From owner-svn-src-all@freebsd.org Sun Aug 6 06:31:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CECFBDC6E20; Sun, 6 Aug 2017 06:31:48 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9EC4874FD5; Sun, 6 Aug 2017 06:31:48 +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 v766Vl7k052961; Sun, 6 Aug 2017 06:31:47 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v766VlJg052960; Sun, 6 Aug 2017 06:31:47 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201708060631.v766VlJg052960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 6 Aug 2017 06:31:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322112 - head/kerberos5/lib/libkafs5 X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/kerberos5/lib/libkafs5 X-SVN-Commit-Revision: 322112 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 06 Aug 2017 06:31:48 -0000 Author: cy Date: Sun Aug 6 06:31:47 2017 New Revision: 322112 URL: https://svnweb.freebsd.org/changeset/base/322112 Log: krb5_err.h is generated from a .et file in kerberos5/lib/libkrb5. As kerberos5/lib/krb5 include files are already referenced it makes no sense to generate it again here. MFC after: 1 month Modified: head/kerberos5/lib/libkafs5/Makefile Modified: head/kerberos5/lib/libkafs5/Makefile ============================================================================== --- head/kerberos5/lib/libkafs5/Makefile Sat Aug 5 23:54:26 2017 (r322111) +++ head/kerberos5/lib/libkafs5/Makefile Sun Aug 6 06:31:47 2017 (r322112) @@ -22,7 +22,7 @@ MLINKS= kafs5.3 k_afs_cell_of_file.3 \ kafs5.3 krb_afslog.3 \ kafs5.3 krb_afslog_uid.3 -SRCS= afssys.c afskrb5.c common.c krb5_err.h +SRCS= afssys.c afskrb5.c common.c CFLAGS+= -I${KRB5DIR}/lib/kafs \ -I${KRB5DIR}/lib/krb5 \ From owner-svn-src-all@freebsd.org Sun Aug 6 06:35:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E1E1DC73DB; Sun, 6 Aug 2017 06:35:42 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0BCF87532B; Sun, 6 Aug 2017 06:35:41 +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 v766Zfo7055992; Sun, 6 Aug 2017 06:35:41 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v766ZfU8055991; Sun, 6 Aug 2017 06:35:41 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201708060635.v766ZfU8055991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 6 Aug 2017 06:35:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322113 - head/kerberos5/libexec/ipropd-master X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/kerberos5/libexec/ipropd-master X-SVN-Commit-Revision: 322113 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 06 Aug 2017 06:35:42 -0000 Author: cy Date: Sun Aug 6 06:35:40 2017 New Revision: 322113 URL: https://svnweb.freebsd.org/changeset/base/322113 Log: Remove dead target introduced in r178828. MFC after: 1 week Modified: head/kerberos5/libexec/ipropd-master/Makefile Modified: head/kerberos5/libexec/ipropd-master/Makefile ============================================================================== --- head/kerberos5/libexec/ipropd-master/Makefile Sun Aug 6 06:31:47 2017 (r322112) +++ head/kerberos5/libexec/ipropd-master/Makefile Sun Aug 6 06:35:40 2017 (r322113) @@ -10,9 +10,6 @@ DPADD= ${LDAPDPADD} LDADD= ${LDAPLDADD} LDFLAGS=${LDAPLDFLAGS} -foo:: - echo ${LIBHX509} - .include .PATH: ${KRB5DIR}/lib/kadm5 From owner-svn-src-all@freebsd.org Sun Aug 6 08:14:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3234ADCABF5; Sun, 6 Aug 2017 08:14:48 +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 mx1.freebsd.org (Postfix) with ESMTPS id EF0397C3CD; Sun, 6 Aug 2017 08:14:47 +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 v768Elwx097195; Sun, 6 Aug 2017 08:14:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v768El16097194; Sun, 6 Aug 2017 08:14:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708060814.v768El16097194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 6 Aug 2017 08:14:47 +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: r322115 - stable/11/sys/dev/ichwd X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/ichwd X-SVN-Commit-Revision: 322115 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 06 Aug 2017 08:14:48 -0000 Author: mav Date: Sun Aug 6 08:14:46 2017 New Revision: 322115 URL: https://svnweb.freebsd.org/changeset/base/322115 Log: MFC r321720, r321856: Attach ichwd(4) only to ISA bus of the LPC bridge. Resource allocation for parent device does not look good by itself, but attempt to allocate them for unrelated device just does not end up good. On Asus X99-E WS/USB3.1 system reporting ISA bridge via both PCI and ACPI this reported to cause kernel panic on shutdown due to messed resources: https://bugs.freenas.org/issues/25237. Modified: stable/11/sys/dev/ichwd/ichwd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/11/sys/dev/ichwd/ichwd.c Sun Aug 6 06:46:44 2017 (r322114) +++ stable/11/sys/dev/ichwd/ichwd.c Sun Aug 6 08:14:46 2017 (r322115) @@ -527,23 +527,29 @@ ichwd_event(void *arg, unsigned int cmd, int *error) } static device_t -ichwd_find_ich_lpc_bridge(struct ichwd_device **id_p) +ichwd_find_ich_lpc_bridge(device_t isa, struct ichwd_device **id_p) { struct ichwd_device *id; - device_t ich = NULL; + device_t isab, pci; + uint16_t devid; - /* look for an ICH LPC interface bridge */ - for (id = ichwd_devices; id->desc != NULL; ++id) - if ((ich = pci_find_device(VENDORID_INTEL, id->device)) != NULL) - break; - - if (ich == NULL) + /* Check whether parent ISA bridge looks familiar. */ + isab = device_get_parent(isa); + pci = device_get_parent(isab); + if (pci == NULL || device_get_devclass(pci) != devclass_find("pci")) return (NULL); + if (pci_get_vendor(isab) != VENDORID_INTEL) + return (NULL); + devid = pci_get_device(isab); + for (id = ichwd_devices; id->desc != NULL; ++id) { + if (devid == id->device) { + if (id_p != NULL) + *id_p = id; + return (isab); + } + } - if (id_p) - *id_p = id; - - return (ich); + return (NULL); } /* @@ -559,7 +565,7 @@ ichwd_identify(driver_t *driver, device_t parent) uint32_t base_address; int rc; - ich = ichwd_find_ich_lpc_bridge(&id_p); + ich = ichwd_find_ich_lpc_bridge(parent, &id_p); if (ich == NULL) return; @@ -612,7 +618,7 @@ ichwd_probe(device_t dev) if (isa_get_logicalid(dev) != 0) return (ENXIO); - if (ichwd_find_ich_lpc_bridge(&id_p) == NULL) + if (ichwd_find_ich_lpc_bridge(device_get_parent(dev), &id_p) == NULL) return (ENXIO); device_set_desc_copy(dev, id_p->desc); @@ -630,7 +636,7 @@ ichwd_attach(device_t dev) sc = device_get_softc(dev); sc->device = dev; - ich = ichwd_find_ich_lpc_bridge(&id_p); + ich = ichwd_find_ich_lpc_bridge(device_get_parent(dev), &id_p); if (ich == NULL) { device_printf(sc->device, "Can not find ICH device.\n"); goto fail; @@ -720,7 +726,6 @@ static int ichwd_detach(device_t dev) { struct ichwd_softc *sc; - device_t ich = NULL; sc = device_get_softc(dev); @@ -745,9 +750,8 @@ ichwd_detach(device_t dev) bus_release_resource(dev, SYS_RES_IOPORT, sc->smi_rid, sc->smi_res); /* deallocate memory resource */ - ich = ichwd_find_ich_lpc_bridge(NULL); - if (sc->gcs_res && ich) - bus_release_resource(ich, SYS_RES_MEMORY, sc->gcs_rid, + if (sc->gcs_res) + bus_release_resource(sc->ich, SYS_RES_MEMORY, sc->gcs_rid, sc->gcs_res); return (0); From owner-svn-src-all@freebsd.org Sun Aug 6 08:15:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72B72DCACA1; Sun, 6 Aug 2017 08:15:22 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4935B7C4F7; Sun, 6 Aug 2017 08:15:22 +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 v768FLZI097279; Sun, 6 Aug 2017 08:15:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v768FLDn097278; Sun, 6 Aug 2017 08:15:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708060815.v768FLDn097278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 6 Aug 2017 08:15:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322116 - stable/10/sys/dev/ichwd X-SVN-Group: stable-10 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/10/sys/dev/ichwd X-SVN-Commit-Revision: 322116 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 06 Aug 2017 08:15:22 -0000 Author: mav Date: Sun Aug 6 08:15:21 2017 New Revision: 322116 URL: https://svnweb.freebsd.org/changeset/base/322116 Log: MFC r321720, r321856: Attach ichwd(4) only to ISA bus of the LPC bridge. Resource allocation for parent device does not look good by itself, but attempt to allocate them for unrelated device just does not end up good. On Asus X99-E WS/USB3.1 system reporting ISA bridge via both PCI and ACPI this reported to cause kernel panic on shutdown due to messed resources: https://bugs.freenas.org/issues/25237. Modified: stable/10/sys/dev/ichwd/ichwd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/10/sys/dev/ichwd/ichwd.c Sun Aug 6 08:14:46 2017 (r322115) +++ stable/10/sys/dev/ichwd/ichwd.c Sun Aug 6 08:15:21 2017 (r322116) @@ -527,23 +527,29 @@ ichwd_event(void *arg, unsigned int cmd, int *error) } static device_t -ichwd_find_ich_lpc_bridge(struct ichwd_device **id_p) +ichwd_find_ich_lpc_bridge(device_t isa, struct ichwd_device **id_p) { struct ichwd_device *id; - device_t ich = NULL; + device_t isab, pci; + uint16_t devid; - /* look for an ICH LPC interface bridge */ - for (id = ichwd_devices; id->desc != NULL; ++id) - if ((ich = pci_find_device(VENDORID_INTEL, id->device)) != NULL) - break; - - if (ich == NULL) + /* Check whether parent ISA bridge looks familiar. */ + isab = device_get_parent(isa); + pci = device_get_parent(isab); + if (pci == NULL || device_get_devclass(pci) != devclass_find("pci")) return (NULL); + if (pci_get_vendor(isab) != VENDORID_INTEL) + return (NULL); + devid = pci_get_device(isab); + for (id = ichwd_devices; id->desc != NULL; ++id) { + if (devid == id->device) { + if (id_p != NULL) + *id_p = id; + return (isab); + } + } - if (id_p) - *id_p = id; - - return (ich); + return (NULL); } /* @@ -559,7 +565,7 @@ ichwd_identify(driver_t *driver, device_t parent) uint32_t base_address; int rc; - ich = ichwd_find_ich_lpc_bridge(&id_p); + ich = ichwd_find_ich_lpc_bridge(parent, &id_p); if (ich == NULL) return; @@ -612,7 +618,7 @@ ichwd_probe(device_t dev) if (isa_get_logicalid(dev) != 0) return (ENXIO); - if (ichwd_find_ich_lpc_bridge(&id_p) == NULL) + if (ichwd_find_ich_lpc_bridge(device_get_parent(dev), &id_p) == NULL) return (ENXIO); device_set_desc_copy(dev, id_p->desc); @@ -630,7 +636,7 @@ ichwd_attach(device_t dev) sc = device_get_softc(dev); sc->device = dev; - ich = ichwd_find_ich_lpc_bridge(&id_p); + ich = ichwd_find_ich_lpc_bridge(device_get_parent(dev), &id_p); if (ich == NULL) { device_printf(sc->device, "Can not find ICH device.\n"); goto fail; @@ -720,7 +726,6 @@ static int ichwd_detach(device_t dev) { struct ichwd_softc *sc; - device_t ich = NULL; sc = device_get_softc(dev); @@ -745,9 +750,8 @@ ichwd_detach(device_t dev) bus_release_resource(dev, SYS_RES_IOPORT, sc->smi_rid, sc->smi_res); /* deallocate memory resource */ - ich = ichwd_find_ich_lpc_bridge(NULL); - if (sc->gcs_res && ich) - bus_release_resource(ich, SYS_RES_MEMORY, sc->gcs_rid, + if (sc->gcs_res) + bus_release_resource(sc->ich, SYS_RES_MEMORY, sc->gcs_rid, sc->gcs_res); return (0); From owner-svn-src-all@freebsd.org Sun Aug 6 10:07:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D605DD0459; Sun, 6 Aug 2017 10:07: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 mx1.freebsd.org (Postfix) with ESMTPS id DF0F07FEBB; Sun, 6 Aug 2017 10:07: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 v76A7PEk042113; Sun, 6 Aug 2017 10:07:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v76A7Pf0042111; Sun, 6 Aug 2017 10:07:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708061007.v76A7Pf0042111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 6 Aug 2017 10:07: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: r322117 - in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 322117 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 06 Aug 2017 10:07:27 -0000 Author: kib Date: Sun Aug 6 10:07:25 2017 New Revision: 322117 URL: https://svnweb.freebsd.org/changeset/base/322117 Log: MFC r321730: Remove unused symbols. Modified: stable/11/sys/amd64/amd64/genassym.c stable/11/sys/i386/i386/genassym.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/genassym.c ============================================================================== --- stable/11/sys/amd64/amd64/genassym.c Sun Aug 6 08:15:21 2017 (r322116) +++ stable/11/sys/amd64/amd64/genassym.c Sun Aug 6 10:07:25 2017 (r322117) @@ -111,12 +111,10 @@ ASSYM(PML4SHIFT, PML4SHIFT); ASSYM(val_KPDPI, KPDPI); ASSYM(val_KPML4I, KPML4I); ASSYM(val_PML4PML4I, PML4PML4I); -ASSYM(USRSTACK, USRSTACK); ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS); ASSYM(KERNBASE, KERNBASE); ASSYM(DMAP_MIN_ADDRESS, DMAP_MIN_ADDRESS); ASSYM(DMAP_MAX_ADDRESS, DMAP_MAX_ADDRESS); -ASSYM(MCLBYTES, MCLBYTES); ASSYM(PCB_R15, offsetof(struct pcb, pcb_r15)); ASSYM(PCB_R14, offsetof(struct pcb, pcb_r14)); Modified: stable/11/sys/i386/i386/genassym.c ============================================================================== --- stable/11/sys/i386/i386/genassym.c Sun Aug 6 08:15:21 2017 (r322116) +++ stable/11/sys/i386/i386/genassym.c Sun Aug 6 10:07:25 2017 (r322117) @@ -115,11 +115,9 @@ ASSYM(PAGE_SHIFT, PAGE_SHIFT); ASSYM(PAGE_MASK, PAGE_MASK); ASSYM(PDRSHIFT, PDRSHIFT); ASSYM(PDRMASK, PDRMASK); -ASSYM(USRSTACK, USRSTACK); ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS); ASSYM(KERNBASE, KERNBASE); ASSYM(KERNLOAD, KERNLOAD); -ASSYM(MCLBYTES, MCLBYTES); ASSYM(PCB_CR0, offsetof(struct pcb, pcb_cr0)); ASSYM(PCB_CR2, offsetof(struct pcb, pcb_cr2)); ASSYM(PCB_CR3, offsetof(struct pcb, pcb_cr3)); From owner-svn-src-all@freebsd.org Sun Aug 6 11:39:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AC63DD4B1F; Sun, 6 Aug 2017 11:39:29 +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 E15DB82816; Sun, 6 Aug 2017 11:39:28 +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 6FAF51047DC3; Sun, 6 Aug 2017 21:39:19 +1000 (AEST) Date: Sun, 6 Aug 2017 21:39:18 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r321920 - head/sys/sys In-Reply-To: <20170805074243.GX1700@kib.kiev.ua> Message-ID: <20170806213334.V1366@besplex.bde.org> References: <201708021014.v72AEHEk061037@repo.freebsd.org> <37abc595-c80e-a8da-04a8-815f42c634de@selasky.org> <20170802135455.GG1700@kib.kiev.ua> <20170803122015.Q1093@besplex.bde.org> <20170803075747.GJ1700@kib.kiev.ua> <20170803180419.R2314@besplex.bde.org> <20170803120729.GO1700@kib.kiev.ua> <20170805112924.W1055@besplex.bde.org> <20170805074243.GX1700@kib.kiev.ua> 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=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=RFnRnYDGFsOq-WPcPKwA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 06 Aug 2017 11:39:29 -0000 On Sat, 5 Aug 2017, Konstantin Belousov wrote: > On Sat, Aug 05, 2017 at 12:26:03PM +1000, Bruce Evans wrote: >>> +#define minor(x) ((int)(x)) >> >> Another nice simplification. Strictly, it should be (int)(dev_t)(x) since >> the pseudo-prototype says that the arg is converted to dev_t, but yesterday >> I couldn't see any differences even for exotic x and exotic arches. >> >> Today I can see some difference for exotic x and perverse implementations. >> E.g., x with extra bits in a large signed integer type to invoke >> implementation-defined behaviour, and a perverse implementation that >> truncates to 0 for direct conversion to int but does the right thing >> for indirect conversion). But we depend on the implementation doing >> the right thing for other casts to int. >> >> Also, if dev_t == uintptr_t, it is valid for the caller to keep dev_t's >> in void *'s internally but not to pass void * to minor() or major() >> according to the prototype. However, casting in the macros breaks the >> warning for this. I think pure macros should not cast their args or >> pretend to have prototypes, but require callers to pass args of supported >> types. The old dev_t macros were closer to this -- they have expressions >> like ((x) << 8) which will fail if x is not an integral type or give >> wrong results ix x has extra bits. > So you are arguing to keep the & 0xffffffff operation ? No, I don't want to go that deep. > I think this is not needed, since your note about cast being equivalent > holds for all supported architectures and I do not see anywhere a contract > for the operations to work on non-dev_t. The pseudo-prototypes look like they provide such a contract. They must be read sort of backwards as saying that it is the caller's responsibility to pass args of the type in the pseudo-prototype, like for a K&R function or a C90 function with prototype is in scope. > So are you fine with the posted patch to sys/types.h ? OK. Bruce From owner-svn-src-all@freebsd.org Sun Aug 6 12:27:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE8E5DD7829; Sun, 6 Aug 2017 12:27:21 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9D02384596; Sun, 6 Aug 2017 12:27:21 +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 v76CRKsI099109; Sun, 6 Aug 2017 12:27:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v76CRKmp099108; Sun, 6 Aug 2017 12:27:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708061227.v76CRKmp099108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 6 Aug 2017 12:27:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322118 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 322118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 06 Aug 2017 12:27:21 -0000 Author: kib Date: Sun Aug 6 12:27:20 2017 New Revision: 322118 URL: https://svnweb.freebsd.org/changeset/base/322118 Log: Remove trivial comments. Remove and-ing with UINT_MAX for minor(), cast to int already does the required truncation of significant bits. Requested and reviewed by: bde Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/types.h Modified: head/sys/sys/types.h ============================================================================== --- head/sys/sys/types.h Sun Aug 6 10:07:25 2017 (r322117) +++ head/sys/sys/types.h Sun Aug 6 12:27:20 2017 (r322118) @@ -364,9 +364,9 @@ __bitcount64(__uint64_t _x) #include -#define major(x) ((int)((dev_t)(x) >> 32)) /* major number */ -#define minor(x) ((int)((x) & 0xffffffff)) /* minor number */ -#define makedev(x, y) (((dev_t)(x) << 32) | (unsigned)(y)) /* create dev_t */ +#define major(x) ((int)((dev_t)(x) >> 32)) +#define minor(x) ((int)(x)) +#define makedev(x, y) (((dev_t)(x) << 32) | (unsigned)(y)) /* * These declarations belong elsewhere, but are repeated here and in From owner-svn-src-all@freebsd.org Sun Aug 6 16:07:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4A61DB7BBB; Sun, 6 Aug 2017 16:07:26 +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 mx1.freebsd.org (Postfix) with ESMTPS id 467A764C86; Sun, 6 Aug 2017 16:07:26 +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 v76G7PqZ087655; Sun, 6 Aug 2017 16:07:25 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v76G7PYp087652; Sun, 6 Aug 2017 16:07:25 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708061607.v76G7PYp087652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 6 Aug 2017 16:07: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: r322119 - in stable/11/sys/dev: mmc sdhci X-SVN-Group: stable-11 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/11/sys/dev: mmc sdhci X-SVN-Commit-Revision: 322119 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 06 Aug 2017 16:07:27 -0000 Author: marius Date: Sun Aug 6 16:07:25 2017 New Revision: 322119 URL: https://svnweb.freebsd.org/changeset/base/322119 Log: MFC: r319350, r321385, r321490, r321588, r321948 o Use SDHCI_CAN_DRIVE_TYPE_{A,C,D} to check for driver type support in SDHCI_CAPABILITIES2 instead of SDHCI_CTRL2_DRIVER_TYPE_{A,C,D} which are meant for setting the driver type in SDHCI_HOST_CONTROL2. o Add support for eMMC HS200 and HS400 bus speed modes at 200 MHz to sdhci(4), mmc(4) and mmcsd(4). On the system where the addition of DDR52 support increased the read throughput to ~80 MB/s (from ~45 MB/s at high speed), HS200 yields ~154 MB/s and HS400 ~187 MB/s, i. e. performance now has more than quadrupled compared to pre-r315598 (pre-r318494 in stable/11). However, in fact this isn't a feature-only change; there are boards based on Intel Bay Trail where DDR52 is problematic and the suggested workaround is to use HS200 mode instead. So far exact details are unknown, however, i. e. whether that's due to a defect in these SoCs or on the boards. Moreover, due to the above changes requiring to be aware of possible MMC siblings in the fast path of mmc(4), corresponding information now is cached in mmc_softc. As a side-effect, mmc_calculate_clock(), now longer will trigger a panic in low memory situations and all of mmc(4) operate on the same set of child devices. o Fix a bug in the failure reporting of mmcsd_delete() that could lead to a panic. o Fix 2 bugs on resume, one in mmcsd(4) that could lead to a panic and another one in mmc(4) that could lead to devices no longer working. o Fix a memory leak in mmcsd_ioctl() in case copyin(9) fails. [1] o Fix missing variable initialization in mmc_switch_status(). [2] o Fix R1_SWITCH_ERROR detection in mmc_switch_status(). [3] o Handle the case of device_add_child(9) failing, for example due to a memory shortage, gracefully in mmc(4) and sdhci(4), including not leaking memory for the instance variables in case of mmc(4), also fixing [4]. o Correctly use the size of a pointer rather than that of a pointer to a pointer (this bug was present in head r321385 only, i. e. not in a stable branch). [5] o Handle the case of an unknown SD CSD version in mmc_decode_csd_sd() gracefully instead of calling panic(9). o Again, check and handle the return values of some additional function calls in mmc(4) instead of assuming that everything went right or mark non-fatal errors by casting the return value to void. o Correct a typo in the Linux IOCTL compatibility; it should have been MMC_IOC_MULTI_CMD rather than MMC_IOC_CMD_MULTI. o Now that we are reaching ever faster speeds (more improvement in this regard is to be expected when adding ADMA support to sdhci(4)), apply a few micro-optimizations to mmc(4), mmcsd(4) and sdhci(4). o Correct confusing and error prone mix-ups between "br" or "bridge" in mmc(4) and mmcsd(4) where - according to the terminology outlined in comments of bridge.h and mmcbr_if.m around since their addition in r163516 - the bus is meant and used instead. o Remove comment lines from bridge.h incorrectly suggesting that there would be a MMC bridge base class driver. o Update comments in bridge.h regarding the star topology of SD and SDIO; since version 3.00 of the SDHCI specification, for eSD and eSDIO bus topologies are actually possible in form of so called "shared buses" (in some subcontext later on renamed to "embedded" buses). Reported by: Coverity CID: 1372612 [1], 1372624 [2], 1372594 [3], 1007069 [4], 1378432 [5] Modified: stable/11/sys/dev/mmc/bridge.h stable/11/sys/dev/mmc/mmc.c stable/11/sys/dev/mmc/mmc_ioctl.h stable/11/sys/dev/mmc/mmc_private.h stable/11/sys/dev/mmc/mmc_subr.c stable/11/sys/dev/mmc/mmc_subr.h stable/11/sys/dev/mmc/mmcbr_if.m stable/11/sys/dev/mmc/mmcbrvar.h stable/11/sys/dev/mmc/mmcbus_if.m stable/11/sys/dev/mmc/mmcreg.h stable/11/sys/dev/mmc/mmcsd.c stable/11/sys/dev/sdhci/sdhci.c stable/11/sys/dev/sdhci/sdhci.h stable/11/sys/dev/sdhci/sdhci_acpi.c stable/11/sys/dev/sdhci/sdhci_if.m stable/11/sys/dev/sdhci/sdhci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mmc/bridge.h ============================================================================== --- stable/11/sys/dev/mmc/bridge.h Sun Aug 6 12:27:20 2017 (r322118) +++ stable/11/sys/dev/mmc/bridge.h Sun Aug 6 16:07:25 2017 (r322119) @@ -65,12 +65,10 @@ * linux/mmc/host.h file. * * A mmc bridge is a chipset that can have one or more mmc and/or sd - * cards attached to it. mmc cards are attached on a bus topology, - * while sd and sdio cards are attached using a star topology (meaning - * in practice each sd card has its own, independent slot). Each - * mmcbr is assumed to be derived from the mmcbr. This is done to - * allow for easier addition of bridges (as each bridge does not need - * to be added to the mmcbus file). + * cards attached to it. mmc devices are attached on a bus topology, + * while sd and sdio cards usually are attached using a star topology + * (meaning in practice each sd card has its own, independent slot). + * Since SDHCI v3.00, buses for esd and esdio are possible, though. * * Attached to the mmc bridge is an mmcbus. The mmcbus is described * in dev/mmc/mmcbus_if.m. @@ -137,6 +135,10 @@ enum mmc_card_mode { mode_mmc, mode_sd }; +enum mmc_retune_req { + retune_req_none = 0, retune_req_normal, retune_req_reset +}; + struct mmc_host { int f_min; int f_max; @@ -177,7 +179,7 @@ struct mmc_host { extern driver_t mmc_driver; extern devclass_t mmc_devclass; -#define MMC_VERSION 3 +#define MMC_VERSION 4 #define MMC_DECLARE_BRIDGE(name) \ DRIVER_MODULE(mmc, name, mmc_driver, mmc_devclass, NULL, NULL); \ Modified: stable/11/sys/dev/mmc/mmc.c ============================================================================== --- stable/11/sys/dev/mmc/mmc.c Sun Aug 6 12:27:20 2017 (r322118) +++ stable/11/sys/dev/mmc/mmc.c Sun Aug 6 16:07:25 2017 (r322119) @@ -88,14 +88,14 @@ struct mmc_ivars { uint8_t raw_ext_csd[MMC_EXTCSD_SIZE]; /* Raw bits of the EXT_CSD */ uint32_t raw_sd_status[16]; /* Raw bits of the SD_STATUS */ uint16_t rca; + u_char read_only; /* True when the device is read-only */ + u_char high_cap; /* High Capacity device (block addressed) */ enum mmc_card_mode mode; + enum mmc_bus_width bus_width; /* Bus width to use */ struct mmc_cid cid; /* cid decoded */ struct mmc_csd csd; /* csd decoded */ struct mmc_scr scr; /* scr decoded */ struct mmc_sd_status sd_status; /* SD_STATUS decoded */ - u_char read_only; /* True when the device is read-only */ - u_char bus_width; /* Bus width to use */ - u_char high_cap; /* High Capacity card (block addressed) */ uint32_t sec_count; /* Card capacity in 512byte blocks */ uint32_t timings; /* Mask of bus timings supported */ uint32_t vccq_120; /* Mask of bus timings at VCCQ of 1.2 V */ @@ -127,8 +127,10 @@ static int mmc_read_ivar(device_t bus, device_t child, uintptr_t *result); static int mmc_release_bus(device_t busdev, device_t dev); static int mmc_resume(device_t dev); +static void mmc_retune_pause(device_t busdev, device_t dev, bool retune); +static void mmc_retune_unpause(device_t busdev, device_t dev); static int mmc_suspend(device_t dev); -static int mmc_wait_for_request(device_t brdev, device_t reqdev, +static int mmc_wait_for_request(device_t busdev, device_t dev, struct mmc_request *req); static int mmc_write_ivar(device_t bus, device_t child, int which, uintptr_t value); @@ -155,21 +157,23 @@ static void mmc_decode_cid_mmc(uint32_t *raw_cid, stru bool is_4_41p); static void mmc_decode_cid_sd(uint32_t *raw_cid, struct mmc_cid *cid); static void mmc_decode_csd_mmc(uint32_t *raw_csd, struct mmc_csd *csd); -static void mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd); +static int mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd); static void mmc_delayed_attach(void *xsc); -static int mmc_delete_cards(struct mmc_softc *sc); +static int mmc_delete_cards(struct mmc_softc *sc, bool final); static void mmc_discover_cards(struct mmc_softc *sc); static void mmc_format_card_id_string(struct mmc_ivars *ivar); static void mmc_go_discovery(struct mmc_softc *sc); static uint32_t mmc_get_bits(uint32_t *bits, int bit_len, int start, int size); static int mmc_highest_voltage(uint32_t ocr); +static bool mmc_host_timing(device_t dev, enum mmc_bus_timing timing); static void mmc_idle_cards(struct mmc_softc *sc); static void mmc_ms_delay(int ms); static void mmc_log_card(device_t dev, struct mmc_ivars *ivar, int newcard); static void mmc_power_down(struct mmc_softc *sc); static void mmc_power_up(struct mmc_softc *sc); static void mmc_rescan_cards(struct mmc_softc *sc); +static int mmc_retune(device_t busdev, device_t dev, bool reset); static void mmc_scan(struct mmc_softc *sc); static int mmc_sd_switch(struct mmc_softc *sc, uint8_t mode, uint8_t grp, uint8_t value, uint8_t *res); @@ -183,15 +187,23 @@ static int mmc_send_op_cond(struct mmc_softc *sc, uint uint32_t *rocr); static int mmc_send_relative_addr(struct mmc_softc *sc, uint32_t *resp); static int mmc_set_blocklen(struct mmc_softc *sc, uint32_t len); -static int mmc_set_card_bus_width(struct mmc_softc *sc, struct mmc_ivars *ivar); +static int mmc_set_card_bus_width(struct mmc_softc *sc, struct mmc_ivars *ivar, + enum mmc_bus_timing timing); static int mmc_set_power_class(struct mmc_softc *sc, struct mmc_ivars *ivar); static int mmc_set_relative_addr(struct mmc_softc *sc, uint16_t resp); static int mmc_set_timing(struct mmc_softc *sc, struct mmc_ivars *ivar, enum mmc_bus_timing timing); +static int mmc_set_vccq(struct mmc_softc *sc, struct mmc_ivars *ivar, + enum mmc_bus_timing timing); +static int mmc_switch_to_hs200(struct mmc_softc *sc, struct mmc_ivars *ivar, + uint32_t clock); +static int mmc_switch_to_hs400(struct mmc_softc *sc, struct mmc_ivars *ivar, + uint32_t max_dtr, enum mmc_bus_timing max_timing); static int mmc_test_bus_width(struct mmc_softc *sc); static uint32_t mmc_timing_to_dtr(struct mmc_ivars *ivar, enum mmc_bus_timing timing); static const char *mmc_timing_to_string(enum mmc_bus_timing timing); +static void mmc_update_child_list(struct mmc_softc *sc); static int mmc_wait_for_command(struct mmc_softc *sc, uint32_t opcode, uint32_t arg, uint32_t flags, uint32_t *resp, int retries); static int mmc_wait_for_req(struct mmc_softc *sc, struct mmc_request *req); @@ -235,7 +247,8 @@ mmc_detach(device_t dev) struct mmc_softc *sc = device_get_softc(dev); int err; - if ((err = mmc_delete_cards(sc)) != 0) + err = mmc_delete_cards(sc, true); + if (err != 0) return (err); mmc_power_down(sc); MMC_LOCK_DESTROY(sc); @@ -250,10 +263,21 @@ mmc_suspend(device_t dev) int err; err = bus_generic_suspend(dev); - if (err) + if (err != 0) return (err); + /* + * We power down with the bus acquired here, mainly so that no device + * is selected any longer and sc->last_rca gets set to 0. Otherwise, + * the deselect as part of the bus acquisition in mmc_scan() may fail + * during resume, as the bus isn't powered up again before later in + * mmc_go_discovery(). + */ + err = mmc_acquire_bus(dev, dev); + if (err != 0) + return (err); mmc_power_down(sc); - return (0); + err = mmc_release_bus(dev, dev); + return (err); } static int @@ -270,7 +294,8 @@ mmc_acquire_bus(device_t busdev, device_t dev) { struct mmc_softc *sc; struct mmc_ivars *ivar; - int err, rca; + int err; + uint16_t rca; enum mmc_bus_timing timing; err = MMCBR_ACQUIRE_HOST(device_get_parent(busdev), busdev); @@ -294,12 +319,27 @@ mmc_acquire_bus(device_t busdev, device_t dev) rca = ivar->rca; if (sc->last_rca != rca) { if (mmc_select_card(sc, rca) != MMC_ERR_NONE) { - device_printf(sc->dev, "Card at relative " - "address %d failed to select.\n", rca); + device_printf(busdev, "Card at relative " + "address %d failed to select\n", rca); return (ENXIO); } sc->last_rca = rca; timing = mmcbr_get_timing(busdev); + /* + * For eMMC modes, setting/updating bus width and VCCQ + * only really is necessary if there actually is more + * than one device on the bus as generally that already + * had to be done by mmc_calculate_clock() or one of + * its calees. Moreover, setting the bus width anew + * can trigger re-tuning (via a CRC error on the next + * CMD), even if not switching between devices an the + * previously selected one is still tuned. Obviously, + * we need to re-tune the host controller if devices + * are actually switched, though. + */ + if (timing >= bus_timing_mmc_ddr52 && + sc->child_count == 1) + return (0); /* Prepare bus width for the new card. */ if (bootverbose || mmc_debug) { device_printf(busdev, @@ -308,38 +348,34 @@ mmc_acquire_bus(device_t busdev, device_t dev) (ivar->bus_width == bus_width_8) ? 8 : 1, mmc_timing_to_string(timing)); } - if (mmc_set_card_bus_width(sc, ivar) != MMC_ERR_NONE) { - device_printf(sc->dev, "Card at relative " - "address %d failed to set bus width.\n", + if (mmc_set_card_bus_width(sc, ivar, timing) != + MMC_ERR_NONE) { + device_printf(busdev, "Card at relative " + "address %d failed to set bus width\n", rca); return (ENXIO); } - if (isset(&ivar->vccq_120, timing)) - mmcbr_set_vccq(busdev, vccq_120); - else if (isset(&ivar->vccq_180, timing)) - mmcbr_set_vccq(busdev, vccq_180); - else - mmcbr_set_vccq(busdev, vccq_330); - if (mmcbr_switch_vccq(busdev) != 0) { - device_printf(sc->dev, "Failed to set VCCQ " - "for card at relative address %d.\n", rca); + mmcbr_set_bus_width(busdev, ivar->bus_width); + mmcbr_update_ios(busdev); + if (mmc_set_vccq(sc, ivar, timing) != MMC_ERR_NONE) { + device_printf(busdev, "Failed to set VCCQ " + "for card at relative address %d\n", rca); return (ENXIO); } - if (mmc_set_power_class(sc, ivar) != MMC_ERR_NONE) { - device_printf(sc->dev, "Card at relative " - "address %d failed to set power class.\n", - rca); + if (timing >= bus_timing_mmc_hs200 && + mmc_retune(busdev, dev, true) != 0) { + device_printf(busdev, "Card at relative " + "address %d failed to re-tune\n", rca); return (ENXIO); } - mmcbr_set_bus_width(busdev, ivar->bus_width); - mmcbr_update_ios(busdev); } } else { /* * If there's a card selected, stand down. */ if (sc->last_rca != 0) { - mmc_select_card(sc, 0); + if (mmc_select_card(sc, 0) != MMC_ERR_NONE) + return (ENXIO); sc->last_rca = 0; } } @@ -407,7 +443,7 @@ mmc_wait_for_req(struct mmc_softc *sc, struct mmc_requ req->done = mmc_wakeup; req->done_data = sc; - if (mmc_debug > 1) { + if (__predict_false(mmc_debug > 1)) { device_printf(sc->dev, "REQUEST: CMD%d arg %#x flags %#x", req->cmd->opcode, req->cmd->arg, req->cmd->flags); if (req->cmd->data) { @@ -420,18 +456,66 @@ mmc_wait_for_req(struct mmc_softc *sc, struct mmc_requ while ((req->flags & MMC_REQ_DONE) == 0) msleep(req, &sc->sc_mtx, 0, "mmcreq", 0); MMC_UNLOCK(sc); - if (mmc_debug > 2 || (mmc_debug > 0 && req->cmd->error != MMC_ERR_NONE)) + if (__predict_false(mmc_debug > 2 || (mmc_debug > 0 && + req->cmd->error != MMC_ERR_NONE))) device_printf(sc->dev, "CMD%d RESULT: %d\n", req->cmd->opcode, req->cmd->error); return (0); } static int -mmc_wait_for_request(device_t brdev, device_t reqdev __unused, - struct mmc_request *req) +mmc_wait_for_request(device_t busdev, device_t dev, struct mmc_request *req) { - struct mmc_softc *sc = device_get_softc(brdev); + struct mmc_softc *sc; + struct mmc_ivars *ivar; + int err, i; + enum mmc_retune_req retune_req; + sc = device_get_softc(busdev); + KASSERT(sc->owner != NULL, + ("%s: Request from %s without bus being acquired.", __func__, + device_get_nameunit(dev))); + + /* + * Unless no device is selected or re-tuning is already ongoing, + * execute re-tuning if a) the bridge is requesting to do so and + * re-tuning hasn't been otherwise paused, or b) if a child asked + * to be re-tuned prior to pausing (see also mmc_retune_pause()). + */ + if (__predict_false(sc->last_rca != 0 && sc->retune_ongoing == 0 && + (((retune_req = mmcbr_get_retune_req(busdev)) != retune_req_none && + sc->retune_paused == 0) || sc->retune_needed == 1))) { + if (__predict_false(mmc_debug > 1)) { + device_printf(busdev, + "Re-tuning with%s circuit reset required\n", + retune_req == retune_req_reset ? "" : "out"); + } + if (device_get_parent(dev) == busdev) + ivar = device_get_ivars(dev); + else { + for (i = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); + if (ivar->rca == sc->last_rca) + break; + } + if (ivar->rca != sc->last_rca) + return (EINVAL); + } + sc->retune_ongoing = 1; + err = mmc_retune(busdev, dev, retune_req == retune_req_reset); + sc->retune_ongoing = 0; + switch (err) { + case MMC_ERR_NONE: + case MMC_ERR_FAILED: /* Re-tune error but still might work */ + break; + case MMC_ERR_BADCRC: /* Switch failure on HS400 recovery */ + return (ENXIO); + case MMC_ERR_INVALID: /* Driver implementation b0rken */ + default: /* Unknown error, should not happen */ + return (EINVAL); + } + sc->retune_needed = 0; + } return (mmc_wait_for_req(sc, req)); } @@ -599,11 +683,14 @@ mmc_power_down(struct mmc_softc *sc) static int mmc_select_card(struct mmc_softc *sc, uint16_t rca) { - int flags; + int err, flags; flags = (rca ? MMC_RSP_R1B : MMC_RSP_NONE) | MMC_CMD_AC; - return (mmc_wait_for_command(sc, MMC_SELECT_CARD, (uint32_t)rca << 16, - flags, NULL, CMD_RETRIES)); + sc->retune_paused++; + err = mmc_wait_for_command(sc, MMC_SELECT_CARD, (uint32_t)rca << 16, + flags, NULL, CMD_RETRIES); + sc->retune_paused--; + return (err); } static int @@ -635,7 +722,8 @@ mmc_sd_switch(struct mmc_softc *sc, uint8_t mode, uint } static int -mmc_set_card_bus_width(struct mmc_softc *sc, struct mmc_ivars *ivar) +mmc_set_card_bus_width(struct mmc_softc *sc, struct mmc_ivars *ivar, + enum mmc_bus_timing timing) { struct mmc_command cmd; int err; @@ -668,28 +756,33 @@ mmc_set_card_bus_width(struct mmc_softc *sc, struct mm } else { switch (ivar->bus_width) { case bus_width_1: + if (timing == bus_timing_mmc_hs400 || + timing == bus_timing_mmc_hs400es) + return (MMC_ERR_INVALID); value = EXT_CSD_BUS_WIDTH_1; break; case bus_width_4: - switch (mmcbr_get_timing(sc->dev)) { + switch (timing) { case bus_timing_mmc_ddr52: - case bus_timing_mmc_hs200: - case bus_timing_mmc_hs400: - case bus_timing_mmc_hs400es: value = EXT_CSD_BUS_WIDTH_4_DDR; break; + case bus_timing_mmc_hs400: + case bus_timing_mmc_hs400es: + return (MMC_ERR_INVALID); default: value = EXT_CSD_BUS_WIDTH_4; break; } break; case bus_width_8: - switch (mmcbr_get_timing(sc->dev)) { + value = 0; + switch (timing) { + case bus_timing_mmc_hs400es: + value = EXT_CSD_BUS_WIDTH_ES; + /* FALLTHROUGH */ case bus_timing_mmc_ddr52: - case bus_timing_mmc_hs200: case bus_timing_mmc_hs400: - case bus_timing_mmc_hs400es: - value = EXT_CSD_BUS_WIDTH_8_DDR; + value |= EXT_CSD_BUS_WIDTH_8_DDR; break; default: value = EXT_CSD_BUS_WIDTH_8; @@ -814,6 +907,13 @@ mmc_set_timing(struct mmc_softc *sc, struct mmc_ivars case bus_timing_mmc_ddr52: value = EXT_CSD_HS_TIMING_HS; break; + case bus_timing_mmc_hs200: + value = EXT_CSD_HS_TIMING_HS200; + break; + case bus_timing_mmc_hs400: + case bus_timing_mmc_hs400es: + value = EXT_CSD_HS_TIMING_HS400; + break; default: return (MMC_ERR_INVALID); } @@ -830,6 +930,23 @@ mmc_set_timing(struct mmc_softc *sc, struct mmc_ivars return (err); } +static int +mmc_set_vccq(struct mmc_softc *sc, struct mmc_ivars *ivar, + enum mmc_bus_timing timing) +{ + + if (isset(&ivar->vccq_120, timing)) + mmcbr_set_vccq(sc->dev, vccq_120); + else if (isset(&ivar->vccq_180, timing)) + mmcbr_set_vccq(sc->dev, vccq_180); + else + mmcbr_set_vccq(sc->dev, vccq_330); + if (mmcbr_switch_vccq(sc->dev) != 0) + return (MMC_ERR_INVALID); + else + return (MMC_ERR_NONE); +} + static const uint8_t p8[8] = { 0x55, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -1037,7 +1154,7 @@ static const int cur_max[8] = { 1000, 5000, 10000, 25000, 35000, 45000, 800000, 200000 }; -static void +static int mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd) { int v; @@ -1078,6 +1195,7 @@ mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *c csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3); csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4); csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1); + return (MMC_ERR_NONE); } else if (v == 1) { m = mmc_get_bits(raw_csd, 128, 115, 4); e = mmc_get_bits(raw_csd, 128, 112, 3); @@ -1101,8 +1219,9 @@ mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *c csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3); csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4); csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1); - } else - panic("unknown SD CSD version"); + return (MMC_ERR_NONE); + } + return (MMC_ERR_INVALID); } static void @@ -1366,6 +1485,53 @@ mmc_timing_to_string(enum mmc_bus_timing timing) return (""); } +static bool +mmc_host_timing(device_t dev, enum mmc_bus_timing timing) +{ + int host_caps; + + host_caps = mmcbr_get_caps(dev); + +#define HOST_TIMING_CAP(host_caps, cap) ({ \ + bool retval; \ + if (((host_caps) & (cap)) == (cap)) \ + retval = true; \ + else \ + retval = false; \ + retval; \ +}) + + switch (timing) { + case bus_timing_normal: + return (true); + case bus_timing_hs: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_HSPEED)); + case bus_timing_uhs_sdr12: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_SDR12)); + case bus_timing_uhs_sdr25: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_SDR25)); + case bus_timing_uhs_ddr50: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_DDR50)); + case bus_timing_uhs_sdr50: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_SDR50)); + case bus_timing_uhs_sdr104: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_SDR104)); + case bus_timing_mmc_ddr52: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_DDR52)); + case bus_timing_mmc_hs200: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS200)); + case bus_timing_mmc_hs400: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS400)); + case bus_timing_mmc_hs400es: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS400 | + MMC_CAP_MMC_ENH_STROBE)); + } + +#undef HOST_TIMING_CAP + + return (false); +} + static void mmc_log_card(device_t dev, struct mmc_ivars *ivar, int newcard) { @@ -1397,9 +1563,8 @@ mmc_discover_cards(struct mmc_softc *sc) u_char switch_res[64]; uint32_t raw_cid[4]; struct mmc_ivars *ivar = NULL; - device_t *devlist; device_t child; - int devcount, err, host_caps, i, newcard; + int err, host_caps, i, newcard; uint32_t resp, sec_count, status; uint16_t rca = 2; @@ -1407,6 +1572,7 @@ mmc_discover_cards(struct mmc_softc *sc) if (bootverbose || mmc_debug) device_printf(sc->dev, "Probing cards\n"); while (1) { + child = NULL; sc->squelched++; /* Errors are expected, squelch reporting. */ err = mmc_all_send_cid(sc, raw_cid); sc->squelched--; @@ -1417,18 +1583,14 @@ mmc_discover_cards(struct mmc_softc *sc) break; } newcard = 1; - if ((err = device_get_children(sc->dev, &devlist, - &devcount)) != 0) - return; - for (i = 0; i < devcount; i++) { - ivar = device_get_ivars(devlist[i]); + for (i = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); if (memcmp(ivar->raw_cid, raw_cid, sizeof(raw_cid)) == 0) { newcard = 0; break; } } - free(devlist, M_TEMP); if (bootverbose || mmc_debug) { device_printf(sc->dev, "%sard detected (CID %08x%08x%08x%08x)\n", @@ -1451,7 +1613,7 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error getting RCA %d\n", err); - break; + goto free_ivar; } ivar->rca = resp >> 16; /* Get card CSD. */ @@ -1459,7 +1621,7 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error getting CSD %d\n", err); - break; + goto free_ivar; } if (bootverbose || mmc_debug) device_printf(sc->dev, @@ -1467,7 +1629,11 @@ mmc_discover_cards(struct mmc_softc *sc) newcard ? "New c" : "C", ivar->raw_csd[0], ivar->raw_csd[1], ivar->raw_csd[2], ivar->raw_csd[3]); - mmc_decode_csd_sd(ivar->raw_csd, &ivar->csd); + err = mmc_decode_csd_sd(ivar->raw_csd, &ivar->csd); + if (err != MMC_ERR_NONE) { + device_printf(sc->dev, "Error decoding CSD\n"); + goto free_ivar; + } ivar->sec_count = ivar->csd.capacity / MMC_SECTOR_SIZE; if (ivar->csd.csd_structure > 0) ivar->high_cap = 1; @@ -1480,12 +1646,12 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error reading card status %d\n", err); - break; + goto free_ivar; } if ((status & R1_CARD_IS_LOCKED) != 0) { device_printf(sc->dev, - "Card is password protected, skipping.\n"); - break; + "Card is password protected, skipping\n"); + goto free_ivar; } /* Get card SCR. Card must be selected to fetch it. */ @@ -1493,13 +1659,13 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error selecting card %d\n", err); - break; + goto free_ivar; } err = mmc_app_send_scr(sc, ivar->rca, ivar->raw_scr); if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error reading SCR %d\n", err); - break; + goto free_ivar; } mmc_app_decode_scr(ivar->raw_scr, &ivar->scr); /* Get card switch capabilities (command class 10). */ @@ -1527,7 +1693,7 @@ mmc_discover_cards(struct mmc_softc *sc) * use from the sd_status is the erase sector size, but * it is still nice to get that right. */ - mmc_select_card(sc, 0); + (void)mmc_select_card(sc, 0); (void)mmc_select_card(sc, ivar->rca); (void)mmc_app_sd_status(sc, ivar->rca, ivar->raw_sd_status); @@ -1537,47 +1703,24 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->erase_sector = 16 << ivar->sd_status.au_size; } - /* Find max supported bus width. */ + /* Find maximum supported bus width. */ if ((host_caps & MMC_CAP_4_BIT_DATA) && (ivar->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) ivar->bus_width = bus_width_4; - /* - * Some cards that report maximum I/O block sizes - * greater than 512 require the block length to be - * set to 512, even though that is supposed to be - * the default. Example: - * - * Transcend 2GB SDSC card, CID: - * mid=0x1b oid=0x534d pnm="00000" prv=1.0 mdt=00.2000 - */ - if (ivar->csd.read_bl_len != MMC_SECTOR_SIZE || - ivar->csd.write_bl_len != MMC_SECTOR_SIZE) - mmc_set_blocklen(sc, MMC_SECTOR_SIZE); - - mmc_format_card_id_string(ivar); - - if (bootverbose || mmc_debug) - mmc_log_card(sc->dev, ivar, newcard); - if (newcard) { - /* Add device. */ - child = device_add_child(sc->dev, NULL, -1); - device_set_ivars(child, ivar); - } - mmc_select_card(sc, 0); - return; + goto child_common; } ivar->rca = rca++; err = mmc_set_relative_addr(sc, ivar->rca); if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error setting RCA %d\n", err); - break; + goto free_ivar; } /* Get card CSD. */ err = mmc_send_csd(sc, ivar->rca, ivar->raw_csd); if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error getting CSD %d\n", err); - break; + goto free_ivar; } if (bootverbose || mmc_debug) device_printf(sc->dev, @@ -1596,19 +1739,19 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error reading card status %d\n", err); - break; + goto free_ivar; } if ((status & R1_CARD_IS_LOCKED) != 0) { device_printf(sc->dev, - "Card is password protected, skipping.\n"); - break; + "Card is password protected, skipping\n"); + goto free_ivar; } err = mmc_select_card(sc, ivar->rca); if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error selecting card %d\n", err); - break; + goto free_ivar; } /* Only MMC >= 4.x devices support EXT_CSD. */ @@ -1618,7 +1761,7 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error reading EXT_CSD %d\n", err); - break; + goto free_ivar; } /* Handle extended capacity from EXT_CSD */ sec_count = ivar->raw_ext_csd[EXT_CSD_SEC_CNT] + @@ -1629,6 +1772,8 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->sec_count = sec_count; ivar->high_cap = 1; } + /* Find maximum supported bus width. */ + ivar->bus_width = mmc_test_bus_width(sc); /* Get device speeds beyond normal mode. */ if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_HS_52) != 0) { @@ -1651,6 +1796,50 @@ mmc_discover_cards(struct mmc_softc *sc) setbit(&ivar->timings, bus_timing_mmc_ddr52); setbit(&ivar->vccq_180, bus_timing_mmc_ddr52); } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS200_1_2V) != 0 && + (host_caps & MMC_CAP_SIGNALING_120) != 0) { + setbit(&ivar->timings, bus_timing_mmc_hs200); + setbit(&ivar->vccq_120, bus_timing_mmc_hs200); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS200_1_8V) != 0 && + (host_caps & MMC_CAP_SIGNALING_180) != 0) { + setbit(&ivar->timings, bus_timing_mmc_hs200); + setbit(&ivar->vccq_180, bus_timing_mmc_hs200); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS400_1_2V) != 0 && + (host_caps & MMC_CAP_SIGNALING_120) != 0 && + ivar->bus_width == bus_width_8) { + setbit(&ivar->timings, bus_timing_mmc_hs400); + setbit(&ivar->vccq_120, bus_timing_mmc_hs400); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS400_1_8V) != 0 && + (host_caps & MMC_CAP_SIGNALING_180) != 0 && + ivar->bus_width == bus_width_8) { + setbit(&ivar->timings, bus_timing_mmc_hs400); + setbit(&ivar->vccq_180, bus_timing_mmc_hs400); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS400_1_2V) != 0 && + (ivar->raw_ext_csd[EXT_CSD_STROBE_SUPPORT] & + EXT_CSD_STROBE_SUPPORT_EN) != 0 && + (host_caps & MMC_CAP_SIGNALING_120) != 0 && + ivar->bus_width == bus_width_8) { + setbit(&ivar->timings, bus_timing_mmc_hs400es); + setbit(&ivar->vccq_120, bus_timing_mmc_hs400es); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS400_1_8V) != 0 && + (ivar->raw_ext_csd[EXT_CSD_STROBE_SUPPORT] & + EXT_CSD_STROBE_SUPPORT_EN) != 0 && + (host_caps & MMC_CAP_SIGNALING_180) != 0 && + ivar->bus_width == bus_width_8) { + setbit(&ivar->timings, bus_timing_mmc_hs400es); + setbit(&ivar->vccq_180, bus_timing_mmc_hs400es); + } /* * Determine generic switch timeout (provided in * units of 10 ms), defaulting to 500 ms. @@ -1659,8 +1848,6 @@ mmc_discover_cards(struct mmc_softc *sc) if (ivar->csd.spec_vers >= 6) ivar->cmd6_time = 10 * ivar->raw_ext_csd[EXT_CSD_GEN_CMD6_TIME]; - /* Find max supported bus width. */ - ivar->bus_width = mmc_test_bus_width(sc); /* Handle HC erase sector size. */ if (ivar->raw_ext_csd[EXT_CSD_ERASE_GRP_SIZE] != 0) { ivar->erase_sector = 1024 * @@ -1674,11 +1861,15 @@ mmc_discover_cards(struct mmc_softc *sc) device_printf(sc->dev, "Error setting erase group %d\n", err); - break; + goto free_ivar; } } } + mmc_decode_cid_mmc(ivar->raw_cid, &ivar->cid, + ivar->raw_ext_csd[EXT_CSD_REV] >= 5); + +child_common: /* * Some cards that report maximum I/O block sizes greater * than 512 require the block length to be set to 512, even @@ -1691,8 +1882,6 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->csd.write_bl_len != MMC_SECTOR_SIZE) mmc_set_blocklen(sc, MMC_SECTOR_SIZE); - mmc_decode_cid_mmc(ivar->raw_cid, &ivar->cid, - ivar->raw_ext_csd[EXT_CSD_REV] >= 5); mmc_format_card_id_string(ivar); if (bootverbose || mmc_debug) @@ -1700,56 +1889,111 @@ mmc_discover_cards(struct mmc_softc *sc) if (newcard) { /* Add device. */ child = device_add_child(sc->dev, NULL, -1); - device_set_ivars(child, ivar); + if (child != NULL) { + device_set_ivars(child, ivar); + sc->child_list = realloc(sc->child_list, + sizeof(device_t) * sc->child_count + 1, + M_DEVBUF, M_WAITOK); + sc->child_list[sc->child_count++] = child; + } else + device_printf(sc->dev, "Error adding child\n"); } - mmc_select_card(sc, 0); + +free_ivar: + if (newcard && child == NULL) + free(ivar, M_DEVBUF); + (void)mmc_select_card(sc, 0); + /* + * Not returning here when one MMC device could no be added + * potentially would mean looping forever when that device + * is broken (in which case it also may impact the remainder + * of the bus anyway, though). + */ + if ((newcard && child == NULL) || + mmcbr_get_mode(sc->dev) == mode_sd) + return; } } static void +mmc_update_child_list(struct mmc_softc *sc) +{ + device_t child; + int i, j; + + if (sc->child_count == 0) { + free(sc->child_list, M_DEVBUF); + return; + } + for (i = j = 0; i < sc->child_count; i++) { + for (;;) { + child = sc->child_list[j++]; + if (child != NULL) + break; + } + if (i != j) + sc->child_list[i] = child; + } + sc->child_list = realloc(sc->child_list, sizeof(device_t) * + sc->child_count, M_DEVBUF, M_WAITOK); +} + +static void mmc_rescan_cards(struct mmc_softc *sc) { struct mmc_ivars *ivar; - device_t *devlist; - int err, i, devcount; + int err, i, j; - if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) - return; - for (i = 0; i < devcount; i++) { - ivar = device_get_ivars(devlist[i]); + for (i = j = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); if (mmc_select_card(sc, ivar->rca) != MMC_ERR_NONE) { if (bootverbose || mmc_debug) device_printf(sc->dev, - "Card at relative address %d lost.\n", + "Card at relative address %d lost\n", ivar->rca); - device_delete_child(sc->dev, devlist[i]); + err = device_delete_child(sc->dev, sc->child_list[i]); + if (err != 0) { + j++; + continue; + } free(ivar, M_DEVBUF); - } + } else + j++; } - free(devlist, M_TEMP); - mmc_select_card(sc, 0); + if (sc->child_count == j) + goto out; + sc->child_count = j; + mmc_update_child_list(sc); +out: + (void)mmc_select_card(sc, 0); } static int -mmc_delete_cards(struct mmc_softc *sc) +mmc_delete_cards(struct mmc_softc *sc, bool final) { struct mmc_ivars *ivar; - device_t *devlist; - int err, i, devcount; + int err, i, j; - if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) - return (err); - for (i = 0; i < devcount; i++) { - ivar = device_get_ivars(devlist[i]); + err = 0; + for (i = j = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); if (bootverbose || mmc_debug) device_printf(sc->dev, - "Card at relative address %d deleted.\n", + "Card at relative address %d deleted\n", ivar->rca); - device_delete_child(sc->dev, devlist[i]); + err = device_delete_child(sc->dev, sc->child_list[i]); + if (err != 0) { + j++; + if (final == false) + continue; + else + break; + } free(ivar, M_DEVBUF); } - free(devlist, M_TEMP); - return (0); + sc->child_count = j; + mmc_update_child_list(sc); + return (err); } static void @@ -1813,7 +2057,7 @@ mmc_go_discovery(struct mmc_softc *sc) mmcbr_get_ocr(dev)); if (mmcbr_get_ocr(dev) == 0) { device_printf(sc->dev, "No compatible cards found on bus\n"); - mmc_delete_cards(sc); + (void)mmc_delete_cards(sc, false); mmc_power_down(sc); return; } @@ -1837,31 +2081,27 @@ mmc_go_discovery(struct mmc_softc *sc) static int mmc_calculate_clock(struct mmc_softc *sc) { - device_t *kids; + device_t dev; struct mmc_ivars *ivar; - int host_caps, i, nkid; + int i; uint32_t dtr, max_dtr; + uint16_t rca; enum mmc_bus_timing max_timing, timing; - bool changed; + bool changed, hs400; - max_dtr = mmcbr_get_f_max(sc->dev); - host_caps = mmcbr_get_caps(sc->dev); - if ((host_caps & MMC_CAP_MMC_DDR52) != 0) - max_timing = bus_timing_mmc_ddr52; - else if ((host_caps & MMC_CAP_HSPEED) != 0) - max_timing = bus_timing_hs; - else - max_timing = bus_timing_normal; - if (device_get_children(sc->dev, &kids, &nkid) != 0) - panic("can't get children"); + dev = sc->dev; + max_dtr = mmcbr_get_f_max(dev); + max_timing = bus_timing_max; do { changed = false; - for (i = 0; i < nkid; i++) { - ivar = device_get_ivars(kids[i]); - if (isclr(&ivar->timings, max_timing)) { - for (timing = max_timing; timing >= + for (i = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); + if (isclr(&ivar->timings, max_timing) || + !mmc_host_timing(dev, max_timing)) { + for (timing = max_timing - 1; timing >= bus_timing_normal; timing--) { - if (isset(&ivar->timings, timing)) { + if (isset(&ivar->timings, timing) && *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Aug 6 16:07:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D0C2DB7C0F; Sun, 6 Aug 2017 16:07:36 +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 mx1.freebsd.org (Postfix) with ESMTPS id D611364CD4; Sun, 6 Aug 2017 16:07:35 +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 v76G7Z2V087707; Sun, 6 Aug 2017 16:07:35 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v76G7ZsZ087704; Sun, 6 Aug 2017 16:07:35 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708061607.v76G7ZsZ087704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 6 Aug 2017 16:07:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322120 - in stable/10/sys/dev: mmc sdhci X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/10/sys/dev: mmc sdhci X-SVN-Commit-Revision: 322120 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 06 Aug 2017 16:07:36 -0000 Author: marius Date: Sun Aug 6 16:07:34 2017 New Revision: 322120 URL: https://svnweb.freebsd.org/changeset/base/322120 Log: MFC: r319350, r320620, r321385, r321490, r321588, r321948 o Use SDHCI_CAN_DRIVE_TYPE_{A,C,D} to check for driver type support in SDHCI_CAPABILITIES2 instead of SDHCI_CTRL2_DRIVER_TYPE_{A,C,D} which are meant for setting the driver type in SDHCI_HOST_CONTROL2. o Correct a typo in the comment part of r320577 (MFCed to stable/10 in r320899). o Add support for eMMC HS200 and HS400 bus speed modes at 200 MHz to sdhci(4), mmc(4) and mmcsd(4). On the system where the addition of DDR52 support increased the read throughput to ~80 MB/s (from ~45 MB/s at high speed), HS200 yields ~154 MB/s and HS400 ~187 MB/s, i. e. performance now has more than quadrupled compared to pre-r315598 (pre-r318495 in stable/10). However, in fact this isn't a feature-only change; there are boards based on Intel Bay Trail where DDR52 is problematic and the suggested workaround is to use HS200 mode instead. So far exact details are unknown, however, i. e. whether that's due to a defect in these SoCs or on the boards. Moreover, due to the above changes requiring to be aware of possible MMC siblings in the fast path of mmc(4), corresponding information now is cached in mmc_softc. As a side-effect, mmc_calculate_clock(), now longer will trigger a panic in low memory situations and all of mmc(4) operate on the same set of child devices. o Fix a bug in the failure reporting of mmcsd_delete() that could lead to a panic. o Fix 2 bugs on resume, one in mmcsd(4) that could lead to a panic and another one in mmc(4) that could lead to devices no longer working. o Fix a memory leak in mmcsd_ioctl() in case copyin(9) fails. [1] o Fix missing variable initialization in mmc_switch_status(). [2] o Fix R1_SWITCH_ERROR detection in mmc_switch_status(). [3] o Handle the case of device_add_child(9) failing, for example due to a memory shortage, gracefully in mmc(4) and sdhci(4), including not leaking memory for the instance variables in case of mmc(4), also fixing [4]. o Correctly use the size of a pointer rather than that of a pointer to a pointer (this bug was present in head r321385 only, i. e. not in a stable branch). [5] o Handle the case of an unknown SD CSD version in mmc_decode_csd_sd() gracefully instead of calling panic(9). o Again, check and handle the return values of some additional function calls in mmc(4) instead of assuming that everything went right or mark non-fatal errors by casting the return value to void. o Correct a typo in the Linux IOCTL compatibility; it should have been MMC_IOC_MULTI_CMD rather than MMC_IOC_CMD_MULTI. o Now that we are reaching ever faster speeds (more improvement in this regard is to be expected when adding ADMA support to sdhci(4)), apply a few micro-optimizations to mmc(4), mmcsd(4) and sdhci(4). o Correct confusing and error prone mix-ups between "br" or "bridge" in mmc(4) and mmcsd(4) where - according to the terminology outlined in comments of bridge.h and mmcbr_if.m around since their addition in r163516 - the bus is meant and used instead. o Remove comment lines from bridge.h incorrectly suggesting that there would be a MMC bridge base class driver. o Update comments in bridge.h regarding the star topology of SD and SDIO; since version 3.00 of the SDHCI specification, for eSD and eSDIO bus topologies are actually possible in form of so called "shared buses" (in some subcontext later on renamed to "embedded" buses). Reported by: Coverity CID: 1372612 [1], 1372624 [2], 1372594 [3], 1007069 [4], 1378432 [5] Modified: stable/10/sys/dev/mmc/bridge.h stable/10/sys/dev/mmc/mmc.c stable/10/sys/dev/mmc/mmc_ioctl.h stable/10/sys/dev/mmc/mmc_private.h stable/10/sys/dev/mmc/mmc_subr.c stable/10/sys/dev/mmc/mmc_subr.h stable/10/sys/dev/mmc/mmcbr_if.m stable/10/sys/dev/mmc/mmcbrvar.h stable/10/sys/dev/mmc/mmcbus_if.m stable/10/sys/dev/mmc/mmcreg.h stable/10/sys/dev/mmc/mmcsd.c stable/10/sys/dev/sdhci/sdhci.c stable/10/sys/dev/sdhci/sdhci.h stable/10/sys/dev/sdhci/sdhci_acpi.c stable/10/sys/dev/sdhci/sdhci_if.m stable/10/sys/dev/sdhci/sdhci_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mmc/bridge.h ============================================================================== --- stable/10/sys/dev/mmc/bridge.h Sun Aug 6 16:07:25 2017 (r322119) +++ stable/10/sys/dev/mmc/bridge.h Sun Aug 6 16:07:34 2017 (r322120) @@ -65,12 +65,10 @@ * linux/mmc/host.h file. * * A mmc bridge is a chipset that can have one or more mmc and/or sd - * cards attached to it. mmc cards are attached on a bus topology, - * while sd and sdio cards are attached using a star topology (meaning - * in practice each sd card has its own, independent slot). Each - * mmcbr is assumed to be derived from the mmcbr. This is done to - * allow for easier addition of bridges (as each bridge does not need - * to be added to the mmcbus file). + * cards attached to it. mmc devices are attached on a bus topology, + * while sd and sdio cards usually are attached using a star topology + * (meaning in practice each sd card has its own, independent slot). + * Since SDHCI v3.00, buses for esd and esdio are possible, though. * * Attached to the mmc bridge is an mmcbus. The mmcbus is described * in dev/mmc/mmcbus_if.m. @@ -137,6 +135,10 @@ enum mmc_card_mode { mode_mmc, mode_sd }; +enum mmc_retune_req { + retune_req_none = 0, retune_req_normal, retune_req_reset +}; + struct mmc_host { int f_min; int f_max; @@ -177,7 +179,7 @@ struct mmc_host { extern driver_t mmc_driver; extern devclass_t mmc_devclass; -#define MMC_VERSION 3 +#define MMC_VERSION 4 #define MMC_DECLARE_BRIDGE(name) \ DRIVER_MODULE(mmc, name, mmc_driver, mmc_devclass, NULL, NULL); \ Modified: stable/10/sys/dev/mmc/mmc.c ============================================================================== --- stable/10/sys/dev/mmc/mmc.c Sun Aug 6 16:07:25 2017 (r322119) +++ stable/10/sys/dev/mmc/mmc.c Sun Aug 6 16:07:34 2017 (r322120) @@ -88,14 +88,14 @@ struct mmc_ivars { uint8_t raw_ext_csd[MMC_EXTCSD_SIZE]; /* Raw bits of the EXT_CSD */ uint32_t raw_sd_status[16]; /* Raw bits of the SD_STATUS */ uint16_t rca; + u_char read_only; /* True when the device is read-only */ + u_char high_cap; /* High Capacity device (block addressed) */ enum mmc_card_mode mode; + enum mmc_bus_width bus_width; /* Bus width to use */ struct mmc_cid cid; /* cid decoded */ struct mmc_csd csd; /* csd decoded */ struct mmc_scr scr; /* scr decoded */ struct mmc_sd_status sd_status; /* SD_STATUS decoded */ - u_char read_only; /* True when the device is read-only */ - u_char bus_width; /* Bus width to use */ - u_char high_cap; /* High Capacity card (block addressed) */ uint32_t sec_count; /* Card capacity in 512byte blocks */ uint32_t timings; /* Mask of bus timings supported */ uint32_t vccq_120; /* Mask of bus timings at VCCQ of 1.2 V */ @@ -128,8 +128,10 @@ static int mmc_read_ivar(device_t bus, device_t child, uintptr_t *result); static int mmc_release_bus(device_t busdev, device_t dev); static int mmc_resume(device_t dev); +static void mmc_retune_pause(device_t busdev, device_t dev, bool retune); +static void mmc_retune_unpause(device_t busdev, device_t dev); static int mmc_suspend(device_t dev); -static int mmc_wait_for_request(device_t brdev, device_t reqdev, +static int mmc_wait_for_request(device_t busdev, device_t dev, struct mmc_request *req); static int mmc_write_ivar(device_t bus, device_t child, int which, uintptr_t value); @@ -156,21 +158,23 @@ static void mmc_decode_cid_mmc(uint32_t *raw_cid, stru bool is_4_41p); static void mmc_decode_cid_sd(uint32_t *raw_cid, struct mmc_cid *cid); static void mmc_decode_csd_mmc(uint32_t *raw_csd, struct mmc_csd *csd); -static void mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd); +static int mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd); static void mmc_delayed_attach(void *xsc); -static int mmc_delete_cards(struct mmc_softc *sc); +static int mmc_delete_cards(struct mmc_softc *sc, bool final); static void mmc_discover_cards(struct mmc_softc *sc); static void mmc_format_card_id_string(struct mmc_ivars *ivar); static void mmc_go_discovery(struct mmc_softc *sc); static uint32_t mmc_get_bits(uint32_t *bits, int bit_len, int start, int size); static int mmc_highest_voltage(uint32_t ocr); +static bool mmc_host_timing(device_t dev, enum mmc_bus_timing timing); static void mmc_idle_cards(struct mmc_softc *sc); static void mmc_ms_delay(int ms); static void mmc_log_card(device_t dev, struct mmc_ivars *ivar, int newcard); static void mmc_power_down(struct mmc_softc *sc); static void mmc_power_up(struct mmc_softc *sc); static void mmc_rescan_cards(struct mmc_softc *sc); +static int mmc_retune(device_t busdev, device_t dev, bool reset); static void mmc_scan(struct mmc_softc *sc); static int mmc_sd_switch(struct mmc_softc *sc, uint8_t mode, uint8_t grp, uint8_t value, uint8_t *res); @@ -184,15 +188,23 @@ static int mmc_send_op_cond(struct mmc_softc *sc, uint uint32_t *rocr); static int mmc_send_relative_addr(struct mmc_softc *sc, uint32_t *resp); static int mmc_set_blocklen(struct mmc_softc *sc, uint32_t len); -static int mmc_set_card_bus_width(struct mmc_softc *sc, struct mmc_ivars *ivar); +static int mmc_set_card_bus_width(struct mmc_softc *sc, struct mmc_ivars *ivar, + enum mmc_bus_timing timing); static int mmc_set_power_class(struct mmc_softc *sc, struct mmc_ivars *ivar); static int mmc_set_relative_addr(struct mmc_softc *sc, uint16_t resp); static int mmc_set_timing(struct mmc_softc *sc, struct mmc_ivars *ivar, enum mmc_bus_timing timing); +static int mmc_set_vccq(struct mmc_softc *sc, struct mmc_ivars *ivar, + enum mmc_bus_timing timing); +static int mmc_switch_to_hs200(struct mmc_softc *sc, struct mmc_ivars *ivar, + uint32_t clock); +static int mmc_switch_to_hs400(struct mmc_softc *sc, struct mmc_ivars *ivar, + uint32_t max_dtr, enum mmc_bus_timing max_timing); static int mmc_test_bus_width(struct mmc_softc *sc); static uint32_t mmc_timing_to_dtr(struct mmc_ivars *ivar, enum mmc_bus_timing timing); static const char *mmc_timing_to_string(enum mmc_bus_timing timing); +static void mmc_update_child_list(struct mmc_softc *sc); static int mmc_wait_for_command(struct mmc_softc *sc, uint32_t opcode, uint32_t arg, uint32_t flags, uint32_t *resp, int retries); static int mmc_wait_for_req(struct mmc_softc *sc, struct mmc_request *req); @@ -236,7 +248,8 @@ mmc_detach(device_t dev) struct mmc_softc *sc = device_get_softc(dev); int err; - if ((err = mmc_delete_cards(sc)) != 0) + err = mmc_delete_cards(sc, true); + if (err != 0) return (err); mmc_power_down(sc); MMC_LOCK_DESTROY(sc); @@ -251,10 +264,21 @@ mmc_suspend(device_t dev) int err; err = bus_generic_suspend(dev); - if (err) + if (err != 0) return (err); + /* + * We power down with the bus acquired here, mainly so that no device + * is selected any longer and sc->last_rca gets set to 0. Otherwise, + * the deselect as part of the bus acquisition in mmc_scan() may fail + * during resume, as the bus isn't powered up again before later in + * mmc_go_discovery(). + */ + err = mmc_acquire_bus(dev, dev); + if (err != 0) + return (err); mmc_power_down(sc); - return (0); + err = mmc_release_bus(dev, dev); + return (err); } static int @@ -271,7 +295,8 @@ mmc_acquire_bus(device_t busdev, device_t dev) { struct mmc_softc *sc; struct mmc_ivars *ivar; - int err, rca; + int err; + uint16_t rca; enum mmc_bus_timing timing; err = MMCBR_ACQUIRE_HOST(device_get_parent(busdev), busdev); @@ -295,12 +320,27 @@ mmc_acquire_bus(device_t busdev, device_t dev) rca = ivar->rca; if (sc->last_rca != rca) { if (mmc_select_card(sc, rca) != MMC_ERR_NONE) { - device_printf(sc->dev, "Card at relative " - "address %d failed to select.\n", rca); + device_printf(busdev, "Card at relative " + "address %d failed to select\n", rca); return (ENXIO); } sc->last_rca = rca; timing = mmcbr_get_timing(busdev); + /* + * For eMMC modes, setting/updating bus width and VCCQ + * only really is necessary if there actually is more + * than one device on the bus as generally that already + * had to be done by mmc_calculate_clock() or one of + * its calees. Moreover, setting the bus width anew + * can trigger re-tuning (via a CRC error on the next + * CMD), even if not switching between devices an the + * previously selected one is still tuned. Obviously, + * we need to re-tune the host controller if devices + * are actually switched, though. + */ + if (timing >= bus_timing_mmc_ddr52 && + sc->child_count == 1) + return (0); /* Prepare bus width for the new card. */ if (bootverbose || mmc_debug) { device_printf(busdev, @@ -309,38 +349,34 @@ mmc_acquire_bus(device_t busdev, device_t dev) (ivar->bus_width == bus_width_8) ? 8 : 1, mmc_timing_to_string(timing)); } - if (mmc_set_card_bus_width(sc, ivar) != MMC_ERR_NONE) { - device_printf(sc->dev, "Card at relative " - "address %d failed to set bus width.\n", + if (mmc_set_card_bus_width(sc, ivar, timing) != + MMC_ERR_NONE) { + device_printf(busdev, "Card at relative " + "address %d failed to set bus width\n", rca); return (ENXIO); } - if (isset(&ivar->vccq_120, timing)) - mmcbr_set_vccq(busdev, vccq_120); - else if (isset(&ivar->vccq_180, timing)) - mmcbr_set_vccq(busdev, vccq_180); - else - mmcbr_set_vccq(busdev, vccq_330); - if (mmcbr_switch_vccq(busdev) != 0) { - device_printf(sc->dev, "Failed to set VCCQ " - "for card at relative address %d.\n", rca); + mmcbr_set_bus_width(busdev, ivar->bus_width); + mmcbr_update_ios(busdev); + if (mmc_set_vccq(sc, ivar, timing) != MMC_ERR_NONE) { + device_printf(busdev, "Failed to set VCCQ " + "for card at relative address %d\n", rca); return (ENXIO); } - if (mmc_set_power_class(sc, ivar) != MMC_ERR_NONE) { - device_printf(sc->dev, "Card at relative " - "address %d failed to set power class.\n", - rca); + if (timing >= bus_timing_mmc_hs200 && + mmc_retune(busdev, dev, true) != 0) { + device_printf(busdev, "Card at relative " + "address %d failed to re-tune\n", rca); return (ENXIO); } - mmcbr_set_bus_width(busdev, ivar->bus_width); - mmcbr_update_ios(busdev); } } else { /* * If there's a card selected, stand down. */ if (sc->last_rca != 0) { - mmc_select_card(sc, 0); + if (mmc_select_card(sc, 0) != MMC_ERR_NONE) + return (ENXIO); sc->last_rca = 0; } } @@ -408,7 +444,7 @@ mmc_wait_for_req(struct mmc_softc *sc, struct mmc_requ req->done = mmc_wakeup; req->done_data = sc; - if (mmc_debug > 1) { + if (__predict_false(mmc_debug > 1)) { device_printf(sc->dev, "REQUEST: CMD%d arg %#x flags %#x", req->cmd->opcode, req->cmd->arg, req->cmd->flags); if (req->cmd->data) { @@ -421,18 +457,66 @@ mmc_wait_for_req(struct mmc_softc *sc, struct mmc_requ while ((req->flags & MMC_REQ_DONE) == 0) msleep(req, &sc->sc_mtx, 0, "mmcreq", 0); MMC_UNLOCK(sc); - if (mmc_debug > 2 || (mmc_debug > 0 && req->cmd->error != MMC_ERR_NONE)) + if (__predict_false(mmc_debug > 2 || (mmc_debug > 0 && + req->cmd->error != MMC_ERR_NONE))) device_printf(sc->dev, "CMD%d RESULT: %d\n", req->cmd->opcode, req->cmd->error); return (0); } static int -mmc_wait_for_request(device_t brdev, device_t reqdev __unused, - struct mmc_request *req) +mmc_wait_for_request(device_t busdev, device_t dev, struct mmc_request *req) { - struct mmc_softc *sc = device_get_softc(brdev); + struct mmc_softc *sc; + struct mmc_ivars *ivar; + int err, i; + enum mmc_retune_req retune_req; + sc = device_get_softc(busdev); + KASSERT(sc->owner != NULL, + ("%s: Request from %s without bus being acquired.", __func__, + device_get_nameunit(dev))); + + /* + * Unless no device is selected or re-tuning is already ongoing, + * execute re-tuning if a) the bridge is requesting to do so and + * re-tuning hasn't been otherwise paused, or b) if a child asked + * to be re-tuned prior to pausing (see also mmc_retune_pause()). + */ + if (__predict_false(sc->last_rca != 0 && sc->retune_ongoing == 0 && + (((retune_req = mmcbr_get_retune_req(busdev)) != retune_req_none && + sc->retune_paused == 0) || sc->retune_needed == 1))) { + if (__predict_false(mmc_debug > 1)) { + device_printf(busdev, + "Re-tuning with%s circuit reset required\n", + retune_req == retune_req_reset ? "" : "out"); + } + if (device_get_parent(dev) == busdev) + ivar = device_get_ivars(dev); + else { + for (i = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); + if (ivar->rca == sc->last_rca) + break; + } + if (ivar->rca != sc->last_rca) + return (EINVAL); + } + sc->retune_ongoing = 1; + err = mmc_retune(busdev, dev, retune_req == retune_req_reset); + sc->retune_ongoing = 0; + switch (err) { + case MMC_ERR_NONE: + case MMC_ERR_FAILED: /* Re-tune error but still might work */ + break; + case MMC_ERR_BADCRC: /* Switch failure on HS400 recovery */ + return (ENXIO); + case MMC_ERR_INVALID: /* Driver implementation b0rken */ + default: /* Unknown error, should not happen */ + return (EINVAL); + } + sc->retune_needed = 0; + } return (mmc_wait_for_req(sc, req)); } @@ -600,11 +684,14 @@ mmc_power_down(struct mmc_softc *sc) static int mmc_select_card(struct mmc_softc *sc, uint16_t rca) { - int flags; + int err, flags; flags = (rca ? MMC_RSP_R1B : MMC_RSP_NONE) | MMC_CMD_AC; - return (mmc_wait_for_command(sc, MMC_SELECT_CARD, (uint32_t)rca << 16, - flags, NULL, CMD_RETRIES)); + sc->retune_paused++; + err = mmc_wait_for_command(sc, MMC_SELECT_CARD, (uint32_t)rca << 16, + flags, NULL, CMD_RETRIES); + sc->retune_paused--; + return (err); } static int @@ -636,7 +723,8 @@ mmc_sd_switch(struct mmc_softc *sc, uint8_t mode, uint } static int -mmc_set_card_bus_width(struct mmc_softc *sc, struct mmc_ivars *ivar) +mmc_set_card_bus_width(struct mmc_softc *sc, struct mmc_ivars *ivar, + enum mmc_bus_timing timing) { struct mmc_command cmd; int err; @@ -669,28 +757,33 @@ mmc_set_card_bus_width(struct mmc_softc *sc, struct mm } else { switch (ivar->bus_width) { case bus_width_1: + if (timing == bus_timing_mmc_hs400 || + timing == bus_timing_mmc_hs400es) + return (MMC_ERR_INVALID); value = EXT_CSD_BUS_WIDTH_1; break; case bus_width_4: - switch (mmcbr_get_timing(sc->dev)) { + switch (timing) { case bus_timing_mmc_ddr52: - case bus_timing_mmc_hs200: - case bus_timing_mmc_hs400: - case bus_timing_mmc_hs400es: value = EXT_CSD_BUS_WIDTH_4_DDR; break; + case bus_timing_mmc_hs400: + case bus_timing_mmc_hs400es: + return (MMC_ERR_INVALID); default: value = EXT_CSD_BUS_WIDTH_4; break; } break; case bus_width_8: - switch (mmcbr_get_timing(sc->dev)) { + value = 0; + switch (timing) { + case bus_timing_mmc_hs400es: + value = EXT_CSD_BUS_WIDTH_ES; + /* FALLTHROUGH */ case bus_timing_mmc_ddr52: - case bus_timing_mmc_hs200: case bus_timing_mmc_hs400: - case bus_timing_mmc_hs400es: - value = EXT_CSD_BUS_WIDTH_8_DDR; + value |= EXT_CSD_BUS_WIDTH_8_DDR; break; default: value = EXT_CSD_BUS_WIDTH_8; @@ -815,6 +908,13 @@ mmc_set_timing(struct mmc_softc *sc, struct mmc_ivars case bus_timing_mmc_ddr52: value = EXT_CSD_HS_TIMING_HS; break; + case bus_timing_mmc_hs200: + value = EXT_CSD_HS_TIMING_HS200; + break; + case bus_timing_mmc_hs400: + case bus_timing_mmc_hs400es: + value = EXT_CSD_HS_TIMING_HS400; + break; default: return (MMC_ERR_INVALID); } @@ -831,6 +931,23 @@ mmc_set_timing(struct mmc_softc *sc, struct mmc_ivars return (err); } +static int +mmc_set_vccq(struct mmc_softc *sc, struct mmc_ivars *ivar, + enum mmc_bus_timing timing) +{ + + if (isset(&ivar->vccq_120, timing)) + mmcbr_set_vccq(sc->dev, vccq_120); + else if (isset(&ivar->vccq_180, timing)) + mmcbr_set_vccq(sc->dev, vccq_180); + else + mmcbr_set_vccq(sc->dev, vccq_330); + if (mmcbr_switch_vccq(sc->dev) != 0) + return (MMC_ERR_INVALID); + else + return (MMC_ERR_NONE); +} + static const uint8_t p8[8] = { 0x55, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -1038,7 +1155,7 @@ static const int cur_max[8] = { 1000, 5000, 10000, 25000, 35000, 45000, 800000, 200000 }; -static void +static int mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd) { int v; @@ -1079,6 +1196,7 @@ mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *c csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3); csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4); csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1); + return (MMC_ERR_NONE); } else if (v == 1) { m = mmc_get_bits(raw_csd, 128, 115, 4); e = mmc_get_bits(raw_csd, 128, 112, 3); @@ -1102,8 +1220,9 @@ mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *c csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3); csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4); csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1); - } else - panic("unknown SD CSD version"); + return (MMC_ERR_NONE); + } + return (MMC_ERR_INVALID); } static void @@ -1367,6 +1486,53 @@ mmc_timing_to_string(enum mmc_bus_timing timing) return (""); } +static bool +mmc_host_timing(device_t dev, enum mmc_bus_timing timing) +{ + int host_caps; + + host_caps = mmcbr_get_caps(dev); + +#define HOST_TIMING_CAP(host_caps, cap) ({ \ + bool retval; \ + if (((host_caps) & (cap)) == (cap)) \ + retval = true; \ + else \ + retval = false; \ + retval; \ +}) + + switch (timing) { + case bus_timing_normal: + return (true); + case bus_timing_hs: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_HSPEED)); + case bus_timing_uhs_sdr12: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_SDR12)); + case bus_timing_uhs_sdr25: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_SDR25)); + case bus_timing_uhs_ddr50: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_DDR50)); + case bus_timing_uhs_sdr50: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_SDR50)); + case bus_timing_uhs_sdr104: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_UHS_SDR104)); + case bus_timing_mmc_ddr52: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_DDR52)); + case bus_timing_mmc_hs200: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS200)); + case bus_timing_mmc_hs400: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS400)); + case bus_timing_mmc_hs400es: + return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS400 | + MMC_CAP_MMC_ENH_STROBE)); + } + +#undef HOST_TIMING_CAP + + return (false); +} + static void mmc_log_card(device_t dev, struct mmc_ivars *ivar, int newcard) { @@ -1398,9 +1564,8 @@ mmc_discover_cards(struct mmc_softc *sc) u_char switch_res[64]; uint32_t raw_cid[4]; struct mmc_ivars *ivar = NULL; - device_t *devlist; device_t child; - int devcount, err, host_caps, i, newcard; + int err, host_caps, i, newcard; uint32_t resp, sec_count, status; uint16_t rca = 2; @@ -1408,6 +1573,7 @@ mmc_discover_cards(struct mmc_softc *sc) if (bootverbose || mmc_debug) device_printf(sc->dev, "Probing cards\n"); while (1) { + child = NULL; sc->squelched++; /* Errors are expected, squelch reporting. */ err = mmc_all_send_cid(sc, raw_cid); sc->squelched--; @@ -1418,18 +1584,14 @@ mmc_discover_cards(struct mmc_softc *sc) break; } newcard = 1; - if ((err = device_get_children(sc->dev, &devlist, - &devcount)) != 0) - return; - for (i = 0; i < devcount; i++) { - ivar = device_get_ivars(devlist[i]); + for (i = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); if (memcmp(ivar->raw_cid, raw_cid, sizeof(raw_cid)) == 0) { newcard = 0; break; } } - free(devlist, M_TEMP); if (bootverbose || mmc_debug) { device_printf(sc->dev, "%sard detected (CID %08x%08x%08x%08x)\n", @@ -1452,7 +1614,7 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error getting RCA %d\n", err); - break; + goto free_ivar; } ivar->rca = resp >> 16; /* Get card CSD. */ @@ -1460,7 +1622,7 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error getting CSD %d\n", err); - break; + goto free_ivar; } if (bootverbose || mmc_debug) device_printf(sc->dev, @@ -1468,7 +1630,11 @@ mmc_discover_cards(struct mmc_softc *sc) newcard ? "New c" : "C", ivar->raw_csd[0], ivar->raw_csd[1], ivar->raw_csd[2], ivar->raw_csd[3]); - mmc_decode_csd_sd(ivar->raw_csd, &ivar->csd); + err = mmc_decode_csd_sd(ivar->raw_csd, &ivar->csd); + if (err != MMC_ERR_NONE) { + device_printf(sc->dev, "Error decoding CSD\n"); + goto free_ivar; + } ivar->sec_count = ivar->csd.capacity / MMC_SECTOR_SIZE; if (ivar->csd.csd_structure > 0) ivar->high_cap = 1; @@ -1481,12 +1647,12 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error reading card status %d\n", err); - break; + goto free_ivar; } if ((status & R1_CARD_IS_LOCKED) != 0) { device_printf(sc->dev, - "Card is password protected, skipping.\n"); - break; + "Card is password protected, skipping\n"); + goto free_ivar; } /* Get card SCR. Card must be selected to fetch it. */ @@ -1494,13 +1660,13 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error selecting card %d\n", err); - break; + goto free_ivar; } err = mmc_app_send_scr(sc, ivar->rca, ivar->raw_scr); if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error reading SCR %d\n", err); - break; + goto free_ivar; } mmc_app_decode_scr(ivar->raw_scr, &ivar->scr); /* Get card switch capabilities (command class 10). */ @@ -1528,7 +1694,7 @@ mmc_discover_cards(struct mmc_softc *sc) * use from the sd_status is the erase sector size, but * it is still nice to get that right. */ - mmc_select_card(sc, 0); + (void)mmc_select_card(sc, 0); (void)mmc_select_card(sc, ivar->rca); (void)mmc_app_sd_status(sc, ivar->rca, ivar->raw_sd_status); @@ -1538,47 +1704,24 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->erase_sector = 16 << ivar->sd_status.au_size; } - /* Find max supported bus width. */ + /* Find maximum supported bus width. */ if ((host_caps & MMC_CAP_4_BIT_DATA) && (ivar->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) ivar->bus_width = bus_width_4; - /* - * Some cards that report maximum I/O block sizes - * greater than 512 require the block length to be - * set to 512, even though that is supposed to be - * the default. Example: - * - * Transcend 2GB SDSC card, CID: - * mid=0x1b oid=0x534d pnm="00000" prv=1.0 mdt=00.2000 - */ - if (ivar->csd.read_bl_len != MMC_SECTOR_SIZE || - ivar->csd.write_bl_len != MMC_SECTOR_SIZE) - mmc_set_blocklen(sc, MMC_SECTOR_SIZE); - - mmc_format_card_id_string(ivar); - - if (bootverbose || mmc_debug) - mmc_log_card(sc->dev, ivar, newcard); - if (newcard) { - /* Add device. */ - child = device_add_child(sc->dev, NULL, -1); - device_set_ivars(child, ivar); - } - mmc_select_card(sc, 0); - return; + goto child_common; } ivar->rca = rca++; err = mmc_set_relative_addr(sc, ivar->rca); if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error setting RCA %d\n", err); - break; + goto free_ivar; } /* Get card CSD. */ err = mmc_send_csd(sc, ivar->rca, ivar->raw_csd); if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error getting CSD %d\n", err); - break; + goto free_ivar; } if (bootverbose || mmc_debug) device_printf(sc->dev, @@ -1597,19 +1740,19 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error reading card status %d\n", err); - break; + goto free_ivar; } if ((status & R1_CARD_IS_LOCKED) != 0) { device_printf(sc->dev, - "Card is password protected, skipping.\n"); - break; + "Card is password protected, skipping\n"); + goto free_ivar; } err = mmc_select_card(sc, ivar->rca); if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error selecting card %d\n", err); - break; + goto free_ivar; } /* Only MMC >= 4.x devices support EXT_CSD. */ @@ -1619,7 +1762,7 @@ mmc_discover_cards(struct mmc_softc *sc) if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error reading EXT_CSD %d\n", err); - break; + goto free_ivar; } /* Handle extended capacity from EXT_CSD */ sec_count = ivar->raw_ext_csd[EXT_CSD_SEC_CNT] + @@ -1630,6 +1773,8 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->sec_count = sec_count; ivar->high_cap = 1; } + /* Find maximum supported bus width. */ + ivar->bus_width = mmc_test_bus_width(sc); /* Get device speeds beyond normal mode. */ if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_HS_52) != 0) { @@ -1652,6 +1797,50 @@ mmc_discover_cards(struct mmc_softc *sc) setbit(&ivar->timings, bus_timing_mmc_ddr52); setbit(&ivar->vccq_180, bus_timing_mmc_ddr52); } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS200_1_2V) != 0 && + (host_caps & MMC_CAP_SIGNALING_120) != 0) { + setbit(&ivar->timings, bus_timing_mmc_hs200); + setbit(&ivar->vccq_120, bus_timing_mmc_hs200); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS200_1_8V) != 0 && + (host_caps & MMC_CAP_SIGNALING_180) != 0) { + setbit(&ivar->timings, bus_timing_mmc_hs200); + setbit(&ivar->vccq_180, bus_timing_mmc_hs200); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS400_1_2V) != 0 && + (host_caps & MMC_CAP_SIGNALING_120) != 0 && + ivar->bus_width == bus_width_8) { + setbit(&ivar->timings, bus_timing_mmc_hs400); + setbit(&ivar->vccq_120, bus_timing_mmc_hs400); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS400_1_8V) != 0 && + (host_caps & MMC_CAP_SIGNALING_180) != 0 && + ivar->bus_width == bus_width_8) { + setbit(&ivar->timings, bus_timing_mmc_hs400); + setbit(&ivar->vccq_180, bus_timing_mmc_hs400); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS400_1_2V) != 0 && + (ivar->raw_ext_csd[EXT_CSD_STROBE_SUPPORT] & + EXT_CSD_STROBE_SUPPORT_EN) != 0 && + (host_caps & MMC_CAP_SIGNALING_120) != 0 && + ivar->bus_width == bus_width_8) { + setbit(&ivar->timings, bus_timing_mmc_hs400es); + setbit(&ivar->vccq_120, bus_timing_mmc_hs400es); + } + if ((ivar->raw_ext_csd[EXT_CSD_CARD_TYPE] & + EXT_CSD_CARD_TYPE_HS400_1_8V) != 0 && + (ivar->raw_ext_csd[EXT_CSD_STROBE_SUPPORT] & + EXT_CSD_STROBE_SUPPORT_EN) != 0 && + (host_caps & MMC_CAP_SIGNALING_180) != 0 && + ivar->bus_width == bus_width_8) { + setbit(&ivar->timings, bus_timing_mmc_hs400es); + setbit(&ivar->vccq_180, bus_timing_mmc_hs400es); + } /* * Determine generic switch timeout (provided in * units of 10 ms), defaulting to 500 ms. @@ -1660,8 +1849,6 @@ mmc_discover_cards(struct mmc_softc *sc) if (ivar->csd.spec_vers >= 6) ivar->cmd6_time = 10 * ivar->raw_ext_csd[EXT_CSD_GEN_CMD6_TIME]; - /* Find max supported bus width. */ - ivar->bus_width = mmc_test_bus_width(sc); /* Handle HC erase sector size. */ if (ivar->raw_ext_csd[EXT_CSD_ERASE_GRP_SIZE] != 0) { ivar->erase_sector = 1024 * @@ -1675,11 +1862,15 @@ mmc_discover_cards(struct mmc_softc *sc) device_printf(sc->dev, "Error setting erase group %d\n", err); - break; + goto free_ivar; } } } + mmc_decode_cid_mmc(ivar->raw_cid, &ivar->cid, + ivar->raw_ext_csd[EXT_CSD_REV] >= 5); + +child_common: /* * Some cards that report maximum I/O block sizes greater * than 512 require the block length to be set to 512, even @@ -1692,8 +1883,6 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->csd.write_bl_len != MMC_SECTOR_SIZE) mmc_set_blocklen(sc, MMC_SECTOR_SIZE); - mmc_decode_cid_mmc(ivar->raw_cid, &ivar->cid, - ivar->raw_ext_csd[EXT_CSD_REV] >= 5); mmc_format_card_id_string(ivar); if (bootverbose || mmc_debug) @@ -1701,56 +1890,111 @@ mmc_discover_cards(struct mmc_softc *sc) if (newcard) { /* Add device. */ child = device_add_child(sc->dev, NULL, -1); - device_set_ivars(child, ivar); + if (child != NULL) { + device_set_ivars(child, ivar); + sc->child_list = realloc(sc->child_list, + sizeof(device_t) * sc->child_count + 1, + M_DEVBUF, M_WAITOK); + sc->child_list[sc->child_count++] = child; + } else + device_printf(sc->dev, "Error adding child\n"); } - mmc_select_card(sc, 0); + +free_ivar: + if (newcard && child == NULL) + free(ivar, M_DEVBUF); + (void)mmc_select_card(sc, 0); + /* + * Not returning here when one MMC device could no be added + * potentially would mean looping forever when that device + * is broken (in which case it also may impact the remainder + * of the bus anyway, though). + */ + if ((newcard && child == NULL) || + mmcbr_get_mode(sc->dev) == mode_sd) + return; } } static void +mmc_update_child_list(struct mmc_softc *sc) +{ + device_t child; + int i, j; + + if (sc->child_count == 0) { + free(sc->child_list, M_DEVBUF); + return; + } + for (i = j = 0; i < sc->child_count; i++) { + for (;;) { + child = sc->child_list[j++]; + if (child != NULL) + break; + } + if (i != j) + sc->child_list[i] = child; + } + sc->child_list = realloc(sc->child_list, sizeof(device_t) * + sc->child_count, M_DEVBUF, M_WAITOK); +} + +static void mmc_rescan_cards(struct mmc_softc *sc) { struct mmc_ivars *ivar; - device_t *devlist; - int err, i, devcount; + int err, i, j; - if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) - return; - for (i = 0; i < devcount; i++) { - ivar = device_get_ivars(devlist[i]); + for (i = j = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); if (mmc_select_card(sc, ivar->rca) != MMC_ERR_NONE) { if (bootverbose || mmc_debug) device_printf(sc->dev, - "Card at relative address %d lost.\n", + "Card at relative address %d lost\n", ivar->rca); - device_delete_child(sc->dev, devlist[i]); + err = device_delete_child(sc->dev, sc->child_list[i]); + if (err != 0) { + j++; + continue; + } free(ivar, M_DEVBUF); - } + } else + j++; } - free(devlist, M_TEMP); - mmc_select_card(sc, 0); + if (sc->child_count == j) + goto out; + sc->child_count = j; + mmc_update_child_list(sc); +out: + (void)mmc_select_card(sc, 0); } static int -mmc_delete_cards(struct mmc_softc *sc) +mmc_delete_cards(struct mmc_softc *sc, bool final) { struct mmc_ivars *ivar; - device_t *devlist; - int err, i, devcount; + int err, i, j; - if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) - return (err); - for (i = 0; i < devcount; i++) { - ivar = device_get_ivars(devlist[i]); + err = 0; + for (i = j = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); if (bootverbose || mmc_debug) device_printf(sc->dev, - "Card at relative address %d deleted.\n", + "Card at relative address %d deleted\n", ivar->rca); - device_delete_child(sc->dev, devlist[i]); + err = device_delete_child(sc->dev, sc->child_list[i]); + if (err != 0) { + j++; + if (final == false) + continue; + else + break; + } free(ivar, M_DEVBUF); } - free(devlist, M_TEMP); - return (0); + sc->child_count = j; + mmc_update_child_list(sc); + return (err); } static void @@ -1814,7 +2058,7 @@ mmc_go_discovery(struct mmc_softc *sc) mmcbr_get_ocr(dev)); if (mmcbr_get_ocr(dev) == 0) { device_printf(sc->dev, "No compatible cards found on bus\n"); - mmc_delete_cards(sc); + (void)mmc_delete_cards(sc, false); mmc_power_down(sc); return; } @@ -1838,31 +2082,27 @@ mmc_go_discovery(struct mmc_softc *sc) static int mmc_calculate_clock(struct mmc_softc *sc) { - device_t *kids; + device_t dev; struct mmc_ivars *ivar; - int host_caps, i, nkid; + int i; uint32_t dtr, max_dtr; + uint16_t rca; enum mmc_bus_timing max_timing, timing; - bool changed; + bool changed, hs400; - max_dtr = mmcbr_get_f_max(sc->dev); - host_caps = mmcbr_get_caps(sc->dev); - if ((host_caps & MMC_CAP_MMC_DDR52) != 0) - max_timing = bus_timing_mmc_ddr52; - else if ((host_caps & MMC_CAP_HSPEED) != 0) - max_timing = bus_timing_hs; - else - max_timing = bus_timing_normal; - if (device_get_children(sc->dev, &kids, &nkid) != 0) - panic("can't get children"); + dev = sc->dev; + max_dtr = mmcbr_get_f_max(dev); + max_timing = bus_timing_max; do { changed = false; - for (i = 0; i < nkid; i++) { - ivar = device_get_ivars(kids[i]); - if (isclr(&ivar->timings, max_timing)) { - for (timing = max_timing; timing >= + for (i = 0; i < sc->child_count; i++) { + ivar = device_get_ivars(sc->child_list[i]); + if (isclr(&ivar->timings, max_timing) || + !mmc_host_timing(dev, max_timing)) { + for (timing = max_timing - 1; timing >= bus_timing_normal; timing--) { - if (isset(&ivar->timings, timing)) { + if (isset(&ivar->timings, timing) && *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Aug 6 16:12:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BCAEDBC291; Sun, 6 Aug 2017 16:12:47 +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 mx1.freebsd.org (Postfix) with ESMTPS id 77B5365338; Sun, 6 Aug 2017 16:12:47 +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 v76GCkum091691; Sun, 6 Aug 2017 16:12:46 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v76GCkPw091687; Sun, 6 Aug 2017 16:12:46 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708061612.v76GCkPw091687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 6 Aug 2017 16:12:46 +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: r322121 - stable/11/sys/dev/sdhci X-SVN-Group: stable-11 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/11/sys/dev/sdhci X-SVN-Commit-Revision: 322121 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 06 Aug 2017 16:12:47 -0000 Author: marius Date: Sun Aug 6 16:12:46 2017 New Revision: 322121 URL: https://svnweb.freebsd.org/changeset/base/322121 Log: MFC: r321589 - Check the slot type capability, set SDHCI_SLOT_{EMBEDDED,NON_REMOVABLE} for embedded slots. Fail in the sdhci(4) initialization for slot type shared, which is completely unsupported by this driver at the moment. [1] For Intel eMMC controllers, taking the embedded slot type into account obsoltes setting SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE so remove these quirk entries. - Hide the 1.8 V VDD capability when the slot is detected as non-embedded, as the SDHCI specification explicitly states that 1.8 V VDD is applicable to embedded slots only. [2] - Define some easy bits of the SDHCI specification v4.20. [3] - Don't leak bus_dma(9) resources in failure paths of sdhci_init_slot(). Obtained from: DragonFlyBSD 65704a46 [1], 7ba10b88 [2], 0df14648 [3] Modified: stable/11/sys/dev/sdhci/sdhci.c stable/11/sys/dev/sdhci/sdhci.h stable/11/sys/dev/sdhci/sdhci_acpi.c stable/11/sys/dev/sdhci/sdhci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sdhci/sdhci.c ============================================================================== --- stable/11/sys/dev/sdhci/sdhci.c Sun Aug 6 16:07:34 2017 (r322120) +++ stable/11/sys/dev/sdhci/sdhci.c Sun Aug 6 16:12:46 2017 (r322121) @@ -657,6 +657,7 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, BUS_DMA_NOWAIT, &slot->dmamap); if (err != 0) { device_printf(dev, "Can't alloc DMA memory\n"); + bus_dma_tag_destroy(slot->dmatag); SDHCI_LOCK_DESTROY(slot); return (err); } @@ -666,6 +667,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, sdhci_getaddr, &slot->paddr, 0); if (err != 0 || slot->paddr == 0) { device_printf(dev, "Can't load DMA memory\n"); + bus_dmamem_free(slot->dmatag, slot->dmamem, slot->dmamap); + bus_dma_tag_destroy(slot->dmatag); SDHCI_LOCK_DESTROY(slot); if (err) return (err); @@ -685,6 +688,22 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, else caps2 = 0; } + if (slot->version >= SDHCI_SPEC_300) { + if ((caps & SDHCI_SLOTTYPE_MASK) != SDHCI_SLOTTYPE_REMOVABLE && + (caps & SDHCI_SLOTTYPE_MASK) != SDHCI_SLOTTYPE_EMBEDDED) { + device_printf(dev, + "Driver doesn't support shared bus slots\n"); + bus_dmamap_unload(slot->dmatag, slot->dmamap); + bus_dmamem_free(slot->dmatag, slot->dmamem, + slot->dmamap); + bus_dma_tag_destroy(slot->dmatag); + SDHCI_LOCK_DESTROY(slot); + return (ENXIO); + } else if ((caps & SDHCI_SLOTTYPE_MASK) == + SDHCI_SLOTTYPE_EMBEDDED) { + slot->opt |= SDHCI_SLOT_EMBEDDED | SDHCI_NON_REMOVABLE; + } + } /* Calculate base clock frequency. */ if (slot->version >= SDHCI_SPEC_300) freq = (caps & SDHCI_CLOCK_V3_BASE_MASK) >> @@ -734,7 +753,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, slot->host.host_ocr |= MMC_OCR_320_330 | MMC_OCR_330_340; if (caps & SDHCI_CAN_VDD_300) slot->host.host_ocr |= MMC_OCR_290_300 | MMC_OCR_300_310; - if (caps & SDHCI_CAN_VDD_180) + /* 1.8V VDD is not supposed to be used for removable cards. */ + if ((caps & SDHCI_CAN_VDD_180) && (slot->opt & SDHCI_SLOT_EMBEDDED)) slot->host.host_ocr |= MMC_OCR_LOW_VOLTAGE; if (slot->host.host_ocr == 0) { device_printf(dev, "Hardware doesn't report any " @@ -881,20 +901,24 @@ no_tuning: if (bootverbose || sdhci_debug) { slot_printf(slot, - "%uMHz%s %s VDD:%s%s%s VCCQ: 3.3V%s%s DRV: B%s%s%s %s\n", + "%uMHz%s %s VDD:%s%s%s VCCQ: 3.3V%s%s DRV: B%s%s%s %s %s\n", slot->max_clk / 1000000, (caps & SDHCI_CAN_DO_HISPD) ? " HS" : "", (host_caps & MMC_CAP_8_BIT_DATA) ? "8bits" : ((host_caps & MMC_CAP_4_BIT_DATA) ? "4bits" : "1bit"), (caps & SDHCI_CAN_VDD_330) ? " 3.3V" : "", (caps & SDHCI_CAN_VDD_300) ? " 3.0V" : "", - (caps & SDHCI_CAN_VDD_180) ? " 1.8V" : "", + ((caps & SDHCI_CAN_VDD_180) && + (slot->opt & SDHCI_SLOT_EMBEDDED)) ? " 1.8V" : "", (host_caps & MMC_CAP_SIGNALING_180) ? " 1.8V" : "", (host_caps & MMC_CAP_SIGNALING_120) ? " 1.2V" : "", (host_caps & MMC_CAP_DRIVER_TYPE_A) ? "A" : "", (host_caps & MMC_CAP_DRIVER_TYPE_C) ? "C" : "", (host_caps & MMC_CAP_DRIVER_TYPE_D) ? "D" : "", - (slot->opt & SDHCI_HAVE_DMA) ? "DMA" : "PIO"); + (slot->opt & SDHCI_HAVE_DMA) ? "DMA" : "PIO", + (slot->opt & SDHCI_SLOT_EMBEDDED) ? "embedded" : + (slot->opt & SDHCI_NON_REMOVABLE) ? "non-removable" : + "removable"); if (host_caps & (MMC_CAP_MMC_DDR52 | MMC_CAP_MMC_HS200 | MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) slot_printf(slot, "eMMC:%s%s%s%s\n", Modified: stable/11/sys/dev/sdhci/sdhci.h ============================================================================== --- stable/11/sys/dev/sdhci/sdhci.h Sun Aug 6 16:07:34 2017 (r322120) +++ stable/11/sys/dev/sdhci/sdhci.h Sun Aug 6 16:12:46 2017 (r322121) @@ -233,6 +233,11 @@ #define SDHCI_HOST_CONTROL2 0x3E #define SDHCI_CTRL2_PRESET_VALUE 0x8000 #define SDHCI_CTRL2_ASYNC_INTR 0x4000 +#define SDHCI_CTRL2_64BIT_ENABLE 0x2000 +#define SDHCI_CTRL2_HOST_V4_ENABLE 0x1000 +#define SDHCI_CTRL2_CMD23_ENABLE 0x0800 +#define SDHCI_CTRL2_ADMA2_LENGTH_MODE 0x0400 +#define SDHCI_CTRL2_UHS2_IFACE_ENABLE 0x0100 #define SDHCI_CTRL2_SAMPLING_CLOCK 0x0080 #define SDHCI_CTRL2_EXEC_TUNING 0x0040 #define SDHCI_CTRL2_DRIVER_TYPE_MASK 0x0030 @@ -317,6 +322,8 @@ #define SDHCI_SPEC_200 1 #define SDHCI_SPEC_300 2 #define SDHCI_SPEC_400 3 +#define SDHCI_SPEC_410 4 +#define SDHCI_SPEC_420 5 SYSCTL_DECL(_hw_sdhci); @@ -338,6 +345,7 @@ struct sdhci_slot { #define SDHCI_TUNING_SUPPORTED 0x08 #define SDHCI_TUNING_ENABLED 0x10 #define SDHCI_SDR50_NEEDS_TUNING 0x20 +#define SDHCI_SLOT_EMBEDDED 0x40 u_char version; int timeout; /* Transfer timeout */ uint32_t max_clk; /* Max possible freq */ Modified: stable/11/sys/dev/sdhci/sdhci_acpi.c ============================================================================== --- stable/11/sys/dev/sdhci/sdhci_acpi.c Sun Aug 6 16:07:34 2017 (r322120) +++ stable/11/sys/dev/sdhci/sdhci_acpi.c Sun Aug 6 16:12:46 2017 (r322121) @@ -58,7 +58,6 @@ static const struct sdhci_acpi_device { u_int quirks; } sdhci_acpi_devices[] = { { "80860F14", 1, "Intel Bay Trail/Braswell eMMC 4.5/4.5.1 Controller", - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | @@ -76,7 +75,6 @@ static const struct sdhci_acpi_device { SDHCI_QUIRK_PRESET_VALUE_BROKEN }, { "80865ACC", 0, "Intel Apollo Lake eMMC 5.0 Controller", SDHCI_QUIRK_BROKEN_DMA | /* APL18 erratum */ - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | Modified: stable/11/sys/dev/sdhci/sdhci_pci.c ============================================================================== --- stable/11/sys/dev/sdhci/sdhci_pci.c Sun Aug 6 16:07:34 2017 (r322120) +++ stable/11/sys/dev/sdhci/sdhci_pci.c Sun Aug 6 16:12:46 2017 (r322121) @@ -104,7 +104,6 @@ static const struct sdhci_device { { 0x16bc14e4, 0xffff, "Broadcom BCM577xx SDXC/MMC Card Reader", SDHCI_QUIRK_BCM577XX_400KHZ_CLKSRC }, { 0x0f148086, 0xffff, "Intel Bay Trail eMMC 4.5 Controller", - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | @@ -114,14 +113,12 @@ static const struct sdhci_device { SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_PRESET_VALUE_BROKEN }, { 0x0f508086, 0xffff, "Intel Bay Trail eMMC 4.5 Controller", - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 | SDHCI_QUIRK_PRESET_VALUE_BROKEN }, { 0x22948086, 0xffff, "Intel Braswell eMMC 4.5.1 Controller", - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_DATA_TIMEOUT_1MHZ | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | @@ -137,7 +134,6 @@ static const struct sdhci_device { SDHCI_QUIRK_PRESET_VALUE_BROKEN }, { 0x5acc8086, 0xffff, "Intel Apollo Lake eMMC 5.0 Controller", SDHCI_QUIRK_BROKEN_DMA | /* APL18 erratum */ - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | From owner-svn-src-all@freebsd.org Sun Aug 6 16:12:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41CC8DBC307; Sun, 6 Aug 2017 16:12:58 +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 mx1.freebsd.org (Postfix) with ESMTPS id 15223653A7; Sun, 6 Aug 2017 16:12:58 +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 v76GCvG0091744; Sun, 6 Aug 2017 16:12:57 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v76GCu4B091740; Sun, 6 Aug 2017 16:12:56 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708061612.v76GCu4B091740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 6 Aug 2017 16:12:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322122 - stable/10/sys/dev/sdhci X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/sys/dev/sdhci X-SVN-Commit-Revision: 322122 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 06 Aug 2017 16:12:58 -0000 Author: marius Date: Sun Aug 6 16:12:56 2017 New Revision: 322122 URL: https://svnweb.freebsd.org/changeset/base/322122 Log: MFC: r321589 - Check the slot type capability, set SDHCI_SLOT_{EMBEDDED,NON_REMOVABLE} for embedded slots. Fail in the sdhci(4) initialization for slot type shared, which is completely unsupported by this driver at the moment. [1] For Intel eMMC controllers, taking the embedded slot type into account obsoltes setting SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE so remove these quirk entries. - Hide the 1.8 V VDD capability when the slot is detected as non-embedded, as the SDHCI specification explicitly states that 1.8 V VDD is applicable to embedded slots only. [2] - Define some easy bits of the SDHCI specification v4.20. [3] - Don't leak bus_dma(9) resources in failure paths of sdhci_init_slot(). Obtained from: DragonFlyBSD 65704a46 [1], 7ba10b88 [2], 0df14648 [3] Modified: stable/10/sys/dev/sdhci/sdhci.c stable/10/sys/dev/sdhci/sdhci.h stable/10/sys/dev/sdhci/sdhci_acpi.c stable/10/sys/dev/sdhci/sdhci_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sdhci/sdhci.c ============================================================================== --- stable/10/sys/dev/sdhci/sdhci.c Sun Aug 6 16:12:46 2017 (r322121) +++ stable/10/sys/dev/sdhci/sdhci.c Sun Aug 6 16:12:56 2017 (r322122) @@ -658,6 +658,7 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, BUS_DMA_NOWAIT, &slot->dmamap); if (err != 0) { device_printf(dev, "Can't alloc DMA memory\n"); + bus_dma_tag_destroy(slot->dmatag); SDHCI_LOCK_DESTROY(slot); return (err); } @@ -667,6 +668,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, sdhci_getaddr, &slot->paddr, 0); if (err != 0 || slot->paddr == 0) { device_printf(dev, "Can't load DMA memory\n"); + bus_dmamem_free(slot->dmatag, slot->dmamem, slot->dmamap); + bus_dma_tag_destroy(slot->dmatag); SDHCI_LOCK_DESTROY(slot); if (err) return (err); @@ -686,6 +689,22 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, else caps2 = 0; } + if (slot->version >= SDHCI_SPEC_300) { + if ((caps & SDHCI_SLOTTYPE_MASK) != SDHCI_SLOTTYPE_REMOVABLE && + (caps & SDHCI_SLOTTYPE_MASK) != SDHCI_SLOTTYPE_EMBEDDED) { + device_printf(dev, + "Driver doesn't support shared bus slots\n"); + bus_dmamap_unload(slot->dmatag, slot->dmamap); + bus_dmamem_free(slot->dmatag, slot->dmamem, + slot->dmamap); + bus_dma_tag_destroy(slot->dmatag); + SDHCI_LOCK_DESTROY(slot); + return (ENXIO); + } else if ((caps & SDHCI_SLOTTYPE_MASK) == + SDHCI_SLOTTYPE_EMBEDDED) { + slot->opt |= SDHCI_SLOT_EMBEDDED | SDHCI_NON_REMOVABLE; + } + } /* Calculate base clock frequency. */ if (slot->version >= SDHCI_SPEC_300) freq = (caps & SDHCI_CLOCK_V3_BASE_MASK) >> @@ -735,7 +754,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, slot->host.host_ocr |= MMC_OCR_320_330 | MMC_OCR_330_340; if (caps & SDHCI_CAN_VDD_300) slot->host.host_ocr |= MMC_OCR_290_300 | MMC_OCR_300_310; - if (caps & SDHCI_CAN_VDD_180) + /* 1.8V VDD is not supposed to be used for removable cards. */ + if ((caps & SDHCI_CAN_VDD_180) && (slot->opt & SDHCI_SLOT_EMBEDDED)) slot->host.host_ocr |= MMC_OCR_LOW_VOLTAGE; if (slot->host.host_ocr == 0) { device_printf(dev, "Hardware doesn't report any " @@ -882,20 +902,24 @@ no_tuning: if (bootverbose || sdhci_debug) { slot_printf(slot, - "%uMHz%s %s VDD:%s%s%s VCCQ: 3.3V%s%s DRV: B%s%s%s %s\n", + "%uMHz%s %s VDD:%s%s%s VCCQ: 3.3V%s%s DRV: B%s%s%s %s %s\n", slot->max_clk / 1000000, (caps & SDHCI_CAN_DO_HISPD) ? " HS" : "", (host_caps & MMC_CAP_8_BIT_DATA) ? "8bits" : ((host_caps & MMC_CAP_4_BIT_DATA) ? "4bits" : "1bit"), (caps & SDHCI_CAN_VDD_330) ? " 3.3V" : "", (caps & SDHCI_CAN_VDD_300) ? " 3.0V" : "", - (caps & SDHCI_CAN_VDD_180) ? " 1.8V" : "", + ((caps & SDHCI_CAN_VDD_180) && + (slot->opt & SDHCI_SLOT_EMBEDDED)) ? " 1.8V" : "", (host_caps & MMC_CAP_SIGNALING_180) ? " 1.8V" : "", (host_caps & MMC_CAP_SIGNALING_120) ? " 1.2V" : "", (host_caps & MMC_CAP_DRIVER_TYPE_A) ? "A" : "", (host_caps & MMC_CAP_DRIVER_TYPE_C) ? "C" : "", (host_caps & MMC_CAP_DRIVER_TYPE_D) ? "D" : "", - (slot->opt & SDHCI_HAVE_DMA) ? "DMA" : "PIO"); + (slot->opt & SDHCI_HAVE_DMA) ? "DMA" : "PIO", + (slot->opt & SDHCI_SLOT_EMBEDDED) ? "embedded" : + (slot->opt & SDHCI_NON_REMOVABLE) ? "non-removable" : + "removable"); if (host_caps & (MMC_CAP_MMC_DDR52 | MMC_CAP_MMC_HS200 | MMC_CAP_MMC_HS400 | MMC_CAP_MMC_ENH_STROBE)) slot_printf(slot, "eMMC:%s%s%s%s\n", Modified: stable/10/sys/dev/sdhci/sdhci.h ============================================================================== --- stable/10/sys/dev/sdhci/sdhci.h Sun Aug 6 16:12:46 2017 (r322121) +++ stable/10/sys/dev/sdhci/sdhci.h Sun Aug 6 16:12:56 2017 (r322122) @@ -233,6 +233,11 @@ #define SDHCI_HOST_CONTROL2 0x3E #define SDHCI_CTRL2_PRESET_VALUE 0x8000 #define SDHCI_CTRL2_ASYNC_INTR 0x4000 +#define SDHCI_CTRL2_64BIT_ENABLE 0x2000 +#define SDHCI_CTRL2_HOST_V4_ENABLE 0x1000 +#define SDHCI_CTRL2_CMD23_ENABLE 0x0800 +#define SDHCI_CTRL2_ADMA2_LENGTH_MODE 0x0400 +#define SDHCI_CTRL2_UHS2_IFACE_ENABLE 0x0100 #define SDHCI_CTRL2_SAMPLING_CLOCK 0x0080 #define SDHCI_CTRL2_EXEC_TUNING 0x0040 #define SDHCI_CTRL2_DRIVER_TYPE_MASK 0x0030 @@ -317,6 +322,8 @@ #define SDHCI_SPEC_200 1 #define SDHCI_SPEC_300 2 #define SDHCI_SPEC_400 3 +#define SDHCI_SPEC_410 4 +#define SDHCI_SPEC_420 5 SYSCTL_DECL(_hw_sdhci); @@ -338,6 +345,7 @@ struct sdhci_slot { #define SDHCI_TUNING_SUPPORTED 0x08 #define SDHCI_TUNING_ENABLED 0x10 #define SDHCI_SDR50_NEEDS_TUNING 0x20 +#define SDHCI_SLOT_EMBEDDED 0x40 u_char version; int timeout; /* Transfer timeout */ uint32_t max_clk; /* Max possible freq */ Modified: stable/10/sys/dev/sdhci/sdhci_acpi.c ============================================================================== --- stable/10/sys/dev/sdhci/sdhci_acpi.c Sun Aug 6 16:12:46 2017 (r322121) +++ stable/10/sys/dev/sdhci/sdhci_acpi.c Sun Aug 6 16:12:56 2017 (r322122) @@ -58,7 +58,6 @@ static const struct sdhci_acpi_device { u_int quirks; } sdhci_acpi_devices[] = { { "80860F14", 1, "Intel Bay Trail/Braswell eMMC 4.5/4.5.1 Controller", - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | @@ -76,7 +75,6 @@ static const struct sdhci_acpi_device { SDHCI_QUIRK_PRESET_VALUE_BROKEN }, { "80865ACC", 0, "Intel Apollo Lake eMMC 5.0 Controller", SDHCI_QUIRK_BROKEN_DMA | /* APL18 erratum */ - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | Modified: stable/10/sys/dev/sdhci/sdhci_pci.c ============================================================================== --- stable/10/sys/dev/sdhci/sdhci_pci.c Sun Aug 6 16:12:46 2017 (r322121) +++ stable/10/sys/dev/sdhci/sdhci_pci.c Sun Aug 6 16:12:56 2017 (r322122) @@ -104,7 +104,6 @@ static const struct sdhci_device { { 0x16bc14e4, 0xffff, "Broadcom BCM577xx SDXC/MMC Card Reader", SDHCI_QUIRK_BCM577XX_400KHZ_CLKSRC }, { 0x0f148086, 0xffff, "Intel Bay Trail eMMC 4.5 Controller", - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | @@ -114,14 +113,12 @@ static const struct sdhci_device { SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_PRESET_VALUE_BROKEN }, { 0x0f508086, 0xffff, "Intel Bay Trail eMMC 4.5 Controller", - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 | SDHCI_QUIRK_PRESET_VALUE_BROKEN }, { 0x22948086, 0xffff, "Intel Braswell eMMC 4.5.1 Controller", - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_DATA_TIMEOUT_1MHZ | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | @@ -137,7 +134,6 @@ static const struct sdhci_device { SDHCI_QUIRK_PRESET_VALUE_BROKEN }, { 0x5acc8086, 0xffff, "Intel Apollo Lake eMMC 5.0 Controller", SDHCI_QUIRK_BROKEN_DMA | /* APL18 erratum */ - SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | SDHCI_QUIRK_INTEL_POWER_UP_RESET | SDHCI_QUIRK_WAIT_WHILE_BUSY | SDHCI_QUIRK_MMC_DDR52 | From owner-svn-src-all@freebsd.org Sun Aug 6 19:46:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB72FDC5EDF; Sun, 6 Aug 2017 19:46:00 +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 mx1.freebsd.org (Postfix) with ESMTPS id ADA3E6B50D; Sun, 6 Aug 2017 19:46:00 +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 v76Jjx25077977; Sun, 6 Aug 2017 19:45:59 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v76Jjxxw077976; Sun, 6 Aug 2017 19:45:59 GMT (envelope-from np@FreeBSD.org) Message-Id: <201708061945.v76Jjxxw077976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sun, 6 Aug 2017 19:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322123 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 322123 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 06 Aug 2017 19:46:01 -0000 Author: np Date: Sun Aug 6 19:45:59 2017 New Revision: 322123 URL: https://svnweb.freebsd.org/changeset/base/322123 Log: cxgbe(4): Avoid a NULL dereference that would occur during module unload if there were problems earlier during attach. MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sched.c Modified: head/sys/dev/cxgbe/t4_sched.c ============================================================================== --- head/sys/dev/cxgbe/t4_sched.c Sun Aug 6 16:12:56 2017 (r322122) +++ head/sys/dev/cxgbe/t4_sched.c Sun Aug 6 19:45:59 2017 (r322123) @@ -382,8 +382,10 @@ t4_free_tx_sched(struct adapter *sc) taskqueue_drain(taskqueue_thread, &sc->tc_task); - for_each_port(sc, i) - free(sc->port[i]->sched_params, M_CXGBE); + for_each_port(sc, i) { + if (sc->port[i] != NULL) + free(sc->port[i]->sched_params, M_CXGBE); + } if (mtx_initialized(&sc->tc_lock)) mtx_destroy(&sc->tc_lock); From owner-svn-src-all@freebsd.org Sun Aug 6 21:54:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90D67DCC1A4; Sun, 6 Aug 2017 21:54:44 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 5C0376F601; Sun, 6 Aug 2017 21:54:44 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v76LshS9029771; Sun, 6 Aug 2017 21:54:43 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v76LshbH029770; Sun, 6 Aug 2017 21:54:43 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201708062154.v76LshbH029770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 6 Aug 2017 21:54:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322124 - head/usr.sbin/bluetooth/rfcomm_pppd X-SVN-Group: head X-SVN-Commit-Author: avos X-SVN-Commit-Paths: head/usr.sbin/bluetooth/rfcomm_pppd X-SVN-Commit-Revision: 322124 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 06 Aug 2017 21:54:44 -0000 Author: avos Date: Sun Aug 6 21:54:43 2017 New Revision: 322124 URL: https://svnweb.freebsd.org/changeset/base/322124 Log: rfcomm_pppd.8: fix a typo (SPD -> SDP). MFC after: 3 days Modified: head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 Modified: head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 ============================================================================== --- head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 Sun Aug 6 19:45:59 2017 (r322123) +++ head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 Sun Aug 6 21:54:43 2017 (r322124) @@ -348,7 +348,7 @@ label. The .Nm utility in server mode will try to register the Bluetooth LAN Access Over PPP -service with the local SPD daemon. +service with the local SDP daemon. If the local SDP daemon is not running, .Nm will exit with an error. From owner-svn-src-all@freebsd.org Mon Aug 7 02:15:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D82DDD7BBB; Mon, 7 Aug 2017 02:15:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 2BFCE76665; Mon, 7 Aug 2017 02:15:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v772FEow034565; Mon, 7 Aug 2017 02:15:14 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v772FEos034561; Mon, 7 Aug 2017 02:15:14 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708070215.v772FEos034561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 7 Aug 2017 02:15:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322129 - in stable/10: contrib/hyperv/tools/scripts etc/devd libexec/hyperv X-SVN-Group: stable-10 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: in stable/10: contrib/hyperv/tools/scripts etc/devd libexec/hyperv X-SVN-Commit-Revision: 322129 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 02:15:15 -0000 Author: sephe Date: Mon Aug 7 02:15:13 2017 New Revision: 322129 URL: https://svnweb.freebsd.org/changeset/base/322129 Log: MFC 321762 hyperv: Add VF bringup scripts and devd rules. How network VF works with hn(4) on Hyper-V in non-transparent mode: - Each network VF has a cooresponding hn(4). - The network VF and the it's cooresponding hn(4) have the same hardware address. - Once the network VF is up, e.g. ifconfig VF up: o All of the transmission should go through the network VF. o Most of the reception goes through the network VF. o Small amount of reception may go through the cooresponding hn(4). This reception will happen, even if the the cooresponding hn(4) is down. The cooresponding hn(4) will change the reception interface to the network VF, so that network layer and application layer will be tricked into thinking that these packets were received by the network VF. o The cooresponding hn(4) pretends the physical link is down. - Once the network VF is down or detached: o All of the transmission should go through the cooresponding hn(4). o All of the reception goes through the cooresponding hn(4). o The cooresponding hn(4) fallbacks to the original physical link detection logic. All these features are mainly used to help live migration, during which the network VF will be detached, while the network communication to the VM must not be cut off. In order to reach this level of live migration transparency, we use failover mode lagg(4) with the network VF and the cooresponding hn(4) attached to it. To ease user configuration for both network VF and non-network VF, the lagg(4) will be created by the following rules, and the configuration of the cooresponding hn(4) will be applied to the lagg(4) automatically. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11635 Added: stable/10/contrib/hyperv/tools/scripts/hyperv_vfattach - copied unchanged from r321762, head/contrib/hyperv/tools/scripts/hyperv_vfattach stable/10/contrib/hyperv/tools/scripts/hyperv_vfup - copied unchanged from r321762, head/contrib/hyperv/tools/scripts/hyperv_vfup Modified: stable/10/etc/devd/hyperv.conf stable/10/libexec/hyperv/Makefile Directory Properties: stable/10/ (props changed) Copied: stable/10/contrib/hyperv/tools/scripts/hyperv_vfattach (from r321762, head/contrib/hyperv/tools/scripts/hyperv_vfattach) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/hyperv/tools/scripts/hyperv_vfattach Mon Aug 7 02:15:13 2017 (r322129, copy of r321762, head/contrib/hyperv/tools/scripts/hyperv_vfattach) @@ -0,0 +1,79 @@ +#!/bin/sh + +# +# If transparent VF is enabled, don't do anything. +# + +sysctl -n hw.hn.vf_transparent > /dev/null 2>&1 +if [ $? -ne 0 ] +then + # Old kernel; no transparent VF. + vf_transparent=0 +else + vf_transparent=`sysctl -n hw.hn.vf_transparent` +fi + +if [ $vf_transparent -ne 0 ] +then + # Transparent VF; done! + exit 0 +fi + +iface=$1 +delay=$2 + +if [ $delay -gt 0 ] +then + # + # Delayed VF up. + # + sleep $delay + ifconfig $iface up + # Done! + exit $? +fi + +# +# Check to see whether $iface is a VF or not. +# If $iface is a VF, bring it up now. +# + +# for hyperv_vf_delay +. /etc/rc.conf + +sysctl -n hw.hn.vflist > /dev/null 2>&1 +if [ $? -ne 0 ] +then + # Old kernel; nothing could be done properly. + exit 0 +fi +vf_list=`sysctl -n hw.hn.vflist` + +for vf in $vf_list +do + if [ $vf = $iface ] + then + # + # Linger a little bit (at least 2 seconds) mainly to + # make sure that $iface is fully attached. + # + # NOTE: + # In Azure hyperv_vf_delay should be configured to a + # large value, e.g. 120 seconds, to avoid racing cloud + # agent goofs. + # + test $hyperv_vf_delay -ge 2 > /dev/null 2>&1 + if [ $? -ne 0 ] + then + hyperv_vf_delay=2 + fi + # + # NOTE: + # "(sleep ..; ifconfig .. up) > /dev/null 2>&1 &" + # does _not_ work. + # + daemon -f /usr/libexec/hyperv/hyperv_vfattach \ + $iface $hyperv_vf_delay + break + fi +done Copied: stable/10/contrib/hyperv/tools/scripts/hyperv_vfup (from r321762, head/contrib/hyperv/tools/scripts/hyperv_vfup) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/hyperv/tools/scripts/hyperv_vfup Mon Aug 7 02:15:13 2017 (r322129, copy of r321762, head/contrib/hyperv/tools/scripts/hyperv_vfup) @@ -0,0 +1,119 @@ +#!/bin/sh + +. /etc/rc.subr +. /etc/network.subr + +load_rc_config netif + +# +# Customized per-interface setup, e.g. hyperv_vfup.hn1 +# +# NOTE-CUSTOMIZE: +# Comment this out, if this script is used as template +# for the customized per-interface setup. +# +if [ -f /usr/libexec/hyperv/hyperv_vfup.$1 ] +then + /usr/libexec/hyperv/hyperv_vfup.$1 + exit $? +fi + +# NOTE-CUSTOMIZE: +#hn=${0##*.} +hn=$1 +hn_unit=`echo $hn | sed 's/[^0-9]*//g'` + +vf=`sysctl -n dev.hn.$hn_unit.vf` +if [ ! $vf ] +then + # Race happened; VF was removed, before we ran. + echo "$hn: VF was detached" + exit 0 +fi + +# +# Create laggX for hnX. +# Add VF and hnX to laggX. +# + +lagg=lagg$hn_unit + +ifconfig $lagg > /dev/null 2>&1 +if [ $? -ne 0 ] +then + # + # No laggX, create it now. + # + ifconfig $lagg create > /dev/null 2>&1 + if [ $? -ne 0 ] + then + echo "$lagg creation failed" + exit 1 + fi + + # + # Configure laggX (failover), add hnX and VF to it. + # + ifconfig $lagg laggproto failover laggport $hn laggport $vf + ifconfig $lagg inet6 no_dad + + # + # Stop dhclient on hnX, if any. + # + pidfile=/var/run/dhclient.$hn.pid + if [ -f $pidfile ] + then + kill -TERM `cat $pidfile` + fi + + # + # Remove all configured IPv4 addresses on hnX, e.g. + # configured by dhclient. laggX will take over the + # network operations. + # + while true + do + ifconfig $hn -alias > /dev/null 2>&1 + if [ $? -ne 0 ] + then + break + fi + done + + # TODO: Remove IPv6 addresses on hnX + + # + # Use hnX's configuration for laggX + # + # NOTE-CUSTOMIZE: + # If this script is used as template for the customized + # per-interface setup, replace this with whatever you + # want to do with the laggX. + # + if dhcpif $hn; + then + ifconfig $lagg up + if syncdhcpif $hn; + then + dhclient $lagg + else + dhclient -b $lagg + fi + else + ifconfig_args=`ifconfig_getargs $hn` + if [ -n "$ifconfig_args" ] + then + ifconfig $lagg $ifconfig_args + fi + fi +else + # + # laggX exists. Check whether VF was there or not. + # If VF was not added to laggX, add it now. + # + ifconfig $lagg | grep "laggport: $vf" > /dev/null 2>&1 + if [ $? -ne 0 ] + then + ifconfig $lagg laggport $vf + fi +fi Modified: stable/10/etc/devd/hyperv.conf ============================================================================== --- stable/10/etc/devd/hyperv.conf Mon Aug 7 01:09:33 2017 (r322128) +++ stable/10/etc/devd/hyperv.conf Mon Aug 7 02:15:13 2017 (r322129) @@ -33,3 +33,76 @@ notify 11 { match "cdev" "hv_fsvss_dev"; action "pkill -x hv_vss_daemon"; }; + +# +# Rules for non-transparent network VF. +# +# How network VF works with hn(4) on Hyper-V in non-transparent mode: +# +# - Each network VF has a cooresponding hn(4). +# - The network VF and the it's cooresponding hn(4) have the same hardware +# address. +# - Once the network VF is up, e.g. ifconfig VF up: +# o All of the transmission should go through the network VF. +# o Most of the reception goes through the network VF. +# o Small amount of reception may go through the cooresponding hn(4). +# This reception will happen, even if the the cooresponding hn(4) is +# down. The cooresponding hn(4) will change the reception interface +# to the network VF, so that network layer and application layer will +# be tricked into thinking that these packets were received by the +# network VF. +# o The cooresponding hn(4) pretends the physical link is down. +# - Once the network VF is down or detached: +# o All of the transmission should go through the cooresponding hn(4). +# o All of the reception goes through the cooresponding hn(4). +# o The cooresponding hn(4) fallbacks to the original physical link +# detection logic. +# +# All these features are mainly used to help live migration, during which +# the network VF will be detached, while the network communication to the +# VM must not be cut off. In order to reach this level of live migration +# transparency, we use failover mode lagg(4) with the network VF and the +# cooresponding hn(4) attached to it. +# +# To ease user configuration for both network VF and non-network VF, the +# lagg(4) will be created by the following rules, and the configuration +# of the cooresponding hn(4) will be applied to the lagg(4) automatically. +# +# NOTE: +# If live migration is not needed at all, the following rules could be +# commented out, and the network VF interface could be used exclusively. +# Most often the cooresponding hn(4) could be completely ignored. +# +# +# Default workflow for the network VF bringup: +# 1) ETHERNET/IFATTACH -> VF interface up (delayed by rc.conf hyperv_vf_delay +# seconds). This operation will trigger HYPERV_NIC_VF/VF_UP. +# 2) HYPERV_NIC_VF/VF_UP: +# a) Create laggX coresponding to hnX. +# b) Add hnX and VF to laggX. +# c) Whack all previous network configuration on hnX, including stopping +# dhclient. +# d) Apply rc.conf ifconfig_hnX to laggX; i.e. including starting dhclient. +# +# NOTE: +# HYPERV_NIC_VF/VF_UP action script could be customized per-interface by +# adding /usr/libexec/hyperv/hyperv_vfup.hnX script. +# /usr/libexec/hyperv/hyperv_vfup could be used as the template for the +# customized per-interface script. +# +# NOTE: +# For transparent network VF, hyperv_vfattach does nothing and +# HYPERV_NIC_VF/VF_UP will not be triggered at all. +# + +notify 10 { + match "system" "HYPERV_NIC_VF"; + match "type" "VF_UP"; + action "/usr/libexec/hyperv/hyperv_vfup $subsystem"; +}; + +notify 10 { + match "system" "ETHERNET"; + match "type" "IFATTACH"; + action "/usr/libexec/hyperv/hyperv_vfattach $subsystem 0"; +}; Modified: stable/10/libexec/hyperv/Makefile ============================================================================== --- stable/10/libexec/hyperv/Makefile Mon Aug 7 01:09:33 2017 (r322128) +++ stable/10/libexec/hyperv/Makefile Mon Aug 7 02:15:13 2017 (r322129) @@ -5,6 +5,7 @@ BINDIR= ${LIBEXECDIR}/hyperv SCRIPTS= hv_set_ifconfig hv_get_dns_info hv_get_dhcp_info +SCRIPTS+= hyperv_vfattach hyperv_vfup NO_OBJ= .include From owner-svn-src-all@freebsd.org Mon Aug 7 02:17:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E864FDD7D9A; Mon, 7 Aug 2017 02:17:16 +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 mx1.freebsd.org (Postfix) with ESMTPS id B4F16767D3; Mon, 7 Aug 2017 02:17:16 +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 v772HFlW034685; Mon, 7 Aug 2017 02:17:15 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v772HFHG034684; Mon, 7 Aug 2017 02:17:15 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708070217.v772HFHG034684@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 7 Aug 2017 02:17:15 +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: r322130 - stable/11/sys/ufs/ffs X-SVN-Group: stable-11 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/11/sys/ufs/ffs X-SVN-Commit-Revision: 322130 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 02:17:17 -0000 Author: mckusick Date: Mon Aug 7 02:17:15 2017 New Revision: 322130 URL: https://svnweb.freebsd.org/changeset/base/322130 Log: MFC r321816: Avoid reading a snapshot block when it is already in the cache. Modified: stable/11/sys/ufs/ffs/ffs_snapshot.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_snapshot.c Mon Aug 7 02:15:13 2017 (r322129) +++ stable/11/sys/ufs/ffs/ffs_snapshot.c Mon Aug 7 02:17:15 2017 (r322130) @@ -1403,7 +1403,7 @@ indiracct_ufs2(snapvp, cancelvp, level, blkno, lbn, rl */ bp = getblk(cancelvp, lbn, fs->fs_bsize, 0, 0, 0); bp->b_blkno = fsbtodb(fs, blkno); - if ((bp->b_flags & (B_DONE | B_DELWRI)) == 0 && + if ((bp->b_flags & B_CACHE) == 0 && (error = readblock(cancelvp, bp, fragstoblks(fs, blkno)))) { brelse(bp); return (error); From owner-svn-src-all@freebsd.org Mon Aug 7 02:23:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D084DD8394; Mon, 7 Aug 2017 02:23:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 46D4176C02; Mon, 7 Aug 2017 02:23:35 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v772NYHC038472; Mon, 7 Aug 2017 02:23:34 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v772NYUV038470; Mon, 7 Aug 2017 02:23:34 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708070223.v772NYUV038470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 7 Aug 2017 02:23:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322131 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/10/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 322131 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 02:23:35 -0000 Author: sephe Date: Mon Aug 7 02:23:34 2017 New Revision: 322131 URL: https://svnweb.freebsd.org/changeset/base/322131 Log: MFC 321836,321837 321836 hyperv/hn: Renaming and minor cleanup This prepares for the upcoming transparent VF support. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11708 321837 hyperv/hn: Add comment about ether_ifattach event subscription. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11710 Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 7 02:17:15 2017 (r322130) +++ stable/10/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 7 02:23:34 2017 (r322131) @@ -217,9 +217,9 @@ struct hn_rxinfo { uint32_t hash_value; }; -struct hn_update_vf { +struct hn_rxvf_setarg { struct hn_rx_ring *rxr; - struct ifnet *vf; + struct ifnet *vf_ifp; }; #define HN_RXINFO_VLAN 0x0001 @@ -259,6 +259,13 @@ static void hn_ifaddr_event(void *, struct ifnet *); static void hn_ifnet_attevent(void *, struct ifnet *); static void hn_ifnet_detevent(void *, struct ifnet *); +static bool hn_ismyvf(const struct hn_softc *, + const struct ifnet *); +static void hn_rxvf_change(struct hn_softc *, + struct ifnet *, bool); +static void hn_rxvf_set(struct hn_softc *, struct ifnet *); +static void hn_rxvf_set_task(void *, int); + static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); static void hn_rndis_rx_data(struct hn_rx_ring *, @@ -790,7 +797,7 @@ hn_rxfilter_config(struct hn_softc *sc) HN_LOCK_ASSERT(sc); if ((ifp->if_flags & IFF_PROMISC) || - (sc->hn_flags & HN_FLAG_VF)) { + (sc->hn_flags & HN_FLAG_RXVF)) { filter = NDIS_PACKET_TYPE_PROMISCUOUS; } else { filter = NDIS_PACKET_TYPE_DIRECTED; @@ -978,39 +985,39 @@ hn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *i } static void -hn_update_vf_task(void *arg, int pending __unused) +hn_rxvf_set_task(void *xarg, int pending __unused) { - struct hn_update_vf *uv = arg; + struct hn_rxvf_setarg *arg = xarg; - uv->rxr->hn_rxvf_ifp = uv->vf; + arg->rxr->hn_rxvf_ifp = arg->vf_ifp; } static void -hn_update_vf(struct hn_softc *sc, struct ifnet *vf) +hn_rxvf_set(struct hn_softc *sc, struct ifnet *vf_ifp) { struct hn_rx_ring *rxr; - struct hn_update_vf uv; + struct hn_rxvf_setarg arg; struct task task; int i; HN_LOCK_ASSERT(sc); - TASK_INIT(&task, 0, hn_update_vf_task, &uv); + TASK_INIT(&task, 0, hn_rxvf_set_task, &arg); for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { rxr = &sc->hn_rx_ring[i]; if (i < sc->hn_rx_ring_inuse) { - uv.rxr = rxr; - uv.vf = vf; + arg.rxr = rxr; + arg.vf_ifp = vf_ifp; vmbus_chan_run_task(rxr->hn_chan, &task); } else { - rxr->hn_rxvf_ifp = vf; + rxr->hn_rxvf_ifp = vf_ifp; } } } -static __inline bool +static bool hn_ismyvf(const struct hn_softc *sc, const struct ifnet *ifp) { const struct ifnet *hn_ifp; @@ -1035,7 +1042,7 @@ hn_ismyvf(const struct hn_softc *sc, const struct ifne } static void -hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf) +hn_rxvf_change(struct hn_softc *sc, struct ifnet *ifp, bool rxvf) { struct ifnet *hn_ifp; @@ -1046,21 +1053,19 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool if (!hn_ismyvf(sc, ifp)) goto out; - hn_ifp = sc->hn_ifp; - /* Now we're sure 'ifp' is a real VF device. */ - if (vf) { - if (sc->hn_flags & HN_FLAG_VF) + if (rxvf) { + if (sc->hn_flags & HN_FLAG_RXVF) goto out; - sc->hn_flags |= HN_FLAG_VF; + sc->hn_flags |= HN_FLAG_RXVF; hn_rxfilter_config(sc); } else { - if (!(sc->hn_flags & HN_FLAG_VF)) + if (!(sc->hn_flags & HN_FLAG_RXVF)) goto out; - sc->hn_flags &= ~HN_FLAG_VF; + sc->hn_flags &= ~HN_FLAG_RXVF; if (hn_ifp->if_drv_flags & IFF_DRV_RUNNING) hn_rxfilter_config(sc); else @@ -1068,11 +1073,11 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool } hn_nvs_set_datapath(sc, - vf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTHETIC); + rxvf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTHETIC); - hn_update_vf(sc, vf ? ifp : NULL); + hn_rxvf_set(sc, rxvf ? ifp : NULL); - if (vf) { + if (rxvf) { hn_suspend_mgmt(sc); sc->hn_link_flags &= ~(HN_LINK_FLAG_LINKUP | HN_LINK_FLAG_NETCHG); @@ -1081,12 +1086,13 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool hn_resume_mgmt(sc); } - devctl_notify("HYPERV_NIC_VF", if_name(hn_ifp), - vf ? "VF_UP" : "VF_DOWN", NULL); + devctl_notify("HYPERV_NIC_VF", hn_ifp->if_xname, + rxvf ? "VF_UP" : "VF_DOWN", NULL); - if (bootverbose) - if_printf(hn_ifp, "Data path is switched %s %s\n", - vf ? "to" : "from", if_name(ifp)); + if (bootverbose) { + if_printf(hn_ifp, "datapath is switched %s %s\n", + rxvf ? "to" : "from", ifp->if_xname); + } out: HN_UNLOCK(sc); } @@ -1094,16 +1100,17 @@ out: static void hn_ifnet_event(void *arg, struct ifnet *ifp, int event) { + if (event != IFNET_EVENT_UP && event != IFNET_EVENT_DOWN) return; - - hn_set_vf(arg, ifp, event == IFNET_EVENT_UP); + hn_rxvf_change(arg, ifp, event == IFNET_EVENT_UP); } static void hn_ifaddr_event(void *arg, struct ifnet *ifp) { - hn_set_vf(arg, ifp, ifp->if_flags & IFF_UP); + + hn_rxvf_change(arg, ifp, ifp->if_flags & IFF_UP); } static void @@ -1517,6 +1524,12 @@ hn_attach(device_t dev) sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + /* + * NOTE: + * Subscribe ether_ifattach event, instead of ifnet_arrival event, + * since interface's LLADDR is needed; interface LLADDR is not + * available when ifnet_arrival event is triggered. + */ sc->hn_ifnet_atthand = EVENTHANDLER_REGISTER(ether_ifattach_event, hn_ifnet_attevent, sc, EVENTHANDLER_PRI_ANY); sc->hn_ifnet_dethand = EVENTHANDLER_REGISTER(ifnet_departure_event, @@ -2889,7 +2902,7 @@ hn_stop(struct hn_softc *sc, bool detaching) * If the VF is active, make sure the filter is not 0, even if * the synthetic NIC is down. */ - if (!detaching && (sc->hn_flags & HN_FLAG_VF)) + if (!detaching && (sc->hn_flags & HN_FLAG_RXVF)) hn_rxfilter_config(sc); } @@ -3421,13 +3434,13 @@ hn_vf_sysctl(SYSCTL_HANDLER_ARGS) { struct hn_softc *sc = arg1; char vf_name[IFNAMSIZ + 1]; - struct ifnet *vf; + struct ifnet *vf_ifp; HN_LOCK(sc); vf_name[0] = '\0'; - vf = sc->hn_vf_ifp; - if (vf != NULL) - snprintf(vf_name, sizeof(vf_name), "%s", if_name(vf)); + vf_ifp = sc->hn_vf_ifp; + if (vf_ifp != NULL) + snprintf(vf_name, sizeof(vf_name), "%s", vf_ifp->if_xname); HN_UNLOCK(sc); return sysctl_handle_string(oidp, vf_name, sizeof(vf_name), req); } @@ -3437,13 +3450,13 @@ hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS) { struct hn_softc *sc = arg1; char vf_name[IFNAMSIZ + 1]; - struct ifnet *vf; + struct ifnet *vf_ifp; HN_LOCK(sc); vf_name[0] = '\0'; - vf = sc->hn_rx_ring[0].hn_rxvf_ifp; - if (vf != NULL) - snprintf(vf_name, sizeof(vf_name), "%s", if_name(vf)); + vf_ifp = sc->hn_rx_ring[0].hn_rxvf_ifp; + if (vf_ifp != NULL) + snprintf(vf_name, sizeof(vf_name), "%s", vf_ifp->if_xname); HN_UNLOCK(sc); return sysctl_handle_string(oidp, vf_name, sizeof(vf_name), req); } @@ -5397,7 +5410,7 @@ hn_suspend(struct hn_softc *sc) hn_polling(sc, 0); if ((sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) || - (sc->hn_flags & HN_FLAG_VF)) + (sc->hn_flags & HN_FLAG_RXVF)) hn_suspend_data(sc); hn_suspend_mgmt(sc); } @@ -5487,16 +5500,16 @@ hn_resume(struct hn_softc *sc) { if ((sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) || - (sc->hn_flags & HN_FLAG_VF)) + (sc->hn_flags & HN_FLAG_RXVF)) hn_resume_data(sc); /* * When the VF is activated, the synthetic interface is changed - * to DOWN in hn_set_vf(). Here, if the VF is still active, we - * don't call hn_resume_mgmt() until the VF is deactivated in - * hn_set_vf(). + * to DOWN in hn_rxvf_change(). Here, if the VF is still active, + * we don't call hn_resume_mgmt() until the VF is deactivated in + * hn_rxvf_change(). */ - if (!(sc->hn_flags & HN_FLAG_VF)) + if (!(sc->hn_flags & HN_FLAG_RXVF)) hn_resume_mgmt(sc); /* Modified: stable/10/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Mon Aug 7 02:17:15 2017 (r322130) +++ stable/10/sys/dev/hyperv/netvsc/if_hnvar.h Mon Aug 7 02:23:34 2017 (r322131) @@ -252,7 +252,7 @@ struct hn_softc { #define HN_FLAG_NO_SLEEPING 0x0020 #define HN_FLAG_RXBUF_REF 0x0040 #define HN_FLAG_CHIM_REF 0x0080 -#define HN_FLAG_VF 0x0100 +#define HN_FLAG_RXVF 0x0100 #define HN_FLAG_ERRORS (HN_FLAG_RXBUF_REF | HN_FLAG_CHIM_REF) From owner-svn-src-all@freebsd.org Mon Aug 7 02:29:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4089ADD876A; Mon, 7 Aug 2017 02:29:11 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0A75176E40; Mon, 7 Aug 2017 02:29:10 +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 v772TAwO038759; Mon, 7 Aug 2017 02:29:10 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v772TAJY038758; Mon, 7 Aug 2017 02:29:10 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708070229.v772TAJY038758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 7 Aug 2017 02:29:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322132 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/10/sys/ufs/ffs X-SVN-Commit-Revision: 322132 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 02:29:11 -0000 Author: mckusick Date: Mon Aug 7 02:29:09 2017 New Revision: 322132 URL: https://svnweb.freebsd.org/changeset/base/322132 Log: MFC r321816: Avoid reading a snapshot block when it is already in the cache. Modified: stable/10/sys/ufs/ffs/ffs_snapshot.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_snapshot.c Mon Aug 7 02:23:34 2017 (r322131) +++ stable/10/sys/ufs/ffs/ffs_snapshot.c Mon Aug 7 02:29:09 2017 (r322132) @@ -1403,7 +1403,7 @@ indiracct_ufs2(snapvp, cancelvp, level, blkno, lbn, rl */ bp = getblk(cancelvp, lbn, fs->fs_bsize, 0, 0, 0); bp->b_blkno = fsbtodb(fs, blkno); - if ((bp->b_flags & (B_DONE | B_DELWRI)) == 0 && + if ((bp->b_flags & B_CACHE) == 0 && (error = readblock(cancelvp, bp, fragstoblks(fs, blkno)))) { brelse(bp); return (error); From owner-svn-src-all@freebsd.org Mon Aug 7 02:33:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67409DD8AAF; Mon, 7 Aug 2017 02:33:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 33E6E77201; Mon, 7 Aug 2017 02:33:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v772XMip042595; Mon, 7 Aug 2017 02:33:22 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v772XM9e042594; Mon, 7 Aug 2017 02:33:22 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708070233.v772XM9e042594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 7 Aug 2017 02:33:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322133 - stable/10/sys/dev/hyperv/utilities X-SVN-Group: stable-10 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/10/sys/dev/hyperv/utilities X-SVN-Commit-Revision: 322133 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 02:33:23 -0000 Author: sephe Date: Mon Aug 7 02:33:22 2017 New Revision: 322133 URL: https://svnweb.freebsd.org/changeset/base/322133 Log: MFC 321965 hyperv/kvp: Use proper size macro for adapter id. Submitted by: Christopher Ertl Sponsored by: Microsoft Modified: stable/10/sys/dev/hyperv/utilities/hv_kvp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_kvp.c Mon Aug 7 02:29:09 2017 (r322132) +++ stable/10/sys/dev/hyperv/utilities/hv_kvp.c Mon Aug 7 02:33:22 2017 (r322133) @@ -253,7 +253,7 @@ hv_kvp_convert_utf8_ipinfo_to_utf16(struct hv_kvp_msg UNUSED_FLAG, &err_dns); utf8_to_utf16((uint16_t *)host_ip_msg->kvp_ip_val.adapter_id, - MAX_IP_ADDR_SIZE, + MAX_ADAPTER_ID_SIZE, (char *)umsg->body.kvp_ip_val.adapter_id, strlen((char *)umsg->body.kvp_ip_val.adapter_id), UNUSED_FLAG, From owner-svn-src-all@freebsd.org Mon Aug 7 02:49:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC362DD93A3; Mon, 7 Aug 2017 02:49:27 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 99EA0777D0; Mon, 7 Aug 2017 02:49:27 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v772nQYc047057; Mon, 7 Aug 2017 02:49:26 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v772nQba047053; Mon, 7 Aug 2017 02:49:26 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708070249.v772nQba047053@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 7 Aug 2017 02:49:26 +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: r322134 - in stable/11: contrib/hyperv/tools/scripts etc/devd libexec/hyperv X-SVN-Group: stable-11 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: in stable/11: contrib/hyperv/tools/scripts etc/devd libexec/hyperv X-SVN-Commit-Revision: 322134 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 02:49:27 -0000 Author: sephe Date: Mon Aug 7 02:49:26 2017 New Revision: 322134 URL: https://svnweb.freebsd.org/changeset/base/322134 Log: MFC 321762 hyperv: Add VF bringup scripts and devd rules. How network VF works with hn(4) on Hyper-V in non-transparent mode: - Each network VF has a cooresponding hn(4). - The network VF and the it's cooresponding hn(4) have the same hardware address. - Once the network VF is up, e.g. ifconfig VF up: o All of the transmission should go through the network VF. o Most of the reception goes through the network VF. o Small amount of reception may go through the cooresponding hn(4). This reception will happen, even if the the cooresponding hn(4) is down. The cooresponding hn(4) will change the reception interface to the network VF, so that network layer and application layer will be tricked into thinking that these packets were received by the network VF. o The cooresponding hn(4) pretends the physical link is down. - Once the network VF is down or detached: o All of the transmission should go through the cooresponding hn(4). o All of the reception goes through the cooresponding hn(4). o The cooresponding hn(4) fallbacks to the original physical link detection logic. All these features are mainly used to help live migration, during which the network VF will be detached, while the network communication to the VM must not be cut off. In order to reach this level of live migration transparency, we use failover mode lagg(4) with the network VF and the cooresponding hn(4) attached to it. To ease user configuration for both network VF and non-network VF, the lagg(4) will be created by the following rules, and the configuration of the cooresponding hn(4) will be applied to the lagg(4) automatically. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11635 Added: stable/11/contrib/hyperv/tools/scripts/hyperv_vfattach - copied unchanged from r321762, head/contrib/hyperv/tools/scripts/hyperv_vfattach stable/11/contrib/hyperv/tools/scripts/hyperv_vfup - copied unchanged from r321762, head/contrib/hyperv/tools/scripts/hyperv_vfup Modified: stable/11/etc/devd/hyperv.conf stable/11/libexec/hyperv/Makefile Directory Properties: stable/11/ (props changed) Copied: stable/11/contrib/hyperv/tools/scripts/hyperv_vfattach (from r321762, head/contrib/hyperv/tools/scripts/hyperv_vfattach) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/hyperv/tools/scripts/hyperv_vfattach Mon Aug 7 02:49:26 2017 (r322134, copy of r321762, head/contrib/hyperv/tools/scripts/hyperv_vfattach) @@ -0,0 +1,79 @@ +#!/bin/sh + +# +# If transparent VF is enabled, don't do anything. +# + +sysctl -n hw.hn.vf_transparent > /dev/null 2>&1 +if [ $? -ne 0 ] +then + # Old kernel; no transparent VF. + vf_transparent=0 +else + vf_transparent=`sysctl -n hw.hn.vf_transparent` +fi + +if [ $vf_transparent -ne 0 ] +then + # Transparent VF; done! + exit 0 +fi + +iface=$1 +delay=$2 + +if [ $delay -gt 0 ] +then + # + # Delayed VF up. + # + sleep $delay + ifconfig $iface up + # Done! + exit $? +fi + +# +# Check to see whether $iface is a VF or not. +# If $iface is a VF, bring it up now. +# + +# for hyperv_vf_delay +. /etc/rc.conf + +sysctl -n hw.hn.vflist > /dev/null 2>&1 +if [ $? -ne 0 ] +then + # Old kernel; nothing could be done properly. + exit 0 +fi +vf_list=`sysctl -n hw.hn.vflist` + +for vf in $vf_list +do + if [ $vf = $iface ] + then + # + # Linger a little bit (at least 2 seconds) mainly to + # make sure that $iface is fully attached. + # + # NOTE: + # In Azure hyperv_vf_delay should be configured to a + # large value, e.g. 120 seconds, to avoid racing cloud + # agent goofs. + # + test $hyperv_vf_delay -ge 2 > /dev/null 2>&1 + if [ $? -ne 0 ] + then + hyperv_vf_delay=2 + fi + # + # NOTE: + # "(sleep ..; ifconfig .. up) > /dev/null 2>&1 &" + # does _not_ work. + # + daemon -f /usr/libexec/hyperv/hyperv_vfattach \ + $iface $hyperv_vf_delay + break + fi +done Copied: stable/11/contrib/hyperv/tools/scripts/hyperv_vfup (from r321762, head/contrib/hyperv/tools/scripts/hyperv_vfup) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/hyperv/tools/scripts/hyperv_vfup Mon Aug 7 02:49:26 2017 (r322134, copy of r321762, head/contrib/hyperv/tools/scripts/hyperv_vfup) @@ -0,0 +1,119 @@ +#!/bin/sh + +. /etc/rc.subr +. /etc/network.subr + +load_rc_config netif + +# +# Customized per-interface setup, e.g. hyperv_vfup.hn1 +# +# NOTE-CUSTOMIZE: +# Comment this out, if this script is used as template +# for the customized per-interface setup. +# +if [ -f /usr/libexec/hyperv/hyperv_vfup.$1 ] +then + /usr/libexec/hyperv/hyperv_vfup.$1 + exit $? +fi + +# NOTE-CUSTOMIZE: +#hn=${0##*.} +hn=$1 +hn_unit=`echo $hn | sed 's/[^0-9]*//g'` + +vf=`sysctl -n dev.hn.$hn_unit.vf` +if [ ! $vf ] +then + # Race happened; VF was removed, before we ran. + echo "$hn: VF was detached" + exit 0 +fi + +# +# Create laggX for hnX. +# Add VF and hnX to laggX. +# + +lagg=lagg$hn_unit + +ifconfig $lagg > /dev/null 2>&1 +if [ $? -ne 0 ] +then + # + # No laggX, create it now. + # + ifconfig $lagg create > /dev/null 2>&1 + if [ $? -ne 0 ] + then + echo "$lagg creation failed" + exit 1 + fi + + # + # Configure laggX (failover), add hnX and VF to it. + # + ifconfig $lagg laggproto failover laggport $hn laggport $vf + ifconfig $lagg inet6 no_dad + + # + # Stop dhclient on hnX, if any. + # + pidfile=/var/run/dhclient.$hn.pid + if [ -f $pidfile ] + then + kill -TERM `cat $pidfile` + fi + + # + # Remove all configured IPv4 addresses on hnX, e.g. + # configured by dhclient. laggX will take over the + # network operations. + # + while true + do + ifconfig $hn -alias > /dev/null 2>&1 + if [ $? -ne 0 ] + then + break + fi + done + + # TODO: Remove IPv6 addresses on hnX + + # + # Use hnX's configuration for laggX + # + # NOTE-CUSTOMIZE: + # If this script is used as template for the customized + # per-interface setup, replace this with whatever you + # want to do with the laggX. + # + if dhcpif $hn; + then + ifconfig $lagg up + if syncdhcpif $hn; + then + dhclient $lagg + else + dhclient -b $lagg + fi + else + ifconfig_args=`ifconfig_getargs $hn` + if [ -n "$ifconfig_args" ] + then + ifconfig $lagg $ifconfig_args + fi + fi +else + # + # laggX exists. Check whether VF was there or not. + # If VF was not added to laggX, add it now. + # + ifconfig $lagg | grep "laggport: $vf" > /dev/null 2>&1 + if [ $? -ne 0 ] + then + ifconfig $lagg laggport $vf + fi +fi Modified: stable/11/etc/devd/hyperv.conf ============================================================================== --- stable/11/etc/devd/hyperv.conf Mon Aug 7 02:33:22 2017 (r322133) +++ stable/11/etc/devd/hyperv.conf Mon Aug 7 02:49:26 2017 (r322134) @@ -33,3 +33,76 @@ notify 11 { match "cdev" "hv_fsvss_dev"; action "pkill -x hv_vss_daemon"; }; + +# +# Rules for non-transparent network VF. +# +# How network VF works with hn(4) on Hyper-V in non-transparent mode: +# +# - Each network VF has a cooresponding hn(4). +# - The network VF and the it's cooresponding hn(4) have the same hardware +# address. +# - Once the network VF is up, e.g. ifconfig VF up: +# o All of the transmission should go through the network VF. +# o Most of the reception goes through the network VF. +# o Small amount of reception may go through the cooresponding hn(4). +# This reception will happen, even if the the cooresponding hn(4) is +# down. The cooresponding hn(4) will change the reception interface +# to the network VF, so that network layer and application layer will +# be tricked into thinking that these packets were received by the +# network VF. +# o The cooresponding hn(4) pretends the physical link is down. +# - Once the network VF is down or detached: +# o All of the transmission should go through the cooresponding hn(4). +# o All of the reception goes through the cooresponding hn(4). +# o The cooresponding hn(4) fallbacks to the original physical link +# detection logic. +# +# All these features are mainly used to help live migration, during which +# the network VF will be detached, while the network communication to the +# VM must not be cut off. In order to reach this level of live migration +# transparency, we use failover mode lagg(4) with the network VF and the +# cooresponding hn(4) attached to it. +# +# To ease user configuration for both network VF and non-network VF, the +# lagg(4) will be created by the following rules, and the configuration +# of the cooresponding hn(4) will be applied to the lagg(4) automatically. +# +# NOTE: +# If live migration is not needed at all, the following rules could be +# commented out, and the network VF interface could be used exclusively. +# Most often the cooresponding hn(4) could be completely ignored. +# +# +# Default workflow for the network VF bringup: +# 1) ETHERNET/IFATTACH -> VF interface up (delayed by rc.conf hyperv_vf_delay +# seconds). This operation will trigger HYPERV_NIC_VF/VF_UP. +# 2) HYPERV_NIC_VF/VF_UP: +# a) Create laggX coresponding to hnX. +# b) Add hnX and VF to laggX. +# c) Whack all previous network configuration on hnX, including stopping +# dhclient. +# d) Apply rc.conf ifconfig_hnX to laggX; i.e. including starting dhclient. +# +# NOTE: +# HYPERV_NIC_VF/VF_UP action script could be customized per-interface by +# adding /usr/libexec/hyperv/hyperv_vfup.hnX script. +# /usr/libexec/hyperv/hyperv_vfup could be used as the template for the +# customized per-interface script. +# +# NOTE: +# For transparent network VF, hyperv_vfattach does nothing and +# HYPERV_NIC_VF/VF_UP will not be triggered at all. +# + +notify 10 { + match "system" "HYPERV_NIC_VF"; + match "type" "VF_UP"; + action "/usr/libexec/hyperv/hyperv_vfup $subsystem"; +}; + +notify 10 { + match "system" "ETHERNET"; + match "type" "IFATTACH"; + action "/usr/libexec/hyperv/hyperv_vfattach $subsystem 0"; +}; Modified: stable/11/libexec/hyperv/Makefile ============================================================================== --- stable/11/libexec/hyperv/Makefile Mon Aug 7 02:33:22 2017 (r322133) +++ stable/11/libexec/hyperv/Makefile Mon Aug 7 02:49:26 2017 (r322134) @@ -5,5 +5,6 @@ BINDIR= ${LIBEXECDIR}/hyperv SCRIPTS= hv_set_ifconfig hv_get_dns_info hv_get_dhcp_info +SCRIPTS+= hyperv_vfattach hyperv_vfup .include From owner-svn-src-all@freebsd.org Mon Aug 7 03:03:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 310C9DD9D3C; Mon, 7 Aug 2017 03:03:42 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 0BAB47C38D; Mon, 7 Aug 2017 03:03:41 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7733efc055752; Mon, 7 Aug 2017 03:03:40 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7733egA055750; Mon, 7 Aug 2017 03:03:40 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708070303.v7733egA055750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 7 Aug 2017 03:03: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: r322135 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/11/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 322135 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 03:03:42 -0000 Author: sephe Date: Mon Aug 7 03:03:40 2017 New Revision: 322135 URL: https://svnweb.freebsd.org/changeset/base/322135 Log: MFC 321836,321837 321836 hyperv/hn: Renaming and minor cleanup This prepares for the upcoming transparent VF support. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11708 321837 hyperv/hn: Add comment about ether_ifattach event subscription. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11710 Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 7 02:49:26 2017 (r322134) +++ stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 7 03:03:40 2017 (r322135) @@ -222,9 +222,9 @@ struct hn_rxinfo { uint32_t hash_value; }; -struct hn_update_vf { +struct hn_rxvf_setarg { struct hn_rx_ring *rxr; - struct ifnet *vf; + struct ifnet *vf_ifp; }; #define HN_RXINFO_VLAN 0x0001 @@ -264,6 +264,13 @@ static void hn_ifaddr_event(void *, struct ifnet *); static void hn_ifnet_attevent(void *, struct ifnet *); static void hn_ifnet_detevent(void *, struct ifnet *); +static bool hn_ismyvf(const struct hn_softc *, + const struct ifnet *); +static void hn_rxvf_change(struct hn_softc *, + struct ifnet *, bool); +static void hn_rxvf_set(struct hn_softc *, struct ifnet *); +static void hn_rxvf_set_task(void *, int); + static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); static void hn_rndis_rx_data(struct hn_rx_ring *, @@ -801,7 +808,7 @@ hn_rxfilter_config(struct hn_softc *sc) HN_LOCK_ASSERT(sc); if ((ifp->if_flags & IFF_PROMISC) || - (sc->hn_flags & HN_FLAG_VF)) { + (sc->hn_flags & HN_FLAG_RXVF)) { filter = NDIS_PACKET_TYPE_PROMISCUOUS; } else { filter = NDIS_PACKET_TYPE_DIRECTED; @@ -991,39 +998,39 @@ hn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *i } static void -hn_update_vf_task(void *arg, int pending __unused) +hn_rxvf_set_task(void *xarg, int pending __unused) { - struct hn_update_vf *uv = arg; + struct hn_rxvf_setarg *arg = xarg; - uv->rxr->hn_rxvf_ifp = uv->vf; + arg->rxr->hn_rxvf_ifp = arg->vf_ifp; } static void -hn_update_vf(struct hn_softc *sc, struct ifnet *vf) +hn_rxvf_set(struct hn_softc *sc, struct ifnet *vf_ifp) { struct hn_rx_ring *rxr; - struct hn_update_vf uv; + struct hn_rxvf_setarg arg; struct task task; int i; HN_LOCK_ASSERT(sc); - TASK_INIT(&task, 0, hn_update_vf_task, &uv); + TASK_INIT(&task, 0, hn_rxvf_set_task, &arg); for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { rxr = &sc->hn_rx_ring[i]; if (i < sc->hn_rx_ring_inuse) { - uv.rxr = rxr; - uv.vf = vf; + arg.rxr = rxr; + arg.vf_ifp = vf_ifp; vmbus_chan_run_task(rxr->hn_chan, &task); } else { - rxr->hn_rxvf_ifp = vf; + rxr->hn_rxvf_ifp = vf_ifp; } } } -static __inline bool +static bool hn_ismyvf(const struct hn_softc *sc, const struct ifnet *ifp) { const struct ifnet *hn_ifp; @@ -1048,7 +1055,7 @@ hn_ismyvf(const struct hn_softc *sc, const struct ifne } static void -hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf) +hn_rxvf_change(struct hn_softc *sc, struct ifnet *ifp, bool rxvf) { struct ifnet *hn_ifp; @@ -1059,21 +1066,19 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool if (!hn_ismyvf(sc, ifp)) goto out; - hn_ifp = sc->hn_ifp; - /* Now we're sure 'ifp' is a real VF device. */ - if (vf) { - if (sc->hn_flags & HN_FLAG_VF) + if (rxvf) { + if (sc->hn_flags & HN_FLAG_RXVF) goto out; - sc->hn_flags |= HN_FLAG_VF; + sc->hn_flags |= HN_FLAG_RXVF; hn_rxfilter_config(sc); } else { - if (!(sc->hn_flags & HN_FLAG_VF)) + if (!(sc->hn_flags & HN_FLAG_RXVF)) goto out; - sc->hn_flags &= ~HN_FLAG_VF; + sc->hn_flags &= ~HN_FLAG_RXVF; if (hn_ifp->if_drv_flags & IFF_DRV_RUNNING) hn_rxfilter_config(sc); else @@ -1081,11 +1086,11 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool } hn_nvs_set_datapath(sc, - vf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTHETIC); + rxvf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTHETIC); - hn_update_vf(sc, vf ? ifp : NULL); + hn_rxvf_set(sc, rxvf ? ifp : NULL); - if (vf) { + if (rxvf) { hn_suspend_mgmt(sc); sc->hn_link_flags &= ~(HN_LINK_FLAG_LINKUP | HN_LINK_FLAG_NETCHG); @@ -1094,12 +1099,13 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool hn_resume_mgmt(sc); } - devctl_notify("HYPERV_NIC_VF", if_name(hn_ifp), - vf ? "VF_UP" : "VF_DOWN", NULL); + devctl_notify("HYPERV_NIC_VF", hn_ifp->if_xname, + rxvf ? "VF_UP" : "VF_DOWN", NULL); - if (bootverbose) - if_printf(hn_ifp, "Data path is switched %s %s\n", - vf ? "to" : "from", if_name(ifp)); + if (bootverbose) { + if_printf(hn_ifp, "datapath is switched %s %s\n", + rxvf ? "to" : "from", ifp->if_xname); + } out: HN_UNLOCK(sc); } @@ -1107,16 +1113,17 @@ out: static void hn_ifnet_event(void *arg, struct ifnet *ifp, int event) { + if (event != IFNET_EVENT_UP && event != IFNET_EVENT_DOWN) return; - - hn_set_vf(arg, ifp, event == IFNET_EVENT_UP); + hn_rxvf_change(arg, ifp, event == IFNET_EVENT_UP); } static void hn_ifaddr_event(void *arg, struct ifnet *ifp) { - hn_set_vf(arg, ifp, ifp->if_flags & IFF_UP); + + hn_rxvf_change(arg, ifp, ifp->if_flags & IFF_UP); } static void @@ -1534,6 +1541,12 @@ hn_attach(device_t dev) sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + /* + * NOTE: + * Subscribe ether_ifattach event, instead of ifnet_arrival event, + * since interface's LLADDR is needed; interface LLADDR is not + * available when ifnet_arrival event is triggered. + */ sc->hn_ifnet_atthand = EVENTHANDLER_REGISTER(ether_ifattach_event, hn_ifnet_attevent, sc, EVENTHANDLER_PRI_ANY); sc->hn_ifnet_dethand = EVENTHANDLER_REGISTER(ifnet_departure_event, @@ -2902,7 +2915,7 @@ hn_stop(struct hn_softc *sc, bool detaching) * If the VF is active, make sure the filter is not 0, even if * the synthetic NIC is down. */ - if (!detaching && (sc->hn_flags & HN_FLAG_VF)) + if (!detaching && (sc->hn_flags & HN_FLAG_RXVF)) hn_rxfilter_config(sc); } @@ -3438,13 +3451,13 @@ hn_vf_sysctl(SYSCTL_HANDLER_ARGS) { struct hn_softc *sc = arg1; char vf_name[IFNAMSIZ + 1]; - struct ifnet *vf; + struct ifnet *vf_ifp; HN_LOCK(sc); vf_name[0] = '\0'; - vf = sc->hn_vf_ifp; - if (vf != NULL) - snprintf(vf_name, sizeof(vf_name), "%s", if_name(vf)); + vf_ifp = sc->hn_vf_ifp; + if (vf_ifp != NULL) + snprintf(vf_name, sizeof(vf_name), "%s", vf_ifp->if_xname); HN_UNLOCK(sc); return sysctl_handle_string(oidp, vf_name, sizeof(vf_name), req); } @@ -3454,13 +3467,13 @@ hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS) { struct hn_softc *sc = arg1; char vf_name[IFNAMSIZ + 1]; - struct ifnet *vf; + struct ifnet *vf_ifp; HN_LOCK(sc); vf_name[0] = '\0'; - vf = sc->hn_rx_ring[0].hn_rxvf_ifp; - if (vf != NULL) - snprintf(vf_name, sizeof(vf_name), "%s", if_name(vf)); + vf_ifp = sc->hn_rx_ring[0].hn_rxvf_ifp; + if (vf_ifp != NULL) + snprintf(vf_name, sizeof(vf_name), "%s", vf_ifp->if_xname); HN_UNLOCK(sc); return sysctl_handle_string(oidp, vf_name, sizeof(vf_name), req); } @@ -5445,7 +5458,7 @@ hn_suspend(struct hn_softc *sc) hn_polling(sc, 0); if ((sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) || - (sc->hn_flags & HN_FLAG_VF)) + (sc->hn_flags & HN_FLAG_RXVF)) hn_suspend_data(sc); hn_suspend_mgmt(sc); } @@ -5535,16 +5548,16 @@ hn_resume(struct hn_softc *sc) { if ((sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) || - (sc->hn_flags & HN_FLAG_VF)) + (sc->hn_flags & HN_FLAG_RXVF)) hn_resume_data(sc); /* * When the VF is activated, the synthetic interface is changed - * to DOWN in hn_set_vf(). Here, if the VF is still active, we - * don't call hn_resume_mgmt() until the VF is deactivated in - * hn_set_vf(). + * to DOWN in hn_rxvf_change(). Here, if the VF is still active, + * we don't call hn_resume_mgmt() until the VF is deactivated in + * hn_rxvf_change(). */ - if (!(sc->hn_flags & HN_FLAG_VF)) + if (!(sc->hn_flags & HN_FLAG_RXVF)) hn_resume_mgmt(sc); /* Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Aug 7 02:49:26 2017 (r322134) +++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h Mon Aug 7 03:03:40 2017 (r322135) @@ -251,7 +251,7 @@ struct hn_softc { #define HN_FLAG_NO_SLEEPING 0x0020 #define HN_FLAG_RXBUF_REF 0x0040 #define HN_FLAG_CHIM_REF 0x0080 -#define HN_FLAG_VF 0x0100 +#define HN_FLAG_RXVF 0x0100 #define HN_FLAG_ERRORS (HN_FLAG_RXBUF_REF | HN_FLAG_CHIM_REF) From owner-svn-src-all@freebsd.org Mon Aug 7 03:14:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53419DAB64D; Mon, 7 Aug 2017 03:14:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 20B027C954; Mon, 7 Aug 2017 03:14:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v773EjSC059694; Mon, 7 Aug 2017 03:14:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v773EjWX059693; Mon, 7 Aug 2017 03:14:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708070314.v773EjWX059693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 7 Aug 2017 03:14:45 +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: r322136 - stable/11/sys/dev/hyperv/utilities X-SVN-Group: stable-11 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: stable/11/sys/dev/hyperv/utilities X-SVN-Commit-Revision: 322136 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 03:14:46 -0000 Author: sephe Date: Mon Aug 7 03:14:45 2017 New Revision: 322136 URL: https://svnweb.freebsd.org/changeset/base/322136 Log: MFC 321965 hyperv/kvp: Use proper size macro for adapter id. Submitted by: Christopher Ertl Sponsored by: Microsoft Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Aug 7 03:03:40 2017 (r322135) +++ stable/11/sys/dev/hyperv/utilities/hv_kvp.c Mon Aug 7 03:14:45 2017 (r322136) @@ -253,7 +253,7 @@ hv_kvp_convert_utf8_ipinfo_to_utf16(struct hv_kvp_msg UNUSED_FLAG, &err_dns); utf8_to_utf16((uint16_t *)host_ip_msg->kvp_ip_val.adapter_id, - MAX_IP_ADDR_SIZE, + MAX_ADAPTER_ID_SIZE, (char *)umsg->body.kvp_ip_val.adapter_id, strlen((char *)umsg->body.kvp_ip_val.adapter_id), UNUSED_FLAG, From owner-svn-src-all@freebsd.org Mon Aug 7 07:02:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6A1CDBF770; Mon, 7 Aug 2017 07:02: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 mx1.freebsd.org (Postfix) with ESMTPS id BD049822DB; Mon, 7 Aug 2017 07:02: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 v7772pg6052289; Mon, 7 Aug 2017 07:02:51 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7772pap052286; Mon, 7 Aug 2017 07:02:51 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708070702.v7772pap052286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 7 Aug 2017 07:02:51 +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: r322137 - in stable/11/sys: fs/nfsserver nfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys: fs/nfsserver nfs X-SVN-Commit-Revision: 322137 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 07:02:53 -0000 Author: mav Date: Mon Aug 7 07:02:51 2017 New Revision: 322137 URL: https://svnweb.freebsd.org/changeset/base/322137 Log: MFC r321794: Improve FHA locality control for NFS read/write requests. This change adds two new tunables, allowing to control serialization for read and write NFS requests separately. It does not change the default behavior since there are too many factors to consider, but gives additional space for further experiments and tuning. The main motivation for this change is very low write speed in case of ZFS with sync=always or when NFS clients requests sychronous operation, when every separate request has to be written/flushed to ZIL, and requests are processed one at a time. Setting vfs.nfsd.fha.write=0 in that case allows to increase ZIL throughput by several times by coalescing writes and cache flushes. There is a worry that doing it may increase data fragmentation on disks, but I suppose it should not happen for pool with SLOG. Sponsored by: iXsystems, Inc. Modified: stable/11/sys/fs/nfsserver/nfs_fha_new.c stable/11/sys/nfs/nfs_fha.c stable/11/sys/nfs/nfs_fha.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsserver/nfs_fha_new.c ============================================================================== --- stable/11/sys/fs/nfsserver/nfs_fha_new.c Mon Aug 7 03:14:45 2017 (r322136) +++ stable/11/sys/fs/nfsserver/nfs_fha_new.c Mon Aug 7 07:02:51 2017 (r322137) @@ -93,7 +93,7 @@ fhanew_init(void *foo) sysctl_ctx_init(&softc->sysctl_ctx); softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx, SYSCTL_STATIC_CHILDREN(_vfs_nfsd), OID_AUTO, "fha", CTLFLAG_RD, - 0, "fha node"); + 0, "NFS File Handle Affinity (FHA)"); if (softc->sysctl_tree == NULL) { printf("%s: unable to allocate sysctl tree\n", __func__); return; Modified: stable/11/sys/nfs/nfs_fha.c ============================================================================== --- stable/11/sys/nfs/nfs_fha.c Mon Aug 7 03:14:45 2017 (r322136) +++ stable/11/sys/nfs/nfs_fha.c Mon Aug 7 07:02:51 2017 (r322137) @@ -51,7 +51,6 @@ static MALLOC_DEFINE(M_NFS_FHA, "NFS FHA", "NFS FHA"); void fha_init(struct fha_params *softc) { - char tmpstr[128]; int i; for (i = 0; i < FHA_HASH_SIZE; i++) @@ -61,47 +60,38 @@ fha_init(struct fha_params *softc) * Set the default tuning parameters. */ softc->ctls.enable = FHA_DEF_ENABLE; + softc->ctls.read = FHA_DEF_READ; + softc->ctls.write = FHA_DEF_WRITE; softc->ctls.bin_shift = FHA_DEF_BIN_SHIFT; softc->ctls.max_nfsds_per_fh = FHA_DEF_MAX_NFSDS_PER_FH; softc->ctls.max_reqs_per_nfsd = FHA_DEF_MAX_REQS_PER_NFSD; /* - * Allow the user to override the defaults at boot time with - * tunables. + * Add sysctls so the user can change the tuning parameters. */ - snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.enable", - softc->server_name); - TUNABLE_INT_FETCH(tmpstr, &softc->ctls.enable); - snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.bin_shift", - softc->server_name); - TUNABLE_INT_FETCH(tmpstr, &softc->ctls.bin_shift); - snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.max_nfsds_per_fh", - softc->server_name); - TUNABLE_INT_FETCH(tmpstr, &softc->ctls.max_nfsds_per_fh); - snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.max_reqs_per_nfsd", - softc->server_name); - TUNABLE_INT_FETCH(tmpstr, &softc->ctls.max_reqs_per_nfsd); - - /* - * Add sysctls so the user can change the tuning parameters at - * runtime. - */ SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "enable", CTLFLAG_RW, + OID_AUTO, "enable", CTLFLAG_RWTUN, &softc->ctls.enable, 0, "Enable NFS File Handle Affinity (FHA)"); SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "bin_shift", CTLFLAG_RW, - &softc->ctls.bin_shift, 0, "For FHA reads, no two requests will " - "contend if they're 2^(bin_shift) bytes apart"); + OID_AUTO, "read", CTLFLAG_RWTUN, + &softc->ctls.read, 0, "Enable NFS FHA read locality"); SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "max_nfsds_per_fh", CTLFLAG_RW, + OID_AUTO, "write", CTLFLAG_RWTUN, + &softc->ctls.write, 0, "Enable NFS FHA write locality"); + + SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "bin_shift", CTLFLAG_RWTUN, + &softc->ctls.bin_shift, 0, "Maximum locality distance 2^(bin_shift) bytes"); + + SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "max_nfsds_per_fh", CTLFLAG_RWTUN, &softc->ctls.max_nfsds_per_fh, 0, "Maximum nfsd threads that " "should be working on requests for the same file handle"); SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "max_reqs_per_nfsd", CTLFLAG_RW, + OID_AUTO, "max_reqs_per_nfsd", CTLFLAG_RWTUN, &softc->ctls.max_reqs_per_nfsd, 0, "Maximum requests that " "single nfsd thread should be working on at any time"); @@ -144,6 +134,7 @@ fha_extract_info(struct svc_req *req, struct fha_info i->fh = ++random_fh; i->offset = 0; i->locktype = LK_EXCLUSIVE; + i->read = i->write = 0; /* * Extract the procnum and convert to v3 form if necessary, @@ -169,6 +160,9 @@ fha_extract_info(struct svc_req *req, struct fha_info if (cb->no_offset(procnum)) goto out; + i->read = cb->is_read(procnum); + i->write = cb->is_write(procnum); + error = cb->realign(&req->rq_args, M_NOWAIT); if (error) goto out; @@ -181,7 +175,7 @@ fha_extract_info(struct svc_req *req, struct fha_info goto out; /* Content ourselves with zero offset for all but reads. */ - if (cb->is_read(procnum) || cb->is_write(procnum)) + if (i->read || i->write) cb->get_offset(&md, &dpos, v3, i); out: @@ -311,8 +305,13 @@ fha_hash_entry_choose_thread(struct fha_params *softc, return (thread); } + /* Check whether we should consider locality. */ + if ((i->read && !softc->ctls.read) || + (i->write && !softc->ctls.write)) + goto noloc; + /* - * Check for read locality, making sure that we won't + * Check for locality, making sure that we won't * exceed our per-thread load limit in the process. */ offset1 = i->offset; @@ -332,6 +331,7 @@ fha_hash_entry_choose_thread(struct fha_params *softc, } } +noloc: /* * We don't have a locality match, so skip this thread, * but keep track of the most attractive thread in case Modified: stable/11/sys/nfs/nfs_fha.h ============================================================================== --- stable/11/sys/nfs/nfs_fha.h Mon Aug 7 03:14:45 2017 (r322136) +++ stable/11/sys/nfs/nfs_fha.h Mon Aug 7 07:02:51 2017 (r322137) @@ -31,6 +31,8 @@ /* Sysctl defaults. */ #define FHA_DEF_ENABLE 1 +#define FHA_DEF_READ 1 +#define FHA_DEF_WRITE 1 #define FHA_DEF_BIN_SHIFT 22 /* 4MB */ #define FHA_DEF_MAX_NFSDS_PER_FH 8 #define FHA_DEF_MAX_REQS_PER_NFSD 0 /* Unlimited */ @@ -39,6 +41,8 @@ struct fha_ctls { int enable; + int read; + int write; uint32_t bin_shift; uint32_t max_nfsds_per_fh; uint32_t max_reqs_per_nfsd; @@ -79,6 +83,8 @@ struct fha_info { u_int64_t fh; off_t offset; int locktype; + int read; + int write; }; struct fha_callbacks { From owner-svn-src-all@freebsd.org Mon Aug 7 07:40:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26A54DC1153; Mon, 7 Aug 2017 07:40:02 +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 mx1.freebsd.org (Postfix) with ESMTPS id EEF2683138; Mon, 7 Aug 2017 07:40: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 v777e1EU064777; Mon, 7 Aug 2017 07:40:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v777e0Ck064774; Mon, 7 Aug 2017 07:40:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708070740.v777e0Ck064774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 7 Aug 2017 07:40:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322138 - in stable/10/sys: fs/nfsserver nfs X-SVN-Group: stable-10 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/10/sys: fs/nfsserver nfs X-SVN-Commit-Revision: 322138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 07:40:02 -0000 Author: mav Date: Mon Aug 7 07:40:00 2017 New Revision: 322138 URL: https://svnweb.freebsd.org/changeset/base/322138 Log: MFC r321794: Improve FHA locality control for NFS read/write requests. This change adds two new tunables, allowing to control serialization for read and write NFS requests separately. It does not change the default behavior since there are too many factors to consider, but gives additional space for further experiments and tuning. The main motivation for this change is very low write speed in case of ZFS with sync=always or when NFS clients requests sychronous operation, when every separate request has to be written/flushed to ZIL, and requests are processed one at a time. Setting vfs.nfsd.fha.write=0 in that case allows to increase ZIL throughput by several times by coalescing writes and cache flushes. There is a worry that doing it may increase data fragmentation on disks, but I suppose it should not happen for pool with SLOG. Sponsored by: iXsystems, Inc. Modified: stable/10/sys/fs/nfsserver/nfs_fha_new.c stable/10/sys/nfs/nfs_fha.c stable/10/sys/nfs/nfs_fha.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_fha_new.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_fha_new.c Mon Aug 7 07:02:51 2017 (r322137) +++ stable/10/sys/fs/nfsserver/nfs_fha_new.c Mon Aug 7 07:40:00 2017 (r322138) @@ -93,7 +93,7 @@ fhanew_init(void *foo) sysctl_ctx_init(&softc->sysctl_ctx); softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx, SYSCTL_STATIC_CHILDREN(_vfs_nfsd), OID_AUTO, "fha", CTLFLAG_RD, - 0, "fha node"); + 0, "NFS File Handle Affinity (FHA)"); if (softc->sysctl_tree == NULL) { printf("%s: unable to allocate sysctl tree\n", __func__); return; Modified: stable/10/sys/nfs/nfs_fha.c ============================================================================== --- stable/10/sys/nfs/nfs_fha.c Mon Aug 7 07:02:51 2017 (r322137) +++ stable/10/sys/nfs/nfs_fha.c Mon Aug 7 07:40:00 2017 (r322138) @@ -51,7 +51,6 @@ static MALLOC_DEFINE(M_NFS_FHA, "NFS FHA", "NFS FHA"); void fha_init(struct fha_params *softc) { - char tmpstr[128]; int i; for (i = 0; i < FHA_HASH_SIZE; i++) @@ -61,47 +60,38 @@ fha_init(struct fha_params *softc) * Set the default tuning parameters. */ softc->ctls.enable = FHA_DEF_ENABLE; + softc->ctls.read = FHA_DEF_READ; + softc->ctls.write = FHA_DEF_WRITE; softc->ctls.bin_shift = FHA_DEF_BIN_SHIFT; softc->ctls.max_nfsds_per_fh = FHA_DEF_MAX_NFSDS_PER_FH; softc->ctls.max_reqs_per_nfsd = FHA_DEF_MAX_REQS_PER_NFSD; /* - * Allow the user to override the defaults at boot time with - * tunables. + * Add sysctls so the user can change the tuning parameters. */ - snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.enable", - softc->server_name); - TUNABLE_INT_FETCH(tmpstr, &softc->ctls.enable); - snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.bin_shift", - softc->server_name); - TUNABLE_INT_FETCH(tmpstr, &softc->ctls.bin_shift); - snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.max_nfsds_per_fh", - softc->server_name); - TUNABLE_INT_FETCH(tmpstr, &softc->ctls.max_nfsds_per_fh); - snprintf(tmpstr, sizeof(tmpstr), "vfs.%s.fha.max_reqs_per_nfsd", - softc->server_name); - TUNABLE_INT_FETCH(tmpstr, &softc->ctls.max_reqs_per_nfsd); - - /* - * Add sysctls so the user can change the tuning parameters at - * runtime. - */ SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "enable", CTLFLAG_RW, + OID_AUTO, "enable", CTLFLAG_RWTUN, &softc->ctls.enable, 0, "Enable NFS File Handle Affinity (FHA)"); SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "bin_shift", CTLFLAG_RW, - &softc->ctls.bin_shift, 0, "For FHA reads, no two requests will " - "contend if they're 2^(bin_shift) bytes apart"); + OID_AUTO, "read", CTLFLAG_RWTUN, + &softc->ctls.read, 0, "Enable NFS FHA read locality"); SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "max_nfsds_per_fh", CTLFLAG_RW, + OID_AUTO, "write", CTLFLAG_RWTUN, + &softc->ctls.write, 0, "Enable NFS FHA write locality"); + + SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "bin_shift", CTLFLAG_RWTUN, + &softc->ctls.bin_shift, 0, "Maximum locality distance 2^(bin_shift) bytes"); + + SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "max_nfsds_per_fh", CTLFLAG_RWTUN, &softc->ctls.max_nfsds_per_fh, 0, "Maximum nfsd threads that " "should be working on requests for the same file handle"); SYSCTL_ADD_UINT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "max_reqs_per_nfsd", CTLFLAG_RW, + OID_AUTO, "max_reqs_per_nfsd", CTLFLAG_RWTUN, &softc->ctls.max_reqs_per_nfsd, 0, "Maximum requests that " "single nfsd thread should be working on at any time"); @@ -144,6 +134,7 @@ fha_extract_info(struct svc_req *req, struct fha_info i->fh = ++random_fh; i->offset = 0; i->locktype = LK_EXCLUSIVE; + i->read = i->write = 0; /* * Extract the procnum and convert to v3 form if necessary, @@ -169,6 +160,9 @@ fha_extract_info(struct svc_req *req, struct fha_info if (cb->no_offset(procnum)) goto out; + i->read = cb->is_read(procnum); + i->write = cb->is_write(procnum); + error = cb->realign(&req->rq_args, M_NOWAIT); if (error) goto out; @@ -181,7 +175,7 @@ fha_extract_info(struct svc_req *req, struct fha_info goto out; /* Content ourselves with zero offset for all but reads. */ - if (cb->is_read(procnum) || cb->is_write(procnum)) + if (i->read || i->write) cb->get_offset(&md, &dpos, v3, i); out: @@ -311,8 +305,13 @@ fha_hash_entry_choose_thread(struct fha_params *softc, return (thread); } + /* Check whether we should consider locality. */ + if ((i->read && !softc->ctls.read) || + (i->write && !softc->ctls.write)) + goto noloc; + /* - * Check for read locality, making sure that we won't + * Check for locality, making sure that we won't * exceed our per-thread load limit in the process. */ offset1 = i->offset; @@ -332,6 +331,7 @@ fha_hash_entry_choose_thread(struct fha_params *softc, } } +noloc: /* * We don't have a locality match, so skip this thread, * but keep track of the most attractive thread in case Modified: stable/10/sys/nfs/nfs_fha.h ============================================================================== --- stable/10/sys/nfs/nfs_fha.h Mon Aug 7 07:02:51 2017 (r322137) +++ stable/10/sys/nfs/nfs_fha.h Mon Aug 7 07:40:00 2017 (r322138) @@ -31,6 +31,8 @@ /* Sysctl defaults. */ #define FHA_DEF_ENABLE 1 +#define FHA_DEF_READ 1 +#define FHA_DEF_WRITE 1 #define FHA_DEF_BIN_SHIFT 22 /* 4MB */ #define FHA_DEF_MAX_NFSDS_PER_FH 8 #define FHA_DEF_MAX_REQS_PER_NFSD 0 /* Unlimited */ @@ -39,6 +41,8 @@ struct fha_ctls { int enable; + int read; + int write; uint32_t bin_shift; uint32_t max_nfsds_per_fh; uint32_t max_reqs_per_nfsd; @@ -79,6 +83,8 @@ struct fha_info { u_int64_t fh; off_t offset; int locktype; + int read; + int write; }; struct fha_callbacks { From owner-svn-src-all@freebsd.org Mon Aug 7 08:45:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2065EDC4524; Mon, 7 Aug 2017 08:45:10 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 EF11716E3; Mon, 7 Aug 2017 08:45:09 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v778j9V7092671; Mon, 7 Aug 2017 08:45:09 GMT (envelope-from gahr@FreeBSD.org) Received: (from gahr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v778j8gS092667; Mon, 7 Aug 2017 08:45:08 GMT (envelope-from gahr@FreeBSD.org) Message-Id: <201708070845.v778j8gS092667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gahr set sender to gahr@FreeBSD.org using -f From: Pietro Cerutti Date: Mon, 7 Aug 2017 08:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322139 - in head: contrib/top usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: gahr X-SVN-Commit-Paths: in head: contrib/top usr.bin/top X-SVN-Commit-Revision: 322139 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 08:45:10 -0000 Author: gahr (ports committer) Date: Mon Aug 7 08:45:08 2017 New Revision: 322139 URL: https://svnweb.freebsd.org/changeset/base/322139 Log: Enhance top(1) to filter on multiple usernames Reviewed by: cognet, bapt Approved by: cognet MFC after: 1 week Relnotes: yes Differential Revision: https://reviews.freebsd.org/D11840 Modified: head/contrib/top/machine.h head/contrib/top/top.c head/contrib/top/top.xs head/usr.bin/top/machine.c Modified: head/contrib/top/machine.h ============================================================================== --- head/contrib/top/machine.h Mon Aug 7 07:40:00 2017 (r322138) +++ head/contrib/top/machine.h Mon Aug 7 08:45:08 2017 (r322139) @@ -70,7 +70,8 @@ struct process_select int self; /* show self */ int system; /* show system processes */ int thread; /* show threads */ - int uid; /* only this uid (unless uid == -1) */ +#define TOP_MAX_UIDS 8 + int uid[TOP_MAX_UIDS]; /* only these uids (unless uid[0] == -1) */ int wcpu; /* show weighted cpu */ int jid; /* only this jid (unless jid == -1) */ int jail; /* show jail ID */ Modified: head/contrib/top/top.c ============================================================================== --- head/contrib/top/top.c Mon Aug 7 07:40:00 2017 (r322138) +++ head/contrib/top/top.c Mon Aug 7 08:45:08 2017 (r322139) @@ -134,7 +134,110 @@ void (*d_process)(int line, char *thisline) = i_proces void reset_display(void); +static void +reset_uids() +{ + for (size_t i = 0; i < TOP_MAX_UIDS; ++i) + ps.uid[i] = -1; +} +static int +add_uid(int uid) +{ + size_t i = 0; + + /* Add the uid if there's room */ + for (; i < TOP_MAX_UIDS; ++i) + { + if (ps.uid[i] == -1 || ps.uid[i] == uid) + { + ps.uid[i] = uid; + break; + } + } + + return (i == TOP_MAX_UIDS); +} + +static void +rem_uid(int uid) +{ + size_t i = 0; + size_t where = TOP_MAX_UIDS; + + /* Look for the user to remove - no problem if it's not there */ + for (; i < TOP_MAX_UIDS; ++i) + { + if (ps.uid[i] == -1) + break; + if (ps.uid[i] == uid) + where = i; + } + + /* Make sure we don't leave a hole in the middle */ + if (where != TOP_MAX_UIDS) + { + ps.uid[where] = ps.uid[i-1]; + ps.uid[i-1] = -1; + } +} + +static int +handle_user(char *buf, size_t buflen) +{ + int rc = 0; + int uid = -1; + char *buf2 = buf; + + new_message(MT_standout, "Username to show (+ for all): "); + if (readline(buf, buflen, No) <= 0) + { + clear_message(); + return rc; + } + + if (buf[0] == '+' || buf[0] == '-') + { + if (buf[1] == '\0') + { + reset_uids(); + goto end; + } + else + ++buf2; + } + + if ((uid = userid(buf2)) == -1) + { + new_message(MT_standout, " %s: unknown user", buf2); + rc = 1; + goto end; + } + + if (buf2 == buf) + { + reset_uids(); + ps.uid[0] = uid; + goto end; + } + + if (buf[0] == '+') + { + if (add_uid(uid)) + { + new_message(MT_standout, " too many users, reset with '+'"); + rc = 1; + goto end; + } + } + else + rem_uid(uid); + +end: + putchar('\r'); + return rc; +} + int main(argc, argv) @@ -252,7 +355,7 @@ char *argv[]; ps.idle = Yes; ps.self = -1; ps.system = No; - ps.uid = -1; + reset_uids(); ps.thread = No; ps.wcpu = 1; ps.jid = -1; @@ -299,7 +402,7 @@ char *argv[]; break; case 'U': /* display only username's processes */ - if ((ps.uid = userid(optarg)) == -1) + if ((ps.uid[0] = userid(optarg)) == -1) { fprintf(stderr, "%s: unknown user\n", optarg); exit(1); @@ -1004,31 +1107,8 @@ restart: break; case CMD_user: - new_message(MT_standout, - "Username to show (+ for all): "); - if (readline(tempbuf2, sizeof(tempbuf2), No) > 0) - { - if (tempbuf2[0] == '+' && - tempbuf2[1] == '\0') - { - ps.uid = -1; - } - else if ((i = userid(tempbuf2)) == -1) - { - new_message(MT_standout, - " %s: unknown user", tempbuf2); - no_command = Yes; - } - else - { - ps.uid = i; - } - putchar('\r'); - } - else - { - clear_message(); - } + if (handle_user(tempbuf2, sizeof(tempbuf2))) + no_command = Yes; break; case CMD_thrtog: Modified: head/contrib/top/top.xs ============================================================================== --- head/contrib/top/top.xs Mon Aug 7 07:40:00 2017 (r322138) +++ head/contrib/top/top.xs Mon Aug 7 08:45:08 2017 (r322139) @@ -307,9 +307,11 @@ This acts similarly to the command .IR renice (8)). .TP .B u -Display only processes owned by a specific username (prompt for username). -If the username specified is simply \*(lq+\*(rq, then processes belonging -to all users will be displayed. +Display only processes owned by a specific set of usernames (prompt for +username). If the username specified is simply \*(lq+\*(rq or \*(lq-\*(rq, +then processes belonging to all users will be displayed. Usernames can be added +to and removed from the set by prepending them with \*(lq+\*(rq and +\*(lq-\*(rq, respectively. .TP .B o Change the order in which the display is sorted. This command is not Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Mon Aug 7 07:40:00 2017 (r322138) +++ head/usr.bin/top/machine.c Mon Aug 7 08:45:08 2017 (r322139) @@ -273,7 +273,19 @@ static const char *format_nice(const struct kinfo_proc static void getsysctl(const char *name, void *ptr, size_t len); static int swapmode(int *retavail, int *retfree); static void update_layout(void); +static int find_uid(uid_t needle, int *haystack); +static int +find_uid(uid_t needle, int *haystack) +{ + size_t i = 0; + + for (; i < TOP_MAX_UIDS; ++i) + if ((uid_t)haystack[i] == needle) + return 1; + return 0; +} + void toggle_pcpustats(void) { @@ -847,7 +859,7 @@ get_process_info(struct system_info *si, struct proces show_jid = sel->jid != -1; show_self = sel->self == -1; show_system = sel->system; - show_uid = sel->uid != -1; + show_uid = sel->uid[0] != -1; show_command = sel->command != NULL; show_kidle = sel->kidle; @@ -906,7 +918,7 @@ get_process_info(struct system_info *si, struct proces /* skip proc. that don't belong to the selected JID */ continue; - if (show_uid && pp->ki_ruid != (uid_t)sel->uid) + if (show_uid && !find_uid(pp->ki_ruid, sel->uid)) /* skip proc. that don't belong to the selected UID */ continue; From owner-svn-src-all@freebsd.org Mon Aug 7 12:28:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E5BFDD008D; Mon, 7 Aug 2017 12:28:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75C3B683DC; Mon, 7 Aug 2017 12:28:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77CRx8n081990; Mon, 7 Aug 2017 12:27:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77CRxcc081989; Mon, 7 Aug 2017 12:27:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071227.v77CRxcc081989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:27:59 +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: r322140 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 322140 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:28:00 -0000 Author: hselasky Date: Mon Aug 7 12:27:59 2017 New Revision: 322140 URL: https://svnweb.freebsd.org/changeset/base/322140 Log: MFC r312877 and r312878: Minor code refactor as a preparation step for suprise removal of CX-4 PCI device(s), changes: - alloc_entry() now clears bit for page slot entry aswell - update of cmd->ent_arr[] is now under cmd->alloc_lock - complete command if alloc_entry() fails Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Aug 7 08:45:08 2017 (r322139) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Aug 7 12:27:59 2017 (r322140) @@ -39,6 +39,11 @@ #include "mlx5_core.h" +static int mlx5_copy_from_msg(void *to, struct mlx5_cmd_msg *from, int size); +static void mlx5_free_cmd_msg(struct mlx5_core_dev *dev, + struct mlx5_cmd_msg *msg); +static void free_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg); + enum { CMD_IF_REV = 5, }; @@ -110,18 +115,27 @@ static u8 alloc_token(struct mlx5_cmd *cmd) return token; } -static int alloc_ent(struct mlx5_cmd *cmd) +static int alloc_ent(struct mlx5_cmd_work_ent *ent) { unsigned long flags; - int ret; + struct mlx5_cmd *cmd = ent->cmd; + int ret = cmd->max_reg_cmds; spin_lock_irqsave(&cmd->alloc_lock, flags); - ret = find_first_bit(&cmd->bitmask, cmd->max_reg_cmds); - if (ret < cmd->max_reg_cmds) - clear_bit(ret, &cmd->bitmask); + if (!ent->page_queue) { + ret = find_first_bit(&cmd->bitmask, cmd->max_reg_cmds); + if (ret >= cmd->max_reg_cmds) + ret = -1; + } + + if (ret != -1) { + ent->idx = ret; + clear_bit(ent->idx, &cmd->bitmask); + cmd->ent_arr[ent->idx] = ent; + } spin_unlock_irqrestore(&cmd->alloc_lock, flags); - return ret < cmd->max_reg_cmds ? ret : -1; + return ret; } static void free_ent(struct mlx5_cmd *cmd, int idx) @@ -704,6 +718,54 @@ static void dump_command(struct mlx5_core_dev *dev, pr_debug("\n"); } +static void complete_command(struct mlx5_cmd_work_ent *ent) +{ + struct mlx5_cmd *cmd = ent->cmd; + struct mlx5_core_dev *dev = container_of(cmd, struct mlx5_core_dev, + cmd); + mlx5_cmd_cbk_t callback; + void *context; + + s64 ds; + struct mlx5_cmd_stats *stats; + unsigned long flags; + int err; + struct semaphore *sem; + + if (ent->page_queue) + sem = &cmd->pages_sem; + else + sem = &cmd->sem; + + if (ent->callback) { + ds = ent->ts2 - ent->ts1; + if (ent->op < ARRAY_SIZE(cmd->stats)) { + stats = &cmd->stats[ent->op]; + spin_lock_irqsave(&stats->lock, flags); + stats->sum += ds; + ++stats->n; + spin_unlock_irqrestore(&stats->lock, flags); + } + + callback = ent->callback; + context = ent->context; + err = ent->ret; + if (!err) + err = mlx5_copy_from_msg(ent->uout, + ent->out, + ent->uout_size); + + mlx5_free_cmd_msg(dev, ent->out); + free_msg(dev, ent->in); + + free_cmd(ent); + callback(err, context); + } else { + complete(&ent->done); + } + up(sem); +} + static void cmd_work_handler(struct work_struct *work) { struct mlx5_cmd_work_ent *ent = container_of(work, struct mlx5_cmd_work_ent, work); @@ -719,19 +781,13 @@ static void cmd_work_handler(struct work_struct *work) } down(sem); - if (!ent->page_queue) { - ent->idx = alloc_ent(cmd); - if (ent->idx < 0) { - mlx5_core_err(dev, "failed to allocate command entry\n"); - up(sem); - return; - } - } else { - ent->idx = cmd->max_reg_cmds; + + if (alloc_ent(ent) < 0) { + complete_command(ent); + return; } ent->token = alloc_token(cmd); - cmd->ent_arr[ent->idx] = ent; lay = get_inst(cmd, ent->idx); ent->lay = lay; memset(lay, 0, sizeof(*lay)); @@ -1108,23 +1164,12 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, { struct mlx5_cmd *cmd = &dev->cmd; struct mlx5_cmd_work_ent *ent; - mlx5_cmd_cbk_t callback; - void *context; - int err; int i; - struct semaphore *sem; - s64 ds; - struct mlx5_cmd_stats *stats; - unsigned long flags; while (vector != 0) { i = ffs(vector) - 1; vector &= ~(1U << i); ent = cmd->ent_arr[i]; - if (ent->page_queue) - sem = &cmd->pages_sem; - else - sem = &cmd->sem; ent->ts2 = ktime_get_ns(); memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); @@ -1142,33 +1187,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, ent->status); } free_ent(cmd, ent->idx); - if (ent->callback) { - ds = ent->ts2 - ent->ts1; - if (ent->op < ARRAY_SIZE(cmd->stats)) { - stats = &cmd->stats[ent->op]; - spin_lock_irqsave(&stats->lock, flags); - stats->sum += ds; - ++stats->n; - spin_unlock_irqrestore(&stats->lock, flags); - } - - callback = ent->callback; - context = ent->context; - err = ent->ret; - if (!err) - err = mlx5_copy_from_msg(ent->uout, - ent->out, - ent->uout_size); - - mlx5_free_cmd_msg(dev, ent->out); - free_msg(dev, ent->in); - - free_cmd(ent); - callback(err, context); - } else { - complete(&ent->done); - } - up(sem); + complete_command(ent); } } EXPORT_SYMBOL(mlx5_cmd_comp_handler); From owner-svn-src-all@freebsd.org Mon Aug 7 12:29:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAD0DDD01D1; Mon, 7 Aug 2017 12:29:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A626C68547; Mon, 7 Aug 2017 12:29:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77CTfx9082108; Mon, 7 Aug 2017 12:29:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77CTf8f082107; Mon, 7 Aug 2017 12:29:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071229.v77CTf8f082107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:29:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322141 - stable/10/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 322141 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:29:42 -0000 Author: hselasky Date: Mon Aug 7 12:29:41 2017 New Revision: 322141 URL: https://svnweb.freebsd.org/changeset/base/322141 Log: MFC r312877 and r312878: Minor code refactor as a preparation step for suprise removal of CX-4 PCI device(s), changes: - alloc_entry() now clears bit for page slot entry aswell - update of cmd->ent_arr[] is now under cmd->alloc_lock - complete command if alloc_entry() fails Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Aug 7 12:27:59 2017 (r322140) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Aug 7 12:29:41 2017 (r322141) @@ -39,6 +39,11 @@ #include "mlx5_core.h" +static int mlx5_copy_from_msg(void *to, struct mlx5_cmd_msg *from, int size); +static void mlx5_free_cmd_msg(struct mlx5_core_dev *dev, + struct mlx5_cmd_msg *msg); +static void free_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg); + enum { CMD_IF_REV = 5, }; @@ -110,18 +115,27 @@ static u8 alloc_token(struct mlx5_cmd *cmd) return token; } -static int alloc_ent(struct mlx5_cmd *cmd) +static int alloc_ent(struct mlx5_cmd_work_ent *ent) { unsigned long flags; - int ret; + struct mlx5_cmd *cmd = ent->cmd; + int ret = cmd->max_reg_cmds; spin_lock_irqsave(&cmd->alloc_lock, flags); - ret = find_first_bit(&cmd->bitmask, cmd->max_reg_cmds); - if (ret < cmd->max_reg_cmds) - clear_bit(ret, &cmd->bitmask); + if (!ent->page_queue) { + ret = find_first_bit(&cmd->bitmask, cmd->max_reg_cmds); + if (ret >= cmd->max_reg_cmds) + ret = -1; + } + + if (ret != -1) { + ent->idx = ret; + clear_bit(ent->idx, &cmd->bitmask); + cmd->ent_arr[ent->idx] = ent; + } spin_unlock_irqrestore(&cmd->alloc_lock, flags); - return ret < cmd->max_reg_cmds ? ret : -1; + return ret; } static void free_ent(struct mlx5_cmd *cmd, int idx) @@ -704,6 +718,54 @@ static void dump_command(struct mlx5_core_dev *dev, pr_debug("\n"); } +static void complete_command(struct mlx5_cmd_work_ent *ent) +{ + struct mlx5_cmd *cmd = ent->cmd; + struct mlx5_core_dev *dev = container_of(cmd, struct mlx5_core_dev, + cmd); + mlx5_cmd_cbk_t callback; + void *context; + + s64 ds; + struct mlx5_cmd_stats *stats; + unsigned long flags; + int err; + struct semaphore *sem; + + if (ent->page_queue) + sem = &cmd->pages_sem; + else + sem = &cmd->sem; + + if (ent->callback) { + ds = ent->ts2 - ent->ts1; + if (ent->op < ARRAY_SIZE(cmd->stats)) { + stats = &cmd->stats[ent->op]; + spin_lock_irqsave(&stats->lock, flags); + stats->sum += ds; + ++stats->n; + spin_unlock_irqrestore(&stats->lock, flags); + } + + callback = ent->callback; + context = ent->context; + err = ent->ret; + if (!err) + err = mlx5_copy_from_msg(ent->uout, + ent->out, + ent->uout_size); + + mlx5_free_cmd_msg(dev, ent->out); + free_msg(dev, ent->in); + + free_cmd(ent); + callback(err, context); + } else { + complete(&ent->done); + } + up(sem); +} + static void cmd_work_handler(struct work_struct *work) { struct mlx5_cmd_work_ent *ent = container_of(work, struct mlx5_cmd_work_ent, work); @@ -719,19 +781,13 @@ static void cmd_work_handler(struct work_struct *work) } down(sem); - if (!ent->page_queue) { - ent->idx = alloc_ent(cmd); - if (ent->idx < 0) { - mlx5_core_err(dev, "failed to allocate command entry\n"); - up(sem); - return; - } - } else { - ent->idx = cmd->max_reg_cmds; + + if (alloc_ent(ent) < 0) { + complete_command(ent); + return; } ent->token = alloc_token(cmd); - cmd->ent_arr[ent->idx] = ent; lay = get_inst(cmd, ent->idx); ent->lay = lay; memset(lay, 0, sizeof(*lay)); @@ -1108,23 +1164,12 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, { struct mlx5_cmd *cmd = &dev->cmd; struct mlx5_cmd_work_ent *ent; - mlx5_cmd_cbk_t callback; - void *context; - int err; int i; - struct semaphore *sem; - s64 ds; - struct mlx5_cmd_stats *stats; - unsigned long flags; while (vector != 0) { i = ffs(vector) - 1; vector &= ~(1U << i); ent = cmd->ent_arr[i]; - if (ent->page_queue) - sem = &cmd->pages_sem; - else - sem = &cmd->sem; ent->ts2 = ktime_get_ns(); memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); @@ -1142,33 +1187,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, ent->status); } free_ent(cmd, ent->idx); - if (ent->callback) { - ds = ent->ts2 - ent->ts1; - if (ent->op < ARRAY_SIZE(cmd->stats)) { - stats = &cmd->stats[ent->op]; - spin_lock_irqsave(&stats->lock, flags); - stats->sum += ds; - ++stats->n; - spin_unlock_irqrestore(&stats->lock, flags); - } - - callback = ent->callback; - context = ent->context; - err = ent->ret; - if (!err) - err = mlx5_copy_from_msg(ent->uout, - ent->out, - ent->uout_size); - - mlx5_free_cmd_msg(dev, ent->out); - free_msg(dev, ent->in); - - free_cmd(ent); - callback(err, context); - } else { - complete(&ent->done); - } - up(sem); + complete_command(ent); } } EXPORT_SYMBOL(mlx5_cmd_comp_handler); From owner-svn-src-all@freebsd.org Mon Aug 7 12:33:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7ABAFDD0581; Mon, 7 Aug 2017 12:33:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46C0D68932; Mon, 7 Aug 2017 12:33:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77CXFkq085922; Mon, 7 Aug 2017 12:33:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77CXFjF085921; Mon, 7 Aug 2017 12:33:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071233.v77CXFjF085921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:33:15 +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: r322142 - stable/11/sys/dev/mlx5 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5 X-SVN-Commit-Revision: 322142 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:33:16 -0000 Author: hselasky Date: Mon Aug 7 12:33:15 2017 New Revision: 322142 URL: https://svnweb.freebsd.org/changeset/base/322142 Log: MFC r312875: Make fw_pages statistics counter 64-bit to avoid overflow. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Mon Aug 7 12:29:41 2017 (r322141) +++ stable/11/sys/dev/mlx5/driver.h Mon Aug 7 12:33:15 2017 (r322142) @@ -518,7 +518,7 @@ struct mlx5_priv { /* pages stuff */ struct workqueue_struct *pg_wq; struct rb_root page_root; - int fw_pages; + s64 fw_pages; atomic_t reg_pages; struct list_head free_list; From owner-svn-src-all@freebsd.org Mon Aug 7 12:34:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7D07DD07B8; Mon, 7 Aug 2017 12:34:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71C0568BDA; Mon, 7 Aug 2017 12:34:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77CYYod086018; Mon, 7 Aug 2017 12:34:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77CYYdb086017; Mon, 7 Aug 2017 12:34:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071234.v77CYYdb086017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:34:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322143 - stable/10/sys/dev/mlx5 X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/mlx5 X-SVN-Commit-Revision: 322143 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:34:35 -0000 Author: hselasky Date: Mon Aug 7 12:34:34 2017 New Revision: 322143 URL: https://svnweb.freebsd.org/changeset/base/322143 Log: MFC r312875: Make fw_pages statistics counter 64-bit to avoid overflow. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/driver.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/driver.h ============================================================================== --- stable/10/sys/dev/mlx5/driver.h Mon Aug 7 12:33:15 2017 (r322142) +++ stable/10/sys/dev/mlx5/driver.h Mon Aug 7 12:34:34 2017 (r322143) @@ -518,7 +518,7 @@ struct mlx5_priv { /* pages stuff */ struct workqueue_struct *pg_wq; struct rb_root page_root; - int fw_pages; + s64 fw_pages; atomic_t reg_pages; struct list_head free_list; From owner-svn-src-all@freebsd.org Mon Aug 7 12:36:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74D5ADD0978; Mon, 7 Aug 2017 12:36:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F01368D7C; Mon, 7 Aug 2017 12:36:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77Cansi086147; Mon, 7 Aug 2017 12:36:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77Canxu086144; Mon, 7 Aug 2017 12:36:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071236.v77Canxu086144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:36: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: r322144 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 322144 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:36:50 -0000 Author: hselasky Date: Mon Aug 7 12:36:48 2017 New Revision: 322144 URL: https://svnweb.freebsd.org/changeset/base/322144 Log: MFC r312880: Wait for all VFs pages to be reclaimed before closing EQ pages. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Mon Aug 7 12:34:34 2017 (r322143) +++ stable/11/sys/dev/mlx5/driver.h Mon Aug 7 12:36:48 2017 (r322144) @@ -43,6 +43,7 @@ #include #define MLX5_QCOUNTER_SETS_NETDEV 64 +#define MLX5_MAX_NUMBER_OF_VFS 128 enum { MLX5_BOARD_ID_LEN = 64, @@ -521,7 +522,7 @@ struct mlx5_priv { s64 fw_pages; atomic_t reg_pages; struct list_head free_list; - + s64 pages_per_func[MLX5_MAX_NUMBER_OF_VFS]; struct mlx5_core_health health; struct mlx5_srq_table srq_table; @@ -850,6 +851,7 @@ void mlx5_core_req_pages_handler(struct mlx5_core_dev s32 npages); int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot); int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev); +s64 mlx5_wait_for_reclaim_vfs_pages(struct mlx5_core_dev *dev); void mlx5_register_debugfs(void); void mlx5_unregister_debugfs(void); int mlx5_eq_init(struct mlx5_core_dev *dev); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Aug 7 12:34:34 2017 (r322143) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Aug 7 12:36:48 2017 (r322144) @@ -853,6 +853,7 @@ static void mlx5_dev_cleanup(struct mlx5_core_dev *dev mlx5_cleanup_qp_table(dev); mlx5_cleanup_cq_table(dev); unmap_bf_area(dev); + mlx5_wait_for_reclaim_vfs_pages(dev); free_comp_eqs(dev); mlx5_stop_eqs(dev); mlx5_free_uuars(dev, &priv->uuari); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Aug 7 12:34:34 2017 (r322143) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Aug 7 12:36:48 2017 (r322144) @@ -27,6 +27,7 @@ #include #include +#include #include #include "mlx5_core.h" @@ -282,6 +283,7 @@ retry: goto out_alloc; } dev->priv.fw_pages += npages; + dev->priv.pages_per_func[func_id] += npages; if (out.hdr.status) { err = mlx5_cmd_status_to_err(&out.hdr); @@ -355,7 +357,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u3 *nclaimed = num_claimed; dev->priv.fw_pages -= num_claimed; - + dev->priv.pages_per_func[func_id] -= num_claimed; for (i = 0; i < num_claimed; i++) { addr = be64_to_cpu(out->pas[i]); free_4k(dev, addr); @@ -422,6 +424,31 @@ int mlx5_satisfy_startup_pages(struct mlx5_core_dev *d enum { MLX5_BLKS_FOR_RECLAIM_PAGES = 12 }; + +s64 mlx5_wait_for_reclaim_vfs_pages(struct mlx5_core_dev *dev) +{ + int end = jiffies + msecs_to_jiffies(MAX_RECLAIM_TIME_MSECS); + s64 prevpages = 0; + s64 npages = 0; + + while (!time_after(jiffies, end)) { + /* exclude own function, VFs only */ + npages = dev->priv.fw_pages - dev->priv.pages_per_func[0]; + if (!npages) + break; + + if (npages != prevpages) + end = end + msecs_to_jiffies(100); + + prevpages = npages; + msleep(1); + } + + if (npages) + mlx5_core_warn(dev, "FW did not return all VFs pages, will cause to memory leak\n"); + + return -npages; +} static int optimal_reclaimed_pages(void) { From owner-svn-src-all@freebsd.org Mon Aug 7 12:38:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2446EDD0AA7; Mon, 7 Aug 2017 12:38:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 001D668EDC; Mon, 7 Aug 2017 12:38:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77Cc5Ei086242; Mon, 7 Aug 2017 12:38:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77Cc5Aa086239; Mon, 7 Aug 2017 12:38:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071238.v77Cc5Aa086239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:38:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322145 - in stable/10/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/10/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 322145 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:38:06 -0000 Author: hselasky Date: Mon Aug 7 12:38:04 2017 New Revision: 322145 URL: https://svnweb.freebsd.org/changeset/base/322145 Log: MFC r312880: Wait for all VFs pages to be reclaimed before closing EQ pages. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/driver.h stable/10/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/10/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/driver.h ============================================================================== --- stable/10/sys/dev/mlx5/driver.h Mon Aug 7 12:36:48 2017 (r322144) +++ stable/10/sys/dev/mlx5/driver.h Mon Aug 7 12:38:04 2017 (r322145) @@ -43,6 +43,7 @@ #include #define MLX5_QCOUNTER_SETS_NETDEV 64 +#define MLX5_MAX_NUMBER_OF_VFS 128 enum { MLX5_BOARD_ID_LEN = 64, @@ -521,7 +522,7 @@ struct mlx5_priv { s64 fw_pages; atomic_t reg_pages; struct list_head free_list; - + s64 pages_per_func[MLX5_MAX_NUMBER_OF_VFS]; struct mlx5_core_health health; struct mlx5_srq_table srq_table; @@ -850,6 +851,7 @@ void mlx5_core_req_pages_handler(struct mlx5_core_dev s32 npages); int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot); int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev); +s64 mlx5_wait_for_reclaim_vfs_pages(struct mlx5_core_dev *dev); void mlx5_register_debugfs(void); void mlx5_unregister_debugfs(void); int mlx5_eq_init(struct mlx5_core_dev *dev); Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Aug 7 12:36:48 2017 (r322144) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Aug 7 12:38:04 2017 (r322145) @@ -851,6 +851,7 @@ static void mlx5_dev_cleanup(struct mlx5_core_dev *dev mlx5_cleanup_qp_table(dev); mlx5_cleanup_cq_table(dev); unmap_bf_area(dev); + mlx5_wait_for_reclaim_vfs_pages(dev); free_comp_eqs(dev); mlx5_stop_eqs(dev); mlx5_free_uuars(dev, &priv->uuari); Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Aug 7 12:36:48 2017 (r322144) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Aug 7 12:38:04 2017 (r322145) @@ -27,6 +27,7 @@ #include #include +#include #include #include "mlx5_core.h" @@ -282,6 +283,7 @@ retry: goto out_alloc; } dev->priv.fw_pages += npages; + dev->priv.pages_per_func[func_id] += npages; if (out.hdr.status) { err = mlx5_cmd_status_to_err(&out.hdr); @@ -355,7 +357,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u3 *nclaimed = num_claimed; dev->priv.fw_pages -= num_claimed; - + dev->priv.pages_per_func[func_id] -= num_claimed; for (i = 0; i < num_claimed; i++) { addr = be64_to_cpu(out->pas[i]); free_4k(dev, addr); @@ -422,6 +424,31 @@ int mlx5_satisfy_startup_pages(struct mlx5_core_dev *d enum { MLX5_BLKS_FOR_RECLAIM_PAGES = 12 }; + +s64 mlx5_wait_for_reclaim_vfs_pages(struct mlx5_core_dev *dev) +{ + int end = jiffies + msecs_to_jiffies(MAX_RECLAIM_TIME_MSECS); + s64 prevpages = 0; + s64 npages = 0; + + while (!time_after(jiffies, end)) { + /* exclude own function, VFs only */ + npages = dev->priv.fw_pages - dev->priv.pages_per_func[0]; + if (!npages) + break; + + if (npages != prevpages) + end = end + msecs_to_jiffies(100); + + prevpages = npages; + msleep(1); + } + + if (npages) + mlx5_core_warn(dev, "FW did not return all VFs pages, will cause to memory leak\n"); + + return -npages; +} static int optimal_reclaimed_pages(void) { From owner-svn-src-all@freebsd.org Mon Aug 7 12:41:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51BD8DD0E26; Mon, 7 Aug 2017 12:41:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D3D1692A2; Mon, 7 Aug 2017 12:41:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77Cf6tw087289; Mon, 7 Aug 2017 12:41:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77Cf6nH087288; Mon, 7 Aug 2017 12:41:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071241.v77Cf6nH087288@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:41: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: r322146 - stable/11/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 322146 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:41:07 -0000 Author: hselasky Date: Mon Aug 7 12:41:06 2017 New Revision: 322146 URL: https://svnweb.freebsd.org/changeset/base/322146 Log: MFC r312879: Rename struct fw_page into struct mlx5_fw_page as a preparation step for adding busdma support. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Aug 7 12:38:04 2017 (r322145) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Aug 7 12:41:06 2017 (r322146) @@ -38,7 +38,7 @@ struct mlx5_pages_req { struct work_struct work; }; -struct fw_page { +struct mlx5_fw_page { struct rb_node rb_node; u64 addr; struct page *page; @@ -77,13 +77,13 @@ static int insert_page(struct mlx5_core_dev *dev, u64 struct rb_root *root = &dev->priv.page_root; struct rb_node **new = &root->rb_node; struct rb_node *parent = NULL; - struct fw_page *nfp; - struct fw_page *tfp; + struct mlx5_fw_page *nfp; + struct mlx5_fw_page *tfp; int i; while (*new) { parent = *new; - tfp = rb_entry(parent, struct fw_page, rb_node); + tfp = rb_entry(parent, struct mlx5_fw_page, rb_node); if (tfp->addr < addr) new = &parent->rb_left; else if (tfp->addr > addr) @@ -108,15 +108,15 @@ static int insert_page(struct mlx5_core_dev *dev, u64 return 0; } -static struct fw_page *find_fw_page(struct mlx5_core_dev *dev, u64 addr) +static struct mlx5_fw_page *find_fw_page(struct mlx5_core_dev *dev, u64 addr) { struct rb_root *root = &dev->priv.page_root; struct rb_node *tmp = root->rb_node; - struct fw_page *result = NULL; - struct fw_page *tfp; + struct mlx5_fw_page *result = NULL; + struct mlx5_fw_page *tfp; while (tmp) { - tfp = rb_entry(tmp, struct fw_page, rb_node); + tfp = rb_entry(tmp, struct mlx5_fw_page, rb_node); if (tfp->addr < addr) { tmp = tmp->rb_left; } else if (tfp->addr > addr) { @@ -156,13 +156,13 @@ static int mlx5_cmd_query_pages(struct mlx5_core_dev * static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr) { - struct fw_page *fp; + struct mlx5_fw_page *fp; unsigned n; if (list_empty(&dev->priv.free_list)) return -ENOMEM; - fp = list_entry(dev->priv.free_list.next, struct fw_page, list); + fp = list_entry(dev->priv.free_list.next, struct mlx5_fw_page, list); n = find_first_bit(&fp->bitmask, 8 * sizeof(fp->bitmask)); if (n >= MLX5_NUM_4K_IN_PAGE) { mlx5_core_warn(dev, "alloc 4k bug\n"); @@ -180,7 +180,7 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *ad static void free_4k(struct mlx5_core_dev *dev, u64 addr) { - struct fw_page *fwp; + struct mlx5_fw_page *fwp; int n; fwp = find_fw_page(dev, addr & PAGE_MASK); @@ -466,7 +466,7 @@ static int optimal_reclaimed_pages(void) int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev) { int end = jiffies + msecs_to_jiffies(MAX_RECLAIM_TIME_MSECS); - struct fw_page *fwp; + struct mlx5_fw_page *fwp; struct rb_node *p; int nclaimed = 0; int err; @@ -474,7 +474,7 @@ int mlx5_reclaim_startup_pages(struct mlx5_core_dev *d do { p = rb_first(&dev->priv.page_root); if (p) { - fwp = rb_entry(p, struct fw_page, rb_node); + fwp = rb_entry(p, struct mlx5_fw_page, rb_node); err = reclaim_pages(dev, fwp->func_id, optimal_reclaimed_pages(), &nclaimed); From owner-svn-src-all@freebsd.org Mon Aug 7 12:42:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50BECDD0F04; Mon, 7 Aug 2017 12:42:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9DC9694E5; Mon, 7 Aug 2017 12:42:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77CgTvC090228; Mon, 7 Aug 2017 12:42:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77CgTkd090227; Mon, 7 Aug 2017 12:42:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071242.v77CgTkd090227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322147 - stable/10/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 322147 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:42:30 -0000 Author: hselasky Date: Mon Aug 7 12:42:28 2017 New Revision: 322147 URL: https://svnweb.freebsd.org/changeset/base/322147 Log: MFC r312879: Rename struct fw_page into struct mlx5_fw_page as a preparation step for adding busdma support. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Aug 7 12:41:06 2017 (r322146) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Aug 7 12:42:28 2017 (r322147) @@ -38,7 +38,7 @@ struct mlx5_pages_req { struct work_struct work; }; -struct fw_page { +struct mlx5_fw_page { struct rb_node rb_node; u64 addr; struct page *page; @@ -77,13 +77,13 @@ static int insert_page(struct mlx5_core_dev *dev, u64 struct rb_root *root = &dev->priv.page_root; struct rb_node **new = &root->rb_node; struct rb_node *parent = NULL; - struct fw_page *nfp; - struct fw_page *tfp; + struct mlx5_fw_page *nfp; + struct mlx5_fw_page *tfp; int i; while (*new) { parent = *new; - tfp = rb_entry(parent, struct fw_page, rb_node); + tfp = rb_entry(parent, struct mlx5_fw_page, rb_node); if (tfp->addr < addr) new = &parent->rb_left; else if (tfp->addr > addr) @@ -108,15 +108,15 @@ static int insert_page(struct mlx5_core_dev *dev, u64 return 0; } -static struct fw_page *find_fw_page(struct mlx5_core_dev *dev, u64 addr) +static struct mlx5_fw_page *find_fw_page(struct mlx5_core_dev *dev, u64 addr) { struct rb_root *root = &dev->priv.page_root; struct rb_node *tmp = root->rb_node; - struct fw_page *result = NULL; - struct fw_page *tfp; + struct mlx5_fw_page *result = NULL; + struct mlx5_fw_page *tfp; while (tmp) { - tfp = rb_entry(tmp, struct fw_page, rb_node); + tfp = rb_entry(tmp, struct mlx5_fw_page, rb_node); if (tfp->addr < addr) { tmp = tmp->rb_left; } else if (tfp->addr > addr) { @@ -156,13 +156,13 @@ static int mlx5_cmd_query_pages(struct mlx5_core_dev * static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr) { - struct fw_page *fp; + struct mlx5_fw_page *fp; unsigned n; if (list_empty(&dev->priv.free_list)) return -ENOMEM; - fp = list_entry(dev->priv.free_list.next, struct fw_page, list); + fp = list_entry(dev->priv.free_list.next, struct mlx5_fw_page, list); n = find_first_bit(&fp->bitmask, 8 * sizeof(fp->bitmask)); if (n >= MLX5_NUM_4K_IN_PAGE) { mlx5_core_warn(dev, "alloc 4k bug\n"); @@ -180,7 +180,7 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *ad static void free_4k(struct mlx5_core_dev *dev, u64 addr) { - struct fw_page *fwp; + struct mlx5_fw_page *fwp; int n; fwp = find_fw_page(dev, addr & PAGE_MASK); @@ -466,7 +466,7 @@ static int optimal_reclaimed_pages(void) int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev) { int end = jiffies + msecs_to_jiffies(MAX_RECLAIM_TIME_MSECS); - struct fw_page *fwp; + struct mlx5_fw_page *fwp; struct rb_node *p; int nclaimed = 0; int err; @@ -474,7 +474,7 @@ int mlx5_reclaim_startup_pages(struct mlx5_core_dev *d do { p = rb_first(&dev->priv.page_root); if (p) { - fwp = rb_entry(p, struct fw_page, rb_node); + fwp = rb_entry(p, struct mlx5_fw_page, rb_node); err = reclaim_pages(dev, fwp->func_id, optimal_reclaimed_pages(), &nclaimed); From owner-svn-src-all@freebsd.org Mon Aug 7 12:44:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B4CCDD1025; Mon, 7 Aug 2017 12:44:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 385DE69660; Mon, 7 Aug 2017 12:44:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77CiJpE090360; Mon, 7 Aug 2017 12:44:19 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77CiIkn090354; Mon, 7 Aug 2017 12:44:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071244.v77CiIkn090354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:44:18 +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: r322148 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 322148 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:44:20 -0000 Author: hselasky Date: Mon Aug 7 12:44:18 2017 New Revision: 322148 URL: https://svnweb.freebsd.org/changeset/base/322148 Log: MFC r312881: Add support for device surprise removal and other PCI errors. - When device disappears from PCI indicate error device state and: 1) Trigger command completion for all pending commands 2) Prevent new commands from executing and return: - success for modify and remove/cleanup commands - failure for create/query commands 3) When reclaiming pages for a device in error state don't ask FW to return all given pages, just release the allocated memory Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Mon Aug 7 12:42:28 2017 (r322147) +++ stable/11/sys/dev/mlx5/driver.h Mon Aug 7 12:44:18 2017 (r322148) @@ -713,6 +713,7 @@ struct mlx5_cmd_work_ent { u64 ts1; u64 ts2; u16 op; + u8 busy; }; struct mlx5_pas { @@ -791,6 +792,7 @@ static inline void *mlx5_vmalloc(unsigned long size) return rtn; } +void mlx5_enter_error_state(struct mlx5_core_dev *dev); int mlx5_cmd_init(struct mlx5_core_dev *dev); void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); void mlx5_cmd_use_events(struct mlx5_core_dev *dev); @@ -862,6 +864,7 @@ void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector); +void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Aug 7 12:42:28 2017 (r322147) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Aug 7 12:44:18 2017 (r322148) @@ -119,6 +119,8 @@ static int alloc_ent(struct mlx5_cmd_work_ent *ent) { unsigned long flags; struct mlx5_cmd *cmd = ent->cmd; + struct mlx5_core_dev *dev = + container_of(cmd, struct mlx5_core_dev, cmd); int ret = cmd->max_reg_cmds; spin_lock_irqsave(&cmd->alloc_lock, flags); @@ -128,7 +130,11 @@ static int alloc_ent(struct mlx5_cmd_work_ent *ent) ret = -1; } + if (dev->state != MLX5_DEVICE_STATE_UP) + ret = -1; + if (ret != -1) { + ent->busy = 1; ent->idx = ret; clear_bit(ent->idx, &cmd->bitmask); cmd->ent_arr[ent->idx] = ent; @@ -205,12 +211,16 @@ static void set_signature(struct mlx5_cmd_work_ent *en static void poll_timeout(struct mlx5_cmd_work_ent *ent) { - int poll_end = jiffies + msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC + 1000); + struct mlx5_core_dev *dev = container_of(ent->cmd, + struct mlx5_core_dev, cmd); + int poll_end = jiffies + + msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC + 1000); u8 own; do { own = ent->lay->status_own; - if (!(own & CMD_OWNER_HW)) { + if (!(own & CMD_OWNER_HW) || + dev->state != MLX5_DEVICE_STATE_UP) { ent->ret = 0; return; } @@ -718,6 +728,173 @@ static void dump_command(struct mlx5_core_dev *dev, pr_debug("\n"); } +static int set_internal_err_outbox(struct mlx5_core_dev *dev, u16 opcode, + struct mlx5_outbox_hdr *hdr) +{ + hdr->status = 0; + hdr->syndrome = 0; + + switch (opcode) { + case MLX5_CMD_OP_TEARDOWN_HCA: + case MLX5_CMD_OP_DISABLE_HCA: + case MLX5_CMD_OP_MANAGE_PAGES: + case MLX5_CMD_OP_DESTROY_MKEY: + case MLX5_CMD_OP_DESTROY_EQ: + case MLX5_CMD_OP_DESTROY_CQ: + case MLX5_CMD_OP_DESTROY_QP: + case MLX5_CMD_OP_DESTROY_PSV: + case MLX5_CMD_OP_DESTROY_SRQ: + case MLX5_CMD_OP_DESTROY_XRC_SRQ: + case MLX5_CMD_OP_DESTROY_DCT: + case MLX5_CMD_OP_DEALLOC_Q_COUNTER: + case MLX5_CMD_OP_DEALLOC_PD: + case MLX5_CMD_OP_DEALLOC_UAR: + case MLX5_CMD_OP_DETACH_FROM_MCG: + case MLX5_CMD_OP_DEALLOC_XRCD: + case MLX5_CMD_OP_DEALLOC_TRANSPORT_DOMAIN: + case MLX5_CMD_OP_DELETE_VXLAN_UDP_DPORT: + case MLX5_CMD_OP_DELETE_L2_TABLE_ENTRY: + case MLX5_CMD_OP_DESTROY_LAG: + case MLX5_CMD_OP_DESTROY_VPORT_LAG: + case MLX5_CMD_OP_DESTROY_TIR: + case MLX5_CMD_OP_DESTROY_SQ: + case MLX5_CMD_OP_DESTROY_RQ: + case MLX5_CMD_OP_DESTROY_RMP: + case MLX5_CMD_OP_DESTROY_TIS: + case MLX5_CMD_OP_DESTROY_RQT: + case MLX5_CMD_OP_DESTROY_FLOW_TABLE: + case MLX5_CMD_OP_DESTROY_FLOW_GROUP: + case MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY: + case MLX5_CMD_OP_DEALLOC_FLOW_COUNTER: + case MLX5_CMD_OP_2ERR_QP: + case MLX5_CMD_OP_2RST_QP: + case MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT: + case MLX5_CMD_OP_MODIFY_FLOW_TABLE: + case MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY: + case MLX5_CMD_OP_SET_FLOW_TABLE_ROOT: + case MLX5_CMD_OP_DEALLOC_ENCAP_HEADER: + case MLX5_CMD_OP_DESTROY_SCHEDULING_ELEMENT: + case MLX5_CMD_OP_DESTROY_QOS_PARA_VPORT: + case MLX5_CMD_OP_MODIFY_VPORT_STATE: + case MLX5_CMD_OP_MODIFY_SQ: + case MLX5_CMD_OP_MODIFY_RQ: + case MLX5_CMD_OP_MODIFY_TIS: + case MLX5_CMD_OP_MODIFY_LAG: + case MLX5_CMD_OP_MODIFY_TIR: + case MLX5_CMD_OP_MODIFY_RMP: + case MLX5_CMD_OP_MODIFY_RQT: + case MLX5_CMD_OP_MODIFY_SCHEDULING_ELEMENT: + case MLX5_CMD_OP_MODIFY_CONG_PARAMS: + case MLX5_CMD_OP_MODIFY_CONG_STATUS: + case MLX5_CMD_OP_MODIFY_CQ: + case MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT: + case MLX5_CMD_OP_MODIFY_HCA_VPORT_CONTEXT: + case MLX5_CMD_OP_MODIFY_OTHER_HCA_CAP: + case MLX5_CMD_OP_ACCESS_REG: + case MLX5_CMD_OP_DRAIN_DCT: + return 0; + + case MLX5_CMD_OP_ADD_VXLAN_UDP_DPORT: + case MLX5_CMD_OP_ALLOC_ENCAP_HEADER: + case MLX5_CMD_OP_ALLOC_FLOW_COUNTER: + case MLX5_CMD_OP_ALLOC_PD: + case MLX5_CMD_OP_ALLOC_Q_COUNTER: + case MLX5_CMD_OP_ALLOC_TRANSPORT_DOMAIN: + case MLX5_CMD_OP_ALLOC_UAR: + case MLX5_CMD_OP_ALLOC_XRCD: + case MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION: + case MLX5_CMD_OP_ARM_RQ: + case MLX5_CMD_OP_ARM_XRC_SRQ: + case MLX5_CMD_OP_ATTACH_TO_MCG: + case MLX5_CMD_OP_CONFIG_INT_MODERATION: + case MLX5_CMD_OP_CREATE_CQ: + case MLX5_CMD_OP_CREATE_DCT: + case MLX5_CMD_OP_CREATE_EQ: + case MLX5_CMD_OP_CREATE_FLOW_GROUP: + case MLX5_CMD_OP_CREATE_FLOW_TABLE: + case MLX5_CMD_OP_CREATE_LAG: + case MLX5_CMD_OP_CREATE_MKEY: + case MLX5_CMD_OP_CREATE_PSV: + case MLX5_CMD_OP_CREATE_QOS_PARA_VPORT: + case MLX5_CMD_OP_CREATE_QP: + case MLX5_CMD_OP_CREATE_RMP: + case MLX5_CMD_OP_CREATE_RQ: + case MLX5_CMD_OP_CREATE_RQT: + case MLX5_CMD_OP_CREATE_SCHEDULING_ELEMENT: + case MLX5_CMD_OP_CREATE_SQ: + case MLX5_CMD_OP_CREATE_SRQ: + case MLX5_CMD_OP_CREATE_TIR: + case MLX5_CMD_OP_CREATE_TIS: + case MLX5_CMD_OP_CREATE_VPORT_LAG: + case MLX5_CMD_OP_CREATE_XRC_SRQ: + case MLX5_CMD_OP_ENABLE_HCA: + case MLX5_CMD_OP_GEN_EQE: + case MLX5_CMD_OP_GET_DROPPED_PACKET_LOG: + case MLX5_CMD_OP_INIT2INIT_QP: + case MLX5_CMD_OP_INIT2RTR_QP: + case MLX5_CMD_OP_INIT_HCA: + case MLX5_CMD_OP_MAD_IFC: + case MLX5_CMD_OP_NOP: + case MLX5_CMD_OP_PAGE_FAULT_RESUME: + case MLX5_CMD_OP_QUERY_ADAPTER: + case MLX5_CMD_OP_QUERY_CONG_PARAMS: + case MLX5_CMD_OP_QUERY_CONG_STATISTICS: + case MLX5_CMD_OP_QUERY_CONG_STATUS: + case MLX5_CMD_OP_QUERY_CQ: + case MLX5_CMD_OP_QUERY_DCT: + case MLX5_CMD_OP_QUERY_EQ: + case MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT: + case MLX5_CMD_OP_QUERY_FLOW_COUNTER: + case MLX5_CMD_OP_QUERY_FLOW_GROUP: + case MLX5_CMD_OP_QUERY_FLOW_TABLE: + case MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY: + case MLX5_CMD_OP_QUERY_HCA_CAP: + case MLX5_CMD_OP_QUERY_HCA_VPORT_CONTEXT: + case MLX5_CMD_OP_QUERY_HCA_VPORT_GID: + case MLX5_CMD_OP_QUERY_HCA_VPORT_PKEY: + case MLX5_CMD_OP_QUERY_ISSI: + case MLX5_CMD_OP_QUERY_L2_TABLE_ENTRY: + case MLX5_CMD_OP_QUERY_LAG: + case MLX5_CMD_OP_QUERY_MAD_DEMUX: + case MLX5_CMD_OP_QUERY_MKEY: + case MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT: + case MLX5_CMD_OP_QUERY_OTHER_HCA_CAP: + case MLX5_CMD_OP_QUERY_PAGES: + case MLX5_CMD_OP_QUERY_QP: + case MLX5_CMD_OP_QUERY_Q_COUNTER: + case MLX5_CMD_OP_QUERY_RMP: + case MLX5_CMD_OP_QUERY_ROCE_ADDRESS: + case MLX5_CMD_OP_QUERY_RQ: + case MLX5_CMD_OP_QUERY_RQT: + case MLX5_CMD_OP_QUERY_SCHEDULING_ELEMENT: + case MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS: + case MLX5_CMD_OP_QUERY_SQ: + case MLX5_CMD_OP_QUERY_SRQ: + case MLX5_CMD_OP_QUERY_TIR: + case MLX5_CMD_OP_QUERY_TIS: + case MLX5_CMD_OP_QUERY_VPORT_COUNTER: + case MLX5_CMD_OP_QUERY_VPORT_STATE: + case MLX5_CMD_OP_QUERY_XRC_SRQ: + case MLX5_CMD_OP_RST2INIT_QP: + case MLX5_CMD_OP_RTR2RTS_QP: + case MLX5_CMD_OP_RTS2RTS_QP: + case MLX5_CMD_OP_SET_DC_CNAK_TRACE: + case MLX5_CMD_OP_SET_HCA_CAP: + case MLX5_CMD_OP_SET_ISSI: + case MLX5_CMD_OP_SET_L2_TABLE_ENTRY: + case MLX5_CMD_OP_SET_MAD_DEMUX: + case MLX5_CMD_OP_SET_ROCE_ADDRESS: + case MLX5_CMD_OP_SQD_RTS_QP: + case MLX5_CMD_OP_SQERR2RTS_QP: + hdr->status = MLX5_CMD_STAT_INT_ERR; + hdr->syndrome = 0xFFFFFFFF; + return -ECANCELED; + default: + mlx5_core_err(dev, "Unknown FW command (%d)\n", opcode); + return -EINVAL; + } +} + static void complete_command(struct mlx5_cmd_work_ent *ent) { struct mlx5_cmd *cmd = ent->cmd; @@ -737,6 +914,18 @@ static void complete_command(struct mlx5_cmd_work_ent else sem = &cmd->sem; + if (dev->state != MLX5_DEVICE_STATE_UP) { + struct mlx5_outbox_hdr *out_hdr = + (struct mlx5_outbox_hdr *)ent->out; + struct mlx5_inbox_hdr *in_hdr = + (struct mlx5_inbox_hdr *)(ent->in->first.data); + u16 opcode = be16_to_cpu(in_hdr->opcode); + + ent->ret = set_internal_err_outbox(dev, + opcode, + out_hdr); + } + if (ent->callback) { ds = ent->ts2 - ent->ts1; if (ent->op < ARRAY_SIZE(cmd->stats)) { @@ -805,7 +994,7 @@ static void cmd_work_handler(struct work_struct *work) set_signature(ent, !cmd->checksum_disabled); dump_command(dev, ent, 1); ent->ts1 = ktime_get_ns(); - + ent->busy = 0; /* ring doorbell after the descriptor is valid */ mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx); wmb(); @@ -872,6 +1061,7 @@ static int wait_func(struct mlx5_core_dev *dev, struct else err = 0; } + if (err == -ETIMEDOUT) { mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", mlx5_command_str(msg_to_opcode(ent->in)), @@ -1180,6 +1370,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, else ent->ret = 0; ent->status = ent->lay->status_own >> 1; + mlx5_core_dbg(dev, "FW command ret 0x%x, status %s(0x%x)\n", ent->ret, @@ -1192,6 +1383,33 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, } EXPORT_SYMBOL(mlx5_cmd_comp_handler); +void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev) +{ + unsigned long vector; + int i = 0; + unsigned long flags; + synchronize_irq(dev->priv.eq_table.cmd_eq.irqn); + spin_lock_irqsave(&dev->cmd.alloc_lock, flags); + vector = ~dev->cmd.bitmask & ((1ul << (1 << dev->cmd.log_sz)) - 1); + spin_unlock_irqrestore(&dev->cmd.alloc_lock, flags); + + if (!vector) + return; + + for (i = 0; i < (1 << dev->cmd.log_sz); i++) { + struct mlx5_cmd_work_ent *ent = dev->cmd.ent_arr[i]; + + if (!test_bit(i, &vector)) + continue; + + while (ent->busy) + usleep_range(1000, 1100); + free_ent(&dev->cmd, i); + complete_command(ent); + } +} +EXPORT_SYMBOL(mlx5_trigger_cmd_completions); + static int status_to_err(u8 status) { return status ? -1 : 0; /* TBD more meaningful codes */ @@ -1234,8 +1452,10 @@ static int is_manage_pages(struct mlx5_inbox_hdr *in) return be16_to_cpu(in->opcode) == MLX5_CMD_OP_MANAGE_PAGES; } -static int cmd_exec_helper(struct mlx5_core_dev *dev, void *in, int in_size, void *out, - int out_size, mlx5_cmd_cbk_t callback, void *context) +static int cmd_exec_helper(struct mlx5_core_dev *dev, + void *in, int in_size, + void *out, int out_size, + mlx5_cmd_cbk_t callback, void *context) { struct mlx5_cmd_msg *inb; struct mlx5_cmd_msg *outb; @@ -1603,3 +1823,4 @@ int mlx5_cmd_status_to_err_v2(void *ptr) return cmd_status_to_err_helper(status); } + Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Mon Aug 7 12:42:28 2017 (r322147) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_health.c Mon Aug 7 12:44:18 2017 (r322148) @@ -122,6 +122,9 @@ static void poll_health(unsigned long data) int next; u32 count; + if (dev->state != MLX5_DEVICE_STATE_UP) + return; + count = ioread32be(health->health_counter); if (count == health->prev) ++health->miss_counter; Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Aug 7 12:42:28 2017 (r322147) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Aug 7 12:44:18 2017 (r322148) @@ -1140,3 +1140,13 @@ static void __exit cleanup(void) module_init(init); module_exit(cleanup); + +void mlx5_enter_error_state(struct mlx5_core_dev *dev) +{ + if (dev->state != MLX5_DEVICE_STATE_UP) + return; + + dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; + mlx5_trigger_cmd_completions(dev); +} +EXPORT_SYMBOL(mlx5_enter_error_state); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Aug 7 12:42:28 2017 (r322147) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Aug 7 12:44:18 2017 (r322148) @@ -475,14 +475,21 @@ int mlx5_reclaim_startup_pages(struct mlx5_core_dev *d p = rb_first(&dev->priv.page_root); if (p) { fwp = rb_entry(p, struct mlx5_fw_page, rb_node); - err = reclaim_pages(dev, fwp->func_id, - optimal_reclaimed_pages(), - &nclaimed); - if (err) { - mlx5_core_warn(dev, "failed reclaiming pages (%d)\n", - err); - return err; + if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { + --dev->priv.fw_pages; + free_4k(dev, fwp->addr); + nclaimed = 1; + } else { + err = reclaim_pages(dev, fwp->func_id, + optimal_reclaimed_pages(), + &nclaimed); + if (err) { + mlx5_core_warn(dev, "failed reclaiming pages (%d)\n", + err); + return err; + } } + if (nclaimed) end = jiffies + msecs_to_jiffies(MAX_RECLAIM_TIME_MSECS); } From owner-svn-src-all@freebsd.org Mon Aug 7 12:45:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C53F7DD1142; Mon, 7 Aug 2017 12:45:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E032697BA; Mon, 7 Aug 2017 12:45:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77CjRJC090462; Mon, 7 Aug 2017 12:45:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77CjRk3090457; Mon, 7 Aug 2017 12:45:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071245.v77CjRk3090457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:45:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322149 - in stable/10/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/10/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 322149 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:45:28 -0000 Author: hselasky Date: Mon Aug 7 12:45:26 2017 New Revision: 322149 URL: https://svnweb.freebsd.org/changeset/base/322149 Log: MFC r312881: Add support for device surprise removal and other PCI errors. - When device disappears from PCI indicate error device state and: 1) Trigger command completion for all pending commands 2) Prevent new commands from executing and return: - success for modify and remove/cleanup commands - failure for create/query commands 3) When reclaiming pages for a device in error state don't ask FW to return all given pages, just release the allocated memory Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/driver.h stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/10/sys/dev/mlx5/mlx5_core/mlx5_health.c stable/10/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/10/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/driver.h ============================================================================== --- stable/10/sys/dev/mlx5/driver.h Mon Aug 7 12:44:18 2017 (r322148) +++ stable/10/sys/dev/mlx5/driver.h Mon Aug 7 12:45:26 2017 (r322149) @@ -713,6 +713,7 @@ struct mlx5_cmd_work_ent { u64 ts1; u64 ts2; u16 op; + u8 busy; }; struct mlx5_pas { @@ -791,6 +792,7 @@ static inline void *mlx5_vmalloc(unsigned long size) return rtn; } +void mlx5_enter_error_state(struct mlx5_core_dev *dev); int mlx5_cmd_init(struct mlx5_core_dev *dev); void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); void mlx5_cmd_use_events(struct mlx5_core_dev *dev); @@ -862,6 +864,7 @@ void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector); +void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Aug 7 12:44:18 2017 (r322148) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Aug 7 12:45:26 2017 (r322149) @@ -119,6 +119,8 @@ static int alloc_ent(struct mlx5_cmd_work_ent *ent) { unsigned long flags; struct mlx5_cmd *cmd = ent->cmd; + struct mlx5_core_dev *dev = + container_of(cmd, struct mlx5_core_dev, cmd); int ret = cmd->max_reg_cmds; spin_lock_irqsave(&cmd->alloc_lock, flags); @@ -128,7 +130,11 @@ static int alloc_ent(struct mlx5_cmd_work_ent *ent) ret = -1; } + if (dev->state != MLX5_DEVICE_STATE_UP) + ret = -1; + if (ret != -1) { + ent->busy = 1; ent->idx = ret; clear_bit(ent->idx, &cmd->bitmask); cmd->ent_arr[ent->idx] = ent; @@ -205,12 +211,16 @@ static void set_signature(struct mlx5_cmd_work_ent *en static void poll_timeout(struct mlx5_cmd_work_ent *ent) { - int poll_end = jiffies + msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC + 1000); + struct mlx5_core_dev *dev = container_of(ent->cmd, + struct mlx5_core_dev, cmd); + int poll_end = jiffies + + msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC + 1000); u8 own; do { own = ent->lay->status_own; - if (!(own & CMD_OWNER_HW)) { + if (!(own & CMD_OWNER_HW) || + dev->state != MLX5_DEVICE_STATE_UP) { ent->ret = 0; return; } @@ -718,6 +728,173 @@ static void dump_command(struct mlx5_core_dev *dev, pr_debug("\n"); } +static int set_internal_err_outbox(struct mlx5_core_dev *dev, u16 opcode, + struct mlx5_outbox_hdr *hdr) +{ + hdr->status = 0; + hdr->syndrome = 0; + + switch (opcode) { + case MLX5_CMD_OP_TEARDOWN_HCA: + case MLX5_CMD_OP_DISABLE_HCA: + case MLX5_CMD_OP_MANAGE_PAGES: + case MLX5_CMD_OP_DESTROY_MKEY: + case MLX5_CMD_OP_DESTROY_EQ: + case MLX5_CMD_OP_DESTROY_CQ: + case MLX5_CMD_OP_DESTROY_QP: + case MLX5_CMD_OP_DESTROY_PSV: + case MLX5_CMD_OP_DESTROY_SRQ: + case MLX5_CMD_OP_DESTROY_XRC_SRQ: + case MLX5_CMD_OP_DESTROY_DCT: + case MLX5_CMD_OP_DEALLOC_Q_COUNTER: + case MLX5_CMD_OP_DEALLOC_PD: + case MLX5_CMD_OP_DEALLOC_UAR: + case MLX5_CMD_OP_DETACH_FROM_MCG: + case MLX5_CMD_OP_DEALLOC_XRCD: + case MLX5_CMD_OP_DEALLOC_TRANSPORT_DOMAIN: + case MLX5_CMD_OP_DELETE_VXLAN_UDP_DPORT: + case MLX5_CMD_OP_DELETE_L2_TABLE_ENTRY: + case MLX5_CMD_OP_DESTROY_LAG: + case MLX5_CMD_OP_DESTROY_VPORT_LAG: + case MLX5_CMD_OP_DESTROY_TIR: + case MLX5_CMD_OP_DESTROY_SQ: + case MLX5_CMD_OP_DESTROY_RQ: + case MLX5_CMD_OP_DESTROY_RMP: + case MLX5_CMD_OP_DESTROY_TIS: + case MLX5_CMD_OP_DESTROY_RQT: + case MLX5_CMD_OP_DESTROY_FLOW_TABLE: + case MLX5_CMD_OP_DESTROY_FLOW_GROUP: + case MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY: + case MLX5_CMD_OP_DEALLOC_FLOW_COUNTER: + case MLX5_CMD_OP_2ERR_QP: + case MLX5_CMD_OP_2RST_QP: + case MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT: + case MLX5_CMD_OP_MODIFY_FLOW_TABLE: + case MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY: + case MLX5_CMD_OP_SET_FLOW_TABLE_ROOT: + case MLX5_CMD_OP_DEALLOC_ENCAP_HEADER: + case MLX5_CMD_OP_DESTROY_SCHEDULING_ELEMENT: + case MLX5_CMD_OP_DESTROY_QOS_PARA_VPORT: + case MLX5_CMD_OP_MODIFY_VPORT_STATE: + case MLX5_CMD_OP_MODIFY_SQ: + case MLX5_CMD_OP_MODIFY_RQ: + case MLX5_CMD_OP_MODIFY_TIS: + case MLX5_CMD_OP_MODIFY_LAG: + case MLX5_CMD_OP_MODIFY_TIR: + case MLX5_CMD_OP_MODIFY_RMP: + case MLX5_CMD_OP_MODIFY_RQT: + case MLX5_CMD_OP_MODIFY_SCHEDULING_ELEMENT: + case MLX5_CMD_OP_MODIFY_CONG_PARAMS: + case MLX5_CMD_OP_MODIFY_CONG_STATUS: + case MLX5_CMD_OP_MODIFY_CQ: + case MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT: + case MLX5_CMD_OP_MODIFY_HCA_VPORT_CONTEXT: + case MLX5_CMD_OP_MODIFY_OTHER_HCA_CAP: + case MLX5_CMD_OP_ACCESS_REG: + case MLX5_CMD_OP_DRAIN_DCT: + return 0; + + case MLX5_CMD_OP_ADD_VXLAN_UDP_DPORT: + case MLX5_CMD_OP_ALLOC_ENCAP_HEADER: + case MLX5_CMD_OP_ALLOC_FLOW_COUNTER: + case MLX5_CMD_OP_ALLOC_PD: + case MLX5_CMD_OP_ALLOC_Q_COUNTER: + case MLX5_CMD_OP_ALLOC_TRANSPORT_DOMAIN: + case MLX5_CMD_OP_ALLOC_UAR: + case MLX5_CMD_OP_ALLOC_XRCD: + case MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION: + case MLX5_CMD_OP_ARM_RQ: + case MLX5_CMD_OP_ARM_XRC_SRQ: + case MLX5_CMD_OP_ATTACH_TO_MCG: + case MLX5_CMD_OP_CONFIG_INT_MODERATION: + case MLX5_CMD_OP_CREATE_CQ: + case MLX5_CMD_OP_CREATE_DCT: + case MLX5_CMD_OP_CREATE_EQ: + case MLX5_CMD_OP_CREATE_FLOW_GROUP: + case MLX5_CMD_OP_CREATE_FLOW_TABLE: + case MLX5_CMD_OP_CREATE_LAG: + case MLX5_CMD_OP_CREATE_MKEY: + case MLX5_CMD_OP_CREATE_PSV: + case MLX5_CMD_OP_CREATE_QOS_PARA_VPORT: + case MLX5_CMD_OP_CREATE_QP: + case MLX5_CMD_OP_CREATE_RMP: + case MLX5_CMD_OP_CREATE_RQ: + case MLX5_CMD_OP_CREATE_RQT: + case MLX5_CMD_OP_CREATE_SCHEDULING_ELEMENT: + case MLX5_CMD_OP_CREATE_SQ: + case MLX5_CMD_OP_CREATE_SRQ: + case MLX5_CMD_OP_CREATE_TIR: + case MLX5_CMD_OP_CREATE_TIS: + case MLX5_CMD_OP_CREATE_VPORT_LAG: + case MLX5_CMD_OP_CREATE_XRC_SRQ: + case MLX5_CMD_OP_ENABLE_HCA: + case MLX5_CMD_OP_GEN_EQE: + case MLX5_CMD_OP_GET_DROPPED_PACKET_LOG: + case MLX5_CMD_OP_INIT2INIT_QP: + case MLX5_CMD_OP_INIT2RTR_QP: + case MLX5_CMD_OP_INIT_HCA: + case MLX5_CMD_OP_MAD_IFC: + case MLX5_CMD_OP_NOP: + case MLX5_CMD_OP_PAGE_FAULT_RESUME: + case MLX5_CMD_OP_QUERY_ADAPTER: + case MLX5_CMD_OP_QUERY_CONG_PARAMS: + case MLX5_CMD_OP_QUERY_CONG_STATISTICS: + case MLX5_CMD_OP_QUERY_CONG_STATUS: + case MLX5_CMD_OP_QUERY_CQ: + case MLX5_CMD_OP_QUERY_DCT: + case MLX5_CMD_OP_QUERY_EQ: + case MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT: + case MLX5_CMD_OP_QUERY_FLOW_COUNTER: + case MLX5_CMD_OP_QUERY_FLOW_GROUP: + case MLX5_CMD_OP_QUERY_FLOW_TABLE: + case MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY: + case MLX5_CMD_OP_QUERY_HCA_CAP: + case MLX5_CMD_OP_QUERY_HCA_VPORT_CONTEXT: + case MLX5_CMD_OP_QUERY_HCA_VPORT_GID: + case MLX5_CMD_OP_QUERY_HCA_VPORT_PKEY: + case MLX5_CMD_OP_QUERY_ISSI: + case MLX5_CMD_OP_QUERY_L2_TABLE_ENTRY: + case MLX5_CMD_OP_QUERY_LAG: + case MLX5_CMD_OP_QUERY_MAD_DEMUX: + case MLX5_CMD_OP_QUERY_MKEY: + case MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT: + case MLX5_CMD_OP_QUERY_OTHER_HCA_CAP: + case MLX5_CMD_OP_QUERY_PAGES: + case MLX5_CMD_OP_QUERY_QP: + case MLX5_CMD_OP_QUERY_Q_COUNTER: + case MLX5_CMD_OP_QUERY_RMP: + case MLX5_CMD_OP_QUERY_ROCE_ADDRESS: + case MLX5_CMD_OP_QUERY_RQ: + case MLX5_CMD_OP_QUERY_RQT: + case MLX5_CMD_OP_QUERY_SCHEDULING_ELEMENT: + case MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS: + case MLX5_CMD_OP_QUERY_SQ: + case MLX5_CMD_OP_QUERY_SRQ: + case MLX5_CMD_OP_QUERY_TIR: + case MLX5_CMD_OP_QUERY_TIS: + case MLX5_CMD_OP_QUERY_VPORT_COUNTER: + case MLX5_CMD_OP_QUERY_VPORT_STATE: + case MLX5_CMD_OP_QUERY_XRC_SRQ: + case MLX5_CMD_OP_RST2INIT_QP: + case MLX5_CMD_OP_RTR2RTS_QP: + case MLX5_CMD_OP_RTS2RTS_QP: + case MLX5_CMD_OP_SET_DC_CNAK_TRACE: + case MLX5_CMD_OP_SET_HCA_CAP: + case MLX5_CMD_OP_SET_ISSI: + case MLX5_CMD_OP_SET_L2_TABLE_ENTRY: + case MLX5_CMD_OP_SET_MAD_DEMUX: + case MLX5_CMD_OP_SET_ROCE_ADDRESS: + case MLX5_CMD_OP_SQD_RTS_QP: + case MLX5_CMD_OP_SQERR2RTS_QP: + hdr->status = MLX5_CMD_STAT_INT_ERR; + hdr->syndrome = 0xFFFFFFFF; + return -ECANCELED; + default: + mlx5_core_err(dev, "Unknown FW command (%d)\n", opcode); + return -EINVAL; + } +} + static void complete_command(struct mlx5_cmd_work_ent *ent) { struct mlx5_cmd *cmd = ent->cmd; @@ -737,6 +914,18 @@ static void complete_command(struct mlx5_cmd_work_ent else sem = &cmd->sem; + if (dev->state != MLX5_DEVICE_STATE_UP) { + struct mlx5_outbox_hdr *out_hdr = + (struct mlx5_outbox_hdr *)ent->out; + struct mlx5_inbox_hdr *in_hdr = + (struct mlx5_inbox_hdr *)(ent->in->first.data); + u16 opcode = be16_to_cpu(in_hdr->opcode); + + ent->ret = set_internal_err_outbox(dev, + opcode, + out_hdr); + } + if (ent->callback) { ds = ent->ts2 - ent->ts1; if (ent->op < ARRAY_SIZE(cmd->stats)) { @@ -805,7 +994,7 @@ static void cmd_work_handler(struct work_struct *work) set_signature(ent, !cmd->checksum_disabled); dump_command(dev, ent, 1); ent->ts1 = ktime_get_ns(); - + ent->busy = 0; /* ring doorbell after the descriptor is valid */ mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx); wmb(); @@ -872,6 +1061,7 @@ static int wait_func(struct mlx5_core_dev *dev, struct else err = 0; } + if (err == -ETIMEDOUT) { mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", mlx5_command_str(msg_to_opcode(ent->in)), @@ -1180,6 +1370,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, else ent->ret = 0; ent->status = ent->lay->status_own >> 1; + mlx5_core_dbg(dev, "FW command ret 0x%x, status %s(0x%x)\n", ent->ret, @@ -1192,6 +1383,33 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, } EXPORT_SYMBOL(mlx5_cmd_comp_handler); +void mlx5_trigger_cmd_completions(struct mlx5_core_dev *dev) +{ + unsigned long vector; + int i = 0; + unsigned long flags; + synchronize_irq(dev->priv.eq_table.cmd_eq.irqn); + spin_lock_irqsave(&dev->cmd.alloc_lock, flags); + vector = ~dev->cmd.bitmask & ((1ul << (1 << dev->cmd.log_sz)) - 1); + spin_unlock_irqrestore(&dev->cmd.alloc_lock, flags); + + if (!vector) + return; + + for (i = 0; i < (1 << dev->cmd.log_sz); i++) { + struct mlx5_cmd_work_ent *ent = dev->cmd.ent_arr[i]; + + if (!test_bit(i, &vector)) + continue; + + while (ent->busy) + usleep_range(1000, 1100); + free_ent(&dev->cmd, i); + complete_command(ent); + } +} +EXPORT_SYMBOL(mlx5_trigger_cmd_completions); + static int status_to_err(u8 status) { return status ? -1 : 0; /* TBD more meaningful codes */ @@ -1234,8 +1452,10 @@ static int is_manage_pages(struct mlx5_inbox_hdr *in) return be16_to_cpu(in->opcode) == MLX5_CMD_OP_MANAGE_PAGES; } -static int cmd_exec_helper(struct mlx5_core_dev *dev, void *in, int in_size, void *out, - int out_size, mlx5_cmd_cbk_t callback, void *context) +static int cmd_exec_helper(struct mlx5_core_dev *dev, + void *in, int in_size, + void *out, int out_size, + mlx5_cmd_cbk_t callback, void *context) { struct mlx5_cmd_msg *inb; struct mlx5_cmd_msg *outb; @@ -1603,3 +1823,4 @@ int mlx5_cmd_status_to_err_v2(void *ptr) return cmd_status_to_err_helper(status); } + Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_core/mlx5_health.c Mon Aug 7 12:44:18 2017 (r322148) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_health.c Mon Aug 7 12:45:26 2017 (r322149) @@ -122,6 +122,9 @@ static void poll_health(unsigned long data) int next; u32 count; + if (dev->state != MLX5_DEVICE_STATE_UP) + return; + count = ioread32be(health->health_counter); if (count == health->prev) ++health->miss_counter; Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Aug 7 12:44:18 2017 (r322148) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Aug 7 12:45:26 2017 (r322149) @@ -1138,3 +1138,13 @@ static void __exit cleanup(void) module_init(init); module_exit(cleanup); + +void mlx5_enter_error_state(struct mlx5_core_dev *dev) +{ + if (dev->state != MLX5_DEVICE_STATE_UP) + return; + + dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; + mlx5_trigger_cmd_completions(dev); +} +EXPORT_SYMBOL(mlx5_enter_error_state); Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Aug 7 12:44:18 2017 (r322148) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Mon Aug 7 12:45:26 2017 (r322149) @@ -475,14 +475,21 @@ int mlx5_reclaim_startup_pages(struct mlx5_core_dev *d p = rb_first(&dev->priv.page_root); if (p) { fwp = rb_entry(p, struct mlx5_fw_page, rb_node); - err = reclaim_pages(dev, fwp->func_id, - optimal_reclaimed_pages(), - &nclaimed); - if (err) { - mlx5_core_warn(dev, "failed reclaiming pages (%d)\n", - err); - return err; + if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { + --dev->priv.fw_pages; + free_4k(dev, fwp->addr); + nclaimed = 1; + } else { + err = reclaim_pages(dev, fwp->func_id, + optimal_reclaimed_pages(), + &nclaimed); + if (err) { + mlx5_core_warn(dev, "failed reclaiming pages (%d)\n", + err); + return err; + } } + if (nclaimed) end = jiffies + msecs_to_jiffies(MAX_RECLAIM_TIME_MSECS); } From owner-svn-src-all@freebsd.org Mon Aug 7 12:48:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CC0DDD136A; Mon, 7 Aug 2017 12:48:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0A3A699BC; Mon, 7 Aug 2017 12:48:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77CmD7d090611; Mon, 7 Aug 2017 12:48:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77CmDvi090606; Mon, 7 Aug 2017 12:48:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071248.v77CmDvi090606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:48:13 +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: r322150 - in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 322150 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:48:15 -0000 Author: hselasky Date: Mon Aug 7 12:48:13 2017 New Revision: 322150 URL: https://svnweb.freebsd.org/changeset/base/322150 Log: MFC r312882, r321983 and r321984: Use the busdma API to allocate all DMA-able memory. The MLX5 driver has four different types of DMA allocations which are now allocated using busdma: 1) The 4K firmware DMA-able blocks. One busdma object per 4K allocation. 2) Data for firmware commands use the 4K firmware blocks split into four 1K blocks. 3) The 4K firmware blocks are also used for doorbell pages. 4) The RQ-, SQ- and CQ- DMA rings. One busdma object per allocation. After this patch the mlx5en driver can be used with DMAR enabled in the FreeBSD kernel. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/driver.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_alloc.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/11/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/device.h ============================================================================== --- stable/11/sys/dev/mlx5/device.h Mon Aug 7 12:45:26 2017 (r322149) +++ stable/11/sys/dev/mlx5/device.h Mon Aug 7 12:48:13 2017 (r322150) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -103,6 +103,7 @@ __mlx5_mask(typ, fld)) enum { MLX5_MAX_COMMANDS = 32, MLX5_CMD_DATA_BLOCK_SIZE = 512, + MLX5_CMD_MBOX_SIZE = 1024, MLX5_PCI_CMD_XPORT = 7, MLX5_MKEY_BSF_OCTO_SIZE = 4, MLX5_MAX_PSVS = 4, @@ -522,6 +523,11 @@ struct mlx5_cmd_prot_block { u8 ctrl_sig; u8 sig; }; + +#define MLX5_NUM_CMDS_IN_ADAPTER_PAGE \ + (MLX5_ADAPTER_PAGE_SIZE / MLX5_CMD_MBOX_SIZE) +CTASSERT(MLX5_CMD_MBOX_SIZE >= sizeof(struct mlx5_cmd_prot_block)); +CTASSERT(MLX5_CMD_MBOX_SIZE <= MLX5_ADAPTER_PAGE_SIZE); enum { MLX5_CQE_SYND_FLUSHED_IN_ERROR = 5, Modified: stable/11/sys/dev/mlx5/driver.h ============================================================================== --- stable/11/sys/dev/mlx5/driver.h Mon Aug 7 12:45:26 2017 (r322149) +++ stable/11/sys/dev/mlx5/driver.h Mon Aug 7 12:48:13 2017 (r322150) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -258,13 +258,26 @@ struct mlx5_cmd_first { __be32 data[4]; }; -struct mlx5_cmd_msg { - struct list_head list; - struct cache_ent *cache; - u32 len; - struct mlx5_cmd_first first; - struct mlx5_cmd_mailbox *next; +struct cache_ent; +struct mlx5_fw_page { + union { + struct rb_node rb_node; + struct list_head list; + }; + struct mlx5_cmd_first first; + struct mlx5_core_dev *dev; + bus_dmamap_t dma_map; + bus_addr_t dma_addr; + void *virt_addr; + struct cache_ent *cache; + u32 numpages; + u16 load_done; +#define MLX5_LOAD_ST_NONE 0 +#define MLX5_LOAD_ST_SUCCESS 1 +#define MLX5_LOAD_ST_FAILURE 2 + u16 func_id; }; +#define mlx5_cmd_msg mlx5_fw_page struct mlx5_cmd_debug { struct dentry *dbg_root; @@ -304,9 +317,16 @@ struct mlx5_cmd_stats { }; struct mlx5_cmd { - void *cmd_alloc_buf; - dma_addr_t alloc_dma; - int alloc_size; + struct mlx5_fw_page *cmd_page; + bus_dma_tag_t dma_tag; + struct sx dma_sx; + struct mtx dma_mtx; +#define MLX5_DMA_OWNED(dev) mtx_owned(&(dev)->cmd.dma_mtx) +#define MLX5_DMA_LOCK(dev) mtx_lock(&(dev)->cmd.dma_mtx) +#define MLX5_DMA_UNLOCK(dev) mtx_unlock(&(dev)->cmd.dma_mtx) + struct cv dma_cv; +#define MLX5_DMA_DONE(dev) cv_broadcast(&(dev)->cmd.dma_cv) +#define MLX5_DMA_WAIT(dev) cv_wait(&(dev)->cmd.dma_cv, &(dev)->cmd.dma_mtx) void *cmd_buf; dma_addr_t dma; u16 cmdif_rev; @@ -331,7 +351,6 @@ struct mlx5_cmd { struct semaphore pages_sem; int mode; struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS]; - struct pci_pool *pool; struct mlx5_cmd_debug dbg; struct cmd_msg_cache cache; int checksum_disabled; @@ -345,24 +364,18 @@ struct mlx5_port_caps { u8 ext_port_cap; }; -struct mlx5_cmd_mailbox { - void *buf; - dma_addr_t dma; - struct mlx5_cmd_mailbox *next; -}; - -struct mlx5_buf_list { - void *buf; - dma_addr_t map; -}; - struct mlx5_buf { - struct mlx5_buf_list direct; - struct mlx5_buf_list *page_list; - int nbufs; + bus_dma_tag_t dma_tag; + bus_dmamap_t dma_map; + struct mlx5_core_dev *dev; + struct { + void *buf; + } direct; + u64 *page_list; int npages; int size; u8 page_shift; + u8 load_done; }; struct mlx5_eq { @@ -521,7 +534,6 @@ struct mlx5_priv { struct rb_root page_root; s64 fw_pages; atomic_t reg_pages; - struct list_head free_list; s64 pages_per_func[MLX5_MAX_NUMBER_OF_VFS]; struct mlx5_core_health health; @@ -664,7 +676,7 @@ struct mlx5_vport_counters { }; enum { - MLX5_DB_PER_PAGE = PAGE_SIZE / L1_CACHE_BYTES, + MLX5_DB_PER_PAGE = MLX5_ADAPTER_PAGE_SIZE / L1_CACHE_BYTES, }; struct mlx5_core_dct { @@ -688,6 +700,7 @@ enum { struct mlx5_db_pgdir { struct list_head list; DECLARE_BITMAP(bitmap, MLX5_DB_PER_PAGE); + struct mlx5_fw_page *fw_page; __be32 *db_page; dma_addr_t db_dma; }; @@ -697,6 +710,7 @@ typedef void (*mlx5_cmd_cbk_t)(int status, void *conte struct mlx5_cmd_work_ent { struct mlx5_cmd_msg *in; struct mlx5_cmd_msg *out; + int uin_size; void *uout; int uout_size; mlx5_cmd_cbk_t callback; @@ -721,13 +735,10 @@ struct mlx5_pas { u8 log_sz; }; -static inline void *mlx5_buf_offset(struct mlx5_buf *buf, int offset) +static inline void * +mlx5_buf_offset(struct mlx5_buf *buf, int offset) { - if (likely(BITS_PER_LONG == 64 || buf->nbufs == 1)) - return buf->direct.buf + offset; - else - return buf->page_list[offset >> PAGE_SHIFT].buf + - (offset & (PAGE_SIZE - 1)); + return ((char *)buf->direct.buf + offset); } @@ -816,8 +827,9 @@ void mlx5_health_cleanup(void); void __init mlx5_health_init(void); void mlx5_start_health_poll(struct mlx5_core_dev *dev); void mlx5_stop_health_poll(struct mlx5_core_dev *dev); -int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, int max_direct, - struct mlx5_buf *buf, int node); + +#define mlx5_buf_alloc_node(dev, size, direct, buf, node) \ + mlx5_buf_alloc(dev, size, direct, buf) int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct, struct mlx5_buf *buf); void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf); @@ -845,6 +857,12 @@ int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn); int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb, u16 opmod, u8 port); +void mlx5_fwp_flush(struct mlx5_fw_page *fwp); +void mlx5_fwp_invalidate(struct mlx5_fw_page *fwp); +struct mlx5_fw_page *mlx5_fwp_alloc(struct mlx5_core_dev *dev, gfp_t flags, unsigned num); +void mlx5_fwp_free(struct mlx5_fw_page *fwp); +u64 mlx5_fwp_get_dma(struct mlx5_fw_page *fwp, size_t offset); +void *mlx5_fwp_get_virt(struct mlx5_fw_page *fwp, size_t offset); void mlx5_pagealloc_init(struct mlx5_core_dev *dev); void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev); int mlx5_pagealloc_start(struct mlx5_core_dev *dev); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_alloc.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_alloc.c Mon Aug 7 12:45:26 2017 (r322149) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_alloc.c Mon Aug 7 12:48:13 2017 (r322150) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,106 +40,110 @@ * multiple pages, so we don't require too much contiguous memory. */ -static void *mlx5_dma_zalloc_coherent_node(struct mlx5_core_dev *dev, - size_t size, dma_addr_t *dma_handle, - int node) +static void +mlx5_buf_load_mem_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - void *cpu_handle; + struct mlx5_buf *buf; + uint8_t owned; + int x; - cpu_handle = dma_zalloc_coherent(&dev->pdev->dev, size, - dma_handle, GFP_KERNEL); - return cpu_handle; + buf = (struct mlx5_buf *)arg; + owned = MLX5_DMA_OWNED(buf->dev); + + if (!owned) + MLX5_DMA_LOCK(buf->dev); + + if (error == 0) { + for (x = 0; x != nseg; x++) { + buf->page_list[x] = segs[x].ds_addr; + KASSERT(segs[x].ds_len == PAGE_SIZE, ("Invalid segment size")); + } + buf->load_done = MLX5_LOAD_ST_SUCCESS; + } else { + buf->load_done = MLX5_LOAD_ST_FAILURE; + } + MLX5_DMA_DONE(buf->dev); + + if (!owned) + MLX5_DMA_UNLOCK(buf->dev); } -int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, int max_direct, - struct mlx5_buf *buf, int node) +int +mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, + int max_direct, struct mlx5_buf *buf) { - dma_addr_t t; + int err; - buf->size = size; - if (size <= max_direct) { - buf->nbufs = 1; - buf->npages = 1; - buf->page_shift = (u8)get_order(size) + PAGE_SHIFT; - buf->direct.buf = mlx5_dma_zalloc_coherent_node(dev, size, - &t, node); - if (!buf->direct.buf) - return -ENOMEM; + buf->npages = howmany(size, PAGE_SIZE); + buf->page_shift = PAGE_SHIFT; + buf->load_done = MLX5_LOAD_ST_NONE; + buf->dev = dev; + buf->page_list = kcalloc(buf->npages, sizeof(*buf->page_list), + GFP_KERNEL); - buf->direct.map = t; + err = -bus_dma_tag_create( + bus_get_dma_tag(dev->pdev->dev.bsddev), + PAGE_SIZE, /* alignment */ + 0, /* no boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + PAGE_SIZE * buf->npages, /* maxsize */ + buf->npages, /* nsegments */ + PAGE_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockfuncarg */ + &buf->dma_tag); - while (t & ((1 << buf->page_shift) - 1)) { - --buf->page_shift; - buf->npages *= 2; - } - } else { - int i; + if (err != 0) + goto err_dma_tag; - buf->direct.buf = NULL; - buf->nbufs = (size + PAGE_SIZE - 1) / PAGE_SIZE; - buf->npages = buf->nbufs; - buf->page_shift = PAGE_SHIFT; - buf->page_list = kcalloc(buf->nbufs, sizeof(*buf->page_list), - GFP_KERNEL); + /* allocate memory */ + err = -bus_dmamem_alloc(buf->dma_tag, &buf->direct.buf, + BUS_DMA_WAITOK | BUS_DMA_COHERENT, &buf->dma_map); + if (err != 0) + goto err_dma_alloc; - for (i = 0; i < buf->nbufs; i++) { - buf->page_list[i].buf = - mlx5_dma_zalloc_coherent_node(dev, PAGE_SIZE, - &t, node); + /* load memory into DMA */ + MLX5_DMA_LOCK(dev); + err = bus_dmamap_load( + buf->dma_tag, buf->dma_map, buf->direct.buf, + PAGE_SIZE * buf->npages, &mlx5_buf_load_mem_cb, + buf, BUS_DMA_WAITOK | BUS_DMA_COHERENT); - buf->page_list[i].map = t; - } + while (buf->load_done == MLX5_LOAD_ST_NONE) + MLX5_DMA_WAIT(dev); + MLX5_DMA_UNLOCK(dev); - if (BITS_PER_LONG == 64) { - struct page **pages; - - pages = kmalloc(sizeof(*pages) * (buf->nbufs + 1), - GFP_KERNEL); - for (i = 0; i < buf->nbufs; i++) - pages[i] = virt_to_page(buf->page_list[i].buf); - pages[buf->nbufs] = pages[0]; - buf->direct.buf = vmap(pages, buf->nbufs + 1, VM_MAP, - PAGE_KERNEL); - kfree(pages); - if (!buf->direct.buf) - goto err_free; - } + /* check for error */ + if (buf->load_done != MLX5_LOAD_ST_SUCCESS) { + err = -ENOMEM; + goto err_dma_load; } - return 0; + /* clean memory */ + memset(buf->direct.buf, 0, PAGE_SIZE * buf->npages); -err_free: - mlx5_buf_free(dev, buf); + /* flush memory to RAM */ + bus_dmamap_sync(buf->dev->cmd.dma_tag, buf->dma_map, BUS_DMASYNC_PREWRITE); + return (0); - return -ENOMEM; +err_dma_load: + bus_dmamem_free(buf->dma_tag, buf->direct.buf, buf->dma_map); +err_dma_alloc: + bus_dma_tag_destroy(buf->dma_tag); +err_dma_tag: + kfree(buf->page_list); + return (err); } -int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct, - struct mlx5_buf *buf) -{ - return mlx5_buf_alloc_node(dev, size, max_direct, - buf, dev->priv.numa_node); -} -EXPORT_SYMBOL_GPL(mlx5_buf_alloc); - - void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf) { - if (buf->nbufs == 1) - dma_free_coherent(&dev->pdev->dev, buf->size, buf->direct.buf, - buf->direct.map); - else { - int i; - if (BITS_PER_LONG == 64 && buf->direct.buf) - vunmap(buf->direct.buf); - for (i = 0; i < buf->nbufs; i++) - if (buf->page_list[i].buf) - dma_free_coherent(&dev->pdev->dev, PAGE_SIZE, - buf->page_list[i].buf, - buf->page_list[i].map); - kfree(buf->page_list); - } + bus_dmamap_unload(buf->dma_tag, buf->dma_map); + bus_dmamem_free(buf->dma_tag, buf->direct.buf, buf->dma_map); + bus_dma_tag_destroy(buf->dma_tag); + kfree(buf->page_list); } EXPORT_SYMBOL_GPL(mlx5_buf_free); @@ -152,8 +156,17 @@ static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struc bitmap_fill(pgdir->bitmap, MLX5_DB_PER_PAGE); - pgdir->db_page = mlx5_dma_zalloc_coherent_node(dev, PAGE_SIZE, - &pgdir->db_dma, node); + pgdir->fw_page = mlx5_fwp_alloc(dev, GFP_KERNEL, 1); + if (pgdir->fw_page != NULL) { + pgdir->db_page = pgdir->fw_page->virt_addr; + pgdir->db_dma = pgdir->fw_page->dma_addr; + + /* clean allocated memory */ + memset(pgdir->db_page, 0, MLX5_ADAPTER_PAGE_SIZE); + + /* flush memory to RAM */ + mlx5_fwp_flush(pgdir->fw_page); + } if (!pgdir->db_page) { kfree(pgdir); return NULL; @@ -228,8 +241,7 @@ void mlx5_db_free(struct mlx5_core_dev *dev, struct ml __set_bit(db->index, db->u.pgdir->bitmap); if (bitmap_full(db->u.pgdir->bitmap, MLX5_DB_PER_PAGE)) { - dma_free_coherent(&(dev->pdev->dev), PAGE_SIZE, - db->u.pgdir->db_page, db->u.pgdir->db_dma); + mlx5_fwp_free(db->u.pgdir->fw_page); list_del(&db->u.pgdir->list); kfree(db->u.pgdir); } @@ -238,19 +250,12 @@ void mlx5_db_free(struct mlx5_core_dev *dev, struct ml } EXPORT_SYMBOL_GPL(mlx5_db_free); - -void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas) +void +mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas) { - u64 addr; int i; - for (i = 0; i < buf->npages; i++) { - if (buf->nbufs == 1) - addr = buf->direct.map + ((u64)i << buf->page_shift); - else - addr = buf->page_list[i].map; - - pas[i] = cpu_to_be64(addr); - } + for (i = 0; i != buf->npages; i++) + pas[i] = cpu_to_be64(buf->page_list[i]); } EXPORT_SYMBOL_GPL(mlx5_fill_page_array); Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Aug 7 12:45:26 2017 (r322149) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Aug 7 12:48:13 2017 (r322150) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -77,6 +77,7 @@ enum { static struct mlx5_cmd_work_ent *alloc_cmd(struct mlx5_cmd *cmd, struct mlx5_cmd_msg *in, + int uin_size, struct mlx5_cmd_msg *out, void *uout, int uout_size, mlx5_cmd_cbk_t cbk, @@ -90,6 +91,7 @@ static struct mlx5_cmd_work_ent *alloc_cmd(struct mlx5 return ERR_PTR(-ENOMEM); ent->in = in; + ent->uin_size = uin_size; ent->out = out; ent->uout = uout; ent->uout_size = uout_size; @@ -192,14 +194,26 @@ static void calc_block_sig(struct mlx5_cmd_prot_block } } -static void calc_chain_sig(struct mlx5_cmd_msg *msg, u8 token, int csum) +static void +calc_chain_sig(struct mlx5_cmd_msg *msg, u8 token, int csum) { - struct mlx5_cmd_mailbox *next = msg->next; + size_t i; - while (next) { - calc_block_sig(next->buf, token, csum); - next = next->next; + for (i = 0; i != (msg->numpages * MLX5_NUM_CMDS_IN_ADAPTER_PAGE); i++) { + struct mlx5_cmd_prot_block *block; + + block = mlx5_fwp_get_virt(msg, i * MLX5_CMD_MBOX_SIZE); + + /* compute signature */ + calc_block_sig(block, token, csum); + + /* check for last block */ + if (block->next == 0) + break; } + + /* make sure data gets written to RAM */ + mlx5_fwp_flush(msg); } static void set_signature(struct mlx5_cmd_work_ent *ent, int csum) @@ -235,10 +249,11 @@ static void free_cmd(struct mlx5_cmd_work_ent *ent) kfree(ent); } - -static int verify_signature(struct mlx5_cmd_work_ent *ent) +static int +verify_signature(struct mlx5_cmd_work_ent *ent) { - struct mlx5_cmd_mailbox *next = ent->out->next; + struct mlx5_cmd_msg *msg = ent->out; + size_t i; int err; u8 sig; @@ -246,15 +261,21 @@ static int verify_signature(struct mlx5_cmd_work_ent * if (sig != 0xff) return -EINVAL; - while (next) { - err = verify_block_sig(next->buf); - if (err) - return err; + for (i = 0; i != (msg->numpages * MLX5_NUM_CMDS_IN_ADAPTER_PAGE); i++) { + struct mlx5_cmd_prot_block *block; - next = next->next; - } + block = mlx5_fwp_get_virt(msg, i * MLX5_CMD_MBOX_SIZE); - return 0; + /* compute signature */ + err = verify_block_sig(block); + if (err != 0) + return (err); + + /* check for last block */ + if (block->next == 0) + break; + } + return (0); } static void dump_buf(void *buf, int size, int data_only, int offset) @@ -681,9 +702,10 @@ static void dump_command(struct mlx5_core_dev *dev, { u16 op = be16_to_cpu(((struct mlx5_inbox_hdr *)(ent->lay->in))->opcode); struct mlx5_cmd_msg *msg = input ? ent->in : ent->out; - struct mlx5_cmd_mailbox *next = msg->next; + size_t i; int data_only; - u32 offset = 0; + int offset = 0; + int msg_len = input ? ent->uin_size : ent->uout_size; int dump_len; data_only = !!(mlx5_core_debug_mask & (1 << MLX5_CMD_DATA)); @@ -711,17 +733,28 @@ static void dump_command(struct mlx5_core_dev *dev, offset += sizeof(*ent->lay); } - while (next && offset < msg->len) { + for (i = 0; i != (msg->numpages * MLX5_NUM_CMDS_IN_ADAPTER_PAGE); i++) { + struct mlx5_cmd_prot_block *block; + + block = mlx5_fwp_get_virt(msg, i * MLX5_CMD_MBOX_SIZE); + if (data_only) { - dump_len = min_t(int, MLX5_CMD_DATA_BLOCK_SIZE, msg->len - offset); - dump_buf(next->buf, dump_len, 1, offset); + if (offset >= msg_len) + break; + dump_len = min_t(int, + MLX5_CMD_DATA_BLOCK_SIZE, msg_len - offset); + + dump_buf(block->data, dump_len, 1, offset); offset += MLX5_CMD_DATA_BLOCK_SIZE; } else { mlx5_core_dbg(dev, "command block:\n"); - dump_buf(next->buf, sizeof(struct mlx5_cmd_prot_block), 0, offset); - offset += sizeof(struct mlx5_cmd_prot_block); + dump_buf(block, sizeof(*block), 0, offset); + offset += sizeof(*block); } - next = next->next; + + /* check for last block */ + if (block->next == 0) + break; } if (data_only) @@ -982,12 +1015,12 @@ static void cmd_work_handler(struct work_struct *work) memset(lay, 0, sizeof(*lay)); memcpy(lay->in, ent->in->first.data, sizeof(lay->in)); ent->op = be32_to_cpu(lay->in[0]) >> 16; - if (ent->in->next) - lay->in_ptr = cpu_to_be64(ent->in->next->dma); - lay->inlen = cpu_to_be32(ent->in->len); - if (ent->out->next) - lay->out_ptr = cpu_to_be64(ent->out->next->dma); - lay->outlen = cpu_to_be32(ent->out->len); + if (ent->in->numpages != 0) + lay->in_ptr = cpu_to_be64(mlx5_fwp_get_dma(ent->in, 0)); + if (ent->out->numpages != 0) + lay->out_ptr = cpu_to_be64(mlx5_fwp_get_dma(ent->out, 0)); + lay->inlen = cpu_to_be32(ent->uin_size); + lay->outlen = cpu_to_be32(ent->uout_size); lay->type = MLX5_PCI_CMD_XPORT; lay->token = ent->token; lay->status_own = CMD_OWNER_HW; @@ -997,14 +1030,14 @@ static void cmd_work_handler(struct work_struct *work) ent->busy = 0; /* ring doorbell after the descriptor is valid */ mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx); - wmb(); + /* make sure data is written to RAM */ + mlx5_fwp_flush(cmd->cmd_page); iowrite32be(1 << ent->idx, &dev->iseg->cmd_dbell); mmiowb(); /* if not in polling don't use ent after this point*/ if (cmd->mode == CMD_MODE_POLLING) { poll_timeout(ent); /* make sure we read the descriptor after ownership is SW */ - rmb(); mlx5_cmd_comp_handler(dev, 1U << ent->idx); } } @@ -1078,6 +1111,7 @@ static int wait_func(struct mlx5_core_dev *dev, struct * 2. page queue commands do not support asynchrous completion */ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, + int uin_size, struct mlx5_cmd_msg *out, void *uout, int uout_size, mlx5_cmd_cbk_t callback, void *context, int page_queue, u8 *status) @@ -1092,8 +1126,8 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, if (callback && page_queue) return -EINVAL; - ent = alloc_cmd(cmd, in, out, uout, uout_size, callback, context, - page_queue); + ent = alloc_cmd(cmd, in, uin_size, out, uout, uout_size, callback, + context, page_queue); if (IS_ERR(ent)) return PTR_ERR(ent); @@ -1138,159 +1172,98 @@ out: return err; } -static int mlx5_copy_to_msg(struct mlx5_cmd_msg *to, void *from, int size) +static int mlx5_copy_to_msg(struct mlx5_cmd_msg *to, void *from, size_t size) { - struct mlx5_cmd_prot_block *block; - struct mlx5_cmd_mailbox *next; - int copy; + size_t delta; + size_t i; - if (!to || !from) - return -ENOMEM; + if (to == NULL || from == NULL) + return (-ENOMEM); - copy = min_t(int, size, sizeof(to->first.data)); - memcpy(to->first.data, from, copy); - size -= copy; - from += copy; + delta = min_t(size_t, size, sizeof(to->first.data)); + memcpy(to->first.data, from, delta); + from = (char *)from + delta; + size -= delta; - next = to->next; - while (size) { - if (!next) { - /* this is a BUG */ - return -ENOMEM; - } + for (i = 0; size != 0; i++) { + struct mlx5_cmd_prot_block *block; - copy = min_t(int, size, MLX5_CMD_DATA_BLOCK_SIZE); - block = next->buf; - memcpy(block->data, from, copy); - from += copy; - size -= copy; - next = next->next; - } + block = mlx5_fwp_get_virt(to, i * MLX5_CMD_MBOX_SIZE); - return 0; + delta = min_t(size_t, size, MLX5_CMD_DATA_BLOCK_SIZE); + memcpy(block->data, from, delta); + from = (char *)from + delta; + size -= delta; + } + return (0); } static int mlx5_copy_from_msg(void *to, struct mlx5_cmd_msg *from, int size) { - struct mlx5_cmd_prot_block *block; - struct mlx5_cmd_mailbox *next; - int copy; + size_t delta; + size_t i; - if (!to || !from) - return -ENOMEM; + if (to == NULL || from == NULL) + return (-ENOMEM); - copy = min_t(int, size, sizeof(from->first.data)); - memcpy(to, from->first.data, copy); - size -= copy; - to += copy; + delta = min_t(size_t, size, sizeof(from->first.data)); + memcpy(to, from->first.data, delta); + to = (char *)to + delta; + size -= delta; - next = from->next; - while (size) { - if (!next) { - /* this is a BUG */ - return -ENOMEM; - } + for (i = 0; size != 0; i++) { + struct mlx5_cmd_prot_block *block; - copy = min_t(int, size, MLX5_CMD_DATA_BLOCK_SIZE); - block = next->buf; + block = mlx5_fwp_get_virt(from, i * MLX5_CMD_MBOX_SIZE); - memcpy(to, block->data, copy); - to += copy; - size -= copy; - next = next->next; + delta = min_t(size_t, size, MLX5_CMD_DATA_BLOCK_SIZE); + memcpy(to, block->data, delta); + to = (char *)to + delta; + size -= delta; } - - return 0; + return (0); } -static struct mlx5_cmd_mailbox *alloc_cmd_box(struct mlx5_core_dev *dev, - gfp_t flags) +static struct mlx5_cmd_msg * +mlx5_alloc_cmd_msg(struct mlx5_core_dev *dev, gfp_t flags, size_t size) { - struct mlx5_cmd_mailbox *mailbox; + struct mlx5_cmd_msg *msg; + size_t blen; + size_t n; + size_t i; - mailbox = kmalloc(sizeof(*mailbox), flags); - if (!mailbox) - return ERR_PTR(-ENOMEM); + blen = size - min_t(size_t, sizeof(msg->first.data), size); + n = howmany(blen, MLX5_CMD_DATA_BLOCK_SIZE); - mailbox->buf = pci_pool_alloc(dev->cmd.pool, flags, - &mailbox->dma); - if (!mailbox->buf) { - mlx5_core_dbg(dev, "failed allocation\n"); - kfree(mailbox); - return ERR_PTR(-ENOMEM); - } - memset(mailbox->buf, 0, sizeof(struct mlx5_cmd_prot_block)); - mailbox->next = NULL; + msg = mlx5_fwp_alloc(dev, flags, howmany(n, MLX5_NUM_CMDS_IN_ADAPTER_PAGE)); + if (msg == NULL) + return (ERR_PTR(-ENOMEM)); - return mailbox; -} + for (i = 0; i != n; i++) { + struct mlx5_cmd_prot_block *block; -static void free_cmd_box(struct mlx5_core_dev *dev, - struct mlx5_cmd_mailbox *mailbox) -{ - pci_pool_free(dev->cmd.pool, mailbox->buf, mailbox->dma); - kfree(mailbox); -} + block = mlx5_fwp_get_virt(msg, i * MLX5_CMD_MBOX_SIZE); -static struct mlx5_cmd_msg *mlx5_alloc_cmd_msg(struct mlx5_core_dev *dev, - gfp_t flags, int size) -{ - struct mlx5_cmd_mailbox *tmp, *head = NULL; - struct mlx5_cmd_prot_block *block; - struct mlx5_cmd_msg *msg; - int blen; - int err; - int n; - int i; + memset(block, 0, MLX5_CMD_MBOX_SIZE); - msg = kzalloc(sizeof(*msg), flags); - if (!msg) - return ERR_PTR(-ENOMEM); - - blen = size - min_t(int, sizeof(msg->first.data), size); - n = (blen + MLX5_CMD_DATA_BLOCK_SIZE - 1) / MLX5_CMD_DATA_BLOCK_SIZE; - - for (i = 0; i < n; i++) { - tmp = alloc_cmd_box(dev, flags); - if (IS_ERR(tmp)) { - mlx5_core_warn(dev, "failed allocating block\n"); - err = PTR_ERR(tmp); - goto err_alloc; + if (i != (n - 1)) { + u64 dma = mlx5_fwp_get_dma(msg, (i + 1) * MLX5_CMD_MBOX_SIZE); + block->next = cpu_to_be64(dma); } - - block = tmp->buf; - tmp->next = head; - block->next = cpu_to_be64(tmp->next ? tmp->next->dma : 0); - block->block_num = cpu_to_be32(n - i - 1); - head = tmp; + block->block_num = cpu_to_be32(i); } - msg->next = head; - msg->len = size; - return msg; -err_alloc: - while (head) { - tmp = head->next; - free_cmd_box(dev, head); - head = tmp; - } - kfree(msg); + /* make sure initial data is written to RAM */ + mlx5_fwp_flush(msg); - return ERR_PTR(err); + return (msg); } -static void mlx5_free_cmd_msg(struct mlx5_core_dev *dev, - struct mlx5_cmd_msg *msg) +static void +mlx5_free_cmd_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg) { - struct mlx5_cmd_mailbox *head = msg->next; - struct mlx5_cmd_mailbox *next; - while (head) { - next = head->next; - free_cmd_box(dev, head); - head = next; - } - kfree(msg); + mlx5_fwp_free(msg); } static void set_wqname(struct mlx5_core_dev *dev) @@ -1356,6 +1329,9 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent; int i; + /* make sure data gets read from RAM */ + mlx5_fwp_invalidate(cmd->cmd_page); + while (vector != 0) { i = ffs(vector) - 1; vector &= ~(1U << i); @@ -1363,6 +1339,8 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, ent->ts2 = ktime_get_ns(); memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); + /* make sure data gets read from RAM */ + mlx5_fwp_invalidate(ent->out); dump_command(dev, ent, 0); if (!ent->ret) { if (!cmd->checksum_disabled) @@ -1432,10 +1410,6 @@ static struct mlx5_cmd_msg *alloc_msg(struct mlx5_core if (!list_empty(&ent->head)) { msg = list_entry(ent->head.next, struct mlx5_cmd_msg, list); - /* For cached lists, we must explicitly state what is - * the real size - */ - msg->len = in_size; list_del(&msg->list); } spin_unlock_irq(&ent->lock); @@ -1460,12 +1434,11 @@ static int cmd_exec_helper(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *inb; struct mlx5_cmd_msg *outb; int pages_queue; - gfp_t gfp; + const gfp_t gfp = GFP_KERNEL; int err; u8 status = 0; pages_queue = is_manage_pages(in); - gfp = callback ? GFP_ATOMIC : GFP_KERNEL; inb = alloc_msg(dev, in_size, gfp); if (IS_ERR(inb)) { @@ -1485,8 +1458,8 @@ static int cmd_exec_helper(struct mlx5_core_dev *dev, goto out_in; } - err = mlx5_cmd_invoke(dev, inb, outb, out, out_size, callback, context, - pages_queue, &status); + err = mlx5_cmd_invoke(dev, inb, in_size, outb, out, out_size, callback, + context, pages_queue, &status); if (err) { if (err == -ETIMEDOUT) return err; @@ -1583,44 +1556,67 @@ ex_err: return err; } -static int alloc_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd) +static int +alloc_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd) { - struct device *ddev = &dev->pdev->dev; - cmd->cmd_alloc_buf = dma_zalloc_coherent(ddev, MLX5_ADAPTER_PAGE_SIZE, - &cmd->alloc_dma, GFP_KERNEL); - if (!cmd->cmd_alloc_buf) - return -ENOMEM; + int err; - /* make sure it is aligned to 4K */ - if (!((uintptr_t)cmd->cmd_alloc_buf & (MLX5_ADAPTER_PAGE_SIZE - 1))) { - cmd->cmd_buf = cmd->cmd_alloc_buf; - cmd->dma = cmd->alloc_dma; - cmd->alloc_size = MLX5_ADAPTER_PAGE_SIZE; - return 0; + sx_init(&cmd->dma_sx, "MLX5-DMA-SX"); + mtx_init(&cmd->dma_mtx, "MLX5-DMA-MTX", NULL, MTX_DEF); + cv_init(&cmd->dma_cv, "MLX5-DMA-CV"); + + /* + * Create global DMA descriptor tag for allocating + * 4K firmware pages: + */ + err = -bus_dma_tag_create( + bus_get_dma_tag(dev->pdev->dev.bsddev), + MLX5_ADAPTER_PAGE_SIZE, /* alignment */ + 0, /* no boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MLX5_ADAPTER_PAGE_SIZE, /* maxsize */ + 1, /* nsegments */ + MLX5_ADAPTER_PAGE_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockfuncarg */ + &cmd->dma_tag); + if (err != 0) + goto failure_destroy_sx; + + cmd->cmd_page = mlx5_fwp_alloc(dev, GFP_KERNEL, 1); + if (cmd->cmd_page == NULL) { + err = -ENOMEM; + goto failure_alloc_page; } + cmd->dma = mlx5_fwp_get_dma(cmd->cmd_page, 0); + cmd->cmd_buf = mlx5_fwp_get_virt(cmd->cmd_page, 0); + return (0); - dma_free_coherent(ddev, MLX5_ADAPTER_PAGE_SIZE, cmd->cmd_alloc_buf, cmd->alloc_dma); - cmd->cmd_alloc_buf = dma_zalloc_coherent(ddev, 2 * MLX5_ADAPTER_PAGE_SIZE - 1, - &cmd->alloc_dma, GFP_KERNEL); - if (!cmd->cmd_alloc_buf) - return -ENOMEM; +failure_alloc_page: + bus_dma_tag_destroy(cmd->dma_tag); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Aug 7 12:49:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 630E9DD14EA; Mon, 7 Aug 2017 12:49:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D9A569B1A; Mon, 7 Aug 2017 12:49:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77CnVxo090716; Mon, 7 Aug 2017 12:49:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77CnVvD090710; Mon, 7 Aug 2017 12:49:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071249.v77CnVvD090710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:49:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322151 - in stable/10/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/10/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 322151 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:49:32 -0000 Author: hselasky Date: Mon Aug 7 12:49:30 2017 New Revision: 322151 URL: https://svnweb.freebsd.org/changeset/base/322151 Log: MFC r312882, r321983 and r321984: Use the busdma API to allocate all DMA-able memory. The MLX5 driver has four different types of DMA allocations which are now allocated using busdma: 1) The 4K firmware DMA-able blocks. One busdma object per 4K allocation. 2) Data for firmware commands use the 4K firmware blocks split into four 1K blocks. 3) The 4K firmware blocks are also used for doorbell pages. 4) The RQ-, SQ- and CQ- DMA rings. One busdma object per allocation. After this patch the mlx5en driver can be used with DMAR enabled in the FreeBSD kernel. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/device.h stable/10/sys/dev/mlx5/driver.h stable/10/sys/dev/mlx5/mlx5_core/mlx5_alloc.c stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/10/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/device.h ============================================================================== --- stable/10/sys/dev/mlx5/device.h Mon Aug 7 12:48:13 2017 (r322150) +++ stable/10/sys/dev/mlx5/device.h Mon Aug 7 12:49:30 2017 (r322151) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -103,6 +103,7 @@ __mlx5_mask(typ, fld)) enum { MLX5_MAX_COMMANDS = 32, MLX5_CMD_DATA_BLOCK_SIZE = 512, + MLX5_CMD_MBOX_SIZE = 1024, MLX5_PCI_CMD_XPORT = 7, MLX5_MKEY_BSF_OCTO_SIZE = 4, MLX5_MAX_PSVS = 4, @@ -522,6 +523,11 @@ struct mlx5_cmd_prot_block { u8 ctrl_sig; u8 sig; }; + +#define MLX5_NUM_CMDS_IN_ADAPTER_PAGE \ + (MLX5_ADAPTER_PAGE_SIZE / MLX5_CMD_MBOX_SIZE) +CTASSERT(MLX5_CMD_MBOX_SIZE >= sizeof(struct mlx5_cmd_prot_block)); +CTASSERT(MLX5_CMD_MBOX_SIZE <= MLX5_ADAPTER_PAGE_SIZE); enum { MLX5_CQE_SYND_FLUSHED_IN_ERROR = 5, Modified: stable/10/sys/dev/mlx5/driver.h ============================================================================== --- stable/10/sys/dev/mlx5/driver.h Mon Aug 7 12:48:13 2017 (r322150) +++ stable/10/sys/dev/mlx5/driver.h Mon Aug 7 12:49:30 2017 (r322151) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -258,13 +258,26 @@ struct mlx5_cmd_first { __be32 data[4]; }; -struct mlx5_cmd_msg { - struct list_head list; - struct cache_ent *cache; - u32 len; - struct mlx5_cmd_first first; - struct mlx5_cmd_mailbox *next; +struct cache_ent; +struct mlx5_fw_page { + union { + struct rb_node rb_node; + struct list_head list; + }; + struct mlx5_cmd_first first; + struct mlx5_core_dev *dev; + bus_dmamap_t dma_map; + bus_addr_t dma_addr; + void *virt_addr; + struct cache_ent *cache; + u32 numpages; + u16 load_done; +#define MLX5_LOAD_ST_NONE 0 +#define MLX5_LOAD_ST_SUCCESS 1 +#define MLX5_LOAD_ST_FAILURE 2 + u16 func_id; }; +#define mlx5_cmd_msg mlx5_fw_page struct mlx5_cmd_debug { struct dentry *dbg_root; @@ -304,9 +317,16 @@ struct mlx5_cmd_stats { }; struct mlx5_cmd { - void *cmd_alloc_buf; - dma_addr_t alloc_dma; - int alloc_size; + struct mlx5_fw_page *cmd_page; + bus_dma_tag_t dma_tag; + struct sx dma_sx; + struct mtx dma_mtx; +#define MLX5_DMA_OWNED(dev) mtx_owned(&(dev)->cmd.dma_mtx) +#define MLX5_DMA_LOCK(dev) mtx_lock(&(dev)->cmd.dma_mtx) +#define MLX5_DMA_UNLOCK(dev) mtx_unlock(&(dev)->cmd.dma_mtx) + struct cv dma_cv; +#define MLX5_DMA_DONE(dev) cv_broadcast(&(dev)->cmd.dma_cv) +#define MLX5_DMA_WAIT(dev) cv_wait(&(dev)->cmd.dma_cv, &(dev)->cmd.dma_mtx) void *cmd_buf; dma_addr_t dma; u16 cmdif_rev; @@ -331,7 +351,6 @@ struct mlx5_cmd { struct semaphore pages_sem; int mode; struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS]; - struct pci_pool *pool; struct mlx5_cmd_debug dbg; struct cmd_msg_cache cache; int checksum_disabled; @@ -345,24 +364,18 @@ struct mlx5_port_caps { u8 ext_port_cap; }; -struct mlx5_cmd_mailbox { - void *buf; - dma_addr_t dma; - struct mlx5_cmd_mailbox *next; -}; - -struct mlx5_buf_list { - void *buf; - dma_addr_t map; -}; - struct mlx5_buf { - struct mlx5_buf_list direct; - struct mlx5_buf_list *page_list; - int nbufs; + bus_dma_tag_t dma_tag; + bus_dmamap_t dma_map; + struct mlx5_core_dev *dev; + struct { + void *buf; + } direct; + u64 *page_list; int npages; int size; u8 page_shift; + u8 load_done; }; struct mlx5_eq { @@ -521,7 +534,6 @@ struct mlx5_priv { struct rb_root page_root; s64 fw_pages; atomic_t reg_pages; - struct list_head free_list; s64 pages_per_func[MLX5_MAX_NUMBER_OF_VFS]; struct mlx5_core_health health; @@ -664,7 +676,7 @@ struct mlx5_vport_counters { }; enum { - MLX5_DB_PER_PAGE = PAGE_SIZE / L1_CACHE_BYTES, + MLX5_DB_PER_PAGE = MLX5_ADAPTER_PAGE_SIZE / L1_CACHE_BYTES, }; struct mlx5_core_dct { @@ -688,6 +700,7 @@ enum { struct mlx5_db_pgdir { struct list_head list; DECLARE_BITMAP(bitmap, MLX5_DB_PER_PAGE); + struct mlx5_fw_page *fw_page; __be32 *db_page; dma_addr_t db_dma; }; @@ -697,6 +710,7 @@ typedef void (*mlx5_cmd_cbk_t)(int status, void *conte struct mlx5_cmd_work_ent { struct mlx5_cmd_msg *in; struct mlx5_cmd_msg *out; + int uin_size; void *uout; int uout_size; mlx5_cmd_cbk_t callback; @@ -721,13 +735,10 @@ struct mlx5_pas { u8 log_sz; }; -static inline void *mlx5_buf_offset(struct mlx5_buf *buf, int offset) +static inline void * +mlx5_buf_offset(struct mlx5_buf *buf, int offset) { - if (likely(BITS_PER_LONG == 64 || buf->nbufs == 1)) - return buf->direct.buf + offset; - else - return buf->page_list[offset >> PAGE_SHIFT].buf + - (offset & (PAGE_SIZE - 1)); + return ((char *)buf->direct.buf + offset); } @@ -816,8 +827,9 @@ void mlx5_health_cleanup(void); void __init mlx5_health_init(void); void mlx5_start_health_poll(struct mlx5_core_dev *dev); void mlx5_stop_health_poll(struct mlx5_core_dev *dev); -int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, int max_direct, - struct mlx5_buf *buf, int node); + +#define mlx5_buf_alloc_node(dev, size, direct, buf, node) \ + mlx5_buf_alloc(dev, size, direct, buf) int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct, struct mlx5_buf *buf); void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf); @@ -845,6 +857,12 @@ int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn); int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb, u16 opmod, u8 port); +void mlx5_fwp_flush(struct mlx5_fw_page *fwp); +void mlx5_fwp_invalidate(struct mlx5_fw_page *fwp); +struct mlx5_fw_page *mlx5_fwp_alloc(struct mlx5_core_dev *dev, gfp_t flags, unsigned num); +void mlx5_fwp_free(struct mlx5_fw_page *fwp); +u64 mlx5_fwp_get_dma(struct mlx5_fw_page *fwp, size_t offset); +void *mlx5_fwp_get_virt(struct mlx5_fw_page *fwp, size_t offset); void mlx5_pagealloc_init(struct mlx5_core_dev *dev); void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev); int mlx5_pagealloc_start(struct mlx5_core_dev *dev); Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_alloc.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_core/mlx5_alloc.c Mon Aug 7 12:48:13 2017 (r322150) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_alloc.c Mon Aug 7 12:49:30 2017 (r322151) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,106 +40,110 @@ * multiple pages, so we don't require too much contiguous memory. */ -static void *mlx5_dma_zalloc_coherent_node(struct mlx5_core_dev *dev, - size_t size, dma_addr_t *dma_handle, - int node) +static void +mlx5_buf_load_mem_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - void *cpu_handle; + struct mlx5_buf *buf; + uint8_t owned; + int x; - cpu_handle = dma_zalloc_coherent(&dev->pdev->dev, size, - dma_handle, GFP_KERNEL); - return cpu_handle; + buf = (struct mlx5_buf *)arg; + owned = MLX5_DMA_OWNED(buf->dev); + + if (!owned) + MLX5_DMA_LOCK(buf->dev); + + if (error == 0) { + for (x = 0; x != nseg; x++) { + buf->page_list[x] = segs[x].ds_addr; + KASSERT(segs[x].ds_len == PAGE_SIZE, ("Invalid segment size")); + } + buf->load_done = MLX5_LOAD_ST_SUCCESS; + } else { + buf->load_done = MLX5_LOAD_ST_FAILURE; + } + MLX5_DMA_DONE(buf->dev); + + if (!owned) + MLX5_DMA_UNLOCK(buf->dev); } -int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, int max_direct, - struct mlx5_buf *buf, int node) +int +mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, + int max_direct, struct mlx5_buf *buf) { - dma_addr_t t; + int err; - buf->size = size; - if (size <= max_direct) { - buf->nbufs = 1; - buf->npages = 1; - buf->page_shift = (u8)get_order(size) + PAGE_SHIFT; - buf->direct.buf = mlx5_dma_zalloc_coherent_node(dev, size, - &t, node); - if (!buf->direct.buf) - return -ENOMEM; + buf->npages = howmany(size, PAGE_SIZE); + buf->page_shift = PAGE_SHIFT; + buf->load_done = MLX5_LOAD_ST_NONE; + buf->dev = dev; + buf->page_list = kcalloc(buf->npages, sizeof(*buf->page_list), + GFP_KERNEL); - buf->direct.map = t; + err = -bus_dma_tag_create( + bus_get_dma_tag(dev->pdev->dev.bsddev), + PAGE_SIZE, /* alignment */ + 0, /* no boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + PAGE_SIZE * buf->npages, /* maxsize */ + buf->npages, /* nsegments */ + PAGE_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockfuncarg */ + &buf->dma_tag); - while (t & ((1 << buf->page_shift) - 1)) { - --buf->page_shift; - buf->npages *= 2; - } - } else { - int i; + if (err != 0) + goto err_dma_tag; - buf->direct.buf = NULL; - buf->nbufs = (size + PAGE_SIZE - 1) / PAGE_SIZE; - buf->npages = buf->nbufs; - buf->page_shift = PAGE_SHIFT; - buf->page_list = kcalloc(buf->nbufs, sizeof(*buf->page_list), - GFP_KERNEL); + /* allocate memory */ + err = -bus_dmamem_alloc(buf->dma_tag, &buf->direct.buf, + BUS_DMA_WAITOK | BUS_DMA_COHERENT, &buf->dma_map); + if (err != 0) + goto err_dma_alloc; - for (i = 0; i < buf->nbufs; i++) { - buf->page_list[i].buf = - mlx5_dma_zalloc_coherent_node(dev, PAGE_SIZE, - &t, node); + /* load memory into DMA */ + MLX5_DMA_LOCK(dev); + err = bus_dmamap_load( + buf->dma_tag, buf->dma_map, buf->direct.buf, + PAGE_SIZE * buf->npages, &mlx5_buf_load_mem_cb, + buf, BUS_DMA_WAITOK | BUS_DMA_COHERENT); - buf->page_list[i].map = t; - } + while (buf->load_done == MLX5_LOAD_ST_NONE) + MLX5_DMA_WAIT(dev); + MLX5_DMA_UNLOCK(dev); - if (BITS_PER_LONG == 64) { - struct page **pages; - - pages = kmalloc(sizeof(*pages) * (buf->nbufs + 1), - GFP_KERNEL); - for (i = 0; i < buf->nbufs; i++) - pages[i] = virt_to_page(buf->page_list[i].buf); - pages[buf->nbufs] = pages[0]; - buf->direct.buf = vmap(pages, buf->nbufs + 1, VM_MAP, - PAGE_KERNEL); - kfree(pages); - if (!buf->direct.buf) - goto err_free; - } + /* check for error */ + if (buf->load_done != MLX5_LOAD_ST_SUCCESS) { + err = -ENOMEM; + goto err_dma_load; } - return 0; + /* clean memory */ + memset(buf->direct.buf, 0, PAGE_SIZE * buf->npages); -err_free: - mlx5_buf_free(dev, buf); + /* flush memory to RAM */ + bus_dmamap_sync(buf->dev->cmd.dma_tag, buf->dma_map, BUS_DMASYNC_PREWRITE); + return (0); - return -ENOMEM; +err_dma_load: + bus_dmamem_free(buf->dma_tag, buf->direct.buf, buf->dma_map); +err_dma_alloc: + bus_dma_tag_destroy(buf->dma_tag); +err_dma_tag: + kfree(buf->page_list); + return (err); } -int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct, - struct mlx5_buf *buf) -{ - return mlx5_buf_alloc_node(dev, size, max_direct, - buf, dev->priv.numa_node); -} -EXPORT_SYMBOL_GPL(mlx5_buf_alloc); - - void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf) { - if (buf->nbufs == 1) - dma_free_coherent(&dev->pdev->dev, buf->size, buf->direct.buf, - buf->direct.map); - else { - int i; - if (BITS_PER_LONG == 64 && buf->direct.buf) - vunmap(buf->direct.buf); - for (i = 0; i < buf->nbufs; i++) - if (buf->page_list[i].buf) - dma_free_coherent(&dev->pdev->dev, PAGE_SIZE, - buf->page_list[i].buf, - buf->page_list[i].map); - kfree(buf->page_list); - } + bus_dmamap_unload(buf->dma_tag, buf->dma_map); + bus_dmamem_free(buf->dma_tag, buf->direct.buf, buf->dma_map); + bus_dma_tag_destroy(buf->dma_tag); + kfree(buf->page_list); } EXPORT_SYMBOL_GPL(mlx5_buf_free); @@ -152,8 +156,17 @@ static struct mlx5_db_pgdir *mlx5_alloc_db_pgdir(struc bitmap_fill(pgdir->bitmap, MLX5_DB_PER_PAGE); - pgdir->db_page = mlx5_dma_zalloc_coherent_node(dev, PAGE_SIZE, - &pgdir->db_dma, node); + pgdir->fw_page = mlx5_fwp_alloc(dev, GFP_KERNEL, 1); + if (pgdir->fw_page != NULL) { + pgdir->db_page = pgdir->fw_page->virt_addr; + pgdir->db_dma = pgdir->fw_page->dma_addr; + + /* clean allocated memory */ + memset(pgdir->db_page, 0, MLX5_ADAPTER_PAGE_SIZE); + + /* flush memory to RAM */ + mlx5_fwp_flush(pgdir->fw_page); + } if (!pgdir->db_page) { kfree(pgdir); return NULL; @@ -228,8 +241,7 @@ void mlx5_db_free(struct mlx5_core_dev *dev, struct ml __set_bit(db->index, db->u.pgdir->bitmap); if (bitmap_full(db->u.pgdir->bitmap, MLX5_DB_PER_PAGE)) { - dma_free_coherent(&(dev->pdev->dev), PAGE_SIZE, - db->u.pgdir->db_page, db->u.pgdir->db_dma); + mlx5_fwp_free(db->u.pgdir->fw_page); list_del(&db->u.pgdir->list); kfree(db->u.pgdir); } @@ -238,19 +250,12 @@ void mlx5_db_free(struct mlx5_core_dev *dev, struct ml } EXPORT_SYMBOL_GPL(mlx5_db_free); - -void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas) +void +mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas) { - u64 addr; int i; - for (i = 0; i < buf->npages; i++) { - if (buf->nbufs == 1) - addr = buf->direct.map + ((u64)i << buf->page_shift); - else - addr = buf->page_list[i].map; - - pas[i] = cpu_to_be64(addr); - } + for (i = 0; i != buf->npages; i++) + pas[i] = cpu_to_be64(buf->page_list[i]); } EXPORT_SYMBOL_GPL(mlx5_fill_page_array); Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Aug 7 12:48:13 2017 (r322150) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Aug 7 12:49:30 2017 (r322151) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -77,6 +77,7 @@ enum { static struct mlx5_cmd_work_ent *alloc_cmd(struct mlx5_cmd *cmd, struct mlx5_cmd_msg *in, + int uin_size, struct mlx5_cmd_msg *out, void *uout, int uout_size, mlx5_cmd_cbk_t cbk, @@ -90,6 +91,7 @@ static struct mlx5_cmd_work_ent *alloc_cmd(struct mlx5 return ERR_PTR(-ENOMEM); ent->in = in; + ent->uin_size = uin_size; ent->out = out; ent->uout = uout; ent->uout_size = uout_size; @@ -192,14 +194,26 @@ static void calc_block_sig(struct mlx5_cmd_prot_block } } -static void calc_chain_sig(struct mlx5_cmd_msg *msg, u8 token, int csum) +static void +calc_chain_sig(struct mlx5_cmd_msg *msg, u8 token, int csum) { - struct mlx5_cmd_mailbox *next = msg->next; + size_t i; - while (next) { - calc_block_sig(next->buf, token, csum); - next = next->next; + for (i = 0; i != (msg->numpages * MLX5_NUM_CMDS_IN_ADAPTER_PAGE); i++) { + struct mlx5_cmd_prot_block *block; + + block = mlx5_fwp_get_virt(msg, i * MLX5_CMD_MBOX_SIZE); + + /* compute signature */ + calc_block_sig(block, token, csum); + + /* check for last block */ + if (block->next == 0) + break; } + + /* make sure data gets written to RAM */ + mlx5_fwp_flush(msg); } static void set_signature(struct mlx5_cmd_work_ent *ent, int csum) @@ -235,10 +249,11 @@ static void free_cmd(struct mlx5_cmd_work_ent *ent) kfree(ent); } - -static int verify_signature(struct mlx5_cmd_work_ent *ent) +static int +verify_signature(struct mlx5_cmd_work_ent *ent) { - struct mlx5_cmd_mailbox *next = ent->out->next; + struct mlx5_cmd_msg *msg = ent->out; + size_t i; int err; u8 sig; @@ -246,15 +261,21 @@ static int verify_signature(struct mlx5_cmd_work_ent * if (sig != 0xff) return -EINVAL; - while (next) { - err = verify_block_sig(next->buf); - if (err) - return err; + for (i = 0; i != (msg->numpages * MLX5_NUM_CMDS_IN_ADAPTER_PAGE); i++) { + struct mlx5_cmd_prot_block *block; - next = next->next; - } + block = mlx5_fwp_get_virt(msg, i * MLX5_CMD_MBOX_SIZE); - return 0; + /* compute signature */ + err = verify_block_sig(block); + if (err != 0) + return (err); + + /* check for last block */ + if (block->next == 0) + break; + } + return (0); } static void dump_buf(void *buf, int size, int data_only, int offset) @@ -681,9 +702,10 @@ static void dump_command(struct mlx5_core_dev *dev, { u16 op = be16_to_cpu(((struct mlx5_inbox_hdr *)(ent->lay->in))->opcode); struct mlx5_cmd_msg *msg = input ? ent->in : ent->out; - struct mlx5_cmd_mailbox *next = msg->next; + size_t i; int data_only; - u32 offset = 0; + int offset = 0; + int msg_len = input ? ent->uin_size : ent->uout_size; int dump_len; data_only = !!(mlx5_core_debug_mask & (1 << MLX5_CMD_DATA)); @@ -711,17 +733,28 @@ static void dump_command(struct mlx5_core_dev *dev, offset += sizeof(*ent->lay); } - while (next && offset < msg->len) { + for (i = 0; i != (msg->numpages * MLX5_NUM_CMDS_IN_ADAPTER_PAGE); i++) { + struct mlx5_cmd_prot_block *block; + + block = mlx5_fwp_get_virt(msg, i * MLX5_CMD_MBOX_SIZE); + if (data_only) { - dump_len = min_t(int, MLX5_CMD_DATA_BLOCK_SIZE, msg->len - offset); - dump_buf(next->buf, dump_len, 1, offset); + if (offset >= msg_len) + break; + dump_len = min_t(int, + MLX5_CMD_DATA_BLOCK_SIZE, msg_len - offset); + + dump_buf(block->data, dump_len, 1, offset); offset += MLX5_CMD_DATA_BLOCK_SIZE; } else { mlx5_core_dbg(dev, "command block:\n"); - dump_buf(next->buf, sizeof(struct mlx5_cmd_prot_block), 0, offset); - offset += sizeof(struct mlx5_cmd_prot_block); + dump_buf(block, sizeof(*block), 0, offset); + offset += sizeof(*block); } - next = next->next; + + /* check for last block */ + if (block->next == 0) + break; } if (data_only) @@ -982,12 +1015,12 @@ static void cmd_work_handler(struct work_struct *work) memset(lay, 0, sizeof(*lay)); memcpy(lay->in, ent->in->first.data, sizeof(lay->in)); ent->op = be32_to_cpu(lay->in[0]) >> 16; - if (ent->in->next) - lay->in_ptr = cpu_to_be64(ent->in->next->dma); - lay->inlen = cpu_to_be32(ent->in->len); - if (ent->out->next) - lay->out_ptr = cpu_to_be64(ent->out->next->dma); - lay->outlen = cpu_to_be32(ent->out->len); + if (ent->in->numpages != 0) + lay->in_ptr = cpu_to_be64(mlx5_fwp_get_dma(ent->in, 0)); + if (ent->out->numpages != 0) + lay->out_ptr = cpu_to_be64(mlx5_fwp_get_dma(ent->out, 0)); + lay->inlen = cpu_to_be32(ent->uin_size); + lay->outlen = cpu_to_be32(ent->uout_size); lay->type = MLX5_PCI_CMD_XPORT; lay->token = ent->token; lay->status_own = CMD_OWNER_HW; @@ -997,14 +1030,14 @@ static void cmd_work_handler(struct work_struct *work) ent->busy = 0; /* ring doorbell after the descriptor is valid */ mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx); - wmb(); + /* make sure data is written to RAM */ + mlx5_fwp_flush(cmd->cmd_page); iowrite32be(1 << ent->idx, &dev->iseg->cmd_dbell); mmiowb(); /* if not in polling don't use ent after this point*/ if (cmd->mode == CMD_MODE_POLLING) { poll_timeout(ent); /* make sure we read the descriptor after ownership is SW */ - rmb(); mlx5_cmd_comp_handler(dev, 1U << ent->idx); } } @@ -1078,6 +1111,7 @@ static int wait_func(struct mlx5_core_dev *dev, struct * 2. page queue commands do not support asynchrous completion */ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, + int uin_size, struct mlx5_cmd_msg *out, void *uout, int uout_size, mlx5_cmd_cbk_t callback, void *context, int page_queue, u8 *status) @@ -1092,8 +1126,8 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, if (callback && page_queue) return -EINVAL; - ent = alloc_cmd(cmd, in, out, uout, uout_size, callback, context, - page_queue); + ent = alloc_cmd(cmd, in, uin_size, out, uout, uout_size, callback, + context, page_queue); if (IS_ERR(ent)) return PTR_ERR(ent); @@ -1138,159 +1172,98 @@ out: return err; } -static int mlx5_copy_to_msg(struct mlx5_cmd_msg *to, void *from, int size) +static int mlx5_copy_to_msg(struct mlx5_cmd_msg *to, void *from, size_t size) { - struct mlx5_cmd_prot_block *block; - struct mlx5_cmd_mailbox *next; - int copy; + size_t delta; + size_t i; - if (!to || !from) - return -ENOMEM; + if (to == NULL || from == NULL) + return (-ENOMEM); - copy = min_t(int, size, sizeof(to->first.data)); - memcpy(to->first.data, from, copy); - size -= copy; - from += copy; + delta = min_t(size_t, size, sizeof(to->first.data)); + memcpy(to->first.data, from, delta); + from = (char *)from + delta; + size -= delta; - next = to->next; - while (size) { - if (!next) { - /* this is a BUG */ - return -ENOMEM; - } + for (i = 0; size != 0; i++) { + struct mlx5_cmd_prot_block *block; - copy = min_t(int, size, MLX5_CMD_DATA_BLOCK_SIZE); - block = next->buf; - memcpy(block->data, from, copy); - from += copy; - size -= copy; - next = next->next; - } + block = mlx5_fwp_get_virt(to, i * MLX5_CMD_MBOX_SIZE); - return 0; + delta = min_t(size_t, size, MLX5_CMD_DATA_BLOCK_SIZE); + memcpy(block->data, from, delta); + from = (char *)from + delta; + size -= delta; + } + return (0); } static int mlx5_copy_from_msg(void *to, struct mlx5_cmd_msg *from, int size) { - struct mlx5_cmd_prot_block *block; - struct mlx5_cmd_mailbox *next; - int copy; + size_t delta; + size_t i; - if (!to || !from) - return -ENOMEM; + if (to == NULL || from == NULL) + return (-ENOMEM); - copy = min_t(int, size, sizeof(from->first.data)); - memcpy(to, from->first.data, copy); - size -= copy; - to += copy; + delta = min_t(size_t, size, sizeof(from->first.data)); + memcpy(to, from->first.data, delta); + to = (char *)to + delta; + size -= delta; - next = from->next; - while (size) { - if (!next) { - /* this is a BUG */ - return -ENOMEM; - } + for (i = 0; size != 0; i++) { + struct mlx5_cmd_prot_block *block; - copy = min_t(int, size, MLX5_CMD_DATA_BLOCK_SIZE); - block = next->buf; + block = mlx5_fwp_get_virt(from, i * MLX5_CMD_MBOX_SIZE); - memcpy(to, block->data, copy); - to += copy; - size -= copy; - next = next->next; + delta = min_t(size_t, size, MLX5_CMD_DATA_BLOCK_SIZE); + memcpy(to, block->data, delta); + to = (char *)to + delta; + size -= delta; } - - return 0; + return (0); } -static struct mlx5_cmd_mailbox *alloc_cmd_box(struct mlx5_core_dev *dev, - gfp_t flags) +static struct mlx5_cmd_msg * +mlx5_alloc_cmd_msg(struct mlx5_core_dev *dev, gfp_t flags, size_t size) { - struct mlx5_cmd_mailbox *mailbox; + struct mlx5_cmd_msg *msg; + size_t blen; + size_t n; + size_t i; - mailbox = kmalloc(sizeof(*mailbox), flags); - if (!mailbox) - return ERR_PTR(-ENOMEM); + blen = size - min_t(size_t, sizeof(msg->first.data), size); + n = howmany(blen, MLX5_CMD_DATA_BLOCK_SIZE); - mailbox->buf = pci_pool_alloc(dev->cmd.pool, flags, - &mailbox->dma); - if (!mailbox->buf) { - mlx5_core_dbg(dev, "failed allocation\n"); - kfree(mailbox); - return ERR_PTR(-ENOMEM); - } - memset(mailbox->buf, 0, sizeof(struct mlx5_cmd_prot_block)); - mailbox->next = NULL; + msg = mlx5_fwp_alloc(dev, flags, howmany(n, MLX5_NUM_CMDS_IN_ADAPTER_PAGE)); + if (msg == NULL) + return (ERR_PTR(-ENOMEM)); - return mailbox; -} + for (i = 0; i != n; i++) { + struct mlx5_cmd_prot_block *block; -static void free_cmd_box(struct mlx5_core_dev *dev, - struct mlx5_cmd_mailbox *mailbox) -{ - pci_pool_free(dev->cmd.pool, mailbox->buf, mailbox->dma); - kfree(mailbox); -} + block = mlx5_fwp_get_virt(msg, i * MLX5_CMD_MBOX_SIZE); -static struct mlx5_cmd_msg *mlx5_alloc_cmd_msg(struct mlx5_core_dev *dev, - gfp_t flags, int size) -{ - struct mlx5_cmd_mailbox *tmp, *head = NULL; - struct mlx5_cmd_prot_block *block; - struct mlx5_cmd_msg *msg; - int blen; - int err; - int n; - int i; + memset(block, 0, MLX5_CMD_MBOX_SIZE); - msg = kzalloc(sizeof(*msg), flags); - if (!msg) - return ERR_PTR(-ENOMEM); - - blen = size - min_t(int, sizeof(msg->first.data), size); - n = (blen + MLX5_CMD_DATA_BLOCK_SIZE - 1) / MLX5_CMD_DATA_BLOCK_SIZE; - - for (i = 0; i < n; i++) { - tmp = alloc_cmd_box(dev, flags); - if (IS_ERR(tmp)) { - mlx5_core_warn(dev, "failed allocating block\n"); - err = PTR_ERR(tmp); - goto err_alloc; + if (i != (n - 1)) { + u64 dma = mlx5_fwp_get_dma(msg, (i + 1) * MLX5_CMD_MBOX_SIZE); + block->next = cpu_to_be64(dma); } - - block = tmp->buf; - tmp->next = head; - block->next = cpu_to_be64(tmp->next ? tmp->next->dma : 0); - block->block_num = cpu_to_be32(n - i - 1); - head = tmp; + block->block_num = cpu_to_be32(i); } - msg->next = head; - msg->len = size; - return msg; -err_alloc: - while (head) { - tmp = head->next; - free_cmd_box(dev, head); - head = tmp; - } - kfree(msg); + /* make sure initial data is written to RAM */ + mlx5_fwp_flush(msg); - return ERR_PTR(err); + return (msg); } -static void mlx5_free_cmd_msg(struct mlx5_core_dev *dev, - struct mlx5_cmd_msg *msg) +static void +mlx5_free_cmd_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg) { - struct mlx5_cmd_mailbox *head = msg->next; - struct mlx5_cmd_mailbox *next; - while (head) { - next = head->next; - free_cmd_box(dev, head); - head = next; - } - kfree(msg); + mlx5_fwp_free(msg); } static void set_wqname(struct mlx5_core_dev *dev) @@ -1356,6 +1329,9 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent; int i; + /* make sure data gets read from RAM */ + mlx5_fwp_invalidate(cmd->cmd_page); + while (vector != 0) { i = ffs(vector) - 1; vector &= ~(1U << i); @@ -1363,6 +1339,8 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, ent->ts2 = ktime_get_ns(); memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); + /* make sure data gets read from RAM */ + mlx5_fwp_invalidate(ent->out); dump_command(dev, ent, 0); if (!ent->ret) { if (!cmd->checksum_disabled) @@ -1432,10 +1410,6 @@ static struct mlx5_cmd_msg *alloc_msg(struct mlx5_core if (!list_empty(&ent->head)) { msg = list_entry(ent->head.next, struct mlx5_cmd_msg, list); - /* For cached lists, we must explicitly state what is - * the real size - */ - msg->len = in_size; list_del(&msg->list); } spin_unlock_irq(&ent->lock); @@ -1460,12 +1434,11 @@ static int cmd_exec_helper(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *inb; struct mlx5_cmd_msg *outb; int pages_queue; - gfp_t gfp; + const gfp_t gfp = GFP_KERNEL; int err; u8 status = 0; pages_queue = is_manage_pages(in); - gfp = callback ? GFP_ATOMIC : GFP_KERNEL; inb = alloc_msg(dev, in_size, gfp); if (IS_ERR(inb)) { @@ -1485,8 +1458,8 @@ static int cmd_exec_helper(struct mlx5_core_dev *dev, goto out_in; } - err = mlx5_cmd_invoke(dev, inb, outb, out, out_size, callback, context, - pages_queue, &status); + err = mlx5_cmd_invoke(dev, inb, in_size, outb, out, out_size, callback, + context, pages_queue, &status); if (err) { if (err == -ETIMEDOUT) return err; @@ -1583,44 +1556,67 @@ ex_err: return err; } -static int alloc_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd) +static int +alloc_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd) { - struct device *ddev = &dev->pdev->dev; - cmd->cmd_alloc_buf = dma_zalloc_coherent(ddev, MLX5_ADAPTER_PAGE_SIZE, - &cmd->alloc_dma, GFP_KERNEL); - if (!cmd->cmd_alloc_buf) - return -ENOMEM; + int err; - /* make sure it is aligned to 4K */ - if (!((uintptr_t)cmd->cmd_alloc_buf & (MLX5_ADAPTER_PAGE_SIZE - 1))) { - cmd->cmd_buf = cmd->cmd_alloc_buf; - cmd->dma = cmd->alloc_dma; - cmd->alloc_size = MLX5_ADAPTER_PAGE_SIZE; - return 0; + sx_init(&cmd->dma_sx, "MLX5-DMA-SX"); + mtx_init(&cmd->dma_mtx, "MLX5-DMA-MTX", NULL, MTX_DEF); + cv_init(&cmd->dma_cv, "MLX5-DMA-CV"); + + /* + * Create global DMA descriptor tag for allocating + * 4K firmware pages: + */ + err = -bus_dma_tag_create( + bus_get_dma_tag(dev->pdev->dev.bsddev), + MLX5_ADAPTER_PAGE_SIZE, /* alignment */ + 0, /* no boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MLX5_ADAPTER_PAGE_SIZE, /* maxsize */ + 1, /* nsegments */ + MLX5_ADAPTER_PAGE_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockfuncarg */ + &cmd->dma_tag); + if (err != 0) + goto failure_destroy_sx; + + cmd->cmd_page = mlx5_fwp_alloc(dev, GFP_KERNEL, 1); + if (cmd->cmd_page == NULL) { + err = -ENOMEM; + goto failure_alloc_page; } + cmd->dma = mlx5_fwp_get_dma(cmd->cmd_page, 0); + cmd->cmd_buf = mlx5_fwp_get_virt(cmd->cmd_page, 0); + return (0); - dma_free_coherent(ddev, MLX5_ADAPTER_PAGE_SIZE, cmd->cmd_alloc_buf, cmd->alloc_dma); - cmd->cmd_alloc_buf = dma_zalloc_coherent(ddev, 2 * MLX5_ADAPTER_PAGE_SIZE - 1, - &cmd->alloc_dma, GFP_KERNEL); - if (!cmd->cmd_alloc_buf) - return -ENOMEM; +failure_alloc_page: + bus_dma_tag_destroy(cmd->dma_tag); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Aug 7 12:52:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EC61DD16DC; Mon, 7 Aug 2017 12:52:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CDDF69D98; Mon, 7 Aug 2017 12:52:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77Cq00g094372; Mon, 7 Aug 2017 12:52:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77Cq0ff094371; Mon, 7 Aug 2017 12:52:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071252.v77Cq0ff094371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:52:00 +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: r322152 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 322152 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:52:01 -0000 Author: hselasky Date: Mon Aug 7 12:52:00 2017 New Revision: 322152 URL: https://svnweb.freebsd.org/changeset/base/322152 Log: MFC r321985: Ticks are 32-bit in FreeBSD. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/addr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/addr.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/addr.c Mon Aug 7 12:49:30 2017 (r322151) +++ stable/11/sys/ofed/drivers/infiniband/core/addr.c Mon Aug 7 12:52:00 2017 (r322152) @@ -185,10 +185,10 @@ EXPORT_SYMBOL(rdma_translate_ip); static void set_timeout(unsigned long time) { - unsigned long delay; + int delay; /* under FreeBSD ticks are 32-bit */ delay = time - jiffies; - if ((long)delay <= 0) + if (delay <= 0) delay = 1; mod_delayed_work(addr_wq, &work, delay); From owner-svn-src-all@freebsd.org Mon Aug 7 12:53:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F3C6DD18E6; Mon, 7 Aug 2017 12:53:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6BA366A044; Mon, 7 Aug 2017 12:53:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77CrAck094464; Mon, 7 Aug 2017 12:53:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77CrAIJ094463; Mon, 7 Aug 2017 12:53:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071253.v77CrAIJ094463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:53:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322153 - stable/10/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 322153 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:53:11 -0000 Author: hselasky Date: Mon Aug 7 12:53:10 2017 New Revision: 322153 URL: https://svnweb.freebsd.org/changeset/base/322153 Log: MFC r321985: Ticks are 32-bit in FreeBSD. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/infiniband/core/addr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/infiniband/core/addr.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/core/addr.c Mon Aug 7 12:52:00 2017 (r322152) +++ stable/10/sys/ofed/drivers/infiniband/core/addr.c Mon Aug 7 12:53:10 2017 (r322153) @@ -192,10 +192,10 @@ EXPORT_SYMBOL(rdma_translate_ip); static void set_timeout(unsigned long time) { - unsigned long delay; + int delay; /* under FreeBSD ticks are 32-bit */ delay = time - jiffies; - if ((long)delay <= 0) + if (delay <= 0) delay = 1; mod_delayed_work(addr_wq, &work, delay); From owner-svn-src-all@freebsd.org Mon Aug 7 12:56:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37733DD1AA1; Mon, 7 Aug 2017 12:56:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05D5A6A1B9; Mon, 7 Aug 2017 12:56:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77Cu4tF094632; Mon, 7 Aug 2017 12:56:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77Cu4J3094631; Mon, 7 Aug 2017 12:56:04 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071256.v77Cu4J3094631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:56:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r322154 - stable/9/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 322154 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:56:05 -0000 Author: hselasky Date: Mon Aug 7 12:56:03 2017 New Revision: 322154 URL: https://svnweb.freebsd.org/changeset/base/322154 Log: MFC r321985: Ticks are 32-bit in FreeBSD. Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/infiniband/core/addr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/infiniband/core/addr.c ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/core/addr.c Mon Aug 7 12:53:10 2017 (r322153) +++ stable/9/sys/ofed/drivers/infiniband/core/addr.c Mon Aug 7 12:56:03 2017 (r322154) @@ -192,10 +192,10 @@ EXPORT_SYMBOL(rdma_translate_ip); static void set_timeout(unsigned long time) { - unsigned long delay; + int delay; /* under FreeBSD ticks are 32-bit */ delay = time - jiffies; - if ((long)delay <= 0) + if (delay <= 0) delay = 1; mod_delayed_work(addr_wq, &work, delay); From owner-svn-src-all@freebsd.org Mon Aug 7 12:57:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41FB1DD1C44; Mon, 7 Aug 2017 12:57:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E7616A36F; Mon, 7 Aug 2017 12:57:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77CvVMO094741; Mon, 7 Aug 2017 12:57:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77CvVut094740; Mon, 7 Aug 2017 12:57:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071257.v77CvVut094740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:57: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: r322155 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 322155 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:57:32 -0000 Author: hselasky Date: Mon Aug 7 12:57:31 2017 New Revision: 322155 URL: https://svnweb.freebsd.org/changeset/base/322155 Log: MFC r321986: Change reject message type when destroying cm_id in ibore. This patch fixes an interopability issue between FreeBSD and non-FreeBSD systems when the connection establishment is aborted. Refer to the initial commit in Linux, drivers/infiniband/core/cm.c, for a more detailed description. Obtained from: Linux Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/cm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/cm.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/cm.c Mon Aug 7 12:56:03 2017 (r322154) +++ stable/11/sys/ofed/drivers/infiniband/core/cm.c Mon Aug 7 12:57:31 2017 (r322155) @@ -889,6 +889,7 @@ retest: cm_reject_sidr_req(cm_id_priv, IB_SIDR_REJECT); break; case IB_CM_REQ_SENT: + case IB_CM_MRA_REQ_RCVD: ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); spin_unlock_irq(&cm_id_priv->lock); ib_send_cm_rej(cm_id, IB_CM_REJ_TIMEOUT, @@ -907,7 +908,6 @@ retest: NULL, 0, NULL, 0); } break; - case IB_CM_MRA_REQ_RCVD: case IB_CM_REP_SENT: case IB_CM_MRA_REP_RCVD: ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); From owner-svn-src-all@freebsd.org Mon Aug 7 12:58:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BC5CDD1D1E; Mon, 7 Aug 2017 12:58:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8C2F6A4DB; Mon, 7 Aug 2017 12:58:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77CwW9W094837; Mon, 7 Aug 2017 12:58:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77CwWYh094836; Mon, 7 Aug 2017 12:58:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071258.v77CwWYh094836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:58:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322156 - stable/10/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 322156 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:58:33 -0000 Author: hselasky Date: Mon Aug 7 12:58:31 2017 New Revision: 322156 URL: https://svnweb.freebsd.org/changeset/base/322156 Log: MFC r321986: Change reject message type when destroying cm_id in ibore. This patch fixes an interopability issue between FreeBSD and non-FreeBSD systems when the connection establishment is aborted. Refer to the initial commit in Linux, drivers/infiniband/core/cm.c, for a more detailed description. Obtained from: Linux Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/infiniband/core/cm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/infiniband/core/cm.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/core/cm.c Mon Aug 7 12:57:31 2017 (r322155) +++ stable/10/sys/ofed/drivers/infiniband/core/cm.c Mon Aug 7 12:58:31 2017 (r322156) @@ -870,6 +870,7 @@ retest: cm_reject_sidr_req(cm_id_priv, IB_SIDR_REJECT); break; case IB_CM_REQ_SENT: + case IB_CM_MRA_REQ_RCVD: ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); spin_unlock_irq(&cm_id_priv->lock); ib_send_cm_rej(cm_id, IB_CM_REJ_TIMEOUT, @@ -888,7 +889,6 @@ retest: NULL, 0, NULL, 0); } break; - case IB_CM_MRA_REQ_RCVD: case IB_CM_REP_SENT: case IB_CM_MRA_REP_RCVD: ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); From owner-svn-src-all@freebsd.org Mon Aug 7 12:59:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 987D0DD1E45; Mon, 7 Aug 2017 12:59:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62B096A624; Mon, 7 Aug 2017 12:59:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77CxWuH094931; Mon, 7 Aug 2017 12:59:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77CxWun094930; Mon, 7 Aug 2017 12:59:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071259.v77CxWun094930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 12:59:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r322157 - stable/9/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 322157 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 12:59:33 -0000 Author: hselasky Date: Mon Aug 7 12:59:32 2017 New Revision: 322157 URL: https://svnweb.freebsd.org/changeset/base/322157 Log: MFC r321986: Change reject message type when destroying cm_id in ibore. This patch fixes an interopability issue between FreeBSD and non-FreeBSD systems when the connection establishment is aborted. Refer to the initial commit in Linux, drivers/infiniband/core/cm.c, for a more detailed description. Obtained from: Linux Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/infiniband/core/cm.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/infiniband/core/cm.c ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/core/cm.c Mon Aug 7 12:58:31 2017 (r322156) +++ stable/9/sys/ofed/drivers/infiniband/core/cm.c Mon Aug 7 12:59:32 2017 (r322157) @@ -870,6 +870,7 @@ retest: cm_reject_sidr_req(cm_id_priv, IB_SIDR_REJECT); break; case IB_CM_REQ_SENT: + case IB_CM_MRA_REQ_RCVD: ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); spin_unlock_irq(&cm_id_priv->lock); ib_send_cm_rej(cm_id, IB_CM_REJ_TIMEOUT, @@ -888,7 +889,6 @@ retest: NULL, 0, NULL, 0); } break; - case IB_CM_MRA_REQ_RCVD: case IB_CM_REP_SENT: case IB_CM_MRA_REP_RCVD: ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); From owner-svn-src-all@freebsd.org Mon Aug 7 13:03:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E962ADD24BD; Mon, 7 Aug 2017 13:03:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B508F6ACCA; Mon, 7 Aug 2017 13:03:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77D3q0d098851; Mon, 7 Aug 2017 13:03:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77D3qeC098850; Mon, 7 Aug 2017 13:03:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071303.v77D3qeC098850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 13:03: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: r322158 - stable/11/sys/ofed/drivers/infiniband/hw/mlx4 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/hw/mlx4 X-SVN-Commit-Revision: 322158 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 13:03:54 -0000 Author: hselasky Date: Mon Aug 7 13:03:52 2017 New Revision: 322158 URL: https://svnweb.freebsd.org/changeset/base/322158 Log: MFC r321780: Make sure on-stack buffer is properly aligned. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/hw/mlx4/mad.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/hw/mlx4/mad.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/hw/mlx4/mad.c Mon Aug 7 12:59:32 2017 (r322157) +++ stable/11/sys/ofed/drivers/infiniband/hw/mlx4/mad.c Mon Aug 7 13:03:52 2017 (r322158) @@ -983,7 +983,7 @@ static int iboe_process_mad(struct ib_device *ibdev, i int err; u32 counter_index = dev->counters[port_num - 1].counter_index & 0xffff; u8 mode; - char counter_buf[MLX4_IF_STAT_SZ(1)]; + char counter_buf[MLX4_IF_STAT_SZ(1)] __aligned(8); union mlx4_counter *counter = (union mlx4_counter *) counter_buf; From owner-svn-src-all@freebsd.org Mon Aug 7 13:06:04 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8FDDDD26B5; Mon, 7 Aug 2017 13:06:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7718F6AE72; Mon, 7 Aug 2017 13:06:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77D63i5098985; Mon, 7 Aug 2017 13:06:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77D63Bt098984; Mon, 7 Aug 2017 13:06:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071306.v77D63Bt098984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 13:06:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322159 - stable/10/sys/ofed/drivers/infiniband/hw/mlx4 X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/ofed/drivers/infiniband/hw/mlx4 X-SVN-Commit-Revision: 322159 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 13:06:04 -0000 Author: hselasky Date: Mon Aug 7 13:06:03 2017 New Revision: 322159 URL: https://svnweb.freebsd.org/changeset/base/322159 Log: MFC r321780: Make sure on-stack buffer is properly aligned. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/infiniband/hw/mlx4/mad.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/infiniband/hw/mlx4/mad.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/hw/mlx4/mad.c Mon Aug 7 13:03:52 2017 (r322158) +++ stable/10/sys/ofed/drivers/infiniband/hw/mlx4/mad.c Mon Aug 7 13:06:03 2017 (r322159) @@ -963,7 +963,7 @@ static int iboe_process_mad(struct ib_device *ibdev, i int err; u32 counter_index = dev->counters[port_num - 1] & 0xffff; u8 mode; - char counter_buf[MLX4_IF_STAT_SZ(1)]; + char counter_buf[MLX4_IF_STAT_SZ(1)] __aligned(8); union mlx4_counter *counter = (union mlx4_counter *) counter_buf; From owner-svn-src-all@freebsd.org Mon Aug 7 13:08:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5816ADD285C; Mon, 7 Aug 2017 13:08:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 20CB46B00F; Mon, 7 Aug 2017 13:08:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77D7xrY099103; Mon, 7 Aug 2017 13:07:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77D7xP2099102; Mon, 7 Aug 2017 13:07:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071307.v77D7xP2099102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 13:07:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r322160 - stable/9/sys/ofed/drivers/infiniband/hw/mlx4 X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/9/sys/ofed/drivers/infiniband/hw/mlx4 X-SVN-Commit-Revision: 322160 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 13:08:00 -0000 Author: hselasky Date: Mon Aug 7 13:07:58 2017 New Revision: 322160 URL: https://svnweb.freebsd.org/changeset/base/322160 Log: MFC r321780: Make sure on-stack buffer is properly aligned. Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/infiniband/hw/mlx4/mad.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/infiniband/hw/mlx4/mad.c ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/hw/mlx4/mad.c Mon Aug 7 13:06:03 2017 (r322159) +++ stable/9/sys/ofed/drivers/infiniband/hw/mlx4/mad.c Mon Aug 7 13:07:58 2017 (r322160) @@ -963,7 +963,7 @@ static int iboe_process_mad(struct ib_device *ibdev, i int err; u32 counter_index = dev->counters[port_num - 1] & 0xffff; u8 mode; - char counter_buf[MLX4_IF_STAT_SZ(1)]; + char counter_buf[MLX4_IF_STAT_SZ(1)] __aligned(8); union mlx4_counter *counter = (union mlx4_counter *) counter_buf; From owner-svn-src-all@freebsd.org Mon Aug 7 13:14:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46073DD2D16; Mon, 7 Aug 2017 13:14:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 217356B479; Mon, 7 Aug 2017 13:14:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77DEBL9003347; Mon, 7 Aug 2017 13:14:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77DEB6D003344; Mon, 7 Aug 2017 13:14:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071314.v77DEB6D003344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 13:14:11 +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: r322161 - in stable/11/sys/ofed: drivers/infiniband/hw/mlx4 drivers/net/mlx4 include/linux/mlx4 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/ofed: drivers/infiniband/hw/mlx4 drivers/net/mlx4 include/linux/mlx4 X-SVN-Commit-Revision: 322161 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 13:14:12 -0000 Author: hselasky Date: Mon Aug 7 13:14:10 2017 New Revision: 322161 URL: https://svnweb.freebsd.org/changeset/base/322161 Log: MFC r321772: Fix broken usage of the mlx4_read_clock() function: - return value has too small width - cycle_t is unsigned and cannot be less than zero Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/hw/mlx4/main.c stable/11/sys/ofed/drivers/net/mlx4/main.c stable/11/sys/ofed/include/linux/mlx4/device.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/hw/mlx4/main.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/hw/mlx4/main.c Mon Aug 7 13:07:58 2017 (r322160) +++ stable/11/sys/ofed/drivers/infiniband/hw/mlx4/main.c Mon Aug 7 13:14:10 2017 (r322161) @@ -878,12 +878,12 @@ static int mlx4_ib_query_values(struct ib_device *devi struct ib_device_values *values) { struct mlx4_ib_dev *dev = to_mdev(device); - cycle_t cycles; + s64 cycles; values->values_mask = 0; if (q_values & IBV_VALUES_HW_CLOCK) { cycles = mlx4_read_clock(dev->dev); - if (cycles < 0) { + if (cycles >= 0) { values->hwclock = cycles & CORE_CLOCK_MASK; values->values_mask |= IBV_VALUES_HW_CLOCK; } Modified: stable/11/sys/ofed/drivers/net/mlx4/main.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/main.c Mon Aug 7 13:07:58 2017 (r322160) +++ stable/11/sys/ofed/drivers/net/mlx4/main.c Mon Aug 7 13:14:10 2017 (r322161) @@ -1793,10 +1793,10 @@ static void unmap_bf_area(struct mlx4_dev *dev) io_mapping_free(mlx4_priv(dev)->bf_mapping); } -int mlx4_read_clock(struct mlx4_dev *dev) +s64 mlx4_read_clock(struct mlx4_dev *dev) { u32 clockhi, clocklo, clockhi1; - cycle_t cycles; + s64 cycles; int i; struct mlx4_priv *priv = mlx4_priv(dev); @@ -1813,7 +1813,7 @@ int mlx4_read_clock(struct mlx4_dev *dev) cycles = (u64) clockhi << 32 | (u64) clocklo; - return cycles; + return cycles & CORE_CLOCK_MASK; } EXPORT_SYMBOL_GPL(mlx4_read_clock); Modified: stable/11/sys/ofed/include/linux/mlx4/device.h ============================================================================== --- stable/11/sys/ofed/include/linux/mlx4/device.h Mon Aug 7 13:07:58 2017 (r322160) +++ stable/11/sys/ofed/include/linux/mlx4/device.h Mon Aug 7 13:14:10 2017 (r322161) @@ -1337,7 +1337,7 @@ int mlx4_get_roce_gid_from_slave(struct mlx4_dev *dev, int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, u32 max_range_qpn); -int mlx4_read_clock(struct mlx4_dev *dev); +s64 mlx4_read_clock(struct mlx4_dev *dev); int mlx4_get_internal_clock_params(struct mlx4_dev *dev, struct mlx4_clock_params *params); From owner-svn-src-all@freebsd.org Mon Aug 7 13:16:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30689DD2EDF; Mon, 7 Aug 2017 13:16:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFED66B64E; Mon, 7 Aug 2017 13:16:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77DGd4m003488; Mon, 7 Aug 2017 13:16:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77DGdxq003486; Mon, 7 Aug 2017 13:16:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071316.v77DGdxq003486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 13:16:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322162 - in stable/10/sys/ofed: drivers/net/mlx4 include/linux/mlx4 X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/10/sys/ofed: drivers/net/mlx4 include/linux/mlx4 X-SVN-Commit-Revision: 322162 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 13:16:40 -0000 Author: hselasky Date: Mon Aug 7 13:16:38 2017 New Revision: 322162 URL: https://svnweb.freebsd.org/changeset/base/322162 Log: MFC r321772: Fix broken usage of the mlx4_read_clock() function: - return value has too small width - cycle_t is unsigned and cannot be less than zero Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/main.c stable/10/sys/ofed/include/linux/mlx4/device.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/main.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/main.c Mon Aug 7 13:14:10 2017 (r322161) +++ stable/10/sys/ofed/drivers/net/mlx4/main.c Mon Aug 7 13:16:38 2017 (r322162) @@ -1795,10 +1795,10 @@ static void unmap_bf_area(struct mlx4_dev *dev) io_mapping_free(mlx4_priv(dev)->bf_mapping); } -int mlx4_read_clock(struct mlx4_dev *dev) +s64 mlx4_read_clock(struct mlx4_dev *dev) { u32 clockhi, clocklo, clockhi1; - cycle_t cycles; + s64 cycles; int i; struct mlx4_priv *priv = mlx4_priv(dev); @@ -1815,7 +1815,7 @@ int mlx4_read_clock(struct mlx4_dev *dev) cycles = (u64) clockhi << 32 | (u64) clocklo; - return cycles; + return cycles & CORE_CLOCK_MASK; } EXPORT_SYMBOL_GPL(mlx4_read_clock); Modified: stable/10/sys/ofed/include/linux/mlx4/device.h ============================================================================== --- stable/10/sys/ofed/include/linux/mlx4/device.h Mon Aug 7 13:14:10 2017 (r322161) +++ stable/10/sys/ofed/include/linux/mlx4/device.h Mon Aug 7 13:16:38 2017 (r322162) @@ -1337,7 +1337,7 @@ int mlx4_get_roce_gid_from_slave(struct mlx4_dev *dev, int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, u32 max_range_qpn); -int mlx4_read_clock(struct mlx4_dev *dev); +s64 mlx4_read_clock(struct mlx4_dev *dev); int mlx4_get_internal_clock_params(struct mlx4_dev *dev, struct mlx4_clock_params *params); From owner-svn-src-all@freebsd.org Mon Aug 7 13:17:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 669FEDD3124; Mon, 7 Aug 2017 13:17:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 334976B8F6; Mon, 7 Aug 2017 13:17:58 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77DHvpU003588; Mon, 7 Aug 2017 13:17:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77DHvrn003586; Mon, 7 Aug 2017 13:17:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071317.v77DHvrn003586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 13:17:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r322163 - in stable/9/sys/ofed: drivers/net/mlx4 include/linux/mlx4 X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/9/sys/ofed: drivers/net/mlx4 include/linux/mlx4 X-SVN-Commit-Revision: 322163 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 13:17:58 -0000 Author: hselasky Date: Mon Aug 7 13:17:57 2017 New Revision: 322163 URL: https://svnweb.freebsd.org/changeset/base/322163 Log: MFC r321772: Fix broken usage of the mlx4_read_clock() function: - return value has too small width - cycle_t is unsigned and cannot be less than zero Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/net/mlx4/main.c stable/9/sys/ofed/include/linux/mlx4/device.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/net/mlx4/main.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/main.c Mon Aug 7 13:16:38 2017 (r322162) +++ stable/9/sys/ofed/drivers/net/mlx4/main.c Mon Aug 7 13:17:57 2017 (r322163) @@ -1795,10 +1795,10 @@ static void unmap_bf_area(struct mlx4_dev *dev) io_mapping_free(mlx4_priv(dev)->bf_mapping); } -int mlx4_read_clock(struct mlx4_dev *dev) +s64 mlx4_read_clock(struct mlx4_dev *dev) { u32 clockhi, clocklo, clockhi1; - cycle_t cycles; + s64 cycles; int i; struct mlx4_priv *priv = mlx4_priv(dev); @@ -1815,7 +1815,7 @@ int mlx4_read_clock(struct mlx4_dev *dev) cycles = (u64) clockhi << 32 | (u64) clocklo; - return cycles; + return cycles & CORE_CLOCK_MASK; } EXPORT_SYMBOL_GPL(mlx4_read_clock); Modified: stable/9/sys/ofed/include/linux/mlx4/device.h ============================================================================== --- stable/9/sys/ofed/include/linux/mlx4/device.h Mon Aug 7 13:16:38 2017 (r322162) +++ stable/9/sys/ofed/include/linux/mlx4/device.h Mon Aug 7 13:17:57 2017 (r322163) @@ -1337,7 +1337,7 @@ int mlx4_get_roce_gid_from_slave(struct mlx4_dev *dev, int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, u32 max_range_qpn); -int mlx4_read_clock(struct mlx4_dev *dev); +s64 mlx4_read_clock(struct mlx4_dev *dev); int mlx4_get_internal_clock_params(struct mlx4_dev *dev, struct mlx4_clock_params *params); From owner-svn-src-all@freebsd.org Mon Aug 7 13:24:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35B73DD3768; Mon, 7 Aug 2017 13:24:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1156C6BEE8; Mon, 7 Aug 2017 13:24:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77DO6Gk007405; Mon, 7 Aug 2017 13:24:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77DO5Jg007400; Mon, 7 Aug 2017 13:24:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071324.v77DO5Jg007400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 13:24: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: r322164 - in stable/11/sys/ofed: drivers/net/mlx4 include/linux/mlx4 X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/ofed: drivers/net/mlx4 include/linux/mlx4 X-SVN-Commit-Revision: 322164 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 13:24:07 -0000 Author: hselasky Date: Mon Aug 7 13:24:05 2017 New Revision: 322164 URL: https://svnweb.freebsd.org/changeset/base/322164 Log: MFC r321782: Remove some dead statistics related code and a structure field from the mlx4en driver which is used by its Linux counterpart, but not under FreeBSD. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c stable/11/sys/ofed/drivers/net/mlx4/mlx4_en.h stable/11/sys/ofed/drivers/net/mlx4/mlx4_stats.h stable/11/sys/ofed/drivers/net/mlx4/port.c stable/11/sys/ofed/include/linux/mlx4/device.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Aug 7 13:17:57 2017 (r322163) +++ stable/11/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Aug 7 13:24:05 2017 (r322164) @@ -1377,8 +1377,6 @@ int mlx4_en_start_port(struct net_device *dev) /* Schedule multicast task to populate multicast list */ queue_work(mdev->workqueue, &priv->rx_mode_task); - mlx4_set_stats_bitmap(mdev->dev, priv->stats_bitmap); - priv->port_up = true; /* Enable the queues. */ @@ -2731,28 +2729,6 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "rx_gt_1548_bytes_packets", CTLFLAG_RD, &priv->pkstats.rx_gt_1548_bytes_packets, "RX Greater Then 1548 bytes Packets"); - -struct mlx4_en_pkt_stats { - unsigned long tx_packets; - unsigned long tx_bytes; - unsigned long tx_multicast_packets; - unsigned long tx_broadcast_packets; - unsigned long tx_errors; - unsigned long tx_dropped; - unsigned long tx_lt_64_bytes_packets; - unsigned long tx_127_bytes_packets; - unsigned long tx_255_bytes_packets; - unsigned long tx_511_bytes_packets; - unsigned long tx_1023_bytes_packets; - unsigned long tx_1518_bytes_packets; - unsigned long tx_1522_bytes_packets; - unsigned long tx_1548_bytes_packets; - unsigned long tx_gt_1548_bytes_packets; - unsigned long rx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS]; - unsigned long tx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS]; -#define NUM_PKT_STATS 72 -}; - SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_packets", CTLFLAG_RD, &priv->pkstats.tx_packets, "TX packets"); Modified: stable/11/sys/ofed/drivers/net/mlx4/mlx4_en.h ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/mlx4_en.h Mon Aug 7 13:17:57 2017 (r322163) +++ stable/11/sys/ofed/drivers/net/mlx4/mlx4_en.h Mon Aug 7 13:24:05 2017 (r322164) @@ -572,7 +572,6 @@ struct mlx4_en_priv { struct mlx4_en_port_stats port_stats; struct mlx4_en_vport_stats vport_stats; struct mlx4_en_vf_stats vf_stats; - DECLARE_BITMAP(stats_bitmap, NUM_ALL_STATS); struct list_head mc_list; struct list_head curr_list; u64 broadcast_id; Modified: stable/11/sys/ofed/drivers/net/mlx4/mlx4_stats.h ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/mlx4_stats.h Mon Aug 7 13:17:57 2017 (r322163) +++ stable/11/sys/ofed/drivers/net/mlx4/mlx4_stats.h Mon Aug 7 13:24:05 2017 (r322164) @@ -82,7 +82,6 @@ struct mlx4_en_pkt_stats { unsigned long tx_gt_1548_bytes_packets; unsigned long rx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS]; unsigned long tx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS]; -#define NUM_PKT_STATS 72 }; struct mlx4_en_vf_stats { @@ -97,7 +96,6 @@ struct mlx4_en_vf_stats { unsigned long tx_multicast_packets; unsigned long tx_broadcast_packets; unsigned long tx_errors; -#define NUM_VF_STATS 11 }; struct mlx4_en_vport_stats { @@ -116,7 +114,6 @@ struct mlx4_en_vport_stats { unsigned long tx_broadcast_packets; unsigned long tx_broadcast_bytes; unsigned long tx_errors; -#define NUM_VPORT_STATS 15 }; struct mlx4_en_port_stats { @@ -129,7 +126,6 @@ struct mlx4_en_port_stats { unsigned long rx_chksum_good; unsigned long rx_chksum_none; unsigned long tx_chksum_offload; -#define NUM_PORT_STATS 8 }; struct mlx4_en_perf_stats { @@ -139,7 +135,6 @@ struct mlx4_en_perf_stats { u16 tx_coal_avg; u16 rx_coal_avg; u32 napi_quota; -#define NUM_PERF_COUNTERS 6 }; struct mlx4_en_flow_stats { @@ -151,8 +146,6 @@ struct mlx4_en_flow_stats { u64 tx_pause_transition; }; #define MLX4_NUM_PRIORITIES 8 -#define NUM_FLOW_PRIORITY_STATS 6 -#define NUM_FLOW_STATS (NUM_FLOW_PRIORITY_STATS*MLX4_NUM_PRIORITIES) struct mlx4_en_stat_out_flow_control_mbox { @@ -180,6 +173,4 @@ int mlx4_get_vport_ethtool_stats(struct mlx4_dev *dev, struct mlx4_en_vport_stats *vport_stats, int reset); -#define NUM_ALL_STATS (NUM_PKT_STATS + NUM_FLOW_STATS + NUM_VPORT_STATS + \ - NUM_VF_STATS + NUM_PORT_STATS + NUM_PERF_STATS) #endif Modified: stable/11/sys/ofed/drivers/net/mlx4/port.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/port.c Mon Aug 7 13:17:57 2017 (r322163) +++ stable/11/sys/ofed/drivers/net/mlx4/port.c Mon Aug 7 13:24:05 2017 (r322164) @@ -982,38 +982,6 @@ int mlx4_DUMP_ETH_STATS_wrapper(struct mlx4_dev *dev, return 0; } -void mlx4_set_stats_bitmap(struct mlx4_dev *dev, unsigned long *stats_bitmap) -{ - int last_i = 0; - - bitmap_zero(stats_bitmap, NUM_ALL_STATS); - - if (mlx4_is_slave(dev)) { - last_i = dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN ? - NUM_PKT_STATS + NUM_FLOW_STATS : NUM_PKT_STATS; - } else { - bitmap_set(stats_bitmap, last_i, NUM_PKT_STATS); - last_i = NUM_PKT_STATS; - - if (dev->caps.flags2 & - MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN) { - bitmap_set(stats_bitmap, last_i, NUM_FLOW_STATS); - last_i += NUM_FLOW_STATS; - } - } - - if (mlx4_is_slave(dev)) - bitmap_set(stats_bitmap, last_i, NUM_VF_STATS); - last_i += NUM_VF_STATS; - - if (mlx4_is_master(dev)) - bitmap_set(stats_bitmap, last_i, NUM_VPORT_STATS); - last_i += NUM_VPORT_STATS; - - bitmap_set(stats_bitmap, last_i, NUM_PORT_STATS); -} -EXPORT_SYMBOL(mlx4_set_stats_bitmap); - int mlx4_get_slave_from_roce_gid(struct mlx4_dev *dev, int port, u8 *gid, int *slave_id) { struct mlx4_priv *priv = mlx4_priv(dev); Modified: stable/11/sys/ofed/include/linux/mlx4/device.h ============================================================================== --- stable/11/sys/ofed/include/linux/mlx4/device.h Mon Aug 7 13:17:57 2017 (r322163) +++ stable/11/sys/ofed/include/linux/mlx4/device.h Mon Aug 7 13:24:05 2017 (r322164) @@ -1273,7 +1273,6 @@ int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac); int mlx4_get_base_qpn(struct mlx4_dev *dev, u8 port); int __mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); -void mlx4_set_stats_bitmap(struct mlx4_dev *dev, unsigned long *stats_bitmap); int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu, u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, From owner-svn-src-all@freebsd.org Mon Aug 7 13:25:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CAF9DD38DC; Mon, 7 Aug 2017 13:25:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16D456C05D; Mon, 7 Aug 2017 13:25:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77DPwkB007529; Mon, 7 Aug 2017 13:25:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77DPvQU007524; Mon, 7 Aug 2017 13:25:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071325.v77DPvQU007524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 13:25:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322165 - in stable/10/sys/ofed: drivers/net/mlx4 include/linux/mlx4 X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/10/sys/ofed: drivers/net/mlx4 include/linux/mlx4 X-SVN-Commit-Revision: 322165 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 13:25:59 -0000 Author: hselasky Date: Mon Aug 7 13:25:57 2017 New Revision: 322165 URL: https://svnweb.freebsd.org/changeset/base/322165 Log: MFC r321782: Remove some dead statistics related code and a structure field from the mlx4en driver which is used by its Linux counterpart, but not under FreeBSD. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h stable/10/sys/ofed/drivers/net/mlx4/mlx4_stats.h stable/10/sys/ofed/drivers/net/mlx4/port.c stable/10/sys/ofed/include/linux/mlx4/device.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Aug 7 13:24:05 2017 (r322164) +++ stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Aug 7 13:25:57 2017 (r322165) @@ -1378,8 +1378,6 @@ int mlx4_en_start_port(struct net_device *dev) /* Schedule multicast task to populate multicast list */ queue_work(mdev->workqueue, &priv->rx_mode_task); - mlx4_set_stats_bitmap(mdev->dev, priv->stats_bitmap); - priv->port_up = true; /* Enable the queues. */ @@ -2730,28 +2728,6 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "rx_gt_1548_bytes_packets", CTLFLAG_RD, &priv->pkstats.rx_gt_1548_bytes_packets, "RX Greater Then 1548 bytes Packets"); - -struct mlx4_en_pkt_stats { - unsigned long tx_packets; - unsigned long tx_bytes; - unsigned long tx_multicast_packets; - unsigned long tx_broadcast_packets; - unsigned long tx_errors; - unsigned long tx_dropped; - unsigned long tx_lt_64_bytes_packets; - unsigned long tx_127_bytes_packets; - unsigned long tx_255_bytes_packets; - unsigned long tx_511_bytes_packets; - unsigned long tx_1023_bytes_packets; - unsigned long tx_1518_bytes_packets; - unsigned long tx_1522_bytes_packets; - unsigned long tx_1548_bytes_packets; - unsigned long tx_gt_1548_bytes_packets; - unsigned long rx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS]; - unsigned long tx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS]; -#define NUM_PKT_STATS 72 -}; - SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_packets", CTLFLAG_RD, &priv->pkstats.tx_packets, "TX packets"); Modified: stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h Mon Aug 7 13:24:05 2017 (r322164) +++ stable/10/sys/ofed/drivers/net/mlx4/mlx4_en.h Mon Aug 7 13:25:57 2017 (r322165) @@ -571,7 +571,6 @@ struct mlx4_en_priv { struct mlx4_en_port_stats port_stats; struct mlx4_en_vport_stats vport_stats; struct mlx4_en_vf_stats vf_stats; - DECLARE_BITMAP(stats_bitmap, NUM_ALL_STATS); struct list_head mc_list; struct list_head curr_list; u64 broadcast_id; Modified: stable/10/sys/ofed/drivers/net/mlx4/mlx4_stats.h ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/mlx4_stats.h Mon Aug 7 13:24:05 2017 (r322164) +++ stable/10/sys/ofed/drivers/net/mlx4/mlx4_stats.h Mon Aug 7 13:25:57 2017 (r322165) @@ -82,7 +82,6 @@ struct mlx4_en_pkt_stats { unsigned long tx_gt_1548_bytes_packets; unsigned long rx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS]; unsigned long tx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS]; -#define NUM_PKT_STATS 72 }; struct mlx4_en_vf_stats { @@ -97,7 +96,6 @@ struct mlx4_en_vf_stats { unsigned long tx_multicast_packets; unsigned long tx_broadcast_packets; unsigned long tx_errors; -#define NUM_VF_STATS 11 }; struct mlx4_en_vport_stats { @@ -116,7 +114,6 @@ struct mlx4_en_vport_stats { unsigned long tx_broadcast_packets; unsigned long tx_broadcast_bytes; unsigned long tx_errors; -#define NUM_VPORT_STATS 15 }; struct mlx4_en_port_stats { @@ -129,7 +126,6 @@ struct mlx4_en_port_stats { unsigned long rx_chksum_good; unsigned long rx_chksum_none; unsigned long tx_chksum_offload; -#define NUM_PORT_STATS 8 }; struct mlx4_en_perf_stats { @@ -139,7 +135,6 @@ struct mlx4_en_perf_stats { u16 tx_coal_avg; u16 rx_coal_avg; u32 napi_quota; -#define NUM_PERF_COUNTERS 6 }; struct mlx4_en_flow_stats { @@ -151,8 +146,6 @@ struct mlx4_en_flow_stats { u64 tx_pause_transition; }; #define MLX4_NUM_PRIORITIES 8 -#define NUM_FLOW_PRIORITY_STATS 6 -#define NUM_FLOW_STATS (NUM_FLOW_PRIORITY_STATS*MLX4_NUM_PRIORITIES) struct mlx4_en_stat_out_flow_control_mbox { @@ -180,6 +173,4 @@ int mlx4_get_vport_ethtool_stats(struct mlx4_dev *dev, struct mlx4_en_vport_stats *vport_stats, int reset); -#define NUM_ALL_STATS (NUM_PKT_STATS + NUM_FLOW_STATS + NUM_VPORT_STATS + \ - NUM_VF_STATS + NUM_PORT_STATS + NUM_PERF_STATS) #endif Modified: stable/10/sys/ofed/drivers/net/mlx4/port.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/port.c Mon Aug 7 13:24:05 2017 (r322164) +++ stable/10/sys/ofed/drivers/net/mlx4/port.c Mon Aug 7 13:25:57 2017 (r322165) @@ -980,38 +980,6 @@ int mlx4_DUMP_ETH_STATS_wrapper(struct mlx4_dev *dev, return 0; } -void mlx4_set_stats_bitmap(struct mlx4_dev *dev, unsigned long *stats_bitmap) -{ - int last_i = 0; - - bitmap_zero(stats_bitmap, NUM_ALL_STATS); - - if (mlx4_is_slave(dev)) { - last_i = dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN ? - NUM_PKT_STATS + NUM_FLOW_STATS : NUM_PKT_STATS; - } else { - bitmap_set(stats_bitmap, last_i, NUM_PKT_STATS); - last_i = NUM_PKT_STATS; - - if (dev->caps.flags2 & - MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN) { - bitmap_set(stats_bitmap, last_i, NUM_FLOW_STATS); - last_i += NUM_FLOW_STATS; - } - } - - if (mlx4_is_slave(dev)) - bitmap_set(stats_bitmap, last_i, NUM_VF_STATS); - last_i += NUM_VF_STATS; - - if (mlx4_is_master(dev)) - bitmap_set(stats_bitmap, last_i, NUM_VPORT_STATS); - last_i += NUM_VPORT_STATS; - - bitmap_set(stats_bitmap, last_i, NUM_PORT_STATS); -} -EXPORT_SYMBOL(mlx4_set_stats_bitmap); - int mlx4_get_slave_from_roce_gid(struct mlx4_dev *dev, int port, u8 *gid, int *slave_id) { struct mlx4_priv *priv = mlx4_priv(dev); Modified: stable/10/sys/ofed/include/linux/mlx4/device.h ============================================================================== --- stable/10/sys/ofed/include/linux/mlx4/device.h Mon Aug 7 13:24:05 2017 (r322164) +++ stable/10/sys/ofed/include/linux/mlx4/device.h Mon Aug 7 13:25:57 2017 (r322165) @@ -1273,7 +1273,6 @@ int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac); int mlx4_get_base_qpn(struct mlx4_dev *dev, u8 port); int __mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); -void mlx4_set_stats_bitmap(struct mlx4_dev *dev, unsigned long *stats_bitmap); int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu, u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, From owner-svn-src-all@freebsd.org Mon Aug 7 13:27:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0C06DD3A7B; Mon, 7 Aug 2017 13:27:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C31A6C230; Mon, 7 Aug 2017 13:27:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77DRaIp007687; Mon, 7 Aug 2017 13:27:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77DRata007682; Mon, 7 Aug 2017 13:27:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708071327.v77DRata007682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Aug 2017 13:27:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r322166 - in stable/9/sys/ofed: drivers/net/mlx4 include/linux/mlx4 X-SVN-Group: stable-9 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/9/sys/ofed: drivers/net/mlx4 include/linux/mlx4 X-SVN-Commit-Revision: 322166 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 13:27:37 -0000 Author: hselasky Date: Mon Aug 7 13:27:35 2017 New Revision: 322166 URL: https://svnweb.freebsd.org/changeset/base/322166 Log: MFC r321782: Remove some dead statistics related code and a structure field from the mlx4en driver which is used by its Linux counterpart, but not under FreeBSD. Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c stable/9/sys/ofed/drivers/net/mlx4/mlx4_en.h stable/9/sys/ofed/drivers/net/mlx4/mlx4_stats.h stable/9/sys/ofed/drivers/net/mlx4/port.c stable/9/sys/ofed/include/linux/mlx4/device.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Aug 7 13:25:57 2017 (r322165) +++ stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c Mon Aug 7 13:27:35 2017 (r322166) @@ -1378,8 +1378,6 @@ int mlx4_en_start_port(struct net_device *dev) /* Schedule multicast task to populate multicast list */ queue_work(mdev->workqueue, &priv->rx_mode_task); - mlx4_set_stats_bitmap(mdev->dev, priv->stats_bitmap); - priv->port_up = true; /* Enable the queues. */ @@ -2731,28 +2729,6 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "rx_gt_1548_bytes_packets", CTLFLAG_RD, &priv->pkstats.rx_gt_1548_bytes_packets, "RX Greater Then 1548 bytes Packets"); - -struct mlx4_en_pkt_stats { - unsigned long tx_packets; - unsigned long tx_bytes; - unsigned long tx_multicast_packets; - unsigned long tx_broadcast_packets; - unsigned long tx_errors; - unsigned long tx_dropped; - unsigned long tx_lt_64_bytes_packets; - unsigned long tx_127_bytes_packets; - unsigned long tx_255_bytes_packets; - unsigned long tx_511_bytes_packets; - unsigned long tx_1023_bytes_packets; - unsigned long tx_1518_bytes_packets; - unsigned long tx_1522_bytes_packets; - unsigned long tx_1548_bytes_packets; - unsigned long tx_gt_1548_bytes_packets; - unsigned long rx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS]; - unsigned long tx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS]; -#define NUM_PKT_STATS 72 -}; - SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_packets", CTLFLAG_RD, &priv->pkstats.tx_packets, "TX packets"); Modified: stable/9/sys/ofed/drivers/net/mlx4/mlx4_en.h ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/mlx4_en.h Mon Aug 7 13:25:57 2017 (r322165) +++ stable/9/sys/ofed/drivers/net/mlx4/mlx4_en.h Mon Aug 7 13:27:35 2017 (r322166) @@ -571,7 +571,6 @@ struct mlx4_en_priv { struct mlx4_en_port_stats port_stats; struct mlx4_en_vport_stats vport_stats; struct mlx4_en_vf_stats vf_stats; - DECLARE_BITMAP(stats_bitmap, NUM_ALL_STATS); struct list_head mc_list; struct list_head curr_list; u64 broadcast_id; Modified: stable/9/sys/ofed/drivers/net/mlx4/mlx4_stats.h ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/mlx4_stats.h Mon Aug 7 13:25:57 2017 (r322165) +++ stable/9/sys/ofed/drivers/net/mlx4/mlx4_stats.h Mon Aug 7 13:27:35 2017 (r322166) @@ -82,7 +82,6 @@ struct mlx4_en_pkt_stats { unsigned long tx_gt_1548_bytes_packets; unsigned long rx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS]; unsigned long tx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS]; -#define NUM_PKT_STATS 72 }; struct mlx4_en_vf_stats { @@ -97,7 +96,6 @@ struct mlx4_en_vf_stats { unsigned long tx_multicast_packets; unsigned long tx_broadcast_packets; unsigned long tx_errors; -#define NUM_VF_STATS 11 }; struct mlx4_en_vport_stats { @@ -116,7 +114,6 @@ struct mlx4_en_vport_stats { unsigned long tx_broadcast_packets; unsigned long tx_broadcast_bytes; unsigned long tx_errors; -#define NUM_VPORT_STATS 15 }; struct mlx4_en_port_stats { @@ -129,7 +126,6 @@ struct mlx4_en_port_stats { unsigned long rx_chksum_good; unsigned long rx_chksum_none; unsigned long tx_chksum_offload; -#define NUM_PORT_STATS 8 }; struct mlx4_en_perf_stats { @@ -139,7 +135,6 @@ struct mlx4_en_perf_stats { u16 tx_coal_avg; u16 rx_coal_avg; u32 napi_quota; -#define NUM_PERF_COUNTERS 6 }; struct mlx4_en_flow_stats { @@ -151,8 +146,6 @@ struct mlx4_en_flow_stats { u64 tx_pause_transition; }; #define MLX4_NUM_PRIORITIES 8 -#define NUM_FLOW_PRIORITY_STATS 6 -#define NUM_FLOW_STATS (NUM_FLOW_PRIORITY_STATS*MLX4_NUM_PRIORITIES) struct mlx4_en_stat_out_flow_control_mbox { @@ -180,6 +173,4 @@ int mlx4_get_vport_ethtool_stats(struct mlx4_dev *dev, struct mlx4_en_vport_stats *vport_stats, int reset); -#define NUM_ALL_STATS (NUM_PKT_STATS + NUM_FLOW_STATS + NUM_VPORT_STATS + \ - NUM_VF_STATS + NUM_PORT_STATS + NUM_PERF_STATS) #endif Modified: stable/9/sys/ofed/drivers/net/mlx4/port.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/port.c Mon Aug 7 13:25:57 2017 (r322165) +++ stable/9/sys/ofed/drivers/net/mlx4/port.c Mon Aug 7 13:27:35 2017 (r322166) @@ -980,38 +980,6 @@ int mlx4_DUMP_ETH_STATS_wrapper(struct mlx4_dev *dev, return 0; } -void mlx4_set_stats_bitmap(struct mlx4_dev *dev, unsigned long *stats_bitmap) -{ - int last_i = 0; - - bitmap_zero(stats_bitmap, NUM_ALL_STATS); - - if (mlx4_is_slave(dev)) { - last_i = dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN ? - NUM_PKT_STATS + NUM_FLOW_STATS : NUM_PKT_STATS; - } else { - bitmap_set(stats_bitmap, last_i, NUM_PKT_STATS); - last_i = NUM_PKT_STATS; - - if (dev->caps.flags2 & - MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN) { - bitmap_set(stats_bitmap, last_i, NUM_FLOW_STATS); - last_i += NUM_FLOW_STATS; - } - } - - if (mlx4_is_slave(dev)) - bitmap_set(stats_bitmap, last_i, NUM_VF_STATS); - last_i += NUM_VF_STATS; - - if (mlx4_is_master(dev)) - bitmap_set(stats_bitmap, last_i, NUM_VPORT_STATS); - last_i += NUM_VPORT_STATS; - - bitmap_set(stats_bitmap, last_i, NUM_PORT_STATS); -} -EXPORT_SYMBOL(mlx4_set_stats_bitmap); - int mlx4_get_slave_from_roce_gid(struct mlx4_dev *dev, int port, u8 *gid, int *slave_id) { struct mlx4_priv *priv = mlx4_priv(dev); Modified: stable/9/sys/ofed/include/linux/mlx4/device.h ============================================================================== --- stable/9/sys/ofed/include/linux/mlx4/device.h Mon Aug 7 13:25:57 2017 (r322165) +++ stable/9/sys/ofed/include/linux/mlx4/device.h Mon Aug 7 13:27:35 2017 (r322166) @@ -1273,7 +1273,6 @@ int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac); int mlx4_get_base_qpn(struct mlx4_dev *dev, u8 port); int __mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); -void mlx4_set_stats_bitmap(struct mlx4_dev *dev, unsigned long *stats_bitmap); int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu, u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, From owner-svn-src-all@freebsd.org Mon Aug 7 14:04:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D7DFDD5786; Mon, 7 Aug 2017 14:04:20 +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 mx1.freebsd.org (Postfix) with ESMTPS id 788BE6D757; Mon, 7 Aug 2017 14:04:20 +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 v77E4JLJ024046; Mon, 7 Aug 2017 14:04:19 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77E4JRQ024045; Mon, 7 Aug 2017 14:04:19 GMT (envelope-from np@FreeBSD.org) Message-Id: <201708071404.v77E4JRQ024045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 7 Aug 2017 14:04:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322167 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 322167 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 14:04:20 -0000 Author: np Date: Mon Aug 7 14:04:19 2017 New Revision: 322167 URL: https://svnweb.freebsd.org/changeset/base/322167 Log: cxgbe(4): Add the T6 and T5 Unified Wire configuration files to the kernel, just like for T4, when the driver is compiled into the kernel. Reported by: mav@ MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Aug 7 13:27:35 2017 (r322166) +++ head/sys/conf/files Mon Aug 7 14:04:19 2017 (r322167) @@ -1399,7 +1399,7 @@ t4fw.fw optional cxgbe \ no-obj no-implicit-rule \ clean "t4fw.fw" t5fw_cfg.c optional cxgbe \ - compile-with "${AWK} -f $S/tools/fw_stub.awk t5fw_cfg.fw:t5fw_cfg t5fw.fw:t5fw -mt5fw_cfg -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk t5fw_cfg.fw:t5fw_cfg t5fw_cfg_uwire.fw:t5fw_cfg_uwire t4fw.fw:t4fw -mt5fw_cfg -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "t5fw_cfg.c" t5fw_cfg.fwo optional cxgbe \ @@ -1412,6 +1412,16 @@ t5fw_cfg.fw optional cxgbe \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t5fw_cfg.fw" +t5fw_cfg_uwire.fwo optional cxgbe \ + dependency "t5fw_cfg_uwire.fw" \ + compile-with "${NORMAL_FWO}" \ + no-implicit-rule \ + clean "t5fw_cfg_uwire.fwo" +t5fw_cfg_uwire.fw optional cxgbe \ + dependency "$S/dev/cxgbe/firmware/t5fw_cfg_uwire.txt" \ + compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ + no-obj no-implicit-rule \ + clean "t5fw_cfg_uwire.fw" t5fw.fwo optional cxgbe \ dependency "t5fw.fw" \ compile-with "${NORMAL_FWO}" \ @@ -1423,7 +1433,7 @@ t5fw.fw optional cxgbe \ no-obj no-implicit-rule \ clean "t5fw.fw" t6fw_cfg.c optional cxgbe \ - compile-with "${AWK} -f $S/tools/fw_stub.awk t6fw_cfg.fw:t6fw_cfg t6fw.fw:t6fw -mt6fw_cfg -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk t6fw_cfg.fw:t6fw_cfg t6fw_cfg_uwire.fw:t6fw_cfg_uwire t6fw.fw:t6fw -mt6fw_cfg -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "t6fw_cfg.c" t6fw_cfg.fwo optional cxgbe \ @@ -1436,6 +1446,16 @@ t6fw_cfg.fw optional cxgbe \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t6fw_cfg.fw" +t6fw_cfg_uwire.fwo optional cxgbe \ + dependency "t6fw_cfg_uwire.fw" \ + compile-with "${NORMAL_FWO}" \ + no-implicit-rule \ + clean "t6fw_cfg_uwire.fwo" +t6fw_cfg_uwire.fw optional cxgbe \ + dependency "$S/dev/cxgbe/firmware/t6fw_cfg_uwire.txt" \ + compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ + no-obj no-implicit-rule \ + clean "t6fw_cfg_uwire.fw" t6fw.fwo optional cxgbe \ dependency "t6fw.fw" \ compile-with "${NORMAL_FWO}" \ From owner-svn-src-all@freebsd.org Mon Aug 7 14:10:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A11ADDD5A88; Mon, 7 Aug 2017 14:10:01 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68EB76D95F; Mon, 7 Aug 2017 14:10:01 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77EA0WU024334; Mon, 7 Aug 2017 14:10:00 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77E9vZw024276; Mon, 7 Aug 2017 14:09:57 GMT (envelope-from br@FreeBSD.org) Message-Id: <201708071409.v77E9vZw024276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 7 Aug 2017 14:09:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322168 - in head: cddl/contrib/opensolaris/lib/libdtrace/common contrib/compiler-rt/lib/builtins contrib/compiler-rt/lib/sanitizer_common contrib/elftoolchain/libelf contrib/jemalloc/i... X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/lib/libdtrace/common contrib/compiler-rt/lib/builtins contrib/compiler-rt/lib/sanitizer_common contrib/elftoolchain/libelf contrib/jemalloc/include/jemalloc contrib/j... X-SVN-Commit-Revision: 322168 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 14:10:01 -0000 Author: br Date: Mon Aug 7 14:09:57 2017 New Revision: 322168 URL: https://svnweb.freebsd.org/changeset/base/322168 Log: o Replace __riscv__ with __riscv o Replace __riscv64 with (__riscv && __riscv_xlen == 64) This is required to support new GCC 7.1 compiler. This is compatible with current GCC 6.1 compiler. RISC-V is extensible ISA and the idea here is to have built-in define per each extension, so together with __riscv we will have some subset of these as well (depending on -march string passed to compiler): __riscv_compressed __riscv_atomic __riscv_mul __riscv_div __riscv_muldiv __riscv_fdiv __riscv_fsqrt __riscv_float_abi_soft __riscv_float_abi_single __riscv_float_abi_double __riscv_cmodel_medlow __riscv_cmodel_medany __riscv_cmodel_pic __riscv_xlen Reviewed by: ngie Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11901 Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c head/contrib/compiler-rt/lib/builtins/int_lib.h head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h head/contrib/elftoolchain/libelf/_libelf_config.h head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h head/contrib/llvm/projects/libunwind/include/__libunwind_config.h head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S head/contrib/llvm/projects/libunwind/src/config.h head/contrib/llvm/projects/libunwind/src/libunwind.cpp head/contrib/netbsd-tests/lib/libc/gen/t_dir.c head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c head/contrib/zstd/lib/common/xxhash.c head/lib/libc/gen/tls.c head/lib/libproc/proc_bkpt.c head/lib/libproc/proc_regs.c head/libexec/rtld-elf/rtld.c head/share/man/man7/arch.7 head/sys/cddl/compat/opensolaris/sys/atomic.h head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h head/sys/cddl/dev/profile/profile.c head/sys/compat/linuxkpi/common/src/linux_page.c head/sys/dev/sym/sym_hipd.c head/sys/kern/subr_devmap.c head/sys/modules/dtrace/dtraceall/dtraceall.c head/sys/sys/cdefs.h head/usr.bin/ldd/ldd.c head/usr.bin/xlint/lint1/param.h Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Mon Aug 7 14:09:57 2017 (r322168) @@ -250,7 +250,7 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__L dofr[j].dofr_offset + 4; rel->r_info = ELF32_R_INFO(count + dep->de_global, R_PPC_REL32); -#elif defined(__riscv__) +#elif defined(__riscv) /* XXX */ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); #else @@ -430,7 +430,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dofr[j].dofr_offset; rel->r_info = ELF64_R_INFO(count + dep->de_global, R_PPC64_REL64); -#elif defined(__riscv__) +#elif defined(__riscv) /* XXX */ #elif defined(__i386) || defined(__amd64) rel->r_offset = s->dofs_offset + @@ -904,7 +904,7 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, return (0); } -#elif defined(__riscv__) +#elif defined(__riscv) /* XXX */ static int dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Mon Aug 7 14:09:57 2017 (r322168) @@ -311,7 +311,7 @@ pfprint_fp(dtrace_hdl_t *dtp, FILE *fp, const char *fo return (dt_printf(dtp, fp, format, *((double *)addr) / n)); #if !defined(__arm__) && !defined(__powerpc__) && \ - !defined(__mips__) && !defined(__riscv__) + !defined(__mips__) && !defined(__riscv) case sizeof (long double): return (dt_printf(dtp, fp, format, *((long double *)addr) / ldn)); Modified: head/contrib/compiler-rt/lib/builtins/int_lib.h ============================================================================== --- head/contrib/compiler-rt/lib/builtins/int_lib.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/compiler-rt/lib/builtins/int_lib.h Mon Aug 7 14:09:57 2017 (r322168) @@ -92,7 +92,7 @@ * does not have dedicated bit counting instructions. */ #if defined(__FreeBSD__) && (defined(__sparc64__) || \ - defined(__mips_n64) || defined(__mips_o64) || defined(__riscv__)) + defined(__mips_n64) || defined(__mips_o64) || defined(__riscv)) si_int __clzsi2(si_int); si_int __ctzsi2(si_int); #define __builtin_clz __clzsi2 Modified: head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h ============================================================================== --- head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h Mon Aug 7 14:09:57 2017 (r322168) @@ -83,7 +83,7 @@ namespace __sanitizer { #elif defined(__powerpc64__) const unsigned struct_kernel_stat_sz = 144; const unsigned struct_kernel_stat64_sz = 104; -#elif defined(__riscv__) +#elif defined(__riscv) /* RISCVTODO: check that these values are correct */ const unsigned struct_kernel_stat_sz = 128; const unsigned struct_kernel_stat64_sz = 128; @@ -126,7 +126,7 @@ namespace __sanitizer { #if SANITIZER_LINUX || SANITIZER_FREEBSD -#if defined(__powerpc64__) || defined(__riscv__) || defined(__s390__) +#if defined(__powerpc64__) || defined(__riscv) || defined(__s390__) const unsigned struct___old_kernel_stat_sz = 0; #elif !defined(__sparc__) const unsigned struct___old_kernel_stat_sz = 32; @@ -554,7 +554,7 @@ namespace __sanitizer { typedef long __sanitizer___kernel_off_t; #endif -#if defined(__powerpc__) || defined(__mips__) || defined(__riscv__) +#if defined(__powerpc__) || defined(__mips__) || defined(__riscv) typedef unsigned int __sanitizer___kernel_old_uid_t; typedef unsigned int __sanitizer___kernel_old_gid_t; #else Modified: head/contrib/elftoolchain/libelf/_libelf_config.h ============================================================================== --- head/contrib/elftoolchain/libelf/_libelf_config.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/elftoolchain/libelf/_libelf_config.h Mon Aug 7 14:09:57 2017 (r322168) @@ -97,7 +97,7 @@ #define LIBELF_BYTEORDER ELFDATA2MSB #define LIBELF_CLASS ELFCLASS32 -#elif defined(__riscv64) +#elif defined(__riscv) && (__riscv_xlen == 64) #define LIBELF_ARCH EM_RISCV #define LIBELF_BYTEORDER ELFDATA2LSB Modified: head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_types.h Mon Aug 7 14:09:57 2017 (r322168) @@ -88,7 +88,7 @@ typedef int malloc_cpuid_t; # ifdef __powerpc__ # define LG_QUANTUM 4 # endif -# ifdef __riscv__ +# ifdef __riscv # define LG_QUANTUM 4 # endif # ifdef __s390__ Modified: head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Mon Aug 7 14:09:57 2017 (r322168) @@ -67,7 +67,7 @@ # define LG_VADDR 32 # define LG_SIZEOF_PTR 2 #endif -#ifdef __riscv__ +#ifdef __riscv # define LG_VADDR 64 # define LG_SIZEOF_PTR 3 #endif Modified: head/contrib/llvm/projects/libunwind/include/__libunwind_config.h ============================================================================== --- head/contrib/llvm/projects/libunwind/include/__libunwind_config.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/llvm/projects/libunwind/include/__libunwind_config.h Mon Aug 7 14:09:57 2017 (r322168) @@ -48,7 +48,7 @@ # define _LIBUNWIND_CONTEXT_SIZE 16 # define _LIBUNWIND_CURSOR_SIZE 28 # define _LIBUNWIND_MAX_REGISTER 32 -# elif defined(__riscv__) +# elif defined(__riscv) # define _LIBUNWIND_TARGET_RISCV 1 # define _LIBUNWIND_CONTEXT_SIZE 64 # define _LIBUNWIND_CURSOR_SIZE 76 Modified: head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S ============================================================================== --- head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Mon Aug 7 14:09:57 2017 (r322168) @@ -478,7 +478,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind14Regis l.jr r9 l.nop -#elif defined(__riscv__) +#elif defined(__riscv) // // void libunwind::Registers_riscv::jumpto() Modified: head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S ============================================================================== --- head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S Mon Aug 7 14:09:57 2017 (r322168) @@ -464,7 +464,7 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext) l.sw 120(r3), r30 l.sw 124(r3), r31 -#elif defined(__riscv__) +#elif defined(__riscv) /* RISCVTODO */ Modified: head/contrib/llvm/projects/libunwind/src/config.h ============================================================================== --- head/contrib/llvm/projects/libunwind/src/config.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/llvm/projects/libunwind/src/config.h Mon Aug 7 14:09:57 2017 (r322168) @@ -71,7 +71,7 @@ (!defined(__APPLE__) && defined(__arm__)) || \ (defined(__arm64__) || defined(__aarch64__)) || \ (defined(__APPLE__) && defined(__mips__)) || \ - defined(__riscv__) + defined(__riscv) #define _LIBUNWIND_BUILD_ZERO_COST_APIS 1 #else #define _LIBUNWIND_BUILD_ZERO_COST_APIS 0 Modified: head/contrib/llvm/projects/libunwind/src/libunwind.cpp ============================================================================== --- head/contrib/llvm/projects/libunwind/src/libunwind.cpp Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/llvm/projects/libunwind/src/libunwind.cpp Mon Aug 7 14:09:57 2017 (r322168) @@ -57,7 +57,7 @@ _LIBUNWIND_EXPORT int unw_init_local(unw_cursor_t *cur # define REGISTER_KIND Registers_arm #elif defined(__or1k__) # define REGISTER_KIND Registers_or1k -#elif defined(__riscv__) +#elif defined(__riscv) # define REGISTER_KIND Registers_riscv #elif defined(__mips__) # warning The MIPS architecture is not supported. Modified: head/contrib/netbsd-tests/lib/libc/gen/t_dir.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_dir.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/netbsd-tests/lib/libc/gen/t_dir.c Mon Aug 7 14:09:57 2017 (r322168) @@ -135,7 +135,7 @@ ATF_TC_BODY(seekdir_basic, tc) } /* There is no sbrk on AArch64 and RISC-V */ -#if !defined(__aarch64__) && !defined(__riscv__) +#if !defined(__aarch64__) && !defined(__riscv) ATF_TC(telldir_leak); ATF_TC_HEAD(telldir_leak, tc) { @@ -185,7 +185,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, seekdir_basic); -#if !defined(__aarch64__) && !defined(__riscv__) +#if !defined(__aarch64__) && !defined(__riscv) ATF_TP_ADD_TC(tp, telldir_leak); #endif Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Mon Aug 7 14:09:57 2017 (r322168) @@ -103,7 +103,7 @@ ATF_TC_BODY(mlock_err, tc) unsigned long vmin = 0; size_t len = sizeof(vmin); #endif -#if !defined(__aarch64__) && !defined(__riscv__) +#if !defined(__aarch64__) && !defined(__riscv) void *invalid_ptr; #endif int null_errno = ENOMEM; /* error expected for NULL */ @@ -155,7 +155,7 @@ ATF_TC_BODY(mlock_err, tc) ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1); /* There is no sbrk on AArch64 and RISC-V */ -#if !defined(__aarch64__) && !defined(__riscv__) +#if !defined(__aarch64__) && !defined(__riscv) /* * These are permitted to fail (EINVAL) but do not on NetBSD */ Modified: head/contrib/zstd/lib/common/xxhash.c ============================================================================== --- head/contrib/zstd/lib/common/xxhash.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/contrib/zstd/lib/common/xxhash.c Mon Aug 7 14:09:57 2017 (r322168) @@ -206,7 +206,7 @@ static U64 XXH_read64(const void* memPtr) #if defined(_MSC_VER) /* Visual Studio */ # define XXH_swap32 _byteswap_ulong # define XXH_swap64 _byteswap_uint64 -#elif (GCC_VERSION >= 403 && !defined(__riscv__)) +#elif (GCC_VERSION >= 403 && !defined(__riscv)) # define XXH_swap32 __builtin_bswap32 # define XXH_swap64 __builtin_bswap64 #else Modified: head/lib/libc/gen/tls.c ============================================================================== --- head/lib/libc/gen/tls.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/lib/libc/gen/tls.c Mon Aug 7 14:09:57 2017 (r322168) @@ -66,7 +66,7 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t #if defined(__amd64__) #define TLS_TCB_ALIGN 16 #elif defined(__aarch64__) || defined(__arm__) || defined(__i386__) || \ - defined(__mips__) || defined(__powerpc__) || defined(__riscv__) || \ + defined(__mips__) || defined(__powerpc__) || defined(__riscv) || \ defined(__sparc64__) #define TLS_TCB_ALIGN sizeof(void *) #else @@ -74,7 +74,7 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t #endif #if defined(__aarch64__) || defined(__arm__) || defined(__mips__) || \ - defined(__powerpc__) || defined(__riscv__) + defined(__powerpc__) || defined(__riscv) #define TLS_VARIANT_I #endif #if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) Modified: head/lib/libproc/proc_bkpt.c ============================================================================== --- head/lib/libproc/proc_bkpt.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/lib/libproc/proc_bkpt.c Mon Aug 7 14:09:57 2017 (r322168) @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); #elif defined(__powerpc__) #define BREAKPOINT_INSTR 0x7fe00008 /* trap */ #define BREAKPOINT_INSTR_SZ 4 -#elif defined(__riscv__) +#elif defined(__riscv) #define BREAKPOINT_INSTR 0x00100073 /* sbreak */ #define BREAKPOINT_INSTR_SZ 4 #else Modified: head/lib/libproc/proc_regs.c ============================================================================== --- head/lib/libproc/proc_regs.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/lib/libproc/proc_regs.c Mon Aug 7 14:09:57 2017 (r322168) @@ -67,7 +67,7 @@ proc_regget(struct proc_handle *phdl, proc_reg_t reg, *regvalue = regs.r_regs[PC]; #elif defined(__powerpc__) *regvalue = regs.pc; -#elif defined(__riscv__) +#elif defined(__riscv) *regvalue = regs.sepc; #endif break; @@ -84,7 +84,7 @@ proc_regget(struct proc_handle *phdl, proc_reg_t reg, *regvalue = regs.r_regs[SP]; #elif defined(__powerpc__) *regvalue = regs.fixreg[1]; -#elif defined(__riscv__) +#elif defined(__riscv) *regvalue = regs.sp; #endif break; @@ -122,7 +122,7 @@ proc_regset(struct proc_handle *phdl, proc_reg_t reg, regs.r_regs[PC] = regvalue; #elif defined(__powerpc__) regs.pc = regvalue; -#elif defined(__riscv__) +#elif defined(__riscv) regs.sepc = regvalue; #endif break; @@ -139,7 +139,7 @@ proc_regset(struct proc_handle *phdl, proc_reg_t reg, regs.r_regs[PC] = regvalue; #elif defined(__powerpc__) regs.fixreg[1] = regvalue; -#elif defined(__riscv__) +#elif defined(__riscv) regs.sp = regvalue; #endif break; Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/libexec/rtld-elf/rtld.c Mon Aug 7 14:09:57 2017 (r322168) @@ -4662,7 +4662,7 @@ tls_get_addr_common(Elf_Addr **dtvp, int index, size_t } #if defined(__aarch64__) || defined(__arm__) || defined(__mips__) || \ - defined(__powerpc__) || defined(__riscv__) + defined(__powerpc__) || defined(__riscv) /* * Allocate Static TLS using the Variant I method. Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Mon Aug 7 14:04:19 2017 (r322167) +++ head/share/man/man7/arch.7 Mon Aug 7 14:09:57 2017 (r322168) @@ -337,8 +337,8 @@ Architecture-specific macros: .It powerpc Ta Dv __powerpc__ .It powerpcspe Ta Dv __powerpc__, Dv __SPE__ .It powerpc64 Ta Dv __powerpc__, Dv __powerpc64__ -.It riscv64 Ta Dv __riscv__, Dv __riscv64 -.It riscv64sf Ta Dv __riscv__, Dv __riscv64 +.It riscv64 Ta Dv __riscv, Dv __riscv_xlen == 64 +.It riscv64sf Ta Dv __riscv, Dv __riscv_xlen == 64 .It sparc64 Ta Dv __sparc64__ .El .Sh SEE ALSO Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/atomic.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/cddl/compat/opensolaris/sys/atomic.h Mon Aug 7 14:09:57 2017 (r322168) @@ -51,7 +51,7 @@ extern uint8_t atomic_or_8_nv(volatile uint8_t *target extern void membar_producer(void); #if defined(__sparc64__) || defined(__powerpc__) || defined(__arm__) || \ - defined(__mips__) || defined(__aarch64__) || defined(__riscv__) + defined(__mips__) || defined(__aarch64__) || defined(__riscv) extern void atomic_or_8(volatile uint8_t *target, uint8_t value); #else static __inline void Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Mon Aug 7 14:09:57 2017 (r322168) @@ -12120,7 +12120,7 @@ err: *factor = 1; #if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \ - defined(__mips__) || defined(__powerpc__) || defined(__riscv__) + defined(__mips__) || defined(__powerpc__) || defined(__riscv) /* * FreeBSD isn't good at limiting the amount of memory we * ask to malloc, so let's place a limit here before trying Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Mon Aug 7 14:09:57 2017 (r322168) @@ -2492,7 +2492,7 @@ extern void dtrace_helpers_destroy(proc_t *); #define DTRACE_INVOP_SD 1 #define DTRACE_INVOP_LD 2 -#elif defined(__riscv__) +#elif defined(__riscv) #define SD_RA_SP_MASK 0x01fff07f #define SD_RA_SP 0x00113023 Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h Mon Aug 7 14:09:57 2017 (r322168) @@ -388,7 +388,7 @@ extern "C" { #define _DONT_USE_1275_GENERIC_NAMES #define _HAVE_CPUID_INSN -#elif defined(__riscv__) +#elif defined(__riscv) /* * Define the appropriate "processor characteristics" Modified: head/sys/cddl/dev/profile/profile.c ============================================================================== --- head/sys/cddl/dev/profile/profile.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/cddl/dev/profile/profile.c Mon Aug 7 14:09:57 2017 (r322168) @@ -143,7 +143,7 @@ struct profile_probe_percpu; #define PROF_ARTIFICIAL_FRAMES 10 #endif -#ifdef __riscv__ +#ifdef __riscv /* TODO: verify */ #define PROF_ARTIFICIAL_FRAMES 10 #endif Modified: head/sys/compat/linuxkpi/common/src/linux_page.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_page.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/compat/linuxkpi/common/src/linux_page.c Mon Aug 7 14:09:57 2017 (r322168) @@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__amd64__) || defined(__aarch64__) || defined(__riscv__) +#if defined(__amd64__) || defined(__aarch64__) || defined(__riscv) #define LINUXKPI_HAVE_DMAP #else #undef LINUXKPI_HAVE_DMAP Modified: head/sys/dev/sym/sym_hipd.c ============================================================================== --- head/sys/dev/sym/sym_hipd.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/dev/sym/sym_hipd.c Mon Aug 7 14:09:57 2017 (r322168) @@ -138,7 +138,7 @@ typedef u_int32_t u32; #define MEMORY_BARRIER() dmb() #elif defined __aarch64__ #define MEMORY_BARRIER() dmb(sy) -#elif defined __riscv__ +#elif defined __riscv #define MEMORY_BARRIER() fence() #else #error "Not supported platform" Modified: head/sys/kern/subr_devmap.c ============================================================================== --- head/sys/kern/subr_devmap.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/kern/subr_devmap.c Mon Aug 7 14:09:57 2017 (r322168) @@ -53,7 +53,7 @@ static struct devmap_entry akva_devmap_entries[AKVA_DE static u_int akva_devmap_idx; static vm_offset_t akva_devmap_vaddr = DEVMAP_MAX_VADDR; -#if defined(__aarch64__) || defined(__riscv__) +#if defined(__aarch64__) || defined(__riscv) extern int early_boot; #endif @@ -197,7 +197,7 @@ devmap_bootstrap(vm_offset_t l1pt, const struct devmap pmap_map_chunk(l1pt, pd->pd_va, pd->pd_pa, pd->pd_size, VM_PROT_READ | VM_PROT_WRITE, PTE_DEVICE); #endif -#elif defined(__aarch64__) || defined(__riscv__) +#elif defined(__aarch64__) || defined(__riscv) pmap_kenter_device(pd->pd_va, pd->pd_size, pd->pd_pa); #endif } @@ -270,7 +270,7 @@ pmap_mapdev(vm_offset_t pa, vm_size_t size) pa = trunc_page(pa); size = round_page(size + offset); -#if defined(__aarch64__) || defined(__riscv__) +#if defined(__aarch64__) || defined(__riscv) if (early_boot) { akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - size); va = akva_devmap_vaddr; Modified: head/sys/modules/dtrace/dtraceall/dtraceall.c ============================================================================== --- head/sys/modules/dtrace/dtraceall/dtraceall.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/modules/dtrace/dtraceall/dtraceall.c Mon Aug 7 14:09:57 2017 (r322168) @@ -70,7 +70,7 @@ MODULE_DEPEND(dtraceall, dtmalloc, 1, 1, 1); MODULE_DEPEND(dtraceall, dtnfscl, 1, 1, 1); #endif #if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \ - defined(__i386__) || defined(__powerpc__) || defined(__riscv__) + defined(__i386__) || defined(__powerpc__) || defined(__riscv) MODULE_DEPEND(dtraceall, fbt, 1, 1, 1); #endif #if defined(__amd64__) || defined(__i386__) Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/sys/sys/cdefs.h Mon Aug 7 14:09:57 2017 (r322168) @@ -782,7 +782,7 @@ #endif #endif /* __STDC_WANT_LIB_EXT1__ */ -#if defined(__mips) || defined(__powerpc64__) || defined(__riscv__) +#if defined(__mips) || defined(__powerpc64__) || defined(__riscv) #define __NO_TLS 1 #endif Modified: head/usr.bin/ldd/ldd.c ============================================================================== --- head/usr.bin/ldd/ldd.c Mon Aug 7 14:04:19 2017 (r322167) +++ head/usr.bin/ldd/ldd.c Mon Aug 7 14:09:57 2017 (r322168) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include "extern.h" /* We don't support a.out executables on arm64 and riscv */ -#if !defined(__aarch64__) && !defined(__riscv__) +#if !defined(__aarch64__) && !defined(__riscv) #include #define AOUT_SUPPORTED #endif Modified: head/usr.bin/xlint/lint1/param.h ============================================================================== --- head/usr.bin/xlint/lint1/param.h Mon Aug 7 14:04:19 2017 (r322167) +++ head/usr.bin/xlint/lint1/param.h Mon Aug 7 14:09:57 2017 (r322168) @@ -80,7 +80,7 @@ #elif __powerpc__ #define PTRDIFF_IS_LONG 0 #define SIZEOF_IS_ULONG 0 -#elif __riscv__ +#elif __riscv #define PTRDIFF_IS_LONG 1 #define SIZEOF_IS_ULONG 1 #elif __sparc__ From owner-svn-src-all@freebsd.org Mon Aug 7 14:34:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BC70DD6D4F; Mon, 7 Aug 2017 14:34:07 +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 mx1.freebsd.org (Postfix) with ESMTPS id 07E516E9F4; Mon, 7 Aug 2017 14:34:06 +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 v77EY6Wf036369; Mon, 7 Aug 2017 14:34:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77EY516036367; Mon, 7 Aug 2017 14:34:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708071434.v77EY516036367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 7 Aug 2017 14:34:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322169 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 322169 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 14:34:07 -0000 Author: mav Date: Mon Aug 7 14:34:05 2017 New Revision: 322169 URL: https://svnweb.freebsd.org/changeset/base/322169 Log: Fix hrtimer_active() in case of cancellation. While there, switch to FreeBSD internal callout active status. Reviewed by: markj, hselasky Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D11900 Modified: head/sys/compat/linuxkpi/common/include/linux/hrtimer.h head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Modified: head/sys/compat/linuxkpi/common/include/linux/hrtimer.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/hrtimer.h Mon Aug 7 14:09:57 2017 (r322168) +++ head/sys/compat/linuxkpi/common/include/linux/hrtimer.h Mon Aug 7 14:34:05 2017 (r322169) @@ -48,7 +48,6 @@ struct hrtimer { enum hrtimer_restart (*function)(struct hrtimer *); struct mtx mtx; struct callout callout; - uint32_t flags; }; #define hrtimer_active(hrtimer) linux_hrtimer_active(hrtimer) Modified: head/sys/compat/linuxkpi/common/src/linux_hrtimer.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Mon Aug 7 14:09:57 2017 (r322168) +++ head/sys/compat/linuxkpi/common/src/linux_hrtimer.c Mon Aug 7 14:34:05 2017 (r322169) @@ -37,9 +37,6 @@ __FBSDID("$FreeBSD$"); #include -/* hrtimer flags */ -#define HRTIMER_ACTIVE 0x01 - static void hrtimer_call_handler(void *arg) { @@ -49,7 +46,7 @@ hrtimer_call_handler(void *arg) hrtimer = arg; ret = hrtimer->function(hrtimer); MPASS(ret == HRTIMER_NORESTART); - hrtimer->flags &= ~HRTIMER_ACTIVE; + callout_deactivate(&hrtimer->callout); } bool @@ -58,19 +55,20 @@ linux_hrtimer_active(struct hrtimer *hrtimer) bool ret; mtx_lock(&hrtimer->mtx); - ret = (hrtimer->flags & HRTIMER_ACTIVE) != 0; + ret = callout_active(&hrtimer->callout); mtx_unlock(&hrtimer->mtx); return (ret); } +/* + * Cancel active hrtimer. + * Return 1 if timer was active and cancellation succeeded, or 0 otherwise. + */ int linux_hrtimer_cancel(struct hrtimer *hrtimer) { - if (!hrtimer_active(hrtimer)) - return (0); - (void)callout_drain(&hrtimer->callout); - return (1); + return (callout_drain(&hrtimer->callout) > 0); } void @@ -78,7 +76,6 @@ linux_hrtimer_init(struct hrtimer *hrtimer) { hrtimer->function = NULL; - hrtimer->flags = 0; mtx_init(&hrtimer->mtx, "hrtimer", NULL, MTX_DEF | MTX_RECURSE); callout_init_mtx(&hrtimer->callout, &hrtimer->mtx, 0); } @@ -103,6 +100,5 @@ linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, mtx_lock(&hrtimer->mtx); callout_reset_sbt(&hrtimer->callout, nstosbt(time.tv64), nstosbt(nsec), hrtimer_call_handler, hrtimer, 0); - hrtimer->flags |= HRTIMER_ACTIVE; mtx_unlock(&hrtimer->mtx); } From owner-svn-src-all@freebsd.org Mon Aug 7 16:23:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2A3CDB44CB; Mon, 7 Aug 2017 16:23: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 mx1.freebsd.org (Postfix) with ESMTPS id 9D4E872EA1; Mon, 7 Aug 2017 16:23: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 v77GNrq6081023; Mon, 7 Aug 2017 16:23:53 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77GNrFZ081021; Mon, 7 Aug 2017 16:23:53 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708071623.v77GNrFZ081021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 7 Aug 2017 16:23:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322170 - head X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322170 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 16:23:54 -0000 Author: dim Date: Mon Aug 7 16:23:53 2017 New Revision: 322170 URL: https://svnweb.freebsd.org/changeset/base/322170 Log: Follow-up to r321684 (Don't use libc++ when cross-building for gcc arches), and handle two more cases where libc++ includes could be incorrectly enabled, in case the host compiler is clang 5.0.0, and the target (cross) compiler is gcc 4.2.1. Noted by: bdrewery MFC after: 3 days X-MFC-With: 321684 Modified: head/Makefile.inc1 head/Makefile.libcompat Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Aug 7 14:34:05 2017 (r322169) +++ head/Makefile.inc1 Mon Aug 7 16:23:53 2017 (r322170) @@ -2742,8 +2742,7 @@ CD2CFLAGS+= -isystem ${XDDESTDIR}/usr/include -L${XDDE # combined with --sysroot. CD2CFLAGS+= -B${XDDESTDIR}/usr/lib # Force using libc++ for external GCC. -# XXX: This should be checking MK_GNUCXX == no -.if ${X_COMPILER_VERSION} >= 40800 +.if ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 CD2CXXFLAGS+= -isystem ${XDDESTDIR}/usr/include/c++/v1 -std=c++11 \ -nostdinc++ .endif Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Mon Aug 7 14:34:05 2017 (r322169) +++ head/Makefile.libcompat Mon Aug 7 16:23:53 2017 (r322170) @@ -99,8 +99,7 @@ LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat # sysroot path which --sysroot does not actually do for headers. LIBCOMPATCFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include # Force using libc++ for external GCC. -# XXX: This should be checking MK_GNUCXX == no -.if ${X_COMPILER_VERSION} >= 40800 && \ +.if ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 && \ (${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no") LIBCOMPATCXXFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \ -nostdinc++ From owner-svn-src-all@freebsd.org Mon Aug 7 17:23:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8CB9DBC6A6; Mon, 7 Aug 2017 17:23:11 +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 mx1.freebsd.org (Postfix) with ESMTPS id 96B267587E; Mon, 7 Aug 2017 17:23:11 +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 v77HNAZ9005306; Mon, 7 Aug 2017 17:23:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77HNAJG005305; Mon, 7 Aug 2017 17:23:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708071723.v77HNAJG005305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 7 Aug 2017 17:23:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322171 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 322171 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 17:23:11 -0000 Author: kib Date: Mon Aug 7 17:23:10 2017 New Revision: 322171 URL: https://svnweb.freebsd.org/changeset/base/322171 Log: Explain why delayed invalidation is not required in pmap_protect() and pmap_remove_pages(). Submitted by: alc MFC after: 1 week Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Aug 7 16:23:53 2017 (r322170) +++ head/sys/amd64/amd64/pmap.c Mon Aug 7 17:23:10 2017 (r322171) @@ -4085,6 +4085,26 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t PG_RW = pmap_rw_bit(pmap); anychanged = FALSE; + /* + * Although this function delays and batches the invalidation + * of stale TLB entries, it does not need to call + * pmap_delayed_invl_started() and + * pmap_delayed_invl_finished(), because it does not + * ordinarily destroy mappings. Stale TLB entries from + * protection-only changes need only be invalidated before the + * pmap lock is released, because protection-only changes do + * not destroy PV entries. Even operations that iterate over + * a physical page's PV list of mappings, like + * pmap_remove_write(), acquire the pmap lock for each + * mapping. Consequently, for protection-only changes, the + * pmap lock suffices to synchronize both page table and TLB + * updates. + * + * This function only destroys a mapping if pmap_demote_pde() + * fails. In that case, stale TLB entries are immediately + * invalidated. + */ + PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { @@ -5469,6 +5489,15 @@ pmap_page_is_mapped(vm_page_t m) * no processor is currently accessing the user address space. In * particular, a page table entry's dirty bit won't change state once * this function starts. + * + * Although this function destroys all of the pmap's managed, + * non-wired mappings, it can delay and batch the invalidation of TLB + * entries without calling pmap_delayed_invl_started() and + * pmap_delayed_invl_finished(). Because the pmap is not active on + * any other processor, none of these TLB entries will ever be used + * before their eventual invalidation. Consequently, there is no need + * for either pmap_remove_all() or pmap_remove_write() to wait for + * that eventual TLB invalidation. */ void pmap_remove_pages(pmap_t pmap) From owner-svn-src-all@freebsd.org Mon Aug 7 17:23:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78047DBC77F; Mon, 7 Aug 2017 17:23:46 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 1B234759C5; Mon, 7 Aug 2017 17:23:46 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v77HNjFu005378; Mon, 7 Aug 2017 17:23:45 GMT (envelope-from phil@FreeBSD.org) Received: (from phil@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77HNihZ005373; Mon, 7 Aug 2017 17:23:44 GMT (envelope-from phil@FreeBSD.org) Message-Id: <201708071723.v77HNihZ005373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phil set sender to phil@FreeBSD.org using -f From: Phil Shafer Date: Mon, 7 Aug 2017 17:23: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: r322172 - in stable/11: contrib/libxo contrib/libxo/doc contrib/libxo/encoder/cbor contrib/libxo/encoder/test contrib/libxo/libxo contrib/libxo/tests/core contrib/libxo/tests/core/saved... X-SVN-Group: stable-11 X-SVN-Commit-Author: phil X-SVN-Commit-Paths: in stable/11: contrib/libxo contrib/libxo/doc contrib/libxo/encoder/cbor contrib/libxo/encoder/test contrib/libxo/libxo contrib/libxo/tests/core contrib/libxo/tests/core/saved contrib/libxo/tests/gett... X-SVN-Commit-Revision: 322172 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 07 Aug 2017 17:23:46 -0000 Author: phil Date: Mon Aug 7 17:23:44 2017 New Revision: 322172 URL: https://svnweb.freebsd.org/changeset/base/322172 Log: Import libxo-0.8.4 from HEAD into stable/11 Submitted by: phil Added: stable/11/contrib/libxo/libxo/xo_options.7 - copied, changed from r318364, head/contrib/libxo/libxo/xo_options.7 Modified: stable/11/contrib/libxo/Makefile.am stable/11/contrib/libxo/configure.ac stable/11/contrib/libxo/doc/Makefile.am stable/11/contrib/libxo/doc/libxo-manual.html stable/11/contrib/libxo/doc/libxo.txt stable/11/contrib/libxo/encoder/cbor/enc_cbor.c stable/11/contrib/libxo/encoder/test/enc_test.c stable/11/contrib/libxo/libxo/Makefile.am stable/11/contrib/libxo/libxo/libxo.3 stable/11/contrib/libxo/libxo/libxo.c stable/11/contrib/libxo/libxo/xo.h stable/11/contrib/libxo/libxo/xo_attr.3 stable/11/contrib/libxo/libxo/xo_buf.h stable/11/contrib/libxo/libxo/xo_create.3 stable/11/contrib/libxo/libxo/xo_emit.3 stable/11/contrib/libxo/libxo/xo_emit_err.3 stable/11/contrib/libxo/libxo/xo_emit_f.3 stable/11/contrib/libxo/libxo/xo_encoder.c stable/11/contrib/libxo/libxo/xo_encoder.h stable/11/contrib/libxo/libxo/xo_err.3 stable/11/contrib/libxo/libxo/xo_error.3 stable/11/contrib/libxo/libxo/xo_finish.3 stable/11/contrib/libxo/libxo/xo_flush.3 stable/11/contrib/libxo/libxo/xo_format.5 stable/11/contrib/libxo/libxo/xo_message.3 stable/11/contrib/libxo/libxo/xo_no_setlocale.3 stable/11/contrib/libxo/libxo/xo_open_container.3 stable/11/contrib/libxo/libxo/xo_open_list.3 stable/11/contrib/libxo/libxo/xo_open_marker.3 stable/11/contrib/libxo/libxo/xo_parse_args.3 stable/11/contrib/libxo/libxo/xo_set_allocator.3 stable/11/contrib/libxo/libxo/xo_set_flags.3 stable/11/contrib/libxo/libxo/xo_set_info.3 stable/11/contrib/libxo/libxo/xo_set_options.3 stable/11/contrib/libxo/libxo/xo_set_style.3 stable/11/contrib/libxo/libxo/xo_set_syslog_enterprise_id.3 stable/11/contrib/libxo/libxo/xo_set_version.3 stable/11/contrib/libxo/libxo/xo_set_writer.3 stable/11/contrib/libxo/libxo/xo_syslog.3 stable/11/contrib/libxo/libxo/xo_syslog.c stable/11/contrib/libxo/tests/core/Makefile.am stable/11/contrib/libxo/tests/core/saved/test_01.E.out stable/11/contrib/libxo/tests/core/saved/test_01.H.out stable/11/contrib/libxo/tests/core/saved/test_01.HIPx.out stable/11/contrib/libxo/tests/core/saved/test_01.HP.out stable/11/contrib/libxo/tests/core/saved/test_01.J.out stable/11/contrib/libxo/tests/core/saved/test_01.JP.out stable/11/contrib/libxo/tests/core/saved/test_01.T.out stable/11/contrib/libxo/tests/core/saved/test_01.X.out stable/11/contrib/libxo/tests/core/saved/test_01.XP.out stable/11/contrib/libxo/tests/core/saved/test_02.E.out stable/11/contrib/libxo/tests/core/saved/test_02.J.out stable/11/contrib/libxo/tests/core/saved/test_02.JP.out stable/11/contrib/libxo/tests/core/saved/test_02.X.out stable/11/contrib/libxo/tests/core/saved/test_02.XP.out stable/11/contrib/libxo/tests/core/saved/test_03.E.out stable/11/contrib/libxo/tests/core/saved/test_04.E.out stable/11/contrib/libxo/tests/core/saved/test_05.E.out stable/11/contrib/libxo/tests/core/saved/test_06.E.out stable/11/contrib/libxo/tests/core/saved/test_07.E.out stable/11/contrib/libxo/tests/core/saved/test_08.E.out stable/11/contrib/libxo/tests/core/saved/test_09.E.out stable/11/contrib/libxo/tests/core/saved/test_10.E.out stable/11/contrib/libxo/tests/core/saved/test_10.X.out stable/11/contrib/libxo/tests/core/saved/test_10.XP.out stable/11/contrib/libxo/tests/core/saved/test_11.E.out stable/11/contrib/libxo/tests/core/saved/test_11.HIPx.out stable/11/contrib/libxo/tests/core/saved/test_11.X.out stable/11/contrib/libxo/tests/core/saved/test_11.XP.out stable/11/contrib/libxo/tests/core/saved/test_12.E.out stable/11/contrib/libxo/tests/core/saved/test_12.H.out stable/11/contrib/libxo/tests/core/saved/test_12.HIPx.out stable/11/contrib/libxo/tests/core/saved/test_12.HP.out stable/11/contrib/libxo/tests/core/saved/test_12.J.out stable/11/contrib/libxo/tests/core/saved/test_12.JP.out stable/11/contrib/libxo/tests/core/saved/test_12.T.out stable/11/contrib/libxo/tests/core/saved/test_12.X.out stable/11/contrib/libxo/tests/core/saved/test_12.XP.out stable/11/contrib/libxo/tests/core/test_01.c stable/11/contrib/libxo/tests/core/test_12.c stable/11/contrib/libxo/tests/gettext/Makefile.am stable/11/contrib/libxo/tests/gettext/saved/gt_01.J.out stable/11/contrib/libxo/tests/gettext/saved/gt_01.JP.out stable/11/contrib/libxo/tests/xo/Makefile.am stable/11/contrib/libxo/tests/xo/saved/xo_01.H.out stable/11/contrib/libxo/tests/xo/saved/xo_01.HIPx.out stable/11/contrib/libxo/tests/xo/saved/xo_01.HP.out stable/11/contrib/libxo/tests/xo/saved/xo_01.J.out stable/11/contrib/libxo/tests/xo/saved/xo_01.JP.out stable/11/contrib/libxo/tests/xo/saved/xo_01.T.out stable/11/contrib/libxo/tests/xo/saved/xo_01.X.out stable/11/contrib/libxo/tests/xo/saved/xo_01.XP.out stable/11/contrib/libxo/tests/xo/xo_01.sh stable/11/contrib/libxo/xo/xo.1 stable/11/contrib/libxo/xo/xo.c stable/11/contrib/libxo/xohtml/xohtml.1 stable/11/contrib/libxo/xohtml/xohtml.css stable/11/contrib/libxo/xohtml/xohtml.sh.in stable/11/contrib/libxo/xolint/xolint.1 stable/11/contrib/libxo/xopo/xopo.1 stable/11/contrib/libxo/xopo/xopo.c stable/11/lib/libxo/Makefile stable/11/lib/libxo/add.man stable/11/lib/libxo/tests/functional_test.sh stable/11/lib/libxo/xo_config.h stable/11/usr.bin/xo/Makefile stable/11/usr.bin/xo/tests/functional_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/libxo/Makefile.am ============================================================================== --- stable/11/contrib/libxo/Makefile.am Mon Aug 7 17:23:10 2017 (r322171) +++ stable/11/contrib/libxo/Makefile.am Mon Aug 7 17:23:44 2017 (r322172) @@ -38,7 +38,14 @@ GH_PAGES_DIR = gh-pages/ GH_PAGES_DIR_VER = gh-pages/${PACKAGE_VERSION} PACKAGE_FILE = ${PACKAGE_TARNAME}-${PACKAGE_VERSION}.tar.gz -upload: dist upload-docs +XOHTML_FILES = \ + ${top_srcdir}/xohtml/xohtml.css \ + ${top_srcdir}/xohtml/xohtml.js \ + ${top_srcdir}/xohtml/external/jquery.js \ + ${top_srcdir}/xohtml/external/jquery.qtip.css \ + ${top_srcdir}/xohtml/external/jquery.qtip.js + +upload: dist upload-docs upload-xohtml-files @echo "Remember to run:" @echo " gt tag ${PACKAGE_VERSION}" @@ -56,6 +63,18 @@ upload-docs: docs libxo-manual.html ${PACKAGE_VERSION} \ && git push origin gh-pages ) ; true +upload-xohtml-files: + @echo "Uploading xohtml files ... " + @-[ -d ${GH_PAGES_DIR} ] \ + && echo "Updating xohtml files on gh-pages ..." \ + && mkdir -p ${GH_PAGES_DIR_VER}/xohtml \ + && cp ${XOHTML_FILES} ${GH_PAGES_DIR_VER}/xohtml \ + && (cd ${GH_PAGES_DIR} \ + && git add ${PACKAGE_VERSION}/xohtml \ + && git commit -m 'new xohtml files' \ + ${PACKAGE_VERSION}/xohtml \ + && git push origin gh-pages ) ; true + pkgconfigdir=$(libdir)/pkgconfig pkgconfig_DATA = packaging/${PACKAGE_NAME}.pc @@ -100,4 +119,25 @@ ANALYZE_DIR = ~/trash/libxo ANALYZE_CMD = scan-build-mp-3.6 analyze: + ${MAKE} clean ${ANALYZE_CMD} -o ${ANALYZE_DIR} ${MAKE} + +SANIFLAGS=-fno-omit-frame-pointer -g -O2 + +sanitize-address: + ${MAKE} clean + ${MAKE} CFLAGS="-fsanitize=address ${SANIFLAGS}" + ${MAKE} install + ${MAKE} test + +sanitize-undefined: + ${MAKE} clean + ${MAKE} CFLAGS="-fsanitize=undefined ${SANIFLAGS}" + ${MAKE} install + ${MAKE} test + +sanitize-memory: + ${MAKE} clean + ${MAKE} CFLAGS="-fsanitize=memory ${SANIFLAGS}" + ${MAKE} install + ${MAKE} test Modified: stable/11/contrib/libxo/configure.ac ============================================================================== --- stable/11/contrib/libxo/configure.ac Mon Aug 7 17:23:10 2017 (r322171) +++ stable/11/contrib/libxo/configure.ac Mon Aug 7 17:23:44 2017 (r322172) @@ -12,7 +12,7 @@ # AC_PREREQ(2.2) -AC_INIT([libxo], [0.6.3], [phil@juniper.net]) +AC_INIT([libxo], [0.8.4], [phil@juniper.net]) AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability]) # Support silent build rules. Requires at least automake-1.11. @@ -20,7 +20,6 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portabili m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_PROG_CC -AM_PROG_AR AC_PROG_INSTALL AC_CONFIG_MACRO_DIR([m4]) AC_PROG_LN_S @@ -135,6 +134,21 @@ if test "$GETTEXT_ENABLE" != "no"; then AC_MSG_RESULT([$HAVE_GETTEXT]) fi + + if test "$HAVE_GETTEXT" != "yes"; then + GETTEXT_PREFIX=/usr/local + AC_MSG_CHECKING([gettext in ${GETTEXT_PREFIX}]) + + _save_cflags="$CFLAGS" + CFLAGS="$CFLAGS -I${GETTEXT_PREFIX}/include -L${GETTEXT_PREFIX}/lib -Werror -lintl" + AC_LINK_IFELSE([AC_LANG_SOURCE([[#include ] + [int main() {char *cp = dgettext(NULL, "xx"); return 0; }]])], + [HAVE_GETTEXT=yes], + [HAVE_GETTEXT=no]) + CFLAGS="$_save_cflags" + + AC_MSG_RESULT([$HAVE_GETTEXT]) + fi fi if test "$HAVE_GETTEXT" = "yes"; then @@ -277,6 +291,13 @@ AC_ARG_ENABLE([debug], [LIBXO_DEBUG=no]) AC_MSG_RESULT([$LIBXO_DEBUG]) AM_CONDITIONAL([LIBXO_DEBUG], [test "$LIBXO_DEBUG" != "no"]) + +AC_MSG_CHECKING([whether to use int return codes]) +AC_ARG_ENABLE([int-return-codes], + [ --enable-int-return-codes Use int return codes (instead of ssize_t)], + [USE_INT_RETURN_CODES=yes; AC_DEFINE([USE_INT_RETURN_CODES], [1], [Use int return codes])], + [USE_INT_RETURN_CODES=no]) +AC_MSG_RESULT([$USE_INT_RETURN_CODES]) AC_MSG_CHECKING([whether to build with text-only rendering]) AC_ARG_ENABLE([text-only], Modified: stable/11/contrib/libxo/doc/Makefile.am ============================================================================== --- stable/11/contrib/libxo/doc/Makefile.am Mon Aug 7 17:23:10 2017 (r322171) +++ stable/11/contrib/libxo/doc/Makefile.am Mon Aug 7 17:23:44 2017 (r322172) @@ -61,9 +61,9 @@ xolint.txt: ${top_srcdir}/xolint/xolint.pl CLEANFILES = \ xolint.txt \ ${INPUT}.xml \ -${INPUT}.txt \ ${INPUT}.fxml \ -${INPUT}.html +${OUTPUT}.txt \ +${OUTPUT}.html else doc docs: @${ECHO} "The 'oxtradoc' tool is not installed; see libslax.org" Modified: stable/11/contrib/libxo/doc/libxo-manual.html ============================================================================== --- stable/11/contrib/libxo/doc/libxo-manual.html Mon Aug 7 17:23:10 2017 (r322171) +++ stable/11/contrib/libxo/doc/libxo-manual.html Mon Aug 7 17:23:44 2017 (r322172) @@ -515,7 +515,7 @@ li.indline1 { } @top-right { - content: "May 2016"; + content: "August 2017"; } @top-center { @@ -21983,15 +21983,17 @@ jQuery(function ($) { - - - - - - - - - + + + + + + + + + + + @@ -22009,7 +22011,7 @@ jQuery(function ($) { -May 28, 2016 +August 3, 2017

libxo: The Easy Way to Generate text, XML, JSON, and HTML output
libxo-manual

@@ -22018,394 +22020,413 @@ jQuery(function ($) {
  • 1   
    -Overview
    • -
      1.1   
      -Getting libxo
    • -
      2   
      +
      3   
      Formatting with libxo +
    • +
    • +
      4   
      +Command-line Arguments
    • -
      3   
      +
      5   
      The libxo API
      • -
        3.1   
        +
        5.1   
        Handles
      • -
        4   
        +
        6   
        The "xo" Utility
      • -
        5   
        +
        7   
        xolint
      • -
        6   
        +
        8   
        xohtml
      • -
        7   
        +
        9   
        xopo
      • -
        8   
        +
        10   
        FAQs
      • -
        9   
        +
        11   
        Howtos: Focused Directions
      • -
        10   
        +
        12   
        Examples
      • @@ -22638,14 +22659,31 @@ jQuery(function ($) { Overview

        libxo - A Library for Generating Text, XML, JSON, and HTML Output

        -

        You want to prepare for the future, but you need to live in the present. You'd love a flying car, but need to get to work today. You want to support features like XML, JSON, and HTML rendering to allow integration with NETCONF, REST, and web browsers, but you need to make text output for command line users. And you don't want multiple code paths that can't help but get out of sync. None of this "if (xml) {... } else {...}" logic. And ifdefs are right out. But you'd really, really like all the fancy features that modern encoding formats can provide. libxo can help.

        -

        The libxo library allows an application to generate text, XML, JSON, and HTML output using a common set of function calls. The application decides at run time which output style should be produced. The application calls a function "xo_emit" to product output that is described in a format string. A "field descriptor" tells libxo what the field is and what it means. Each field descriptor is placed in braces with a printf-like format string (Section 2.2):

        +

        You want to prepare for the future, but you need to live in the present. You'd love a flying car, but need to get to work today. You want to support features like XML, JSON, and HTML rendering to allow integration with NETCONF, REST, and web browsers, but you need to make text output for command line users.

        +

        And you don't want multiple code paths that can't help but get out of sync:

        +    /* None of this "if (xml) {... } else {...}"  logic */
        +    if (xml) {
        +        /* some code to make xml*/
        +    } else {
        +        /* other code to make text */
        +        /* oops forgot to add something on both clauses! */
        +    }
        +
        +    /* And ifdefs are right out. */
        +    #ifdef MAKE_XML
        +        /* icky */
        +    #else
        +        /* pooh */
        +    #endif
        +	    

        But you'd really, really like all the fancy features that modern encoding formats can provide. libxo can help.

        +

        The libxo library allows an application to generate text, XML, JSON, and HTML output using a common set of function calls. The application decides at run time which output style should be produced. The application calls a function "xo_emit" to product output that is described in a format string. A "field descriptor" tells libxo what the field is and what it means. Each field descriptor is placed in braces with a printf-like format string (Section 3.2):

        +
             xo_emit(" {:lines/%7ju} {:words/%7ju} "
                     "{:characters/%7ju} {d:filename/%s}\n",
                     linect, wordct, charct, file);
        -	    

        Each field can have a role, with the 'value' role being the default, and the role tells libxo how and when to render that field. Output can then be generated in various style, using the "‑‑libxo" option:

        -
        +	    

        Each field can have a role, with the 'value' role being the default, and the role tells libxo how and when to render that field (see Section 3.2.1 for details). Modifiers change how the field is rendered in different output styles (see Section 3.2.2 for details. Output can then be generated in various style, using the "‑‑libxo" option:

        +
             % wc /etc/motd
                   25     165    1140 /etc/motd
        
        *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 17:28:37 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19BF6DBCBE4;
         Mon,  7 Aug 2017 17:28:37 +0000 (UTC)
         (envelope-from markj@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id DAC3A75C20;
         Mon,  7 Aug 2017 17:28:36 +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 v77HSafH005598;
         Mon, 7 Aug 2017 17:28:36 GMT (envelope-from markj@FreeBSD.org)
        Received: (from markj@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77HSaIn005597;
         Mon, 7 Aug 2017 17:28:36 GMT (envelope-from markj@FreeBSD.org)
        Message-Id: <201708071728.v77HSaIn005597@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: markj set sender to
         markj@FreeBSD.org using -f
        From: Mark Johnston 
        Date: Mon, 7 Aug 2017 17:28:36 +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: r322173 - stable/11/sys/kern
        X-SVN-Group: stable-11
        X-SVN-Commit-Author: markj
        X-SVN-Commit-Paths: stable/11/sys/kern
        X-SVN-Commit-Revision: 322173
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 17:28:37 -0000
        
        Author: markj
        Date: Mon Aug  7 17:28:35 2017
        New Revision: 322173
        URL: https://svnweb.freebsd.org/changeset/base/322173
        
        Log:
          MFC r321744:
          Correct the predicates on which lockstat:::{thread,spin}-spin fire.
        
        Modified:
          stable/11/sys/kern/kern_mutex.c
        Directory Properties:
          stable/11/   (props changed)
        
        Modified: stable/11/sys/kern/kern_mutex.c
        ==============================================================================
        --- stable/11/sys/kern/kern_mutex.c	Mon Aug  7 17:23:44 2017	(r322172)
        +++ stable/11/sys/kern/kern_mutex.c	Mon Aug  7 17:28:35 2017	(r322173)
        @@ -766,7 +766,7 @@ _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t
         	LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(spin__acquire, m,
         	    contested, waittime, file, line);
         #ifdef KDTRACE_HOOKS
        -	if (spin_time != 0)
        +	if (lda.spin_cnt != 0)
         		LOCKSTAT_RECORD1(spin__spin, m, spin_time);
         #endif
         }
        @@ -879,7 +879,7 @@ retry:
         		LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(spin__acquire, m,
         		    contested, waittime, file, line);
         #ifdef KDTRACE_HOOKS
        -	if (spin_time != 0)
        +	if (lda.spin_cnt != 0)
         		LOCKSTAT_RECORD1(thread__spin, m, spin_time);
         #endif
         }
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 17:29:49 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C92CDBCD97;
         Mon,  7 Aug 2017 17:29:49 +0000 (UTC)
         (envelope-from markj@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id 6972B75DDF;
         Mon,  7 Aug 2017 17:29:49 +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 v77HTm2t005695;
         Mon, 7 Aug 2017 17:29:48 GMT (envelope-from markj@FreeBSD.org)
        Received: (from markj@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77HTm4e005694;
         Mon, 7 Aug 2017 17:29:48 GMT (envelope-from markj@FreeBSD.org)
        Message-Id: <201708071729.v77HTm4e005694@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: markj set sender to
         markj@FreeBSD.org using -f
        From: Mark Johnston 
        Date: Mon, 7 Aug 2017 17:29:48 +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: r322174 - stable/11/sys/kern
        X-SVN-Group: stable-11
        X-SVN-Commit-Author: markj
        X-SVN-Commit-Paths: stable/11/sys/kern
        X-SVN-Commit-Revision: 322174
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 17:29:49 -0000
        
        Author: markj
        Date: Mon Aug  7 17:29:48 2017
        New Revision: 322174
        URL: https://svnweb.freebsd.org/changeset/base/322174
        
        Log:
          MFC r321805:
          Batch v_wire_count decrements in vm_hold_free_pages().
        
        Modified:
          stable/11/sys/kern/vfs_bio.c
        Directory Properties:
          stable/11/   (props changed)
        
        Modified: stable/11/sys/kern/vfs_bio.c
        ==============================================================================
        --- stable/11/sys/kern/vfs_bio.c	Mon Aug  7 17:28:35 2017	(r322173)
        +++ stable/11/sys/kern/vfs_bio.c	Mon Aug  7 17:29:48 2017	(r322174)
        @@ -4507,13 +4507,10 @@ vm_hold_free_pages(struct buf *bp, int newbsize)
         	for (index = newnpages; index < bp->b_npages; index++) {
         		p = bp->b_pages[index];
         		bp->b_pages[index] = NULL;
        -		if (vm_page_sbusied(p))
        -			printf("vm_hold_free_pages: blkno: %jd, lblkno: %jd\n",
        -			    (intmax_t)bp->b_blkno, (intmax_t)bp->b_lblkno);
         		p->wire_count--;
         		vm_page_free(p);
        -		atomic_subtract_int(&vm_cnt.v_wire_count, 1);
         	}
        +	atomic_subtract_int(&vm_cnt.v_wire_count, bp->b_npages - newnpages);
         	bp->b_npages = newnpages;
         }
         
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 17:29:56 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F264DBCDDF;
         Mon,  7 Aug 2017 17:29:56 +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 mx1.freebsd.org (Postfix) with ESMTPS id E5C7075E02;
         Mon,  7 Aug 2017 17:29:55 +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 v77HTtZA005748;
         Mon, 7 Aug 2017 17:29:55 GMT (envelope-from kib@FreeBSD.org)
        Received: (from kib@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77HTtFa005747;
         Mon, 7 Aug 2017 17:29:55 GMT (envelope-from kib@FreeBSD.org)
        Message-Id: <201708071729.v77HTtFa005747@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
         using -f
        From: Konstantin Belousov 
        Date: Mon, 7 Aug 2017 17:29:55 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322175 - head/sys/amd64/amd64
        X-SVN-Group: head
        X-SVN-Commit-Author: kib
        X-SVN-Commit-Paths: head/sys/amd64/amd64
        X-SVN-Commit-Revision: 322175
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 17:29:56 -0000
        
        Author: kib
        Date: Mon Aug  7 17:29:54 2017
        New Revision: 322175
        URL: https://svnweb.freebsd.org/changeset/base/322175
        
        Log:
          Avoid DI recursion when reclaim_pv_chunk() is called from
          pmap_advise() or pmap_remove().
          
          Reported and tested by:	pho (previous version)
          Reviewed by:	alc
          Sponsored by:	The FreeBSD Foundation
          MFC after:	1 week
        
        Modified:
          head/sys/amd64/amd64/pmap.c
        
        Modified: head/sys/amd64/amd64/pmap.c
        ==============================================================================
        --- head/sys/amd64/amd64/pmap.c	Mon Aug  7 17:29:48 2017	(r322174)
        +++ head/sys/amd64/amd64/pmap.c	Mon Aug  7 17:29:54 2017	(r322175)
        @@ -428,8 +428,15 @@ static struct lock_object invl_gen_ts = {
         	.lo_name = "invlts",
         };
         
        +static bool
        +pmap_not_in_di(void)
        +{
        +
        +	return (curthread->td_md.md_invl_gen.gen == 0);
        +}
        +
         #define	PMAP_ASSERT_NOT_IN_DI() \
        -    KASSERT(curthread->td_md.md_invl_gen.gen == 0, ("DI already started"))
        +    KASSERT(pmap_not_in_di(), ("DI already started"))
         
         /*
          * Start a new Delayed Invalidation (DI) block of code, executed by
        @@ -2856,6 +2863,19 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG
         	"Current number of spare pv entries");
         #endif
         
        +static void
        +reclaim_pv_chunk_leave_pmap(pmap_t pmap, pmap_t locked_pmap, bool start_di)
        +{
        +
        +	if (pmap == NULL)
        +		return;
        +	pmap_invalidate_all(pmap);
        +	if (pmap != locked_pmap)
        +		PMAP_UNLOCK(pmap);
        +	if (start_di)
        +		pmap_delayed_invl_finished();
        +}
        +
         /*
          * We are in a serious low memory condition.  Resort to
          * drastic measures to free some pages so we can allocate
        @@ -2883,6 +2903,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l
         	struct spglist free;
         	uint64_t inuse;
         	int bit, field, freed;
        +	bool start_di;
         
         	PMAP_LOCK_ASSERT(locked_pmap, MA_OWNED);
         	KASSERT(lockp != NULL, ("reclaim_pv_chunk: lockp is NULL"));
        @@ -2891,19 +2912,21 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l
         	PG_G = PG_A = PG_M = PG_RW = 0;
         	SLIST_INIT(&free);
         	TAILQ_INIT(&new_tail);
        -	pmap_delayed_invl_started();
        +
        +	/*
        +	 * A delayed invalidation block should already be active if
        +	 * pmap_advise() or pmap_remove() called this function by way
        +	 * of pmap_demote_pde_locked().
        +	 */
        +	start_di = pmap_not_in_di();
        +
         	mtx_lock(&pv_chunks_mutex);
         	while ((pc = TAILQ_FIRST(&pv_chunks)) != NULL && SLIST_EMPTY(&free)) {
         		TAILQ_REMOVE(&pv_chunks, pc, pc_lru);
         		mtx_unlock(&pv_chunks_mutex);
         		if (pmap != pc->pc_pmap) {
        -			if (pmap != NULL) {
        -				pmap_invalidate_all(pmap);
        -				if (pmap != locked_pmap)
        -					PMAP_UNLOCK(pmap);
        -			}
        -			pmap_delayed_invl_finished();
        -			pmap_delayed_invl_started();
        +			reclaim_pv_chunk_leave_pmap(pmap, locked_pmap,
        +			    start_di);
         			pmap = pc->pc_pmap;
         			/* Avoid deadlock and lock recursion. */
         			if (pmap > locked_pmap) {
        @@ -2920,6 +2943,8 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l
         			PG_A = pmap_accessed_bit(pmap);
         			PG_M = pmap_modified_bit(pmap);
         			PG_RW = pmap_rw_bit(pmap);
        +			if (start_di)
        +				pmap_delayed_invl_started();
         		}
         
         		/*
        @@ -2994,12 +3019,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l
         	}
         	TAILQ_CONCAT(&pv_chunks, &new_tail, pc_lru);
         	mtx_unlock(&pv_chunks_mutex);
        -	if (pmap != NULL) {
        -		pmap_invalidate_all(pmap);
        -		if (pmap != locked_pmap)
        -			PMAP_UNLOCK(pmap);
        -	}
        -	pmap_delayed_invl_finished();
        +	reclaim_pv_chunk_leave_pmap(pmap, locked_pmap, start_di);
         	if (m_pc == NULL && !SLIST_EMPTY(&free)) {
         		m_pc = SLIST_FIRST(&free);
         		SLIST_REMOVE_HEAD(&free, plinks.s.ss);
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 17:30:23 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6375DBCEDC;
         Mon,  7 Aug 2017 17:30: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 mx1.freebsd.org (Postfix) with ESMTPS id A4D0876043;
         Mon,  7 Aug 2017 17:30: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 v77HUMal005840;
         Mon, 7 Aug 2017 17:30:22 GMT (envelope-from markj@FreeBSD.org)
        Received: (from markj@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77HUMAq005839;
         Mon, 7 Aug 2017 17:30:22 GMT (envelope-from markj@FreeBSD.org)
        Message-Id: <201708071730.v77HUMAq005839@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: markj set sender to
         markj@FreeBSD.org using -f
        From: Mark Johnston 
        Date: Mon, 7 Aug 2017 17:30: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: r322176 - stable/11/sys/x86/x86
        X-SVN-Group: stable-11
        X-SVN-Commit-Author: markj
        X-SVN-Commit-Paths: stable/11/sys/x86/x86
        X-SVN-Commit-Revision: 322176
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 17:30:23 -0000
        
        Author: markj
        Date: Mon Aug  7 17:30:22 2017
        New Revision: 322176
        URL: https://svnweb.freebsd.org/changeset/base/322176
        
        Log:
          MFC r321803:
          Don't trace running threads that have interrupts disabled.
        
        Modified:
          stable/11/sys/x86/x86/stack_machdep.c
        Directory Properties:
          stable/11/   (props changed)
        
        Modified: stable/11/sys/x86/x86/stack_machdep.c
        ==============================================================================
        --- stable/11/sys/x86/x86/stack_machdep.c	Mon Aug  7 17:29:54 2017	(r322175)
        +++ stable/11/sys/x86/x86/stack_machdep.c	Mon Aug  7 17:30:22 2017	(r322176)
        @@ -49,12 +49,14 @@ __FBSDID("$FreeBSD$");
         
         #ifdef __i386__
         #define	PCB_FP(pcb)	((pcb)->pcb_ebp)
        +#define	TF_FLAGS(tf)	((tf)->tf_eflags)
         #define	TF_FP(tf)	((tf)->tf_ebp)
         #define	TF_PC(tf)	((tf)->tf_eip)
         
         typedef struct i386_frame *x86_frame_t;
         #else
         #define	PCB_FP(pcb)	((pcb)->pcb_rbp)
        +#define	TF_FLAGS(tf)	((tf)->tf_rflags)
         #define	TF_FP(tf)	((tf)->tf_rbp)
         #define	TF_PC(tf)	((tf)->tf_rip)
         
        @@ -104,10 +106,10 @@ stack_nmi_handler(struct trapframe *tf)
         	if (nmi_stack == NULL || curthread != nmi_pending)
         		return (0);
         
        -	if (INKERNEL(TF_PC(tf)))
        +	if (INKERNEL(TF_PC(tf)) && (TF_FLAGS(tf) & PSL_I) != 0)
         		stack_capture(curthread, nmi_stack, TF_FP(tf));
         	else
        -		/* We interrupted a thread in user mode. */
        +		/* We were running in usermode or had interrupts disabled. */
         		nmi_stack->depth = 0;
         
         	atomic_store_rel_ptr((long *)&nmi_pending, (long)NULL);
        @@ -155,7 +157,6 @@ stack_save_td_running(struct stack *st, struct thread 
         	mtx_unlock_spin(&nmi_lock);
         
         	if (st->depth == 0)
        -		/* We interrupted a thread in user mode. */
         		return (EAGAIN);
         #else /* !SMP */
         	KASSERT(0, ("curthread isn't running"));
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 18:01:29 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C21EDBEB97;
         Mon,  7 Aug 2017 18:01: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 mx1.freebsd.org (Postfix) with ESMTPS id 1E47A775A3;
         Mon,  7 Aug 2017 18:01: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 v77I1SbA020916;
         Mon, 7 Aug 2017 18:01:28 GMT (envelope-from kevans@FreeBSD.org)
        Received: (from kevans@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77I1SIG020914;
         Mon, 7 Aug 2017 18:01:28 GMT (envelope-from kevans@FreeBSD.org)
        Message-Id: <201708071801.v77I1SIG020914@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: kevans set sender to
         kevans@FreeBSD.org using -f
        From: Kyle Evans 
        Date: Mon, 7 Aug 2017 18:01:28 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322177 - head/usr.bin/indent
        X-SVN-Group: head
        X-SVN-Commit-Author: kevans
        X-SVN-Commit-Paths: head/usr.bin/indent
        X-SVN-Commit-Revision: 322177
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 18:01:29 -0000
        
        Author: kevans
        Date: Mon Aug  7 18:01:27 2017
        New Revision: 322177
        URL: https://svnweb.freebsd.org/changeset/base/322177
        
        Log:
          Respect SIMPLE_BACKUP_SUFFIX environment variable in indent(1)
          
          Instead of using a non-configurable ".BAK" suffix, respect the
          SIMPLE_BACKUP_SUFFIX environment variable also used by patch(1). This
          simplifies cleanup operations in some patch/indent workflows.
          
          Reviewed by:	cem (earlier version), emaste, pstef
          Approved by:	emaste (mentor)
          Differential Revision:	https://reviews.freebsd.org/D10921
        
        Modified:
          head/usr.bin/indent/indent.1
          head/usr.bin/indent/indent.c
        
        Modified: head/usr.bin/indent/indent.1
        ==============================================================================
        --- head/usr.bin/indent/indent.1	Mon Aug  7 17:30:22 2017	(r322176)
        +++ head/usr.bin/indent/indent.1	Mon Aug  7 18:01:27 2017	(r322177)
        @@ -30,7 +30,7 @@
         .\"	@(#)indent.1	8.1 (Berkeley) 7/1/93
         .\" $FreeBSD$
         .\"
        -.Dd July 25, 2017
        +.Dd August 7, 2017
         .Dt INDENT 1
         .Os
         .Sh NAME
        @@ -119,7 +119,10 @@ If
         is named
         .Sq Pa /blah/blah/file ,
         the backup file is named
        -.Sq Pa file.BAK .
        +.Sq Pa file.BAK
        +by default. The extension used for the backup file may be overridden using the
        +.Ev SIMPLE_BACKUP_SUFFIX
        +environment variable.
         .Pp
         If
         .Ar output-file
        
        Modified: head/usr.bin/indent/indent.c
        ==============================================================================
        --- head/usr.bin/indent/indent.c	Mon Aug  7 17:30:22 2017	(r322176)
        +++ head/usr.bin/indent/indent.c	Mon Aug  7 18:01:27 2017	(r322177)
        @@ -71,6 +71,8 @@ const char *in_name = "Standard Input";	/* will always
         					 * file */
         const char *out_name = "Standard Output";	/* will always point to name
         						 * of output file */
        +const char *simple_backup_suffix = ".BAK";	/* Suffix to use for backup
        +						 * files */
         char        bakfile[MAXPATHLEN] = "";
         
         int
        @@ -99,8 +101,8 @@ main(int argc, char **argv)
         
             int         last_else = 0;	/* true iff last keyword was an else */
             const char *profile_name = NULL;
        +    const char *envval = NULL;
         
        -
             /*-----------------------------------------------*\
             |		      INITIALIZATION		      |
             \*-----------------------------------------------*/
        @@ -160,6 +162,10 @@ main(int argc, char **argv)
             output = NULL;
             tabs_to_var = 0;
         
        +    envval = getenv("SIMPLE_BACKUP_SUFFIX");
        +    if (envval)
        +        simple_backup_suffix = envval;
        +
             /*--------------------------------------------------*\
             |   		COMMAND LINE SCAN		 |
             \*--------------------------------------------------*/
        @@ -1234,7 +1240,7 @@ bakcopy(void)
         	p--;
             if (*p == '/')
         	p++;
        -    sprintf(bakfile, "%s.BAK", p);
        +    sprintf(bakfile, "%s%s", p, simple_backup_suffix);
         
             /* copy in_name to backup file */
             bakchn = creat(bakfile, 0600);
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:18:28 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAF21DC2B80;
         Mon,  7 Aug 2017 19:18:28 +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 mx1.freebsd.org (Postfix) with ESMTPS id C63F27E81C;
         Mon,  7 Aug 2017 19:18:28 +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 v77JIShs052317;
         Mon, 7 Aug 2017 19:18:28 GMT (envelope-from mckusick@FreeBSD.org)
        Received: (from mckusick@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JISXB052316;
         Mon, 7 Aug 2017 19:18:28 GMT (envelope-from mckusick@FreeBSD.org)
        Message-Id: <201708071918.v77JISXB052316@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: mckusick set sender to
         mckusick@FreeBSD.org using -f
        From: Kirk McKusick 
        Date: Mon, 7 Aug 2017 19:18:28 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322178 - head/sys/geom/journal
        X-SVN-Group: head
        X-SVN-Commit-Author: mckusick
        X-SVN-Commit-Paths: head/sys/geom/journal
        X-SVN-Commit-Revision: 322178
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:18:29 -0000
        
        Author: mckusick
        Date: Mon Aug  7 19:18:27 2017
        New Revision: 322178
        URL: https://svnweb.freebsd.org/changeset/base/322178
        
        Log:
          sysctl kern.geom.journal.cache.limit shows negative value for FreeBSD/amd64
          system having over 4GB RAM. That's due to:
          
          1) the limit being u_int instead of u_long like vm.kmem_size (the limit is
             half of vm.kmem_size by default for amd64);
          2) sysctl handler g_journal_cache_limit_sysctl() using u_int instead of u_long.
          
          The fix is to replace u_int with u_long for the kern.geom.journal.cache.limit
          sysctl variable.
          
          PR: 198500
          Submitted by: Dr. Andreas Longwitz 
          Reported by: Eugene Grosbein
          Discussed with: kib
          MFC after: 1 week
        
        Modified:
          head/sys/geom/journal/g_journal.c
        
        Modified: head/sys/geom/journal/g_journal.c
        ==============================================================================
        --- head/sys/geom/journal/g_journal.c	Mon Aug  7 18:01:27 2017	(r322177)
        +++ head/sys/geom/journal/g_journal.c	Mon Aug  7 19:18:27 2017	(r322178)
        @@ -130,26 +130,26 @@ SYSCTL_PROC(_kern_geom_journal, OID_AUTO, record_entri
         SYSCTL_UINT(_kern_geom_journal, OID_AUTO, optimize, CTLFLAG_RW,
             &g_journal_do_optimize, 0, "Try to combine bios on flush and copy");
         
        -static u_int g_journal_cache_used = 0;
        -static u_int g_journal_cache_limit = 64 * 1024 * 1024;
        +static u_long g_journal_cache_used = 0;
        +static u_long g_journal_cache_limit = 64 * 1024 * 1024;
         static u_int g_journal_cache_divisor = 2;
         static u_int g_journal_cache_switch = 90;
         static u_int g_journal_cache_misses = 0;
         static u_int g_journal_cache_alloc_failures = 0;
        -static u_int g_journal_cache_low = 0;
        +static u_long g_journal_cache_low = 0;
         
         static SYSCTL_NODE(_kern_geom_journal, OID_AUTO, cache, CTLFLAG_RW, 0,
             "GEOM_JOURNAL cache");
        -SYSCTL_UINT(_kern_geom_journal_cache, OID_AUTO, used, CTLFLAG_RD,
        +SYSCTL_ULONG(_kern_geom_journal_cache, OID_AUTO, used, CTLFLAG_RD,
             &g_journal_cache_used, 0, "Number of allocated bytes");
         static int
         g_journal_cache_limit_sysctl(SYSCTL_HANDLER_ARGS)
         {
        -	u_int limit;
        +	u_long limit;
         	int error;
         
         	limit = g_journal_cache_limit;
        -	error = sysctl_handle_int(oidp, &limit, 0, req);
        +	error = sysctl_handle_long(oidp, &limit, 0, req);
         	if (error != 0 || req->newptr == NULL)
         		return (error);
         	g_journal_cache_limit = limit;
        @@ -157,7 +157,7 @@ g_journal_cache_limit_sysctl(SYSCTL_HANDLER_ARGS)
         	return (0);
         }
         SYSCTL_PROC(_kern_geom_journal_cache, OID_AUTO, limit,
        -    CTLTYPE_UINT | CTLFLAG_RWTUN, NULL, 0, g_journal_cache_limit_sysctl, "I",
        +    CTLTYPE_ULONG | CTLFLAG_RWTUN, NULL, 0, g_journal_cache_limit_sysctl, "I",
             "Maximum number of allocated bytes");
         SYSCTL_UINT(_kern_geom_journal_cache, OID_AUTO, divisor, CTLFLAG_RDTUN,
             &g_journal_cache_divisor, 0,
        @@ -3046,9 +3046,9 @@ g_journal_switcher(void *arg)
         			kproc_exit(0);
         		}
         		if (error == 0 && g_journal_sync_requested == 0) {
        -			GJ_DEBUG(1, "Out of cache, force switch (used=%u "
        -			    "limit=%u).", g_journal_cache_used,
        -			    g_journal_cache_limit);
        +			GJ_DEBUG(1, "Out of cache, force switch (used=%jd "
        +			    "limit=%jd).", (intmax_t)g_journal_cache_used,
        +			    (intmax_t)g_journal_cache_limit);
         		}
         		GJ_TIMER_START(1, &bt);
         		g_journal_do_switch(mp);
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:40:04 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62395DC4070;
         Mon,  7 Aug 2017 19:40:04 +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 mx1.freebsd.org (Postfix) with ESMTPS id 315BD7F332;
         Mon,  7 Aug 2017 19:40:04 +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 v77Je3Kl060493;
         Mon, 7 Aug 2017 19:40:03 GMT (envelope-from mckusick@FreeBSD.org)
        Received: (from mckusick@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77Je3g3060491;
         Mon, 7 Aug 2017 19:40:03 GMT (envelope-from mckusick@FreeBSD.org)
        Message-Id: <201708071940.v77Je3g3060491@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: mckusick set sender to
         mckusick@FreeBSD.org using -f
        From: Kirk McKusick 
        Date: Mon, 7 Aug 2017 19:40:03 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322179 - head/sys/geom/journal
        X-SVN-Group: head
        X-SVN-Commit-Author: mckusick
        X-SVN-Commit-Paths: head/sys/geom/journal
        X-SVN-Commit-Revision: 322179
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:40:04 -0000
        
        Author: mckusick
        Date: Mon Aug  7 19:40:03 2017
        New Revision: 322179
        URL: https://svnweb.freebsd.org/changeset/base/322179
        
        Log:
          gjournal is broken in handling its flush_queue. If we have 10 bio's
          in the flush_queue:
                   1 2 3 4 5 6 7 8 9 10
          and another 10 bio's go into the flush queue after only the first five
          bio's are removed from the flush queue, the queue should look like:
                   6 7 8 9 10 11 12 13 14 15 16 17 18 19 20,
          but because of the bug we end up with
                   6 11 12 13 14  15 16 17 18 19 20 7 8 9 10.
          So the sequence of the bio's is damaged in the flush queue (and
          therefore in the journal on disk !). This error can be triggered by
          ffs_snapshot() when a block is read with readblock() and gjournal finds
          this block in the broken flush queue before it goes to the correct
          active queue.
          
          The fix is to place all new blocks at the end of the queue.
          
          Submitted by: Dr. Andreas Longwitz 
          Discussed with: kib
          MFC after: 1 week
        
        Modified:
          head/sys/geom/journal/g_journal.c
          head/sys/geom/journal/g_journal.h
        
        Modified: head/sys/geom/journal/g_journal.c
        ==============================================================================
        --- head/sys/geom/journal/g_journal.c	Mon Aug  7 19:18:27 2017	(r322178)
        +++ head/sys/geom/journal/g_journal.c	Mon Aug  7 19:40:03 2017	(r322179)
        @@ -1261,7 +1261,7 @@ g_journal_flush(struct g_journal_softc *sc)
         	strlcpy(hdr.jrh_magic, GJ_RECORD_HEADER_MAGIC, sizeof(hdr.jrh_magic));
         
         	bioq = &sc->sc_active.jj_queue;
        -	pbp = sc->sc_flush_queue;
        +	GJQ_LAST(sc->sc_flush_queue, pbp);
         
         	fbp = g_alloc_bio();
         	fbp->bio_parent = NULL;
        
        Modified: head/sys/geom/journal/g_journal.h
        ==============================================================================
        --- head/sys/geom/journal/g_journal.h	Mon Aug  7 19:18:27 2017	(r322178)
        +++ head/sys/geom/journal/g_journal.h	Mon Aug  7 19:40:03 2017	(r322179)
        @@ -182,6 +182,17 @@ struct g_journal_softc {
         		(pbp)->bio_next = (bp);					\
         	}								\
         } while (0)
        +#define GJQ_LAST(head, bp) do {						\
        +	struct bio *_bp;						\
        +									\
        +	if ((head) == NULL) {						\
        +		(bp) = (head);						\
        +		break;							\
        +	}								\
        +	for (_bp = (head); _bp->bio_next != NULL; _bp = _bp->bio_next)	\
        +		continue;						\
        +	(bp) = (_bp);							\
        +} while (0)
         #define	GJQ_FIRST(head)	(head)
         #define	GJQ_REMOVE(head, bp)	do {					\
         	struct bio *_bp;						\
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:45:14 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55581DC44E8;
         Mon,  7 Aug 2017 19:45:14 +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 mx1.freebsd.org (Postfix) with ESMTPS id 17C327F761;
         Mon,  7 Aug 2017 19:45:14 +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 v77JjDDn064414;
         Mon, 7 Aug 2017 19:45:13 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjDaS064413;
         Mon, 7 Aug 2017 19:45:13 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjDaS064413@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:13 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322180 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322180
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:14 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:13 2017
        New Revision: 322180
        URL: https://svnweb.freebsd.org/changeset/base/322180
        
        Log:
          Document r321304, libarchive 3.3.2.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:40:03 2017	(r322179)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:13 2017	(r322180)
        @@ -214,9 +214,6 @@
               &man.zlib.3; has been updated to version
         	1.2.11.
         
        -      &man.libarchive.3; has been updated to
        -	version 3.3.1.
        -
               &man.ntpd.8; has been updated to version
         	4.2.8p10.
         
        @@ -225,6 +222,9 @@
         
               &man.tcsh.1; has been updated to version
         	6.20.00.
        +
        +      &man.libarchive.3; has been updated to
        +	version 3.3.2.
             
         
             
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:45:24 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CC1DDC4551;
         Mon,  7 Aug 2017 19:45:24 +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 mx1.freebsd.org (Postfix) with ESMTPS id 471CE7F7DF;
         Mon,  7 Aug 2017 19:45:24 +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 v77JjNtc064508;
         Mon, 7 Aug 2017 19:45:23 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjNcJ064507;
         Mon, 7 Aug 2017 19:45:23 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjNcJ064507@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:23 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322181 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322181
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:24 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:23 2017
        New Revision: 322181
        URL: https://svnweb.freebsd.org/changeset/base/322181
        
        Log:
          Document r321263, newsyslog(8) RFC5424 logging format.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:13 2017	(r322180)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:23 2017	(r322181)
        @@ -178,6 +178,12 @@
         	&man.src.conf.5; knob has been added, which when enabled
         	allows building &man.rpcbind.8; with
         	warmstart support.
        +
        +      The &man.newsyslog.8; utility has been
        +	updated to support logging to &man.syslogd.8; in a format
        +	compliant with RFC5424.  For more details, see the description
        +	for the T flag in
        +	&man.newsyslog.conf.5;.
             
         
             
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:45:27 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2668FDC4571;
         Mon,  7 Aug 2017 19:45:27 +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 mx1.freebsd.org (Postfix) with ESMTPS id E577C7F81A;
         Mon,  7 Aug 2017 19:45:26 +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 v77JjPMT064637;
         Mon, 7 Aug 2017 19:45:25 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjPdp064636;
         Mon, 7 Aug 2017 19:45:25 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjPdp064636@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:25 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322184 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322184
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:27 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:25 2017
        New Revision: 322184
        URL: https://svnweb.freebsd.org/changeset/base/322184
        
        Log:
          Move the r321263 entry to 'userland-programs' for consistency.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:24 2017	(r322183)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:25 2017	(r322184)
        @@ -178,12 +178,6 @@
         	&man.src.conf.5; knob has been added, which when enabled
         	allows building &man.rpcbind.8; with
         	warmstart support.
        -
        -      The &man.newsyslog.8; utility has been
        -	updated to support logging to &man.syslogd.8; in a format
        -	compliant with RFC5424.  For more details, see the description
        -	for the T flag in
        -	&man.newsyslog.conf.5;.
             
         
             
        @@ -215,6 +209,12 @@
         	/etc/syslog.d and
         	/usr/local/etc/syslog.d
         	by default.
        +
        +      The &man.newsyslog.8; utility has been
        +	updated to support logging to &man.syslogd.8; in a format
        +	compliant with RFC5424.  For more details, see the description
        +	for the T flag in
        +	&man.newsyslog.conf.5;.
             
         
             
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:45:26 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53CAEDC4565;
         Mon,  7 Aug 2017 19:45:26 +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 mx1.freebsd.org (Postfix) with ESMTPS id 206447F804;
         Mon,  7 Aug 2017 19:45:26 +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 v77JjP4O064594;
         Mon, 7 Aug 2017 19:45:25 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjPRl064593;
         Mon, 7 Aug 2017 19:45:25 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjPRl064593@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:25 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322183 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322183
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:26 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:24 2017
        New Revision: 322183
        URL: https://svnweb.freebsd.org/changeset/base/322183
        
        Log:
          Document r321234, syslogd(8) 'syslogd.d' directories.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:24 2017	(r322182)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:24 2017	(r322183)
        @@ -206,6 +206,15 @@
         	  class="directory">/etc/cron.d and /usr/local/etc/cron.d by
         	default.
        +
        +      The &man.syslogd.8; utility has been
        +	updated to add the include keyword which
        +	allows specifying a directory containing configuration files
        +	to be included in addition to &man.syslog.conf.5;.  The
        +	default &man.syslog.conf.5; has been updated to include
        +	/etc/syslog.d and
        +	/usr/local/etc/syslog.d
        +	by default.
             
         
             
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:45:28 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06289DC4580;
         Mon,  7 Aug 2017 19:45:28 +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 mx1.freebsd.org (Postfix) with ESMTPS id C25F57F82E;
         Mon,  7 Aug 2017 19:45:27 +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 v77JjQT7064681;
         Mon, 7 Aug 2017 19:45:26 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjQGN064680;
         Mon, 7 Aug 2017 19:45:26 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjQGN064680@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:26 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322185 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322185
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:28 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:26 2017
        New Revision: 322185
        URL: https://svnweb.freebsd.org/changeset/base/322185
        
        Log:
          Document r321216, savecore(8) unit change.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:25 2017	(r322184)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:26 2017	(r322185)
        @@ -215,6 +215,10 @@
         	compliant with RFC5424.  For more details, see the description
         	for the T flag in
         	&man.newsyslog.conf.5;.
        +
        +      The &man.savecore.8; utility has been
        +	updated to use KiB when outputting
        +	information regarding total space, free space, etc.
             
         
             
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:45:25 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81C82DC455C;
         Mon,  7 Aug 2017 19:45:25 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4E6B77F7F6;
         Mon,  7 Aug 2017 19:45:25 +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 v77JjOW0064551;
         Mon, 7 Aug 2017 19:45:24 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjO5l064550;
         Mon, 7 Aug 2017 19:45:24 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjO5l064550@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:24 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322182 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322182
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:25 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:24 2017
        New Revision: 322182
        URL: https://svnweb.freebsd.org/changeset/base/322182
        
        Log:
          Document r321242, cron(8) 'cron.d' directories.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:23 2017	(r322181)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:24 2017	(r322182)
        @@ -200,6 +200,12 @@
               The &man.cxgbetool.8; utility has been
         	added, providing command-line access to features and debugging
         	facilities of &man.cxgbe.4; devices.
        +
        +      The &man.cron.8; utility has been
        +	updated to add support for including files within /etc/cron.d and /usr/local/etc/cron.d by
        +	default.
             
         
             
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:45:28 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAF21DC458F;
         Mon,  7 Aug 2017 19:45:28 +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 mx1.freebsd.org (Postfix) with ESMTPS id 74CF37F840;
         Mon,  7 Aug 2017 19:45:28 +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 v77JjRrN064726;
         Mon, 7 Aug 2017 19:45:27 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjRUe064725;
         Mon, 7 Aug 2017 19:45:27 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjRUe064725@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:27 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322186 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322186
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:28 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:27 2017
        New Revision: 322186
        URL: https://svnweb.freebsd.org/changeset/base/322186
        
        Log:
          Document r321202, default EFI partition size increase.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:26 2017	(r322185)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:27 2017	(r322186)
        @@ -255,7 +255,10 @@
             
               Installation and Configuration Tools
         
        -       
        +      The
        +	default EFI partition created by
        +	&man.bsdinstall.8; has been increased from 800KB to
        +	200MB.
             
         
             
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:45:31 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 465CBDC45DB;
         Mon,  7 Aug 2017 19:45:31 +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 mx1.freebsd.org (Postfix) with ESMTPS id 028677F893;
         Mon,  7 Aug 2017 19:45:30 +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 v77JjUGM064857;
         Mon, 7 Aug 2017 19:45:30 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjUgd064856;
         Mon, 7 Aug 2017 19:45:30 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjUgd064856@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:30 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322189 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322189
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:31 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:29 2017
        New Revision: 322189
        URL: https://svnweb.freebsd.org/changeset/base/322189
        
        Log:
          Document r321024, kern.features.linux{,64} addition.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:29 2017	(r322188)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:29 2017	(r322189)
        @@ -339,7 +339,13 @@
             
               System Tuning and Controls
         
        -      
        +      The
        +	kern.features.linux and
        +	kern.features.linux64 flags have been
        +	added to the kern.features &man.sysctl.8;,
        +	which when set to 1, indicate the kernel
        +	is configured with compatibility for 32-bit and/or 64-bit
        +	linux binaries, respectively.
             
           
         
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:45:32 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAE51DC45F5;
         Mon,  7 Aug 2017 19:45:32 +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 mx1.freebsd.org (Postfix) with ESMTPS id ABAAB7F8CE;
         Mon,  7 Aug 2017 19:45:32 +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 v77JjVVq064944;
         Mon, 7 Aug 2017 19:45:31 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjVZU064943;
         Mon, 7 Aug 2017 19:45:31 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjVZU064943@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:31 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322191 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322191
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:33 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:31 2017
        New Revision: 322191
        URL: https://svnweb.freebsd.org/changeset/base/322191
        
        Log:
          Document r320824, gdb(1)/kgdb(1) deprecation.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:30 2017	(r322190)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:31 2017	(r322191)
        @@ -201,6 +201,12 @@
         	deprecated, and planned for removal in
         	&os; 12.0-RELEASE.
         
        +      The &man.gdb.1; and &man.kgdb.1;
        +	utilities have been marked as deprecated, and planned for
        +	removal from the base system in the future.  A newer version
        +	is available in the devel/gdb port.
        +
               The &man.cron.8; utility has been
         	updated to add support for including files within /etc/cron.d and 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3519DDC45E5;
         Mon,  7 Aug 2017 19:45:32 +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 mx1.freebsd.org (Postfix) with ESMTPS id ED87F7F8B2;
         Mon,  7 Aug 2017 19:45:31 +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 v77JjUe8064901;
         Mon, 7 Aug 2017 19:45:30 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjUEp064900;
         Mon, 7 Aug 2017 19:45:30 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjUEp064900@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:30 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322190 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322190
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:32 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:30 2017
        New Revision: 322190
        URL: https://svnweb.freebsd.org/changeset/base/322190
        
        Log:
          Document r320646, rcmds deprecation.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:29 2017	(r322189)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:30 2017	(r322190)
        @@ -195,6 +195,12 @@
         	added, providing command-line access to features and debugging
         	facilities of &man.cxgbe.4; devices.
         
        +      The &man.rcp.1;, &man.rlogin.1;,
        +	&man.rsh.1;, &man.ruptime.1;, &man.rwho.1;, &man.rlogind.8;,
        +	&man.rshd.8;, and &man.rwhod.8; utilities have been marked as
        +	deprecated, and planned for removal in
        +	&os; 12.0-RELEASE.
        +
               The &man.cron.8; utility has been
         	updated to add support for including files within /etc/cron.d and 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89752DC45AD;
         Mon,  7 Aug 2017 19:45:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id 52F757F85B;
         Mon,  7 Aug 2017 19:45:29 +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 v77JjSMt064770;
         Mon, 7 Aug 2017 19:45:28 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjSw5064769;
         Mon, 7 Aug 2017 19:45:28 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjSw5064769@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:28 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322187 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322187
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:29 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:28 2017
        New Revision: 322187
        URL: https://svnweb.freebsd.org/changeset/base/322187
        
        Log:
          Document r321198, vt(4) maximum framebuffer increase.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:27 2017	(r322186)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:28 2017	(r322187)
        @@ -314,6 +314,13 @@
               tuning, and system control parameters that are not otherwise
               categorized.
         
        +    
        +      Miscellaneous Kernel Changes
        +
        +      The &man.vt.4; driver has been updated,
        +	increasing the maximum framebuffer size.
        +    
        +
             
               Kernel Bug Fixes
         
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:45:33 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE873DC4612;
         Mon,  7 Aug 2017 19:45:33 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9047D7F8EE;
         Mon,  7 Aug 2017 19:45:33 +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 v77JjW6O064987;
         Mon, 7 Aug 2017 19:45:32 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjW9E064986;
         Mon, 7 Aug 2017 19:45:32 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjW9E064986@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:32 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322192 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322192
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:34 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:32 2017
        New Revision: 322192
        URL: https://svnweb.freebsd.org/changeset/base/322192
        
        Log:
          Document r321067, arcmsr(4) driver version 1.40.00.00.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:31 2017	(r322191)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:32 2017	(r322192)
        @@ -383,6 +383,10 @@
         	to support tri-mode
         	(SAS/SATA/PCIe)
         	Broadcom® storage adapters.
        +
        +      The &man.arcmsr.4; driver has been
        +	updated to version 1.40.00.00, adding support for ARC-1884
        +	SATA controllers.
             
         
             
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:45:34 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FC44DC4629;
         Mon,  7 Aug 2017 19:45:34 +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 mx1.freebsd.org (Postfix) with ESMTPS id 626C27F908;
         Mon,  7 Aug 2017 19:45:34 +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 v77JjXIL065030;
         Mon, 7 Aug 2017 19:45:33 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjX2X065029;
         Mon, 7 Aug 2017 19:45:33 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjX2X065029@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:33 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322193 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322193
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:34 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:33 2017
        New Revision: 322193
        URL: https://svnweb.freebsd.org/changeset/base/322193
        
        Log:
          Remove r321216 entry, part of which was reverted.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:32 2017	(r322192)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:33 2017	(r322193)
        @@ -227,10 +227,6 @@
         	compliant with RFC5424.  For more details, see the description
         	for the T flag in
         	&man.newsyslog.conf.5;.
        -
        -      The &man.savecore.8; utility has been
        -	updated to use KiB when outputting
        -	information regarding total space, free space, etc.
             
         
             
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 19:45:30 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63B75DC45CA;
         Mon,  7 Aug 2017 19:45:30 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2C4C57F878;
         Mon,  7 Aug 2017 19:45:30 +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 v77JjTKv064813;
         Mon, 7 Aug 2017 19:45:29 GMT (envelope-from gjb@FreeBSD.org)
        Received: (from gjb@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77JjTjY064812;
         Mon, 7 Aug 2017 19:45:29 GMT (envelope-from gjb@FreeBSD.org)
        Message-Id: <201708071945.v77JjTjY064812@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org
         using -f
        From: Glen Barber 
        Date: Mon, 7 Aug 2017 19:45:29 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322188 - stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: gjb
        X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes
        X-SVN-Commit-Revision: 322188
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 19:45:30 -0000
        
        Author: gjb
        Date: Mon Aug  7 19:45:29 2017
        New Revision: 322188
        URL: https://svnweb.freebsd.org/changeset/base/322188
        
        Log:
          Document r321031, NFS 'pNFS commit' support.
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        
        Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
        ==============================================================================
        --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:28 2017	(r322187)
        +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml	Mon Aug  7 19:45:29 2017	(r322188)
        @@ -462,6 +462,11 @@
         	prevent creating new TCP connections when
         	ERESTART is received from
         	&man.sosend.9;.
        +
        +      The NFS client has
        +	been updated to support pNFS
        +	commit through the
        +	DS.
             
         
             
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 21:12:29 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB6CDDC8FBE;
         Mon,  7 Aug 2017 21:12:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id 843FD83111;
         Mon,  7 Aug 2017 21:12:29 +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 v77LCSIK001385;
         Mon, 7 Aug 2017 21:12:28 GMT (envelope-from imp@FreeBSD.org)
        Received: (from imp@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LCSxL001381;
         Mon, 7 Aug 2017 21:12:28 GMT (envelope-from imp@FreeBSD.org)
        Message-Id: <201708072112.v77LCSxL001381@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org
         using -f
        From: Warner Losh 
        Date: Mon, 7 Aug 2017 21:12:28 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322196 - head/sys/geom
        X-SVN-Group: head
        X-SVN-Commit-Author: imp
        X-SVN-Commit-Paths: head/sys/geom
        X-SVN-Commit-Revision: 322196
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 21:12:29 -0000
        
        Author: imp
        Date: Mon Aug  7 21:12:28 2017
        New Revision: 322196
        URL: https://svnweb.freebsd.org/changeset/base/322196
        
        Log:
          Add aliasing concept to geom.
          
          Add an alias name list to geoms. Use them in geom_dev to create
          aliases. Previously, geom_dev would create an device node for the name
          of the geom. Now, additional nodes are created pointing back to the
          primary node with make_dev_alias_p. Aliases must be in place on the
          geom before any tasting occurs.
          
          Differential Revision: https://reviews.freebsd.org/D11873
        
        Modified:
          head/sys/geom/geom.h
          head/sys/geom/geom_dev.c
          head/sys/geom/geom_dump.c
          head/sys/geom/geom_subr.c
        
        Modified: head/sys/geom/geom.h
        ==============================================================================
        --- head/sys/geom/geom.h	Mon Aug  7 19:56:09 2017	(r322195)
        +++ head/sys/geom/geom.h	Mon Aug  7 21:12:28 2017	(r322196)
        @@ -120,6 +120,15 @@ struct g_class {
         	LIST_HEAD(,g_geom)	geom;
         };
         
        +/*
        + * The g_geom_alias is a list node for aliases for the geom name
        + * for device node creation.
        + */
        +struct g_geom_alias {
        +	LIST_ENTRY(g_geom_alias) ga_next;
        +	const char		*ga_alias;
        +};
        +
         #define G_VERSION_00	0x19950323
         #define G_VERSION_01	0x20041207	/* add fflag to g_ioctl_t */
         #define G_VERSION	G_VERSION_01
        @@ -150,6 +159,7 @@ struct g_geom {
         	unsigned		flags;
         #define	G_GEOM_WITHER		1
         #define	G_GEOM_VOLATILE_BIO	2
        +	LIST_HEAD(,g_geom_alias) aliases;
         };
         
         /*
        @@ -269,6 +279,7 @@ void g_destroy_provider(struct g_provider *pp);
         void g_detach(struct g_consumer *cp);
         void g_error_provider(struct g_provider *pp, int error);
         struct g_provider *g_provider_by_name(char const *arg);
        +void g_geom_add_alias(struct g_geom *gp, const char *alias);
         int g_getattr__(const char *attr, struct g_consumer *cp, void *var, int len);
         #define g_getattr(a, c, v) g_getattr__((a), (c), (v), sizeof *(v))
         int g_handleattr(struct bio *bp, const char *attribute, const void *val,
        
        Modified: head/sys/geom/geom_dev.c
        ==============================================================================
        --- head/sys/geom/geom_dev.c	Mon Aug  7 19:56:09 2017	(r322195)
        +++ head/sys/geom/geom_dev.c	Mon Aug  7 21:12:28 2017	(r322196)
        @@ -315,10 +315,11 @@ static struct g_geom *
         g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
         {
         	struct g_geom *gp;
        +	struct g_geom_alias *gap;
         	struct g_consumer *cp;
         	struct g_dev_softc *sc;
         	int error;
        -	struct cdev *dev;
        +	struct cdev *dev, *adev;
         	char buf[SPECNAMELEN + 6];
         
         	g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name);
        @@ -357,6 +358,23 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp,
         	g_dev_attrchanged(cp, "GEOM::physpath");
         	snprintf(buf, sizeof(buf), "cdev=%s", gp->name);
         	devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK);
        +	/*
        +	 * Now add all the aliases for this drive
        +	 */
        +	LIST_FOREACH(gap, &pp->geom->aliases, ga_next) {
        +		error = make_dev_alias_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &adev, dev,
        +		    "%s", gap->ga_alias);
        +		if (error) {
        +			printf("%s: make_dev_alias_p() failed (name=%s, error=%d)\n",
        +			    __func__, gap->ga_alias, error);
        +			continue;
        +		}
        +		adev->si_flags |= SI_UNMAPPED;
        +		adev->si_iosize_max = dev->si_iosize_max;
        +		adev->si_drv2 = dev->si_drv2;
        +		snprintf(buf, sizeof(buf), "cdev=%s", gap->ga_alias);
        +		devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK);
        +	}
         
         	return (gp);
         }
        
        Modified: head/sys/geom/geom_dump.c
        ==============================================================================
        --- head/sys/geom/geom_dump.c	Mon Aug  7 19:56:09 2017	(r322195)
        +++ head/sys/geom/geom_dump.c	Mon Aug  7 21:12:28 2017	(r322196)
        @@ -234,6 +234,7 @@ g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct
         {
         	struct g_consumer *cp2;
         	struct g_provider *pp2;
        +	struct g_geom_alias *gap;
         
         	sbuf_printf(sb, "    \n", gp);
         	sbuf_printf(sb, "      \n", gp->class);
        @@ -258,6 +259,11 @@ g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct
         		if (pp != NULL && pp != pp2)
         			continue;
         		g_conf_provider(sb, pp2);
        +	}
        +	LIST_FOREACH(gap, &gp->aliases, ga_next) {
        +		sbuf_printf(sb, "      \n");
        +		g_conf_printf_escaped(sb, "%s", gap->ga_alias);
        +		sbuf_printf(sb, "      \n");
         	}
         	sbuf_printf(sb, "    \n");
         }
        
        Modified: head/sys/geom/geom_subr.c
        ==============================================================================
        --- head/sys/geom/geom_subr.c	Mon Aug  7 19:56:09 2017	(r322195)
        +++ head/sys/geom/geom_subr.c	Mon Aug  7 21:12:28 2017	(r322196)
        @@ -347,6 +347,7 @@ g_new_geomf(struct g_class *mp, const char *fmt, ...)
         	gp->rank = 1;
         	LIST_INIT(&gp->consumer);
         	LIST_INIT(&gp->provider);
        +	LIST_INIT(&gp->aliases);
         	LIST_INSERT_HEAD(&mp->geom, gp, geom);
         	TAILQ_INSERT_HEAD(&geoms, gp, geoms);
         	strcpy(gp->name, sbuf_data(sb));
        @@ -367,6 +368,7 @@ g_new_geomf(struct g_class *mp, const char *fmt, ...)
         void
         g_destroy_geom(struct g_geom *gp)
         {
        +	struct g_geom_alias *gap, *gaptmp;
         
         	g_topology_assert();
         	G_VALID_GEOM(gp);
        @@ -380,6 +382,8 @@ g_destroy_geom(struct g_geom *gp)
         	g_cancel_event(gp);
         	LIST_REMOVE(gp, geom);
         	TAILQ_REMOVE(&geoms, gp, geoms);
        +	LIST_FOREACH_SAFE(gap, &gp->aliases, ga_next, gaptmp)
        +		g_free(gap);
         	g_free(gp->name);
         	g_free(gp);
         }
        @@ -1210,6 +1214,18 @@ g_compare_names(const char *namea, const char *nameb)
         	if (strcmp(namea + deva, nameb + devb) == 0)
         		return (1);
         	return (0);
        +}
        +
        +void
        +g_geom_add_alias(struct g_geom *gp, const char *alias)
        +{
        +	struct g_geom_alias *gap;
        +
        +	gap = (struct g_geom_alias *)g_malloc(
        +		sizeof(struct g_geom_alias) + strlen(alias) + 1, M_WAITOK);
        +	strcpy((char *)(gap + 1), alias);
        +	gap->ga_alias = (const char *)(gap + 1);
        +	LIST_INSERT_HEAD(&gp->aliases, gap, ga_next);
         }
         
         #if defined(DIAGNOSTIC) || defined(DDB)
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 21:12:34 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id B534BDC8FDA;
         Mon,  7 Aug 2017 21:12:34 +0000 (UTC) (envelope-from imp@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id 7876C83126;
         Mon,  7 Aug 2017 21:12:34 +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 v77LCXof001438;
         Mon, 7 Aug 2017 21:12:33 GMT (envelope-from imp@FreeBSD.org)
        Received: (from imp@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LCXcH001437;
         Mon, 7 Aug 2017 21:12:33 GMT (envelope-from imp@FreeBSD.org)
        Message-Id: <201708072112.v77LCXcH001437@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org
         using -f
        From: Warner Losh 
        Date: Mon, 7 Aug 2017 21:12:33 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322197 - head/sys/geom/part
        X-SVN-Group: head
        X-SVN-Commit-Author: imp
        X-SVN-Commit-Paths: head/sys/geom/part
        X-SVN-Commit-Revision: 322197
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 21:12:34 -0000
        
        Author: imp
        Date: Mon Aug  7 21:12:33 2017
        New Revision: 322197
        URL: https://svnweb.freebsd.org/changeset/base/322197
        
        Log:
          Add alias support to gpart.
          
          When we're creating new providers for each of the partitions, add
          aliases to the geom before we create the provider so when geom_dev
          tastes the provider, the aliases are in place so the proper /dev
          entries are created. So foo5p6 gets created as an alias for bar5p6
          when foo is an alias for bar in the geom we're partitioning with
          g_part. This also copies aliases from the container geom (eg disk) to
          the label geom (the disk with GPT partitioning) so that aliases nest
          properly.
          
          Differential Revision: https://reviews.freebsd.org/D11873
        
        Modified:
          head/sys/geom/part/g_part.c
        
        Modified: head/sys/geom/part/g_part.c
        ==============================================================================
        --- head/sys/geom/part/g_part.c	Mon Aug  7 21:12:28 2017	(r322196)
        +++ head/sys/geom/part/g_part.c	Mon Aug  7 21:12:33 2017	(r322197)
        @@ -429,6 +429,7 @@ g_part_new_provider(struct g_geom *gp, struct g_part_t
         	struct g_consumer *cp;
         	struct g_provider *pp;
         	struct sbuf *sb;
        +	struct g_geom_alias *gap;
         	off_t offset;
         
         	cp = LIST_FIRST(&gp->consumer);
        @@ -439,6 +440,19 @@ g_part_new_provider(struct g_geom *gp, struct g_part_t
         		entry->gpe_offset = offset;
         
         	if (entry->gpe_pp == NULL) {
        +		/*
        +		 * Add aliases to the geom before we create the provider so that
        +		 * geom_dev can taste it with all the aliases in place so all
        +		 * the aliased dev_t instances get created for each partition
        +		 * (eg foo5p7 gets created for bar5p7 when foo is an alias of bar).
        +		 */
        +		LIST_FOREACH(gap, &table->gpt_gp->aliases, ga_next) {
        +			sb = sbuf_new_auto();
        +			G_PART_FULLNAME(table, entry, sb, gap->ga_alias);
        +			sbuf_finish(sb);
        +			g_geom_add_alias(gp, sbuf_data(sb));
        +			sbuf_delete(sb);
        +		}
         		sb = sbuf_new_auto();
         		G_PART_FULLNAME(table, entry, sb, gp->name);
         		sbuf_finish(sb);
        @@ -1901,6 +1915,7 @@ g_part_taste(struct g_class *mp, struct g_provider *pp
         	struct g_part_entry *entry;
         	struct g_part_table *table;
         	struct root_hold_token *rht;
        +	struct g_geom_alias *gap;
         	int attr, depth;
         	int error;
         
        @@ -1913,10 +1928,12 @@ g_part_taste(struct g_class *mp, struct g_provider *pp
         
         	/*
         	 * Create a GEOM with consumer and hook it up to the provider.
        -	 * With that we become part of the topology. Optain read access
        +	 * With that we become part of the topology. Obtain read access
         	 * to the provider.
         	 */
         	gp = g_new_geomf(mp, "%s", pp->name);
        +	LIST_FOREACH(gap, &pp->geom->aliases, ga_next)
        +		g_geom_add_alias(gp, gap->ga_alias);
         	cp = g_new_consumer(gp);
         	cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
         	error = g_attach(cp, pp);
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 21:12:40 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CEBFDC9022;
         Mon,  7 Aug 2017 21:12:40 +0000 (UTC) (envelope-from imp@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id DAD2083196;
         Mon,  7 Aug 2017 21:12:39 +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 v77LCdEt001492;
         Mon, 7 Aug 2017 21:12:39 GMT (envelope-from imp@FreeBSD.org)
        Received: (from imp@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LCcXm001489;
         Mon, 7 Aug 2017 21:12:38 GMT (envelope-from imp@FreeBSD.org)
        Message-Id: <201708072112.v77LCcXm001489@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org
         using -f
        From: Warner Losh 
        Date: Mon, 7 Aug 2017 21:12:38 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322198 - in head: share/man/man9 sys/geom
        X-SVN-Group: head
        X-SVN-Commit-Author: imp
        X-SVN-Commit-Paths: in head: share/man/man9 sys/geom
        X-SVN-Commit-Revision: 322198
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 21:12:40 -0000
        
        Author: imp
        Date: Mon Aug  7 21:12:38 2017
        New Revision: 322198
        URL: https://svnweb.freebsd.org/changeset/base/322198
        
        Log:
          Expose API to allow disks to ask for alias names in devfs.
          
          Implement disk_add_alias to allow aliases to be added to disks. All
          disk have a primary name (say "foo") can also have secondary names
          (say "bar") such that all instances of "foo" also have a "bar"
          alias. So if you have foo0, foo0p1, foo1, foo1s1 and foo1s1a nodes
          created by the foo driver and gpart, device nodes bar0, bar0p1, bar1,
          bar1s1 and bar1s1a will appear as symlinks back to the original nodes.
          This generalizes to multiple aliases. However, since the unit number
          follows the primary name, multiple device drivers can't create the
          same aliases unless those drives coorinate the unit number space (eg
          you couldn't add an alias 'disk' to both 'da' and 'ada' because it's
          possible to have da0 and ada0, because 'disk0' is ambiguous).
          
          Differential Revision: https://reviews.freebsd.org/D11873
        
        Modified:
          head/share/man/man9/disk.9
          head/sys/geom/geom_disk.c
          head/sys/geom/geom_disk.h
        
        Modified: head/share/man/man9/disk.9
        ==============================================================================
        --- head/share/man/man9/disk.9	Mon Aug  7 21:12:33 2017	(r322197)
        +++ head/share/man/man9/disk.9	Mon Aug  7 21:12:38 2017	(r322198)
        @@ -27,7 +27,7 @@
         .\"
         .\" $FreeBSD$
         .\"
        -.Dd October 30, 2012
        +.Dd August 3, 2017
         .Dt DISK 9
         .Os
         .Sh NAME
        @@ -45,6 +45,8 @@
         .Fn disk_destroy "struct disk *disk"
         .Ft int
         .Fn disk_resize "struct disk *disk" "int flags"
        +.Ft void
        +.Fn disk_add_alias "struct disk *disk" "const char *alias"
         .Sh DESCRIPTION
         The disk storage API permits kernel device drivers providing access to
         disk-like storage devices to advertise the device to other kernel
        @@ -69,6 +71,20 @@ function,
         fill in the fields and call
         .Fn disk_create
         when the device is ready to service requests.
        +.Fn disk_add_alias
        +adds an alias for the disk and must be called before
        +.Fn disk_create ,
        +but may be called multiple times.
        +For each alias added, a device node will be created with
        +.Xr make_dev_alias 9
        +in the same way primary device nodes are created with
        +.Xr make_dev 9
        +for
        +.Va d_name
        +and
        +.Va d_unit .
        +Care should be taken to ensure that only one driver creates aliases
        +for any given name.
         .Fn disk_resize
         can be called by the driver after modifying
         .Va d_mediasize
        @@ -227,7 +243,13 @@ structure for this disk device.
         .El
         .Sh SEE ALSO
         .Xr GEOM 4 ,
        -.Xr devfs 5
        +.Xr devfs 5 ,
        +.Xr MAKE_DEV 9
         .Sh AUTHORS
         This manual page was written by
         .An Robert Watson .
        +.Sh BUGS
        +Disk aliases are not a general purpose aliasing mechanism, but are
        +intended only to ease the transition from one name to another.
        +They can be used to ensure that nvd0 and nda0 are the same thing.
        +They cannot be used to implement the diskX concept from macOS.
        
        Modified: head/sys/geom/geom_disk.c
        ==============================================================================
        --- head/sys/geom/geom_disk.c	Mon Aug  7 21:12:33 2017	(r322197)
        +++ head/sys/geom/geom_disk.c	Mon Aug  7 21:12:38 2017	(r322198)
        @@ -676,6 +676,7 @@ g_disk_create(void *arg, int flag)
         	struct g_provider *pp;
         	struct disk *dp;
         	struct g_disk_softc *sc;
        +	struct disk_alias *dap;
         	char tmpstr[80];
         
         	if (flag == EV_CANCEL)
        @@ -704,6 +705,10 @@ g_disk_create(void *arg, int flag)
         	sc->dp = dp;
         	gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit);
         	gp->softc = sc;
        +	LIST_FOREACH(dap, &dp->d_aliases, da_next) {
        +		snprintf(tmpstr, sizeof(tmpstr), "%s%d", dap->da_alias, dp->d_unit);
        +		g_geom_add_alias(gp, tmpstr);
        +	}
         	pp = g_new_providerf(gp, "%s", gp->name);
         	devstat_remove_entry(pp->stat);
         	pp->stat = NULL;
        @@ -791,6 +796,7 @@ g_disk_destroy(void *ptr, int flag)
         	struct disk *dp;
         	struct g_geom *gp;
         	struct g_disk_softc *sc;
        +	struct disk_alias *dap, *daptmp;
         
         	g_topology_assert();
         	dp = ptr;
        @@ -802,6 +808,8 @@ g_disk_destroy(void *ptr, int flag)
         		dp->d_geom = NULL;
         		g_wither_geom(gp, ENXIO);
         	}
        +	LIST_FOREACH_SAFE(dap, &dp->d_aliases, da_next, daptmp)
        +		g_free(dap);
         
         	g_free(dp);
         }
        @@ -834,8 +842,11 @@ g_disk_ident_adjust(char *ident, size_t size)
         struct disk *
         disk_alloc(void)
         {
        +	struct disk *dp;
         
        -	return (g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO));
        +	dp = g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO);
        +	LIST_INIT(&dp->d_aliases);
        +	return (dp);
         }
         
         void
        @@ -882,6 +893,18 @@ disk_destroy(struct disk *dp)
         	if (dp->d_devstat != NULL)
         		devstat_remove_entry(dp->d_devstat);
         	g_post_event(g_disk_destroy, dp, M_WAITOK, NULL);
        +}
        +
        +void
        +disk_add_alias(struct disk *dp, const char *name)
        +{
        +	struct disk_alias *dap;
        +
        +	dap = (struct disk_alias *)g_malloc(
        +		sizeof(struct disk_alias) + strlen(name) + 1, M_WAITOK);
        +	strcpy((char *)(dap + 1), name);
        +	dap->da_alias = (const char *)(dap + 1);
        +	LIST_INSERT_HEAD(&dp->d_aliases, dap, da_next);
         }
         
         void
        
        Modified: head/sys/geom/geom_disk.h
        ==============================================================================
        --- head/sys/geom/geom_disk.h	Mon Aug  7 21:12:33 2017	(r322197)
        +++ head/sys/geom/geom_disk.h	Mon Aug  7 21:12:38 2017	(r322198)
        @@ -66,6 +66,11 @@ typedef enum {
         	DISK_INIT_DONE
         } disk_init_level;
         
        +struct disk_alias {
        +	LIST_ENTRY(disk_alias)	da_next;
        +	const char		*da_alias;
        +};
        +
         struct disk {
         	/* Fields which are private to geom_disk */
         	struct g_geom		*d_geom;
        @@ -109,6 +114,9 @@ struct disk {
         
         	/* Fields private to the driver */
         	void			*d_drv1;
        +
        +	/* Fields private to geom_disk, to be moved on next version bump */
        +	LIST_HEAD(,disk_alias)	d_aliases;
         };
         
         #define DISKFLAG_RESERVED	0x1	/* Was NEEDSGIANT */
        @@ -132,6 +140,7 @@ void disk_attr_changed(struct disk *dp, const char *at
         void disk_media_changed(struct disk *dp, int flag);
         void disk_media_gone(struct disk *dp, int flag);
         int disk_resize(struct disk *dp, int flag);
        +void disk_add_alias(struct disk *disk, const char *);
         
         #define DISK_VERSION_00		0x58561059
         #define DISK_VERSION_01		0x5856105a
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 21:12:45 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E778DC9074;
         Mon,  7 Aug 2017 21:12:45 +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 mx1.freebsd.org (Postfix) with ESMTPS id D0DD68322F;
         Mon,  7 Aug 2017 21:12:44 +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 v77LChjK001555;
         Mon, 7 Aug 2017 21:12:43 GMT (envelope-from imp@FreeBSD.org)
        Received: (from imp@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LChcT001554;
         Mon, 7 Aug 2017 21:12:43 GMT (envelope-from imp@FreeBSD.org)
        Message-Id: <201708072112.v77LChcT001554@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org
         using -f
        From: Warner Losh 
        Date: Mon, 7 Aug 2017 21:12:43 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322199 - head/sys/cam/nvme
        X-SVN-Group: head
        X-SVN-Commit-Author: imp
        X-SVN-Commit-Paths: head/sys/cam/nvme
        X-SVN-Commit-Revision: 322199
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 21:12:45 -0000
        
        Author: imp
        Date: Mon Aug  7 21:12:43 2017
        New Revision: 322199
        URL: https://svnweb.freebsd.org/changeset/base/322199
        
        Log:
          Add nvd alias to nda ndoes.
          
          All ndaX and ndaXpY nodes will appear as nvdX and nvdXpY as well
          (through symlinks in devfs via the normal disk aliasing mechanism in
          GEOM).
          
          Differential Revision: https://reviews.freebsd.org/D11873
        
        Modified:
          head/sys/cam/nvme/nvme_da.c
        
        Modified: head/sys/cam/nvme/nvme_da.c
        ==============================================================================
        --- head/sys/cam/nvme/nvme_da.c	Mon Aug  7 21:12:38 2017	(r322198)
        +++ head/sys/cam/nvme/nvme_da.c	Mon Aug  7 21:12:43 2017	(r322199)
        @@ -808,6 +808,10 @@ ndaregister(struct cam_periph *periph, void *arg)
         	    DEVSTAT_ALL_SUPPORTED,
         	    DEVSTAT_TYPE_DIRECT | XPORT_DEVSTAT_TYPE(cpi.transport),
         	    DEVSTAT_PRIORITY_DISK);
        +	/*
        +	 * Add alias for older nvd drives to ease transition.
        +	 */
        +	disk_add_alias(disk, "nvd");
         
         	/*
         	 * Acquire a reference to the periph before we register with GEOM.
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 21:23:55 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9EBBDC99ED;
         Mon,  7 Aug 2017 21:23:55 +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 mx1.freebsd.org (Postfix) with ESMTPS id B454B83ACF;
         Mon,  7 Aug 2017 21:23:55 +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 v77LNs3C005749;
         Mon, 7 Aug 2017 21:23:54 GMT (envelope-from imp@FreeBSD.org)
        Received: (from imp@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LNsfC005748;
         Mon, 7 Aug 2017 21:23:54 GMT (envelope-from imp@FreeBSD.org)
        Message-Id: <201708072123.v77LNsfC005748@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org
         using -f
        From: Warner Losh 
        Date: Mon, 7 Aug 2017 21:23:54 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322200 - head/sbin/fsck_ffs
        X-SVN-Group: head
        X-SVN-Commit-Author: imp
        X-SVN-Commit-Paths: head/sbin/fsck_ffs
        X-SVN-Commit-Revision: 322200
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 21:23:56 -0000
        
        Author: imp
        Date: Mon Aug  7 21:23:54 2017
        New Revision: 322200
        URL: https://svnweb.freebsd.org/changeset/base/322200
        
        Log:
          Make it possible to ignore superblock mismatch. This will not fix such
          a mismatch, but will allow fsck to continue when the last alternate
          superblock gets corrupted somehow.
          
          Also, remove searching for alternate super blocks. It should have been
          removed two years ago with r276737 by imp@. Leave minor vestiges in
          place in case someone wants to solve the hard problem of knowing where
          altnernate superblocks live without access to data formerly stored in
          disklabels.
          
          Differential Revision: https://reviews.freebsd.org/D11589
        
        Modified:
          head/sbin/fsck_ffs/setup.c
        
        Modified: head/sbin/fsck_ffs/setup.c
        ==============================================================================
        --- head/sbin/fsck_ffs/setup.c	Mon Aug  7 21:12:43 2017	(r322199)
        +++ head/sbin/fsck_ffs/setup.c	Mon Aug  7 21:23:54 2017	(r322200)
        @@ -68,10 +68,9 @@ static void badsb(int listerr, const char *s);
         int
         setup(char *dev)
         {
        -	long cg, asked, i, j;
        +	long asked, i, j;
         	long bmapsize;
         	struct stat statb;
        -	struct fs proto;
         	size_t size;
         
         	havesb = 0;
        @@ -178,26 +177,8 @@ setup(char *dev)
         		skipclean = 0;
         		if (bflag || preen)
         			return(0);
        -		if (reply("LOOK FOR ALTERNATE SUPERBLOCKS") == 0)
        -			return (0);
        -		for (cg = 0; cg < proto.fs_ncg; cg++) {
        -			bflag = fsbtodb(&proto, cgsblock(&proto, cg));
        -			if (readsb(0) != 0)
        -				break;
        -		}
        -		if (cg >= proto.fs_ncg) {
        -			printf("%s %s\n%s %s\n%s %s\n",
        -				"SEARCH FOR ALTERNATE SUPER-BLOCK",
        -				"FAILED. YOU MUST USE THE",
        -				"-b OPTION TO FSCK TO SPECIFY THE",
        -				"LOCATION OF AN ALTERNATE",
        -				"SUPER-BLOCK TO SUPPLY NEEDED",
        -				"INFORMATION; SEE fsck_ffs(8).");
        -			bflag = 0;
        -			return(0);
        -		}
        -		pwarn("USING ALTERNATE SUPERBLOCK AT %jd\n", bflag);
        -		bflag = 0;
        +		/* Looking for alternates is hard punt for now but retain structure */
        +		return (0);
         	}
         	if (skipclean && ckclean && sblock.fs_clean) {
         		pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n");
        @@ -393,9 +374,16 @@ readsb(int listerr)
         	    altsblock.fs_ipg != sblock.fs_ipg ||
         	    altsblock.fs_fpg != sblock.fs_fpg ||
         	    altsblock.fs_magic != sblock.fs_magic) {
        -		badsb(listerr,
        -		"VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE");
        -		return (0);
        +		if (listerr == 0)
        +			return (0);
        +		if (preen)
        +			printf("%s: ", cdevname);
        +		printf(
        +		    "VALUES IN SUPER BLOCK LSB=%jd DISAGREE WITH THOSE IN\n"
        +		    "FIRST ALTERNATE LSB=%jd\n",
        +		    sblk.b_bno, asblk.b_bno);
        +		if (reply("IGNORE ALTERNATE SUPER BLOCK") == 0)
        +			return (0);
         	}
         out:
         	/*
        @@ -415,17 +403,6 @@ out:
         	}
         	havesb = 1;
         	return (1);
        -}
        -
        -static void
        -badsb(int listerr, const char *s)
        -{
        -
        -	if (!listerr)
        -		return;
        -	if (preen)
        -		printf("%s: ", cdevname);
        -	pfatal("BAD SUPER BLOCK: %s\n", s);
         }
         
         void
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 21:24:01 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EBF6DC9A36;
         Mon,  7 Aug 2017 21:24:01 +0000 (UTC) (envelope-from imp@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id F02AC83B35;
         Mon,  7 Aug 2017 21:24:00 +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 v77LO0sl005806;
         Mon, 7 Aug 2017 21:24:00 GMT (envelope-from imp@FreeBSD.org)
        Received: (from imp@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LO0fj005805;
         Mon, 7 Aug 2017 21:24:00 GMT (envelope-from imp@FreeBSD.org)
        Message-Id: <201708072124.v77LO0fj005805@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org
         using -f
        From: Warner Losh 
        Date: Mon, 7 Aug 2017 21:24:00 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322201 - head/sbin/fsck_ffs
        X-SVN-Group: head
        X-SVN-Commit-Author: imp
        X-SVN-Commit-Paths: head/sbin/fsck_ffs
        X-SVN-Commit-Revision: 322201
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 21:24:01 -0000
        
        Author: imp
        Date: Mon Aug  7 21:23:59 2017
        New Revision: 322201
        URL: https://svnweb.freebsd.org/changeset/base/322201
        
        Log:
          In debug mode, print the differences between the superblock and
          alternate superblock when the values disagree and we're going to
          reject it.
          
          Differential Revision: https://reviews.freebsd.org/D11589
        
        Modified:
          head/sbin/fsck_ffs/setup.c
        
        Modified: head/sbin/fsck_ffs/setup.c
        ==============================================================================
        --- head/sbin/fsck_ffs/setup.c	Mon Aug  7 21:23:54 2017	(r322200)
        +++ head/sbin/fsck_ffs/setup.c	Mon Aug  7 21:23:59 2017	(r322201)
        @@ -294,7 +294,7 @@ int
         readsb(int listerr)
         {
         	ufs2_daddr_t super;
        -	int i;
        +	int i, bad;
         
         	if (bflag) {
         		super = bflag;
        @@ -344,43 +344,53 @@ readsb(int listerr)
         	dev_bsize = sblock.fs_fsize / fsbtodb(&sblock, 1);
         	sblk.b_bno = super / dev_bsize;
         	sblk.b_size = SBLOCKSIZE;
        -	if (bflag)
        -		goto out;
         	/*
         	 * Compare all fields that should not differ in alternate super block.
         	 * When an alternate super-block is specified this check is skipped.
         	 */
        +	if (bflag)
        +		goto out;
         	getblk(&asblk, cgsblock(&sblock, sblock.fs_ncg - 1), sblock.fs_sbsize);
         	if (asblk.b_errs)
         		return (0);
        -	if (altsblock.fs_sblkno != sblock.fs_sblkno ||
        -	    altsblock.fs_cblkno != sblock.fs_cblkno ||
        -	    altsblock.fs_iblkno != sblock.fs_iblkno ||
        -	    altsblock.fs_dblkno != sblock.fs_dblkno ||
        -	    altsblock.fs_ncg != sblock.fs_ncg ||
        -	    altsblock.fs_bsize != sblock.fs_bsize ||
        -	    altsblock.fs_fsize != sblock.fs_fsize ||
        -	    altsblock.fs_frag != sblock.fs_frag ||
        -	    altsblock.fs_bmask != sblock.fs_bmask ||
        -	    altsblock.fs_fmask != sblock.fs_fmask ||
        -	    altsblock.fs_bshift != sblock.fs_bshift ||
        -	    altsblock.fs_fshift != sblock.fs_fshift ||
        -	    altsblock.fs_fragshift != sblock.fs_fragshift ||
        -	    altsblock.fs_fsbtodb != sblock.fs_fsbtodb ||
        -	    altsblock.fs_sbsize != sblock.fs_sbsize ||
        -	    altsblock.fs_nindir != sblock.fs_nindir ||
        -	    altsblock.fs_inopb != sblock.fs_inopb ||
        -	    altsblock.fs_cssize != sblock.fs_cssize ||
        -	    altsblock.fs_ipg != sblock.fs_ipg ||
        -	    altsblock.fs_fpg != sblock.fs_fpg ||
        -	    altsblock.fs_magic != sblock.fs_magic) {
        +	bad = 0;
        +#define CHK(x, y)				\
        +	if (altsblock.x != sblock.x) {		\
        +		bad++;				\
        +		if (listerr && debug)		\
        +			printf("SUPER BLOCK VS ALTERNATE MISMATCH %s: " y " vs " y "\n", \
        +			    #x, (intmax_t)sblock.x, (intmax_t)altsblock.x); \
        +	}
        +	CHK(fs_sblkno, "%jd");
        +	CHK(fs_cblkno, "%jd");
        +	CHK(fs_iblkno, "%jd");
        +	CHK(fs_dblkno, "%jd");
        +	CHK(fs_ncg, "%jd");
        +	CHK(fs_bsize, "%jd");
        +	CHK(fs_fsize, "%jd");
        +	CHK(fs_frag, "%jd");
        +	CHK(fs_bmask, "%#jx");
        +	CHK(fs_fmask, "%#jx");
        +	CHK(fs_bshift, "%jd");
        +	CHK(fs_fshift, "%jd");
        +	CHK(fs_fragshift, "%jd");
        +	CHK(fs_fsbtodb, "%jd");
        +	CHK(fs_sbsize, "%jd");
        +	CHK(fs_nindir, "%jd");
        +	CHK(fs_inopb, "%jd");
        +	CHK(fs_cssize, "%jd");
        +	CHK(fs_ipg, "%jd");
        +	CHK(fs_fpg, "%jd");
        +	CHK(fs_magic, "%#jx");
        +#undef CHK
        +	if (bad) {
         		if (listerr == 0)
         			return (0);
         		if (preen)
         			printf("%s: ", cdevname);
         		printf(
         		    "VALUES IN SUPER BLOCK LSB=%jd DISAGREE WITH THOSE IN\n"
        -		    "FIRST ALTERNATE LSB=%jd\n",
        +		    "LAST ALTERNATE LSB=%jd\n",
         		    sblk.b_bno, asblk.b_bno);
         		if (reply("IGNORE ALTERNATE SUPER BLOCK") == 0)
         			return (0);
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 21:29:29 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C457DC9E71;
         Mon,  7 Aug 2017 21:29:29 +0000 (UTC)
         (envelope-from nwhitehorn@freebsd.org)
        Received: from c.mail.sonic.net (c.mail.sonic.net [64.142.111.80])
         (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id EC1C583F1C;
         Mon,  7 Aug 2017 21:29:28 +0000 (UTC)
         (envelope-from nwhitehorn@freebsd.org)
        Received: from aurora.physics.berkeley.edu (aurora.physics.berkeley.edu
         [128.32.117.67]) (authenticated bits=0)
         by c.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id v77LJ9at020655
         (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);
         Mon, 7 Aug 2017 14:19:09 -0700
        Subject: Re: svn commit: r322198 - in head: share/man/man9 sys/geom
        To: Warner Losh , src-committers@freebsd.org,
         svn-src-all@freebsd.org, svn-src-head@freebsd.org
        References: <201708072112.v77LCcXm001489@repo.freebsd.org>
        From: Nathan Whitehorn 
        Message-ID: 
        Date: Mon, 7 Aug 2017 14:19:08 -0700
        User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101
         Thunderbird/52.2.1
        MIME-Version: 1.0
        In-Reply-To: <201708072112.v77LCcXm001489@repo.freebsd.org>
        Content-Type: text/plain; charset=utf-8; format=flowed
        Content-Transfer-Encoding: 7bit
        Content-Language: en-US
        X-Sonic-CAuth: UmFuZG9tSVZanR1XNDjwUc+d68kKRHx9cZPgvD2jA9A4qr1UorDYX7HUzHVija80Qsyyp6dGYx6Ffx1jBBljpnoYyED+uRJF4Nw54js4q08=
        X-Sonic-ID: C;kngODbZ75xGdWMGbEi49jA== M;4uhNDbZ75xGdWMGbEi49jA==
        X-Spam-Flag: No
        X-Sonic-Spam-Details: 0.0/5.0 by cerberusd
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 21:29:29 -0000
        
        It would be really nice to let gpart provide aliases correct to 
        partition labels, which would fix the existing racy and unreliable 
        glabel code. Do you see any obstacles to using this code for that?
        -Nathan
        
        On 08/07/17 14:12, Warner Losh wrote:
        > Author: imp
        > Date: Mon Aug  7 21:12:38 2017
        > New Revision: 322198
        > URL: https://svnweb.freebsd.org/changeset/base/322198
        >
        > Log:
        >    Expose API to allow disks to ask for alias names in devfs.
        >    
        >    Implement disk_add_alias to allow aliases to be added to disks. All
        >    disk have a primary name (say "foo") can also have secondary names
        >    (say "bar") such that all instances of "foo" also have a "bar"
        >    alias. So if you have foo0, foo0p1, foo1, foo1s1 and foo1s1a nodes
        >    created by the foo driver and gpart, device nodes bar0, bar0p1, bar1,
        >    bar1s1 and bar1s1a will appear as symlinks back to the original nodes.
        >    This generalizes to multiple aliases. However, since the unit number
        >    follows the primary name, multiple device drivers can't create the
        >    same aliases unless those drives coorinate the unit number space (eg
        >    you couldn't add an alias 'disk' to both 'da' and 'ada' because it's
        >    possible to have da0 and ada0, because 'disk0' is ambiguous).
        >    
        >    Differential Revision: https://reviews.freebsd.org/D11873
        >
        > Modified:
        >    head/share/man/man9/disk.9
        >    head/sys/geom/geom_disk.c
        >    head/sys/geom/geom_disk.h
        >
        > Modified: head/share/man/man9/disk.9
        > ==============================================================================
        > --- head/share/man/man9/disk.9	Mon Aug  7 21:12:33 2017	(r322197)
        > +++ head/share/man/man9/disk.9	Mon Aug  7 21:12:38 2017	(r322198)
        > @@ -27,7 +27,7 @@
        >   .\"
        >   .\" $FreeBSD$
        >   .\"
        > -.Dd October 30, 2012
        > +.Dd August 3, 2017
        >   .Dt DISK 9
        >   .Os
        >   .Sh NAME
        > @@ -45,6 +45,8 @@
        >   .Fn disk_destroy "struct disk *disk"
        >   .Ft int
        >   .Fn disk_resize "struct disk *disk" "int flags"
        > +.Ft void
        > +.Fn disk_add_alias "struct disk *disk" "const char *alias"
        >   .Sh DESCRIPTION
        >   The disk storage API permits kernel device drivers providing access to
        >   disk-like storage devices to advertise the device to other kernel
        > @@ -69,6 +71,20 @@ function,
        >   fill in the fields and call
        >   .Fn disk_create
        >   when the device is ready to service requests.
        > +.Fn disk_add_alias
        > +adds an alias for the disk and must be called before
        > +.Fn disk_create ,
        > +but may be called multiple times.
        > +For each alias added, a device node will be created with
        > +.Xr make_dev_alias 9
        > +in the same way primary device nodes are created with
        > +.Xr make_dev 9
        > +for
        > +.Va d_name
        > +and
        > +.Va d_unit .
        > +Care should be taken to ensure that only one driver creates aliases
        > +for any given name.
        >   .Fn disk_resize
        >   can be called by the driver after modifying
        >   .Va d_mediasize
        > @@ -227,7 +243,13 @@ structure for this disk device.
        >   .El
        >   .Sh SEE ALSO
        >   .Xr GEOM 4 ,
        > -.Xr devfs 5
        > +.Xr devfs 5 ,
        > +.Xr MAKE_DEV 9
        >   .Sh AUTHORS
        >   This manual page was written by
        >   .An Robert Watson .
        > +.Sh BUGS
        > +Disk aliases are not a general purpose aliasing mechanism, but are
        > +intended only to ease the transition from one name to another.
        > +They can be used to ensure that nvd0 and nda0 are the same thing.
        > +They cannot be used to implement the diskX concept from macOS.
        >
        > Modified: head/sys/geom/geom_disk.c
        > ==============================================================================
        > --- head/sys/geom/geom_disk.c	Mon Aug  7 21:12:33 2017	(r322197)
        > +++ head/sys/geom/geom_disk.c	Mon Aug  7 21:12:38 2017	(r322198)
        > @@ -676,6 +676,7 @@ g_disk_create(void *arg, int flag)
        >   	struct g_provider *pp;
        >   	struct disk *dp;
        >   	struct g_disk_softc *sc;
        > +	struct disk_alias *dap;
        >   	char tmpstr[80];
        >   
        >   	if (flag == EV_CANCEL)
        > @@ -704,6 +705,10 @@ g_disk_create(void *arg, int flag)
        >   	sc->dp = dp;
        >   	gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit);
        >   	gp->softc = sc;
        > +	LIST_FOREACH(dap, &dp->d_aliases, da_next) {
        > +		snprintf(tmpstr, sizeof(tmpstr), "%s%d", dap->da_alias, dp->d_unit);
        > +		g_geom_add_alias(gp, tmpstr);
        > +	}
        >   	pp = g_new_providerf(gp, "%s", gp->name);
        >   	devstat_remove_entry(pp->stat);
        >   	pp->stat = NULL;
        > @@ -791,6 +796,7 @@ g_disk_destroy(void *ptr, int flag)
        >   	struct disk *dp;
        >   	struct g_geom *gp;
        >   	struct g_disk_softc *sc;
        > +	struct disk_alias *dap, *daptmp;
        >   
        >   	g_topology_assert();
        >   	dp = ptr;
        > @@ -802,6 +808,8 @@ g_disk_destroy(void *ptr, int flag)
        >   		dp->d_geom = NULL;
        >   		g_wither_geom(gp, ENXIO);
        >   	}
        > +	LIST_FOREACH_SAFE(dap, &dp->d_aliases, da_next, daptmp)
        > +		g_free(dap);
        >   
        >   	g_free(dp);
        >   }
        > @@ -834,8 +842,11 @@ g_disk_ident_adjust(char *ident, size_t size)
        >   struct disk *
        >   disk_alloc(void)
        >   {
        > +	struct disk *dp;
        >   
        > -	return (g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO));
        > +	dp = g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO);
        > +	LIST_INIT(&dp->d_aliases);
        > +	return (dp);
        >   }
        >   
        >   void
        > @@ -882,6 +893,18 @@ disk_destroy(struct disk *dp)
        >   	if (dp->d_devstat != NULL)
        >   		devstat_remove_entry(dp->d_devstat);
        >   	g_post_event(g_disk_destroy, dp, M_WAITOK, NULL);
        > +}
        > +
        > +void
        > +disk_add_alias(struct disk *dp, const char *name)
        > +{
        > +	struct disk_alias *dap;
        > +
        > +	dap = (struct disk_alias *)g_malloc(
        > +		sizeof(struct disk_alias) + strlen(name) + 1, M_WAITOK);
        > +	strcpy((char *)(dap + 1), name);
        > +	dap->da_alias = (const char *)(dap + 1);
        > +	LIST_INSERT_HEAD(&dp->d_aliases, dap, da_next);
        >   }
        >   
        >   void
        >
        > Modified: head/sys/geom/geom_disk.h
        > ==============================================================================
        > --- head/sys/geom/geom_disk.h	Mon Aug  7 21:12:33 2017	(r322197)
        > +++ head/sys/geom/geom_disk.h	Mon Aug  7 21:12:38 2017	(r322198)
        > @@ -66,6 +66,11 @@ typedef enum {
        >   	DISK_INIT_DONE
        >   } disk_init_level;
        >   
        > +struct disk_alias {
        > +	LIST_ENTRY(disk_alias)	da_next;
        > +	const char		*da_alias;
        > +};
        > +
        >   struct disk {
        >   	/* Fields which are private to geom_disk */
        >   	struct g_geom		*d_geom;
        > @@ -109,6 +114,9 @@ struct disk {
        >   
        >   	/* Fields private to the driver */
        >   	void			*d_drv1;
        > +
        > +	/* Fields private to geom_disk, to be moved on next version bump */
        > +	LIST_HEAD(,disk_alias)	d_aliases;
        >   };
        >   
        >   #define DISKFLAG_RESERVED	0x1	/* Was NEEDSGIANT */
        > @@ -132,6 +140,7 @@ void disk_attr_changed(struct disk *dp, const char *at
        >   void disk_media_changed(struct disk *dp, int flag);
        >   void disk_media_gone(struct disk *dp, int flag);
        >   int disk_resize(struct disk *dp, int flag);
        > +void disk_add_alias(struct disk *disk, const char *);
        >   
        >   #define DISK_VERSION_00		0x58561059
        >   #define DISK_VERSION_01		0x5856105a
        >
        
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 21:29:43 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2216EDC9ED7;
         Mon,  7 Aug 2017 21:29:43 +0000 (UTC)
         (envelope-from kostikbel@gmail.com)
        Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id A8CBD83FDB;
         Mon,  7 Aug 2017 21:29:42 +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 v77LTbCV054758
         (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);
         Tue, 8 Aug 2017 00:29:38 +0300 (EEST)
         (envelope-from kostikbel@gmail.com)
        DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v77LTbCV054758
        Received: (from kostik@localhost)
         by tom.home (8.15.2/8.15.2/Submit) id v77LTbZm054757;
         Tue, 8 Aug 2017 00:29:37 +0300 (EEST)
         (envelope-from kostikbel@gmail.com)
        X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com
         using -f
        Date: Tue, 8 Aug 2017 00:29:37 +0300
        From: Konstantin Belousov 
        To: Warner Losh 
        Cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: Re: svn commit: r322196 - head/sys/geom
        Message-ID: <20170807212937.GJ1700@kib.kiev.ua>
        References: <201708072112.v77LCSxL001381@repo.freebsd.org>
        MIME-Version: 1.0
        Content-Type: text/plain; charset=us-ascii
        Content-Disposition: inline
        In-Reply-To: <201708072112.v77LCSxL001381@repo.freebsd.org>
        User-Agent: Mutt/1.8.3 (2017-05-23)
        X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00,
         DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no
         autolearn_force=no version=3.4.1
        X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 21:29:43 -0000
        
        On Mon, Aug 07, 2017 at 09:12:28PM +0000, Warner Losh wrote:
        > +	LIST_FOREACH(gap, &pp->geom->aliases, ga_next) {
        > +		error = make_dev_alias_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &adev, dev,
        > +		    "%s", gap->ga_alias);
        > +		if (error) {
        > +			printf("%s: make_dev_alias_p() failed (name=%s, error=%d)\n",
        > +			    __func__, gap->ga_alias, error);
        > +			continue;
        > +		}
        > +		adev->si_flags |= SI_UNMAPPED;
        Why do you set the flag unconditionally ?
        
        > +		adev->si_iosize_max = dev->si_iosize_max;
        > +		adev->si_drv2 = dev->si_drv2;
        And what are you trying to do by these initializations, including the
        si_flags adjustment ?
        
        Aliases cause creation of symlinks in the devfs populate loop, which
        makes it impossible to access the alias cdevs.
        
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 21:29:56 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2575DC9F58;
         Mon,  7 Aug 2017 21:29:56 +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 mx1.freebsd.org (Postfix) with ESMTPS id C0C1984121;
         Mon,  7 Aug 2017 21:29:56 +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 v77LTtIt006046;
         Mon, 7 Aug 2017 21:29:55 GMT (envelope-from emaste@FreeBSD.org)
        Received: (from emaste@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LTtDB006045;
         Mon, 7 Aug 2017 21:29:55 GMT (envelope-from emaste@FreeBSD.org)
        Message-Id: <201708072129.v77LTtDB006045@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: emaste set sender to
         emaste@FreeBSD.org using -f
        From: Ed Maste 
        Date: Mon, 7 Aug 2017 21:29:55 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322202 - head
        X-SVN-Group: head
        X-SVN-Commit-Author: emaste
        X-SVN-Commit-Paths: head
        X-SVN-Commit-Revision: 322202
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 21:29:57 -0000
        
        Author: emaste
        Date: Mon Aug  7 21:29:55 2017
        New Revision: 322202
        URL: https://svnweb.freebsd.org/changeset/base/322202
        
        Log:
          UPDATING: clarify what the RCMDS knob controls
        
        Modified:
          head/UPDATING
        
        Modified: head/UPDATING
        ==============================================================================
        --- head/UPDATING	Mon Aug  7 21:23:59 2017	(r322201)
        +++ head/UPDATING	Mon Aug  7 21:29:55 2017	(r322202)
        @@ -64,8 +64,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
         	and upgrading, if you are not already using clang 3.5.0 or higher.
         
         20170701:
        -	WITHOUT_RCMDS is now the default. Set WITH_RCMDS if you need them to be
        -	built with the base system.
        +	WITHOUT_RCMDS is now the default. Set WITH_RCMDS if you need the
        +	r-commands (rlogin, rsh, etc.) to be built with the base system.
         
         20170625:
         	The FreeBSD/powerpc platform now uses a 64-bit type for time_t.  This is
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 21:32:04 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B15ADCA357
         for ;
         Mon,  7 Aug 2017 21:32:04 +0000 (UTC)
         (envelope-from wlosh@bsdimp.com)
        Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com
         [IPv6:2607:f8b0:4001:c0b::22c])
         (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
         (Client CN "smtp.gmail.com",
         Issuer "Google Internet Authority G2" (verified OK))
         by mx1.freebsd.org (Postfix) with ESMTPS id E1CE784582
         for ; Mon,  7 Aug 2017 21:32:03 +0000 (UTC)
         (envelope-from wlosh@bsdimp.com)
        Received: by mail-it0-x22c.google.com with SMTP id m34so9473933iti.1
         for ; Mon, 07 Aug 2017 14:32:03 -0700 (PDT)
        DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
         d=bsdimp-com.20150623.gappssmtp.com; s=20150623;
         h=mime-version:sender:in-reply-to:references:from:date:message-id
         :subject:to:cc;
         bh=uvmBlFI9/OKaLGRNZINyvZi35LbG4SJzA0YnDK6uPMY=;
         b=AnkYRzeBMqvSBkJzCV/jELo5OtAzV6jZFmk/OyZQwXX5cV4wo5kNWr+TPBljbe//Pk
         VWQJu8eo1POQJM+kEhBfuJT+WmPR7kFlFw1qmJ65eWV6bwM8HqaMBN1Lwm6HO6PaAncQ
         gvDxCgM7c2E81l9+u+ipbcdjAzJii8rJ67hRxqcapgWe2rrk4B7cx3BQTlv2KZidBhDG
         yH2l6gyuZeyYwSK0ZWBhx4qKkhQrTG66pLv42SwXH4MLqpEhKcqpDiQIwJQPFlh3m+p9
         /d0R3wldDtSFYQzsfiktdBcV1h6kgKDSIeEQNb6zCEYsaUuj9C+CRp/OflZExKAC7SzO
         djmw==
        X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
         d=1e100.net; s=20161025;
         h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
         :date:message-id:subject:to:cc;
         bh=uvmBlFI9/OKaLGRNZINyvZi35LbG4SJzA0YnDK6uPMY=;
         b=Qij7RR52RWBhvVcVlCJSSGGVRBNC/Rp3TuCcZEeG1w4x0/eXNl2Y6JZA5fhnhGvL+n
         6LxtSMYDPUhwXtE0ifA72wm2IFTyOOXREPxBDa984CYUKzijKs5O+UFpEQ7/AWVUf97v
         F0Pl2+JDoPaHEYVckAZoErfqf9+RC1lzzp13NpZubkZ7MPi1VS4UJAI196rVfCYi/03C
         qOk4ASFiOhz2jGGyoMa7WJDxdcVWC64+yUJYS02XMzGUjl1TqUrx2YIBtHpHxA/OPQQQ
         fSHCOJ0+rx5oGCZTVzh9U2g/TCsPXEglGXyXdFIbwuh0wkqiSEkhdBYv2ulRSuVP1H1d
         Rfpg==
        X-Gm-Message-State: AIVw1109xN2GVvdaJEijBMDm9Gg/vZZGOmvC6FShFwqSyujrK4UFbQqY
         B0Uy0aefUDY6h3o5Nnkh+B7BC8SvYG9a
        X-Received: by 10.36.101.2 with SMTP id u2mr2271056itb.38.1502141523246; Mon,
         07 Aug 2017 14:32:03 -0700 (PDT)
        MIME-Version: 1.0
        Sender: wlosh@bsdimp.com
        Received: by 10.79.10.71 with HTTP; Mon, 7 Aug 2017 14:32:02 -0700 (PDT)
        X-Originating-IP: [2603:300b:6:5100:f809:2296:13f6:2a42]
        In-Reply-To: 
        References: <201708072112.v77LCcXm001489@repo.freebsd.org>
         
        From: Warner Losh 
        Date: Mon, 7 Aug 2017 15:32:02 -0600
        X-Google-Sender-Auth: 04HUKsAClqfiG0KP1UGUg_AXnJ8
        Message-ID: 
        Subject: Re: svn commit: r322198 - in head: share/man/man9 sys/geom
        To: Nathan Whitehorn 
        Cc: Warner Losh , src-committers ,
         "svn-src-all@freebsd.org" , 
         "svn-src-head@freebsd.org" 
        Content-Type: text/plain; charset="UTF-8"
        X-Content-Filtered-By: Mailman/MimeDel 2.1.23
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 21:32:04 -0000
        
        On Mon, Aug 7, 2017 at 3:19 PM, Nathan Whitehorn 
        wrote:
        
        > It would be really nice to let gpart provide aliases correct to partition
        > labels, which would fix the existing racy and unreliable glabel code. Do
        > you see any obstacles to using this code for that?
        
        
        I'm not sure I understand well enough the issue here to have an opinion.
        
        Warner
        
        On 08/07/17 14:12, Warner Losh wrote:
        >
        >> Author: imp
        >> Date: Mon Aug  7 21:12:38 2017
        >> New Revision: 322198
        >> URL: https://svnweb.freebsd.org/changeset/base/322198
        >>
        >> Log:
        >>    Expose API to allow disks to ask for alias names in devfs.
        >>       Implement disk_add_alias to allow aliases to be added to disks. All
        >>    disk have a primary name (say "foo") can also have secondary names
        >>    (say "bar") such that all instances of "foo" also have a "bar"
        >>    alias. So if you have foo0, foo0p1, foo1, foo1s1 and foo1s1a nodes
        >>    created by the foo driver and gpart, device nodes bar0, bar0p1, bar1,
        >>    bar1s1 and bar1s1a will appear as symlinks back to the original nodes.
        >>    This generalizes to multiple aliases. However, since the unit number
        >>    follows the primary name, multiple device drivers can't create the
        >>    same aliases unless those drives coorinate the unit number space (eg
        >>    you couldn't add an alias 'disk' to both 'da' and 'ada' because it's
        >>    possible to have da0 and ada0, because 'disk0' is ambiguous).
        >>       Differential Revision: https://reviews.freebsd.org/D11873
        >>
        >> Modified:
        >>    head/share/man/man9/disk.9
        >>    head/sys/geom/geom_disk.c
        >>    head/sys/geom/geom_disk.h
        >>
        >> Modified: head/share/man/man9/disk.9
        >> ============================================================
        >> ==================
        >> --- head/share/man/man9/disk.9  Mon Aug  7 21:12:33 2017        (r322197)
        >> +++ head/share/man/man9/disk.9  Mon Aug  7 21:12:38 2017        (r322198)
        >> @@ -27,7 +27,7 @@
        >>   .\"
        >>   .\" $FreeBSD$
        >>   .\"
        >> -.Dd October 30, 2012
        >> +.Dd August 3, 2017
        >>   .Dt DISK 9
        >>   .Os
        >>   .Sh NAME
        >> @@ -45,6 +45,8 @@
        >>   .Fn disk_destroy "struct disk *disk"
        >>   .Ft int
        >>   .Fn disk_resize "struct disk *disk" "int flags"
        >> +.Ft void
        >> +.Fn disk_add_alias "struct disk *disk" "const char *alias"
        >>   .Sh DESCRIPTION
        >>   The disk storage API permits kernel device drivers providing access to
        >>   disk-like storage devices to advertise the device to other kernel
        >> @@ -69,6 +71,20 @@ function,
        >>   fill in the fields and call
        >>   .Fn disk_create
        >>   when the device is ready to service requests.
        >> +.Fn disk_add_alias
        >> +adds an alias for the disk and must be called before
        >> +.Fn disk_create ,
        >> +but may be called multiple times.
        >> +For each alias added, a device node will be created with
        >> +.Xr make_dev_alias 9
        >> +in the same way primary device nodes are created with
        >> +.Xr make_dev 9
        >> +for
        >> +.Va d_name
        >> +and
        >> +.Va d_unit .
        >> +Care should be taken to ensure that only one driver creates aliases
        >> +for any given name.
        >>   .Fn disk_resize
        >>   can be called by the driver after modifying
        >>   .Va d_mediasize
        >> @@ -227,7 +243,13 @@ structure for this disk device.
        >>   .El
        >>   .Sh SEE ALSO
        >>   .Xr GEOM 4 ,
        >> -.Xr devfs 5
        >> +.Xr devfs 5 ,
        >> +.Xr MAKE_DEV 9
        >>   .Sh AUTHORS
        >>   This manual page was written by
        >>   .An Robert Watson .
        >> +.Sh BUGS
        >> +Disk aliases are not a general purpose aliasing mechanism, but are
        >> +intended only to ease the transition from one name to another.
        >> +They can be used to ensure that nvd0 and nda0 are the same thing.
        >> +They cannot be used to implement the diskX concept from macOS.
        >>
        >> Modified: head/sys/geom/geom_disk.c
        >> ============================================================
        >> ==================
        >> --- head/sys/geom/geom_disk.c   Mon Aug  7 21:12:33 2017        (r322197)
        >> +++ head/sys/geom/geom_disk.c   Mon Aug  7 21:12:38 2017        (r322198)
        >> @@ -676,6 +676,7 @@ g_disk_create(void *arg, int flag)
        >>         struct g_provider *pp;
        >>         struct disk *dp;
        >>         struct g_disk_softc *sc;
        >> +       struct disk_alias *dap;
        >>         char tmpstr[80];
        >>         if (flag == EV_CANCEL)
        >> @@ -704,6 +705,10 @@ g_disk_create(void *arg, int flag)
        >>         sc->dp = dp;
        >>         gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit);
        >>         gp->softc = sc;
        >> +       LIST_FOREACH(dap, &dp->d_aliases, da_next) {
        >> +               snprintf(tmpstr, sizeof(tmpstr), "%s%d", dap->da_alias,
        >> dp->d_unit);
        >> +               g_geom_add_alias(gp, tmpstr);
        >> +       }
        >>         pp = g_new_providerf(gp, "%s", gp->name);
        >>         devstat_remove_entry(pp->stat);
        >>         pp->stat = NULL;
        >> @@ -791,6 +796,7 @@ g_disk_destroy(void *ptr, int flag)
        >>         struct disk *dp;
        >>         struct g_geom *gp;
        >>         struct g_disk_softc *sc;
        >> +       struct disk_alias *dap, *daptmp;
        >>         g_topology_assert();
        >>         dp = ptr;
        >> @@ -802,6 +808,8 @@ g_disk_destroy(void *ptr, int flag)
        >>                 dp->d_geom = NULL;
        >>                 g_wither_geom(gp, ENXIO);
        >>         }
        >> +       LIST_FOREACH_SAFE(dap, &dp->d_aliases, da_next, daptmp)
        >> +               g_free(dap);
        >>         g_free(dp);
        >>   }
        >> @@ -834,8 +842,11 @@ g_disk_ident_adjust(char *ident, size_t size)
        >>   struct disk *
        >>   disk_alloc(void)
        >>   {
        >> +       struct disk *dp;
        >>   -     return (g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO));
        >> +       dp = g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO);
        >> +       LIST_INIT(&dp->d_aliases);
        >> +       return (dp);
        >>   }
        >>     void
        >> @@ -882,6 +893,18 @@ disk_destroy(struct disk *dp)
        >>         if (dp->d_devstat != NULL)
        >>                 devstat_remove_entry(dp->d_devstat);
        >>         g_post_event(g_disk_destroy, dp, M_WAITOK, NULL);
        >> +}
        >> +
        >> +void
        >> +disk_add_alias(struct disk *dp, const char *name)
        >> +{
        >> +       struct disk_alias *dap;
        >> +
        >> +       dap = (struct disk_alias *)g_malloc(
        >> +               sizeof(struct disk_alias) + strlen(name) + 1, M_WAITOK);
        >> +       strcpy((char *)(dap + 1), name);
        >> +       dap->da_alias = (const char *)(dap + 1);
        >> +       LIST_INSERT_HEAD(&dp->d_aliases, dap, da_next);
        >>   }
        >>     void
        >>
        >> Modified: head/sys/geom/geom_disk.h
        >> ============================================================
        >> ==================
        >> --- head/sys/geom/geom_disk.h   Mon Aug  7 21:12:33 2017        (r322197)
        >> +++ head/sys/geom/geom_disk.h   Mon Aug  7 21:12:38 2017        (r322198)
        >> @@ -66,6 +66,11 @@ typedef enum {
        >>         DISK_INIT_DONE
        >>   } disk_init_level;
        >>   +struct disk_alias {
        >> +       LIST_ENTRY(disk_alias)  da_next;
        >> +       const char              *da_alias;
        >> +};
        >> +
        >>   struct disk {
        >>         /* Fields which are private to geom_disk */
        >>         struct g_geom           *d_geom;
        >> @@ -109,6 +114,9 @@ struct disk {
        >>         /* Fields private to the driver */
        >>         void                    *d_drv1;
        >> +
        >> +       /* Fields private to geom_disk, to be moved on next version bump
        >> */
        >> +       LIST_HEAD(,disk_alias)  d_aliases;
        >>   };
        >>     #define DISKFLAG_RESERVED   0x1     /* Was NEEDSGIANT */
        >> @@ -132,6 +140,7 @@ void disk_attr_changed(struct disk *dp, const char *at
        >>   void disk_media_changed(struct disk *dp, int flag);
        >>   void disk_media_gone(struct disk *dp, int flag);
        >>   int disk_resize(struct disk *dp, int flag);
        >> +void disk_add_alias(struct disk *disk, const char *);
        >>     #define DISK_VERSION_00             0x58561059
        >>   #define DISK_VERSION_01               0x5856105a
        >>
        >>
        >
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 21:37:58 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99288DCA750
         for ;
         Mon,  7 Aug 2017 21:37:58 +0000 (UTC)
         (envelope-from wlosh@bsdimp.com)
        Received: from mail-it0-x22d.google.com (mail-it0-x22d.google.com
         [IPv6:2607:f8b0:4001:c0b::22d])
         (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
         (Client CN "smtp.gmail.com",
         Issuer "Google Internet Authority G2" (verified OK))
         by mx1.freebsd.org (Postfix) with ESMTPS id 6129F84867
         for ; Mon,  7 Aug 2017 21:37:58 +0000 (UTC)
         (envelope-from wlosh@bsdimp.com)
        Received: by mail-it0-x22d.google.com with SMTP id 76so9795115ith.0
         for ; Mon, 07 Aug 2017 14:37:58 -0700 (PDT)
        DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
         d=bsdimp-com.20150623.gappssmtp.com; s=20150623;
         h=mime-version:sender:in-reply-to:references:from:date:message-id
         :subject:to:cc;
         bh=NI8SPRm+PsybPL/kAX0p0cNCCji6y3xyJswDwJNTVac=;
         b=vOIomLcSp2yrp+UN9u/QEofg+M7T9X/u4YEvt7+gp1ymHo5hZMeXuR0l+ssV5mVx+u
         WTSKjg7lL/Ytzu3CsPSRvzNTrbWHQtuTYh5VIiAyDTNwmkcM4cYbjQZ1zjxHGAoPPKvv
         HqVHvjvNtnYP+jE4dEnQQyrfDEgjr2kpmCTrMVasou++WsruT0GmOvSkQ7By0Is1XssM
         kCvDCgiZl1Sm3Lzd6mTaw1uehHe22jqPCx8zE0Wy3ZE5oVUj/LOHT+QxYnM6eS27tiE5
         gg6V66YC31jKBKwfWKVVI5pNLlYm+smcWw8RDlJHO/wb3eHIVnLfRTw0leFkaO7234kh
         pT4A==
        X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
         d=1e100.net; s=20161025;
         h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
         :date:message-id:subject:to:cc;
         bh=NI8SPRm+PsybPL/kAX0p0cNCCji6y3xyJswDwJNTVac=;
         b=F6O/g/YPDV1f7iLS/fqdTxYBjerXa5FgN5M+BWL0iaXC6hFkQ88wUkR9xUkc9by05n
         9dq8YT3KpNE3vmOlS5a8/GhmSpA+bVJlT2y0DyUXu88m7JTRXXiBary/KM7U2WT5PXM/
         36Ot6/BIKaWWyZPnT+ggyBn4sLGB0Uvtd7ntNJUZX3HFLw2FjhZ+bixTa0zqZsYrIn5B
         4HaM+VfMvglgfV0xzd18B/nYc5tD5lGzLxW52Xxqz5fQB8Sc9MXq1Z6IZMrge+Wee6wt
         VVDsJxS+Vqvo4V02W4fRxRaMAN7+gFewPuQWW4e0bY27c4q53BOyKgLpfD0qA6/U0LlP
         Stcg==
        X-Gm-Message-State: AIVw113BPAlBJJ6mnKM53VoLMaFBp+SjmglMCKyRqSGrNmGX4Qg7R1vN
         nZj9+1cHKfx9s9ixfwP1W4reCicqPb7+
        X-Received: by 10.36.68.193 with SMTP id o184mr2089095ita.59.1502141877712;
         Mon, 07 Aug 2017 14:37:57 -0700 (PDT)
        MIME-Version: 1.0
        Sender: wlosh@bsdimp.com
        Received: by 10.79.10.71 with HTTP; Mon, 7 Aug 2017 14:37:57 -0700 (PDT)
        X-Originating-IP: [2603:300b:6:5100:f809:2296:13f6:2a42]
        In-Reply-To: <20170807212937.GJ1700@kib.kiev.ua>
        References: <201708072112.v77LCSxL001381@repo.freebsd.org>
         <20170807212937.GJ1700@kib.kiev.ua>
        From: Warner Losh 
        Date: Mon, 7 Aug 2017 15:37:57 -0600
        X-Google-Sender-Auth: _YaedL6OTiTGDFf4VI-Q-BhVgXU
        Message-ID: 
        Subject: Re: svn commit: r322196 - head/sys/geom
        To: Konstantin Belousov 
        Cc: Warner Losh , src-committers ,
         "svn-src-all@freebsd.org" , 
         "svn-src-head@freebsd.org" 
        Content-Type: text/plain; charset="UTF-8"
        X-Content-Filtered-By: Mailman/MimeDel 2.1.23
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 21:37:58 -0000
        
        On Mon, Aug 7, 2017 at 3:29 PM, Konstantin Belousov 
        wrote:
        
        > On Mon, Aug 07, 2017 at 09:12:28PM +0000, Warner Losh wrote:
        > > +     LIST_FOREACH(gap, &pp->geom->aliases, ga_next) {
        > > +             error = make_dev_alias_p(MAKEDEV_CHECKNAME |
        > MAKEDEV_WAITOK, &adev, dev,
        > > +                 "%s", gap->ga_alias);
        > > +             if (error) {
        > > +                     printf("%s: make_dev_alias_p() failed (name=%s,
        > error=%d)\n",
        > > +                         __func__, gap->ga_alias, error);
        > > +                     continue;
        > > +             }
        > > +             adev->si_flags |= SI_UNMAPPED;
        > Why do you set the flag unconditionally ?
        
        
        Because it's set for "dev" unconditionally and the old compat code did it
        too...
        
        > +             adev->si_iosize_max = dev->si_iosize_max;
        > > +             adev->si_drv2 = dev->si_drv2;
        > And what are you trying to do by these initializations, including the
        > si_flags adjustment ?
        >
        
        The old (ad->ada) compat code set them. Though to be honest, I didn't drill
        down into the devfs code to see if that as still relevant. It sounds like
        maybe not relevant...
        
        
        > Aliases cause creation of symlinks in the devfs populate loop, which
        > makes it impossible to access the alias cdevs.
        >
        
        True enough. If so, do you think these adjustments to adev can just be
        removed entirely? A quick look in devfs code suggests that it doesn't
        matter since, as you point out, it's a symlink not a new, different node.
        
        Thanks for the feedback.
        
        Warner
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 21:38:11 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F332DCA7AF;
         Mon,  7 Aug 2017 21:38:11 +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 mx1.freebsd.org (Postfix) with ESMTPS id 439A58491E;
         Mon,  7 Aug 2017 21:38:11 +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 v77LcAY2009903;
         Mon, 7 Aug 2017 21:38:10 GMT (envelope-from marius@FreeBSD.org)
        Received: (from marius@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77LcAiY009902;
         Mon, 7 Aug 2017 21:38:10 GMT (envelope-from marius@FreeBSD.org)
        Message-Id: <201708072138.v77LcAiY009902@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: marius set sender to
         marius@FreeBSD.org using -f
        From: Marius Strobl 
        Date: Mon, 7 Aug 2017 21:38:10 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322203 - head/usr.sbin/tzsetup
        X-SVN-Group: head
        X-SVN-Commit-Author: marius
        X-SVN-Commit-Paths: head/usr.sbin/tzsetup
        X-SVN-Commit-Revision: 322203
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 21:38:11 -0000
        
        Author: marius
        Date: Mon Aug  7 21:38:10 2017
        New Revision: 322203
        URL: https://svnweb.freebsd.org/changeset/base/322203
        
        Log:
          Revert the parts of r322097 related to /etc/wall_cmos_clock handling as
          the previous behavior actually is required for setting up configurations
          in which the RTC is using UTC but the timezone is not. Still, besides
          uniform error handling, that file should get the same treatment in the
          non-interactive variants supported by tzsetup(8).
        
        Modified:
          head/usr.sbin/tzsetup/tzsetup.c
        
        Modified: head/usr.sbin/tzsetup/tzsetup.c
        ==============================================================================
        --- head/usr.sbin/tzsetup/tzsetup.c	Mon Aug  7 21:29:55 2017	(r322202)
        +++ head/usr.sbin/tzsetup/tzsetup.c	Mon Aug  7 21:38:10 2017	(r322203)
        @@ -866,48 +866,10 @@ install_zoneinfo_file(const char *zoneinfo_file)
         static int
         install_zoneinfo(const char *zoneinfo)
         {
        -	int		fd, rv;
        +	int		rv;
         	FILE		*f;
         	char		path_zoneinfo_file[MAXPATHLEN];
        -	char		prompt[SILLY_BUFFER_SIZE], title[64];
         
        -	if (reallydoit) {
        -		if (strcmp(zoneinfo, "UTC") == 0) {
        -			if (unlink(path_wall_cmos_clock) < 0 &&
        -			    errno != ENOENT) {
        -				snprintf(title, sizeof(title), "Error");
        -				snprintf(prompt, sizeof(prompt),
        -				    "Could not delete %s: %s",
        -				    path_wall_cmos_clock, strerror(errno));
        -#ifdef HAVE_DIALOG
        -				if (usedialog)
        -					dialog_msgbox(title, prompt, 8, 72, 1);
        -				else
        -#endif
        -					fprintf(stderr, "%s\n", prompt);
        -
        -				return (DITEM_FAILURE | DITEM_RECREATE);
        -			}
        -		} else {
        -			fd = open(path_wall_cmos_clock, O_WRONLY | O_CREAT |
        -			    O_TRUNC, S_IRUSR | S_IRGRP | S_IROTH);
        -			if (fd < 0) {
        -				snprintf(title, sizeof(title), "Error");
        -				snprintf(prompt, sizeof(prompt),
        -				    "Could not create %s: %s",
        -				    path_wall_cmos_clock, strerror(errno));
        -#ifdef HAVE_DIALOG
        -				if (usedialog)
        -					dialog_msgbox(title, prompt, 8, 72, 1);
        -				else
        -#endif
        -					fprintf(stderr, "%s\n", prompt);
        -				return (DITEM_FAILURE | DITEM_RECREATE);
        -			}
        -			close(fd);
        -		}
        -	}
        -
         	if ((size_t)snprintf(path_zoneinfo_file, sizeof(path_zoneinfo_file),
         	    "%s/%s", path_zoneinfo, zoneinfo) >= sizeof(path_zoneinfo_file))
         		errx(1, "%s/%s name too long", path_zoneinfo, zoneinfo);
        @@ -938,6 +900,7 @@ main(int argc, char **argv)
         {
         #ifdef HAVE_DIALOG
         	char		title[64], prompt[128];
        +	int		fd;
         #endif
         	int		c, rv, skiputc;
         	char		vm_guest[16] = "";
        @@ -992,7 +955,6 @@ main(int argc, char **argv)
         		    _PATH_WALL_CMOS_CLOCK);
         	}
         
        -
         	/* Override the user-supplied umask. */
         	(void)umask(S_IWGRP | S_IWOTH);
         
        @@ -1059,11 +1021,19 @@ main(int argc, char **argv)
         		yesno = dialog_yesno(title, prompt, 7, 73);
         		dlg_restore_vars(&save_vars);
         		if (!yesno) {
        +			if (reallydoit)
        +				unlink(path_wall_cmos_clock);
        +		} else {
         			if (reallydoit) {
        -				rv = install_zoneinfo("UTC");
        -				dlg_clear();
        -				end_dialog();
        -				exit(rv & ~DITEM_LEAVE_MENU);
        +				fd = open(path_wall_cmos_clock,
        +				    O_WRONLY | O_CREAT | O_TRUNC,
        +				    S_IRUSR | S_IRGRP | S_IROTH);
        +				if (fd < 0) {
        +					end_dialog();
        +					err(1, "create %s",
        +					    path_wall_cmos_clock);
        +				}
        +				close(fd);
         			}
         		}
         		dlg_clear();
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 21:51:48 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0545FDCB600;
         Mon,  7 Aug 2017 21:51:48 +0000 (UTC)
         (envelope-from kostikbel@gmail.com)
        Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id 8E03086E;
         Mon,  7 Aug 2017 21:51:47 +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 v77Lpa5J060342
         (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);
         Tue, 8 Aug 2017 00:51:37 +0300 (EEST)
         (envelope-from kostikbel@gmail.com)
        DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v77Lpa5J060342
        Received: (from kostik@localhost)
         by tom.home (8.15.2/8.15.2/Submit) id v77LpaGH060341;
         Tue, 8 Aug 2017 00:51:36 +0300 (EEST)
         (envelope-from kostikbel@gmail.com)
        X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com
         using -f
        Date: Tue, 8 Aug 2017 00:51:36 +0300
        From: Konstantin Belousov 
        To: Warner Losh 
        Cc: Warner Losh , src-committers ,
         "svn-src-all@freebsd.org" ,
         "svn-src-head@freebsd.org" 
        Subject: Re: svn commit: r322196 - head/sys/geom
        Message-ID: <20170807215136.GK1700@kib.kiev.ua>
        References: <201708072112.v77LCSxL001381@repo.freebsd.org>
         <20170807212937.GJ1700@kib.kiev.ua>
         
        MIME-Version: 1.0
        Content-Type: text/plain; charset=us-ascii
        Content-Disposition: inline
        In-Reply-To: 
        User-Agent: Mutt/1.8.3 (2017-05-23)
        X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00,
         DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no
         autolearn_force=no version=3.4.1
        X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 21:51:48 -0000
        
        On Mon, Aug 07, 2017 at 03:37:57PM -0600, Warner Losh wrote:
        > On Mon, Aug 7, 2017 at 3:29 PM, Konstantin Belousov 
        > wrote:
        > 
        > > On Mon, Aug 07, 2017 at 09:12:28PM +0000, Warner Losh wrote:
        > > > +     LIST_FOREACH(gap, &pp->geom->aliases, ga_next) {
        > > > +             error = make_dev_alias_p(MAKEDEV_CHECKNAME |
        > > MAKEDEV_WAITOK, &adev, dev,
        > > > +                 "%s", gap->ga_alias);
        > > > +             if (error) {
        > > > +                     printf("%s: make_dev_alias_p() failed (name=%s,
        > > error=%d)\n",
        > > > +                         __func__, gap->ga_alias, error);
        > > > +                     continue;
        > > > +             }
        > > > +             adev->si_flags |= SI_UNMAPPED;
        > > Why do you set the flag unconditionally ?
        > 
        > 
        > Because it's set for "dev" unconditionally and the old compat code did it
        > too...
        > 
        > > +             adev->si_iosize_max = dev->si_iosize_max;
        > > > +             adev->si_drv2 = dev->si_drv2;
        > > And what are you trying to do by these initializations, including the
        > > si_flags adjustment ?
        > >
        > 
        > The old (ad->ada) compat code set them. Though to be honest, I didn't drill
        > down into the devfs code to see if that as still relevant. It sounds like
        > maybe not relevant...
        > 
        > 
        > > Aliases cause creation of symlinks in the devfs populate loop, which
        > > makes it impossible to access the alias cdevs.
        > >
        > 
        > True enough. If so, do you think these adjustments to adev can just be
        > removed entirely? A quick look in devfs code suggests that it doesn't
        > matter since, as you point out, it's a symlink not a new, different node.
        Yes, I think that the adev tweaks are not needed.  I will be surprised
        if it appears to be used, but then there might be some hole in the
        devfs symlinks handling.
        
        That said, since you mentioned ada/ad aliases, are they still in the tree ?
        If yes, do you plan to convert them as well ?
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 22:00:19 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 360DBDCBB42
         for ;
         Mon,  7 Aug 2017 22:00:19 +0000 (UTC)
         (envelope-from wlosh@bsdimp.com)
        Received: from mail-io0-x22a.google.com (mail-io0-x22a.google.com
         [IPv6:2607:f8b0:4001:c06::22a])
         (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
         (Client CN "smtp.gmail.com",
         Issuer "Google Internet Authority G2" (verified OK))
         by mx1.freebsd.org (Postfix) with ESMTPS id ED9B3C30
         for ; Mon,  7 Aug 2017 22:00:18 +0000 (UTC)
         (envelope-from wlosh@bsdimp.com)
        Received: by mail-io0-x22a.google.com with SMTP id g71so7332443ioe.5
         for ; Mon, 07 Aug 2017 15:00:18 -0700 (PDT)
        DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
         d=bsdimp-com.20150623.gappssmtp.com; s=20150623;
         h=mime-version:sender:in-reply-to:references:from:date:message-id
         :subject:to:cc;
         bh=q9IEw/sgQBHuytiSK/3Slfhhg/o4WaAk8MN2W4ngBfQ=;
         b=fhAqw36yCnkoJB/dZQCsTETdNPM8ij0/8hTjv/KlIyLTg7MdpV8B6B1fqbl3BbYrbS
         eqiaH3Te/LMi4c7uXJC9Oq8ekUx2YsF2STm4BNdC3Ziv01ap5DnTq75/+XrdszKSfWPO
         5mOcqYqE5upi0vn1ccju/o1lYQF7HraCkk2D2FANH4nRuDxBMt2K9UlVNWNQb48Yzut8
         R25z70+0PVf9ieaKYPLccNUxrp+pJUXV/Rh91r3S4L8CRbOwHzNTO16SKwE0C6x3+ftM
         6nJfTrCi8mdYWiEvEkHqG3udCXeB/DnxtpsAR5oYyMyGPI27ZZY3TIVsrm43Fkl6B/xQ
         0/AA==
        X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
         d=1e100.net; s=20161025;
         h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
         :date:message-id:subject:to:cc;
         bh=q9IEw/sgQBHuytiSK/3Slfhhg/o4WaAk8MN2W4ngBfQ=;
         b=ng1xLDLAkyRzfUQb3n5DqCKPsUPiu0WhEC2wEyS+6cqhofetT2BSr78bRcmkGSsMOh
         xX9s6XKQHvuOL1Tx1OYZlxJohCvrQDwH63Jm+L+uZuxsXJ2b2J2FC24u2N1w0TOZ/BQ9
         trsH0q2d1sQeBQnk4mGoH+Bp1sx84zSlCiUrwpY20iCkMU2gRWsHUvH4B5nysehryJq4
         FOvfuAjQs502ga/ASXCXyv4sqdn1bsFxxpB2CYmnLT3zQkEvgDKRNTErk7CZMwkiZWYW
         as+xqsKX/0LtLczFrdVIfJVWvcTs1DfjCJhH2afqqa0ynWNvg70zJEAjB0llUc8nGOsu
         4F1w==
        X-Gm-Message-State: AIVw112sPGup5nYshRHkXX7efmiBiuPBvhtG8WRgRx6Yh815DCZcHP/S
         vdsbGEA1I4H/qHhPC9Urqe9l1973vqXQ
        X-Received: by 10.107.147.133 with SMTP id v127mr1812624iod.128.1502143218296; 
         Mon, 07 Aug 2017 15:00:18 -0700 (PDT)
        MIME-Version: 1.0
        Sender: wlosh@bsdimp.com
        Received: by 10.79.10.71 with HTTP; Mon, 7 Aug 2017 15:00:17 -0700 (PDT)
        X-Originating-IP: [2603:300b:6:5100:f809:2296:13f6:2a42]
        In-Reply-To: <20170807215136.GK1700@kib.kiev.ua>
        References: <201708072112.v77LCSxL001381@repo.freebsd.org>
         <20170807212937.GJ1700@kib.kiev.ua>
         
         <20170807215136.GK1700@kib.kiev.ua>
        From: Warner Losh 
        Date: Mon, 7 Aug 2017 16:00:17 -0600
        X-Google-Sender-Auth: xeMD_KUYpArcONA3TBQ_hvNYx1s
        Message-ID: 
        Subject: Re: svn commit: r322196 - head/sys/geom
        To: Konstantin Belousov 
        Cc: Warner Losh , src-committers ,
         "svn-src-all@freebsd.org" , 
         "svn-src-head@freebsd.org" 
        Content-Type: text/plain; charset="UTF-8"
        X-Content-Filtered-By: Mailman/MimeDel 2.1.23
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 22:00:19 -0000
        
        On Mon, Aug 7, 2017 at 3:51 PM, Konstantin Belousov 
        wrote:
        
        > On Mon, Aug 07, 2017 at 03:37:57PM -0600, Warner Losh wrote:
        > > On Mon, Aug 7, 2017 at 3:29 PM, Konstantin Belousov  >
        > > wrote:
        > >
        > > > On Mon, Aug 07, 2017 at 09:12:28PM +0000, Warner Losh wrote:
        > > > > +     LIST_FOREACH(gap, &pp->geom->aliases, ga_next) {
        > > > > +             error = make_dev_alias_p(MAKEDEV_CHECKNAME |
        > > > MAKEDEV_WAITOK, &adev, dev,
        > > > > +                 "%s", gap->ga_alias);
        > > > > +             if (error) {
        > > > > +                     printf("%s: make_dev_alias_p() failed (name=%s,
        > > > error=%d)\n",
        > > > > +                         __func__, gap->ga_alias, error);
        > > > > +                     continue;
        > > > > +             }
        > > > > +             adev->si_flags |= SI_UNMAPPED;
        > > > Why do you set the flag unconditionally ?
        > >
        > >
        > > Because it's set for "dev" unconditionally and the old compat code did it
        > > too...
        > >
        > > > +             adev->si_iosize_max = dev->si_iosize_max;
        > > > > +             adev->si_drv2 = dev->si_drv2;
        > > > And what are you trying to do by these initializations, including the
        > > > si_flags adjustment ?
        > > >
        > >
        > > The old (ad->ada) compat code set them. Though to be honest, I didn't
        > drill
        > > down into the devfs code to see if that as still relevant. It sounds like
        > > maybe not relevant...
        > >
        > >
        > > > Aliases cause creation of symlinks in the devfs populate loop, which
        > > > makes it impossible to access the alias cdevs.
        > > >
        > >
        > > True enough. If so, do you think these adjustments to adev can just be
        > > removed entirely? A quick look in devfs code suggests that it doesn't
        > > matter since, as you point out, it's a symlink not a new, different node.
        > Yes, I think that the adev tweaks are not needed.  I will be surprised
        > if it appears to be used, but then there might be some hole in the
        > devfs symlinks handling.
        >
        
        Maybe I'm just setting 'dead variables' here that don't matter. I don't
        know that this is required, just kept the same code that used to 'work'.
        
        
        > That said, since you mentioned ada/ad aliases, are they still in the tree ?
        > If yes, do you plan to convert them as well ?
        >
        
        That code was removed in 11. I thought about bringing the code that ada
        used to implement them back verbatim for nda (and soon mda), but thought
        this approach was better and more general (and less error prone). I have no
        plans to re-add them.
        
        Warner
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 22:20:20 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CB4EDCC8C8;
         Mon,  7 Aug 2017 22:20:20 +0000 (UTC)
         (envelope-from nwhitehorn@freebsd.org)
        Received: from c.mail.sonic.net (c.mail.sonic.net [64.142.111.80])
         (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id 73F3516AA;
         Mon,  7 Aug 2017 22:20:19 +0000 (UTC)
         (envelope-from nwhitehorn@freebsd.org)
        Received: from aurora.physics.berkeley.edu (aurora.physics.berkeley.edu
         [128.32.117.67]) (authenticated bits=0)
         by c.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id v77MKFch016136
         (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);
         Mon, 7 Aug 2017 15:20:16 -0700
        Subject: Re: svn commit: r322198 - in head: share/man/man9 sys/geom
        To: Warner Losh 
        Cc: Warner Losh , src-committers ,
         "svn-src-all@freebsd.org" ,
         "svn-src-head@freebsd.org" 
        References: <201708072112.v77LCcXm001489@repo.freebsd.org>
         
         
        From: Nathan Whitehorn 
        Message-ID: 
        Date: Mon, 7 Aug 2017 15:20:15 -0700
        User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101
         Thunderbird/52.2.1
        MIME-Version: 1.0
        In-Reply-To: 
        Content-Language: en-US
        X-Sonic-CAuth: UmFuZG9tSVb9xHFseSlKGqz/QUV2bNmClrWf5AS1Bg7C0zDLKPqfcqZE2hTydO9Ok3QDeZL7HTKC057/Xx+6RlBRu1KuPZXEwkLleUlfPjE=
        X-Sonic-ID: C;2tiIlr575xGvjcGbEi49jA== M;kl3Tlr575xGvjcGbEi49jA==
        X-Spam-Flag: No
        X-Sonic-Spam-Details: 0.0/5.0 by cerberusd
        Content-Type: text/plain; charset=utf-8; format=flowed
        Content-Transfer-Encoding: 7bit
        X-Content-Filtered-By: Mailman/MimeDel 2.1.23
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 22:20:20 -0000
        
        
        
        On 08/07/17 14:32, Warner Losh wrote:
        >
        >
        > On Mon, Aug 7, 2017 at 3:19 PM, Nathan Whitehorn 
        > > wrote:
        >
        >     It would be really nice to let gpart provide aliases correct to
        >     partition labels, which would fix the existing racy and unreliable
        >     glabel code. Do you see any obstacles to using this code for that?
        >
        >
        > I'm not sure I understand well enough the issue here to have an opinion.
        
        We get /dev/gpt/foo (etc.) right now by parsing the GPT labels with a 
        completely parallel piece of code to gpart and then create an extra geom 
        provider based on the label. This falls down in four ways:
        1. The code is racy. It is perfectly possible to get a GPT label set by 
        gpart but not have it picked up by glabel for some period of time that 
        may be infinite (until a retaste), since the events don't propagate.
        2. The resulting /dev entry is unpredictable from the label, since 
        glabel internally does some fixups related to spaces, etc. You need to 
        copy and paste glabel's munging code.
        3. It isn't implemented for all of the schemes gpart supports since it 
        has a reimplementation of the partition table parser.
        4. Because it uses an extra provider, mounting, say, /dev/adaXpY causes 
        /dev/gpt/Z to vanish.
        
        This combination of things is why we don't currently use labels in the 
        installer and never have. Having gpart internally create symlinks would 
        fix all of this at a stroke. I will take a look at this some more and 
        see how hard it would be to implement; at the very least, I think you 
        would also need a disk_remove_alias() or the like.
        -Nathan
        
        > Warner
        >
        >     On 08/07/17 14:12, Warner Losh wrote:
        >
        >         Author: imp
        >         Date: Mon Aug  7 21:12:38 2017
        >         New Revision: 322198
        >         URL: https://svnweb.freebsd.org/changeset/base/322198
        >         
        >
        >         Log:
        >            Expose API to allow disks to ask for alias names in devfs.
        >               Implement disk_add_alias to allow aliases to be added to
        >         disks. All
        >            disk have a primary name (say "foo") can also have
        >         secondary names
        >            (say "bar") such that all instances of "foo" also have a "bar"
        >            alias. So if you have foo0, foo0p1, foo1, foo1s1 and
        >         foo1s1a nodes
        >            created by the foo driver and gpart, device nodes bar0,
        >         bar0p1, bar1,
        >            bar1s1 and bar1s1a will appear as symlinks back to the
        >         original nodes.
        >            This generalizes to multiple aliases. However, since the
        >         unit number
        >            follows the primary name, multiple device drivers can't
        >         create the
        >            same aliases unless those drives coorinate the unit number
        >         space (eg
        >            you couldn't add an alias 'disk' to both 'da' and 'ada'
        >         because it's
        >            possible to have da0 and ada0, because 'disk0' is ambiguous).
        >               Differential Revision:
        >         https://reviews.freebsd.org/D11873
        >         
        >
        >         Modified:
        >            head/share/man/man9/disk.9
        >            head/sys/geom/geom_disk.c
        >            head/sys/geom/geom_disk.h
        >
        >         Modified: head/share/man/man9/disk.9
        >         ==============================================================================
        >         --- head/share/man/man9/disk.9  Mon Aug  7 21:12:33 2017     
        >           (r322197)
        >         +++ head/share/man/man9/disk.9  Mon Aug  7 21:12:38 2017     
        >           (r322198)
        >         @@ -27,7 +27,7 @@
        >           .\"
        >           .\" $FreeBSD$
        >           .\"
        >         -.Dd October 30, 2012
        >         +.Dd August 3, 2017
        >           .Dt DISK 9
        >           .Os
        >           .Sh NAME
        >         @@ -45,6 +45,8 @@
        >           .Fn disk_destroy "struct disk *disk"
        >           .Ft int
        >           .Fn disk_resize "struct disk *disk" "int flags"
        >         +.Ft void
        >         +.Fn disk_add_alias "struct disk *disk" "const char *alias"
        >           .Sh DESCRIPTION
        >           The disk storage API permits kernel device drivers providing
        >         access to
        >           disk-like storage devices to advertise the device to other
        >         kernel
        >         @@ -69,6 +71,20 @@ function,
        >           fill in the fields and call
        >           .Fn disk_create
        >           when the device is ready to service requests.
        >         +.Fn disk_add_alias
        >         +adds an alias for the disk and must be called before
        >         +.Fn disk_create ,
        >         +but may be called multiple times.
        >         +For each alias added, a device node will be created with
        >         +.Xr make_dev_alias 9
        >         +in the same way primary device nodes are created with
        >         +.Xr make_dev 9
        >         +for
        >         +.Va d_name
        >         +and
        >         +.Va d_unit .
        >         +Care should be taken to ensure that only one driver creates
        >         aliases
        >         +for any given name.
        >           .Fn disk_resize
        >           can be called by the driver after modifying
        >           .Va d_mediasize
        >         @@ -227,7 +243,13 @@ structure for this disk device.
        >           .El
        >           .Sh SEE ALSO
        >           .Xr GEOM 4 ,
        >         -.Xr devfs 5
        >         +.Xr devfs 5 ,
        >         +.Xr MAKE_DEV 9
        >           .Sh AUTHORS
        >           This manual page was written by
        >           .An Robert Watson .
        >         +.Sh BUGS
        >         +Disk aliases are not a general purpose aliasing mechanism,
        >         but are
        >         +intended only to ease the transition from one name to another.
        >         +They can be used to ensure that nvd0 and nda0 are the same thing.
        >         +They cannot be used to implement the diskX concept from macOS.
        >
        >         Modified: head/sys/geom/geom_disk.c
        >         ==============================================================================
        >         --- head/sys/geom/geom_disk.c   Mon Aug  7 21:12:33 2017     
        >           (r322197)
        >         +++ head/sys/geom/geom_disk.c   Mon Aug  7 21:12:38 2017     
        >           (r322198)
        >         @@ -676,6 +676,7 @@ g_disk_create(void *arg, int flag)
        >                 struct g_provider *pp;
        >                 struct disk *dp;
        >                 struct g_disk_softc *sc;
        >         +       struct disk_alias *dap;
        >                 char tmpstr[80];
        >                 if (flag == EV_CANCEL)
        >         @@ -704,6 +705,10 @@ g_disk_create(void *arg, int flag)
        >                 sc->dp = dp;
        >                 gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name,
        >         dp->d_unit);
        >                 gp->softc = sc;
        >         +       LIST_FOREACH(dap, &dp->d_aliases, da_next) {
        >         +               snprintf(tmpstr, sizeof(tmpstr), "%s%d",
        >         dap->da_alias, dp->d_unit);
        >         +               g_geom_add_alias(gp, tmpstr);
        >         +       }
        >                 pp = g_new_providerf(gp, "%s", gp->name);
        >                 devstat_remove_entry(pp->stat);
        >                 pp->stat = NULL;
        >         @@ -791,6 +796,7 @@ g_disk_destroy(void *ptr, int flag)
        >                 struct disk *dp;
        >                 struct g_geom *gp;
        >                 struct g_disk_softc *sc;
        >         +       struct disk_alias *dap, *daptmp;
        >                 g_topology_assert();
        >                 dp = ptr;
        >         @@ -802,6 +808,8 @@ g_disk_destroy(void *ptr, int flag)
        >                         dp->d_geom = NULL;
        >                         g_wither_geom(gp, ENXIO);
        >                 }
        >         +       LIST_FOREACH_SAFE(dap, &dp->d_aliases, da_next, daptmp)
        >         +               g_free(dap);
        >                 g_free(dp);
        >           }
        >         @@ -834,8 +842,11 @@ g_disk_ident_adjust(char *ident, size_t size)
        >           struct disk *
        >           disk_alloc(void)
        >           {
        >         +       struct disk *dp;
        >           -     return (g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO));
        >         +       dp = g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO);
        >         +       LIST_INIT(&dp->d_aliases);
        >         +       return (dp);
        >           }
        >             void
        >         @@ -882,6 +893,18 @@ disk_destroy(struct disk *dp)
        >                 if (dp->d_devstat != NULL)
        >                         devstat_remove_entry(dp->d_devstat);
        >                 g_post_event(g_disk_destroy, dp, M_WAITOK, NULL);
        >         +}
        >         +
        >         +void
        >         +disk_add_alias(struct disk *dp, const char *name)
        >         +{
        >         +       struct disk_alias *dap;
        >         +
        >         +       dap = (struct disk_alias *)g_malloc(
        >         +               sizeof(struct disk_alias) + strlen(name) + 1,
        >         M_WAITOK);
        >         +       strcpy((char *)(dap + 1), name);
        >         +       dap->da_alias = (const char *)(dap + 1);
        >         +       LIST_INSERT_HEAD(&dp->d_aliases, dap, da_next);
        >           }
        >             void
        >
        >         Modified: head/sys/geom/geom_disk.h
        >         ==============================================================================
        >         --- head/sys/geom/geom_disk.h   Mon Aug  7 21:12:33 2017     
        >           (r322197)
        >         +++ head/sys/geom/geom_disk.h   Mon Aug  7 21:12:38 2017     
        >           (r322198)
        >         @@ -66,6 +66,11 @@ typedef enum {
        >                 DISK_INIT_DONE
        >           } disk_init_level;
        >           +struct disk_alias {
        >         +       LIST_ENTRY(disk_alias)  da_next;
        >         +       const char              *da_alias;
        >         +};
        >         +
        >           struct disk {
        >                 /* Fields which are private to geom_disk */
        >                 struct g_geom           *d_geom;
        >         @@ -109,6 +114,9 @@ struct disk {
        >                 /* Fields private to the driver */
        >                 void                    *d_drv1;
        >         +
        >         +       /* Fields private to geom_disk, to be moved on next
        >         version bump */
        >         +       LIST_HEAD(,disk_alias)  d_aliases;
        >           };
        >             #define DISKFLAG_RESERVED   0x1     /* Was NEEDSGIANT */
        >         @@ -132,6 +140,7 @@ void disk_attr_changed(struct disk *dp,
        >         const char *at
        >           void disk_media_changed(struct disk *dp, int flag);
        >           void disk_media_gone(struct disk *dp, int flag);
        >           int disk_resize(struct disk *dp, int flag);
        >         +void disk_add_alias(struct disk *disk, const char *);
        >             #define DISK_VERSION_00             0x58561059
        >           #define DISK_VERSION_01               0x5856105a
        >
        >
        >
        
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 22:27:27 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id EEC54DCCE64
         for ;
         Mon,  7 Aug 2017 22:27:27 +0000 (UTC)
         (envelope-from wlosh@bsdimp.com)
        Received: from mail-io0-x229.google.com (mail-io0-x229.google.com
         [IPv6:2607:f8b0:4001:c06::229])
         (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
         (Client CN "smtp.gmail.com",
         Issuer "Google Internet Authority G2" (verified OK))
         by mx1.freebsd.org (Postfix) with ESMTPS id B0F261C7F
         for ; Mon,  7 Aug 2017 22:27:27 +0000 (UTC)
         (envelope-from wlosh@bsdimp.com)
        Received: by mail-io0-x229.google.com with SMTP id c74so7533057iod.4
         for ; Mon, 07 Aug 2017 15:27:27 -0700 (PDT)
        DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
         d=bsdimp-com.20150623.gappssmtp.com; s=20150623;
         h=mime-version:sender:in-reply-to:references:from:date:message-id
         :subject:to:cc;
         bh=Dj4uVpHicX8f2cJwwuQVH4o8zHcichwoVDCHKZZXRBE=;
         b=oMx32OaBhmiD9xOyFcwRz1f8ajEl90Lw/Cuq21yzmotJuQYRCLGDS2AjBvBWyaWDis
         HssXcQ+pHu95p3MXb0Tcc/itbh2n6FcRS8otqEbt1iCgRdKDzzmHl5fv0ayLbRWbhcOO
         8my7PLdob4IlBT3Ml5vnBSL3N9z3jtbnTuQ55jhe4xZ3azc/qyhxMekILiMUR67dTHQF
         9PrwdA3D3RFbo//j2RiafyXH/P8HN/kBJJy/0pnO8QmUUrvQsPurVphyWkL52fMybNQY
         UzaOwfpNpOrA/gqicd0JcEIMZK8CWFNvFrN0+OuPKzkwYy3LsxBRQpMOtejkj658/MKp
         GkMQ==
        X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
         d=1e100.net; s=20161025;
         h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
         :date:message-id:subject:to:cc;
         bh=Dj4uVpHicX8f2cJwwuQVH4o8zHcichwoVDCHKZZXRBE=;
         b=lolJxK+EQw3K6aBUXHYrlvu3rnDhYQPJA9jYHntFQlOuaXO9dEjzbmP2X9OyA0jbyY
         SrzyVaj9eoi2bVosElj7Z60+/i6WVgyygS45DvqiYjTuSRkIiyD/upt8Ujq7t3Ma98Hm
         T8uDlwa6A3dgS5P3f4pJb8OprMoCDZTr/im8yXs1ldpblghh9kOkEZh62UTwgwGqMpDZ
         oad4RwGv7bFmgzZeQX1CMhPdj6heAa2SycCG/KI1aelEx3/dDFj52e1cqgCBD5CijI9p
         TCTwzFdgpWiybKMkNxXj2VnIfsPApiq7DvhhKLukBQ7Ca1CtZ23osiRvgDmaZk8kp5dM
         qWSw==
        X-Gm-Message-State: AHYfb5gnF/xI07+mswT5HReqVZh1W6J2mfKMMBUp1u5M5TTj92d5JNOw
         0tv5VHZcn4eWmXfFiBm66uoctkjc2Xkj
        X-Received: by 10.107.36.18 with SMTP id k18mr1998886iok.147.1502144847006;
         Mon, 07 Aug 2017 15:27:27 -0700 (PDT)
        MIME-Version: 1.0
        Sender: wlosh@bsdimp.com
        Received: by 10.79.10.71 with HTTP; Mon, 7 Aug 2017 15:27:26 -0700 (PDT)
        X-Originating-IP: [2603:300b:6:5100:f809:2296:13f6:2a42]
        In-Reply-To: 
        References: <201708072112.v77LCcXm001489@repo.freebsd.org>
         
         
         
        From: Warner Losh 
        Date: Mon, 7 Aug 2017 16:27:26 -0600
        X-Google-Sender-Auth: v2RLNhOy1-V9VJ32s9o_BFXmqFI
        Message-ID: 
        Subject: Re: svn commit: r322198 - in head: share/man/man9 sys/geom
        To: Nathan Whitehorn 
        Cc: Warner Losh , src-committers ,
         "svn-src-all@freebsd.org" , 
         "svn-src-head@freebsd.org" 
        Content-Type: text/plain; charset="UTF-8"
        X-Content-Filtered-By: Mailman/MimeDel 2.1.23
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 22:27:28 -0000
        
        On Mon, Aug 7, 2017 at 4:20 PM, Nathan Whitehorn 
        wrote:
        
        >
        >
        > On 08/07/17 14:32, Warner Losh wrote:
        >
        >
        >
        > On Mon, Aug 7, 2017 at 3:19 PM, Nathan Whitehorn 
        > wrote:
        >
        >> It would be really nice to let gpart provide aliases correct to partition
        >> labels, which would fix the existing racy and unreliable glabel code. Do
        >> you see any obstacles to using this code for that?
        >
        >
        > I'm not sure I understand well enough the issue here to have an opinion.
        >
        >
        > We get /dev/gpt/foo (etc.) right now by parsing the GPT labels with a
        > completely parallel piece of code to gpart and then create an extra geom
        > provider based on the label. This falls down in four ways:
        > 1. The code is racy. It is perfectly possible to get a GPT label set by
        > gpart but not have it picked up by glabel for some period of time that may
        > be infinite (until a retaste), since the events don't propagate.
        > 2. The resulting /dev entry is unpredictable from the label, since glabel
        > internally does some fixups related to spaces, etc. You need to copy and
        > paste glabel's munging code.
        > 3. It isn't implemented for all of the schemes gpart supports since it has
        > a reimplementation of the partition table parser.
        > 4. Because it uses an extra provider, mounting, say, /dev/adaXpY causes
        > /dev/gpt/Z to vanish.
        >
        > This combination of things is why we don't currently use labels in the
        > installer and never have. Having gpart internally create symlinks would fix
        > all of this at a stroke. I will take a look at this some more and see how
        > hard it would be to implement; at the very least, I think you would also
        > need a disk_remove_alias() or the like.
        >
        
        I've experienced all but #1 and #2. I've run systems for about a decade
        with root mounted on /dev/gpt/HOST-root, usr on /dev/gpt/HOST-usr, etc.
        Must have gotten lucky, or not hit the use case that you've seen.
        
        Not sure what's up with #3, but it sounds orthogonal and an incomplete
        gpart/glabel integration.
        
        #4 has always bothered me. While device aliases like I've done here would
        solve that problem, I'm not sure what other issues there'd be demoting
        glabel devices to mere /dev/ nodes from first class geom objects.
        
        The main issue I see is needing to have the aliases in place when tasting
        time comes for the geom being tasted. I haven't thought through geom's
        sequence enough to know if that would be more robust or not.
        
        Warner
        
        
        -Nathan
        >
        >
        > Warner
        >
        > On 08/07/17 14:12, Warner Losh wrote:
        >>
        >>> Author: imp
        >>> Date: Mon Aug  7 21:12:38 2017
        >>> New Revision: 322198
        >>> URL: https://svnweb.freebsd.org/changeset/base/322198
        >>>
        >>> Log:
        >>>    Expose API to allow disks to ask for alias names in devfs.
        >>>       Implement disk_add_alias to allow aliases to be added to disks. All
        >>>    disk have a primary name (say "foo") can also have secondary names
        >>>    (say "bar") such that all instances of "foo" also have a "bar"
        >>>    alias. So if you have foo0, foo0p1, foo1, foo1s1 and foo1s1a nodes
        >>>    created by the foo driver and gpart, device nodes bar0, bar0p1, bar1,
        >>>    bar1s1 and bar1s1a will appear as symlinks back to the original nodes.
        >>>    This generalizes to multiple aliases. However, since the unit number
        >>>    follows the primary name, multiple device drivers can't create the
        >>>    same aliases unless those drives coorinate the unit number space (eg
        >>>    you couldn't add an alias 'disk' to both 'da' and 'ada' because it's
        >>>    possible to have da0 and ada0, because 'disk0' is ambiguous).
        >>>       Differential Revision: https://reviews.freebsd.org/D11873
        >>>
        >>> Modified:
        >>>    head/share/man/man9/disk.9
        >>>    head/sys/geom/geom_disk.c
        >>>    head/sys/geom/geom_disk.h
        >>>
        >>> Modified: head/share/man/man9/disk.9
        >>> ============================================================
        >>> ==================
        >>> --- head/share/man/man9/disk.9  Mon Aug  7 21:12:33 2017        (r322197)
        >>> +++ head/share/man/man9/disk.9  Mon Aug  7 21:12:38 2017        (r322198)
        >>> @@ -27,7 +27,7 @@
        >>>   .\"
        >>>   .\" $FreeBSD$
        >>>   .\"
        >>> -.Dd October 30, 2012
        >>> +.Dd August 3, 2017
        >>>   .Dt DISK 9
        >>>   .Os
        >>>   .Sh NAME
        >>> @@ -45,6 +45,8 @@
        >>>   .Fn disk_destroy "struct disk *disk"
        >>>   .Ft int
        >>>   .Fn disk_resize "struct disk *disk" "int flags"
        >>> +.Ft void
        >>> +.Fn disk_add_alias "struct disk *disk" "const char *alias"
        >>>   .Sh DESCRIPTION
        >>>   The disk storage API permits kernel device drivers providing access to
        >>>   disk-like storage devices to advertise the device to other kernel
        >>> @@ -69,6 +71,20 @@ function,
        >>>   fill in the fields and call
        >>>   .Fn disk_create
        >>>   when the device is ready to service requests.
        >>> +.Fn disk_add_alias
        >>> +adds an alias for the disk and must be called before
        >>> +.Fn disk_create ,
        >>> +but may be called multiple times.
        >>> +For each alias added, a device node will be created with
        >>> +.Xr make_dev_alias 9
        >>> +in the same way primary device nodes are created with
        >>> +.Xr make_dev 9
        >>> +for
        >>> +.Va d_name
        >>> +and
        >>> +.Va d_unit .
        >>> +Care should be taken to ensure that only one driver creates aliases
        >>> +for any given name.
        >>>   .Fn disk_resize
        >>>   can be called by the driver after modifying
        >>>   .Va d_mediasize
        >>> @@ -227,7 +243,13 @@ structure for this disk device.
        >>>   .El
        >>>   .Sh SEE ALSO
        >>>   .Xr GEOM 4 ,
        >>> -.Xr devfs 5
        >>> +.Xr devfs 5 ,
        >>> +.Xr MAKE_DEV 9
        >>>   .Sh AUTHORS
        >>>   This manual page was written by
        >>>   .An Robert Watson .
        >>> +.Sh BUGS
        >>> +Disk aliases are not a general purpose aliasing mechanism, but are
        >>> +intended only to ease the transition from one name to another.
        >>> +They can be used to ensure that nvd0 and nda0 are the same thing.
        >>> +They cannot be used to implement the diskX concept from macOS.
        >>>
        >>> Modified: head/sys/geom/geom_disk.c
        >>> ============================================================
        >>> ==================
        >>> --- head/sys/geom/geom_disk.c   Mon Aug  7 21:12:33 2017        (r322197)
        >>> +++ head/sys/geom/geom_disk.c   Mon Aug  7 21:12:38 2017        (r322198)
        >>> @@ -676,6 +676,7 @@ g_disk_create(void *arg, int flag)
        >>>         struct g_provider *pp;
        >>>         struct disk *dp;
        >>>         struct g_disk_softc *sc;
        >>> +       struct disk_alias *dap;
        >>>         char tmpstr[80];
        >>>         if (flag == EV_CANCEL)
        >>> @@ -704,6 +705,10 @@ g_disk_create(void *arg, int flag)
        >>>         sc->dp = dp;
        >>>         gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit);
        >>>         gp->softc = sc;
        >>> +       LIST_FOREACH(dap, &dp->d_aliases, da_next) {
        >>> +               snprintf(tmpstr, sizeof(tmpstr), "%s%d", dap->da_alias,
        >>> dp->d_unit);
        >>> +               g_geom_add_alias(gp, tmpstr);
        >>> +       }
        >>>         pp = g_new_providerf(gp, "%s", gp->name);
        >>>         devstat_remove_entry(pp->stat);
        >>>         pp->stat = NULL;
        >>> @@ -791,6 +796,7 @@ g_disk_destroy(void *ptr, int flag)
        >>>         struct disk *dp;
        >>>         struct g_geom *gp;
        >>>         struct g_disk_softc *sc;
        >>> +       struct disk_alias *dap, *daptmp;
        >>>         g_topology_assert();
        >>>         dp = ptr;
        >>> @@ -802,6 +808,8 @@ g_disk_destroy(void *ptr, int flag)
        >>>                 dp->d_geom = NULL;
        >>>                 g_wither_geom(gp, ENXIO);
        >>>         }
        >>> +       LIST_FOREACH_SAFE(dap, &dp->d_aliases, da_next, daptmp)
        >>> +               g_free(dap);
        >>>         g_free(dp);
        >>>   }
        >>> @@ -834,8 +842,11 @@ g_disk_ident_adjust(char *ident, size_t size)
        >>>   struct disk *
        >>>   disk_alloc(void)
        >>>   {
        >>> +       struct disk *dp;
        >>>   -     return (g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO));
        >>> +       dp = g_malloc(sizeof(struct disk), M_WAITOK | M_ZERO);
        >>> +       LIST_INIT(&dp->d_aliases);
        >>> +       return (dp);
        >>>   }
        >>>     void
        >>> @@ -882,6 +893,18 @@ disk_destroy(struct disk *dp)
        >>>         if (dp->d_devstat != NULL)
        >>>                 devstat_remove_entry(dp->d_devstat);
        >>>         g_post_event(g_disk_destroy, dp, M_WAITOK, NULL);
        >>> +}
        >>> +
        >>> +void
        >>> +disk_add_alias(struct disk *dp, const char *name)
        >>> +{
        >>> +       struct disk_alias *dap;
        >>> +
        >>> +       dap = (struct disk_alias *)g_malloc(
        >>> +               sizeof(struct disk_alias) + strlen(name) + 1, M_WAITOK);
        >>> +       strcpy((char *)(dap + 1), name);
        >>> +       dap->da_alias = (const char *)(dap + 1);
        >>> +       LIST_INSERT_HEAD(&dp->d_aliases, dap, da_next);
        >>>   }
        >>>     void
        >>>
        >>> Modified: head/sys/geom/geom_disk.h
        >>> ============================================================
        >>> ==================
        >>> --- head/sys/geom/geom_disk.h   Mon Aug  7 21:12:33 2017        (r322197)
        >>> +++ head/sys/geom/geom_disk.h   Mon Aug  7 21:12:38 2017        (r322198)
        >>> @@ -66,6 +66,11 @@ typedef enum {
        >>>         DISK_INIT_DONE
        >>>   } disk_init_level;
        >>>   +struct disk_alias {
        >>> +       LIST_ENTRY(disk_alias)  da_next;
        >>> +       const char              *da_alias;
        >>> +};
        >>> +
        >>>   struct disk {
        >>>         /* Fields which are private to geom_disk */
        >>>         struct g_geom           *d_geom;
        >>> @@ -109,6 +114,9 @@ struct disk {
        >>>         /* Fields private to the driver */
        >>>         void                    *d_drv1;
        >>> +
        >>> +       /* Fields private to geom_disk, to be moved on next version bump
        >>> */
        >>> +       LIST_HEAD(,disk_alias)  d_aliases;
        >>>   };
        >>>     #define DISKFLAG_RESERVED   0x1     /* Was NEEDSGIANT */
        >>> @@ -132,6 +140,7 @@ void disk_attr_changed(struct disk *dp, const char
        >>> *at
        >>>   void disk_media_changed(struct disk *dp, int flag);
        >>>   void disk_media_gone(struct disk *dp, int flag);
        >>>   int disk_resize(struct disk *dp, int flag);
        >>> +void disk_add_alias(struct disk *disk, const char *);
        >>>     #define DISK_VERSION_00             0x58561059
        >>>   #define DISK_VERSION_01               0x5856105a
        >>>
        >>>
        >>
        >
        >
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 22:28:29 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66D57DCCF43;
         Mon,  7 Aug 2017 22:28:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id 32F901DE4;
         Mon,  7 Aug 2017 22:28:29 +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 v77MSSq8030617;
         Mon, 7 Aug 2017 22:28:28 GMT (envelope-from jkim@FreeBSD.org)
        Received: (from jkim@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77MSSgh030613;
         Mon, 7 Aug 2017 22:28:28 GMT (envelope-from jkim@FreeBSD.org)
        Message-Id: <201708072228.v77MSSgh030613@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: jkim set sender to
         jkim@FreeBSD.org using -f
        From: Jung-uk Kim 
        Date: Mon, 7 Aug 2017 22:28: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: r322204 - in stable/11/sys: amd64/amd64 i386/i386
         x86/include x86/x86
        X-SVN-Group: stable-11
        X-SVN-Commit-Author: jkim
        X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/i386 x86/include x86/x86
        X-SVN-Commit-Revision: 322204
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 22:28:29 -0000
        
        Author: jkim
        Date: Mon Aug  7 22:28:27 2017
        New Revision: 322204
        URL: https://svnweb.freebsd.org/changeset/base/322204
        
        Log:
          MFC:	r322076
          
          Detect hypervisor early so that we set lower hz on it.
        
        Modified:
          stable/11/sys/amd64/amd64/machdep.c
          stable/11/sys/i386/i386/machdep.c
          stable/11/sys/x86/include/x86_var.h
          stable/11/sys/x86/x86/identcpu.c
        Directory Properties:
          stable/11/   (props changed)
        
        Modified: stable/11/sys/amd64/amd64/machdep.c
        ==============================================================================
        --- stable/11/sys/amd64/amd64/machdep.c	Mon Aug  7 21:38:10 2017	(r322203)
        +++ stable/11/sys/amd64/amd64/machdep.c	Mon Aug  7 22:28:27 2017	(r322204)
        @@ -1544,6 +1544,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
         
         	kmdp = init_ops.parse_preload_data(modulep);
         
        +	identify_hypervisor();
        +
         	/* Init basic tunables, hz etc */
         	init_param1();
         
        
        Modified: stable/11/sys/i386/i386/machdep.c
        ==============================================================================
        --- stable/11/sys/i386/i386/machdep.c	Mon Aug  7 21:38:10 2017	(r322203)
        +++ stable/11/sys/i386/i386/machdep.c	Mon Aug  7 22:28:27 2017	(r322204)
        @@ -2472,6 +2472,8 @@ init386(int first)
         	else
         		init_static_kenv(NULL, 0);
         
        +	identify_hypervisor();
        +
         	/* Init basic tunables, hz etc */
         	init_param1();
         
        
        Modified: stable/11/sys/x86/include/x86_var.h
        ==============================================================================
        --- stable/11/sys/x86/include/x86_var.h	Mon Aug  7 21:38:10 2017	(r322203)
        +++ stable/11/sys/x86/include/x86_var.h	Mon Aug  7 22:28:27 2017	(r322204)
        @@ -116,6 +116,7 @@ void	cpu_setregs(void);
         void	dump_add_page(vm_paddr_t);
         void	dump_drop_page(vm_paddr_t);
         void	identify_cpu(void);
        +void	identify_hypervisor(void);
         void	initializecpu(void);
         void	initializecpucache(void);
         bool	fix_cpuid(void);
        
        Modified: stable/11/sys/x86/x86/identcpu.c
        ==============================================================================
        --- stable/11/sys/x86/x86/identcpu.c	Mon Aug  7 21:38:10 2017	(r322203)
        +++ stable/11/sys/x86/x86/identcpu.c	Mon Aug  7 22:28:27 2017	(r322204)
        @@ -1252,7 +1252,7 @@ static const char *const vm_pnames[] = {
         	NULL
         };
         
        -static void
        +void
         identify_hypervisor(void)
         {
         	u_int regs[4];
        @@ -1403,7 +1403,6 @@ identify_cpu(void)
         	cpu_feature2 = regs[2];
         #endif
         
        -	identify_hypervisor();
         	cpu_vendor_id = find_cpu_vendor_id();
         
         	if (fix_cpuid()) {
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 22:30:19 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id E064EDCD0A4;
         Mon,  7 Aug 2017 22:30:19 +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 mx1.freebsd.org (Postfix) with ESMTPS id B946C1F4B;
         Mon,  7 Aug 2017 22:30:19 +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 v77MUIBY030743;
         Mon, 7 Aug 2017 22:30:18 GMT (envelope-from jkim@FreeBSD.org)
        Received: (from jkim@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77MUI3N030738;
         Mon, 7 Aug 2017 22:30:18 GMT (envelope-from jkim@FreeBSD.org)
        Message-Id: <201708072230.v77MUI3N030738@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: jkim set sender to
         jkim@FreeBSD.org using -f
        From: Jung-uk Kim 
        Date: Mon, 7 Aug 2017 22:30:18 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322205 - in stable/10/sys: amd64/amd64 amd64/include
         i386/i386 i386/include x86/x86
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: jkim
        X-SVN-Commit-Paths: in stable/10/sys: amd64/amd64 amd64/include i386/i386
         i386/include x86/x86
        X-SVN-Commit-Revision: 322205
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 22:30:20 -0000
        
        Author: jkim
        Date: Mon Aug  7 22:30:18 2017
        New Revision: 322205
        URL: https://svnweb.freebsd.org/changeset/base/322205
        
        Log:
          MFC:	r322076
          
          Detect hypervisor early so that we set lower hz on it.
          > Description of fields to fill in above:                     76 columns --|
          > PR:                       If and which Problem Report is related.
          > Submitted by:             If someone else sent in the change.
          > Reported by:              If someone else reported the issue.
          > Reviewed by:              If someone else reviewed your modification.
          > Approved by:              If you needed approval for this commit.
          > Obtained from:            If the change is from a third party.
          > MFC after:                N [day[s]|week[s]|month[s]].  Request a reminder email.
          > MFH:                      Ports tree branch name.  Request approval for merge.
          > Relnotes:                 Set to 'yes' for mention in release notes.
          > Security:                 Vulnerability reference (one per line) or description.
          > Sponsored by:             If the change was sponsored by an organization.
          > Differential Revision:    https://reviews.freebsd.org/D### (*full* phabric URL needed).
          > Empty fields above will be automatically removed.
          
          _M   .
          M    sys/amd64/amd64/machdep.c
          M    sys/amd64/include/md_var.h
          M    sys/i386/i386/machdep.c
          M    sys/i386/include/md_var.h
          M    sys/x86/x86/identcpu.c
        
        Modified:
          stable/10/sys/amd64/amd64/machdep.c
          stable/10/sys/amd64/include/md_var.h
          stable/10/sys/i386/i386/machdep.c
          stable/10/sys/i386/include/md_var.h
          stable/10/sys/x86/x86/identcpu.c
        Directory Properties:
          stable/10/   (props changed)
        
        Modified: stable/10/sys/amd64/amd64/machdep.c
        ==============================================================================
        --- stable/10/sys/amd64/amd64/machdep.c	Mon Aug  7 22:28:27 2017	(r322204)
        +++ stable/10/sys/amd64/amd64/machdep.c	Mon Aug  7 22:30:18 2017	(r322205)
        @@ -1853,6 +1853,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
         	ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t);
         #endif
         
        +	identify_hypervisor();
        +
         	/* Init basic tunables, hz etc */
         	init_param1();
         
        
        Modified: stable/10/sys/amd64/include/md_var.h
        ==============================================================================
        --- stable/10/sys/amd64/include/md_var.h	Mon Aug  7 22:28:27 2017	(r322204)
        +++ stable/10/sys/amd64/include/md_var.h	Mon Aug  7 22:30:18 2017	(r322205)
        @@ -120,6 +120,7 @@ void	gsbase_load_fault(void) __asm(__STRING(gsbase_loa
         void	dump_add_page(vm_paddr_t);
         void	dump_drop_page(vm_paddr_t);
         void	identify_cpu(void);
        +void	identify_hypervisor(void);
         void	initializecpu(void);
         void	initializecpucache(void);
         bool	fix_cpuid(void);
        
        Modified: stable/10/sys/i386/i386/machdep.c
        ==============================================================================
        --- stable/10/sys/i386/i386/machdep.c	Mon Aug  7 22:28:27 2017	(r322204)
        +++ stable/10/sys/i386/i386/machdep.c	Mon Aug  7 22:30:18 2017	(r322205)
        @@ -3195,6 +3195,10 @@ init386(int first)
         	else
         		init_static_kenv(NULL, 0);
         
        +#ifndef XEN
        +	identify_hypervisor();
        +#endif
        +
         	/* Init basic tunables, hz etc */
         	init_param1();
         
        
        Modified: stable/10/sys/i386/include/md_var.h
        ==============================================================================
        --- stable/10/sys/i386/include/md_var.h	Mon Aug  7 22:28:27 2017	(r322204)
        +++ stable/10/sys/i386/include/md_var.h	Mon Aug  7 22:30:18 2017	(r322205)
        @@ -128,6 +128,7 @@ void	dump_drop_page(vm_paddr_t);
         void	finishidentcpu(void);
         void	fillw(int /*u_short*/ pat, void *base, size_t cnt);
         void	fill_based_sd(struct segment_descriptor *sdp, uint32_t base);
        +void	identify_hypervisor(void);
         void	initializecpu(void);
         void	initializecpucache(void);
         bool	fix_cpuid(void);
        
        Modified: stable/10/sys/x86/x86/identcpu.c
        ==============================================================================
        --- stable/10/sys/x86/x86/identcpu.c	Mon Aug  7 22:28:27 2017	(r322204)
        +++ stable/10/sys/x86/x86/identcpu.c	Mon Aug  7 22:30:18 2017	(r322205)
        @@ -1229,7 +1229,7 @@ static const char *const vm_pnames[] = {
         	NULL
         };
         
        -static void
        +void
         identify_hypervisor(void)
         {
         	u_int regs[4];
        @@ -1377,9 +1377,6 @@ identify_cpu(void)
         	cpu_feature2 = regs[2];
         #endif
         
        -#ifndef XEN
        -	identify_hypervisor();
        -#endif
         	cpu_vendor_id = find_cpu_vendor_id();
         
         	if (fix_cpuid()) {
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 22:42:47 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6ED5CDCDAC6;
         Mon,  7 Aug 2017 22:42:47 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3BC8E2784;
         Mon,  7 Aug 2017 22:42:47 +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 v77Mgkal038377;
         Mon, 7 Aug 2017 22:42:46 GMT (envelope-from imp@FreeBSD.org)
        Received: (from imp@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77Mgk5H038376;
         Mon, 7 Aug 2017 22:42:46 GMT (envelope-from imp@FreeBSD.org)
        Message-Id: <201708072242.v77Mgk5H038376@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org
         using -f
        From: Warner Losh 
        Date: Mon, 7 Aug 2017 22:42:46 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322206 - head/sys/geom
        X-SVN-Group: head
        X-SVN-Commit-Author: imp
        X-SVN-Commit-Paths: head/sys/geom
        X-SVN-Commit-Revision: 322206
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 22:42:47 -0000
        
        Author: imp
        Date: Mon Aug  7 22:42:46 2017
        New Revision: 322206
        URL: https://svnweb.freebsd.org/changeset/base/322206
        
        Log:
          Eliminate useless adjustments of aliased device.
          
          No need to set any fields in the cloned device. devfs uses symlinks,
          so the adev entries returned won't be presented to the drivers. Since
          we don't save copies, nothing else will see them. This code came from
          the old compat code, and it appears to be obsolete or never needed.
          
          Submitted by: kib@
          Differential Review: https://reviews.freebsd.org/D11919
        
        Modified:
          head/sys/geom/geom_dev.c
        
        Modified: head/sys/geom/geom_dev.c
        ==============================================================================
        --- head/sys/geom/geom_dev.c	Mon Aug  7 22:30:18 2017	(r322205)
        +++ head/sys/geom/geom_dev.c	Mon Aug  7 22:42:46 2017	(r322206)
        @@ -369,9 +369,6 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp,
         			    __func__, gap->ga_alias, error);
         			continue;
         		}
        -		adev->si_flags |= SI_UNMAPPED;
        -		adev->si_iosize_max = dev->si_iosize_max;
        -		adev->si_drv2 = dev->si_drv2;
         		snprintf(buf, sizeof(buf), "cdev=%s", gap->ga_alias);
         		devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK);
         	}
        
        From owner-svn-src-all@freebsd.org  Mon Aug  7 23:33:07 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60399DD02AD;
         Mon,  7 Aug 2017 23:33:07 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2F04F636E2;
         Mon,  7 Aug 2017 23:33:07 +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 v77NX6L5058684;
         Mon, 7 Aug 2017 23:33:06 GMT (envelope-from marius@FreeBSD.org)
        Received: (from marius@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v77NX6T7058679;
         Mon, 7 Aug 2017 23:33:06 GMT (envelope-from marius@FreeBSD.org)
        Message-Id: <201708072333.v77NX6T7058679@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: marius set sender to
         marius@FreeBSD.org using -f
        From: Marius Strobl 
        Date: Mon, 7 Aug 2017 23:33:06 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322209 - head/sys/dev/mmc
        X-SVN-Group: head
        X-SVN-Commit-Author: marius
        X-SVN-Commit-Paths: head/sys/dev/mmc
        X-SVN-Commit-Revision: 322209
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 07 Aug 2017 23:33:07 -0000
        
        Author: marius
        Date: Mon Aug  7 23:33:05 2017
        New Revision: 322209
        URL: https://svnweb.freebsd.org/changeset/base/322209
        
        Log:
          - If available, use TRIM instead of ERASE for implementing BIO_DELETE.
            This also involves adding a quirk table as TRIM is broken for some
            Kingston eMMC devices, though. Compared to ERASE (declared "legacy"
            in the eMMC specification v5.1), TRIM has the advantage of operating
            on write sectors rather than on erase sectors, which typically are
            of a much larger size. Thus, employing TRIM, we don't need to fiddle
            with coalescing BIO_DELETE requests that are also of (write) sector
            units into erase sectors, which might not even add up in all cases.
          - For some SanDisk iNAND devices, the CMD38 argument, e. g. ERASE,
            TRIM etc., has to be specified via EXT_CSD[113], which now is also
            handled via a quirk.
          - My initial understanding was that for eMMC partitions, the granularity
            should be used as erase sector size, e. g. 128 KB for boot partitions.
            However, rereading the relevant parts of the eMMC specification v5.1,
            this isn't actually correct. So drop the code which used partition
            granularities for delmaxsize and stripesize. For the most part, this
            change is a NOP, though, because a) for ERASE, mmcsd_delete() used
            the erase sector size unconditionally for all partitions anyway and
            b) g_disk_limit() doesn't actually take the stripesize into account.
          - Take some more advantage of mmcsd_errmsg() in mmcsd(4) for making
            error codes human readable.
        
        Modified:
          head/sys/dev/mmc/bridge.h
          head/sys/dev/mmc/mmc.c
          head/sys/dev/mmc/mmcreg.h
          head/sys/dev/mmc/mmcsd.c
          head/sys/dev/mmc/mmcvar.h
        
        Modified: head/sys/dev/mmc/bridge.h
        ==============================================================================
        --- head/sys/dev/mmc/bridge.h	Mon Aug  7 23:32:00 2017	(r322208)
        +++ head/sys/dev/mmc/bridge.h	Mon Aug  7 23:33:05 2017	(r322209)
        @@ -180,7 +180,7 @@ struct mmc_host {
         extern driver_t   mmc_driver;
         extern devclass_t mmc_devclass;
         
        -#define	MMC_VERSION	4
        +#define	MMC_VERSION	5
         
         #define	MMC_DECLARE_BRIDGE(name)					\
             DRIVER_MODULE(mmc, name, mmc_driver, mmc_devclass, NULL, NULL);	\
        
        Modified: head/sys/dev/mmc/mmc.c
        ==============================================================================
        --- head/sys/dev/mmc/mmc.c	Mon Aug  7 23:32:00 2017	(r322208)
        +++ head/sys/dev/mmc/mmc.c	Mon Aug  7 23:33:05 2017	(r322209)
        @@ -104,12 +104,34 @@ struct mmc_ivars {
         	uint32_t hs_tran_speed;	/* Max speed in high speed mode */
         	uint32_t erase_sector;	/* Card native erase sector size */
         	uint32_t cmd6_time;	/* Generic switch timeout [us] */
        +	uint32_t quirks;	/* Quirks as per mmc_quirk->quirks */
         	char card_id_string[64];/* Formatted CID info (serial, MFG, etc) */
         	char card_sn_string[16];/* Formatted serial # for disk->d_ident */
         };
         
         #define	CMD_RETRIES	3
         
        +static const struct mmc_quirk mmc_quirks[] = {
        +	/*
        +	 * For some SanDisk iNAND devices, the CMD38 argument needs to be
        +	 * provided in EXT_CSD[113].
        +	 */
        +	{ 0x2, 0x100,	 		"SEM02G", MMC_QUIRK_INAND_CMD38 },
        +	{ 0x2, 0x100,			"SEM04G", MMC_QUIRK_INAND_CMD38 },
        +	{ 0x2, 0x100,			"SEM08G", MMC_QUIRK_INAND_CMD38 },
        +	{ 0x2, 0x100,			"SEM16G", MMC_QUIRK_INAND_CMD38 },
        +	{ 0x2, 0x100,			"SEM32G", MMC_QUIRK_INAND_CMD38 },
        +
        +	/*
        +	 * Disable TRIM for Kingston eMMCs where a firmware bug can lead to
        +	 * unrecoverable data corruption.
        +	 */
        +	{ 0x70, MMC_QUIRK_OID_ANY,	"V10008", MMC_QUIRK_BROKEN_TRIM },
        +	{ 0x70, MMC_QUIRK_OID_ANY,	"V10016", MMC_QUIRK_BROKEN_TRIM },
        +
        +	{ 0x0, 0x0, NULL, 0x0 }
        +};
        +
         static SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, NULL, "mmc driver");
         
         static int mmc_debug;
        @@ -1109,7 +1131,7 @@ mmc_format_card_id_string(struct mmc_ivars *ivar)
         	/*
         	 * Format a card ID string for use by the mmcsd driver, it's what
         	 * appears between the <> in the following:
        -	 * mmcsd0: 968MB  at mmc0
        +	 * mmcsd0: 968MB  at mmc0
         	 * 22.5MHz/4bit/128-block
         	 *
         	 * Also format just the card serial number, which the mmcsd driver will
        @@ -1547,6 +1569,7 @@ mmc_log_card(device_t dev, struct mmc_ivars *ivar, int
         			break;
         		}
         	}
        +	device_printf(dev, " quirks: %b\n", ivar->quirks, MMC_QUIRKS_FMT);
         	device_printf(dev, " bus: %ubit, %uMHz (%s timing)\n",
         	    (ivar->bus_width == bus_width_1 ? 1 :
         	    (ivar->bus_width == bus_width_4 ? 4 : 8)),
        @@ -1563,6 +1586,7 @@ mmc_discover_cards(struct mmc_softc *sc)
         	u_char switch_res[64];
         	uint32_t raw_cid[4];
         	struct mmc_ivars *ivar = NULL;
        +	const struct mmc_quirk *quirk;
         	device_t child;
         	int err, host_caps, i, newcard;
         	uint32_t resp, sec_count, status;
        @@ -1870,6 +1894,18 @@ mmc_discover_cards(struct mmc_softc *sc)
         		    ivar->raw_ext_csd[EXT_CSD_REV] >= 5);
         
         child_common:
        +		for (quirk = &mmc_quirks[0]; quirk->mid != 0x0; quirk++) {
        +			if ((quirk->mid == MMC_QUIRK_MID_ANY ||
        +			    quirk->mid == ivar->cid.mid) &&
        +			    (quirk->oid == MMC_QUIRK_OID_ANY ||
        +			    quirk->oid == ivar->cid.oid) &&
        +			    strncmp(quirk->pnm, ivar->cid.pnm,
        +			    sizeof(ivar->cid.pnm)) == 0) {
        +				ivar->quirks = quirk->quirks;
        +				break;
        +			}
        +		}
        +
         		/*
         		 * Some cards that report maximum I/O block sizes greater
         		 * than 512 require the block length to be set to 512, even
        @@ -2470,6 +2506,12 @@ mmc_read_ivar(device_t bus, device_t child, int which,
         		break;
         	case MMC_IVAR_MAX_DATA:
         		*result = mmcbr_get_max_data(bus);
        +		break;
        +	case MMC_IVAR_CMD6_TIMEOUT:
        +		*result = ivar->cmd6_time;
        +		break;
        +	case MMC_IVAR_QUIRKS:
        +		*result = ivar->quirks;
         		break;
         	case MMC_IVAR_CARD_ID_STRING:
         		*(char **)result = ivar->card_id_string;
        
        Modified: head/sys/dev/mmc/mmcreg.h
        ==============================================================================
        --- head/sys/dev/mmc/mmcreg.h	Mon Aug  7 23:32:00 2017	(r322208)
        +++ head/sys/dev/mmc/mmcreg.h	Mon Aug  7 23:33:05 2017	(r322209)
        @@ -268,6 +268,13 @@ struct mmc_request {
         #define	MMC_ERASE_GROUP_END	36
         			/* 37 -- reserved old command */
         #define	MMC_ERASE		38
        +#define	 MMC_ERASE_ERASE	0x00000000
        +#define	 MMC_ERASE_TRIM		0x00000001
        +#define	 MMC_ERASE_FULE		0x00000002
        +#define	 MMC_ERASE_DISCARD	0x00000003
        +#define	 MMC_ERASE_SECURE_ERASE	0x80000000
        +#define	 MMC_ERASE_SECURE_TRIM1	0x80000001
        +#define	 MMC_ERASE_SECURE_TRIM2	0x80008000
         
         /* Class 9: I/O mode commands */
         #define	MMC_FAST_IO		39
        @@ -375,6 +382,7 @@ struct mmc_request {
         #define	EXT_CSD_ERASE_TO_MULT	223	/* RO */
         #define	EXT_CSD_ERASE_GRP_SIZE	224	/* RO */
         #define	EXT_CSD_BOOT_SIZE_MULT	226	/* RO */
        +#define	EXT_CSD_SEC_FEATURE_SUPPORT 231	/* RO */
         #define	EXT_CSD_PWR_CL_200_195	236	/* RO */
         #define	EXT_CSD_PWR_CL_200_360	237	/* RO */
         #define	EXT_CSD_PWR_CL_52_195_DDR 238	/* RO */
        @@ -459,6 +467,22 @@ struct mmc_request {
         
         #define	EXT_CSD_STROBE_SUPPORT_EN	0x01
         
        +#define	EXT_CSD_SEC_FEATURE_SUPPORT_ER_EN	0x01
        +#define	EXT_CSD_SEC_FEATURE_SUPPORT_BD_BLK_EN	0x04
        +#define	EXT_CSD_SEC_FEATURE_SUPPORT_GB_CL_EN	0x10
        +#define	EXT_CSD_SEC_FEATURE_SUPPORT_SANITIZE	0x40
        +
        +/*
        + * Vendor specific EXT_CSD fields
        + */
        +/* SanDisk iNAND */
        +#define	EXT_CSD_INAND_CMD38			113
        +#define	 EXT_CSD_INAND_CMD38_ERASE		0x00
        +#define	 EXT_CSD_INAND_CMD38_TRIM		0x01
        +#define	 EXT_CSD_INAND_CMD38_SECURE_ERASE	0x80
        +#define	 EXT_CSD_INAND_CMD38_SECURE_TRIM1	0x81
        +#define	 EXT_CSD_INAND_CMD38_SECURE_TRIM2	0x82
        +
         #define	MMC_TYPE_HS_26_MAX		26000000
         #define	MMC_TYPE_HS_52_MAX		52000000
         #define	MMC_TYPE_DDR52_MAX		52000000
        @@ -600,8 +624,7 @@ struct mmc_cid {
         	uint8_t fwrev;
         };
         
        -struct mmc_csd
        -{
        +struct mmc_csd {
         	uint8_t csd_structure;
         	uint8_t spec_vers;
         	uint16_t ccc;
        @@ -627,16 +650,14 @@ struct mmc_csd
         	    wp_grp_enable:1;
         };
         
        -struct mmc_scr
        -{
        +struct mmc_scr {
         	unsigned char		sda_vsn;
         	unsigned char		bus_widths;
         #define	SD_SCR_BUS_WIDTH_1	(1 << 0)
         #define	SD_SCR_BUS_WIDTH_4	(1 << 2)
         };
         
        -struct mmc_sd_status
        -{
        +struct mmc_sd_status {
         	uint8_t			bus_width;
         	uint8_t			secured_mode;
         	uint16_t		card_type;
        @@ -648,6 +669,19 @@ struct mmc_sd_status
         	uint8_t			erase_timeout;
         	uint8_t			erase_offset;
         };
        +
        +struct mmc_quirk {
        +	uint32_t mid;
        +#define	MMC_QUIRK_MID_ANY	((uint32_t)-1)
        +	uint16_t oid;
        +#define	MMC_QUIRK_OID_ANY	((uint16_t)-1)
        +	const char *pnm;
        +	uint32_t quirks;
        +#define	MMC_QUIRK_INAND_CMD38	0x0001
        +#define	MMC_QUIRK_BROKEN_TRIM	0x0002
        +};
        +
        +#define	MMC_QUIRKS_FMT		"\020" "\001INAND_CMD38" "\002BROKEN_TRIM"
         
         /*
          * Various MMC/SD constants
        
        Modified: head/sys/dev/mmc/mmcsd.c
        ==============================================================================
        --- head/sys/dev/mmc/mmcsd.c	Mon Aug  7 23:32:00 2017	(r322208)
        +++ head/sys/dev/mmc/mmcsd.c	Mon Aug  7 23:33:05 2017	(r322209)
        @@ -126,6 +126,10 @@ struct mmcsd_softc {
         	uint8_t part_curr;	/* Partition currently switched to */
         	uint8_t ext_csd[MMC_EXTCSD_SIZE];
         	uint16_t rca;
        +	uint32_t flags;
        +#define	MMCSD_INAND_CMD38	0x0001
        +#define	MMCSD_USE_TRIM		0x0002
        +	uint32_t cmd6_time;	/* Generic switch timeout [us] */
         	uint32_t part_time;	/* Partition switch timeout [us] */
         	off_t enh_base;		/* Enhanced user data area slice base ... */
         	off_t enh_size;		/* ... and size [bytes] */
        @@ -168,9 +172,10 @@ static int mmcsd_ioctl_rpmb(struct cdev *dev, u_long c
             int fflag, struct thread *td);
         
         static void mmcsd_add_part(struct mmcsd_softc *sc, u_int type,
        -    const char *name, u_int cnt, off_t media_size, off_t erase_size, bool ro);
        +    const char *name, u_int cnt, off_t media_size, bool ro);
         static int mmcsd_bus_bit_width(device_t dev);
         static daddr_t mmcsd_delete(struct mmcsd_part *part, struct bio *bp);
        +static const char *mmcsd_errmsg(int e);
         static int mmcsd_ioctl(struct mmcsd_part *part, u_long cmd, void *data,
             int fflag);
         static int mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic,
        @@ -221,6 +226,7 @@ mmcsd_attach(device_t dev)
         	off_t erase_size, sector_size, size, wp_size;
         	uintmax_t bytes;
         	int err, i;
        +	uint32_t quirks;
         	uint8_t rev;
         	bool comp, ro;
         	char unit[2];
        @@ -239,21 +245,48 @@ mmcsd_attach(device_t dev)
         	 * place either.
         	 */
         	sc->max_data = mmc_get_max_data(dev);
        -	sc->erase_sector = mmc_get_erase_sector(dev);
         	sc->high_cap = mmc_get_high_cap(dev);
         	sc->rca = mmc_get_rca(dev);
        +	sc->cmd6_time = mmc_get_cmd6_timeout(dev);
        +	quirks = mmc_get_quirks(dev);
         
         	/* Only MMC >= 4.x devices support EXT_CSD. */
         	if (mmc_get_spec_vers(dev) >= 4) {
         		MMCBUS_ACQUIRE_BUS(mmcbus, dev);
         		err = mmc_send_ext_csd(mmcbus, dev, sc->ext_csd);
         		MMCBUS_RELEASE_BUS(mmcbus, dev);
        -		if (err != MMC_ERR_NONE)
        -			bzero(sc->ext_csd, sizeof(sc->ext_csd));
        +		if (err != MMC_ERR_NONE) {
        +			device_printf(dev, "Error reading EXT_CSD %s\n",
        +			    mmcsd_errmsg(err));
        +			return (ENXIO);
        +		}
         	}
         	ext_csd = sc->ext_csd;
         
        +	if ((quirks & MMC_QUIRK_INAND_CMD38) != 0) {
        +		if (mmc_get_spec_vers(dev) < 4) {
        +			device_printf(dev,
        +			    "MMC_QUIRK_INAND_CMD38 set but no EXT_CSD\n");
        +			return (EINVAL);
        +		}
        +		sc->flags |= MMCSD_INAND_CMD38;
        +	}
        +
         	/*
        +	 * EXT_CSD_SEC_FEATURE_SUPPORT_GB_CL_EN denotes support for both
        +	 * insecure and secure TRIM.
        +	 */
        +	if ((ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT] &
        +	    EXT_CSD_SEC_FEATURE_SUPPORT_GB_CL_EN) != 0 &&
        +	    (quirks & MMC_QUIRK_BROKEN_TRIM) == 0) {
        +		if (bootverbose)
        +			device_printf(dev, "taking advantage of TRIM\n");
        +		sc->flags |= MMCSD_USE_TRIM;
        +		sc->erase_sector = 1;
        +	} else
        +		sc->erase_sector = mmc_get_erase_sector(dev);
        +
        +	/*
         	 * Enhanced user data area and general purpose partitions are only
         	 * supported in revision 1.4 (EXT_CSD_REV == 4) and later, the RPMB
         	 * partition in revision 1.5 (MMC v4.41, EXT_CSD_REV == 5) and later.
        @@ -306,8 +339,7 @@ mmcsd_attach(device_t dev)
         	 */
         	ro = mmc_get_read_only(dev);
         	mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_DEFAULT, "mmcsd",
        -	    device_get_unit(dev), mmc_get_media_size(dev) * sector_size,
        -	    sc->erase_sector * sector_size, ro);
        +	    device_get_unit(dev), mmc_get_media_size(dev) * sector_size, ro);
         
         	if (mmc_get_spec_vers(dev) < 3)
         		return (0);
        @@ -332,11 +364,11 @@ mmcsd_attach(device_t dev)
         	size = ext_csd[EXT_CSD_BOOT_SIZE_MULT] * MMC_BOOT_RPMB_BLOCK_SIZE;
         	if (size > 0 && (mmcbr_get_caps(mmcbus) & MMC_CAP_BOOT_NOACC) == 0) {
         		mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_BOOT0,
        -		    MMCSD_FMT_BOOT, 0, size, MMC_BOOT_RPMB_BLOCK_SIZE,
        +		    MMCSD_FMT_BOOT, 0, size,
         		    ro | ((ext_csd[EXT_CSD_BOOT_WP_STATUS] &
         		    EXT_CSD_BOOT_WP_STATUS_BOOT0_MASK) != 0));
         		mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_BOOT1,
        -		    MMCSD_FMT_BOOT, 1, size, MMC_BOOT_RPMB_BLOCK_SIZE,
        +		    MMCSD_FMT_BOOT, 1, size,
         		    ro | ((ext_csd[EXT_CSD_BOOT_WP_STATUS] &
         		    EXT_CSD_BOOT_WP_STATUS_BOOT1_MASK) != 0));
         	}
        @@ -345,7 +377,7 @@ mmcsd_attach(device_t dev)
         	size = ext_csd[EXT_CSD_RPMB_MULT] * MMC_BOOT_RPMB_BLOCK_SIZE;
         	if (rev >= 5 && size > 0)
         		mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_RPMB,
        -		    MMCSD_FMT_RPMB, 0, size, MMC_BOOT_RPMB_BLOCK_SIZE, ro);
        +		    MMCSD_FMT_RPMB, 0, size, ro);
         
         	if (rev <= 3 || comp == FALSE)
         		return (0);
        @@ -365,8 +397,7 @@ mmcsd_attach(device_t dev)
         			if (size == 0)
         				continue;
         			mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_GP0 + i,
        -			    MMCSD_FMT_GP, i, size * erase_size * wp_size,
        -			    erase_size, ro);
        +			    MMCSD_FMT_GP, i, size * erase_size * wp_size, ro);
         		}
         	}
         	return (0);
        @@ -419,7 +450,7 @@ static struct cdevsw mmcsd_rpmb_cdevsw = {
         
         static void
         mmcsd_add_part(struct mmcsd_softc *sc, u_int type, const char *name, u_int cnt,
        -    off_t media_size, off_t erase_size, bool ro)
        +    off_t media_size, bool ro)
         {
         	struct make_dev_args args;
         	device_t dev, mmcbus;
        @@ -482,10 +513,10 @@ mmcsd_add_part(struct mmcsd_softc *sc, u_int type, con
         		d->d_sectorsize = mmc_get_sector_size(dev);
         		d->d_maxsize = sc->max_data * d->d_sectorsize;
         		d->d_mediasize = media_size;
        -		d->d_stripesize = erase_size;
        +		d->d_stripesize = sc->erase_sector * d->d_sectorsize;
         		d->d_unit = cnt;
         		d->d_flags = DISKFLAG_CANDELETE;
        -		d->d_delmaxsize = erase_size;
        +		d->d_delmaxsize = mmc_get_erase_sector(dev) * d->d_sectorsize;
         		strlcpy(d->d_ident, mmc_get_card_sn_string(dev),
         		    sizeof(d->d_ident));
         		strlcpy(d->d_descr, mmc_get_card_id_string(dev),
        @@ -1151,6 +1182,8 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp)
         	struct mmcsd_softc *sc;
         	device_t dev, mmcbus;
         	u_int erase_sector, sz;
        +	int err;
        +	bool use_trim;
         
         	sc = part->sc;
         	dev = sc->dev;
        @@ -1159,24 +1192,46 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp)
         	block = bp->bio_pblkno;
         	sz = part->disk->d_sectorsize;
         	end = bp->bio_pblkno + (bp->bio_bcount / sz);
        -	/* Coalesce with part remaining from previous request. */
        -	if (block > part->eblock && block <= part->eend)
        -		block = part->eblock;
        -	if (end >= part->eblock && end < part->eend)
        -		end = part->eend;
        -	/* Safe round to the erase sector boundaries. */
        -	erase_sector = sc->erase_sector;
        -	start = block + erase_sector - 1;	 /* Round up. */
        -	start -= start % erase_sector;
        -	stop = end;				/* Round down. */
        -	stop -= end % erase_sector;
        -	/* We can't erase an area smaller than a sector, store it for later. */
        -	if (start >= stop) {
        -		part->eblock = block;
        -		part->eend = end;
        -		return (end);
        +	use_trim = sc->flags & MMCSD_USE_TRIM;
        +	if (use_trim == true) {
        +		start = block;
        +		stop = end;
        +	} else {
        +		/* Coalesce with the remainder of the previous request. */
        +		if (block > part->eblock && block <= part->eend)
        +			block = part->eblock;
        +		if (end >= part->eblock && end < part->eend)
        +			end = part->eend;
        +		/* Safely round to the erase sector boundaries. */
        +		erase_sector = sc->erase_sector;
        +		start = block + erase_sector - 1;	 /* Round up. */
        +		start -= start % erase_sector;
        +		stop = end;				/* Round down. */
        +		stop -= end % erase_sector;
        +		/*
        +		 * We can't erase an area smaller than an erase sector, so
        +		 * store it for later.
        +		 */
        +		if (start >= stop) {
        +			part->eblock = block;
        +			part->eend = end;
        +			return (end);
        +		}
         	}
         
        +	if ((sc->flags & MMCSD_INAND_CMD38) != 0) {
        +		err = mmc_switch(mmcbus, dev, sc->rca, EXT_CSD_CMD_SET_NORMAL,
        +		    EXT_CSD_INAND_CMD38, use_trim == true ?
        +		    EXT_CSD_INAND_CMD38_TRIM : EXT_CSD_INAND_CMD38_ERASE,
        +		    sc->cmd6_time, true);
        +		if (err != MMC_ERR_NONE) {
        +			device_printf(dev,
        +			    "Setting iNAND erase command failed %s\n",
        +			    mmcsd_errmsg(err));
        +			return (block);
        +		}
        +	}
        +
         	/*
         	 * Pause re-tuning so it won't interfere with the order of erase
         	 * commands.  Note that these latter don't use the data lines, so
        @@ -1198,8 +1253,8 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp)
         	cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
         	MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req);
         	if (req.cmd->error != MMC_ERR_NONE) {
        -		device_printf(dev, "Setting erase start position failed %d\n",
        -		    req.cmd->error);
        +		device_printf(dev, "Setting erase start position failed %s\n",
        +		    mmcsd_errmsg(req.cmd->error));
         		block = bp->bio_pblkno;
         		goto unpause;
         	}
        @@ -1218,8 +1273,8 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp)
         	cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
         	MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req);
         	if (req.cmd->error != MMC_ERR_NONE) {
        -		device_printf(dev, "Setting erase stop position failed %d\n",
        -		    req.cmd->error);
        +		device_printf(dev, "Setting erase stop position failed %s\n",
        +		    mmcsd_errmsg(req.cmd->error));
         		block = bp->bio_pblkno;
         		goto unpause;
         	}
        @@ -1228,23 +1283,24 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp)
         	memset(&cmd, 0, sizeof(cmd));
         	req.cmd = &cmd;
         	cmd.opcode = MMC_ERASE;
        -	cmd.arg = 0;
        +	cmd.arg = use_trim == true ? MMC_ERASE_TRIM : MMC_ERASE_ERASE;
         	cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
         	MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req);
         	if (req.cmd->error != MMC_ERR_NONE) {
        -		device_printf(dev, "erase err3: %d\n", req.cmd->error);
        -		device_printf(dev, "Issuing erase command failed %d\n",
        -		    req.cmd->error);
        +		device_printf(dev, "Issuing erase command failed %s\n",
        +		    mmcsd_errmsg(req.cmd->error));
         		block = bp->bio_pblkno;
         		goto unpause;
         	}
        -	/* Store one of remaining parts for the next call. */
        -	if (bp->bio_pblkno >= part->eblock || block == start) {
        -		part->eblock = stop;	/* Predict next forward. */
        -		part->eend = end;
        -	} else {
        -		part->eblock = block;	/* Predict next backward. */
        -		part->eend = start;
        +	if (use_trim == false) {
        +		/* Store one of the remaining parts for the next call. */
        +		if (bp->bio_pblkno >= part->eblock || block == start) {
        +			part->eblock = stop;	/* Predict next forward. */
        +			part->eend = end;
        +		} else {
        +			part->eblock = block;	/* Predict next backward. */
        +			part->eend = start;
        +		}
         	}
         	block = end;
         unpause:
        
        Modified: head/sys/dev/mmc/mmcvar.h
        ==============================================================================
        --- head/sys/dev/mmc/mmcvar.h	Mon Aug  7 23:32:00 2017	(r322208)
        +++ head/sys/dev/mmc/mmcvar.h	Mon Aug  7 23:33:05 2017	(r322209)
        @@ -68,6 +68,8 @@ enum mmc_device_ivars {
             MMC_IVAR_BUS_WIDTH,
             MMC_IVAR_ERASE_SECTOR,
             MMC_IVAR_MAX_DATA,
        +    MMC_IVAR_CMD6_TIMEOUT,
        +    MMC_IVAR_QUIRKS,
             MMC_IVAR_CARD_ID_STRING,
             MMC_IVAR_CARD_SN_STRING,
         };
        @@ -90,6 +92,8 @@ MMC_ACCESSOR(card_type, CARD_TYPE, int)
         MMC_ACCESSOR(bus_width, BUS_WIDTH, int)
         MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int)
         MMC_ACCESSOR(max_data, MAX_DATA, int)
        +MMC_ACCESSOR(cmd6_timeout, CMD6_TIMEOUT, u_int)
        +MMC_ACCESSOR(quirks, QUIRKS, u_int)
         MMC_ACCESSOR(card_id_string, CARD_ID_STRING, const char *)
         MMC_ACCESSOR(card_sn_string, CARD_SN_STRING, const char *)
         
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 00:31:11 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1ECDDD2CD9;
         Tue,  8 Aug 2017 00:31:11 +0000 (UTC)
         (envelope-from lstewart@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (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 6FCB365092;
         Tue,  8 Aug 2017 00:31:11 +0000 (UTC)
         (envelope-from lstewart@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v780VAK0081188;
         Tue, 8 Aug 2017 00:31:10 GMT (envelope-from lstewart@FreeBSD.org)
        Received: (from lstewart@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v780VAij081187;
         Tue, 8 Aug 2017 00:31:10 GMT (envelope-from lstewart@FreeBSD.org)
        Message-Id: <201708080031.v780VAij081187@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: lstewart set sender to
         lstewart@FreeBSD.org using -f
        From: Lawrence Stewart 
        Date: Tue, 8 Aug 2017 00:31:10 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322210 - head/bin/pkill
        X-SVN-Group: head
        X-SVN-Commit-Author: lstewart
        X-SVN-Commit-Paths: head/bin/pkill
        X-SVN-Commit-Revision: 322210
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 00:31:11 -0000
        
        Author: lstewart
        Date: Tue Aug  8 00:31:10 2017
        New Revision: 322210
        URL: https://svnweb.freebsd.org/changeset/base/322210
        
        Log:
          pgrep naively appends the delimiter to all PIDs including the last
          e.g. "pgrep -d, getty" outputs "1399,1386,1309,1308,1307,1306,1305,1302,"
          Ensure the list is correctly delimited by suppressing the emission of the
          delimiter after the final PID.
          
          Reviewed by:	imp, kib
          MFC after:	1 week
          Sponsored by:	Netflix, Inc.
          Differential Revision:	https://reviews.freebsd.org/D8537
        
        Modified:
          head/bin/pkill/pkill.c
        
        Modified: head/bin/pkill/pkill.c
        ==============================================================================
        --- head/bin/pkill/pkill.c	Mon Aug  7 23:33:05 2017	(r322209)
        +++ head/bin/pkill/pkill.c	Tue Aug  8 00:31:10 2017	(r322210)
        @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
         #include 
         
         #include 
        +#include 
         #include 
         #include 
         #include 
        @@ -656,10 +657,12 @@ killact(const struct kinfo_proc *kp)
         static int
         grepact(const struct kinfo_proc *kp)
         {
        +	static bool first = true;
         
        -	show_process(kp);
        -	if (!quiet)
        +	if (!quiet && !first)
         		printf("%s", delim);
        +	show_process(kp);
        +	first = false;
         	return (1);
         }
         
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 04:10:48 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5270ADBE781;
         Tue,  8 Aug 2017 04:10: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 mx1.freebsd.org (Postfix) with ESMTPS id 2F2F96D450;
         Tue,  8 Aug 2017 04:10: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 v784AlOG069261;
         Tue, 8 Aug 2017 04:10:47 GMT (envelope-from kevans@FreeBSD.org)
        Received: (from kevans@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v784AkDP069258;
         Tue, 8 Aug 2017 04:10:46 GMT (envelope-from kevans@FreeBSD.org)
        Message-Id: <201708080410.v784AkDP069258@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: kevans set sender to
         kevans@FreeBSD.org using -f
        From: Kyle Evans 
        Date: Tue, 8 Aug 2017 04:10:46 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322211 - in head:
         contrib/netbsd-tests/lib/libc/regex/data lib/libc/regex
        X-SVN-Group: head
        X-SVN-Commit-Author: kevans
        X-SVN-Commit-Paths: in head: contrib/netbsd-tests/lib/libc/regex/data
         lib/libc/regex
        X-SVN-Commit-Revision: 322211
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 04:10:48 -0000
        
        Author: kevans
        Date: Tue Aug  8 04:10:46 2017
        New Revision: 322211
        URL: https://svnweb.freebsd.org/changeset/base/322211
        
        Log:
          regex(3): Handle invalid {} constructs consistently and adjust tests
          
          Currently, regex(3) exhibits the following wrong behavior as demonstrated
          with sed:
          
           - echo "a{1,2,3}b" | sed -r "s/{/_/"     (1)
           - echo "a{1,2,3}b" | sed "s/\}/_/"       (2)
           - echo "a{1,2,3}b" | sed -r "s/{}/_/"    (3)
          
          Cases (1) and (3) should throw errors but they actually succeed, and (2)
          throws an error when it should match the literal '}'. The correct behavior
          was decided by comparing to the behavior with the equivalent BRE (1)(3) or
          ERE (2) and consulting POSIX, along with some reasonable evaluation.
          
          Tests were also adjusted/added accordingly.
          
          PR:		166861
          Reviewed by:	emaste, ngie, pfg
          Approved by:	emaste (mentor)
          MFC after:	never
          Differential Revision:	https://reviews.freebsd.org/D10315
        
        Modified:
          head/contrib/netbsd-tests/lib/libc/regex/data/repet_bounded.in
          head/contrib/netbsd-tests/lib/libc/regex/data/repet_multi.in
          head/lib/libc/regex/regcomp.c
        
        Modified: head/contrib/netbsd-tests/lib/libc/regex/data/repet_bounded.in
        ==============================================================================
        --- head/contrib/netbsd-tests/lib/libc/regex/data/repet_bounded.in	Tue Aug  8 00:31:10 2017	(r322210)
        +++ head/contrib/netbsd-tests/lib/libc/regex/data/repet_bounded.in	Tue Aug  8 04:10:46 2017	(r322211)
        @@ -1,9 +1,24 @@
         # the dreaded bounded repetitions
        -{		&	{	{
        -{abc		&	{abc	{abc
        +# Begin FreeBSD
        +{		C	BADRPT
        +{		b	{	{
        +\{		-	{	{
        +\{		bC	BADRPT
        +{}		C	BADRPT
        +{}		b	{}	{}
        +\{\}		-	{}	{}
        +\{\}		bC	BADRPT
        +}		&	}	}
        +\}		&	}	}
        +{abc		b	{abc	{abc
        +{abc		C	BADRPT
        +# End FreeBSD
         {1		C	BADRPT
         {1}		C	BADRPT
        -a{b		&	a{b	a{b
        +# Begin FreeBSD
        +a{b		b	a{b	a{b
        +a{b		C	BADRPT
        +# End FreeBSD
         a{1}b		-	ab	ab
         a\{1\}b		b	ab	ab
         a{1,}b		-	ab	ab
        @@ -16,9 +31,15 @@ a{1a		C	EBRACE
         a\{1a		bC	EBRACE
         a{1a}		C	BADBR
         a\{1a\}		bC	BADBR
        -a{,2}		-	a{,2}	a{,2}
        +# Begin FreeBSD
        +a{,2}		b	a{,2}	a{,2}
        +a{,2}		C	BADBR
        +# End FreeBSD
         a\{,2\}		bC	BADBR
        -a{,}		-	a{,}	a{,}
        +# Begin FreeBSD
        +a{,}		b	a{,}	a{,}
        +a{,}		C	BADBR
        +# End FreeBSD
         a\{,\}		bC	BADBR
         a{1,x}		C	BADBR
         a\{1,x\}	bC	BADBR
        
        Modified: head/contrib/netbsd-tests/lib/libc/regex/data/repet_multi.in
        ==============================================================================
        --- head/contrib/netbsd-tests/lib/libc/regex/data/repet_multi.in	Tue Aug  8 00:31:10 2017	(r322210)
        +++ head/contrib/netbsd-tests/lib/libc/regex/data/repet_multi.in	Tue Aug  8 04:10:46 2017	(r322211)
        @@ -15,7 +15,10 @@ a?{1}		C	BADRPT
         a{1}*		C	BADRPT
         a{1}+		C	BADRPT
         a{1}?		C	BADRPT
        -a*{b}		-	a{b}	a{b}
        +# Begin FreeBSD
        +a*{b}		b	a{b}	a{b}
        +a*{b}		C	BADRPT
        +# End FreeBSD
         a\{1\}\{1\}	bC	BADRPT
         a*\{1\}		bC	BADRPT
         a\{1\}*		bC	BADRPT
        
        Modified: head/lib/libc/regex/regcomp.c
        ==============================================================================
        --- head/lib/libc/regex/regcomp.c	Tue Aug  8 00:31:10 2017	(r322210)
        +++ head/lib/libc/regex/regcomp.c	Tue Aug  8 04:10:46 2017	(r322211)
        @@ -412,6 +412,7 @@ p_ere_exp(struct parse *p, struct branchc *bc)
         	case '*':
         	case '+':
         	case '?':
        +	case '{':
         		SETERROR(REG_BADRPT);
         		break;
         	case '.':
        @@ -438,9 +439,6 @@ p_ere_exp(struct parse *p, struct branchc *bc)
         			break;
         		}
         		break;
        -	case '{':		/* okay as ordinary except if digit follows */
        -		(void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
        -		/* FALLTHROUGH */
         	default:
         		if (p->error != 0)
         			return (false);
        @@ -454,9 +452,11 @@ p_ere_exp(struct parse *p, struct branchc *bc)
         		return (false);
         	c = PEEK();
         	/* we call { a repetition if followed by a digit */
        -	if (!( c == '*' || c == '+' || c == '?' ||
        -				(c == '{' && MORE2() && isdigit((uch)PEEK2())) ))
        +	if (!( c == '*' || c == '+' || c == '?' || c == '{'))
         		return (false);		/* no repetition, we're done */
        +	else if (c == '{')
        +		(void)REQUIRE(MORE2() && \
        +		    (isdigit((uch)PEEK2()) || PEEK2() == ','), REG_BADRPT);
         	NEXT();
         
         	(void)REQUIRE(!wascaret, REG_BADRPT);
        @@ -757,7 +757,6 @@ p_simp_re(struct parse *p, struct branchc *bc)
         		(void)REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
         		break;
         	case BACKSL|')':	/* should not get here -- must be user */
        -	case BACKSL|'}':
         		SETERROR(REG_EPAREN);
         		break;
         	case BACKSL|'1':
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 04:30:24 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 458C8DBF97E;
         Tue,  8 Aug 2017 04:30: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 mx1.freebsd.org (Postfix) with ESMTPS id 120A36DEFD;
         Tue,  8 Aug 2017 04:30:24 +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 v784UN0e077232;
         Tue, 8 Aug 2017 04:30:23 GMT (envelope-from markj@FreeBSD.org)
        Received: (from markj@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v784UN92077230;
         Tue, 8 Aug 2017 04:30:23 GMT (envelope-from markj@FreeBSD.org)
        Message-Id: <201708080430.v784UN92077230@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: markj set sender to
         markj@FreeBSD.org using -f
        From: Mark Johnston 
        Date: Tue, 8 Aug 2017 04:30:23 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322212 - head/sys/compat/linuxkpi/common/include/linux
        X-SVN-Group: head
        X-SVN-Commit-Author: markj
        X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux
        X-SVN-Commit-Revision: 322212
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 04:30:24 -0000
        
        Author: markj
        Date: Tue Aug  8 04:30:22 2017
        New Revision: 322212
        URL: https://svnweb.freebsd.org/changeset/base/322212
        
        Log:
          Add macros for defining attribute groups and for WO and RW attributes.
          
          Reviewed by:	hselasky
          MFC after:	1 week
          Differential Revision:	https://reviews.freebsd.org/D11872
        
        Modified:
          head/sys/compat/linuxkpi/common/include/linux/device.h
          head/sys/compat/linuxkpi/common/include/linux/sysfs.h
        
        Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
        ==============================================================================
        --- head/sys/compat/linuxkpi/common/include/linux/device.h	Tue Aug  8 04:10:46 2017	(r322211)
        +++ head/sys/compat/linuxkpi/common/include/linux/device.h	Tue Aug  8 04:30:22 2017	(r322212)
        @@ -142,7 +142,13 @@ struct device_attribute {
         
         #define	DEVICE_ATTR(_name, _mode, _show, _store)			\
         	struct device_attribute dev_attr_##_name =			\
        -	    { { #_name, NULL, _mode }, _show, _store }
        +	    __ATTR(_name, _mode, _show, _store)
        +#define	DEVICE_ATTR_RO(_name)						\
        +	struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
        +#define	DEVICE_ATTR_WO(_name)						\
        +	struct device_attribute dev_attr_##_name = __ATTR_WO(_name)
        +#define	DEVICE_ATTR_RW(_name)						\
        +	struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
         
         /* Simple class attribute that is just a static string */
         struct class_attribute_string {
        
        Modified: head/sys/compat/linuxkpi/common/include/linux/sysfs.h
        ==============================================================================
        --- head/sys/compat/linuxkpi/common/include/linux/sysfs.h	Tue Aug  8 04:10:46 2017	(r322211)
        +++ head/sys/compat/linuxkpi/common/include/linux/sysfs.h	Tue Aug  8 04:30:22 2017	(r322212)
        @@ -54,13 +54,20 @@ struct attribute_group {
         	.attr = { .name = __stringify(_name), .mode = _mode },		\
                 .show = _show, .store  = _store,				\
         }
        +#define	__ATTR_RO(_name)	__ATTR(_name, 0444, _name##_show, NULL)
        +#define	__ATTR_WO(_name)	__ATTR(_name, 0200, NULL, _name##_store)
        +#define	__ATTR_RW(_name)	__ATTR(_name, 0644, _name##_show, _name##_store)
         
        -#define	__ATTR_RO(_name) {						\
        -	.attr = { .name = __stringify(_name), .mode = 0444 },		\
        -	.show   = _name##_show,						\
        -}
        -
         #define	__ATTR_NULL	{ .attr = { .name = NULL } }
        +
        +#define	ATTRIBUTE_GROUPS(_name)						\
        +	static struct attribute_group _name##_group = {			\
        +		.attrs = _name##_attrs,					\
        +	};								\
        +	static struct attribute_group *_name##_groups[] = {		\
        +		&_name##_group,						\
        +		NULL,							\
        +	};
         
         /*
          * Handle our generic '\0' terminated 'C' string.
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 04:34:03 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0F7ADBFE4B;
         Tue,  8 Aug 2017 04:34:03 +0000 (UTC)
         (envelope-from markj@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id 9CE016E390;
         Tue,  8 Aug 2017 04:34:03 +0000 (UTC)
         (envelope-from markj@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v784Y2I3081105;
         Tue, 8 Aug 2017 04:34:02 GMT (envelope-from markj@FreeBSD.org)
        Received: (from markj@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v784Y2ph081103;
         Tue, 8 Aug 2017 04:34:02 GMT (envelope-from markj@FreeBSD.org)
        Message-Id: <201708080434.v784Y2ph081103@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: markj set sender to
         markj@FreeBSD.org using -f
        From: Mark Johnston 
        Date: Tue, 8 Aug 2017 04:34:02 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322213 - head/sys/compat/linuxkpi/common/include/linux
        X-SVN-Group: head
        X-SVN-Commit-Author: markj
        X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux
        X-SVN-Commit-Revision: 322213
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 04:34:03 -0000
        
        Author: markj
        Date: Tue Aug  8 04:34:02 2017
        New Revision: 322213
        URL: https://svnweb.freebsd.org/changeset/base/322213
        
        Log:
          Add round_jiffies_up(), local_clock() and __setup_timer() to the LinuxKPI.
          
          Reviewed by:	hselasky
          MFC after:	1 week
          Differential Revision:	https://reviews.freebsd.org/D11871
        
        Modified:
          head/sys/compat/linuxkpi/common/include/linux/sched.h
          head/sys/compat/linuxkpi/common/include/linux/timer.h
        
        Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h
        ==============================================================================
        --- head/sys/compat/linuxkpi/common/include/linux/sched.h	Tue Aug  8 04:30:22 2017	(r322212)
        +++ head/sys/compat/linuxkpi/common/include/linux/sched.h	Tue Aug  8 04:34:02 2017	(r322213)
        @@ -36,14 +36,16 @@
         #include 
         #include 
         #include 
        +#include 
         
        +#include 
         #include 
         #include 
        +#include 
         #include 
         #include 
        -#include 
         #include 
        -#include 
        +#include 
         
         #include 
         
        @@ -149,5 +151,14 @@ int linux_schedule_timeout(int timeout);
         
         #define	io_schedule()			schedule()
         #define	io_schedule_timeout(timeout)	schedule_timeout(timeout)
        +
        +static inline uint64_t
        +local_clock(void)
        +{
        +	struct timespec ts;
        +
        +	nanotime(&ts);
        +	return ((uint64_t)ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec);
        +}
         
         #endif	/* _LINUX_SCHED_H_ */
        
        Modified: head/sys/compat/linuxkpi/common/include/linux/timer.h
        ==============================================================================
        --- head/sys/compat/linuxkpi/common/include/linux/timer.h	Tue Aug  8 04:30:22 2017	(r322212)
        +++ head/sys/compat/linuxkpi/common/include/linux/timer.h	Tue Aug  8 04:34:02 2017	(r322213)
        @@ -46,15 +46,20 @@ struct timer_list {
         
         extern unsigned long linux_timer_hz_mask;
         
        -#define	setup_timer(timer, func, dat)					\
        -do {									\
        +#define	TIMER_IRQSAFE	0x0001
        +
        +#define	setup_timer(timer, func, dat) do {				\
         	(timer)->function = (func);					\
         	(timer)->data = (dat);						\
         	callout_init(&(timer)->timer_callout, 1);			\
         } while (0)
         
        -#define	init_timer(timer)						\
        -do {									\
        +#define	__setup_timer(timer, func, dat, flags) do {			\
        +	CTASSERT(((flags) & ~TIMER_IRQSAFE) == 0);			\
        +	setup_timer(timer, func, dat);					\
        +} while (0)
        +
        +#define	init_timer(timer) do {						\
         	(timer)->function = NULL;					\
         	(timer)->data = 0;						\
         	callout_init(&(timer)->timer_callout, 1);			\
        @@ -67,9 +72,10 @@ extern void add_timer_on(struct timer_list *, int cpu)
         #define	del_timer(timer)	callout_stop(&(timer)->timer_callout)
         #define	del_timer_sync(timer)	callout_drain(&(timer)->timer_callout)
         #define	timer_pending(timer)	callout_pending(&(timer)->timer_callout)
        -#define	round_jiffies(j) \
        +#define	round_jiffies(j)	\
         	((unsigned long)(((j) + linux_timer_hz_mask) & ~linux_timer_hz_mask))
        -#define	round_jiffies_relative(j) \
        -	round_jiffies(j)
        +#define	round_jiffies_relative(j) round_jiffies(j)
        +#define	round_jiffies_up(j)	round_jiffies(j)
        +#define	round_jiffies_up_relative(j) round_jiffies_up(j)
         
         #endif					/* _LINUX_TIMER_H_ */
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 04:59:18 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A45EDC1375;
         Tue,  8 Aug 2017 04:59:18 +0000 (UTC)
         (envelope-from ngie@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (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 CA0086ED98;
         Tue,  8 Aug 2017 04:59:17 +0000 (UTC)
         (envelope-from ngie@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v784xGIH089104;
         Tue, 8 Aug 2017 04:59:16 GMT (envelope-from ngie@FreeBSD.org)
        Received: (from ngie@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v784xGvm089103;
         Tue, 8 Aug 2017 04:59:16 GMT (envelope-from ngie@FreeBSD.org)
        Message-Id: <201708080459.v784xGvm089103@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: ngie set sender to
         ngie@FreeBSD.org using -f
        From: Ngie Cooper 
        Date: Tue, 8 Aug 2017 04:59:16 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322214 - in head/tests: etc/rc.d sys/acl sys/file
         sys/geom/class/eli sys/geom/class/gate sys/geom/class/mirror
         sys/geom/class/nop sys/geom/class/uzip sys/kern sys/kqueue/libkqueue sys/...
        X-SVN-Group: head
        X-SVN-Commit-Author: ngie
        X-SVN-Commit-Paths: in head/tests: etc/rc.d sys/acl sys/file
         sys/geom/class/eli sys/geom/class/gate sys/geom/class/mirror
         sys/geom/class/nop sys/geom/class/uzip sys/kern sys/kqueue/libkqueue
         sys/mac/portacl sys/mqueue sy...
        X-SVN-Commit-Revision: 322214
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 04:59:18 -0000
        
        Author: ngie
        Date: Tue Aug  8 04:59:16 2017
        New Revision: 322214
        URL: https://svnweb.freebsd.org/changeset/base/322214
        
        Log:
          Make test scripts under tests/... non-executable
          
          Executable bits should be set at install time instead of in the repo.
          Setting executable bits on files triggers false positives with Phabricator.
          
          MFC after:	2 months
        
        Modified:
        Directory Properties:
          head/tests/etc/rc.d/routing_test.sh   (props changed)
          head/tests/sys/acl/aclfuzzer.sh   (props changed)
          head/tests/sys/acl/mktrivial.sh   (props changed)
          head/tests/sys/file/flock_test.sh   (props changed)
          head/tests/sys/geom/class/eli/conf.sh   (props changed)
          head/tests/sys/geom/class/eli/init_alias_test.sh   (props changed)
          head/tests/sys/geom/class/gate/ggate_test.sh   (props changed)
          head/tests/sys/geom/class/mirror/8_test.sh   (props changed)
          head/tests/sys/geom/class/mirror/9_test.sh   (props changed)
          head/tests/sys/geom/class/nop/nop_test.sh   (props changed)
          head/tests/sys/geom/class/uzip/conf.sh   (props changed)
          head/tests/sys/kern/coredump_phnum_test.sh   (props changed)
          head/tests/sys/kqueue/libkqueue/kqueue_test.sh   (props changed)
          head/tests/sys/mac/portacl/misc.sh   (props changed)
          head/tests/sys/mac/portacl/nobody_test.sh   (props changed)
          head/tests/sys/mac/portacl/root_test.sh   (props changed)
          head/tests/sys/mqueue/mqueue_test.sh   (props changed)
          head/tests/sys/netinet/fibs_test.sh   (props changed)
          head/tests/sys/opencrypto/runtests.sh   (props changed)
          head/tests/sys/vfs/trailing_slash.sh   (props changed)
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 05:15:21 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF80DDC22CF;
         Tue,  8 Aug 2017 05:15:21 +0000 (UTC)
         (envelope-from ngie@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (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 9D8D56F77E;
         Tue,  8 Aug 2017 05:15:21 +0000 (UTC)
         (envelope-from ngie@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v785FKGP097341;
         Tue, 8 Aug 2017 05:15:20 GMT (envelope-from ngie@FreeBSD.org)
        Received: (from ngie@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v785FK1W097339;
         Tue, 8 Aug 2017 05:15:20 GMT (envelope-from ngie@FreeBSD.org)
        Message-Id: <201708080515.v785FK1W097339@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: ngie set sender to
         ngie@FreeBSD.org using -f
        From: Ngie Cooper 
        Date: Tue, 8 Aug 2017 05:15:20 +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: r322215 - in stable/11/tools/tools: bootparttest
         zfsboottest
        X-SVN-Group: stable-11
        X-SVN-Commit-Author: ngie
        X-SVN-Commit-Paths: in stable/11/tools/tools: bootparttest zfsboottest
        X-SVN-Commit-Revision: 322215
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 05:15:21 -0000
        
        Author: ngie
        Date: Tue Aug  8 05:15:20 2017
        New Revision: 322215
        URL: https://svnweb.freebsd.org/changeset/base/322215
        
        Log:
          MFC r321849,r321852:
          
          r321849:
          
          Fix the return type for pager_output(..) in bootparttest and zfsboottest
          
          pager_output(..) has always returned int. For some reason (probably the
          clang 5.0 update), this mismatch now results in an error with CC=clang.
          
          r321852:
          
          Fix up r321849
          
          pager_output should return 0 if no more output needs to be paged; non-zero
          otherwise.
          
          MFC with:	r321849
        
        Modified:
          stable/11/tools/tools/bootparttest/stub.c
          stable/11/tools/tools/zfsboottest/zfsboottest.c
        Directory Properties:
          stable/11/   (props changed)
        
        Modified: stable/11/tools/tools/bootparttest/stub.c
        ==============================================================================
        --- stable/11/tools/tools/bootparttest/stub.c	Tue Aug  8 04:59:16 2017	(r322214)
        +++ stable/11/tools/tools/bootparttest/stub.c	Tue Aug  8 05:15:20 2017	(r322215)
        @@ -44,9 +44,10 @@ Free(void *ptr, const char *file, int line)
         	return (free(ptr));
         }
         
        -void
        +int
         pager_output(const char *s)
         {
         
         	printf("%s", s);
        +	return (0);
         }
        
        Modified: stable/11/tools/tools/zfsboottest/zfsboottest.c
        ==============================================================================
        --- stable/11/tools/tools/zfsboottest/zfsboottest.c	Tue Aug  8 04:59:16 2017	(r322214)
        +++ stable/11/tools/tools/zfsboottest/zfsboottest.c	Tue Aug  8 05:15:20 2017	(r322215)
        @@ -43,11 +43,12 @@
         
         #define NBBY 8
         
        -void
        +int
         pager_output(const char *line)
         {
         
         	fprintf(stderr, "%s", line);
        +	return (0);
         }
         
         #define ZFS_TEST
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 05:19:47 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59FCDDC280B;
         Tue,  8 Aug 2017 05:19:47 +0000 (UTC)
         (envelope-from ngie@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (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 273EF6FAA9;
         Tue,  8 Aug 2017 05:19:47 +0000 (UTC)
         (envelope-from ngie@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v785Jk9h097533;
         Tue, 8 Aug 2017 05:19:46 GMT (envelope-from ngie@FreeBSD.org)
        Received: (from ngie@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v785JkEO097532;
         Tue, 8 Aug 2017 05:19:46 GMT (envelope-from ngie@FreeBSD.org)
        Message-Id: <201708080519.v785JkEO097532@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: ngie set sender to
         ngie@FreeBSD.org using -f
        From: Ngie Cooper 
        Date: Tue, 8 Aug 2017 05:19:46 +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: r322216 - stable/11/sys/boot/geli
        X-SVN-Group: stable-11
        X-SVN-Commit-Author: ngie
        X-SVN-Commit-Paths: stable/11/sys/boot/geli
        X-SVN-Commit-Revision: 322216
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 05:19:47 -0000
        
        Author: ngie
        Date: Tue Aug  8 05:19:45 2017
        New Revision: 322216
        URL: https://svnweb.freebsd.org/changeset/base/322216
        
        Log:
          MFC r321851:
          
          Standardize paths on SRCTOP instead of .CURDIR-relative paths
        
        Modified:
          stable/11/sys/boot/geli/Makefile
        Directory Properties:
          stable/11/   (props changed)
        
        Modified: stable/11/sys/boot/geli/Makefile
        ==============================================================================
        --- stable/11/sys/boot/geli/Makefile	Tue Aug  8 05:15:20 2017	(r322215)
        +++ stable/11/sys/boot/geli/Makefile	Tue Aug  8 05:19:45 2017	(r322216)
        @@ -28,23 +28,23 @@ SRCS+=  bcmp.c bcopy.c bzero.c
         SRCS+=  pwgets.c
         
         # sha256 and sha512 from sys/crypto
        -.PATH: ${.CURDIR}/../../crypto/sha2
        +.PATH: ${SRCTOP}/sys/crypto/sha2
         CFLAGS+=	-DWEAK_REFS
         SRCS+=		sha256c.c sha512c.c
         
         # md5 from libmd
        -.PATH: ${.CURDIR}/../../../lib/libmd
        +.PATH: ${SRCTOP}/lib/libmd
         SRCS+=		md5c.c
         
         # AES implementation from sys/crypto
        -.PATH: ${.CURDIR}/../../crypto/rijndael
        +.PATH: ${SRCTOP}/sys/crypto/rijndael
         CFLAGS+=	-I${.CURDIR}/../../
         # Remove asserts
         CFLAGS+=	-DNDEBUG
         SRCS+=		rijndael-alg-fst.c rijndael-api-fst.c rijndael-api.c
         
         # local GELI Implementation
        -.PATH: ${.CURDIR}/../../geom/eli
        +.PATH: ${SRCTOP}/sys/geom/eli
         CFLAGS+=	-D_STAND
         SRCS+=		geliboot_crypto.c g_eli_hmac.c g_eli_key.c g_eli_key_cache.c pkcs5v2.c
         
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:28:02 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id B976ADD1765;
         Tue,  8 Aug 2017 10:28:02 +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 mx1.freebsd.org (Postfix) with ESMTPS id 871CE7D4D7;
         Tue,  8 Aug 2017 10:28:02 +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 v78AS1JV022323;
         Tue, 8 Aug 2017 10:28:01 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78AS1Eg022322;
         Tue, 8 Aug 2017 10:28:01 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081028.v78AS1Eg022322@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:28:01 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322217 - vendor/illumos/dist/lib/libzfs/common
        X-SVN-Group: vendor
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor/illumos/dist/lib/libzfs/common
        X-SVN-Commit-Revision: 322217
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:28:02 -0000
        
        Author: avg
        Date: Tue Aug  8 10:28:01 2017
        New Revision: 322217
        URL: https://svnweb.freebsd.org/changeset/base/322217
        
        Log:
          8418 zfs_prop_get_table() call in zfs_validate_name() is a no-op
          
          illumos/illumos-gate@e09ba01dcda5e24964b8632718777b39166d86e4
          https://github.com/illumos/illumos-gate/commit/e09ba01dcda5e24964b8632718777b39166d86e4
          
          https://www.illumos.org/issues/8418
            The following line in zfs_validate_name() is just a no-op and it should be
            removed:
            108    (void) zfs_prop_get_table();
          
          Reviewed by: Vitaliy Gusev 
          Approved by: Matthew Ahrens 
          Author: Marcel Telka 
        
        Modified:
          vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
        
        Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
        ==============================================================================
        --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c	Tue Aug  8 05:19:45 2017	(r322216)
        +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c	Tue Aug  8 10:28:01 2017	(r322217)
        @@ -105,7 +105,6 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *pa
         	namecheck_err_t why;
         	char what;
         
        -	(void) zfs_prop_get_table();
         	if (entity_namecheck(path, &why, &what) != 0) {
         		if (hdl != NULL) {
         			switch (why) {
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:30:50 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C8D9DD1A20;
         Tue,  8 Aug 2017 10:30:50 +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 mx1.freebsd.org (Postfix) with ESMTPS id 59CAA7D69B;
         Tue,  8 Aug 2017 10:30:50 +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 v78AUnlj022476;
         Tue, 8 Aug 2017 10:30:49 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78AUnST022475;
         Tue, 8 Aug 2017 10:30:49 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081030.v78AUnST022475@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:30:49 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322218 - head/cddl/contrib/opensolaris/lib/libzfs/common
        X-SVN-Group: head
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common
        X-SVN-Commit-Revision: 322218
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:30:50 -0000
        
        Author: avg
        Date: Tue Aug  8 10:30:49 2017
        New Revision: 322218
        URL: https://svnweb.freebsd.org/changeset/base/322218
        
        Log:
          MFV r322217: 8418 zfs_prop_get_table() call in zfs_validate_name() is a no-op
          
          illumos/illumos-gate@e09ba01dcda5e24964b8632718777b39166d86e4
          https://github.com/illumos/illumos-gate/commit/e09ba01dcda5e24964b8632718777b39166d86e4
          
          https://www.illumos.org/issues/8418
            The following line in zfs_validate_name() is just a no-op and it
            should be removed:
                108    (void) zfs_prop_get_table();
          
          Reviewed by: Vitaliy Gusev 
          Approved by: Matthew Ahrens 
          Author: Marcel Telka 
          
          MFC after:	2 weeks
        
        Modified:
          head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
        Directory Properties:
          head/cddl/contrib/opensolaris/   (props changed)
          head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)
        
        Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
        ==============================================================================
        --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	Tue Aug  8 10:28:01 2017	(r322217)
        +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	Tue Aug  8 10:30:49 2017	(r322218)
        @@ -103,7 +103,6 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *pa
         	namecheck_err_t why;
         	char what;
         
        -	(void) zfs_prop_get_table();
         	if (entity_namecheck(path, &why, &what) != 0) {
         		if (hdl != NULL) {
         			switch (why) {
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:31:44 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13C5BDD1C04;
         Tue,  8 Aug 2017 10:31:44 +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 mx1.freebsd.org (Postfix) with ESMTPS id CE1397D96A;
         Tue,  8 Aug 2017 10:31:43 +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 v78AVgkJ023945;
         Tue, 8 Aug 2017 10:31:42 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78AVgTo023944;
         Tue, 8 Aug 2017 10:31:42 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081031.v78AVgTo023944@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:31:42 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322219 - vendor-sys/illumos/dist/uts/common/fs/zfs/sys
        X-SVN-Group: vendor-sys
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs/sys
        X-SVN-Commit-Revision: 322219
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:31:44 -0000
        
        Author: avg
        Date: Tue Aug  8 10:31:42 2017
        New Revision: 322219
        URL: https://svnweb.freebsd.org/changeset/base/322219
        
        Log:
          8416 abd.h is not C++ friendly
          
          illumos/illumos-gate@5e2a074725cb7c16ea1c6554da11ab4d6b4e7aee
          https://github.com/illumos/illumos-gate/commit/5e2a074725cb7c16ea1c6554da11ab4d6b4e7aee
          
          https://www.illumos.org/issues/8416
            A C++ compiler fails to compile abd_is_linear(), which is an inline function
            defined in abd.h, with the following error:
                 error: cannot initialize return object of type 'boolean_t' with an
                 rvalue of type 'bool'
            That happens because a bool can not be converted to an enum in C++.
            That's a problem because abd.h can be visible through other header files that a
            C++ program that works with ZFS can include.
          
          Reviewed by: Igor Kozhukhov 
          Reviewed by: Dan Kimmel 
          Reviewed by: Alek Pinchuk 
          Approved by: Robert Mustacchi 
          Author: Andriy Gapon 
        
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/sys/abd.h
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/abd.h
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/abd.h	Tue Aug  8 10:30:49 2017	(r322218)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/abd.h	Tue Aug  8 10:31:42 2017	(r322219)
        @@ -60,7 +60,7 @@ extern boolean_t zfs_abd_scatter_enabled;
         inline boolean_t
         abd_is_linear(abd_t *abd)
         {
        -	return ((abd->abd_flags & ABD_FLAG_LINEAR) != 0);
        +	return ((abd->abd_flags & ABD_FLAG_LINEAR) != 0 ? B_TRUE : B_FALSE);
         }
         
         /*
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:36:09 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35654DD1F20;
         Tue,  8 Aug 2017 10:36: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 mx1.freebsd.org (Postfix) with ESMTPS id F08817DBF5;
         Tue,  8 Aug 2017 10:36:08 +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 v78Aa8rg026472;
         Tue, 8 Aug 2017 10:36:08 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Aa81J026471;
         Tue, 8 Aug 2017 10:36:08 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081036.v78Aa81J026471@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:36:08 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322220 - head/sys/cddl/contrib/opensolaris
        X-SVN-Group: head
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris
        X-SVN-Commit-Revision: 322220
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:36:09 -0000
        
        Author: avg
        Date: Tue Aug  8 10:36:07 2017
        New Revision: 322220
        URL: https://svnweb.freebsd.org/changeset/base/322220
        
        Log:
          MFV r322219: 8416 abd.h is not C++ friendly
          
          FreeBSD note: this is a record-only commit, we had to apply the change
          in r320156.
          
          illumos/illumos-gate@5e2a074725cb7c16ea1c6554da11ab4d6b4e7aee
          https://github.com/illumos/illumos-gate/commit/5e2a074725cb7c16ea1c6554da11ab4d6b4e7aee
          
          https://www.illumos.org/issues/8416
            A C++ compiler fails to compile abd_is_linear(), which is an inline function
            defined in abd.h, with the following error:
                 error: cannot initialize return object of type 'boolean_t' with an
                 rvalue of type 'bool'
            That happens because a bool can not be converted to an enum in C++.
            That's a problem because abd.h can be visible through other header files that a
            C++ program that works with ZFS can include.
          
          Reviewed by: Igor Kozhukhov 
          Reviewed by: Dan Kimmel 
          Reviewed by: Alek Pinchuk 
          Approved by: Robert Mustacchi 
          Author: Andriy Gapon 
        
        Modified:
        Directory Properties:
          head/sys/cddl/contrib/opensolaris/   (props changed)
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:37:05 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1086CDD1FEB;
         Tue,  8 Aug 2017 10:37:05 +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 mx1.freebsd.org (Postfix) with ESMTPS id DD8F07DD6F;
         Tue,  8 Aug 2017 10:37:04 +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 v78Ab47h026557;
         Tue, 8 Aug 2017 10:37:04 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Ab4Kl026556;
         Tue, 8 Aug 2017 10:37:04 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081037.v78Ab4Kl026556@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:37:04 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322221 - vendor-sys/illumos/dist/uts/common/fs/zfs
        X-SVN-Group: vendor-sys
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs
        X-SVN-Commit-Revision: 322221
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:37:05 -0000
        
        Author: avg
        Date: Tue Aug  8 10:37:03 2017
        New Revision: 322221
        URL: https://svnweb.freebsd.org/changeset/base/322221
        
        Log:
          7910 l2arc_write_buffers() may write beyond target_sz
          
          illumos/illumos-gate@16a7e5ac116c85d965007a5f201104b564e82210
          https://github.com/illumos/illumos-gate/commit/16a7e5ac116c85d965007a5f201104b564e82210
          
          https://www.illumos.org/issues/7910
            It seems that the change in issue #6950 resurrected the problem that was
            earlier fixed by the change in issue #5219.
            Please also see the following FreeBSD bug report: https://bugs.freebsd.org/
            bugzilla/show_bug.cgi?id=216178
          
          Reviewed by: George Wilson 
          Reviewed by: Dan Kimmel 
          Approved by: Robert Mustacchi 
          Author: Andriy Gapon 
        
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c	Tue Aug  8 10:36:07 2017	(r322220)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c	Tue Aug  8 10:37:03 2017	(r322221)
        @@ -631,8 +631,8 @@ typedef struct arc_stats {
         	kstat_named_t arcstat_l2_abort_lowmem;
         	kstat_named_t arcstat_l2_cksum_bad;
         	kstat_named_t arcstat_l2_io_error;
        -	kstat_named_t arcstat_l2_size;
        -	kstat_named_t arcstat_l2_asize;
        +	kstat_named_t arcstat_l2_lsize;
        +	kstat_named_t arcstat_l2_psize;
         	kstat_named_t arcstat_l2_hdr_size;
         	kstat_named_t arcstat_memory_throttle_count;
         	kstat_named_t arcstat_meta_used;
        @@ -3048,19 +3048,19 @@ arc_hdr_l2hdr_destroy(arc_buf_hdr_t *hdr)
         {
         	l2arc_buf_hdr_t *l2hdr = &hdr->b_l2hdr;
         	l2arc_dev_t *dev = l2hdr->b_dev;
        -	uint64_t asize = arc_hdr_size(hdr);
        +	uint64_t psize = arc_hdr_size(hdr);
         
         	ASSERT(MUTEX_HELD(&dev->l2ad_mtx));
         	ASSERT(HDR_HAS_L2HDR(hdr));
         
         	list_remove(&dev->l2ad_buflist, hdr);
         
        -	ARCSTAT_INCR(arcstat_l2_asize, -asize);
        -	ARCSTAT_INCR(arcstat_l2_size, -HDR_GET_LSIZE(hdr));
        +	ARCSTAT_INCR(arcstat_l2_psize, -psize);
        +	ARCSTAT_INCR(arcstat_l2_lsize, -HDR_GET_LSIZE(hdr));
         
        -	vdev_space_update(dev->l2ad_vdev, -asize, 0, 0);
        +	vdev_space_update(dev->l2ad_vdev, -psize, 0, 0);
         
        -	(void) refcount_remove_many(&dev->l2ad_alloc, asize, hdr);
        +	(void) refcount_remove_many(&dev->l2ad_alloc, psize, hdr);
         	arc_hdr_clear_flags(hdr, ARC_FLAG_HAS_L2HDR);
         }
         
        @@ -6522,8 +6522,8 @@ top:
         			list_remove(buflist, hdr);
         			arc_hdr_clear_flags(hdr, ARC_FLAG_HAS_L2HDR);
         
        -			ARCSTAT_INCR(arcstat_l2_asize, -arc_hdr_size(hdr));
        -			ARCSTAT_INCR(arcstat_l2_size, -HDR_GET_LSIZE(hdr));
        +			ARCSTAT_INCR(arcstat_l2_psize, -arc_hdr_size(hdr));
        +			ARCSTAT_INCR(arcstat_l2_lsize, -HDR_GET_LSIZE(hdr));
         
         			bytes_dropped += arc_hdr_size(hdr);
         			(void) refcount_remove_many(&dev->l2ad_alloc,
        @@ -6782,7 +6782,7 @@ top:
         			/*
         			 * This doesn't exist in the ARC.  Destroy.
         			 * arc_hdr_destroy() will call list_remove()
        -			 * and decrement arcstat_l2_size.
        +			 * and decrement arcstat_l2_lsize.
         			 */
         			arc_change_state(arc_anon, hdr, hash_lock);
         			arc_hdr_destroy(hdr);
        @@ -6824,7 +6824,7 @@ static uint64_t
         l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
         {
         	arc_buf_hdr_t *hdr, *hdr_prev, *head;
        -	uint64_t write_asize, write_psize, write_sz, headroom;
        +	uint64_t write_asize, write_psize, write_lsize, headroom;
         	boolean_t full;
         	l2arc_write_callback_t *cb;
         	zio_t *pio, *wzio;
        @@ -6833,7 +6833,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         	ASSERT3P(dev->l2ad_vdev, !=, NULL);
         
         	pio = NULL;
        -	write_sz = write_asize = write_psize = 0;
        +	write_lsize = write_asize = write_psize = 0;
         	full = B_FALSE;
         	head = kmem_cache_alloc(hdr_l2only_cache, KM_PUSHPAGE);
         	arc_hdr_set_flags(head, ARC_FLAG_L2_WRITE_HEAD | ARC_FLAG_HAS_L2HDR);
        @@ -6890,7 +6890,22 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         				continue;
         			}
         
        -			if ((write_asize + HDR_GET_LSIZE(hdr)) > target_sz) {
        +			/*
        +			 * We rely on the L1 portion of the header below, so
        +			 * it's invalid for this header to have been evicted out
        +			 * of the ghost cache, prior to being written out. The
        +			 * ARC_FLAG_L2_WRITING bit ensures this won't happen.
        +			 */
        +			ASSERT(HDR_HAS_L1HDR(hdr));
        +
        +			ASSERT3U(HDR_GET_PSIZE(hdr), >, 0);
        +			ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL);
        +			ASSERT3U(arc_hdr_size(hdr), >, 0);
        +			uint64_t psize = arc_hdr_size(hdr);
        +			uint64_t asize = vdev_psize_to_asize(dev->l2ad_vdev,
        +			    psize);
        +
        +			if ((write_asize + asize) > target_sz) {
         				full = B_TRUE;
         				mutex_exit(hash_lock);
         				break;
        @@ -6923,21 +6938,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         			list_insert_head(&dev->l2ad_buflist, hdr);
         			mutex_exit(&dev->l2ad_mtx);
         
        -			/*
        -			 * We rely on the L1 portion of the header below, so
        -			 * it's invalid for this header to have been evicted out
        -			 * of the ghost cache, prior to being written out. The
        -			 * ARC_FLAG_L2_WRITING bit ensures this won't happen.
        -			 */
        -			ASSERT(HDR_HAS_L1HDR(hdr));
        +			(void) refcount_add_many(&dev->l2ad_alloc, psize, hdr);
         
        -			ASSERT3U(HDR_GET_PSIZE(hdr), >, 0);
        -			ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL);
        -			ASSERT3U(arc_hdr_size(hdr), >, 0);
        -			uint64_t size = arc_hdr_size(hdr);
        -
        -			(void) refcount_add_many(&dev->l2ad_alloc, size, hdr);
        -
         			/*
         			 * Normally the L2ARC can use the hdr's data, but if
         			 * we're sharing data between the hdr and one of its
        @@ -6952,20 +6954,18 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         			 * lifetime of the ZIO and be cleaned up afterwards, we
         			 * add it to the l2arc_free_on_write queue.
         			 */
        -			uint64_t asize = vdev_psize_to_asize(dev->l2ad_vdev,
        -			    size);
         			abd_t *to_write;
        -			if (!HDR_SHARED_DATA(hdr) && size == asize) {
        +			if (!HDR_SHARED_DATA(hdr) && psize == asize) {
         				to_write = hdr->b_l1hdr.b_pabd;
         			} else {
         				to_write = abd_alloc_for_io(asize,
         				    HDR_ISTYPE_METADATA(hdr));
        -				abd_copy(to_write, hdr->b_l1hdr.b_pabd, size);
        -				if (asize != size) {
        -					abd_zero_off(to_write, size,
        -					    asize - size);
        +				abd_copy(to_write, hdr->b_l1hdr.b_pabd, psize);
        +				if (asize != psize) {
        +					abd_zero_off(to_write, psize,
        +					    asize - psize);
         				}
        -				l2arc_free_abd_on_write(to_write, size,
        +				l2arc_free_abd_on_write(to_write, asize,
         				    arc_buf_type(hdr));
         			}
         			wzio = zio_write_phys(pio, dev->l2ad_vdev,
        @@ -6974,12 +6974,12 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         			    ZIO_PRIORITY_ASYNC_WRITE,
         			    ZIO_FLAG_CANFAIL, B_FALSE);
         
        -			write_sz += HDR_GET_LSIZE(hdr);
        +			write_lsize += HDR_GET_LSIZE(hdr);
         			DTRACE_PROBE2(l2arc__write, vdev_t *, dev->l2ad_vdev,
         			    zio_t *, wzio);
         
        -			write_asize += size;
        -			write_psize += asize;
        +			write_psize += psize;
        +			write_asize += asize;
         			dev->l2ad_hand += asize;
         
         			mutex_exit(hash_lock);
        @@ -6995,7 +6995,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         
         	/* No buffers selected for writing? */
         	if (pio == NULL) {
        -		ASSERT0(write_sz);
        +		ASSERT0(write_lsize);
         		ASSERT(!HDR_HAS_L1HDR(head));
         		kmem_cache_free(hdr_l2only_cache, head);
         		return (0);
        @@ -7003,10 +7003,10 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         
         	ASSERT3U(write_asize, <=, target_sz);
         	ARCSTAT_BUMP(arcstat_l2_writes_sent);
        -	ARCSTAT_INCR(arcstat_l2_write_bytes, write_asize);
        -	ARCSTAT_INCR(arcstat_l2_size, write_sz);
        -	ARCSTAT_INCR(arcstat_l2_asize, write_asize);
        -	vdev_space_update(dev->l2ad_vdev, write_asize, 0, 0);
        +	ARCSTAT_INCR(arcstat_l2_write_bytes, write_psize);
        +	ARCSTAT_INCR(arcstat_l2_lsize, write_lsize);
        +	ARCSTAT_INCR(arcstat_l2_psize, write_psize);
        +	vdev_space_update(dev->l2ad_vdev, write_psize, 0, 0);
         
         	/*
         	 * Bump device hand to the device start if it is approaching the end.
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:43:42 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A5EEDD28B4;
         Tue,  8 Aug 2017 10:43: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 mx1.freebsd.org (Postfix) with ESMTPS id 63C1A7E3C0;
         Tue,  8 Aug 2017 10:43:42 +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 v78Ahfel030337;
         Tue, 8 Aug 2017 10:43:41 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Ahf0E030336;
         Tue, 8 Aug 2017 10:43:41 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081043.v78Ahf0E030336@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:43:41 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322222 -
         head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Group: head
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Commit-Revision: 322222
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:43:42 -0000
        
        Author: avg
        Date: Tue Aug  8 10:43:41 2017
        New Revision: 322222
        URL: https://svnweb.freebsd.org/changeset/base/322222
        
        Log:
          MFV r322221: 7910 l2arc_write_buffers() may write beyond target_sz
          
          FreeBD note: the essence of this change was committed to FreeBSD in
          r314274.  This commit catches up with differences between what was
          committed to FreeBSD and what was committed to OpenZFS, mainly more
          logical variable names.
          
          illumos/illumos-gate@16a7e5ac116c85d965007a5f201104b564e82210
          https://github.com/illumos/illumos-gate/commit/16a7e5ac116c85d965007a5f201104b564e82210
          
          https://www.illumos.org/issues/7910
            It seems that the change in issue #6950 resurrected the problem that was
            earlier fixed by the change in issue #5219.
            Please also see the following FreeBSD bug report:
            https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216178
          
          Reviewed by: George Wilson 
          Reviewed by: Dan Kimmel 
          Approved by: Robert Mustacchi 
          Author: Andriy Gapon 
          
          MFC after:	2 weeks
        
        Modified:
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
        Directory Properties:
          head/sys/cddl/contrib/opensolaris/   (props changed)
        
        Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
        ==============================================================================
        --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Tue Aug  8 10:37:03 2017	(r322221)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Tue Aug  8 10:43:41 2017	(r322222)
        @@ -712,8 +712,8 @@ typedef struct arc_stats {
         	kstat_named_t arcstat_l2_abort_lowmem;
         	kstat_named_t arcstat_l2_cksum_bad;
         	kstat_named_t arcstat_l2_io_error;
        -	kstat_named_t arcstat_l2_size;
        -	kstat_named_t arcstat_l2_asize;
        +	kstat_named_t arcstat_l2_lsize;
        +	kstat_named_t arcstat_l2_psize;
         	kstat_named_t arcstat_l2_hdr_size;
         	kstat_named_t arcstat_l2_write_trylock_fail;
         	kstat_named_t arcstat_l2_write_passed_headroom;
        @@ -3338,19 +3338,19 @@ arc_hdr_l2hdr_destroy(arc_buf_hdr_t *hdr)
         {
         	l2arc_buf_hdr_t *l2hdr = &hdr->b_l2hdr;
         	l2arc_dev_t *dev = l2hdr->b_dev;
        -	uint64_t asize = arc_hdr_size(hdr);
        +	uint64_t psize = arc_hdr_size(hdr);
         
         	ASSERT(MUTEX_HELD(&dev->l2ad_mtx));
         	ASSERT(HDR_HAS_L2HDR(hdr));
         
         	list_remove(&dev->l2ad_buflist, hdr);
         
        -	ARCSTAT_INCR(arcstat_l2_asize, -asize);
        -	ARCSTAT_INCR(arcstat_l2_size, -HDR_GET_LSIZE(hdr));
        +	ARCSTAT_INCR(arcstat_l2_psize, -psize);
        +	ARCSTAT_INCR(arcstat_l2_lsize, -HDR_GET_LSIZE(hdr));
         
        -	vdev_space_update(dev->l2ad_vdev, -asize, 0, 0);
        +	vdev_space_update(dev->l2ad_vdev, -psize, 0, 0);
         
        -	(void) refcount_remove_many(&dev->l2ad_alloc, asize, hdr);
        +	(void) refcount_remove_many(&dev->l2ad_alloc, psize, hdr);
         	arc_hdr_clear_flags(hdr, ARC_FLAG_HAS_L2HDR);
         }
         
        @@ -7051,8 +7051,8 @@ top:
         			l2arc_trim(hdr);
         			arc_hdr_clear_flags(hdr, ARC_FLAG_HAS_L2HDR);
         
        -			ARCSTAT_INCR(arcstat_l2_asize, -arc_hdr_size(hdr));
        -			ARCSTAT_INCR(arcstat_l2_size, -HDR_GET_LSIZE(hdr));
        +			ARCSTAT_INCR(arcstat_l2_psize, -arc_hdr_size(hdr));
        +			ARCSTAT_INCR(arcstat_l2_lsize, -HDR_GET_LSIZE(hdr));
         
         			bytes_dropped += arc_hdr_size(hdr);
         			(void) refcount_remove_many(&dev->l2ad_alloc,
        @@ -7311,7 +7311,7 @@ top:
         			/*
         			 * This doesn't exist in the ARC.  Destroy.
         			 * arc_hdr_destroy() will call list_remove()
        -			 * and decrement arcstat_l2_size.
        +			 * and decrement arcstat_l2_lsize.
         			 */
         			arc_change_state(arc_anon, hdr, hash_lock);
         			arc_hdr_destroy(hdr);
        @@ -7353,7 +7353,7 @@ static uint64_t
         l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
         {
         	arc_buf_hdr_t *hdr, *hdr_prev, *head;
        -	uint64_t write_asize, write_psize, write_sz, headroom;
        +	uint64_t write_asize, write_psize, write_lsize, headroom;
         	boolean_t full;
         	l2arc_write_callback_t *cb;
         	zio_t *pio, *wzio;
        @@ -7363,7 +7363,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         	ASSERT3P(dev->l2ad_vdev, !=, NULL);
         
         	pio = NULL;
        -	write_sz = write_asize = write_psize = 0;
        +	write_lsize = write_asize = write_psize = 0;
         	full = B_FALSE;
         	head = kmem_cache_alloc(hdr_l2only_cache, KM_PUSHPAGE);
         	arc_hdr_set_flags(head, ARC_FLAG_L2_WRITE_HEAD | ARC_FLAG_HAS_L2HDR);
        @@ -7440,11 +7440,11 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         			ASSERT3U(HDR_GET_PSIZE(hdr), >, 0);
         			ASSERT3P(hdr->b_l1hdr.b_pabd, !=, NULL);
         			ASSERT3U(arc_hdr_size(hdr), >, 0);
        -			uint64_t size = arc_hdr_size(hdr);
        +			uint64_t psize = arc_hdr_size(hdr);
         			uint64_t asize = vdev_psize_to_asize(dev->l2ad_vdev,
        -			    size);
        +			    psize);
         
        -			if ((write_psize + asize) > target_sz) {
        +			if ((write_asize + asize) > target_sz) {
         				full = B_TRUE;
         				mutex_exit(hash_lock);
         				ARCSTAT_BUMP(arcstat_l2_write_full);
        @@ -7479,7 +7479,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         			list_insert_head(&dev->l2ad_buflist, hdr);
         			mutex_exit(&dev->l2ad_mtx);
         
        -			(void) refcount_add_many(&dev->l2ad_alloc, size, hdr);
        +			(void) refcount_add_many(&dev->l2ad_alloc, psize, hdr);
         
         			/*
         			 * Normally the L2ARC can use the hdr's data, but if
        @@ -7496,15 +7496,15 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         			 * add it to the l2arc_free_on_write queue.
         			 */
         			abd_t *to_write;
        -			if (!HDR_SHARED_DATA(hdr) && size == asize) {
        +			if (!HDR_SHARED_DATA(hdr) && psize == asize) {
         				to_write = hdr->b_l1hdr.b_pabd;
         			} else {
         				to_write = abd_alloc_for_io(asize,
         				    HDR_ISTYPE_METADATA(hdr));
        -				abd_copy(to_write, hdr->b_l1hdr.b_pabd, size);
        -				if (asize != size) {
        -					abd_zero_off(to_write, size,
        -					    asize - size);
        +				abd_copy(to_write, hdr->b_l1hdr.b_pabd, psize);
        +				if (asize != psize) {
        +					abd_zero_off(to_write, psize,
        +					    asize - psize);
         				}
         				l2arc_free_abd_on_write(to_write, asize,
         				    arc_buf_type(hdr));
        @@ -7515,12 +7515,12 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         			    ZIO_PRIORITY_ASYNC_WRITE,
         			    ZIO_FLAG_CANFAIL, B_FALSE);
         
        -			write_sz += HDR_GET_LSIZE(hdr);
        +			write_lsize += HDR_GET_LSIZE(hdr);
         			DTRACE_PROBE2(l2arc__write, vdev_t *, dev->l2ad_vdev,
         			    zio_t *, wzio);
         
        -			write_asize += size;
        -			write_psize += asize;
        +			write_psize += psize;
        +			write_asize += asize;
         			dev->l2ad_hand += asize;
         
         			mutex_exit(hash_lock);
        @@ -7536,7 +7536,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         
         	/* No buffers selected for writing? */
         	if (pio == NULL) {
        -		ASSERT0(write_sz);
        +		ASSERT0(write_lsize);
         		ASSERT(!HDR_HAS_L1HDR(head));
         		kmem_cache_free(hdr_l2only_cache, head);
         		return (0);
        @@ -7544,10 +7544,10 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint
         
         	ASSERT3U(write_psize, <=, target_sz);
         	ARCSTAT_BUMP(arcstat_l2_writes_sent);
        -	ARCSTAT_INCR(arcstat_l2_write_bytes, write_asize);
        -	ARCSTAT_INCR(arcstat_l2_size, write_sz);
        -	ARCSTAT_INCR(arcstat_l2_asize, write_asize);
        -	vdev_space_update(dev->l2ad_vdev, write_asize, 0, 0);
        +	ARCSTAT_INCR(arcstat_l2_write_bytes, write_psize);
        +	ARCSTAT_INCR(arcstat_l2_lsize, write_lsize);
        +	ARCSTAT_INCR(arcstat_l2_psize, write_psize);
        +	vdev_space_update(dev->l2ad_vdev, write_psize, 0, 0);
         
         	/*
         	 * Bump device hand to the device start if it is approaching the end.
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:44:50 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 729ACDD29BA;
         Tue,  8 Aug 2017 10:44:50 +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 mx1.freebsd.org (Postfix) with ESMTPS id 411AB7E51A;
         Tue,  8 Aug 2017 10:44:50 +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 v78AinQi030460;
         Tue, 8 Aug 2017 10:44:49 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Ain21030459;
         Tue, 8 Aug 2017 10:44:49 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081044.v78Ain21030459@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:44:49 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322223 - vendor-sys/illumos/dist/uts/common/fs/zfs
         vendor/illumos/dist/cmd/ztest
        X-SVN-Group: vendor
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs
         vendor/illumos/dist/cmd/ztest
        X-SVN-Commit-Revision: 322223
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:44:50 -0000
        
        Author: avg
        Date: Tue Aug  8 10:44:48 2017
        New Revision: 322223
        URL: https://svnweb.freebsd.org/changeset/base/322223
        
        Log:
          8378 crash due to bp in-memory modification of nopwrite block
          
          illumos/illumos-gate@b7edcb940884114e61382937505433c4c38c0278
          https://github.com/illumos/illumos-gate/commit/b7edcb940884114e61382937505433c4c38c0278
          
          https://www.illumos.org/issues/8378
            The problem is that zfs_get_data() supplies a stale zgd_bp to dmu_sync(), which
            we then nopwrite against.
            zfs_get_data() doesn't hold any DMU-related locks, so after it copies db_blkptr
            to zgd_bp, dbuf_write_ready()
            could change db_blkptr, and dbuf_write_done() could remove the dirty record.
            dmu_sync() then sees the stale
            BP and that the dbuf it not dirty, so it is eligible for nop-writing.
            The fix is for dmu_sync() to copy db_blkptr to zgd_bp after acquiring the
            db_mtx. We could still see a stale
            db_blkptr, but if it is stale then the dirty record will still exist and thus
            we won't attempt to nopwrite.
          
          Reviewed by: Prakash Surya 
          Reviewed by: George Wilson 
          Approved by: Robert Mustacchi 
          Author: Matthew Ahrens 
        
        Modified:
          vendor/illumos/dist/cmd/ztest/ztest.c
        
        Changes in other areas also in this revision:
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
          vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c
          vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c
        
        Modified: vendor/illumos/dist/cmd/ztest/ztest.c
        ==============================================================================
        --- vendor/illumos/dist/cmd/ztest/ztest.c	Tue Aug  8 10:43:41 2017	(r322222)
        +++ vendor/illumos/dist/cmd/ztest/ztest.c	Tue Aug  8 10:44:48 2017	(r322223)
        @@ -1842,7 +1842,6 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, z
         	uint64_t object = lr->lr_foid;
         	uint64_t offset = lr->lr_offset;
         	uint64_t size = lr->lr_length;
        -	blkptr_t *bp = &lr->lr_blkptr;
         	uint64_t txg = lr->lr_common.lrc_txg;
         	uint64_t crtxg;
         	dmu_object_info_t doi;
        @@ -1896,11 +1895,7 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, z
         		    DMU_READ_NO_PREFETCH);
         
         		if (error == 0) {
        -			blkptr_t *obp = dmu_buf_get_blkptr(db);
        -			if (obp) {
        -				ASSERT(BP_IS_HOLE(bp));
        -				*bp = *obp;
        -			}
        +			blkptr_t *bp = &lr->lr_blkptr;
         
         			zgd->zgd_db = db;
         			zgd->zgd_bp = bp;
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:44:50 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32149DD29B5;
         Tue,  8 Aug 2017 10:44:50 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0C2907E519;
         Tue,  8 Aug 2017 10:44:49 +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 v78AinUp030454;
         Tue, 8 Aug 2017 10:44:49 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Aimom030451;
         Tue, 8 Aug 2017 10:44:48 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081044.v78Aimom030451@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:44:48 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322223 - vendor-sys/illumos/dist/uts/common/fs/zfs
         vendor/illumos/dist/cmd/ztest
        X-SVN-Group: vendor-sys
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs
         vendor/illumos/dist/cmd/ztest
        X-SVN-Commit-Revision: 322223
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:44:50 -0000
        
        Author: avg
        Date: Tue Aug  8 10:44:48 2017
        New Revision: 322223
        URL: https://svnweb.freebsd.org/changeset/base/322223
        
        Log:
          8378 crash due to bp in-memory modification of nopwrite block
          
          illumos/illumos-gate@b7edcb940884114e61382937505433c4c38c0278
          https://github.com/illumos/illumos-gate/commit/b7edcb940884114e61382937505433c4c38c0278
          
          https://www.illumos.org/issues/8378
            The problem is that zfs_get_data() supplies a stale zgd_bp to dmu_sync(), which
            we then nopwrite against.
            zfs_get_data() doesn't hold any DMU-related locks, so after it copies db_blkptr
            to zgd_bp, dbuf_write_ready()
            could change db_blkptr, and dbuf_write_done() could remove the dirty record.
            dmu_sync() then sees the stale
            BP and that the dbuf it not dirty, so it is eligible for nop-writing.
            The fix is for dmu_sync() to copy db_blkptr to zgd_bp after acquiring the
            db_mtx. We could still see a stale
            db_blkptr, but if it is stale then the dirty record will still exist and thus
            we won't attempt to nopwrite.
          
          Reviewed by: Prakash Surya 
          Reviewed by: George Wilson 
          Approved by: Robert Mustacchi 
          Author: Matthew Ahrens 
        
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
          vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c
          vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c
        
        Changes in other areas also in this revision:
        Modified:
          vendor/illumos/dist/cmd/ztest/ztest.c
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c	Tue Aug  8 10:43:41 2017	(r322222)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c	Tue Aug  8 10:44:48 2017	(r322223)
        @@ -1574,6 +1574,7 @@ dmu_sync_done(zio_t *zio, arc_buf_t *buf, void *varg)
         			uint8_t chksum = BP_GET_CHECKSUM(bp_orig);
         
         			ASSERT(BP_EQUAL(bp, bp_orig));
        +			VERIFY(BP_EQUAL(bp, db->db_blkptr));
         			ASSERT(zio->io_prop.zp_compress != ZIO_COMPRESS_OFF);
         			ASSERT(zio_checksum_table[chksum].ci_flags &
         			    ZCHECKSUM_FLAG_NOPWRITE);
        @@ -1614,19 +1615,11 @@ dmu_sync_late_arrival_done(zio_t *zio)
         	blkptr_t *bp_orig = &zio->io_bp_orig;
         
         	if (zio->io_error == 0 && !BP_IS_HOLE(bp)) {
        -		/*
        -		 * If we didn't allocate a new block (i.e. ZIO_FLAG_NOPWRITE)
        -		 * then there is nothing to do here. Otherwise, free the
        -		 * newly allocated block in this txg.
        -		 */
        -		if (zio->io_flags & ZIO_FLAG_NOPWRITE) {
        -			ASSERT(BP_EQUAL(bp, bp_orig));
        -		} else {
        -			ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig));
        -			ASSERT(zio->io_bp->blk_birth == zio->io_txg);
        -			ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa));
        -			zio_free(zio->io_spa, zio->io_txg, zio->io_bp);
        -		}
        +		ASSERT(!(zio->io_flags & ZIO_FLAG_NOPWRITE));
        +		ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig));
        +		ASSERT(zio->io_bp->blk_birth == zio->io_txg);
        +		ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa));
        +		zio_free(zio->io_spa, zio->io_txg, zio->io_bp);
         	}
         
         	dmu_tx_commit(dsa->dsa_tx);
        @@ -1658,6 +1651,29 @@ dmu_sync_late_arrival(zio_t *pio, objset_t *os, dmu_sy
         	dsa->dsa_zgd = zgd;
         	dsa->dsa_tx = tx;
         
        +	/*
        +	 * Since we are currently syncing this txg, it's nontrivial to
        +	 * determine what BP to nopwrite against, so we disable nopwrite.
        +	 *
        +	 * When syncing, the db_blkptr is initially the BP of the previous
        +	 * txg.  We can not nopwrite against it because it will be changed
        +	 * (this is similar to the non-late-arrival case where the dbuf is
        +	 * dirty in a future txg).
        +	 *
        +	 * Then dbuf_write_ready() sets bp_blkptr to the location we will write.
        +	 * We can not nopwrite against it because although the BP will not
        +	 * (typically) be changed, the data has not yet been persisted to this
        +	 * location.
        +	 *
        +	 * Finally, when dbuf_write_done() is called, it is theoretically
        +	 * possible to always nopwrite, because the data that was written in
        +	 * this txg is the same data that we are trying to write.  However we
        +	 * would need to check that this dbuf is not dirty in any future
        +	 * txg's (as we do in the normal dmu_sync() path). For simplicity, we
        +	 * don't nopwrite in this case.
        +	 */
        +	zp->zp_nopwrite = B_FALSE;
        +
         	zio_nowait(zio_write(pio, os->os_spa, dmu_tx_get_txg(tx), zgd->zgd_bp,
         	    abd_get_from_buf(zgd->zgd_db->db_data, zgd->zgd_db->db_size),
         	    zgd->zgd_db->db_size, zgd->zgd_db->db_size, zp,
        @@ -1695,7 +1711,6 @@ dmu_sync_late_arrival(zio_t *pio, objset_t *os, dmu_sy
         int
         dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done, zgd_t *zgd)
         {
        -	blkptr_t *bp = zgd->zgd_bp;
         	dmu_buf_impl_t *db = (dmu_buf_impl_t *)zgd->zgd_db;
         	objset_t *os = db->db_objset;
         	dsl_dataset_t *ds = os->os_dsl_dataset;
        @@ -1762,6 +1777,21 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done
         
         	ASSERT(dr->dr_next == NULL || dr->dr_next->dr_txg < txg);
         
        +	if (db->db_blkptr != NULL) {
        +		/*
        +		 * We need to fill in zgd_bp with the current blkptr so that
        +		 * the nopwrite code can check if we're writing the same
        +		 * data that's already on disk.  We can only nopwrite if we
        +		 * are sure that after making the copy, db_blkptr will not
        +		 * change until our i/o completes.  We ensure this by
        +		 * holding the db_mtx, and only allowing nopwrite if the
        +		 * block is not already dirty (see below).  This is verified
        +		 * by dmu_sync_done(), which VERIFYs that the db_blkptr has
        +		 * not changed.
        +		 */
        +		*zgd->zgd_bp = *db->db_blkptr;
        +	}
        +
         	/*
         	 * Assume the on-disk data is X, the current syncing data (in
         	 * txg - 1) is Y, and the current in-memory data is Z (currently
        @@ -1813,7 +1843,7 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done
         	dsa->dsa_tx = NULL;
         
         	zio_nowait(arc_write(pio, os->os_spa, txg,
        -	    bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db),
        +	    zgd->zgd_bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db),
         	    &zp, dmu_sync_ready, NULL, NULL, dmu_sync_done, dsa,
         	    ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, &zb));
         
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c	Tue Aug  8 10:43:41 2017	(r322222)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c	Tue Aug  8 10:44:48 2017	(r322223)
        @@ -1053,7 +1053,6 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio
         	uint64_t object = lr->lr_foid;
         	uint64_t offset = lr->lr_offset;
         	uint64_t size = lr->lr_length;
        -	blkptr_t *bp = &lr->lr_blkptr;
         	dmu_buf_t *db;
         	zgd_t *zgd;
         	int error = 0;
        @@ -1130,11 +1129,7 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio
         			    DMU_READ_NO_PREFETCH);
         
         		if (error == 0) {
        -			blkptr_t *obp = dmu_buf_get_blkptr(db);
        -			if (obp) {
        -				ASSERT(BP_IS_HOLE(bp));
        -				*bp = *obp;
        -			}
        +			blkptr_t *bp = &lr->lr_blkptr;
         
         			zgd->zgd_db = db;
         			zgd->zgd_bp = bp;
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c	Tue Aug  8 10:43:41 2017	(r322222)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c	Tue Aug  8 10:44:48 2017	(r322223)
        @@ -24,7 +24,7 @@
          * Portions Copyright 2010 Robert Milkowski
          *
          * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
        - * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
        + * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
          * Copyright (c) 2013, Joyent, Inc. All rights reserved.
          * Copyright (c) 2014 Integros [integros.com]
          */
        @@ -991,7 +991,6 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, zi
         	uint64_t object = ZVOL_OBJ;
         	uint64_t offset = lr->lr_offset;
         	uint64_t size = lr->lr_length;	/* length of user data */
        -	blkptr_t *bp = &lr->lr_blkptr;
         	dmu_buf_t *db;
         	zgd_t *zgd;
         	int error;
        @@ -1019,11 +1018,7 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, zi
         		error = dmu_buf_hold(os, object, offset, zgd, &db,
         		    DMU_READ_NO_PREFETCH);
         		if (error == 0) {
        -			blkptr_t *obp = dmu_buf_get_blkptr(db);
        -			if (obp) {
        -				ASSERT(BP_IS_HOLE(bp));
        -				*bp = *obp;
        -			}
        +			blkptr_t *bp = &lr->lr_blkptr;
         
         			zgd->zgd_db = db;
         			zgd->zgd_bp = bp;
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:45:15 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20F38DD2A83;
         Tue,  8 Aug 2017 10:45:15 +0000 (UTC) (envelope-from se@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id F0B477E6F6;
         Tue,  8 Aug 2017 10:45:14 +0000 (UTC) (envelope-from se@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78AjEcb030537;
         Tue, 8 Aug 2017 10:45:14 GMT (envelope-from se@FreeBSD.org)
        Received: (from se@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78AjDxN030533;
         Tue, 8 Aug 2017 10:45:13 GMT (envelope-from se@FreeBSD.org)
        Message-Id: <201708081045.v78AjDxN030533@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: se set sender to se@FreeBSD.org
         using -f
        From: Stefan Esser 
        Date: Tue, 8 Aug 2017 10:45:13 +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: r322224 - stable/11/share/vt/keymaps
        X-SVN-Group: stable-11
        X-SVN-Commit-Author: se
        X-SVN-Commit-Paths: stable/11/share/vt/keymaps
        X-SVN-Commit-Revision: 322224
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:45:15 -0000
        
        Author: se
        Date: Tue Aug  8 10:45:13 2017
        New Revision: 322224
        URL: https://svnweb.freebsd.org/changeset/base/322224
        
        Log:
          MFC 321858: Add alternate Turkish keyboard layout F, submitted by Ufur Guler.
          MFC 321859: While here, adjust a few file and path names in comments.
        
        Added:
          stable/11/share/vt/keymaps/tr.f.kbd
             - copied unchanged from r321858, head/share/vt/keymaps/tr.f.kbd
        Modified:
          stable/11/share/vt/keymaps/INDEX.keymaps
          stable/11/share/vt/keymaps/Makefile
        Directory Properties:
          stable/11/   (props changed)
        
        Modified: stable/11/share/vt/keymaps/INDEX.keymaps
        ==============================================================================
        --- stable/11/share/vt/keymaps/INDEX.keymaps	Tue Aug  8 10:44:48 2017	(r322223)
        +++ stable/11/share/vt/keymaps/INDEX.keymaps	Tue Aug  8 10:45:13 2017	(r322224)
        @@ -15,7 +15,7 @@
         # 	german.iso.kbd:en:german
         #
         # See also setlocal
        -# /usr/share/locale, /usr/X11/lib/X11/locale/locale.alias
        +# /usr/share/locale, /usr/local/lib/X11/locale/locale.alias
         #
         #
         # Language support: MENU, FONT
        @@ -31,6 +31,7 @@ MENU:he:ךלש תדלקמה תפש ×ª× ×¨×—×‘
         MENU:uk:Оберiть розкладку клавіатури
         MENU:el:Επιλέξτε το πληκτÏολόγιο της κονσόλας
         MENU:hy:Ô¸Õ¶Õ¿Ö€Õ¥Ö„ Õ½Õ¿Õ¥Õ²Õ¶Õ¡Õ·Õ¡Ö€Õ« Õ¤Õ¡Õ½Õ¡Õ¾Õ¸Ö€Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨
        +MENU:tr:Klavye düzeninizi seçiniz
         
         #
         # The font definition for "en" is the fall-back font for
        @@ -210,6 +211,7 @@ de.kbd:de:Deutsch
         de.kbd:fr:Allemand
         de.kbd:pt:Alemão
         de.kbd:es:Alemán
        +de.kbd:tr:Almanca
         de.kbd:uk:Ðімецька
         
         de.acc.kbd:en:German (accent keys)
        @@ -502,11 +504,18 @@ ch.macbook.acc.kbd:fr:Suisse-Allemand  Macbook/Macbook
         ch.macbook.acc.kbd:pt:Suiço-Alemão Macbook/Macbook Pro (com acentos)
         ch.macbook.acc.kbd:es:Germanosuizo  Macbook/Macbook Pro (con acentos)
         
        -tr.kbd:en:Turkish
        -tr.kbd:de:Türkisch
        -tr.kbd:fr:Turc
        -tr.kbd:uk:Турецька
        +tr.kbd:en:Turkish (Q)
        +tr.kbd:de:Türkisch (Q)
        +tr.kbd:fr:Turc (Q)
        +tr.kbd:uk:Турецька (Q)
        +tr.kbd:tr:Türkçe (Q)
         
        +tr.f.kbd:en:Turkish (F)
        +tr.f.kbd:de:Türkisch (F)
        +tr.f.kbd:fr:Turc (F)
        +tr.f.kbd:uk:Турецька (F)
        +tr.f.kbd:tr:Türkçe (F)
        +
         uk.kbd:en:United Kingdom
         uk.kbd:de:Vereinigtes Königreich
         uk.kbd:fr:Royaume Uni
        @@ -515,9 +524,9 @@ uk.kbd:es:Británico
         
         uk.capsctrl.kbd:en:United Kingdom (Caps Lock acts as Left Ctrl)
         uk.capsctrl.kbd:de:Vereinigtes Königreich (Caps Lock als linke Strg)
        -#uk.iso-ctrl.kbd:fr:Royaume Uni (caps lock acts as Left Ctrl)
        -#uk.iso-ctrl.kbd:pt:Reino Unido (caps lock acts as Left Ctrl)
        -#uk.iso-ctrl.kbd:es:Británico (caps lock acts as Left Ctrl)
        +#uk.capsctrl.kbd:fr:Royaume Uni (caps lock acts as Left Ctrl)
        +#uk.capsctrl.kbd:pt:Reino Unido (caps lock acts as Left Ctrl)
        +#uk.capsctrl.kbd:es:Británico (caps lock acts as Left Ctrl)
         
         uk.dvorak.kbd:en:United Kingdom Dvorak
         uk.dvorak.kbd:de:Vereinigtes Königreich Dvorak
        
        Modified: stable/11/share/vt/keymaps/Makefile
        ==============================================================================
        --- stable/11/share/vt/keymaps/Makefile	Tue Aug  8 10:44:48 2017	(r322223)
        +++ stable/11/share/vt/keymaps/Makefile	Tue Aug  8 10:45:13 2017	(r322224)
        @@ -69,6 +69,7 @@ FILES=	INDEX.keymaps \
         	se.kbd \
         	si.kbd \
         	sk.kbd \
        +	tr.f.kbd \
         	tr.kbd \
         	ua.kbd \
         	ua.shift.alt.kbd \
        
        Copied: stable/11/share/vt/keymaps/tr.f.kbd (from r321858, head/share/vt/keymaps/tr.f.kbd)
        ==============================================================================
        --- /dev/null	00:00:00 1970	(empty, because file is newly added)
        +++ stable/11/share/vt/keymaps/tr.f.kbd	Tue Aug  8 10:45:13 2017	(r322224, copy of r321858, head/share/vt/keymaps/tr.f.kbd)
        @@ -0,0 +1,121 @@
        +# Turkish F Keyboard (01-08-2017)
        +#
        +# $FreeBSD$
        +#
        +# Ufuk Guler
        +# ufukguler@yahoo.com
        +#
        +# Mobile        : +(90) 544 848 39 09
        +#                                                         alt
        +# scan                       cntrl          alt    alt   cntrl lock
        +# code  base   shift  cntrl  shift  alt    shift  cntrl  shift state
        +# ------------------------------------------------------------------
        +  000   nop    nop    nop    nop    nop    nop    nop    nop     O
        +  001   esc    esc    esc    esc    esc    esc    debug  esc     O
        +  002   '1'    '!'    '1'    '!'    0xB9   0xA1   '1'    '!'     O
        +  003   '2'    '"'    nul    '"'    0xB2   nop    '2'    nul     O
        +  004   '3'    '^'    nop    nop    '#'    0xB3   '#'    '#'     O
        +  005   '4'    '$'    nop    '$'    0xBC   nop    '4'    '$'     O
        +  006   '5'    '%'    nop    '%'    0xBD   nop    '5'    '%'     O
        +  007   '6'    '&'    nop    '&'    0xBE   nop    '6'    nop     O
        +  008   '7'    '''    nop    '''    '{'    nop    nop    '&'     O
        +  009   '8'    '('    nop    '('    '['    nop    nop    '*'     O
        +  010   '9'    ')'    '9'    ')'    ']'    0xB1   gs     '('     O
        +  011   '0'    '='    nop    '='    '}'    0xB0   nop    ')'     O
        +  012   '/'    '?'    nop    nop    '\'    0xBF   fs     nop     O
        +  013   '-'    '_'    nop    nop    '|'    nop    nop    '+'     O
        +  014   bs     bs     del    del    bs     bs     del    del     O
        +  015   ht     btab   nop    nop    ht     btab   nop    nop     O
        +  016   'f'    'F'    ack    ack    '@'    nop    ack    ack     C
        +  017   'g'    'G'    bel    bel    bel    bel    bel    bel     C
        +  018   0x011F 0x011E nop    nop    nop    nop    nop    nop     C
        +  019   0x0131 'I'    ht     ht     0xB6   ht     ht     ht      C
        +  020   'o'    'O'    si     si     0xF4   0xD4   si     si      C
        +  021   'd'    'D'    eot    eot    0xA5   eot    eot    eot     C
        +  022   'r'    'R'    dc2    dc2    0xAE   dc2    dc2    dc2     C
        +  023   'n'    'N'    so     so     so     so     so     so      C
        +  024   'h'    'H'    bs     bs     0xB0   bs     bs     bs      C
        +  025   'p'    'P'    dle    dle    0xA3   dle    dle    dle     C
        +  026   'q'    'Q'    dc1    dc1    0xA8   dc1    dc1    dc1     C
        +  027   'w'    'W'    etb    etb    0x7E   nop    nop    nop     C
        +  028   cr     cr     nl     nl     cr     cr     nl     nl      O
        +  029   lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl   O
        +  030   'u'    'U'    nak    nak    0xFB   0xDB   nak    nak     C
        +  031   'i'    0x0130 nop    nop    0xEE   0x0130 nop    nop     C
        +  032   'e'    'E'    enq    enq    0x20AC enq    enq    enq     C
        +  033   'a'    'A'    soh    soh    0xE2   0xC2   soh    soh     C
        +  034   0xFC   0xDC   nop    nop    0xFB   0xDB   nop    nop     C
        +  035   't'    'T'    dc4    dc4    0x2122 dc4    dc4    dc4     C
        +  036   'k'    'K'    vt     vt     vt     vt     vt     vt      C
        +  037   'm'    'M'    cr     cr     0xB5   cr     cr     cr      C
        +  038   'l'    'L'    ff     ff     ff     ff     ff     ff      C
        +  039   'y'    'Y'    em     em     0xB4   em    ';'     ':'     C
        +  040   0x015F 0x015E '''    '"'    '#'    0x02C7 '#'    '"'     C
        +  041   '+'    '*'    nop    '*'    0xAC   0xB1   nop    nop     C
        +  042   lshift lshift lshift lshift lshift lshift lshift lshift  O
        +  043   'x'    'X'    can    can    0x60   0x60   can    can     C
        +  044   'j'    'J'    nl     nl     0xAB   'J'    nl     nl      C
        +  045   0xF6   0xD6   nop    nop    0xBB   nop    nop    nop     C
        +  046   'v'    'V'    syn    0x60   0x201C syn    syn    syn     C
        +  047   'c'    'C'    etx    etx    0xA2   0xA9   etx    etx     C
        +  048   0xE7    0xC7  nop    nop    0x201D nop    nop    nop     C
        +  049   'z'    'Z'    sub    sub    sub    sub    sub    sub     C
        +  050   's'    'S'    dc3    dc3    0xA7   dc3    dc3    dc3     C
        +  051   'b'    'B'    stx    stx    0xD7   stx    ','    '<'     C
        +  052   '.'    ':'    '.'    ':'    0xF7   0x2022 '.'    '>'     C
        +  053   ','    ';'    ','    ';'    0x2022 nop    '/'    '?'     O
        +  054   rshift rshift rshift rshift rshift rshift rshift rshift  O
        +  055   '*'    '*'    '*'    '*'    '*'    '*'    '*'    '*'     O
        +  056   lalt   lalt   lalt   lalt   lalt   lalt   lalt   lalt    O
        +  057   ' '    ' '    nul    ' '    ' '    ' '    susp   ' '     O
        +  058   clock  clock  clock  clock  clock  clock  clock  clock   O
        +  059   fkey01 fkey13 fkey25 fkey37 scr01  scr11  scr01  scr11   O
        +  060   fkey02 fkey14 fkey26 fkey38 scr02  scr12  scr02  scr12   O
        +  061   fkey03 fkey15 fkey27 fkey39 scr03  scr13  scr03  scr13   O
        +  062   fkey04 fkey16 fkey28 fkey40 scr04  scr14  scr04  scr14   O
        +  063   fkey05 fkey17 fkey29 fkey41 scr05  scr15  scr05  scr15   O
        +  064   fkey06 fkey18 fkey30 fkey42 scr06  scr16  scr06  scr16   O
        +  065   fkey07 fkey19 fkey31 fkey43 scr07  scr07  scr07  scr07   O
        +  066   fkey08 fkey20 fkey32 fkey44 scr08  scr08  scr08  scr08   O
        +  067   fkey09 fkey21 fkey33 fkey45 scr09  scr09  scr09  scr09   O
        +  068   fkey10 fkey22 fkey34 fkey46 scr10  scr10  scr10  scr10   O
        +  069   nlock  nlock  nlock  nlock  nlock  nlock  nlock  nlock   O
        +  070   slock  slock  slock  slock  slock  slock  slock  slock   O
        +  071   fkey49 '7'    '7'    '7'    '7'    '7'    '7'    '7'     N
        +  072   fkey50 '8'    '8'    '8'    '8'    '8'    '8'    '8'     N
        +  073   fkey51 '9'    '9'    '9'    '9'    '9'    '9'    '9'     N
        +  074   fkey52 '-'    '-'    '-'    '-'    '-'    '-'    '-'     N
        +  075   fkey53 '4'    '4'    '4'    '4'    '4'    '4'    '4'     N
        +  076   fkey54 '5'    '5'    '5'    '5'    '5'    '5'    '5'     N
        +  077   fkey55 '6'    '6'    '6'    '6'    '6'    '6'    '6'     N
        +  078   fkey56 '+'    '+'    '+'    '+'    '+'    '+'    '+'     N
        +  079   fkey57 '1'    '1'    '1'    '1'    '1'    '1'    '1'     N
        +  080   fkey58 '2'    '2'    '2'    '2'    '2'    '2'    '2'     N
        +  081   fkey59 '3'    '3'    '3'    '3'    '3'    '3'    '3'     N
        +  082   fkey60 '0'    '0'    '0'    '0'    '0'    '0'    '0'     N
        +  083   del    ','    ','    ','    ','    ','    boot   boot    N
        +  084   nop    nop    nop    nop    nop    nop    nop    nop     O
        +  085   nop    nop    nop    nop    nop    nop    nop    nop     O
        +  086   '<'    '>'    '<'    '>'    '|'    0xA6   nop    0xA6    O
        +  087   fkey11 fkey23 fkey35 fkey47 scr11  scr11  scr11  scr11   O
        +  088   fkey12 fkey24 fkey36 fkey48 scr12  scr12  scr12  scr12   O
        +  089   cr     cr     nl     nl     cr     cr     nl     nl      O
        +  090   rctrl  rctrl  rctrl  rctrl  rctrl  rctrl  rctrl  rctrl   O
        +  091   '/'    '/'    '/'    '/'    '/'    '/'    '/'    '/'     N
        +  092   nscr   pscr   debug  debug  nop    nop    nop    nop     O
        +  093   ralt   ralt   ralt   ralt   ralt   ralt   ralt   ralt    O
        +  094   fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49  O
        +  095   fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50  O
        +  096   fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51  O
        +  097   fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53  O
        +  098   fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55  O
        +  099   fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57  O
        +  100   fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58  O
        +  101   fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59  O
        +  102   fkey60 paste  fkey60 fkey60 fkey60 fkey60 fkey60 fkey60  O
        +  103   fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 boot   fkey61  O
        +  104   slock  saver  slock  saver  susp   nop    susp   nop     O
        +  105   fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62  O
        +  106   fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63  O
        +  107   fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64  O
        +  108   nop    nop    nop    nop    nop    nop    nop    nop     O
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:45:24 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EAEDDD2AE4;
         Tue,  8 Aug 2017 10:45:24 +0000 (UTC) (envelope-from se@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id 277177E7D8;
         Tue,  8 Aug 2017 10:45:24 +0000 (UTC) (envelope-from se@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78AjNWN030596;
         Tue, 8 Aug 2017 10:45:23 GMT (envelope-from se@FreeBSD.org)
        Received: (from se@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78AjN0F030592;
         Tue, 8 Aug 2017 10:45:23 GMT (envelope-from se@FreeBSD.org)
        Message-Id: <201708081045.v78AjN0F030592@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: se set sender to se@FreeBSD.org
         using -f
        From: Stefan Esser 
        Date: Tue, 8 Aug 2017 10:45:23 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322225 - stable/10/share/vt/keymaps
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: se
        X-SVN-Commit-Paths: stable/10/share/vt/keymaps
        X-SVN-Commit-Revision: 322225
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:45:24 -0000
        
        Author: se
        Date: Tue Aug  8 10:45:22 2017
        New Revision: 322225
        URL: https://svnweb.freebsd.org/changeset/base/322225
        
        Log:
          MFC 321858: Add alternate Turkish keyboard layout F, submitted by Ufur Guler.
          MFC 321859: While here, adjust a few file and path names in comments.
        
        Added:
          stable/10/share/vt/keymaps/tr.f.kbd
             - copied unchanged from r321858, head/share/vt/keymaps/tr.f.kbd
        Modified:
          stable/10/share/vt/keymaps/INDEX.keymaps
          stable/10/share/vt/keymaps/Makefile
        Directory Properties:
          stable/10/   (props changed)
        
        Modified: stable/10/share/vt/keymaps/INDEX.keymaps
        ==============================================================================
        --- stable/10/share/vt/keymaps/INDEX.keymaps	Tue Aug  8 10:45:13 2017	(r322224)
        +++ stable/10/share/vt/keymaps/INDEX.keymaps	Tue Aug  8 10:45:22 2017	(r322225)
        @@ -15,7 +15,7 @@
         # 	german.iso.kbd:en:german
         #
         # See also setlocal
        -# /usr/share/locale, /usr/X11/lib/X11/locale/locale.alias
        +# /usr/share/locale, /usr/local/lib/X11/locale/locale.alias
         #
         #
         # Language support: MENU, FONT
        @@ -31,6 +31,7 @@ MENU:he:ךלש תדלקמה תפש ×ª× ×¨×—×‘
         MENU:uk:Оберiть розкладку клавіатури
         MENU:el:Επιλέξτε το πληκτÏολόγιο της κονσόλας
         MENU:hy:Ô¸Õ¶Õ¿Ö€Õ¥Ö„ Õ½Õ¿Õ¥Õ²Õ¶Õ¡Õ·Õ¡Ö€Õ« Õ¤Õ¡Õ½Õ¡Õ¾Õ¸Ö€Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨
        +MENU:tr:Klavye düzeninizi seçiniz
         
         #
         # The font definition for "en" is the fall-back font for
        @@ -210,6 +211,7 @@ de.kbd:de:Deutsch
         de.kbd:fr:Allemand
         de.kbd:pt:Alemão
         de.kbd:es:Alemán
        +de.kbd:tr:Almanca
         de.kbd:uk:Ðімецька
         
         de.acc.kbd:en:German (accent keys)
        @@ -502,11 +504,18 @@ ch.macbook.acc.kbd:fr:Suisse-Allemand  Macbook/Macbook
         ch.macbook.acc.kbd:pt:Suiço-Alemão Macbook/Macbook Pro (com acentos)
         ch.macbook.acc.kbd:es:Germanosuizo  Macbook/Macbook Pro (con acentos)
         
        -tr.kbd:en:Turkish
        -tr.kbd:de:Türkisch
        -tr.kbd:fr:Turc
        -tr.kbd:uk:Турецька
        +tr.kbd:en:Turkish (Q)
        +tr.kbd:de:Türkisch (Q)
        +tr.kbd:fr:Turc (Q)
        +tr.kbd:uk:Турецька (Q)
        +tr.kbd:tr:Türkçe (Q)
         
        +tr.f.kbd:en:Turkish (F)
        +tr.f.kbd:de:Türkisch (F)
        +tr.f.kbd:fr:Turc (F)
        +tr.f.kbd:uk:Турецька (F)
        +tr.f.kbd:tr:Türkçe (F)
        +
         uk.kbd:en:United Kingdom
         uk.kbd:de:Vereinigtes Königreich
         uk.kbd:fr:Royaume Uni
        @@ -515,9 +524,9 @@ uk.kbd:es:Británico
         
         uk.capsctrl.kbd:en:United Kingdom (Caps Lock acts as Left Ctrl)
         uk.capsctrl.kbd:de:Vereinigtes Königreich (Caps Lock als linke Strg)
        -#uk.iso-ctrl.kbd:fr:Royaume Uni (caps lock acts as Left Ctrl)
        -#uk.iso-ctrl.kbd:pt:Reino Unido (caps lock acts as Left Ctrl)
        -#uk.iso-ctrl.kbd:es:Británico (caps lock acts as Left Ctrl)
        +#uk.capsctrl.kbd:fr:Royaume Uni (caps lock acts as Left Ctrl)
        +#uk.capsctrl.kbd:pt:Reino Unido (caps lock acts as Left Ctrl)
        +#uk.capsctrl.kbd:es:Británico (caps lock acts as Left Ctrl)
         
         uk.dvorak.kbd:en:United Kingdom Dvorak
         uk.dvorak.kbd:de:Vereinigtes Königreich Dvorak
        
        Modified: stable/10/share/vt/keymaps/Makefile
        ==============================================================================
        --- stable/10/share/vt/keymaps/Makefile	Tue Aug  8 10:45:13 2017	(r322224)
        +++ stable/10/share/vt/keymaps/Makefile	Tue Aug  8 10:45:22 2017	(r322225)
        @@ -69,6 +69,7 @@ FILES=	INDEX.keymaps \
         	se.kbd \
         	si.kbd \
         	sk.kbd \
        +	tr.f.kbd \
         	tr.kbd \
         	ua.kbd \
         	ua.shift.alt.kbd \
        
        Copied: stable/10/share/vt/keymaps/tr.f.kbd (from r321858, head/share/vt/keymaps/tr.f.kbd)
        ==============================================================================
        --- /dev/null	00:00:00 1970	(empty, because file is newly added)
        +++ stable/10/share/vt/keymaps/tr.f.kbd	Tue Aug  8 10:45:22 2017	(r322225, copy of r321858, head/share/vt/keymaps/tr.f.kbd)
        @@ -0,0 +1,121 @@
        +# Turkish F Keyboard (01-08-2017)
        +#
        +# $FreeBSD$
        +#
        +# Ufuk Guler
        +# ufukguler@yahoo.com
        +#
        +# Mobile        : +(90) 544 848 39 09
        +#                                                         alt
        +# scan                       cntrl          alt    alt   cntrl lock
        +# code  base   shift  cntrl  shift  alt    shift  cntrl  shift state
        +# ------------------------------------------------------------------
        +  000   nop    nop    nop    nop    nop    nop    nop    nop     O
        +  001   esc    esc    esc    esc    esc    esc    debug  esc     O
        +  002   '1'    '!'    '1'    '!'    0xB9   0xA1   '1'    '!'     O
        +  003   '2'    '"'    nul    '"'    0xB2   nop    '2'    nul     O
        +  004   '3'    '^'    nop    nop    '#'    0xB3   '#'    '#'     O
        +  005   '4'    '$'    nop    '$'    0xBC   nop    '4'    '$'     O
        +  006   '5'    '%'    nop    '%'    0xBD   nop    '5'    '%'     O
        +  007   '6'    '&'    nop    '&'    0xBE   nop    '6'    nop     O
        +  008   '7'    '''    nop    '''    '{'    nop    nop    '&'     O
        +  009   '8'    '('    nop    '('    '['    nop    nop    '*'     O
        +  010   '9'    ')'    '9'    ')'    ']'    0xB1   gs     '('     O
        +  011   '0'    '='    nop    '='    '}'    0xB0   nop    ')'     O
        +  012   '/'    '?'    nop    nop    '\'    0xBF   fs     nop     O
        +  013   '-'    '_'    nop    nop    '|'    nop    nop    '+'     O
        +  014   bs     bs     del    del    bs     bs     del    del     O
        +  015   ht     btab   nop    nop    ht     btab   nop    nop     O
        +  016   'f'    'F'    ack    ack    '@'    nop    ack    ack     C
        +  017   'g'    'G'    bel    bel    bel    bel    bel    bel     C
        +  018   0x011F 0x011E nop    nop    nop    nop    nop    nop     C
        +  019   0x0131 'I'    ht     ht     0xB6   ht     ht     ht      C
        +  020   'o'    'O'    si     si     0xF4   0xD4   si     si      C
        +  021   'd'    'D'    eot    eot    0xA5   eot    eot    eot     C
        +  022   'r'    'R'    dc2    dc2    0xAE   dc2    dc2    dc2     C
        +  023   'n'    'N'    so     so     so     so     so     so      C
        +  024   'h'    'H'    bs     bs     0xB0   bs     bs     bs      C
        +  025   'p'    'P'    dle    dle    0xA3   dle    dle    dle     C
        +  026   'q'    'Q'    dc1    dc1    0xA8   dc1    dc1    dc1     C
        +  027   'w'    'W'    etb    etb    0x7E   nop    nop    nop     C
        +  028   cr     cr     nl     nl     cr     cr     nl     nl      O
        +  029   lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl   O
        +  030   'u'    'U'    nak    nak    0xFB   0xDB   nak    nak     C
        +  031   'i'    0x0130 nop    nop    0xEE   0x0130 nop    nop     C
        +  032   'e'    'E'    enq    enq    0x20AC enq    enq    enq     C
        +  033   'a'    'A'    soh    soh    0xE2   0xC2   soh    soh     C
        +  034   0xFC   0xDC   nop    nop    0xFB   0xDB   nop    nop     C
        +  035   't'    'T'    dc4    dc4    0x2122 dc4    dc4    dc4     C
        +  036   'k'    'K'    vt     vt     vt     vt     vt     vt      C
        +  037   'm'    'M'    cr     cr     0xB5   cr     cr     cr      C
        +  038   'l'    'L'    ff     ff     ff     ff     ff     ff      C
        +  039   'y'    'Y'    em     em     0xB4   em    ';'     ':'     C
        +  040   0x015F 0x015E '''    '"'    '#'    0x02C7 '#'    '"'     C
        +  041   '+'    '*'    nop    '*'    0xAC   0xB1   nop    nop     C
        +  042   lshift lshift lshift lshift lshift lshift lshift lshift  O
        +  043   'x'    'X'    can    can    0x60   0x60   can    can     C
        +  044   'j'    'J'    nl     nl     0xAB   'J'    nl     nl      C
        +  045   0xF6   0xD6   nop    nop    0xBB   nop    nop    nop     C
        +  046   'v'    'V'    syn    0x60   0x201C syn    syn    syn     C
        +  047   'c'    'C'    etx    etx    0xA2   0xA9   etx    etx     C
        +  048   0xE7    0xC7  nop    nop    0x201D nop    nop    nop     C
        +  049   'z'    'Z'    sub    sub    sub    sub    sub    sub     C
        +  050   's'    'S'    dc3    dc3    0xA7   dc3    dc3    dc3     C
        +  051   'b'    'B'    stx    stx    0xD7   stx    ','    '<'     C
        +  052   '.'    ':'    '.'    ':'    0xF7   0x2022 '.'    '>'     C
        +  053   ','    ';'    ','    ';'    0x2022 nop    '/'    '?'     O
        +  054   rshift rshift rshift rshift rshift rshift rshift rshift  O
        +  055   '*'    '*'    '*'    '*'    '*'    '*'    '*'    '*'     O
        +  056   lalt   lalt   lalt   lalt   lalt   lalt   lalt   lalt    O
        +  057   ' '    ' '    nul    ' '    ' '    ' '    susp   ' '     O
        +  058   clock  clock  clock  clock  clock  clock  clock  clock   O
        +  059   fkey01 fkey13 fkey25 fkey37 scr01  scr11  scr01  scr11   O
        +  060   fkey02 fkey14 fkey26 fkey38 scr02  scr12  scr02  scr12   O
        +  061   fkey03 fkey15 fkey27 fkey39 scr03  scr13  scr03  scr13   O
        +  062   fkey04 fkey16 fkey28 fkey40 scr04  scr14  scr04  scr14   O
        +  063   fkey05 fkey17 fkey29 fkey41 scr05  scr15  scr05  scr15   O
        +  064   fkey06 fkey18 fkey30 fkey42 scr06  scr16  scr06  scr16   O
        +  065   fkey07 fkey19 fkey31 fkey43 scr07  scr07  scr07  scr07   O
        +  066   fkey08 fkey20 fkey32 fkey44 scr08  scr08  scr08  scr08   O
        +  067   fkey09 fkey21 fkey33 fkey45 scr09  scr09  scr09  scr09   O
        +  068   fkey10 fkey22 fkey34 fkey46 scr10  scr10  scr10  scr10   O
        +  069   nlock  nlock  nlock  nlock  nlock  nlock  nlock  nlock   O
        +  070   slock  slock  slock  slock  slock  slock  slock  slock   O
        +  071   fkey49 '7'    '7'    '7'    '7'    '7'    '7'    '7'     N
        +  072   fkey50 '8'    '8'    '8'    '8'    '8'    '8'    '8'     N
        +  073   fkey51 '9'    '9'    '9'    '9'    '9'    '9'    '9'     N
        +  074   fkey52 '-'    '-'    '-'    '-'    '-'    '-'    '-'     N
        +  075   fkey53 '4'    '4'    '4'    '4'    '4'    '4'    '4'     N
        +  076   fkey54 '5'    '5'    '5'    '5'    '5'    '5'    '5'     N
        +  077   fkey55 '6'    '6'    '6'    '6'    '6'    '6'    '6'     N
        +  078   fkey56 '+'    '+'    '+'    '+'    '+'    '+'    '+'     N
        +  079   fkey57 '1'    '1'    '1'    '1'    '1'    '1'    '1'     N
        +  080   fkey58 '2'    '2'    '2'    '2'    '2'    '2'    '2'     N
        +  081   fkey59 '3'    '3'    '3'    '3'    '3'    '3'    '3'     N
        +  082   fkey60 '0'    '0'    '0'    '0'    '0'    '0'    '0'     N
        +  083   del    ','    ','    ','    ','    ','    boot   boot    N
        +  084   nop    nop    nop    nop    nop    nop    nop    nop     O
        +  085   nop    nop    nop    nop    nop    nop    nop    nop     O
        +  086   '<'    '>'    '<'    '>'    '|'    0xA6   nop    0xA6    O
        +  087   fkey11 fkey23 fkey35 fkey47 scr11  scr11  scr11  scr11   O
        +  088   fkey12 fkey24 fkey36 fkey48 scr12  scr12  scr12  scr12   O
        +  089   cr     cr     nl     nl     cr     cr     nl     nl      O
        +  090   rctrl  rctrl  rctrl  rctrl  rctrl  rctrl  rctrl  rctrl   O
        +  091   '/'    '/'    '/'    '/'    '/'    '/'    '/'    '/'     N
        +  092   nscr   pscr   debug  debug  nop    nop    nop    nop     O
        +  093   ralt   ralt   ralt   ralt   ralt   ralt   ralt   ralt    O
        +  094   fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49  O
        +  095   fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50  O
        +  096   fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51  O
        +  097   fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53  O
        +  098   fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55  O
        +  099   fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57  O
        +  100   fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58  O
        +  101   fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59  O
        +  102   fkey60 paste  fkey60 fkey60 fkey60 fkey60 fkey60 fkey60  O
        +  103   fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 boot   fkey61  O
        +  104   slock  saver  slock  saver  susp   nop    susp   nop     O
        +  105   fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62  O
        +  106   fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63  O
        +  107   fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64  O
        +  108   nop    nop    nop    nop    nop    nop    nop    nop     O
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:46:53 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 680EBDD2C26;
         Tue,  8 Aug 2017 10:46: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 mx1.freebsd.org (Postfix) with ESMTPS id 4327D7E9E1;
         Tue,  8 Aug 2017 10:46: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 v78AkqHR030690;
         Tue, 8 Aug 2017 10:46:52 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Akq6g030686;
         Tue, 8 Aug 2017 10:46:52 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081046.v78Akq6g030686@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:46:52 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322226 - in head: cddl/contrib/opensolaris/cmd/ztest
         sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Group: head
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/ztest
         sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Commit-Revision: 322226
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:46:53 -0000
        
        Author: avg
        Date: Tue Aug  8 10:46:51 2017
        New Revision: 322226
        URL: https://svnweb.freebsd.org/changeset/base/322226
        
        Log:
          MFV r322223: 8378 crash due to bp in-memory modification of nopwrite block
          
          illumos/illumos-gate@b7edcb940884114e61382937505433c4c38c0278
          https://github.com/illumos/illumos-gate/commit/b7edcb940884114e61382937505433c4c38c0278
          
          https://www.illumos.org/issues/8378
            The problem is that zfs_get_data() supplies a stale zgd_bp to dmu_sync(), which
            we then nopwrite against.
            zfs_get_data() doesn't hold any DMU-related locks, so after it copies db_blkptr
            to zgd_bp, dbuf_write_ready()
            could change db_blkptr, and dbuf_write_done() could remove the dirty record.
            dmu_sync() then sees the stale
            BP and that the dbuf it not dirty, so it is eligible for nop-writing.
            The fix is for dmu_sync() to copy db_blkptr to zgd_bp after acquiring the
            db_mtx. We could still see a stale
            db_blkptr, but if it is stale then the dirty record will still exist and thus
            we won't attempt to nopwrite.
          
          Reviewed by: Prakash Surya 
          Reviewed by: George Wilson 
          Approved by: Robert Mustacchi 
          Author: Matthew Ahrens 
          
          MFC after:	2 weeks
        
        Modified:
          head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
        Directory Properties:
          head/cddl/contrib/opensolaris/   (props changed)
          head/sys/cddl/contrib/opensolaris/   (props changed)
        
        Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
        ==============================================================================
        --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c	Tue Aug  8 10:45:22 2017	(r322225)
        +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c	Tue Aug  8 10:46:51 2017	(r322226)
        @@ -1838,7 +1838,6 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, z
         	uint64_t object = lr->lr_foid;
         	uint64_t offset = lr->lr_offset;
         	uint64_t size = lr->lr_length;
        -	blkptr_t *bp = &lr->lr_blkptr;
         	uint64_t txg = lr->lr_common.lrc_txg;
         	uint64_t crtxg;
         	dmu_object_info_t doi;
        @@ -1892,11 +1891,7 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, z
         		    DMU_READ_NO_PREFETCH);
         
         		if (error == 0) {
        -			blkptr_t *obp = dmu_buf_get_blkptr(db);
        -			if (obp) {
        -				ASSERT(BP_IS_HOLE(bp));
        -				*bp = *obp;
        -			}
        +			blkptr_t *bp = &lr->lr_blkptr;
         
         			zgd->zgd_db = db;
         			zgd->zgd_bp = bp;
        
        Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
        ==============================================================================
        --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c	Tue Aug  8 10:45:22 2017	(r322225)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c	Tue Aug  8 10:46:51 2017	(r322226)
        @@ -1657,6 +1657,7 @@ dmu_sync_done(zio_t *zio, arc_buf_t *buf, void *varg)
         			uint8_t chksum = BP_GET_CHECKSUM(bp_orig);
         
         			ASSERT(BP_EQUAL(bp, bp_orig));
        +			VERIFY(BP_EQUAL(bp, db->db_blkptr));
         			ASSERT(zio->io_prop.zp_compress != ZIO_COMPRESS_OFF);
         			ASSERT(zio_checksum_table[chksum].ci_flags &
         			    ZCHECKSUM_FLAG_NOPWRITE);
        @@ -1697,19 +1698,11 @@ dmu_sync_late_arrival_done(zio_t *zio)
         	blkptr_t *bp_orig = &zio->io_bp_orig;
         
         	if (zio->io_error == 0 && !BP_IS_HOLE(bp)) {
        -		/*
        -		 * If we didn't allocate a new block (i.e. ZIO_FLAG_NOPWRITE)
        -		 * then there is nothing to do here. Otherwise, free the
        -		 * newly allocated block in this txg.
        -		 */
        -		if (zio->io_flags & ZIO_FLAG_NOPWRITE) {
        -			ASSERT(BP_EQUAL(bp, bp_orig));
        -		} else {
        -			ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig));
        -			ASSERT(zio->io_bp->blk_birth == zio->io_txg);
        -			ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa));
        -			zio_free(zio->io_spa, zio->io_txg, zio->io_bp);
        -		}
        +		ASSERT(!(zio->io_flags & ZIO_FLAG_NOPWRITE));
        +		ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig));
        +		ASSERT(zio->io_bp->blk_birth == zio->io_txg);
        +		ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa));
        +		zio_free(zio->io_spa, zio->io_txg, zio->io_bp);
         	}
         
         	dmu_tx_commit(dsa->dsa_tx);
        @@ -1741,6 +1734,29 @@ dmu_sync_late_arrival(zio_t *pio, objset_t *os, dmu_sy
         	dsa->dsa_zgd = zgd;
         	dsa->dsa_tx = tx;
         
        +	/*
        +	 * Since we are currently syncing this txg, it's nontrivial to
        +	 * determine what BP to nopwrite against, so we disable nopwrite.
        +	 *
        +	 * When syncing, the db_blkptr is initially the BP of the previous
        +	 * txg.  We can not nopwrite against it because it will be changed
        +	 * (this is similar to the non-late-arrival case where the dbuf is
        +	 * dirty in a future txg).
        +	 *
        +	 * Then dbuf_write_ready() sets bp_blkptr to the location we will write.
        +	 * We can not nopwrite against it because although the BP will not
        +	 * (typically) be changed, the data has not yet been persisted to this
        +	 * location.
        +	 *
        +	 * Finally, when dbuf_write_done() is called, it is theoretically
        +	 * possible to always nopwrite, because the data that was written in
        +	 * this txg is the same data that we are trying to write.  However we
        +	 * would need to check that this dbuf is not dirty in any future
        +	 * txg's (as we do in the normal dmu_sync() path). For simplicity, we
        +	 * don't nopwrite in this case.
        +	 */
        +	zp->zp_nopwrite = B_FALSE;
        +
         	zio_nowait(zio_write(pio, os->os_spa, dmu_tx_get_txg(tx), zgd->zgd_bp,
         	    abd_get_from_buf(zgd->zgd_db->db_data, zgd->zgd_db->db_size),
         	    zgd->zgd_db->db_size, zgd->zgd_db->db_size, zp,
        @@ -1778,7 +1794,6 @@ dmu_sync_late_arrival(zio_t *pio, objset_t *os, dmu_sy
         int
         dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done, zgd_t *zgd)
         {
        -	blkptr_t *bp = zgd->zgd_bp;
         	dmu_buf_impl_t *db = (dmu_buf_impl_t *)zgd->zgd_db;
         	objset_t *os = db->db_objset;
         	dsl_dataset_t *ds = os->os_dsl_dataset;
        @@ -1845,6 +1860,21 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done
         
         	ASSERT(dr->dr_next == NULL || dr->dr_next->dr_txg < txg);
         
        +	if (db->db_blkptr != NULL) {
        +		/*
        +		 * We need to fill in zgd_bp with the current blkptr so that
        +		 * the nopwrite code can check if we're writing the same
        +		 * data that's already on disk.  We can only nopwrite if we
        +		 * are sure that after making the copy, db_blkptr will not
        +		 * change until our i/o completes.  We ensure this by
        +		 * holding the db_mtx, and only allowing nopwrite if the
        +		 * block is not already dirty (see below).  This is verified
        +		 * by dmu_sync_done(), which VERIFYs that the db_blkptr has
        +		 * not changed.
        +		 */
        +		*zgd->zgd_bp = *db->db_blkptr;
        +	}
        +
         	/*
         	 * Assume the on-disk data is X, the current syncing data (in
         	 * txg - 1) is Y, and the current in-memory data is Z (currently
        @@ -1896,7 +1926,7 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done
         	dsa->dsa_tx = NULL;
         
         	zio_nowait(arc_write(pio, os->os_spa, txg,
        -	    bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db),
        +	    zgd->zgd_bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db),
         	    &zp, dmu_sync_ready, NULL, NULL, dmu_sync_done, dsa,
         	    ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, &zb));
         
        
        Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
        ==============================================================================
        --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Tue Aug  8 10:45:22 2017	(r322225)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Tue Aug  8 10:46:51 2017	(r322226)
        @@ -1297,7 +1297,6 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio
         	uint64_t object = lr->lr_foid;
         	uint64_t offset = lr->lr_offset;
         	uint64_t size = lr->lr_length;
        -	blkptr_t *bp = &lr->lr_blkptr;
         	dmu_buf_t *db;
         	zgd_t *zgd;
         	int error = 0;
        @@ -1374,11 +1373,7 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio
         			    DMU_READ_NO_PREFETCH);
         
         		if (error == 0) {
        -			blkptr_t *obp = dmu_buf_get_blkptr(db);
        -			if (obp) {
        -				ASSERT(BP_IS_HOLE(bp));
        -				*bp = *obp;
        -			}
        +			blkptr_t *bp = &lr->lr_blkptr;
         
         			zgd->zgd_db = db;
         			zgd->zgd_bp = bp;
        
        Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
        ==============================================================================
        --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c	Tue Aug  8 10:45:22 2017	(r322225)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c	Tue Aug  8 10:46:51 2017	(r322226)
        @@ -27,7 +27,7 @@
          * Portions Copyright 2010 Robert Milkowski
          *
          * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
        - * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
        + * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
          * Copyright (c) 2013, Joyent, Inc. All rights reserved.
          * Copyright (c) 2014 Integros [integros.com]
          */
        @@ -1340,7 +1340,6 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, zi
         	uint64_t object = ZVOL_OBJ;
         	uint64_t offset = lr->lr_offset;
         	uint64_t size = lr->lr_length;	/* length of user data */
        -	blkptr_t *bp = &lr->lr_blkptr;
         	dmu_buf_t *db;
         	zgd_t *zgd;
         	int error;
        @@ -1368,11 +1367,7 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, zi
         		error = dmu_buf_hold(os, object, offset, zgd, &db,
         		    DMU_READ_NO_PREFETCH);
         		if (error == 0) {
        -			blkptr_t *obp = dmu_buf_get_blkptr(db);
        -			if (obp) {
        -				ASSERT(BP_IS_HOLE(bp));
        -				*bp = *obp;
        -			}
        +			blkptr_t *bp = &lr->lr_blkptr;
         
         			zgd->zgd_db = db;
         			zgd->zgd_bp = bp;
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:47:57 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAC62DD2D34;
         Tue,  8 Aug 2017 10:47:57 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9EE8C7EB3C;
         Tue,  8 Aug 2017 10:47:57 +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 v78AluPO030772;
         Tue, 8 Aug 2017 10:47:56 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78AluD1030771;
         Tue, 8 Aug 2017 10:47:56 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081047.v78AluD1030771@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:47:56 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322227 - vendor-sys/illumos/dist/uts/common/fs/zfs
        X-SVN-Group: vendor-sys
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs
        X-SVN-Commit-Revision: 322227
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:47:58 -0000
        
        Author: avg
        Date: Tue Aug  8 10:47:56 2017
        New Revision: 322227
        URL: https://svnweb.freebsd.org/changeset/base/322227
        
        Log:
          8377 Panic in bookmark deletion
          
          illumos/illumos-gate@42418f9e73f0d007aa87675ecc206c26fc8e073e
          https://github.com/illumos/illumos-gate/commit/42418f9e73f0d007aa87675ecc206c26fc8e073e
          
          https://www.illumos.org/issues/8377
            The problem is that when dsl_bookmark_destroy_check() is executed from open
            context (the pre-check), it fills in dbda_success based on the existence of the
            bookmark.
            But the bookmark (or containing filesystem as in this case) can be destroyed
            before we get to syncing context. When we re-run dsl_bookmark_destroy_check()
            in syncing
            context, it will not add the deleted bookmark to dbda_success, intending for
            dsl_bookmark_destroy_sync() to not process it. But because the bookmark is
            still in dbda_success
            from the open-context call, we do try to destroy it.
            The fix is that dsl_bookmark_destroy_check() should not modify dbda_success
            when called from open context.
          
          Reviewed by: Paul Dagnelie 
          Reviewed by: Pavel Zakharov 
          Reviewed by: George Wilson 
          Approved by: Robert Mustacchi 
          Author: Matthew Ahrens 
        
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_bookmark.c
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_bookmark.c
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_bookmark.c	Tue Aug  8 10:46:51 2017	(r322226)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_bookmark.c	Tue Aug  8 10:47:56 2017	(r322227)
        @@ -354,6 +354,9 @@ dsl_bookmark_destroy_check(void *arg, dmu_tx_t *tx)
         	dsl_pool_t *dp = dmu_tx_pool(tx);
         	int rv = 0;
         
        +	ASSERT(nvlist_empty(dbda->dbda_success));
        +	ASSERT(nvlist_empty(dbda->dbda_errors));
        +
         	if (!spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_BOOKMARKS))
         		return (0);
         
        @@ -383,7 +386,10 @@ dsl_bookmark_destroy_check(void *arg, dmu_tx_t *tx)
         			}
         		}
         		if (error == 0) {
        -			fnvlist_add_boolean(dbda->dbda_success, fullname);
        +			if (dmu_tx_is_syncing(tx)) {
        +				fnvlist_add_boolean(dbda->dbda_success,
        +				    fullname);
        +			}
         		} else {
         			fnvlist_add_int32(dbda->dbda_errors, fullname, error);
         			rv = error;
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:48:53 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76240DD2E2E;
         Tue,  8 Aug 2017 10:48: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 mx1.freebsd.org (Postfix) with ESMTPS id 447D87EC72;
         Tue,  8 Aug 2017 10:48: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 v78AmqJo030853;
         Tue, 8 Aug 2017 10:48:52 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Amqvm030852;
         Tue, 8 Aug 2017 10:48:52 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081048.v78Amqvm030852@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:48:52 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322228 -
         head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Group: head
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Commit-Revision: 322228
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:48:53 -0000
        
        Author: avg
        Date: Tue Aug  8 10:48:52 2017
        New Revision: 322228
        URL: https://svnweb.freebsd.org/changeset/base/322228
        
        Log:
          MFV r322227: 8377 Panic in bookmark deletion
          
          illumos/illumos-gate@42418f9e73f0d007aa87675ecc206c26fc8e073e
          https://github.com/illumos/illumos-gate/commit/42418f9e73f0d007aa87675ecc206c26fc8e073e
          
          https://www.illumos.org/issues/8377
            The problem is that when dsl_bookmark_destroy_check() is executed from open
            context (the pre-check), it fills in dbda_success based on the existence of the
            bookmark.
            But the bookmark (or containing filesystem as in this case) can be destroyed
            before we get to syncing context. When we re-run dsl_bookmark_destroy_check()
            in syncing
            context, it will not add the deleted bookmark to dbda_success, intending for
            dsl_bookmark_destroy_sync() to not process it. But because the bookmark is
            still in dbda_success
            from the open-context call, we do try to destroy it.
            The fix is that dsl_bookmark_destroy_check() should not modify dbda_success
            when called from open context.
          
          Reviewed by: Paul Dagnelie 
          Reviewed by: Pavel Zakharov 
          Reviewed by: George Wilson 
          Approved by: Robert Mustacchi 
          Author: Matthew Ahrens 
          
          MFC after:	2 weeks
        
        Modified:
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c
        Directory Properties:
          head/sys/cddl/contrib/opensolaris/   (props changed)
        
        Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c
        ==============================================================================
        --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c	Tue Aug  8 10:47:56 2017	(r322227)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c	Tue Aug  8 10:48:52 2017	(r322228)
        @@ -354,6 +354,9 @@ dsl_bookmark_destroy_check(void *arg, dmu_tx_t *tx)
         	dsl_pool_t *dp = dmu_tx_pool(tx);
         	int rv = 0;
         
        +	ASSERT(nvlist_empty(dbda->dbda_success));
        +	ASSERT(nvlist_empty(dbda->dbda_errors));
        +
         	if (!spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_BOOKMARKS))
         		return (0);
         
        @@ -383,7 +386,10 @@ dsl_bookmark_destroy_check(void *arg, dmu_tx_t *tx)
         			}
         		}
         		if (error == 0) {
        -			fnvlist_add_boolean(dbda->dbda_success, fullname);
        +			if (dmu_tx_is_syncing(tx)) {
        +				fnvlist_add_boolean(dbda->dbda_success,
        +				    fullname);
        +			}
         		} else {
         			fnvlist_add_int32(dbda->dbda_errors, fullname, error);
         			rv = error;
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:49:57 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA5E3DD2F09;
         Tue,  8 Aug 2017 10:49:57 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9489E7EDC1;
         Tue,  8 Aug 2017 10:49:57 +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 v78Anusg030934;
         Tue, 8 Aug 2017 10:49:56 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78AnuJW030931;
         Tue, 8 Aug 2017 10:49:56 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081049.v78AnuJW030931@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:49:56 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322229 - vendor-sys/illumos/dist/uts/common/fs/zfs
         vendor-sys/illumos/dist/uts/common/fs/zfs/sys
         vendor/illumos/dist/lib/libzfs/common
         vendor/illumos/dist/lib/libzfs_core/common
        X-SVN-Group: vendor-sys
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs
         vendor-sys/illumos/dist/uts/common/fs/zfs/sys
         vendor/illumos/dist/lib/libzfs/common
         vendor/illumos/dist/lib/libzfs_core/common
        X-SVN-Commit-Revision: 322229
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:49:57 -0000
        
        Author: avg
        Date: Tue Aug  8 10:49:56 2017
        New Revision: 322229
        URL: https://svnweb.freebsd.org/changeset/base/322229
        
        Log:
          7600 zfs rollback should pass target snapshot to kernel
          
          illumos/illumos-gate@77b171372ed21642e04c873ef1e87fe2365520df
          https://github.com/illumos/illumos-gate/commit/77b171372ed21642e04c873ef1e87fe2365520df
          
          https://www.illumos.org/issues/7600
            At present, the kernel side code seems to blindly rollback to whatever happens
            to be the latest snapshot at the time when the rollback task is processed.
            The expected target's name should be passed to the kernel driver and the sync
            task should validate that the target exists and that it is the latest snapshot
            indeed.
          
          Reviewed by: Matthew Ahrens 
          Reviewed by: Pavel Zakharov 
          Approved by: Robert Mustacchi 
          Author: Andriy Gapon 
        
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
          vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
          vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c
        
        Changes in other areas also in this revision:
        Modified:
          vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
          vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c
          vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c	Tue Aug  8 10:48:52 2017	(r322228)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c	Tue Aug  8 10:49:56 2017	(r322229)
        @@ -2173,6 +2173,7 @@ dsl_dataset_handoff_check(dsl_dataset_t *ds, void *own
         
         typedef struct dsl_dataset_rollback_arg {
         	const char *ddra_fsname;
        +	const char *ddra_tosnap;
         	void *ddra_owner;
         	nvlist_t *ddra_result;
         } dsl_dataset_rollback_arg_t;
        @@ -2214,6 +2215,18 @@ dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx)
         		return (SET_ERROR(EAGAIN));
         	}
         
        +	/*
        +	 * If the expected target snapshot is specified, then check that
        +	 * the latest snapshot is it.
        +	 */
        +	if (ddra->ddra_tosnap != NULL) {
        +		char namebuf[ZFS_MAX_DATASET_NAME_LEN];
        +
        +		dsl_dataset_name(ds->ds_prev, namebuf);
        +		if (strcmp(namebuf, ddra->ddra_tosnap) != 0)
        +			return (SET_ERROR(EXDEV));
        +	}
        +
         	/* must not have any bookmarks after the most recent snapshot */
         	nvlist_t *proprequest = fnvlist_alloc();
         	fnvlist_add_boolean(proprequest, zfs_prop_to_name(ZFS_PROP_CREATETXG));
        @@ -2315,11 +2328,13 @@ dsl_dataset_rollback_sync(void *arg, dmu_tx_t *tx)
          * notes above zfs_suspend_fs() for further details.
          */
         int
        -dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result)
        +dsl_dataset_rollback(const char *fsname, const char *tosnap, void *owner,
        +    nvlist_t *result)
         {
         	dsl_dataset_rollback_arg_t ddra;
         
         	ddra.ddra_fsname = fsname;
        +	ddra.ddra_tosnap = tosnap;
         	ddra.ddra_owner = owner;
         	ddra.ddra_result = result;
         
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h	Tue Aug  8 10:48:52 2017	(r322228)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h	Tue Aug  8 10:49:56 2017	(r322229)
        @@ -334,7 +334,8 @@ void dsl_dataset_set_refreservation_sync_impl(dsl_data
         void dsl_dataset_zapify(dsl_dataset_t *ds, dmu_tx_t *tx);
         boolean_t dsl_dataset_is_zapified(dsl_dataset_t *ds);
         boolean_t dsl_dataset_has_resume_receive_state(dsl_dataset_t *ds);
        -int dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result);
        +int dsl_dataset_rollback(const char *fsname, const char *tosnap, void *owner,
        +    nvlist_t *result);
         
         void dsl_dataset_deactivate_feature(uint64_t dsobj,
             spa_feature_t f, dmu_tx_t *tx);
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c	Tue Aug  8 10:48:52 2017	(r322228)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c	Tue Aug  8 10:49:56 2017	(r322229)
        @@ -3636,18 +3636,29 @@ zfs_ioc_destroy(zfs_cmd_t *zc)
         /*
          * fsname is name of dataset to rollback (to most recent snapshot)
          *
        - * innvl is not used.
        + * innvl may contain name of expected target snapshot
          *
          * outnvl: "target" -> name of most recent snapshot
          * }
          */
         /* ARGSUSED */
         static int
        -zfs_ioc_rollback(const char *fsname, nvlist_t *args, nvlist_t *outnvl)
        +zfs_ioc_rollback(const char *fsname, nvlist_t *innvl, nvlist_t *outnvl)
         {
         	zfsvfs_t *zfsvfs;
        +	char *target = NULL;
         	int error;
         
        +	(void) nvlist_lookup_string(innvl, "target", &target);
        +	if (target != NULL) {
        +		int fslen = strlen(fsname);
        +
        +		if (strncmp(fsname, target, fslen) != 0)
        +			return (SET_ERROR(EINVAL));
        +		if (target[fslen] != '@')
        +			return (SET_ERROR(EINVAL));
        +	}
        +
         	if (getzfsvfs(fsname, &zfsvfs) == 0) {
         		dsl_dataset_t *ds;
         
        @@ -3656,13 +3667,14 @@ zfs_ioc_rollback(const char *fsname, nvlist_t *args, n
         		if (error == 0) {
         			int resume_err;
         
        -			error = dsl_dataset_rollback(fsname, zfsvfs, outnvl);
        +			error = dsl_dataset_rollback(fsname, target, zfsvfs,
        +			    outnvl);
         			resume_err = zfs_resume_fs(zfsvfs, ds);
         			error = error ? error : resume_err;
         		}
         		VFS_RELE(zfsvfs->z_vfs);
         	} else {
        -		error = dsl_dataset_rollback(fsname, NULL, outnvl);
        +		error = dsl_dataset_rollback(fsname, target, NULL, outnvl);
         	}
         	return (error);
         }
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:49:58 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D2CDDD2F10;
         Tue,  8 Aug 2017 10:49:58 +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 mx1.freebsd.org (Postfix) with ESMTPS id 06CFF7EDC2;
         Tue,  8 Aug 2017 10:49:57 +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 v78AnvsQ030943;
         Tue, 8 Aug 2017 10:49:57 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Anv3f030940;
         Tue, 8 Aug 2017 10:49:57 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081049.v78Anv3f030940@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:49:56 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322229 - vendor-sys/illumos/dist/uts/common/fs/zfs
         vendor-sys/illumos/dist/uts/common/fs/zfs/sys
         vendor/illumos/dist/lib/libzfs/common
         vendor/illumos/dist/lib/libzfs_core/common
        X-SVN-Group: vendor
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs
         vendor-sys/illumos/dist/uts/common/fs/zfs/sys
         vendor/illumos/dist/lib/libzfs/common
         vendor/illumos/dist/lib/libzfs_core/common
        X-SVN-Commit-Revision: 322229
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:49:58 -0000
        
        Author: avg
        Date: Tue Aug  8 10:49:56 2017
        New Revision: 322229
        URL: https://svnweb.freebsd.org/changeset/base/322229
        
        Log:
          7600 zfs rollback should pass target snapshot to kernel
          
          illumos/illumos-gate@77b171372ed21642e04c873ef1e87fe2365520df
          https://github.com/illumos/illumos-gate/commit/77b171372ed21642e04c873ef1e87fe2365520df
          
          https://www.illumos.org/issues/7600
            At present, the kernel side code seems to blindly rollback to whatever happens
            to be the latest snapshot at the time when the rollback task is processed.
            The expected target's name should be passed to the kernel driver and the sync
            task should validate that the target exists and that it is the latest snapshot
            indeed.
          
          Reviewed by: Matthew Ahrens 
          Reviewed by: Pavel Zakharov 
          Approved by: Robert Mustacchi 
          Author: Andriy Gapon 
        
        Modified:
          vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
          vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c
          vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h
        
        Changes in other areas also in this revision:
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_dataset.c
          vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_dataset.h
          vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c
        
        Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
        ==============================================================================
        --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c	Tue Aug  8 10:48:52 2017	(r322228)
        +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c	Tue Aug  8 10:49:56 2017	(r322229)
        @@ -3912,14 +3912,19 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo
         	}
         
         	/*
        -	 * We rely on zfs_iter_children() to verify that there are no
        -	 * newer snapshots for the given dataset.  Therefore, we can
        -	 * simply pass the name on to the ioctl() call.  There is still
        -	 * an unlikely race condition where the user has taken a
        -	 * snapshot since we verified that this was the most recent.
        +	 * Pass both the filesystem and the wanted snapshot names,
        +	 * we would get an error back if the snapshot is destroyed or
        +	 * a new snapshot is created before this request is processed.
         	 */
        -	err = lzc_rollback(zhp->zfs_name, NULL, 0);
        -	if (err != 0) {
        +	err = lzc_rollback_to(zhp->zfs_name, snap->zfs_name);
        +	if (err == EXDEV) {
        +		zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
        +		    "'%s' is not the latest snapshot"), snap->zfs_name);
        +		(void) zfs_error_fmt(zhp->zfs_hdl, EZFS_BUSY,
        +		    dgettext(TEXT_DOMAIN, "cannot rollback '%s'"),
        +		    zhp->zfs_name);
        +		return (err);
        +	} else if (err != 0) {
         		(void) zfs_standard_error_fmt(zhp->zfs_hdl, errno,
         		    dgettext(TEXT_DOMAIN, "cannot rollback '%s'"),
         		    zhp->zfs_name);
        
        Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c
        ==============================================================================
        --- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c	Tue Aug  8 10:48:52 2017	(r322228)
        +++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c	Tue Aug  8 10:49:56 2017	(r322229)
        @@ -728,6 +728,9 @@ lzc_receive_with_header(const char *snapname, nvlist_t
          * Roll back this filesystem or volume to its most recent snapshot.
          * If snapnamebuf is not NULL, it will be filled in with the name
          * of the most recent snapshot.
        + * Note that the latest snapshot may change if a new one is concurrently
        + * created or the current one is destroyed.  lzc_rollback_to can be used
        + * to roll back to a specific latest snapshot.
          *
          * Return 0 on success or an errno on failure.
          */
        @@ -747,6 +750,27 @@ lzc_rollback(const char *fsname, char *snapnamebuf, in
         	}
         	nvlist_free(result);
         
        +	return (err);
        +}
        +
        +/*
        + * Roll back this filesystem or volume to the specified snapshot,
        + * if possible.
        + *
        + * Return 0 on success or an errno on failure.
        + */
        +int
        +lzc_rollback_to(const char *fsname, const char *snapname)
        +{
        +	nvlist_t *args;
        +	nvlist_t *result;
        +	int err;
        +
        +	args = fnvlist_alloc();
        +	fnvlist_add_string(args, "target", snapname);
        +	err = lzc_ioctl(ZFS_IOC_ROLLBACK, fsname, args, &result);
        +	nvlist_free(args);
        +	nvlist_free(result);
         	return (err);
         }
         
        
        Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h
        ==============================================================================
        --- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h	Tue Aug  8 10:48:52 2017	(r322228)
        +++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h	Tue Aug  8 10:49:56 2017	(r322229)
        @@ -84,6 +84,7 @@ int lzc_receive_with_header(const char *, nvlist_t *, 
         boolean_t lzc_exists(const char *);
         
         int lzc_rollback(const char *, char *, int);
        +int lzc_rollback_to(const char *, const char *);
         
         #ifdef	__cplusplus
         }
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:52:03 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59FDEDD3252;
         Tue,  8 Aug 2017 10:52:03 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3658A7F278;
         Tue,  8 Aug 2017 10:52:03 +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 v78Aq2QU034598;
         Tue, 8 Aug 2017 10:52:02 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Aq1Rl034592;
         Tue, 8 Aug 2017 10:52:01 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081052.v78Aq1Rl034592@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:52:01 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322230 - in head:
         cddl/contrib/opensolaris/lib/libzfs/common
         cddl/contrib/opensolaris/lib/libzfs_core/common
         sys/cddl/contrib/opensolaris/uts/common/fs/zfs
         sys/cddl/contrib/opensolaris...
        X-SVN-Group: head
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/lib/libzfs/common
         cddl/contrib/opensolaris/lib/libzfs_core/common
         sys/cddl/contrib/opensolaris/uts/common/fs/zfs
         sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys
        X-SVN-Commit-Revision: 322230
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:52:03 -0000
        
        Author: avg
        Date: Tue Aug  8 10:52:01 2017
        New Revision: 322230
        URL: https://svnweb.freebsd.org/changeset/base/322230
        
        Log:
          MFV r322229: 7600 zfs rollback should pass target snapshot to kernel
          
          illumos/illumos-gate@77b171372ed21642e04c873ef1e87fe2365520df
          https://github.com/illumos/illumos-gate/commit/77b171372ed21642e04c873ef1e87fe2365520df
          
          https://www.illumos.org/issues/7600
            At present, the kernel side code seems to blindly rollback to whatever happens
            to be the latest snapshot at the time when the rollback task is processed.
            The expected target's name should be passed to the kernel driver and the sync
            task should validate that the target exists and that it is the latest snapshot
            indeed.
          
          Reviewed by: Matthew Ahrens 
          Reviewed by: Pavel Zakharov 
          Approved by: Robert Mustacchi 
          Author: Andriy Gapon 
          
          MFC after:	3 weeks
        
        Modified:
          head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
          head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
          head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
        Directory Properties:
          head/cddl/contrib/opensolaris/   (props changed)
          head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)
          head/sys/cddl/contrib/opensolaris/   (props changed)
        
        Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
        ==============================================================================
        --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	Tue Aug  8 10:49:56 2017	(r322229)
        +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c	Tue Aug  8 10:52:01 2017	(r322230)
        @@ -3957,14 +3957,19 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo
         	}
         
         	/*
        -	 * We rely on zfs_iter_children() to verify that there are no
        -	 * newer snapshots for the given dataset.  Therefore, we can
        -	 * simply pass the name on to the ioctl() call.  There is still
        -	 * an unlikely race condition where the user has taken a
        -	 * snapshot since we verified that this was the most recent.
        +	 * Pass both the filesystem and the wanted snapshot names,
        +	 * we would get an error back if the snapshot is destroyed or
        +	 * a new snapshot is created before this request is processed.
         	 */
        -	err = lzc_rollback(zhp->zfs_name, NULL, 0);
        -	if (err != 0) {
        +	err = lzc_rollback_to(zhp->zfs_name, snap->zfs_name);
        +	if (err == EXDEV) {
        +		zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
        +		    "'%s' is not the latest snapshot"), snap->zfs_name);
        +		(void) zfs_error_fmt(zhp->zfs_hdl, EZFS_BUSY,
        +		    dgettext(TEXT_DOMAIN, "cannot rollback '%s'"),
        +		    zhp->zfs_name);
        +		return (err);
        +	} else if (err != 0) {
         		(void) zfs_standard_error_fmt(zhp->zfs_hdl, errno,
         		    dgettext(TEXT_DOMAIN, "cannot rollback '%s'"),
         		    zhp->zfs_name);
        
        Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
        ==============================================================================
        --- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c	Tue Aug  8 10:49:56 2017	(r322229)
        +++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c	Tue Aug  8 10:52:01 2017	(r322230)
        @@ -765,6 +765,9 @@ lzc_receive_with_header(const char *snapname, nvlist_t
          * Roll back this filesystem or volume to its most recent snapshot.
          * If snapnamebuf is not NULL, it will be filled in with the name
          * of the most recent snapshot.
        + * Note that the latest snapshot may change if a new one is concurrently
        + * created or the current one is destroyed.  lzc_rollback_to can be used
        + * to roll back to a specific latest snapshot.
          *
          * Return 0 on success or an errno on failure.
          */
        @@ -784,6 +787,27 @@ lzc_rollback(const char *fsname, char *snapnamebuf, in
         	}
         	nvlist_free(result);
         
        +	return (err);
        +}
        +
        +/*
        + * Roll back this filesystem or volume to the specified snapshot,
        + * if possible.
        + *
        + * Return 0 on success or an errno on failure.
        + */
        +int
        +lzc_rollback_to(const char *fsname, const char *snapname)
        +{
        +	nvlist_t *args;
        +	nvlist_t *result;
        +	int err;
        +
        +	args = fnvlist_alloc();
        +	fnvlist_add_string(args, "target", snapname);
        +	err = lzc_ioctl(ZFS_IOC_ROLLBACK, fsname, args, &result);
        +	nvlist_free(args);
        +	nvlist_free(result);
         	return (err);
         }
         
        
        Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h
        ==============================================================================
        --- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h	Tue Aug  8 10:49:56 2017	(r322229)
        +++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h	Tue Aug  8 10:52:01 2017	(r322230)
        @@ -84,6 +84,7 @@ int lzc_receive_with_header(const char *, nvlist_t *, 
         boolean_t lzc_exists(const char *);
         
         int lzc_rollback(const char *, char *, int);
        +int lzc_rollback_to(const char *, const char *);
         
         #ifdef	__cplusplus
         }
        
        Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
        ==============================================================================
        --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c	Tue Aug  8 10:49:56 2017	(r322229)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c	Tue Aug  8 10:52:01 2017	(r322230)
        @@ -2259,6 +2259,7 @@ dsl_dataset_handoff_check(dsl_dataset_t *ds, void *own
         
         typedef struct dsl_dataset_rollback_arg {
         	const char *ddra_fsname;
        +	const char *ddra_tosnap;
         	void *ddra_owner;
         	nvlist_t *ddra_result;
         } dsl_dataset_rollback_arg_t;
        @@ -2300,6 +2301,18 @@ dsl_dataset_rollback_check(void *arg, dmu_tx_t *tx)
         		return (SET_ERROR(EAGAIN));
         	}
         
        +	/*
        +	 * If the expected target snapshot is specified, then check that
        +	 * the latest snapshot is it.
        +	 */
        +	if (ddra->ddra_tosnap != NULL) {
        +		char namebuf[ZFS_MAX_DATASET_NAME_LEN];
        +
        +		dsl_dataset_name(ds->ds_prev, namebuf);
        +		if (strcmp(namebuf, ddra->ddra_tosnap) != 0)
        +			return (SET_ERROR(EXDEV));
        +	}
        +
         	/* must not have any bookmarks after the most recent snapshot */
         	nvlist_t *proprequest = fnvlist_alloc();
         	fnvlist_add_boolean(proprequest, zfs_prop_to_name(ZFS_PROP_CREATETXG));
        @@ -2401,11 +2414,13 @@ dsl_dataset_rollback_sync(void *arg, dmu_tx_t *tx)
          * notes above zfs_suspend_fs() for further details.
          */
         int
        -dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result)
        +dsl_dataset_rollback(const char *fsname, const char *tosnap, void *owner,
        +    nvlist_t *result)
         {
         	dsl_dataset_rollback_arg_t ddra;
         
         	ddra.ddra_fsname = fsname;
        +	ddra.ddra_tosnap = tosnap;
         	ddra.ddra_owner = owner;
         	ddra.ddra_result = result;
         
        
        Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
        ==============================================================================
        --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h	Tue Aug  8 10:49:56 2017	(r322229)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h	Tue Aug  8 10:52:01 2017	(r322230)
        @@ -334,7 +334,8 @@ void dsl_dataset_set_refreservation_sync_impl(dsl_data
         void dsl_dataset_zapify(dsl_dataset_t *ds, dmu_tx_t *tx);
         boolean_t dsl_dataset_is_zapified(dsl_dataset_t *ds);
         boolean_t dsl_dataset_has_resume_receive_state(dsl_dataset_t *ds);
        -int dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result);
        +int dsl_dataset_rollback(const char *fsname, const char *tosnap, void *owner,
        +    nvlist_t *result);
         
         void dsl_dataset_deactivate_feature(uint64_t dsobj,
             spa_feature_t f, dmu_tx_t *tx);
        
        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	Tue Aug  8 10:49:56 2017	(r322229)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Tue Aug  8 10:52:01 2017	(r322230)
        @@ -3780,18 +3780,29 @@ zfs_ioc_destroy(zfs_cmd_t *zc)
         /*
          * fsname is name of dataset to rollback (to most recent snapshot)
          *
        - * innvl is not used.
        + * innvl may contain name of expected target snapshot
          *
          * outnvl: "target" -> name of most recent snapshot
          * }
          */
         /* ARGSUSED */
         static int
        -zfs_ioc_rollback(const char *fsname, nvlist_t *args, nvlist_t *outnvl)
        +zfs_ioc_rollback(const char *fsname, nvlist_t *innvl, nvlist_t *outnvl)
         {
         	zfsvfs_t *zfsvfs;
        +	char *target = NULL;
         	int error;
         
        +	(void) nvlist_lookup_string(innvl, "target", &target);
        +	if (target != NULL) {
        +		int fslen = strlen(fsname);
        +
        +		if (strncmp(fsname, target, fslen) != 0)
        +			return (SET_ERROR(EINVAL));
        +		if (target[fslen] != '@')
        +			return (SET_ERROR(EINVAL));
        +	}
        +
         	if (getzfsvfs(fsname, &zfsvfs) == 0) {
         		dsl_dataset_t *ds;
         
        @@ -3800,7 +3811,8 @@ zfs_ioc_rollback(const char *fsname, nvlist_t *args, n
         		if (error == 0) {
         			int resume_err;
         
        -			error = dsl_dataset_rollback(fsname, zfsvfs, outnvl);
        +			error = dsl_dataset_rollback(fsname, target, zfsvfs,
        +			    outnvl);
         			resume_err = zfs_resume_fs(zfsvfs, ds);
         			error = error ? error : resume_err;
         		}
        @@ -3810,7 +3822,7 @@ zfs_ioc_rollback(const char *fsname, nvlist_t *args, n
         		vfs_unbusy(zfsvfs->z_vfs);
         #endif
         	} else {
        -		error = dsl_dataset_rollback(fsname, NULL, outnvl);
        +		error = dsl_dataset_rollback(fsname, target, NULL, outnvl);
         	}
         	return (error);
         }
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:55:43 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2C3FDD34DC;
         Tue,  8 Aug 2017 10:55:43 +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 mx1.freebsd.org (Postfix) with ESMTPS id BD3257F484;
         Tue,  8 Aug 2017 10:55:43 +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 v78Atgnr034781;
         Tue, 8 Aug 2017 10:55:42 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78AtgCF034780;
         Tue, 8 Aug 2017 10:55:42 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081055.v78AtgCF034780@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:55:42 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322231 - vendor/illumos/dist/lib/libzfs/common
        X-SVN-Group: vendor
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor/illumos/dist/lib/libzfs/common
        X-SVN-Commit-Revision: 322231
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:55:44 -0000
        
        Author: avg
        Date: Tue Aug  8 10:55:42 2017
        New Revision: 322231
        URL: https://svnweb.freebsd.org/changeset/base/322231
        
        Log:
          8430 dir_is_empty_readdir() doesn't properly handle error from fdopendir()
          
          illumos/illumos-gate@ba6e7e6505150388de6dc6a88741164118a421bf
          https://github.com/illumos/illumos-gate/commit/ba6e7e6505150388de6dc6a88741164118a421bf
          
          https://www.illumos.org/issues/8430
            we should close dirfd if fdopendir() fails.
          
          Reviewed by: Serapheim Dimitropoulos 
          Reviewed by: Matthew Ahrens 
          Reviewed by: Dan Kimmel 
          Reviewed by: Yuri Pankov 
          Reviewed by: Igor Kozhukhov 
          Approved by: Robert Mustacchi 
          Author: Sowrabha Gopal 
        
        Modified:
          vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c
        
        Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c
        ==============================================================================
        --- vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c	Tue Aug  8 10:52:01 2017	(r322230)
        +++ vendor/illumos/dist/lib/libzfs/common/libzfs_mount.c	Tue Aug  8 10:55:42 2017	(r322231)
        @@ -209,6 +209,7 @@ dir_is_empty_readdir(const char *dirname)
         	}
         
         	if ((dirp = fdopendir(dirfd)) == NULL) {
        +		(void) close(dirfd);
         		return (B_TRUE);
         	}
         
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:58:03 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 434B9DD36CB;
         Tue,  8 Aug 2017 10:58:03 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0FE8B7F5EA;
         Tue,  8 Aug 2017 10:58:02 +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 v78Aw2Z1034905;
         Tue, 8 Aug 2017 10:58:02 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Aw2Sr034904;
         Tue, 8 Aug 2017 10:58:02 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081058.v78Aw2Sr034904@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:58:02 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322232 - vendor-sys/illumos/dist/uts/common/fs/zfs/sys
        X-SVN-Group: vendor-sys
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs/sys
        X-SVN-Commit-Revision: 322232
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:58:03 -0000
        
        Author: avg
        Date: Tue Aug  8 10:58:01 2017
        New Revision: 322232
        URL: https://svnweb.freebsd.org/changeset/base/322232
        
        Log:
          8426 mark immutable buffer arguments as such in abd.h
          
          illumos/illumos-gate@9b195260e22529ac0e2580faaf89402420589c1c
          https://github.com/illumos/illumos-gate/commit/9b195260e22529ac0e2580faaf89402420589c1c
          
          https://www.illumos.org/issues/8426
            abd_copy_from_buf and abd_cmp_buf do not modify their void *buf arguments, so
            qualify them with const.
            abd_copy_from_buf_off and abd_cmp_buf_off already had that type for the
            corresponding arguments.
          
          Reviewed by: Matt Ahrens 
          Approved by: Robert Mustacchi 
          Author: Andriy Gapon 
        
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/sys/abd.h
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/abd.h
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/abd.h	Tue Aug  8 10:55:42 2017	(r322231)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/abd.h	Tue Aug  8 10:58:01 2017	(r322232)
        @@ -113,7 +113,7 @@ abd_copy(abd_t *dabd, abd_t *sabd, size_t size)
         }
         
         inline void
        -abd_copy_from_buf(abd_t *abd, void *buf, size_t size)
        +abd_copy_from_buf(abd_t *abd, const void *buf, size_t size)
         {
         	abd_copy_from_buf_off(abd, buf, 0, size);
         }
        @@ -125,7 +125,7 @@ abd_copy_to_buf(void* buf, abd_t *abd, size_t size)
         }
         
         inline int
        -abd_cmp_buf(abd_t *abd, void *buf, size_t size)
        +abd_cmp_buf(abd_t *abd, const void *buf, size_t size)
         {
         	return (abd_cmp_buf_off(abd, buf, 0, size));
         }
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 10:59:19 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC6F7DD3809;
         Tue,  8 Aug 2017 10:59:19 +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 mx1.freebsd.org (Postfix) with ESMTPS id A48EC7F743;
         Tue,  8 Aug 2017 10:59:19 +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 v78AxIQl034994;
         Tue, 8 Aug 2017 10:59:18 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78AxIH1034993;
         Tue, 8 Aug 2017 10:59:18 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081059.v78AxIH1034993@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 10:59:18 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322233 -
         head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys
        X-SVN-Group: head
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys
        X-SVN-Commit-Revision: 322233
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 10:59:20 -0000
        
        Author: avg
        Date: Tue Aug  8 10:59:18 2017
        New Revision: 322233
        URL: https://svnweb.freebsd.org/changeset/base/322233
        
        Log:
          MFV r322232: 8426 mark immutable buffer arguments as such in abd.h
          
          illumos/illumos-gate@9b195260e22529ac0e2580faaf89402420589c1c
          https://github.com/illumos/illumos-gate/commit/9b195260e22529ac0e2580faaf89402420589c1c
          
          https://www.illumos.org/issues/8426
            abd_copy_from_buf and abd_cmp_buf do not modify their void *buf arguments, so
            qualify them with const.
            abd_copy_from_buf_off and abd_cmp_buf_off already had that type for the
            corresponding arguments.
          
          Reviewed by: Matt Ahrens 
          Approved by: Robert Mustacchi 
          Author: Andriy Gapon 
          
          MFC after:	2 weeks
        
        Modified:
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h
        Directory Properties:
          head/sys/cddl/contrib/opensolaris/   (props changed)
        
        Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h
        ==============================================================================
        --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h	Tue Aug  8 10:58:01 2017	(r322232)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h	Tue Aug  8 10:59:18 2017	(r322233)
        @@ -117,7 +117,7 @@ abd_copy(abd_t *dabd, abd_t *sabd, size_t size)
         }
         
         inline void
        -abd_copy_from_buf(abd_t *abd, void *buf, size_t size)
        +abd_copy_from_buf(abd_t *abd, const void *buf, size_t size)
         {
         	abd_copy_from_buf_off(abd, buf, 0, size);
         }
        @@ -129,7 +129,7 @@ abd_copy_to_buf(void* buf, abd_t *abd, size_t size)
         }
         
         inline int
        -abd_cmp_buf(abd_t *abd, void *buf, size_t size)
        +abd_cmp_buf(abd_t *abd, const void *buf, size_t size)
         {
         	return (abd_cmp_buf_off(abd, buf, 0, size));
         }
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:07:36 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A411DD3F0C;
         Tue,  8 Aug 2017 11:07: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 mx1.freebsd.org (Postfix) with ESMTPS id CA5197FCC0;
         Tue,  8 Aug 2017 11:07:35 +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 v78B7Y16039162;
         Tue, 8 Aug 2017 11:07:34 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78B7Yvm039161;
         Tue, 8 Aug 2017 11:07:34 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081107.v78B7Yvm039161@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 11:07:34 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322234 -
         head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Group: head
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Commit-Revision: 322234
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:07:36 -0000
        
        Author: avg
        Date: Tue Aug  8 11:07:34 2017
        New Revision: 322234
        URL: https://svnweb.freebsd.org/changeset/base/322234
        
        Log:
          zfs: no need for __DECONST after abd constification in r322233
          
          Note that vdev_label_write_pad2() is FreeBSD specific.
          
          MFC after:	2 weeks
          X-MFC after:	r322233
        
        Modified:
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
        
        Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
        ==============================================================================
        --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c	Tue Aug  8 10:59:18 2017	(r322233)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c	Tue Aug  8 11:07:34 2017	(r322234)
        @@ -899,7 +899,7 @@ vdev_label_write_pad2(vdev_t *vd, const char *buf, siz
         
         	pad2 = abd_alloc_for_io(VDEV_PAD_SIZE, B_TRUE);
         	abd_zero(pad2, VDEV_PAD_SIZE);
        -	abd_copy_from_buf(pad2, __DECONST(void *, buf), size);
        +	abd_copy_from_buf(pad2, buf, size);
         
         retry:
         	zio = zio_root(spa, NULL, NULL, flags);
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:10:38 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABC97DD412B;
         Tue,  8 Aug 2017 11:10:38 +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 mx1.freebsd.org (Postfix) with ESMTPS id 8847D7FEED;
         Tue,  8 Aug 2017 11:10:38 +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 v78BAbam040242;
         Tue, 8 Aug 2017 11:10:37 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BAbbc040031;
         Tue, 8 Aug 2017 11:10:37 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081110.v78BAbbc040031@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 11:10:37 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322235 - vendor-sys/illumos/dist/uts/common/fs/zfs
         vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb
         vendor/illumos/dist/man/man1m
        X-SVN-Group: vendor-sys
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs
         vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb
         vendor/illumos/dist/man/man1m
        X-SVN-Commit-Revision: 322235
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:10:38 -0000
        
        Author: avg
        Date: Tue Aug  8 11:10:37 2017
        New Revision: 322235
        URL: https://svnweb.freebsd.org/changeset/base/322235
        
        Log:
          8067 zdb should be able to dump literal embedded block pointer
          
          illumos/illumos-gate@4923c69fddc0887da5604a262585af3efd82ee20
          https://github.com/illumos/illumos-gate/commit/4923c69fddc0887da5604a262585af3efd82ee20
          
          https://www.illumos.org/issues/8067
            Add an option to zdb to print a literal embedded block pointer supplied on the
            command line:
            zdb -E [-A] word0:word1:...:word15
          
          Reviewed by: George Wilson 
          Reviewed by: Alex Reece 
          Reviewed by: Yuri Pankov 
          Approved by: Robert Mustacchi 
          Author: Matthew Ahrens 
        
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/blkptr.c
          vendor-sys/illumos/dist/uts/common/fs/zfs/sys/blkptr.h
        
        Changes in other areas also in this revision:
        Modified:
          vendor/illumos/dist/cmd/zdb/zdb.c
          vendor/illumos/dist/man/man1m/zdb.1m
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/blkptr.c
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/blkptr.c	Tue Aug  8 11:07:34 2017	(r322234)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/blkptr.c	Tue Aug  8 11:10:37 2017	(r322235)
        @@ -117,3 +117,36 @@ decode_embedded_bp_compressed(const blkptr_t *bp, void
         		buf8[i] = BF64_GET(w, (i % sizeof (w)) * NBBY, NBBY);
         	}
         }
        +
        +/*
        + * Fill in the buffer with the (decompressed) payload of the embedded
        + * blkptr_t.  Takes into account compression and byteorder (the payload is
        + * treated as a stream of bytes).
        + * Return 0 on success, or ENOSPC if it won't fit in the buffer.
        + */
        +int
        +decode_embedded_bp(const blkptr_t *bp, void *buf, int buflen)
        +{
        +	int lsize, psize;
        +
        +	ASSERT(BP_IS_EMBEDDED(bp));
        +
        +	lsize = BPE_GET_LSIZE(bp);
        +	psize = BPE_GET_PSIZE(bp);
        +
        +	if (lsize > buflen)
        +		return (ENOSPC);
        +	ASSERT3U(lsize, ==, buflen);
        +
        +	if (BP_GET_COMPRESS(bp) != ZIO_COMPRESS_OFF) {
        +		uint8_t dstbuf[BPE_PAYLOAD_SIZE];
        +		decode_embedded_bp_compressed(bp, dstbuf);
        +		VERIFY0(zio_decompress_data_buf(BP_GET_COMPRESS(bp),
        +		    dstbuf, buf, psize, buflen));
        +	} else {
        +		ASSERT3U(lsize, ==, psize);
        +		decode_embedded_bp_compressed(bp, buf);
        +	}
        +
        +	return (0);
        +}
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/blkptr.h
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/blkptr.h	Tue Aug  8 11:07:34 2017	(r322234)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/blkptr.h	Tue Aug  8 11:10:37 2017	(r322235)
        @@ -30,6 +30,7 @@ extern "C" {
         void encode_embedded_bp_compressed(blkptr_t *, void *,
             enum zio_compress, int, int);
         void decode_embedded_bp_compressed(const blkptr_t *, void *);
        +int decode_embedded_bp(const blkptr_t *, void *, int);
         
         #ifdef	__cplusplus
         }
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:10:39 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26B47DD4133;
         Tue,  8 Aug 2017 11:10: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 mx1.freebsd.org (Postfix) with ESMTPS id F3F8E7FEEE;
         Tue,  8 Aug 2017 11:10:38 +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 v78BAc37040874;
         Tue, 8 Aug 2017 11:10:38 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BAbEI040622;
         Tue, 8 Aug 2017 11:10:37 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081110.v78BAbEI040622@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 11:10:37 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322235 - vendor-sys/illumos/dist/uts/common/fs/zfs
         vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb
         vendor/illumos/dist/man/man1m
        X-SVN-Group: vendor
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs
         vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zdb
         vendor/illumos/dist/man/man1m
        X-SVN-Commit-Revision: 322235
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:10:39 -0000
        
        Author: avg
        Date: Tue Aug  8 11:10:37 2017
        New Revision: 322235
        URL: https://svnweb.freebsd.org/changeset/base/322235
        
        Log:
          8067 zdb should be able to dump literal embedded block pointer
          
          illumos/illumos-gate@4923c69fddc0887da5604a262585af3efd82ee20
          https://github.com/illumos/illumos-gate/commit/4923c69fddc0887da5604a262585af3efd82ee20
          
          https://www.illumos.org/issues/8067
            Add an option to zdb to print a literal embedded block pointer supplied on the
            command line:
            zdb -E [-A] word0:word1:...:word15
          
          Reviewed by: George Wilson 
          Reviewed by: Alex Reece 
          Reviewed by: Yuri Pankov 
          Approved by: Robert Mustacchi 
          Author: Matthew Ahrens 
        
        Modified:
          vendor/illumos/dist/cmd/zdb/zdb.c
          vendor/illumos/dist/man/man1m/zdb.1m
        
        Changes in other areas also in this revision:
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/blkptr.c
          vendor-sys/illumos/dist/uts/common/fs/zfs/sys/blkptr.h
        
        Modified: vendor/illumos/dist/cmd/zdb/zdb.c
        ==============================================================================
        --- vendor/illumos/dist/cmd/zdb/zdb.c	Tue Aug  8 11:07:34 2017	(r322234)
        +++ vendor/illumos/dist/cmd/zdb/zdb.c	Tue Aug  8 11:10:37 2017	(r322235)
        @@ -61,6 +61,7 @@
         #include 
         #include 
         #include 
        +#include 
         #include 
         #undef verify
         #include 
        @@ -134,10 +135,11 @@ usage(void)
         	    "\t%s -O  \n"
         	    "\t%s -R [-A] [-e [-V] [-p  ...]] [-U ]\n"
         	    "\t\t ::[:]\n"
        +	    "\t%s -E [-A] word0:word1:...:word15\n"
         	    "\t%s -S [-AP] [-e [-V] [-p  ...]] [-U ] "
         	    "\n\n",
         	    cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname,
        -	    cmdname);
        +	    cmdname, cmdname);
         
         	(void) fprintf(stderr, "    Dataset name must include at least one "
         	    "separator character '/' or '@'\n");
        @@ -152,6 +154,8 @@ usage(void)
         	(void) fprintf(stderr, "        -C config (or cachefile if alone)\n");
         	(void) fprintf(stderr, "        -d dataset(s)\n");
         	(void) fprintf(stderr, "        -D dedup statistics\n");
        +	(void) fprintf(stderr, "        -E decode and display block from an "
        +	    "embedded block pointer\n");
         	(void) fprintf(stderr, "        -h pool history\n");
         	(void) fprintf(stderr, "        -i intent logs\n");
         	(void) fprintf(stderr, "        -l read label contents\n");
        @@ -3625,6 +3629,33 @@ out:
         	free(dup);
         }
         
        +static void
        +zdb_embedded_block(char *thing)
        +{
        +	blkptr_t bp = { 0 };
        +	unsigned long long *words = (void *)&bp;
        +	char buf[SPA_MAXBLOCKSIZE];
        +	int err;
        +
        +	err = sscanf(thing, "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx:"
        +	    "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx",
        +	    words + 0, words + 1, words + 2, words + 3,
        +	    words + 4, words + 5, words + 6, words + 7,
        +	    words + 8, words + 9, words + 10, words + 11,
        +	    words + 12, words + 13, words + 14, words + 15);
        +	if (err != 16) {
        +		(void) printf("invalid input format\n");
        +		exit(1);
        +	}
        +	ASSERT3U(BPE_GET_LSIZE(&bp), <=, SPA_MAXBLOCKSIZE);
        +	err = decode_embedded_bp(&bp, buf, BPE_GET_LSIZE(&bp));
        +	if (err != 0) {
        +		(void) printf("decode failed: %u\n", err);
        +		exit(1);
        +	}
        +	zdb_dump_block_raw(buf, BPE_GET_LSIZE(&bp), 0);
        +}
        +
         static boolean_t
         pool_match(nvlist_t *cfg, char *tgt)
         {
        @@ -3743,13 +3774,14 @@ main(int argc, char **argv)
         		spa_config_path = spa_config_path_env;
         
         	while ((c = getopt(argc, argv,
        -	    "AbcCdDeFGhiI:lLmMo:Op:PqRsSt:uU:vVx:X")) != -1) {
        +	    "AbcCdDeEFGhiI:lLmMo:Op:PqRsSt:uU:vVx:X")) != -1) {
         		switch (c) {
         		case 'b':
         		case 'c':
         		case 'C':
         		case 'd':
         		case 'D':
        +		case 'E':
         		case 'G':
         		case 'h':
         		case 'i':
        @@ -3813,6 +3845,12 @@ main(int argc, char **argv)
         			break;
         		case 'U':
         			spa_config_path = optarg;
        +			if (spa_config_path[0] != '/') {
        +				(void) fprintf(stderr,
        +				    "cachefile must be an absolute path "
        +				    "(i.e. start with a slash)\n");
        +				usage();
        +			}
         			break;
         		case 'v':
         			verbose++;
        @@ -3860,7 +3898,7 @@ main(int argc, char **argv)
         		verbose = MAX(verbose, 1);
         
         	for (c = 0; c < 256; c++) {
        -		if (dump_all && strchr("AeFlLOPRSX", c) == NULL)
        +		if (dump_all && strchr("AeEFlLOPRSX", c) == NULL)
         			dump_opt[c] = 1;
         		if (dump_opt[c])
         			dump_opt[c] += verbose;
        @@ -3874,6 +3912,14 @@ main(int argc, char **argv)
         
         	if (argc < 2 && dump_opt['R'])
         		usage();
        +
        +	if (dump_opt['E']) {
        +		if (argc != 1)
        +			usage();
        +		zdb_embedded_block(argv[0]);
        +		return (0);
        +	}
        +
         	if (argc < 1) {
         		if (!dump_opt['e'] && dump_opt['C']) {
         			dump_cachefile(spa_config_path);
        
        Modified: vendor/illumos/dist/man/man1m/zdb.1m
        ==============================================================================
        --- vendor/illumos/dist/man/man1m/zdb.1m	Tue Aug  8 11:07:34 2017	(r322234)
        +++ vendor/illumos/dist/man/man1m/zdb.1m	Tue Aug  8 11:10:37 2017	(r322235)
        @@ -10,10 +10,10 @@
         .\"
         .\"
         .\" Copyright 2012, Richard Lowe.
        -.\" Copyright (c) 2012, 2016 by Delphix. All rights reserved.
        +.\" Copyright (c) 2012, 2017 by Delphix. All rights reserved.
         .\" Copyright 2017 Nexenta Systems, Inc.
         .\"
        -.Dd January 14, 2017
        +.Dd April 14, 2017
         .Dt ZDB 1M
         .Os
         .Sh NAME
        @@ -39,6 +39,10 @@
         .Op Fl A
         .Op Fl U Ar cache
         .Nm
        +.Fl E
        +.Op Fl A
        +.Ar word0 Ns : Ns Ar word1 Ns :...: Ns Ar word15
        +.Nm
         .Fl l
         .Op Fl Aqu
         .Ar device
        @@ -153,6 +157,10 @@ Display the statistics independently for each deduplic
         Dump the contents of the deduplication tables describing duplicate blocks.
         .It Fl DDDDD
         Also dump the contents of the deduplication tables describing unique blocks.
        +.It Fl E Ar word0 Ns : Ns Ar word1 Ns :...: Ns Ar word15
        +Decode and display block from an embedded block pointer specified by the
        +.Ar word
        +arguments.
         .It Fl h
         Display pool history similar to
         .Nm zpool Cm history ,
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:13:29 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 092EDDD454A;
         Tue,  8 Aug 2017 11:13:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id CACB280578;
         Tue,  8 Aug 2017 11:13:28 +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 v78BDR3O043187;
         Tue, 8 Aug 2017 11:13:27 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BDRba043186;
         Tue, 8 Aug 2017 11:13:27 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081113.v78BDRba043186@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 11:13:27 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322236 - vendor-sys/illumos/dist/uts/common/fs/zfs
        X-SVN-Group: vendor-sys
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs
        X-SVN-Commit-Revision: 322236
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:13:29 -0000
        
        Author: avg
        Date: Tue Aug  8 11:13:27 2017
        New Revision: 322236
        URL: https://svnweb.freebsd.org/changeset/base/322236
        
        Log:
          8126 ztest assertion failed in dbuf_dirty due to dn_nlevels changing
          
          illumos/illumos-gate@dcb6872c565819ac88acbc2ece999ef241c8b982
          https://github.com/illumos/illumos-gate/commit/dcb6872c565819ac88acbc2ece999ef241c8b982
          
          https://www.illumos.org/issues/8126
            The sync thread is concurrently modifying dn_phys->dn_nlevels
            while dbuf_dirty() is trying to assert something about it, without
            holding the necessary lock. We need to move this assertion further down
            in the function, after we have acquired the dn_struct_rwlock.
          
          Reviewed by: Pavel Zakharov 
          Reviewed by: Serapheim Dimitropoulos 
          Approved by: Robert Mustacchi 
          Author: Matthew Ahrens 
        
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c	Tue Aug  8 11:10:37 2017	(r322235)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c	Tue Aug  8 11:13:27 2017	(r322236)
        @@ -1542,11 +1542,6 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx)
         	    (dmu_tx_is_syncing(tx) ? DN_DIRTY_SYNC : DN_DIRTY_OPEN));
         
         	ASSERT3U(dn->dn_nlevels, >, db->db_level);
        -	ASSERT((dn->dn_phys->dn_nlevels == 0 && db->db_level == 0) ||
        -	    dn->dn_phys->dn_nlevels > db->db_level ||
        -	    dn->dn_next_nlevels[txgoff] > db->db_level ||
        -	    dn->dn_next_nlevels[(tx->tx_txg-1) & TXG_MASK] > db->db_level ||
        -	    dn->dn_next_nlevels[(tx->tx_txg-2) & TXG_MASK] > db->db_level);
         
         	/*
         	 * We should only be dirtying in syncing context if it's the
        @@ -1662,6 +1657,16 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx)
         		rw_enter(&dn->dn_struct_rwlock, RW_READER);
         		drop_struct_lock = TRUE;
         	}
        +
        +	/*
        +	 * We need to hold the dn_struct_rwlock to make this assertion,
        +	 * because it protects dn_phys / dn_next_nlevels from changing.
        +	 */
        +	ASSERT((dn->dn_phys->dn_nlevels == 0 && db->db_level == 0) ||
        +	    dn->dn_phys->dn_nlevels > db->db_level ||
        +	    dn->dn_next_nlevels[txgoff] > db->db_level ||
        +	    dn->dn_next_nlevels[(tx->tx_txg-1) & TXG_MASK] > db->db_level ||
        +	    dn->dn_next_nlevels[(tx->tx_txg-2) & TXG_MASK] > db->db_level);
         
         	/*
         	 * If we are overwriting a dedup BP, then unless it is snapshotted,
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:14:42 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41603DD468D;
         Tue,  8 Aug 2017 11:14: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 mx1.freebsd.org (Postfix) with ESMTPS id 0EF058071F;
         Tue,  8 Aug 2017 11:14: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 v78BEfx0043278;
         Tue, 8 Aug 2017 11:14:41 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BEfuf043277;
         Tue, 8 Aug 2017 11:14:41 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081114.v78BEfuf043277@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 11:14:41 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322237 -
         head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Group: head
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Commit-Revision: 322237
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:14:42 -0000
        
        Author: avg
        Date: Tue Aug  8 11:14:40 2017
        New Revision: 322237
        URL: https://svnweb.freebsd.org/changeset/base/322237
        
        Log:
          MFV r322236: 8126 ztest assertion failed in dbuf_dirty due to dn_nlevels changing
          
          illumos/illumos-gate@dcb6872c565819ac88acbc2ece999ef241c8b982
          https://github.com/illumos/illumos-gate/commit/dcb6872c565819ac88acbc2ece999ef241c8b982
          
          https://www.illumos.org/issues/8126
            The sync thread is concurrently modifying dn_phys->dn_nlevels
            while dbuf_dirty() is trying to assert something about it, without
            holding the necessary lock. We need to move this assertion further down
            in the function, after we have acquired the dn_struct_rwlock.
          
          Reviewed by: Pavel Zakharov 
          Reviewed by: Serapheim Dimitropoulos 
          Approved by: Robert Mustacchi 
          Author: Matthew Ahrens 
          
          MFC after:	2 weeks
        
        Modified:
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
        Directory Properties:
          head/sys/cddl/contrib/opensolaris/   (props changed)
        
        Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
        ==============================================================================
        --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c	Tue Aug  8 11:13:27 2017	(r322236)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c	Tue Aug  8 11:14:40 2017	(r322237)
        @@ -1542,11 +1542,6 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx)
         	    (dmu_tx_is_syncing(tx) ? DN_DIRTY_SYNC : DN_DIRTY_OPEN));
         
         	ASSERT3U(dn->dn_nlevels, >, db->db_level);
        -	ASSERT((dn->dn_phys->dn_nlevels == 0 && db->db_level == 0) ||
        -	    dn->dn_phys->dn_nlevels > db->db_level ||
        -	    dn->dn_next_nlevels[txgoff] > db->db_level ||
        -	    dn->dn_next_nlevels[(tx->tx_txg-1) & TXG_MASK] > db->db_level ||
        -	    dn->dn_next_nlevels[(tx->tx_txg-2) & TXG_MASK] > db->db_level);
         
         	/*
         	 * We should only be dirtying in syncing context if it's the
        @@ -1662,6 +1657,16 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx)
         		rw_enter(&dn->dn_struct_rwlock, RW_READER);
         		drop_struct_lock = TRUE;
         	}
        +
        +	/*
        +	 * We need to hold the dn_struct_rwlock to make this assertion,
        +	 * because it protects dn_phys / dn_next_nlevels from changing.
        +	 */
        +	ASSERT((dn->dn_phys->dn_nlevels == 0 && db->db_level == 0) ||
        +	    dn->dn_phys->dn_nlevels > db->db_level ||
        +	    dn->dn_next_nlevels[txgoff] > db->db_level ||
        +	    dn->dn_next_nlevels[(tx->tx_txg-1) & TXG_MASK] > db->db_level ||
        +	    dn->dn_next_nlevels[(tx->tx_txg-2) & TXG_MASK] > db->db_level);
         
         	/*
         	 * If we are overwriting a dedup BP, then unless it is snapshotted,
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:15:37 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7EEEDD47AC;
         Tue,  8 Aug 2017 11:15: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 mx1.freebsd.org (Postfix) with ESMTPS id 7B8C78088F;
         Tue,  8 Aug 2017 11:15: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 v78BFaKk043360;
         Tue, 8 Aug 2017 11:15:36 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BFaZu043359;
         Tue, 8 Aug 2017 11:15:36 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081115.v78BFaZu043359@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 11:15:36 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322238 - vendor-sys/illumos/dist/uts/common/fs/zfs
        X-SVN-Group: vendor-sys
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs
        X-SVN-Commit-Revision: 322238
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:15:37 -0000
        
        Author: avg
        Date: Tue Aug  8 11:15:36 2017
        New Revision: 322238
        URL: https://svnweb.freebsd.org/changeset/base/322238
        
        Log:
          7915 checks in l2arc_evict could use some cleaning up
          
          illumos/illumos-gate@267ae6c3a88d2fc39276af66caafa978b0935b82
          https://github.com/illumos/illumos-gate/commit/267ae6c3a88d2fc39276af66caafa978b0935b82
          
          https://www.illumos.org/issues/7915
            l2arc_evict() is strictly serialized with respect to l2arc_write_buffers() and
            l2arc_write_done().
            Normally, l2arc_evict() and l2arc_write_buffers() are called from the same
            thread, so they can not be concurrent.
            Also, l2arc_write_buffers() uses zio_wait() on the parent zio of all cache zio-
            s.
            That ensures that l2arc_write_done() is completed before l2arc_write_buffers()
            returns.
            Finally, if a cache device is removed, then l2arc_evict() is called under
            SCL_ALL in the exclusive mode.
            That ensures that it can not be concurrent with the normal L2ARC accesses to
            the device (including writing and evicting buffers).
            Given the above, some checks and actions in l2arc_evict() do not make sense.
            For instance, it must never encounter the write head header let alone remove it
            from the buffer list.
          
          Reviewed by: Dan Kimmel 
          Reviewed by: Prakash Surya 
          Approved by: Matthew Ahrens 
          Author: Andriy Gapon 
        
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c	Tue Aug  8 11:14:40 2017	(r322237)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c	Tue Aug  8 11:15:36 2017	(r322238)
        @@ -6755,18 +6755,16 @@ top:
         			goto top;
         		}
         
        -		if (HDR_L2_WRITE_HEAD(hdr)) {
        -			/*
        -			 * We hit a write head node.  Leave it for
        -			 * l2arc_write_done().
        -			 */
        -			list_remove(buflist, hdr);
        -			mutex_exit(hash_lock);
        -			continue;
        -		}
        +		/*
        +		 * A header can't be on this list if it doesn't have L2 header.
        +		 */
        +		ASSERT(HDR_HAS_L2HDR(hdr));
         
        -		if (!all && HDR_HAS_L2HDR(hdr) &&
        -		    (hdr->b_l2hdr.b_daddr > taddr ||
        +		/* Ensure this header has finished being written. */
        +		ASSERT(!HDR_L2_WRITING(hdr));
        +		ASSERT(!HDR_L2_WRITE_HEAD(hdr));
        +
        +		if (!all && (hdr->b_l2hdr.b_daddr >= taddr ||
         		    hdr->b_l2hdr.b_daddr < dev->l2ad_hand)) {
         			/*
         			 * We've evicted to the target address,
        @@ -6776,7 +6774,6 @@ top:
         			break;
         		}
         
        -		ASSERT(HDR_HAS_L2HDR(hdr));
         		if (!HDR_HAS_L1HDR(hdr)) {
         			ASSERT(!HDR_L2_READING(hdr));
         			/*
        @@ -6798,9 +6795,6 @@ top:
         				ARCSTAT_BUMP(arcstat_l2_evict_reading);
         				arc_hdr_set_flags(hdr, ARC_FLAG_L2_EVICTED);
         			}
        -
        -			/* Ensure this header has finished being written */
        -			ASSERT(!HDR_L2_WRITING(hdr));
         
         			arc_hdr_l2hdr_destroy(hdr);
         		}
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:19:15 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EFA3DD4A0C;
         Tue,  8 Aug 2017 11:19:15 +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 mx1.freebsd.org (Postfix) with ESMTPS id 1B4BA80A3C;
         Tue,  8 Aug 2017 11:19:15 +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 v78BJEkm043524;
         Tue, 8 Aug 2017 11:19:14 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BJE37043523;
         Tue, 8 Aug 2017 11:19:14 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081119.v78BJE37043523@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 11:19:14 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322239 -
         head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Group: head
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Commit-Revision: 322239
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:19:15 -0000
        
        Author: avg
        Date: Tue Aug  8 11:19:14 2017
        New Revision: 322239
        URL: https://svnweb.freebsd.org/changeset/base/322239
        
        Log:
          MFV r322238: 7915 checks in l2arc_evict could use some cleaning up
          
          illumos/illumos-gate@267ae6c3a88d2fc39276af66caafa978b0935b82
          https://github.com/illumos/illumos-gate/commit/267ae6c3a88d2fc39276af66caafa978b0935b82
          
          https://www.illumos.org/issues/7915
            l2arc_evict() is strictly serialized with respect to
            l2arc_write_buffers() and l2arc_write_done().  Normally, l2arc_evict()
            and l2arc_write_buffers() are called from the same thread, so they can
            not be concurrent.  Also, l2arc_write_buffers() uses zio_wait() on the
            parent zio of all cache zio-s.  That ensures that l2arc_write_done()
            is completed before l2arc_write_buffers() returns.  Finally, if a
            cache device is removed, then l2arc_evict() is called under SCL_ALL in
            the exclusive mode.  That ensures that it can not be concurrent with
            the normal L2ARC accesses to the device (including writing and
            evicting buffers).  Given the above, some checks and actions in
            l2arc_evict() do not make sense.  For instance, it must never
            encounter the write head header let alone remove it from the buffer
            list.
          
          Reviewed by: Dan Kimmel 
          Reviewed by: Prakash Surya 
          Approved by: Matthew Ahrens 
          Author: Andriy Gapon 
          
          MFC after:	2 weeks
        
        Modified:
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
        Directory Properties:
          head/sys/cddl/contrib/opensolaris/   (props changed)
        
        Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
        ==============================================================================
        --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Tue Aug  8 11:15:36 2017	(r322238)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Tue Aug  8 11:19:14 2017	(r322239)
        @@ -7284,18 +7284,16 @@ top:
         			goto top;
         		}
         
        -		if (HDR_L2_WRITE_HEAD(hdr)) {
        -			/*
        -			 * We hit a write head node.  Leave it for
        -			 * l2arc_write_done().
        -			 */
        -			list_remove(buflist, hdr);
        -			mutex_exit(hash_lock);
        -			continue;
        -		}
        +		/*
        +		 * A header can't be on this list if it doesn't have L2 header.
        +		 */
        +		ASSERT(HDR_HAS_L2HDR(hdr));
         
        -		if (!all && HDR_HAS_L2HDR(hdr) &&
        -		    (hdr->b_l2hdr.b_daddr >= taddr ||
        +		/* Ensure this header has finished being written. */
        +		ASSERT(!HDR_L2_WRITING(hdr));
        +		ASSERT(!HDR_L2_WRITE_HEAD(hdr));
        +
        +		if (!all && (hdr->b_l2hdr.b_daddr >= taddr ||
         		    hdr->b_l2hdr.b_daddr < dev->l2ad_hand)) {
         			/*
         			 * We've evicted to the target address,
        @@ -7305,7 +7303,6 @@ top:
         			break;
         		}
         
        -		ASSERT(HDR_HAS_L2HDR(hdr));
         		if (!HDR_HAS_L1HDR(hdr)) {
         			ASSERT(!HDR_L2_READING(hdr));
         			/*
        @@ -7327,9 +7324,6 @@ top:
         				ARCSTAT_BUMP(arcstat_l2_evict_reading);
         				arc_hdr_set_flags(hdr, ARC_FLAG_L2_EVICTED);
         			}
        -
        -			/* Ensure this header has finished being written */
        -			ASSERT(!HDR_L2_WRITING(hdr));
         
         			arc_hdr_l2hdr_destroy(hdr);
         		}
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:19:58 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 400A0DD4B0E;
         Tue,  8 Aug 2017 11:19:58 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0A4CF80C02;
         Tue,  8 Aug 2017 11:19:57 +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 v78BJvIV043590;
         Tue, 8 Aug 2017 11:19:57 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BJvjL043589;
         Tue, 8 Aug 2017 11:19:57 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081119.v78BJvjL043589@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 11:19:57 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322240 - vendor-sys/illumos/dist/uts/common/fs/zfs/sys
        X-SVN-Group: vendor-sys
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs/sys
        X-SVN-Commit-Revision: 322240
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:19:58 -0000
        
        Author: avg
        Date: Tue Aug  8 11:19:56 2017
        New Revision: 322240
        URL: https://svnweb.freebsd.org/changeset/base/322240
        
        Log:
          8491 uberblock on-disk padding to reserve space for smoothly merging zpool checkpoint & MMP in ZFS
          
          illumos/illumos-gate@79c2b812ee2010ebf20fdd92dc5f06b59000a94c
          https://github.com/illumos/illumos-gate/commit/79c2b812ee2010ebf20fdd92dc5f06b59000a94c
          
          https://www.illumos.org/issues/8491
            The zpool checkpoint feature in DxOS added a new field in the uberblock.
            The Multi-Modifier Protection Pull Request from ZoL adds two new fields in the
            uberblock (Reference: https://github.com/zfsonlinux/zfs/pull/6279).
            As these two changes come from two different sources and once upstreamed and
            deployed will introduce an incompatibility with each other we want
            to upstream a change that will reserve the padding for both of them so
            integration goes smoothly and everyone gets both features.
          
          Reviewed by: Matthew Ahrens 
          Reviewed by: Brian Behlendorf 
          Reviewed by: Olaf Faaland 
          Approved by: Gordon Ross 
          Author: Serapheim Dimitropoulos 
        
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/sys/uberblock_impl.h
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/uberblock_impl.h
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/uberblock_impl.h	Tue Aug  8 11:19:14 2017	(r322239)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/uberblock_impl.h	Tue Aug  8 11:19:56 2017	(r322240)
        @@ -20,6 +20,7 @@
          */
         /*
          * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2017 by Delphix. All rights reserved.
          */
         
         #ifndef _SYS_UBERBLOCK_IMPL_H
        @@ -54,6 +55,12 @@ struct uberblock {
         
         	/* highest SPA_VERSION supported by software that wrote this txg */
         	uint64_t	ub_software_version;
        +
        +	/* These fields are reserved for features that are under development: */
        +	uint64_t	ub_mmp_magic;
        +	uint64_t	ub_mmp_delay;
        +	uint64_t	ub_mmp_seq;
        +	uint64_t	ub_checkpoint_txg;
         };
         
         #ifdef	__cplusplus
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:21:59 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64A14DD4D2E;
         Tue,  8 Aug 2017 11:21:59 +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 mx1.freebsd.org (Postfix) with ESMTPS id 312F480F9F;
         Tue,  8 Aug 2017 11:21:59 +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 v78BLwX7046497;
         Tue, 8 Aug 2017 11:21:58 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BLwII046496;
         Tue, 8 Aug 2017 11:21:58 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081121.v78BLwII046496@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 11:21:58 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322241 -
         head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys
        X-SVN-Group: head
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys
        X-SVN-Commit-Revision: 322241
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:21:59 -0000
        
        Author: avg
        Date: Tue Aug  8 11:21:58 2017
        New Revision: 322241
        URL: https://svnweb.freebsd.org/changeset/base/322241
        
        Log:
          MFV r322240: 8491 uberblock on-disk padding to reserve space for smoothly merging zpool checkpoint & MMP in ZFS
          
          illumos/illumos-gate@79c2b812ee2010ebf20fdd92dc5f06b59000a94c
          https://github.com/illumos/illumos-gate/commit/79c2b812ee2010ebf20fdd92dc5f06b59000a94c
          
          https://www.illumos.org/issues/8491
            The zpool checkpoint feature in DxOS added a new field in the uberblock.
            The Multi-Modifier Protection Pull Request from ZoL adds two new fields in the
            uberblock (Reference: https://github.com/zfsonlinux/zfs/pull/6279).
            As these two changes come from two different sources and once upstreamed and
            deployed will introduce an incompatibility with each other we want
            to upstream a change that will reserve the padding for both of them so
            integration goes smoothly and everyone gets both features.
          
          Reviewed by: Matthew Ahrens 
          Reviewed by: Brian Behlendorf 
          Reviewed by: Olaf Faaland 
          Approved by: Gordon Ross 
          Author: Serapheim Dimitropoulos 
          
          MFC after:	3 weeks
        
        Modified:
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h
        Directory Properties:
          head/sys/cddl/contrib/opensolaris/   (props changed)
        
        Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h
        ==============================================================================
        --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h	Tue Aug  8 11:19:56 2017	(r322240)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h	Tue Aug  8 11:21:58 2017	(r322241)
        @@ -20,6 +20,7 @@
          */
         /*
          * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2017 by Delphix. All rights reserved.
          */
         
         #ifndef _SYS_UBERBLOCK_IMPL_H
        @@ -54,6 +55,12 @@ struct uberblock {
         
         	/* highest SPA_VERSION supported by software that wrote this txg */
         	uint64_t	ub_software_version;
        +
        +	/* These fields are reserved for features that are under development: */
        +	uint64_t	ub_mmp_magic;
        +	uint64_t	ub_mmp_delay;
        +	uint64_t	ub_mmp_seq;
        +	uint64_t	ub_checkpoint_txg;
         };
         
         #ifdef	__cplusplus
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:24:15 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23FF4DD5041;
         Tue,  8 Aug 2017 11:24:15 +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 mx1.freebsd.org (Postfix) with ESMTPS id E18A4811DE;
         Tue,  8 Aug 2017 11:24:14 +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 v78BOEhV047367;
         Tue, 8 Aug 2017 11:24:14 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BOEwB047366;
         Tue, 8 Aug 2017 11:24:14 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081124.v78BOEwB047366@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 11:24:14 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322242 - vendor-sys/illumos/dist/uts/common/fs/zfs
        X-SVN-Group: vendor-sys
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs
        X-SVN-Commit-Revision: 322242
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:24:15 -0000
        
        Author: avg
        Date: Tue Aug  8 11:24:13 2017
        New Revision: 322242
        URL: https://svnweb.freebsd.org/changeset/base/322242
        
        Log:
          8373 TXG_WAIT in ZIL commit path
          
          illumos/illumos-gate@d28671a3b094af696bea87f52272d4c4d89321c7
          https://github.com/illumos/illumos-gate/commit/d28671a3b094af696bea87f52272d4c4d89321c7
          
          https://www.illumos.org/issues/8373
            The code that writes ZIL blocks uses dmu_tx_assign(TXG_WAIT) to assign a
            transaction to a transaction group.
            That seems to be logically incorrect as writing of the ZIL block does not
            introduce any new dirty data.
            Also, when there is a lot of dirty data, the call can introduce significant
            delays into the ZIL commit path,
            thus affecting all synchronous writes. Additionally, ARC throttling may affect
            the ZIL writing.
            We probably need a new mechanism similar to dmu_tx_create_assigned to assign
            ZIL transactions.
            (Ab)using TXG_WAITED does not seem to be sufficient.
          
          Reviewed by: Matthew Ahrens 
          Reviewed by: Prakash Surya 
          Approved by: Dan McDonald 
          Author: Andriy Gapon 
        
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c	Tue Aug  8 11:21:58 2017	(r322241)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zil.c	Tue Aug  8 11:24:13 2017	(r322242)
        @@ -974,7 +974,24 @@ zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb)
         	 * to clean up in the event of allocation failure or I/O failure.
         	 */
         	tx = dmu_tx_create(zilog->zl_os);
        -	VERIFY(dmu_tx_assign(tx, TXG_WAIT) == 0);
        +
        +	/*
        +	 * Since we are not going to create any new dirty data and we can even
        +	 * help with clearing the existing dirty data, we should not be subject
        +	 * to the dirty data based delays.
        +	 * We (ab)use TXG_WAITED to bypass the delay mechanism.
        +	 * One side effect from using TXG_WAITED is that dmu_tx_assign() can
        +	 * fail if the pool is suspended.  Those are dramatic circumstances,
        +	 * so we return NULL to signal that the normal ZIL processing is not
        +	 * possible and txg_wait_synced() should be used to ensure that the data
        +	 * is on disk.
        +	 */
        +	error = dmu_tx_assign(tx, TXG_WAITED);
        +	if (error != 0) {
        +		ASSERT3S(error, ==, EIO);
        +		dmu_tx_abort(tx);
        +		return (NULL);
        +	}
         	dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx);
         	txg = dmu_tx_get_txg(tx);
         
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:24:41 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86AFDDD50B9;
         Tue,  8 Aug 2017 11:24:41 +0000 (UTC)
         (envelope-from bapt@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id 5D4C28130B;
         Tue,  8 Aug 2017 11:24:41 +0000 (UTC)
         (envelope-from bapt@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BOem6047433;
         Tue, 8 Aug 2017 11:24:40 GMT (envelope-from bapt@FreeBSD.org)
        Received: (from bapt@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BOeOI047432;
         Tue, 8 Aug 2017 11:24:40 GMT (envelope-from bapt@FreeBSD.org)
        Message-Id: <201708081124.v78BOeOI047432@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: bapt set sender to
         bapt@FreeBSD.org using -f
        From: Baptiste Daroussin 
        Date: Tue, 8 Aug 2017 11:24: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: r322243 - stable/11/share/misc
        X-SVN-Group: stable-11
        X-SVN-Commit-Author: bapt
        X-SVN-Commit-Paths: stable/11/share/misc
        X-SVN-Commit-Revision: 322243
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:24:41 -0000
        
        Author: bapt
        Date: Tue Aug  8 11:24:40 2017
        New Revision: 322243
        URL: https://svnweb.freebsd.org/changeset/base/322243
        
        Log:
          MFC r321812:
          
          Update pci_vendors to 2017.07.27
        
        Modified:
          stable/11/share/misc/pci_vendors
        Directory Properties:
          stable/11/   (props changed)
        
        Modified: stable/11/share/misc/pci_vendors
        ==============================================================================
        --- stable/11/share/misc/pci_vendors	Tue Aug  8 11:24:13 2017	(r322242)
        +++ stable/11/share/misc/pci_vendors	Tue Aug  8 11:24:40 2017	(r322243)
        @@ -3,8 +3,8 @@
         #
         #	List of PCI ID's
         #
        -#	Version: 2017.07.13
        -#	Date:    2017-07-13 03:15:01
        +#	Version: 2017.07.27
        +#	Date:    2017-07-27 03:15:02
         #
         #	Maintained by Albert Pool, Martin Mares, and other volunteers from
         #	the PCI ID Project at http://pci-ids.ucw.cz/.
        @@ -2436,7 +2436,7 @@
         		144d c0c7  Radeon HD 7550M
         	6842  Thames LE [Radeon HD 7000M Series]
         	6843  Thames [Radeon HD 7670M]
        -	6863  Vega 10 [Radeon Vega Frontier Edition]
        +	6863  Vega 10 XTX [Radeon Vega Frontier Edition]
         	687f  Vega [Radeon RX Vega]
         	6888  Cypress XT [FirePro V8800]
         	6889  Cypress PRO [FirePro V7800]
        @@ -2952,6 +2952,8 @@
         	6987  Polaris12
         	6995  Lexa XT [Radeon PRO WX 2100]
         	699f  Lexa PRO [Radeon RX 550]
        +		148c 2380  Lexa XL [Radeon RX 550]
        +		1da2 e367  Lexa PRO [Radeon RX 550]
         	700f  RS100 AGP Bridge
         	7010  RS200/RS250 AGP Bridge
         	7100  R520 [Radeon X1800 XT]
        @@ -6026,11 +6028,12 @@
         		1077 e4f4  FastLinQ QL45411H 40GbE Adapter
         	1644  FastLinQ QL45000 Series 100GbE Controller
         		1077 e4f8  FastLinQ QL45611H 100GbE Adapter
        +	1654  FastLinQ QL45000 Series 50GbE Controller
        +		1590 0223  Synergy 6810C 25/50Gb Ethernet Adapter
         	1656  FastLinQ QL45000 Series 25GbE Controller
         		1077 02a7  QL45212-DE 25GbE Adapter
         		1077 e4f6  FastLinQ QL45211H 25GbE Adapter
         		1077 e4f7  FastLinQ QL45212H 25GbE Adapter
        -		1590 0223  Synergy 6810C 25/50Gb Ethernet Adapter
         	165c  FastLinQ QL45000 Series 40GbE Controller (FCoE)
         		1077 e4f1  FastLinQ QL45462H 40GbE FCoE Adapter
         		1077 e4f2  FastLinQ QL45461H 40GbE FCoE Adapter
        @@ -16128,6 +16131,8 @@
         	50a0  T540-50A0 Unified Wire Ethernet Controller
         	50a1  T540-50A1 Unified Wire Ethernet Controller
         	50a2  T580-50A2 Unified Wire Ethernet Controller
        +	50a3  T580-50A3 Unified Wire Ethernet Controller
        +	50a4  T540-50A4 Unified Wire Ethernet Controller
         	5401  T520-CR Unified Wire Ethernet Controller
         	5402  T522-CR Unified Wire Ethernet Controller
         	5403  T540-CR Unified Wire Ethernet Controller
        @@ -16181,6 +16186,8 @@
         	54a0  T540-50A0 Unified Wire Ethernet Controller
         	54a1  T540-50A1 Unified Wire Ethernet Controller
         	54a2  T580-50A2 Unified Wire Ethernet Controller
        +	54a3  T580-50A3 Unified Wire Ethernet Controller
        +	54a4  T540-50A4 Unified Wire Ethernet Controller
         	5501  T520-CR Unified Wire Storage Controller
         	5502  T522-CR Unified Wire Storage Controller
         	5503  T540-CR Unified Wire Storage Controller
        @@ -16234,6 +16241,8 @@
         	55a0  T540-50A0 Unified Wire Storage Controller
         	55a1  T540-50A1 Unified Wire Storage Controller
         	55a2  T580-50A2 Unified Wire Storage Controller
        +	55a3  T580-50A3 Unified Wire Storage Controller
        +	55a4  T540-50A4 Unified Wire Storage Controller
         	5601  T520-CR Unified Wire Storage Controller
         	5602  T522-CR Unified Wire Storage Controller
         	5603  T540-CR Unified Wire Storage Controller
        @@ -16287,6 +16296,8 @@
         	56a0  T540-50A0 Unified Wire Storage Controller
         	56a1  T540-50A1 Unified Wire Storage Controller
         	56a2  T580-50A2 Unified Wire Storage Controller
        +	56a3  T580-50A3 Unified Wire Storage Controller
        +	56a4  T540-50A4 Unified Wire Storage Controller
         	5701  T520-CR Unified Wire Ethernet Controller
         	5702  T522-CR Unified Wire Ethernet Controller
         	5703  T540-CR Unified Wire Ethernet Controller
        @@ -16379,6 +16390,8 @@
         	58a0  T540-50A0 Unified Wire Ethernet Controller [VF]
         	58a1  T540-50A1 Unified Wire Ethernet Controller [VF]
         	58a2  T580-50A2 Unified Wire Ethernet Controller [VF]
        +	58a3  T580-50A3 Unified Wire Ethernet Controller [VF]
        +	58a4  T540-50A4 Unified Wire Ethernet Controller [VF]
         	6001  T6225-CR Unified Wire Ethernet Controller
         	6002  T6225-SO-CR Unified Wire Ethernet Controller
         	6003  T6425-CR Unified Wire Ethernet Controller
        @@ -16594,6 +16607,7 @@
         	e836  M115S Hybrid Analog/DVB PAL/SECAM/NTSC Tuner
         	f436  AVerTV Hybrid+FM
         1462  Micro-Star International Co., Ltd. [MSI]
        +	aaf0  Radeon RX 580 Gaming X 8G
         1463  Fast Corporation
         1464  Interactive Circuits & Systems Ltd
         1465  GN NETTEST Telecom DIV.
        @@ -19273,6 +19287,7 @@
         		17d3 1880  ARC-1880 8/12/16/24 Port PCIe 2.0 to SAS/SATA 6Gb RAID Controller
         		17d3 1882  ARC-1882 8/12/16/24 Port PCIe 3.0 to SAS/SATA 6Gb RAID Controller
         		17d3 1883  ARC-1883 8/12/16/24 Port PCIe 3.0 to SAS/SATA 12Gb RAID Controller
        +	1884  ARC-1884 series PCIe 3.0 to SAS/SATA 12/6Gb RAID Controller
         # nee Neterion Inc., previously S2io Inc.
         17d5  Exar Corp.
         	5731  Xframe 10-Gigabit Ethernet PCI-X
        @@ -19348,12 +19363,15 @@
         17e4  Sectra AB
         	0001  KK671 Cardbus encryption board
         	0002  KK672 Cardbus encryption board
        -17e6  Entropic Communications Inc.
        +# nee Entropic Communications Inc.
        +17e6  MaxLinear
         	0010  EN2010 [c.Link] MoCA Network Controller (Coax, PCI interface)
         	0011  EN2010 [c.Link] MoCA Network Controller (Coax, MPEG interface)
         	0021  EN2210 [c.Link] MoCA Network Controller (Coax)
         	0025  EN2510 [c.Link] MoCA Network Controller (Coax, PCIe interface)
         	0027  EN2710 [c.Link] MoCA 2.0 Network Controller (Coax, PCIe interface)
        +	3706  MoCA 2.0 Network Controller (Coax, PCIe interface)
        +	3711  MoCA 2.5 Network Controller (Coax, PCIe interface)
         17ee  Connect Components Ltd
         17f2  Albatron Corp.
         17f3  RDC Semiconductor, Inc.
        @@ -24631,6 +24649,7 @@
         	24f3  Wireless 8260
         # Snow Field Peak AC
         		8086 0010  Dual Band Wireless-AC 8260
        +		8086 1010  Dual Band Wireless-AC 8260
         	24f4  Wireless 8260
         # Snow Field Peak AC
         		8086 0030  Dual Band Wireless-AC 8260
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:25:11 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33548DD5160;
         Tue,  8 Aug 2017 11:25:11 +0000 (UTC)
         (envelope-from bapt@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id 0B01081442;
         Tue,  8 Aug 2017 11:25:10 +0000 (UTC)
         (envelope-from bapt@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BPAQg047497;
         Tue, 8 Aug 2017 11:25:10 GMT (envelope-from bapt@FreeBSD.org)
        Received: (from bapt@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BPALb047496;
         Tue, 8 Aug 2017 11:25:10 GMT (envelope-from bapt@FreeBSD.org)
        Message-Id: <201708081125.v78BPALb047496@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: bapt set sender to
         bapt@FreeBSD.org using -f
        From: Baptiste Daroussin 
        Date: Tue, 8 Aug 2017 11:25:10 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
        Subject: svn commit: r322244 - stable/10/share/misc
        X-SVN-Group: stable-10
        X-SVN-Commit-Author: bapt
        X-SVN-Commit-Paths: stable/10/share/misc
        X-SVN-Commit-Revision: 322244
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:25:11 -0000
        
        Author: bapt
        Date: Tue Aug  8 11:25:09 2017
        New Revision: 322244
        URL: https://svnweb.freebsd.org/changeset/base/322244
        
        Log:
          MFC r321812:
          
          Update pci_vendors to 2017.07.27
        
        Modified:
          stable/10/share/misc/pci_vendors
        Directory Properties:
          stable/10/   (props changed)
        
        Modified: stable/10/share/misc/pci_vendors
        ==============================================================================
        --- stable/10/share/misc/pci_vendors	Tue Aug  8 11:24:40 2017	(r322243)
        +++ stable/10/share/misc/pci_vendors	Tue Aug  8 11:25:09 2017	(r322244)
        @@ -3,8 +3,8 @@
         #
         #	List of PCI ID's
         #
        -#	Version: 2017.07.13
        -#	Date:    2017-07-13 03:15:01
        +#	Version: 2017.07.27
        +#	Date:    2017-07-27 03:15:02
         #
         #	Maintained by Albert Pool, Martin Mares, and other volunteers from
         #	the PCI ID Project at http://pci-ids.ucw.cz/.
        @@ -2436,7 +2436,7 @@
         		144d c0c7  Radeon HD 7550M
         	6842  Thames LE [Radeon HD 7000M Series]
         	6843  Thames [Radeon HD 7670M]
        -	6863  Vega 10 [Radeon Vega Frontier Edition]
        +	6863  Vega 10 XTX [Radeon Vega Frontier Edition]
         	687f  Vega [Radeon RX Vega]
         	6888  Cypress XT [FirePro V8800]
         	6889  Cypress PRO [FirePro V7800]
        @@ -2952,6 +2952,8 @@
         	6987  Polaris12
         	6995  Lexa XT [Radeon PRO WX 2100]
         	699f  Lexa PRO [Radeon RX 550]
        +		148c 2380  Lexa XL [Radeon RX 550]
        +		1da2 e367  Lexa PRO [Radeon RX 550]
         	700f  RS100 AGP Bridge
         	7010  RS200/RS250 AGP Bridge
         	7100  R520 [Radeon X1800 XT]
        @@ -6026,11 +6028,12 @@
         		1077 e4f4  FastLinQ QL45411H 40GbE Adapter
         	1644  FastLinQ QL45000 Series 100GbE Controller
         		1077 e4f8  FastLinQ QL45611H 100GbE Adapter
        +	1654  FastLinQ QL45000 Series 50GbE Controller
        +		1590 0223  Synergy 6810C 25/50Gb Ethernet Adapter
         	1656  FastLinQ QL45000 Series 25GbE Controller
         		1077 02a7  QL45212-DE 25GbE Adapter
         		1077 e4f6  FastLinQ QL45211H 25GbE Adapter
         		1077 e4f7  FastLinQ QL45212H 25GbE Adapter
        -		1590 0223  Synergy 6810C 25/50Gb Ethernet Adapter
         	165c  FastLinQ QL45000 Series 40GbE Controller (FCoE)
         		1077 e4f1  FastLinQ QL45462H 40GbE FCoE Adapter
         		1077 e4f2  FastLinQ QL45461H 40GbE FCoE Adapter
        @@ -16128,6 +16131,8 @@
         	50a0  T540-50A0 Unified Wire Ethernet Controller
         	50a1  T540-50A1 Unified Wire Ethernet Controller
         	50a2  T580-50A2 Unified Wire Ethernet Controller
        +	50a3  T580-50A3 Unified Wire Ethernet Controller
        +	50a4  T540-50A4 Unified Wire Ethernet Controller
         	5401  T520-CR Unified Wire Ethernet Controller
         	5402  T522-CR Unified Wire Ethernet Controller
         	5403  T540-CR Unified Wire Ethernet Controller
        @@ -16181,6 +16186,8 @@
         	54a0  T540-50A0 Unified Wire Ethernet Controller
         	54a1  T540-50A1 Unified Wire Ethernet Controller
         	54a2  T580-50A2 Unified Wire Ethernet Controller
        +	54a3  T580-50A3 Unified Wire Ethernet Controller
        +	54a4  T540-50A4 Unified Wire Ethernet Controller
         	5501  T520-CR Unified Wire Storage Controller
         	5502  T522-CR Unified Wire Storage Controller
         	5503  T540-CR Unified Wire Storage Controller
        @@ -16234,6 +16241,8 @@
         	55a0  T540-50A0 Unified Wire Storage Controller
         	55a1  T540-50A1 Unified Wire Storage Controller
         	55a2  T580-50A2 Unified Wire Storage Controller
        +	55a3  T580-50A3 Unified Wire Storage Controller
        +	55a4  T540-50A4 Unified Wire Storage Controller
         	5601  T520-CR Unified Wire Storage Controller
         	5602  T522-CR Unified Wire Storage Controller
         	5603  T540-CR Unified Wire Storage Controller
        @@ -16287,6 +16296,8 @@
         	56a0  T540-50A0 Unified Wire Storage Controller
         	56a1  T540-50A1 Unified Wire Storage Controller
         	56a2  T580-50A2 Unified Wire Storage Controller
        +	56a3  T580-50A3 Unified Wire Storage Controller
        +	56a4  T540-50A4 Unified Wire Storage Controller
         	5701  T520-CR Unified Wire Ethernet Controller
         	5702  T522-CR Unified Wire Ethernet Controller
         	5703  T540-CR Unified Wire Ethernet Controller
        @@ -16379,6 +16390,8 @@
         	58a0  T540-50A0 Unified Wire Ethernet Controller [VF]
         	58a1  T540-50A1 Unified Wire Ethernet Controller [VF]
         	58a2  T580-50A2 Unified Wire Ethernet Controller [VF]
        +	58a3  T580-50A3 Unified Wire Ethernet Controller [VF]
        +	58a4  T540-50A4 Unified Wire Ethernet Controller [VF]
         	6001  T6225-CR Unified Wire Ethernet Controller
         	6002  T6225-SO-CR Unified Wire Ethernet Controller
         	6003  T6425-CR Unified Wire Ethernet Controller
        @@ -16594,6 +16607,7 @@
         	e836  M115S Hybrid Analog/DVB PAL/SECAM/NTSC Tuner
         	f436  AVerTV Hybrid+FM
         1462  Micro-Star International Co., Ltd. [MSI]
        +	aaf0  Radeon RX 580 Gaming X 8G
         1463  Fast Corporation
         1464  Interactive Circuits & Systems Ltd
         1465  GN NETTEST Telecom DIV.
        @@ -19273,6 +19287,7 @@
         		17d3 1880  ARC-1880 8/12/16/24 Port PCIe 2.0 to SAS/SATA 6Gb RAID Controller
         		17d3 1882  ARC-1882 8/12/16/24 Port PCIe 3.0 to SAS/SATA 6Gb RAID Controller
         		17d3 1883  ARC-1883 8/12/16/24 Port PCIe 3.0 to SAS/SATA 12Gb RAID Controller
        +	1884  ARC-1884 series PCIe 3.0 to SAS/SATA 12/6Gb RAID Controller
         # nee Neterion Inc., previously S2io Inc.
         17d5  Exar Corp.
         	5731  Xframe 10-Gigabit Ethernet PCI-X
        @@ -19348,12 +19363,15 @@
         17e4  Sectra AB
         	0001  KK671 Cardbus encryption board
         	0002  KK672 Cardbus encryption board
        -17e6  Entropic Communications Inc.
        +# nee Entropic Communications Inc.
        +17e6  MaxLinear
         	0010  EN2010 [c.Link] MoCA Network Controller (Coax, PCI interface)
         	0011  EN2010 [c.Link] MoCA Network Controller (Coax, MPEG interface)
         	0021  EN2210 [c.Link] MoCA Network Controller (Coax)
         	0025  EN2510 [c.Link] MoCA Network Controller (Coax, PCIe interface)
         	0027  EN2710 [c.Link] MoCA 2.0 Network Controller (Coax, PCIe interface)
        +	3706  MoCA 2.0 Network Controller (Coax, PCIe interface)
        +	3711  MoCA 2.5 Network Controller (Coax, PCIe interface)
         17ee  Connect Components Ltd
         17f2  Albatron Corp.
         17f3  RDC Semiconductor, Inc.
        @@ -24631,6 +24649,7 @@
         	24f3  Wireless 8260
         # Snow Field Peak AC
         		8086 0010  Dual Band Wireless-AC 8260
        +		8086 1010  Dual Band Wireless-AC 8260
         	24f4  Wireless 8260
         # Snow Field Peak AC
         		8086 0030  Dual Band Wireless-AC 8260
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:26:04 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id B652EDD5298;
         Tue,  8 Aug 2017 11:26:04 +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 mx1.freebsd.org (Postfix) with ESMTPS id 82E22815A2;
         Tue,  8 Aug 2017 11:26:04 +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 v78BQ3re047572;
         Tue, 8 Aug 2017 11:26:03 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BQ3Lr047571;
         Tue, 8 Aug 2017 11:26:03 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081126.v78BQ3Lr047571@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 11:26:03 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322245 -
         head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Group: head
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
        X-SVN-Commit-Revision: 322245
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:26:04 -0000
        
        Author: avg
        Date: Tue Aug  8 11:26:03 2017
        New Revision: 322245
        URL: https://svnweb.freebsd.org/changeset/base/322245
        
        Log:
          MFV r322242: 8373 TXG_WAIT in ZIL commit path
          
          illumos/illumos-gate@d28671a3b094af696bea87f52272d4c4d89321c7
          https://github.com/illumos/illumos-gate/commit/d28671a3b094af696bea87f52272d4c4d89321c7
          
          https://www.illumos.org/issues/8373
            The code that writes ZIL blocks uses dmu_tx_assign(TXG_WAIT) to assign
            a transaction to a transaction group.  That seems to be logically
            incorrect as writing of the ZIL block does not introduce any new dirty
            data.  Also, when there is a lot of dirty data, the call can introduce
            significant delays into the ZIL commit path, thus affecting all
            synchronous writes. Additionally, ARC throttling may affect the ZIL
            writing.
          
          Reviewed by: Matthew Ahrens 
          Reviewed by: Prakash Surya 
          Approved by: Dan McDonald 
          Author: Andriy Gapon 
          
          MFC after:	2 weeks
        
        Modified:
          head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
        Directory Properties:
          head/sys/cddl/contrib/opensolaris/   (props changed)
        
        Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
        ==============================================================================
        --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c	Tue Aug  8 11:25:09 2017	(r322244)
        +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c	Tue Aug  8 11:26:03 2017	(r322245)
        @@ -985,7 +985,24 @@ zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb, boolea
         	 * to clean up in the event of allocation failure or I/O failure.
         	 */
         	tx = dmu_tx_create(zilog->zl_os);
        -	VERIFY(dmu_tx_assign(tx, TXG_WAIT) == 0);
        +
        +	/*
        +	 * Since we are not going to create any new dirty data and we can even
        +	 * help with clearing the existing dirty data, we should not be subject
        +	 * to the dirty data based delays.
        +	 * We (ab)use TXG_WAITED to bypass the delay mechanism.
        +	 * One side effect from using TXG_WAITED is that dmu_tx_assign() can
        +	 * fail if the pool is suspended.  Those are dramatic circumstances,
        +	 * so we return NULL to signal that the normal ZIL processing is not
        +	 * possible and txg_wait_synced() should be used to ensure that the data
        +	 * is on disk.
        +	 */
        +	error = dmu_tx_assign(tx, TXG_WAITED);
        +	if (error != 0) {
        +		ASSERT3S(error, ==, EIO);
        +		dmu_tx_abort(tx);
        +		return (NULL);
        +	}
         	dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx);
         	txg = dmu_tx_get_txg(tx);
         
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:27:20 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7565ADD5428;
         Tue,  8 Aug 2017 11:27:20 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4379F81775;
         Tue,  8 Aug 2017 11:27:20 +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 v78BRJSr047659;
         Tue, 8 Aug 2017 11:27:19 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BRJtu047658;
         Tue, 8 Aug 2017 11:27:19 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081127.v78BRJtu047658@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 11:27:19 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322246 - vendor-sys/illumos/dist/uts/common/fs/zfs
        X-SVN-Group: vendor-sys
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: vendor-sys/illumos/dist/uts/common/fs/zfs
        X-SVN-Commit-Revision: 322246
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:27:20 -0000
        
        Author: avg
        Date: Tue Aug  8 11:27:19 2017
        New Revision: 322246
        URL: https://svnweb.freebsd.org/changeset/base/322246
        
        Log:
          8508 Mounting a zpool on 32-bit platforms panics
          
          illumos/illumos-gate@b11fe8c01471a5bff68e83e1fe5f809ad16b3be8
          https://github.com/illumos/illumos-gate/commit/b11fe8c01471a5bff68e83e1fe5f809ad16b3be8
          
          https://www.illumos.org/issues/8508
            Mounting a zpool on a 32-bit system triggers a panic in spa_history_log_version
            () due to a type format mismatch for ZPL_VERSION. ZPL_VERSION is a unsigned
            long long, but the format expects an integer. On 64-bit platforms this may not
            be an issue due to word size and alignment. On 32-bit platforms a word size is
            half that of a long long, causing the second word of the long long to be seen
            as the string pointer for utsname.nodename.
          
          Reviewed by: Matt Ahrens 
          Approved by: Dan McDonald 
          Author: Justin Hibbits 
        
        Modified:
          vendor-sys/illumos/dist/uts/common/fs/zfs/spa_history.c
        
        Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa_history.c
        ==============================================================================
        --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa_history.c	Tue Aug  8 11:26:03 2017	(r322245)
        +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa_history.c	Tue Aug  8 11:27:19 2017	(r322246)
        @@ -614,7 +614,7 @@ void
         spa_history_log_version(spa_t *spa, const char *operation)
         {
         	spa_history_log_internal(spa, operation, NULL,
        -	    "pool version %llu; software version %llu/%d; uts %s %s %s %s",
        +	    "pool version %llu; software version %llu/%llu; uts %s %s %s %s",
         	    (u_longlong_t)spa_version(spa), SPA_VERSION, ZPL_VERSION,
         	    utsname.nodename, utsname.release, utsname.version,
         	    utsname.machine);
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:28:40 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27882DD554A;
         Tue,  8 Aug 2017 11: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 mx1.freebsd.org (Postfix) with ESMTPS id E8E24818CB;
         Tue,  8 Aug 2017 11:28: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 v78BScvX047756;
         Tue, 8 Aug 2017 11:28:38 GMT (envelope-from avg@FreeBSD.org)
        Received: (from avg@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BScI1047755;
         Tue, 8 Aug 2017 11:28:38 GMT (envelope-from avg@FreeBSD.org)
        Message-Id: <201708081128.v78BScI1047755@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org
         using -f
        From: Andriy Gapon 
        Date: Tue, 8 Aug 2017 11:28:38 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322247 - head/sys/cddl/contrib/opensolaris
        X-SVN-Group: head
        X-SVN-Commit-Author: avg
        X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris
        X-SVN-Commit-Revision: 322247
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:28:40 -0000
        
        Author: avg
        Date: Tue Aug  8 11:28:38 2017
        New Revision: 322247
        URL: https://svnweb.freebsd.org/changeset/base/322247
        
        Log:
          MFV r322246: 8508 Mounting a zpool on 32-bit platforms panics
          
          FreeBSD note: this is a record-only commit, the actual change originated
          from FreeBSD.
          
          illumos/illumos-gate@b11fe8c01471a5bff68e83e1fe5f809ad16b3be8
          https://github.com/illumos/illumos-gate/commit/b11fe8c01471a5bff68e83e1fe5f809ad16b3be8
          
          https://www.illumos.org/issues/8508
            Mounting a zpool on a 32-bit system triggers a panic in spa_history_log_version
            () due to a type format mismatch for ZPL_VERSION. ZPL_VERSION is a unsigned
            long long, but the format expects an integer. On 64-bit platforms this may not
            be an issue due to word size and alignment. On 32-bit platforms a word size is
            half that of a long long, causing the second word of the long long to be seen
            as the string pointer for utsname.nodename.
          
          Reviewed by: Matt Ahrens 
          Approved by: Dan McDonald 
          Author: Justin Hibbits 
        
        Modified:
        Directory Properties:
          head/sys/cddl/contrib/opensolaris/   (props changed)
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:35:04 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CC1BDD5C74;
         Tue,  8 Aug 2017 11:35:04 +0000 (UTC)
         (envelope-from hselasky@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id 1999F81F49;
         Tue,  8 Aug 2017 11:35:04 +0000 (UTC)
         (envelope-from hselasky@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BZ3rM051676;
         Tue, 8 Aug 2017 11:35:03 GMT (envelope-from hselasky@FreeBSD.org)
        Received: (from hselasky@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BZ2tO051670;
         Tue, 8 Aug 2017 11:35:02 GMT (envelope-from hselasky@FreeBSD.org)
        Message-Id: <201708081135.v78BZ2tO051670@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: hselasky set sender to
         hselasky@FreeBSD.org using -f
        From: Hans Petter Selasky 
        Date: Tue, 8 Aug 2017 11:35:02 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322248 - in head/sys/dev/mlx4: . mlx4_en
        X-SVN-Group: head
        X-SVN-Commit-Author: hselasky
        X-SVN-Commit-Paths: in head/sys/dev/mlx4: . mlx4_en
        X-SVN-Commit-Revision: 322248
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:35:04 -0000
        
        Author: hselasky
        Date: Tue Aug  8 11:35:02 2017
        New Revision: 322248
        URL: https://svnweb.freebsd.org/changeset/base/322248
        
        Log:
          Fix for mlx4en(4) to properly call m_defrag().
          
          The m_defrag() function can only defrag mbuf chains which have a valid
          mbuf packet header. In r291699 when the mlx4en(4) driver was converted
          into using BUSDMA(9), the call to m_defrag() was moved after the part
          of the transmit routine which strips the header from the mbuf chain.
          This effectivly disabled the mbuf defrag mechanism and such packets
          simply got dropped.
          
          This patch removes the stripping of mbufs from a chain and loads all
          mbufs using busdma. If busdma finds there are no segments, unload
          the DMA map and free the mbuf right away, because that means all
          data in the mbuf has been inlined in the TX ring. Else proceed
          as usual.
          
          Add a per-ring rounter for the number of defrag attempts and
          make sure the oversized_packets counter gets zeroed while at it.
          
          The counters are per-ring to avoid excessive cache misses in the
          TX path.
          
          Submitted by:		mjoras@
          Differential Revision:	https://reviews.freebsd.org/D11683
          MFC after:		1 week
          Sponsored by:		Mellanox Technologies
        
        Modified:
          head/sys/dev/mlx4/mlx4_en/en.h
          head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
          head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c
          head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c
          head/sys/dev/mlx4/stats.h
        
        Modified: head/sys/dev/mlx4/mlx4_en/en.h
        ==============================================================================
        --- head/sys/dev/mlx4/mlx4_en/en.h	Tue Aug  8 11:28:38 2017	(r322247)
        +++ head/sys/dev/mlx4/mlx4_en/en.h	Tue Aug  8 11:35:02 2017	(r322248)
        @@ -278,6 +278,8 @@ struct mlx4_en_tx_ring {
         	unsigned long queue_stopped;
         	unsigned long oversized_packets;
         	unsigned long wake_queue;
        +	unsigned long tso_packets;
        +	unsigned long defrag_attempts;
         	struct mlx4_bf bf;
         	bool bf_enabled;
         	int hwtstamp_tx_type;
        
        Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
        ==============================================================================
        --- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c	Tue Aug  8 11:28:38 2017	(r322247)
        +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c	Tue Aug  8 11:35:02 2017	(r322248)
        @@ -2681,6 +2681,8 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p
         	SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "tx_chksum_offload",
         	    CTLFLAG_RD, &priv->port_stats.tx_chksum_offload,
         	    "TX checksum offloads");
        +	SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "defrag_attempts", CTLFLAG_RD,
        +	    &priv->port_stats.defrag_attempts, "Oversized chains defragged");
         
         	/* Could strdup the names and add in a loop.  This is simpler. */
         	SYSCTL_ADD_ULONG(ctx, node_list, OID_AUTO, "rx_bytes", CTLFLAG_RD,
        @@ -2774,6 +2776,10 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p
         		    CTLFLAG_RD, &tx_ring->packets, "TX packets");
         		SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "bytes",
         		    CTLFLAG_RD, &tx_ring->bytes, "TX bytes");
        +		SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "tso_packets",
        +		    CTLFLAG_RD, &tx_ring->tso_packets, "TSO packets");
        +		SYSCTL_ADD_ULONG(ctx, ring_list, OID_AUTO, "defrag_attempts",
        +		    CTLFLAG_RD, &tx_ring->defrag_attempts, "Oversized chains defragged");
         	}
         
         	for (i = 0; i < priv->rx_ring_num; i++) {
        
        Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c
        ==============================================================================
        --- head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c	Tue Aug  8 11:28:38 2017	(r322247)
        +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c	Tue Aug  8 11:35:02 2017	(r322248)
        @@ -191,11 +191,16 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u
         	priv->port_stats.tx_chksum_offload = 0;
         	priv->port_stats.queue_stopped = 0;
         	priv->port_stats.wake_queue = 0;
        +	priv->port_stats.oversized_packets = 0;
        +	priv->port_stats.tso_packets = 0;
        +	priv->port_stats.defrag_attempts = 0;
         	for (i = 0; i < priv->tx_ring_num; i++) {
         		priv->port_stats.tx_chksum_offload += priv->tx_ring[i]->tx_csum;
         		priv->port_stats.queue_stopped += priv->tx_ring[i]->queue_stopped;
         		priv->port_stats.wake_queue += priv->tx_ring[i]->wake_queue;
         		priv->port_stats.oversized_packets += priv->tx_ring[i]->oversized_packets;
        +		priv->port_stats.tso_packets += priv->tx_ring[i]->tso_packets;
        +		priv->port_stats.defrag_attempts += priv->tx_ring[i]->defrag_attempts;
         	}
         	/* RX Statistics */
         	priv->pkstats.rx_packets = be64_to_cpu(mlx4_en_stats->RTOT_prio_0) +
        
        Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c
        ==============================================================================
        --- head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c	Tue Aug  8 11:28:38 2017	(r322247)
        +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c	Tue Aug  8 11:35:02 2017	(r322248)
        @@ -793,7 +793,7 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int
         			num_pkts = DIV_ROUND_UP(payload_len, mss);
         		ring->bytes += payload_len + (num_pkts * ihs);
         		ring->packets += num_pkts;
        -		priv->port_stats.tso_packets++;
        +		ring->tso_packets++;
         		/* store pointer to inline header */
         		dseg_inline = dseg;
         		/* copy data inline */
        @@ -814,20 +814,11 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int
         	}
         	m_adj(mb, ihs);
         
        -	/* trim off empty mbufs */
        -	while (mb->m_len == 0) {
        -		mb = m_free(mb);
        -		/* check if all data has been inlined */
        -		if (mb == NULL) {
        -			nr_segs = 0;
        -			goto skip_dma;
        -		}
        -	}
        -
         	err = bus_dmamap_load_mbuf_sg(ring->dma_tag, tx_info->dma_map,
         	    mb, segs, &nr_segs, BUS_DMA_NOWAIT);
         	if (unlikely(err == EFBIG)) {
         		/* Too many mbuf fragments */
        +		ring->defrag_attempts++;
         		m = m_defrag(mb, M_NOWAIT);
         		if (m == NULL) {
         			ring->oversized_packets++;
        @@ -843,11 +834,18 @@ static int mlx4_en_xmit(struct mlx4_en_priv *priv, int
         		ring->oversized_packets++;
         		goto tx_drop;
         	}
        -	/* make sure all mbuf data is written to RAM */
        -	bus_dmamap_sync(ring->dma_tag, tx_info->dma_map,
        -	    BUS_DMASYNC_PREWRITE);
        +	/* If there were no errors and we didn't load anything, don't sync. */
        +	if (nr_segs != 0) {
        +		/* make sure all mbuf data is written to RAM */
        +		bus_dmamap_sync(ring->dma_tag, tx_info->dma_map,
        +		    BUS_DMASYNC_PREWRITE);
        +	} else {
        +		/* All data was inlined, free the mbuf. */
        +		bus_dmamap_unload(ring->dma_tag, tx_info->dma_map);
        +		m_freem(mb);
        +		mb = NULL;
        +	}
         
        -skip_dma:
         	/* compute number of DS needed */
         	ds_cnt = (dseg - ((volatile struct mlx4_wqe_data_seg *)tx_desc)) + nr_segs;
         
        
        Modified: head/sys/dev/mlx4/stats.h
        ==============================================================================
        --- head/sys/dev/mlx4/stats.h	Tue Aug  8 11:28:38 2017	(r322247)
        +++ head/sys/dev/mlx4/stats.h	Tue Aug  8 11:35:02 2017	(r322248)
        @@ -126,6 +126,7 @@ struct mlx4_en_port_stats {
         	unsigned long rx_chksum_good;
         	unsigned long rx_chksum_none;
         	unsigned long tx_chksum_offload;
        +	unsigned long defrag_attempts;
         };
         
         struct mlx4_en_perf_stats {
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:35:32 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96915DD5D39;
         Tue,  8 Aug 2017 11:35:32 +0000 (UTC)
         (envelope-from bapt@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id 0FF3F8205B;
         Tue,  8 Aug 2017 11:35:29 +0000 (UTC)
         (envelope-from bapt@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BZSFn051738;
         Tue, 8 Aug 2017 11:35:28 GMT (envelope-from bapt@FreeBSD.org)
        Received: (from bapt@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BZRe3051731;
         Tue, 8 Aug 2017 11:35:27 GMT (envelope-from bapt@FreeBSD.org)
        Message-Id: <201708081135.v78BZRe3051731@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: bapt set sender to
         bapt@FreeBSD.org using -f
        From: Baptiste Daroussin 
        Date: Tue, 8 Aug 2017 11:35:27 +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: r322249 - in stable/11: contrib/mdocml usr.bin/mandoc
        X-SVN-Group: stable-11
        X-SVN-Commit-Author: bapt
        X-SVN-Commit-Paths: in stable/11: contrib/mdocml usr.bin/mandoc
        X-SVN-Commit-Revision: 322249
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:35:32 -0000
        
        Author: bapt
        Date: Tue Aug  8 11:35:27 2017
        New Revision: 322249
        URL: https://svnweb.freebsd.org/changeset/base/322249
        
        Log:
          MFC r313958, r319717, r321810
          
          r313958:
          Import mandoc 1.4.1rc2
          
          r319717:
          Import mandoc snapshot 2017-06-08
          
          It implements missing man(7) macros used in base by kerberos/ntp and makes them
          supported by mandoc.
          
          This import should have been done before the removal of groff.
          
          Reported by:	gordon
          
          r321810:
          Update mandoc to 1.14.2
        
        Added:
          stable/11/contrib/mdocml/catman.8
             - copied, changed from r313958, head/contrib/mdocml/catman.8
          stable/11/contrib/mdocml/catman.c
             - copied unchanged from r313958, head/contrib/mdocml/catman.c
          stable/11/contrib/mdocml/compat_recallocarray.c
             - copied unchanged from r321810, head/contrib/mdocml/compat_recallocarray.c
          stable/11/contrib/mdocml/man.options.1
             - copied, changed from r313958, head/contrib/mdocml/man.options.1
          stable/11/contrib/mdocml/mandoc_xr.c
             - copied unchanged from r321810, head/contrib/mdocml/mandoc_xr.c
          stable/11/contrib/mdocml/mandoc_xr.h
             - copied unchanged from r321810, head/contrib/mdocml/mandoc_xr.h
          stable/11/contrib/mdocml/mandocd.8
             - copied, changed from r313958, head/contrib/mdocml/mandocd.8
          stable/11/contrib/mdocml/mandocd.c
             - copied, changed from r313958, head/contrib/mdocml/mandocd.c
          stable/11/contrib/mdocml/mdoc_markdown.c
             - copied, changed from r319717, head/contrib/mdocml/mdoc_markdown.c
          stable/11/contrib/mdocml/roff_html.c
             - copied, changed from r319717, head/contrib/mdocml/roff_html.c
          stable/11/contrib/mdocml/roff_term.c
             - copied, changed from r319717, head/contrib/mdocml/roff_term.c
          stable/11/contrib/mdocml/roff_validate.c
             - copied, changed from r319717, head/contrib/mdocml/roff_validate.c
          stable/11/contrib/mdocml/term_tab.c
             - copied, changed from r319717, head/contrib/mdocml/term_tab.c
          stable/11/contrib/mdocml/test-O_DIRECTORY.c
             - copied unchanged from r313958, head/contrib/mdocml/test-O_DIRECTORY.c
          stable/11/contrib/mdocml/test-cmsg.c
             - copied unchanged from r313958, head/contrib/mdocml/test-cmsg.c
          stable/11/contrib/mdocml/test-recallocarray.c
             - copied unchanged from r321810, head/contrib/mdocml/test-recallocarray.c
          stable/11/contrib/mdocml/test-recvmsg.c
             - copied unchanged from r313958, head/contrib/mdocml/test-recvmsg.c
        Deleted:
          stable/11/contrib/mdocml/man_hash.c
          stable/11/contrib/mdocml/manpage.c
          stable/11/contrib/mdocml/mdoc_hash.c
        Modified:
          stable/11/contrib/mdocml/INSTALL
          stable/11/contrib/mdocml/LICENSE
          stable/11/contrib/mdocml/Makefile
          stable/11/contrib/mdocml/Makefile.depend
          stable/11/contrib/mdocml/NEWS
          stable/11/contrib/mdocml/TODO
          stable/11/contrib/mdocml/apropos.1
          stable/11/contrib/mdocml/att.c
          stable/11/contrib/mdocml/cgi.c
          stable/11/contrib/mdocml/cgi.h.example
          stable/11/contrib/mdocml/chars.c
          stable/11/contrib/mdocml/compat_fts.c
          stable/11/contrib/mdocml/config.h
          stable/11/contrib/mdocml/configure
          stable/11/contrib/mdocml/configure.local.example
          stable/11/contrib/mdocml/dba.c
          stable/11/contrib/mdocml/dbm_map.c
          stable/11/contrib/mdocml/demandoc.c
          stable/11/contrib/mdocml/eqn.7
          stable/11/contrib/mdocml/eqn.c
          stable/11/contrib/mdocml/eqn_html.c
          stable/11/contrib/mdocml/eqn_term.c
          stable/11/contrib/mdocml/gmdiff
          stable/11/contrib/mdocml/html.c
          stable/11/contrib/mdocml/html.h
          stable/11/contrib/mdocml/lib.c
          stable/11/contrib/mdocml/libman.h
          stable/11/contrib/mdocml/libmandoc.h
          stable/11/contrib/mdocml/libmdoc.h
          stable/11/contrib/mdocml/libroff.h
          stable/11/contrib/mdocml/main.c
          stable/11/contrib/mdocml/main.h
          stable/11/contrib/mdocml/makewhatis.8
          stable/11/contrib/mdocml/man.1
          stable/11/contrib/mdocml/man.7
          stable/11/contrib/mdocml/man.c
          stable/11/contrib/mdocml/man.cgi.3
          stable/11/contrib/mdocml/man.cgi.8
          stable/11/contrib/mdocml/man.h
          stable/11/contrib/mdocml/man_html.c
          stable/11/contrib/mdocml/man_macro.c
          stable/11/contrib/mdocml/man_term.c
          stable/11/contrib/mdocml/man_validate.c
          stable/11/contrib/mdocml/manconf.h
          stable/11/contrib/mdocml/mandoc.1
          stable/11/contrib/mdocml/mandoc.3
          stable/11/contrib/mdocml/mandoc.c
          stable/11/contrib/mdocml/mandoc.css
          stable/11/contrib/mdocml/mandoc.h
          stable/11/contrib/mdocml/mandoc_aux.c
          stable/11/contrib/mdocml/mandoc_aux.h
          stable/11/contrib/mdocml/mandoc_char.7
          stable/11/contrib/mdocml/mandoc_escape.3
          stable/11/contrib/mdocml/mandoc_headers.3
          stable/11/contrib/mdocml/mandoc_html.3
          stable/11/contrib/mdocml/mandocdb.c
          stable/11/contrib/mdocml/manpath.c
          stable/11/contrib/mdocml/mansearch.3
          stable/11/contrib/mdocml/mansearch.c
          stable/11/contrib/mdocml/mansearch.h
          stable/11/contrib/mdocml/mdoc.7
          stable/11/contrib/mdocml/mdoc.c
          stable/11/contrib/mdocml/mdoc.h
          stable/11/contrib/mdocml/mdoc_argv.c
          stable/11/contrib/mdocml/mdoc_html.c
          stable/11/contrib/mdocml/mdoc_macro.c
          stable/11/contrib/mdocml/mdoc_man.c
          stable/11/contrib/mdocml/mdoc_state.c
          stable/11/contrib/mdocml/mdoc_term.c
          stable/11/contrib/mdocml/mdoc_validate.c
          stable/11/contrib/mdocml/msec.in
          stable/11/contrib/mdocml/out.c
          stable/11/contrib/mdocml/out.h
          stable/11/contrib/mdocml/preconv.c
          stable/11/contrib/mdocml/read.c
          stable/11/contrib/mdocml/roff.7
          stable/11/contrib/mdocml/roff.c
          stable/11/contrib/mdocml/roff.h
          stable/11/contrib/mdocml/roff_int.h
          stable/11/contrib/mdocml/soelim.1
          stable/11/contrib/mdocml/st.c
          stable/11/contrib/mdocml/st.in
          stable/11/contrib/mdocml/tag.c
          stable/11/contrib/mdocml/tbl.7
          stable/11/contrib/mdocml/tbl.c
          stable/11/contrib/mdocml/tbl_data.c
          stable/11/contrib/mdocml/tbl_html.c
          stable/11/contrib/mdocml/tbl_layout.c
          stable/11/contrib/mdocml/tbl_term.c
          stable/11/contrib/mdocml/term.c
          stable/11/contrib/mdocml/term.h
          stable/11/contrib/mdocml/term_ascii.c
          stable/11/contrib/mdocml/term_ps.c
          stable/11/contrib/mdocml/tree.c
          stable/11/usr.bin/mandoc/Makefile
        Directory Properties:
          stable/11/   (props changed)
        
        Modified: stable/11/contrib/mdocml/INSTALL
        ==============================================================================
        --- stable/11/contrib/mdocml/INSTALL	Tue Aug  8 11:35:02 2017	(r322248)
        +++ stable/11/contrib/mdocml/INSTALL	Tue Aug  8 11:35:27 2017	(r322249)
        @@ -1,22 +1,24 @@
        -$Id: INSTALL,v 1.17 2016/07/19 22:40:33 schwarze Exp $
        +$Id: INSTALL,v 1.20 2017/07/28 14:57:56 schwarze Exp $
         
        -About mdocml, the portable mandoc distribution
        -----------------------------------------------
        -The mandoc manpage compiler toolset is a suite of tools compiling
        -mdoc(7), the roff(7) macro language of choice for BSD manual pages,
        -and man(7), the predominant historical language for UNIX manuals.
        +About the portable mandoc distribution
        +--------------------------------------
        +The mandoc manpage compiler toolset (formerly called "mdocml")
        +is a suite of tools compiling mdoc(7), the roff(7) macro language
        +of choice for BSD manual pages, and man(7), the predominant
        +historical language for UNIX manuals.
        +
         It includes a man(1) manual viewer and additional tools.
        -For general information, see .
        +For general information, see .
         
         In case you have questions or want to provide feedback, read
        -.  Consider subscribing to the
        +.  Consider subscribing to the
         discuss@ mailing list mentioned on that page.  If you intend to
         help with the development of mandoc, consider subscribing to the
         tech@ mailing list, too.
         
         Enjoy using the mandoc toolset!
         
        -Ingo Schwarze, Karlsruhe, July 2016
        +Ingo Schwarze, Karlsruhe, July 2017
         
         
         Installation
        @@ -25,21 +27,27 @@ Before manually installing mandoc on your system, plea
         whether the newest version of mandoc is already installed by default
         or available via a binary package or a ports system.  A list of the
         latest bundled and ported versions of mandoc for various operating
        -systems is maintained at .
        +systems is maintained at .
         
         Regarding how packages and ports are maintained for your operating
         system, please consult your operating system documentation.
         To install mandoc manually, the following steps are needed:
         
        -1. If you want to build the CGI program, man.cgi(8), too, run the
        -command "echo BUILD_CGI=1 > configure.local".  Then run "cp
        -cgi.h.examples cgi.h" and edit cgi.h as desired.
        +1. If you want to build the CGI program, man.cgi(8), too,
        +run the command "echo BUILD_CGI=1 >> configure.local".
        +Then run "cp cgi.h.example cgi.h" and edit cgi.h as desired.
         
        -2. Define MANPATH_DEFAULT in configure.local
        +2. If you also want to build the catman(8) utility, run the
        +command "echo BUILD_CATMAN=1 >> configure.local".  Note that it
        +is unlikely to be a drop-in replacement providing the same
        +functionality as your system's "catman", if your operating
        +system contains one.
        +
        +3. Define MANPATH_DEFAULT in configure.local
         if /usr/share/man:/usr/X11R6/man:/usr/local/man is not appropriate
         for your operating system.
         
        -3. Run "./configure".
        +4. Run "./configure".
         This script attempts autoconfiguration of mandoc for your system.
         Read both its standard output and the file "Makefile.local" it
         generates.  If anything looks wrong or different from what you
        @@ -49,27 +57,31 @@ result seems right to you.
         On Solaris 10 and earlier, you may have to run "ksh ./configure"
         because the native /bin/sh lacks some POSIX features.
         
        -4. Run "make".
        +5. Run "make".
         Any POSIX-compatible make, in particular both BSD make and GNU make,
         should work.  If the build fails, look at "configure.local.example"
         and go back to step 2.
         
        -5. Run "make -n install" and check whether everything will be
        +6. Run "make -n install" and check whether everything will be
         installed to the intended places.  Otherwise, put some *DIR or *NM*
        -variables into "configure.local" and go back to step 3.
        +variables into "configure.local" and go back to step 4.
         
        -6. Run "sudo make install".  If you intend to build a binary
        +7. Optionally run the regression suite.
        +Basically, that amounts to "cd regress && ./regress.pl".
        +But you should probably look at "./mandoc -l regress/regress.pl.1"
        +first.
        +
        +8. Run "sudo make install".  If you intend to build a binary
         package using some kind of fake root mechanism, you may need a
         command like "make DESTDIR=... install".  Read the *-install targets
         in the "Makefile" to understand how DESTDIR is used.
         
        -7. Run the command "sudo
        -makewhatis" to build mandoc.db(5) databases in all the directory
        -trees configured in step 6.  Whenever installing new manual pages,
        -re-run makewhatis(8) to update the databases, or apropos(1) will
        -not find the new pages.
        +9. Run the command "sudo makewhatis" to build mandoc.db(5) databases
        +in all the directory trees configured in step 3.  Whenever installing
        +new manual pages, re-run makewhatis(8) to update the databases, or
        +apropos(1) will not find the new pages.
         
        -8. To set up a man.cgi(8) server, read its manual page.
        +10. To set up a man.cgi(8) server, read its manual page.
         
         Note that some man(7) pages may contain low-level roff(7) markup
         that mandoc does not yet understand.  On some BSD systems using
        @@ -87,9 +99,10 @@ The following libraries are required:
         
         2. The fts(3) directory traversion functions.
         If your system does not have them, the bundled compatibility version
        -will be used, so you need not worry in that case.  But be careful: the
        -glibc version of fts(3) is known to be broken on 32bit platforms,
        -see .
        +will be used, so you need not worry in that case.  But be careful: old
        +glibc versions of fts(3) were known to be broken on 32bit platforms,
        +see .
        +That was presumably fixed in glibc-2.23.
         If you run into that problem, set "HAVE_FTS=0" in configure.local.
         
         3. Marc Espie's ohash(3) library.
        
        Modified: stable/11/contrib/mdocml/LICENSE
        ==============================================================================
        --- stable/11/contrib/mdocml/LICENSE	Tue Aug  8 11:35:02 2017	(r322248)
        +++ stable/11/contrib/mdocml/LICENSE	Tue Aug  8 11:35:27 2017	(r322249)
        @@ -1,18 +1,19 @@
        -$Id: LICENSE,v 1.13 2016/10/18 14:15:33 schwarze Exp $
        +$Id: LICENSE,v 1.17 2017/06/23 15:58:14 schwarze Exp $
         
         With the exceptions noted below, all code and documentation
        -contained in the mdocml toolkit is protected by the Copyright
        +contained in the mandoc toolkit is protected by the Copyright
         of the following developers:
         
         Copyright (c) 2008-2012, 2014 Kristaps Dzonsons 
        -Copyright (c) 2010-2016 Ingo Schwarze 
        +Copyright (c) 2010-2017 Ingo Schwarze 
         Copyright (c) 2009, 2010, 2011, 2012 Joerg Sonnenberger 
         Copyright (c) 2013 Franco Fichtner 
         Copyright (c) 2014 Baptiste Daroussin 
         Copyright (c) 2016 Ed Maste 
        +Copyright (c) 2017 Michael Stapelberg 
         Copyright (c) 1999, 2004 Marc Espie 
         Copyright (c) 1998, 2004, 2010 Todd C. Miller 
        -Copyright (c) 2008 Otto Moerbeek 
        +Copyright (c) 2008, 2017 Otto Moerbeek 
         Copyright (c) 2004 Ted Unangst 
         Copyright (c) 1994 Christos Zoulas 
         Copyright (c) 2003, 2007, 2008, 2014 Jason McIntyre 
        @@ -21,7 +22,7 @@ See the individual source files for information about 
         to which file during which years.
         
         
        -The mdocml distribution as a whole is distributed by its developers
        +The mandoc distribution as a whole is distributed by its developers
         under the following license:
         
         Permission to use, copy, modify, and distribute this software for any
        
        Modified: stable/11/contrib/mdocml/Makefile
        ==============================================================================
        --- stable/11/contrib/mdocml/Makefile	Tue Aug  8 11:35:02 2017	(r322248)
        +++ stable/11/contrib/mdocml/Makefile	Tue Aug  8 11:35:27 2017	(r322249)
        @@ -1,7 +1,7 @@
        -# $Id: Makefile,v 1.493 2016/11/19 15:24:51 schwarze Exp $
        +# $Id: Makefile,v 1.516 2017/07/20 16:24:53 schwarze Exp $
         #
         # Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons 
        -# Copyright (c) 2011, 2013-2016 Ingo Schwarze 
        +# Copyright (c) 2011, 2013-2017 Ingo Schwarze 
         #
         # Permission to use, copy, modify, and distribute this software for any
         # purpose with or without fee is hereby granted, provided that the above
        @@ -15,11 +15,12 @@
         # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
         # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
         
        -VERSION = 1.14.0
        +VERSION = 1.14.2
         
         # === LIST OF FILES ====================================================
         
         TESTSRCS	 = test-be32toh.c \
        +		   test-cmsg.c \
         		   test-dirent-namlen.c \
         		   test-EFTYPE.c \
         		   test-err.c \
        @@ -30,11 +31,14 @@ TESTSRCS	 = test-be32toh.c \
         		   test-mkdtemp.c \
         		   test-nanosleep.c \
         		   test-ntohl.c \
        +		   test-O_DIRECTORY.c \
         		   test-ohash.c \
         		   test-PATH_MAX.c \
         		   test-pledge.c \
         		   test-progname.c \
        +		   test-recvmsg.c \
         		   test-reallocarray.c \
        +		   test-recallocarray.c \
         		   test-rewb-bsd.c \
         		   test-rewb-sysv.c \
         		   test-sandbox_init.c \
        @@ -49,6 +53,7 @@ TESTSRCS	 = test-be32toh.c \
         		   test-wchar.c
         
         SRCS		 = att.c \
        +		   catman.c \
         		   cgi.c \
         		   chars.c \
         		   compat_err.c \
        @@ -60,6 +65,7 @@ SRCS		 = att.c \
         		   compat_ohash.c \
         		   compat_progname.c \
         		   compat_reallocarray.c \
        +		   compat_recallocarray.c \
         		   compat_strcasestr.c \
         		   compat_stringlist.c \
         		   compat_strlcat.c \
        @@ -81,7 +87,6 @@ SRCS		 = att.c \
         		   lib.c \
         		   main.c \
         		   man.c \
        -		   man_hash.c \
         		   man_html.c \
         		   man_macro.c \
         		   man_term.c \
        @@ -89,16 +94,17 @@ SRCS		 = att.c \
         		   mandoc.c \
         		   mandoc_aux.c \
         		   mandoc_ohash.c \
        +		   mandoc_xr.c \
        +		   mandocd.c \
         		   mandocdb.c \
        -		   manpage.c \
         		   manpath.c \
         		   mansearch.c \
         		   mdoc.c \
         		   mdoc_argv.c \
        -		   mdoc_hash.c \
         		   mdoc_html.c \
         		   mdoc_macro.c \
         		   mdoc_man.c \
        +		   mdoc_markdown.c \
         		   mdoc_state.c \
         		   mdoc_term.c \
         		   mdoc_validate.c \
        @@ -107,6 +113,9 @@ SRCS		 = att.c \
         		   preconv.c \
         		   read.c \
         		   roff.c \
        +		   roff_html.c \
        +		   roff_term.c \
        +		   roff_validate.c \
         		   soelim.c \
         		   st.c \
         		   tag.c \
        @@ -119,6 +128,7 @@ SRCS		 = att.c \
         		   term.c \
         		   term_ascii.c \
         		   term_ps.c \
        +		   term_tab.c \
         		   tree.c
         
         DISTFILES	 = INSTALL \
        @@ -128,6 +138,7 @@ DISTFILES	 = INSTALL \
         		   NEWS \
         		   TODO \
         		   apropos.1 \
        +		   catman.8 \
         		   cgi.h.example \
         		   compat_fts.h \
         		   compat_ohash.h \
        @@ -156,6 +167,7 @@ DISTFILES	 = INSTALL \
         		   man.cgi.8 \
         		   man.conf.5 \
         		   man.h \
        +		   man.options.1 \
         		   manconf.h \
         		   mandoc.1 \
         		   mandoc.3 \
        @@ -169,6 +181,8 @@ DISTFILES	 = INSTALL \
         		   mandoc_html.3 \
         		   mandoc_malloc.3 \
         		   mandoc_ohash.h \
        +		   mandoc_xr.h \
        +		   mandocd.8 \
         		   mansearch.3 \
         		   mansearch.h \
         		   mchars_alloc.3 \
        @@ -190,7 +204,6 @@ DISTFILES	 = INSTALL \
         		   $(TESTSRCS)
         
         LIBMAN_OBJS	 = man.o \
        -		   man_hash.o \
         		   man_macro.o \
         		   man_validate.o
         
        @@ -198,7 +211,6 @@ LIBMDOC_OBJS	 = att.o \
         		   lib.o \
         		   mdoc.o \
         		   mdoc_argv.o \
        -		   mdoc_hash.o \
         		   mdoc_macro.o \
         		   mdoc_state.o \
         		   mdoc_validate.o \
        @@ -206,6 +218,7 @@ LIBMDOC_OBJS	 = att.o \
         
         LIBROFF_OBJS	 = eqn.o \
         		   roff.o \
        +		   roff_validate.o \
         		   tbl.o \
         		   tbl_data.o \
         		   tbl_layout.o \
        @@ -218,6 +231,7 @@ LIBMANDOC_OBJS	 = $(LIBMAN_OBJS) \
         		   mandoc.o \
         		   mandoc_aux.o \
         		   mandoc_ohash.o \
        +		   mandoc_xr.o \
         		   msec.o \
         		   preconv.o \
         		   read.o
        @@ -231,6 +245,7 @@ COMPAT_OBJS	 = compat_err.o \
         		   compat_ohash.o \
         		   compat_progname.o \
         		   compat_reallocarray.o \
        +		   compat_recallocarray.o \
         		   compat_strcasestr.o \
         		   compat_strlcat.o \
         		   compat_strlcpy.o \
        @@ -242,16 +257,17 @@ MANDOC_HTML_OBJS = eqn_html.o \
         		   html.o \
         		   man_html.o \
         		   mdoc_html.o \
        +		   roff_html.o \
         		   tbl_html.o
         
        -MANDOC_MAN_OBJS  = mdoc_man.o
        -
         MANDOC_TERM_OBJS = eqn_term.o \
         		   man_term.o \
         		   mdoc_term.o \
        +		   roff_term.o \
         		   term.o \
         		   term_ascii.o \
         		   term_ps.o \
        +		   term_tab.o \
         		   tbl_term.o
         
         DBM_OBJS	 = dbm.o \
        @@ -271,6 +287,8 @@ MAIN_OBJS	 = $(MANDOC_HTML_OBJS) \
         		   $(DBA_OBJS) \
         		   main.o \
         		   manpath.o \
        +		   mdoc_man.o \
        +		   mdoc_markdown.o \
         		   out.o \
         		   tag.o \
         		   tree.o
        @@ -280,9 +298,11 @@ CGI_OBJS	 = $(MANDOC_HTML_OBJS) \
         		   cgi.o \
         		   out.o
         
        -MANPAGE_OBJS	 = $(DBM_OBJS) \
        -		   manpage.o \
        -		   manpath.o
        +MANDOCD_OBJS	 = $(MANDOC_HTML_OBJS) \
        +		   $(MANDOC_TERM_OBJS) \
        +		   mandocd.o \
        +		   out.o \
        +		   tag.o
         
         DEMANDOC_OBJS	 = demandoc.o
         
        @@ -298,6 +318,7 @@ WWW_MANS	 = apropos.1.html \
         		   man.1.html \
         		   mandoc.1.html \
         		   soelim.1.html \
        +		   man.cgi.3.html \
         		   mandoc.3.html \
         		   mandoc_escape.3.html \
         		   mandoc_headers.3.html \
        @@ -311,11 +332,12 @@ WWW_MANS	 = apropos.1.html \
         		   eqn.7.html \
         		   man.7.html \
         		   mandoc_char.7.html \
        +		   mandocd.8.html \
         		   mdoc.7.html \
         		   roff.7.html \
         		   tbl.7.html \
        +		   catman.8.html \
         		   makewhatis.8.html \
        -		   man.cgi.3.html \
         		   man.cgi.8.html \
         		   man.h.html \
         		   manconf.h.html \
        @@ -325,24 +347,17 @@ WWW_MANS	 = apropos.1.html \
         		   mdoc.h.html \
         		   roff.h.html
         
        -WWW_OBJS	 = mdocml.tar.gz \
        -		   mdocml.sha256
        -
         # === USER CONFIGURATION ===============================================
         
         include Makefile.local
         
         # === DEPENDENCY HANDLING ==============================================
         
        -all: base-build $(BUILD_TARGETS) Makefile.local
        +all: mandoc demandoc soelim $(BUILD_TARGETS) Makefile.local
         
        -base-build: mandoc demandoc soelim
        -
        -cgi-build: man.cgi
        -
         install: base-install $(INSTALL_TARGETS)
         
        -www: $(WWW_OBJS) $(WWW_MANS)
        +www: $(WWW_MANS)
         
         $(WWW_MANS): mandoc
         
        @@ -360,13 +375,13 @@ clean:
         	rm -f libmandoc.a $(LIBMANDOC_OBJS) $(COMPAT_OBJS)
         	rm -f mandoc $(MAIN_OBJS)
         	rm -f man.cgi $(CGI_OBJS)
        -	rm -f manpage $(MANPAGE_OBJS)
        +	rm -f mandocd catman catman.o $(MANDOCD_OBJS)
         	rm -f demandoc $(DEMANDOC_OBJS)
         	rm -f soelim $(SOELIM_OBJS)
        -	rm -f $(WWW_MANS) $(WWW_OBJS)
        +	rm -f $(WWW_MANS) mandoc.tar.gz mandoc.sha256
         	rm -rf *.dSYM
         
        -base-install: base-build
        +base-install: mandoc demandoc soelim
         	mkdir -p $(DESTDIR)$(BINDIR)
         	mkdir -p $(DESTDIR)$(SBINDIR)
         	mkdir -p $(DESTDIR)$(MANDIR)/man1
        @@ -375,29 +390,28 @@ base-install: base-build
         	mkdir -p $(DESTDIR)$(MANDIR)/man8
         	$(INSTALL_PROGRAM) mandoc demandoc $(DESTDIR)$(BINDIR)
         	$(INSTALL_PROGRAM) soelim $(DESTDIR)$(BINDIR)/$(BINM_SOELIM)
        -	ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_MAN)
        -	ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_APROPOS)
        -	ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_WHATIS)
        -	ln -f $(DESTDIR)$(BINDIR)/mandoc \
        -		$(DESTDIR)$(SBINDIR)/$(BINM_MAKEWHATIS)
        +	cd $(DESTDIR)$(BINDIR) && $(LN) mandoc $(BINM_MAN)
        +	cd $(DESTDIR)$(BINDIR) && $(LN) mandoc $(BINM_APROPOS)
        +	cd $(DESTDIR)$(BINDIR) && $(LN) mandoc $(BINM_WHATIS)
        +	cd $(DESTDIR)$(SBINDIR) && \
        +		$(LN) ${BIN_FROM_SBIN}/mandoc $(BINM_MAKEWHATIS)
         	$(INSTALL_MAN) mandoc.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1
         	$(INSTALL_MAN) soelim.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_SOELIM).1
         	$(INSTALL_MAN) man.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_MAN).1
         	$(INSTALL_MAN) apropos.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_APROPOS).1
        -	ln -f $(DESTDIR)$(MANDIR)/man1/$(BINM_APROPOS).1 \
        -		$(DESTDIR)$(MANDIR)/man1/$(BINM_WHATIS).1
        -	$(INSTALL_MAN) man.conf.5 $(DESTDIR)$(MANDIR)/man5/${MANM_MANCONF}.5
        +	cd $(DESTDIR)$(MANDIR)/man1 && $(LN) $(BINM_APROPOS).1 $(BINM_WHATIS).1
        +	$(INSTALL_MAN) man.conf.5 $(DESTDIR)$(MANDIR)/man5/$(MANM_MANCONF).5
         	$(INSTALL_MAN) mandoc.db.5 $(DESTDIR)$(MANDIR)/man5
        -	$(INSTALL_MAN) man.7 $(DESTDIR)$(MANDIR)/man7/${MANM_MAN}.7
        -	$(INSTALL_MAN) mdoc.7 $(DESTDIR)$(MANDIR)/man7/${MANM_MDOC}.7
        -	$(INSTALL_MAN) roff.7 $(DESTDIR)$(MANDIR)/man7/${MANM_ROFF}.7
        -	$(INSTALL_MAN) eqn.7 $(DESTDIR)$(MANDIR)/man7/${MANM_EQN}.7
        -	$(INSTALL_MAN) tbl.7 $(DESTDIR)$(MANDIR)/man7/${MANM_TBL}.7
        +	$(INSTALL_MAN) man.7 $(DESTDIR)$(MANDIR)/man7/$(MANM_MAN).7
        +	$(INSTALL_MAN) mdoc.7 $(DESTDIR)$(MANDIR)/man7/$(MANM_MDOC).7
        +	$(INSTALL_MAN) roff.7 $(DESTDIR)$(MANDIR)/man7/$(MANM_ROFF).7
        +	$(INSTALL_MAN) eqn.7 $(DESTDIR)$(MANDIR)/man7/$(MANM_EQN).7
        +	$(INSTALL_MAN) tbl.7 $(DESTDIR)$(MANDIR)/man7/$(MANM_TBL).7
         	$(INSTALL_MAN) mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
         	$(INSTALL_MAN) makewhatis.8 \
         		$(DESTDIR)$(MANDIR)/man8/$(BINM_MAKEWHATIS).8
         
        -lib-install: base-build
        +lib-install: libmandoc.a
         	mkdir -p $(DESTDIR)$(LIBDIR)
         	mkdir -p $(DESTDIR)$(INCLUDEDIR)
         	mkdir -p $(DESTDIR)$(MANDIR)/man3
        @@ -407,13 +421,70 @@ lib-install: base-build
         	$(INSTALL_MAN) mandoc.3 mandoc_escape.3 mandoc_malloc.3 \
         		mansearch.3 mchars_alloc.3 tbl.3 $(DESTDIR)$(MANDIR)/man3
         
        -cgi-install: cgi-build
        +cgi-install: man.cgi
         	mkdir -p $(DESTDIR)$(CGIBINDIR)
         	mkdir -p $(DESTDIR)$(HTDOCDIR)
         	$(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR)
         	$(INSTALL_DATA) mandoc.css $(DESTDIR)$(HTDOCDIR)
         
        -Makefile.local config.h: configure ${TESTSRCS}
        +catman-install: mandocd catman
        +	mkdir -p $(DESTDIR)$(SBINDIR)
        +	mkdir -p $(DESTDIR)$(MANDIR)/man8
        +	$(INSTALL_PROGRAM) mandocd $(DESTDIR)$(SBINDIR)
        +	$(INSTALL_PROGRAM) catman $(DESTDIR)$(SBINDIR)/$(BINM_CATMAN)
        +	$(INSTALL_MAN) mandocd.8 $(DESTDIR)$(MANDIR)/man8
        +	$(INSTALL_MAN) catman.8 $(DESTDIR)$(MANDIR)/man8/$(BINM_CATMAN).8
        +
        +uninstall:
        +	rm -f $(DESTDIR)$(BINDIR)/mandoc
        +	rm -f $(DESTDIR)$(BINDIR)/demandoc
        +	rm -f $(DESTDIR)$(BINDIR)/$(BINM_SOELIM)
        +	rm -f $(DESTDIR)$(BINDIR)/$(BINM_MAN)
        +	rm -f $(DESTDIR)$(BINDIR)/$(BINM_APROPOS)
        +	rm -f $(DESTDIR)$(BINDIR)/$(BINM_WHATIS)
        +	rm -f $(DESTDIR)$(SBINDIR)/$(BINM_MAKEWHATIS)
        +	rm -f $(DESTDIR)$(MANDIR)/man1/mandoc.1
        +	rm -f $(DESTDIR)$(MANDIR)/man1/demandoc.1
        +	rm -f $(DESTDIR)$(MANDIR)/man1/$(BINM_SOELIM).1
        +	rm -f $(DESTDIR)$(MANDIR)/man1/$(BINM_MAN).1
        +	rm -f $(DESTDIR)$(MANDIR)/man1/$(BINM_APROPOS).1
        +	rm -f $(DESTDIR)$(MANDIR)/man1/$(BINM_WHATIS).1
        +	rm -f $(DESTDIR)$(MANDIR)/man5/$(MANM_MANCONF).5
        +	rm -f $(DESTDIR)$(MANDIR)/man5/mandoc.db.5
        +	rm -f $(DESTDIR)$(MANDIR)/man7/$(MANM_MAN).7
        +	rm -f $(DESTDIR)$(MANDIR)/man7/$(MANM_MDOC).7
        +	rm -f $(DESTDIR)$(MANDIR)/man7/$(MANM_ROFF).7
        +	rm -f $(DESTDIR)$(MANDIR)/man7/$(MANM_EQN).7
        +	rm -f $(DESTDIR)$(MANDIR)/man7/$(MANM_TBL).7
        +	rm -f $(DESTDIR)$(MANDIR)/man7/mandoc_char.7
        +	rm -f $(DESTDIR)$(MANDIR)/man8/$(BINM_MAKEWHATIS).8
        +	rm -f $(DESTDIR)$(CGIBINDIR)/man.cgi
        +	rm -f $(DESTDIR)$(HTDOCDIR)/mandoc.css
        +	rm -f $(DESTDIR)$(SBINDIR)/mandocd
        +	rm -f $(DESTDIR)$(SBINDIR)/$(BINM_CATMAN)
        +	rm -f $(DESTDIR)$(MANDIR)/man8/mandocd.8
        +	rm -f $(DESTDIR)$(MANDIR)/man8/$(BINM_CATMAN).8
        +	rm -f $(DESTDIR)$(LIBDIR)/libmandoc.a
        +	rm -f $(DESTDIR)$(MANDIR)/man3/mandoc.3
        +	rm -f $(DESTDIR)$(MANDIR)/man3/mandoc_escape.3
        +	rm -f $(DESTDIR)$(MANDIR)/man3/mandoc_malloc.3
        +	rm -f $(DESTDIR)$(MANDIR)/man3/mansearch.3
        +	rm -f $(DESTDIR)$(MANDIR)/man3/mchars_alloc.3
        +	rm -f $(DESTDIR)$(MANDIR)/man3/tbl.3
        +	rm -f $(DESTDIR)$(INCLUDEDIR)/man.h
        +	rm -f $(DESTDIR)$(INCLUDEDIR)/mandoc.h
        +	rm -f $(DESTDIR)$(INCLUDEDIR)/mandoc_aux.h
        +	rm -f $(DESTDIR)$(INCLUDEDIR)/mdoc.h
        +	rm -f $(DESTDIR)$(INCLUDEDIR)/roff.h
        +	[ ! -e $(DESTDIR)$(INCLUDEDIR) ] || rmdir $(DESTDIR)$(INCLUDEDIR)
        +
        +regress: all
        +	cd regress && ./regress.pl
        +
        +regress-clean:
        +	cd regress && ./regress.pl . clean
        +
        +Makefile.local config.h: configure $(TESTSRCS)
         	@echo "$@ is out of date; please run ./configure"
         	@exit 1
         
        @@ -423,12 +494,15 @@ libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
         mandoc: $(MAIN_OBJS) libmandoc.a
         	$(CC) -o $@ $(LDFLAGS) $(MAIN_OBJS) libmandoc.a $(LDADD)
         
        -manpage: $(MANPAGE_OBJS) libmandoc.a
        -	$(CC) -o $@ $(LDFLAGS) $(MANPAGE_OBJS) libmandoc.a $(LDADD)
        -
         man.cgi: $(CGI_OBJS) libmandoc.a
         	$(CC) $(STATIC) -o $@ $(LDFLAGS) $(CGI_OBJS) libmandoc.a $(LDADD)
         
        +mandocd: $(MANDOCD_OBJS) libmandoc.a
        +	$(CC) -o $@ $(LDFLAGS) $(MANDOCD_OBJS) libmandoc.a $(LDADD)
        +
        +catman: catman.o libmandoc.a
        +	$(CC) -o $@ $(LDFLAGS) catman.o libmandoc.a $(LDADD)
        +
         demandoc: $(DEMANDOC_OBJS) libmandoc.a
         	$(CC) -o $@ $(LDFLAGS) $(DEMANDOC_OBJS) libmandoc.a $(LDADD)
         
        @@ -438,13 +512,7 @@ soelim: $(SOELIM_OBJS)
         # --- maintainer targets ---
         
         www-install: www
        -	mkdir -p $(HTDOCDIR)/snapshots
         	$(INSTALL_DATA) $(WWW_MANS) mandoc.css $(HTDOCDIR)
        -	$(INSTALL_DATA) $(WWW_OBJS) $(HTDOCDIR)/snapshots
        -	$(INSTALL_DATA) mdocml.tar.gz \
        -		$(HTDOCDIR)/snapshots/mdocml-$(VERSION).tar.gz
        -	$(INSTALL_DATA) mdocml.sha256 \
        -		$(HTDOCDIR)/snapshots/mdocml-$(VERSION).sha256
         
         depend: config.h
         	mkdep -f Makefile.depend $(CFLAGS) $(SRCS)
        @@ -453,16 +521,43 @@ depend: config.h
         		Makefile.depend > Makefile.tmp
         	mv Makefile.tmp Makefile.depend
         
        -dist: mdocml.sha256
        +regress-distclean:
        +	@find regress \
        +		-name '.#*' -o \
        +		-name '*.orig' -o \
        +		-name '*.rej' -o \
        +		-name '*.core' \
        +		-exec rm -i {} \;
         
        -mdocml.sha256: mdocml.tar.gz
        -	sha256 mdocml.tar.gz > $@
        +regress-distcheck:
        +	@find regress ! -type d ! -type f
        +	@find regress -type f \
        +		! -path '*/CVS/*' \
        +		! -name Makefile \
        +		! -name Makefile.inc \
        +		! -name '*.in' \
        +		! -name '*.out_ascii' \
        +		! -name '*.out_utf8' \
        +		! -name '*.out_html' \
        +		! -name '*.out_markdown' \
        +		! -name '*.out_lint' \
        +		! -path regress/regress.pl \
        +		! -path regress/regress.pl.1
         
        -mdocml.tar.gz: $(DISTFILES)
        -	mkdir -p .dist/mdocml-$(VERSION)/
        -	$(INSTALL) -m 0644 $(DISTFILES) .dist/mdocml-$(VERSION)
        -	chmod 755 .dist/mdocml-$(VERSION)/configure
        -	( cd .dist/ && tar zcf ../$@ mdocml-$(VERSION) )
        +dist: mandoc.sha256
        +
        +mandoc.sha256: mandoc.tar.gz
        +	sha256 mandoc.tar.gz > $@
        +
        +mandoc.tar.gz: $(DISTFILES)
        +	ls regress/*/*/*.mandoc_* && exit 1 || true
        +	mkdir -p .dist/mandoc-$(VERSION)/
        +	$(INSTALL) -m 0644 $(DISTFILES) .dist/mandoc-$(VERSION)
        +	cp -pR regress .dist/mandoc-$(VERSION)
        +	find .dist/mandoc-$(VERSION)/regress \
        +	    -type d -name CVS -print0 | xargs -0 rm -rf
        +	chmod 755 .dist/mandoc-$(VERSION)/configure
        +	( cd .dist/ && tar zcf ../$@ mandoc-$(VERSION) )
         	rm -rf .dist/
         
         # === SUFFIX RULES =====================================================
        
        Modified: stable/11/contrib/mdocml/Makefile.depend
        ==============================================================================
        --- stable/11/contrib/mdocml/Makefile.depend	Tue Aug  8 11:35:02 2017	(r322248)
        +++ stable/11/contrib/mdocml/Makefile.depend	Tue Aug  8 11:35:27 2017	(r322249)
        @@ -1,4 +1,5 @@
        -att.o: att.c config.h roff.h mdoc.h libmdoc.h
        +att.o: att.c config.h mandoc.h roff.h mdoc.h libmdoc.h
        +catman.o: catman.c config.h compat_fts.h
         cgi.o: cgi.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h man.h main.h manconf.h mansearch.h cgi.h
         chars.o: chars.c config.h mandoc.h mandoc_aux.h mandoc_ohash.h compat_ohash.h libmandoc.h
         compat_err.o: compat_err.c config.h
        @@ -10,6 +11,7 @@ compat_mkdtemp.o: compat_mkdtemp.c config.h
         compat_ohash.o: compat_ohash.c config.h compat_ohash.h
         compat_progname.o: compat_progname.c config.h
         compat_reallocarray.o: compat_reallocarray.c config.h
        +compat_recallocarray.o: compat_recallocarray.c config.h
         compat_strcasestr.o: compat_strcasestr.c config.h
         compat_stringlist.o: compat_stringlist.c config.h compat_stringlist.h
         compat_strlcat.o: compat_strlcat.c config.h
        @@ -23,42 +25,45 @@ dba_read.o: dba_read.c mandoc_aux.h mansearch.h dba_ar
         dba_write.o: dba_write.c config.h dba_write.h
         dbm.o: dbm.c config.h mansearch.h dbm_map.h dbm.h
         dbm_map.o: dbm_map.c config.h mansearch.h dbm_map.h dbm.h
        -demandoc.o: demandoc.c config.h roff.h man.h mdoc.h mandoc.h
        -eqn.o: eqn.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h
        +demandoc.o: demandoc.c config.h mandoc.h roff.h man.h mdoc.h
        +eqn.o: eqn.c config.h mandoc_aux.h mandoc.h roff.h libmandoc.h libroff.h
         eqn_html.o: eqn_html.c config.h mandoc.h out.h html.h
         eqn_term.o: eqn_term.c config.h mandoc.h out.h term.h
        -html.o: html.c config.h mandoc.h mandoc_aux.h out.h html.h manconf.h main.h
        -lib.o: lib.c config.h roff.h mdoc.h libmdoc.h lib.in
        -main.o: main.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h man.h tag.h main.h manconf.h mansearch.h
        +html.o: html.c config.h mandoc_aux.h mandoc.h roff.h out.h html.h manconf.h main.h
        +lib.o: lib.c config.h mandoc.h roff.h mdoc.h libmdoc.h lib.in
        +main.o: main.c config.h mandoc_aux.h mandoc.h mandoc_xr.h roff.h mdoc.h man.h tag.h main.h manconf.h mansearch.h
         man.o: man.c config.h mandoc_aux.h mandoc.h roff.h man.h libmandoc.h roff_int.h libman.h
        -man_hash.o: man_hash.c config.h mandoc.h roff.h man.h libmandoc.h libman.h
        -man_html.o: man_html.c config.h mandoc_aux.h roff.h man.h out.h html.h main.h
        +man_html.o: man_html.c config.h mandoc_aux.h mandoc.h roff.h man.h out.h html.h main.h
         man_macro.o: man_macro.c config.h mandoc.h roff.h man.h libmandoc.h roff_int.h libman.h
         man_term.o: man_term.c config.h mandoc_aux.h mandoc.h roff.h man.h out.h term.h main.h
         man_validate.o: man_validate.c config.h mandoc_aux.h mandoc.h roff.h man.h libmandoc.h roff_int.h libman.h
        -mandoc.o: mandoc.c config.h mandoc.h mandoc_aux.h libmandoc.h
        +mandoc.o: mandoc.c config.h mandoc_aux.h mandoc.h roff.h libmandoc.h
         mandoc_aux.o: mandoc_aux.c config.h mandoc.h mandoc_aux.h
         mandoc_ohash.o: mandoc_ohash.c mandoc_aux.h mandoc_ohash.h compat_ohash.h
        +mandoc_xr.o: mandoc_xr.c mandoc_aux.h mandoc_ohash.h compat_ohash.h mandoc_xr.h
        +mandocd.o: mandocd.c config.h mandoc.h roff.h mdoc.h man.h main.h manconf.h
         mandocdb.o: mandocdb.c config.h compat_fts.h mandoc_aux.h mandoc_ohash.h compat_ohash.h mandoc.h roff.h mdoc.h man.h manconf.h mansearch.h dba_array.h dba.h
        -manpage.o: manpage.c config.h manconf.h mansearch.h
         manpath.o: manpath.c config.h mandoc_aux.h manconf.h
         mansearch.o: mansearch.c config.h mandoc.h mandoc_aux.h mandoc_ohash.h compat_ohash.h manconf.h mansearch.h dbm.h
         mdoc.o: mdoc.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
         mdoc_argv.o: mdoc_argv.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
        -mdoc_hash.o: mdoc_hash.c config.h mandoc.h roff.h mdoc.h libmandoc.h libmdoc.h
        -mdoc_html.o: mdoc_html.c config.h mandoc_aux.h roff.h mdoc.h out.h html.h main.h
        +mdoc_html.o: mdoc_html.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h out.h html.h main.h
         mdoc_macro.o: mdoc_macro.c config.h mandoc.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
         mdoc_man.o: mdoc_man.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h man.h out.h main.h
        +mdoc_markdown.o: mdoc_markdown.c mandoc_aux.h mandoc.h roff.h mdoc.h main.h
         mdoc_state.o: mdoc_state.c mandoc.h roff.h mdoc.h libmandoc.h libmdoc.h
         mdoc_term.o: mdoc_term.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h out.h term.h tag.h main.h
        -mdoc_validate.o: mdoc_validate.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
        +mdoc_validate.o: mdoc_validate.c config.h mandoc_aux.h mandoc.h mandoc_xr.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
         msec.o: msec.c config.h mandoc.h libmandoc.h msec.in
         out.o: out.c config.h mandoc_aux.h mandoc.h out.h
         preconv.o: preconv.c config.h mandoc.h libmandoc.h
        -read.o: read.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h man.h libmandoc.h roff_int.h
        -roff.o: roff.c config.h mandoc.h mandoc_aux.h roff.h libmandoc.h roff_int.h libroff.h predefs.in
        +read.o: read.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h man.h libmandoc.h
        +roff.o: roff.c config.h mandoc.h mandoc_aux.h mandoc_ohash.h compat_ohash.h roff.h libmandoc.h roff_int.h libroff.h predefs.in
        +roff_html.o: roff_html.c mandoc.h roff.h out.h html.h
        +roff_term.o: roff_term.c mandoc.h roff.h out.h term.h
        +roff_validate.o: roff_validate.c mandoc.h roff.h libmandoc.h roff_int.h
         soelim.o: soelim.c config.h compat_stringlist.h
        -st.o: st.c config.h roff.h mdoc.h libmdoc.h st.in
        +st.o: st.c config.h mandoc.h roff.h mdoc.h libmdoc.h st.in
         tag.o: tag.c config.h mandoc_aux.h mandoc_ohash.h compat_ohash.h tag.h
         tbl.o: tbl.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h
         tbl_data.o: tbl_data.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h
        @@ -69,4 +74,5 @@ tbl_term.o: tbl_term.c config.h mandoc.h out.h term.h
         term.o: term.c config.h mandoc.h mandoc_aux.h out.h term.h main.h
         term_ascii.o: term_ascii.c config.h mandoc.h mandoc_aux.h out.h term.h manconf.h main.h
         term_ps.o: term_ps.c config.h mandoc_aux.h out.h term.h manconf.h main.h
        +term_tab.o: term_tab.c mandoc_aux.h out.h term.h
         tree.o: tree.c config.h mandoc.h roff.h mdoc.h man.h main.h
        
        Modified: stable/11/contrib/mdocml/NEWS
        ==============================================================================
        --- stable/11/contrib/mdocml/NEWS	Tue Aug  8 11:35:02 2017	(r322248)
        +++ stable/11/contrib/mdocml/NEWS	Tue Aug  8 11:35:27 2017	(r322249)
        @@ -1,7 +1,221 @@
        -$Id: NEWS,v 1.12 2016/07/14 11:09:06 schwarze Exp $
        +$Id: NEWS,v 1.26 2017/07/28 14:57:56 schwarze Exp $
         
        -This file lists the most important changes in the mdocml.bsd.lv distribution.
        +This file lists the most important changes in the mandoc.bsd.lv distribution.
         
        +Changes in version 1.14.2, released on July 28, 2017
        +
        +    --- MAJOR NEW FEATURES ---
        + * New mdoc(7) -Tmarkdown output mode.
        + * For -Thtml, implement internal hyperlinks pointing to authoritative
        +   definitions of various syntax elements, similar to the ctags(1)-like
        +   less(1) :t internal searching in terminal mode.
        + * Provide a superset of the functionality of the former mdoclint(1)
        +   utility and a new -Wstyle message level with several new messages,
        +   including validity checking of .Xr cross references.
        + * tbl(7): Implement automatic line breaking inside individual table
        +   cells, and several other formatting improvements.
        + * eqn(7): Complete rewrite of the lexer, resulting in several bugfixes.
        + * Continue parser unification, in particular allowing generation
        +   of syntax tree nodes on the roff(7) level, allowing implementation
        +   of many additional roff requests.
        +    --- REMOVED FUNCTIONALITY ---
        + * Delete the manpage(1) utility.  It was never enabled in any release.
        + * Delete the -Txhtml command line option.  It has been an obsolete
        +   alias for the -Thtml output mode for more than two years.
        +    --- MINOR NEW FEATURES ---
        + * -Tlint now puts parser messages on stdout instead of stderr,
        +   making commands like "man -l -Tlint *.1" useful.
        + * mdoc(7): Various .Lk formatting improvements.
        + * mdoc(7) -Thtml: Better CSS for .Bl lists.
        + * man(7): Implement the .MT/.ME block macro (mailto hyperlink).
        + * man(7): Implement the .DT macro (restore default tab positions).
        + * man(7): Improved support for manuals generated with reStructuredText
        +   by partial support for the \n[an-margin] number register.
        + * man(7) -Thtml: Support deep linking to .SH and .SS headers.
        + * tbl(7): Implement the "allbox" table option.
        + * tbl(7): Implement the column spacing and the 'w' (minimum column
        +   width) layout modifiers.
        + * tbl(7): Significant improvements of the manual page.
        + * eqn(7): Much improved font selection, including recognition of
        +   well-known function names, and a few other formatting improvements.
        + * eqn(7) -Thtml: Use  and  in addition to .
        + * roff(7): Implement the .ce (centering), .mc (margin character),
        +   .rj (right justify), .ta (define tab stops), .ti (temporary indent),
        +   .als (macro alias), .ec and .eo (escape character control),
        +   .po (page offset), and .rn (macro rename) requests.
        + * roff(7) .am: Implement appending to mdoc(7) and man(7) macros.
        + * roff(7): implement the \h (horizontol motion), \l (horizontal
        +   line drawing), and \p (break output line) escape sequences,
        +   and also several additional character escape sequences.
        + * roff(7): Implement the 'd' conditional (macro or string defined).
        + * man.cgi(8) now uses pledge(2), too.
        + * regress.pl(1): simpler user interface, better summary output,
        +   simpler code, and no more recursion.
        +    --- THANKS TO ---
        + * Anthony Bentley (OpenBSD) for the implementation of .MT/.ME,
        +   reports of many bugs and missing features, and suggestions
        +   for a number of feature and documentation improvements.
        + * Sebastien Marie (OpenBSD) for two source code patches and
        +   for some useful discussions.
        + * Florian Obser (OpenBSD) for a bugfix patch and a bug report.
        + * Jonathan Gray (OpenBSD) for several bug reports from afl(1)
        +   and several more from static analysis tools.
        + * Theo Buehler (OpenBSD) for several bug reports, most from afl(1).
        + * Jason McIntyre (OpenBSD) for many useful discussions about a
        +   wide variety of topics, lots of continuous testing, a number of
        +   bug reports, and some suggestions for messages and documentation.
        + * Thomas Klausner (NetBSD) for lots of help while migrating
        +   mdoclint(1) functionality to mandoc -Tlint, for suggesting
        +   several useful new messages, and for release testing.
        + * Reyk Floeter (OpenBSD) and Vsevolod Stakhov (FreeBSD) for
        +   suggesting a markdown output mode.
        + * Thomas Guettler for suggesting -Thtml internal hyperlinks.
        + * Yuri Pankov (Illumos) for inspiring new warning messages and
        +   for extensive release testing.
        + * Anton Lindqvist and TJ Townsend (both OpenBSD) and Jan Stary
        +   for multiple bug reports.
        + * Leah Neukirchen (Void Linux) for bug reports and release testing.
        + * Michael Stapelberg (Debian) for suggesting feature improvements
        +   and for release testing.
        + * Martin Natano and Theo de Raadt (both OpenBSD), Andreas Voegele,
        +   Gabriel Guzman, Gonzalo Tornaria, Markus Waldeck, and Raf Czlonka
        +   for bug reports.
        + * Antoine Jacoutot (OpenBSD) and Steffen Nurpmeso for suggesting
        +   feature improvements.
        + * Dag-Erling Smoergrav (FreeBSD) for inspiring new warning messages.
        + * Ted Unangst and Marc Espie (OpenBSD) for providing useful ideas.
        + * Svyatoslav Mishyn (Crux Linux) for release testing.
        + * Carsten Kunze (Heirloom roff) for help keeping mandoc and groff
        +   compatible and for committing some of my patches to groff.
        +
        +Changes in version 1.14.1, released on February 21, 2017
        +
        +    --- MAJOR NEW FEATURES ---
        + * apropos(1): Reimplement complete semantic search functionality
        +   without the dependency on SQLite3, using only POSIX APIs.
        +   This comes with a completely new mandoc.db(5) file format.
        + * man(1): Support more than one tag entry for the same search term,
        +   plus some minor improvements to the less(1) :t support.
        + * -Thtml: Use real macro names for CSS classes.
        +   Systematic cleanup of and many improvements to mandoc.css.
        + * -Thtml: Produce human readable HTML code by using indentation
        +   and better line breaks.  Improve various HTML elements,
        +   and trim several useless ones.
        + * New catman(8) utility, still somewhat experimental.
        + * Now includes a portable version of the OpenBSD mandoc regression
        +   suite, see regress/regress.pl.1 for details.
        +    --- REMOVED FUNCTIONALITY ---
        + * Operating systems that don't provide mmap(3) are no longer supported.
        + * Drop support for manpath(1).  Even if your system has manpath(1),
        +   it is simpler to use MANPATH_DEFAULT in configure.local for
        +   operating system defaults, man.conf(5) for machine-specific
        +   modifications, and ${MANPATH}, -m, and -M for user preferences
        +   than to bother with the complexity of manpath(1).
        + * makewhatis(8) -p: No longer warn about missing MLINKS since these
        +   are no longer needed for anything.
        +    --- MINOR NEW FEATURES ---
        + * mdoc(7): Warn about invalid punctuation and content below NAME.
        + * mdoc(7): Warn about .Xr lacking the second argument (section).
        + * mdoc(7): Warn about violations of the rule "new sentence, new line".
        + * roff(7): Warn about trailing whitespace at the end of comments.
        + * mdoc(7): Improve rendering of double quotes.
        + * mdoc(7): Always do text production in the validator, never in the
        +   formatters.  Cleaner, simpler, shorter, helps NetBSD apropos(1)
        +   and also makes -Ttree output more useful.
        + * -Ttree: Show metadata and some additional node flags.
        +   New -Onoval output option to show the unvalidated tree.
        +    --- RELIABILITY BUGFIXES ---
        + * man(1): Make "man -l" work with standard input from a pipe or file,
        +   as long as standard output is a terminal.
        + * man(7): Fix out of bounds read access if a text node immediately
        +   preceded the first .SH header.
        + * mdoc(7): Fix out of bounds read access for .Bl without a type
        +   but with a width.
        + * mdoc(7): Fix out of bounds read access for .Bl -column starting
        +   with a tab character instead of a child .It macro.
        + * mdoc(7): Fix syntax tree corruption leading to segfaults caused
        +   by stray block end macros in nested blocks of mismatching type.
        + * man(1): Fix NULL dereference when the first of multiple pages
        +   shown was preformatted.
        + * mdoc(7): Fix syntax tree corruption leading to NULL dereference
        +   caused by partial implicit macros inside .Bl -column table cells.
        + * mdoc(7): Fix syntax tree corruption leading to NULL dereference
        +   for macro sequences like .Bl .Bl .It Bo .El .It.
        + * mdoc(7): Fix syntax tree corruption leading to NULL dereference
        +   caused by .Ta following a nested .Bl -column breaking another block.
        + * mdoc(7): Fix syntax tree corruption sometimes leading to NULL
        +   dereference caused by indirectly broken .Nd or .Nm blocks.
        + * mdoc(7) -Thtml: Fix a NULL dereference for .Bl -column with 0 columns.
        + * mdoc(7): Fix NULL dereference in some specific cases of a
        +   block-end macro calling another block-end macro.
        + * mdoc(7): Fix NULL dereference if the only child of the head
        +   of the first .Sh was an empty in-line macro.
        + * eqn(7): Fix NULL dereference in the terminal formatter
        +   for empty matrices and empty square roots.
        + * mdoc(7): Fix an assertion failure for a .Bd without a type that
        +   breaks another block.
        + * mdoc(7): Fix an assertion failure that happened for some .Bl -column
        +   lists containing a column width of "-4n", "-3n", or "-2n".
        + * mdoc(7): Fix an assertion failure caused by .Bl -column without .It
        +   but containing eqn(7) or tbl(7) code.
        + * roff(7): Fix an assertion failure caused by \z\[u00FF] with -Tps/-Tpdf.
        + * roff(7): Fix an assertion failures caused by whitespace inside \o''
        +   (overstrike) sequences.
        + * -Thtml: Fix an assertion failure caused by -Oman or -Oincludes of
        +   excessive length.
        +    --- PORTABILITY IMPROVEMENTS ---
        + * man(1): Do not mix stdio narrow and wide stream orientation
        +   on stdout, which could cause output corruption on glibc.
        + * mandoc(1): Autodetect a suitable locale for -Tutf8 mode.
        + * ./configure: Autodetect whether PATH_MAX and O_DIRECTORY are defined.
        + * ./configure: Autodetect if nanosleep(3) needs -lrt.
        + * ./configure: Provide an ${LN} configuration variable.
        + * ./configure: Put compiler arguments that may contain -l at the end.
        +    --- MINOR BUGFIXES ---
        + * mdoc(7): Fix SYNOPSIS output if the first child of .Nm is a macro.
        + * mdoc(7) -Thtml: Improve formatting of .Bl -tag with short tags.
        + * man(7) -Thtml: Preserve whitespace in .nf (nofill) mode.
        + * mandoc(1): Error out on invalid output options on the command line.
        +    --- STRUCTURAL CHANGES, no functional change ---
        + * Redesign part of the mandoc_html(3) interfaces, making them much
        +   easier to use and reducing the amount of code by a few hundred lines.
        +    --- THANKS TO ---
        + * Michael Stapelberg (Debian) for designing the new mandocd(8)
        +   and parts of the new catman(8), for release testing, and for a
        +   number of patches and bug reports.
        + * Baptiste Daroussin (FreeBSD) for profiling the new makewhatis(8)
        +   implementation and suggesting an algorithmic improvement which
        +   more than doubled performance, and for a few bug reports.
        + * Ed Maste (FreeBSD) for an important patch improving reproducibility
        +   of builds in makewhatis(8), and for a few bug reports.
        + * Theo Buehler (OpenBSD) for almost twenty important bug reports,
        +   most of them found by systematic afl(1) fuzzing.
        + * Benny Lofgren, David Dahlberg, and in particular Vadim Zhukov
        +   for crucial help in getting .Bl -tag CSS formatting fixed.
        + * Svyatoslav Mishyn (Crux Linux) for an initial version of the
        +   patch to autodetect a suitable locale for -Tutf8 mode
        +   and for release testing.
        + * Jason McIntyre (OpenBSD) for multiple useful discussions
        +   and a number of bug reports.
        + * Sevan Janiyan (NetBSD) for extensive release testing and multiple
        +   bug reports.
        + * Thomas Klausner and Christos Zoulas (NetBSD), Yuri Pankov (illumos),
        +   and Leah Neukirchen (Void Linux) for release testing and bug reports.
        + * Ulrich Spoerlein (FreeBSD) for release testing.
        + * Alexander Bluhm, Andrew Fresh, Antoine Jacoutot, Antony Bentley,
        +   Christian Weisgerber, Jonathan Gray, Marc Espie, Martijn van Duren,
        +   Stuart Henderson, Ted Unangst, Theo de Raadt (OpenBSD), Abhinav
        +   Upadhyay, Kamil Rytarowski (NetBSD), Aaron M. Ucko, Bdale Garbee,
        +   Reiner Herrmann, Shane Kerr (Debian), Daniel Sabogal (Alpine Linux),
        +   Carsten Kunze (Heirloom roff), Kristaps Dzonsons (bsd.lv),
        +   Anton Lindqvist, Jan Stary, Jeremy A. Mates, Mark Patruck,
        +   Pavan Maddamsetti, Sean Levy , and
        +   Tiago Silva for bug reports.
        + * Brent Cook, Marc Espie, Philip Guenther, Todd Miller (OpenBSD)
        +   and Markus Waldeck for useful discussions.
        + * And as usual, OpenCSW for providing me with a Solaris 9/10/11
        +   testing environment.
        +
         Changes in version 1.13.4, released on July 14, 2016
         
             --- MAJOR NEW FEATURES ---
        @@ -109,7 +323,7 @@ Changes in version 1.13.4, released on July 14, 2016
            again resulting in more than half a dozen important bug reports.
          * Svyatoslav Mishyn (Crux Linux) for some patches, several bug
            reports, and extensive release testing.
        - * Christian Neukirchen (void Linux) for a number of compatibility
        + * Leah Neukirchen (Void Linux) for a number of compatibility
            patches and suggestions and several bug reports.
          * Christos Zoulas (NetBSD) for a bug fix patch and some useful
            suggestions for cleanup.
        @@ -146,11 +360,11 @@ Changes in version 1.13.3, released on March 13, 2015
          * New -Wunsupp message level.
             --- POTENTIONALLY SECURITY RELEVANT BUGFIXES ---
          * Fix a potential write buffer overrun on incomplete string conditionals.
        -   http://mdocml.bsd.lv/cgi-bin/cvsweb/roff.c#rev1.241
        +   http://mandoc.bsd.lv/cgi-bin/cvsweb/roff.c#rev1.241
          * Fix a potential write buffer overrun on backslash at EOF in a conditional.
        -   http://mdocml.bsd.lv/cgi-bin/cvsweb/roff.c#rev1.247
        +   http://mandoc.bsd.lv/cgi-bin/cvsweb/roff.c#rev1.247
          * Fix a use after free sometimes hit when validation deletes a block.
        -   http://mdocml.bsd.lv/cgi-bin/cvsweb/mdoc_macro.c#rev1.180
        +   http://mandoc.bsd.lv/cgi-bin/cvsweb/mdoc_macro.c#rev1.180
             --- MAJOR FUNCTIONALLY RELEVANT BUGFIXES ---
          * Let man(1) show manuals for the current architecture by default,
            and support the MACHINE environment variable.
        @@ -761,4 +975,4 @@ Changes in version 1.9.15, released on February 18, 20
          * and column lengths handled correctly.
         
         For older releases, see the ChangeLog files
        -in http://mdocml.bsd.lv/snapshots/ .
        +in http://mandoc.bsd.lv/snapshots/ .
        
        Modified: stable/11/contrib/mdocml/TODO
        ==============================================================================
        --- stable/11/contrib/mdocml/TODO	Tue Aug  8 11:35:02 2017	(r322248)
        +++ stable/11/contrib/mdocml/TODO	Tue Aug  8 11:35:27 2017	(r322249)
        @@ -1,6 +1,6 @@
         ************************************************************************
         * Official mandoc TODO.
        -* $Id: TODO,v 1.223 2017/01/17 15:32:43 schwarze Exp $
        +* $Id: TODO,v 1.246 2017/07/24 11:15:12 schwarze Exp $
         ************************************************************************
         
         Many issues are annotated for difficulty as follows:
        @@ -61,37 +61,14 @@ are mere guesses, and some may be wrong.
           reported by brad@  Sat, 15 Jan 2011 15:45:23 -0500
           loc ***  exist ***  algo ***  size **  imp *
         
        -- .ta (tab settings)
        -  #1 most important issue naddy@ Mon, 16 Feb 2015 20:59:17 +0100
        -  ircbug(1) gnats(1) reported by brad@  Sat, 15 Jan 2011 15:50:51 -0500
        -  also Tcl_NewStringObj(3) via wiz@  Wed, 5 Mar 2014 22:27:43 +0100
        -  also posix2time(3) Carsten Kunze  Mon, 1 Dec 2014 13:03:10 +0100
        -  loc **  exist ***  algo **  size **  imp ***
        
        *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:36:59 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09C79DD5F52;
         Tue,  8 Aug 2017 11:36:59 +0000 (UTC)
         (envelope-from hselasky@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id CB688822BA;
         Tue,  8 Aug 2017 11:36:58 +0000 (UTC)
         (envelope-from hselasky@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BavNh051822;
         Tue, 8 Aug 2017 11:36:57 GMT (envelope-from hselasky@FreeBSD.org)
        Received: (from hselasky@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Bavr0051821;
         Tue, 8 Aug 2017 11:36:57 GMT (envelope-from hselasky@FreeBSD.org)
        Message-Id: <201708081136.v78Bavr0051821@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: hselasky set sender to
         hselasky@FreeBSD.org using -f
        From: Hans Petter Selasky 
        Date: Tue, 8 Aug 2017 11:36:57 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322250 - head/sys/dev/mlx5/mlx5_en
        X-SVN-Group: head
        X-SVN-Commit-Author: hselasky
        X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en
        X-SVN-Commit-Revision: 322250
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:36:59 -0000
        
        Author: hselasky
        Date: Tue Aug  8 11:36:57 2017
        New Revision: 322250
        URL: https://svnweb.freebsd.org/changeset/base/322250
        
        Log:
          Count drop events due to lack of PCI bandwidth as queue drops and not as
          input errors in the mlx5en(4) driver. This improves the sysadmin view of
          physical port errors.
          
          Submitted by:		gallatin@
          MFC after:		1 week
          Sponsored by:		Mellanox Technologies
        
        Modified:
          head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
        
        Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
        ==============================================================================
        --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Tue Aug  8 11:35:27 2017	(r322249)
        +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Tue Aug  8 11:36:57 2017	(r322250)
        @@ -552,7 +552,6 @@ mlx5e_update_stats_work(struct work_struct *work)
         	    priv->stats.pport.alignment_err +
         	    priv->stats.pport.check_seq_err +
         	    priv->stats.pport.crc_align_errors +
        -	    priv->stats.pport.drop_events +
         	    priv->stats.pport.in_range_len_errors +
         	    priv->stats.pport.jabbers +
         	    priv->stats.pport.out_of_range_len +
        @@ -561,7 +560,8 @@ mlx5e_update_stats_work(struct work_struct *work)
         	    priv->stats.pport.too_long_errors +
         	    priv->stats.pport.undersize_pkts +
         	    priv->stats.pport.unsupported_op_rx;
        -	ifp->if_iqdrops = s->rx_out_of_buffer;
        +	ifp->if_iqdrops = s->rx_out_of_buffer +
        +	    priv->stats.pport.drop_events;
         	ifp->if_opackets = s->tx_packets;
         	ifp->if_oerrors = s->tx_error_packets;
         	ifp->if_snd.ifq_drops = s->tx_queue_dropped;
        @@ -2467,7 +2467,6 @@ mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt)
         		    priv->stats.pport.alignment_err +
         		    priv->stats.pport.check_seq_err +
         		    priv->stats.pport.crc_align_errors +
        -		    priv->stats.pport.drop_events +
         		    priv->stats.pport.in_range_len_errors +
         		    priv->stats.pport.jabbers +
         		    priv->stats.pport.out_of_range_len +
        @@ -2478,7 +2477,8 @@ mlx5e_get_counter(struct ifnet *ifp, ift_counter cnt)
         		    priv->stats.pport.unsupported_op_rx;
         		break;
         	case IFCOUNTER_IQDROPS:
        -		retval = priv->stats.vport.rx_out_of_buffer;
        +		retval = priv->stats.vport.rx_out_of_buffer +
        +		    priv->stats.pport.drop_events;
         		break;
         	case IFCOUNTER_OPACKETS:
         		retval = priv->stats.vport.tx_packets;
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 11:49:38 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3177EDD69EC;
         Tue,  8 Aug 2017 11:49:38 +0000 (UTC)
         (envelope-from hselasky@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client did not present a certificate)
         by mx1.freebsd.org (Postfix) with ESMTPS id F27DB82AA9;
         Tue,  8 Aug 2017 11:49:37 +0000 (UTC)
         (envelope-from hselasky@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78BnbZd056190;
         Tue, 8 Aug 2017 11:49:37 GMT (envelope-from hselasky@FreeBSD.org)
        Received: (from hselasky@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78BnbGw056189;
         Tue, 8 Aug 2017 11:49:37 GMT (envelope-from hselasky@FreeBSD.org)
        Message-Id: <201708081149.v78BnbGw056189@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: hselasky set sender to
         hselasky@FreeBSD.org using -f
        From: Hans Petter Selasky 
        Date: Tue, 8 Aug 2017 11:49:37 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322251 - head/sys/dev/mlx5/mlx5_en
        X-SVN-Group: head
        X-SVN-Commit-Author: hselasky
        X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en
        X-SVN-Commit-Revision: 322251
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 11:49:38 -0000
        
        Author: hselasky
        Date: Tue Aug  8 11:49:36 2017
        New Revision: 322251
        URL: https://svnweb.freebsd.org/changeset/base/322251
        
        Log:
          Make sure the received IP header gets 32-bit aligned for short packets
          in the mlx5en(4) driver.
          
          MFC after:		1 week
          Sponsored by:		Mellanox Technologies
        
        Modified:
          head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
        
        Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
        ==============================================================================
        --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c	Tue Aug  8 11:36:57 2017	(r322250)
        +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c	Tue Aug  8 11:49:36 2017	(r322251)
        @@ -355,9 +355,11 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget)
         			rq->stats.wqe_err++;
         			goto wq_ll_pop;
         		}
        -
        -		if (MHLEN >= byte_cnt &&
        +		if ((MHLEN - MLX5E_NET_IP_ALIGN) >= byte_cnt &&
         		    (mb = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) {
        +			/* get IP header aligned */
        +			mb->m_data += MLX5E_NET_IP_ALIGN;
        +
         			bcopy(rq->mbuf[wqe_counter].data, mtod(mb, caddr_t),
         			    byte_cnt);
         		} else {
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 12:18:12 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE024DD8D90;
         Tue,  8 Aug 2017 12:18: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 mx1.freebsd.org (Postfix) with ESMTPS id 8B85B74B;
         Tue,  8 Aug 2017 12:18: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 v78CIBmw068414;
         Tue, 8 Aug 2017 12:18:11 GMT (envelope-from manu@FreeBSD.org)
        Received: (from manu@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78CIBvL068413;
         Tue, 8 Aug 2017 12:18:11 GMT (envelope-from manu@FreeBSD.org)
        Message-Id: <201708081218.v78CIBvL068413@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: manu set sender to
         manu@FreeBSD.org using -f
        From: Emmanuel Vadot 
        Date: Tue, 8 Aug 2017 12:18:11 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322252 - head/usr.bin/vmstat
        X-SVN-Group: head
        X-SVN-Commit-Author: manu
        X-SVN-Commit-Paths: head/usr.bin/vmstat
        X-SVN-Commit-Revision: 322252
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 12:18:12 -0000
        
        Author: manu
        Date: Tue Aug  8 12:18:11 2017
        New Revision: 322252
        URL: https://svnweb.freebsd.org/changeset/base/322252
        
        Log:
          vmstat: Always emit a space after the free-memory column
          
          When displaying in non-human form, if the free-memory number
          is large (more than 7 digits), there is no space between it and
          the page fault column.
          
          PR:		221290
          Submitted by:	Josuah Demangeon  (Original version)
        
        Modified:
          head/usr.bin/vmstat/vmstat.c
        
        Modified: head/usr.bin/vmstat/vmstat.c
        ==============================================================================
        --- head/usr.bin/vmstat/vmstat.c	Tue Aug  8 11:49:36 2017	(r322251)
        +++ head/usr.bin/vmstat/vmstat.c	Tue Aug  8 12:18:11 2017	(r322252)
        @@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps)
         			xo_emit(" ");
         			xo_emit("{:free-memory/%7d}",
         			        vmstat_pgtok(total.t_free));
        +			xo_emit(" ");
         		}
         		xo_emit("{:total-page-faults/%5lu} ",
         		        (unsigned long)rate(sum.v_vm_faults -
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 13:27:33 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C51EDAB321;
         Tue,  8 Aug 2017 13:27:33 +0000 (UTC)
         (envelope-from grembo@FreeBSD.org)
        Received: from repo.freebsd.org (repo.freebsd.org
         [IPv6:2610:1c1:1:6068::e6a:0])
         (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 69CD72DB3;
         Tue,  8 Aug 2017 13:27:33 +0000 (UTC)
         (envelope-from grembo@FreeBSD.org)
        Received: from repo.freebsd.org ([127.0.1.37])
         by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78DRWQ0096544;
         Tue, 8 Aug 2017 13:27:32 GMT (envelope-from grembo@FreeBSD.org)
        Received: (from grembo@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78DRW6G096543;
         Tue, 8 Aug 2017 13:27:32 GMT (envelope-from grembo@FreeBSD.org)
        Message-Id: <201708081327.v78DRW6G096543@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: grembo set sender to
         grembo@FreeBSD.org using -f
        From: Michael Gmelin 
        Date: Tue, 8 Aug 2017 13:27:32 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322253 - head/sys/dev/cyapa
        X-SVN-Group: head
        X-SVN-Commit-Author: grembo
        X-SVN-Commit-Paths: head/sys/dev/cyapa
        X-SVN-Commit-Revision: 322253
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 13:27:33 -0000
        
        Author: grembo (ports committer)
        Date: Tue Aug  8 13:27:32 2017
        New Revision: 322253
        URL: https://svnweb.freebsd.org/changeset/base/322253
        
        Log:
          Fix typo in cyapa out of bounds check.
          
          PR:		217783
          Submitted by:	razmyslov@viva64.com
          MFC after:	1 week
        
        Modified:
          head/sys/dev/cyapa/cyapa.c
        
        Modified: head/sys/dev/cyapa/cyapa.c
        ==============================================================================
        --- head/sys/dev/cyapa/cyapa.c	Tue Aug  8 12:18:11 2017	(r322252)
        +++ head/sys/dev/cyapa/cyapa.c	Tue Aug  8 13:27:32 2017	(r322253)
        @@ -1455,7 +1455,7 @@ cyapa_raw_input(struct cyapa_softc *sc, struct cyapa_r
         				sc->delta_x = sc->cap_resx;
         			if (sc->delta_x < -sc->cap_resx)
         				sc->delta_x = -sc->cap_resx;
        -			if (sc->delta_y > sc->cap_resx)
        +			if (sc->delta_y > sc->cap_resy)
         				sc->delta_y = sc->cap_resy;
         			if (sc->delta_y < -sc->cap_resy)
         				sc->delta_y = -sc->cap_resy;
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 13:44:34 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03380DB4492;
         Tue,  8 Aug 2017 13:44:34 +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 mx1.freebsd.org (Postfix) with ESMTPS id C57393AA6;
         Tue,  8 Aug 2017 13:44:33 +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 v78DiWs1005117;
         Tue, 8 Aug 2017 13:44:32 GMT (envelope-from emaste@FreeBSD.org)
        Received: (from emaste@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78DiW2O005116;
         Tue, 8 Aug 2017 13:44:32 GMT (envelope-from emaste@FreeBSD.org)
        Message-Id: <201708081344.v78DiW2O005116@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: emaste set sender to
         emaste@FreeBSD.org using -f
        From: Ed Maste 
        Date: Tue, 8 Aug 2017 13:44:32 +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: r322254 - stable/11/usr.sbin/bsdinstall/scripts
        X-SVN-Group: stable-11
        X-SVN-Commit-Author: emaste
        X-SVN-Commit-Paths: stable/11/usr.sbin/bsdinstall/scripts
        X-SVN-Commit-Revision: 322254
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 13:44:34 -0000
        
        Author: emaste
        Date: Tue Aug  8 13:44:32 2017
        New Revision: 322254
        URL: https://svnweb.freebsd.org/changeset/base/322254
        
        Log:
          MFC r321734: bsdinstall: default to UEFI-only boot on arm64
          
          Sponsored by:	The FreeBSD Foundation
        
        Modified:
          stable/11/usr.sbin/bsdinstall/scripts/zfsboot
        Directory Properties:
          stable/11/   (props changed)
        
        Modified: stable/11/usr.sbin/bsdinstall/scripts/zfsboot
        ==============================================================================
        --- stable/11/usr.sbin/bsdinstall/scripts/zfsboot	Tue Aug  8 13:27:32 2017	(r322253)
        +++ stable/11/usr.sbin/bsdinstall/scripts/zfsboot	Tue Aug  8 13:44:32 2017	(r322254)
        @@ -1554,17 +1554,27 @@ f_dprintf "BSDINSTALL_TMPETC=[%s]" "$BSDINSTALL_TMPETC
         f_dprintf "FSTAB_FMT=[%s]" "$FSTAB_FMT"
         
         #
        -# If the system was booted with UEFI, set the default boot type to UEFI
        +# Determine default boot type
         #
        -bootmethod=$( sysctl -n machdep.bootmethod )
        -f_dprintf "machdep.bootmethod=[%s]" "$bootmethod"
        -if [ "$bootmethod" = "UEFI" ]; then
        -	: ${ZFSBOOT_BOOT_TYPE:=BIOS+UEFI}
        +case $(uname -m) in
        +arm64)
        +	# We support only UEFI boot for arm64
        +	: ${ZFSBOOT_BOOT_TYPE:=UEFI}
         	: ${ZFSBOOT_PARTITION_SCHEME:=GPT}
        -else
        -	: ${ZFSBOOT_BOOT_TYPE:=BIOS}
        -	: ${ZFSBOOT_PARTITION_SCHEME:=GPT}
        -fi
        +	;;
        +*)
        +	# If the system was booted with UEFI, set the default boot type to UEFI
        +	bootmethod=$( sysctl -n machdep.bootmethod )
        +	f_dprintf "machdep.bootmethod=[%s]" "$bootmethod"
        +	if [ "$bootmethod" = "UEFI" ]; then
        +		: ${ZFSBOOT_BOOT_TYPE:=BIOS+UEFI}
        +		: ${ZFSBOOT_PARTITION_SCHEME:=GPT}
        +	else
        +		: ${ZFSBOOT_BOOT_TYPE:=BIOS}
        +		: ${ZFSBOOT_PARTITION_SCHEME:=GPT}
        +	fi
        +	;;
        +esac
         
         #
         # Loop over the main menu until we've accomplished what we came here to do
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 13:56:01 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FE46DB4FF0;
         Tue,  8 Aug 2017 13:56:01 +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 C47386342B;
         Tue,  8 Aug 2017 13:56:00 +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 32CAF104AEEA;
         Tue,  8 Aug 2017 23:55:53 +1000 (AEST)
        Date: Tue, 8 Aug 2017 23:55:52 +1000 (EST)
        From: Bruce Evans 
        X-X-Sender: bde@besplex.bde.org
        To: Emmanuel Vadot 
        cc: src-committers@freebsd.org, svn-src-all@freebsd.org, 
         svn-src-head@freebsd.org
        Subject: Re: svn commit: r322252 - head/usr.bin/vmstat
        In-Reply-To: <201708081218.v78CIBvL068413@repo.freebsd.org>
        Message-ID: <20170808225104.I3528@besplex.bde.org>
        References: <201708081218.v78CIBvL068413@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=KeqiiUQD c=1 sm=1 tr=0
         a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17
         a=kj9zAlcOel0A:10 a=Q9sN3FMeAAAA:8 a=IM31cjteyJiYWX7TRqIA:9
         a=wIYqAnBEUc7iLIlU:21 a=DlAg6Rs7D7Kog30i:21 a=CjuIK1q_8ugA:10
         a=mnDzqiP7QBHErLppGYsC:22
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 13:56:01 -0000
        
        On Tue, 8 Aug 2017, Emmanuel Vadot wrote:
        
        > Log:
        >  vmstat: Always emit a space after the free-memory column
        >
        >  When displaying in non-human form, if the free-memory number
        >  is large (more than 7 digits), there is no space between it and
        >  the page fault column.
        >
        >  PR:		221290
        >  Submitted by:	Josuah Demangeon  (Original version)
        >
        > Modified:
        >  head/usr.bin/vmstat/vmstat.c
        >
        > Modified: head/usr.bin/vmstat/vmstat.c
        > ==============================================================================
        > --- head/usr.bin/vmstat/vmstat.c	Tue Aug  8 11:49:36 2017	(r322251)
        > +++ head/usr.bin/vmstat/vmstat.c	Tue Aug  8 12:18:11 2017	(r322252)
        > @@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps)
        > 			xo_emit(" ");
        > 			xo_emit("{:free-memory/%7d}",
        > 			        vmstat_pgtok(total.t_free));
        > +			xo_emit(" ");
        > 		}
        > 		xo_emit("{:total-page-faults/%5lu} ",
        > 		        (unsigned long)rate(sum.v_vm_faults -
        
        This seems to break the formatting.  There was a negative amount of space
        available for expansion, and since the header was not expanded to match
        its alignment with the fields is more random than before.  With -h, the
        width was 80 columns, giving ugly line wrap on 80-column terminals with
        auto-wrap.  Now it is 81 columns, giving uglier line wrap on all 80-
        column terminals.
        
        The bugs were mostly in the first line of the header:
        - the second line of the header was correct for vmstat -h
        - for vmstat without -h, the second line of the header was apparently broken
           by a change like the one here, that added a space after the "r b w" fields
           without adding one in the "r b w" header
        - most of the fields in the first line of the header are misaligned with the
           second lone.  Many have drifted 3 to the left of where the were in a sort
           of center-justified place.  Some of these might have actually been
           intended to be left justified, but had an off by +1 error.  Now these
           have an error of off by -2 relative to left justifications.
        
        Only the "memory" header in the first line is better than in old versions.
        It is now left justified.  Left justifying all headers in the first line
        is probably best.  I couldn't find a good way to delimit the right hand
        side of the extents of the headers in the first line.  The second line of
        the headers already uses right justification consistently and this works
        well.
        
        Bruce
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 14:15:20 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3186DB6028;
         Tue,  8 Aug 2017 14:15:20 +0000 (UTC)
         (envelope-from manu@bidouilliste.com)
        Received: from mail.blih.net (mail.blih.net [212.83.177.182])
         (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
         (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified))
         by mx1.freebsd.org (Postfix) with ESMTPS id D809463E0A;
         Tue,  8 Aug 2017 14:15:18 +0000 (UTC)
         (envelope-from manu@bidouilliste.com)
        Received: from mail.blih.net (mail.blih.net [212.83.177.182])
         by mail.blih.net (OpenSMTPD) with ESMTP id d0a43a1c;
         Tue, 8 Aug 2017 16:15:10 +0200 (CEST)
        DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date
         :from:to:cc:subject:message-id:in-reply-to:references
         :mime-version:content-type:content-transfer-encoding; s=mail;
         bh=j90AO2uKb8a+TCyvXumjW/Lu9rw=; b=HIF8HbVeVNSIxXLEatRPHBxjcqBL
         r/PHGQTLckdR5dPCfYd7DXsDiaBqPCgQ78nH9X1IUs3kp7BUGtpGmyyhovhluLFx
         JmPcviDV0gzMJ+fqLVumzrGMTjgehgp5TWsDsbUXTgMCRjXE/rayDHDn7hl58c85
         7+wh3Yuow2Y8oNc=
        DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date
         :from:to:cc:subject:message-id:in-reply-to:references
         :mime-version:content-type:content-transfer-encoding; q=dns; s=
         mail; b=HArmG9I3ADKaIJBP7SzK9MHSgD/JX5cqMuS6KbibH1+d70WywW2EwRf5
         fe4d1sNNkGujjVDkeI8IEV6GH+CPwqNHHxYek9fCiuXaEt5R0n8nrfW/GgXWG0Lj
         675qQbqC2EoFLl4oaubXh0CQHGHpweroMOjyV8atb2rjxqeJhDQ=
        Received: from arcadia (evadot.gandi.net [217.70.181.36])
         by mail.blih.net (OpenSMTPD) with ESMTPSA id 84b4059f
         TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO;
         Tue, 8 Aug 2017 16:15:09 +0200 (CEST)
        Date: Tue, 8 Aug 2017 16:15:07 +0200
        From: Emmanuel Vadot 
        To: Bruce Evans 
        Cc: Emmanuel Vadot , src-committers@freebsd.org,
         svn-src-all@freebsd.org, svn-src-head@freebsd.org
        Subject: Re: svn commit: r322252 - head/usr.bin/vmstat
        Message-Id: <20170808161507.2d185d394dc921eac6729d89@bidouilliste.com>
        In-Reply-To: <20170808225104.I3528@besplex.bde.org>
        References: <201708081218.v78CIBvL068413@repo.freebsd.org>
         <20170808225104.I3528@besplex.bde.org>
        X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; amd64-portbld-freebsd12.0)
        Mime-Version: 1.0
        Content-Type: text/plain; charset=US-ASCII
        Content-Transfer-Encoding: 7bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 14:15:21 -0000
        
        On Tue, 8 Aug 2017 23:55:52 +1000 (EST)
        Bruce Evans  wrote:
        
        > On Tue, 8 Aug 2017, Emmanuel Vadot wrote:
        > 
        > > Log:
        > >  vmstat: Always emit a space after the free-memory column
        > >
        > >  When displaying in non-human form, if the free-memory number
        > >  is large (more than 7 digits), there is no space between it and
        > >  the page fault column.
        > >
        > >  PR:		221290
        > >  Submitted by:	Josuah Demangeon  (Original version)
        > >
        > > Modified:
        > >  head/usr.bin/vmstat/vmstat.c
        > >
        > > Modified: head/usr.bin/vmstat/vmstat.c
        > > ==============================================================================
        > > --- head/usr.bin/vmstat/vmstat.c	Tue Aug  8 11:49:36 2017	(r322251)
        > > +++ head/usr.bin/vmstat/vmstat.c	Tue Aug  8 12:18:11 2017	(r322252)
        > > @@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps)
        > > 			xo_emit(" ");
        > > 			xo_emit("{:free-memory/%7d}",
        > > 			        vmstat_pgtok(total.t_free));
        > > +			xo_emit(" ");
        > > 		}
        > > 		xo_emit("{:total-page-faults/%5lu} ",
        > > 		        (unsigned long)rate(sum.v_vm_faults -
        > 
        > This seems to break the formatting.  There was a negative amount of space
        > available for expansion, and since the header was not expanded to match
        > its alignment with the fields is more random than before.  With -h, the
        > width was 80 columns, giving ugly line wrap on 80-column terminals with
        > auto-wrap.  Now it is 81 columns, giving uglier line wrap on all 80-
        > column terminals.
        
         This break nothing, This was the case before too (with or without
        -h), just tested in tmux with force-width 80.
        
        > The bugs were mostly in the first line of the header:
        > - the second line of the header was correct for vmstat -h
        > - for vmstat without -h, the second line of the header was apparently broken
        >    by a change like the one here, that added a space after the "r b w" fields
        >    without adding one in the "r b w" header
        > - most of the fields in the first line of the header are misaligned with the
        >    second lone.  Many have drifted 3 to the left of where the were in a sort
        >    of center-justified place.  Some of these might have actually been
        >    intended to be left justified, but had an off by +1 error.  Now these
        >    have an error of off by -2 relative to left justifications.
        > 
        > Only the "memory" header in the first line is better than in old versions.
        > It is now left justified.  Left justifying all headers in the first line
        > is probably best.  I couldn't find a good way to delimit the right hand
        > side of the extents of the headers in the first line.  The second line of
        > the headers already uses right justification consistently and this works
        > well.
        > 
        > Bruce
        
         I think that all this might be true but you might talk about the whole
        libxo conversion that was done, not my commit right ?
        
        -- 
        Emmanuel Vadot  
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 15:37:22 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA2E4DBE9B9;
         Tue,  8 Aug 2017 15:37:22 +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 mx1.freebsd.org (Postfix) with ESMTPS id A89606688E;
         Tue,  8 Aug 2017 15:37:22 +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 v78FbLKQ049560;
         Tue, 8 Aug 2017 15:37:21 GMT (envelope-from asomers@FreeBSD.org)
        Received: (from asomers@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78FbLUp049559;
         Tue, 8 Aug 2017 15:37:21 GMT (envelope-from asomers@FreeBSD.org)
        Message-Id: <201708081537.v78FbLUp049559@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: asomers set sender to
         asomers@FreeBSD.org using -f
        From: Alan Somers 
        Date: Tue, 8 Aug 2017 15:37:21 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322255 - head/tests/sys/netinet
        X-SVN-Group: head
        X-SVN-Commit-Author: asomers
        X-SVN-Commit-Paths: head/tests/sys/netinet
        X-SVN-Commit-Revision: 322255
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 15:37:23 -0000
        
        Author: asomers
        Date: Tue Aug  8 15:37:21 2017
        New Revision: 322255
        URL: https://svnweb.freebsd.org/changeset/base/322255
        
        Log:
          tests/sys/netinet/fibs_test: skip selected tests when firewalls are enabled
          
          Some tests send packets over epair(4) interfaces. Firewalls can cause
          spurious failures.
          
          Reviewed by:	ngie
          MFC after:	3 weeks
          Sponsored by:	Spectra Logic Corp
          Differential Revision:	https://reviews.freebsd.org/D11917
        
        Modified:
          head/tests/sys/netinet/fibs_test.sh
        
        Modified: head/tests/sys/netinet/fibs_test.sh
        ==============================================================================
        --- head/tests/sys/netinet/fibs_test.sh	Tue Aug  8 13:44:32 2017	(r322254)
        +++ head/tests/sys/netinet/fibs_test.sh	Tue Aug  8 15:37:21 2017	(r322255)
        @@ -766,6 +766,12 @@ get_epair()
         {
         	local EPAIRD
         
        +	if  (which pfctl && pfctl -s info | grep -q 'Status: Enabled') || 
        +	    [ `sysctl -n net.inet.ip.fw.enable` = "1" ] ||
        +	    (which ipf && ipf -V); then
        +		atf_skip "firewalls interfere with this test"
        +	fi
        +
         	if EPAIRD=`ifconfig epair create`; then
         		# Record the epair device so we can clean it up later
         		echo ${EPAIRD} >> "ifaces_to_cleanup"
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 15:37:45 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id E12CEDBEA8E;
         Tue,  8 Aug 2017 15:37:45 +0000 (UTC)
         (envelope-from asomers@gmail.com)
        Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com
         [IPv6:2a00:1450:400c:c09::234])
         (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
         (Client CN "smtp.gmail.com",
         Issuer "Google Internet Authority G2" (verified OK))
         by mx1.freebsd.org (Postfix) with ESMTPS id 7547F669E0;
         Tue,  8 Aug 2017 15:37:45 +0000 (UTC)
         (envelope-from asomers@gmail.com)
        Received: by mail-wm0-x234.google.com with SMTP id t201so10505854wmt.1;
         Tue, 08 Aug 2017 08:37:45 -0700 (PDT)
        DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
         h=mime-version:sender:in-reply-to:references:from:date:message-id
         :subject:to:cc;
         bh=+QoJ5nLEdlva+48nefCUfmlEdR6Xo7uX1Gi/t1hAd0o=;
         b=iq5M+s4Ask3Jdgjvq01KqeBOqBH2gwCzhwAhJRHVEMf/MSV/99ix6miijoIVExU0Yc
         e+mRciFfjPG75CtvTxwYnt/UQ66bOs0U7YFhM1G7Rv5SY2utZdv6y4BHTqF6yvYpr53f
         usUiFGzsIG+dpHqBL3ITI/h/p1ZovZX4viPHb+umilQV1byjztlOmUOXDfsjVcbbtdLk
         Sx8WFCOCTbTDWJQ0teglHRyuingtnyiBiYhy7uv/af0HypBrCmYpQXhtt+VRqhQ0BJ7e
         ctQb1+ZWZvK1fMDmVVNxOu4FWb5xNxmqGwzoEQLCYksrTm0BT1e01IFpSBf+XycdIaWI
         WlZw==
        X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
         d=1e100.net; s=20161025;
         h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
         :date:message-id:subject:to:cc;
         bh=+QoJ5nLEdlva+48nefCUfmlEdR6Xo7uX1Gi/t1hAd0o=;
         b=SjaAkvdBDdVibd03e06s3XaioP2uHeUa9/xlT1zS9fgmCFOCbvJBVataJAGpXN7gIs
         lxOj00LeEkBXIY/pvp2zcQ43UdCdIA0tR3APLAH0Hr4F6d4X72OikQ9w/sFc/fZkrp29
         fXOVKvZfN4Rv6G5DABF4fKKvnoKeFUJyG0paaTQhX8U3aQ8fISVthQZo4h9cVR51lDC1
         i1KaAcXro1ANheZNu+mhtKlQlijVdao1/NIInTiyx/slPBrvKUQ4lw41ZgXk6EGZ72s/
         qfW/0w/McUJwzzjuJ//kamrhf5IX7JLNDH2FXA5Qnz9kDtVWaGdkEuqMDs7OrdgHWY9l
         J+MQ==
        X-Gm-Message-State: AHYfb5gsN72YFexL4AK3ziUIfLyyV7GE/xZop2gi6rYC+ad2/+TsJVqb
         PzDEg6vV3zBQLEeDvBtVOjVWbeyYBA==
        X-Received: by 10.28.207.77 with SMTP id f74mr3251733wmg.166.1502206663327;
         Tue, 08 Aug 2017 08:37:43 -0700 (PDT)
        MIME-Version: 1.0
        Sender: asomers@gmail.com
        Received: by 10.28.208.3 with HTTP; Tue, 8 Aug 2017 08:37:42 -0700 (PDT)
        In-Reply-To: <201708080459.v784xGvm089103@repo.freebsd.org>
        References: <201708080459.v784xGvm089103@repo.freebsd.org>
        From: Alan Somers 
        Date: Tue, 8 Aug 2017 09:37:42 -0600
        X-Google-Sender-Auth: bRmhaGVNx65__NTTqcntfrCbUBA
        Message-ID: 
        Subject: Re: svn commit: r322214 - in head/tests: etc/rc.d sys/acl sys/file
         sys/geom/class/eli sys/geom/class/gate sys/geom/class/mirror
         sys/geom/class/nop sys/geom/class/uzip sys/kern sys/kqueue/libkqueue sys/...
        To: Ngie Cooper 
        Cc: "src-committers@freebsd.org" , 
         "svn-src-all@freebsd.org" , 
         "svn-src-head@freebsd.org" 
        Content-Type: text/plain; charset="UTF-8"
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 15:37:46 -0000
        
        On Mon, Aug 7, 2017 at 10:59 PM, Ngie Cooper  wrote:
        > Author: ngie
        > Date: Tue Aug  8 04:59:16 2017
        > New Revision: 322214
        > URL: https://svnweb.freebsd.org/changeset/base/322214
        >
        > Log:
        >   Make test scripts under tests/... non-executable
        >
        >   Executable bits should be set at install time instead of in the repo.
        >   Setting executable bits on files triggers false positives with Phabricator.
        >
        >   MFC after:    2 months
        
        Thanks!  That was really annoying.
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 15:46:31 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F3DEDBF3FF;
         Tue,  8 Aug 2017 15:46:31 +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 mx1.freebsd.org (Postfix) with ESMTPS id D2FBD66F80;
         Tue,  8 Aug 2017 15:46:30 +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 v78FkTWH053762;
         Tue, 8 Aug 2017 15:46:29 GMT (envelope-from kib@FreeBSD.org)
        Received: (from kib@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78FkTr8053761;
         Tue, 8 Aug 2017 15:46:29 GMT (envelope-from kib@FreeBSD.org)
        Message-Id: <201708081546.v78FkTr8053761@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org
         using -f
        From: Konstantin Belousov 
        Date: Tue, 8 Aug 2017 15:46:29 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322256 - head/sys/dev/hwpmc
        X-SVN-Group: head
        X-SVN-Commit-Author: kib
        X-SVN-Commit-Paths: head/sys/dev/hwpmc
        X-SVN-Commit-Revision: 322256
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 15:46:31 -0000
        
        Author: kib
        Date: Tue Aug  8 15:46:29 2017
        New Revision: 322256
        URL: https://svnweb.freebsd.org/changeset/base/322256
        
        Log:
          Fix logic error in the the assert, causing the condition to be always true.
          
          Also improve the formatting of the corresponding KASSERT message.
          
          Based on the submission by:	Svyatoslav 
          Found by:	PVS-Studio
          PR:	217741
          Reviewed by:	emaste
          Sponsored by:	The FreeBSD Foundation (kib)
          MFC after:	1 week
        
        Modified:
          head/sys/dev/hwpmc/hwpmc_piv.c
        
        Modified: head/sys/dev/hwpmc/hwpmc_piv.c
        ==============================================================================
        --- head/sys/dev/hwpmc/hwpmc_piv.c	Tue Aug  8 15:37:21 2017	(r322255)
        +++ head/sys/dev/hwpmc/hwpmc_piv.c	Tue Aug  8 15:46:29 2017	(r322256)
        @@ -809,8 +809,8 @@ p4_config_pmc(int cpu, int ri, struct pmc *pm)
         	mtx_lock_spin(&pc->pc_mtx);
         	cfgflags = P4_PCPU_GET_CFGFLAGS(pc,ri);
         
        -	KASSERT(cfgflags >= 0 || cfgflags <= 3,
        -	    ("[p4,%d] illegal cfgflags cfg=%d on cpu=%d ri=%d", __LINE__,
        +	KASSERT((cfgflags & ~0x3) == 0,
        +	    ("[p4,%d] illegal cfgflags cfg=%#x on cpu=%d ri=%d", __LINE__,
         		cfgflags, cpu, ri));
         
         	KASSERT(cfgflags == 0 || phw->phw_pmc,
        @@ -835,8 +835,8 @@ p4_config_pmc(int cpu, int ri, struct pmc *pm)
         			phw->phw_pmc = NULL;
         	}
         
        -	KASSERT(cfgflags >= 0 || cfgflags <= 3,
        -	    ("[p4,%d] illegal runcount cfg=%d on cpu=%d ri=%d", __LINE__,
        +	KASSERT((cfgflags & ~0x3) == 0,
        +	    ("[p4,%d] illegal runcount cfg=%#x on cpu=%d ri=%d", __LINE__,
         		cfgflags, cpu, ri));
         
         	P4_PCPU_SET_CFGFLAGS(pc,ri,cfgflags);
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 15:54:58 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 417FEDBFCD9;
         Tue,  8 Aug 2017 15:54:58 +0000 (UTC)
         (envelope-from asomers@gmail.com)
        Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com
         [IPv6:2a00:1450:400c:c09::22d])
         (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
         (Client CN "smtp.gmail.com",
         Issuer "Google Internet Authority G2" (verified OK))
         by mx1.freebsd.org (Postfix) with ESMTPS id CDF5B67734;
         Tue,  8 Aug 2017 15:54:57 +0000 (UTC)
         (envelope-from asomers@gmail.com)
        Received: by mail-wm0-x22d.google.com with SMTP id m85so10927994wma.0;
         Tue, 08 Aug 2017 08:54:57 -0700 (PDT)
        DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
         h=mime-version:sender:in-reply-to:references:from:date:message-id
         :subject:to:cc;
         bh=r59vfEwSpV8HuaQHJI5uk0WH51BnEwLyYVk57jS6ru8=;
         b=dbdjcY6bP3c4e/lYjOQfcA/3nT2eeg7F8oKaOb8TaF27NhR/ybn8APiSxOQay5mjrP
         1qhIEnZJwQYnVC56GybUnEqI7DTba4oteVe40RrhJ/4ZsHngI+HPTVtWH6zbqW52xASs
         1hjdLmFlNMpOXfG/YXxhmzPDWJN9jM5VIL8wXiFppQm98t/ejQ8MXF+2GDFnMcWbBOwC
         pd32ElxPfF37oYBCGbdtsRpa7tb7bZlLuxRaeDdRDLBeULe3b45p+MOsi1Dx4ZDL2K9T
         7bTv+OXABo/887nOSE6ILaGYkX62xsKcnuoMkKhfUs/wEHP0P5umkA49+X6P/FbF7fnx
         qoVg==
        X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
         d=1e100.net; s=20161025;
         h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
         :date:message-id:subject:to:cc;
         bh=r59vfEwSpV8HuaQHJI5uk0WH51BnEwLyYVk57jS6ru8=;
         b=fK0l17qTADq2tHXkqkhucyBtOJXOuWx4BcvrQKoN9ZTlB3Gaim25wffRTSiORDXx68
         jTQ6LErTjT/H6PdncPIc8/5Ib3KGU2WYTCRTmFdEiZMts2z66XEX9MoFO3/2gfGNL+9G
         DpEPhq2nKjRLn313Xl0z5S933tvhv2k7V/tkgFB0J6ZQ/5XLMPpZn980Xy9TwgKPv1f9
         yybekX5EULiQ/ZTTDusUfOHjugZJYFGmfzm81ul14BDydUaaEd/npyBUrI/ccqJN6v3k
         82bWFYcwrSPipwVAAoJr2FpLeYVQUIzjT154UH0FKYs4G5jwK+MmExgC+IizJZd0l/eY
         cIdw==
        X-Gm-Message-State: AHYfb5hhtm8XQBhTb9O10zEjl4s9gKlsBzIv1Qh1Jbuc7PaDfQRogI0m
         6Gel5PqpICxNlDLyEQwYsZZSDP7uNw==
        X-Received: by 10.28.152.143 with SMTP id a137mr2874298wme.176.1502207695940; 
         Tue, 08 Aug 2017 08:54:55 -0700 (PDT)
        MIME-Version: 1.0
        Sender: asomers@gmail.com
        Received: by 10.28.208.3 with HTTP; Tue, 8 Aug 2017 08:54:55 -0700 (PDT)
        In-Reply-To: <201607082344.u68NiAcj026917@repo.freebsd.org>
        References: <201607082344.u68NiAcj026917@repo.freebsd.org>
        From: Alan Somers 
        Date: Tue, 8 Aug 2017 09:54:55 -0600
        X-Google-Sender-Auth: w67BqhUpB5ESk340_FIizwV63ck
        Message-ID: 
        Subject: Re: svn commit: r302474 - in head: cddl/lib/libdtrace
         tests/sys/netinet
        To: "George V. Neville-Neil" 
        Cc: "src-committers@freebsd.org" , 
         "svn-src-all@freebsd.org" , 
         "svn-src-head@freebsd.org" 
        Content-Type: text/plain; charset="UTF-8"
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 15:54:58 -0000
        
        On Fri, Jul 8, 2016 at 5:44 PM, George V. Neville-Neil  wrote:
        > Author: gnn
        > Date: Fri Jul  8 23:44:09 2016
        > New Revision: 302474
        > URL: https://svnweb.freebsd.org/changeset/base/302474
        >
        > Log:
        >   On FreeBSD there is a setsockopt option SO_USER_COOKIE which allows
        >   setting a 32 bit value on each socket. This can be used by applications
        >   and DTrace as a rendezvous point so that an applicaton's data can
        >   more easily be captured at run time. Expose the user cookie via
        >   DTrace by updating the translator in tcp.d and add a quick test
        >   program, a TCP server, that sets the cookie on each connection
        >   accepted.
        >
        >   Reviewed by:  hiren
        >   MFC after:    1 week
        >   Sponsored by: Limelight Networks
        >   Differential Revision:        https://reviews.freebsd.org/D7152
        
        I just noticed that the test program isn't hooked up to Kyua at all.
        Nothing will ever run it.  Is there supposed to be a short atf-sh
        script that invokes it?
        
        -Alan
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 16:06:17 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 637A1DC07BC;
         Tue,  8 Aug 2017 16:06:17 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2B07B67E42;
         Tue,  8 Aug 2017 16:06:17 +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 v78G6GZv062612;
         Tue, 8 Aug 2017 16:06:16 GMT (envelope-from imp@FreeBSD.org)
        Received: (from imp@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78G6GSI062611;
         Tue, 8 Aug 2017 16:06:16 GMT (envelope-from imp@FreeBSD.org)
        Message-Id: <201708081606.v78G6GSI062611@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org
         using -f
        From: Warner Losh 
        Date: Tue, 8 Aug 2017 16:06:16 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322257 - head/sys/dev/nvme
        X-SVN-Group: head
        X-SVN-Commit-Author: imp
        X-SVN-Commit-Paths: head/sys/dev/nvme
        X-SVN-Commit-Revision: 322257
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 16:06:17 -0000
        
        Author: imp
        Date: Tue Aug  8 16:06:16 2017
        New Revision: 322257
        URL: https://svnweb.freebsd.org/changeset/base/322257
        
        Log:
          Use the correct queue depth for nda devices.
          
          Submitted by: Matt Williams
        
        Modified:
          head/sys/dev/nvme/nvme_sim.c
        
        Modified: head/sys/dev/nvme/nvme_sim.c
        ==============================================================================
        --- head/sys/dev/nvme/nvme_sim.c	Tue Aug  8 15:46:29 2017	(r322256)
        +++ head/sys/dev/nvme/nvme_sim.c	Tue Aug  8 16:06:16 2017	(r322257)
        @@ -253,7 +253,7 @@ nvme_sim_new_controller(struct nvme_controller *ctrlr)
         	int unit;
         	struct nvme_sim_softc *sc = NULL;
         
        -	max_trans = 256;/* XXX not so simple -- must match queues */
        +	max_trans = ctrlr->num_io_queues;
         	unit = device_get_unit(ctrlr->dev);
         	devq = cam_simq_alloc(max_trans);
         	if (devq == NULL)
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 16:14:33 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58D76DC0D93;
         Tue,  8 Aug 2017 16:14:33 +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 mx1.freebsd.org (Postfix) with ESMTPS id 34F31683EB;
         Tue,  8 Aug 2017 16:14:33 +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 v78GEWl2066450;
         Tue, 8 Aug 2017 16:14:32 GMT (envelope-from asomers@FreeBSD.org)
        Received: (from asomers@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78GEVGY066448;
         Tue, 8 Aug 2017 16:14:31 GMT (envelope-from asomers@FreeBSD.org)
        Message-Id: <201708081614.v78GEVGY066448@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: asomers set sender to
         asomers@FreeBSD.org using -f
        From: Alan Somers 
        Date: Tue, 8 Aug 2017 16:14:31 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-head@freebsd.org
        Subject: svn commit: r322258 - head/sys/kern
        X-SVN-Group: head
        X-SVN-Commit-Author: asomers
        X-SVN-Commit-Paths: head/sys/kern
        X-SVN-Commit-Revision: 322258
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 16:14:33 -0000
        
        Author: asomers
        Date: Tue Aug  8 16:14:31 2017
        New Revision: 322258
        URL: https://svnweb.freebsd.org/changeset/base/322258
        
        Log:
          Make p1003_1b.aio_listio_max a tunable
          
          p1003_1b.aio_listio_max is now a tunable. Its value is reflected in the
          sysctl of the same name, and the sysconf(3) variable _SC_AIO_LISTIO_MAX.
          Its value will be bounded from below by the compile-time constant
          AIO_LISTIO_MAX and from above by the compile-time constant
          MAX_AIO_QUEUE_PER_PROC and the tunable vfs.aio.max_aio_queue.
          
          Reviewed by:	jhb, kib
          MFC after:	3 weeks
          Relnotes:	yes
          Sponsored by:	Spectra Logic Corp
          Differential Revision:	https://reviews.freebsd.org/D11601
        
        Modified:
          head/sys/kern/posix4_mib.c
          head/sys/kern/vfs_aio.c
        
        Modified: head/sys/kern/posix4_mib.c
        ==============================================================================
        --- head/sys/kern/posix4_mib.c	Tue Aug  8 16:06:16 2017	(r322257)
        +++ head/sys/kern/posix4_mib.c	Tue Aug  8 16:14:31 2017	(r322258)
        @@ -91,7 +91,6 @@ P1B_SYSCTL(CTL_P1003_1B_FSYNC, fsync);
         P1B_SYSCTL(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, shared_memory_objects);
         P1B_SYSCTL(CTL_P1003_1B_SYNCHRONIZED_IO, synchronized_io);
         P1B_SYSCTL(CTL_P1003_1B_TIMERS, timers);
        -P1B_SYSCTL(CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max);
         P1B_SYSCTL(CTL_P1003_1B_AIO_MAX, aio_max);
         P1B_SYSCTL(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, aio_prio_delta_max);
         P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max);
        
        Modified: head/sys/kern/vfs_aio.c
        ==============================================================================
        --- head/sys/kern/vfs_aio.c	Tue Aug  8 16:06:16 2017	(r322257)
        +++ head/sys/kern/vfs_aio.c	Tue Aug  8 16:14:31 2017	(r322258)
        @@ -102,6 +102,7 @@ static uint64_t jobseqno;
         #endif
         
         FEATURE(aio, "Asynchronous I/O");
        +SYSCTL_DECL(_p1003_1b);
         
         static MALLOC_DEFINE(M_LIO, "lio", "listio aio control block list");
         
        @@ -168,6 +169,11 @@ static int max_buf_aio = MAX_BUF_AIO;
         SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0,
             "Maximum buf aio requests per process (stored in the process)");
         
        +static int aio_listio_max = AIO_LISTIO_MAX;
        +SYSCTL_INT(_p1003_1b, CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max,
        +    CTLFLAG_RDTUN | CTLFLAG_CAPRD, &aio_listio_max, 0,
        +    "Maximum aio requests for a single lio_listio call");
        +
         #ifdef COMPAT_FREEBSD6
         typedef struct oaiocb {
         	int	aio_fildes;		/* File descriptor */
        @@ -388,6 +394,11 @@ static int
         aio_onceonly(void)
         {
         
        +	if (aio_listio_max < AIO_LISTIO_MAX)
        +		aio_listio_max = AIO_LISTIO_MAX;
        +	if (aio_listio_max > MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count))
        +		aio_listio_max = MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count);
        +
         	exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL,
         	    EVENTHANDLER_PRI_ANY);
         	exec_tag = EVENTHANDLER_REGISTER(process_exec, aio_proc_rundown_exec,
        @@ -405,14 +416,13 @@ aio_onceonly(void)
         	    NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
         	aiocb_zone = uma_zcreate("AIOCB", sizeof(struct kaiocb), NULL, NULL,
         	    NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
        -	aiol_zone = uma_zcreate("AIOL", AIO_LISTIO_MAX*sizeof(intptr_t) , NULL,
        -	    NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
        +	aiol_zone = uma_zcreate("AIOL", aio_listio_max * sizeof(intptr_t) ,
        +	    NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
         	aiolio_zone = uma_zcreate("AIOLIO", sizeof(struct aioliojob), NULL,
         	    NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
         	aiod_lifetime = AIOD_LIFETIME_DEFAULT;
         	jobrefid = 1;
         	p31b_setcfg(CTL_P1003_1B_ASYNCHRONOUS_IO, _POSIX_ASYNCHRONOUS_IO);
        -	p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, AIO_LISTIO_MAX);
         	p31b_setcfg(CTL_P1003_1B_AIO_MAX, MAX_AIO_QUEUE);
         	p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, 0);
         
        @@ -1943,7 +1953,7 @@ sys_aio_suspend(struct thread *td, struct aio_suspend_
         	struct aiocb **ujoblist;
         	int error;
         
        -	if (uap->nent < 0 || uap->nent > AIO_LISTIO_MAX)
        +	if (uap->nent < 0 || uap->nent > aio_listio_max)
         		return (EINVAL);
         
         	if (uap->timeout) {
        @@ -2151,7 +2161,7 @@ kern_lio_listio(struct thread *td, int mode, struct ai
         	if ((mode != LIO_NOWAIT) && (mode != LIO_WAIT))
         		return (EINVAL);
         
        -	if (nent < 0 || nent > AIO_LISTIO_MAX)
        +	if (nent < 0 || nent > aio_listio_max)
         		return (EINVAL);
         
         	if (p->p_aioinfo == NULL)
        @@ -2283,7 +2293,7 @@ freebsd6_lio_listio(struct thread *td, struct freebsd6
         		return (EINVAL);
         
         	nent = uap->nent;
        -	if (nent < 0 || nent > AIO_LISTIO_MAX)
        +	if (nent < 0 || nent > aio_listio_max)
         		return (EINVAL);
         
         	if (uap->sig && (uap->mode == LIO_NOWAIT)) {
        @@ -2320,7 +2330,7 @@ sys_lio_listio(struct thread *td, struct lio_listio_ar
         		return (EINVAL);
         
         	nent = uap->nent;
        -	if (nent < 0 || nent > AIO_LISTIO_MAX)
        +	if (nent < 0 || nent > aio_listio_max)
         		return (EINVAL);
         
         	if (uap->sig && (uap->mode == LIO_NOWAIT)) {
        @@ -2789,7 +2799,7 @@ freebsd32_aio_suspend(struct thread *td, struct freebs
         	uint32_t *ujoblist32;
         	int error, i;
         
        -	if (uap->nent < 0 || uap->nent > AIO_LISTIO_MAX)
        +	if (uap->nent < 0 || uap->nent > aio_listio_max)
         		return (EINVAL);
         
         	if (uap->timeout) {
        @@ -2915,7 +2925,7 @@ freebsd6_freebsd32_lio_listio(struct thread *td,
         		return (EINVAL);
         
         	nent = uap->nent;
        -	if (nent < 0 || nent > AIO_LISTIO_MAX)
        +	if (nent < 0 || nent > aio_listio_max)
         		return (EINVAL);
         
         	if (uap->sig && (uap->mode == LIO_NOWAIT)) {
        @@ -2961,7 +2971,7 @@ freebsd32_lio_listio(struct thread *td, struct freebsd
         		return (EINVAL);
         
         	nent = uap->nent;
        -	if (nent < 0 || nent > AIO_LISTIO_MAX)
        +	if (nent < 0 || nent > aio_listio_max)
         		return (EINVAL);
         
         	if (uap->sig && (uap->mode == LIO_NOWAIT)) {
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 16:52:58 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5111DC2F7D;
         Tue,  8 Aug 2017 16:52:58 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3EF7069A9A;
         Tue,  8 Aug 2017 16:52:58 +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 v78Gqvn2082492;
         Tue, 8 Aug 2017 16:52:57 GMT (envelope-from dim@FreeBSD.org)
        Received: (from dim@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Gqre2082459;
         Tue, 8 Aug 2017 16:52:53 GMT (envelope-from dim@FreeBSD.org)
        Message-Id: <201708081652.v78Gqre2082459@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org
         using -f
        From: Dimitry Andric 
        Date: Tue, 8 Aug 2017 16:52:53 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322259 - in vendor/llvm/dist: bindings/ocaml/llvm
         cmake/modules docs include/llvm/Analysis include/llvm/CodeGen lib/Analysis
         lib/CodeGen lib/CodeGen/SelectionDAG lib/IR lib/Object lib/...
        X-SVN-Group: vendor
        X-SVN-Commit-Author: dim
        X-SVN-Commit-Paths: in vendor/llvm/dist: bindings/ocaml/llvm cmake/modules
         docs include/llvm/Analysis include/llvm/CodeGen lib/Analysis lib/CodeGen
         lib/CodeGen/SelectionDAG lib/IR lib/Object lib/Target/AArch64 lib/Target...
        X-SVN-Commit-Revision: 322259
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 16:52:58 -0000
        
        Author: dim
        Date: Tue Aug  8 16:52:53 2017
        New Revision: 322259
        URL: https://svnweb.freebsd.org/changeset/base/322259
        
        Log:
          Vendor import of llvm release_50 branch r310316:
          https://llvm.org/svn/llvm-project/llvm/branches/release_50@310316
        
        Added:
          vendor/llvm/dist/test/CodeGen/Mips/cconv/pr33883.ll
          vendor/llvm/dist/test/CodeGen/Mips/pr33978.ll
          vendor/llvm/dist/test/CodeGen/X86/conditional-tailcall-samedest.mir
          vendor/llvm/dist/test/CodeGen/X86/pause.ll
          vendor/llvm/dist/test/CodeGen/X86/tail-call-mutable-memarg.ll
          vendor/llvm/dist/test/Instrumentation/AddressSanitizer/force-dynamic-shadow.ll
          vendor/llvm/dist/test/Transforms/InstSimplify/pr33957.ll
          vendor/llvm/dist/test/Transforms/SCCP/definite-initializer.ll
        Modified:
          vendor/llvm/dist/bindings/ocaml/llvm/llvm.ml
          vendor/llvm/dist/bindings/ocaml/llvm/llvm.mli
          vendor/llvm/dist/bindings/ocaml/llvm/llvm_ocaml.c
          vendor/llvm/dist/cmake/modules/AddOCaml.cmake
          vendor/llvm/dist/docs/ReleaseNotes.rst
          vendor/llvm/dist/include/llvm/Analysis/ValueTracking.h
          vendor/llvm/dist/include/llvm/CodeGen/MachineFunction.h
          vendor/llvm/dist/include/llvm/CodeGen/MachineInstr.h
          vendor/llvm/dist/lib/Analysis/ValueTracking.cpp
          vendor/llvm/dist/lib/CodeGen/BranchFolding.cpp
          vendor/llvm/dist/lib/CodeGen/MachineFunction.cpp
          vendor/llvm/dist/lib/CodeGen/MachineInstr.cpp
          vendor/llvm/dist/lib/CodeGen/ScheduleDAGInstrs.cpp
          vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
          vendor/llvm/dist/lib/CodeGen/StackColoring.cpp
          vendor/llvm/dist/lib/IR/ConstantFold.cpp
          vendor/llvm/dist/lib/Object/COFFImportFile.cpp
          vendor/llvm/dist/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
          vendor/llvm/dist/lib/Target/AArch64/AArch64FrameLowering.cpp
          vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp
          vendor/llvm/dist/lib/Target/AArch64/AArch64InstrInfo.td
          vendor/llvm/dist/lib/Target/AArch64/AArch64MacroFusion.cpp
          vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp
          vendor/llvm/dist/lib/Target/X86/X86InstrSSE.td
          vendor/llvm/dist/lib/Transforms/IPO/ArgumentPromotion.cpp
          vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp
          vendor/llvm/dist/lib/Transforms/Scalar/SCCP.cpp
          vendor/llvm/dist/lib/Transforms/Utils/CloneModule.cpp
          vendor/llvm/dist/test/CodeGen/AArch64/aarch64_win64cc_vararg.ll
          vendor/llvm/dist/test/CodeGen/AArch64/misched-fusion-aes.ll
          vendor/llvm/dist/test/CodeGen/AArch64/tbi.ll
          vendor/llvm/dist/test/CodeGen/AArch64/win64_vararg.ll
          vendor/llvm/dist/test/DllTool/coff-weak-exports.def
          vendor/llvm/dist/test/Instrumentation/AddressSanitizer/stack-poisoning-byval-args.ll
          vendor/llvm/dist/test/MC/AArch64/arm64-crypto.s
          vendor/llvm/dist/test/Transforms/ArgumentPromotion/byval.ll
          vendor/llvm/dist/unittests/Transforms/Utils/Cloning.cpp
        
        Modified: vendor/llvm/dist/bindings/ocaml/llvm/llvm.ml
        ==============================================================================
        --- vendor/llvm/dist/bindings/ocaml/llvm/llvm.ml	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/bindings/ocaml/llvm/llvm.ml	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -20,6 +20,10 @@ type llattribute
         type llmemorybuffer
         type llmdkind
         
        +exception FeatureDisabled of string
        +
        +let () = Callback.register_exception "Llvm.FeatureDisabled" (FeatureDisabled "")
        +
         module TypeKind = struct
           type t =
           | Void
        
        Modified: vendor/llvm/dist/bindings/ocaml/llvm/llvm.mli
        ==============================================================================
        --- vendor/llvm/dist/bindings/ocaml/llvm/llvm.mli	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/bindings/ocaml/llvm/llvm.mli	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -371,6 +371,8 @@ type ('a, 'b) llrev_pos =
         
         (** {6 Exceptions} *)
         
        +exception FeatureDisabled of string
        +
         exception IoError of string
         
         
        
        Modified: vendor/llvm/dist/bindings/ocaml/llvm/llvm_ocaml.c
        ==============================================================================
        --- vendor/llvm/dist/bindings/ocaml/llvm/llvm_ocaml.c	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/bindings/ocaml/llvm/llvm_ocaml.c	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -336,7 +336,12 @@ CAMLprim LLVMContextRef llvm_type_context(LLVMTypeRef 
         
         /* lltype -> unit */
         CAMLprim value llvm_dump_type(LLVMTypeRef Val) {
        +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
           LLVMDumpType(Val);
        +#else
        +  caml_raise_with_arg(*caml_named_value("Llvm.FeatureDisabled"),
        +      caml_copy_string("dump"));
        +#endif
           return Val_unit;
         }
         
        
        Modified: vendor/llvm/dist/cmake/modules/AddOCaml.cmake
        ==============================================================================
        --- vendor/llvm/dist/cmake/modules/AddOCaml.cmake	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/cmake/modules/AddOCaml.cmake	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -87,6 +87,11 @@ function(add_ocaml_library name)
           foreach( include_dir ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR} )
             set(c_flags "${c_flags} -I${include_dir}")
           endforeach()
        +  # include -D/-UNDEBUG to match dump function visibility
        +  # regex from HandleLLVMOptions.cmake
        +  string(REGEX MATCH "(^| )[/-][UD] *NDEBUG($| )" flag_matches
        +         "${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${CMAKE_C_FLAGS}")
        +  set(c_flags "${c_flags} ${flag_matches}")
         
           foreach( ocaml_file ${ARG_OCAML} )
             list(APPEND sources "${ocaml_file}.mli" "${ocaml_file}.ml")
        @@ -199,7 +204,7 @@ function(add_ocaml_library name)
                   PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
                               GROUP_READ GROUP_EXECUTE
                               WORLD_READ WORLD_EXECUTE
        -          DESTINATION "${LLVM_OCAML_INSTALL_PATH}/llvm")
        +          DESTINATION "${LLVM_OCAML_INSTALL_PATH}/stublibs")
         
           foreach( install_file ${install_files} ${install_shlibs} )
             get_filename_component(filename "${install_file}" NAME)
        
        Modified: vendor/llvm/dist/docs/ReleaseNotes.rst
        ==============================================================================
        --- vendor/llvm/dist/docs/ReleaseNotes.rst	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/docs/ReleaseNotes.rst	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -125,7 +125,22 @@ Changes to the AMDGPU Target
         Changes to the AVR Target
         -----------------------------
         
        - During this release ...
        +This release consists mainly of bugfixes and implementations of features
        +required for compiling basic Rust programs.
        +
        +* Enable the branch relaxation pass so that we don't crash on large
        +  stack load/stores
        +
        +* Add support for lowering bit-rotations to the native `ror` and `rol`
        +  instructions
        +
        +* Fix bug where function pointers were treated as pointers to RAM and not
        +  pointers to program memory
        +
        +* Fix broken code generaton for shift-by-variable expressions
        +
        +* Support zero-sized types in argument lists; this is impossible in C,
        +  but possible in Rust
         
         Changes to the OCaml bindings
         -----------------------------
        
        Modified: vendor/llvm/dist/include/llvm/Analysis/ValueTracking.h
        ==============================================================================
        --- vendor/llvm/dist/include/llvm/Analysis/ValueTracking.h	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/include/llvm/Analysis/ValueTracking.h	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -312,6 +312,12 @@ template  class ArrayRef;
                                     const DataLayout &DL, LoopInfo *LI = nullptr,
                                     unsigned MaxLookup = 6);
         
        +  /// This is a wrapper around GetUnderlyingObjects and adds support for basic
        +  /// ptrtoint+arithmetic+inttoptr sequences.
        +  void getUnderlyingObjectsForCodeGen(const Value *V,
        +                            SmallVectorImpl &Objects,
        +                            const DataLayout &DL);
        +
           /// Return true if the only users of this pointer are lifetime markers.
           bool onlyUsedByLifetimeMarkers(const Value *V);
         
        
        Modified: vendor/llvm/dist/include/llvm/CodeGen/MachineFunction.h
        ==============================================================================
        --- vendor/llvm/dist/include/llvm/CodeGen/MachineFunction.h	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/include/llvm/CodeGen/MachineFunction.h	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -661,6 +661,12 @@ class MachineFunction { (public)
           MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO,
                                                   int64_t Offset, uint64_t Size);
         
        +  /// Allocate a new MachineMemOperand by copying an existing one,
        +  /// replacing only AliasAnalysis information. MachineMemOperands are owned
        +  /// by the MachineFunction and need not be explicitly deallocated.
        +  MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO,
        +                                          const AAMDNodes &AAInfo);
        +
           using OperandCapacity = ArrayRecycler::Capacity;
         
           /// Allocate an array of MachineOperands. This is only intended for use by
        
        Modified: vendor/llvm/dist/include/llvm/CodeGen/MachineInstr.h
        ==============================================================================
        --- vendor/llvm/dist/include/llvm/CodeGen/MachineInstr.h	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/include/llvm/CodeGen/MachineInstr.h	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -379,6 +379,9 @@ class MachineInstr (public)
             return NumMemRefs == 1;
           }
         
        +  /// Return the number of memory operands.
        +  unsigned getNumMemOperands() const { return NumMemRefs; }
        +
           /// API for querying MachineInstr properties. They are the same as MCInstrDesc
           /// queries but they are bundle aware.
         
        
        Modified: vendor/llvm/dist/lib/Analysis/ValueTracking.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/Analysis/ValueTracking.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/Analysis/ValueTracking.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -3277,6 +3277,69 @@ void llvm::GetUnderlyingObjects(Value *V, SmallVectorI
           } while (!Worklist.empty());
         }
         
        +/// This is the function that does the work of looking through basic
        +/// ptrtoint+arithmetic+inttoptr sequences.
        +static const Value *getUnderlyingObjectFromInt(const Value *V) {
        +  do {
        +    if (const Operator *U = dyn_cast(V)) {
        +      // If we find a ptrtoint, we can transfer control back to the
        +      // regular getUnderlyingObjectFromInt.
        +      if (U->getOpcode() == Instruction::PtrToInt)
        +        return U->getOperand(0);
        +      // If we find an add of a constant, a multiplied value, or a phi, it's
        +      // likely that the other operand will lead us to the base
        +      // object. We don't have to worry about the case where the
        +      // object address is somehow being computed by the multiply,
        +      // because our callers only care when the result is an
        +      // identifiable object.
        +      if (U->getOpcode() != Instruction::Add ||
        +          (!isa(U->getOperand(1)) &&
        +           Operator::getOpcode(U->getOperand(1)) != Instruction::Mul &&
        +           !isa(U->getOperand(1))))
        +        return V;
        +      V = U->getOperand(0);
        +    } else {
        +      return V;
        +    }
        +    assert(V->getType()->isIntegerTy() && "Unexpected operand type!");
        +  } while (true);
        +}
        +
        +/// This is a wrapper around GetUnderlyingObjects and adds support for basic
        +/// ptrtoint+arithmetic+inttoptr sequences.
        +void llvm::getUnderlyingObjectsForCodeGen(const Value *V,
        +                          SmallVectorImpl &Objects,
        +                          const DataLayout &DL) {
        +  SmallPtrSet Visited;
        +  SmallVector Working(1, V);
        +  do {
        +    V = Working.pop_back_val();
        +
        +    SmallVector Objs;
        +    GetUnderlyingObjects(const_cast(V), Objs, DL);
        +
        +    for (Value *V : Objs) {
        +      if (!Visited.insert(V).second)
        +        continue;
        +      if (Operator::getOpcode(V) == Instruction::IntToPtr) {
        +        const Value *O =
        +          getUnderlyingObjectFromInt(cast(V)->getOperand(0));
        +        if (O->getType()->isPointerTy()) {
        +          Working.push_back(O);
        +          continue;
        +        }
        +      }
        +      // If GetUnderlyingObjects fails to find an identifiable object,
        +      // getUnderlyingObjectsForCodeGen also fails for safety.
        +      if (!isIdentifiedObject(V)) {
        +        Objects.clear();
        +        return;
        +      }
        +      Objects.push_back(const_cast(V));
        +    }
        +  } while (!Working.empty());
        +}
        +
         /// Return true if the only users of this pointer are lifetime markers.
         bool llvm::onlyUsedByLifetimeMarkers(const Value *V) {
           for (const User *U : V->users()) {
        
        Modified: vendor/llvm/dist/lib/CodeGen/BranchFolding.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/CodeGen/BranchFolding.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/CodeGen/BranchFolding.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -1475,13 +1475,14 @@ ReoptimizeBlock:
               bool PredAnalyzable =
                   !TII->analyzeBranch(*Pred, PredTBB, PredFBB, PredCond, true);
         
        -      if (PredAnalyzable && !PredCond.empty() && PredTBB == MBB) {
        +      if (PredAnalyzable && !PredCond.empty() && PredTBB == MBB &&
        +          PredTBB != PredFBB) {
                 // The predecessor has a conditional branch to this block which consists
                 // of only a tail call. Try to fold the tail call into the conditional
                 // branch.
                 if (TII->canMakeTailCallConditional(PredCond, TailCall)) {
                   // TODO: It would be nice if analyzeBranch() could provide a pointer
        -          // to the branch insturction so replaceBranchWithTailCall() doesn't
        +          // to the branch instruction so replaceBranchWithTailCall() doesn't
                   // have to search for it.
                   TII->replaceBranchWithTailCall(*Pred, PredCond, TailCall);
                   ++NumTailCalls;
        
        Modified: vendor/llvm/dist/lib/CodeGen/MachineFunction.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/CodeGen/MachineFunction.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/CodeGen/MachineFunction.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -330,6 +330,20 @@ MachineFunction::getMachineMemOperand(const MachineMem
                                        MMO->getOrdering(), MMO->getFailureOrdering());
         }
         
        +MachineMemOperand *
        +MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
        +                                      const AAMDNodes &AAInfo) {
        +  MachinePointerInfo MPI = MMO->getValue() ?
        +             MachinePointerInfo(MMO->getValue(), MMO->getOffset()) :
        +             MachinePointerInfo(MMO->getPseudoValue(), MMO->getOffset());
        +
        +  return new (Allocator)
        +             MachineMemOperand(MPI, MMO->getFlags(), MMO->getSize(),
        +                               MMO->getBaseAlignment(), AAInfo,
        +                               MMO->getRanges(), MMO->getSyncScopeID(),
        +                               MMO->getOrdering(), MMO->getFailureOrdering());
        +}
        +
         MachineInstr::mmo_iterator
         MachineFunction::allocateMemRefsArray(unsigned long Num) {
           return Allocator.Allocate(Num);
        
        Modified: vendor/llvm/dist/lib/CodeGen/MachineInstr.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/CodeGen/MachineInstr.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/CodeGen/MachineInstr.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -578,10 +578,8 @@ bool MachinePointerInfo::isDereferenceable(unsigned Si
           if (BasePtr == nullptr)
             return false;
         
        -  return isDereferenceableAndAlignedPointer(BasePtr, 1,
        -                                            APInt(DL.getPointerSize(),
        -                                                  Offset + Size),
        -                                            DL);
        +  return isDereferenceableAndAlignedPointer(
        +      BasePtr, 1, APInt(DL.getPointerSizeInBits(), Offset + Size), DL);
         }
         
         /// getConstantPool - Return a MachinePointerInfo record that refers to the
        
        Modified: vendor/llvm/dist/lib/CodeGen/ScheduleDAGInstrs.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/CodeGen/ScheduleDAGInstrs.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/CodeGen/ScheduleDAGInstrs.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -121,63 +121,6 @@ ScheduleDAGInstrs::ScheduleDAGInstrs(MachineFunction &
           SchedModel.init(ST.getSchedModel(), &ST, TII);
         }
         
        -/// This is the function that does the work of looking through basic
        -/// ptrtoint+arithmetic+inttoptr sequences.
        -static const Value *getUnderlyingObjectFromInt(const Value *V) {
        -  do {
        -    if (const Operator *U = dyn_cast(V)) {
        -      // If we find a ptrtoint, we can transfer control back to the
        -      // regular getUnderlyingObjectFromInt.
        -      if (U->getOpcode() == Instruction::PtrToInt)
        -        return U->getOperand(0);
        -      // If we find an add of a constant, a multiplied value, or a phi, it's
        -      // likely that the other operand will lead us to the base
        -      // object. We don't have to worry about the case where the
        -      // object address is somehow being computed by the multiply,
        -      // because our callers only care when the result is an
        -      // identifiable object.
        -      if (U->getOpcode() != Instruction::Add ||
        -          (!isa(U->getOperand(1)) &&
        -           Operator::getOpcode(U->getOperand(1)) != Instruction::Mul &&
        -           !isa(U->getOperand(1))))
        -        return V;
        -      V = U->getOperand(0);
        -    } else {
        -      return V;
        -    }
        -    assert(V->getType()->isIntegerTy() && "Unexpected operand type!");
        -  } while (true);
        -}
        -
        -/// This is a wrapper around GetUnderlyingObjects and adds support for basic
        -/// ptrtoint+arithmetic+inttoptr sequences.
        -static void getUnderlyingObjects(const Value *V,
        -                                 SmallVectorImpl &Objects,
        -                                 const DataLayout &DL) {
        -  SmallPtrSet Visited;
        -  SmallVector Working(1, V);
        -  do {
        -    V = Working.pop_back_val();
        -
        -    SmallVector Objs;
        -    GetUnderlyingObjects(const_cast(V), Objs, DL);
        -
        -    for (Value *V : Objs) {
        -      if (!Visited.insert(V).second)
        -        continue;
        -      if (Operator::getOpcode(V) == Instruction::IntToPtr) {
        -        const Value *O =
        -          getUnderlyingObjectFromInt(cast(V)->getOperand(0));
        -        if (O->getType()->isPointerTy()) {
        -          Working.push_back(O);
        -          continue;
        -        }
        -      }
        -      Objects.push_back(const_cast(V));
        -    }
        -  } while (!Working.empty());
        -}
        -
         /// If this machine instr has memory reference information and it can be tracked
         /// to a normal reference to a known object, return the Value for that object.
         static void getUnderlyingObjectsForInstr(const MachineInstr *MI,
        @@ -208,12 +151,10 @@ static void getUnderlyingObjectsForInstr(const Machine
                 Objects.push_back(UnderlyingObjectsVector::value_type(PSV, MayAlias));
               } else if (const Value *V = MMO->getValue()) {
                 SmallVector Objs;
        -        getUnderlyingObjects(V, Objs, DL);
        +        getUnderlyingObjectsForCodeGen(V, Objs, DL);
         
                 for (Value *V : Objs) {
        -          if (!isIdentifiedObject(V))
        -            return false;
        -
        +          assert(isIdentifiedObject(V));
                   Objects.push_back(UnderlyingObjectsVector::value_type(V, true));
                 }
               } else
        
        Modified: vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -99,6 +99,27 @@ LimitFPPrecision("limit-float-precision",
         // store [4096 x i8] %data, [4096 x i8]* %buffer
         static const unsigned MaxParallelChains = 64;
         
        +// True if the Value passed requires ABI mangling as it is a parameter to a
        +// function or a return value from a function which is not an intrinsic.
        +static bool isABIRegCopy(const Value * V) {
        +  const bool IsRetInst = V && isa(V);
        +  const bool IsCallInst = V && isa(V);
        +  const bool IsInLineAsm =
        +      IsCallInst && static_cast(V)->isInlineAsm();
        +  const bool IsIndirectFunctionCall =
        +      IsCallInst && !IsInLineAsm &&
        +      !static_cast(V)->getCalledFunction();
        +  // It is possible that the call instruction is an inline asm statement or an
        +  // indirect function call in which case the return value of
        +  // getCalledFunction() would be nullptr.
        +  const bool IsInstrinsicCall =
        +      IsCallInst && !IsInLineAsm && !IsIndirectFunctionCall &&
        +      static_cast(V)->getCalledFunction()->getIntrinsicID() !=
        +          Intrinsic::not_intrinsic;
        +
        +  return IsRetInst || (IsCallInst && (!IsInLineAsm && !IsInstrinsicCall));
        +}
        +
         static SDValue getCopyFromPartsVector(SelectionDAG &DAG, const SDLoc &DL,
                                               const SDValue *Parts, unsigned NumParts,
                                               MVT PartVT, EVT ValueVT, const Value *V,
        @@ -1026,13 +1047,9 @@ SDValue SelectionDAGBuilder::getCopyFromRegs(const Val
         
           if (It != FuncInfo.ValueMap.end()) {
             unsigned InReg = It->second;
        -    bool IsABIRegCopy =
        -        V && ((isa(V) &&
        -               !(static_cast(V))->isInlineAsm()) ||
        -              isa(V));
         
             RegsForValue RFV(*DAG.getContext(), DAG.getTargetLoweringInfo(),
        -                     DAG.getDataLayout(), InReg, Ty, IsABIRegCopy);
        +                     DAG.getDataLayout(), InReg, Ty, isABIRegCopy(V));
             SDValue Chain = DAG.getEntryNode();
             Result = RFV.getCopyFromRegs(DAG, FuncInfo, getCurSDLoc(), Chain, nullptr,
                                          V);
        @@ -1221,13 +1238,9 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value 
           // If this is an instruction which fast-isel has deferred, select it now.
           if (const Instruction *Inst = dyn_cast(V)) {
             unsigned InReg = FuncInfo.InitializeRegForValue(Inst);
        -    bool IsABIRegCopy =
        -        V && ((isa(V) &&
        -               !(static_cast(V))->isInlineAsm()) ||
        -              isa(V));
         
             RegsForValue RFV(*DAG.getContext(), TLI, DAG.getDataLayout(), InReg,
        -                     Inst->getType(), IsABIRegCopy);
        +                     Inst->getType(), isABIRegCopy(V));
             SDValue Chain = DAG.getEntryNode();
             return RFV.getCopyFromRegs(DAG, FuncInfo, getCurSDLoc(), Chain, nullptr, V);
           }
        @@ -8281,13 +8294,9 @@ SelectionDAGBuilder::CopyValueToVirtualRegister(const 
           const TargetLowering &TLI = DAG.getTargetLoweringInfo();
           // If this is an InlineAsm we have to match the registers required, not the
           // notional registers required by the type.
        -  bool IsABIRegCopy =
        -    V && ((isa(V) &&
        -           !(static_cast(V))->isInlineAsm()) ||
        -          isa(V));
         
           RegsForValue RFV(V->getContext(), TLI, DAG.getDataLayout(), Reg,
        -                   V->getType(), IsABIRegCopy);
        +                   V->getType(), isABIRegCopy(V));
           SDValue Chain = DAG.getEntryNode();
         
           ISD::NodeType ExtendType = (FuncInfo.PreferredExtendType.find(V) ==
        
        Modified: vendor/llvm/dist/lib/CodeGen/StackColoring.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/CodeGen/StackColoring.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/CodeGen/StackColoring.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -37,6 +37,7 @@
         #include "llvm/CodeGen/MachineRegisterInfo.h"
         #include "llvm/CodeGen/Passes.h"
         #include "llvm/CodeGen/PseudoSourceValue.h"
        +#include "llvm/CodeGen/SelectionDAGNodes.h"
         #include "llvm/CodeGen/SlotIndexes.h"
         #include "llvm/CodeGen/StackProtector.h"
         #include "llvm/CodeGen/WinEHFuncInfo.h"
        @@ -889,6 +890,10 @@ void StackColoring::remapInstructions(DenseMap Allocas;
        +
        +  // Keep a list of allocas which has been affected by the remap.
        +  SmallPtrSet MergedAllocas;
        +
           for (const std::pair &SI : SlotRemap) {
             const AllocaInst *From = MFI->getObjectAllocation(SI.first);
             const AllocaInst *To = MFI->getObjectAllocation(SI.second);
        @@ -908,6 +913,10 @@ void StackColoring::remapInstructions(DenseMapadjustForColoring(From, To);
        @@ -939,13 +948,6 @@ void StackColoring::remapInstructions(DenseMap(MMO->getValue());
        @@ -997,6 +999,48 @@ void StackColoring::remapInstructions(DenseMapallocateMemRefsArray(I.getNumMemOperands());
        +      unsigned MemOpIdx = 0;
        +      bool ReplaceMemOps = false;
        +      for (MachineMemOperand *MMO : I.memoperands()) {
        +        // If this memory location can be a slot remapped here,
        +        // we remove AA information.
        +        bool MayHaveConflictingAAMD = false;
        +        if (MMO->getAAInfo()) {
        +          if (const Value *MMOV = MMO->getValue()) {
        +            SmallVector Objs;
        +            getUnderlyingObjectsForCodeGen(MMOV, Objs, MF->getDataLayout());
        +
        +            if (Objs.empty())
        +              MayHaveConflictingAAMD = true;
        +            else
        +              for (Value *V : Objs) {
        +                // If this memory location comes from a known stack slot
        +                // that is not remapped, we continue checking.
        +                // Otherwise, we need to invalidate AA infomation.
        +                const AllocaInst *AI = dyn_cast_or_null(V);
        +                if (AI && MergedAllocas.count(AI)) {
        +                  MayHaveConflictingAAMD = true;
        +                  break;
        +                }
        +              }
        +          }
        +        }
        +        if (MayHaveConflictingAAMD) {
        +          NewMemOps[MemOpIdx++] = MF->getMachineMemOperand(MMO, AAMDNodes());
        +          ReplaceMemOps = true;
        +        }
        +        else
        +          NewMemOps[MemOpIdx++] = MMO;
        +      }
        +
        +      // If any memory operand is updated, set memory references of
        +      // this instruction.
        +      if (ReplaceMemOps)
        +        I.setMemRefs(std::make_pair(NewMemOps, I.getNumMemOperands()));
             }
         
           // Update the location of C++ catch objects for the MSVC personality routine.
        
        Modified: vendor/llvm/dist/lib/IR/ConstantFold.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/IR/ConstantFold.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/IR/ConstantFold.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -2097,15 +2097,19 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *Pointe
               // Subsequent evaluation would get confused and produce erroneous results.
               //
               // The following prohibits such a GEP from being formed by checking to see
        -      // if the index is in-range with respect to an array or vector.
        +      // if the index is in-range with respect to an array.
        +      // TODO: This code may be extended to handle vectors as well.
               bool PerformFold = false;
               if (Idx0->isNullValue())
                 PerformFold = true;
               else if (LastI.isSequential())
                 if (ConstantInt *CI = dyn_cast(Idx0))
        -          PerformFold =
        -              !LastI.isBoundedSequential() ||
        -              isIndexInRangeOfArrayType(LastI.getSequentialNumElements(), CI);
        +          PerformFold = (!LastI.isBoundedSequential() ||
        +                         isIndexInRangeOfArrayType(
        +                             LastI.getSequentialNumElements(), CI)) &&
        +                        !CE->getOperand(CE->getNumOperands() - 1)
        +                             ->getType()
        +                             ->isVectorTy();
         
               if (PerformFold) {
                 SmallVector NewIndices;
        
        Modified: vendor/llvm/dist/lib/Object/COFFImportFile.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/Object/COFFImportFile.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/Object/COFFImportFile.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -542,15 +542,12 @@ NewArchiveMember ObjectFactory::createWeakExternal(Str
           SymbolTable[2].Name.Offset.Offset = sizeof(uint32_t);
         
           //__imp_ String Table
        -  if (Imp) {
        -    SymbolTable[3].Name.Offset.Offset = sizeof(uint32_t) + Sym.size() + 7;
        -    writeStringTable(Buffer, {std::string("__imp_").append(Sym),
        -                              std::string("__imp_").append(Weak)});
        -  } else {
        -    SymbolTable[3].Name.Offset.Offset = sizeof(uint32_t) + Sym.size() + 1;
        -    writeStringTable(Buffer, {Sym, Weak});
        -  }
        +  StringRef Prefix = Imp ? "__imp_" : "";
        +  SymbolTable[3].Name.Offset.Offset =
        +      sizeof(uint32_t) + Sym.size() + Prefix.size() + 1;
           append(Buffer, SymbolTable);
        +  writeStringTable(Buffer, {(Prefix + Sym).str(),
        +                            (Prefix + Weak).str()});
         
           // Copied here so we can still use writeStringTable
           char *Buf = Alloc.Allocate(Buffer.size());
        
        Modified: vendor/llvm/dist/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -946,6 +946,18 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock &
           case AArch64::CMP_SWAP_128:
             return expandCMP_SWAP_128(MBB, MBBI, NextMBBI);
         
        +  case AArch64::AESMCrrTied:
        +  case AArch64::AESIMCrrTied: {
        +    MachineInstrBuilder MIB =
        +    BuildMI(MBB, MBBI, MI.getDebugLoc(),
        +            TII->get(Opcode == AArch64::AESMCrrTied ? AArch64::AESMCrr :
        +                                                      AArch64::AESIMCrr))
        +      .add(MI.getOperand(0))
        +      .add(MI.getOperand(1));
        +    transferImpOps(MI, MIB, MIB);
        +    MI.eraseFromParent();
        +    return true;
        +   }
           }
           return false;
         }
        
        Modified: vendor/llvm/dist/lib/Target/AArch64/AArch64FrameLowering.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/Target/AArch64/AArch64FrameLowering.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/Target/AArch64/AArch64FrameLowering.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -506,19 +506,23 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio
             return;
           }
         
        -  auto CSStackSize = AFI->getCalleeSavedStackSize();
        +  bool IsWin64 =
        +      Subtarget.isCallingConvWin64(MF.getFunction()->getCallingConv());
        +  unsigned FixedObject = IsWin64 ? alignTo(AFI->getVarArgsGPRSize(), 16) : 0;
        +
        +  auto PrologueSaveSize = AFI->getCalleeSavedStackSize() + FixedObject;
           // All of the remaining stack allocations are for locals.
        -  AFI->setLocalStackSize(NumBytes - CSStackSize);
        +  AFI->setLocalStackSize(NumBytes - PrologueSaveSize);
         
           bool CombineSPBump = shouldCombineCSRLocalStackBump(MF, NumBytes);
           if (CombineSPBump) {
             emitFrameOffset(MBB, MBBI, DL, AArch64::SP, AArch64::SP, -NumBytes, TII,
                             MachineInstr::FrameSetup);
             NumBytes = 0;
        -  } else if (CSStackSize != 0) {
        +  } else if (PrologueSaveSize != 0) {
             MBBI = convertCalleeSaveRestoreToSPPrePostIncDec(MBB, MBBI, DL, TII,
        -                                                     -CSStackSize);
        -    NumBytes -= CSStackSize;
        +                                                     -PrologueSaveSize);
        +    NumBytes -= PrologueSaveSize;
           }
           assert(NumBytes >= 0 && "Negative stack allocation size!?");
         
        @@ -532,8 +536,9 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio
             ++MBBI;
           }
           if (HasFP) {
        -    // Only set up FP if we actually need to. Frame pointer is fp = sp - 16.
        -    int FPOffset = CSStackSize - 16;
        +    // Only set up FP if we actually need to. Frame pointer is fp =
        +    // sp - fixedobject - 16.
        +    int FPOffset = AFI->getCalleeSavedStackSize() - 16;
             if (CombineSPBump)
               FPOffset += AFI->getLocalStackSize();
         
        @@ -672,8 +677,8 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio
             if (HasFP) {
               // Define the current CFA rule to use the provided FP.
               unsigned Reg = RegInfo->getDwarfRegNum(FramePtr, true);
        -      unsigned CFIIndex = MF.addFrameInst(
        -          MCCFIInstruction::createDefCfa(nullptr, Reg, 2 * StackGrowth));
        +      unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa(
        +          nullptr, Reg, 2 * StackGrowth - FixedObject));
               BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
                   .addCFIIndex(CFIIndex)
                   .setMIFlags(MachineInstr::FrameSetup);
        @@ -759,12 +764,16 @@ void AArch64FrameLowering::emitEpilogue(MachineFunctio
           // AArch64TargetLowering::LowerCall figures out ArgumentPopSize and keeps
           // it as the 2nd argument of AArch64ISD::TC_RETURN.
         
        -  auto CSStackSize = AFI->getCalleeSavedStackSize();
        +  bool IsWin64 =
        +      Subtarget.isCallingConvWin64(MF.getFunction()->getCallingConv());
        +  unsigned FixedObject = IsWin64 ? alignTo(AFI->getVarArgsGPRSize(), 16) : 0;
        +
        +  auto PrologueSaveSize = AFI->getCalleeSavedStackSize() + FixedObject;
           bool CombineSPBump = shouldCombineCSRLocalStackBump(MF, NumBytes);
         
        -  if (!CombineSPBump && CSStackSize != 0)
        +  if (!CombineSPBump && PrologueSaveSize != 0)
             convertCalleeSaveRestoreToSPPrePostIncDec(
        -        MBB, std::prev(MBB.getFirstTerminator()), DL, TII, CSStackSize);
        +        MBB, std::prev(MBB.getFirstTerminator()), DL, TII, PrologueSaveSize);
         
           // Move past the restores of the callee-saved registers.
           MachineBasicBlock::iterator LastPopI = MBB.getFirstTerminator();
        @@ -786,7 +795,7 @@ void AArch64FrameLowering::emitEpilogue(MachineFunctio
             return;
           }
         
        -  NumBytes -= CSStackSize;
        +  NumBytes -= PrologueSaveSize;
           assert(NumBytes >= 0 && "Negative stack allocation size!?");
         
           if (!hasFP(MF)) {
        @@ -796,7 +805,7 @@ void AArch64FrameLowering::emitEpilogue(MachineFunctio
             if (RedZone && ArgumentPopSize == 0)
               return;
         
        -    bool NoCalleeSaveRestore = CSStackSize == 0;
        +    bool NoCalleeSaveRestore = PrologueSaveSize == 0;
             int StackRestoreBytes = RedZone ? 0 : NumBytes;
             if (NoCalleeSaveRestore)
               StackRestoreBytes += ArgumentPopSize;
        @@ -815,7 +824,8 @@ void AArch64FrameLowering::emitEpilogue(MachineFunctio
           // be able to save any instructions.
           if (MFI.hasVarSizedObjects() || AFI->isStackRealigned())
             emitFrameOffset(MBB, LastPopI, DL, AArch64::SP, AArch64::FP,
        -                    -CSStackSize + 16, TII, MachineInstr::FrameDestroy);
        +                    -AFI->getCalleeSavedStackSize() + 16, TII,
        +                    MachineInstr::FrameDestroy);
           else if (NumBytes)
             emitFrameOffset(MBB, LastPopI, DL, AArch64::SP, AArch64::SP, NumBytes, TII,
                             MachineInstr::FrameDestroy);
        @@ -845,7 +855,11 @@ int AArch64FrameLowering::resolveFrameIndexReference(c
           const AArch64RegisterInfo *RegInfo = static_cast(
               MF.getSubtarget().getRegisterInfo());
           const AArch64FunctionInfo *AFI = MF.getInfo();
        -  int FPOffset = MFI.getObjectOffset(FI) + 16;
        +  const AArch64Subtarget &Subtarget = MF.getSubtarget();
        +  bool IsWin64 =
        +      Subtarget.isCallingConvWin64(MF.getFunction()->getCallingConv());
        +  unsigned FixedObject = IsWin64 ? alignTo(AFI->getVarArgsGPRSize(), 16) : 0;
        +  int FPOffset = MFI.getObjectOffset(FI) + FixedObject + 16;
           int Offset = MFI.getObjectOffset(FI) + MFI.getStackSize();
           bool isFixed = MFI.isFixedObjectIndex(FI);
         
        @@ -955,12 +969,6 @@ static void computeCalleeSaveRegisterPairs(
                   (Count & 1) == 0) &&
                  "Odd number of callee-saved regs to spill!");
           int Offset = AFI->getCalleeSavedStackSize();
        -
        -  unsigned GPRSaveSize = AFI->getVarArgsGPRSize();
        -  const AArch64Subtarget &Subtarget = MF.getSubtarget();
        -  bool IsWin64 = Subtarget.isCallingConvWin64(MF.getFunction()->getCallingConv());
        -  if (IsWin64)
        -    Offset -= alignTo(GPRSaveSize, 16);
         
           for (unsigned i = 0; i < Count; ++i) {
             RegPairInfo RPI;
        
        Modified: vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -9586,8 +9586,8 @@ static bool performTBISimplification(SDValue Addr,
                                              SelectionDAG &DAG) {
           APInt DemandedMask = APInt::getLowBitsSet(64, 56);
           KnownBits Known;
        -  TargetLowering::TargetLoweringOpt TLO(DAG, DCI.isBeforeLegalize(),
        -                                        DCI.isBeforeLegalizeOps());
        +  TargetLowering::TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(),
        +                                        !DCI.isBeforeLegalizeOps());
           const TargetLowering &TLI = DAG.getTargetLoweringInfo();
           if (TLI.SimplifyDemandedBits(Addr, DemandedMask, Known, TLO)) {
             DCI.CommitTargetLoweringOpt(TLO);
        
        Modified: vendor/llvm/dist/lib/Target/AArch64/AArch64InstrInfo.td
        ==============================================================================
        --- vendor/llvm/dist/lib/Target/AArch64/AArch64InstrInfo.td	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/Target/AArch64/AArch64InstrInfo.td	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -37,6 +37,9 @@ def HasFullFP16      : Predicate<"Subtarget->hasFullFP
                                          AssemblerPredicate<"FeatureFullFP16", "fullfp16">;
         def HasSPE           : Predicate<"Subtarget->hasSPE()">,
                                          AssemblerPredicate<"FeatureSPE", "spe">;
        +def HasFuseAES       : Predicate<"Subtarget->hasFuseAES()">,
        +                                 AssemblerPredicate<"FeatureFuseAES",
        +                                 "fuse-aes">;
         def HasSVE           : Predicate<"Subtarget->hasSVE()">,
                                          AssemblerPredicate<"FeatureSVE", "sve">;
         
        @@ -5303,6 +5306,31 @@ def AESErr   : AESTiedInst<0b0100, "aese",   int_aarch
         def AESDrr   : AESTiedInst<0b0101, "aesd",   int_aarch64_crypto_aesd>;
         def AESMCrr  : AESInst<    0b0110, "aesmc",  int_aarch64_crypto_aesmc>;
         def AESIMCrr : AESInst<    0b0111, "aesimc", int_aarch64_crypto_aesimc>;
        +
        +// Pseudo instructions for AESMCrr/AESIMCrr with a register constraint required
        +// for AES fusion on some CPUs.
        +let hasSideEffects = 0, mayStore = 0, mayLoad = 0 in {
        +def AESMCrrTied: Pseudo<(outs V128:$Rd), (ins V128:$Rn), [], "$Rn = $Rd">,
        +                        Sched<[WriteV]>;
        +def AESIMCrrTied: Pseudo<(outs V128:$Rd), (ins V128:$Rn), [], "$Rn = $Rd">,
        +                         Sched<[WriteV]>;
        +}
        +
        +// Only use constrained versions of AES(I)MC instructions if they are paired with
        +// AESE/AESD.
        +def : Pat<(v16i8 (int_aarch64_crypto_aesmc
        +            (v16i8 (int_aarch64_crypto_aese (v16i8 V128:$src1),
        +                                            (v16i8 V128:$src2))))),
        +          (v16i8 (AESMCrrTied (v16i8 (AESErr (v16i8 V128:$src1),
        +                                             (v16i8 V128:$src2)))))>,
        +          Requires<[HasFuseAES]>;
        +
        +def : Pat<(v16i8 (int_aarch64_crypto_aesimc
        +            (v16i8 (int_aarch64_crypto_aesd (v16i8 V128:$src1),
        +                                            (v16i8 V128:$src2))))),
        +          (v16i8 (AESIMCrrTied (v16i8 (AESDrr (v16i8 V128:$src1),
        +                                              (v16i8 V128:$src2)))))>,
        +          Requires<[HasFuseAES]>;
         
         def SHA1Crrr     : SHATiedInstQSV<0b000, "sha1c",   int_aarch64_crypto_sha1c>;
         def SHA1Prrr     : SHATiedInstQSV<0b001, "sha1p",   int_aarch64_crypto_sha1p>;
        
        Modified: vendor/llvm/dist/lib/Target/AArch64/AArch64MacroFusion.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/Target/AArch64/AArch64MacroFusion.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/Target/AArch64/AArch64MacroFusion.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -118,11 +118,13 @@ static bool shouldScheduleAdjacent(const TargetInstrIn
             // Fuse AES crypto operations.
             switch(SecondOpcode) {
             // AES encode.
        -    case AArch64::AESMCrr :
        +    case AArch64::AESMCrr:
        +    case AArch64::AESMCrrTied:
               return FirstOpcode == AArch64::AESErr ||
                      FirstOpcode == AArch64::INSTRUCTION_LIST_END;
             // AES decode.
             case AArch64::AESIMCrr:
        +    case AArch64::AESIMCrrTied:
               return FirstOpcode == AArch64::AESDrr ||
                      FirstOpcode == AArch64::INSTRUCTION_LIST_END;
             }
        
        Modified: vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -3984,6 +3984,13 @@ bool MatchingStackOffset(SDValue Arg, unsigned Offset,
           if (Offset != MFI.getObjectOffset(FI))
             return false;
         
        +  // If this is not byval, check that the argument stack object is immutable.
        +  // inalloca and argument copy elision can create mutable argument stack
        +  // objects. Byval objects can be mutated, but a byval call intends to pass the
        +  // mutated memory.
        +  if (!Flags.isByVal() && !MFI.isImmutableObjectIndex(FI))
        +    return false;
        +
           if (VA.getLocVT().getSizeInBits() > Arg.getValueSizeInBits()) {
             // If the argument location is wider than the argument type, check that any
             // extension flags match.
        @@ -30605,8 +30612,8 @@ static SDValue combineSelect(SDNode *N, SelectionDAG &
             assert(BitWidth >= 8 && BitWidth <= 64 && "Invalid mask size");
             APInt DemandedMask(APInt::getSignMask(BitWidth));
             KnownBits Known;
        -    TargetLowering::TargetLoweringOpt TLO(DAG, DCI.isBeforeLegalize(),
        -                                          DCI.isBeforeLegalizeOps());
        +    TargetLowering::TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(),
        +                                          !DCI.isBeforeLegalizeOps());
             if (TLI.ShrinkDemandedConstant(Cond, DemandedMask, TLO) ||
                 TLI.SimplifyDemandedBits(Cond, DemandedMask, Known, TLO)) {
               // If we changed the computation somewhere in the DAG, this change will
        
        Modified: vendor/llvm/dist/lib/Target/X86/X86InstrSSE.td
        ==============================================================================
        --- vendor/llvm/dist/lib/Target/X86/X86InstrSSE.td	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/Target/X86/X86InstrSSE.td	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -3697,8 +3697,7 @@ let SchedRW = [WriteNop] in {
         // Pause. This "instruction" is encoded as "rep; nop", so even though it
         // was introduced with SSE2, it's backward compatible.
         def PAUSE : I<0x90, RawFrm, (outs), (ins),
        -              "pause", [(int_x86_sse2_pause)], IIC_SSE_PAUSE>,
        -              OBXS, Requires<[HasSSE2]>;
        +              "pause", [(int_x86_sse2_pause)], IIC_SSE_PAUSE>, OBXS;
         }
         
         let SchedRW = [WriteFence] in {
        
        Modified: vendor/llvm/dist/lib/Transforms/IPO/ArgumentPromotion.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/Transforms/IPO/ArgumentPromotion.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/Transforms/IPO/ArgumentPromotion.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -356,7 +356,7 @@ doPromotion(Function *F, SmallPtrSetImpl &
               // Just add all the struct element types.
               Type *AgTy = cast(I->getType())->getElementType();
               Value *TheAlloca = new AllocaInst(AgTy, DL.getAllocaAddrSpace(), nullptr,
        -                                        "", InsertPt);
        +                                        I->getParamAlignment(), "", InsertPt);
               StructType *STy = cast(AgTy);
               Value *Idxs[2] = {ConstantInt::get(Type::getInt32Ty(F->getContext()), 0),
                                 nullptr};
        
        Modified: vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp
        ==============================================================================
        --- vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -756,7 +756,8 @@ struct FunctionStackPoisoner : public InstVisitor llvm::CloneModule(
             SmallVector, 1> MDs;
             I->getAllMetadata(MDs);
             for (auto MD : MDs)
        -      GV->addMetadata(MD.first, *MapMetadata(MD.second, VMap));
        +      GV->addMetadata(MD.first,
        +                      *MapMetadata(MD.second, VMap, RF_MoveDistinctMDs));
         
             copyComdat(GV, &*I);
           }
        
        Modified: vendor/llvm/dist/test/CodeGen/AArch64/aarch64_win64cc_vararg.ll
        ==============================================================================
        --- vendor/llvm/dist/test/CodeGen/AArch64/aarch64_win64cc_vararg.ll	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/test/CodeGen/AArch64/aarch64_win64cc_vararg.ll	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -2,14 +2,14 @@
         
         define win64cc void @pass_va(i32 %count, ...) nounwind {
         entry:
        -; CHECK: sub     sp, sp, #80
        +; CHECK: str     x30, [sp, #-80]!
         ; CHECK: add     x8, sp, #24
         ; CHECK: add     x0, sp, #24
         ; CHECK: stp     x6, x7, [sp, #64]
         ; CHECK: stp     x4, x5, [sp, #48]
         ; CHECK: stp     x2, x3, [sp, #32]
         ; CHECK: str     x1, [sp, #24]
        -; CHECK: stp     x30, x8, [sp]
        +; CHECK: str     x8, [sp, #8]
         ; CHECK: bl      other_func
         ; CHECK: ldr     x30, [sp], #80
         ; CHECK: ret
        
        Modified: vendor/llvm/dist/test/CodeGen/AArch64/misched-fusion-aes.ll
        ==============================================================================
        --- vendor/llvm/dist/test/CodeGen/AArch64/misched-fusion-aes.ll	Tue Aug  8 16:14:31 2017	(r322258)
        +++ vendor/llvm/dist/test/CodeGen/AArch64/misched-fusion-aes.ll	Tue Aug  8 16:52:53 2017	(r322259)
        @@ -1,10 +1,10 @@
        -; RUN: llc %s -o - -mtriple=aarch64-unknown -mattr=+fuse-aes,+crypto | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKFUSEALLPAIRS
        -; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=generic -mattr=+crypto | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKFUSEALLPAIRS
        -; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=cortex-a53 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKFUSEALLPAIRS
        -; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=cortex-a57 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKFUSEALLPAIRS
        -; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=cortex-a72 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKFUSEALLPAIRS
        -; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=cortex-a73 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKFUSEALLPAIRS
        -; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=exynos-m1  | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKM1
        +; RUN: llc %s -o - -mtriple=aarch64-unknown -mattr=+fuse-aes,+crypto | FileCheck %s
        +; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=generic -mattr=+crypto | FileCheck %s
        +; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=cortex-a53 | FileCheck %s
        +; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=cortex-a57 | FileCheck %s
        +; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=cortex-a72 | FileCheck %s
        +; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=cortex-a73 | FileCheck %s
        +; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=exynos-m1  | FileCheck %s
         
         declare <16 x i8> @llvm.aarch64.crypto.aese(<16 x i8> %d, <16 x i8> %k)
         declare <16 x i8> @llvm.aarch64.crypto.aesmc(<16 x i8> %d)
        @@ -76,41 +76,23 @@ define void @aesea(<16 x i8>* %a0, <16 x i8>* %b0, <16
           ret void
         
         ; CHECK-LABEL: aesea:
        -; CHECKFUSEALLPAIRS: aese [[VA:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesmc {{v[0-7].16b}}, [[VA]]
        -; CHECKFUSEALLPAIRS: aese [[VB:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesmc {{v[0-7].16b}}, [[VB]]
        -; CHECKFUSEALLPAIRS: aese [[VC:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesmc {{v[0-7].16b}}, [[VC]]
        -; CHECKFUSEALLPAIRS: aese [[VD:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesmc {{v[0-7].16b}}, [[VD]]
        -; CHECKFUSEALLPAIRS: aese [[VE:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesmc {{v[0-7].16b}}, [[VE]]
        -; CHECKFUSEALLPAIRS: aese [[VF:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesmc {{v[0-7].16b}}, [[VF]]
        -; CHECKFUSEALLPAIRS: aese [[VG:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesmc {{v[0-7].16b}}, [[VG]]
        -; CHECKFUSEALLPAIRS: aese [[VH:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesmc {{v[0-7].16b}}, [[VH]]
        -; CHECKFUSEALLPAIRS-NOT: aesmc
        -
        -; CHECKM1: aese [[VA:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKM1-NEXT: aesmc {{v[0-7].16b}}, [[VA]]
        -; CHECKM1: aese [[VH:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKM1: aese [[VB:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKM1-NEXT: aesmc {{v[0-7].16b}}, [[VB]]
        -; CHECKM1: aese {{v[0-7].16b}}, {{v[0-7].16b}}
        -; CHECKM1: aese [[VC:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKM1-NEXT: aesmc {{v[0-7].16b}}, [[VC]]
        -; CHECKM1: aese [[VD:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKM1-NEXT: aesmc {{v[0-7].16b}}, [[VD]]
        -; CHECKM1: aesmc {{v[0-7].16b}}, [[VH]]
        -; CHECKM1: aese [[VE:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKM1-NEXT: aesmc {{v[0-7].16b}}, [[VE]]
        -; CHECKM1: aese [[VF:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKM1-NEXT: aesmc {{v[0-7].16b}}, [[VF]]
        -; CHECKM1: aese [[VG:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKM1-NEXT: aesmc {{v[0-7].16b}}, [[VG]]
        +; CHECK: aese [[VA:v[0-7].16b]], {{v[0-7].16b}}
        +; CHECK-NEXT: aesmc [[VA]], [[VA]]
        +; CHECK: aese [[VB:v[0-7].16b]], {{v[0-7].16b}}
        +; CHECK-NEXT: aesmc [[VB]], [[VB]]
        +; CHECK: aese [[VC:v[0-7].16b]], {{v[0-7].16b}}
        +; CHECK-NEXT: aesmc [[VC]], [[VC]]
        +; CHECK: aese [[VD:v[0-7].16b]], {{v[0-7].16b}}
        +; CHECK-NEXT: aesmc [[VD]], [[VD]]
        +; CHECK: aese [[VE:v[0-7].16b]], {{v[0-7].16b}}
        +; CHECK-NEXT: aesmc [[VE]], [[VE]]
        +; CHECK: aese [[VF:v[0-7].16b]], {{v[0-7].16b}}
        +; CHECK-NEXT: aesmc [[VF]], [[VF]]
        +; CHECK: aese [[VG:v[0-7].16b]], {{v[0-7].16b}}
        +; CHECK-NEXT: aesmc [[VG]], [[VG]]
        +; CHECK: aese [[VH:v[0-7].16b]], {{v[0-7].16b}}
        +; CHECK-NEXT: aesmc [[VH]], [[VH]]
        +; CHECK-NOT: aesmc
         }
         
         define void @aesda(<16 x i8>* %a0, <16 x i8>* %b0, <16 x i8>* %c0, <16 x i8> %d, <16 x i8> %e) {
        @@ -178,41 +160,23 @@ define void @aesda(<16 x i8>* %a0, <16 x i8>* %b0, <16
           ret void
         
         ; CHECK-LABEL: aesda:
        -; CHECKFUSEALLPAIRS: aesd [[VA:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesimc {{v[0-7].16b}}, [[VA]]
        -; CHECKFUSEALLPAIRS: aesd [[VB:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesimc {{v[0-7].16b}}, [[VB]]
        -; CHECKFUSEALLPAIRS: aesd [[VC:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesimc {{v[0-7].16b}}, [[VC]]
        -; CHECKFUSEALLPAIRS: aesd [[VD:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesimc {{v[0-7].16b}}, [[VD]]
        -; CHECKFUSEALLPAIRS: aesd [[VE:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesimc {{v[0-7].16b}}, [[VE]]
        -; CHECKFUSEALLPAIRS: aesd [[VF:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesimc {{v[0-7].16b}}, [[VF]]
        -; CHECKFUSEALLPAIRS: aesd [[VG:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesimc {{v[0-7].16b}}, [[VG]]
        -; CHECKFUSEALLPAIRS: aesd [[VH:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKFUSEALLPAIRS-NEXT: aesimc {{v[0-7].16b}}, [[VH]]
        -; CHECKFUSEALLPAIRS-NOT: aesimc
        -
        -; CHECKM1: aesd [[VA:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKM1-NEXT: aesimc {{v[0-7].16b}}, [[VA]]
        -; CHECKM1: aesd [[VH:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKM1: aesd [[VB:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKM1-NEXT: aesimc {{v[0-7].16b}}, [[VB]]
        -; CHECKM1: aesd {{v[0-7].16b}}, {{v[0-7].16b}}
        -; CHECKM1: aesd [[VC:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKM1-NEXT: aesimc {{v[0-7].16b}}, [[VC]]
        -; CHECKM1: aesd [[VD:v[0-7].16b]], {{v[0-7].16b}}
        -; CHECKM1-NEXT: aesimc {{v[0-7].16b}}, [[VD]]
        -; CHECKM1: aesimc {{v[0-7].16b}}, [[VH]]
        -; CHECKM1: aesd [[VE:v[0-7].16b]], {{v[0-7].16b}}
        
        *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 16:53:04 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 186B2DC2FB2;
         Tue,  8 Aug 2017 16:53:04 +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 mx1.freebsd.org (Postfix) with ESMTPS id B780069AA5;
         Tue,  8 Aug 2017 16:53:03 +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 v78Gr2mE082543;
         Tue, 8 Aug 2017 16:53:02 GMT (envelope-from dim@FreeBSD.org)
        Received: (from dim@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Gr24s082542;
         Tue, 8 Aug 2017 16:53:02 GMT (envelope-from dim@FreeBSD.org)
        Message-Id: <201708081653.v78Gr24s082542@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org
         using -f
        From: Dimitry Andric 
        Date: Tue, 8 Aug 2017 16:53:02 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322260 - vendor/llvm/llvm-release_50-r310316
        X-SVN-Group: vendor
        X-SVN-Commit-Author: dim
        X-SVN-Commit-Paths: vendor/llvm/llvm-release_50-r310316
        X-SVN-Commit-Revision: 322260
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 16:53:04 -0000
        
        Author: dim
        Date: Tue Aug  8 16:53:02 2017
        New Revision: 322260
        URL: https://svnweb.freebsd.org/changeset/base/322260
        
        Log:
          Tag llvm release_50 branch r310316.
        
        Added:
          vendor/llvm/llvm-release_50-r310316/
             - copied from r322259, vendor/llvm/dist/
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 16:53:27 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04385DC3079;
         Tue,  8 Aug 2017 16:53: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 mx1.freebsd.org (Postfix) with ESMTPS id 8ABAA69C86;
         Tue,  8 Aug 2017 16:53:26 +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 v78GrPLx082623;
         Tue, 8 Aug 2017 16:53:25 GMT (envelope-from dim@FreeBSD.org)
        Received: (from dim@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78GrNqZ082597;
         Tue, 8 Aug 2017 16:53:23 GMT (envelope-from dim@FreeBSD.org)
        Message-Id: <201708081653.v78GrNqZ082597@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org
         using -f
        From: Dimitry Andric 
        Date: Tue, 8 Aug 2017 16:53:23 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322261 - in vendor/clang/dist: include/clang/AST
         include/clang/Basic include/clang/Driver include/clang/Serialization lib/AST
         lib/Basic lib/Driver/ToolChains lib/Driver/ToolChains/Arch...
        X-SVN-Group: vendor
        X-SVN-Commit-Author: dim
        X-SVN-Commit-Paths: in vendor/clang/dist: include/clang/AST
         include/clang/Basic include/clang/Driver include/clang/Serialization lib/AST
         lib/Basic lib/Driver/ToolChains lib/Driver/ToolChains/Arch lib/Headers
         lib/Lex lib/...
        X-SVN-Commit-Revision: 322261
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 16:53:27 -0000
        
        Author: dim
        Date: Tue Aug  8 16:53:22 2017
        New Revision: 322261
        URL: https://svnweb.freebsd.org/changeset/base/322261
        
        Log:
          Vendor import of clang release_50 branch r310316:
          https://llvm.org/svn/llvm-project/cfe/branches/release_50@310316
        
        Added:
          vendor/clang/dist/test/CodeGen/pause.c   (contents, props changed)
          vendor/clang/dist/test/CodeGen/x86-nontemporal.c   (contents, props changed)
          vendor/clang/dist/test/PCH/coroutines.cpp   (contents, props changed)
        Deleted:
          vendor/clang/dist/test/CodeGen/mips-madd4.c
        Modified:
          vendor/clang/dist/include/clang/AST/StmtCXX.h
          vendor/clang/dist/include/clang/Basic/BuiltinsX86.def
          vendor/clang/dist/include/clang/Driver/Options.td
          vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h
          vendor/clang/dist/lib/AST/ODRHash.cpp
          vendor/clang/dist/lib/AST/StmtCXX.cpp
          vendor/clang/dist/lib/Basic/Targets.cpp
          vendor/clang/dist/lib/Driver/ToolChains/Arch/Mips.cpp
          vendor/clang/dist/lib/Driver/ToolChains/OpenBSD.cpp
          vendor/clang/dist/lib/Headers/avx2intrin.h
          vendor/clang/dist/lib/Headers/avx512fintrin.h
          vendor/clang/dist/lib/Headers/avxintrin.h
          vendor/clang/dist/lib/Headers/float.h
          vendor/clang/dist/lib/Lex/ScratchBuffer.cpp
          vendor/clang/dist/lib/Sema/Sema.cpp
          vendor/clang/dist/lib/Sema/SemaExpr.cpp
          vendor/clang/dist/lib/Serialization/ASTReaderStmt.cpp
          vendor/clang/dist/lib/Serialization/ASTWriterStmt.cpp
          vendor/clang/dist/test/Driver/openbsd.c
          vendor/clang/dist/test/Misc/caret-diags-multiline.cpp
          vendor/clang/dist/test/Preprocessor/init.c
          vendor/clang/dist/test/Sema/vector-cast.c
          vendor/clang/dist/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
        
        Modified: vendor/clang/dist/include/clang/AST/StmtCXX.h
        ==============================================================================
        --- vendor/clang/dist/include/clang/AST/StmtCXX.h	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/include/clang/AST/StmtCXX.h	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -317,6 +317,7 @@ class CoroutineBodyStmt final
           unsigned NumParams;
         
           friend class ASTStmtReader;
        +  friend class ASTReader;
           friend TrailingObjects;
         
           Stmt **getStoredStmts() { return getTrailingObjects(); }
        @@ -347,6 +348,8 @@ class CoroutineBodyStmt final
         
         public:
           static CoroutineBodyStmt *Create(const ASTContext &C, CtorArgs const &Args);
        +  static CoroutineBodyStmt *Create(const ASTContext &C, EmptyShell,
        +                                   unsigned NumParams);
         
           bool hasDependentPromiseType() const {
             return getPromiseDecl()->getType()->isDependentType();
        @@ -443,6 +446,8 @@ class CoreturnStmt : public Stmt { (public)
             SubStmts[SubStmt::Operand] = Operand;
             SubStmts[SubStmt::PromiseCall] = PromiseCall;
           }
        +
        +  CoreturnStmt(EmptyShell) : CoreturnStmt({}, {}, {}) {}
         
           SourceLocation getKeywordLoc() const { return CoreturnLoc; }
         
        
        Modified: vendor/clang/dist/include/clang/Basic/BuiltinsX86.def
        ==============================================================================
        --- vendor/clang/dist/include/clang/Basic/BuiltinsX86.def	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/include/clang/Basic/BuiltinsX86.def	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -338,8 +338,8 @@ TARGET_BUILTIN(__builtin_ia32_lfence, "v", "", "sse2")
         TARGET_HEADER_BUILTIN(_mm_lfence, "v", "h", "emmintrin.h", ALL_LANGUAGES, "sse2")
         TARGET_BUILTIN(__builtin_ia32_mfence, "v", "", "sse2")
         TARGET_HEADER_BUILTIN(_mm_mfence, "v", "h", "emmintrin.h", ALL_LANGUAGES, "sse2")
        -TARGET_BUILTIN(__builtin_ia32_pause, "v", "", "sse2")
        -TARGET_HEADER_BUILTIN(_mm_pause, "v", "h", "emmintrin.h", ALL_LANGUAGES, "sse2")
        +TARGET_BUILTIN(__builtin_ia32_pause, "v", "", "")
        +TARGET_HEADER_BUILTIN(_mm_pause, "v", "h", "emmintrin.h", ALL_LANGUAGES, "")
         TARGET_BUILTIN(__builtin_ia32_pmuludq128, "V2LLiV4iV4i", "", "sse2")
         TARGET_BUILTIN(__builtin_ia32_psraw128, "V8sV8sV8s", "", "sse2")
         TARGET_BUILTIN(__builtin_ia32_psrad128, "V4iV4iV4i", "", "sse2")
        
        Modified: vendor/clang/dist/include/clang/Driver/Options.td
        ==============================================================================
        --- vendor/clang/dist/include/clang/Driver/Options.td	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/include/clang/Driver/Options.td	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -2019,10 +2019,6 @@ def mdspr2 : Flag<["-"], "mdspr2">, Group;
         def mno_dspr2 : Flag<["-"], "mno-dspr2">, Group;
         def msingle_float : Flag<["-"], "msingle-float">, Group;
         def mdouble_float : Flag<["-"], "mdouble-float">, Group;
        -def mmadd4 : Flag<["-"], "mmadd4">, Group,
        -  HelpText<"Enable the generation of 4-operand madd.s, madd.d and related instructions.">;
        -def mno_madd4 : Flag<["-"], "mno-madd4">, Group,
        -  HelpText<"Disable the generation of 4-operand madd.s, madd.d and related instructions.">;
         def mmsa : Flag<["-"], "mmsa">, Group,
           HelpText<"Enable MSA ASE (MIPS only)">;
         def mno_msa : Flag<["-"], "mno-msa">, Group,
        
        Modified: vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h
        ==============================================================================
        --- vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -1545,9 +1545,14 @@ namespace clang {
         
               // ARC
               EXPR_OBJC_BRIDGED_CAST,     // ObjCBridgedCastExpr
        -      
        +
               STMT_MS_DEPENDENT_EXISTS,   // MSDependentExistsStmt
        -      EXPR_LAMBDA                 // LambdaExpr
        +      EXPR_LAMBDA,                // LambdaExpr
        +      STMT_COROUTINE_BODY,
        +      STMT_CORETURN,
        +      EXPR_COAWAIT,
        +      EXPR_COYIELD,
        +      EXPR_DEPENDENT_COAWAIT,
             };
         
             /// \brief The kinds of designators that can occur in a
        
        Modified: vendor/clang/dist/lib/AST/ODRHash.cpp
        ==============================================================================
        --- vendor/clang/dist/lib/AST/ODRHash.cpp	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/AST/ODRHash.cpp	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -378,8 +378,12 @@ void ODRHash::AddCXXRecordDecl(const CXXRecordDecl *Re
           assert(Record && Record->hasDefinition() &&
                  "Expected non-null record to be a definition.");
         
        -  if (isa(Record)) {
        -    return;
        +  const DeclContext *DC = Record;
        +  while (DC) {
        +    if (isa(DC)) {
        +      return;
        +    }
        +    DC = DC->getParent();
           }
         
           AddDecl(Record);
        
        Modified: vendor/clang/dist/lib/AST/StmtCXX.cpp
        ==============================================================================
        --- vendor/clang/dist/lib/AST/StmtCXX.cpp	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/AST/StmtCXX.cpp	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -96,6 +96,20 @@ CoroutineBodyStmt *CoroutineBodyStmt::Create(
           return new (Mem) CoroutineBodyStmt(Args);
         }
         
        +CoroutineBodyStmt *CoroutineBodyStmt::Create(const ASTContext &C, EmptyShell,
        +                                             unsigned NumParams) {
        +  std::size_t Size = totalSizeToAlloc(
        +      CoroutineBodyStmt::FirstParamMove + NumParams);
        +
        +  void *Mem = C.Allocate(Size, alignof(CoroutineBodyStmt));
        +  auto *Result = new (Mem) CoroutineBodyStmt(CtorArgs());
        +  Result->NumParams = NumParams;
        +  auto *ParamBegin = Result->getStoredStmts() + SubStmt::FirstParamMove;
        +  std::uninitialized_fill(ParamBegin, ParamBegin + NumParams,
        +                          static_cast(nullptr));
        +  return Result;
        +}
        +
         CoroutineBodyStmt::CoroutineBodyStmt(CoroutineBodyStmt::CtorArgs const &Args)
             : Stmt(CoroutineBodyStmtClass), NumParams(Args.ParamMoves.size()) {
           Stmt **SubStmts = getStoredStmts();
        
        Modified: vendor/clang/dist/lib/Basic/Targets.cpp
        ==============================================================================
        --- vendor/clang/dist/lib/Basic/Targets.cpp	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/Basic/Targets.cpp	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -8050,7 +8050,6 @@ class MipsTargetInfo : public TargetInfo {
             NoDSP, DSP1, DSP2
           } DspRev;
           bool HasMSA;
        -  bool DisableMadd4;
         
         protected:
           bool HasFP64;
        @@ -8061,7 +8060,7 @@ class MipsTargetInfo : public TargetInfo {
               : TargetInfo(Triple), IsMips16(false), IsMicromips(false),
                 IsNan2008(false), IsSingleFloat(false), IsNoABICalls(false),
                 CanUseBSDABICalls(false), FloatABI(HardFloat), DspRev(NoDSP),
        -        HasMSA(false), DisableMadd4(false), HasFP64(false) {
        +        HasMSA(false), HasFP64(false) {
             TheCXXABI.set(TargetCXXABI::GenericMIPS);
         
             setABI((getTriple().getArch() == llvm::Triple::mips ||
        @@ -8307,9 +8306,6 @@ class MipsTargetInfo : public TargetInfo {
             if (HasMSA)
               Builder.defineMacro("__mips_msa", Twine(1));
         
        -    if (DisableMadd4)
        -      Builder.defineMacro("__mips_no_madd4", Twine(1));
        -
             Builder.defineMacro("_MIPS_SZPTR", Twine(getPointerWidth(0)));
             Builder.defineMacro("_MIPS_SZINT", Twine(getIntWidth()));
             Builder.defineMacro("_MIPS_SZLONG", Twine(getLongWidth()));
        @@ -8472,8 +8468,6 @@ class MipsTargetInfo : public TargetInfo {
                 DspRev = std::max(DspRev, DSP2);
               else if (Feature == "+msa")
                 HasMSA = true;
        -      else if (Feature == "+nomadd4")
        -        DisableMadd4 = true;
               else if (Feature == "+fp64")
                 HasFP64 = true;
               else if (Feature == "-fp64")
        
        Modified: vendor/clang/dist/lib/Driver/ToolChains/Arch/Mips.cpp
        ==============================================================================
        --- vendor/clang/dist/lib/Driver/ToolChains/Arch/Mips.cpp	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/Driver/ToolChains/Arch/Mips.cpp	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -297,8 +297,6 @@ void mips::getMIPSTargetFeatures(const Driver &D, cons
         
           AddTargetFeature(Args, Features, options::OPT_mno_odd_spreg,
                            options::OPT_modd_spreg, "nooddspreg");
        -  AddTargetFeature(Args, Features, options::OPT_mno_madd4, options::OPT_mmadd4,
        -                   "nomadd4");
           AddTargetFeature(Args, Features, options::OPT_mlong_calls,
                            options::OPT_mno_long_calls, "long-calls");
           AddTargetFeature(Args, Features, options::OPT_mmt, options::OPT_mno_mt,"mt");
        
        Modified: vendor/clang/dist/lib/Driver/ToolChains/OpenBSD.cpp
        ==============================================================================
        --- vendor/clang/dist/lib/Driver/ToolChains/OpenBSD.cpp	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/Driver/ToolChains/OpenBSD.cpp	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -133,6 +133,8 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
             }
           }
         
        +  if (Args.hasArg(options::OPT_pie))
        +    CmdArgs.push_back("-pie");
           if (Args.hasArg(options::OPT_nopie))
             CmdArgs.push_back("-nopie");
         
        
        Modified: vendor/clang/dist/lib/Headers/avx2intrin.h
        ==============================================================================
        --- vendor/clang/dist/lib/Headers/avx2intrin.h	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/Headers/avx2intrin.h	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -832,7 +832,8 @@ _mm256_xor_si256(__m256i __a, __m256i __b)
         static __inline__ __m256i __DEFAULT_FN_ATTRS
         _mm256_stream_load_si256(__m256i const *__V)
         {
        -  return (__m256i)__builtin_nontemporal_load((const __v4di *)__V);
        +  typedef __v4di __v4di_aligned __attribute__((aligned(32)));
        +  return (__m256i)__builtin_nontemporal_load((const __v4di_aligned *)__V);
         }
         
         static __inline__ __m128 __DEFAULT_FN_ATTRS
        
        Modified: vendor/clang/dist/lib/Headers/avx512fintrin.h
        ==============================================================================
        --- vendor/clang/dist/lib/Headers/avx512fintrin.h	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/Headers/avx512fintrin.h	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -4289,7 +4289,7 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS
         _mm512_maskz_cvtps_epu32 ( __mmask16 __U, __m512 __A)
         {
           return (__m512i) __builtin_ia32_cvtps2udq512_mask ((__v16sf) __A,
        -                  (__v16si) 
        +                  (__v16si)
                           _mm512_setzero_si512 (),
                           (__mmask16) __U ,
                           _MM_FROUND_CUR_DIRECTION);
        @@ -9035,25 +9035,29 @@ _mm512_kxor (__mmask16 __A, __mmask16 __B)
         static __inline__ void __DEFAULT_FN_ATTRS
         _mm512_stream_si512 (__m512i * __P, __m512i __A)
         {
        -  __builtin_nontemporal_store((__v8di)__A, (__v8di*)__P);
        +  typedef __v8di __v8di_aligned __attribute__((aligned(64)));
        +  __builtin_nontemporal_store((__v8di_aligned)__A, (__v8di_aligned*)__P);
         }
         
         static __inline__ __m512i __DEFAULT_FN_ATTRS
         _mm512_stream_load_si512 (void *__P)
         {
        -  return (__m512i) __builtin_nontemporal_load((const __v8di *)__P);
        +  typedef __v8di __v8di_aligned __attribute__((aligned(64)));
        +  return (__m512i) __builtin_nontemporal_load((const __v8di_aligned *)__P);
         }
         
         static __inline__ void __DEFAULT_FN_ATTRS
         _mm512_stream_pd (double *__P, __m512d __A)
         {
        -  __builtin_nontemporal_store((__v8df)__A, (__v8df*)__P);
        +  typedef __v8df __v8df_aligned __attribute__((aligned(64)));
        +  __builtin_nontemporal_store((__v8df_aligned)__A, (__v8df_aligned*)__P);
         }
         
         static __inline__ void __DEFAULT_FN_ATTRS
         _mm512_stream_ps (float *__P, __m512 __A)
         {
        -  __builtin_nontemporal_store((__v16sf)__A, (__v16sf*)__P);
        +  typedef __v16sf __v16sf_aligned __attribute__((aligned(64)));
        +  __builtin_nontemporal_store((__v16sf_aligned)__A, (__v16sf_aligned*)__P);
         }
         
         static __inline__ __m512d __DEFAULT_FN_ATTRS
        @@ -9217,39 +9221,39 @@ _mm512_maskz_moveldup_ps (__mmask16 __U, __m512 __A)
         static __inline__ __m128 __DEFAULT_FN_ATTRS
         _mm_mask_move_ss (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B)
         {
        -  __m128 res = __A; 
        +  __m128 res = __A;
           res[0] = (__U & 1) ? __B[0] : __W[0];
        -  return res; 
        +  return res;
         }
         
         static __inline__ __m128 __DEFAULT_FN_ATTRS
         _mm_maskz_move_ss (__mmask8 __U, __m128 __A, __m128 __B)
         {
        -  __m128 res = __A; 
        -  res[0] = (__U & 1) ? __B[0] : 0; 
        -  return res; 
        +  __m128 res = __A;
        +  res[0] = (__U & 1) ? __B[0] : 0;
        +  return res;
         }
         
         static __inline__ __m128d __DEFAULT_FN_ATTRS
         _mm_mask_move_sd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B)
         {
        -  __m128d res = __A; 
        +  __m128d res = __A;
           res[0] = (__U & 1) ? __B[0] : __W[0];
        -  return res; 
        +  return res;
         }
         
         static __inline__ __m128d __DEFAULT_FN_ATTRS
         _mm_maskz_move_sd (__mmask8 __U, __m128d __A, __m128d __B)
         {
        -  __m128d res = __A; 
        -  res[0] = (__U & 1) ? __B[0] : 0; 
        -  return res; 
        +  __m128d res = __A;
        +  res[0] = (__U & 1) ? __B[0] : 0;
        +  return res;
         }
         
         static __inline__ void __DEFAULT_FN_ATTRS
         _mm_mask_store_ss (float * __W, __mmask8 __U, __m128 __A)
         {
        -  __builtin_ia32_storess128_mask ((__v16sf *)__W, 
        +  __builtin_ia32_storess128_mask ((__v16sf *)__W,
                         (__v16sf) _mm512_castps128_ps512(__A),
                         (__mmask16) __U & (__mmask16)1);
         }
        @@ -9257,7 +9261,7 @@ _mm_mask_store_ss (float * __W, __mmask8 __U, __m128 _
         static __inline__ void __DEFAULT_FN_ATTRS
         _mm_mask_store_sd (double * __W, __mmask8 __U, __m128d __A)
         {
        -  __builtin_ia32_storesd128_mask ((__v8df *)__W, 
        +  __builtin_ia32_storesd128_mask ((__v8df *)__W,
                         (__v8df) _mm512_castpd128_pd512(__A),
                         (__mmask8) __U & 1);
         }
        @@ -9606,7 +9610,7 @@ _mm_mask_cvtsd_ss (__m128 __W, __mmask8 __U, __m128 __
         {
           return __builtin_ia32_cvtsd2ss_round_mask ((__v4sf)(__A),
                                                      (__v2df)(__B),
        -                                             (__v4sf)(__W), 
        +                                             (__v4sf)(__W),
                                                      (__mmask8)(__U), _MM_FROUND_CUR_DIRECTION);
         }
         
        @@ -9615,7 +9619,7 @@ _mm_maskz_cvtsd_ss (__mmask8 __U, __m128 __A, __m128d 
         {
           return __builtin_ia32_cvtsd2ss_round_mask ((__v4sf)(__A),
                                                      (__v2df)(__B),
        -                                             (__v4sf)_mm_setzero_ps(), 
        +                                             (__v4sf)_mm_setzero_ps(),
                                                      (__mmask8)(__U), _MM_FROUND_CUR_DIRECTION);
         }
         
        @@ -9680,7 +9684,7 @@ _mm_mask_cvtss_sd (__m128d __W, __mmask8 __U, __m128d 
           return __builtin_ia32_cvtss2sd_round_mask((__v2df)(__A),
                                                       (__v4sf)(__B),
                                                       (__v2df)(__W),
        -                                              (__mmask8)(__U), _MM_FROUND_CUR_DIRECTION); 
        +                                              (__mmask8)(__U), _MM_FROUND_CUR_DIRECTION);
         }
         
         static __inline__ __m128d __DEFAULT_FN_ATTRS
        @@ -9688,8 +9692,8 @@ _mm_maskz_cvtss_sd (__mmask8 __U, __m128d __A, __m128 
         {
           return __builtin_ia32_cvtss2sd_round_mask((__v2df)(__A),
                                                       (__v4sf)(__B),
        -                                              (__v2df)_mm_setzero_pd(), 
        -                                              (__mmask8)(__U), _MM_FROUND_CUR_DIRECTION); 
        +                                              (__v2df)_mm_setzero_pd(),
        +                                              (__mmask8)(__U), _MM_FROUND_CUR_DIRECTION);
         }
         
         static __inline__ __m128d __DEFAULT_FN_ATTRS
        @@ -9935,7 +9939,7 @@ static __inline__ double __DEFAULT_FN_ATTRS _mm512_red
         }
         
         // Vec512 - Vector with size 512.
        -// Vec512Neutral - All vector elements set to the identity element. 
        +// Vec512Neutral - All vector elements set to the identity element.
         // Identity element: {+,0},{*,1},{&,0xFFFFFFFFFFFFFFFF},{|,0}
         // Operator - Can be one of following: +,*,&,|
         // Mask - Intrinsic Mask
        @@ -9965,19 +9969,19 @@ _mm512_mask_reduce_mul_epi64(__mmask8 __M, __m512i __W
         
         static __inline__ long long __DEFAULT_FN_ATTRS
         _mm512_mask_reduce_and_epi64(__mmask8 __M, __m512i __W) {
        -  _mm512_mask_reduce_operator_64bit(__W, _mm512_set1_epi64(0xFFFFFFFFFFFFFFFF), 
        +  _mm512_mask_reduce_operator_64bit(__W, _mm512_set1_epi64(0xFFFFFFFFFFFFFFFF),
                                             &, __M,  i, i, q);
         }
         
         static __inline__ long long __DEFAULT_FN_ATTRS
         _mm512_mask_reduce_or_epi64(__mmask8 __M, __m512i __W) {
        -  _mm512_mask_reduce_operator_64bit(__W, _mm512_set1_epi64(0), |, __M, 
        +  _mm512_mask_reduce_operator_64bit(__W, _mm512_set1_epi64(0), |, __M,
                                             i, i, q);
         }
         
         static __inline__ double __DEFAULT_FN_ATTRS
         _mm512_mask_reduce_add_pd(__mmask8 __M, __m512d __W) {
        -  _mm512_mask_reduce_operator_64bit(__W, _mm512_set1_pd(0), +, __M, 
        +  _mm512_mask_reduce_operator_64bit(__W, _mm512_set1_pd(0), +, __M,
                                             f, d, pd);
         }
         
        @@ -10039,17 +10043,17 @@ _mm512_reduce_add_epi32(__m512i __W) {
           _mm512_reduce_operator_32bit(__W, +, i, i);
         }
         
        -static __inline__ int __DEFAULT_FN_ATTRS 
        +static __inline__ int __DEFAULT_FN_ATTRS
         _mm512_reduce_mul_epi32(__m512i __W) {
           _mm512_reduce_operator_32bit(__W, *, i, i);
         }
         
        -static __inline__ int __DEFAULT_FN_ATTRS 
        +static __inline__ int __DEFAULT_FN_ATTRS
         _mm512_reduce_and_epi32(__m512i __W) {
           _mm512_reduce_operator_32bit(__W, &, i, i);
         }
         
        -static __inline__ int __DEFAULT_FN_ATTRS 
        +static __inline__ int __DEFAULT_FN_ATTRS
         _mm512_reduce_or_epi32(__m512i __W) {
           _mm512_reduce_operator_32bit(__W, |, i, i);
         }
        @@ -10065,7 +10069,7 @@ _mm512_reduce_mul_ps(__m512 __W) {
         }
         
         // Vec512 - Vector with size 512.
        -// Vec512Neutral - All vector elements set to the identity element. 
        +// Vec512Neutral - All vector elements set to the identity element.
         // Identity element: {+,0},{*,1},{&,0xFFFFFFFF},{|,0}
         // Operator - Can be one of following: +,*,&,|
         // Mask - Intrinsic Mask
        @@ -10095,7 +10099,7 @@ _mm512_mask_reduce_mul_epi32( __mmask16 __M, __m512i _
         
         static __inline__ int __DEFAULT_FN_ATTRS
         _mm512_mask_reduce_and_epi32( __mmask16 __M, __m512i __W) {
        -  _mm512_mask_reduce_operator_32bit(__W, _mm512_set1_epi32(0xFFFFFFFF), &, __M, 
        +  _mm512_mask_reduce_operator_32bit(__W, _mm512_set1_epi32(0xFFFFFFFF), &, __M,
                                             i, i, d);
         }
         
        @@ -10158,7 +10162,7 @@ _mm512_mask_reduce_mul_ps(__mmask16 __M, __m512 __W) {
             return Vec512[0];                                                          \
           })
         
        -static __inline__ long long __DEFAULT_FN_ATTRS 
        +static __inline__ long long __DEFAULT_FN_ATTRS
         _mm512_reduce_max_epi64(__m512i __V) {
           _mm512_reduce_maxMin_64bit(__V, max_epi64, i, i);
         }
        @@ -10168,7 +10172,7 @@ _mm512_reduce_max_epu64(__m512i __V) {
           _mm512_reduce_maxMin_64bit(__V, max_epu64, i, i);
         }
         
        -static __inline__ double __DEFAULT_FN_ATTRS 
        +static __inline__ double __DEFAULT_FN_ATTRS
         _mm512_reduce_max_pd(__m512d __V) {
           _mm512_reduce_maxMin_64bit(__V, max_pd, d, f);
         }
        @@ -10183,7 +10187,7 @@ _mm512_reduce_min_epu64(__m512i __V) {
           _mm512_reduce_maxMin_64bit(__V, min_epu64, i, i);
         }
         
        -static __inline__ double __DEFAULT_FN_ATTRS 
        +static __inline__ double __DEFAULT_FN_ATTRS
         _mm512_reduce_min_pd(__m512d __V) {
           _mm512_reduce_maxMin_64bit(__V, min_pd, d, f);
         }
        
        Modified: vendor/clang/dist/lib/Headers/avxintrin.h
        ==============================================================================
        --- vendor/clang/dist/lib/Headers/avxintrin.h	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/Headers/avxintrin.h	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -3590,7 +3590,8 @@ _mm_maskstore_ps(float *__p, __m128i __m, __m128 __a)
         static __inline void __DEFAULT_FN_ATTRS
         _mm256_stream_si256(__m256i *__a, __m256i __b)
         {
        -  __builtin_nontemporal_store((__v4di)__b, (__v4di*)__a);
        +  typedef __v4di __v4di_aligned __attribute__((aligned(32)));
        +  __builtin_nontemporal_store((__v4di_aligned)__b, (__v4di_aligned*)__a);
         }
         
         /// \brief Moves double-precision values from a 256-bit vector of [4 x double]
        @@ -3609,7 +3610,8 @@ _mm256_stream_si256(__m256i *__a, __m256i __b)
         static __inline void __DEFAULT_FN_ATTRS
         _mm256_stream_pd(double *__a, __m256d __b)
         {
        -  __builtin_nontemporal_store((__v4df)__b, (__v4df*)__a);
        +  typedef __v4df __v4df_aligned __attribute__((aligned(32)));
        +  __builtin_nontemporal_store((__v4df_aligned)__b, (__v4df_aligned*)__a);
         }
         
         /// \brief Moves single-precision floating point values from a 256-bit vector
        @@ -3629,7 +3631,8 @@ _mm256_stream_pd(double *__a, __m256d __b)
         static __inline void __DEFAULT_FN_ATTRS
         _mm256_stream_ps(float *__p, __m256 __a)
         {
        -  __builtin_nontemporal_store((__v8sf)__a, (__v8sf*)__p);
        +  typedef __v8sf __v8sf_aligned __attribute__((aligned(32)));
        +  __builtin_nontemporal_store((__v8sf_aligned)__a, (__v8sf_aligned*)__p);
         }
         
         /* Create vectors */
        
        Modified: vendor/clang/dist/lib/Headers/float.h
        ==============================================================================
        --- vendor/clang/dist/lib/Headers/float.h	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/Headers/float.h	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -33,6 +33,15 @@
          */
         #if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
             __STDC_HOSTED__ && __has_include_next()
        +
        +/* Prior to Apple's 10.7 SDK, float.h SDK header used to apply an extra level
        + * of #include_next to keep Metrowerks compilers happy. Avoid this
        + * extra indirection.
        + */
        +#ifdef __APPLE__
        +#define _FLOAT_H_
        +#endif
        +
         #  include_next 
         
         /* Undefine anything that we'll be redefining below. */
        
        Modified: vendor/clang/dist/lib/Lex/ScratchBuffer.cpp
        ==============================================================================
        --- vendor/clang/dist/lib/Lex/ScratchBuffer.cpp	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/Lex/ScratchBuffer.cpp	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -35,6 +35,14 @@ SourceLocation ScratchBuffer::getToken(const char *Buf
                                                const char *&DestPtr) {
           if (BytesUsed+Len+2 > ScratchBufSize)
             AllocScratchBuffer(Len+2);
        +  else {
        +    // Clear out the source line cache if it's already been computed.
        +    // FIXME: Allow this to be incrementally extended.
        +    auto *ContentCache = const_cast(
        +        SourceMgr.getSLocEntry(SourceMgr.getFileID(BufferStartLoc))
        +                 .getFile().getContentCache());
        +    ContentCache->SourceLineCache = nullptr;
        +  }
         
           // Prefix the token with a \n, so that it looks like it is the first thing on
           // its own virtual line in caret diagnostics.
        
        Modified: vendor/clang/dist/lib/Sema/Sema.cpp
        ==============================================================================
        --- vendor/clang/dist/lib/Sema/Sema.cpp	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/Sema/Sema.cpp	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -542,6 +542,9 @@ void Sema::getUndefinedButUsed(
             // __attribute__((weakref)) is basically a definition.
             if (ND->hasAttr()) continue;
         
        +    if (isa(ND))
        +      continue;
        +
             if (FunctionDecl *FD = dyn_cast(ND)) {
               if (FD->isDefined())
                 continue;
        
        Modified: vendor/clang/dist/lib/Sema/SemaExpr.cpp
        ==============================================================================
        --- vendor/clang/dist/lib/Sema/SemaExpr.cpp	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/Sema/SemaExpr.cpp	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -8288,7 +8288,7 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, Ex
             // type. Note that this is already done by non-compound assignments in
             // CheckAssignmentConstraints. If it's a scalar type, only bitcast for
             // <1 x T> -> T. The result is also a vector type.
        -    } else if (OtherType->isExtVectorType() ||
        +    } else if (OtherType->isExtVectorType() || OtherType->isVectorType() ||
                        (OtherType->isScalarType() && VT->getNumElements() == 1)) {
               ExprResult *RHSExpr = &RHS;
               *RHSExpr = ImpCastExprToType(RHSExpr->get(), LHSType, CK_BitCast);
        
        Modified: vendor/clang/dist/lib/Serialization/ASTReaderStmt.cpp
        ==============================================================================
        --- vendor/clang/dist/lib/Serialization/ASTReaderStmt.cpp	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/Serialization/ASTReaderStmt.cpp	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -367,28 +367,45 @@ void ASTStmtReader::VisitMSAsmStmt(MSAsmStmt *S) {
         }
         
         void ASTStmtReader::VisitCoroutineBodyStmt(CoroutineBodyStmt *S) {
        -  // FIXME: Implement coroutine serialization.
        -  llvm_unreachable("unimplemented");
        +  VisitStmt(S);
        +  assert(Record.peekInt() == S->NumParams);
        +  Record.skipInts(1);
        +  auto *StoredStmts = S->getStoredStmts();
        +  for (unsigned i = 0;
        +       i < CoroutineBodyStmt::SubStmt::FirstParamMove + S->NumParams; ++i)
        +    StoredStmts[i] = Record.readSubStmt();
         }
         
         void ASTStmtReader::VisitCoreturnStmt(CoreturnStmt *S) {
        -  // FIXME: Implement coroutine serialization.
        -  llvm_unreachable("unimplemented");
        +  VisitStmt(S);
        +  S->CoreturnLoc = Record.readSourceLocation();
        +  for (auto &SubStmt: S->SubStmts)
        +    SubStmt = Record.readSubStmt();
        +  S->IsImplicit = Record.readInt() != 0;
         }
         
        -void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr *S) {
        -  // FIXME: Implement coroutine serialization.
        -  llvm_unreachable("unimplemented");
        +void ASTStmtReader::VisitCoawaitExpr(CoawaitExpr *E) {
        +  VisitExpr(E);
        +  E->KeywordLoc = ReadSourceLocation();
        +  for (auto &SubExpr: E->SubExprs)
        +    SubExpr = Record.readSubStmt();
        +  E->OpaqueValue = cast_or_null(Record.readSubStmt());
        +  E->setIsImplicit(Record.readInt() != 0);
         }
         
        -void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr *S) {
        -  // FIXME: Implement coroutine serialization.
        -  llvm_unreachable("unimplemented");
        +void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr *E) {
        +  VisitExpr(E);
        +  E->KeywordLoc = ReadSourceLocation();
        +  for (auto &SubExpr: E->SubExprs)
        +    SubExpr = Record.readSubStmt();
        +  E->OpaqueValue = cast_or_null(Record.readSubStmt());
         }
         
        -void ASTStmtReader::VisitCoyieldExpr(CoyieldExpr *S) {
        -  // FIXME: Implement coroutine serialization.
        -  llvm_unreachable("unimplemented");
        +void ASTStmtReader::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
        +  VisitExpr(E);
        +  E->KeywordLoc = ReadSourceLocation();
        +  for (auto &SubExpr: E->SubExprs)
        +    SubExpr = Record.readSubStmt();
         }
         
         void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) {
        @@ -3947,6 +3964,29 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
               S = LambdaExpr::CreateDeserialized(Context, NumCaptures);
               break;
             }
        +
        +    case STMT_COROUTINE_BODY: {
        +      unsigned NumParams = Record[ASTStmtReader::NumStmtFields];
        +      S = CoroutineBodyStmt::Create(Context, Empty, NumParams);
        +      break;
        +    }
        +
        +    case STMT_CORETURN:
        +      S = new (Context) CoreturnStmt(Empty);
        +      break;
        +
        +    case EXPR_COAWAIT:
        +      S = new (Context) CoawaitExpr(Empty);
        +      break;
        +
        +    case EXPR_COYIELD:
        +      S = new (Context) CoyieldExpr(Empty);
        +      break;
        +
        +    case EXPR_DEPENDENT_COAWAIT:
        +      S = new (Context) DependentCoawaitExpr(Empty);
        +      break;
        +
             }
         
             // We hit a STMT_STOP, so we're done with this expression.
        
        Modified: vendor/clang/dist/lib/Serialization/ASTWriterStmt.cpp
        ==============================================================================
        --- vendor/clang/dist/lib/Serialization/ASTWriterStmt.cpp	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/lib/Serialization/ASTWriterStmt.cpp	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -286,7 +286,7 @@ void ASTStmtWriter::VisitMSAsmStmt(MSAsmStmt *S) {
           }
         
           // Outputs
        -  for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {      
        +  for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
             Record.AddStmt(S->getOutputExpr(I));
             Record.AddString(S->getOutputConstraint(I));
           }
        @@ -300,29 +300,48 @@ void ASTStmtWriter::VisitMSAsmStmt(MSAsmStmt *S) {
           Code = serialization::STMT_MSASM;
         }
         
        -void ASTStmtWriter::VisitCoroutineBodyStmt(CoroutineBodyStmt *S) {
        -  // FIXME: Implement coroutine serialization.
        -  llvm_unreachable("unimplemented");
        +void ASTStmtWriter::VisitCoroutineBodyStmt(CoroutineBodyStmt *CoroStmt) {
        +  VisitStmt(CoroStmt);
        +  Record.push_back(CoroStmt->getParamMoves().size());
        +  for (Stmt *S : CoroStmt->children())
        +    Record.AddStmt(S);
        +  Code = serialization::STMT_COROUTINE_BODY;
         }
         
         void ASTStmtWriter::VisitCoreturnStmt(CoreturnStmt *S) {
        -  // FIXME: Implement coroutine serialization.
        -  llvm_unreachable("unimplemented");
        +  VisitStmt(S);
        +  Record.AddSourceLocation(S->getKeywordLoc());
        +  Record.AddStmt(S->getOperand());
        +  Record.AddStmt(S->getPromiseCall());
        +  Record.push_back(S->isImplicit());
        +  Code = serialization::STMT_CORETURN;
         }
         
        -void ASTStmtWriter::VisitCoawaitExpr(CoawaitExpr *S) {
        -  // FIXME: Implement coroutine serialization.
        -  llvm_unreachable("unimplemented");
        +void ASTStmtWriter::VisitCoroutineSuspendExpr(CoroutineSuspendExpr *E) {
        +  VisitExpr(E);
        +  Record.AddSourceLocation(E->getKeywordLoc());
        +  for (Stmt *S : E->children())
        +    Record.AddStmt(S);
        +  Record.AddStmt(E->getOpaqueValue());
         }
         
        -void ASTStmtWriter::VisitDependentCoawaitExpr(DependentCoawaitExpr *S) {
        -  // FIXME: Implement coroutine serialization.
        -  llvm_unreachable("unimplemented");
        +void ASTStmtWriter::VisitCoawaitExpr(CoawaitExpr *E) {
        +  VisitCoroutineSuspendExpr(E);
        +  Record.push_back(E->isImplicit());
        +  Code = serialization::EXPR_COAWAIT;
         }
         
        -void ASTStmtWriter::VisitCoyieldExpr(CoyieldExpr *S) {
        -  // FIXME: Implement coroutine serialization.
        -  llvm_unreachable("unimplemented");
        +void ASTStmtWriter::VisitCoyieldExpr(CoyieldExpr *E) {
        +  VisitCoroutineSuspendExpr(E);
        +  Code = serialization::EXPR_COYIELD;
        +}
        +
        +void ASTStmtWriter::VisitDependentCoawaitExpr(DependentCoawaitExpr *E) {
        +  VisitExpr(E);
        +  Record.AddSourceLocation(E->getKeywordLoc());
        +  for (Stmt *S : E->children())
        +    Record.AddStmt(S);
        +  Code = serialization::EXPR_DEPENDENT_COAWAIT;
         }
         
         void ASTStmtWriter::VisitCapturedStmt(CapturedStmt *S) {
        
        Added: vendor/clang/dist/test/CodeGen/pause.c
        ==============================================================================
        --- /dev/null	00:00:00 1970	(empty, because file is newly added)
        +++ vendor/clang/dist/test/CodeGen/pause.c	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -0,0 +1,11 @@
        +// RUN: %clang_cc1 -ffreestanding %s -triple=i386-pc-win32 -target-feature -sse2 -emit-llvm -o - -Wall -Werror | FileCheck %s
        +// RUN: %clang_cc1 -ffreestanding %s -triple=i386-pc-win32 -target-feature +sse2 -emit-llvm -o - -Wall -Werror | FileCheck %s
        +
        +
        +#include 
        +
        +void test_mm_pause() {
        +  // CHECK-LABEL: test_mm_pause
        +  // CHECK: call void @llvm.x86.sse2.pause()
        +  return _mm_pause();
        +}
        
        Added: vendor/clang/dist/test/CodeGen/x86-nontemporal.c
        ==============================================================================
        --- /dev/null	00:00:00 1970	(empty, because file is newly added)
        +++ vendor/clang/dist/test/CodeGen/x86-nontemporal.c	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -0,0 +1,93 @@
        +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -target-feature +avx -target-feature +avx2 -target-feature +avx512f -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK
        +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -target-feature +avx -target-feature +avx2 -target-feature +avx512f -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK
        +
        +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -target-feature +avx -target-feature +avx2 -target-feature +avx512f -emit-llvm -o - -Wall -Werror -fmax-type-align=16 | FileCheck %s --check-prefix=CHECK
        +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -target-feature +avx -target-feature +avx2 -target-feature +avx512f -fno-signed-char -emit-llvm -o - -Wall -Werror -fmax-type-align=16 | FileCheck %s --check-prefix=CHECK
        +
        +#include 
        +
        +// (PR33830) Tests ensure the correct alignment of non-temporal load/stores on darwin targets where fmax-type-align is set to 16.
        +
        +//
        +// 128-bit vectors
        +//
        +
        +void test_mm_stream_pd(double* A, __m128d B) {
        +  // CHECK-LABEL: test_mm_stream_pd
        +  // CHECK: store <2 x double> %{{.*}}, <2 x double>* %{{.*}}, align 16, !nontemporal
        +  _mm_stream_pd(A, B);
        +}
        +
        +void test_mm_stream_ps(float* A, __m128 B) {
        +  // CHECK16-LABEL: test_mm_stream_ps
        +  // CHECK16: store <4 x float> %{{.*}}, <4 x float>* %{{.*}}, align 16, !nontemporal
        +  _mm_stream_ps(A, B);
        +}
        +
        +void test_mm_stream_si128(__m128i* A, __m128i B) {
        +  // CHECK-LABEL: test_mm_stream_si128
        +  // CHECK: store <2 x i64> %{{.*}}, <2 x i64>* %{{.*}}, align 16, !nontemporal
        +  _mm_stream_si128(A, B);
        +}
        +
        +__m128i test_mm_stream_load_si128(__m128i const *A) {
        +  // CHECK-LABEL: test_mm_stream_load_si128
        +  // CHECK: load <2 x i64>, <2 x i64>* %{{.*}}, align 16, !nontemporal
        +  return _mm_stream_load_si128(A);
        +}
        +
        +//
        +// 256-bit vectors
        +//
        +
        +void test_mm256_stream_pd(double* A, __m256d B) {
        +  // CHECK-LABEL: test_mm256_stream_pd
        +  // CHECK: store <4 x double> %{{.*}}, <4 x double>* %{{.*}}, align 32, !nontemporal
        +  _mm256_stream_pd(A, B);
        +}
        +
        +void test_mm256_stream_ps(float* A, __m256 B) {
        +  // CHECK-LABEL: test_mm256_stream_ps
        +  // CHECK: store <8 x float> %{{.*}}, <8 x float>* %{{.*}}, align 32, !nontemporal
        +  _mm256_stream_ps(A, B);
        +}
        +
        +void test_mm256_stream_si256(__m256i* A, __m256i B) {
        +  // CHECK-LABEL: test_mm256_stream_si256
        +  // CHECK: store <4 x i64> %{{.*}}, <4 x i64>* %{{.*}}, align 32, !nontemporal
        +  _mm256_stream_si256(A, B);
        +}
        +
        +__m256i test_mm256_stream_load_si256(__m256i const *A) {
        +  // CHECK-LABEL: test_mm256_stream_load_si256
        +  // CHECK: load <4 x i64>, <4 x i64>* %{{.*}}, align 32, !nontemporal
        +  return _mm256_stream_load_si256(A);
        +}
        +
        +//
        +// 512-bit vectors
        +//
        +
        +void test_mm512_stream_pd(double* A, __m512d B) {
        +  // CHECK-LABEL: test_mm512_stream_pd
        +  // CHECK: store <8 x double> %{{.*}}, <8 x double>* %{{.*}}, align 64, !nontemporal
        +  _mm512_stream_pd(A, B);
        +}
        +
        +void test_mm512_stream_ps(float* A, __m512 B) {
        +  // CHECK-LABEL: test_mm512_stream_ps
        +  // CHECK: store <16 x float> %{{.*}}, <16 x float>* %{{.*}}, align 64, !nontemporal
        +  _mm512_stream_ps(A, B);
        +}
        +
        +void test_mm512_stream_si512(__m512i* A, __m512i B) {
        +  // CHECK-LABEL: test_mm512_stream_si512
        +  // CHECK: store <8 x i64> %{{.*}}, <8 x i64>* %{{.*}}, align 64, !nontemporal
        +  _mm512_stream_si512(A, B);
        +}
        +
        +__m512i test_mm512_stream_load_si512(void *A) {
        +  // CHECK-LABEL: test_mm512_stream_load_si512
        +  // CHECK: load <8 x i64>, <8 x i64>* %{{.*}}, align 64, !nontemporal
        +  return _mm512_stream_load_si512(A);
        +}
        
        Modified: vendor/clang/dist/test/Driver/openbsd.c
        ==============================================================================
        --- vendor/clang/dist/test/Driver/openbsd.c	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/test/Driver/openbsd.c	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -77,7 +77,9 @@
         // Check linking against correct startup code when (not) using PIE
         // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \
         // RUN:   | FileCheck -check-prefix=CHECK-PIE %s
        -// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -fno-pie %s -### 2>&1 \
        +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pie %s -### 2>&1 \
        +// RUN:   | FileCheck -check-prefix=CHECK-PIE-FLAG %s
        +// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -fno-pie %s -### 2>&1 \
         // RUN:   | FileCheck -check-prefix=CHECK-PIE %s
         // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 2>&1 \
         // RUN:   | FileCheck -check-prefix=CHECK-STATIC-PIE %s
        @@ -93,6 +95,7 @@
         // RUN:   | FileCheck -check-prefix=CHECK-NOPIE %s
         // CHECK-PIE: "{{.*}}crt0.o"
         // CHECK-PIE-NOT: "-nopie"
        +// CHECK-PIE-FLAG: "-pie"
         // CHECK-STATIC-PIE: "{{.*}}rcrt0.o"
         // CHECK-STATIC-PIE-NOT: "-nopie"
         // CHECK-NOPIE: "-nopie" "{{.*}}crt0.o"
        
        Modified: vendor/clang/dist/test/Misc/caret-diags-multiline.cpp
        ==============================================================================
        --- vendor/clang/dist/test/Misc/caret-diags-multiline.cpp	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/test/Misc/caret-diags-multiline.cpp	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -232,3 +232,8 @@ void multiple_ranges(int a, int b) {
           b
           );
         }
        +
        +#define pr33902_a(b) #b
        +#define pr33902_c(d) _Pragma(pr33902_a(d))
        +#define pr33902_e(f) pr33902_c(GCC warning #f)
        +pr33902_e() pr33902_e()
        
        Added: vendor/clang/dist/test/PCH/coroutines.cpp
        ==============================================================================
        --- /dev/null	00:00:00 1970	(empty, because file is newly added)
        +++ vendor/clang/dist/test/PCH/coroutines.cpp	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -0,0 +1,77 @@
        +// Test this without pch.
        +// RUN: %clang_cc1 -include %s -verify -std=c++1z -fcoroutines-ts %s
        +
        +// Test with pch.
        +// RUN: %clang_cc1 -std=c++1z -fcoroutines-ts  -emit-pch -o %t %s
        +// RUN: %clang_cc1 -include-pch %t -verify -std=c++1z -fcoroutines-ts %s
        +
        +#ifndef HEADER
        +#define HEADER
        +
        +namespace std::experimental {
        +template  struct coroutine_traits;
        +
        +template  struct coroutine_handle {
        +  coroutine_handle() = default;
        +  static coroutine_handle from_address(void *) noexcept;
        +};
        +template <> struct coroutine_handle {
        +  static coroutine_handle from_address(void *) noexcept;
        +  coroutine_handle() = default;
        +  template 
        +  coroutine_handle(coroutine_handle) noexcept;
        +};
        +}
        +
        +struct suspend_always {
        +  bool await_ready() noexcept;
        +  void await_suspend(std::experimental::coroutine_handle<>) noexcept;
        +  void await_resume() noexcept;
        +};
        +
        +template  struct std::experimental::coroutine_traits {
        +  struct promise_type {
        +    void get_return_object() noexcept;
        +    suspend_always initial_suspend() noexcept;
        +    suspend_always final_suspend() noexcept;
        +    void return_void() noexcept;
        +    suspend_always yield_value(int) noexcept;
        +    promise_type();
        +    ~promise_type() noexcept;
        +    void unhandled_exception() noexcept;
        +  };
        +};
        +
        +template  struct std::experimental::coroutine_traits {
        +  struct promise_type {
        +    int get_return_object() noexcept;
        +    suspend_always initial_suspend() noexcept;
        +    suspend_always final_suspend() noexcept;
        +    void return_value(int) noexcept;
        +    promise_type();
        +    ~promise_type() noexcept;
        +    void unhandled_exception() noexcept;
        +  };
        +};
        +
        +template 
        +void f(T x) {  // checks coawait_expr and coroutine_body_stmt
        +  co_yield 42; // checks coyield_expr
        +  co_await x;  // checks dependent_coawait
        +  co_return;   // checks coreturn_stmt
        +}
        +
        +template 
        +int f2(T x) {  // checks coawait_expr and coroutine_body_stmt
        +  co_return x;   // checks coreturn_stmt with expr
        +}
        +
        +#else
        +
        +// expected-no-diagnostics
        +void g() {
        +  f(suspend_always{});
        +  f2(42);
        +}
        +
        +#endif
        
        Modified: vendor/clang/dist/test/Preprocessor/init.c
        ==============================================================================
        --- vendor/clang/dist/test/Preprocessor/init.c	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/test/Preprocessor/init.c	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -4686,16 +4686,6 @@
         // RUN:   | FileCheck -match-full-lines -check-prefix MIPS-MSA %s
         // MIPS-MSA:#define __mips_msa 1
         //
        -// RUN: %clang_cc1 -target-feature +nomadd4 \
        -// RUN:   -E -dM -triple=mips-none-none < /dev/null \
        -// RUN:   | FileCheck -match-full-lines -check-prefix MIPS-NOMADD4 %s
        -// MIPS-NOMADD4:#define __mips_no_madd4 1
        -//
        -// RUN: %clang_cc1 \
        -// RUN:   -E -dM -triple=mips-none-none < /dev/null \
        -// RUN:   | FileCheck -match-full-lines -check-prefix MIPS-MADD4 %s
        -// MIPS-MADD4-NOT:#define __mips_no_madd4 1
        -//
         // RUN: %clang_cc1 -target-cpu mips32r3 -target-feature +nan2008 \
         // RUN:   -E -dM -triple=mips-none-none < /dev/null \
         // RUN:   | FileCheck -match-full-lines -check-prefix MIPS-NAN2008 %s
        
        Modified: vendor/clang/dist/test/Sema/vector-cast.c
        ==============================================================================
        --- vendor/clang/dist/test/Sema/vector-cast.c	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/test/Sema/vector-cast.c	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -48,6 +48,9 @@ typedef float float2 __attribute__ ((vector_size (8)))
         typedef __attribute__((vector_size(8))) double float64x1_t;
         typedef __attribute__((vector_size(16))) double float64x2_t;
         float64x1_t vget_low_f64(float64x2_t __p0);
        +typedef float float16 __attribute__((__vector_size__(16)));
        +typedef signed int vSInt32 __attribute__((__vector_size__(16)));
        +typedef unsigned int vUInt32 __attribute__((__vector_size__(16)));
         
         void f4() {
           float2 f2;
        @@ -72,4 +75,9 @@ void f5() {
           void *ptr;
           v = ptr; // expected-error-re {{assigning to 'short_sizeof_pointer' (vector of {{[0-9]+}} 'short' values) from incompatible type 'void *'}}
           ptr = v; // expected-error {{assigning to 'void *' from incompatible type 'short_sizeof_pointer'}}
        +}
        +
        +void f6(vSInt32 a0) {
        +  vUInt32 counter = (float16){0.0f, 0.0f, 0.0f, 0.0f}; // expected-warning {{incompatible vector types initializing 'vUInt32' (vector of 4 'unsigned int' values) with an expression of type 'float16' (vector of 4 'float' values)}}
        +  counter -= a0;
         }
        
        Modified: vendor/clang/dist/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
        ==============================================================================
        --- vendor/clang/dist/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp	Tue Aug  8 16:53:02 2017	(r322260)
        +++ vendor/clang/dist/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp	Tue Aug  8 16:53:22 2017	(r322261)
        @@ -1,5 +1,10 @@
        -// RUN: %clang_cc1 -std=c++1z -verify %s
        +// RUN: %clang_cc1 -std=c++1z -verify %s -DERRORS
        +// RUN: %clang_cc1 -std=c++1z -verify %s -UERRORS
         
        +// This test is split into two because we only produce "undefined internal"
        +// warnings if we didn't produce any errors.
        +#if ERRORS
        +
         namespace std {
           using size_t = decltype(sizeof(0));
           template struct initializer_list {
        @@ -280,3 +285,21 @@ namespace tuple_tests {
             scoped_lock l = {};
           }
         }
        +
        +#else
        +
        +// expected-no-diagnostics
        +namespace undefined_warnings {
        +  // Make sure we don't get an "undefined but used internal symbol" warning for the deduction guide here.
        +  namespace {
        +    template 
        +    struct TemplDObj {
        +      explicit TemplDObj(T func) noexcept {}
        +    };
        +    auto test1 = TemplDObj(0);
        +
        +    TemplDObj(float) -> TemplDObj;
        +    auto test2 = TemplDObj(.0f);
        +  }
        +}
        +#endif
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 16:53:32 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2282DC30AF;
         Tue,  8 Aug 2017 16:53:32 +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 mx1.freebsd.org (Postfix) with ESMTPS id A70D369CF1;
         Tue,  8 Aug 2017 16:53:32 +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 v78GrVdn082672;
         Tue, 8 Aug 2017 16:53:31 GMT (envelope-from dim@FreeBSD.org)
        Received: (from dim@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78GrV6A082671;
         Tue, 8 Aug 2017 16:53:31 GMT (envelope-from dim@FreeBSD.org)
        Message-Id: <201708081653.v78GrV6A082671@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org
         using -f
        From: Dimitry Andric 
        Date: Tue, 8 Aug 2017 16:53:31 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322262 - vendor/clang/clang-release_50-r310316
        X-SVN-Group: vendor
        X-SVN-Commit-Author: dim
        X-SVN-Commit-Paths: vendor/clang/clang-release_50-r310316
        X-SVN-Commit-Revision: 322262
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 16:53:33 -0000
        
        Author: dim
        Date: Tue Aug  8 16:53:31 2017
        New Revision: 322262
        URL: https://svnweb.freebsd.org/changeset/base/322262
        
        Log:
          Tag clang release_50 branch r310316.
        
        Added:
          vendor/clang/clang-release_50-r310316/
             - copied from r322261, vendor/clang/dist/
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 16:53:36 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52E2FDC30F6;
         Tue,  8 Aug 2017 16:53: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 mx1.freebsd.org (Postfix) with ESMTPS id 0779569D25;
         Tue,  8 Aug 2017 16:53:35 +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 v78GrZWk082718;
         Tue, 8 Aug 2017 16:53:35 GMT (envelope-from dim@FreeBSD.org)
        Received: (from dim@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78GrZKx082717;
         Tue, 8 Aug 2017 16:53:35 GMT (envelope-from dim@FreeBSD.org)
        Message-Id: <201708081653.v78GrZKx082717@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org
         using -f
        From: Dimitry Andric 
        Date: Tue, 8 Aug 2017 16:53:35 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322263 -
         vendor/compiler-rt/compiler-rt-release_50-r310316
        X-SVN-Group: vendor
        X-SVN-Commit-Author: dim
        X-SVN-Commit-Paths: vendor/compiler-rt/compiler-rt-release_50-r310316
        X-SVN-Commit-Revision: 322263
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 16:53:36 -0000
        
        Author: dim
        Date: Tue Aug  8 16:53:34 2017
        New Revision: 322263
        URL: https://svnweb.freebsd.org/changeset/base/322263
        
        Log:
          Tag compiler-rt release_50 branch r310316.
        
        Added:
          vendor/compiler-rt/compiler-rt-release_50-r310316/
             - copied from r322262, vendor/compiler-rt/dist/
        
        From owner-svn-src-all@freebsd.org  Tue Aug  8 16:53:42 2017
        Return-Path: 
        Delivered-To: svn-src-all@mailman.ysv.freebsd.org
        Received: from mx1.freebsd.org (mx1.freebsd.org
         [IPv6:2001:1900:2254:206a::19:1])
         by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DA0DDC317A;
         Tue,  8 Aug 2017 16:53: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 mx1.freebsd.org (Postfix) with ESMTPS id 5DC8669DDB;
         Tue,  8 Aug 2017 16:53: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 v78Grfct082777;
         Tue, 8 Aug 2017 16:53:41 GMT (envelope-from dim@FreeBSD.org)
        Received: (from dim@localhost)
         by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78GreBB082767;
         Tue, 8 Aug 2017 16:53:40 GMT (envelope-from dim@FreeBSD.org)
        Message-Id: <201708081653.v78GreBB082767@repo.freebsd.org>
        X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org
         using -f
        From: Dimitry Andric 
        Date: Tue, 8 Aug 2017 16:53:40 +0000 (UTC)
        To: src-committers@freebsd.org, svn-src-all@freebsd.org,
         svn-src-vendor@freebsd.org
        Subject: svn commit: r322264 - in vendor/libc++/dist: include
         test/std/input.output/string.streams/stringstream.cons
         test/std/thread/thread.mutex/thread.lock/thread.lock.scoped
         test/std/utilities/variant/va...
        X-SVN-Group: vendor
        X-SVN-Commit-Author: dim
        X-SVN-Commit-Paths: in vendor/libc++/dist: include
         test/std/input.output/string.streams/stringstream.cons
         test/std/thread/thread.mutex/thread.lock/thread.lock.scoped
         test/std/utilities/variant/variant.variant/variant.cto...
        X-SVN-Commit-Revision: 322264
        X-SVN-Commit-Repository: base
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        X-BeenThere: svn-src-all@freebsd.org
        X-Mailman-Version: 2.1.23
        Precedence: list
        List-Id: "SVN commit messages 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, 08 Aug 2017 16:53:42 -0000
        
        Author: dim
        Date: Tue Aug  8 16:53:40 2017
        New Revision: 322264
        URL: https://svnweb.freebsd.org/changeset/base/322264
        
        Log:
          Vendor import of libc++ release_50 branch r310316:
          https://llvm.org/svn/llvm-project/libcxx/branches/release_50@310316
        
        Modified:
          vendor/libc++/dist/include/__bsd_locale_defaults.h
          vendor/libc++/dist/include/__bsd_locale_fallbacks.h
          vendor/libc++/dist/include/__locale
          vendor/libc++/dist/include/mutex
          vendor/libc++/dist/include/sstream
          vendor/libc++/dist/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp
          vendor/libc++/dist/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp
          vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
          vendor/libc++/dist/www/cxx1z_status.html
          vendor/libc++/dist/www/cxx2a_status.html
        
        Modified: vendor/libc++/dist/include/__bsd_locale_defaults.h
        ==============================================================================
        --- vendor/libc++/dist/include/__bsd_locale_defaults.h	Tue Aug  8 16:53:34 2017	(r322263)
        +++ vendor/libc++/dist/include/__bsd_locale_defaults.h	Tue Aug  8 16:53:40 2017	(r322264)
        @@ -15,6 +15,10 @@
         #ifndef _LIBCPP_BSD_LOCALE_DEFAULTS_H
         #define _LIBCPP_BSD_LOCALE_DEFAULTS_H
         
        +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
        +#pragma GCC system_header
        +#endif
        +
         #define __libcpp_mb_cur_max_l(loc)                          MB_CUR_MAX_L(loc)
         #define __libcpp_btowc_l(ch, loc)                           btowc_l(ch, loc)
         #define __libcpp_wctob_l(wch, loc)                          wctob_l(wch, loc)
        
        Modified: vendor/libc++/dist/include/__bsd_locale_fallbacks.h
        ==============================================================================
        --- vendor/libc++/dist/include/__bsd_locale_fallbacks.h	Tue Aug  8 16:53:34 2017	(r322263)
        +++ vendor/libc++/dist/include/__bsd_locale_fallbacks.h	Tue Aug  8 16:53:40 2017	(r322264)
        @@ -18,6 +18,10 @@
         #include 
         #include 
         
        +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
        +#pragma GCC system_header
        +#endif
        +
         _LIBCPP_BEGIN_NAMESPACE_STD
         
         inline _LIBCPP_ALWAYS_INLINE
        
        Modified: vendor/libc++/dist/include/__locale
        ==============================================================================
        --- vendor/libc++/dist/include/__locale	Tue Aug  8 16:53:34 2017	(r322263)
        +++ vendor/libc++/dist/include/__locale	Tue Aug  8 16:53:40 2017	(r322264)
        @@ -34,7 +34,7 @@
         # include 
         #elif defined(_NEWLIB_VERSION)
         # include 
        -#elif (defined(__GLIBC__) || defined(__APPLE__)      || defined(__FreeBSD__) \
        +#elif (defined(__APPLE__)      || defined(__FreeBSD__) \
             || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
         # include 
         #elif defined(__Fuchsia__)
        
        Modified: vendor/libc++/dist/include/mutex
        ==============================================================================
        --- vendor/libc++/dist/include/mutex	Tue Aug  8 16:53:34 2017	(r322263)
        +++ vendor/libc++/dist/include/mutex	Tue Aug  8 16:53:40 2017	(r322264)
        @@ -116,7 +116,7 @@ class scoped_lock // C++17 (public)
             using mutex_type = Mutex;  // If MutexTypes... consists of the single type Mutex
         
             explicit scoped_lock(MutexTypes&... m);
        -    scoped_lock(MutexTypes&... m, adopt_lock_t);
        +    scoped_lock(adopt_lock_t, MutexTypes&... m);
             ~scoped_lock();
             scoped_lock(scoped_lock const&) = delete;
             scoped_lock& operator=(scoped_lock const&) = delete;
        @@ -500,7 +500,7 @@ class _LIBCPP_TEMPLATE_VIS scoped_lock<_Mutex> { (publ
             ~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();}
         
             _LIBCPP_INLINE_VISIBILITY
        -    explicit scoped_lock(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
        +    explicit scoped_lock(adopt_lock_t, mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
                 : __m_(__m) {}
         
             scoped_lock(scoped_lock const&) = delete;
        @@ -522,7 +522,7 @@ class _LIBCPP_TEMPLATE_VIS scoped_lock (public)
             }
         
             _LIBCPP_INLINE_VISIBILITY
        -    scoped_lock(_MArgs&... __margs, adopt_lock_t)
        +    scoped_lock(adopt_lock_t, _MArgs&... __margs)
                 : __t_(__margs...)
             {
             }
        
        Modified: vendor/libc++/dist/include/sstream
        ==============================================================================
        --- vendor/libc++/dist/include/sstream	Tue Aug  8 16:53:34 2017	(r322263)
        +++ vendor/libc++/dist/include/sstream	Tue Aug  8 16:53:40 2017	(r322264)
        @@ -249,7 +249,8 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_st
         template 
         basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& __s,
                                      ios_base::openmode __wch)
        -    : __hm_(0),
        +    : __str_(__s.get_allocator()),
        +      __hm_(0),
               __mode_(__wch)
         {
             str(__s);
        
        Modified: vendor/libc++/dist/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp
        ==============================================================================
        --- vendor/libc++/dist/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp	Tue Aug  8 16:53:34 2017	(r322263)
        +++ vendor/libc++/dist/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp	Tue Aug  8 16:53:40 2017	(r322264)
        @@ -18,6 +18,16 @@
         #include 
         #include 
         
        +template
        +struct NoDefaultAllocator : std::allocator
        +{
        +  template struct rebind { using other = NoDefaultAllocator; };
        +  NoDefaultAllocator(int id_) : id(id_) { }
        +  template NoDefaultAllocator(const NoDefaultAllocator& a) : id(a.id) { }
        +  int id;
        +};
        +
        +
         int main()
         {
             {
        @@ -45,5 +55,14 @@ int main()
                 assert(i == 456);
                 ss << i << ' ' << 123;
                 assert(ss.str() == L"456 1236 ");
        +    }
        +    { // This is https://bugs.llvm.org/show_bug.cgi?id=33727
        +		typedef std::basic_string   , NoDefaultAllocator > S;
        +		typedef std::basic_stringbuf, NoDefaultAllocator > SB;
        +
        +		S s(NoDefaultAllocator(1));
        +		SB sb(s);
        +	//	This test is not required by the standard, but *where else* could it get the allocator?
        +		assert(sb.str().get_allocator() == s.get_allocator());
             }
         }
        
        Modified: vendor/libc++/dist/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp
        ==============================================================================
        --- vendor/libc++/dist/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp	Tue Aug  8 16:53:34 2017	(r322263)
        +++ vendor/libc++/dist/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp	Tue Aug  8 16:53:40 2017	(r322264)
        @@ -14,7 +14,7 @@
         
         // template  class scoped_lock;
         
        -// scoped_lock(Mutex&..., adopt_lock_t);
        +// scoped_lock(adopt_lock_t, Mutex&...);
         
         #include 
         #include 
        @@ -43,7 +43,7 @@ int main()
                 using LG = std::scoped_lock;
                 m1.lock();
                 {
        -            LG lg(m1, std::adopt_lock);
        +            LG lg(std::adopt_lock, m1);
                     assert(m1.locked);
                 }
                 assert(!m1.locked);
        @@ -53,7 +53,7 @@ int main()
                 using LG = std::scoped_lock;
                 m1.lock(); m2.lock();
                 {
        -            LG lg(m1, m2, std::adopt_lock);
        +            LG lg(std::adopt_lock, m1, m2);
                     assert(m1.locked && m2.locked);
                 }
                 assert(!m1.locked && !m2.locked);
        @@ -63,7 +63,7 @@ int main()
                 using LG = std::scoped_lock;
                 m1.lock(); m2.lock(); m3.lock();
                 {
        -            LG lg(m1, m2, m3, std::adopt_lock);
        +            LG lg(std::adopt_lock, m1, m2, m3);
                     assert(m1.locked && m2.locked && m3.locked);
                 }
                 assert(!m1.locked && !m2.locked && !m3.locked);
        
        Modified: vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
        ==============================================================================
        --- vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp	Tue Aug  8 16:53:34 2017	(r322263)
        +++ vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp	Tue Aug  8 16:53:40 2017	(r322264)
        @@ -261,4 +261,13 @@ int main() {
           test_copy_ctor_valueless_by_exception();
           test_copy_ctor_sfinae();
           test_constexpr_copy_ctor_extension();
        +#if 0
        +// disable this for the moment; it fails on older compilers.
        +//  Need to figure out which compilers will support it.
        +{ // This is the motivating example from P0739R0
        +  std::variant v1(3);
        +  std::variant v2 = v1;
        +  (void) v2;
        +}
        +#endif
         }
        
        Modified: vendor/libc++/dist/www/cxx1z_status.html
        ==============================================================================
        --- vendor/libc++/dist/www/cxx1z_status.html	Tue Aug  8 16:53:34 2017	(r322263)
        +++ vendor/libc++/dist/www/cxx1z_status.html	Tue Aug  8 16:53:40 2017	(r322264)
        @@ -39,6 +39,8 @@
           

        In February 2017, the C++ standard committee approved this draft, and sent it to ISO for approval as C++17

        This page shows the status of libc++; the status of clang's support of the language features is here.

        +

        Reminder: Features in unreleased drafts of the standard are subject to change.

        +

        The groups that have contributed papers:

        • LWG - Library working group
        • @@ -163,7 +165,7 @@ P0623R0LWGFinal C++17 Parallel Algorithms FixesKona P0682R1LWGRepairing elementary string conversionsToronto - P0739R0LWGSome improvements to class template argument deduction integration into the standard libraryToronto + P0739R0LWGSome improvements to class template argument deduction integration into the standard libraryTorontoComplete5.0 @@ -497,7 +499,7 @@ -

          Last Updated: 25-May-2017

          +

          Last Updated: 27-Jul-2017

          Modified: vendor/libc++/dist/www/cxx2a_status.html ============================================================================== --- vendor/libc++/dist/www/cxx2a_status.html Tue Aug 8 16:53:34 2017 (r322263) +++ vendor/libc++/dist/www/cxx2a_status.html Tue Aug 8 16:53:40 2017 (r322264) @@ -38,6 +38,8 @@

          In July 2017, the C++ standard committee created a draft for the next version of the C++ standard, known here as "C++2a" (probably to be C++20).

          This page shows the status of libc++; the status of clang's support of the language features is here.

          +

          Reminder: Features in unreleased drafts of the standard are subject to change.

          +

          The groups that have contributed papers:

          • LWG - Library working group
          • From owner-svn-src-all@freebsd.org Tue Aug 8 16:53:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C806DC320F; Tue, 8 Aug 2017 16:53:50 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0971B69EA5; Tue, 8 Aug 2017 16:53: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 v78GrnUV082874; Tue, 8 Aug 2017 16:53:49 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78GrnL0082873; Tue, 8 Aug 2017 16:53:49 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708081653.v78GrnL0082873@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 8 Aug 2017 16:53:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322266 - vendor/lld/lld-release_50-r310316 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lld/lld-release_50-r310316 X-SVN-Commit-Revision: 322266 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 16:53:50 -0000 Author: dim Date: Tue Aug 8 16:53:48 2017 New Revision: 322266 URL: https://svnweb.freebsd.org/changeset/base/322266 Log: Tag lld release_50 branch r310316. Added: vendor/lld/lld-release_50-r310316/ - copied from r322265, vendor/lld/dist/ From owner-svn-src-all@freebsd.org Tue Aug 8 16:53:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3167DC319F; Tue, 8 Aug 2017 16:53: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 mx1.freebsd.org (Postfix) with ESMTPS id 91D6D69E2C; Tue, 8 Aug 2017 16:53: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 v78GriYs082827; Tue, 8 Aug 2017 16:53:44 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78GriXe082826; Tue, 8 Aug 2017 16:53:44 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708081653.v78GriXe082826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 8 Aug 2017 16:53:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322265 - vendor/libc++/libc++-release_50-r310316 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/libc++-release_50-r310316 X-SVN-Commit-Revision: 322265 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 16:53:46 -0000 Author: dim Date: Tue Aug 8 16:53:44 2017 New Revision: 322265 URL: https://svnweb.freebsd.org/changeset/base/322265 Log: Tag libc++ release_50 branch r310316. Added: vendor/libc++/libc++-release_50-r310316/ - copied from r322264, vendor/libc++/dist/ From owner-svn-src-all@freebsd.org Tue Aug 8 16:53:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3206ADC326D; Tue, 8 Aug 2017 16:53: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 mx1.freebsd.org (Postfix) with ESMTPS id D447369F21; Tue, 8 Aug 2017 16:53: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 v78Grrgi082923; Tue, 8 Aug 2017 16:53:53 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78GrrHQ082922; Tue, 8 Aug 2017 16:53:53 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708081653.v78GrrHQ082922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 8 Aug 2017 16:53:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322267 - vendor/lldb/lldb-release_50-r310316 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-release_50-r310316 X-SVN-Commit-Revision: 322267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 16:53:54 -0000 Author: dim Date: Tue Aug 8 16:53:52 2017 New Revision: 322267 URL: https://svnweb.freebsd.org/changeset/base/322267 Log: Tag lldb release_50 branch r310316. Added: vendor/lldb/lldb-release_50-r310316/ - copied from r322266, vendor/lldb/dist/ From owner-svn-src-all@freebsd.org Tue Aug 8 17:49:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A95DDC60D3; Tue, 8 Aug 2017 17:49:59 +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 mx1.freebsd.org (Postfix) with ESMTPS id D96116C090; Tue, 8 Aug 2017 17:49: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 v78HnvAg027493; Tue, 8 Aug 2017 17:49:57 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Hnvju027492; Tue, 8 Aug 2017 17:49:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708081749.v78Hnvju027492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 8 Aug 2017 17:49:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322270 - head/sys/dev/mly X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/mly X-SVN-Commit-Revision: 322270 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 17:49:59 -0000 Author: jhb Date: Tue Aug 8 17:49:57 2017 New Revision: 322270 URL: https://svnweb.freebsd.org/changeset/base/322270 Log: Fix a NULL pointer dereference in mly_user_command(). If mly_user_command fails to allocate a command slot it jumps to an 'out' label used for error handling. The error handling code checks for a data buffer in 'mc->mc_data' to free before checking if 'mc' is NULL. Fix by just returning directly if we fail to allocate a command and only using the 'out' label for subsequent errors when there is actual cleanup to perform. PR: 217747 Reported by: PVS-Studio Reviewed by: emaste MFC after: 1 week Modified: head/sys/dev/mly/mly.c Modified: head/sys/dev/mly/mly.c ============================================================================== --- head/sys/dev/mly/mly.c Tue Aug 8 17:26:19 2017 (r322269) +++ head/sys/dev/mly/mly.c Tue Aug 8 17:49:57 2017 (r322270) @@ -2892,8 +2892,7 @@ mly_user_command(struct mly_softc *sc, struct mly_user MLY_LOCK(sc); if (mly_alloc_command(sc, &mc)) { MLY_UNLOCK(sc); - error = ENOMEM; - goto out; /* XXX Linux version will wait for a command */ + return (ENOMEM); /* XXX Linux version will wait for a command */ } MLY_UNLOCK(sc); @@ -2952,11 +2951,9 @@ mly_user_command(struct mly_softc *sc, struct mly_user out: if (mc->mc_data != NULL) free(mc->mc_data, M_DEVBUF); - if (mc != NULL) { - MLY_LOCK(sc); - mly_release_command(mc); - MLY_UNLOCK(sc); - } + MLY_LOCK(sc); + mly_release_command(mc); + MLY_UNLOCK(sc); return(error); } From owner-svn-src-all@freebsd.org Tue Aug 8 18:31:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFFDADC86F5; Tue, 8 Aug 2017 18:31:41 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7F9606E1BA; Tue, 8 Aug 2017 18:31:41 +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 v78IVewE047831; Tue, 8 Aug 2017 18:31:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78IVea9047830; Tue, 8 Aug 2017 18:31:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708081831.v78IVea9047830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 8 Aug 2017 18:31:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322271 - head/sbin/fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sbin/fsck_ffs X-SVN-Commit-Revision: 322271 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 18:31:41 -0000 Author: emaste Date: Tue Aug 8 18:31:40 2017 New Revision: 322271 URL: https://svnweb.freebsd.org/changeset/base/322271 Log: Remove now-unused badsb declaration, missed in r322200 Sponsored by: The FreeBSD Foundation Modified: head/sbin/fsck_ffs/setup.c Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Tue Aug 8 17:49:57 2017 (r322270) +++ head/sbin/fsck_ffs/setup.c Tue Aug 8 18:31:40 2017 (r322271) @@ -58,8 +58,6 @@ struct bufarea asblk; #define altsblock (*asblk.b_un.b_fs) #define POWEROF2(num) (((num) & ((num) - 1)) == 0) -static void badsb(int listerr, const char *s); - /* * Read in a superblock finding an alternate if necessary. * Return 1 if successful, 0 if unsuccessful, -1 if file system From owner-svn-src-all@freebsd.org Tue Aug 8 19:36:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DACADCBDCF; Tue, 8 Aug 2017 19:36:35 +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 mx1.freebsd.org (Postfix) with ESMTPS id 1A0BE7091B; Tue, 8 Aug 2017 19:36:35 +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 v78JaY8X074052; Tue, 8 Aug 2017 19:36:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78JaY4m074051; Tue, 8 Aug 2017 19:36:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708081936.v78JaY4m074051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 8 Aug 2017 19:36:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322272 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 322272 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 19:36:35 -0000 Author: mav Date: Tue Aug 8 19:36:34 2017 New Revision: 322272 URL: https://svnweb.freebsd.org/changeset/base/322272 Log: Fix few issues of LinuxKPI workqueue. LinuxKPI workqueue wrappers reported "successful" cancellation for works already completed in normal way. This change brings reported status and real cancellation fact into sync. This required for drm-next operation. Reviewed by: hselasky (earlier version) Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D11904 Modified: head/sys/compat/linuxkpi/common/src/linux_work.c Modified: head/sys/compat/linuxkpi/common/src/linux_work.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_work.c Tue Aug 8 18:31:40 2017 (r322271) +++ head/sys/compat/linuxkpi/common/src/linux_work.c Tue Aug 8 19:36:34 2017 (r322272) @@ -214,7 +214,7 @@ linux_work_fn(void *context, int pending) [WORK_ST_TIMER] = WORK_ST_EXEC, /* delayed work w/o timeout */ [WORK_ST_TASK] = WORK_ST_EXEC, /* call callback */ [WORK_ST_EXEC] = WORK_ST_IDLE, /* complete callback */ - [WORK_ST_CANCEL] = WORK_ST_IDLE, /* complete cancel */ + [WORK_ST_CANCEL] = WORK_ST_EXEC, /* failed to cancel */ }; struct work_struct *work; struct workqueue_struct *wq; @@ -236,6 +236,7 @@ linux_work_fn(void *context, int pending) switch (linux_update_state(&work->state, states)) { case WORK_ST_TIMER: case WORK_ST_TASK: + case WORK_ST_CANCEL: WQ_EXEC_UNLOCK(wq); /* call work function */ @@ -266,13 +267,14 @@ linux_delayed_work_timer_fn(void *arg) [WORK_ST_IDLE] = WORK_ST_IDLE, /* NOP */ [WORK_ST_TIMER] = WORK_ST_TASK, /* start queueing task */ [WORK_ST_TASK] = WORK_ST_TASK, /* NOP */ - [WORK_ST_EXEC] = WORK_ST_TASK, /* queue task another time */ - [WORK_ST_CANCEL] = WORK_ST_IDLE, /* complete cancel */ + [WORK_ST_EXEC] = WORK_ST_EXEC, /* NOP */ + [WORK_ST_CANCEL] = WORK_ST_TASK, /* failed to cancel */ }; struct delayed_work *dwork = arg; switch (linux_update_state(&dwork->work.state, states)) { case WORK_ST_TIMER: + case WORK_ST_CANCEL: linux_delayed_work_enqueue(dwork); break; default: @@ -290,10 +292,10 @@ linux_cancel_work_sync(struct work_struct *work) { static const uint8_t states[WORK_ST_MAX] __aligned(8) = { [WORK_ST_IDLE] = WORK_ST_IDLE, /* NOP */ - [WORK_ST_TIMER] = WORK_ST_IDLE, /* idle */ - [WORK_ST_TASK] = WORK_ST_IDLE, /* idle */ - [WORK_ST_EXEC] = WORK_ST_IDLE, /* idle */ - [WORK_ST_CANCEL] = WORK_ST_IDLE, /* idle */ + [WORK_ST_TIMER] = WORK_ST_TIMER, /* can't happen */ + [WORK_ST_TASK] = WORK_ST_IDLE, /* cancel and drain */ + [WORK_ST_EXEC] = WORK_ST_IDLE, /* too late, drain */ + [WORK_ST_CANCEL] = WORK_ST_IDLE, /* cancel and drain */ }; struct taskqueue *tq; @@ -302,7 +304,13 @@ linux_cancel_work_sync(struct work_struct *work) switch (linux_update_state(&work->state, states)) { case WORK_ST_IDLE: + case WORK_ST_TIMER: return (0); + case WORK_ST_EXEC: + tq = work->work_queue->taskqueue; + if (taskqueue_cancel(tq, &work->work_task, NULL) != 0) + taskqueue_drain(tq, &work->work_task); + return (0); default: tq = work->work_queue->taskqueue; if (taskqueue_cancel(tq, &work->work_task, NULL) != 0) @@ -343,23 +351,29 @@ linux_cancel_delayed_work(struct delayed_work *dwork) { static const uint8_t states[WORK_ST_MAX] __aligned(8) = { [WORK_ST_IDLE] = WORK_ST_IDLE, /* NOP */ - [WORK_ST_TIMER] = WORK_ST_CANCEL, /* cancel */ - [WORK_ST_TASK] = WORK_ST_CANCEL, /* cancel */ - [WORK_ST_EXEC] = WORK_ST_CANCEL, /* cancel */ - [WORK_ST_CANCEL] = WORK_ST_CANCEL, /* cancel */ + [WORK_ST_TIMER] = WORK_ST_CANCEL, /* try to cancel */ + [WORK_ST_TASK] = WORK_ST_CANCEL, /* try to cancel */ + [WORK_ST_EXEC] = WORK_ST_EXEC, /* NOP */ + [WORK_ST_CANCEL] = WORK_ST_CANCEL, /* NOP */ }; struct taskqueue *tq; switch (linux_update_state(&dwork->work.state, states)) { case WORK_ST_TIMER: - if (linux_cancel_timer(dwork, 0)) + case WORK_ST_CANCEL: + if (linux_cancel_timer(dwork, 0)) { + atomic_cmpxchg(&dwork->work.state, + WORK_ST_CANCEL, WORK_ST_IDLE); return (1); + } /* FALLTHROUGH */ case WORK_ST_TASK: - case WORK_ST_EXEC: tq = dwork->work.work_queue->taskqueue; - if (taskqueue_cancel(tq, &dwork->work.work_task, NULL) == 0) + if (taskqueue_cancel(tq, &dwork->work.work_task, NULL) == 0) { + atomic_cmpxchg(&dwork->work.state, + WORK_ST_CANCEL, WORK_ST_IDLE); return (1); + } /* FALLTHROUGH */ default: return (0); @@ -376,10 +390,10 @@ linux_cancel_delayed_work_sync(struct delayed_work *dw { static const uint8_t states[WORK_ST_MAX] __aligned(8) = { [WORK_ST_IDLE] = WORK_ST_IDLE, /* NOP */ - [WORK_ST_TIMER] = WORK_ST_IDLE, /* idle */ - [WORK_ST_TASK] = WORK_ST_IDLE, /* idle */ - [WORK_ST_EXEC] = WORK_ST_IDLE, /* idle */ - [WORK_ST_CANCEL] = WORK_ST_IDLE, /* idle */ + [WORK_ST_TIMER] = WORK_ST_IDLE, /* cancel and drain */ + [WORK_ST_TASK] = WORK_ST_IDLE, /* cancel and drain */ + [WORK_ST_EXEC] = WORK_ST_IDLE, /* too late, drain */ + [WORK_ST_CANCEL] = WORK_ST_IDLE, /* cancel and drain */ }; struct taskqueue *tq; @@ -389,7 +403,13 @@ linux_cancel_delayed_work_sync(struct delayed_work *dw switch (linux_update_state(&dwork->work.state, states)) { case WORK_ST_IDLE: return (0); + case WORK_ST_EXEC: + tq = dwork->work.work_queue->taskqueue; + if (taskqueue_cancel(tq, &dwork->work.work_task, NULL) != 0) + taskqueue_drain(tq, &dwork->work.work_task); + return (0); case WORK_ST_TIMER: + case WORK_ST_CANCEL: if (linux_cancel_timer(dwork, 1)) { /* * Make sure taskqueue is also drained before @@ -468,6 +488,7 @@ linux_work_pending(struct work_struct *work) switch (atomic_read(&work->state)) { case WORK_ST_TIMER: case WORK_ST_TASK: + case WORK_ST_CANCEL: return (1); default: return (0); @@ -486,7 +507,6 @@ linux_work_busy(struct work_struct *work) case WORK_ST_IDLE: return (0); case WORK_ST_EXEC: - case WORK_ST_CANCEL: tq = work->work_queue->taskqueue; return (taskqueue_poll_is_busy(tq, &work->work_task)); default: From owner-svn-src-all@freebsd.org Tue Aug 8 19:47:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 163B3DCC6C9; Tue, 8 Aug 2017 19:47: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 mx1.freebsd.org (Postfix) with ESMTPS id D3B597100D; Tue, 8 Aug 2017 19:47:12 +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 v78JlBho078011; Tue, 8 Aug 2017 19:47:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78JlBXn078010; Tue, 8 Aug 2017 19:47:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708081947.v78JlBXn078010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 8 Aug 2017 19:47:11 +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: r322273 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 322273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 19:47:13 -0000 Author: markj Date: Tue Aug 8 19:47:11 2017 New Revision: 322273 URL: https://svnweb.freebsd.org/changeset/base/322273 Log: MFC r321884, r321896: Fix a witness assertion that fires when a lock type's class changes. Modified: stable/11/sys/kern/subr_witness.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/subr_witness.c ============================================================================== --- stable/11/sys/kern/subr_witness.c Tue Aug 8 19:36:34 2017 (r322272) +++ stable/11/sys/kern/subr_witness.c Tue Aug 8 19:47:11 2017 (r322273) @@ -1850,12 +1850,14 @@ enroll(const char *description, struct lock_class *loc return (w); found: w->w_refcount++; + if (w->w_refcount == 1) + w->w_class = lock_class; mtx_unlock_spin(&w_mtx); if (lock_class != w->w_class) kassert_panic( - "lock (%s) %s does not match earlier (%s) lock", - description, lock_class->lc_name, - w->w_class->lc_name); + "lock (%s) %s does not match earlier (%s) lock", + description, lock_class->lc_name, + w->w_class->lc_name); return (w); } From owner-svn-src-all@freebsd.org Tue Aug 8 19:49:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AE58DCC912; Tue, 8 Aug 2017 19:49:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC1227119F; Tue, 8 Aug 2017 19:49:36 +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 v78Jna6M078155; Tue, 8 Aug 2017 19:49:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Jna07078154; Tue, 8 Aug 2017 19:49:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708081949.v78Jna07078154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 8 Aug 2017 19:49:36 +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: r322274 - stable/11/cddl/contrib/opensolaris/cmd/lockstat X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/lockstat X-SVN-Commit-Revision: 322274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 19:49:37 -0000 Author: markj Date: Tue Aug 8 19:49:35 2017 New Revision: 322274 URL: https://svnweb.freebsd.org/changeset/base/322274 Log: MFC r321843, r321843: Let lockstat use ksyms(4)'s mmap interface. Modified: stable/11/cddl/contrib/opensolaris/cmd/lockstat/sym.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/lockstat/sym.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/lockstat/sym.c Tue Aug 8 19:47:11 2017 (r322273) +++ stable/11/cddl/contrib/opensolaris/cmd/lockstat/sym.c Tue Aug 8 19:49:35 2017 (r322274) @@ -175,10 +175,6 @@ symtab_init(void) int fd; int i; int strindex = -1; -#ifndef illumos - void *ksyms; - size_t sz; -#endif #ifndef illumos if ((fd = open("/dev/ksyms", O_RDONLY)) == -1) { @@ -194,33 +190,9 @@ symtab_init(void) return (-1); #endif -#ifdef illumos (void) elf_version(EV_CURRENT); elf = elf_begin(fd, ELF_C_READ, NULL); -#else - /* - * XXX - libelf needs to be fixed so it will work with - * non 'ordinary' files like /dev/ksyms. The following - * is a work around for now. - */ - if (elf_version(EV_CURRENT) == EV_NONE) { - close(fd); - return (-1); - } - if (ioctl(fd, KIOCGSIZE, &sz) < 0) { - close(fd); - return (-1); - } - if (ioctl(fd, KIOCGADDR, &ksyms) < 0) { - close(fd); - return (-1); - } - if ((elf = elf_memory(ksyms, sz)) == NULL) { - close(fd); - return (-1); - } -#endif for (cnt = 1; (scn = elf_nextscn(elf, scn)) != NULL; cnt++) { Shdr *shdr = elf_getshdr(scn); From owner-svn-src-all@freebsd.org Tue Aug 8 19:53:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70CBFDCCC78; Tue, 8 Aug 2017 19:53:08 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4AA4A71592; Tue, 8 Aug 2017 19:53:08 +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 v78Jr7We082259; Tue, 8 Aug 2017 19:53:07 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78Jr7dw082257; Tue, 8 Aug 2017 19:53:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708081953.v78Jr7dw082257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 8 Aug 2017 19:53:07 +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: r322275 - in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 322275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 19:53:08 -0000 Author: markj Date: Tue Aug 8 19:53:06 2017 New Revision: 322275 URL: https://svnweb.freebsd.org/changeset/base/322275 Log: MFC r321847: Batch updates to v_wire_count when freeing page table pages on x86. Modified: stable/11/sys/amd64/amd64/pmap.c stable/11/sys/i386/i386/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Tue Aug 8 19:49:35 2017 (r322274) +++ stable/11/sys/amd64/amd64/pmap.c Tue Aug 8 19:53:06 2017 (r322275) @@ -2200,12 +2200,14 @@ static __inline void pmap_free_zero_pages(struct spglist *free) { vm_page_t m; + int count; - while ((m = SLIST_FIRST(free)) != NULL) { + for (count = 0; (m = SLIST_FIRST(free)) != NULL; count++) { SLIST_REMOVE_HEAD(free, plinks.s.ss); /* Preserve the page's PG_ZERO setting. */ vm_page_free_toq(m); } + atomic_subtract_int(&vm_cnt.v_wire_count, count); } /* @@ -2311,13 +2313,6 @@ _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_ pmap_unwire_ptp(pmap, va, pdppg, free); } - /* - * This is a release store so that the ordinary store unmapping - * the page table page is globally performed before TLB shoot- - * down is begun. - */ - atomic_subtract_rel_int(&vm_cnt.v_wire_count, 1); - /* * Put page on a list so that it is released after * *ALL* TLB shootdown is done @@ -3001,7 +2996,6 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l SLIST_REMOVE_HEAD(&free, plinks.s.ss); /* Recycle a freed page table page. */ m_pc->wire_count = 1; - atomic_add_int(&vm_cnt.v_wire_count, 1); } pmap_free_zero_pages(&free); return (m_pc); @@ -3666,7 +3660,6 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offse ("pmap_remove_pde: pte page wire count error")); mpte->wire_count = 0; pmap_add_delayed_free_list(mpte, free, FALSE); - atomic_subtract_int(&vm_cnt.v_wire_count, 1); } } return (pmap_unuse_pt(pmap, sva, *pmap_pdpe(pmap, sva), free)); @@ -5531,7 +5524,6 @@ pmap_remove_pages(pmap_t pmap) ("pmap_remove_pages: pte page wire count error")); mpte->wire_count = 0; pmap_add_delayed_free_list(mpte, &free, FALSE); - atomic_subtract_int(&vm_cnt.v_wire_count, 1); } } else { pmap_resident_count_dec(pmap, 1); Modified: stable/11/sys/i386/i386/pmap.c ============================================================================== --- stable/11/sys/i386/i386/pmap.c Tue Aug 8 19:49:35 2017 (r322274) +++ stable/11/sys/i386/i386/pmap.c Tue Aug 8 19:53:06 2017 (r322275) @@ -1709,12 +1709,14 @@ static __inline void pmap_free_zero_pages(struct spglist *free) { vm_page_t m; + int count; - while ((m = SLIST_FIRST(free)) != NULL) { + for (count = 0; (m = SLIST_FIRST(free)) != NULL; count++) { SLIST_REMOVE_HEAD(free, plinks.s.ss); /* Preserve the page's PG_ZERO setting. */ vm_page_free_toq(m); } + atomic_subtract_int(&vm_cnt.v_wire_count, count); } /* @@ -1792,13 +1794,6 @@ _pmap_unwire_ptp(pmap_t pmap, vm_page_t m, struct spgl --pmap->pm_stats.resident_count; /* - * This is a release store so that the ordinary store unmapping - * the page table page is globally performed before TLB shoot- - * down is begun. - */ - atomic_subtract_rel_int(&vm_cnt.v_wire_count, 1); - - /* * Do an invltlb to make the invalidated mapping * take effect immediately. */ @@ -2061,11 +2056,11 @@ pmap_release(pmap_t pmap) ("pmap_release: got wrong ptd page")); #endif m->wire_count--; - atomic_subtract_int(&vm_cnt.v_wire_count, 1); vm_page_free_zero(m); } + atomic_subtract_int(&vm_cnt.v_wire_count, NPGPTD); } - + static int kvm_size(SYSCTL_HANDLER_ARGS) { @@ -2324,7 +2319,6 @@ out: SLIST_REMOVE_HEAD(&free, plinks.s.ss); /* Recycle a freed page table page. */ m_pc->wire_count = 1; - atomic_add_int(&vm_cnt.v_wire_count, 1); } pmap_free_zero_pages(&free); return (m_pc); @@ -2873,7 +2867,6 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offse ("pmap_remove_pde: pte page wire count error")); mpte->wire_count = 0; pmap_add_delayed_free_list(mpte, free, FALSE); - atomic_subtract_int(&vm_cnt.v_wire_count, 1); } } } @@ -4617,7 +4610,6 @@ pmap_remove_pages(pmap_t pmap) ("pmap_remove_pages: pte page wire count error")); mpte->wire_count = 0; pmap_add_delayed_free_list(mpte, &free, FALSE); - atomic_subtract_int(&vm_cnt.v_wire_count, 1); } } else { pmap->pm_stats.resident_count--; From owner-svn-src-all@freebsd.org Tue Aug 8 20:07:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86232DCD828; Tue, 8 Aug 2017 20:07:10 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 5B3EF71E0B; Tue, 8 Aug 2017 20:07:10 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78K79iL086573; Tue, 8 Aug 2017 20:07:09 GMT (envelope-from jlh@FreeBSD.org) Received: (from jlh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78K79T1086567; Tue, 8 Aug 2017 20:07:09 GMT (envelope-from jlh@FreeBSD.org) Message-Id: <201708082007.v78K79T1086567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jlh set sender to jlh@FreeBSD.org using -f From: Jeremie Le Hen Date: Tue, 8 Aug 2017 20:07:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322276 - in head: usr.bin usr.bin/ruptime usr.bin/rwho usr.sbin usr.sbin/rwhod X-SVN-Group: head X-SVN-Commit-Author: jlh X-SVN-Commit-Paths: in head: usr.bin usr.bin/ruptime usr.bin/rwho usr.sbin usr.sbin/rwhod X-SVN-Commit-Revision: 322276 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 20:07:10 -0000 Author: jlh Date: Tue Aug 8 20:07:08 2017 New Revision: 322276 URL: https://svnweb.freebsd.org/changeset/base/322276 Log: Revert r322029 and r322031 so as to recommit them with a better commit log. PR: 220953 Reported by: ngie@ Modified: head/usr.bin/Makefile head/usr.bin/ruptime/ruptime.1 head/usr.bin/rwho/rwho.1 head/usr.sbin/Makefile head/usr.sbin/rwhod/rwhod.8 Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Tue Aug 8 19:53:06 2017 (r322275) +++ head/usr.bin/Makefile Tue Aug 8 20:07:08 2017 (r322276) @@ -133,10 +133,8 @@ SUBDIR= alias \ rpcinfo \ rs \ rup \ - ruptime \ rusers \ rwall \ - rwho \ script \ sdiff \ sed \ @@ -253,6 +251,8 @@ SUBDIR.${MK_OPENSSL}+= newkey SUBDIR.${MK_QUOTAS}+= quota SUBDIR.${MK_RCMDS}+= rlogin SUBDIR.${MK_RCMDS}+= rsh +SUBDIR.${MK_RCMDS}+= ruptime +SUBDIR.${MK_RCMDS}+= rwho SUBDIR.${MK_SENDMAIL}+= vacation SUBDIR.${MK_TALK}+= talk SUBDIR.${MK_TELNET}+= telnet Modified: head/usr.bin/ruptime/ruptime.1 ============================================================================== --- head/usr.bin/ruptime/ruptime.1 Tue Aug 8 19:53:06 2017 (r322275) +++ head/usr.bin/ruptime/ruptime.1 Tue Aug 8 20:07:08 2017 (r322276) @@ -38,6 +38,15 @@ .Nm .Op Fl alrtu .Op Ar host ... +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: head/usr.bin/rwho/rwho.1 ============================================================================== --- head/usr.bin/rwho/rwho.1 Tue Aug 8 19:53:06 2017 (r322275) +++ head/usr.bin/rwho/rwho.1 Tue Aug 8 20:07:08 2017 (r322276) @@ -37,6 +37,15 @@ .Sh SYNOPSIS .Nm .Op Fl a +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Tue Aug 8 19:53:06 2017 (r322275) +++ head/usr.sbin/Makefile Tue Aug 8 20:07:08 2017 (r322276) @@ -74,7 +74,6 @@ SUBDIR= adduser \ rpc.statd \ rpc.umntall \ rtprio \ - rwhod \ service \ services_mkdb \ sesutil \ @@ -192,6 +191,7 @@ SUBDIR.${MK_PPP}+= ppp SUBDIR.${MK_QUOTAS}+= edquota SUBDIR.${MK_QUOTAS}+= quotaon SUBDIR.${MK_QUOTAS}+= repquota +SUBDIR.${MK_RCMDS}+= rwhod SUBDIR.${MK_SENDMAIL}+= editmap SUBDIR.${MK_SENDMAIL}+= mailstats SUBDIR.${MK_SENDMAIL}+= makemap Modified: head/usr.sbin/rwhod/rwhod.8 ============================================================================== --- head/usr.sbin/rwhod/rwhod.8 Tue Aug 8 19:53:06 2017 (r322275) +++ head/usr.sbin/rwhod/rwhod.8 Tue Aug 8 20:07:08 2017 (r322276) @@ -40,6 +40,15 @@ .Op Fl p .Op Fl l .Op Fl m Op Ar ttl +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm From owner-svn-src-all@freebsd.org Tue Aug 8 20:17:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BA0CDCDF66; Tue, 8 Aug 2017 20:17:09 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 57CD57235C; Tue, 8 Aug 2017 20:17:09 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78KH8VR090661; Tue, 8 Aug 2017 20:17:08 GMT (envelope-from jlh@FreeBSD.org) Received: (from jlh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78KH7av090655; Tue, 8 Aug 2017 20:17:07 GMT (envelope-from jlh@FreeBSD.org) Message-Id: <201708082017.v78KH7av090655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jlh set sender to jlh@FreeBSD.org using -f From: Jeremie Le Hen Date: Tue, 8 Aug 2017 20:17:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322277 - in head: tools/build/mk usr.bin usr.bin/ruptime usr.bin/rwho usr.sbin usr.sbin/rwhod X-SVN-Group: head X-SVN-Commit-Author: jlh X-SVN-Commit-Paths: in head: tools/build/mk usr.bin usr.bin/ruptime usr.bin/rwho usr.sbin usr.sbin/rwhod X-SVN-Commit-Revision: 322277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 20:17:09 -0000 Author: jlh Date: Tue Aug 8 20:17:07 2017 New Revision: 322277 URL: https://svnweb.freebsd.org/changeset/base/322277 Log: rwho/ruptime/rwhod shouldn't be gated by RCMDS. As peter@ points out in pr/220953: "rwho, rwhod and ruptime are not part of the remote login suite (rsh, rlogin etc). They should *not* be in the rcmds package which is disabled by default. We rely on rwho/rwhod/ruptime in the freebsd.org cluster." This commit is a re-commit of r322029 and r322031 with a better commit log, as pointed out by ngie@. This also includes the necesary changes to OptionalObsoleteFiles.inc, as requested by jhb@. PR: 220953 Reported by: peter@, jhb@ Differential Revision: https://reviews.freebsd.org/D11743 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.bin/Makefile head/usr.bin/ruptime/ruptime.1 head/usr.bin/rwho/rwho.1 head/usr.sbin/Makefile head/usr.sbin/rwhod/rwhod.8 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Tue Aug 8 20:07:08 2017 (r322276) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Tue Aug 8 20:17:07 2017 (r322277) @@ -6895,24 +6895,16 @@ OLD_FILES+=usr/share/man/man8/rbootd.8.gz .if ${MK_RCMDS} == no OLD_FILES+=bin/rcp -OLD_FILES+=etc/rc.d/rwho -OLD_FILES+=etc/periodic/daily/140.clean-rwho OLD_FILES+=rescue/rcp OLD_FILES+=usr/bin/rlogin OLD_FILES+=usr/bin/rsh -OLD_FILES+=usr/bin/ruptime -OLD_FILES+=usr/bin/rwho OLD_FILES+=usr/libexec/rlogind OLD_FILES+=usr/libexec/rshd -OLD_FILES+=usr/sbin/rwhod OLD_FILES+=usr/share/man/man1/rcp.1.gz OLD_FILES+=usr/share/man/man1/rlogin.1.gz OLD_FILES+=usr/share/man/man1/rsh.1.gz -OLD_FILES+=usr/share/man/man1/ruptime.1.gz -OLD_FILES+=usr/share/man/man1/rwho.1.gz OLD_FILES+=usr/share/man/man8/rlogind.8.gz OLD_FILES+=usr/share/man/man8/rshd.8.gz -OLD_FILES+=usr/share/man/man8/rwhod.8.gz .endif .if ${MK_RESCUE} == no Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Tue Aug 8 20:07:08 2017 (r322276) +++ head/usr.bin/Makefile Tue Aug 8 20:17:07 2017 (r322277) @@ -133,8 +133,10 @@ SUBDIR= alias \ rpcinfo \ rs \ rup \ + ruptime \ rusers \ rwall \ + rwho \ script \ sdiff \ sed \ @@ -251,8 +253,6 @@ SUBDIR.${MK_OPENSSL}+= newkey SUBDIR.${MK_QUOTAS}+= quota SUBDIR.${MK_RCMDS}+= rlogin SUBDIR.${MK_RCMDS}+= rsh -SUBDIR.${MK_RCMDS}+= ruptime -SUBDIR.${MK_RCMDS}+= rwho SUBDIR.${MK_SENDMAIL}+= vacation SUBDIR.${MK_TALK}+= talk SUBDIR.${MK_TELNET}+= telnet Modified: head/usr.bin/ruptime/ruptime.1 ============================================================================== --- head/usr.bin/ruptime/ruptime.1 Tue Aug 8 20:07:08 2017 (r322276) +++ head/usr.bin/ruptime/ruptime.1 Tue Aug 8 20:17:07 2017 (r322277) @@ -38,15 +38,6 @@ .Nm .Op Fl alrtu .Op Ar host ... -.Sh DEPRECATION NOTICE -.Nm -is deprecated and will be removed from future versions of the -.Fx -base system. -If -.Nm -is still required, it can be installed from ports or packages -(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: head/usr.bin/rwho/rwho.1 ============================================================================== --- head/usr.bin/rwho/rwho.1 Tue Aug 8 20:07:08 2017 (r322276) +++ head/usr.bin/rwho/rwho.1 Tue Aug 8 20:17:07 2017 (r322277) @@ -37,15 +37,6 @@ .Sh SYNOPSIS .Nm .Op Fl a -.Sh DEPRECATION NOTICE -.Nm -is deprecated and will be removed from future versions of the -.Fx -base system. -If -.Nm -is still required, it can be installed from ports or packages -(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Tue Aug 8 20:07:08 2017 (r322276) +++ head/usr.sbin/Makefile Tue Aug 8 20:17:07 2017 (r322277) @@ -74,6 +74,7 @@ SUBDIR= adduser \ rpc.statd \ rpc.umntall \ rtprio \ + rwhod \ service \ services_mkdb \ sesutil \ @@ -191,7 +192,6 @@ SUBDIR.${MK_PPP}+= ppp SUBDIR.${MK_QUOTAS}+= edquota SUBDIR.${MK_QUOTAS}+= quotaon SUBDIR.${MK_QUOTAS}+= repquota -SUBDIR.${MK_RCMDS}+= rwhod SUBDIR.${MK_SENDMAIL}+= editmap SUBDIR.${MK_SENDMAIL}+= mailstats SUBDIR.${MK_SENDMAIL}+= makemap Modified: head/usr.sbin/rwhod/rwhod.8 ============================================================================== --- head/usr.sbin/rwhod/rwhod.8 Tue Aug 8 20:07:08 2017 (r322276) +++ head/usr.sbin/rwhod/rwhod.8 Tue Aug 8 20:17:07 2017 (r322277) @@ -40,15 +40,6 @@ .Op Fl p .Op Fl l .Op Fl m Op Ar ttl -.Sh DEPRECATION NOTICE -.Nm -is deprecated and will be removed from future versions of the -.Fx -base system. -If -.Nm -is still required, it can be installed from ports or packages -(net/bsdrcmds). .Sh DESCRIPTION The .Nm From owner-svn-src-all@freebsd.org Tue Aug 8 20:18:40 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A16C1DCE13B; Tue, 8 Aug 2017 20:18:40 +0000 (UTC) (envelope-from jlehen@gmail.com) Received: from mail-qt0-x241.google.com (mail-qt0-x241.google.com [IPv6:2607:f8b0:400d:c0d::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5AB44724FE; Tue, 8 Aug 2017 20:18:40 +0000 (UTC) (envelope-from jlehen@gmail.com) Received: by mail-qt0-x241.google.com with SMTP id i19so4085981qte.1; Tue, 08 Aug 2017 13:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=lRRcVkBh+zxRrgJgeFO5sQs3ID3N1Vr01II+CMRAwgo=; b=bS3ebeCIbDLlaDfRUvtBNLEh5mCEWtZohpojFIRB/8Ydos/R7hcSJrTQXvYr0YZot1 7mJ1qpSDhXJHhEM2DyZtUGnxLG05tpRCSEeslvpqQxURgjVsUxwB/tAAzgUvG4jySASx RumG/KFUkWruQbXj2RSfcp/sojgNKXTmlHTVrPDj06uTk+Oo82ozld59jOtSyCNgEa1D KL26x2CSrqHbrU6lk+LmNZHIcmRxAFUwKd1+xkYdfnwow3HOLlFB/ZfOPSIaGTaZtBj6 b2D9sYZXErnyQilYkgA7vnZPWCZ4kV+wzsh1Zb0q6SPOzA3xPuODU8SdyUEADYErSErU a1cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=lRRcVkBh+zxRrgJgeFO5sQs3ID3N1Vr01II+CMRAwgo=; b=GguJWfWFH72eLJVdnWoR9GUcU8cE+b985OqOhU+6WAPc2b0n55PkhOvsXqK9cfgE7q mZV2YNb+9Zob97fx7sFtYKSPbjg+djydYIuXLuekgDTlLXJdCtWe7k6GqDgztr0N+NR7 0iSiCwrnUnlB9zuq28CN7km4dBstB0i8r0CHFaIfhFnaIME2RyYCw4kIuCXYAeZDoKzN v+Mn9dy9CpnnMmxj+A655jyfpRNFLDDEdRQEHVc2g9IpsvwrjwPApUqt2lu5NkpJ/MJd lHfTIHnfkgWwEQVoW7jWCiXAL2AKsriJnoY0f8qKnz7gSVsmI0MbePgG+qZXlH55wEw7 TSQw== X-Gm-Message-State: AHYfb5j1HuTicb6I5cye6NCeifqvu/a+y82KRsGAUK2SQ1aeF5k78v3+ ly5+Jcm9u8FCHbKvhm9lm/HzOpsKf1SwJ2k= X-Received: by 10.200.56.48 with SMTP id q45mr7188026qtb.36.1502223519512; Tue, 08 Aug 2017 13:18:39 -0700 (PDT) MIME-Version: 1.0 Sender: jlehen@gmail.com Received: by 10.12.180.155 with HTTP; Tue, 8 Aug 2017 13:18:38 -0700 (PDT) In-Reply-To: <20170805133842.GC16195@spindle.one-eyed-alien.net> References: <201708032130.v73LUC2H045637@repo.freebsd.org> <20170805133842.GC16195@spindle.one-eyed-alien.net> From: Jeremie Le Hen Date: Tue, 8 Aug 2017 22:18:38 +0200 X-Google-Sender-Auth: YtLGSWd7L32Y47zUS-6Z3MGGyE4 Message-ID: Subject: Re: svn commit: r322029 - in head: usr.bin usr.sbin To: Brooks Davis Cc: "Ngie Cooper (yaneurabeya)" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 20:18:40 -0000 On Sat, Aug 5, 2017 at 3:38 PM, Brooks Davis wrote: > On Fri, Aug 04, 2017 at 04:50:32PM +0200, Jeremie Le Hen wrote: >> On Fri, Aug 4, 2017 at 12:42 AM, Ngie Cooper (yaneurabeya) >> wrote: >> > >> >> On Aug 3, 2017, at 14:30, Jeremie Le Hen wrote: >> >> >> >> Author: jlh >> >> Date: Thu Aug 3 21:30:12 2017 >> >> New Revision: 322029 >> >> URL: https://svnweb.freebsd.org/changeset/base/322029 >> >> >> >> Log: >> >> rwho/ruptime/rwhod shouldn't be gated by RCMDS. >> > >> > The why in this commit and the next you made (r322031) would have been incredibly helpful. If bugzilla disappears I only have the commit history tracking the what. >> >> I agree, I realized this only afterwards. I don't know how to fix this though. > > Reverting the change and reapplying it with a meaningful message will > produce the best result. OK thanks. FYI this is submitted in r322277, with changes to tools/build/mk/OptionalObsoleteFiles.inc as requested by jhb@. Thanks all for your patience :-). -- Jeremie Le Hen jlh@FreeBSD.org From owner-svn-src-all@freebsd.org Tue Aug 8 20:44:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 609FBDCF4C8; Tue, 8 Aug 2017 20:44:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 32C417312E; Tue, 8 Aug 2017 20:44:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78KiHlr002792; Tue, 8 Aug 2017 20:44:17 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78KiH9F002789; Tue, 8 Aug 2017 20:44:17 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708082044.v78KiH9F002789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 8 Aug 2017 20:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322278 - in head/sys: amd64/amd64 amd64/include dev/efidev X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include dev/efidev X-SVN-Commit-Revision: 322278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 20:44:18 -0000 Author: imp Date: Tue Aug 8 20:44:16 2017 New Revision: 322278 URL: https://svnweb.freebsd.org/changeset/base/322278 Log: Fail to open efirt device when no EFI on system. libefivar expects opening /dev/efi to indicate if the we can make efi runtime calls. With a null routine, it was always succeeding leading efi_variables_supported() to return the wrong value. Only succeed if we have an efi_runtime table. Also, while I'm hear, out of an abundance of caution, add a likely redundant check to make sure efi_systbl is not NULL before dereferencing it. I know it can't be NULL if efi_cfgtbl is non-NULL, but the compiler doesn't. Modified: head/sys/amd64/amd64/efirt.c head/sys/amd64/include/efi.h head/sys/dev/efidev/efidev.c Modified: head/sys/amd64/amd64/efirt.c ============================================================================== --- head/sys/amd64/amd64/efirt.c Tue Aug 8 20:17:07 2017 (r322277) +++ head/sys/amd64/amd64/efirt.c Tue Aug 8 20:44:16 2017 (r322278) @@ -421,12 +421,21 @@ efi_uninit(void) } int +efi_rt_ok(void) +{ + + if (efi_runtime == NULL) + return (ENXIO); + return (0); +} + +int efi_get_table(struct uuid *uuid, void **ptr) { struct efi_cfgtbl *ct; u_long count; - if (efi_cfgtbl == NULL) + if (efi_cfgtbl == NULL || efi_systbl == NULL) return (ENXIO); count = efi_systbl->st_entries; ct = efi_cfgtbl; Modified: head/sys/amd64/include/efi.h ============================================================================== --- head/sys/amd64/include/efi.h Tue Aug 8 20:17:07 2017 (r322277) +++ head/sys/amd64/include/efi.h Tue Aug 8 20:44:16 2017 (r322278) @@ -49,6 +49,7 @@ struct uuid; struct efi_tm; +int efi_rt_ok(void); int efi_get_table(struct uuid *uuid, void **ptr); int efi_get_time(struct efi_tm *tm); int efi_get_time_locked(struct efi_tm *tm); Modified: head/sys/dev/efidev/efidev.c ============================================================================== --- head/sys/dev/efidev/efidev.c Tue Aug 8 20:17:07 2017 (r322277) +++ head/sys/dev/efidev/efidev.c Tue Aug 8 20:44:16 2017 (r322278) @@ -39,14 +39,27 @@ __FBSDID("$FreeBSD$"); #include #include +static d_open_t efidev_open; static d_ioctl_t efidev_ioctl; static struct cdevsw efi_cdevsw = { .d_name = "efi", .d_version = D_VERSION, + .d_open = efidev_open, .d_ioctl = efidev_ioctl, }; +static int +efidev_open(struct cdev *dev __unused, int oflags __unused, + int devtype __unused, struct thread *td __unused) +{ + /* + * Only return success when we have an actual runtime to call. + */ + + return efi_rt_ok(); +} + static int efidev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr, int flags __unused, struct thread *td __unused) From owner-svn-src-all@freebsd.org Tue Aug 8 21:01:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42A7CDD014F; Tue, 8 Aug 2017 21:01:13 +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 mx1.freebsd.org (Postfix) with ESMTPS id 1089773964; Tue, 8 Aug 2017 21:01:12 +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 v78L1CGD010351; Tue, 8 Aug 2017 21:01:12 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78L1CtG010350; Tue, 8 Aug 2017 21:01:12 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708082101.v78L1CtG010350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 8 Aug 2017 21:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322279 - head/sys/dev/efidev X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/efidev X-SVN-Commit-Revision: 322279 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 21:01:13 -0000 Author: imp Date: Tue Aug 8 21:01:11 2017 New Revision: 322279 URL: https://svnweb.freebsd.org/changeset/base/322279 Log: Turns out to be even simpler to just not create /dev/efi if we don't have a efi runtime. Modified: head/sys/dev/efidev/efidev.c Modified: head/sys/dev/efidev/efidev.c ============================================================================== --- head/sys/dev/efidev/efidev.c Tue Aug 8 20:44:16 2017 (r322278) +++ head/sys/dev/efidev/efidev.c Tue Aug 8 21:01:11 2017 (r322279) @@ -39,28 +39,15 @@ __FBSDID("$FreeBSD$"); #include #include -static d_open_t efidev_open; static d_ioctl_t efidev_ioctl; static struct cdevsw efi_cdevsw = { .d_name = "efi", .d_version = D_VERSION, - .d_open = efidev_open, .d_ioctl = efidev_ioctl, }; static int -efidev_open(struct cdev *dev __unused, int oflags __unused, - int devtype __unused, struct thread *td __unused) -{ - /* - * Only return success when we have an actual runtime to call. - */ - - return efi_rt_ok(); -} - -static int efidev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr, int flags __unused, struct thread *td __unused) { @@ -195,6 +182,11 @@ efidev_modevents(module_t m, int event, void *arg __un switch (event) { case MOD_LOAD: + /* + * If we have no efi environment, then don't create the device. + */ + if (efi_rt_ok() != 0) + return (0); make_dev_args_init(&mda); mda.mda_flags = MAKEDEV_WAITOK | MAKEDEV_CHECKNAME; mda.mda_devsw = &efi_cdevsw; From owner-svn-src-all@freebsd.org Tue Aug 8 21:09:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68F93DD087D; Tue, 8 Aug 2017 21:09:27 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34C8873E29; Tue, 8 Aug 2017 21:09:27 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78L9Qn1011323; Tue, 8 Aug 2017 21:09:26 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78L9Q45011322; Tue, 8 Aug 2017 21:09:26 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201708082109.v78L9Q45011322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 8 Aug 2017 21:09:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322280 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 322280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 21:09:27 -0000 Author: kp Date: Tue Aug 8 21:09:26 2017 New Revision: 322280 URL: https://svnweb.freebsd.org/changeset/base/322280 Log: pf_get_sport(): Prevent possible endless loop when searching for an unused nat port This is an import of Alexander Bluhm's OpenBSD commit r1.60, the first chunk had to be modified because on OpenBSD the 'cut' declaration is located elsewhere. Upstream report by Jingmin Zhou: https://marc.info/?l=openbsd-pf&m=150020133510896&w=2 OpenBSD commit message: Use a 32 bit variable to detect integer overflow when searching for an unused nat port. Prevents a possible endless loop if high port is 65535 or low port is 0. report and analysis Jingmin Zhou; OK sashan@ visa@ Quoted from: https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/net/pf_lb.c PR: 221201 Submitted by: Fabian Keil Obtained from: OpenBSD via ElectroBSD MFC after: 1 week Modified: head/sys/netpfil/pf/pf_lb.c Modified: head/sys/netpfil/pf/pf_lb.c ============================================================================== --- head/sys/netpfil/pf/pf_lb.c Tue Aug 8 21:01:11 2017 (r322279) +++ head/sys/netpfil/pf/pf_lb.c Tue Aug 8 21:09:26 2017 (r322280) @@ -259,7 +259,8 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf return (0); } } else { - uint16_t tmp, cut; + uint32_t tmp; + uint16_t cut; if (low > high) { tmp = low; @@ -269,7 +270,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf /* low < high */ cut = arc4random() % (1 + high - low) + low; /* low <= cut <= high */ - for (tmp = cut; tmp <= high; ++(tmp)) { + for (tmp = cut; tmp <= high && tmp <= 0xffff; ++tmp) { key.port[1] = htons(tmp); if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { @@ -277,7 +278,8 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf return (0); } } - for (tmp = cut - 1; tmp >= low; --(tmp)) { + tmp = cut; + for (tmp -= 1; tmp >= low && tmp <= 0xffff; --tmp) { key.port[1] = htons(tmp); if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { From owner-svn-src-all@freebsd.org Tue Aug 8 22:40:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0FCDDD50A9; Tue, 8 Aug 2017 22:40:27 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 6DB8976DFE; Tue, 8 Aug 2017 22:40:27 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78MeQW4048259; Tue, 8 Aug 2017 22:40:26 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78MeQ8f048258; Tue, 8 Aug 2017 22:40:26 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201708082240.v78MeQ8f048258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Tue, 8 Aug 2017 22:40:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322281 - head/sbin/ifconfig X-SVN-Group: head X-SVN-Commit-Author: garga X-SVN-Commit-Paths: head/sbin/ifconfig X-SVN-Commit-Revision: 322281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 22:40:27 -0000 Author: garga (ports committer) Date: Tue Aug 8 22:40:26 2017 New Revision: 322281 URL: https://svnweb.freebsd.org/changeset/base/322281 Log: Add missing parenthesis on error message Approved by: loos MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sbin/ifconfig/ifconfig.c Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Tue Aug 8 21:09:26 2017 (r322280) +++ head/sbin/ifconfig/ifconfig.c Tue Aug 8 22:40:26 2017 (r322281) @@ -760,7 +760,7 @@ top: if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0 && (uafp != NULL || errno != EAFNOSUPPORT || (s = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0)) - err(1, "socket(family %u,SOCK_DGRAM", ifr.ifr_addr.sa_family); + err(1, "socket(family %u,SOCK_DGRAM)", ifr.ifr_addr.sa_family); while (argc > 0) { p = cmd_lookup(*argv, iscreate); From owner-svn-src-all@freebsd.org Tue Aug 8 22:58:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D922DD5E70; Tue, 8 Aug 2017 22:58:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0504B77678; Tue, 8 Aug 2017 22:58:34 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78MwYXk056460; Tue, 8 Aug 2017 22:58:34 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78MwYtw056459; Tue, 8 Aug 2017 22:58:34 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708082258.v78MwYtw056459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 8 Aug 2017 22:58:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322282 - head/sys/arm/conf X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/conf X-SVN-Commit-Revision: 322282 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 08 Aug 2017 22:58:35 -0000 Author: ian Date: Tue Aug 8 22:58:34 2017 New Revision: 322282 URL: https://svnweb.freebsd.org/changeset/base/322282 Log: Remove the ds133x and s35390a i2c RTC drivers for now. They both do i2c transfers in their probe() or attach() routines, and that doesn't work when the low-level controller requires interrupts to be functional. The DS133x family of chips is nearly identical to the DS1307 and support for them should be added to that driver, then the ds133x driver can be deleted. The s35390a driver just needs a non-trivial workover. In both cases that work will be done and committed separately. Modified: head/sys/arm/conf/GENERIC Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Tue Aug 8 22:40:26 2017 (r322281) +++ head/sys/arm/conf/GENERIC Tue Aug 8 22:58:34 2017 (r322282) @@ -139,11 +139,9 @@ device twl_clks # twl external clocks # i2c RTCs device ds1307 # Dallas DS1307 RTC and compatible -device ds133x # Dallas DS1337, DS1338 and DS1339 RTC device ds1672 # Dallas DS1672 RTC device ds3231 # Dallas DS3231 RTC + temperature device nxprtc # NXP RTCs: PCA/PFC212x PCA/PCF85xx -device s35390a # Seiko Instruments S-35390A RTC # GPIO device gpio From owner-svn-src-all@freebsd.org Wed Aug 9 00:45:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C810DDB1F6; Wed, 9 Aug 2017 00:45:26 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B4097EBEE; Wed, 9 Aug 2017 00:45:26 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v790jPPS001357; Wed, 9 Aug 2017 00:45:25 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v790jPo8001356; Wed, 9 Aug 2017 00:45:25 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090045.v790jPo8001356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 00:45:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322285 - head/sys/dev/fdt X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/fdt X-SVN-Commit-Revision: 322285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 00:45:26 -0000 Author: mw Date: Wed Aug 9 00:45:25 2017 New Revision: 322285 URL: https://svnweb.freebsd.org/changeset/base/322285 Log: Enable parsing simple-bus 'ranges' with multiple entries This patch makes possible to boot with up to 8 ranges in soc. Dynamic allocation cannot be used, because ftd_get_ranges function is called early, when malloc is not available. Change is required for the alignment of Marvell Armada 38x device trees present in sys/gnu/dts/arm - originally the platform has 6 entries in simple-bus 'ranges'. Submitted by: Patryk Duda Reviewed by: manu, nwhitehorn, cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11876 Modified: head/sys/dev/fdt/fdt_common.c Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Tue Aug 8 23:55:38 2017 (r322284) +++ head/sys/dev/fdt/fdt_common.c Wed Aug 9 00:45:25 2017 (r322285) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #define FDT_TYPE_LEN 64 #define FDT_REG_CELLS 4 +#define FDT_RANGES_SIZE 48 SYSCTL_NODE(_hw, OID_AUTO, fdt, CTLFLAG_RD, 0, "Flattened Device Tree"); @@ -149,7 +150,7 @@ fdt_get_range_by_busaddr(phandle_t node, u_long addr, int fdt_get_range(phandle_t node, int range_id, u_long *base, u_long *size) { - pcell_t ranges[6], *rangesptr; + pcell_t ranges[FDT_RANGES_SIZE], *rangesptr; pcell_t addr_cells, size_cells, par_addr_cells; u_long par_bus_addr, pbase, psize; int err, len, tuple_size, tuples; From owner-svn-src-all@freebsd.org Wed Aug 9 00:51:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2CCFDDB710; Wed, 9 Aug 2017 00:51:46 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E2F77F0F1; Wed, 9 Aug 2017 00:51:46 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v790pjaa002662; Wed, 9 Aug 2017 00:51:45 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v790pj2I002659; Wed, 9 Aug 2017 00:51:45 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090051.v790pj2I002659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 00:51:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322286 - head/sys/boot/fdt/dts/arm X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/boot/fdt/dts/arm X-SVN-Commit-Revision: 322286 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 00:51:46 -0000 Author: mw Date: Wed Aug 9 00:51:45 2017 New Revision: 322286 URL: https://svnweb.freebsd.org/changeset/base/322286 Log: Restore original /soc ranges on Marvell Armada 38x boards Because fdt_get_ranges can process now multiple 'ranges' entries, restoring the ranges from original Linux device trees is possible. Submitted by: Patryk Duda Reviewed by: cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11877 Modified: head/sys/boot/fdt/dts/arm/armada-385-db-ap.dts head/sys/boot/fdt/dts/arm/armada-388-gp.dts head/sys/boot/fdt/dts/arm/armada-38x-solidrun-microsom.dtsi Modified: head/sys/boot/fdt/dts/arm/armada-385-db-ap.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/armada-385-db-ap.dts Wed Aug 9 00:45:25 2017 (r322285) +++ head/sys/boot/fdt/dts/arm/armada-385-db-ap.dts Wed Aug 9 00:51:45 2017 (r322286) @@ -60,7 +60,11 @@ }; soc { - ranges = ; + ranges = ; internal-regs { i2c0: i2c@11000 { Modified: head/sys/boot/fdt/dts/arm/armada-388-gp.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/armada-388-gp.dts Wed Aug 9 00:45:25 2017 (r322285) +++ head/sys/boot/fdt/dts/arm/armada-388-gp.dts Wed Aug 9 00:51:45 2017 (r322286) @@ -59,7 +59,11 @@ }; soc { - ranges = ; + ranges = ; internal-regs { crypto@90000 { Modified: head/sys/boot/fdt/dts/arm/armada-38x-solidrun-microsom.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/armada-38x-solidrun-microsom.dtsi Wed Aug 9 00:45:25 2017 (r322285) +++ head/sys/boot/fdt/dts/arm/armada-38x-solidrun-microsom.dtsi Wed Aug 9 00:51:45 2017 (r322286) @@ -57,7 +57,11 @@ }; soc { - ranges = ; + ranges = ; internal-regs { ethernet@70000 { From owner-svn-src-all@freebsd.org Wed Aug 9 00:56:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 216B3DDBA8F; Wed, 9 Aug 2017 00:56:31 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E03867F457; Wed, 9 Aug 2017 00:56:30 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v790uT4w005761; Wed, 9 Aug 2017 00:56:29 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v790uTv4005760; Wed, 9 Aug 2017 00:56:29 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090056.v790uTv4005760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 00:56:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322287 - head/sys/dev/ofw X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ofw X-SVN-Commit-Revision: 322287 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 00:56:31 -0000 Author: mw Date: Wed Aug 9 00:56:29 2017 New Revision: 322287 URL: https://svnweb.freebsd.org/changeset/base/322287 Log: Add support for "compatible" parameter in ofw_fdt_fixup Sometimes it's convenient to provide fixup to many boards that use the same SoC family (eg. Marvell Armada 38x). Instead of putting multiple entries in fdt_fixup_table, use one entry which refers to all boards with given SoC. Submitted by: Patryk Duda Reviewed by: nwhitehorn, cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11878 Modified: head/sys/dev/ofw/ofw_fdt.c Modified: head/sys/dev/ofw/ofw_fdt.c ============================================================================== --- head/sys/dev/ofw/ofw_fdt.c Wed Aug 9 00:51:45 2017 (r322286) +++ head/sys/dev/ofw/ofw_fdt.c Wed Aug 9 00:56:29 2017 (r322287) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "ofw_if.h" @@ -450,7 +451,15 @@ ofw_fdt_fixup(ofw_t ofw) for (i = 0; fdt_fixup_table[i].model != NULL; i++) { if (strncmp(model, fdt_fixup_table[i].model, FDT_MODEL_LEN) != 0) - continue; + /* + * Sometimes it's convenient to provide one + * fixup entry that refers to many boards. + * To handle this case, simply check if model + * is compatible parameter + */ + if(!ofw_bus_node_is_compatible(root, + fdt_fixup_table[i].model)) + continue; if (fdt_fixup_table[i].handler != NULL) (*fdt_fixup_table[i].handler)(root); From owner-svn-src-all@freebsd.org Wed Aug 9 01:04:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4AE3DAB2DD; Wed, 9 Aug 2017 01: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 mx1.freebsd.org (Postfix) with ESMTPS id 905EF7FA51; Wed, 9 Aug 2017 01: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 v7914a6D010122; Wed, 9 Aug 2017 01:04:36 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7914a3w010121; Wed, 9 Aug 2017 01:04:36 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708090104.v7914a3w010121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 9 Aug 2017 01:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322288 - head/lib/libc/regex X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/regex X-SVN-Commit-Revision: 322288 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 01:04:37 -0000 Author: kevans Date: Wed Aug 9 01:04:36 2017 New Revision: 322288 URL: https://svnweb.freebsd.org/changeset/base/322288 Log: regex(3): Refactor fast/slow stepping bits in the matching engine Adding features for matching is fairly straightforward, but this requires some duplication because of this fast/slow setup. They can be fairly trivially combined into a single walk(), so do it to make future additions less error prone. Reviewed by: cem (earlier version), emaste, pfg Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D11233 Modified: head/lib/libc/regex/engine.c Modified: head/lib/libc/regex/engine.c ============================================================================== --- head/lib/libc/regex/engine.c Wed Aug 9 00:56:29 2017 (r322287) +++ head/lib/libc/regex/engine.c Wed Aug 9 01:04:36 2017 (r322288) @@ -36,6 +36,8 @@ #include __FBSDID("$FreeBSD$"); +#include + /* * The matching engine and friends. This file is #included by regexec.c * after suitable #defines of a variety of macros used herein, so that @@ -45,8 +47,7 @@ __FBSDID("$FreeBSD$"); #ifdef SNAMES #define matcher smatcher -#define fast sfast -#define slow sslow +#define walk swalk #define dissect sdissect #define backref sbackref #define step sstep @@ -56,8 +57,7 @@ __FBSDID("$FreeBSD$"); #endif #ifdef LNAMES #define matcher lmatcher -#define fast lfast -#define slow lslow +#define walk lwalk #define dissect ldissect #define backref lbackref #define step lstep @@ -67,8 +67,7 @@ __FBSDID("$FreeBSD$"); #endif #ifdef MNAMES #define matcher mmatcher -#define fast mfast -#define slow mslow +#define walk mwalk #define dissect mdissect #define backref mbackref #define step mstep @@ -104,8 +103,7 @@ extern "C" { static int matcher(struct re_guts *g, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags); static const char *dissect(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst); static const char *backref(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev, int); -static const char *fast(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst); -static const char *slow(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst); +static const char *walk(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, bool fast); static states step(struct re_guts *g, sopno start, sopno stop, states bef, wint_t ch, states aft); #define MAX_RECURSION 100 #define BOL (OUT-1) @@ -251,7 +249,7 @@ matcher(struct re_guts *g, /* this loop does only one repetition except for backrefs */ for (;;) { - endp = fast(m, start, stop, gf, gl); + endp = walk(m, start, stop, gf, gl, true); if (endp == NULL) { /* a miss */ if (m->pmatch != NULL) free((char *)m->pmatch); @@ -267,7 +265,7 @@ matcher(struct re_guts *g, assert(m->coldp != NULL); for (;;) { NOTE("finding start"); - endp = slow(m, m->coldp, stop, gf, gl); + endp = walk(m, m->coldp, stop, gf, gl, false); if (endp != NULL) break; assert(m->coldp < m->endp); @@ -312,7 +310,7 @@ matcher(struct re_guts *g, if (dp != NULL || endp <= m->coldp) break; /* defeat */ NOTE("backoff"); - endp = slow(m, m->coldp, endp-1, gf, gl); + endp = walk(m, m->coldp, endp-1, gf, gl, false); if (endp == NULL) break; /* defeat */ /* try it on a shorter possibility */ @@ -430,10 +428,10 @@ dissect(struct match *m, stp = stop; for (;;) { /* how long could this one be? */ - rest = slow(m, sp, stp, ss, es); + rest = walk(m, sp, stp, ss, es, false); assert(rest != NULL); /* it did match */ /* could the rest match the rest? */ - tail = slow(m, rest, stop, es, stopst); + tail = walk(m, rest, stop, es, stopst, false); if (tail == stop) break; /* yes! */ /* no -- try a shorter match for this one */ @@ -443,7 +441,7 @@ dissect(struct match *m, ssub = ss + 1; esub = es - 1; /* did innards match? */ - if (slow(m, sp, rest, ssub, esub) != NULL) { + if (walk(m, sp, rest, ssub, esub, false) != NULL) { dp = dissect(m, sp, rest, ssub, esub); assert(dp == rest); } else /* no */ @@ -454,10 +452,10 @@ dissect(struct match *m, stp = stop; for (;;) { /* how long could this one be? */ - rest = slow(m, sp, stp, ss, es); + rest = walk(m, sp, stp, ss, es, false); assert(rest != NULL); /* it did match */ /* could the rest match the rest? */ - tail = slow(m, rest, stop, es, stopst); + tail = walk(m, rest, stop, es, stopst, false); if (tail == stop) break; /* yes! */ /* no -- try a shorter match for this one */ @@ -469,7 +467,7 @@ dissect(struct match *m, ssp = sp; oldssp = ssp; for (;;) { /* find last match of innards */ - sep = slow(m, ssp, rest, ssub, esub); + sep = walk(m, ssp, rest, ssub, esub, false); if (sep == NULL || sep == ssp) break; /* failed or matched null */ oldssp = ssp; /* on to next try */ @@ -481,7 +479,7 @@ dissect(struct match *m, ssp = oldssp; } assert(sep == rest); /* must exhaust substring */ - assert(slow(m, ssp, sep, ssub, esub) == rest); + assert(walk(m, ssp, sep, ssub, esub, false) == rest); dp = dissect(m, ssp, sep, ssub, esub); assert(dp == sep); sp = rest; @@ -490,10 +488,10 @@ dissect(struct match *m, stp = stop; for (;;) { /* how long could this one be? */ - rest = slow(m, sp, stp, ss, es); + rest = walk(m, sp, stp, ss, es, false); assert(rest != NULL); /* it did match */ /* could the rest match the rest? */ - tail = slow(m, rest, stop, es, stopst); + tail = walk(m, rest, stop, es, stopst, false); if (tail == stop) break; /* yes! */ /* no -- try a shorter match for this one */ @@ -504,7 +502,7 @@ dissect(struct match *m, esub = ss + OPND(m->g->strip[ss]) - 1; assert(OP(m->g->strip[esub]) == OOR1); for (;;) { /* find first matching branch */ - if (slow(m, sp, rest, ssub, esub) == rest) + if (walk(m, sp, rest, ssub, esub, false) == rest) break; /* it matched all of it */ /* that one missed, try next one */ assert(OP(m->g->strip[esub]) == OOR1); @@ -757,124 +755,16 @@ backref(struct match *m, } /* - - fast - step through the string at top speed - == static const char *fast(struct match *m, const char *start, \ - == const char *stop, sopno startst, sopno stopst); + - walk - step through the string either quickly or slowly + == static const char *walk(struct match *m, const char *start, \ + == const char *stop, sopno startst, sopno stopst, bool fast); */ -static const char * /* where tentative match ended, or NULL */ -fast( struct match *m, - const char *start, - const char *stop, - sopno startst, - sopno stopst) +static const char * /* where it ended, or NULL */ +walk(struct match *m, const char *start, const char *stop, sopno startst, + sopno stopst, bool fast) { states st = m->st; states fresh = m->fresh; - states tmp = m->tmp; - const char *p = start; - wint_t c; - wint_t lastc; /* previous c */ - wint_t flagch; - int i; - const char *coldp; /* last p after which no match was underway */ - size_t clen; - - CLEAR(st); - SET1(st, startst); - SP("fast", st, *p); - st = step(m->g, startst, stopst, st, NOTHING, st); - ASSIGN(fresh, st); - SP("start", st, *p); - coldp = NULL; - if (start == m->offp || (start == m->beginp && !(m->eflags®_NOTBOL))) - c = OUT; - else { - /* - * XXX Wrong if the previous character was multi-byte. - * Newline never is (in encodings supported by FreeBSD), - * so this only breaks the ISWORD tests below. - */ - c = (uch)*(start - 1); - } - for (;;) { - /* next character */ - lastc = c; - if (p == m->endp) { - clen = 0; - c = OUT; - } else - clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR); - if (EQ(st, fresh)) - coldp = p; - - /* is there an EOL and/or BOL between lastc and c? */ - flagch = '\0'; - i = 0; - if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || - (lastc == OUT && !(m->eflags®_NOTBOL)) ) { - flagch = BOL; - i = m->g->nbol; - } - if ( (c == '\n' && m->g->cflags®_NEWLINE) || - (c == OUT && !(m->eflags®_NOTEOL)) ) { - flagch = (flagch == BOL) ? BOLEOL : EOL; - i += m->g->neol; - } - if (i != 0) { - for (; i > 0; i--) - st = step(m->g, startst, stopst, st, flagch, st); - SP("boleol", st, c); - } - - /* how about a word boundary? */ - if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && - (c != OUT && ISWORD(c)) ) { - flagch = BOW; - } - if ( (lastc != OUT && ISWORD(lastc)) && - (flagch == EOL || (c != OUT && !ISWORD(c))) ) { - flagch = EOW; - } - if (flagch == BOW || flagch == EOW) { - st = step(m->g, startst, stopst, st, flagch, st); - SP("boweow", st, c); - } - - /* are we done? */ - if (ISSET(st, stopst) || p == stop || clen > stop - p) - break; /* NOTE BREAK OUT */ - - /* no, we must deal with this character */ - ASSIGN(tmp, st); - ASSIGN(st, fresh); - assert(c != OUT); - st = step(m->g, startst, stopst, tmp, c, st); - SP("aft", st, c); - assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); - p += clen; - } - - assert(coldp != NULL); - m->coldp = coldp; - if (ISSET(st, stopst)) - return(p+XMBRTOWC(NULL, p, stop - p, &m->mbs, 0)); - else - return(NULL); -} - -/* - - slow - step through the string more deliberately - == static const char *slow(struct match *m, const char *start, \ - == const char *stop, sopno startst, sopno stopst); - */ -static const char * /* where it ended */ -slow( struct match *m, - const char *start, - const char *stop, - sopno startst, - sopno stopst) -{ - states st = m->st; states empty = m->empty; states tmp = m->tmp; const char *p = start; @@ -890,6 +780,8 @@ slow( struct match *m, SET1(st, startst); SP("sstart", st, *p); st = step(m->g, startst, stopst, st, NOTHING, st); + if (fast) + ASSIGN(fresh, st); matchp = NULL; if (start == m->offp || (start == m->beginp && !(m->eflags®_NOTBOL))) c = OUT; @@ -910,6 +802,9 @@ slow( struct match *m, } else clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR); + if (fast && EQ(st, fresh)) + matchp = p; + /* is there an EOL and/or BOL between lastc and c? */ flagch = '\0'; i = 0; @@ -944,14 +839,21 @@ slow( struct match *m, } /* are we done? */ - if (ISSET(st, stopst)) - matchp = p; + if (ISSET(st, stopst)) { + if (fast) + break; + else + matchp = p; + } if (EQ(st, empty) || p == stop || clen > stop - p) break; /* NOTE BREAK OUT */ /* no, we must deal with this character */ ASSIGN(tmp, st); - ASSIGN(st, empty); + if (fast) + ASSIGN(st, fresh); + else + ASSIGN(st, empty); assert(c != OUT); st = step(m->g, startst, stopst, tmp, c, st); SP("saft", st, c); @@ -959,10 +861,17 @@ slow( struct match *m, p += clen; } - return(matchp); + if (fast) { + assert(matchp != NULL); + m->coldp = matchp; + if (ISSET(st, stopst)) + return (p + XMBRTOWC(NULL, p, stop - p, &m->mbs, 0)); + else + return (NULL); + } else + return (matchp); } - /* - step - map set of states reachable before char to set reachable after == static states step(struct re_guts *g, sopno start, sopno stop, \ @@ -1173,8 +1082,7 @@ pchar(int ch) #endif #undef matcher -#undef fast -#undef slow +#undef walk #undef dissect #undef backref #undef step From owner-svn-src-all@freebsd.org Wed Aug 9 01:06:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0810DAB536; Wed, 9 Aug 2017 01:06:41 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E56E7FBED; Wed, 9 Aug 2017 01:06:41 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7916euN010234; Wed, 9 Aug 2017 01:06:40 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7916eC9010233; Wed, 9 Aug 2017 01:06:40 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090106.v7916eC9010233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 01:06:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322289 - head/sys/dev/ofw X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ofw X-SVN-Commit-Revision: 322289 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 01:06:41 -0000 Author: mw Date: Wed Aug 9 01:06:40 2017 New Revision: 322289 URL: https://svnweb.freebsd.org/changeset/base/322289 Log: Enable using ofw_bus_find_compatible in early platform code Before this patch function ofw_bus_find_compatible was using memory allocations in order to find compatible node and the property's length. This way there was always a suited buffer for property, however this approach had also disadvantages - ofw_bus_find_compatible couldn't be used when malloc is not available, e.g. during fdt fixup stage. In order to remove the usage limitation of ofw_bus_find_compatible(), this patch modifies the function to use ofw_bus_node_is_compatible() (instead of the one without _int suffix), which uses a fixed buffer on stack instead of dynamic allocations. Submitted by: Patryk Duda Reviewed by: nwhitehorn, cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11880 Modified: head/sys/dev/ofw/ofw_bus_subr.c Modified: head/sys/dev/ofw/ofw_bus_subr.c ============================================================================== --- head/sys/dev/ofw/ofw_bus_subr.c Wed Aug 9 01:04:36 2017 (r322288) +++ head/sys/dev/ofw/ofw_bus_subr.c Wed Aug 9 01:06:40 2017 (r322289) @@ -720,22 +720,14 @@ phandle_t ofw_bus_find_compatible(phandle_t node, const char *onecompat) { phandle_t child, ret; - void *compat; - int len; /* * Traverse all children of 'start' node, and find first with * matching 'compatible' property. */ for (child = OF_child(node); child != 0; child = OF_peer(child)) { - len = OF_getprop_alloc(child, "compatible", 1, &compat); - if (len >= 0) { - ret = ofw_bus_node_is_compatible_int(compat, len, - onecompat); - free(compat, M_OFWPROP); - if (ret != 0) - return (child); - } + if (ofw_bus_node_is_compatible(child, onecompat) != 0) + return (child); ret = ofw_bus_find_compatible(child, onecompat); if (ret != 0) From owner-svn-src-all@freebsd.org Wed Aug 9 01:14:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAFA4DABCBD; Wed, 9 Aug 2017 01:14:30 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A99B800CC; Wed, 9 Aug 2017 01:14:30 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v791ETAB014053; Wed, 9 Aug 2017 01:14:29 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v791ETgk014052; Wed, 9 Aug 2017 01:14:29 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090114.v791ETgk014052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 01:14:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322290 - head/sys/arm/mv X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/arm/mv X-SVN-Commit-Revision: 322290 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 01:14:30 -0000 Author: mw Date: Wed Aug 9 01:14:29 2017 New Revision: 322290 URL: https://svnweb.freebsd.org/changeset/base/322290 Log: Dynamically configure timers' base frequency for Armada 38x Instead of using 'clock-frequency' device tree property for global/twd mpcore timers of Armada 38x SoCs, set it in platform_late_init stage with arm_tmr_change_frequency() function. Reviewed by: cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11881 Modified: head/sys/arm/mv/mv_machdep.c Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Wed Aug 9 01:06:40 2017 (r322289) +++ head/sys/arm/mv/mv_machdep.c Wed Aug 9 01:14:29 2017 (r322290) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -294,6 +295,9 @@ platform_late_init(void) #endif #if defined(SOC_MV_ARMADA38X) + /* Configure timers' base frequency */ + arm_tmr_change_frequency(get_cpu_freq() / 2); + /* * Workaround for Marvell Armada38X family HW issue * between Cortex-A9 CPUs and on-chip devices that may From owner-svn-src-all@freebsd.org Wed Aug 9 01:19:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10AA2DB525A; Wed, 9 Aug 2017 01:19: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 mx1.freebsd.org (Postfix) with ESMTPS id C3F8E8048A; Wed, 9 Aug 2017 01:19:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v791JJ41014248; Wed, 9 Aug 2017 01:19:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v791JJeB014244; Wed, 9 Aug 2017 01:19:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708090119.v791JJeB014244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 9 Aug 2017 01:19:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322291 - in head/usr.bin/du: . tests X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/usr.bin/du: . tests X-SVN-Commit-Revision: 322291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 01:19:21 -0000 Author: kevans Date: Wed Aug 9 01:19:19 2017 New Revision: 322291 URL: https://svnweb.freebsd.org/changeset/base/322291 Log: du(1): Add --si option to display in terms of powers of 1000 Reviewed by: cem (earlier version), emaste Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D11748 Modified: head/usr.bin/du/du.1 head/usr.bin/du/du.c head/usr.bin/du/tests/du_test.sh Modified: head/usr.bin/du/du.1 ============================================================================== --- head/usr.bin/du/du.1 Wed Aug 9 01:14:29 2017 (r322290) +++ head/usr.bin/du/du.1 Wed Aug 9 01:19:19 2017 (r322291) @@ -28,7 +28,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd November 4, 2012 +.Dd August 8, 2017 .Dt DU 1 .Os .Sh NAME @@ -63,9 +63,10 @@ Calculate block counts in .Ar blocksize byte blocks. This is different from the -.Fl h, k, m +.Fl h, k, m, +.Fl Fl si and -.Fl g +.Fl g options or setting .Ev BLOCKSIZE and gives an estimate of how much space the examined file hierarchy would @@ -101,7 +102,7 @@ Display block counts in 1073741824-byte (1 GiB) blocks .Dq Human-readable output. Use unit suffixes: Byte, Kilobyte, Megabyte, -Gigabyte, Terabyte and Petabyte. +Gigabyte, Terabyte and Petabyte based on powers of 1024. .It Fl k Display block counts in 1024-byte (1 kiB) blocks. .It Fl l @@ -131,6 +132,11 @@ This option exists solely for conformance with Display an entry for each specified file. (Equivalent to .Fl d Li 0 ) +.It Fl Fl si +.Dq Human-readable +output. +Use unit suffixes: Byte, Kilobyte, Megabyte, +Gigabyte, Terabyte and Petabyte based on powers of 1000. .It Fl t Ar threshold Display only entries for which size exceeds .Ar threshold . @@ -166,9 +172,9 @@ options override each other and the command's actions by the last one specified. .Pp The -.Fl h, k +.Fl h, k, m and -.Fl m +.Fl Fl si options all override each other; the last one specified determines the block counts used. .Sh ENVIRONMENT @@ -177,17 +183,17 @@ the block counts used. If the environment variable .Ev BLOCKSIZE is set, and the -.Fl h, k +.Fl h, k, m or -.Fl m +.Fl Fl si options are not specified, the block counts will be displayed in units of that block size. If .Ev BLOCKSIZE is not set, and the -.Fl h, k +.Fl h, k, m or -.Fl m +.Fl Fl si options are not specified, the block counts will be displayed in 512-byte blocks. .El Modified: head/usr.bin/du/du.c ============================================================================== --- head/usr.bin/du/du.c Wed Aug 9 01:14:29 2017 (r322290) +++ head/usr.bin/du/du.c Wed Aug 9 01:19:19 2017 (r322291) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -60,6 +61,11 @@ __FBSDID("$FreeBSD$"); #include #include +#define SI_OPT (CHAR_MAX + 1) + +#define UNITS_2 1 +#define UNITS_SI 2 + static SLIST_HEAD(ignhead, ignentry) ignores; struct ignentry { char *mask; @@ -75,10 +81,16 @@ static int ignorep(FTSENT *); static void siginfo(int __unused); static int nodumpflag = 0; -static int Aflag; +static int Aflag, hflag; static long blocksize, cblocksize; static volatile sig_atomic_t info; +static const struct option long_options[] = +{ + { "si", no_argument, NULL, SI_OPT }, + { NULL, no_argument, NULL, 0 }, +}; + int main(int argc, char *argv[]) { @@ -89,14 +101,13 @@ main(int argc, char *argv[]) int ftsoptions; int depth; int Hflag, Lflag, aflag, sflag, dflag, cflag; - int hflag, lflag, ch, notused, rval; + int lflag, ch, notused, rval; char **save; static char dot[] = "."; setlocale(LC_ALL, ""); - Hflag = Lflag = aflag = sflag = dflag = cflag = hflag = - lflag = Aflag = 0; + Hflag = Lflag = aflag = sflag = dflag = cflag = lflag = Aflag = 0; save = argv; ftsoptions = FTS_PHYSICAL; @@ -108,7 +119,8 @@ main(int argc, char *argv[]) depth = INT_MAX; SLIST_INIT(&ignores); - while ((ch = getopt(argc, argv, "AB:HI:LPasd:cghklmnrt:x")) != -1) + while ((ch = getopt_long(argc, argv, "+AB:HI:LPasd:cghklmnrt:x", + long_options, NULL)) != -1) switch (ch) { case 'A': Aflag = 1; @@ -160,7 +172,7 @@ main(int argc, char *argv[]) blocksize = 1073741824; break; case 'h': - hflag = 1; + hflag = UNITS_2; break; case 'k': hflag = 0; @@ -189,6 +201,9 @@ main(int argc, char *argv[]) case 'x': ftsoptions |= FTS_XDEV; break; + case SI_OPT: + hflag = UNITS_SI; + break; case '?': default: usage(); @@ -270,7 +285,7 @@ main(int argc, char *argv[]) if (p->fts_level <= depth && threshold <= threshold_sign * howmany(p->fts_bignum * cblocksize, blocksize)) { - if (hflag) { + if (hflag > 0) { prthumanval(p->fts_bignum); (void)printf("\t%s\n", p->fts_path); } else { @@ -306,7 +321,7 @@ main(int argc, char *argv[]) howmany(p->fts_statp->st_blocks, cblocksize); if (aflag || p->fts_level == 0) { - if (hflag) { + if (hflag > 0) { prthumanval(curblocks); (void)printf("\t%s\n", p->fts_path); } else { @@ -326,7 +341,7 @@ main(int argc, char *argv[]) err(1, "fts_read"); if (cflag) { - if (hflag) { + if (hflag > 0) { prthumanval(savednumber); (void)printf("\ttotal\n"); } else { @@ -474,13 +489,16 @@ static void prthumanval(int64_t bytes) { char buf[5]; + int flags; bytes *= cblocksize; + flags = HN_B | HN_NOSPACE | HN_DECIMAL; if (!Aflag) bytes *= DEV_BSIZE; + if (hflag == UNITS_SI) + flags |= HN_DIVISOR_1000; - humanize_number(buf, sizeof(buf), bytes, "", HN_AUTOSCALE, - HN_B | HN_NOSPACE | HN_DECIMAL); + humanize_number(buf, sizeof(buf), bytes, "", HN_AUTOSCALE, flags); (void)printf("%4s", buf); } Modified: head/usr.bin/du/tests/du_test.sh ============================================================================== --- head/usr.bin/du/tests/du_test.sh Wed Aug 9 01:14:29 2017 (r322290) +++ head/usr.bin/du/tests/du_test.sh Wed Aug 9 01:19:19 2017 (r322291) @@ -141,6 +141,20 @@ m_flag_body() atf_check -o inline:'1\tA\n1\tB\n1024\tC\n' du -Am A B C } +atf_test_case si_flag +si_flag_head() +{ + atf_set "descr" "Verify --si output" +} +si_flag_body() +{ + atf_check truncate -s 1500000 A + atf_check truncate -s 1572864 B + + atf_check -o inline:'1.4M\tA\n1.5M\tB\n' du -Ah A B + atf_check -o inline:'1.5M\tA\n1.6M\tB\n' du -A --si A B +} + atf_init_test_cases() { atf_add_test_case A_flag @@ -150,4 +164,5 @@ atf_init_test_cases() atf_add_test_case h_flag atf_add_test_case k_flag atf_add_test_case m_flag + atf_add_test_case si_flag } From owner-svn-src-all@freebsd.org Wed Aug 9 01:20:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC4BBDB5411; Wed, 9 Aug 2017 01:20:54 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7BE9480661; Wed, 9 Aug 2017 01:20:54 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v791KrlZ014359; Wed, 9 Aug 2017 01:20:53 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v791Krwm014358; Wed, 9 Aug 2017 01:20:53 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090120.v791Krwm014358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 01:20:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322292 - head/sys/boot/fdt/dts/arm X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/boot/fdt/dts/arm X-SVN-Commit-Revision: 322292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 01:20:54 -0000 Author: mw Date: Wed Aug 9 01:20:53 2017 New Revision: 322292 URL: https://svnweb.freebsd.org/changeset/base/322292 Log: Remove clock-frequency properties from Armada 38x timer nodes Since the timers' base frequency setting is added to the platform code, this patch removes clock-frequency properties from global and twd timers, aligning both to the Linux device tree. Submitted by: Patryk Duda Reviewed by: cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11882 Modified: head/sys/boot/fdt/dts/arm/armada-38x.dtsi Modified: head/sys/boot/fdt/dts/arm/armada-38x.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/armada-38x.dtsi Wed Aug 9 01:19:19 2017 (r322291) +++ head/sys/boot/fdt/dts/arm/armada-38x.dtsi Wed Aug 9 01:20:53 2017 (r322292) @@ -189,7 +189,6 @@ compatible = "arm,cortex-a9-global-timer"; reg = <0xc200 0x20>; interrupts = ; - clock-frequency = <800000000>; clocks = <&coreclk 2>; }; @@ -197,7 +196,6 @@ compatible = "arm,cortex-a9-twd-timer"; reg = <0xc600 0x20>; interrupts = ; - clock-frequency = <800000000>; clocks = <&coreclk 2>; }; From owner-svn-src-all@freebsd.org Wed Aug 9 01:24:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F16FDB59BE; Wed, 9 Aug 2017 01:24: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 mx1.freebsd.org (Postfix) with ESMTPS id 4C4F780B5F; Wed, 9 Aug 2017 01:24: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 v791Oq5s018039; Wed, 9 Aug 2017 01:24:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v791Oq49018037; Wed, 9 Aug 2017 01:24:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708090124.v791Oq49018037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 9 Aug 2017 01:24:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322293 - head/bin/df X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/bin/df X-SVN-Commit-Revision: 322293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 01:24:53 -0000 Author: kevans Date: Wed Aug 9 01:24:52 2017 New Revision: 322293 URL: https://svnweb.freebsd.org/changeset/base/322293 Log: df(1): Add --si as an alias for -H Reviewed by: cem (earlier version), emaste Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D11749 Modified: head/bin/df/df.1 head/bin/df/df.c Modified: head/bin/df/df.1 ============================================================================== --- head/bin/df/df.1 Wed Aug 9 01:20:53 2017 (r322292) +++ head/bin/df/df.1 Wed Aug 9 01:24:52 2017 (r322293) @@ -29,7 +29,7 @@ .\" @(#)df.1 8.3 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd December 1, 2015 +.Dd August 8, 2017 .Dt DF 1 .Os .Sh NAME @@ -97,7 +97,7 @@ output. Use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte and Pebibyte (based on powers of 1024) in order to reduce the number of digits to four or fewer. -.It Fl H +.It Fl H , Fl Fl si .Dq Human-readable output. Use unit suffixes: Byte, Kilobyte, Megabyte, Modified: head/bin/df/df.c ============================================================================== --- head/bin/df/df.c Wed Aug 9 01:20:53 2017 (r322292) +++ head/bin/df/df.c Wed Aug 9 01:24:52 2017 (r322293) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#include #include #include #ifdef MOUNT_CHAR_DEVS @@ -107,6 +108,12 @@ static int thousands; static struct ufs_args mdev; #endif +static const struct option long_options[] = +{ + { "si", no_argument, NULL, 'H' }, + { NULL, no_argument, NULL, 0 }, +}; + int main(int argc, char *argv[]) { @@ -142,7 +149,8 @@ main(int argc, char *argv[]) if (argc < 0) exit(1); - while ((ch = getopt(argc, argv, "abcgHhiklmnPt:T,")) != -1) + while ((ch = getopt_long(argc, argv, "+abcgHhiklmnPt:T,", long_options, + NULL)) != -1) switch (ch) { case 'a': aflag = 1; From owner-svn-src-all@freebsd.org Wed Aug 9 01:25:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2C5BDB5B67; Wed, 9 Aug 2017 01:25:48 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81C4580D0D; Wed, 9 Aug 2017 01:25:48 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v791PlUF018120; Wed, 9 Aug 2017 01:25:47 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v791Plrp018119; Wed, 9 Aug 2017 01:25:47 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090125.v791Plrp018119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 01:25:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322294 - head/sys/arm/mv/armada38x X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/arm/mv/armada38x X-SVN-Commit-Revision: 322294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 01:25:48 -0000 Author: mw Date: Wed Aug 9 01:25:47 2017 New Revision: 322294 URL: https://svnweb.freebsd.org/changeset/base/322294 Log: Enable pl310 coherent operation in platform init for Armada 38x Updating PL310 sotfware context sc_io_coherent field in platform_pl310_init() routine for Armada 38x helps to avoid using 'arm,io-coherent' property, which is by default not present in the device tree node in Linux. This way another step for DT unification between two operating systems is done. The improvemnt will also work after enabling PLATFORM for Marvell ARMv7 SoCs. Reviewed by: andrew, cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11883 Modified: head/sys/arm/mv/armada38x/armada38x_pl310.c Modified: head/sys/arm/mv/armada38x/armada38x_pl310.c ============================================================================== --- head/sys/arm/mv/armada38x/armada38x_pl310.c Wed Aug 9 01:24:52 2017 (r322293) +++ head/sys/arm/mv/armada38x/armada38x_pl310.c Wed Aug 9 01:25:47 2017 (r322294) @@ -57,6 +57,9 @@ platform_pl310_init(struct pl310_softc *sc) pl310_write4(sc, PL310_PREFETCH_CTRL, PREFETCH_CTRL_DL | PREFETCH_CTRL_DATA_PREFETCH | PREFETCH_CTRL_INCR_DL | PREFETCH_CTRL_DL_ON_WRAP); + + /* Disable L2 cache sync for IO coherent operation */ + sc->sc_io_coherent = true; } void From owner-svn-src-all@freebsd.org Wed Aug 9 01:31:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01479DB60ED; Wed, 9 Aug 2017 01:31:07 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C447A81060; Wed, 9 Aug 2017 01:31:06 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v791V6OL019006; Wed, 9 Aug 2017 01:31:06 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v791V5lM019004; Wed, 9 Aug 2017 01:31:05 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708090131.v791V5lM019004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 9 Aug 2017 01:31:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322295 - head/sys/boot/fdt/dts/arm X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/boot/fdt/dts/arm X-SVN-Commit-Revision: 322295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 01:31:07 -0000 Author: mw Date: Wed Aug 9 01:31:05 2017 New Revision: 322295 URL: https://svnweb.freebsd.org/changeset/base/322295 Log: Update pl310 node in Armada 38x DTS to match the one used in Linux Since the cache controller nodes fixup is added to the platform code, this patch aligns it to the Linux device tree representation. Submitted by: Patryk Duda Reviewed by: cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11884 Modified: head/sys/boot/fdt/dts/arm/armada-38x.dtsi Modified: head/sys/boot/fdt/dts/arm/armada-38x.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/armada-38x.dtsi Wed Aug 9 01:25:47 2017 (r322294) +++ head/sys/boot/fdt/dts/arm/armada-38x.dtsi Wed Aug 9 01:31:05 2017 (r322295) @@ -177,7 +177,10 @@ reg = <0x8000 0x1000>; cache-unified; cache-level = <2>; - arm,io-coherent; + arm,double-linefill-incr = <1>; + arm,double-linefill-wrap = <0>; + arm,double-linefill = <1>; + prefetch-data = <1>; }; scu@c000 { From owner-svn-src-all@freebsd.org Wed Aug 9 04:09:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E575DC1E11; Wed, 9 Aug 2017 04:09:18 +0000 (UTC) (envelope-from decui@microsoft.com) Received: from APC01-HK2-obe.outbound.protection.outlook.com (mail-hk2apc01on0120.outbound.protection.outlook.com [104.47.124.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C7BE1777; Wed, 9 Aug 2017 04:09:16 +0000 (UTC) (envelope-from decui@microsoft.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=/r/oxQBttJaDD/9NNNIPK1NyWl/iEkGApSDZ4eji1g4=; b=WGXRHXOwyqaB57DTGLHBQSxUgSMm3SrpLS83kLoKFgqhGf6HPiEwqxQNzCL2IDnRGL6N7tKgq/Lm3odzfkbMm3ZEEux6fYreRbHz8vZRlcEXPS8I6AhGPv6nEgCviKYiPG95jNbBXVzq/wejRx2fyk7QQ0EdrB2iJRh8t3O0zlQ= Received: from KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM (10.170.167.145) by KL1P15301MB0039.APCP153.PROD.OUTLOOK.COM (10.170.168.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1362.4; Wed, 9 Aug 2017 04:09:09 +0000 Received: from KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM ([10.170.167.145]) by KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM ([10.170.167.145]) with mapi id 15.01.1362.003; Wed, 9 Aug 2017 04:09:08 +0000 From: Dexuan Cui To: Jung-uk Kim , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" CC: Yanmin Qiao , Hongjiang Zhang Subject: RE: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 Thread-Topic: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 Thread-Index: AQHTDbgLhcqLEIRH8UKGIazjERHYm6J7bHlA Date: Wed, 9 Aug 2017 04:09:07 +0000 Message-ID: References: <201708050656.v756uk48076256@repo.freebsd.org> In-Reply-To: <201708050656.v756uk48076256@repo.freebsd.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Ref=https://api.informationprotection.azure.com/api/72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=decui@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2017-08-08T21:09:05.9146953-07:00; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General authentication-results: spf=none (sender IP is ) smtp.mailfrom=decui@microsoft.com; x-originating-ip: [50.35.78.155] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; KL1P15301MB0039; 6:wrLmHIpAZhwSyClR7HrNyievuZqr+R0FA6TQ+5GqMJGA1CzoTT3cgdq/wEaQa6/nYi8u/yyZNjT/wEziRqE8vEpVxLpyfrS/gnV2moQdsIItd6JZ6jG4CxWpONDmmx5SQDW3x3sfy2kygVY9mCNuElP73JUozK+tbDTIpIwwjifpKDu4Tp5gl7mO7WphgTzF2p7nv8yRcGgitZezZBlu+An3jAumjf/xhq9PPf9+kgRU8i0dkFf8jUnkqTT+RS1chU/Y3RU0QCr2BjqLE6MlsEeUvok2XoHEzllfw5Qx+rRgxzfYLZ8rk5e22jTLqYIzblefxK8Q2UjdINeDXh0AOA==; 5:dDvs0Pus2R/Bz308xyPvtDv1cwx1k1mJMzdt/bUBp58MbqCzhkwAZHJt0PFgQW7N95onkPk9CP1V/KlhOGUHkbrlcu/tr56iMgH/9qXYeksmy1J4px9Ta6PHXV6mMFGqnBaRMEm4wmV8Fi9vIkmfxg==; 24:Gs+SPHFSUGeySq09i4X5D0F/n5odJ7nOZF9jUVIKRIx4bI9ydTYueJIcvYw67qw5YQXoh61eIyQQPVNc9yqL2PBgeduUNRzFkCrdgY7D7iE=; 7:MG/k8j5SxoIytjRy3RbVBfq5m+O34TlH0YMQdxQaUi9yjuSAsf6CBMzz/y+NQn5ZtcesN9SgwLunE+ANxONXFNQVHLwdXLMJT/6/63EYhdmPvsLc2EOxMYCNBmifyX8xz4DD6iXn2ParemDHME+XMEhAHSOmxLr4KD4KhuonC5zHwVRfhVmJRUBOQLvfhbM++Y11EDP6Ho2eei2vrnl5YxpCRYq7q4aKmBmMI4kEzOg= x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10019020)(6009001)(39400400002)(39860400002)(39450400003)(39850400002)(39840400002)(39410400002)(47760400005)(13464003)(189002)(199003)(50986999)(54356999)(2201001)(76176999)(86612001)(74316002)(8990500004)(3660700001)(2900100001)(6246003)(53936002)(25786009)(305945005)(68736007)(101416001)(105586002)(97736004)(2950100002)(106356001)(53546010)(8936002)(189998001)(5005710100001)(2501003)(66066001)(8676002)(6506006)(10090500001)(6436002)(81166006)(81156014)(4326008)(450100002)(5660300001)(2906002)(966005)(229853002)(9686003)(6306002)(3280700002)(7736002)(86362001)(575784001)(10290500003)(478600001)(54906002)(3846002)(7696004)(33656002)(6116002)(102836003)(38730400002)(107886003)(14454004)(77096006)(55016002); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1P15301MB0039; H:KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-correlation-id: 07c2b888-caae-48df-6fd7-08d4dedc61f8 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(48565401081)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:KL1P15301MB0039; x-ms-traffictypediagnostic: KL1P15301MB0039: x-exchange-antispam-report-test: UriScan:(189930954265078)(219752817060721); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(61425038)(6040450)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123558100)(20161123564025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:KL1P15301MB0039; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:KL1P15301MB0039; x-forefront-prvs: 0394259C80 received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Aug 2017 04:09:07.8612 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1P15301MB0039 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 04:09:18 -0000 SGkgamtpbSwNClRoZSBwYXRjaCBicmVha3MgRnJlZUJTRCBWTSBvbiBIeXBlci1WLg0KDQppZGVu dGlmeV9oeXBlcnZpc29yKCkgaXMgbW92ZWQgZnJvbSBpZGVudGlmeV9jcHUoKSB0byBhbiBlYXJs aWVyIHBsYWNlLCBidXQgdGhlIGdsb2JhbCANCnZhcmlhYmxlIGNwdV9mZWF0dXJlMiB1c2VkIGJ5 IHRoZSBmdW5jdGlvbiBpcyBzdGlsbCBpbml0aWFsaXplZCBpbiBpZGVudGlmeV9jcHUoKS4NCg0K SSdtIG5vdCBzdXJlIGFib3V0IHRoZSBiYWNrZ3JvdW5kIG9mIHlvdXIgcGF0Y2guIENhbiB5b3Ug cGxlYXNlIGhhdmUgYSBsb29rPw0KDQpUaGFua3MsDQotLSBEZXh1YW4NCg0KPiAtLS0tLU9yaWdp bmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBvd25lci1zcmMtY29tbWl0dGVyc0BmcmVlYnNkLm9y ZyBbbWFpbHRvOm93bmVyLXNyYy0NCj4gY29tbWl0dGVyc0BmcmVlYnNkLm9yZ10gT24gQmVoYWxm IE9mIEp1bmctdWsgS2ltDQo+IFNlbnQ6IEZyaWRheSwgQXVndXN0IDQsIDIwMTcgMjM6NTcNCj4g VG86IHNyYy1jb21taXR0ZXJzQGZyZWVic2Qub3JnOyBzdm4tc3JjLWFsbEBmcmVlYnNkLm9yZzsg c3ZuLXNyYy0NCj4gaGVhZEBmcmVlYnNkLm9yZw0KPiBTdWJqZWN0OiBzdm4gY29tbWl0OiByMzIy MDc2IC0gaW4gaGVhZC9zeXM6IGFtZDY0L2FtZDY0IGkzODYvaTM4Ng0KPiB4ODYvaW5jbHVkZSB4 ODYveDg2DQo+IA0KPiBBdXRob3I6IGpraW0NCj4gRGF0ZTogU2F0IEF1ZyAgNSAwNjo1Njo0NiAy MDE3DQo+IE5ldyBSZXZpc2lvbjogMzIyMDc2DQo+IFVSTDoNCj4gaHR0cHM6Ly9uYTAxLnNhZmVs aW5rcy5wcm90ZWN0aW9uLm91dGxvb2suY29tLz91cmw9aHR0cHMlM0ElMkYlMkZzdm53ZWIuZnIN Cj4gZWVic2Qub3JnJTJGY2hhbmdlc2V0JTJGYmFzZSUyRjMyMjA3NiZkYXRhPTAyJTdDMDElN0Nk ZWN1aSU0MG1pY3INCj4gb3NvZnQuY29tJTdDNWE4MjYyMzVlMDhiNDE1ZmMzY2IwOGQ0ZGJjZjJi ODAlN0M3MmY5ODhiZjg2ZjE0MWFmOTFhYg0KPiAyZDdjZDAxMWRiNDclN0MxJTdDMCU3QzYzNjM3 NTEzMDIxNzE5MjA0NyZzZGF0YT0lMkJjWmhsciUyQjJ6WDVTDQo+IFMxZUEzMmZXTXB6Y2tOSE9R bEd6OFVITFhDYVVOMHMlM0QmcmVzZXJ2ZWQ9MA0KPiANCj4gTG9nOg0KPiAgIERldGVjdCBoeXBl cnZpc29ycyBlYXJseS4gIFdlIHVzZWQgdG8gc2V0IGxvd2VyIGh6IG9uIGh5cGVydmlzb3JzIGJ5 IGRlZmF1bHQNCj4gICBidXQgaXQgd2FzIGJyb2tlbiBzaW5jZSByMjczODAwIChhbmQgcjI3ODUy MiwgaXRzIE1GQyB0byBzdGFibGUvMTApIGJlY2F1c2UNCj4gICBpZGVudGlmeV9jcHUoKSBpcyBj YWxsZWQgdG9vIGxhdGUsIGkuZS4sIGFmdGVyIGluaXRfcGFyYW0xKCkuDQo+IA0KPiAgIE1GQyBh ZnRlcjoJMyBkYXlzDQo+IA0KPiBNb2RpZmllZDoNCj4gICBoZWFkL3N5cy9hbWQ2NC9hbWQ2NC9t YWNoZGVwLmMNCj4gICBoZWFkL3N5cy9pMzg2L2kzODYvbWFjaGRlcC5jDQo+ICAgaGVhZC9zeXMv eDg2L2luY2x1ZGUveDg2X3Zhci5oDQo+ICAgaGVhZC9zeXMveDg2L3g4Ni9pZGVudGNwdS5jDQo+ IA0KPiBNb2RpZmllZDogaGVhZC9zeXMvYW1kNjQvYW1kNjQvbWFjaGRlcC5jDQo+ID09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 DQo+ID09PT09PT09PT09PT0NCj4gLS0tIGhlYWQvc3lzL2FtZDY0L2FtZDY0L21hY2hkZXAuYwlT YXQgQXVnICA1IDA2OjQ2OjA2IDIwMTcNCj4gCShyMzIyMDc1KQ0KPiArKysgaGVhZC9zeXMvYW1k NjQvYW1kNjQvbWFjaGRlcC5jCVNhdCBBdWcgIDUgMDY6NTY6NDYgMjAxNw0KPiAJKHIzMjIwNzYp DQo+IEBAIC0xNTM3LDYgKzE1MzcsOCBAQCBoYW1tZXJfdGltZSh1X2ludDY0X3QgbW9kdWxlcCwg dV9pbnQ2NF90IHBoeXNmcmVlKQ0KPiANCj4gIAlrbWRwID0gaW5pdF9vcHMucGFyc2VfcHJlbG9h ZF9kYXRhKG1vZHVsZXApOw0KPiANCj4gKwlpZGVudGlmeV9oeXBlcnZpc29yKCk7DQo+ICsNCj4g IAkvKiBJbml0IGJhc2ljIHR1bmFibGVzLCBoeiBldGMgKi8NCj4gIAlpbml0X3BhcmFtMSgpOw0K PiANCj4gDQo+IE1vZGlmaWVkOiBoZWFkL3N5cy9pMzg2L2kzODYvbWFjaGRlcC5jDQo+ID09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09DQo+ID09PT09PT09PT09PT0NCj4gLS0tIGhlYWQvc3lzL2kzODYvaTM4Ni9tYWNoZGVwLmMJ U2F0IEF1ZyAgNSAwNjo0NjowNiAyMDE3DQo+IAkocjMyMjA3NSkNCj4gKysrIGhlYWQvc3lzL2kz ODYvaTM4Ni9tYWNoZGVwLmMJU2F0IEF1ZyAgNSAwNjo1Njo0NiAyMDE3DQo+IAkocjMyMjA3NikN Cj4gQEAgLTIxODUsNiArMjE4NSw4IEBAIGluaXQzODYoaW50IGZpcnN0KQ0KPiAgCWVsc2UNCj4g IAkJaW5pdF9zdGF0aWNfa2VudihOVUxMLCAwKTsNCj4gDQo+ICsJaWRlbnRpZnlfaHlwZXJ2aXNv cigpOw0KPiArDQo+ICAJLyogSW5pdCBiYXNpYyB0dW5hYmxlcywgaHogZXRjICovDQo+ICAJaW5p dF9wYXJhbTEoKTsNCj4gDQo+IA0KPiBNb2RpZmllZDogaGVhZC9zeXMveDg2L2luY2x1ZGUveDg2 X3Zhci5oDQo+ID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09DQo+ID09PT09PT09PT09PT0NCj4gLS0tIGhlYWQvc3lzL3g4Ni9p bmNsdWRlL3g4Nl92YXIuaAlTYXQgQXVnICA1IDA2OjQ2OjA2IDIwMTcNCj4gCShyMzIyMDc1KQ0K PiArKysgaGVhZC9zeXMveDg2L2luY2x1ZGUveDg2X3Zhci5oCVNhdCBBdWcgIDUgMDY6NTY6NDYg MjAxNw0KPiAJKHIzMjIwNzYpDQo+IEBAIC0xMTYsNiArMTE2LDcgQEAgdm9pZAljcHVfc2V0cmVn cyh2b2lkKTsNCj4gIHZvaWQJZHVtcF9hZGRfcGFnZSh2bV9wYWRkcl90KTsNCj4gIHZvaWQJZHVt cF9kcm9wX3BhZ2Uodm1fcGFkZHJfdCk7DQo+ICB2b2lkCWlkZW50aWZ5X2NwdSh2b2lkKTsNCj4g K3ZvaWQJaWRlbnRpZnlfaHlwZXJ2aXNvcih2b2lkKTsNCj4gIHZvaWQJaW5pdGlhbGl6ZWNwdSh2 b2lkKTsNCj4gIHZvaWQJaW5pdGlhbGl6ZWNwdWNhY2hlKHZvaWQpOw0KPiAgYm9vbAlmaXhfY3B1 aWQodm9pZCk7DQo+IA0KPiBNb2RpZmllZDogaGVhZC9zeXMveDg2L3g4Ni9pZGVudGNwdS5jDQo+ ID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09DQo+ID09PT09PT09PT09PT0NCj4gLS0tIGhlYWQvc3lzL3g4Ni94ODYvaWRlbnRj cHUuYwlTYXQgQXVnICA1IDA2OjQ2OjA2IDIwMTcJKHIzMjIwNzUpDQo+ICsrKyBoZWFkL3N5cy94 ODYveDg2L2lkZW50Y3B1LmMJU2F0IEF1ZyAgNSAwNjo1Njo0NiAyMDE3DQo+IAkocjMyMjA3NikN Cj4gQEAgLTEyNTIsNyArMTI1Miw3IEBAIHN0YXRpYyBjb25zdCBjaGFyICpjb25zdCB2bV9wbmFt ZXNbXSA9IHsNCj4gIAlOVUxMDQo+ICB9Ow0KPiANCj4gLXN0YXRpYyB2b2lkDQo+ICt2b2lkDQo+ ICBpZGVudGlmeV9oeXBlcnZpc29yKHZvaWQpDQo+ICB7DQo+ICAJdV9pbnQgcmVnc1s0XTsNCj4g QEAgLTE0MDMsNyArMTQwMyw2IEBAIGlkZW50aWZ5X2NwdSh2b2lkKQ0KPiAgCWNwdV9mZWF0dXJl MiA9IHJlZ3NbMl07DQo+ICAjZW5kaWYNCj4gDQo+IC0JaWRlbnRpZnlfaHlwZXJ2aXNvcigpOw0K PiAgCWNwdV92ZW5kb3JfaWQgPSBmaW5kX2NwdV92ZW5kb3JfaWQoKTsNCj4gDQo+ICAJaWYgKGZp eF9jcHVpZCgpKSB7DQoNCg== From owner-svn-src-all@freebsd.org Wed Aug 9 04:23:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FA01DC23D0; Wed, 9 Aug 2017 04:23:06 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF0661F4A; Wed, 9 Aug 2017 04:23:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v794N5QL091676; Wed, 9 Aug 2017 04:23:05 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v794N4Kd091671; Wed, 9 Aug 2017 04:23:04 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201708090423.v794N4Kd091671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Wed, 9 Aug 2017 04:23:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322296 - in head/sys: kern sparc64/sparc64 vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in head/sys: kern sparc64/sparc64 vm X-SVN-Commit-Revision: 322296 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 04:23:06 -0000 Author: alc Date: Wed Aug 9 04:23:04 2017 New Revision: 322296 URL: https://svnweb.freebsd.org/changeset/base/322296 Log: Introduce vm_page_grab_pages(), which is intended to replace loops calling vm_page_grab() on consecutive page indices. Besides simplifying the code in the caller, vm_page_grab_pages() allows for batching optimizations. For example, the current implementation replaces calls to vm_page_lookup() on consecutive page indices by cheaper calls to vm_page_next(). Reviewed by: kib, markj Tested by: pho (an earlier version) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11926 Modified: head/sys/kern/vfs_bio.c head/sys/sparc64/sparc64/pmap.c head/sys/vm/vm_glue.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Aug 9 01:31:05 2017 (r322295) +++ head/sys/kern/vfs_bio.c Wed Aug 9 04:23:04 2017 (r322296) @@ -2735,7 +2735,7 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int */ obj = bp->b_bufobj->bo_object; VM_OBJECT_WLOCK(obj); - while (bp->b_npages < desiredpages) { + if (bp->b_npages < desiredpages) { /* * We must allocate system pages since blocking * here could interfere with paging I/O, no @@ -2746,14 +2746,12 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int * deadlocks once allocbuf() is called after * pages are vfs_busy_pages(). */ - m = vm_page_grab(obj, OFF_TO_IDX(bp->b_offset) + bp->b_npages, - VM_ALLOC_NOBUSY | VM_ALLOC_SYSTEM | - VM_ALLOC_WIRED | VM_ALLOC_IGN_SBUSY | - VM_ALLOC_COUNT(desiredpages - bp->b_npages)); - if (m->valid == 0) - bp->b_flags &= ~B_CACHE; - bp->b_pages[bp->b_npages] = m; - ++bp->b_npages; + vm_page_grab_pages(obj, + OFF_TO_IDX(bp->b_offset) + bp->b_npages, + VM_ALLOC_SYSTEM | VM_ALLOC_IGN_SBUSY | + VM_ALLOC_NOBUSY | VM_ALLOC_WIRED, + &bp->b_pages[bp->b_npages], desiredpages - bp->b_npages); + bp->b_npages = desiredpages; } /* Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Wed Aug 9 01:31:05 2017 (r322295) +++ head/sys/sparc64/sparc64/pmap.c Wed Aug 9 04:23:04 2017 (r322296) @@ -1226,7 +1226,6 @@ int pmap_pinit(pmap_t pm) { vm_page_t ma[TSB_PAGES]; - vm_page_t m; int i; /* @@ -1249,14 +1248,11 @@ pmap_pinit(pmap_t pm) CPU_ZERO(&pm->pm_active); VM_OBJECT_WLOCK(pm->pm_tsb_obj); - for (i = 0; i < TSB_PAGES; i++) { - m = vm_page_grab(pm->pm_tsb_obj, i, VM_ALLOC_NOBUSY | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); - m->valid = VM_PAGE_BITS_ALL; - m->md.pmap = pm; - ma[i] = m; - } + vm_page_grab_pages(pm->pm_tsb_obj, 0, VM_ALLOC_NORMAL | + VM_ALLOC_NOBUSY | VM_ALLOC_WIRED | VM_ALLOC_ZERO, ma, TSB_PAGES); VM_OBJECT_WUNLOCK(pm->pm_tsb_obj); + for (i = 0; i < TSB_PAGES; i++) + ma[i]->md.pmap = pm; pmap_qenter((vm_offset_t)pm->pm_tsb, ma, TSB_PAGES); bzero(&pm->pm_stats, sizeof(pm->pm_stats)); Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Wed Aug 9 01:31:05 2017 (r322295) +++ head/sys/vm/vm_glue.c Wed Aug 9 04:23:04 2017 (r322296) @@ -322,7 +322,7 @@ vm_thread_new(struct thread *td, int pages) { vm_object_t ksobj; vm_offset_t ks; - vm_page_t m, ma[KSTACK_MAX_PAGES]; + vm_page_t ma[KSTACK_MAX_PAGES]; struct kstack_cache_entry *ks_ce; int i; @@ -391,15 +391,10 @@ vm_thread_new(struct thread *td, int pages) * page of stack. */ VM_OBJECT_WLOCK(ksobj); - for (i = 0; i < pages; i++) { - /* - * Get a kernel stack page. - */ - m = vm_page_grab(ksobj, i, VM_ALLOC_NOBUSY | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED); - ma[i] = m; - m->valid = VM_PAGE_BITS_ALL; - } + vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | + VM_ALLOC_WIRED, ma, pages); + for (i = 0; i < pages; i++) + ma[i]->valid = VM_PAGE_BITS_ALL; VM_OBJECT_WUNLOCK(ksobj); pmap_qenter(ks, ma, pages); return (1); @@ -573,9 +568,8 @@ vm_thread_swapin(struct thread *td) pages = td->td_kstack_pages; ksobj = td->td_kstack_obj; VM_OBJECT_WLOCK(ksobj); - for (int i = 0; i < pages; i++) - ma[i] = vm_page_grab(ksobj, i, VM_ALLOC_NORMAL | - VM_ALLOC_WIRED); + vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_WIRED, ma, + pages); for (int i = 0; i < pages;) { int j, a, count, rv; Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Aug 9 01:31:05 2017 (r322295) +++ head/sys/vm/vm_page.c Wed Aug 9 04:23:04 2017 (r322296) @@ -3155,6 +3155,100 @@ retrylookup: } /* + * Return the specified range of pages from the given object. For each + * page offset within the range, if a page already exists within the object + * at that offset and it is busy, then wait for it to change state. If, + * instead, the page doesn't exist, then allocate it. + * + * The caller must always specify an allocation class. + * + * allocation classes: + * VM_ALLOC_NORMAL normal process request + * VM_ALLOC_SYSTEM system *really* needs the pages + * + * The caller must always specify that the pages are to be busied and/or + * wired. + * + * optional allocation flags: + * VM_ALLOC_IGN_SBUSY do not sleep on soft busy pages + * VM_ALLOC_NOBUSY do not exclusive busy the page + * VM_ALLOC_SBUSY set page to sbusy state + * VM_ALLOC_WIRED wire the pages + * VM_ALLOC_ZERO zero and validate any invalid pages + * + * This routine may sleep. + */ +void +vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, + vm_page_t *ma, int count) +{ + vm_page_t m; + int i; + bool sleep; + + VM_OBJECT_ASSERT_WLOCKED(object); + KASSERT(((u_int)allocflags >> VM_ALLOC_COUNT_SHIFT) == 0, + ("vm_page_grap_pages: VM_ALLOC_COUNT() is not allowed")); + KASSERT((allocflags & VM_ALLOC_NOBUSY) == 0 || + (allocflags & VM_ALLOC_WIRED) != 0, + ("vm_page_grab_pages: the pages must be busied or wired")); + KASSERT((allocflags & VM_ALLOC_SBUSY) == 0 || + (allocflags & VM_ALLOC_IGN_SBUSY) != 0, + ("vm_page_grab_pages: VM_ALLOC_SBUSY/IGN_SBUSY mismatch")); + if (count == 0) + return; + i = 0; +retrylookup: + m = vm_page_lookup(object, pindex + i); + for (; i < count; i++) { + if (m != NULL) { + sleep = (allocflags & VM_ALLOC_IGN_SBUSY) != 0 ? + vm_page_xbusied(m) : vm_page_busied(m); + if (sleep) { + /* + * Reference the page before unlocking and + * sleeping so that the page daemon is less + * likely to reclaim it. + */ + vm_page_aflag_set(m, PGA_REFERENCED); + vm_page_lock(m); + VM_OBJECT_WUNLOCK(object); + vm_page_busy_sleep(m, "grbmaw", (allocflags & + VM_ALLOC_IGN_SBUSY) != 0); + VM_OBJECT_WLOCK(object); + goto retrylookup; + } + if ((allocflags & VM_ALLOC_WIRED) != 0) { + vm_page_lock(m); + vm_page_wire(m); + vm_page_unlock(m); + } + if ((allocflags & (VM_ALLOC_NOBUSY | + VM_ALLOC_SBUSY)) == 0) + vm_page_xbusy(m); + if ((allocflags & VM_ALLOC_SBUSY) != 0) + vm_page_sbusy(m); + } else { + m = vm_page_alloc(object, pindex + i, (allocflags & + ~VM_ALLOC_IGN_SBUSY) | VM_ALLOC_COUNT(count - i)); + if (m == NULL) { + VM_OBJECT_WUNLOCK(object); + VM_WAIT; + VM_OBJECT_WLOCK(object); + goto retrylookup; + } + } + if (m->valid == 0 && (allocflags & VM_ALLOC_ZERO) != 0) { + if ((m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + m->valid = VM_PAGE_BITS_ALL; + } + ma[i] = m; + m = vm_page_next(m); + } +} + +/* * Mapping function for valid or dirty bits in a page. * * Inputs are required to range within a page. Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Wed Aug 9 01:31:05 2017 (r322295) +++ head/sys/vm/vm_page.h Wed Aug 9 04:23:04 2017 (r322296) @@ -394,6 +394,9 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); * vm_page_alloc_freelist(). Some functions support only a subset * of the flags, and ignore others, see the flags legend. * + * The meaning of VM_ALLOC_ZERO differs slightly between the vm_page_alloc*() + * and the vm_page_grab*() functions. See these functions for details. + * * Bits 0 - 1 define class. * Bits 2 - 15 dedicated for flags. * Legend: @@ -401,6 +404,7 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); * (c) - vm_page_alloc_contig() supports the flag. * (f) - vm_page_alloc_freelist() supports the flag. * (g) - vm_page_grab() supports the flag. + * (p) - vm_page_grab_pages() supports the flag. * Bits above 15 define the count of additional pages that the caller * intends to allocate. */ @@ -408,13 +412,13 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); #define VM_ALLOC_INTERRUPT 1 #define VM_ALLOC_SYSTEM 2 #define VM_ALLOC_CLASS_MASK 3 -#define VM_ALLOC_WIRED 0x0020 /* (acfg) Allocate non pageable page */ -#define VM_ALLOC_ZERO 0x0040 /* (acfg) Try to obtain a zeroed page */ +#define VM_ALLOC_WIRED 0x0020 /* (acfgp) Allocate a wired page */ +#define VM_ALLOC_ZERO 0x0040 /* (acfgp) Allocate a prezeroed page */ #define VM_ALLOC_NOOBJ 0x0100 /* (acg) No associated object */ -#define VM_ALLOC_NOBUSY 0x0200 /* (acg) Do not busy the page */ -#define VM_ALLOC_IGN_SBUSY 0x1000 /* (g) Ignore shared busy flag */ +#define VM_ALLOC_NOBUSY 0x0200 /* (acgp) Do not excl busy the page */ +#define VM_ALLOC_IGN_SBUSY 0x1000 /* (gp) Ignore shared busy flag */ #define VM_ALLOC_NODUMP 0x2000 /* (ag) don't include in dump */ -#define VM_ALLOC_SBUSY 0x4000 /* (acg) Shared busy the page */ +#define VM_ALLOC_SBUSY 0x4000 /* (acgp) Shared busy the page */ #define VM_ALLOC_NOWAIT 0x8000 /* (g) Do not sleep, return NULL */ #define VM_ALLOC_COUNT_SHIFT 16 #define VM_ALLOC_COUNT(count) ((count) << VM_ALLOC_COUNT_SHIFT) @@ -466,6 +470,8 @@ vm_page_t vm_page_alloc_contig(vm_object_t object, vm_ vm_paddr_t boundary, vm_memattr_t memattr); vm_page_t vm_page_alloc_freelist(int, int); vm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int); +void vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, + vm_page_t *ma, int count); int vm_page_try_to_free (vm_page_t); void vm_page_deactivate (vm_page_t); void vm_page_deactivate_noreuse(vm_page_t); From owner-svn-src-all@freebsd.org Wed Aug 9 05:17:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF6EEDC2CBD; Wed, 9 Aug 2017 05:17:22 +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 mx1.freebsd.org (Postfix) with ESMTPS id A8FB230A5; Wed, 9 Aug 2017 05:17:22 +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 v795HLM8011850; Wed, 9 Aug 2017 05:17:21 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v795HLtb011847; Wed, 9 Aug 2017 05:17:21 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708090517.v795HLtb011847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 9 Aug 2017 05:17:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322297 - in head: sbin/fsck_ffs sbin/newfs sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in head: sbin/fsck_ffs sbin/newfs sys/ufs/ffs X-SVN-Commit-Revision: 322297 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 05:17:22 -0000 Author: mckusick Date: Wed Aug 9 05:17:21 2017 New Revision: 322297 URL: https://svnweb.freebsd.org/changeset/base/322297 Log: Since the switch to GPT disk labels, fsck for UFS/FFS has been unable to automatically find alternate superblocks. This checkin places the information needed to find alternate superblocks to the end of the area reserved for the boot block. Filesystems created with a newfs of this vintage or later will create the recovery information. If you have a filesystem created prior to this change and wish to have a recovery block created for your filesystem, you can do so by running fsck in forground mode (i.e., do not use the -p or -y options). As it starts, fsck will ask ``SAVE DATA TO FIND ALTERNATE SUPERBLOCKS'' to which you should answer yes. Discussed with: kib, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11589 Modified: head/sbin/fsck_ffs/setup.c head/sbin/newfs/mkfs.c head/sys/ufs/ffs/fs.h Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Wed Aug 9 04:23:04 2017 (r322296) +++ head/sbin/fsck_ffs/setup.c Wed Aug 9 05:17:21 2017 (r322297) @@ -58,6 +58,10 @@ struct bufarea asblk; #define altsblock (*asblk.b_un.b_fs) #define POWEROF2(num) (((num) & ((num) - 1)) == 0) +static int calcsb(char *dev, int devfd, struct fs *fs); +static void saverecovery(int readfd, int writefd); +static int chkrecovery(int devfd); + /* * Read in a superblock finding an alternate if necessary. * Return 1 if successful, 0 if unsuccessful, -1 if file system @@ -66,9 +70,10 @@ struct bufarea asblk; int setup(char *dev) { - long asked, i, j; + long cg, asked, i, j; long bmapsize; struct stat statb; + struct fs proto; size_t size; havesb = 0; @@ -173,10 +178,28 @@ setup(char *dev) */ if (readsb(1) == 0) { skipclean = 0; - if (bflag || preen) + if (bflag || preen || calcsb(dev, fsreadfd, &proto) == 0) return(0); - /* Looking for alternates is hard punt for now but retain structure */ - return (0); + if (reply("LOOK FOR ALTERNATE SUPERBLOCKS") == 0) + return (0); + for (cg = 0; cg < proto.fs_ncg; cg++) { + bflag = fsbtodb(&proto, cgsblock(&proto, cg)); + if (readsb(0) != 0) + break; + } + if (cg >= proto.fs_ncg) { + printf("%s %s\n%s %s\n%s %s\n", + "SEARCH FOR ALTERNATE SUPER-BLOCK", + "FAILED. YOU MUST USE THE", + "-b OPTION TO FSCK TO SPECIFY THE", + "LOCATION OF AN ALTERNATE", + "SUPER-BLOCK TO SUPPLY NEEDED", + "INFORMATION; SEE fsck_ffs(8)."); + bflag = 0; + return(0); + } + pwarn("USING ALTERNATE SUPERBLOCK AT %jd\n", bflag); + bflag = 0; } if (skipclean && ckclean && sblock.fs_clean) { pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n"); @@ -213,6 +236,10 @@ setup(char *dev) memmove(&altsblock, &sblock, (size_t)sblock.fs_sbsize); flush(fswritefd, &asblk); } + if (preen == 0 && yflag == 0 && sblock.fs_magic == FS_UFS2_MAGIC && + fswritefd != -1 && chkrecovery(fsreadfd) == 0 && + reply("SAVE DATA TO FIND ALTERNATE SUPERBLOCKS") != 0) + saverecovery(fsreadfd, fswritefd); /* * read in the summary info. */ @@ -427,4 +454,74 @@ sblock_init(void) if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL) errx(EEXIT, "cannot allocate space for superblock"); dev_bsize = secsize = DEV_BSIZE; +} + +/* + * Calculate a prototype superblock based on information in the boot area. + * When done the cgsblock macro can be calculated and the fs_ncg field + * can be used. Do NOT attempt to use other macros without verifying that + * their needed information is available! + */ +static int +calcsb(char *dev, int devfd, struct fs *fs) +{ + struct fsrecovery fsr; + + /* + * We need fragments-per-group and the partition-size. + * + * Newfs stores these details at the end of the boot block area + * at the start of the filesystem partition. If they have been + * overwritten by a boot block, we fail. But usually they are + * there and we can use them. + */ + if (blread(devfd, (char *)&fsr, + (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr)) || + fsr.fsr_magic != FS_UFS2_MAGIC) + return (0); + memset(fs, 0, sizeof(struct fs)); + fs->fs_fpg = fsr.fsr_fpg; + fs->fs_fsbtodb = fsr.fsr_fsbtodb; + fs->fs_sblkno = fsr.fsr_sblkno; + fs->fs_magic = fsr.fsr_magic; + fs->fs_ncg = fsr.fsr_ncg; + return (1); +} + +/* + * Check to see if recovery information exists. + */ +static int +chkrecovery(int devfd) +{ + struct fsrecovery fsr; + + if (blread(devfd, (char *)&fsr, + (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr)) || + fsr.fsr_magic != FS_UFS2_MAGIC) + return (0); + return (1); +} + +/* + * Read the last sector of the boot block, replace the last + * 20 bytes with the recovery information, then write it back. + * The recovery information only works for UFS2 filesystems. + */ +static void +saverecovery(int readfd, int writefd) +{ + struct fsrecovery fsr; + + if (sblock.fs_magic != FS_UFS2_MAGIC || + blread(readfd, (char *)&fsr, + (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, sizeof(fsr))) + return; + fsr.fsr_magic = sblock.fs_magic; + fsr.fsr_fpg = sblock.fs_fpg; + fsr.fsr_fsbtodb = sblock.fs_fsbtodb; + fsr.fsr_sblkno = sblock.fs_sblkno; + fsr.fsr_ncg = sblock.fs_ncg; + blwrite(writefd, (char *)&fsr, (SBLOCK_UFS2 - sizeof(fsr)) / dev_bsize, + sizeof(fsr)); } Modified: head/sbin/newfs/mkfs.c ============================================================================== --- head/sbin/newfs/mkfs.c Wed Aug 9 04:23:04 2017 (r322296) +++ head/sbin/newfs/mkfs.c Wed Aug 9 05:17:21 2017 (r322297) @@ -121,6 +121,7 @@ mkfs(struct partition *pp, char *fsys) ino_t maxinum; int minfragsperinode; /* minimum ratio of frags to inodes */ char tmpbuf[100]; /* XXX this will break in about 2,500 years */ + struct fsrecovery fsr; union { struct fs fdummy; char cdummy[SBLOCKSIZE]; @@ -616,6 +617,25 @@ restart: wtfs(fsbtodb(&sblock, sblock.fs_csaddr + numfrags(&sblock, i)), MIN(sblock.fs_cssize - i, sblock.fs_bsize), ((char *)fscs) + i); + /* + * Read the last sector of the boot block, replace the last + * 20 bytes with the recovery information, then write it back. + * The recovery information only works for UFS2 filesystems. + */ + if (sblock.fs_magic == FS_UFS2_MAGIC) { + i = bread(&disk, + part_ofs + (SBLOCK_UFS2 - sizeof(fsr)) / disk.d_bsize, + (char *)&fsr, sizeof(fsr)); + if (i == -1) + err(1, "can't read recovery area: %s", disk.d_error); + fsr.fsr_magic = sblock.fs_magic; + fsr.fsr_fpg = sblock.fs_fpg; + fsr.fsr_fsbtodb = sblock.fs_fsbtodb; + fsr.fsr_sblkno = sblock.fs_sblkno; + fsr.fsr_ncg = sblock.fs_ncg; + wtfs((SBLOCK_UFS2 - sizeof(fsr)) / disk.d_bsize, sizeof(fsr), + (char *)&fsr); + } /* * Update information about this partition in pack * label, to that it may be updated on disk. Modified: head/sys/ufs/ffs/fs.h ============================================================================== --- head/sys/ufs/ffs/fs.h Wed Aug 9 04:23:04 2017 (r322296) +++ head/sys/ufs/ffs/fs.h Wed Aug 9 05:17:21 2017 (r322297) @@ -234,6 +234,20 @@ struct fsck_cmd { }; /* + * A recovery structure placed at the end of the boot block area by newfs + * that can be used by fsck to search for alternate superblocks. + */ +#define RESID (4096 - 20) /* disk sector size minus recovery area size */ +struct fsrecovery { + char block[RESID]; /* unused part of sector */ + int32_t fsr_magic; /* magic number */ + int32_t fsr_fsbtodb; /* fsbtodb and dbtofsb shift constant */ + int32_t fsr_sblkno; /* offset of super-block in filesys */ + int32_t fsr_fpg; /* blocks per group * fs_frag */ + u_int32_t fsr_ncg; /* number of cylinder groups */ +}; + +/* * Per cylinder group information; summarized in blocks allocated * from first cylinder group data blocks. These blocks have to be * read in from fs_csaddr (size fs_cssize) in addition to the From owner-svn-src-all@freebsd.org Wed Aug 9 05:21:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9721ADC3026; Wed, 9 Aug 2017 05:21:58 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61E25355F; Wed, 9 Aug 2017 05:21:58 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v795LvoX015802; Wed, 9 Aug 2017 05:21:57 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v795LvgP015801; Wed, 9 Aug 2017 05:21:57 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201708090521.v795LvgP015801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 9 Aug 2017 05:21:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322298 - head X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 05:21:58 -0000 Author: mckusick Date: Wed Aug 9 05:21:57 2017 New Revision: 322298 URL: https://svnweb.freebsd.org/changeset/base/322298 Log: Add an entry to UPDATING for r322297 which restores the ability of fsck to automatically find alternate superblocks when the standard one is trashed or unavailable. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11589 Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Aug 9 05:17:21 2017 (r322297) +++ head/UPDATING Wed Aug 9 05:21:57 2017 (r322298) @@ -51,6 +51,19 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20170808: + Since the switch to GPT disk labels, fsck for UFS/FFS has been + unable to automatically find alternate superblocks. As of r322297, + the information needed to find alternate superblocks has been + moved to the end of the area reserved for the boot block. + Filesystems created with a newfs of this vintage or later + will create the recovery information. If you have a filesystem + created prior to this change and wish to have a recovery block + created for your filesystem, you can do so by running fsck in + forground mode (i.e., do not use the -p or -y options). As it + starts, fsck will ask ``SAVE DATA TO FIND ALTERNATE SUPERBLOCKS'' + to which you should answer yes. + 20170728: As of r321665, an NFSv4 server configuration that services Kerberos mounts or clients that do not support the uid/gid in From owner-svn-src-all@freebsd.org Wed Aug 9 05:59:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4532DDC3A30; Wed, 9 Aug 2017 05:59:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 00B29635C9; Wed, 9 Aug 2017 05:59:45 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v795xjN9027950; Wed, 9 Aug 2017 05:59:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v795xjbZ027948; Wed, 9 Aug 2017 05:59:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708090559.v795xjbZ027948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 9 Aug 2017 05:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322299 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 322299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 05:59:46 -0000 Author: sephe Date: Wed Aug 9 05:59:45 2017 New Revision: 322299 URL: https://svnweb.freebsd.org/changeset/base/322299 Log: hyperv/hn: Implement transparent mode network VF. How network VF works with hn(4) on Hyper-V in transparent mode: - Each network VF has a cooresponding hn(4). - The network VF and the it's cooresponding hn(4) have the same hardware address. - Once the network VF is attached, the cooresponding hn(4) waits several seconds to make sure that the network VF attach routing completes, then: o Set the intersection of the network VF's if_capabilities and the cooresponding hn(4)'s if_capabilities to the cooresponding hn(4)'s if_capabilities. And adjust the cooresponding hn(4) if_capable and if_hwassist accordingly. (*) o Make sure that the cooresponding hn(4)'s TSO parameters meet the constraints posed by both the network VF and the cooresponding hn(4). (*) o The network VF's if_input is overridden. The overriding if_input changes the input packet's rcvif to the cooreponding hn(4). The network layers are tricked into thinking that all packets are neceived by the cooresponding hn(4). o If the cooresponding hn(4) was brought up, bring up the network VF. The transmission dispatched to the cooresponding hn(4) are redispatched to the network VF. o Bringing down the cooresponding hn(4) also brings down the network VF. o All IOCTLs issued to the cooresponding hn(4) are pass-through'ed to the network VF; the cooresponding hn(4) changes its internal state if necessary. o The media status of the cooresponding hn(4) solely relies on the network VF. o If there are multicast filters on the cooresponding hn(4), allmulti will be enabled on the network VF. (**) - Once the network VF is detached. Undo all damages did to the cooresponding hn(4) in the above item. NOTE: No operation should be issued directly to the network VF, if the network VF transparent mode is enabled. The network VF transparent mode can be enabled by setting tunable hw.hn.vf_transparent to 1. The network VF transparent mode is _not_ enabled by default, as of this commit. The benefit of the network VF transparent mode is that the network VF attachment and detachment are transparent to all network layers; e.g. live migration detaches and reattaches the network VF. The major drawbacks of the network VF transparent mode: - The netmap(4) support is lost, even if the VF supports it. - ALTQ does not work, since if_start method cannot be properly supported. (*) These decisions were made so that things will not be messed up too much during the transition period. (**) This does _not_ need to go through the fancy multicast filter management stuffs like what vlan(4) has, at least currently: - As of this write, multicast does not work in Azure. - As of this write, multicast packets go through the cooresponding hn(4). MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11803 Modified: head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnreg.h head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Aug 9 05:21:57 2017 (r322298) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Aug 9 05:59:45 2017 (r322299) @@ -123,6 +123,8 @@ __FBSDID("$FreeBSD$"); #define HN_VFMAP_SIZE_DEF 8 +#define HN_XPNT_VF_ATTWAIT_MIN 2 /* seconds */ + /* YYY should get it from the underlying channel */ #define HN_TX_DESC_CNT 512 @@ -263,6 +265,7 @@ static void hn_ifnet_event(void *, struct ifnet *, i static void hn_ifaddr_event(void *, struct ifnet *); static void hn_ifnet_attevent(void *, struct ifnet *); static void hn_ifnet_detevent(void *, struct ifnet *); +static void hn_ifnet_lnkevent(void *, struct ifnet *, int); static bool hn_ismyvf(const struct hn_softc *, const struct ifnet *); @@ -270,6 +273,15 @@ static void hn_rxvf_change(struct hn_softc *, struct ifnet *, bool); static void hn_rxvf_set(struct hn_softc *, struct ifnet *); static void hn_rxvf_set_task(void *, int); +static void hn_xpnt_vf_input(struct ifnet *, struct mbuf *); +static int hn_xpnt_vf_iocsetflags(struct hn_softc *); +static int hn_xpnt_vf_iocsetcaps(struct hn_softc *, + struct ifreq *); +static void hn_xpnt_vf_saveifflags(struct hn_softc *); +static bool hn_xpnt_vf_isready(struct hn_softc *); +static void hn_xpnt_vf_setready(struct hn_softc *); +static void hn_xpnt_vf_init_taskfunc(void *, int); +static void hn_xpnt_vf_init(struct hn_softc *); static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); @@ -322,6 +334,8 @@ static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS); static int hn_vflist_sysctl(SYSCTL_HANDLER_ARGS); static int hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_xpnt_vf_accbpf_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_xpnt_vf_enabled_sysctl(SYSCTL_HANDLER_ARGS); static void hn_stop(struct hn_softc *, bool); static void hn_init_locked(struct hn_softc *); @@ -352,6 +366,7 @@ static void hn_disable_rx(struct hn_softc *); static void hn_drain_rxtx(struct hn_softc *, int); static void hn_polling(struct hn_softc *, u_int); static void hn_chan_polling(struct vmbus_channel *, u_int); +static void hn_mtu_change_fixup(struct hn_softc *); static void hn_update_link_status(struct hn_softc *); static void hn_change_network(struct hn_softc *); @@ -529,6 +544,22 @@ SYSCTL_PROC(_hw_hn, OID_AUTO, vflist, CTLFLAG_RD | CTL SYSCTL_PROC(_hw_hn, OID_AUTO, vfmap, CTLFLAG_RD | CTLTYPE_STRING, 0, 0, hn_vfmap_sysctl, "A", "VF mapping"); +/* Transparent VF */ +static int hn_xpnt_vf = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, vf_transparent, CTLFLAG_RDTUN, + &hn_xpnt_vf, 0, "Transparent VF mod"); + +/* Accurate BPF support for Transparent VF */ +static int hn_xpnt_vf_accbpf = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, vf_xpnt_accbpf, CTLFLAG_RDTUN, + &hn_xpnt_vf_accbpf, 0, "Accurate BPF for transparent VF"); + +/* Extra wait for transparent VF attach routing; unit seconds. */ +static int hn_xpnt_vf_attwait = HN_XPNT_VF_ATTWAIT_MIN; +SYSCTL_INT(_hw_hn, OID_AUTO, vf_xpnt_attwait, CTLFLAG_RWTUN, + &hn_xpnt_vf_attwait, 0, + "Extra wait for transparent VF attach routing; unit: seconds"); + static u_int hn_cpu_index; /* next CPU for channel */ static struct taskqueue **hn_tx_taskque;/* shared TX taskqueues */ @@ -807,8 +838,12 @@ hn_rxfilter_config(struct hn_softc *sc) HN_LOCK_ASSERT(sc); - if ((ifp->if_flags & IFF_PROMISC) || - (sc->hn_flags & HN_FLAG_RXVF)) { + /* + * If the non-transparent mode VF is activated, we don't know how + * its RX filter is configured, so stick the synthetic device in + * the promiscous mode. + */ + if ((ifp->if_flags & IFF_PROMISC) || (sc->hn_flags & HN_FLAG_RXVF)) { filter = NDIS_PACKET_TYPE_PROMISCUOUS; } else { filter = NDIS_PACKET_TYPE_DIRECTED; @@ -1086,7 +1121,7 @@ hn_rxvf_change(struct hn_softc *sc, struct ifnet *ifp, } hn_nvs_set_datapath(sc, - rxvf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTHETIC); + rxvf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTH); hn_rxvf_set(sc, rxvf ? ifp : NULL); @@ -1126,7 +1161,323 @@ hn_ifaddr_event(void *arg, struct ifnet *ifp) hn_rxvf_change(arg, ifp, ifp->if_flags & IFF_UP); } +static int +hn_xpnt_vf_iocsetcaps(struct hn_softc *sc, struct ifreq *ifr) +{ + struct ifnet *ifp, *vf_ifp; + uint64_t tmp; + int error; + + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; + vf_ifp = sc->hn_vf_ifp; + + /* + * Fix up requested capabilities w/ supported capabilities, + * since the supported capabilities could have been changed. + */ + ifr->ifr_reqcap &= ifp->if_capabilities; + /* Pass SIOCSIFCAP to VF. */ + error = vf_ifp->if_ioctl(vf_ifp, SIOCSIFCAP, (caddr_t)ifr); + + /* + * NOTE: + * The error will be propagated to the callers, however, it + * is _not_ useful here. + */ + + /* + * Merge VF's enabled capabilities. + */ + ifp->if_capenable = vf_ifp->if_capenable & ifp->if_capabilities; + + tmp = vf_ifp->if_hwassist & HN_CSUM_IP_HWASSIST(sc); + if (ifp->if_capenable & IFCAP_TXCSUM) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + tmp = vf_ifp->if_hwassist & HN_CSUM_IP6_HWASSIST(sc); + if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + tmp = vf_ifp->if_hwassist & CSUM_IP_TSO; + if (ifp->if_capenable & IFCAP_TSO4) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + tmp = vf_ifp->if_hwassist & CSUM_IP6_TSO; + if (ifp->if_capenable & IFCAP_TSO6) + ifp->if_hwassist |= tmp; + else + ifp->if_hwassist &= ~tmp; + + return (error); +} + +static int +hn_xpnt_vf_iocsetflags(struct hn_softc *sc) +{ + struct ifnet *vf_ifp; + struct ifreq ifr; + + HN_LOCK_ASSERT(sc); + vf_ifp = sc->hn_vf_ifp; + + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, vf_ifp->if_xname, sizeof(ifr.ifr_name)); + ifr.ifr_flags = vf_ifp->if_flags & 0xffff; + ifr.ifr_flagshigh = vf_ifp->if_flags >> 16; + return (vf_ifp->if_ioctl(vf_ifp, SIOCSIFFLAGS, (caddr_t)&ifr)); +} + static void +hn_xpnt_vf_saveifflags(struct hn_softc *sc) +{ + struct ifnet *ifp = sc->hn_ifp; + int allmulti = 0; + + HN_LOCK_ASSERT(sc); + + /* XXX vlan(4) style mcast addr maintenance */ + if (!TAILQ_EMPTY(&ifp->if_multiaddrs)) + allmulti = IFF_ALLMULTI; + + /* Always set the VF's if_flags */ + sc->hn_vf_ifp->if_flags = ifp->if_flags | allmulti; +} + +static void +hn_xpnt_vf_input(struct ifnet *vf_ifp, struct mbuf *m) +{ + struct rm_priotracker pt; + struct ifnet *hn_ifp = NULL; + struct mbuf *mn; + + /* + * XXX racy, if hn(4) ever detached. + */ + rm_rlock(&hn_vfmap_lock, &pt); + if (vf_ifp->if_index < hn_vfmap_size) + hn_ifp = hn_vfmap[vf_ifp->if_index]; + rm_runlock(&hn_vfmap_lock, &pt); + + if (hn_ifp != NULL) { + /* + * Fix up rcvif and go through hn(4)'s if_input and + * increase ipackets. + */ + for (mn = m; mn != NULL; mn = mn->m_nextpkt) { + /* Allow tapping on the VF. */ + ETHER_BPF_MTAP(vf_ifp, mn); + mn->m_pkthdr.rcvif = hn_ifp; + if_inc_counter(hn_ifp, IFCOUNTER_IPACKETS, 1); + } + hn_ifp->if_input(hn_ifp, m); + } else { + /* + * In the middle of the transition; free this + * mbuf chain. + */ + while (m != NULL) { + mn = m->m_nextpkt; + m->m_nextpkt = NULL; + m_freem(m); + m = mn; + } + } +} + +static void +hn_mtu_change_fixup(struct hn_softc *sc) +{ + struct ifnet *ifp; + + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; + + hn_set_tso_maxsize(sc, hn_tso_maxlen, ifp->if_mtu); +#if __FreeBSD_version >= 1100099 + if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < HN_LRO_LENLIM_MIN(ifp)) + hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); +#endif +} + +static void +hn_xpnt_vf_setready(struct hn_softc *sc) +{ + struct ifnet *ifp, *vf_ifp; + struct ifreq ifr; + + HN_LOCK_ASSERT(sc); + ifp = sc->hn_ifp; + vf_ifp = sc->hn_vf_ifp; + + /* + * Mark the VF ready. + */ + sc->hn_vf_rdytick = 0; + + /* + * Save information for restoration. + */ + sc->hn_saved_caps = ifp->if_capabilities; + sc->hn_saved_tsomax = ifp->if_hw_tsomax; + sc->hn_saved_tsosegcnt = ifp->if_hw_tsomaxsegcount; + sc->hn_saved_tsosegsz = ifp->if_hw_tsomaxsegsize; + + /* + * Intersect supported/enabled capabilities. + * + * NOTE: + * if_hwassist is not changed here. + */ + ifp->if_capabilities &= vf_ifp->if_capabilities; + ifp->if_capenable &= ifp->if_capabilities; + + /* + * Fix TSO settings. + */ + if (ifp->if_hw_tsomax > vf_ifp->if_hw_tsomax) + ifp->if_hw_tsomax = vf_ifp->if_hw_tsomax; + if (ifp->if_hw_tsomaxsegcount > vf_ifp->if_hw_tsomaxsegcount) + ifp->if_hw_tsomaxsegcount = vf_ifp->if_hw_tsomaxsegcount; + if (ifp->if_hw_tsomaxsegsize > vf_ifp->if_hw_tsomaxsegsize) + ifp->if_hw_tsomaxsegsize = vf_ifp->if_hw_tsomaxsegsize; + + /* + * Change VF's enabled capabilities. + */ + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, vf_ifp->if_xname, sizeof(ifr.ifr_name)); + ifr.ifr_reqcap = ifp->if_capenable; + hn_xpnt_vf_iocsetcaps(sc, &ifr); + + if (ifp->if_mtu != ETHERMTU) { + int error; + + /* + * Change VF's MTU. + */ + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, vf_ifp->if_xname, sizeof(ifr.ifr_name)); + ifr.ifr_mtu = ifp->if_mtu; + error = vf_ifp->if_ioctl(vf_ifp, SIOCSIFMTU, (caddr_t)&ifr); + if (error) { + if_printf(ifp, "%s SIOCSIFMTU %u failed\n", + vf_ifp->if_xname, ifp->if_mtu); + if (ifp->if_mtu > ETHERMTU) { + if_printf(ifp, "change MTU to %d\n", ETHERMTU); + + /* + * XXX + * No need to adjust the synthetic parts' MTU; + * failure of the adjustment will cause us + * infinite headache. + */ + ifp->if_mtu = ETHERMTU; + hn_mtu_change_fixup(sc); + } + } + } +} + +static bool +hn_xpnt_vf_isready(struct hn_softc *sc) +{ + + HN_LOCK_ASSERT(sc); + + if (!hn_xpnt_vf || sc->hn_vf_ifp == NULL) + return (false); + + if (sc->hn_vf_rdytick == 0) + return (true); + + if (sc->hn_vf_rdytick > ticks) + return (false); + + /* Mark VF as ready. */ + hn_xpnt_vf_setready(sc); + return (true); +} + +static void +hn_xpnt_vf_init(struct hn_softc *sc) +{ + int error; + + HN_LOCK_ASSERT(sc); + + KASSERT((sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) == 0, + ("%s: transparent VF was enabled", sc->hn_ifp->if_xname)); + + if (bootverbose) { + if_printf(sc->hn_ifp, "try bringing up %s\n", + sc->hn_vf_ifp->if_xname); + } + + /* + * Bring the VF up. + */ + hn_xpnt_vf_saveifflags(sc); + sc->hn_vf_ifp->if_flags |= IFF_UP; + error = hn_xpnt_vf_iocsetflags(sc); + if (error) { + if_printf(sc->hn_ifp, "bringing up %s failed: %d\n", + sc->hn_vf_ifp->if_xname, error); + return; + } + + /* + * NOTE: + * Datapath setting must happen _after_ bringing the VF up. + */ + hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_VF); + + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(&sc->hn_vf_lock); + sc->hn_xvf_flags |= HN_XVFFLAG_ENABLED; + rm_wunlock(&sc->hn_vf_lock); +} + +static void +hn_xpnt_vf_init_taskfunc(void *xsc, int pending __unused) +{ + struct hn_softc *sc = xsc; + + HN_LOCK(sc); + + if ((sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) == 0) + goto done; + if (sc->hn_vf_ifp == NULL) + goto done; + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + goto done; + + if (sc->hn_vf_rdytick != 0) { + /* Mark VF as ready. */ + hn_xpnt_vf_setready(sc); + } + + if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) { + /* + * Delayed VF initialization. + */ + if (bootverbose) { + if_printf(sc->hn_ifp, "delayed initialize %s\n", + sc->hn_vf_ifp->if_xname); + } + hn_xpnt_vf_init(sc); + } +done: + HN_UNLOCK(sc); +} + +static void hn_ifnet_attevent(void *xsc, struct ifnet *ifp) { struct hn_softc *sc = xsc; @@ -1145,6 +1496,16 @@ hn_ifnet_attevent(void *xsc, struct ifnet *ifp) goto done; } + if (hn_xpnt_vf && ifp->if_start != NULL) { + /* + * ifnet.if_start is _not_ supported by transparent + * mode VF; mainly due to the IFF_DRV_OACTIVE flag. + */ + if_printf(sc->hn_ifp, "%s uses if_start, which is unsupported " + "in transparent VF mode.\n", ifp->if_xname); + goto done; + } + rm_wlock(&hn_vfmap_lock); if (ifp->if_index >= hn_vfmap_size) { @@ -1168,7 +1529,37 @@ hn_ifnet_attevent(void *xsc, struct ifnet *ifp) rm_wunlock(&hn_vfmap_lock); + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(&sc->hn_vf_lock); + KASSERT((sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) == 0, + ("%s: transparent VF was enabled", sc->hn_ifp->if_xname)); sc->hn_vf_ifp = ifp; + rm_wunlock(&sc->hn_vf_lock); + + if (hn_xpnt_vf) { + int wait_ticks; + + /* + * Install if_input for vf_ifp, which does vf_ifp -> hn_ifp. + * Save vf_ifp's current if_input for later restoration. + */ + sc->hn_vf_input = ifp->if_input; + ifp->if_input = hn_xpnt_vf_input; + + /* + * Stop link status management; use the VF's. + */ + hn_suspend_mgmt(sc); + + /* + * Give VF sometime to complete its attach routing. + */ + wait_ticks = hn_xpnt_vf_attwait * hz; + sc->hn_vf_rdytick = ticks + wait_ticks; + + taskqueue_enqueue_timeout(sc->hn_vf_taskq, &sc->hn_vf_init, + wait_ticks); + } done: HN_UNLOCK(sc); } @@ -1186,7 +1577,61 @@ hn_ifnet_detevent(void *xsc, struct ifnet *ifp) if (!hn_ismyvf(sc, ifp)) goto done; + if (hn_xpnt_vf) { + /* + * Make sure that the delayed initialization is not running. + * + * NOTE: + * - This lock _must_ be released, since the hn_vf_init task + * will try holding this lock. + * - It is safe to release this lock here, since the + * hn_ifnet_attevent() is interlocked by the hn_vf_ifp. + * + * XXX racy, if hn(4) ever detached. + */ + HN_UNLOCK(sc); + taskqueue_drain_timeout(sc->hn_vf_taskq, &sc->hn_vf_init); + HN_LOCK(sc); + + KASSERT(sc->hn_vf_input != NULL, ("%s VF input is not saved", + sc->hn_ifp->if_xname)); + ifp->if_input = sc->hn_vf_input; + sc->hn_vf_input = NULL; + + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_SYNTH); + + if (sc->hn_vf_rdytick == 0) { + /* + * The VF was ready; restore some settings. + */ + sc->hn_ifp->if_capabilities = sc->hn_saved_caps; + /* + * NOTE: + * There is _no_ need to fixup if_capenable and + * if_hwassist, since the if_capabilities before + * restoration was an intersection of the VF's + * if_capabilites and the synthetic device's + * if_capabilites. + */ + sc->hn_ifp->if_hw_tsomax = sc->hn_saved_tsomax; + sc->hn_ifp->if_hw_tsomaxsegcount = + sc->hn_saved_tsosegcnt; + sc->hn_ifp->if_hw_tsomaxsegsize = sc->hn_saved_tsosegsz; + } + + /* + * Resume link status management, which was suspended + * by hn_ifnet_attevent(). + */ + hn_resume_mgmt(sc); + } + + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(&sc->hn_vf_lock); + sc->hn_xvf_flags &= ~HN_XVFFLAG_ENABLED; sc->hn_vf_ifp = NULL; + rm_wunlock(&sc->hn_vf_lock); rm_wlock(&hn_vfmap_lock); @@ -1205,6 +1650,15 @@ done: HN_UNLOCK(sc); } +static void +hn_ifnet_lnkevent(void *xsc, struct ifnet *ifp, int link_state) +{ + struct hn_softc *sc = xsc; + + if (sc->hn_vf_ifp == ifp) + if_link_state_change(sc->hn_ifp, link_state); +} + /* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ static const struct hyperv_guid g_net_vsc_device_type = { .hv_guid = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, @@ -1236,6 +1690,9 @@ hn_attach(device_t dev) sc->hn_dev = dev; sc->hn_prichan = vmbus_get_channel(dev); HN_LOCK_INIT(sc); + rm_init(&sc->hn_vf_lock, "hnvf"); + if (hn_xpnt_vf && hn_xpnt_vf_accbpf) + sc->hn_xvf_flags |= HN_XVFFLAG_ACCBPF; /* * Initialize these tunables once. @@ -1275,6 +1732,18 @@ hn_attach(device_t dev) TIMEOUT_TASK_INIT(sc->hn_mgmt_taskq0, &sc->hn_netchg_status, 0, hn_netchg_status_taskfunc, sc); + if (hn_xpnt_vf) { + /* + * Setup taskqueue for VF tasks, e.g. delayed VF bringing up. + */ + sc->hn_vf_taskq = taskqueue_create("hn_vf", M_WAITOK, + taskqueue_thread_enqueue, &sc->hn_vf_taskq); + taskqueue_start_threads(&sc->hn_vf_taskq, 1, PI_NET, "%s vf", + device_get_nameunit(dev)); + TIMEOUT_TASK_INIT(sc->hn_vf_taskq, &sc->hn_vf_init, 0, + hn_xpnt_vf_init_taskfunc, sc); + } + /* * Allocate ifnet and setup its name earlier, so that if_printf * can be used by functions, which will be called after @@ -1401,6 +1870,14 @@ hn_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "hwassist", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_hwassist_sysctl, "A", "hwassist"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tso_max", + CTLFLAG_RD, &ifp->if_hw_tsomax, 0, "max TSO size"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tso_maxsegcnt", + CTLFLAG_RD, &ifp->if_hw_tsomaxsegcount, 0, + "max # of TSO segments"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tso_maxsegsz", + CTLFLAG_RD, &ifp->if_hw_tsomaxsegsize, 0, + "max size of TSO segment"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxfilter", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_rxfilter_sysctl, "A", "rxfilter"); @@ -1445,9 +1922,20 @@ hn_attach(device_t dev) SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, hn_vf_sysctl, "A", "Virtual Function's name"); - SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxvf", - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, - hn_rxvf_sysctl, "A", "activated Virtual Function's name"); + if (!hn_xpnt_vf) { + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxvf", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_rxvf_sysctl, "A", "activated Virtual Function's name"); + } else { + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf_xpnt_enabled", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_xpnt_vf_enabled_sysctl, "I", + "Transparent VF enabled"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf_xpnt_accbpf", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + hn_xpnt_vf_accbpf_sysctl, "I", + "Accurate BPF for transparent VF"); + } /* * Setup the ifmedia, which has been initialized earlier. @@ -1480,7 +1968,7 @@ hn_attach(device_t dev) ifp->if_qflush = hn_xmit_qflush; } - ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_LRO; + ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_LRO | IFCAP_LINKSTATE; #ifdef foo /* We can't diff IPv6 packets from IPv4 packets on RX path. */ ifp->if_capabilities |= IFCAP_RXCSUM_IPV6; @@ -1515,7 +2003,13 @@ hn_attach(device_t dev) ifp->if_hwassist &= ~(HN_CSUM_IP6_MASK | CSUM_IP6_TSO); if (ifp->if_capabilities & (IFCAP_TSO6 | IFCAP_TSO4)) { + /* + * Lock hn_set_tso_maxsize() to simplify its + * internal logic. + */ + HN_LOCK(sc); hn_set_tso_maxsize(sc, hn_tso_maxlen, ETHERMTU); + HN_UNLOCK(sc); ifp->if_hw_tsomaxsegcount = HN_TX_DATA_SEGCNT_MAX; ifp->if_hw_tsomaxsegsize = PAGE_SIZE; } @@ -1536,10 +2030,15 @@ hn_attach(device_t dev) sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0; hn_update_link_status(sc); - sc->hn_ifnet_evthand = EVENTHANDLER_REGISTER(ifnet_event, - hn_ifnet_event, sc, EVENTHANDLER_PRI_ANY); - sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, - hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + if (!hn_xpnt_vf) { + sc->hn_ifnet_evthand = EVENTHANDLER_REGISTER(ifnet_event, + hn_ifnet_event, sc, EVENTHANDLER_PRI_ANY); + sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, + hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + } else { + sc->hn_ifnet_lnkhand = EVENTHANDLER_REGISTER(ifnet_link_event, + hn_ifnet_lnkevent, sc, EVENTHANDLER_PRI_ANY); + } /* * NOTE: @@ -1566,6 +2065,14 @@ hn_detach(device_t dev) struct hn_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->hn_ifp, *vf_ifp; + if (sc->hn_xact != NULL && vmbus_chan_is_revoked(sc->hn_prichan)) { + /* + * In case that the vmbus missed the orphan handler + * installation. + */ + vmbus_xact_ctx_orphan(sc->hn_xact); + } + if (sc->hn_ifaddr_evthand != NULL) EVENTHANDLER_DEREGISTER(ifaddr_event, sc->hn_ifaddr_evthand); if (sc->hn_ifnet_evthand != NULL) @@ -1578,20 +2085,14 @@ hn_detach(device_t dev) EVENTHANDLER_DEREGISTER(ifnet_departure_event, sc->hn_ifnet_dethand); } + if (sc->hn_ifnet_lnkhand != NULL) + EVENTHANDLER_DEREGISTER(ifnet_link_event, sc->hn_ifnet_lnkhand); vf_ifp = sc->hn_vf_ifp; __compiler_membar(); if (vf_ifp != NULL) hn_ifnet_detevent(sc, vf_ifp); - if (sc->hn_xact != NULL && vmbus_chan_is_revoked(sc->hn_prichan)) { - /* - * In case that the vmbus missed the orphan handler - * installation. - */ - vmbus_xact_ctx_orphan(sc->hn_xact); - } - if (device_is_attached(dev)) { HN_LOCK(sc); if (sc->hn_flags & HN_FLAG_SYNTH_ATTACHED) { @@ -1621,6 +2122,8 @@ hn_detach(device_t dev) free(sc->hn_tx_taskqs, M_DEVBUF); } taskqueue_free(sc->hn_mgmt_taskq0); + if (sc->hn_vf_taskq != NULL) + taskqueue_free(sc->hn_vf_taskq); if (sc->hn_xact != NULL) { /* @@ -1634,6 +2137,7 @@ hn_detach(device_t dev) if_free(ifp); HN_LOCK_DESTROY(sc); + rm_destroy(&sc->hn_vf_lock); return (0); } @@ -2699,7 +3203,8 @@ static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct hn_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; + struct ifreq *ifr = (struct ifreq *)data, ifr_vf; + struct ifnet *vf_ifp; int mask, error = 0; switch (cmd) { @@ -2728,6 +3233,21 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } + if (hn_xpnt_vf_isready(sc)) { + vf_ifp = sc->hn_vf_ifp; + ifr_vf = *ifr; + strlcpy(ifr_vf.ifr_name, vf_ifp->if_xname, + sizeof(ifr_vf.ifr_name)); + error = vf_ifp->if_ioctl(vf_ifp, SIOCSIFMTU, + (caddr_t)&ifr_vf); + if (error) { + HN_UNLOCK(sc); + if_printf(ifp, "%s SIOCSIFMTU %d failed: %d\n", + vf_ifp->if_xname, ifr->ifr_mtu, error); + break; + } + } + /* * Suspend this interface before the synthetic parts * are ripped. @@ -2756,23 +3276,32 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifp->if_mtu = ifr->ifr_mtu; /* - * Make sure that various parameters based on MTU are - * still valid, after the MTU change. + * Synthetic parts' reattach may change the chimney + * sending size; update it. */ if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax) hn_set_chim_size(sc, sc->hn_chim_szmax); - hn_set_tso_maxsize(sc, hn_tso_maxlen, ifp->if_mtu); -#if __FreeBSD_version >= 1100099 - if (sc->hn_rx_ring[0].hn_lro.lro_length_lim < - HN_LRO_LENLIM_MIN(ifp)) - hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp)); -#endif /* + * Make sure that various parameters based on MTU are + * still valid, after the MTU change. + */ + hn_mtu_change_fixup(sc); + + /* * All done! Resume the interface now. */ hn_resume(sc); + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) { + /* + * Since we have reattached the NVS part, + * change the datapath to VF again; in case + * that it is lost, after the NVS was detached. + */ + hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_VF); + } + HN_UNLOCK(sc); break; @@ -2784,6 +3313,9 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } + if (hn_xpnt_vf_isready(sc)) + hn_xpnt_vf_saveifflags(sc); + if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* @@ -2794,6 +3326,9 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) HN_NO_SLEEPING(sc); hn_rxfilter_config(sc); HN_SLEEPING_OK(sc); + + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + error = hn_xpnt_vf_iocsetflags(sc); } else { hn_init_locked(sc); } @@ -2808,8 +3343,23 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSIFCAP: HN_LOCK(sc); - mask = ifr->ifr_reqcap ^ ifp->if_capenable; + if (hn_xpnt_vf_isready(sc)) { + ifr_vf = *ifr; + strlcpy(ifr_vf.ifr_name, sc->hn_vf_ifp->if_xname, + sizeof(ifr_vf.ifr_name)); + error = hn_xpnt_vf_iocsetcaps(sc, &ifr_vf); + HN_UNLOCK(sc); + break; + } + + /* + * Fix up requested capabilities w/ supported capabilities, + * since the supported capabilities could have been changed. + */ + mask = (ifr->ifr_reqcap & ifp->if_capabilities) ^ + ifp->if_capenable; + if (mask & IFCAP_TXCSUM) { ifp->if_capenable ^= IFCAP_TXCSUM; if (ifp->if_capenable & IFCAP_TXCSUM) @@ -2873,11 +3423,42 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) HN_SLEEPING_OK(sc); } + /* XXX vlan(4) style mcast addr maintenance */ + if (hn_xpnt_vf_isready(sc)) { + int old_if_flags; + + old_if_flags = sc->hn_vf_ifp->if_flags; + hn_xpnt_vf_saveifflags(sc); + + if ((sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) && + ((old_if_flags ^ sc->hn_vf_ifp->if_flags) & + IFF_ALLMULTI)) + error = hn_xpnt_vf_iocsetflags(sc); + } + HN_UNLOCK(sc); break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: + HN_LOCK(sc); + if (hn_xpnt_vf_isready(sc)) { + /* + * SIOCGIFMEDIA expects ifmediareq, so don't + * create and pass ifr_vf to the VF here; just + * replace the ifr_name. + */ + vf_ifp = sc->hn_vf_ifp; + strlcpy(ifr->ifr_name, vf_ifp->if_xname, + sizeof(ifr->ifr_name)); + error = vf_ifp->if_ioctl(vf_ifp, cmd, data); + /* Restore the ifr_name. */ + strlcpy(ifr->ifr_name, ifp->if_xname, + sizeof(ifr->ifr_name)); + HN_UNLOCK(sc); + break; + } + HN_UNLOCK(sc); error = ifmedia_ioctl(ifp, ifr, &sc->hn_media, cmd); break; @@ -2899,11 +3480,37 @@ hn_stop(struct hn_softc *sc, bool detaching) KASSERT(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED, ("synthetic parts were not attached")); + /* Clear RUNNING bit ASAP. */ + atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); + /* Disable polling. */ hn_polling(sc, 0); - /* Clear RUNNING bit _before_ hn_suspend_data() */ - atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) { + KASSERT(sc->hn_vf_ifp != NULL, + ("%s: VF is not attached", ifp->if_xname)); + + /* NOTE: hn_vf_lock for hn_transmit() */ + rm_wlock(&sc->hn_vf_lock); + sc->hn_xvf_flags &= ~HN_XVFFLAG_ENABLED; + rm_wunlock(&sc->hn_vf_lock); + + /* + * NOTE: + * Datapath setting must happen _before_ bringing + * the VF down. + */ + hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_SYNTH); + + /* + * Bring the VF down. + */ + hn_xpnt_vf_saveifflags(sc); + sc->hn_vf_ifp->if_flags &= ~IFF_UP; + hn_xpnt_vf_iocsetflags(sc); + } + + /* Suspend data transfers. */ hn_suspend_data(sc); /* Clear OACTIVE bit. */ @@ -2912,8 +3519,8 @@ hn_stop(struct hn_softc *sc, bool detaching) sc->hn_tx_ring[i].hn_oactive = 0; /* - * If the VF is active, make sure the filter is not 0, even if - * the synthetic NIC is down. + * If the non-transparent mode VF is active, make sure + * that the RX filter still allows packet reception. */ if (!detaching && (sc->hn_flags & HN_FLAG_RXVF)) hn_rxfilter_config(sc); @@ -2944,6 +3551,11 @@ hn_init_locked(struct hn_softc *sc) /* Clear TX 'suspended' bit. */ hn_resume_tx(sc, sc->hn_tx_ring_inuse); + if (hn_xpnt_vf_isready(sc)) { + /* Initialize transparent VF. */ + hn_xpnt_vf_init(sc); + } + /* Everything is ready; unleash! */ atomic_set_int(&ifp->if_drv_flags, IFF_DRV_RUNNING); @@ -3567,6 +4179,42 @@ hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS) } static int +hn_xpnt_vf_accbpf_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + int error, onoff = 0; + + if (sc->hn_xvf_flags & HN_XVFFLAG_ACCBPF) + onoff = 1; + error = sysctl_handle_int(oidp, &onoff, 0, req); + if (error || req->newptr == NULL) + return (error); + + HN_LOCK(sc); + /* NOTE: hn_vf_lock for hn_transmit() */ + rm_wlock(&sc->hn_vf_lock); + if (onoff) + sc->hn_xvf_flags |= HN_XVFFLAG_ACCBPF; + else + sc->hn_xvf_flags &= ~HN_XVFFLAG_ACCBPF; + rm_wunlock(&sc->hn_vf_lock); + HN_UNLOCK(sc); + + return (0); +} + +static int +hn_xpnt_vf_enabled_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + int enabled = 0; + + if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) + enabled = 1; + return (sysctl_handle_int(oidp, &enabled, 0, req)); +} + +static int hn_check_iplen(const struct mbuf *m, int hoff) { const struct ip *ip; @@ -4282,8 +4930,11 @@ static void hn_set_tso_maxsize(struct hn_softc *sc, int tso_maxlen, int mtu) { struct ifnet *ifp = sc->hn_ifp; + u_int hw_tsomax; int tso_minlen; + HN_LOCK_ASSERT(sc); + if ((ifp->if_capabilities & (IFCAP_TSO4 | IFCAP_TSO6)) == 0) return; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Aug 9 07:05:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C69EDC4C25; Wed, 9 Aug 2017 07:05:30 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 2A99765100; Wed, 9 Aug 2017 07:05:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 9DDA7D6709B; Wed, 9 Aug 2017 17:05:16 +1000 (AEST) Date: Wed, 9 Aug 2017 17:05:09 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alan Somers cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322258 - head/sys/kern In-Reply-To: <201708081614.v78GEVGY066448@repo.freebsd.org> Message-ID: <20170809141608.I1096@besplex.bde.org> References: <201708081614.v78GEVGY066448@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=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=oIpZr1xkWgYFOLge9vcA:9 a=ryAa0PDDeZGzOGob:21 a=tOHjCrgPa2CUQTTv:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 07:05:30 -0000 On Tue, 8 Aug 2017, Alan Somers wrote: > Log: > Make p1003_1b.aio_listio_max a tunable > > p1003_1b.aio_listio_max is now a tunable. Its value is reflected in the > sysctl of the same name, and the sysconf(3) variable _SC_AIO_LISTIO_MAX. > Its value will be bounded from below by the compile-time constant > AIO_LISTIO_MAX and from above by the compile-time constant > MAX_AIO_QUEUE_PER_PROC and the tunable vfs.aio.max_aio_queue. I don't like tunables or sysctls being limited or silently limiting them. This is not done for more important sysctls like kern.maxfilesperproc. Lots of silent runtime limiting is done for a few more important limits like kern.maxfilesperproc. The limiting is also buggy: - vfs.aio.max_aio_queue isn't a tunable as stated. It is a r/w sysctl - if vfs.aio.max_aio_queue were a r/o tunable, then there would be a solvable ordering problem initializing it before using it - since vfs.aio.max_aio_queue is only a sysctl, it is unusable at boot time (and module load time), but it is used there. Other bugs in vfs.aio.max_aio_queue: - its name is too long, yet not very descriptive - its name repeats "aio" - its name but doesn't say "len", so it looks like it limits a number of queues and not the length of a single queue. This is backwards relative to the corresponding variable name. That is missing "aio" when it is needed, but only spells "length" badly as "count". It is max_queue_count, but should be something like aio_max_qlen. All sysctl variables should have an aio_ prefix which is removed in the leaf name in the sysctl tree. Other names have similar or worse bugs. Bugs start with parameter names MAX_AIO_* instead of AIO_*_MAX, and variable names track this. There is some ambiguity from global vs per-process limits and counts, and the noise word "num" is sprinkled to get names which differ without describing any difference. > Modified: head/sys/kern/vfs_aio.c > ============================================================================== > --- head/sys/kern/vfs_aio.c Tue Aug 8 16:06:16 2017 (r322257) > +++ head/sys/kern/vfs_aio.c Tue Aug 8 16:14:31 2017 (r322258) > @@ -102,6 +102,7 @@ static uint64_t jobseqno; > #endif > > FEATURE(aio, "Asynchronous I/O"); > +SYSCTL_DECL(_p1003_1b); > > static MALLOC_DEFINE(M_LIO, "lio", "listio aio control block list"); > > @@ -168,6 +169,11 @@ static int max_buf_aio = MAX_BUF_AIO; > SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0, > "Maximum buf aio requests per process (stored in the process)"); > > +static int aio_listio_max = AIO_LISTIO_MAX; > +SYSCTL_INT(_p1003_1b, CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max, > + CTLFLAG_RDTUN | CTLFLAG_CAPRD, &aio_listio_max, 0, > + "Maximum aio requests for a single lio_listio call"); > + The POSIX namespace is missing all of the bugs described above. It has aio first (except, for historical reasons it unfortunately has p10031b instead of vfs.aio for the sysctl prefix), and max last. > #ifdef COMPAT_FREEBSD6 > typedef struct oaiocb { > int aio_fildes; /* File descriptor */ > @@ -388,6 +394,11 @@ static int > aio_onceonly(void) > { > > + if (aio_listio_max < AIO_LISTIO_MAX) > + aio_listio_max = AIO_LISTIO_MAX; > + if (aio_listio_max > MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count)) > + aio_listio_max = MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count); > + max_queue_count is not initialized here, except to a default at compile time. Except for module (re)load, it always has the default value MAX_AIO_QUEUE = 1024 (this 1024 is bogusly ifdefed. MAX_AIO_QUEUE is not defined in any header file and is not a supported option, and the tunable makes the option less needed than before). MAX_AIO_QUEUE_PER_PROC = 256, modulo a similar unsupported option. Thus MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count) is an obfuscated spelling of 256. MAX_AIO_QUEUE_PER_PROC is also just the default for a variable (max_aio_queue_per_proc), so using it here has the same bugs except for the obfuscation. Using MIN() instead of imin() is a style bug. OTOH, AIO_LISTIO_MAX is defined (as 16) in a header file, and is not bogusly ifdefed. It is 1 of 3 aio limits specified by POSIX. The checking would be buggy if it were done later, since max_queue_count is not checked and limiting to it can corrupt aio_listio_max (when it is negative or just too small). The compile-time definition of AIO_LISTIO_MAX seems to be broken. I think POSIX species that AIO_LISTIO_MAX shall not be defined if the value of {AIO_LISTIO_MAX} varies at runtime, but it is still defined. FreeBSD has this bug for many other sysconf() variables, e.g., {OPEN_MAX}. Perhaps AIO_LISTIO_MAX is easier to fix since it is not hard-coded as often as OPEN_MAX. AIO_LISTIO_MAX is now just the FreeBSD default, but the first check in the above restricts {AIO_LISTIO_MAX} to this default (16) instead of to the POSIX limit of _POSIX_IO_LISTIO_MAX (2). Relaxing this check would cause more problems with hard-coded AIO_LISTIO_MAX. If the second check in the above were done at runtime so that it worked for changed max_queue_count, then it would reduce aio_listio_max below the POSIX limit of 2 slightly before it reduces to garbage zero and negative values. The first check should be large, or if you want to give a preference for >= the old limit of 16 and a hard limit of the POSIX limit of 2, check keep checking the old limit first and the POSIX limit last. > exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL, > EVENTHANDLER_PRI_ANY); > exec_tag = EVENTHANDLER_REGISTER(process_exec, aio_proc_rundown_exec, > @@ -405,14 +416,13 @@ aio_onceonly(void) > NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); > aiocb_zone = uma_zcreate("AIOCB", sizeof(struct kaiocb), NULL, NULL, > NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); > - aiol_zone = uma_zcreate("AIOL", AIO_LISTIO_MAX*sizeof(intptr_t) , NULL, > - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); > + aiol_zone = uma_zcreate("AIOL", aio_listio_max * sizeof(intptr_t) , > + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); Allocations like this are hard to adjust later (I forget if the size limit is hard or soft, but it should be hard). The user must be allowed to set aio_listio_max to value larger than the default, so as to prepare for expansion of the other limits later. However, this doesn't work, since it leaves the other limits inconsistent until they are expanded. It seems best to adjust all the other limits based on the aio_listio_max tunable. Usually this is not set. Use the old parameters then, but remove all the macros and compile-time initializers for them. Do onceonly initialization like if (aio_listio_max == 16) { max_queue_count = 1024; /* historical MAX_AIO_QUEUE */ ... } When aio_listio_max != 16, calculate the parameters somehow. I don't know how to do this. At least make them consistent. After initialization, the other parameters are still restricted by the choice for aio_listio_max. Leave it to the user to not choose bad combinations. The aio sysctls seem to already break many of the POSIX sysctls. E.g., MAX_AIO_QUEUE is used as the default for the r/w sysctl vfs.aio.max_aio_queue and as the value for the sysctl r/o sysctl p1003_1b.aio_max. Any change to the first sysctl breaks the second sysctl. The 3 POSIX (2001) aio sysctls thus have quite different invariance bugs: - {AIO_MAX}: AIO_MAX is correctly not defined. {AIO_MAX} is variable by a low-level sysctl but the p1003 sysctl used to report {AIO_MAX} doesn't see the change. - {AIO_PRIO_DELTA_MAX}: no low-level sysctl or variable to break it (value is always 0) - {AIO_LISTIO_MAX}: was constant until this commit. There is not low-level sysctl for it, and the low-level variable for it is correctly exported, but AIO_LISTIO_MAX was incorrectly defined so it is hard to change now. {AIO_LISTIO_MAX} is inconsistent with the macro whenever the tunable is used to change its default. Bruce From owner-svn-src-all@freebsd.org Wed Aug 9 07:24:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8CFDDC5369; Wed, 9 Aug 2017 07:24:59 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 A0E0B65B97; Wed, 9 Aug 2017 07:24:59 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v797OwCl064446; Wed, 9 Aug 2017 07:24:58 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v797OwJb064445; Wed, 9 Aug 2017 07:24:58 GMT (envelope-from des@FreeBSD.org) Message-Id: <201708090724.v797OwJb064445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Wed, 9 Aug 2017 07:24:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322300 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: des X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 322300 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 07:25:00 -0000 Author: des Date: Wed Aug 9 07:24:58 2017 New Revision: 322300 URL: https://svnweb.freebsd.org/changeset/base/322300 Log: Correct sysctl names. Modified: head/sys/netinet/in.h Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Wed Aug 9 05:59:45 2017 (r322299) +++ head/sys/netinet/in.h Wed Aug 9 07:24:58 2017 (r322300) @@ -289,7 +289,7 @@ __END_DECLS * if you trust the remote host to restrict these ports. * * The default range of ports and the high range can be changed by - * sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto) + * sysctl(3). (net.inet.ip.portrange.{hi,low,}{first,last}) * * Changing those values has bad security implications if you are * using a stateless firewall that is allowing packets outside of that From owner-svn-src-all@freebsd.org Wed Aug 9 08:44:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24966DC6D7D; Wed, 9 Aug 2017 08:44:23 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id C7FB36858C; Wed, 9 Aug 2017 08:44:22 +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 mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 6A3EB3CCF6C; Wed, 9 Aug 2017 18:44:19 +1000 (AEST) Date: Wed, 9 Aug 2017 18:44:19 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Emmanuel Vadot cc: Bruce Evans , Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322252 - head/usr.bin/vmstat In-Reply-To: <20170808161507.2d185d394dc921eac6729d89@bidouilliste.com> Message-ID: <20170809171526.B1567@besplex.bde.org> References: <201708081218.v78CIBvL068413@repo.freebsd.org> <20170808225104.I3528@besplex.bde.org> <20170808161507.2d185d394dc921eac6729d89@bidouilliste.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=LI0WeNe9 c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=Q9sN3FMeAAAA:8 a=3W0Di7-B9xzAe2TjPFYA:9 a=4JXGKAPf0pKDMlew:21 a=AfNcCDu4C7j3jd7Y:21 a=CjuIK1q_8ugA:10 a=mnDzqiP7QBHErLppGYsC:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 08:44:23 -0000 On Tue, 8 Aug 2017, Emmanuel Vadot wrote: > On Tue, 8 Aug 2017 23:55:52 +1000 (EST) > Bruce Evans wrote: > >> On Tue, 8 Aug 2017, Emmanuel Vadot wrote: >> >>> Log: >>> vmstat: Always emit a space after the free-memory column >>> >>> When displaying in non-human form, if the free-memory number >>> is large (more than 7 digits), there is no space between it and >>> the page fault column. >>> >>> PR: 221290 >>> Submitted by: Josuah Demangeon (Original version) >>> >>> Modified: >>> head/usr.bin/vmstat/vmstat.c >>> >>> Modified: head/usr.bin/vmstat/vmstat.c >>> ============================================================================== >>> --- head/usr.bin/vmstat/vmstat.c Tue Aug 8 11:49:36 2017 (r322251) >>> +++ head/usr.bin/vmstat/vmstat.c Tue Aug 8 12:18:11 2017 (r322252) >>> @@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps) >>> xo_emit(" "); >>> xo_emit("{:free-memory/%7d}", >>> vmstat_pgtok(total.t_free)); >>> + xo_emit(" "); >>> } >>> xo_emit("{:total-page-faults/%5lu} ", >>> (unsigned long)rate(sum.v_vm_faults - >> >> This seems to break the formatting. There was a negative amount of space >> available for expansion, and since the header was not expanded to match >> its alignment with the fields is more random than before. With -h, the >> width was 80 columns, giving ugly line wrap on 80-column terminals with >> auto-wrap. Now it is 81 columns, giving uglier line wrap on all 80- >> column terminals. > > This break nothing, This was the case before too (with or without > -h), just tested in tmux with force-width 80. Testing shows that it breaks the -H case as expected. (I had misread the change as affecting the -h case too.) Before: X procs memory page disks faults cpu X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id X 0 0 0 12719376 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 Misformatting in the data line starts with the avm field taking 8 of the 7 columns reserved for it. This and all subsequent fields are misaligned with the header. The header is pre-misformatted to width 85, with lots of inconsistencies in the first line. Old versions were carefully formatted to width 79, with no inconsistencies in the first line. The extra width for avm makes the extra width for the header not even work to line up. X procs memory page disks faults cpu X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id X 0 0 0 12719380 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 The new bugs are that the extra space before the "flt" field increases the off-by-1 error to off-by-2 for this field and all subsequent fields. All fields starting with "flt" now have an error of at least off-by-1 even if none are too wide, since the header was not expanded to match. Expansion would increase its breakage from 6 to wide to 7 too wide. >> The bugs were mostly in the first line of the header: >> - the second line of the header was correct for vmstat -h >> - for vmstat without -h, the second line of the header was apparently broken >> by a change like the one here, that added a space after the "r b w" fields >> without adding one in the "r b w" header >> - most of the fields in the first line of the header are misaligned with the >> second lone. Many have drifted 3 to the left of where the were in a sort >> of center-justified place. Some of these might have actually been >> intended to be left justified, but had an off by +1 error. Now these >> have an error of off by -2 relative to left justifications. >> >> Only the "memory" header in the first line is better than in old versions. >> It is now left justified. Left justifying all headers in the first line >> is probably best. I couldn't find a good way to delimit the right hand >> side of the extents of the headers in the first line. The second line of >> the headers already uses right justification consistently and this works >> well. > > I think that all this might be true but you might talk about the whole > libxo conversion that was done, not my commit right ? I try not to look at libxo, since its misformattings are enormous starting in the source code. My columnize.awk script works almost perfectly to fix the above misformattings: X BEGIN { X columns = 79 # XXX X } X X { X # Determine fields and field widths for current line. X # awk's field splitting feature turned out to be inadequate, X # and this would be even easier in C. X n = split($0, a, "") X f = 1 X j = 1 X while (j <= n) { X cpw[f] = 0 X cfw[f] = 0 X while (j <= n && a[j] == " ") { X cpw[f]++ # current (left) padding width X j++ X } X if (j > n) X break X while (j <= n && a[j] != " ") { X cfw[f]++ # current field width without padding X j++ X } X fld[f] = substr($0, j - cfw[f], cfw[f]) X if (f != 1) { X cpw[f]-- X cfw[f]++ # current field width with min padding X } X f++ X } X nf = f - 1 # no need to use or trust NF X X if (NR == 1 || NR < 3 && nf != anf) { X # Make current field widths (with full padding) the maximum X # ones. When NR > 1, this discards the previous maximums. X # Good enough for vmstat, where the widths from NR == 1 are X # garbage. X # X # Make current field widths (with minimal padding) the minimum X # ones. X anf = nf X for (f = 1; f <= anf; f++) { X Mfw[f] = cpw[f] + cfw[f] X mfw[f] = cfw[f] X } X } else if (nf < anf) { X # Some non-tabular line after warming up. Probably an ornate X # line in the next header. Too hard to handle properly. X printf("%.*s oops\n", columns - 5, $0) X fflush(stdout) X next X } else if (nf > anf) { X # Some non-tabular line after warming up. Hopefully just X # a single trailing field with inadequate field separators X # like the COMMAND field in ps and top. Append the extras X # to the last field with minimal separators. X for (f = anf + 1; f <= nf; f++) X fld[anf] = fld[anf] " " fld[f] X nf = anf X cfw[nf] = 1 + length(fld[nf]) X } X X # Update the maximum and minimum field widths if this line needs X # wider fields. X len = 0 X for (f = 1; f <= nf; f++) { X if (Mfw[f] < cfw[f]) X Mfw[f] = cfw[f] X len += Mfw[f] X if (mfw[f] < cfw[f]) X mfw[f] = cfw[f] X } X X # If the line would be too wide, reduce the maximum field widths X # minimally towards minimum ones. X while (len > columns) { X for (f = 1; f <= nf; f++) { X if (Mfw[f] > mfw[f]) { X Mfw[f]-- X len-- X break X } X } X if (f > nf) X break X } X X s = "" X for (f = 1; f <= nf - 1; f++) X s = s sprintf("%*s", Mfw[f], fld[f]) X s = s sprintf(" %-*s", Mfw[nf] - 1, fld[nf]) X printf("%.*s\n", columns, s) X fflush(stdout) X } When applied to the above saved output (old then new, quoted by X's), it produces: X procs memory page disks faults cpu X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id X 0 0 0 12719376 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 X procs memory page disks faults oops X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id X 0 0 0 12719380 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 It removed enough spaces to fit in 79 columns even with the X's. It can't handle the first line of the header very well since this line has an ornate format whose columns don't match the rest of the output in any simple way (programs should produce more parseable formats, like ps does). All that that it did for the first line was move "cpu" to a less worse place in the old output and change it to "oops" in the new output. Even programs like ps and df that attempt to do the necessary dynamic formatting often produce worse results than the above script. df on freefall now produces a mess lots of spaces giving long lines even with -h, I think because the mountpoint names are very long and df has hard- coded formats for everything else. columnize.awk only manages to almost clean this up for the -h case. It has a problem that it is stream-based and doesn't backtrack to adjust early lines. This is necessary for use in filters. vmstat 1 | awk -f columize.awk is a good example of using columize.awk in a filter. This use also requires it to understand headers not in the first few lines of output. This is not easy, and in practice it gets confused by the first line of the vmstat header unless it is the first line of the output. This is why it printed "oops" in the abov concatenated output. The first header line just has an unusual number of fields so cannot be handled right. When it is the first line in the output, it is printed verbatim except possibly for removing spaces, since it gives the only available information on the expected columnar output. Bruce From owner-svn-src-all@freebsd.org Wed Aug 9 08:57:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05898DC7298; Wed, 9 Aug 2017 08:57:02 +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 mx1.freebsd.org (Postfix) with ESMTPS id C5CA968C89; Wed, 9 Aug 2017 08:57:01 +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 v798v017002424; Wed, 9 Aug 2017 08:57:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v798v0oG002422; Wed, 9 Aug 2017 08:57:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708090857.v798v0oG002422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 9 Aug 2017 08:57:00 +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: r322301 - in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 322301 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 08:57:02 -0000 Author: kib Date: Wed Aug 9 08:57:00 2017 New Revision: 322301 URL: https://svnweb.freebsd.org/changeset/base/322301 Log: MFC r321919: Do not call trapsignal() after handling usermode fault or interrupt, when a signal is not intended to be sent. Modified: stable/11/sys/amd64/amd64/trap.c stable/11/sys/i386/i386/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Wed Aug 9 07:24:58 2017 (r322300) +++ stable/11/sys/amd64/amd64/trap.c Wed Aug 9 08:57:00 2017 (r322301) @@ -370,7 +370,7 @@ trap(struct trapframe *frame) #ifdef DEV_ISA case T_NMI: nmi_handle_intr(type, frame); - break; + goto out; #endif /* DEV_ISA */ case T_OFLOW: /* integer overflow fault */ @@ -408,7 +408,7 @@ trap(struct trapframe *frame) if (dtrace_return_probe_ptr != NULL && dtrace_return_probe_ptr(®s) == 0) goto out; - break; + goto userout; #endif } } else { Modified: stable/11/sys/i386/i386/trap.c ============================================================================== --- stable/11/sys/i386/i386/trap.c Wed Aug 9 07:24:58 2017 (r322300) +++ stable/11/sys/i386/i386/trap.c Wed Aug 9 08:57:00 2017 (r322301) @@ -455,7 +455,7 @@ user_trctrap_out: goto userout; #else /* !POWERFAIL_NMI */ nmi_handle_intr(type, frame); - break; + goto out; #endif /* POWERFAIL_NMI */ #endif /* DEV_ISA */ @@ -499,7 +499,7 @@ user_trctrap_out: if (dtrace_return_probe_ptr != NULL && dtrace_return_probe_ptr(®s) == 0) goto out; - break; + goto userout; #endif } } else { From owner-svn-src-all@freebsd.org Wed Aug 9 09:13:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4594DDC7A9D; Wed, 9 Aug 2017 09:13:17 +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 mx1.freebsd.org (Postfix) with ESMTPS id 135A769BD3; Wed, 9 Aug 2017 09:13:17 +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 v799DGZ9011216; Wed, 9 Aug 2017 09:13:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v799DGiv011215; Wed, 9 Aug 2017 09:13:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708090913.v799DGiv011215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 9 Aug 2017 09:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322302 - head/sys/cam/ctl X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam/ctl X-SVN-Commit-Revision: 322302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 09:13:17 -0000 Author: mav Date: Wed Aug 9 09:13:15 2017 New Revision: 322302 URL: https://svnweb.freebsd.org/changeset/base/322302 Log: Do not loose CCB flags after r320493. There is at least CAM_UNLOCKED that should be kept. MFC after: 3 days Modified: head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Wed Aug 9 08:57:00 2017 (r322301) +++ head/sys/cam/ctl/scsi_ctl.c Wed Aug 9 09:13:15 2017 (r322302) @@ -1003,7 +1003,8 @@ ctlfe_requeue_ccb(struct cam_periph *periph, union ccb * target/lun. Reset the target and LUN fields back to the wildcard * values before we send them back down to the SIM. */ - xpt_setup_ccb(&ccb->ccb_h, periph->path, CAM_PRIORITY_NONE); + xpt_setup_ccb_flags(&ccb->ccb_h, periph->path, CAM_PRIORITY_NONE, + ccb->ccb_h.flags); xpt_action(ccb); } From owner-svn-src-all@freebsd.org Wed Aug 9 09:16:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48DD0DC7BD0; Wed, 9 Aug 2017 09:16: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 mx1.freebsd.org (Postfix) with ESMTPS id 158CF69F02; Wed, 9 Aug 2017 09:16: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 v799GH8i011653; Wed, 9 Aug 2017 09:16:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v799GHPG011651; Wed, 9 Aug 2017 09:16:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708090916.v799GHPG011651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 9 Aug 2017 09:16:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322303 - in stable/10/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/10/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 322303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 09:16:18 -0000 Author: kib Date: Wed Aug 9 09:16:16 2017 New Revision: 322303 URL: https://svnweb.freebsd.org/changeset/base/322303 Log: MFC r321919: Do not call trapsignal() after handling usermode fault or interrupt, when a signal is not intended to be sent. Modified: stable/10/sys/amd64/amd64/trap.c stable/10/sys/i386/i386/trap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/trap.c ============================================================================== --- stable/10/sys/amd64/amd64/trap.c Wed Aug 9 09:13:15 2017 (r322302) +++ stable/10/sys/amd64/amd64/trap.c Wed Aug 9 09:16:16 2017 (r322303) @@ -396,7 +396,7 @@ trap(struct trapframe *frame) goto userout; } else if (panic_on_nmi) panic("NMI indicates hardware failure"); - break; + goto out; #endif /* DEV_ISA */ case T_OFLOW: /* integer overflow fault */ @@ -434,7 +434,7 @@ trap(struct trapframe *frame) if (dtrace_return_probe_ptr != NULL && dtrace_return_probe_ptr(®s) == 0) goto out; - break; + goto userout; #endif } } else { Modified: stable/10/sys/i386/i386/trap.c ============================================================================== --- stable/10/sys/i386/i386/trap.c Wed Aug 9 09:13:15 2017 (r322302) +++ stable/10/sys/i386/i386/trap.c Wed Aug 9 09:16:16 2017 (r322303) @@ -469,7 +469,7 @@ trap(struct trapframe *frame) goto userout; } else if (panic_on_nmi) panic("NMI indicates hardware failure"); - break; + goto out; #endif /* POWERFAIL_NMI */ #endif /* DEV_ISA */ @@ -519,7 +519,7 @@ trap(struct trapframe *frame) if (dtrace_return_probe_ptr != NULL && dtrace_return_probe_ptr(®s) == 0) goto out; - break; + goto userout; #endif } } else { From owner-svn-src-all@freebsd.org Wed Aug 9 09:40:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D426DC81CB; Wed, 9 Aug 2017 09:40:52 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 62D796AC6D; Wed, 9 Aug 2017 09:40:50 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 622c0cbf; Wed, 9 Aug 2017 11:40:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=YHlYNx1ueOQ1mJD02d0Dw2TKYKQ=; b=kD0Uz7hXb5dY/sojLfBufpJwbjW8 bWszu/vcA9QwgqEqj7DDL+kEFnjv8IvLC9DPLoX5DQkCeACKeyR7XxJvcYpRs6qj pR96z7PxUpW1t/wp2rR3zlaZSgebVINSsim8U3KU+QjC/JUQI9OlU/ZnQOUiwxKj FR72iA/4KeRPHc8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=MKR1o5mjiBJ13SopBz044PfeZTniB86PKJPU0zND2ZFg96j1lQg93vqk 7FthG1dNpH05XoWeWzslAI4REgSo5ezChoQPtSL6cyjQVgWWoyKnjBZi8MvNtUzJ S1EyPSAeLySguhm1J/ptEX8ArIki8o7tH7msqQ0XmGe/9oBlHWA= Received: from arcadia (evadot.gandi.net [217.70.181.36]) by mail.blih.net (OpenSMTPD) with ESMTPSA id d970e6e3 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Wed, 9 Aug 2017 11:40:46 +0200 (CEST) Date: Wed, 9 Aug 2017 11:40:46 +0200 From: Emmanuel Vadot To: Bruce Evans Cc: Emmanuel Vadot , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322252 - head/usr.bin/vmstat Message-Id: <20170809114046.6e55bb881d98d19f8b88ddc2@bidouilliste.com> In-Reply-To: <20170809171526.B1567@besplex.bde.org> References: <201708081218.v78CIBvL068413@repo.freebsd.org> <20170808225104.I3528@besplex.bde.org> <20170808161507.2d185d394dc921eac6729d89@bidouilliste.com> <20170809171526.B1567@besplex.bde.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 09:40:52 -0000 On Wed, 9 Aug 2017 18:44:19 +1000 (EST) Bruce Evans wrote: > On Tue, 8 Aug 2017, Emmanuel Vadot wrote: > > > On Tue, 8 Aug 2017 23:55:52 +1000 (EST) > > Bruce Evans wrote: > > > >> On Tue, 8 Aug 2017, Emmanuel Vadot wrote: > >> > >>> Log: > >>> vmstat: Always emit a space after the free-memory column > >>> > >>> When displaying in non-human form, if the free-memory number > >>> is large (more than 7 digits), there is no space between it and > >>> the page fault column. > >>> > >>> PR: 221290 > >>> Submitted by: Josuah Demangeon (Original version) > >>> > >>> Modified: > >>> head/usr.bin/vmstat/vmstat.c > >>> > >>> Modified: head/usr.bin/vmstat/vmstat.c > >>> ============================================================================== > >>> --- head/usr.bin/vmstat/vmstat.c Tue Aug 8 11:49:36 2017 (r322251) > >>> +++ head/usr.bin/vmstat/vmstat.c Tue Aug 8 12:18:11 2017 (r322252) > >>> @@ -832,6 +832,7 @@ dovmstat(unsigned int interval, int reps) > >>> xo_emit(" "); > >>> xo_emit("{:free-memory/%7d}", > >>> vmstat_pgtok(total.t_free)); > >>> + xo_emit(" "); > >>> } > >>> xo_emit("{:total-page-faults/%5lu} ", > >>> (unsigned long)rate(sum.v_vm_faults - > >> > >> This seems to break the formatting. There was a negative amount of space > >> available for expansion, and since the header was not expanded to match > >> its alignment with the fields is more random than before. With -h, the > >> width was 80 columns, giving ugly line wrap on 80-column terminals with > >> auto-wrap. Now it is 81 columns, giving uglier line wrap on all 80- > >> column terminals. > > > > This break nothing, This was the case before too (with or without > > -h), just tested in tmux with force-width 80. > > Testing shows that it breaks the -H case as expected. (I had misread the > change as affecting the -h case too.) > > Before: > > X procs memory page disks faults cpu > X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id > X 0 0 0 12719376 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 > > Misformatting in the data line starts with the avm field taking 8 of the 7 > columns reserved for it. This and all subsequent fields are misaligned with > the header. > > The header is pre-misformatted to width 85, with lots of inconsistencies in > the first line. Old versions were carefully formatted to width 79, with no > inconsistencies in the first line. The extra width for avm makes the extra > width for the header not even work to line up. > > X procs memory page disks faults cpu > X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id > X 0 0 0 12719380 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 > > The new bugs are that the extra space before the "flt" field increases the > off-by-1 error to off-by-2 for this field and all subsequent fields. All > fields starting with "flt" now have an error of at least off-by-1 even > if none are too wide, since the header was not expanded to match. Expansion > would increase its breakage from 6 to wide to 7 too wide. Thanks, I know see the problem. I'll see if this could be corrected easily with libxo ... > >> The bugs were mostly in the first line of the header: > >> - the second line of the header was correct for vmstat -h > >> - for vmstat without -h, the second line of the header was apparently broken > >> by a change like the one here, that added a space after the "r b w" fields > >> without adding one in the "r b w" header > >> - most of the fields in the first line of the header are misaligned with the > >> second lone. Many have drifted 3 to the left of where the were in a sort > >> of center-justified place. Some of these might have actually been > >> intended to be left justified, but had an off by +1 error. Now these > >> have an error of off by -2 relative to left justifications. > >> > >> Only the "memory" header in the first line is better than in old versions. > >> It is now left justified. Left justifying all headers in the first line > >> is probably best. I couldn't find a good way to delimit the right hand > >> side of the extents of the headers in the first line. The second line of > >> the headers already uses right justification consistently and this works > >> well. > > > > I think that all this might be true but you might talk about the whole > > libxo conversion that was done, not my commit right ? > > I try not to look at libxo, since its misformattings are enormous starting > in the source code. > > My columnize.awk script works almost perfectly to fix the above > misformattings: > > X BEGIN { > X columns = 79 # XXX > X } > X > X { > X # Determine fields and field widths for current line. > X # awk's field splitting feature turned out to be inadequate, > X # and this would be even easier in C. > X n = split($0, a, "") > X f = 1 > X j = 1 > X while (j <= n) { > X cpw[f] = 0 > X cfw[f] = 0 > X while (j <= n && a[j] == " ") { > X cpw[f]++ # current (left) padding width > X j++ > X } > X if (j > n) > X break > X while (j <= n && a[j] != " ") { > X cfw[f]++ # current field width without padding > X j++ > X } > X fld[f] = substr($0, j - cfw[f], cfw[f]) > X if (f != 1) { > X cpw[f]-- > X cfw[f]++ # current field width with min padding > X } > X f++ > X } > X nf = f - 1 # no need to use or trust NF > X > X if (NR == 1 || NR < 3 && nf != anf) { > X # Make current field widths (with full padding) the maximum > X # ones. When NR > 1, this discards the previous maximums. > X # Good enough for vmstat, where the widths from NR == 1 are > X # garbage. > X # > X # Make current field widths (with minimal padding) the minimum > X # ones. > X anf = nf > X for (f = 1; f <= anf; f++) { > X Mfw[f] = cpw[f] + cfw[f] > X mfw[f] = cfw[f] > X } > X } else if (nf < anf) { > X # Some non-tabular line after warming up. Probably an ornate > X # line in the next header. Too hard to handle properly. > X printf("%.*s oops\n", columns - 5, $0) > X fflush(stdout) > X next > X } else if (nf > anf) { > X # Some non-tabular line after warming up. Hopefully just > X # a single trailing field with inadequate field separators > X # like the COMMAND field in ps and top. Append the extras > X # to the last field with minimal separators. > X for (f = anf + 1; f <= nf; f++) > X fld[anf] = fld[anf] " " fld[f] > X nf = anf > X cfw[nf] = 1 + length(fld[nf]) > X } > X > X # Update the maximum and minimum field widths if this line needs > X # wider fields. > X len = 0 > X for (f = 1; f <= nf; f++) { > X if (Mfw[f] < cfw[f]) > X Mfw[f] = cfw[f] > X len += Mfw[f] > X if (mfw[f] < cfw[f]) > X mfw[f] = cfw[f] > X } > X > X # If the line would be too wide, reduce the maximum field widths > X # minimally towards minimum ones. > X while (len > columns) { > X for (f = 1; f <= nf; f++) { > X if (Mfw[f] > mfw[f]) { > X Mfw[f]-- > X len-- > X break > X } > X } > X if (f > nf) > X break > X } > X > X s = "" > X for (f = 1; f <= nf - 1; f++) > X s = s sprintf("%*s", Mfw[f], fld[f]) > X s = s sprintf(" %-*s", Mfw[nf] - 1, fld[nf]) > X printf("%.*s\n", columns, s) > X fflush(stdout) > X } > > When applied to the above saved output (old then new, quoted by X's), it > produces: > > X procs memory page disks faults cpu > X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id > X 0 0 0 12719376 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 > X procs memory page disks faults oops > X r b w avm fre flt re pi po fr sr ad0 ad1 in sy cs us sy id > X 0 0 0 12719380 977460 2167 3 28 0 2545 451 0 0 268 27162 7175 9 1 91 > > It removed enough spaces to fit in 79 columns even with the X's. It can't > handle the first line of the header very well since this line has an ornate > format whose columns don't match the rest of the output in any simple way > (programs should produce more parseable formats, like ps does). All that > that it did for the first line was move "cpu" to a less worse place in the > old output and change it to "oops" in the new output. > > Even programs like ps and df that attempt to do the necessary dynamic > formatting often produce worse results than the above script. df on > freefall now produces a mess lots of spaces giving long lines even with > -h, I think because the mountpoint names are very long and df has hard- > coded formats for everything else. columnize.awk only manages to almost > clean this up for the -h case. It has a problem that it is stream-based > and doesn't backtrack to adjust early lines. This is necessary for use > in filters. > > vmstat 1 | awk -f columize.awk is a good example of using columize.awk > in a filter. This use also requires it to understand headers not in > the first few lines of output. This is not easy, and in practice it > gets confused by the first line of the vmstat header unless it is the > first line of the output. This is why it printed "oops" in the > abov concatenated output. The first header line just has an unusual > number of fields so cannot be handled right. When it is the first > line in the output, it is printed verbatim except possibly for removing > spaces, since it gives the only available information on the expected > columnar output. > > Bruce -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Wed Aug 9 10:27:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B023DC8CD6; Wed, 9 Aug 2017 10:27:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52AF66BE6F; Wed, 9 Aug 2017 10:27:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79ARLrb040212; Wed, 9 Aug 2017 10:27:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79ARLwv040211; Wed, 9 Aug 2017 10:27:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708091027.v79ARLwv040211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 9 Aug 2017 10:27:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322304 - head/sys/dev/mlx4/mlx4_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_en X-SVN-Commit-Revision: 322304 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 10:27:22 -0000 Author: hselasky Date: Wed Aug 9 10:27:21 2017 New Revision: 322304 URL: https://svnweb.freebsd.org/changeset/base/322304 Log: Add support for RX and TX statistics when the mlx4en(4) PCI device is in VF or SRIOV mode typically in a virtual machine environment. Submitted by: Sepherosa Ziehau MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c Wed Aug 9 09:16:16 2017 (r322303) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c Wed Aug 9 10:27:21 2017 (r322304) @@ -124,11 +124,45 @@ out: return err; } +static void mlx4_en_fold_software_stats(struct net_device *dev) +{ + struct mlx4_en_priv *priv = netdev_priv(dev); + struct mlx4_en_dev *mdev = priv->mdev; + u64 packets, bytes; + int i; + + if (!priv->port_up || mlx4_is_master(mdev->dev)) + return; + + packets = 0; + bytes = 0; + for (i = 0; i < priv->rx_ring_num; i++) { + const struct mlx4_en_rx_ring *ring = priv->rx_ring[i]; + + packets += READ_ONCE(ring->packets); + bytes += READ_ONCE(ring->bytes); + } + priv->pkstats.rx_packets = packets; + priv->pkstats.rx_bytes = bytes; + + packets = 0; + bytes = 0; + for (i = 0; i < priv->tx_ring_num; i++) { + const struct mlx4_en_tx_ring *ring = priv->tx_ring[i]; + + packets += READ_ONCE(ring->packets); + bytes += READ_ONCE(ring->bytes); + } + priv->pkstats.tx_packets = packets; + priv->pkstats.tx_bytes = bytes; +} + int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) { struct mlx4_en_stat_out_mbox *mlx4_en_stats; struct mlx4_en_stat_out_flow_control_mbox *flowstats; - struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]); + struct net_device *dev = mdev->pndev[port]; + struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_vport_stats *vport_stats = &priv->vport_stats; struct mlx4_cmd_mailbox *mailbox = NULL; struct mlx4_cmd_mailbox *mailbox_flow = NULL; @@ -138,7 +172,6 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u int do_if_stat = 1; unsigned long period = (unsigned long) (jiffies - priv->last_ifq_jiffies); struct mlx4_en_vport_stats tmp_vport_stats; - struct net_device *dev; if (jiffies_to_msecs(period) < EN_IFQ_MIN_INTERVAL || priv->counter_index == 0xff) @@ -528,8 +561,12 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u be64_to_cpu(flowstats[i].tx_pause_transition); } - memset(&tmp_vport_stats, 0, sizeof(tmp_vport_stats)); + mlx4_en_fold_software_stats(dev); + spin_unlock(&priv->stats_lock); + + memset(&tmp_vport_stats, 0, sizeof(tmp_vport_stats)); + err = mlx4_get_vport_ethtool_stats(mdev->dev, port, &tmp_vport_stats, reset); spin_lock(&priv->stats_lock); @@ -552,42 +589,37 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u vport_stats->tx_errors = tmp_vport_stats.tx_errors; } - if (!mlx4_is_mfunc(mdev->dev)) { -/* netdevice stats format */ #if __FreeBSD_version >= 1100000 - if (reset == 0) { - dev = mdev->pndev[port]; - if_inc_counter(dev, IFCOUNTER_IPACKETS, - priv->pkstats.rx_packets - priv->pkstats_last.rx_packets); - if_inc_counter(dev, IFCOUNTER_OPACKETS, - priv->pkstats.tx_packets - priv->pkstats_last.tx_packets); - if_inc_counter(dev, IFCOUNTER_IBYTES, - priv->pkstats.rx_bytes - priv->pkstats_last.rx_bytes); - if_inc_counter(dev, IFCOUNTER_OBYTES, - priv->pkstats.tx_bytes - priv->pkstats_last.tx_bytes); - if_inc_counter(dev, IFCOUNTER_IERRORS, - priv->pkstats.rx_errors - priv->pkstats_last.rx_errors); - if_inc_counter(dev, IFCOUNTER_IQDROPS, - priv->pkstats.rx_dropped - priv->pkstats_last.rx_dropped); - if_inc_counter(dev, IFCOUNTER_IMCASTS, - priv->pkstats.rx_multicast_packets - priv->pkstats_last.rx_multicast_packets); - if_inc_counter(dev, IFCOUNTER_OMCASTS, - priv->pkstats.tx_multicast_packets - priv->pkstats_last.tx_multicast_packets); - } - priv->pkstats_last = priv->pkstats; + if (reset == 0) { + if_inc_counter(dev, IFCOUNTER_IPACKETS, + priv->pkstats.rx_packets - priv->pkstats_last.rx_packets); + if_inc_counter(dev, IFCOUNTER_OPACKETS, + priv->pkstats.tx_packets - priv->pkstats_last.tx_packets); + if_inc_counter(dev, IFCOUNTER_IBYTES, + priv->pkstats.rx_bytes - priv->pkstats_last.rx_bytes); + if_inc_counter(dev, IFCOUNTER_OBYTES, + priv->pkstats.tx_bytes - priv->pkstats_last.tx_bytes); + if_inc_counter(dev, IFCOUNTER_IERRORS, + priv->pkstats.rx_errors - priv->pkstats_last.rx_errors); + if_inc_counter(dev, IFCOUNTER_IQDROPS, + priv->pkstats.rx_dropped - priv->pkstats_last.rx_dropped); + if_inc_counter(dev, IFCOUNTER_IMCASTS, + priv->pkstats.rx_multicast_packets - priv->pkstats_last.rx_multicast_packets); + if_inc_counter(dev, IFCOUNTER_OMCASTS, + priv->pkstats.tx_multicast_packets - priv->pkstats_last.tx_multicast_packets); + } + priv->pkstats_last = priv->pkstats; #else - dev = mdev->pndev[port]; - dev->if_ipackets = priv->pkstats.rx_packets; - dev->if_opackets = priv->pkstats.tx_packets; - dev->if_ibytes = priv->pkstats.rx_bytes; - dev->if_obytes = priv->pkstats.tx_bytes; - dev->if_ierrors = priv->pkstats.rx_errors; - dev->if_iqdrops = priv->pkstats.rx_dropped; - dev->if_imcasts = priv->pkstats.rx_multicast_packets; - dev->if_omcasts = priv->pkstats.tx_multicast_packets; - dev->if_collisions = 0; + dev->if_ipackets = priv->pkstats.rx_packets; + dev->if_opackets = priv->pkstats.tx_packets; + dev->if_ibytes = priv->pkstats.rx_bytes; + dev->if_obytes = priv->pkstats.tx_bytes; + dev->if_ierrors = priv->pkstats.rx_errors; + dev->if_iqdrops = priv->pkstats.rx_dropped; + dev->if_imcasts = priv->pkstats.rx_multicast_packets; + dev->if_omcasts = priv->pkstats.tx_multicast_packets; + dev->if_collisions = 0; #endif - } spin_unlock(&priv->stats_lock); From owner-svn-src-all@freebsd.org Wed Aug 9 10:30:57 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A1E4DC8F2C; Wed, 9 Aug 2017 10:30:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 099716C1B8; Wed, 9 Aug 2017 10:30:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79AUu0B040528; Wed, 9 Aug 2017 10:30:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79AUuPi040511; Wed, 9 Aug 2017 10:30:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708091030.v79AUuPi040511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 9 Aug 2017 10:30:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322305 - head/sys/dev/mlx4/mlx4_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_en X-SVN-Commit-Revision: 322305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 10:30:57 -0000 Author: hselasky Date: Wed Aug 9 10:30:55 2017 New Revision: 322305 URL: https://svnweb.freebsd.org/changeset/base/322305 Log: Increment queue drops in the network statistics when transmitted packets are dropped by the mlx4en(4) driver. Submitted by: Sepherosa Ziehau MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Wed Aug 9 10:27:21 2017 (r322304) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Wed Aug 9 10:30:55 2017 (r322305) @@ -1071,6 +1071,10 @@ mlx4_en_transmit(struct ifnet *dev, struct mbuf *m) taskqueue_enqueue(cq->tq, &cq->cq_task); } +#if __FreeBSD_version >= 1100000 + if (unlikely(err != 0)) + if_inc_counter(dev, IFCOUNTER_IQDROPS, 1); +#endif return (err); } From owner-svn-src-all@freebsd.org Wed Aug 9 10:32:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A01CDC9101; Wed, 9 Aug 2017 10:32:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66D666C539; Wed, 9 Aug 2017 10:32:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79AWpsj044415; Wed, 9 Aug 2017 10:32:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79AWpJX044414; Wed, 9 Aug 2017 10:32:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708091032.v79AWpJX044414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 9 Aug 2017 10:32:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322306 - head/sys/dev/mlx4/mlx4_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx4/mlx4_en X-SVN-Commit-Revision: 322306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 10:32:52 -0000 Author: hselasky Date: Wed Aug 9 10:32:51 2017 New Revision: 322306 URL: https://svnweb.freebsd.org/changeset/base/322306 Log: Print maximum MTU when trying to set invalid MTU in the mlx4en(4) driver. Useful for debugging. Submitted by: Sepherosa Ziehau MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c ============================================================================== --- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Aug 9 10:30:55 2017 (r322305) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Aug 9 10:32:51 2017 (r322306) @@ -1771,7 +1771,8 @@ static int mlx4_en_change_mtu(struct net_device *dev, (unsigned)dev->if_mtu, (unsigned)new_mtu); if ((new_mtu < MLX4_EN_MIN_MTU) || (new_mtu > priv->max_mtu)) { - en_err(priv, "Bad MTU size:%d.\n", new_mtu); + en_err(priv, "Bad MTU size:%d, max %u.\n", new_mtu, + priv->max_mtu); return -EPERM; } mutex_lock(&mdev->state_lock); From owner-svn-src-all@freebsd.org Wed Aug 9 10:46:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65EB6DC9777; Wed, 9 Aug 2017 10:46:35 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 331026CC9D; Wed, 9 Aug 2017 10:46:35 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79AkYpN048470; Wed, 9 Aug 2017 10:46:34 GMT (envelope-from oleg@FreeBSD.org) Received: (from oleg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79AkY2V048469; Wed, 9 Aug 2017 10:46:34 GMT (envelope-from oleg@FreeBSD.org) Message-Id: <201708091046.v79AkY2V048469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oleg set sender to oleg@FreeBSD.org using -f From: Oleg Bulyzhin Date: Wed, 9 Aug 2017 10:46:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322307 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: oleg X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 322307 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 10:46:35 -0000 Author: oleg Date: Wed Aug 9 10:46:34 2017 New Revision: 322307 URL: https://svnweb.freebsd.org/changeset/base/322307 Log: Fix comment typo. Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Wed Aug 9 10:32:51 2017 (r322306) +++ head/sys/netinet/if_ether.c Wed Aug 9 10:46:34 2017 (r322307) @@ -1279,7 +1279,7 @@ arp_mark_lle_reachable(struct llentry *la) } /* - * Add pernament link-layer record for given interface address. + * Add permanent link-layer record for given interface address. */ static __noinline void arp_add_ifa_lle(struct ifnet *ifp, const struct sockaddr *dst) From owner-svn-src-all@freebsd.org Wed Aug 9 12:03:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E549DCB60F; Wed, 9 Aug 2017 12:03:13 +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 mx1.freebsd.org (Postfix) with ESMTPS id 74A6A6F502; Wed, 9 Aug 2017 12:03:13 +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 v79C3C4d081252; Wed, 9 Aug 2017 12:03:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79C3C1o081247; Wed, 9 Aug 2017 12:03:12 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708091203.v79C3C1o081247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 9 Aug 2017 12:03:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322308 - in head/sys/dev: ahci sound/pci/hda usb/controller X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/dev: ahci sound/pci/hda usb/controller X-SVN-Commit-Revision: 322308 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 12:03:13 -0000 Author: mav Date: Wed Aug 9 12:03:12 2017 New Revision: 322308 URL: https://svnweb.freebsd.org/changeset/base/322308 Log: Add new Intel Lewisburg and Union Point chipset PCI IDs. While there, polish some old AHCI ones, since they are still reused. MFC after: 1 week Modified: head/sys/dev/ahci/ahci_pci.c head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/sound/pci/hda/hdac.h head/sys/dev/usb/controller/xhci_pci.c Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Wed Aug 9 10:46:34 2017 (r322307) +++ head/sys/dev/ahci/ahci_pci.c Wed Aug 9 12:03:12 2017 (r322308) @@ -92,10 +92,10 @@ static const struct { {0x27c58086, 0x00, "Intel ICH7M", 0}, {0x27c68086, 0x00, "Intel ICH7M", 0}, {0x28218086, 0x00, "Intel ICH8", 0}, - {0x28228086, 0x00, "Intel ICH8", 0}, + {0x28228086, 0x00, "Intel ICH8+ (RAID)", 0}, {0x28248086, 0x00, "Intel ICH8", 0}, {0x28298086, 0x00, "Intel ICH8M", 0}, - {0x282a8086, 0x00, "Intel ICH8M", 0}, + {0x282a8086, 0x00, "Intel ICH8M+ (RAID)", 0}, {0x29228086, 0x00, "Intel ICH9", 0}, {0x29238086, 0x00, "Intel ICH9", 0}, {0x29248086, 0x00, "Intel ICH9", 0}, @@ -108,14 +108,14 @@ static const struct { {0x292f8086, 0x00, "Intel ICH9M", 0}, {0x294d8086, 0x00, "Intel ICH9", 0}, {0x294e8086, 0x00, "Intel ICH9M", 0}, - {0x3a058086, 0x00, "Intel ICH10", 0}, + {0x3a058086, 0x00, "Intel ICH10 (RAID)", 0}, {0x3a228086, 0x00, "Intel ICH10", 0}, - {0x3a258086, 0x00, "Intel ICH10", 0}, + {0x3a258086, 0x00, "Intel ICH10 (RAID)", 0}, {0x3b228086, 0x00, "Intel 5 Series/3400 Series", 0}, {0x3b238086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b258086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b258086, 0x00, "Intel 5 Series/3400 Series (RAID)", 0}, {0x3b298086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b2c8086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b2c8086, 0x00, "Intel 5 Series/3400 Series (RAID)", 0}, {0x3b2f8086, 0x00, "Intel 5 Series/3400 Series", 0}, {0x19b08086, 0x00, "Intel Denverton", 0}, {0x19b18086, 0x00, "Intel Denverton", 0}, @@ -139,12 +139,13 @@ static const struct { {0x19cf8086, 0x00, "Intel Denverton", 0}, {0x1c028086, 0x00, "Intel Cougar Point", 0}, {0x1c038086, 0x00, "Intel Cougar Point", 0}, - {0x1c048086, 0x00, "Intel Cougar Point", 0}, - {0x1c058086, 0x00, "Intel Cougar Point", 0}, + {0x1c048086, 0x00, "Intel Cougar Point (RAID)", 0}, + {0x1c058086, 0x00, "Intel Cougar Point (RAID)", 0}, + {0x1c068086, 0x00, "Intel Cougar Point (RAID)", 0}, {0x1d028086, 0x00, "Intel Patsburg", 0}, {0x1d048086, 0x00, "Intel Patsburg", 0}, {0x1d068086, 0x00, "Intel Patsburg", 0}, - {0x28268086, 0x00, "Intel Patsburg (RAID)", 0}, + {0x28268086, 0x00, "Intel Patsburg+ (RAID)", 0}, {0x1e028086, 0x00, "Intel Panther Point", 0}, {0x1e038086, 0x00, "Intel Panther Point", 0}, {0x1e048086, 0x00, "Intel Panther Point (RAID)", 0}, @@ -170,8 +171,6 @@ static const struct { {0x1f3e8086, 0x00, "Intel Avoton (RAID)", 0}, {0x1f3f8086, 0x00, "Intel Avoton (RAID)", 0}, {0x23a38086, 0x00, "Intel Coleto Creek", 0}, - {0x28238086, 0x00, "Intel Wellsburg (RAID)", 0}, - {0x28278086, 0x00, "Intel Wellsburg (RAID)", 0}, {0x8c028086, 0x00, "Intel Lynx Point", 0}, {0x8c038086, 0x00, "Intel Lynx Point", 0}, {0x8c048086, 0x00, "Intel Lynx Point (RAID)", 0}, @@ -195,6 +194,8 @@ static const struct { {0x8d648086, 0x00, "Intel Wellsburg (RAID)", 0}, {0x8d668086, 0x00, "Intel Wellsburg (RAID)", 0}, {0x8d6e8086, 0x00, "Intel Wellsburg (RAID)", 0}, + {0x28238086, 0x00, "Intel Wellsburg+ (RAID)", 0}, + {0x28278086, 0x00, "Intel Wellsburg+ (RAID)", 0}, {0x9c028086, 0x00, "Intel Lynx Point-LP", 0}, {0x9c038086, 0x00, "Intel Lynx Point-LP", 0}, {0x9c048086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, @@ -212,6 +213,17 @@ static const struct { {0xa1068086, 0x00, "Intel Sunrise Point (RAID)", 0}, {0xa1078086, 0x00, "Intel Sunrise Point (RAID)", 0}, {0xa10f8086, 0x00, "Intel Sunrise Point (RAID)", 0}, + {0xa1828086, 0x00, "Intel Lewisburg", 0}, + {0xa1868086, 0x00, "Intel Lewisburg (RAID)", 0}, + {0xa1d28086, 0x00, "Intel Lewisburg", 0}, + {0xa1d68086, 0x00, "Intel Lewisburg (RAID)", 0}, + {0xa2028086, 0x00, "Intel Lewisburg", 0}, + {0xa2068086, 0x00, "Intel Lewisburg (RAID)", 0}, + {0xa2528086, 0x00, "Intel Lewisburg", 0}, + {0xa2568086, 0x00, "Intel Lewisburg (RAID)", 0}, + {0xa2828086, 0x00, "Intel Union Point", 0}, + {0xa2868086, 0x00, "Intel Union Point (RAID)", 0}, + {0xa28e8086, 0x00, "Intel Union Point (RAID)", 0}, {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2360197b, 0x00, "JMicron JMB360", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE | AHCI_Q_1CH}, Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Wed Aug 9 10:46:34 2017 (r322307) +++ head/sys/dev/sound/pci/hda/hdac.c Wed Aug 9 12:03:12 2017 (r322308) @@ -97,6 +97,8 @@ static const struct { { HDA_INTEL_KBLKLP, "Intel Kabylake-LP", 0, 0 }, { HDA_INTEL_SRPT, "Intel Sunrise Point", 0, 0 }, { HDA_INTEL_KBLK, "Intel Kabylake", 0, 0 }, + { HDA_INTEL_KBLKH, "Intel Kabylake-H", 0, 0 }, + { HDA_INTEL_CFLK, "Intel Coffelake", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, Modified: head/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.h Wed Aug 9 10:46:34 2017 (r322307) +++ head/sys/dev/sound/pci/hda/hdac.h Wed Aug 9 12:03:12 2017 (r322308) @@ -73,6 +73,8 @@ #define HDA_INTEL_KBLKLP HDA_MODEL_CONSTRUCT(INTEL, 0x9d71) #define HDA_INTEL_SRPT HDA_MODEL_CONSTRUCT(INTEL, 0xa170) #define HDA_INTEL_KBLK HDA_MODEL_CONSTRUCT(INTEL, 0xa171) +#define HDA_INTEL_KBLKH HDA_MODEL_CONSTRUCT(INTEL, 0xa2f0) +#define HDA_INTEL_CFLK HDA_MODEL_CONSTRUCT(INTEL, 0xa348) #define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff) /* Nvidia */ Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Wed Aug 9 10:46:34 2017 (r322307) +++ head/sys/dev/usb/controller/xhci_pci.c Wed Aug 9 12:03:12 2017 (r322308) @@ -134,6 +134,10 @@ xhci_pci_match(device_t self) return ("Intel Sunrise Point-LP USB 3.0 controller"); case 0xa12f8086: return ("Intel Sunrise Point USB 3.0 controller"); + case 0xa1af8086: + return ("Intel Lewisburg USB 3.0 controller"); + case 0xa2af8086: + return ("Intel Union Point USB 3.0 controller"); case 0xa01b177d: return ("Cavium ThunderX USB 3.0 controller"); From owner-svn-src-all@freebsd.org Wed Aug 9 12:21:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD858DCBD36; Wed, 9 Aug 2017 12:21:18 +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 mx1.freebsd.org (Postfix) with ESMTPS id B3CBF6FDEA; Wed, 9 Aug 2017 12:21:18 +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 v79CLHF8085632; Wed, 9 Aug 2017 12:21:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79CLHqg085628; Wed, 9 Aug 2017 12:21:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708091221.v79CLHqg085628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 9 Aug 2017 12:21:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322309 - in head/sys/dev: ahci ata ata/chipsets sound/pci/hda X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/dev: ahci ata ata/chipsets sound/pci/hda X-SVN-Commit-Revision: 322309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 12:21:19 -0000 Author: mav Date: Wed Aug 9 12:21:17 2017 New Revision: 322309 URL: https://svnweb.freebsd.org/changeset/base/322309 Log: Use "Ibex Peak" codename for "5 Series/3400 Series" chipsets. This is shorter and unifies naming with later chipsets. MFC after: 1 week Modified: head/sys/dev/ahci/ahci_pci.c head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-intel.c head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Wed Aug 9 12:03:12 2017 (r322308) +++ head/sys/dev/ahci/ahci_pci.c Wed Aug 9 12:21:17 2017 (r322309) @@ -111,12 +111,12 @@ static const struct { {0x3a058086, 0x00, "Intel ICH10 (RAID)", 0}, {0x3a228086, 0x00, "Intel ICH10", 0}, {0x3a258086, 0x00, "Intel ICH10 (RAID)", 0}, - {0x3b228086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b238086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b258086, 0x00, "Intel 5 Series/3400 Series (RAID)", 0}, - {0x3b298086, 0x00, "Intel 5 Series/3400 Series", 0}, - {0x3b2c8086, 0x00, "Intel 5 Series/3400 Series (RAID)", 0}, - {0x3b2f8086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b228086, 0x00, "Intel Ibex Peak", 0}, + {0x3b238086, 0x00, "Intel Ibex Peak", 0}, + {0x3b258086, 0x00, "Intel Ibex Peak (RAID)", 0}, + {0x3b298086, 0x00, "Intel Ibex Peak-M", 0}, + {0x3b2c8086, 0x00, "Intel Ibex Peak-M (RAID)", 0}, + {0x3b2f8086, 0x00, "Intel Ibex Peak-M Series", 0}, {0x19b08086, 0x00, "Intel Denverton", 0}, {0x19b18086, 0x00, "Intel Denverton", 0}, {0x19b28086, 0x00, "Intel Denverton", 0}, Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Wed Aug 9 12:03:12 2017 (r322308) +++ head/sys/dev/ata/ata-pci.h Wed Aug 9 12:21:17 2017 (r322309) @@ -193,12 +193,12 @@ struct ata_pci_controller { #define ATA_I82801JI_S1 0x3a208086 #define ATA_I82801JI_S2 0x3a268086 -#define ATA_5Series_S1 0x3b208086 -#define ATA_5Series_S2 0x3b218086 -#define ATA_5Series_S3 0x3b268086 -#define ATA_5Series_S4 0x3b288086 -#define ATA_5Series_S5 0x3b2d8086 -#define ATA_5Series_S6 0x3b2e8086 +#define ATA_IBP_S1 0x3b208086 +#define ATA_IBP_S2 0x3b218086 +#define ATA_IBP_S3 0x3b268086 +#define ATA_IBP_S4 0x3b288086 +#define ATA_IBP_S5 0x3b2d8086 +#define ATA_IBP_S6 0x3b2e8086 #define ATA_CPT_S1 0x1c008086 #define ATA_CPT_S2 0x1c018086 Modified: head/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-intel.c Wed Aug 9 12:03:12 2017 (r322308) +++ head/sys/dev/ata/chipsets/ata-intel.c Wed Aug 9 12:21:17 2017 (r322309) @@ -149,12 +149,12 @@ ata_intel_probe(device_t dev) { ATA_I82801JD_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, - { ATA_5Series_S1, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S2, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S3, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S4, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S5, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S6, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_IBP_S1, 0, INTEL_6CH, 0, ATA_SA300, "Ibex Peak" }, + { ATA_IBP_S2, 0, INTEL_6CH2, 0, ATA_SA300, "Ibex Peak" }, + { ATA_IBP_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Ibex Peak" }, + { ATA_IBP_S4, 0, INTEL_6CH, 0, ATA_SA300, "Ibex Peak-M" }, + { ATA_IBP_S5, 0, INTEL_6CH2, 0, ATA_SA300, "Ibex Peak-M" }, + { ATA_IBP_S6, 0, INTEL_6CH, 0, ATA_SA300, "Ibex Peak-M" }, { ATA_CPT_S1, 0, INTEL_6CH, 0, ATA_SA600, "Cougar Point" }, { ATA_CPT_S2, 0, INTEL_6CH, 0, ATA_SA600, "Cougar Point" }, { ATA_CPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" }, Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Wed Aug 9 12:03:12 2017 (r322308) +++ head/sys/dev/sound/pci/hda/hdac.c Wed Aug 9 12:21:17 2017 (r322309) @@ -106,8 +106,8 @@ static const struct { { HDA_INTEL_82801I, "Intel 82801I", 0, 0 }, { HDA_INTEL_82801JI, "Intel 82801JI", 0, 0 }, { HDA_INTEL_82801JD, "Intel 82801JD", 0, 0 }, - { HDA_INTEL_PCH, "Intel 5 Series/3400 Series", 0, 0 }, - { HDA_INTEL_PCH2, "Intel 5 Series/3400 Series", 0, 0 }, + { HDA_INTEL_PCH, "Intel Ibex Peak", 0, 0 }, + { HDA_INTEL_PCH2, "Intel Ibex Peak", 0, 0 }, { HDA_INTEL_SCH, "Intel SCH", 0, 0 }, { HDA_NVIDIA_MCP51, "NVIDIA MCP51", 0, HDAC_QUIRK_MSI }, { HDA_NVIDIA_MCP55, "NVIDIA MCP55", 0, HDAC_QUIRK_MSI }, From owner-svn-src-all@freebsd.org Wed Aug 9 12:24:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EC56DCBE37; Wed, 9 Aug 2017 12:24:08 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3534070141; Wed, 9 Aug 2017 12:24:08 +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 v79CO7f1089699; Wed, 9 Aug 2017 12:24:07 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79CO7m6089697; Wed, 9 Aug 2017 12:24:07 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201708091224.v79CO7m6089697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 9 Aug 2017 12:24:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322310 - in head: share/man/man4 sys/net X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head: share/man/man4 sys/net X-SVN-Commit-Revision: 322310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 12:24:08 -0000 Author: ae Date: Wed Aug 9 12:24:07 2017 New Revision: 322310 URL: https://svnweb.freebsd.org/changeset/base/322310 Log: Add to if_enc(4) ability to capture packets via BPF after pfil processing. New flag 0x4 can be configured in net.enc.[in|out].ipsec_bpf_mask. When it is set, if_enc(4) additionally captures a packet via BPF after invoking pfil hook. This may be useful for debugging. MFC after: 2 weeks Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D11804 Modified: head/share/man/man4/enc.4 head/sys/net/if_enc.c Modified: head/share/man/man4/enc.4 ============================================================================== --- head/share/man/man4/enc.4 Wed Aug 9 12:21:17 2017 (r322309) +++ head/share/man/man4/enc.4 Wed Aug 9 12:24:07 2017 (r322310) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 28, 2007 +.Dd August 9, 2017 .Dt ENC 4 .Os .Sh NAME @@ -44,6 +44,13 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "device enc" .Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_enc_load="YES" +.Ed .Sh DESCRIPTION The .Nm @@ -115,6 +122,11 @@ outgoing path Most people will want to run with the suggested defaults for .Cm ipsec_filter_mask and rely on the security policy database for the outer headers. +.Pp +Note that packets are captured by BPF before firewall processing. +The special value 0x4 can be configured in the +.Ar ipsec_bpf_mask +and packets will be also captured after firewall processing. .Sh EXAMPLES To see the packets the processed via .Xr ipsec 4 , Modified: head/sys/net/if_enc.c ============================================================================== --- head/sys/net/if_enc.c Wed Aug 9 12:21:17 2017 (r322309) +++ head/sys/net/if_enc.c Wed Aug 9 12:24:07 2017 (r322310) @@ -99,9 +99,15 @@ static void enc_remove_hhooks(struct enc_softc *); static const char encname[] = "enc"; +#define IPSEC_ENC_AFTER_PFIL 0x04 /* * Before and after are relative to when we are stripping the * outer IP header. + * + * AFTER_PFIL flag used only for bpf_mask_*. It enables BPF capturing + * after PFIL hook execution. It might be useful when PFIL hook does + * some changes to the packet, e.g. address translation. If PFIL hook + * consumes mbuf, nothing will be captured. */ static VNET_DEFINE(int, filter_mask_in) = IPSEC_ENC_BEFORE; static VNET_DEFINE(int, bpf_mask_in) = IPSEC_ENC_BEFORE; @@ -194,6 +200,30 @@ enc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (0); } +static void +enc_bpftap(struct ifnet *ifp, struct mbuf *m, const struct secasvar *sav, + int32_t hhook_type, uint8_t enc, uint8_t af) +{ + struct enchdr hdr; + + if (hhook_type == HHOOK_TYPE_IPSEC_IN && + (enc & V_bpf_mask_in) == 0) + return; + else if (hhook_type == HHOOK_TYPE_IPSEC_OUT && + (enc & V_bpf_mask_out) == 0) + return; + if (bpf_peers_present(ifp->if_bpf) == 0) + return; + hdr.af = af; + hdr.spi = sav->spi; + hdr.flags = 0; + if (sav->alg_enc != SADB_EALG_NONE) + hdr.flags |= M_CONF; + if (sav->alg_auth != SADB_AALG_NONE) + hdr.flags |= M_AUTH; + bpf_mtap2(ifp->if_bpf, &hdr, sizeof(hdr), m); +} + /* * One helper hook function is used by any hook points. * + from hhook_type we can determine the packet direction: @@ -206,7 +236,6 @@ static int enc_hhook(int32_t hhook_type, int32_t hhook_id, void *udata, void *ctx_data, void *hdata, struct osd *hosd) { - struct enchdr hdr; struct ipsec_ctx_data *ctx; struct enc_softc *sc; struct ifnet *ifp, *rcvif; @@ -223,21 +252,7 @@ enc_hhook(int32_t hhook_type, int32_t hhook_id, void * if (ctx->af != hhook_id) return (EPFNOSUPPORT); - if (((hhook_type == HHOOK_TYPE_IPSEC_IN && - (ctx->enc & V_bpf_mask_in) != 0) || - (hhook_type == HHOOK_TYPE_IPSEC_OUT && - (ctx->enc & V_bpf_mask_out) != 0)) && - bpf_peers_present(ifp->if_bpf) != 0) { - hdr.af = ctx->af; - hdr.spi = ctx->sav->spi; - hdr.flags = 0; - if (ctx->sav->alg_enc != SADB_EALG_NONE) - hdr.flags |= M_CONF; - if (ctx->sav->alg_auth != SADB_AALG_NONE) - hdr.flags |= M_AUTH; - bpf_mtap2(ifp->if_bpf, &hdr, sizeof(hdr), *ctx->mp); - } - + enc_bpftap(ifp, *ctx->mp, ctx->sav, hhook_type, ctx->enc, ctx->af); switch (hhook_type) { case HHOOK_TYPE_IPSEC_IN: if (ctx->enc == IPSEC_ENC_BEFORE) { @@ -290,6 +305,8 @@ enc_hhook(int32_t hhook_type, int32_t hhook_id, void * return (EACCES); } (*ctx->mp)->m_pkthdr.rcvif = rcvif; + enc_bpftap(ifp, *ctx->mp, ctx->sav, hhook_type, + IPSEC_ENC_AFTER_PFIL, ctx->af); return (0); } From owner-svn-src-all@freebsd.org Wed Aug 9 12:45:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94AF0DCC321; Wed, 9 Aug 2017 12:45:50 +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 mx1.freebsd.org (Postfix) with ESMTPS id 63064709F8; Wed, 9 Aug 2017 12:45:50 +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 v79Cjn5A097669; Wed, 9 Aug 2017 12:45:49 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79CjnoC097668; Wed, 9 Aug 2017 12:45:49 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708091245.v79CjnoC097668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 9 Aug 2017 12:45:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322312 - stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Commit-Revision: 322312 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 12:45:50 -0000 Author: gjb Date: Wed Aug 9 12:45:49 2017 New Revision: 322312 URL: https://svnweb.freebsd.org/changeset/base/322312 Log: Revise entry for r320646, rwho/rwhod/ruptime are not part of rcmds. Fix line wrapping. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Wed Aug 9 12:45:48 2017 (r322311) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Wed Aug 9 12:45:49 2017 (r322312) @@ -196,9 +196,8 @@ facilities of &man.cxgbe.4; devices. The &man.rcp.1;, &man.rlogin.1;, - &man.rsh.1;, &man.ruptime.1;, &man.rwho.1;, &man.rlogind.8;, - &man.rshd.8;, and &man.rwhod.8; utilities have been marked as - deprecated, and planned for removal in + &man.rsh.1;, &man.rlogind.8;, and &man.rshd.8; utilities have + been marked as deprecated, and planned for removal in &os; 12.0-RELEASE. The &man.gdb.1; and &man.kgdb.1; From owner-svn-src-all@freebsd.org Wed Aug 9 12:45:49 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C36B7DCC31A; Wed, 9 Aug 2017 12:45:49 +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 mx1.freebsd.org (Postfix) with ESMTPS id 8FC9C709F7; Wed, 9 Aug 2017 12:45:49 +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 v79CjmVK097626; Wed, 9 Aug 2017 12:45:48 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79CjmRJ097625; Wed, 9 Aug 2017 12:45:48 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708091245.v79CjmRJ097625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 9 Aug 2017 12:45:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322311 - stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Commit-Revision: 322311 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 12:45:49 -0000 Author: gjb Date: Wed Aug 9 12:45:48 2017 New Revision: 322311 URL: https://svnweb.freebsd.org/changeset/base/322311 Log: Document r321964, bmake 20170720. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Wed Aug 9 12:24:07 2017 (r322310) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Wed Aug 9 12:45:48 2017 (r322311) @@ -258,6 +258,9 @@ &man.libarchive.3; has been updated to version 3.3.2. + + bmake has + been updated to version 20170720. From owner-svn-src-all@freebsd.org Wed Aug 9 12:56:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94894DCC665; Wed, 9 Aug 2017 12:56:00 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5E49E71086; Wed, 9 Aug 2017 12:56:00 +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 v79CtxHN001717; Wed, 9 Aug 2017 12:55:59 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79CtxMw001716; Wed, 9 Aug 2017 12:55:59 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708091255.v79CtxMw001716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 9 Aug 2017 12:55:59 +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: r322313 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Commit-Revision: 322313 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 12:56:00 -0000 Author: gjb Date: Wed Aug 9 12:55:58 2017 New Revision: 322313 URL: https://svnweb.freebsd.org/changeset/base/322313 Log: Add an errata entry for ruptime(1), rwho(1), and rwhod(8), not included in the rcmds deprecation. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Wed Aug 9 12:45:49 2017 (r322312) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Wed Aug 9 12:55:58 2017 (r322313) @@ -186,6 +186,16 @@ boot Communications, LLC (Netgate), when in fact this work was done by Hiroki Mori independently. + + + [2017-08-09] The release notes stated the + &man.ruptime.1;, &man.rwho.1;, and &man.rwhod.8; utilities + have been marked "deprecated", however this change + was reversed in 12.0-CURRENT. + + The other utilities mentioned in the entry in the + release notes, however, are unchanged. + From owner-svn-src-all@freebsd.org Wed Aug 9 13:25:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96F33DCCF84; Wed, 9 Aug 2017 13:25:28 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 6409A71FE5; Wed, 9 Aug 2017 13:25:28 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79DPRpf013878; Wed, 9 Aug 2017 13:25:27 GMT (envelope-from jonathan@FreeBSD.org) Received: (from jonathan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79DPRlm013877; Wed, 9 Aug 2017 13:25:27 GMT (envelope-from jonathan@FreeBSD.org) Message-Id: <201708091325.v79DPRlm013877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jonathan set sender to jonathan@FreeBSD.org using -f From: Jonathan Anderson Date: Wed, 9 Aug 2017 13:25:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322314 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: jonathan X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322314 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 13:25:28 -0000 Author: jonathan Date: Wed Aug 9 13:25:27 2017 New Revision: 322314 URL: https://svnweb.freebsd.org/changeset/base/322314 Log: Add birthday information for jonathan@. As requested by mckusick@... Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Wed Aug 9 12:55:58 2017 (r322313) +++ head/usr.bin/calendar/calendars/calendar.freebsd Wed Aug 9 13:25:27 2017 (r322314) @@ -123,6 +123,7 @@ 03/24 Marcel Moolenaar born in Hilversum, the Netherlands, 1968 03/24 Emanuel Haupt born in Zurich, Switzerland, 1979 03/25 Andrew R. Reiter born in Springfield, Massachusetts, United States, 1980 +03/26 Jonathan Anderson born in Ottawa, Ontario, Canada, 1983 03/27 Josef El-Rayes born in Linz, Austria, 1982 03/28 Sean C. Farley born in Indianapolis, Indiana, United States, 1970 03/29 Thierry Thomas born in Luxeuil les Bains, France, 1961 From owner-svn-src-all@freebsd.org Wed Aug 9 13:26:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DA11DCCFE7; Wed, 9 Aug 2017 13:26:13 +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 mx1.freebsd.org (Postfix) with ESMTPS id 67C587212C; Wed, 9 Aug 2017 13:26:13 +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 v79DQCIk013952; Wed, 9 Aug 2017 13:26:12 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79DQCwZ013950; Wed, 9 Aug 2017 13:26:12 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201708091326.v79DQCwZ013950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 9 Aug 2017 13:26:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322315 - stable/10/sys/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/10/sys/netinet X-SVN-Commit-Revision: 322315 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 13:26:13 -0000 Author: tuexen Date: Wed Aug 9 13:26:12 2017 New Revision: 322315 URL: https://svnweb.freebsd.org/changeset/base/322315 Log: MFC r317208: Syncoockies can be used in combination with the syncache. If the cache overflows, syncookies are used. This patch restricts the usage of syncookies in this case: accept syncookies only if there was an overflow of the syncache recently. This mitigates a problem reported in PR217637, where is syncookie was accepted without any recent drops. Thanks to glebius@ for suggesting an improvement. PR: 217637 Reviewed by: gnn, glebius Differential Revision: https://reviews.freebsd.org/D10272 Modified: stable/10/sys/netinet/tcp_syncache.c stable/10/sys/netinet/tcp_syncache.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_syncache.c ============================================================================== --- stable/10/sys/netinet/tcp_syncache.c Wed Aug 9 13:25:27 2017 (r322314) +++ stable/10/sys/netinet/tcp_syncache.c Wed Aug 9 13:26:12 2017 (r322315) @@ -277,6 +277,7 @@ syncache_init(void) &V_tcp_syncache.hashbase[i].sch_mtx, 0); V_tcp_syncache.hashbase[i].sch_length = 0; V_tcp_syncache.hashbase[i].sch_sc = &V_tcp_syncache; + V_tcp_syncache.hashbase[i].sch_last_overflow = INT64_MIN; } /* Create the syncache entry zone. */ @@ -357,6 +358,7 @@ syncache_insert(struct syncache *sc, struct syncache_h KASSERT(!TAILQ_EMPTY(&sch->sch_bucket), ("sch->sch_length incorrect")); sc2 = TAILQ_LAST(&sch->sch_bucket, sch_head); + sch->sch_last_overflow = time_uptime; syncache_drop(sc2, sch); TCPSTAT_INC(tcps_sc_bucketoverflow); } @@ -985,10 +987,13 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt /* * There is no syncache entry, so see if this ACK is * a returning syncookie. To do this, first: - * A. See if this socket has had a syncache entry dropped in - * the past. We don't want to accept a bogus syncookie - * if we've never received a SYN. - * B. check that the syncookie is valid. If it is, then + * A. Check if syncookies are used in case of syncache + * overflows + * B. See if this socket has had a syncache entry dropped in + * the recent past. We don't want to accept a bogus + * syncookie if we've never received a SYN or accept it + * twice. + * C. check that the syncookie is valid. If it is, then * cobble up a fake syncache entry, and return. */ if (!V_tcp_syncookies) { @@ -999,6 +1004,15 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt s, __func__); goto failed; } + if (!V_tcp_syncookiesonly && + sch->sch_last_overflow < time_uptime - SYNCOOKIE_LIFETIME) { + SCH_UNLOCK(sch); + if ((s = tcp_log_addrs(inc, th, NULL, NULL))) + log(LOG_DEBUG, "%s; %s: Spurious ACK, " + "segment rejected (no syncache entry)\n", + s, __func__); + goto failed; + } bzero(&scs, sizeof(scs)); sc = syncookie_lookup(inc, sch, &scs, th, to, *lsop); SCH_UNLOCK(sch); @@ -1336,8 +1350,10 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *t * entry and insert the new one. */ TCPSTAT_INC(tcps_sc_zonefail); - if ((sc = TAILQ_LAST(&sch->sch_bucket, sch_head)) != NULL) + if ((sc = TAILQ_LAST(&sch->sch_bucket, sch_head)) != NULL) { + sch->sch_last_overflow = time_uptime; syncache_drop(sc, sch); + } sc = uma_zalloc(V_tcp_syncache.zone, M_NOWAIT | M_ZERO); if (sc == NULL) { if (V_tcp_syncookies) { Modified: stable/10/sys/netinet/tcp_syncache.h ============================================================================== --- stable/10/sys/netinet/tcp_syncache.h Wed Aug 9 13:25:27 2017 (r322314) +++ stable/10/sys/netinet/tcp_syncache.h Wed Aug 9 13:26:12 2017 (r322315) @@ -100,6 +100,7 @@ struct syncache_head { int sch_nextc; u_int sch_length; struct tcp_syncache *sch_sc; + time_t sch_last_overflow; }; #define SYNCOOKIE_SECRET_SIZE 16 From owner-svn-src-all@freebsd.org Wed Aug 9 13:46:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E4BDDCD76C; Wed, 9 Aug 2017 13:46:18 +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 mx1.freebsd.org (Postfix) with ESMTPS id E078A72C35; Wed, 9 Aug 2017 13:46:17 +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 v79DkH3c022296; Wed, 9 Aug 2017 13:46:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79DkHCM022295; Wed, 9 Aug 2017 13:46:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708091346.v79DkHCM022295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 9 Aug 2017 13:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322316 - head/sys/dev/ahci X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/ahci X-SVN-Commit-Revision: 322316 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 13:46:18 -0000 Author: mav Date: Wed Aug 9 13:46:16 2017 New Revision: 322316 URL: https://svnweb.freebsd.org/changeset/base/322316 Log: Missing remanant of 322309. MFC after: 1 week Modified: head/sys/dev/ahci/ahci_pci.c Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Wed Aug 9 13:26:12 2017 (r322315) +++ head/sys/dev/ahci/ahci_pci.c Wed Aug 9 13:46:16 2017 (r322316) @@ -116,7 +116,7 @@ static const struct { {0x3b258086, 0x00, "Intel Ibex Peak (RAID)", 0}, {0x3b298086, 0x00, "Intel Ibex Peak-M", 0}, {0x3b2c8086, 0x00, "Intel Ibex Peak-M (RAID)", 0}, - {0x3b2f8086, 0x00, "Intel Ibex Peak-M Series", 0}, + {0x3b2f8086, 0x00, "Intel Ibex Peak-M", 0}, {0x19b08086, 0x00, "Intel Denverton", 0}, {0x19b18086, 0x00, "Intel Denverton", 0}, {0x19b28086, 0x00, "Intel Denverton", 0}, From owner-svn-src-all@freebsd.org Wed Aug 9 15:38:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26010DCFA23; Wed, 9 Aug 2017 15:38:26 +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 mx1.freebsd.org (Postfix) with ESMTPS id E9D8D764E5; Wed, 9 Aug 2017 15:38:25 +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 v79FcPaT067064; Wed, 9 Aug 2017 15:38:25 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79FcPWa067063; Wed, 9 Aug 2017 15:38:25 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708091538.v79FcPWa067063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 9 Aug 2017 15:38:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r322317 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 322317 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 15:38:26 -0000 Author: gjb Date: Wed Aug 9 15:38:24 2017 New Revision: 322317 URL: https://svnweb.freebsd.org/changeset/base/322317 Log: Turn over releng/11.1 to so@. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: svnadmin/conf/approvers Modified: svnadmin/conf/approvers ============================================================================== --- svnadmin/conf/approvers Wed Aug 9 13:46:16 2017 (r322316) +++ svnadmin/conf/approvers Wed Aug 9 15:38:24 2017 (r322317) @@ -20,8 +20,7 @@ #^stable/11/ re #^stable/10/ re ^release/ re -^releng/11.1/ re -^releng/11.0/ (security-officer|so) +^releng/11.[0-1]/ (security-officer|so) ^releng/10.[0-3]/ (security-officer|so) ^releng/9.[0-3]/ (security-officer|so) ^releng/8.[0-4]/ (security-officer|so) From owner-svn-src-all@freebsd.org Wed Aug 9 16:15:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D83E7DD06A6; Wed, 9 Aug 2017 16:15:26 +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 mx1.freebsd.org (Postfix) with ESMTPS id B4759779BC; Wed, 9 Aug 2017 16:15:26 +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 v79GFPVc083490; Wed, 9 Aug 2017 16:15:25 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79GFPk9083482; Wed, 9 Aug 2017 16:15:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708091615.v79GFPk9083482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 9 Aug 2017 16:15:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322318 - in head: share/man/man4 sys/conf sys/geom X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/geom X-SVN-Commit-Revision: 322318 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 16:15:26 -0000 Author: imp Date: Wed Aug 9 16:15:24 2017 New Revision: 322318 URL: https://svnweb.freebsd.org/changeset/base/322318 Log: Mark geom classes as deprecated. geom_bsd, geom_mbr and geom_sunlabel have been obsolete since Marcel Moolenaar's geom_part was in FreeBSD 7. They haven't been in GENERIC since FreeBSD 8. Add warning when used. geom_vol_ffs has been obsolete since ufs support to geom_label was committed in FreeBSD 5. It hasn't been in GENERIC since FreeBSD 5. Add warning when used. geom_fox has been obsolete since gmultipath was committed in FreeBSD 7. (no warning added, since this is a very obscure class). These will all be removed in FreeBSD 12. MFC After: 3 days Differential Revision: https://reviews.freebsd.org/D11935 Note: Classes will be removed after MFC Modified: head/share/man/man4/geom.4 head/share/man/man4/geom_fox.4 head/sys/conf/NOTES head/sys/geom/geom_bsd.c head/sys/geom/geom_mbr.c head/sys/geom/geom_sunlabel.c head/sys/geom/geom_vol_ffs.c Modified: head/share/man/man4/geom.4 ============================================================================== --- head/share/man/man4/geom.4 Wed Aug 9 15:38:24 2017 (r322317) +++ head/share/man/man4/geom.4 Wed Aug 9 16:15:24 2017 (r322318) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 20, 2017 +.Dd August 9, 2017 .Dt GEOM 4 .Os .Sh NAME @@ -43,17 +43,14 @@ .Sh SYNOPSIS .Cd options GEOM_AES .Cd options GEOM_BDE -.Cd options GEOM_BSD .Cd options GEOM_CACHE .Cd options GEOM_CONCAT .Cd options GEOM_ELI -.Cd options GEOM_FOX .Cd options GEOM_GATE .Cd options GEOM_JOURNAL .Cd options GEOM_LABEL .Cd options GEOM_LINUX_LVM .Cd options GEOM_MAP -.Cd options GEOM_MBR .Cd options GEOM_MIRROR .Cd options GEOM_MOUNTVER .Cd options GEOM_MULTIPATH @@ -71,10 +68,8 @@ .Cd options GEOM_RAID3 .Cd options GEOM_SHSEC .Cd options GEOM_STRIPE -.Cd options GEOM_SUNLABEL .Cd options GEOM_UZIP .Cd options GEOM_VIRSTOR -.Cd options GEOM_VOL .Cd options GEOM_ZERO .Sh DESCRIPTION The @@ -449,6 +444,24 @@ This is unused at this time. .It 0x80 Pq Dv G_F_CTLDUMP Dump contents of gctl requests. .El +.Sh OBSOLETE OPTIONS +.Pp +The following options have been deprecated and will be removed in +.Fx 12 : +.Cd GEOM_BSD , +.Cd GEOM_FOX , +.Cd GEOM_MBR , +.Cd GEOM_SUNLABEL , +and +.Cd GEOM_VOL . +.Pp +Use +.Cd GEOM_PART_BSD , +.Cd GEOM_MULTIPATH , +.Cd GEOM_PART_MBR , +.Cd GEOM_PART_VTOC8 , +.Cd GEOM_LABEL +options, respectively, instead. .Sh SEE ALSO .Xr libgeom 3 , .Xr DECLARE_GEOM_CLASS 9 , Modified: head/share/man/man4/geom_fox.4 ============================================================================== --- head/share/man/man4/geom_fox.4 Wed Aug 9 15:38:24 2017 (r322317) +++ head/share/man/man4/geom_fox.4 Wed Aug 9 16:15:24 2017 (r322318) @@ -51,6 +51,8 @@ This driver is obsolete. Users are advised to use .Xr gmultipath 8 instead. +This driver will be removed in +.Fx 12 . .Ef .Pp The intent of the Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Wed Aug 9 15:38:24 2017 (r322317) +++ head/sys/conf/NOTES Wed Aug 9 16:15:24 2017 (r322318) @@ -147,17 +147,17 @@ options BOOTHOWTO=RB_MULTIPLE options GEOM_AES # Don't use, use GEOM_BDE options GEOM_BDE # Disk encryption. -options GEOM_BSD # BSD disklabels +options GEOM_BSD # BSD disklabels (obsolete, gone in 12) options GEOM_CACHE # Disk cache. options GEOM_CONCAT # Disk concatenation. options GEOM_ELI # Disk encryption. -options GEOM_FOX # Redundant path mitigation +options GEOM_FOX # Redundant path mitigation (obsolete, gone in 12) options GEOM_GATE # Userland services. options GEOM_JOURNAL # Journaling. options GEOM_LABEL # Providers labelization. options GEOM_LINUX_LVM # Linux LVM2 volumes options GEOM_MAP # Map based partitioning -options GEOM_MBR # DOS/MBR partitioning +options GEOM_MBR # DOS/MBR partitioning (obsolete, gone in 12) options GEOM_MIRROR # Disk mirroring. options GEOM_MULTIPATH # Disk multipath options GEOM_NOP # Test class. @@ -174,11 +174,11 @@ options GEOM_RAID # Soft RAID functionality. options GEOM_RAID3 # RAID3 functionality. options GEOM_SHSEC # Shared secret. options GEOM_STRIPE # Disk striping. -options GEOM_SUNLABEL # Sun/Solaris partitioning +options GEOM_SUNLABEL # Sun/Solaris partitioning (obsolete, gone in 12) options GEOM_UZIP # Read-only compressed disks options GEOM_VINUM # Vinum logical volume manager options GEOM_VIRSTOR # Virtual storage. -options GEOM_VOL # Volume names from UFS superblock +options GEOM_VOL # Volume names from UFS superblock (obsolete, gone in 12) options GEOM_ZERO # Performance testing helper. # Modified: head/sys/geom/geom_bsd.c ============================================================================== --- head/sys/geom/geom_bsd.c Wed Aug 9 15:38:24 2017 (r322317) +++ head/sys/geom/geom_bsd.c Wed Aug 9 16:15:24 2017 (r322318) @@ -72,6 +72,8 @@ FEATURE(geom_bsd, "GEOM BSD disklabels support"); #define LABELSIZE (148 + 16 * MAXPARTITIONS) +static int g_bsd_once; + static void g_bsd_hotwrite(void *arg, int flag); /* * Our private data about one instance. All the rest is handled by the @@ -504,6 +506,12 @@ g_bsd_taste(struct g_class *mp, struct g_provider *pp, g_slice_conf_hot(gp, 0, ms->labeloffset, LABELSIZE, G_SLICE_HOT_ALLOW, G_SLICE_HOT_DENY, G_SLICE_HOT_CALL); gsp->hot = g_bsd_hotwrite; + if (!g_bsd_once) { + g_bsd_once = 1; + printf( + "WARNING: geom_bsd (geom %s) is deprecated, " + "use gpart instead.\n", gp->name); + } return (gp); } /* Modified: head/sys/geom/geom_mbr.c ============================================================================== --- head/sys/geom/geom_mbr.c Wed Aug 9 15:38:24 2017 (r322317) +++ head/sys/geom/geom_mbr.c Wed Aug 9 16:15:24 2017 (r322318) @@ -57,6 +57,8 @@ FEATURE(geom_mbr, "GEOM DOS/MBR partitioning support") #define MBR_CLASS_NAME "MBR" #define MBREXT_CLASS_NAME "MBREXT" +static int g_mbr_once = 0; + static struct dos_partition historical_bogus_partition_table[NDOSPART] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, @@ -315,6 +317,12 @@ g_mbr_taste(struct g_class *mp, struct g_provider *pp, if (LIST_EMPTY(&gp->provider)) { g_slice_spoiled(cp); return (NULL); + } + if (!g_mbr_once) { + g_mbr_once = 1; + printf( + "WARNING: geom_mbr (geom %s) is deprecated, " + "use gpart instead.\n", gp->name); } return (gp); } Modified: head/sys/geom/geom_sunlabel.c ============================================================================== --- head/sys/geom/geom_sunlabel.c Wed Aug 9 15:38:24 2017 (r322317) +++ head/sys/geom/geom_sunlabel.c Wed Aug 9 16:15:24 2017 (r322318) @@ -65,6 +65,8 @@ struct g_sunlabel_softc { u_char labelsum[16]; }; +static int g_sunlabel_once = 0; + static int g_sunlabel_modify(struct g_geom *gp, struct g_sunlabel_softc *ms, u_char *sec0) { @@ -312,6 +314,12 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider g_slice_conf_hot(gp, 0, 0, SUN_SIZE, G_SLICE_HOT_ALLOW, G_SLICE_HOT_DENY, G_SLICE_HOT_CALL); gsp->hot = g_sunlabel_hotwrite; + if (!g_sunlabel_once) { + g_sunlabel_once = 1; + printf( + "WARNING: geom_sunlabel (geom %s) is deprecated, " + "use gpart instead.\n", gp->name); + } return (gp); } Modified: head/sys/geom/geom_vol_ffs.c ============================================================================== --- head/sys/geom/geom_vol_ffs.c Wed Aug 9 15:38:24 2017 (r322317) +++ head/sys/geom/geom_vol_ffs.c Wed Aug 9 16:15:24 2017 (r322318) @@ -48,6 +48,7 @@ FEATURE(geom_vol, "GEOM support for volume names from #define VOL_FFS_CLASS_NAME "VOL_FFS" static int superblocks[] = SBLOCKSEARCH; +static int g_vol_ffs_once; struct g_vol_ffs_softc { char * vol; @@ -144,6 +145,12 @@ g_vol_ffs_taste(struct g_class *mp, struct g_provider if (LIST_EMPTY(&gp->provider)) { g_slice_spoiled(cp); return (NULL); + } + if (!g_vol_ffs_once) { + g_vol_ffs_once = 1; + printf( + "WARNING: geom_vol_Ffs (geom %s) is deprecated, " + "use glabel instead.\n", gp->name); } return (gp); } From owner-svn-src-all@freebsd.org Wed Aug 9 16:37:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29CB1DD0AF4; Wed, 9 Aug 2017 16:37:39 +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 mx1.freebsd.org (Postfix) with ESMTPS id EBB557C3DE; Wed, 9 Aug 2017 16:37:38 +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 v79Gbc87091519; Wed, 9 Aug 2017 16:37:38 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79Gbct7091518; Wed, 9 Aug 2017 16:37:38 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708091637.v79Gbct7091518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 9 Aug 2017 16:37:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322319 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 322319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 16:37:39 -0000 Author: imp Date: Wed Aug 9 16:37:37 2017 New Revision: 322319 URL: https://svnweb.freebsd.org/changeset/base/322319 Log: Also provide a warning for geom_fox. Differential Review: https://reviews.freebsd.org/D11935 Requested by: jhb@ MFC After: 3 days Modified: head/sys/geom/geom_fox.c Modified: head/sys/geom/geom_fox.c ============================================================================== --- head/sys/geom/geom_fox.c Wed Aug 9 16:15:24 2017 (r322318) +++ head/sys/geom/geom_fox.c Wed Aug 9 16:37:37 2017 (r322319) @@ -53,6 +53,8 @@ #define FOX_CLASS_NAME "FOX" #define FOX_MAGIC "GEOM::FOX" +static int g_fox_once; + FEATURE(geom_fox, "GEOM FOX redundant path mitigation support"); struct g_fox_softc { @@ -438,8 +440,15 @@ printf("fox %s lock %p\n", gp->name, &sc->lock); g_free(buf); g_access(cp, -1, 0, 0); - if (!LIST_EMPTY(&gp->provider)) + if (!LIST_EMPTY(&gp->provider)) { + if (!g_fox_once) { + g_fox_once = 1; + printf( + "WARNING: geom_fox (geom %s) is deprecated, " + "use gmultipath instead.\n", gp->name); + } return (gp); + } g_free(gp->softc); g_detach(cp); From owner-svn-src-all@freebsd.org Wed Aug 9 16:42:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C1FDDD0CCC; Wed, 9 Aug 2017 16:42:13 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEAEF7C948; Wed, 9 Aug 2017 16:42:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id B88D510AF07; Wed, 9 Aug 2017 12:41:56 -0400 (EDT) From: John Baldwin To: Jeremie Le Hen Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322277 - in head: tools/build/mk usr.bin usr.bin/ruptime usr.bin/rwho usr.sbin usr.sbin/rwhod Date: Wed, 09 Aug 2017 09:13:33 -0700 Message-ID: <57853544.8eSNM9xh9N@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201708082017.v78KH7av090655@repo.freebsd.org> References: <201708082017.v78KH7av090655@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 09 Aug 2017 12:41:56 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 16:42:13 -0000 On Tuesday, August 08, 2017 08:17:07 PM Jeremie Le Hen wrote: > Author: jlh > Date: Tue Aug 8 20:17:07 2017 > New Revision: 322277 > URL: https://svnweb.freebsd.org/changeset/base/322277 > > Log: > rwho/ruptime/rwhod shouldn't be gated by RCMDS. > > As peter@ points out in pr/220953: > "rwho, rwhod and ruptime are not part of the remote login suite (rsh, rlogin > etc). > > They should *not* be in the rcmds package which is disabled by default. We > rely on rwho/rwhod/ruptime in the freebsd.org cluster." > > This commit is a re-commit of r322029 and r322031 with a better commit log, as > pointed out by ngie@. > > This also includes the necesary changes to OptionalObsoleteFiles.inc, as > requested by jhb@. > > PR: 220953 > Reported by: peter@, jhb@ > Differential Revision: https://reviews.freebsd.org/D11743 You still need to fix the Makefiles that install /etc/rc.d/rwho and /etc/periodic/daily/140.clean-rwho to install those files unconditionally. -- John Baldwin From owner-svn-src-all@freebsd.org Wed Aug 9 17:02:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA82ADD14C5; Wed, 9 Aug 2017 17:02:54 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) by mx1.freebsd.org (Postfix) with ESMTP id 3F7A97D3F6; Wed, 9 Aug 2017 17:02:49 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 To: Dexuan Cui , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Cc: Yanmin Qiao , Hongjiang Zhang References: <201708050656.v756uk48076256@repo.freebsd.org> From: Jung-uk Kim Message-ID: <331d02b4-a315-70e5-7fe9-2e767554a148@FreeBSD.org> Date: Wed, 9 Aug 2017 13:02:42 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="icHEPANxVljk5Wmr1TTJ23MNwHXws8NnW" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 17:02:55 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --icHEPANxVljk5Wmr1TTJ23MNwHXws8NnW Content-Type: multipart/mixed; boundary="WDQBVTA42pmju0a29PpWBPQKg2FLjcBPJ"; protected-headers="v1" From: Jung-uk Kim To: Dexuan Cui , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Cc: Yanmin Qiao , Hongjiang Zhang Message-ID: <331d02b4-a315-70e5-7fe9-2e767554a148@FreeBSD.org> Subject: Re: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 References: <201708050656.v756uk48076256@repo.freebsd.org> In-Reply-To: --WDQBVTA42pmju0a29PpWBPQKg2FLjcBPJ Content-Type: multipart/mixed; boundary="------------370644EAE7D50A34E0B3E01F" Content-Language: en-US This is a multi-part message in MIME format. --------------370644EAE7D50A34E0B3E01F Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/09/2017 00:09, Dexuan Cui wrote: > Hi jkim, > The patch breaks FreeBSD VM on Hyper-V. >=20 > identify_hypervisor() is moved from identify_cpu() to an earlier place,= but the global=20 > variable cpu_feature2 used by the function is still initialized in iden= tify_cpu(). >=20 > I'm not sure about the background of your patch. Can you please have a = look? Can you please test the attached patch? Jung-uk Kim --------------370644EAE7D50A34E0B3E01F Content-Type: text/x-patch; name="cpuid.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cpuid.diff" Index: sys/amd64/amd64/machdep.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 --- sys/amd64/amd64/machdep.c (revision 322319) +++ sys/amd64/amd64/machdep.c (working copy) @@ -1537,6 +1537,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) =20 kmdp =3D init_ops.parse_preload_data(modulep); =20 + identify_cpu(); identify_hypervisor(); =20 /* Init basic tunables, hz etc */ @@ -1643,7 +1644,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) !=3D NULL) vty_set_preferred(VTY_VT); =20 - identify_cpu(); /* Final stage of CPU initialization */ + finishidentcpu(); /* Final stage of CPU initialization */ initializecpu(); /* Initialize CPU registers */ initializecpucache(); =20 Index: sys/i386/include/md_var.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/i386/include/md_var.h (revision 322319) +++ sys/i386/include/md_var.h (working copy) @@ -59,7 +59,6 @@ void doreti_popl_es(void) __asm(__STRING(doreti_po void doreti_popl_es_fault(void) __asm(__STRING(doreti_popl_es_fault)); void doreti_popl_fs(void) __asm(__STRING(doreti_popl_fs)); void doreti_popl_fs_fault(void) __asm(__STRING(doreti_popl_fs_fault)); -void finishidentcpu(void); void fill_based_sd(struct segment_descriptor *sdp, uint32_t base); void i686_pagezero(void *addr); void sse2_pagezero(void *addr); Index: sys/x86/include/x86_var.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/x86/include/x86_var.h (revision 322319) +++ sys/x86/include/x86_var.h (working copy) @@ -115,6 +115,7 @@ void cpu_probe_amdc1e(void); void cpu_setregs(void); void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); +void finishidentcpu(void); void identify_cpu(void); void identify_hypervisor(void); void initializecpu(void); Index: sys/x86/x86/identcpu.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 --- sys/x86/x86/identcpu.c (revision 322319) +++ sys/x86/x86/identcpu.c (working copy) @@ -1372,23 +1372,12 @@ fix_cpuid(void) return (false); } =20 -/* - * Final stage of CPU identification. - */ -#ifdef __i386__ +#ifdef __amd64__ void -finishidentcpu(void) -#else -void identify_cpu(void) -#endif { - u_int regs[4], cpu_stdext_disable; -#ifdef __i386__ - u_char ccr3; -#endif + u_int regs[4]; =20 -#ifdef __amd64__ do_cpuid(0, regs); cpu_high =3D regs[0]; ((u_int *)&cpu_vendor)[0] =3D regs[1]; @@ -1401,8 +1390,20 @@ identify_cpu(void) cpu_procinfo =3D regs[1]; cpu_feature =3D regs[3]; cpu_feature2 =3D regs[2]; +} #endif =20 +/* + * Final stage of CPU identification. + */ +void +finishidentcpu(void) +{ + u_int regs[4], cpu_stdext_disable; +#ifdef __i386__ + u_char ccr3; +#endif + cpu_vendor_id =3D find_cpu_vendor_id(); =20 if (fix_cpuid()) { --------------370644EAE7D50A34E0B3E01F-- --WDQBVTA42pmju0a29PpWBPQKg2FLjcBPJ-- --icHEPANxVljk5Wmr1TTJ23MNwHXws8NnW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEl1bqgKaRyqfWXu/CfJ+WJvzb8UYFAlmLQDIACgkQfJ+WJvzb 8Ub0pwf/T59R175CWocqyBfEXVKgvQj0xzk5nJPTvbSNknVvbn+aLNbcJq0qPflj fskzMxqWw8rfSGwtkJke8Up1VMwKBybT1b73f7Bq7TrBlkcp6YX2frsMaALjqHtu Dbrgz3RCDx+P99Hz9+GzwNqrI2sg276IMX/QD9fPtBZo0estB+oDC07TrEBq0wYx lzE4LDwBInoWwLBCgYm1WZOE8va0iANycEDULGQd7vWgDA9CKhxgM9sjYn7w8ay1 emPpx5/0HcUEN1EC4yOHu7jqfqYH1SzEezbGzZ/zeH22HErGOrCncVRwW3f6bTEB A2XI0NeWiha/3llOYxy8/N6FRNYSjQ== =wIVS -----END PGP SIGNATURE----- --icHEPANxVljk5Wmr1TTJ23MNwHXws8NnW-- From owner-svn-src-all@freebsd.org Wed Aug 9 17:32:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 660B8DD1CE0; Wed, 9 Aug 2017 17:32: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 mx1.freebsd.org (Postfix) with ESMTPS id F1FD37E236; Wed, 9 Aug 2017 17:32:44 +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 v79HWiVf015851; Wed, 9 Aug 2017 17:32:44 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79HWegF015814; Wed, 9 Aug 2017 17:32:40 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708091732.v79HWegF015814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 9 Aug 2017 17:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322320 - in head: contrib/libc++/include contrib/llvm/include/llvm/Analysis contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/Analysis contrib/llvm/lib/CodeGen contrib/llvm/lib/CodeGe... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/libc++/include contrib/llvm/include/llvm/Analysis contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/Analysis contrib/llvm/lib/CodeGen contrib/llvm/lib/CodeGen/SelectionDAG contrib/ll... X-SVN-Commit-Revision: 322320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 17:32:45 -0000 Author: dim Date: Wed Aug 9 17:32:39 2017 New Revision: 322320 URL: https://svnweb.freebsd.org/changeset/base/322320 Log: Upgrade our copies of clang, llvm and libc++ to r310316 from the upstream release_50 branch. MFC after: 2 months X-MFC-with: r321369 Modified: head/contrib/libc++/include/__bsd_locale_defaults.h head/contrib/libc++/include/__bsd_locale_fallbacks.h head/contrib/libc++/include/__locale head/contrib/libc++/include/mutex head/contrib/libc++/include/sstream head/contrib/llvm/include/llvm/Analysis/ValueTracking.h head/contrib/llvm/include/llvm/CodeGen/MachineFunction.h head/contrib/llvm/include/llvm/CodeGen/MachineInstr.h head/contrib/llvm/lib/Analysis/ValueTracking.cpp head/contrib/llvm/lib/CodeGen/BranchFolding.cpp head/contrib/llvm/lib/CodeGen/MachineFunction.cpp head/contrib/llvm/lib/CodeGen/MachineInstr.cpp head/contrib/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp head/contrib/llvm/lib/CodeGen/StackColoring.cpp head/contrib/llvm/lib/IR/ConstantFold.cpp head/contrib/llvm/lib/Object/COFFImportFile.cpp head/contrib/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp head/contrib/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp head/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.td head/contrib/llvm/lib/Target/AArch64/AArch64MacroFusion.cpp head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp head/contrib/llvm/lib/Target/X86/X86InstrSSE.td head/contrib/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp head/contrib/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp head/contrib/llvm/lib/Transforms/Scalar/SCCP.cpp head/contrib/llvm/lib/Transforms/Utils/CloneModule.cpp head/contrib/llvm/tools/clang/include/clang/AST/StmtCXX.h head/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def head/contrib/llvm/tools/clang/include/clang/Driver/Options.td head/contrib/llvm/tools/clang/include/clang/Serialization/ASTBitCodes.h head/contrib/llvm/tools/clang/lib/AST/ODRHash.cpp head/contrib/llvm/tools/clang/lib/AST/StmtCXX.cpp head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/OpenBSD.cpp head/contrib/llvm/tools/clang/lib/Headers/avx2intrin.h head/contrib/llvm/tools/clang/lib/Headers/avx512fintrin.h head/contrib/llvm/tools/clang/lib/Headers/avxintrin.h head/contrib/llvm/tools/clang/lib/Headers/float.h head/contrib/llvm/tools/clang/lib/Sema/Sema.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp head/contrib/llvm/tools/clang/lib/Serialization/ASTReaderStmt.cpp head/contrib/llvm/tools/clang/lib/Serialization/ASTWriterStmt.cpp head/lib/clang/include/clang/Basic/Version.inc head/lib/clang/include/lld/Config/Version.inc head/lib/clang/include/llvm/Support/VCSRevision.h Directory Properties: head/contrib/compiler-rt/ (props changed) head/contrib/libc++/ (props changed) head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) head/contrib/llvm/tools/lld/ (props changed) head/contrib/llvm/tools/lldb/ (props changed) Modified: head/contrib/libc++/include/__bsd_locale_defaults.h ============================================================================== --- head/contrib/libc++/include/__bsd_locale_defaults.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/libc++/include/__bsd_locale_defaults.h Wed Aug 9 17:32:39 2017 (r322320) @@ -15,6 +15,10 @@ #ifndef _LIBCPP_BSD_LOCALE_DEFAULTS_H #define _LIBCPP_BSD_LOCALE_DEFAULTS_H +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + #define __libcpp_mb_cur_max_l(loc) MB_CUR_MAX_L(loc) #define __libcpp_btowc_l(ch, loc) btowc_l(ch, loc) #define __libcpp_wctob_l(wch, loc) wctob_l(wch, loc) Modified: head/contrib/libc++/include/__bsd_locale_fallbacks.h ============================================================================== --- head/contrib/libc++/include/__bsd_locale_fallbacks.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/libc++/include/__bsd_locale_fallbacks.h Wed Aug 9 17:32:39 2017 (r322320) @@ -18,6 +18,10 @@ #include #include +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + _LIBCPP_BEGIN_NAMESPACE_STD inline _LIBCPP_ALWAYS_INLINE Modified: head/contrib/libc++/include/__locale ============================================================================== --- head/contrib/libc++/include/__locale Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/libc++/include/__locale Wed Aug 9 17:32:39 2017 (r322320) @@ -34,7 +34,7 @@ # include #elif defined(_NEWLIB_VERSION) # include -#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \ +#elif (defined(__APPLE__) || defined(__FreeBSD__) \ || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)) # include #elif defined(__Fuchsia__) Modified: head/contrib/libc++/include/mutex ============================================================================== --- head/contrib/libc++/include/mutex Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/libc++/include/mutex Wed Aug 9 17:32:39 2017 (r322320) @@ -116,7 +116,7 @@ class scoped_lock // C++17 (public) using mutex_type = Mutex; // If MutexTypes... consists of the single type Mutex explicit scoped_lock(MutexTypes&... m); - scoped_lock(MutexTypes&... m, adopt_lock_t); + scoped_lock(adopt_lock_t, MutexTypes&... m); ~scoped_lock(); scoped_lock(scoped_lock const&) = delete; scoped_lock& operator=(scoped_lock const&) = delete; @@ -500,7 +500,7 @@ class _LIBCPP_TEMPLATE_VIS scoped_lock<_Mutex> { (publ ~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();} _LIBCPP_INLINE_VISIBILITY - explicit scoped_lock(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) + explicit scoped_lock(adopt_lock_t, mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) : __m_(__m) {} scoped_lock(scoped_lock const&) = delete; @@ -522,7 +522,7 @@ class _LIBCPP_TEMPLATE_VIS scoped_lock (public) } _LIBCPP_INLINE_VISIBILITY - scoped_lock(_MArgs&... __margs, adopt_lock_t) + scoped_lock(adopt_lock_t, _MArgs&... __margs) : __t_(__margs...) { } Modified: head/contrib/libc++/include/sstream ============================================================================== --- head/contrib/libc++/include/sstream Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/libc++/include/sstream Wed Aug 9 17:32:39 2017 (r322320) @@ -249,7 +249,8 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_st template basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& __s, ios_base::openmode __wch) - : __hm_(0), + : __str_(__s.get_allocator()), + __hm_(0), __mode_(__wch) { str(__s); Modified: head/contrib/llvm/include/llvm/Analysis/ValueTracking.h ============================================================================== --- head/contrib/llvm/include/llvm/Analysis/ValueTracking.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/include/llvm/Analysis/ValueTracking.h Wed Aug 9 17:32:39 2017 (r322320) @@ -312,6 +312,12 @@ template class ArrayRef; const DataLayout &DL, LoopInfo *LI = nullptr, unsigned MaxLookup = 6); + /// This is a wrapper around GetUnderlyingObjects and adds support for basic + /// ptrtoint+arithmetic+inttoptr sequences. + void getUnderlyingObjectsForCodeGen(const Value *V, + SmallVectorImpl &Objects, + const DataLayout &DL); + /// Return true if the only users of this pointer are lifetime markers. bool onlyUsedByLifetimeMarkers(const Value *V); Modified: head/contrib/llvm/include/llvm/CodeGen/MachineFunction.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/MachineFunction.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/include/llvm/CodeGen/MachineFunction.h Wed Aug 9 17:32:39 2017 (r322320) @@ -661,6 +661,12 @@ class MachineFunction { (public) MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO, int64_t Offset, uint64_t Size); + /// Allocate a new MachineMemOperand by copying an existing one, + /// replacing only AliasAnalysis information. MachineMemOperands are owned + /// by the MachineFunction and need not be explicitly deallocated. + MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO, + const AAMDNodes &AAInfo); + using OperandCapacity = ArrayRecycler::Capacity; /// Allocate an array of MachineOperands. This is only intended for use by Modified: head/contrib/llvm/include/llvm/CodeGen/MachineInstr.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/MachineInstr.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/include/llvm/CodeGen/MachineInstr.h Wed Aug 9 17:32:39 2017 (r322320) @@ -379,6 +379,9 @@ class MachineInstr (public) return NumMemRefs == 1; } + /// Return the number of memory operands. + unsigned getNumMemOperands() const { return NumMemRefs; } + /// API for querying MachineInstr properties. They are the same as MCInstrDesc /// queries but they are bundle aware. Modified: head/contrib/llvm/lib/Analysis/ValueTracking.cpp ============================================================================== --- head/contrib/llvm/lib/Analysis/ValueTracking.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Analysis/ValueTracking.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -3277,6 +3277,69 @@ void llvm::GetUnderlyingObjects(Value *V, SmallVectorI } while (!Worklist.empty()); } +/// This is the function that does the work of looking through basic +/// ptrtoint+arithmetic+inttoptr sequences. +static const Value *getUnderlyingObjectFromInt(const Value *V) { + do { + if (const Operator *U = dyn_cast(V)) { + // If we find a ptrtoint, we can transfer control back to the + // regular getUnderlyingObjectFromInt. + if (U->getOpcode() == Instruction::PtrToInt) + return U->getOperand(0); + // If we find an add of a constant, a multiplied value, or a phi, it's + // likely that the other operand will lead us to the base + // object. We don't have to worry about the case where the + // object address is somehow being computed by the multiply, + // because our callers only care when the result is an + // identifiable object. + if (U->getOpcode() != Instruction::Add || + (!isa(U->getOperand(1)) && + Operator::getOpcode(U->getOperand(1)) != Instruction::Mul && + !isa(U->getOperand(1)))) + return V; + V = U->getOperand(0); + } else { + return V; + } + assert(V->getType()->isIntegerTy() && "Unexpected operand type!"); + } while (true); +} + +/// This is a wrapper around GetUnderlyingObjects and adds support for basic +/// ptrtoint+arithmetic+inttoptr sequences. +void llvm::getUnderlyingObjectsForCodeGen(const Value *V, + SmallVectorImpl &Objects, + const DataLayout &DL) { + SmallPtrSet Visited; + SmallVector Working(1, V); + do { + V = Working.pop_back_val(); + + SmallVector Objs; + GetUnderlyingObjects(const_cast(V), Objs, DL); + + for (Value *V : Objs) { + if (!Visited.insert(V).second) + continue; + if (Operator::getOpcode(V) == Instruction::IntToPtr) { + const Value *O = + getUnderlyingObjectFromInt(cast(V)->getOperand(0)); + if (O->getType()->isPointerTy()) { + Working.push_back(O); + continue; + } + } + // If GetUnderlyingObjects fails to find an identifiable object, + // getUnderlyingObjectsForCodeGen also fails for safety. + if (!isIdentifiedObject(V)) { + Objects.clear(); + return; + } + Objects.push_back(const_cast(V)); + } + } while (!Working.empty()); +} + /// Return true if the only users of this pointer are lifetime markers. bool llvm::onlyUsedByLifetimeMarkers(const Value *V) { for (const User *U : V->users()) { Modified: head/contrib/llvm/lib/CodeGen/BranchFolding.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/BranchFolding.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/CodeGen/BranchFolding.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -1475,13 +1475,14 @@ ReoptimizeBlock: bool PredAnalyzable = !TII->analyzeBranch(*Pred, PredTBB, PredFBB, PredCond, true); - if (PredAnalyzable && !PredCond.empty() && PredTBB == MBB) { + if (PredAnalyzable && !PredCond.empty() && PredTBB == MBB && + PredTBB != PredFBB) { // The predecessor has a conditional branch to this block which consists // of only a tail call. Try to fold the tail call into the conditional // branch. if (TII->canMakeTailCallConditional(PredCond, TailCall)) { // TODO: It would be nice if analyzeBranch() could provide a pointer - // to the branch insturction so replaceBranchWithTailCall() doesn't + // to the branch instruction so replaceBranchWithTailCall() doesn't // have to search for it. TII->replaceBranchWithTailCall(*Pred, PredCond, TailCall); ++NumTailCalls; Modified: head/contrib/llvm/lib/CodeGen/MachineFunction.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/MachineFunction.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/CodeGen/MachineFunction.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -330,6 +330,20 @@ MachineFunction::getMachineMemOperand(const MachineMem MMO->getOrdering(), MMO->getFailureOrdering()); } +MachineMemOperand * +MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO, + const AAMDNodes &AAInfo) { + MachinePointerInfo MPI = MMO->getValue() ? + MachinePointerInfo(MMO->getValue(), MMO->getOffset()) : + MachinePointerInfo(MMO->getPseudoValue(), MMO->getOffset()); + + return new (Allocator) + MachineMemOperand(MPI, MMO->getFlags(), MMO->getSize(), + MMO->getBaseAlignment(), AAInfo, + MMO->getRanges(), MMO->getSyncScopeID(), + MMO->getOrdering(), MMO->getFailureOrdering()); +} + MachineInstr::mmo_iterator MachineFunction::allocateMemRefsArray(unsigned long Num) { return Allocator.Allocate(Num); Modified: head/contrib/llvm/lib/CodeGen/MachineInstr.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/MachineInstr.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/CodeGen/MachineInstr.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -578,10 +578,8 @@ bool MachinePointerInfo::isDereferenceable(unsigned Si if (BasePtr == nullptr) return false; - return isDereferenceableAndAlignedPointer(BasePtr, 1, - APInt(DL.getPointerSize(), - Offset + Size), - DL); + return isDereferenceableAndAlignedPointer( + BasePtr, 1, APInt(DL.getPointerSizeInBits(), Offset + Size), DL); } /// getConstantPool - Return a MachinePointerInfo record that refers to the Modified: head/contrib/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -121,63 +121,6 @@ ScheduleDAGInstrs::ScheduleDAGInstrs(MachineFunction & SchedModel.init(ST.getSchedModel(), &ST, TII); } -/// This is the function that does the work of looking through basic -/// ptrtoint+arithmetic+inttoptr sequences. -static const Value *getUnderlyingObjectFromInt(const Value *V) { - do { - if (const Operator *U = dyn_cast(V)) { - // If we find a ptrtoint, we can transfer control back to the - // regular getUnderlyingObjectFromInt. - if (U->getOpcode() == Instruction::PtrToInt) - return U->getOperand(0); - // If we find an add of a constant, a multiplied value, or a phi, it's - // likely that the other operand will lead us to the base - // object. We don't have to worry about the case where the - // object address is somehow being computed by the multiply, - // because our callers only care when the result is an - // identifiable object. - if (U->getOpcode() != Instruction::Add || - (!isa(U->getOperand(1)) && - Operator::getOpcode(U->getOperand(1)) != Instruction::Mul && - !isa(U->getOperand(1)))) - return V; - V = U->getOperand(0); - } else { - return V; - } - assert(V->getType()->isIntegerTy() && "Unexpected operand type!"); - } while (true); -} - -/// This is a wrapper around GetUnderlyingObjects and adds support for basic -/// ptrtoint+arithmetic+inttoptr sequences. -static void getUnderlyingObjects(const Value *V, - SmallVectorImpl &Objects, - const DataLayout &DL) { - SmallPtrSet Visited; - SmallVector Working(1, V); - do { - V = Working.pop_back_val(); - - SmallVector Objs; - GetUnderlyingObjects(const_cast(V), Objs, DL); - - for (Value *V : Objs) { - if (!Visited.insert(V).second) - continue; - if (Operator::getOpcode(V) == Instruction::IntToPtr) { - const Value *O = - getUnderlyingObjectFromInt(cast(V)->getOperand(0)); - if (O->getType()->isPointerTy()) { - Working.push_back(O); - continue; - } - } - Objects.push_back(const_cast(V)); - } - } while (!Working.empty()); -} - /// If this machine instr has memory reference information and it can be tracked /// to a normal reference to a known object, return the Value for that object. static void getUnderlyingObjectsForInstr(const MachineInstr *MI, @@ -208,12 +151,10 @@ static void getUnderlyingObjectsForInstr(const Machine Objects.push_back(UnderlyingObjectsVector::value_type(PSV, MayAlias)); } else if (const Value *V = MMO->getValue()) { SmallVector Objs; - getUnderlyingObjects(V, Objs, DL); + getUnderlyingObjectsForCodeGen(V, Objs, DL); for (Value *V : Objs) { - if (!isIdentifiedObject(V)) - return false; - + assert(isIdentifiedObject(V)); Objects.push_back(UnderlyingObjectsVector::value_type(V, true)); } } else Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -99,6 +99,27 @@ LimitFPPrecision("limit-float-precision", // store [4096 x i8] %data, [4096 x i8]* %buffer static const unsigned MaxParallelChains = 64; +// True if the Value passed requires ABI mangling as it is a parameter to a +// function or a return value from a function which is not an intrinsic. +static bool isABIRegCopy(const Value * V) { + const bool IsRetInst = V && isa(V); + const bool IsCallInst = V && isa(V); + const bool IsInLineAsm = + IsCallInst && static_cast(V)->isInlineAsm(); + const bool IsIndirectFunctionCall = + IsCallInst && !IsInLineAsm && + !static_cast(V)->getCalledFunction(); + // It is possible that the call instruction is an inline asm statement or an + // indirect function call in which case the return value of + // getCalledFunction() would be nullptr. + const bool IsInstrinsicCall = + IsCallInst && !IsInLineAsm && !IsIndirectFunctionCall && + static_cast(V)->getCalledFunction()->getIntrinsicID() != + Intrinsic::not_intrinsic; + + return IsRetInst || (IsCallInst && (!IsInLineAsm && !IsInstrinsicCall)); +} + static SDValue getCopyFromPartsVector(SelectionDAG &DAG, const SDLoc &DL, const SDValue *Parts, unsigned NumParts, MVT PartVT, EVT ValueVT, const Value *V, @@ -1026,13 +1047,9 @@ SDValue SelectionDAGBuilder::getCopyFromRegs(const Val if (It != FuncInfo.ValueMap.end()) { unsigned InReg = It->second; - bool IsABIRegCopy = - V && ((isa(V) && - !(static_cast(V))->isInlineAsm()) || - isa(V)); RegsForValue RFV(*DAG.getContext(), DAG.getTargetLoweringInfo(), - DAG.getDataLayout(), InReg, Ty, IsABIRegCopy); + DAG.getDataLayout(), InReg, Ty, isABIRegCopy(V)); SDValue Chain = DAG.getEntryNode(); Result = RFV.getCopyFromRegs(DAG, FuncInfo, getCurSDLoc(), Chain, nullptr, V); @@ -1221,13 +1238,9 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value // If this is an instruction which fast-isel has deferred, select it now. if (const Instruction *Inst = dyn_cast(V)) { unsigned InReg = FuncInfo.InitializeRegForValue(Inst); - bool IsABIRegCopy = - V && ((isa(V) && - !(static_cast(V))->isInlineAsm()) || - isa(V)); RegsForValue RFV(*DAG.getContext(), TLI, DAG.getDataLayout(), InReg, - Inst->getType(), IsABIRegCopy); + Inst->getType(), isABIRegCopy(V)); SDValue Chain = DAG.getEntryNode(); return RFV.getCopyFromRegs(DAG, FuncInfo, getCurSDLoc(), Chain, nullptr, V); } @@ -8281,13 +8294,9 @@ SelectionDAGBuilder::CopyValueToVirtualRegister(const const TargetLowering &TLI = DAG.getTargetLoweringInfo(); // If this is an InlineAsm we have to match the registers required, not the // notional registers required by the type. - bool IsABIRegCopy = - V && ((isa(V) && - !(static_cast(V))->isInlineAsm()) || - isa(V)); RegsForValue RFV(V->getContext(), TLI, DAG.getDataLayout(), Reg, - V->getType(), IsABIRegCopy); + V->getType(), isABIRegCopy(V)); SDValue Chain = DAG.getEntryNode(); ISD::NodeType ExtendType = (FuncInfo.PreferredExtendType.find(V) == Modified: head/contrib/llvm/lib/CodeGen/StackColoring.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/StackColoring.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/CodeGen/StackColoring.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -37,6 +37,7 @@ #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/PseudoSourceValue.h" +#include "llvm/CodeGen/SelectionDAGNodes.h" #include "llvm/CodeGen/SlotIndexes.h" #include "llvm/CodeGen/StackProtector.h" #include "llvm/CodeGen/WinEHFuncInfo.h" @@ -889,6 +890,10 @@ void StackColoring::remapInstructions(DenseMap Allocas; + + // Keep a list of allocas which has been affected by the remap. + SmallPtrSet MergedAllocas; + for (const std::pair &SI : SlotRemap) { const AllocaInst *From = MFI->getObjectAllocation(SI.first); const AllocaInst *To = MFI->getObjectAllocation(SI.second); @@ -908,6 +913,10 @@ void StackColoring::remapInstructions(DenseMapadjustForColoring(From, To); @@ -939,13 +948,6 @@ void StackColoring::remapInstructions(DenseMap(MMO->getValue()); @@ -997,6 +999,48 @@ void StackColoring::remapInstructions(DenseMapallocateMemRefsArray(I.getNumMemOperands()); + unsigned MemOpIdx = 0; + bool ReplaceMemOps = false; + for (MachineMemOperand *MMO : I.memoperands()) { + // If this memory location can be a slot remapped here, + // we remove AA information. + bool MayHaveConflictingAAMD = false; + if (MMO->getAAInfo()) { + if (const Value *MMOV = MMO->getValue()) { + SmallVector Objs; + getUnderlyingObjectsForCodeGen(MMOV, Objs, MF->getDataLayout()); + + if (Objs.empty()) + MayHaveConflictingAAMD = true; + else + for (Value *V : Objs) { + // If this memory location comes from a known stack slot + // that is not remapped, we continue checking. + // Otherwise, we need to invalidate AA infomation. + const AllocaInst *AI = dyn_cast_or_null(V); + if (AI && MergedAllocas.count(AI)) { + MayHaveConflictingAAMD = true; + break; + } + } + } + } + if (MayHaveConflictingAAMD) { + NewMemOps[MemOpIdx++] = MF->getMachineMemOperand(MMO, AAMDNodes()); + ReplaceMemOps = true; + } + else + NewMemOps[MemOpIdx++] = MMO; + } + + // If any memory operand is updated, set memory references of + // this instruction. + if (ReplaceMemOps) + I.setMemRefs(std::make_pair(NewMemOps, I.getNumMemOperands())); } // Update the location of C++ catch objects for the MSVC personality routine. Modified: head/contrib/llvm/lib/IR/ConstantFold.cpp ============================================================================== --- head/contrib/llvm/lib/IR/ConstantFold.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/IR/ConstantFold.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -2097,15 +2097,19 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *Pointe // Subsequent evaluation would get confused and produce erroneous results. // // The following prohibits such a GEP from being formed by checking to see - // if the index is in-range with respect to an array or vector. + // if the index is in-range with respect to an array. + // TODO: This code may be extended to handle vectors as well. bool PerformFold = false; if (Idx0->isNullValue()) PerformFold = true; else if (LastI.isSequential()) if (ConstantInt *CI = dyn_cast(Idx0)) - PerformFold = - !LastI.isBoundedSequential() || - isIndexInRangeOfArrayType(LastI.getSequentialNumElements(), CI); + PerformFold = (!LastI.isBoundedSequential() || + isIndexInRangeOfArrayType( + LastI.getSequentialNumElements(), CI)) && + !CE->getOperand(CE->getNumOperands() - 1) + ->getType() + ->isVectorTy(); if (PerformFold) { SmallVector NewIndices; Modified: head/contrib/llvm/lib/Object/COFFImportFile.cpp ============================================================================== --- head/contrib/llvm/lib/Object/COFFImportFile.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Object/COFFImportFile.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -542,15 +542,12 @@ NewArchiveMember ObjectFactory::createWeakExternal(Str SymbolTable[2].Name.Offset.Offset = sizeof(uint32_t); //__imp_ String Table - if (Imp) { - SymbolTable[3].Name.Offset.Offset = sizeof(uint32_t) + Sym.size() + 7; - writeStringTable(Buffer, {std::string("__imp_").append(Sym), - std::string("__imp_").append(Weak)}); - } else { - SymbolTable[3].Name.Offset.Offset = sizeof(uint32_t) + Sym.size() + 1; - writeStringTable(Buffer, {Sym, Weak}); - } + StringRef Prefix = Imp ? "__imp_" : ""; + SymbolTable[3].Name.Offset.Offset = + sizeof(uint32_t) + Sym.size() + Prefix.size() + 1; append(Buffer, SymbolTable); + writeStringTable(Buffer, {(Prefix + Sym).str(), + (Prefix + Weak).str()}); // Copied here so we can still use writeStringTable char *Buf = Alloc.Allocate(Buffer.size()); Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -946,6 +946,18 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock & case AArch64::CMP_SWAP_128: return expandCMP_SWAP_128(MBB, MBBI, NextMBBI); + case AArch64::AESMCrrTied: + case AArch64::AESIMCrrTied: { + MachineInstrBuilder MIB = + BuildMI(MBB, MBBI, MI.getDebugLoc(), + TII->get(Opcode == AArch64::AESMCrrTied ? AArch64::AESMCrr : + AArch64::AESIMCrr)) + .add(MI.getOperand(0)) + .add(MI.getOperand(1)); + transferImpOps(MI, MIB, MIB); + MI.eraseFromParent(); + return true; + } } return false; } Modified: head/contrib/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -506,19 +506,23 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio return; } - auto CSStackSize = AFI->getCalleeSavedStackSize(); + bool IsWin64 = + Subtarget.isCallingConvWin64(MF.getFunction()->getCallingConv()); + unsigned FixedObject = IsWin64 ? alignTo(AFI->getVarArgsGPRSize(), 16) : 0; + + auto PrologueSaveSize = AFI->getCalleeSavedStackSize() + FixedObject; // All of the remaining stack allocations are for locals. - AFI->setLocalStackSize(NumBytes - CSStackSize); + AFI->setLocalStackSize(NumBytes - PrologueSaveSize); bool CombineSPBump = shouldCombineCSRLocalStackBump(MF, NumBytes); if (CombineSPBump) { emitFrameOffset(MBB, MBBI, DL, AArch64::SP, AArch64::SP, -NumBytes, TII, MachineInstr::FrameSetup); NumBytes = 0; - } else if (CSStackSize != 0) { + } else if (PrologueSaveSize != 0) { MBBI = convertCalleeSaveRestoreToSPPrePostIncDec(MBB, MBBI, DL, TII, - -CSStackSize); - NumBytes -= CSStackSize; + -PrologueSaveSize); + NumBytes -= PrologueSaveSize; } assert(NumBytes >= 0 && "Negative stack allocation size!?"); @@ -532,8 +536,9 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio ++MBBI; } if (HasFP) { - // Only set up FP if we actually need to. Frame pointer is fp = sp - 16. - int FPOffset = CSStackSize - 16; + // Only set up FP if we actually need to. Frame pointer is fp = + // sp - fixedobject - 16. + int FPOffset = AFI->getCalleeSavedStackSize() - 16; if (CombineSPBump) FPOffset += AFI->getLocalStackSize(); @@ -672,8 +677,8 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio if (HasFP) { // Define the current CFA rule to use the provided FP. unsigned Reg = RegInfo->getDwarfRegNum(FramePtr, true); - unsigned CFIIndex = MF.addFrameInst( - MCCFIInstruction::createDefCfa(nullptr, Reg, 2 * StackGrowth)); + unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa( + nullptr, Reg, 2 * StackGrowth - FixedObject)); BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) .addCFIIndex(CFIIndex) .setMIFlags(MachineInstr::FrameSetup); @@ -759,12 +764,16 @@ void AArch64FrameLowering::emitEpilogue(MachineFunctio // AArch64TargetLowering::LowerCall figures out ArgumentPopSize and keeps // it as the 2nd argument of AArch64ISD::TC_RETURN. - auto CSStackSize = AFI->getCalleeSavedStackSize(); + bool IsWin64 = + Subtarget.isCallingConvWin64(MF.getFunction()->getCallingConv()); + unsigned FixedObject = IsWin64 ? alignTo(AFI->getVarArgsGPRSize(), 16) : 0; + + auto PrologueSaveSize = AFI->getCalleeSavedStackSize() + FixedObject; bool CombineSPBump = shouldCombineCSRLocalStackBump(MF, NumBytes); - if (!CombineSPBump && CSStackSize != 0) + if (!CombineSPBump && PrologueSaveSize != 0) convertCalleeSaveRestoreToSPPrePostIncDec( - MBB, std::prev(MBB.getFirstTerminator()), DL, TII, CSStackSize); + MBB, std::prev(MBB.getFirstTerminator()), DL, TII, PrologueSaveSize); // Move past the restores of the callee-saved registers. MachineBasicBlock::iterator LastPopI = MBB.getFirstTerminator(); @@ -786,7 +795,7 @@ void AArch64FrameLowering::emitEpilogue(MachineFunctio return; } - NumBytes -= CSStackSize; + NumBytes -= PrologueSaveSize; assert(NumBytes >= 0 && "Negative stack allocation size!?"); if (!hasFP(MF)) { @@ -796,7 +805,7 @@ void AArch64FrameLowering::emitEpilogue(MachineFunctio if (RedZone && ArgumentPopSize == 0) return; - bool NoCalleeSaveRestore = CSStackSize == 0; + bool NoCalleeSaveRestore = PrologueSaveSize == 0; int StackRestoreBytes = RedZone ? 0 : NumBytes; if (NoCalleeSaveRestore) StackRestoreBytes += ArgumentPopSize; @@ -815,7 +824,8 @@ void AArch64FrameLowering::emitEpilogue(MachineFunctio // be able to save any instructions. if (MFI.hasVarSizedObjects() || AFI->isStackRealigned()) emitFrameOffset(MBB, LastPopI, DL, AArch64::SP, AArch64::FP, - -CSStackSize + 16, TII, MachineInstr::FrameDestroy); + -AFI->getCalleeSavedStackSize() + 16, TII, + MachineInstr::FrameDestroy); else if (NumBytes) emitFrameOffset(MBB, LastPopI, DL, AArch64::SP, AArch64::SP, NumBytes, TII, MachineInstr::FrameDestroy); @@ -845,7 +855,11 @@ int AArch64FrameLowering::resolveFrameIndexReference(c const AArch64RegisterInfo *RegInfo = static_cast( MF.getSubtarget().getRegisterInfo()); const AArch64FunctionInfo *AFI = MF.getInfo(); - int FPOffset = MFI.getObjectOffset(FI) + 16; + const AArch64Subtarget &Subtarget = MF.getSubtarget(); + bool IsWin64 = + Subtarget.isCallingConvWin64(MF.getFunction()->getCallingConv()); + unsigned FixedObject = IsWin64 ? alignTo(AFI->getVarArgsGPRSize(), 16) : 0; + int FPOffset = MFI.getObjectOffset(FI) + FixedObject + 16; int Offset = MFI.getObjectOffset(FI) + MFI.getStackSize(); bool isFixed = MFI.isFixedObjectIndex(FI); @@ -955,12 +969,6 @@ static void computeCalleeSaveRegisterPairs( (Count & 1) == 0) && "Odd number of callee-saved regs to spill!"); int Offset = AFI->getCalleeSavedStackSize(); - - unsigned GPRSaveSize = AFI->getVarArgsGPRSize(); - const AArch64Subtarget &Subtarget = MF.getSubtarget(); - bool IsWin64 = Subtarget.isCallingConvWin64(MF.getFunction()->getCallingConv()); - if (IsWin64) - Offset -= alignTo(GPRSaveSize, 16); for (unsigned i = 0; i < Count; ++i) { RegPairInfo RPI; Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -9586,8 +9586,8 @@ static bool performTBISimplification(SDValue Addr, SelectionDAG &DAG) { APInt DemandedMask = APInt::getLowBitsSet(64, 56); KnownBits Known; - TargetLowering::TargetLoweringOpt TLO(DAG, DCI.isBeforeLegalize(), - DCI.isBeforeLegalizeOps()); + TargetLowering::TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(), + !DCI.isBeforeLegalizeOps()); const TargetLowering &TLI = DAG.getTargetLoweringInfo(); if (TLI.SimplifyDemandedBits(Addr, DemandedMask, Known, TLO)) { DCI.CommitTargetLoweringOpt(TLO); Modified: head/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.td Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.td Wed Aug 9 17:32:39 2017 (r322320) @@ -37,6 +37,9 @@ def HasFullFP16 : Predicate<"Subtarget->hasFullFP AssemblerPredicate<"FeatureFullFP16", "fullfp16">; def HasSPE : Predicate<"Subtarget->hasSPE()">, AssemblerPredicate<"FeatureSPE", "spe">; +def HasFuseAES : Predicate<"Subtarget->hasFuseAES()">, + AssemblerPredicate<"FeatureFuseAES", + "fuse-aes">; def HasSVE : Predicate<"Subtarget->hasSVE()">, AssemblerPredicate<"FeatureSVE", "sve">; @@ -5303,6 +5306,31 @@ def AESErr : AESTiedInst<0b0100, "aese", int_aarch def AESDrr : AESTiedInst<0b0101, "aesd", int_aarch64_crypto_aesd>; def AESMCrr : AESInst< 0b0110, "aesmc", int_aarch64_crypto_aesmc>; def AESIMCrr : AESInst< 0b0111, "aesimc", int_aarch64_crypto_aesimc>; + +// Pseudo instructions for AESMCrr/AESIMCrr with a register constraint required +// for AES fusion on some CPUs. +let hasSideEffects = 0, mayStore = 0, mayLoad = 0 in { +def AESMCrrTied: Pseudo<(outs V128:$Rd), (ins V128:$Rn), [], "$Rn = $Rd">, + Sched<[WriteV]>; +def AESIMCrrTied: Pseudo<(outs V128:$Rd), (ins V128:$Rn), [], "$Rn = $Rd">, + Sched<[WriteV]>; +} + +// Only use constrained versions of AES(I)MC instructions if they are paired with +// AESE/AESD. +def : Pat<(v16i8 (int_aarch64_crypto_aesmc + (v16i8 (int_aarch64_crypto_aese (v16i8 V128:$src1), + (v16i8 V128:$src2))))), + (v16i8 (AESMCrrTied (v16i8 (AESErr (v16i8 V128:$src1), + (v16i8 V128:$src2)))))>, + Requires<[HasFuseAES]>; + +def : Pat<(v16i8 (int_aarch64_crypto_aesimc + (v16i8 (int_aarch64_crypto_aesd (v16i8 V128:$src1), + (v16i8 V128:$src2))))), + (v16i8 (AESIMCrrTied (v16i8 (AESDrr (v16i8 V128:$src1), + (v16i8 V128:$src2)))))>, + Requires<[HasFuseAES]>; def SHA1Crrr : SHATiedInstQSV<0b000, "sha1c", int_aarch64_crypto_sha1c>; def SHA1Prrr : SHATiedInstQSV<0b001, "sha1p", int_aarch64_crypto_sha1p>; Modified: head/contrib/llvm/lib/Target/AArch64/AArch64MacroFusion.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64MacroFusion.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/AArch64/AArch64MacroFusion.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -118,11 +118,13 @@ static bool shouldScheduleAdjacent(const TargetInstrIn // Fuse AES crypto operations. switch(SecondOpcode) { // AES encode. - case AArch64::AESMCrr : + case AArch64::AESMCrr: + case AArch64::AESMCrrTied: return FirstOpcode == AArch64::AESErr || FirstOpcode == AArch64::INSTRUCTION_LIST_END; // AES decode. case AArch64::AESIMCrr: + case AArch64::AESIMCrrTied: return FirstOpcode == AArch64::AESDrr || FirstOpcode == AArch64::INSTRUCTION_LIST_END; } Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -3984,6 +3984,13 @@ bool MatchingStackOffset(SDValue Arg, unsigned Offset, if (Offset != MFI.getObjectOffset(FI)) return false; + // If this is not byval, check that the argument stack object is immutable. + // inalloca and argument copy elision can create mutable argument stack + // objects. Byval objects can be mutated, but a byval call intends to pass the + // mutated memory. + if (!Flags.isByVal() && !MFI.isImmutableObjectIndex(FI)) + return false; + if (VA.getLocVT().getSizeInBits() > Arg.getValueSizeInBits()) { // If the argument location is wider than the argument type, check that any // extension flags match. @@ -30605,8 +30612,8 @@ static SDValue combineSelect(SDNode *N, SelectionDAG & assert(BitWidth >= 8 && BitWidth <= 64 && "Invalid mask size"); APInt DemandedMask(APInt::getSignMask(BitWidth)); KnownBits Known; - TargetLowering::TargetLoweringOpt TLO(DAG, DCI.isBeforeLegalize(), - DCI.isBeforeLegalizeOps()); + TargetLowering::TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(), + !DCI.isBeforeLegalizeOps()); if (TLI.ShrinkDemandedConstant(Cond, DemandedMask, TLO) || TLI.SimplifyDemandedBits(Cond, DemandedMask, Known, TLO)) { // If we changed the computation somewhere in the DAG, this change will Modified: head/contrib/llvm/lib/Target/X86/X86InstrSSE.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrSSE.td Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Target/X86/X86InstrSSE.td Wed Aug 9 17:32:39 2017 (r322320) @@ -3697,8 +3697,7 @@ let SchedRW = [WriteNop] in { // Pause. This "instruction" is encoded as "rep; nop", so even though it // was introduced with SSE2, it's backward compatible. def PAUSE : I<0x90, RawFrm, (outs), (ins), - "pause", [(int_x86_sse2_pause)], IIC_SSE_PAUSE>, - OBXS, Requires<[HasSSE2]>; + "pause", [(int_x86_sse2_pause)], IIC_SSE_PAUSE>, OBXS; } let SchedRW = [WriteFence] in { Modified: head/contrib/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -356,7 +356,7 @@ doPromotion(Function *F, SmallPtrSetImpl & // Just add all the struct element types. Type *AgTy = cast(I->getType())->getElementType(); Value *TheAlloca = new AllocaInst(AgTy, DL.getAllocaAddrSpace(), nullptr, - "", InsertPt); + I->getParamAlignment(), "", InsertPt); StructType *STy = cast(AgTy); Value *Idxs[2] = {ConstantInt::get(Type::getInt32Ty(F->getContext()), 0), nullptr}; Modified: head/contrib/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -756,7 +756,8 @@ struct FunctionStackPoisoner : public InstVisitor llvm::CloneModule( SmallVector, 1> MDs; I->getAllMetadata(MDs); for (auto MD : MDs) - GV->addMetadata(MD.first, *MapMetadata(MD.second, VMap)); + GV->addMetadata(MD.first, + *MapMetadata(MD.second, VMap, RF_MoveDistinctMDs)); copyComdat(GV, &*I); } Modified: head/contrib/llvm/tools/clang/include/clang/AST/StmtCXX.h ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/AST/StmtCXX.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/include/clang/AST/StmtCXX.h Wed Aug 9 17:32:39 2017 (r322320) @@ -317,6 +317,7 @@ class CoroutineBodyStmt final unsigned NumParams; friend class ASTStmtReader; + friend class ASTReader; friend TrailingObjects; Stmt **getStoredStmts() { return getTrailingObjects(); } @@ -347,6 +348,8 @@ class CoroutineBodyStmt final public: static CoroutineBodyStmt *Create(const ASTContext &C, CtorArgs const &Args); + static CoroutineBodyStmt *Create(const ASTContext &C, EmptyShell, + unsigned NumParams); bool hasDependentPromiseType() const { return getPromiseDecl()->getType()->isDependentType(); @@ -443,6 +446,8 @@ class CoreturnStmt : public Stmt { (public) SubStmts[SubStmt::Operand] = Operand; SubStmts[SubStmt::PromiseCall] = PromiseCall; } + + CoreturnStmt(EmptyShell) : CoreturnStmt({}, {}, {}) {} SourceLocation getKeywordLoc() const { return CoreturnLoc; } Modified: head/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def Wed Aug 9 17:32:39 2017 (r322320) @@ -338,8 +338,8 @@ TARGET_BUILTIN(__builtin_ia32_lfence, "v", "", "sse2") TARGET_HEADER_BUILTIN(_mm_lfence, "v", "h", "emmintrin.h", ALL_LANGUAGES, "sse2") TARGET_BUILTIN(__builtin_ia32_mfence, "v", "", "sse2") TARGET_HEADER_BUILTIN(_mm_mfence, "v", "h", "emmintrin.h", ALL_LANGUAGES, "sse2") -TARGET_BUILTIN(__builtin_ia32_pause, "v", "", "sse2") -TARGET_HEADER_BUILTIN(_mm_pause, "v", "h", "emmintrin.h", ALL_LANGUAGES, "sse2") +TARGET_BUILTIN(__builtin_ia32_pause, "v", "", "") +TARGET_HEADER_BUILTIN(_mm_pause, "v", "h", "emmintrin.h", ALL_LANGUAGES, "") TARGET_BUILTIN(__builtin_ia32_pmuludq128, "V2LLiV4iV4i", "", "sse2") TARGET_BUILTIN(__builtin_ia32_psraw128, "V8sV8sV8s", "", "sse2") TARGET_BUILTIN(__builtin_ia32_psrad128, "V4iV4iV4i", "", "sse2") Modified: head/contrib/llvm/tools/clang/include/clang/Driver/Options.td ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Driver/Options.td Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/include/clang/Driver/Options.td Wed Aug 9 17:32:39 2017 (r322320) @@ -2019,10 +2019,6 @@ def mdspr2 : Flag<["-"], "mdspr2">, Group; def mno_dspr2 : Flag<["-"], "mno-dspr2">, Group; def msingle_float : Flag<["-"], "msingle-float">, Group; def mdouble_float : Flag<["-"], "mdouble-float">, Group; -def mmadd4 : Flag<["-"], "mmadd4">, Group, - HelpText<"Enable the generation of 4-operand madd.s, madd.d and related instructions.">; -def mno_madd4 : Flag<["-"], "mno-madd4">, Group, - HelpText<"Disable the generation of 4-operand madd.s, madd.d and related instructions.">; def mmsa : Flag<["-"], "mmsa">, Group, HelpText<"Enable MSA ASE (MIPS only)">; def mno_msa : Flag<["-"], "mno-msa">, Group, Modified: head/contrib/llvm/tools/clang/include/clang/Serialization/ASTBitCodes.h ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Serialization/ASTBitCodes.h Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/include/clang/Serialization/ASTBitCodes.h Wed Aug 9 17:32:39 2017 (r322320) @@ -1545,9 +1545,14 @@ namespace clang { // ARC EXPR_OBJC_BRIDGED_CAST, // ObjCBridgedCastExpr - + STMT_MS_DEPENDENT_EXISTS, // MSDependentExistsStmt - EXPR_LAMBDA // LambdaExpr + EXPR_LAMBDA, // LambdaExpr + STMT_COROUTINE_BODY, + STMT_CORETURN, + EXPR_COAWAIT, + EXPR_COYIELD, + EXPR_DEPENDENT_COAWAIT, }; /// \brief The kinds of designators that can occur in a Modified: head/contrib/llvm/tools/clang/lib/AST/ODRHash.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/AST/ODRHash.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/lib/AST/ODRHash.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -378,8 +378,12 @@ void ODRHash::AddCXXRecordDecl(const CXXRecordDecl *Re assert(Record && Record->hasDefinition() && "Expected non-null record to be a definition."); - if (isa(Record)) { - return; + const DeclContext *DC = Record; + while (DC) { + if (isa(DC)) { + return; + } + DC = DC->getParent(); } AddDecl(Record); Modified: head/contrib/llvm/tools/clang/lib/AST/StmtCXX.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/AST/StmtCXX.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/lib/AST/StmtCXX.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -96,6 +96,20 @@ CoroutineBodyStmt *CoroutineBodyStmt::Create( return new (Mem) CoroutineBodyStmt(Args); } +CoroutineBodyStmt *CoroutineBodyStmt::Create(const ASTContext &C, EmptyShell, + unsigned NumParams) { + std::size_t Size = totalSizeToAlloc( + CoroutineBodyStmt::FirstParamMove + NumParams); + + void *Mem = C.Allocate(Size, alignof(CoroutineBodyStmt)); + auto *Result = new (Mem) CoroutineBodyStmt(CtorArgs()); + Result->NumParams = NumParams; + auto *ParamBegin = Result->getStoredStmts() + SubStmt::FirstParamMove; + std::uninitialized_fill(ParamBegin, ParamBegin + NumParams, + static_cast(nullptr)); + return Result; +} + CoroutineBodyStmt::CoroutineBodyStmt(CoroutineBodyStmt::CtorArgs const &Args) : Stmt(CoroutineBodyStmtClass), NumParams(Args.ParamMoves.size()) { Stmt **SubStmts = getStoredStmts(); Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Wed Aug 9 16:37:37 2017 (r322319) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Wed Aug 9 17:32:39 2017 (r322320) @@ -8050,7 +8050,6 @@ class MipsTargetInfo : public TargetInfo { NoDSP, DSP1, DSP2 } DspRev; bool HasMSA; - bool DisableMadd4; protected: bool HasFP64; @@ -8061,7 +8060,7 @@ class MipsTargetInfo : public TargetInfo { : TargetInfo(Triple), IsMips16(false), IsMicromips(false), IsNan2008(false), IsSingleFloat(false), IsNoABICalls(false), CanUseBSDABICalls(false), FloatABI(HardFloat), DspRev(NoDSP), - HasMSA(false), DisableMadd4(false), HasFP64(false) { + HasMSA(false), HasFP64(false) { TheCXXABI.set(TargetCXXABI::GenericMIPS); setABI((getTriple().getArch() == llvm::Triple::mips || @@ -8307,9 +8306,6 @@ class MipsTargetInfo : public TargetInfo { if (HasMSA) Builder.defineMacro("__mips_msa", Twine(1)); - if (DisableMadd4) - Builder.defineMacro("__mips_no_madd4", Twine(1)); - Builder.defineMacro("_MIPS_SZPTR", Twine(getPointerWidth(0))); Builder.defineMacro("_MIPS_SZINT", Twine(getIntWidth())); Builder.defineMacro("_MIPS_SZLONG", Twine(getLongWidth())); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Aug 9 17:34:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 070F7DD1DF5; Wed, 9 Aug 2017 17:34:50 +0000 (UTC) (envelope-from decui@microsoft.com) Received: from APC01-PU1-obe.outbound.protection.outlook.com (mail-pu1apc01on0119.outbound.protection.outlook.com [104.47.126.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 43E8E7E419; Wed, 9 Aug 2017 17:34:48 +0000 (UTC) (envelope-from decui@microsoft.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sIm3DsVbZhJrqNPJQ/E9H/Tdbt+CJ/sVtn9J6ffIxXw=; b=ZdJHsNOdV3xrlbEKuXz3678zbkAPth8txhE663tUZ5P6HviA7bAwERIr0tXJFcJiQ9ivUztttxpU7//kTIJcSQa52CBewfXigy1Oin0exCIYNQQ9i1hnHYQscx67zIGFzKcpn950K0KHIbheQDYPSU/q2GEfCNQp7nihGv8OKdQ= Received: from KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM (10.170.167.145) by KL1P15301MB0086.APCP153.PROD.OUTLOOK.COM (10.170.164.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1362.4; Wed, 9 Aug 2017 17:34:41 +0000 Received: from KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM ([10.170.167.145]) by KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM ([10.170.167.145]) with mapi id 15.01.1362.006; Wed, 9 Aug 2017 17:34:40 +0000 From: Dexuan Cui To: Jung-uk Kim , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" CC: Yanmin Qiao , Hongjiang Zhang Subject: RE: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 Thread-Topic: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 Thread-Index: AQHTDbgLhcqLEIRH8UKGIazjERHYm6J7bHlAgADatwCAAAhoUA== Date: Wed, 9 Aug 2017 17:34:39 +0000 Message-ID: References: <201708050656.v756uk48076256@repo.freebsd.org> <331d02b4-a315-70e5-7fe9-2e767554a148@FreeBSD.org> In-Reply-To: <331d02b4-a315-70e5-7fe9-2e767554a148@FreeBSD.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Ref=https://api.informationprotection.azure.com/api/72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=decui@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2017-08-09T10:34:37.2441482-07:00; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General authentication-results: spf=none (sender IP is ) smtp.mailfrom=decui@microsoft.com; x-originating-ip: [167.220.1.135] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; KL1P15301MB0086; 6:urOIieXJtcvY9zexK44h8PLW01uRwmKDqi3+kNNri6UdPCaoYx+lOWRo9zz4wa1cRg9tfXyY1NdsVmpIC44EAF155sTHDgCTwfiQt/gIgxDuy3ebyjGG+Aut8RHti9zvtGhqblCgExtsjNg5nQuf7ySkcDT3vTdJRnn2+k9G02Ks7zHw+GEqy2A7GMsQ/s5R81P34NKIjch5c0xZF4a/IAZmHNR2zdC5/8HVRp0sxuzPHwutQYiyVytLUj++e67wXyHsG3CgN9DzFOprkE8pvq+K5xWGwS4wlnRWCRorrq+g7iSKd1HnpZ4ULFlwpP0iwd3rwHoQOpvVjM8nnFH2xg==; 5:WaXXGW5IU1OHGQh3Vz3TjisN42kspDF1Mnw/Wa3+nJH+BlpvJeriM1scBrLXRJUCA6rqyuCK4+7bdotJougyDvLy21wxakf02Z0Qvh1JMKn6h7A7dfvmCTOGJZCWZbnj/XO/P3qFgahttNKT8IWVkQ==; 24:tVp0HLhA1qWXLrlJ5PtlpE+AyzaEEtYmV0en1su2ta/oQMwgAqS9kXPS4ZKg+jW9hj4YiICle0NXbE5J5jT6kcn7i1xtqU3nKBw4r6PvtCk=; 7:yp160NEANd/AiV+SW7KMRc35RIxt11SoWUo5bnP+aUBFZXursks7+2pED+31hL1n32iGc3DOTDC4RFtAhDHjg6+pR58qXNxpdaw5goaIIG1aQEB8i3QymK4Tdexxtyqep1TypyvCyvypx6ZNt9CZqpccmlxUYJuaIdq57JB/qjNzllzlP5+1UB/PDsmIwT1Wsxizz33etEHdEUKvSw2BxPYDBJspXvctv6KlgrQdvoc= x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10019020)(6009001)(39850400002)(39410400002)(39840400002)(39450400003)(39400400002)(39860400002)(47760400005)(189002)(199003)(51914003)(24454002)(68736007)(8936002)(5005710100001)(107886003)(38730400002)(2906002)(2201001)(14454004)(33656002)(2501003)(2900100001)(5890100001)(6246003)(3846002)(6116002)(102836003)(189998001)(10090500001)(7736002)(229853002)(77096006)(4326008)(450100002)(6506006)(6436002)(8990500004)(5660300001)(25786009)(76176999)(54356999)(81166006)(50986999)(66066001)(10290500003)(86612001)(54906002)(53546010)(2950100002)(3280700002)(305945005)(3660700001)(7696004)(106356001)(8676002)(81156014)(74316002)(53936002)(105586002)(86362001)(101416001)(97736004)(9686003)(55016002)(478600001); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1P15301MB0086; H:KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-correlation-id: 763ac651-0cb2-4701-d959-08d4df4cea21 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:KL1P15301MB0086; x-ms-traffictypediagnostic: KL1P15301MB0086: x-exchange-antispam-report-test: UriScan:(89211679590171); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(61425038)(6040450)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(6055026)(61426038)(61427038)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123562025)(20161123560025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:KL1P15301MB0086; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:KL1P15301MB0086; x-forefront-prvs: 0394259C80 received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Aug 2017 17:34:39.5520 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1P15301MB0086 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 17:34:50 -0000 PiBGcm9tOiBvd25lci1zcmMtY29tbWl0dGVyc0BmcmVlYnNkLm9yZyBbbWFpbHRvOm93bmVyLXNy Yy0NCj4gY29tbWl0dGVyc0BmcmVlYnNkLm9yZ10gT24gQmVoYWxmIE9mIEp1bmctdWsgS2ltDQo+ IFNlbnQ6IFdlZG5lc2RheSwgQXVndXN0IDksIDIwMTcgMTA6MDMNCj4gVG86IERleHVhbiBDdWkg PGRlY3VpQG1pY3Jvc29mdC5jb20+OyBzcmMtY29tbWl0dGVyc0BmcmVlYnNkLm9yZzsgc3ZuLXNy Yy0NCj4gYWxsQGZyZWVic2Qub3JnOyBzdm4tc3JjLWhlYWRAZnJlZWJzZC5vcmcNCj4gQ2M6IFlh bm1pbiBRaWFvIDx5YXFpYUBtaWNyb3NvZnQuY29tPjsgSG9uZ2ppYW5nIFpoYW5nDQo+IDxob256 aGFuQG1pY3Jvc29mdC5jb20+DQo+IFN1YmplY3Q6IFJlOiBzdm4gY29tbWl0OiByMzIyMDc2IC0g aW4gaGVhZC9zeXM6IGFtZDY0L2FtZDY0IGkzODYvaTM4Ng0KPiB4ODYvaW5jbHVkZSB4ODYveDg2 DQo+IA0KPiBPbiAwOC8wOS8yMDE3IDAwOjA5LCBEZXh1YW4gQ3VpIHdyb3RlOg0KPiA+IEhpIGpr aW0sDQo+ID4gVGhlIHBhdGNoIGJyZWFrcyBGcmVlQlNEIFZNIG9uIEh5cGVyLVYuDQo+ID4NCj4g PiBpZGVudGlmeV9oeXBlcnZpc29yKCkgaXMgbW92ZWQgZnJvbSBpZGVudGlmeV9jcHUoKSB0byBh biBlYXJsaWVyIHBsYWNlLCBidXQgdGhlDQo+IGdsb2JhbA0KPiA+IHZhcmlhYmxlIGNwdV9mZWF0 dXJlMiB1c2VkIGJ5IHRoZSBmdW5jdGlvbiBpcyBzdGlsbCBpbml0aWFsaXplZCBpbiBpZGVudGlm eV9jcHUoKS4NCj4gPg0KPiA+IEknbSBub3Qgc3VyZSBhYm91dCB0aGUgYmFja2dyb3VuZCBvZiB5 b3VyIHBhdGNoLiBDYW4geW91IHBsZWFzZSBoYXZlIGEgbG9vaz8NCj4gDQo+IENhbiB5b3UgcGxl YXNlIHRlc3QgdGhlIGF0dGFjaGVkIHBhdGNoPw0KPiANCj4gSnVuZy11ayBLaW0NCg0KSSB0ZXN0 ZWQgdGhlIHBhdGNoIG9ubHkgd2l0aCBteSAgeDg2XzY0IFZNLCBhbmQgaXQgd29ya2VkLiAgDQoN ClRoYW5rcyBmb3IgdGhlIHF1aWNrIGZpeCENCg0KLS0gRGV4dWFuDQoNCg== From owner-svn-src-all@freebsd.org Wed Aug 9 17:48:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7859DDD2254; Wed, 9 Aug 2017 17:48:39 +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 mx1.freebsd.org (Postfix) with ESMTPS id 476917EADF; Wed, 9 Aug 2017 17:48:39 +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 v79HmcPN019967; Wed, 9 Aug 2017 17:48:38 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79HmcP7019966; Wed, 9 Aug 2017 17:48:38 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201708091748.v79HmcP7019966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 9 Aug 2017 17:48:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322321 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 17:48:39 -0000 Author: glebius Date: Wed Aug 9 17:48:38 2017 New Revision: 322321 URL: https://svnweb.freebsd.org/changeset/base/322321 Log: Plug uninitialized stack variable leak in sendfile(2). Reported by: Ilja Van Sprundel Submitted by: Domagoj Stolfa MFC after: 1 week Security: uninitialized stack variable leak Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Wed Aug 9 17:32:39 2017 (r322320) +++ head/sys/kern/kern_sendfile.c Wed Aug 9 17:48:38 2017 (r322321) @@ -945,6 +945,7 @@ sendfile(struct thread *td, struct sendfile_args *uap, if (uap->offset < 0) return (EINVAL); + sbytes = 0; hdr_uio = trl_uio = NULL; if (uap->hdtr != NULL) { From owner-svn-src-all@freebsd.org Wed Aug 9 18:06:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F547DD2792; Wed, 9 Aug 2017 18:06: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 mx1.freebsd.org (Postfix) with ESMTPS id 27F757F38A; Wed, 9 Aug 2017 18:06: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 v79I6SHH028197; Wed, 9 Aug 2017 18:06:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79I6SAf028195; Wed, 9 Aug 2017 18:06:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708091806.v79I6SAf028195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 9 Aug 2017 18:06:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322322 - head/lib/libusb X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libusb X-SVN-Commit-Revision: 322322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 18:06:29 -0000 Author: kevans Date: Wed Aug 9 18:06:27 2017 New Revision: 322322 URL: https://svnweb.freebsd.org/changeset/base/322322 Log: libusb(3): Expose device caps as libusb_bos_descriptor::dev_capability Some libusb consumers in Linux-land (in this case, libusb4java) expect a dev_capability member that they can use to enumerate the device capabilities. No particular layout is expected of this, just that it can be traversed using the bLength member until bNumDeviceCapabilities are read and that the consumer may then use one of the libusb_get_*_descriptor methods to extract specific (usb 2.0 vs. ss) capability information. In collaboration with: hselasky Reviewed by: hselasky Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D11494 Modified: head/lib/libusb/libusb.h head/lib/libusb/libusb10_desc.c Modified: head/lib/libusb/libusb.h ============================================================================== --- head/lib/libusb/libusb.h Wed Aug 9 17:48:38 2017 (r322321) +++ head/lib/libusb/libusb.h Wed Aug 9 18:06:27 2017 (r322322) @@ -388,6 +388,7 @@ typedef struct libusb_bos_descriptor { uint8_t bNumDeviceCapabilities; struct libusb_usb_2_0_device_capability_descriptor *usb_2_0_ext_cap; struct libusb_ss_usb_device_capability_descriptor *ss_usb_cap; + struct libusb_bos_dev_capability_descriptor **dev_capability; } libusb_bos_descriptor __aligned(sizeof(void *)); typedef struct libusb_usb_2_0_extension_descriptor { Modified: head/lib/libusb/libusb10_desc.c ============================================================================== --- head/lib/libusb/libusb10_desc.c Wed Aug 9 17:48:38 2017 (r322321) +++ head/lib/libusb/libusb10_desc.c Wed Aug 9 18:06:27 2017 (r322322) @@ -433,6 +433,7 @@ libusb_parse_bos_descriptor(const void *buf, int len, struct libusb_bos_descriptor *ptr; struct libusb_usb_2_0_device_capability_descriptor *dcap_20 = NULL; struct libusb_ss_usb_device_capability_descriptor *ss_cap = NULL; + uint8_t index = 0; if (buf == NULL || bos == NULL || len < 1) return (LIBUSB_ERROR_INVALID_PARAM); @@ -453,7 +454,8 @@ libusb_parse_bos_descriptor(const void *buf, int len, break; if (dlen >= LIBUSB_DT_BOS_SIZE && - dtype == LIBUSB_DT_BOS) { + dtype == LIBUSB_DT_BOS && + ptr == NULL) { ptr = malloc(sizeof(*ptr) + sizeof(*dcap_20) + sizeof(*ss_cap)); @@ -470,6 +472,11 @@ libusb_parse_bos_descriptor(const void *buf, int len, ptr->bNumDeviceCapabilities = ((const uint8_t *)buf)[4]; ptr->usb_2_0_ext_cap = NULL; ptr->ss_usb_cap = NULL; + ptr->dev_capability = calloc(ptr->bNumDeviceCapabilities, sizeof(void *)); + if (ptr->dev_capability == NULL) { + free(ptr); + return (LIBUSB_ERROR_NO_MEM); + } dcap_20 = (void *)(ptr + 1); ss_cap = (void *)(dcap_20 + 1); @@ -477,6 +484,15 @@ libusb_parse_bos_descriptor(const void *buf, int len, if (dlen >= 3 && ptr != NULL && dtype == LIBUSB_DT_DEVICE_CAPABILITY) { + if (index != ptr->bNumDeviceCapabilities) { + ptr->dev_capability[index] = malloc(dlen); + if (ptr->dev_capability[index] == NULL) { + libusb_free_bos_descriptor(ptr); + return LIBUSB_ERROR_NO_MEM; + } + memcpy(ptr->dev_capability[index], buf, dlen); + index++; + } switch (((const uint8_t *)buf)[2]) { case LIBUSB_USB_2_0_EXTENSION_DEVICE_CAPABILITY: if (ptr->usb_2_0_ext_cap != NULL || dcap_20 == NULL) @@ -523,8 +539,11 @@ libusb_parse_bos_descriptor(const void *buf, int len, buf = ((const uint8_t *)buf) + dlen; len -= dlen; } - if (ptr != NULL) + + if (ptr != NULL) { + ptr->bNumDeviceCapabilities = index; return (0); /* success */ + } return (LIBUSB_ERROR_IO); } @@ -532,9 +551,14 @@ libusb_parse_bos_descriptor(const void *buf, int len, void libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos) { + uint8_t i; + if (bos == NULL) return; + for (i = 0; i != bos->bNumDeviceCapabilities; i++) + free(bos->dev_capability[i]); + free(bos->dev_capability); free(bos); } From owner-svn-src-all@freebsd.org Wed Aug 9 18:09:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE555DD2815; Wed, 9 Aug 2017 18:09:10 +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 mx1.freebsd.org (Postfix) with ESMTPS id A6F5C7F520; Wed, 9 Aug 2017 18:09:10 +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 v79I99Tm028334; Wed, 9 Aug 2017 18:09:09 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79I9924028330; Wed, 9 Aug 2017 18:09:09 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201708091809.v79I9924028330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 9 Aug 2017 18:09:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322323 - in head/sys: amd64/amd64 i386/include x86/include x86/x86 X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/include x86/include x86/x86 X-SVN-Commit-Revision: 322323 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 18:09:10 -0000 Author: jkim Date: Wed Aug 9 18:09:09 2017 New Revision: 322323 URL: https://svnweb.freebsd.org/changeset/base/322323 Log: Split identify_cpu() into two functions for amd64 as we do for i386. This reduces diff between amd64 and i386. Also, it fixes a regression introduced in r322076, i.e., identify_hypervisor() failed to identify some hypervisors. This function assumes cpu_feature2 is already initialized. Reported by: dexuan Tested by: dexuan Modified: head/sys/amd64/amd64/machdep.c head/sys/i386/include/md_var.h head/sys/x86/include/x86_var.h head/sys/x86/x86/identcpu.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Wed Aug 9 18:06:27 2017 (r322322) +++ head/sys/amd64/amd64/machdep.c Wed Aug 9 18:09:09 2017 (r322323) @@ -1537,6 +1537,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) kmdp = init_ops.parse_preload_data(modulep); + identify_cpu(); identify_hypervisor(); /* Init basic tunables, hz etc */ @@ -1643,7 +1644,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) != NULL) vty_set_preferred(VTY_VT); - identify_cpu(); /* Final stage of CPU initialization */ + finishidentcpu(); /* Final stage of CPU initialization */ initializecpu(); /* Initialize CPU registers */ initializecpucache(); Modified: head/sys/i386/include/md_var.h ============================================================================== --- head/sys/i386/include/md_var.h Wed Aug 9 18:06:27 2017 (r322322) +++ head/sys/i386/include/md_var.h Wed Aug 9 18:09:09 2017 (r322323) @@ -59,7 +59,6 @@ void doreti_popl_es(void) __asm(__STRING(doreti_popl_e void doreti_popl_es_fault(void) __asm(__STRING(doreti_popl_es_fault)); void doreti_popl_fs(void) __asm(__STRING(doreti_popl_fs)); void doreti_popl_fs_fault(void) __asm(__STRING(doreti_popl_fs_fault)); -void finishidentcpu(void); void fill_based_sd(struct segment_descriptor *sdp, uint32_t base); void i686_pagezero(void *addr); void sse2_pagezero(void *addr); Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Wed Aug 9 18:06:27 2017 (r322322) +++ head/sys/x86/include/x86_var.h Wed Aug 9 18:09:09 2017 (r322323) @@ -115,6 +115,7 @@ void cpu_probe_amdc1e(void); void cpu_setregs(void); void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); +void finishidentcpu(void); void identify_cpu(void); void identify_hypervisor(void); void initializecpu(void); Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Wed Aug 9 18:06:27 2017 (r322322) +++ head/sys/x86/x86/identcpu.c Wed Aug 9 18:09:09 2017 (r322323) @@ -1372,23 +1372,12 @@ fix_cpuid(void) return (false); } -/* - * Final stage of CPU identification. - */ -#ifdef __i386__ +#ifdef __amd64__ void -finishidentcpu(void) -#else -void identify_cpu(void) -#endif { - u_int regs[4], cpu_stdext_disable; -#ifdef __i386__ - u_char ccr3; -#endif + u_int regs[4]; -#ifdef __amd64__ do_cpuid(0, regs); cpu_high = regs[0]; ((u_int *)&cpu_vendor)[0] = regs[1]; @@ -1401,6 +1390,18 @@ identify_cpu(void) cpu_procinfo = regs[1]; cpu_feature = regs[3]; cpu_feature2 = regs[2]; +} +#endif + +/* + * Final stage of CPU identification. + */ +void +finishidentcpu(void) +{ + u_int regs[4], cpu_stdext_disable; +#ifdef __i386__ + u_char ccr3; #endif cpu_vendor_id = find_cpu_vendor_id(); From owner-svn-src-all@freebsd.org Wed Aug 9 18:15:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03475DD2B01; Wed, 9 Aug 2017 18:15:09 +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 mx1.freebsd.org (Postfix) with ESMTPS id C41877FA4D; Wed, 9 Aug 2017 18:15: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 v79IF7LR032138; Wed, 9 Aug 2017 18:15:07 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79IF7Nx032137; Wed, 9 Aug 2017 18:15:07 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708091815.v79IF7Nx032137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 9 Aug 2017 18:15:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322324 - head/lib/libcapsicum X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libcapsicum X-SVN-Commit-Revision: 322324 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 18:15:09 -0000 Author: kevans Date: Wed Aug 9 18:15:07 2017 New Revision: 322324 URL: https://svnweb.freebsd.org/changeset/base/322324 Log: capsicum_helpers: Add FIODTYPE to default ioctls allowed FIODTYPE will be needed by hexdump(1) to speed up the -s flag on devices that should be able to support fseek(3); specifically, in an attempt to correct for the fact that most tape drives don't support seeking yet don't indicate as such when fseeko(3) is invoked. Related: D10939 Reviewed by: cem, emaste, oshogbo Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D10937 Modified: head/lib/libcapsicum/capsicum_helpers.h Modified: head/lib/libcapsicum/capsicum_helpers.h ============================================================================== --- head/lib/libcapsicum/capsicum_helpers.h Wed Aug 9 18:09:09 2017 (r322323) +++ head/lib/libcapsicum/capsicum_helpers.h Wed Aug 9 18:15:07 2017 (r322324) @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -47,7 +48,7 @@ static __inline int caph_limit_stream(int fd, int flags) { cap_rights_t rights; - unsigned long cmds[] = { TIOCGETA, TIOCGWINSZ }; + unsigned long cmds[] = { TIOCGETA, TIOCGWINSZ, FIODTYPE }; cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL); From owner-svn-src-all@freebsd.org Wed Aug 9 18:23:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8977DD2D8E; Wed, 9 Aug 2017 18:23:47 +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 mx1.freebsd.org (Postfix) with ESMTPS id 738F77FF40; Wed, 9 Aug 2017 18:23:47 +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 v79INkUG036151; Wed, 9 Aug 2017 18:23:46 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79INktO036150; Wed, 9 Aug 2017 18:23:46 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708091823.v79INktO036150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 9 Aug 2017 18:23:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322325 - head/bin/cat X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/bin/cat X-SVN-Commit-Revision: 322325 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 18:23:47 -0000 Author: emaste Date: Wed Aug 9 18:23:46 2017 New Revision: 322325 URL: https://svnweb.freebsd.org/changeset/base/322325 Log: cat: fix build with -DNO_UDOM_SUPPORT Sponsored by: The FreeBSD Foundation Modified: head/bin/cat/cat.c Modified: head/bin/cat/cat.c ============================================================================== --- head/bin/cat/cat.c Wed Aug 9 18:15:07 2017 (r322324) +++ head/bin/cat/cat.c Wed Aug 9 18:23:46 2017 (r322325) @@ -51,12 +51,12 @@ __FBSDID("$FreeBSD$"); #ifndef NO_UDOM_SUPPORT #include #include -#include #include #endif #include #include +#include #include #include #include From owner-svn-src-all@freebsd.org Wed Aug 9 19:09:25 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FDE8DD3A3D; Wed, 9 Aug 2017 19:09:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4543781879; Wed, 9 Aug 2017 19:09:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79J9Owt053567; Wed, 9 Aug 2017 19:09:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79J9N0U053557; Wed, 9 Aug 2017 19:09:23 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708091909.v79J9N0U053557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 9 Aug 2017 19:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322326 - in head/contrib/llvm/tools/lldb: include/lldb/Target source/Plugins/ABI/SysV-i386 source/Plugins/Platform/FreeBSD source/Plugins/Platform/NetBSD source/Plugins/Platform/OpenBS... X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/contrib/llvm/tools/lldb: include/lldb/Target source/Plugins/ABI/SysV-i386 source/Plugins/Platform/FreeBSD source/Plugins/Platform/NetBSD source/Plugins/Platform/OpenBSD source/Plugins/Process/... X-SVN-Commit-Revision: 322326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 19:09:25 -0000 Author: emaste Date: Wed Aug 9 19:09:23 2017 New Revision: 322326 URL: https://svnweb.freebsd.org/changeset/base/322326 Log: lldb: Make i386-*-freebsd expression work on JIT path * Enable i386 ABI creation for freebsd * Added an extra argument in ABISysV_i386::PrepareTrivialCall for mmap syscall * Unlike linux, the last argument of mmap is actually 64-bit(off_t). This requires us to push an additional word for the higher order bits. * Prior to this change, ktrace dump will show mmap failures due to invalid argument coming from the 6th mmap argument. Submitted by: Karnajit Wangkhem Differential Revision: https://reviews.llvm.org/D34776 Modified: head/contrib/llvm/tools/lldb/include/lldb/Target/Platform.h head/contrib/llvm/tools/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h head/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp head/contrib/llvm/tools/lldb/source/Target/Platform.cpp Modified: head/contrib/llvm/tools/lldb/include/lldb/Target/Platform.h ============================================================================== --- head/contrib/llvm/tools/lldb/include/lldb/Target/Platform.h Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/include/lldb/Target/Platform.h Wed Aug 9 19:09:23 2017 (r322326) @@ -53,6 +53,7 @@ class PlatformProperties : public Properties { (public }; typedef std::shared_ptr PlatformPropertiesSP; +typedef llvm::SmallVector MmapArgList; //---------------------------------------------------------------------- /// @class Platform Platform.h "lldb/Target/Platform.h" @@ -628,8 +629,11 @@ class Platform : public PluginInterface { (public) virtual Status Unlink(const FileSpec &file_spec); - virtual uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags); + virtual MmapArgList GetMmapArgumentList(const ArchSpec &arch, + lldb::addr_t addr, + lldb::addr_t length, + unsigned prot, unsigned flags, + lldb::addr_t fd, lldb::addr_t offset); virtual bool GetSupportsRSync() { return m_supports_rsync; } Modified: head/contrib/llvm/tools/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp Wed Aug 9 19:09:23 2017 (r322326) @@ -206,7 +206,7 @@ ABISP ABISysV_i386::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; if ((arch.GetTriple().getArch() == llvm::Triple::x86) && - arch.GetTriple().isOSLinux()) { + (arch.GetTriple().isOSLinux() || arch.GetTriple().isOSFreeBSD())) { if (!g_abi_sp) g_abi_sp.reset(new ABISysV_i386(process_sp)); return g_abi_sp; Modified: head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Wed Aug 9 19:09:23 2017 (r322326) @@ -314,13 +314,19 @@ void PlatformFreeBSD::CalculateTrapHandlerSymbolNames( m_trap_handlers.push_back(ConstString("_sigtramp")); } -uint64_t PlatformFreeBSD::ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags) { +MmapArgList PlatformFreeBSD::GetMmapArgumentList(const ArchSpec &arch, + addr_t addr, addr_t length, + unsigned prot, unsigned flags, + addr_t fd, addr_t offset) { uint64_t flags_platform = 0; if (flags & eMmapFlagsPrivate) flags_platform |= MAP_PRIVATE; if (flags & eMmapFlagsAnon) flags_platform |= MAP_ANON; - return flags_platform; + + MmapArgList args({addr, length, prot, flags_platform, fd, offset}); + if (arch.GetTriple().getArch() == llvm::Triple::x86) + args.push_back(0); + return args; } Modified: head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h Wed Aug 9 19:09:23 2017 (r322326) @@ -61,8 +61,10 @@ class PlatformFreeBSD : public PlatformPOSIX { (public void CalculateTrapHandlerSymbolNames() override; - uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags) override; + MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr, + lldb::addr_t length, unsigned prot, + unsigned flags, lldb::addr_t fd, + lldb::addr_t offset) override; private: DISALLOW_COPY_AND_ASSIGN(PlatformFreeBSD); Modified: head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp Wed Aug 9 19:09:23 2017 (r322326) @@ -420,13 +420,17 @@ void PlatformNetBSD::CalculateTrapHandlerSymbolNames() m_trap_handlers.push_back(ConstString("_sigtramp")); } -uint64_t PlatformNetBSD::ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags) { +MmapArgList PlatformNetBSD::GetMmapArgumentList(const ArchSpec &arch, + addr_t addr, addr_t length, + unsigned prot, unsigned flags, + addr_t fd, addr_t offset) { uint64_t flags_platform = 0; if (flags & eMmapFlagsPrivate) flags_platform |= MAP_PRIVATE; if (flags & eMmapFlagsAnon) flags_platform |= MAP_ANON; - return flags_platform; + + MmapArgList args({addr, length, prot, flags_platform, fd, offset}); + return args; } Modified: head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h Wed Aug 9 19:09:23 2017 (r322326) @@ -59,8 +59,10 @@ class PlatformNetBSD : public PlatformPOSIX { (public) void CalculateTrapHandlerSymbolNames() override; - uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags) override; + MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr, + lldb::addr_t length, unsigned prot, + unsigned flags, lldb::addr_t fd, + lldb::addr_t offset) override; private: DISALLOW_COPY_AND_ASSIGN(PlatformNetBSD); Modified: head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp Wed Aug 9 19:09:23 2017 (r322326) @@ -219,5 +219,7 @@ uint64_t PlatformOpenBSD::ConvertMmapFlagsToPlatform(c flags_platform |= MAP_PRIVATE; if (flags & eMmapFlagsAnon) flags_platform |= MAP_ANON; - return flags_platform; + + MmapArgList args({addr, length, prot, flags_platform, fd, offset}); + return args; } Modified: head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h Wed Aug 9 19:09:23 2017 (r322326) @@ -53,8 +53,10 @@ class PlatformOpenBSD : public PlatformPOSIX { (public void CalculateTrapHandlerSymbolNames() override; - uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags) override; + MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr, + lldb::addr_t length, unsigned prot, + unsigned flags, lldb::addr_t fd, + lldb::addr_t offset) override; private: DISALLOW_COPY_AND_ASSIGN(PlatformOpenBSD); Modified: head/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp Wed Aug 9 19:09:23 2017 (r322326) @@ -64,7 +64,7 @@ bool lldb_private::InferiorCallMmap(Process *process, options.SetTimeout(std::chrono::milliseconds(500)); options.SetTrapExceptions(false); - addr_t prot_arg, flags_arg = 0; + addr_t prot_arg; if (prot == eMmapProtNone) prot_arg = PROT_NONE; else { @@ -77,11 +77,6 @@ bool lldb_private::InferiorCallMmap(Process *process, prot_arg |= PROT_WRITE; } - const ArchSpec arch = process->GetTarget().GetArchitecture(); - flags_arg = - process->GetTarget().GetPlatform()->ConvertMmapFlagsToPlatform(arch, - flags); - AddressRange mmap_range; if (sc.GetAddressRange(range_scope, 0, use_inline_block_range, mmap_range)) { @@ -89,7 +84,10 @@ bool lldb_private::InferiorCallMmap(Process *process, process->GetTarget().GetScratchClangASTContext(); CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); - lldb::addr_t args[] = {addr, length, prot_arg, flags_arg, fd, offset}; + const ArchSpec arch = process->GetTarget().GetArchitecture(); + MmapArgList args = + process->GetTarget().GetPlatform()->GetMmapArgumentList( + arch, addr, length, prot_arg, flags, fd, offset); lldb::ThreadPlanSP call_plan_sp( new ThreadPlanCallFunction(*thread, mmap_range.GetBaseAddress(), clang_void_ptr_type, args, options)); Modified: head/contrib/llvm/tools/lldb/source/Target/Platform.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Target/Platform.cpp Wed Aug 9 18:23:46 2017 (r322325) +++ head/contrib/llvm/tools/lldb/source/Target/Platform.cpp Wed Aug 9 19:09:23 2017 (r322326) @@ -1316,14 +1316,18 @@ Status Platform::Unlink(const FileSpec &path) { return error; } -uint64_t Platform::ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags) { +MmapArgList Platform::GetMmapArgumentList(const ArchSpec &arch, addr_t addr, + addr_t length, unsigned prot, + unsigned flags, addr_t fd, + addr_t offset) { uint64_t flags_platform = 0; if (flags & eMmapFlagsPrivate) flags_platform |= MAP_PRIVATE; if (flags & eMmapFlagsAnon) flags_platform |= MAP_ANON; - return flags_platform; + + MmapArgList args({addr, length, prot, flags_platform, fd, offset}); + return args; } lldb_private::Status Platform::RunShellCommand( From owner-svn-src-all@freebsd.org Wed Aug 9 19:16:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CF40DD3DB9; Wed, 9 Aug 2017 19:16:56 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0658081EDE; Wed, 9 Aug 2017 19:16:55 +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 v79JGtGj057402; Wed, 9 Aug 2017 19:16:55 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79JGsL4057398; Wed, 9 Aug 2017 19:16:54 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708091916.v79JGsL4057398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 9 Aug 2017 19:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322327 - in head: . release/packages X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in head: . release/packages X-SVN-Commit-Revision: 322327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 19:16:56 -0000 Author: gjb Date: Wed Aug 9 19:16:54 2017 New Revision: 322327 URL: https://svnweb.freebsd.org/changeset/base/322327 Log: Add a dependency on the kernel package for the runtime package. The idea here is that, provided upstream pkg(8) maintainers accept the proposed change, the kernel.ucl will contain a post-install script causing pkg(8) to emit a message informing to reboot the system after the kernel is upgraded using 'pkg upgrade', so the new userland is installed on the running new kernel. At present, this functionality does not exist in pkg(8), but will help ensure the upgrade path follows that from UPDATING. To work around this for now, evaluate ASSUME_ALWAYS_YES, and prompt the user if they wish to proceed if not set to true. Since there is a kernel dependency, and a non-GENERIC kernel may be in use, update Makefile.inc1 to replace '%KERNCONF%' in the runtime.ucl with the first-built kernel set either via command line or in make.conf(5). MFC after: 5 days Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 head/release/packages/kernel.ucl head/release/packages/runtime.ucl Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Aug 9 19:09:23 2017 (r322326) +++ head/Makefile.inc1 Wed Aug 9 19:16:54 2017 (r322327) @@ -1618,7 +1618,10 @@ create-world-package-${pkgname}: .PHONY @awk -F\" ' \ /^name/ { printf("===> Creating %s-", $$2); next } \ /^version/ { print $$2; next } \ - ' ${WSTAGEDIR}/${pkgname}.ucl ; \ + ' ${WSTAGEDIR}/${pkgname}.ucl ; + @if [ "${pkgname}" == "runtime" ]; then \ + sed -i '' -e "s/%KERNCONF%/${INSTALLKERNEL:tl}/" ${WSTAGEDIR}/${pkgname}.ucl ; \ + fi ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \ create -M ${WSTAGEDIR}/${pkgname}.ucl \ -p ${WSTAGEDIR}/${pkgname}.plist \ Modified: head/release/packages/kernel.ucl ============================================================================== --- head/release/packages/kernel.ucl Wed Aug 9 19:09:23 2017 (r322326) +++ head/release/packages/kernel.ucl Wed Aug 9 19:16:54 2017 (r322327) @@ -16,6 +16,39 @@ desc = < Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C55B0DD4ECF; Wed, 9 Aug 2017 19:58:39 +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 mx1.freebsd.org (Postfix) with ESMTPS id 98491841F3; Wed, 9 Aug 2017 19:58:39 +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 v79Jwc1V075399; Wed, 9 Aug 2017 19:58:38 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79JwcLk075398; Wed, 9 Aug 2017 19:58:38 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201708091958.v79JwcLk075398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 9 Aug 2017 19:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322328 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 322328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 19:58:39 -0000 Author: ae Date: Wed Aug 9 19:58:38 2017 New Revision: 322328 URL: https://svnweb.freebsd.org/changeset/base/322328 Log: Make user supplied data checks a bit stricter. key_msg2sp() is used for parsing data from setsockopt(IP[V6]_IPSEC_POLICY) call. This socket option is usually used to configure IPsec bypass for socket. Only privileged user can set this socket option. The message syntax is described here http://www.kame.net/newsletter/20021210/ and our libipsec is usually used to create the correct request. Add additional checks: * that sadb_x_ipsecrequest_len is not out of bounds of user supplied buffer * that src/dst's sa_len is the same * that 2*sa_len is not out of bounds of user supplied buffer * that 2*sa_len fits into bounds of sadb_x_ipsecrequest Reported by: Ilja van Sprundel MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11796 Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Wed Aug 9 19:16:54 2017 (r322327) +++ head/sys/netipsec/key.c Wed Aug 9 19:58:38 2017 (r322328) @@ -1403,7 +1403,8 @@ key_msg2sp(struct sadb_x_policy *xpl0, size_t len, int while (tlen > 0) { /* length check */ - if (xisr->sadb_x_ipsecrequest_len < sizeof(*xisr)) { + if (xisr->sadb_x_ipsecrequest_len < sizeof(*xisr) || + xisr->sadb_x_ipsecrequest_len > tlen) { ipseclog((LOG_DEBUG, "%s: invalid ipsecrequest " "length.\n", __func__)); key_freesp(&newsp); @@ -1517,10 +1518,12 @@ key_msg2sp(struct sadb_x_policy *xpl0, size_t len, int if (xisr->sadb_x_ipsecrequest_len > sizeof(*xisr)) { struct sockaddr *paddr; + len = tlen - sizeof(*xisr); paddr = (struct sockaddr *)(xisr + 1); /* validity check */ - if (paddr->sa_len - > sizeof(isr->saidx.src)) { + if (len < sizeof(struct sockaddr) || + len < 2 * paddr->sa_len || + paddr->sa_len > sizeof(isr->saidx.src)) { ipseclog((LOG_DEBUG, "%s: invalid " "request address length.\n", __func__)); @@ -1528,13 +1531,26 @@ key_msg2sp(struct sadb_x_policy *xpl0, size_t len, int *error = EINVAL; return NULL; } + /* + * Request length should be enough to keep + * source and destination addresses. + */ + if (xisr->sadb_x_ipsecrequest_len < + sizeof(*xisr) + 2 * paddr->sa_len) { + ipseclog((LOG_DEBUG, "%s: invalid " + "ipsecrequest length.\n", + __func__)); + key_freesp(&newsp); + *error = EINVAL; + return (NULL); + } bcopy(paddr, &isr->saidx.src, paddr->sa_len); paddr = (struct sockaddr *)((caddr_t)paddr + paddr->sa_len); /* validity check */ - if (paddr->sa_len - > sizeof(isr->saidx.dst)) { + if (paddr->sa_len != + isr->saidx.src.sa.sa_len) { ipseclog((LOG_DEBUG, "%s: invalid " "request address length.\n", __func__)); From owner-svn-src-all@freebsd.org Wed Aug 9 20:13:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A65CDD5342; Wed, 9 Aug 2017 20:13:51 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 D151A84AAD; Wed, 9 Aug 2017 20:13:50 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79KDnT1083325; Wed, 9 Aug 2017 20:13:49 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79KDnup083324; Wed, 9 Aug 2017 20:13:49 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708092013.v79KDnup083324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Wed, 9 Aug 2017 20:13:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322329 - head/sys/boot/i386/boot2 X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/boot/i386/boot2 X-SVN-Commit-Revision: 322329 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 20:13:51 -0000 Author: rlibby Date: Wed Aug 9 20:13:49 2017 New Revision: 322329 URL: https://svnweb.freebsd.org/changeset/base/322329 Log: i386/boot2: -fno-asynchronous-unwind-tables for gcc The amd64 build of boot2 was failing with gcc 6.3.0 due to being more than 1 kB too large. It was apparently generating a .eh_frame section which was not being removed by objcopy -S. The .eh_frame section seems to be mandatory per the amd64 ABI, but boot2 is compiled for i386 (uses -m32), and therefore should be optional in this context. Suppress generation of .eh_frame with the -fno-asynchronous-unwind-tables flag to gcc. This saves 1348 bytes (the limit is 7680 bytes). Reviewed by: dim, imp Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11928 Modified: head/sys/boot/i386/boot2/Makefile Modified: head/sys/boot/i386/boot2/Makefile ============================================================================== --- head/sys/boot/i386/boot2/Makefile Wed Aug 9 19:58:38 2017 (r322328) +++ head/sys/boot/i386/boot2/Makefile Wed Aug 9 20:13:49 2017 (r322329) @@ -38,6 +38,7 @@ CFLAGS= -fomit-frame-pointer \ -Winline CFLAGS.gcc+= -Os \ + -fno-asynchronous-unwind-tables \ --param max-inline-insns-single=100 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201 CFLAGS.gcc+= -mno-align-long-strings From owner-svn-src-all@freebsd.org Wed Aug 9 21:44:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D162DD6AA7; Wed, 9 Aug 2017 21:44:56 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4661C2B0E; Wed, 9 Aug 2017 21:44:56 +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 v79LitAF020167; Wed, 9 Aug 2017 21:44:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79Litsf020166; Wed, 9 Aug 2017 21:44:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201708092144.v79Litsf020166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 9 Aug 2017 21:44:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322330 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322330 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 21:44:56 -0000 Author: kevans Date: Wed Aug 9 21:44:55 2017 New Revision: 322330 URL: https://svnweb.freebsd.org/changeset/base/322330 Log: Add myself to calendar.freebsd Requested by: mckusick Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D11936 Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Wed Aug 9 20:13:49 2017 (r322329) +++ head/usr.bin/calendar/calendars/calendar.freebsd Wed Aug 9 21:44:55 2017 (r322330) @@ -343,6 +343,7 @@ 09/22 Bryan Drewery born in San Diego, California, United States, 1984 09/23 Martin Matuska born in Bratislava, Slovakia, 1979 09/24 Larry Rosenman born in Queens, New York, United States, 1957 +09/27 Kyle Evans born in Oklahoma City, Oklahoma, United States, 1991 09/27 Neil Blakey-Milner born in Port Elizabeth, South Africa, 1978 09/27 Renato Botelho born in Araras, Sao Paulo, Brazil, 1979 09/28 Greg Lehey born in Melbourne, Victoria, Australia, 1948 From owner-svn-src-all@freebsd.org Wed Aug 9 22:18:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12A43DD7250; Wed, 9 Aug 2017 22:18:51 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 BBABF3921; Wed, 9 Aug 2017 22:18:50 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79MInII032029; Wed, 9 Aug 2017 22:18:49 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79MInEd032026; Wed, 9 Aug 2017 22:18:49 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201708092218.v79MInEd032026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Wed, 9 Aug 2017 22:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322331 - in head/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Group: head X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: in head/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Commit-Revision: 322331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 22:18:51 -0000 Author: davidcs Date: Wed Aug 9 22:18:49 2017 New Revision: 322331 URL: https://svnweb.freebsd.org/changeset/base/322331 Log: Provide compile to choose receive processing in either Ithread or Taskqueue Thread. Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c head/sys/dev/qlnx/qlnxe/qlnx_ver.h head/sys/modules/qlnx/qlnxe/Makefile Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_os.c Wed Aug 9 21:44:55 2017 (r322330) +++ head/sys/dev/qlnx/qlnxe/qlnx_os.c Wed Aug 9 22:18:49 2017 (r322331) @@ -397,10 +397,14 @@ qlnx_fp_taskqueue(void *context, int pending) struct ifnet *ifp; struct mbuf *mp; int ret = -1; + struct thread *cthread; + +#ifdef QLNX_RCV_IN_TASKQ int lro_enable; int rx_int = 0, total_rx_count = 0; - struct thread *cthread; +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ + fp = context; if (fp == NULL) @@ -419,55 +423,60 @@ qlnx_fp_taskqueue(void *context, int pending) ifp = ha->ifp; - lro_enable = ha->ifp->if_capenable & IFCAP_LRO; +#ifdef QLNX_RCV_IN_TASKQ + { + lro_enable = ifp->if_capenable & IFCAP_LRO; - rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); + rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); - if (rx_int) { - fp->rx_pkts += rx_int; - total_rx_count += rx_int; - } + if (rx_int) { + fp->rx_pkts += rx_int; + total_rx_count += rx_int; + } #ifdef QLNX_SOFT_LRO - { - struct lro_ctrl *lro; + { + struct lro_ctrl *lro; + + lro = &fp->rxq->lro; - lro = &fp->rxq->lro; + if (lro_enable && total_rx_count) { - if (lro_enable && total_rx_count) { - #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) - if (ha->dbg_trace_lro_cnt) { - if (lro->lro_mbuf_count & ~1023) - fp->lro_cnt_1024++; - else if (lro->lro_mbuf_count & ~511) - fp->lro_cnt_512++; - else if (lro->lro_mbuf_count & ~255) - fp->lro_cnt_256++; - else if (lro->lro_mbuf_count & ~127) - fp->lro_cnt_128++; - else if (lro->lro_mbuf_count & ~63) - fp->lro_cnt_64++; - } - tcp_lro_flush_all(lro); + if (ha->dbg_trace_lro_cnt) { + if (lro->lro_mbuf_count & ~1023) + fp->lro_cnt_1024++; + else if (lro->lro_mbuf_count & ~511) + fp->lro_cnt_512++; + else if (lro->lro_mbuf_count & ~255) + fp->lro_cnt_256++; + else if (lro->lro_mbuf_count & ~127) + fp->lro_cnt_128++; + else if (lro->lro_mbuf_count & ~63) + fp->lro_cnt_64++; + } + tcp_lro_flush_all(lro); #else - struct lro_entry *queued; + struct lro_entry *queued; - while ((!SLIST_EMPTY(&lro->lro_active))) { - queued = SLIST_FIRST(&lro->lro_active); - SLIST_REMOVE_HEAD(&lro->lro_active, next); - tcp_lro_flush(lro, queued); - } + while ((!SLIST_EMPTY(&lro->lro_active))) { + queued = SLIST_FIRST(&lro->lro_active); + SLIST_REMOVE_HEAD(&lro->lro_active, next); + tcp_lro_flush(lro, queued); + } #endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ + } } - } #endif /* #ifdef QLNX_SOFT_LRO */ - ecore_sb_update_sb_idx(fp->sb_info); - rmb(); + ecore_sb_update_sb_idx(fp->sb_info); + rmb(); + } +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ + mtx_lock(&fp->tx_mtx); if (((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != @@ -477,10 +486,6 @@ qlnx_fp_taskqueue(void *context, int pending) goto qlnx_fp_taskqueue_exit; } -// for (tc = 0; tc < ha->num_tc; tc++) { -// (void)qlnx_tx_int(ha, fp, fp->txq[tc]); -// } - mp = drbr_peek(ifp, fp->tx_br); while (mp != NULL) { @@ -516,13 +521,11 @@ qlnx_fp_taskqueue(void *context, int pending) mp = drbr_peek(ifp, fp->tx_br); } -// for (tc = 0; tc < ha->num_tc; tc++) { -// (void)qlnx_tx_int(ha, fp, fp->txq[tc]); -// } - mtx_unlock(&fp->tx_mtx); qlnx_fp_taskqueue_exit: + +#ifdef QLNX_RCV_IN_TASKQ if (rx_int) { if (fp->fp_taskqueue != NULL) taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); @@ -532,6 +535,7 @@ qlnx_fp_taskqueue_exit: } ecore_sb_ack(fp->sb_info, IGU_INT_ENABLE, 1); } +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ QL_DPRINT2(ha, "exit ret = %d\n", ret); return; @@ -4262,6 +4266,7 @@ next_cqe: /* don't consume bd rx buffer */ return rx_pkt; } + /* * fast path interrupt */ @@ -4292,9 +4297,82 @@ qlnx_fp_isr(void *arg) if (fp == NULL) { ha->err_fp_null++; } else { + +#ifdef QLNX_RCV_IN_TASKQ ecore_sb_ack(fp->sb_info, IGU_INT_DISABLE, 0); if (fp->fp_taskqueue != NULL) taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); +#else + int rx_int = 0, total_rx_count = 0; + int lro_enable, tc; + + lro_enable = ha->ifp->if_capenable & IFCAP_LRO; + + ecore_sb_ack(fp->sb_info, IGU_INT_DISABLE, 0); + + do { + for (tc = 0; tc < ha->num_tc; tc++) { + if (mtx_trylock(&fp->tx_mtx)) { + qlnx_tx_int(ha, fp, fp->txq[tc]); + mtx_unlock(&fp->tx_mtx); + } + } + + rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, + lro_enable); + + if (rx_int) { + fp->rx_pkts += rx_int; + total_rx_count += rx_int; + } + + } while (rx_int); + + +#ifdef QLNX_SOFT_LRO + { + struct lro_ctrl *lro; + + lro = &fp->rxq->lro; + + if (lro_enable && total_rx_count) { + +#if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) + +#ifdef QLNX_TRACE_LRO_CNT + if (lro->lro_mbuf_count & ~1023) + fp->lro_cnt_1024++; + else if (lro->lro_mbuf_count & ~511) + fp->lro_cnt_512++; + else if (lro->lro_mbuf_count & ~255) + fp->lro_cnt_256++; + else if (lro->lro_mbuf_count & ~127) + fp->lro_cnt_128++; + else if (lro->lro_mbuf_count & ~63) + fp->lro_cnt_64++; +#endif /* #ifdef QLNX_TRACE_LRO_CNT */ + + tcp_lro_flush_all(lro); + +#else + struct lro_entry *queued; + + while ((!SLIST_EMPTY(&lro->lro_active))) { + queued = SLIST_FIRST(&lro->lro_active); + SLIST_REMOVE_HEAD(&lro->lro_active, \ + next); + tcp_lro_flush(lro, queued); + } +#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ + } + } +#endif /* #ifdef QLNX_SOFT_LRO */ + + ecore_sb_update_sb_idx(fp->sb_info); + rmb(); + ecore_sb_ack(fp->sb_info, IGU_INT_ENABLE, 1); + +#endif /* #ifdef QLNX_RCV_IN_TASKQ */ } return; Modified: head/sys/dev/qlnx/qlnxe/qlnx_ver.h ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_ver.h Wed Aug 9 21:44:55 2017 (r322330) +++ head/sys/dev/qlnx/qlnxe/qlnx_ver.h Wed Aug 9 22:18:49 2017 (r322331) @@ -39,5 +39,5 @@ #define QLNX_VERSION_MAJOR 1 #define QLNX_VERSION_MINOR 4 -#define QLNX_VERSION_BUILD 5 +#define QLNX_VERSION_BUILD 6 Modified: head/sys/modules/qlnx/qlnxe/Makefile ============================================================================== --- head/sys/modules/qlnx/qlnxe/Makefile Wed Aug 9 21:44:55 2017 (r322330) +++ head/sys/modules/qlnx/qlnxe/Makefile Wed Aug 9 22:18:49 2017 (r322331) @@ -65,5 +65,6 @@ CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/includ #CFLAGS += -DQLNX_SOFT_LRO #CFLAGS += -DQLNX_QSORT_LRO #CFLAGS += -DQLNX_MAX_COALESCE +#CFLAGS += -DQLNX_RCV_IN_TASKQ CWARNFLAGS+= -Wno-cast-qual From owner-svn-src-all@freebsd.org Wed Aug 9 22:58:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 762B2DD7B35; Wed, 9 Aug 2017 22:58:43 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 425EE63C36; Wed, 9 Aug 2017 22:58:43 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79Mwg2u048248; Wed, 9 Aug 2017 22:58:42 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79Mwg0o048246; Wed, 9 Aug 2017 22:58:42 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708092258.v79Mwg0o048246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Wed, 9 Aug 2017 22:58:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322332 - in head: contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src lib/libc/stdlib/jemalloc X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: in head: contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src lib/libc/stdlib/jemalloc X-SVN-Commit-Revision: 322332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 09 Aug 2017 22:58:43 -0000 Author: rlibby Date: Wed Aug 9 22:58:42 2017 New Revision: 322332 URL: https://svnweb.freebsd.org/changeset/base/322332 Log: Pick 'Remove external linkage for spin_adaptive' from upstream jemalloc Apply the changes from upstream jemalloc 048c6679. This is actually not quite a cherry pick due to makefile difference and because FreeBSD does not carry the msvc project files which were also modified in that commit. Approved by: jasone (maintainer), markj (mentor) Sponsored by: Dell EMC Isilon Deleted: head/contrib/jemalloc/src/spin.c Modified: head/contrib/jemalloc/include/jemalloc/internal/spin.h head/lib/libc/stdlib/jemalloc/Makefile.inc Modified: head/contrib/jemalloc/include/jemalloc/internal/spin.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/spin.h Wed Aug 9 22:18:49 2017 (r322331) +++ head/contrib/jemalloc/include/jemalloc/internal/spin.h Wed Aug 9 22:58:42 2017 (r322332) @@ -1,19 +1,13 @@ #ifndef JEMALLOC_INTERNAL_SPIN_H #define JEMALLOC_INTERNAL_SPIN_H -#ifdef JEMALLOC_SPIN_C_ -# define SPIN_INLINE extern inline -#else -# define SPIN_INLINE inline -#endif - #define SPIN_INITIALIZER {0U} typedef struct { unsigned iteration; } spin_t; -SPIN_INLINE void +static inline void spin_adaptive(spin_t *spin) { volatile uint32_t i; Modified: head/lib/libc/stdlib/jemalloc/Makefile.inc ============================================================================== --- head/lib/libc/stdlib/jemalloc/Makefile.inc Wed Aug 9 22:18:49 2017 (r322331) +++ head/lib/libc/stdlib/jemalloc/Makefile.inc Wed Aug 9 22:58:42 2017 (r322332) @@ -5,7 +5,7 @@ JEMALLOCSRCS:= jemalloc.c arena.c background_thread.c base.c bitmap.c ckh.c \ ctl.c extent.c extent_dss.c extent_mmap.c hash.c hooks.c large.c \ malloc_io.c mutex.c mutex_pool.c nstime.c pages.c prng.c prof.c \ - rtree.c spin.c stats.c sz.c tcache.c ticker.c tsd.c witness.c + rtree.c stats.c sz.c tcache.c ticker.c tsd.c witness.c SYM_MAPS+=${LIBC_SRCTOP}/stdlib/jemalloc/Symbol.map From owner-svn-src-all@freebsd.org Thu Aug 10 02:15:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DA94DDCD32; Thu, 10 Aug 2017 02:15:41 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 6D29B6A498; Thu, 10 Aug 2017 02:15:41 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A2FeXo032111; Thu, 10 Aug 2017 02:15:40 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A2Femo032110; Thu, 10 Aug 2017 02:15:40 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708100215.v7A2Femo032110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Thu, 10 Aug 2017 02:15:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322335 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322335 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 02:15:41 -0000 Author: rlibby Date: Thu Aug 10 02:15:40 2017 New Revision: 322335 URL: https://svnweb.freebsd.org/changeset/base/322335 Log: Add myself (rlibby) to calendar.freebsd Reported by: mckusick Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D11947 Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 00:39:02 2017 (r322334) +++ head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 02:15:40 2017 (r322335) @@ -219,6 +219,7 @@ 06/04 Zack Kirsch born in Memphis, Tennessee, United States, 1982 06/04 Johannes Jost Meixner born in Wiesbaden, Germany, 1987 06/06 Sergei Kolobov born in Karpinsk, Russian Federation, 1972 +06/06 Ryan Libby born in Kirkland, Washington, United States, 1985 06/06 Alan Eldridge died in Denver, Colorado, 2003 06/07 Jimmy Olgeni born in Milano, Italy, 1976 06/07 Benjamin Close born in Adelaide, Australia, 1978 From owner-svn-src-all@freebsd.org Thu Aug 10 02:55:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5904BDB4BC8; Thu, 10 Aug 2017 02:55:23 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 283736BAE2; Thu, 10 Aug 2017 02:55:23 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A2tMUh048242; Thu, 10 Aug 2017 02:55:22 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A2tMXu048241; Thu, 10 Aug 2017 02:55:22 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201708100255.v7A2tMXu048241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 10 Aug 2017 02:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322336 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322336 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 02:55:23 -0000 Author: sbruno Date: Thu Aug 10 02:55:22 2017 New Revision: 322336 URL: https://svnweb.freebsd.org/changeset/base/322336 Log: Add sbruno@ birthday information. Reported by: mckusick Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 02:15:40 2017 (r322335) +++ head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 02:55:22 2017 (r322336) @@ -427,6 +427,7 @@ 12/18 Semen Ustimenko born in Novosibirsk, Russian Federation, 1979 12/19 Stephen Hurd born in Estevan, Saskatchewan, Canada, 1975 12/19 Emmanuel Vadot born in Decines-Charpieu, France, 1983 +12/20 Sean Bruno born in Monterey, California, USA, 1974 12/21 Rong-En Fan born in Taipei, Taiwan, Republic of China, 1982 12/22 Alan L. Cox born in Warren, Ohio, United States, 1964 12/22 Maxim Sobolev born in Dnepropetrovsk, Ukraine, 1976 From owner-svn-src-all@freebsd.org Thu Aug 10 03:11:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 650E5DB5796; Thu, 10 Aug 2017 03:11:06 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33E5F6C6D8; Thu, 10 Aug 2017 03:11:06 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A3B51h053191; Thu, 10 Aug 2017 03:11:05 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A3B5dl053190; Thu, 10 Aug 2017 03:11:05 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201708100311.v7A3B5dl053190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 10 Aug 2017 03:11:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322337 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 322337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 03:11:06 -0000 Author: sbruno Date: Thu Aug 10 03:11:05 2017 New Revision: 322337 URL: https://svnweb.freebsd.org/changeset/base/322337 Log: Export IFCAP_HWSTATS so that we don't experience double stats counting on iflib enabled devices. PR: 220198 Submitted by: Matt Macy Reported by: Ben Woods Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Aug 10 02:55:22 2017 (r322336) +++ head/sys/net/iflib.c Thu Aug 10 03:11:05 2017 (r322337) @@ -3723,7 +3723,7 @@ iflib_if_qflush(if_t ifp) #define IFCAP_FLAGS (IFCAP_TXCSUM_IPV6 | IFCAP_RXCSUM_IPV6 | IFCAP_HWCSUM | IFCAP_LRO | \ - IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTAGGING | \ + IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTAGGING | IFCAP_HWSTATS | \ IFCAP_VLAN_MTU | IFCAP_VLAN_HWFILTER | IFCAP_VLAN_HWTSO) static int @@ -4096,8 +4096,8 @@ iflib_device_register(device_t dev, void *sc, if_share MPASS(scctx->isc_tx_csum_flags); #endif - if_setcapabilities(ifp, scctx->isc_capenable); - if_setcapenable(ifp, scctx->isc_capenable); + if_setcapabilities(ifp, scctx->isc_capenable | IFCAP_HWSTATS); + if_setcapenable(ifp, scctx->isc_capenable | IFCAP_HWSTATS); if (scctx->isc_ntxqsets == 0 || (scctx->isc_ntxqsets_max && scctx->isc_ntxqsets_max < scctx->isc_ntxqsets)) scctx->isc_ntxqsets = scctx->isc_ntxqsets_max; From owner-svn-src-all@freebsd.org Thu Aug 10 03:43:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3784DDC22A2; Thu, 10 Aug 2017 03:43:24 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 051BC6D7DE; Thu, 10 Aug 2017 03:43:23 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A3hNEf068838; Thu, 10 Aug 2017 03:43:23 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A3hNwR068837; Thu, 10 Aug 2017 03:43:23 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201708100343.v7A3hNwR068837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 10 Aug 2017 03:43:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322338 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 322338 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 03:43:24 -0000 Author: sbruno Date: Thu Aug 10 03:43:23 2017 New Revision: 322338 URL: https://svnweb.freebsd.org/changeset/base/322338 Log: Don't leak mbufs if clusers exceeds the number of segments. This would leak mbufs over time causing crashes. PR: 221202 Submitted by: Matt Macy Reported by: gergely.czuczy@harmless.hu Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Aug 10 03:11:05 2017 (r322337) +++ head/sys/net/iflib.c Thu Aug 10 03:43:23 2017 (r322338) @@ -267,6 +267,8 @@ iflib_get_sctx(if_ctx_t ctx) #define RX_SW_DESC_INUSE (1 << 3) #define TX_SW_DESC_MAPPED (1 << 4) +#define M_TOOBIG M_UNUSED_8 + typedef struct iflib_sw_rx_desc_array { bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ struct mbuf **ifsd_m; /* pkthdr mbufs */ @@ -2930,8 +2932,11 @@ iflib_busdma_load_mbuf_sg(iflib_txq_t txq, bus_dma_tag m = m->m_next; count++; } while (m != NULL); - if (count > *nsegs) + if (count > *nsegs) { + ifsd_m[pidx] = *m0; + ifsd_m[pidx]->m_flags |= M_TOOBIG; return (0); + } m = *m0; count = 0; do { @@ -3241,8 +3246,15 @@ iflib_tx_desc_free(iflib_txq_t txq, int n) if ((m = ifsd_m[cidx]) != NULL) { /* XXX we don't support any drivers that batch packets yet */ MPASS(m->m_nextpkt == NULL); - - m_free(m); + /* if the number of clusters exceeds the number of segments + * there won't be space on the ring to save a pointer to each + * cluster so we simply free the list here + */ + if (m->m_flags & M_TOOBIG) { + m_freem(m); + } else { + m_free(m); + } ifsd_m[cidx] = NULL; #if MEMORY_LOGGING txq->ift_dequeued++; From owner-svn-src-all@freebsd.org Thu Aug 10 05:22:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 169D3DC4CC3 for ; Thu, 10 Aug 2017 05:22:10 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C433A6FEA2 for ; Thu, 10 Aug 2017 05:22:09 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f68.google.com with SMTP id w199so5689556lff.2 for ; Wed, 09 Aug 2017 22:22: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:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=JYsn+U8b91HB46gZceAaRtrnF2VYR/ugwZA6WHY6B3Y=; b=pnabaNf8QJjUqJXcdpUrqUI/PMC/haEBJXpixE9jWqk796j5FEUalgW39N8nFs6Wz9 17jFvWXqIUrISuigmwzmiX8jLPEQr/o3c4M/L+ID1UDbR1O2e+T7nFo3zfSdIrJvxK5d wKZqzN+zq/vbwPJMSfNkPj0Wok69/Iy6brxTP8U49IhxsOmZbpuq/e+tqBHn75L0sSMV n0NcmBlBDKK59MUa4GZnC2GxnR2dIBRAZllUnCAsfkvq7rqBHsD/deSv3g+Rpz8t7Izj 5hI78Oq+LvizdQyxg4F+npQFVy/OMU7gDn66gpDvBbb4UQshsRZBwP/qygZV9SjITE58 R+FA== X-Gm-Message-State: AHYfb5hUQujoON7KbAp+rFpj2ojidm9fNV/0uFQMWbcENqhHxzOr1qTn pZmohblBNp21Abza X-Received: by 10.25.33.129 with SMTP id h123mr3213844lfh.68.1502342522207; Wed, 09 Aug 2017 22:22:02 -0700 (PDT) Received: from [192.168.1.2] ([89.169.174.106]) by smtp.gmail.com with ESMTPSA id f78sm900982lji.45.2017.08.09.22.22.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Aug 2017 22:22:01 -0700 (PDT) Subject: Re: svn commit: r322315 - stable/10/sys/netinet To: Michael Tuexen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org References: <201708091326.v79DQCwZ013950@repo.freebsd.org> From: Andrey Chernov Message-ID: <278107ed-e602-d92b-7c3d-211c23e8c653@freebsd.org> Date: Thu, 10 Aug 2017 08:22:00 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <201708091326.v79DQCwZ013950@repo.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Language: ru-English Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 05:22:10 -0000 On 09.08.2017 16:26, Michael Tuexen wrote: > Author: tuexen > Date: Wed Aug 9 13:26:12 2017 > New Revision: 322315 > URL: https://svnweb.freebsd.org/changeset/base/322315 > > Log: > MFC r317208: > > Syncoockies can be used in combination with the syncache. If the cache > overflows, syncookies are used. It cause error for i386 stable-10 -ffreestanding -fstack-protector -gdwarf-2 -Werror ../../../netinet/tcp_syncache.c ../../../netinet/tcp_syncache.c:280:50: error: implicit conversion from 'long long' to 'time_t' (aka 'int') changes value from -9223372036854775808 to 0 [-Werror,-Wconstant-conversion] V_tcp_syncache.hashbase[i].sch_last_overflow = INT64_MIN; ~ ^~~~~~~~~ ./x86/_stdint.h:89:41: note: expanded from macro 'INT64_MIN' #define INT64_MIN (-0x7fffffffffffffffLL-1) ~~~~~~~~~~~~~~~~~~~~~^~ 1 error generated. *** Error code 1 From owner-svn-src-all@freebsd.org Thu Aug 10 05:35:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11FB0DC54AB; Thu, 10 Aug 2017 05:35:47 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 D0CB47051A; Thu, 10 Aug 2017 05:35:46 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A5Zkc6013195; Thu, 10 Aug 2017 05:35:46 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A5Zklw013194; Thu, 10 Aug 2017 05:35:46 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201708100535.v7A5Zklw013194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Thu, 10 Aug 2017 05:35:46 +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: r322339 - stable/11/sys/fs/fdescfs X-SVN-Group: stable-11 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/11/sys/fs/fdescfs X-SVN-Commit-Revision: 322339 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 05:35:47 -0000 Author: dchagin Date: Thu Aug 10 05:35:45 2017 New Revision: 322339 URL: https://svnweb.freebsd.org/changeset/base/322339 Log: MFC r321460: Replace unnecessary _KERNEL by double-include protection. Modified: stable/11/sys/fs/fdescfs/fdesc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/fdescfs/fdesc.h ============================================================================== --- stable/11/sys/fs/fdescfs/fdesc.h Thu Aug 10 03:43:23 2017 (r322338) +++ stable/11/sys/fs/fdescfs/fdesc.h Thu Aug 10 05:35:45 2017 (r322339) @@ -34,7 +34,9 @@ * $FreeBSD$ */ -#ifdef _KERNEL +#ifndef _FS_FDESC_H_ +#define _FS_FDESC_H_ + /* Private mount flags for fdescfs. */ #define FMNT_UNMOUNTF 0x01 struct fdescmount { @@ -66,4 +68,4 @@ extern vfs_init_t fdesc_init; extern vfs_uninit_t fdesc_uninit; extern int fdesc_allocvp(fdntype, unsigned, int, struct mount *, struct vnode **); -#endif /* _KERNEL */ +#endif /* !_FS_FDESC_H_ */ From owner-svn-src-all@freebsd.org Thu Aug 10 05:38:33 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 150DDDC55D8; Thu, 10 Aug 2017 05:38:33 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 E545B7069C; Thu, 10 Aug 2017 05:38:32 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A5cW8d013353; Thu, 10 Aug 2017 05:38:32 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A5cVsi013346; Thu, 10 Aug 2017 05:38:31 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201708100538.v7A5cVsi013346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Thu, 10 Aug 2017 05:38: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: r322340 - in stable/11: share/man/man4 share/man/man5 sys/fs/fdescfs sys/kern sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: in stable/11: share/man/man4 share/man/man5 sys/fs/fdescfs sys/kern sys/sys X-SVN-Commit-Revision: 322340 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 05:38:33 -0000 Author: dchagin Date: Thu Aug 10 05:38:31 2017 New Revision: 322340 URL: https://svnweb.freebsd.org/changeset/base/322340 Log: MFC r321839: Implement proper Linux /dev/fd and /proc/self/fd behavior by adding Linux specific things to the native fdescfs file system. Unlike FreeBSD, the Linux fdescfs is a directory containing a symbolic links to the actual files, which the process has open. A readlink(2) call on this file returns a full path in case of regular file or a string in a special format (type:[inode], anon_inode:, etc..). As well as in a FreeBSD, opening the file in the Linux fdescfs directory is equivalent to duplicating the corresponding file descriptor. Here we have mutually exclusive requirements: - in case of readlink(2) call fdescfs lookup() method should return VLNK vnode otherwise our kern_readlink() fail with EINVAL error; - in the other calls fdescfs lookup() method should return non VLNK vnode. For what new vnode v_flag VV_READLINK was added, which is set if fdescfs has beed mounted with linrdlnk option an modified kern_readlinkat() to properly handle it. For now For Linux ABI compatibility mount fdescfs volume with linrdlnk option: mount -t fdescfs -o linrdlnk null /compat/linux/dev/fd Relnotes: yes Differential Revision: https://reviews.freebsd.org/D11452 Modified: stable/11/share/man/man4/linux.4 stable/11/share/man/man5/fdescfs.5 stable/11/sys/fs/fdescfs/fdesc.h stable/11/sys/fs/fdescfs/fdesc_vfsops.c stable/11/sys/fs/fdescfs/fdesc_vnops.c stable/11/sys/kern/vfs_syscalls.c stable/11/sys/sys/vnode.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/linux.4 ============================================================================== --- stable/11/share/man/man4/linux.4 Thu Aug 10 05:35:45 2017 (r322339) +++ stable/11/share/man/man4/linux.4 Thu Aug 10 05:38:31 2017 (r322340) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2010 +.Dd August 1, 2017 .Dt LINUX 4 .Os .Sh NAME @@ -127,9 +127,11 @@ regardless of whether the module is statically linked into the kernel or loaded as a module. .Sh FILES -.Bl -tag -width /compat/linux/proc -compact +.Bl -tag -width /compat/linux/dev/fd -compact .It Pa /compat/linux minimal Linux run-time environment +.It Pa /compat/linux/dev/fd +limited Linux file-descriptor file system .It Pa /compat/linux/proc limited Linux process file system .It Pa /compat/linux/sys @@ -138,6 +140,7 @@ limited Linux system file system .Sh SEE ALSO .Xr brandelf 1 , .Xr elf 5 , +.Xr fdescfs 5 , .Xr linprocfs 5 , .Xr linsysfs 5 .Sh HISTORY Modified: stable/11/share/man/man5/fdescfs.5 ============================================================================== --- stable/11/share/man/man5/fdescfs.5 Thu Aug 10 05:35:45 2017 (r322339) +++ stable/11/share/man/man5/fdescfs.5 Thu Aug 10 05:38:31 2017 (r322340) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 18, 2010 +.Dd August 1, 2017 .Dt FDESCFS 5 .Os .Sh NAME @@ -92,6 +92,14 @@ and files are created by default when devfs alone is mounted. .Nm creates entries for all file descriptors opened by the process. +.Pp +For +.Xr linux 4 +ABI compatibility mount +.Nm +volume with +.Cm linrdlnk +option. .Sh FILES .Bl -tag -width /dev/stderr -compact .It Pa /dev/fd/# @@ -103,6 +111,12 @@ volume located on .Pa /dev/fd : .Pp .Dl "mount -t fdescfs null /dev/fd" +.Pp +For +.Xr linux 4 +ABI compatibility: +.Pp +.Dl "mount -t fdescfs -o linrdlnk null /compat/linux/dev/fd" .Sh SEE ALSO .Xr devfs 5 , .Xr mount 8 Modified: stable/11/sys/fs/fdescfs/fdesc.h ============================================================================== --- stable/11/sys/fs/fdescfs/fdesc.h Thu Aug 10 05:35:45 2017 (r322339) +++ stable/11/sys/fs/fdescfs/fdesc.h Thu Aug 10 05:38:31 2017 (r322340) @@ -38,7 +38,9 @@ #define _FS_FDESC_H_ /* Private mount flags for fdescfs. */ -#define FMNT_UNMOUNTF 0x01 +#define FMNT_UNMOUNTF 0x01 +#define FMNT_LINRDLNKF 0x02 + struct fdescmount { struct vnode *f_root; /* Root node */ int flags; Modified: stable/11/sys/fs/fdescfs/fdesc_vfsops.c ============================================================================== --- stable/11/sys/fs/fdescfs/fdesc_vfsops.c Thu Aug 10 05:35:45 2017 (r322339) +++ stable/11/sys/fs/fdescfs/fdesc_vfsops.c Thu Aug 10 05:38:31 2017 (r322340) @@ -101,6 +101,8 @@ fdesc_mount(struct mount *mp) */ mp->mnt_data = fmp; fmp->flags = 0; + if (vfs_getopt(mp->mnt_optnew, "linrdlnk", NULL, NULL) == 0) + fmp->flags |= FMNT_LINRDLNKF; error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, &rvp); if (error) { free(fmp, M_FDESCMNT); Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c ============================================================================== --- stable/11/sys/fs/fdescfs/fdesc_vnops.c Thu Aug 10 05:35:45 2017 (r322339) +++ stable/11/sys/fs/fdescfs/fdesc_vnops.c Thu Aug 10 05:38:31 2017 (r322340) @@ -69,6 +69,7 @@ static vop_getattr_t fdesc_getattr; static vop_lookup_t fdesc_lookup; static vop_open_t fdesc_open; static vop_readdir_t fdesc_readdir; +static vop_readlink_t fdesc_readlink; static vop_reclaim_t fdesc_reclaim; static vop_setattr_t fdesc_setattr; @@ -81,6 +82,7 @@ static struct vop_vector fdesc_vnodeops = { .vop_open = fdesc_open, .vop_pathconf = vop_stdpathconf, .vop_readdir = fdesc_readdir, + .vop_readlink = fdesc_readlink, .vop_reclaim = fdesc_reclaim, .vop_setattr = fdesc_setattr, }; @@ -195,6 +197,8 @@ loop: fd->fd_type = ftype; fd->fd_fd = fd_fd; fd->fd_ix = ix; + if (ftype == Fdesc && fmp->flags & FMNT_LINRDLNKF) + vp->v_vflag |= VV_READLINK; error = insmntque1(vp, mp, fdesc_insmntque_dtr, NULL); if (error != 0) { *vpp = NULLVP; @@ -420,7 +424,7 @@ fdesc_getattr(struct vop_getattr_args *ap) break; case Fdesc: - vap->va_type = VCHR; + vap->va_type = (vp->v_vflag & VV_READLINK) == 0 ? VCHR : VLNK; vap->va_nlink = 1; vap->va_size = 0; vap->va_rdev = makedev(0, vap->va_fileid); @@ -490,6 +494,7 @@ fdesc_setattr(struct vop_setattr_args *ap) static int fdesc_readdir(struct vop_readdir_args *ap) { + struct fdescmount *fmp; struct uio *uio = ap->a_uio; struct filedesc *fdp; struct dirent d; @@ -499,6 +504,7 @@ fdesc_readdir(struct vop_readdir_args *ap) if (VTOFDESC(ap->a_vp)->fd_type != Froot) panic("fdesc_readdir: not dir"); + fmp = VFSTOFDESC(ap->a_vp->v_mount); if (ap->a_ncookies != NULL) *ap->a_ncookies = 0; @@ -530,7 +536,8 @@ fdesc_readdir(struct vop_readdir_args *ap) break; dp->d_namlen = sprintf(dp->d_name, "%d", fcnt); dp->d_reclen = UIO_MX; - dp->d_type = DT_CHR; + dp->d_type = (fmp->flags & FMNT_LINRDLNKF) == 0 ? + DT_CHR : DT_LNK; dp->d_fileno = i + FD_DESC; break; } @@ -566,4 +573,53 @@ fdesc_reclaim(struct vop_reclaim_args *ap) free(vp->v_data, M_TEMP); vp->v_data = NULL; return (0); +} + +static int +fdesc_readlink(struct vop_readlink_args *va) +{ + struct vnode *vp, *vn; + cap_rights_t rights; + struct thread *td; + struct uio *uio; + struct file *fp; + char *freepath, *fullpath; + size_t pathlen; + int lockflags, fd_fd; + int error; + + freepath = NULL; + vn = va->a_vp; + if (VTOFDESC(vn)->fd_type != Fdesc) + panic("fdesc_readlink: not fdescfs link"); + fd_fd = ((struct fdescnode *)vn->v_data)->fd_fd; + lockflags = VOP_ISLOCKED(vn); + VOP_UNLOCK(vn, 0); + + td = curthread; + error = fget_cap(td, fd_fd, cap_rights_init(&rights), &fp, NULL); + if (error != 0) + goto out; + + switch (fp->f_type) { + case DTYPE_VNODE: + vp = fp->f_vnode; + error = vn_fullpath(td, vp, &fullpath, &freepath); + break; + default: + fullpath = "anon_inode:[unknown]"; + break; + } + if (error == 0) { + uio = va->a_uio; + pathlen = strlen(fullpath); + error = uiomove(fullpath, pathlen, uio); + } + if (freepath != NULL) + free(freepath, M_TEMP); + fdrop(fp, td); + +out: + vn_lock(vn, lockflags | LK_RETRY); + return (error); } Modified: stable/11/sys/kern/vfs_syscalls.c ============================================================================== --- stable/11/sys/kern/vfs_syscalls.c Thu Aug 10 05:35:45 2017 (r322339) +++ stable/11/sys/kern/vfs_syscalls.c Thu Aug 10 05:38:31 2017 (r322340) @@ -2409,7 +2409,7 @@ kern_readlinkat(struct thread *td, int fd, char *path, return (error); } #endif - if (vp->v_type != VLNK) + if (vp->v_type != VLNK && (vp->v_vflag & VV_READLINK) == 0) error = EINVAL; else { aiov.iov_base = buf; Modified: stable/11/sys/sys/vnode.h ============================================================================== --- stable/11/sys/sys/vnode.h Thu Aug 10 05:35:45 2017 (r322339) +++ stable/11/sys/sys/vnode.h Thu Aug 10 05:38:31 2017 (r322340) @@ -253,6 +253,7 @@ struct xvnode { #define VV_DELETED 0x0400 /* should be removed */ #define VV_MD 0x0800 /* vnode backs the md device */ #define VV_FORCEINSMQ 0x1000 /* force the insmntque to succeed */ +#define VV_READLINK 0x2000 /* fdescfs linux vnode */ /* * Vnode attributes. A field value of VNOVAL represents a field whose value From owner-svn-src-all@freebsd.org Thu Aug 10 06:36:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84465DC6AE6; Thu, 10 Aug 2017 06:36:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5077372198; Thu, 10 Aug 2017 06:36:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A6abFV037848; Thu, 10 Aug 2017 06:36:37 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A6abvW037847; Thu, 10 Aug 2017 06:36:37 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708100636.v7A6abvW037847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 10 Aug 2017 06:36:37 +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: r322341 - in stable: 10/crypto/openssh 11/crypto/openssh X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable: 10/crypto/openssh 11/crypto/openssh X-SVN-Commit-Revision: 322341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 06:36:38 -0000 Author: delphij Date: Thu Aug 10 06:36:37 2017 New Revision: 322341 URL: https://svnweb.freebsd.org/changeset/base/322341 Log: Apply upstream fix: Skip passwords longer than 1k in length so clients can't easily DoS sshd by sending very long passwords, causing it to spend CPU hashing them. feedback djm@, ok markus@. Brought to our attention by tomas.kuthan at oracle.com, shilei-c at 360.cn and coredump at autistici.org Security: CVE-2016-6515 Security: FreeBSD-SA-17:06.openssh Modified: stable/11/crypto/openssh/auth-passwd.c Changes in other areas also in this revision: Modified: stable/10/crypto/openssh/auth-passwd.c Modified: stable/11/crypto/openssh/auth-passwd.c ============================================================================== --- stable/11/crypto/openssh/auth-passwd.c Thu Aug 10 05:38:31 2017 (r322340) +++ stable/11/crypto/openssh/auth-passwd.c Thu Aug 10 06:36:37 2017 (r322341) @@ -66,6 +66,8 @@ extern login_cap_t *lc; #define DAY (24L * 60 * 60) /* 1 day in seconds */ #define TWO_WEEKS (2L * 7 * DAY) /* 2 weeks in seconds */ +#define MAX_PASSWORD_LEN 1024 + void disable_forwarding(void) { @@ -86,6 +88,9 @@ auth_password(Authctxt *authctxt, const char *password #if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE) static int expire_checked = 0; #endif + + if (strlen(password) > MAX_PASSWORD_LEN) + return 0; #ifndef HAVE_CYGWIN if (pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES) From owner-svn-src-all@freebsd.org Thu Aug 10 06:36:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3541DC6AEA; Thu, 10 Aug 2017 06:36:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F13D7219A; Thu, 10 Aug 2017 06:36:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A6abF3037854; Thu, 10 Aug 2017 06:36:37 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A6abxI037853; Thu, 10 Aug 2017 06:36:37 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708100636.v7A6abxI037853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 10 Aug 2017 06:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322341 - in stable: 10/crypto/openssh 11/crypto/openssh X-SVN-Group: stable-10 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable: 10/crypto/openssh 11/crypto/openssh X-SVN-Commit-Revision: 322341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 06:36:38 -0000 Author: delphij Date: Thu Aug 10 06:36:37 2017 New Revision: 322341 URL: https://svnweb.freebsd.org/changeset/base/322341 Log: Apply upstream fix: Skip passwords longer than 1k in length so clients can't easily DoS sshd by sending very long passwords, causing it to spend CPU hashing them. feedback djm@, ok markus@. Brought to our attention by tomas.kuthan at oracle.com, shilei-c at 360.cn and coredump at autistici.org Security: CVE-2016-6515 Security: FreeBSD-SA-17:06.openssh Modified: stable/10/crypto/openssh/auth-passwd.c Changes in other areas also in this revision: Modified: stable/11/crypto/openssh/auth-passwd.c Modified: stable/10/crypto/openssh/auth-passwd.c ============================================================================== --- stable/10/crypto/openssh/auth-passwd.c Thu Aug 10 05:38:31 2017 (r322340) +++ stable/10/crypto/openssh/auth-passwd.c Thu Aug 10 06:36:37 2017 (r322341) @@ -66,6 +66,8 @@ extern login_cap_t *lc; #define DAY (24L * 60 * 60) /* 1 day in seconds */ #define TWO_WEEKS (2L * 7 * DAY) /* 2 weeks in seconds */ +#define MAX_PASSWORD_LEN 1024 + void disable_forwarding(void) { @@ -86,6 +88,9 @@ auth_password(Authctxt *authctxt, const char *password #if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE) static int expire_checked = 0; #endif + + if (strlen(password) > MAX_PASSWORD_LEN) + return 0; #ifndef HAVE_CYGWIN if (pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES) From owner-svn-src-all@freebsd.org Thu Aug 10 06:59:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 253FCDC719F; Thu, 10 Aug 2017 06:59:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0039672B80; Thu, 10 Aug 2017 06:59:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A6x8mQ046056; Thu, 10 Aug 2017 06:59:08 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A6x7x9046051; Thu, 10 Aug 2017 06:59:07 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708100659.v7A6x7x9046051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 10 Aug 2017 06:59:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r322342 - in releng/11.1: . crypto/openssh sys/conf sys/kern sys/netpfil/pf X-SVN-Group: releng X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in releng/11.1: . crypto/openssh sys/conf sys/kern sys/netpfil/pf X-SVN-Commit-Revision: 322342 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 06:59:09 -0000 Author: delphij Date: Thu Aug 10 06:59:07 2017 New Revision: 322342 URL: https://svnweb.freebsd.org/changeset/base/322342 Log: Fix OpenSSH Denial of Service vulnerability. [SA-17:06] Fix VNET kernel panic with asynchronous I/O. [EN-17:07] Fix pf(4) housekeeping thread causes kernel panic. [EN-17:08] Approved by: so Modified: releng/11.1/UPDATING releng/11.1/crypto/openssh/auth-passwd.c releng/11.1/sys/conf/newvers.sh releng/11.1/sys/kern/sys_socket.c releng/11.1/sys/netpfil/pf/pf.c Modified: releng/11.1/UPDATING ============================================================================== --- releng/11.1/UPDATING Thu Aug 10 06:36:37 2017 (r322341) +++ releng/11.1/UPDATING Thu Aug 10 06:59:07 2017 (r322342) @@ -16,6 +16,16 @@ 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. +20170810 p1 FreeBSD-SA-17:06.openssh + FreeBSD-EN-17:07.vnet + FreeBSD-EN-17:08.pf + + Fix OpenSSH Denial of Service vulnerability. [SA-17:06] + + Fix VNET kernel panic with asynchronous I/O. [EN-17:07] + + Fix pf(4) housekeeping thread causes kernel panic. [EN-17:08] + 20170725: 11.1-RELEASE. Modified: releng/11.1/crypto/openssh/auth-passwd.c ============================================================================== --- releng/11.1/crypto/openssh/auth-passwd.c Thu Aug 10 06:36:37 2017 (r322341) +++ releng/11.1/crypto/openssh/auth-passwd.c Thu Aug 10 06:59:07 2017 (r322342) @@ -66,6 +66,8 @@ extern login_cap_t *lc; #define DAY (24L * 60 * 60) /* 1 day in seconds */ #define TWO_WEEKS (2L * 7 * DAY) /* 2 weeks in seconds */ +#define MAX_PASSWORD_LEN 1024 + void disable_forwarding(void) { @@ -86,6 +88,9 @@ auth_password(Authctxt *authctxt, const char *password #if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE) static int expire_checked = 0; #endif + + if (strlen(password) > MAX_PASSWORD_LEN) + return 0; #ifndef HAVE_CYGWIN if (pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES) Modified: releng/11.1/sys/conf/newvers.sh ============================================================================== --- releng/11.1/sys/conf/newvers.sh Thu Aug 10 06:36:37 2017 (r322341) +++ releng/11.1/sys/conf/newvers.sh Thu Aug 10 06:59:07 2017 (r322342) @@ -44,7 +44,7 @@ TYPE="FreeBSD" REVISION="11.1" -BRANCH="RELEASE" +BRANCH="RELEASE-p1" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/11.1/sys/kern/sys_socket.c ============================================================================== --- releng/11.1/sys/kern/sys_socket.c Thu Aug 10 06:36:37 2017 (r322341) +++ releng/11.1/sys/kern/sys_socket.c Thu Aug 10 06:59:07 2017 (r322342) @@ -675,6 +675,7 @@ soaio_process_sb(struct socket *so, struct sockbuf *sb { struct kaiocb *job; + CURVNET_SET(so->so_vnet); SOCKBUF_LOCK(sb); while (!TAILQ_EMPTY(&sb->sb_aiojobq) && soaio_ready(so, sb)) { job = TAILQ_FIRST(&sb->sb_aiojobq); @@ -698,6 +699,7 @@ soaio_process_sb(struct socket *so, struct sockbuf *sb ACCEPT_LOCK(); SOCK_LOCK(so); sorele(so); + CURVNET_RESTORE(); } void Modified: releng/11.1/sys/netpfil/pf/pf.c ============================================================================== --- releng/11.1/sys/netpfil/pf/pf.c Thu Aug 10 06:36:37 2017 (r322341) +++ releng/11.1/sys/netpfil/pf/pf.c Thu Aug 10 06:59:07 2017 (r322342) @@ -129,6 +129,8 @@ VNET_DEFINE(int, pf_tcp_secret_init); #define V_pf_tcp_secret_init VNET(pf_tcp_secret_init) VNET_DEFINE(int, pf_tcp_iss_off); #define V_pf_tcp_iss_off VNET(pf_tcp_iss_off) +VNET_DECLARE(int, pf_vnet_active); +#define V_pf_vnet_active VNET(pf_vnet_active) /* * Queue for pf_intr() sends. @@ -1439,6 +1441,12 @@ pf_purge_thread(void *unused __unused) pf_end_threads++; wakeup(pf_purge_thread); kproc_exit(0); + } + + /* Wait while V_pf_default_rule.timeout is initialized. */ + if (V_pf_vnet_active == 0) { + CURVNET_RESTORE(); + continue; } /* Process 1/interval fraction of the state table every run. */ From owner-svn-src-all@freebsd.org Thu Aug 10 06:59:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2BA9DC71FF; Thu, 10 Aug 2017 06:59:27 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E35572C9A; Thu, 10 Aug 2017 06:59:27 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A6xQV2046113; Thu, 10 Aug 2017 06:59:26 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A6xQjh046108; Thu, 10 Aug 2017 06:59:26 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708100659.v7A6xQjh046108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 10 Aug 2017 06:59:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r322343 - in releng/11.0: . crypto/openssh sys/conf sys/kern X-SVN-Group: releng X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in releng/11.0: . crypto/openssh sys/conf sys/kern X-SVN-Commit-Revision: 322343 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 06:59:27 -0000 Author: delphij Date: Thu Aug 10 06:59:26 2017 New Revision: 322343 URL: https://svnweb.freebsd.org/changeset/base/322343 Log: Fix OpenSSH Denial of Service vulnerability. [SA-17:06] Fix VNET kernel panic with asynchronous I/O. [EN-17:07] Approved by: so Modified: releng/11.0/UPDATING releng/11.0/crypto/openssh/auth-passwd.c releng/11.0/sys/conf/newvers.sh releng/11.0/sys/kern/sys_socket.c Modified: releng/11.0/UPDATING ============================================================================== --- releng/11.0/UPDATING Thu Aug 10 06:59:07 2017 (r322342) +++ releng/11.0/UPDATING Thu Aug 10 06:59:26 2017 (r322343) @@ -16,6 +16,13 @@ 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. +20170810 p12 FreeBSD-SA-17:06.openssh + FreeBSD-EN-17:07.vnet + + Fix OpenSSH Denial of Service vulnerability. [SA-17:06] + + Fix VNET kernel panic with asynchronous I/O. [EN-17:07] + 20170712 p11 FreeBSD-SA-17:05.heimdal Fix heimdal KDC-REP service name validation vulnerability. Modified: releng/11.0/crypto/openssh/auth-passwd.c ============================================================================== --- releng/11.0/crypto/openssh/auth-passwd.c Thu Aug 10 06:59:07 2017 (r322342) +++ releng/11.0/crypto/openssh/auth-passwd.c Thu Aug 10 06:59:26 2017 (r322343) @@ -66,6 +66,8 @@ extern login_cap_t *lc; #define DAY (24L * 60 * 60) /* 1 day in seconds */ #define TWO_WEEKS (2L * 7 * DAY) /* 2 weeks in seconds */ +#define MAX_PASSWORD_LEN 1024 + void disable_forwarding(void) { @@ -86,6 +88,9 @@ auth_password(Authctxt *authctxt, const char *password #if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE) static int expire_checked = 0; #endif + + if (strlen(password) > MAX_PASSWORD_LEN) + return 0; #ifndef HAVE_CYGWIN if (pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES) Modified: releng/11.0/sys/conf/newvers.sh ============================================================================== --- releng/11.0/sys/conf/newvers.sh Thu Aug 10 06:59:07 2017 (r322342) +++ releng/11.0/sys/conf/newvers.sh Thu Aug 10 06:59:26 2017 (r322343) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="11.0" -BRANCH="RELEASE-p11" +BRANCH="RELEASE-p12" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/11.0/sys/kern/sys_socket.c ============================================================================== --- releng/11.0/sys/kern/sys_socket.c Thu Aug 10 06:59:07 2017 (r322342) +++ releng/11.0/sys/kern/sys_socket.c Thu Aug 10 06:59:26 2017 (r322343) @@ -673,6 +673,7 @@ soaio_process_sb(struct socket *so, struct sockbuf *sb { struct kaiocb *job; + CURVNET_SET(so->so_vnet); SOCKBUF_LOCK(sb); while (!TAILQ_EMPTY(&sb->sb_aiojobq) && soaio_ready(so, sb)) { job = TAILQ_FIRST(&sb->sb_aiojobq); @@ -696,6 +697,7 @@ soaio_process_sb(struct socket *so, struct sockbuf *sb ACCEPT_LOCK(); SOCK_LOCK(so); sorele(so); + CURVNET_RESTORE(); } void From owner-svn-src-all@freebsd.org Thu Aug 10 06:59:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 617C7DC7251; Thu, 10 Aug 2017 06:59:45 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E1D172DBC; Thu, 10 Aug 2017 06:59:45 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A6xi18046170; Thu, 10 Aug 2017 06:59:44 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A6xh3e046167; Thu, 10 Aug 2017 06:59:43 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201708100659.v7A6xh3e046167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 10 Aug 2017 06:59:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r322344 - in releng/10.3: . crypto/openssh sys/conf X-SVN-Group: releng X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in releng/10.3: . crypto/openssh sys/conf X-SVN-Commit-Revision: 322344 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 06:59:45 -0000 Author: delphij Date: Thu Aug 10 06:59:43 2017 New Revision: 322344 URL: https://svnweb.freebsd.org/changeset/base/322344 Log: Fix OpenSSH Denial of Service vulnerability. [SA-17:06] Approved by: so Modified: releng/10.3/UPDATING releng/10.3/crypto/openssh/auth-passwd.c releng/10.3/sys/conf/newvers.sh Modified: releng/10.3/UPDATING ============================================================================== --- releng/10.3/UPDATING Thu Aug 10 06:59:26 2017 (r322343) +++ releng/10.3/UPDATING Thu Aug 10 06:59:43 2017 (r322344) @@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITHOUT_CLANG to b stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20170810 p21 FreeBSD-SA-17:06.openssh + + Fix OpenSSH Denial of Service vulnerability. [SA-17:06] + 20170712 p20 FreeBSD-SA-17:05.heimdal FreeBSD-EN-17:06.hyperv Modified: releng/10.3/crypto/openssh/auth-passwd.c ============================================================================== --- releng/10.3/crypto/openssh/auth-passwd.c Thu Aug 10 06:59:26 2017 (r322343) +++ releng/10.3/crypto/openssh/auth-passwd.c Thu Aug 10 06:59:43 2017 (r322344) @@ -66,6 +66,8 @@ extern login_cap_t *lc; #define DAY (24L * 60 * 60) /* 1 day in seconds */ #define TWO_WEEKS (2L * 7 * DAY) /* 2 weeks in seconds */ +#define MAX_PASSWORD_LEN 1024 + void disable_forwarding(void) { @@ -86,6 +88,9 @@ auth_password(Authctxt *authctxt, const char *password #if defined(USE_SHADOW) && defined(HAS_SHADOW_EXPIRE) static int expire_checked = 0; #endif + + if (strlen(password) > MAX_PASSWORD_LEN) + return 0; #ifndef HAVE_CYGWIN if (pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES) Modified: releng/10.3/sys/conf/newvers.sh ============================================================================== --- releng/10.3/sys/conf/newvers.sh Thu Aug 10 06:59:26 2017 (r322343) +++ releng/10.3/sys/conf/newvers.sh Thu Aug 10 06:59:43 2017 (r322344) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.3" -BRANCH="RELEASE-p20" +BRANCH="RELEASE-p21" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@freebsd.org Thu Aug 10 08:22:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90CE3DCB383; Thu, 10 Aug 2017 08:22:08 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 5671B7694F; Thu, 10 Aug 2017 08:22:08 +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 mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 5F3D1D44261; Thu, 10 Aug 2017 18:22:00 +1000 (AEST) Date: Thu, 10 Aug 2017 18:21:53 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322318 - in head: share/man/man4 sys/conf sys/geom In-Reply-To: <201708091615.v79GFPk9083482@repo.freebsd.org> Message-ID: <20170810165627.A1346@besplex.bde.org> References: <201708091615.v79GFPk9083482@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=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=L0oNAlR-A_7cc9sh_MoA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 08:22:08 -0000 On Wed, 9 Aug 2017, Warner Losh wrote: > Log: > Mark geom classes as deprecated. > > geom_bsd, geom_mbr and geom_sunlabel have been obsolete since Marcel > Moolenaar's geom_part was in FreeBSD 7. They haven't been in GENERIC > since FreeBSD 8. Add warning when used. > > geom_vol_ffs has been obsolete since ufs support to geom_label was > committed in FreeBSD 5. It hasn't been in GENERIC since FreeBSD 5. > Add warning when used. > > geom_fox has been obsolete since gmultipath was committed in FreeBSD 7. > (no warning added, since this is a very obscure class). > > These will all be removed in FreeBSD 12. geom_bsd (and possibly geom_mbr) can't be remove because they provide more features than geom_part*. The only loss that I noticed is for nested partitions on a backup drive: GEOM_BSD + GEOM_MBR gives: da1 da1s4aa da1s4be da1s4cs3d da1s4e da1s1 da1s4ac da1s4c da1s4cs4 da1s4f da1s1a da1s4ad da1s4cs1 da1s4cs4a da1s4g da1s1c da1s4b da1s4cs2 da1s4cs4c da1s3 da1s4ba da1s4cs3 da1s4cs4d da1s4 da1s4bc da1s4cs3a da1s4cs4e da1s4a da1s4bd da1s4cs3c da1s4d Here da1s4 = da1s4c contains an image backup of a whole drive modified to hold a BSD label in the second sector. The first sector contains a copy of the MBR of the original drive, with offsets adjusted. This works right nested, but can only point to 4 slices. The BSD label points to these 4 and has 2 extras (for damaged and/or recovery areas). The nested MBR gives slices da1s4cs[1-4]. da1s4cs[3-4] are BSD slices containing nested labels. These give the nested partitions da1s4cs[3-4][a-h]. The BSD label in da1s4 gives aliases for da1s4cs[1-4]. 2 of these are for BSD slices (da1s4a == da1s4cs3 and da1s4b == da1s4cs4). Nested labels in these give the nested alasias da1s4[a-b][a-h]. GEOM_PART_BSD + GEOM_PART_EBR + GEM_PART_EBR_COMPAT + GEOM_PART_MBR only gives: da1 da1s1a da1s4 da1s4b da1s4e da1s4g da1s1 da1s3 da1s4a da1s4d da1s4f It doesn't give any nesting. It doesn't create 'c' devices for this or any other drive. Nesting and aliases give large complications, and I don't like even the 2-level MBR+label nesting that I normally use, but the above is what turned up naturally and it is too hard to untangle it. Bruce From owner-svn-src-all@freebsd.org Thu Aug 10 09:00:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98050DCC5E1; Thu, 10 Aug 2017 09:00: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 mx1.freebsd.org (Postfix) with ESMTPS id 6C9DE77C33; Thu, 10 Aug 2017 09:00: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 v7A90F0W094475; Thu, 10 Aug 2017 09:00:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A90FjI094474; Thu, 10 Aug 2017 09:00:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708100900.v7A90FjI094474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 10 Aug 2017 09:00:15 +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: r322345 - stable/11/lib/libc/x86/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/lib/libc/x86/sys X-SVN-Commit-Revision: 322345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 09:00:16 -0000 Author: kib Date: Thu Aug 10 09:00:15 2017 New Revision: 322345 URL: https://svnweb.freebsd.org/changeset/base/322345 Log: MFC r321608: Use MFENCE to serialize RDTSC on non-Intel CPUs. Modified: stable/11/lib/libc/x86/sys/__vdso_gettc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/x86/sys/__vdso_gettc.c ============================================================================== --- stable/11/lib/libc/x86/sys/__vdso_gettc.c Thu Aug 10 06:59:43 2017 (r322344) +++ stable/11/lib/libc/x86/sys/__vdso_gettc.c Thu Aug 10 09:00:15 2017 (r322345) @@ -52,57 +52,108 @@ __FBSDID("$FreeBSD$"); #endif #include "libc_private.h" +static enum LMB { + LMB_UNKNOWN, + LMB_NONE, + LMB_MFENCE, + LMB_LFENCE +} lfence_works = LMB_UNKNOWN; + static void -lfence_mb(void) +cpuidp(u_int leaf, u_int p[4]) { + + __asm __volatile( #if defined(__i386__) - static int lfence_works = -1; + " pushl %%ebx\n" +#endif + " cpuid\n" +#if defined(__i386__) + " movl %%ebx,%1\n" + " popl %%ebx" +#endif + : "=a" (p[0]), +#if defined(__i386__) + "=r" (p[1]), +#elif defined(__amd64__) + "=b" (p[1]), +#else +#error "Arch" +#endif + "=c" (p[2]), "=d" (p[3]) + : "0" (leaf)); +} + +static enum LMB +select_lmb(void) +{ + u_int p[4]; + static const char intel_id[] = "GenuntelineI"; + + cpuidp(0, p); + return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ? + LMB_LFENCE : LMB_MFENCE); +} + +static void +init_fence(void) +{ +#if defined(__i386__) u_int cpuid_supported, p[4]; - if (lfence_works == -1) { - __asm __volatile( - " pushfl\n" - " popl %%eax\n" - " movl %%eax,%%ecx\n" - " xorl $0x200000,%%eax\n" - " pushl %%eax\n" - " popfl\n" - " pushfl\n" - " popl %%eax\n" - " xorl %%eax,%%ecx\n" - " je 1f\n" - " movl $1,%0\n" - " jmp 2f\n" - "1: movl $0,%0\n" - "2:\n" - : "=r" (cpuid_supported) : : "eax", "ecx", "cc"); - if (cpuid_supported) { - __asm __volatile( - " pushl %%ebx\n" - " cpuid\n" - " movl %%ebx,%1\n" - " popl %%ebx\n" - : "=a" (p[0]), "=r" (p[1]), "=c" (p[2]), "=d" (p[3]) - : "0" (0x1)); - lfence_works = (p[3] & CPUID_SSE2) != 0; - } else - lfence_works = 0; - } - if (lfence_works == 1) - lfence(); + __asm __volatile( + " pushfl\n" + " popl %%eax\n" + " movl %%eax,%%ecx\n" + " xorl $0x200000,%%eax\n" + " pushl %%eax\n" + " popfl\n" + " pushfl\n" + " popl %%eax\n" + " xorl %%eax,%%ecx\n" + " je 1f\n" + " movl $1,%0\n" + " jmp 2f\n" + "1: movl $0,%0\n" + "2:\n" + : "=r" (cpuid_supported) : : "eax", "ecx", "cc"); + if (cpuid_supported) { + cpuidp(0x1, p); + if ((p[3] & CPUID_SSE2) != 0) + lfence_works = select_lmb(); + } else + lfence_works = LMB_NONE; #elif defined(__amd64__) - lfence(); + lfence_works = select_lmb(); #else -#error "arch" +#error "Arch" #endif } +static void +rdtsc_mb(void) +{ + +again: + if (__predict_true(lfence_works == LMB_LFENCE)) { + lfence(); + return; + } else if (lfence_works == LMB_MFENCE) { + mfence(); + return; + } else if (lfence_works == LMB_NONE) { + return; + } + init_fence(); + goto again; +} + static u_int __vdso_gettc_rdtsc_low(const struct vdso_timehands *th) { u_int rv; - lfence_mb(); + rdtsc_mb(); __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" : "=a" (rv) : "c" (th->th_x86_shift) : "edx"); return (rv); @@ -112,7 +163,7 @@ static u_int __vdso_rdtsc32(void) { - lfence_mb(); + rdtsc_mb(); return (rdtsc32()); } @@ -211,7 +262,7 @@ __vdso_hyperv_tsc(struct hyperv_reftsc *tsc_ref, u_int scale = tsc_ref->tsc_scale; ofs = tsc_ref->tsc_ofs; - lfence_mb(); + rdtsc_mb(); tsc = rdtsc(); /* ret = ((tsc * scale) >> 64) + ofs */ From owner-svn-src-all@freebsd.org Thu Aug 10 09:02:46 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A8CFDCC7EE; Thu, 10 Aug 2017 09:02:46 +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 mx1.freebsd.org (Postfix) with ESMTPS id EDB477C17F; Thu, 10 Aug 2017 09:02:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A92jO9098364; Thu, 10 Aug 2017 09:02:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A92jRK098363; Thu, 10 Aug 2017 09:02:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708100902.v7A92jRK098363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 10 Aug 2017 09:02:45 +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: r322346 - stable/11/libexec/rtld-elf X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/libexec/rtld-elf X-SVN-Commit-Revision: 322346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 09:02:46 -0000 Author: kib Date: Thu Aug 10 09:02:44 2017 New Revision: 322346 URL: https://svnweb.freebsd.org/changeset/base/322346 Log: MFC r321607: Allow to specify targets by absolute paths in libmap.conf. PR: 221032 Modified: stable/11/libexec/rtld-elf/rtld.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/rtld-elf/rtld.c ============================================================================== --- stable/11/libexec/rtld-elf/rtld.c Thu Aug 10 09:00:15 2017 (r322345) +++ stable/11/libexec/rtld-elf/rtld.c Thu Aug 10 09:02:44 2017 (r322346) @@ -1589,19 +1589,20 @@ find_library(const char *xname, const Obj_Entry *refob bool nodeflib, objgiven; objgiven = refobj != NULL; - if (strchr(xname, '/') != NULL) { /* Hard coded pathname */ - if (xname[0] != '/' && !trust) { + + if (libmap_disable || !objgiven || + (name = lm_find(refobj->path, xname)) == NULL) + name = (char *)xname; + + if (strchr(name, '/') != NULL) { /* Hard coded pathname */ + if (name[0] != '/' && !trust) { _rtld_error("Absolute pathname required for shared object \"%s\"", - xname); - return NULL; + name); + return (NULL); } return (origin_subst(__DECONST(Obj_Entry *, refobj), - __DECONST(char *, xname))); + __DECONST(char *, name))); } - - if (libmap_disable || !objgiven || - (name = lm_find(refobj->path, xname)) == NULL) - name = (char *)xname; dbg(" Searching for \"%s\"", name); From owner-svn-src-all@freebsd.org Thu Aug 10 09:15:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D2CEDCCB16; Thu, 10 Aug 2017 09:15:20 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 23AC27C68E; Thu, 10 Aug 2017 09:15:20 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A9FJLv002483; Thu, 10 Aug 2017 09:15:19 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A9FIke002476; Thu, 10 Aug 2017 09:15:18 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201708100915.v7A9FIke002476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Thu, 10 Aug 2017 09:15:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322347 - in head/sys/x86: acpica include x86 xen X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: in head/sys/x86: acpica include x86 xen X-SVN-Commit-Revision: 322347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 09:15:20 -0000 Author: royger Date: Thu Aug 10 09:15:18 2017 New Revision: 322347 URL: https://svnweb.freebsd.org/changeset/base/322347 Log: apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase Populate the lapics arrays and call cpu_add/lapic_create in the setup phase instead. Also store the max APIC ID found in the newly introduced max_apic_id global variable. This is a requirement in order to make the static arrays currently using MAX_LAPIC_ID dynamic. Sponsored by: Citrix Systems R&D MFC after: 1 month Reviewed by: kib Differential revision: https://reviews.freebsd.org/D11911 Modified: head/sys/x86/acpica/madt.c head/sys/x86/acpica/srat.c head/sys/x86/include/x86_var.h head/sys/x86/x86/local_apic.c head/sys/x86/x86/mp_x86.c head/sys/x86/x86/mptable.c head/sys/x86/xen/pvcpu_enum.c Modified: head/sys/x86/acpica/madt.c ============================================================================== --- head/sys/x86/acpica/madt.c Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/acpica/madt.c Thu Aug 10 09:15:18 2017 (r322347) @@ -83,6 +83,8 @@ static int madt_probe(void); static int madt_probe_cpus(void); static void madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry, void *arg __unused); +static void madt_setup_cpus_handler(ACPI_SUBTABLE_HEADER *entry, + void *arg __unused); static void madt_register(void *dummy); static int madt_setup_local(void); static int madt_setup_io(void); @@ -140,6 +142,7 @@ madt_setup_local(void) bool bios_x2apic; madt = pmap_mapbios(madt_physaddr, madt_length); + madt_walk_table(madt_setup_cpus_handler, NULL); if ((cpu_feature2 & CPUID2_X2APIC) != 0) { reason = NULL; @@ -302,6 +305,19 @@ madt_walk_table(acpi_subtable_handler *handler, void * } static void +madt_parse_cpu(unsigned int apic_id, unsigned int flags) +{ + + if (!(flags & ACPI_MADT_ENABLED) || mp_ncpus == MAXCPU || + apic_id > MAX_APIC_ID) + return; + + mp_ncpus++; + mp_maxid = mp_ncpus - 1; + max_apic_id = max(apic_id, max_apic_id); +} + +static void madt_add_cpu(u_int acpi_id, u_int apic_id, u_int flags) { struct lapic_info *la; @@ -331,6 +347,24 @@ madt_add_cpu(u_int acpi_id, u_int apic_id, u_int flags static void madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) +{ + ACPI_MADT_LOCAL_APIC *proc; + ACPI_MADT_LOCAL_X2APIC *x2apic; + + switch (entry->Type) { + case ACPI_MADT_TYPE_LOCAL_APIC: + proc = (ACPI_MADT_LOCAL_APIC *)entry; + madt_parse_cpu(proc->Id, proc->LapicFlags); + break; + case ACPI_MADT_TYPE_LOCAL_X2APIC: + x2apic = (ACPI_MADT_LOCAL_X2APIC *)entry; + madt_parse_cpu(x2apic->LocalApicId, x2apic->LapicFlags); + break; + } +} + +static void +madt_setup_cpus_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) { ACPI_MADT_LOCAL_APIC *proc; ACPI_MADT_LOCAL_X2APIC *x2apic; Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/acpica/srat.c Thu Aug 10 09:15:18 2017 (r322347) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/include/x86_var.h Thu Aug 10 09:15:18 2017 (r322347) @@ -78,6 +78,7 @@ extern int _ufssel; extern int _ugssel; extern int use_xsave; extern uint64_t xsave_mask; +extern u_int max_apic_id; struct pcb; struct thread; Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/x86/local_apic.c Thu Aug 10 09:15:18 2017 (r322347) @@ -184,6 +184,7 @@ static struct eventtimer lapic_et; #ifdef SMP static uint64_t lapic_ipi_wait_mult; #endif +unsigned int max_apic_id; SYSCTL_NODE(_hw, OID_AUTO, apic, CTLFLAG_RD, 0, "APIC options"); SYSCTL_INT(_hw_apic, OID_AUTO, x2apic_mode, CTLFLAG_RD, &x2apic_mode, 0, ""); Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/x86/mp_x86.c Thu Aug 10 09:15:18 2017 (r322347) @@ -825,10 +825,6 @@ cpu_add(u_int apic_id, char boot_cpu) boot_cpu_id = apic_id; cpu_info[apic_id].cpu_bsp = 1; } - if (mp_ncpus < MAXCPU) { - mp_ncpus++; - mp_maxid = mp_ncpus - 1; - } if (bootverbose) printf("SMP: Added CPU %d (%s)\n", apic_id, boot_cpu ? "BSP" : "AP"); Modified: head/sys/x86/x86/mptable.c ============================================================================== --- head/sys/x86/x86/mptable.c Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/x86/mptable.c Thu Aug 10 09:15:18 2017 (r322347) @@ -191,6 +191,7 @@ static void mptable_pci_setup(void); static int mptable_probe(void); static int mptable_probe_cpus(void); static void mptable_probe_cpus_handler(u_char *entry, void *arg __unused); +static void mptable_setup_cpus_handler(u_char *entry, void *arg __unused); static void mptable_register(void *dummy); static int mptable_setup_local(void); static int mptable_setup_io(void); @@ -329,14 +330,11 @@ mptable_probe_cpus(void) /* Is this a pre-defined config? */ if (mpfps->config_type != 0) { - lapic_create(0, 1); - lapic_create(1, 0); + mp_ncpus = 2; + mp_maxid = 1; + max_apic_id = 1; } else { - cpu_mask = 0; mptable_walk_table(mptable_probe_cpus_handler, &cpu_mask); -#ifdef MPTABLE_FORCE_HTT - mptable_hyperthread_fixup(cpu_mask); -#endif } return (0); } @@ -352,9 +350,17 @@ mptable_setup_local(void) /* Is this a pre-defined config? */ printf("MPTable: <"); if (mpfps->config_type != 0) { + lapic_create(0, 1); + lapic_create(1, 0); addr = DEFAULT_APIC_BASE; printf("Default Configuration %d", mpfps->config_type); + } else { + cpu_mask = 0; + mptable_walk_table(mptable_setup_cpus_handler, &cpu_mask); +#ifdef MPTABLE_FORCE_HTT + mptable_hyperthread_fixup(cpu_mask); +#endif addr = mpct->apic_address; printf("%.*s %.*s", (int)sizeof(mpct->oem_id), mpct->oem_id, (int)sizeof(mpct->product_id), mpct->product_id); @@ -464,6 +470,25 @@ mptable_walk_extended_table(mptable_extended_entry_han static void mptable_probe_cpus_handler(u_char *entry, void *arg) +{ + proc_entry_ptr proc; + + switch (*entry) { + case MPCT_ENTRY_PROCESSOR: + proc = (proc_entry_ptr)entry; + if (proc->cpu_flags & PROCENTRY_FLAG_EN && + proc->apic_id < MAX_LAPIC_ID && mp_ncpus < MAXCPU) { + mp_ncpus++; + mp_maxid = mp_ncpus - 1; + max_apic_id = max(max_apic_id, proc->apic_id); + } + break; + } +} + + +static void +mptable_setup_cpus_handler(u_char *entry, void *arg) { proc_entry_ptr proc; u_int *cpu_mask; Modified: head/sys/x86/xen/pvcpu_enum.c ============================================================================== --- head/sys/x86/xen/pvcpu_enum.c Thu Aug 10 09:02:44 2017 (r322346) +++ head/sys/x86/xen/pvcpu_enum.c Thu Aug 10 09:15:18 2017 (r322347) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -151,11 +152,12 @@ xenpv_probe_cpus(void) #ifdef SMP int i, ret; - for (i = 0; i < MAXCPU; i++) { + for (i = 0; i < MAXCPU && (i * 2) < MAX_APIC_ID; i++) { ret = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); - if (ret >= 0) - lapic_create((i * 2), (i == 0)); + mp_ncpus = min(mp_ncpus + 1, MAXCPU); } + mp_maxid = mp_ncpus - 1; + max_apic_id = mp_ncpus * 2; #endif return (0); } @@ -166,6 +168,16 @@ xenpv_probe_cpus(void) static int xenpv_setup_local(void) { +#ifdef SMP + int i, ret; + + for (i = 0; i < MAXCPU && (i * 2) < MAX_APIC_ID; i++) { + ret = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); + if (ret >= 0) + lapic_create((i * 2), (i == 0)); + } +#endif + PCPU_SET(vcpu_id, 0); lapic_init(0); return (0); From owner-svn-src-all@freebsd.org Thu Aug 10 09:16:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78048DCCBB6; Thu, 10 Aug 2017 09:16:05 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 527A17C812; Thu, 10 Aug 2017 09:16:05 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A9G4Bx002557; Thu, 10 Aug 2017 09:16:04 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A9G3Rc002550; Thu, 10 Aug 2017 09:16:03 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201708100916.v7A9G3Rc002550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Thu, 10 Aug 2017 09:16:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322348 - in head/sys/x86: acpica include x86 X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: in head/sys/x86: acpica include x86 X-SVN-Commit-Revision: 322348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 09:16:05 -0000 Author: royger Date: Thu Aug 10 09:16:03 2017 New Revision: 322348 URL: https://svnweb.freebsd.org/changeset/base/322348 Log: x86: make the arrays that depend on MAX_APIC_ID dynamic So that MAX_APIC_ID can be bumped without wasting memory. Note that the usage of MAX_APIC_ID in the SRAT parsing forces the parser to allocate memory directly from the phys_avail physical memory array, which is not the best approach probably, but I haven't found any other way to allocate memory so early in boot. This memory is not returned to the system afterwards, but at least it's sized according to the maximum APIC ID found in the MADT table. Sponsored by: Citrix Systems R&D MFC after: 1 month Reviewed by: kib Differential revision: https://reviews.freebsd.org/D11912 Modified: head/sys/x86/acpica/madt.c head/sys/x86/acpica/srat.c head/sys/x86/include/apicvar.h head/sys/x86/include/x86_smp.h head/sys/x86/x86/local_apic.c head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/acpica/madt.c ============================================================================== --- head/sys/x86/acpica/madt.c Thu Aug 10 09:15:18 2017 (r322347) +++ head/sys/x86/acpica/madt.c Thu Aug 10 09:16:03 2017 (r322348) @@ -59,7 +59,7 @@ static struct { static struct lapic_info { u_int la_enabled; u_int la_acpi_id; -} lapics[MAX_APIC_ID + 1]; +} *lapics; int madt_found_sci_override; static ACPI_TABLE_MADT *madt; @@ -141,8 +141,6 @@ madt_setup_local(void) int user_x2apic; bool bios_x2apic; - madt = pmap_mapbios(madt_physaddr, madt_length); - madt_walk_table(madt_setup_cpus_handler, NULL); if ((cpu_feature2 & CPUID2_X2APIC) != 0) { reason = NULL; @@ -214,6 +212,11 @@ madt_setup_local(void) } } + madt = pmap_mapbios(madt_physaddr, madt_length); + lapics = malloc(sizeof(*lapics) * (max_apic_id + 1), M_MADT, + M_WAITOK | M_ZERO); + madt_walk_table(madt_setup_cpus_handler, NULL); + lapic_init(madt->Address); printf("ACPI APIC Table: <%.*s %.*s>\n", (int)sizeof(madt->Header.OemId), madt->Header.OemId, @@ -236,6 +239,8 @@ madt_setup_io(void) u_int pin; int i; + KASSERT(lapics != NULL, ("local APICs not initialized")); + /* Try to initialize ACPI so that we can access the FADT. */ i = acpi_Startup(); if (ACPI_FAILURE(i)) { @@ -282,6 +287,10 @@ madt_setup_io(void) free(ioapics, M_MADT); ioapics = NULL; + /* NB: this is the last use of the lapics array. */ + free(lapics, M_MADT); + lapics = NULL; + return (0); } @@ -332,7 +341,7 @@ madt_add_cpu(u_int acpi_id, u_int apic_id, u_int flags "enabled" : "disabled"); if (!(flags & ACPI_MADT_ENABLED)) return; - if (apic_id > MAX_APIC_ID) { + if (apic_id > max_apic_id) { printf("MADT: Ignoring local APIC ID %u (too high)\n", apic_id); return; @@ -471,7 +480,7 @@ madt_find_cpu(u_int acpi_id, u_int *apic_id) { int i; - for (i = 0; i <= MAX_APIC_ID; i++) { + for (i = 0; i <= max_apic_id; i++) { if (!lapics[i].la_enabled) continue; if (lapics[i].la_acpi_id != acpi_id) @@ -723,6 +732,9 @@ madt_set_ids(void *dummy) if (madt == NULL) return; + + KASSERT(lapics != NULL, ("local APICs not initialized")); + CPU_FOREACH(i) { pc = pcpu_find(i); KASSERT(pc != NULL, ("no pcpu data for CPU %u", i)); Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Thu Aug 10 09:15:18 2017 (r322347) +++ head/sys/x86/acpica/srat.c Thu Aug 10 09:16:03 2017 (r322348) @@ -55,11 +55,11 @@ __FBSDID("$FreeBSD$"); #include #if MAXMEMDOM > 1 -struct cpu_info { +static struct cpu_info { int enabled:1; int has_memory:1; int domain; -} cpus[MAX_APIC_ID + 1]; +} *cpus; struct mem_affinity mem_info[VM_PHYSSEG_MAX + 1]; int num_mem; @@ -204,7 +204,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *ar "enabled" : "disabled"); if (!(cpu->Flags & ACPI_SRAT_CPU_ENABLED)) break; - if (cpu->ApicId > MAX_APIC_ID) { + if (cpu->ApicId > max_apic_id) { printf("SRAT: Ignoring local APIC ID %u (too high)\n", cpu->ApicId); break; @@ -228,7 +228,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *ar "enabled" : "disabled"); if (!(x2apic->Flags & ACPI_SRAT_CPU_ENABLED)) break; - if (x2apic->ApicId > MAX_APIC_ID) { + if (x2apic->ApicId > max_apic_id) { printf("SRAT: Ignoring local APIC ID %u (too high)\n", x2apic->ApicId); break; @@ -294,7 +294,7 @@ check_domains(void) for (i = 0; i < num_mem; i++) { found = 0; - for (j = 0; j <= MAX_APIC_ID; j++) + for (j = 0; j <= max_apic_id; j++) if (cpus[j].enabled && cpus[j].domain == mem_info[i].domain) { cpus[j].has_memory = 1; @@ -306,7 +306,7 @@ check_domains(void) return (ENXIO); } } - for (i = 0; i <= MAX_APIC_ID; i++) + for (i = 0; i <= max_apic_id; i++) if (cpus[i].enabled && !cpus[i].has_memory) { printf("SRAT: No memory found for CPU %d\n", i); return (ENXIO); @@ -401,7 +401,7 @@ renumber_domains(void) for (j = 0; j < num_mem; j++) if (mem_info[j].domain == domain_pxm[i]) mem_info[j].domain = i; - for (j = 0; j <= MAX_APIC_ID; j++) + for (j = 0; j <= max_apic_id; j++) if (cpus[j].enabled && cpus[j].domain == domain_pxm[i]) cpus[j].domain = i; } @@ -415,6 +415,8 @@ renumber_domains(void) static int parse_srat(void) { + unsigned int idx, size; + vm_paddr_t addr; int error; if (resource_disabled("srat", 0)) @@ -423,6 +425,25 @@ parse_srat(void) srat_physaddr = acpi_find_table(ACPI_SIG_SRAT); if (srat_physaddr == 0) return (-1); + + /* + * Allocate data structure: + * + * Find the last physical memory region and steal some memory from + * it. This is done because at this point in the boot process + * malloc is still not usable. + */ + for (idx = 0; phys_avail[idx + 1] != 0; idx += 2); + KASSERT(idx != 0, ("phys_avail is empty!")); + idx -= 2; + + size = sizeof(*cpus) * (max_apic_id + 1); + addr = trunc_page(phys_avail[idx + 1] - size); + KASSERT(addr >= phys_avail[idx], + ("Not enough memory for SRAT table items")); + phys_avail[idx + 1] = addr - 1; + + cpus = (struct cpu_info *)PHYS_TO_DMAP(addr); /* * Make a pass over the table to populate the cpus[] and Modified: head/sys/x86/include/apicvar.h ============================================================================== --- head/sys/x86/include/apicvar.h Thu Aug 10 09:15:18 2017 (r322347) +++ head/sys/x86/include/apicvar.h Thu Aug 10 09:16:03 2017 (r322348) @@ -182,7 +182,7 @@ inthand_t IDTVEC(spuriousint), IDTVEC(timerint); extern vm_paddr_t lapic_paddr; -extern int apic_cpuids[]; +extern int *apic_cpuids; void apic_register_enumerator(struct apic_enumerator *enumerator); void *ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase); Modified: head/sys/x86/include/x86_smp.h ============================================================================== --- head/sys/x86/include/x86_smp.h Thu Aug 10 09:15:18 2017 (r322347) +++ head/sys/x86/include/x86_smp.h Thu Aug 10 09:16:03 2017 (r322348) @@ -54,7 +54,7 @@ struct cpu_info { int cpu_disabled:1; int cpu_hyperthread:1; }; -extern struct cpu_info cpu_info[]; +extern struct cpu_info *cpu_info; #ifdef COUNT_IPIS extern u_long *ipi_invltlb_counts[MAXCPU]; Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Thu Aug 10 09:15:18 2017 (r322347) +++ head/sys/x86/x86/local_apic.c Thu Aug 10 09:16:03 2017 (r322348) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -83,6 +84,8 @@ __FBSDID("$FreeBSD$"); #define GSEL_APIC GSEL(GCODE_SEL, SEL_KPL) #endif +static MALLOC_DEFINE(M_LAPIC, "local_apic", "Local APIC items"); + /* Sanity checks on IDT vectors. */ CTASSERT(APIC_IO_INTS + APIC_NUM_IOINTS == APIC_TIMER_INT); CTASSERT(APIC_TIMER_INT < APIC_LOCAL_INTS); @@ -134,7 +137,7 @@ struct lapic { uint32_t lvt_timer_last; /* Include IDT_SYSCALL to make indexing easier. */ int la_ioint_irqs[APIC_NUM_IOINTS + 1]; -} static lapics[MAX_APIC_ID + 1]; +} static *lapics; /* Global defaults for local APIC LVT entries. */ static struct lvt lvts[APIC_LVT_MAX + 1] = { @@ -601,7 +604,7 @@ native_lapic_create(u_int apic_id, int boot_cpu) { int i; - if (apic_id > MAX_APIC_ID) { + if (apic_id > max_apic_id) { printf("APIC: Ignoring local APIC with ID %d\n", apic_id); if (boot_cpu) panic("Can't ignore BSP"); @@ -1661,7 +1664,7 @@ DB_SHOW_COMMAND(apic, db_show_apic) verbose = 1; else verbose = 0; - for (apic_id = 0; apic_id <= MAX_APIC_ID; apic_id++) { + for (apic_id = 0; apic_id <= max_apic_id; apic_id++) { if (lapics[apic_id].la_present == 0) continue; db_printf("Interrupts bound to lapic %u\n", apic_id); @@ -1861,6 +1864,9 @@ apic_setup_local(void *dummy __unused) if (best_enum == NULL) return; + + lapics = malloc(sizeof(*lapics) * (max_apic_id + 1), M_LAPIC, + M_WAITOK | M_ZERO); /* Initialize the local APIC. */ retval = best_enum->apic_setup_local(); Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Thu Aug 10 09:15:18 2017 (r322347) +++ head/sys/x86/x86/mp_x86.c Thu Aug 10 09:16:03 2017 (r322348) @@ -84,6 +84,8 @@ __FBSDID("$FreeBSD$"); #define BIOS_RESET (0x0f) #define BIOS_WARM (0x0a) +static MALLOC_DEFINE(M_CPUS, "cpus", "CPU items"); + /* lock region used by kernel profiling */ int mcount_lock; @@ -132,8 +134,8 @@ volatile int aps_ready = 0; * Store data from cpu_add() until later in the boot when we actually setup * the APs. */ -struct cpu_info cpu_info[MAX_APIC_ID + 1]; -int apic_cpuids[MAX_APIC_ID + 1]; +struct cpu_info *cpu_info; +int *apic_cpuids; int cpu_apic_ids[MAXCPU]; /* Holds pending bitmap based IPIs per CPU */ @@ -546,7 +548,7 @@ topo_probe(void) nlayers++; topo_init_root(&topo_root); - for (i = 0; i <= MAX_APIC_ID; ++i) { + for (i = 0; i <= max_apic_id; ++i) { if (!cpu_info[i].cpu_present) continue; @@ -803,6 +805,19 @@ cpu_topo(void) return (cg_root); } +static void +cpu_alloc(void *dummy __unused) +{ + /* + * Dynamically allocate the arrays that depend on the + * maximum APIC ID. + */ + cpu_info = malloc(sizeof(*cpu_info) * (max_apic_id + 1), M_CPUS, + M_WAITOK | M_ZERO); + apic_cpuids = malloc(sizeof(*apic_cpuids) * (max_apic_id + 1), M_CPUS, + M_WAITOK | M_ZERO); +} +SYSINIT(cpu_alloc, SI_SUB_CPU, SI_ORDER_FIRST, cpu_alloc, NULL); /* * Add a logical CPU to the topology. @@ -811,7 +826,7 @@ void cpu_add(u_int apic_id, char boot_cpu) { - if (apic_id > MAX_APIC_ID) { + if (apic_id > max_apic_id) { panic("SMP: APIC ID %d too high", apic_id); return; } From owner-svn-src-all@freebsd.org Thu Aug 10 09:16:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0017DCCC49; Thu, 10 Aug 2017 09:16:41 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 7A3F67C96A; Thu, 10 Aug 2017 09:16:41 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A9Ged2002619; Thu, 10 Aug 2017 09:16:40 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A9Genk002615; Thu, 10 Aug 2017 09:16:40 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201708100916.v7A9Genk002615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Thu, 10 Aug 2017 09:16:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322349 - in head/sys/x86: acpica include x86 X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: in head/sys/x86: acpica include x86 X-SVN-Commit-Revision: 322349 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 09:16:41 -0000 Author: royger Date: Thu Aug 10 09:16:40 2017 New Revision: 322349 URL: https://svnweb.freebsd.org/changeset/base/322349 Log: x86: bump MAX_APIC_ID to 512 Introduce a new define to take int account the xAPIC ID limit, for systems where x2APIC is not available/reliable. Also change some of the usages of the APIC ID to use an unsigned int (which is the correct storage type to deal with x2APIC IDs as found in x2APIC MADT entries). This allows booting FreeBSD on a box with 256 CPUs and APIC IDs up to 295: FreeBSD/SMP: Multiprocessor System Detected: 256 CPUs FreeBSD/SMP: 1 package(s) x 64 core(s) x 4 hardware threads Package HW ID = 0 Core HW ID = 0 CPU0 (BSP): APIC ID: 0 CPU1 (AP/HT): APIC ID: 1 CPU2 (AP/HT): APIC ID: 2 CPU3 (AP/HT): APIC ID: 3 [...] Core HW ID = 73 CPU252 (AP): APIC ID: 292 CPU253 (AP/HT): APIC ID: 293 CPU254 (AP/HT): APIC ID: 294 CPU255 (AP/HT): APIC ID: 295 Submitted by: kib (previous version) Relnotes: yes MFC after: 1 month Reviewed by: kib Differential revision: https://reviews.freebsd.org/D11913 Modified: head/sys/x86/acpica/madt.c head/sys/x86/include/apicvar.h head/sys/x86/x86/mp_x86.c head/sys/x86/x86/mptable.c Modified: head/sys/x86/acpica/madt.c ============================================================================== --- head/sys/x86/acpica/madt.c Thu Aug 10 09:16:03 2017 (r322348) +++ head/sys/x86/acpica/madt.c Thu Aug 10 09:16:40 2017 (r322349) @@ -212,6 +212,14 @@ madt_setup_local(void) } } + /* + * Truncate max_apic_id if not in x2APIC mode. Some structures + * will already be allocated with the previous max_apic_id, but + * at least we can prevent wasting more memory elsewhere. + */ + if (!x2apic_mode) + max_apic_id = min(max_apic_id, xAPIC_MAX_APIC_ID); + madt = pmap_mapbios(madt_physaddr, madt_length); lapics = malloc(sizeof(*lapics) * (max_apic_id + 1), M_MADT, M_WAITOK | M_ZERO); @@ -250,7 +258,7 @@ madt_setup_io(void) panic("Using MADT but ACPI doesn't work"); } - ioapics = malloc(sizeof(*ioapics) * (MAX_APIC_ID + 1), M_MADT, + ioapics = malloc(sizeof(*ioapics) * (IOAPIC_MAX_ID + 1), M_MADT, M_WAITOK | M_ZERO); /* First, we run through adding I/O APIC's. */ @@ -277,7 +285,7 @@ madt_setup_io(void) } /* Third, we register all the I/O APIC's. */ - for (i = 0; i <= MAX_APIC_ID; i++) + for (i = 0; i <= IOAPIC_MAX_ID; i++) if (ioapics[i].io_apic != NULL) ioapic_register(ioapics[i].io_apic); @@ -408,7 +416,7 @@ madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *ar "MADT: Found IO APIC ID %u, Interrupt %u at %p\n", apic->Id, apic->GlobalIrqBase, (void *)(uintptr_t)apic->Address); - if (apic->Id > MAX_APIC_ID) + if (apic->Id > IOAPIC_MAX_ID) panic("%s: I/O APIC ID %u too high", __func__, apic->Id); if (ioapics[apic->Id].io_apic != NULL) @@ -501,7 +509,7 @@ madt_find_interrupt(int intr, void **apic, u_int *pin) int i, best; best = -1; - for (i = 0; i <= MAX_APIC_ID; i++) { + for (i = 0; i <= IOAPIC_MAX_ID; i++) { if (ioapics[i].io_apic == NULL || ioapics[i].io_vector > intr) continue; Modified: head/sys/x86/include/apicvar.h ============================================================================== --- head/sys/x86/include/apicvar.h Thu Aug 10 09:16:03 2017 (r322348) +++ head/sys/x86/include/apicvar.h Thu Aug 10 09:16:40 2017 (r322349) @@ -74,8 +74,12 @@ * I/O device! */ -#define MAX_APIC_ID 0xfe -#define APIC_ID_ALL 0xff +#define xAPIC_MAX_APIC_ID 0xfe +#define xAPIC_ID_ALL 0xff +#define MAX_APIC_ID 0x200 +#define APIC_ID_ALL 0xffffffff + +#define IOAPIC_MAX_ID xAPIC_MAX_APIC_ID /* I/O Interrupts are used for external devices such as ISA, PCI, etc. */ #define APIC_IO_INTS (IDT_IO_INTS + 16) Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Thu Aug 10 09:16:03 2017 (r322348) +++ head/sys/x86/x86/mp_x86.c Thu Aug 10 09:16:40 2017 (r322349) @@ -137,6 +137,10 @@ volatile int aps_ready = 0; struct cpu_info *cpu_info; int *apic_cpuids; int cpu_apic_ids[MAXCPU]; +_Static_assert(MAXCPU <= MAX_APIC_ID, + "MAXCPU cannot be larger that MAX_APIC_ID"); +_Static_assert(xAPIC_MAX_APIC_ID <= MAX_APIC_ID, + "xAPIC_MAX_APIC_ID cannot be larger that MAX_APIC_ID"); /* Holds pending bitmap based IPIs per CPU */ volatile u_int cpu_ipi_pending[MAXCPU]; @@ -830,18 +834,18 @@ cpu_add(u_int apic_id, char boot_cpu) panic("SMP: APIC ID %d too high", apic_id); return; } - KASSERT(cpu_info[apic_id].cpu_present == 0, ("CPU %d added twice", + KASSERT(cpu_info[apic_id].cpu_present == 0, ("CPU %u added twice", apic_id)); cpu_info[apic_id].cpu_present = 1; if (boot_cpu) { KASSERT(boot_cpu_id == -1, - ("CPU %d claims to be BSP, but CPU %d already is", apic_id, + ("CPU %u claims to be BSP, but CPU %u already is", apic_id, boot_cpu_id)); boot_cpu_id = apic_id; cpu_info[apic_id].cpu_bsp = 1; } if (bootverbose) - printf("SMP: Added CPU %d (%s)\n", apic_id, boot_cpu ? "BSP" : + printf("SMP: Added CPU %u (%s)\n", apic_id, boot_cpu ? "BSP" : "AP"); } Modified: head/sys/x86/x86/mptable.c ============================================================================== --- head/sys/x86/x86/mptable.c Thu Aug 10 09:16:03 2017 (r322348) +++ head/sys/x86/x86/mptable.c Thu Aug 10 09:16:40 2017 (r322349) @@ -159,7 +159,7 @@ struct pci_route_interrupt_args { static mpfps_t mpfps; static mpcth_t mpct; static ext_entry_ptr mpet; -static void *ioapics[MAX_APIC_ID + 1]; +static void *ioapics[IOAPIC_MAX_ID + 1]; static bus_datum *busses; static int mptable_nioapics, mptable_nbusses, mptable_maxbusid; static int pci0 = -1; @@ -393,7 +393,7 @@ mptable_setup_io(void) mptable_parse_ints(); /* Fourth, we register all the I/O APIC's. */ - for (i = 0; i <= MAX_APIC_ID; i++) + for (i = 0; i <= IOAPIC_MAX_ID; i++) if (ioapics[i] != NULL) ioapic_register(ioapics[i]); @@ -589,7 +589,7 @@ mptable_parse_apics_and_busses_handler(u_char *entry, apic = (io_apic_entry_ptr)entry; if (!(apic->apic_flags & IOAPICENTRY_FLAG_EN)) break; - if (apic->apic_id > MAX_APIC_ID) + if (apic->apic_id > IOAPIC_MAX_ID) panic("%s: I/O APIC ID %d too high", __func__, apic->apic_id); if (ioapics[apic->apic_id] != NULL) @@ -736,7 +736,7 @@ mptable_parse_io_int(int_entry_ptr intr) return; } } - if (apic_id > MAX_APIC_ID) { + if (apic_id > IOAPIC_MAX_ID) { printf("MPTable: Ignoring interrupt entry for ioapic%d\n", intr->dst_apic_id); return; From owner-svn-src-all@freebsd.org Thu Aug 10 09:17:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C914EDCCCA6; Thu, 10 Aug 2017 09:17:17 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 983507CABF; Thu, 10 Aug 2017 09:17:17 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7A9HGMr002687; Thu, 10 Aug 2017 09:17:16 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7A9HGNS002686; Thu, 10 Aug 2017 09:17:16 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201708100917.v7A9HGNS002686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Thu, 10 Aug 2017 09:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322350 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 09:17:17 -0000 Author: royger Date: Thu Aug 10 09:17:16 2017 New Revision: 322350 URL: https://svnweb.freebsd.org/changeset/base/322350 Log: calendars: add myself to the FreeBSD calendar Reported by: mckusick Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 09:16:40 2017 (r322349) +++ head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 09:17:16 2017 (r322350) @@ -223,6 +223,7 @@ 06/06 Alan Eldridge died in Denver, Colorado, 2003 06/07 Jimmy Olgeni born in Milano, Italy, 1976 06/07 Benjamin Close born in Adelaide, Australia, 1978 +06/07 Roger Pau Monne born in Reus, Catalunya, Spain, 1986 06/08 Ravi Pokala born in Royal Oak, Michigan, United States, 1980 06/09 Stanislav Galabov born in Sofia, Bulgaria 1978 06/11 Alonso Cardenas Marquez born in Arequipa, Peru, 1979 From owner-svn-src-all@freebsd.org Thu Aug 10 10:59:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF4DEDCEABC; Thu, 10 Aug 2017 10:59:06 +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 mx1.freebsd.org (Postfix) with ESMTPS id 848CD7F4D3; Thu, 10 Aug 2017 10:59:06 +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 v7AAx5Bb043135; Thu, 10 Aug 2017 10:59:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AAx5f8043134; Thu, 10 Aug 2017 10:59:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708101059.v7AAx5f8043134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 10 Aug 2017 10:59:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322351 - head/usr.sbin/acpi/acpidump X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 322351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 10:59:07 -0000 Author: mav Date: Thu Aug 10 10:59:05 2017 New Revision: 322351 URL: https://svnweb.freebsd.org/changeset/base/322351 Log: Add two NFIT fields missed in r321298. MFC after: 2 weeks Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 10 09:17:16 2017 (r322350) +++ head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 10 10:59:05 2017 (r322351) @@ -1236,6 +1236,7 @@ acpi_print_nfit(ACPI_NFIT_HEADER *nfit) (uintmax_t)mmap->RegionOffset); printf("\tAddress=0x%016jx\n", (uintmax_t)mmap->Address); printf("\tInterleaveIndex=%u\n", (u_int)mmap->InterleaveIndex); + printf("\tInterleaveWays=%u\n", (u_int)mmap->InterleaveWays); #define PRINTFLAG(var, flag) printflag((var), ACPI_NFIT_MEM_## flag, #flag) @@ -1283,6 +1284,7 @@ acpi_print_nfit(ACPI_NFIT_HEADER *nfit) (u_int)ctlreg->ManufacturingDate); printf("\tSerialNumber=%u\n", (u_int)ctlreg->SerialNumber); + printf("\tCode=0x%04x\n", (u_int)ctlreg->Code); printf("\tWindows=%u\n", (u_int)ctlreg->Windows); printf("\tWindowSize=0x%016jx\n", (uintmax_t)ctlreg->WindowSize); From owner-svn-src-all@freebsd.org Thu Aug 10 12:30:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7854DD14E0; Thu, 10 Aug 2017 12:30:35 +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 mx1.freebsd.org (Postfix) with ESMTPS id 857D082172; Thu, 10 Aug 2017 12:30:35 +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 v7ACUYuv079720; Thu, 10 Aug 2017 12:30:34 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ACUYla079719; Thu, 10 Aug 2017 12:30:34 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708101230.v7ACUYla079719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 10 Aug 2017 12:30:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322352 - head/release/packages X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/packages X-SVN-Commit-Revision: 322352 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 12:30:35 -0000 Author: gjb Date: Thu Aug 10 12:30:34 2017 New Revision: 322352 URL: https://svnweb.freebsd.org/changeset/base/322352 Log: Revise part of r322327 in release/packages/kernel.ucl. It appears I misunderstand process forking and signal handling in how the pre-/post-install scripts are executed internally by pkg(8). In some cases (not all), ^C when prompted to cancel the kernel package update will stop the pre-install script from executing, but allow pkg(8) to continue extracting the package when it is not the intent. In order to keep somewhat of an anti-footshooting measure in place, print the recommendation to install the kernel package first if ASSUME_ALWAYS_YES is false and TERM is set, then sleep for 5 seconds to allow the user to see the message. MFC after: 5 days MFC with: r322327 X-MFC-Note: Maybe not until I am happy with this.. Sponsored by: The FreeBSD Foundation Modified: head/release/packages/kernel.ucl Modified: head/release/packages/kernel.ucl ============================================================================== --- head/release/packages/kernel.ucl Thu Aug 10 10:59:05 2017 (r322351) +++ head/release/packages/kernel.ucl Thu Aug 10 12:30:34 2017 (r322352) @@ -25,6 +25,9 @@ scripts: { continue ;; esac + if [ -z "${TERM}" ]; then + exit 0 + fi echo "****************************************************************" echo "It is recommended to install the FreeBSD-%PKGNAME% package" echo "with:" @@ -37,16 +40,7 @@ scripts: { echo " pkg upgrade" echo echo "****************************************************************" - echo - echo "Do you want to continue anyway?" - echo "[Enter] to continue, ^C to cancel." - echo - read ANSWER - case ${ANSWER} in - *) - continue - ;; - esac + sleep 5 EOD post-install = < Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 863B4DD1744; Thu, 10 Aug 2017 12:31:56 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 506BC823E6; Thu, 10 Aug 2017 12:31:56 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ACVtDe082585; Thu, 10 Aug 2017 12:31:55 GMT (envelope-from oleg@FreeBSD.org) Received: (from oleg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ACVttu082584; Thu, 10 Aug 2017 12:31:55 GMT (envelope-from oleg@FreeBSD.org) Message-Id: <201708101231.v7ACVttu082584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oleg set sender to oleg@FreeBSD.org using -f From: Oleg Bulyzhin Date: Thu, 10 Aug 2017 12:31:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322353 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: oleg X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 12:31:56 -0000 Author: oleg Date: Thu Aug 10 12:31:55 2017 New Revision: 322353 URL: https://svnweb.freebsd.org/changeset/base/322353 Log: Add myself. Reported by: mckusick Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 12:30:34 2017 (r322352) +++ head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 12:31:55 2017 (r322353) @@ -155,6 +155,7 @@ 04/22 Jakub Klama born in Blachownia, Silesia, Poland, 1989 04/25 Richard Gallamore born in Kissimmee, Florida, United States, 1987 04/26 Rene Ladan born in Geldrop, the Netherlands, 1980 +04/28 Oleg Bulyzhin born in Kharkov, USSR, 1976 04/28 Andriy Voskoboinyk born in Bila Tserkva, Ukraine, 1992 04/29 Adam Weinberger born in Berkeley, California, United States, 1980 04/29 Eric Anholt born in Portland, Oregon, United States, 1983 From owner-svn-src-all@freebsd.org Thu Aug 10 12:51:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BD09DD1CD2; Thu, 10 Aug 2017 12:51:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17DC882D08; Thu, 10 Aug 2017 12:51:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ACp5g0088243; Thu, 10 Aug 2017 12:51:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ACp5oL088242; Thu, 10 Aug 2017 12:51:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708101251.v7ACp5oL088242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 10 Aug 2017 12:51:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322354 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 322354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 12:51:06 -0000 Author: hselasky Date: Thu Aug 10 12:51:04 2017 New Revision: 322354 URL: https://svnweb.freebsd.org/changeset/base/322354 Log: Make sure the linux_wait_event_common() function in the LinuxKPI properly handles a timeout value of MAX_SCHEDULE_TIMEOUT which basically means there is no timeout. This is a regression issue after r319757. While at it change the type of returned variable from "long" to "int" to match the actual return type. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_schedule.c Modified: head/sys/compat/linuxkpi/common/src/linux_schedule.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_schedule.c Thu Aug 10 12:31:55 2017 (r322353) +++ head/sys/compat/linuxkpi/common/src/linux_schedule.c Thu Aug 10 12:51:04 2017 (r322354) @@ -213,12 +213,18 @@ linux_wait_event_common(wait_queue_head_t *wqh, wait_q unsigned int state, spinlock_t *lock) { struct task_struct *task; - long ret; + int ret; if (lock != NULL) spin_unlock_irq(lock); DROP_GIANT(); + + /* range check timeout */ + if (timeout < 1) + timeout = 1; + else if (timeout == MAX_SCHEDULE_TIMEOUT) + timeout = 0; task = current; From owner-svn-src-all@freebsd.org Thu Aug 10 13:00:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE622DD1EA2; Thu, 10 Aug 2017 13:00:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D2C683326; Thu, 10 Aug 2017 13:00:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AD0AvK091860; Thu, 10 Aug 2017 13:00:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AD0AIN091859; Thu, 10 Aug 2017 13:00:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708101300.v7AD0AIN091859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 10 Aug 2017 13:00:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322355 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 322355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 13:00:11 -0000 Author: hselasky Date: Thu Aug 10 13:00:10 2017 New Revision: 322355 URL: https://svnweb.freebsd.org/changeset/base/322355 Log: Fixes for wait event in the LinuxKPI. These are regression issues after r319757. 1) Correct the return value from __wait_event_common() from 1 to 0 in case the timeout is specified as MAX_SCHEDULE_TIMEOUT. In the other case __ret is zero and will be substituted in the last part of the macro with the appropriate value before return. 2) Make sure the "timeout" argument is casted to "int" before evaluating negativity. Else the signedness of a "long" might be checked instead of the signedness of an integer. 3) The wait_event() function should not have a return value. Found by: KrishnamRaju ErapaRaju MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/wait.h Thu Aug 10 12:51:04 2017 (r322354) +++ head/sys/compat/linuxkpi/common/include/linux/wait.h Thu Aug 10 13:00:10 2017 (r322355) @@ -127,16 +127,14 @@ int linux_wait_event_common(wait_queue_head_t *, wait_ */ #define __wait_event_common(wqh, cond, timeout, state, lock) ({ \ DEFINE_WAIT(__wq); \ - const int __timeout = (timeout) < 1 ? 1 : (timeout); \ + const int __timeout = ((int)(timeout)) < 1 ? 1 : (timeout); \ int __start = ticks; \ int __ret = 0; \ \ for (;;) { \ linux_prepare_to_wait(&(wqh), &__wq, state); \ - if (cond) { \ - __ret = 1; \ + if (cond) \ break; \ - } \ __ret = linux_wait_event_common(&(wqh), &__wq, \ __timeout, state, lock); \ if (__ret != 0) \ @@ -158,10 +156,10 @@ int linux_wait_event_common(wait_queue_head_t *, wait_ __ret; \ }) -#define wait_event(wqh, cond) ({ \ - __wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT, \ +#define wait_event(wqh, cond) do { \ + (void) __wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT, \ TASK_UNINTERRUPTIBLE, NULL); \ -}) +} while (0) #define wait_event_timeout(wqh, cond, timeout) ({ \ __wait_event_common(wqh, cond, timeout, TASK_UNINTERRUPTIBLE, \ From owner-svn-src-all@freebsd.org Thu Aug 10 13:01:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD826DD203B; Thu, 10 Aug 2017 13:01:20 +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 mx1.freebsd.org (Postfix) with ESMTPS id 8C9F183600; Thu, 10 Aug 2017 13:01:20 +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 v7AD1JoB095843; Thu, 10 Aug 2017 13:01:19 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AD1JPM095842; Thu, 10 Aug 2017 13:01:19 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708101301.v7AD1JPM095842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 10 Aug 2017 13:01:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322356 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322356 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 13:01:20 -0000 Author: emaste Date: Thu Aug 10 13:01:19 2017 New Revision: 322356 URL: https://svnweb.freebsd.org/changeset/base/322356 Log: Mark PROFILE option as broken when targetting mips64 The assembly in sys/mips/include/profile.h will only work for o32 ABI. Submitted by: Alexander Richardson MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11950 Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Thu Aug 10 13:00:10 2017 (r322355) +++ head/share/mk/src.opts.mk Thu Aug 10 13:01:19 2017 (r322356) @@ -282,7 +282,10 @@ BROKEN_OPTIONS+=SSP .if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || ${__T:Mriscv*} BROKEN_OPTIONS+=EFI .endif - +.if ${__T:Mmips64*} +# profiling won't work on MIPS64 because there is only assembly for o32 +BROKEN_OPTIONS+=PROFILE +.endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ ${__T} == "powerpc64" || ${__T} == "sparc64" __DEFAULT_YES_OPTIONS+=CXGBETOOL From owner-svn-src-all@freebsd.org Thu Aug 10 13:05:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21498DD20D8; Thu, 10 Aug 2017 13:05:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F18A083882; Thu, 10 Aug 2017 13:05:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AD5fT6096021; Thu, 10 Aug 2017 13:05:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AD5eK3096017; Thu, 10 Aug 2017 13:05:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708101305.v7AD5eK3096017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 10 Aug 2017 13:05:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322357 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 322357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 13:05:42 -0000 Author: hselasky Date: Thu Aug 10 13:05:40 2017 New Revision: 322357 URL: https://svnweb.freebsd.org/changeset/base/322357 Log: Use integer type to pass around jiffies and/or ticks values in the LinuxKPI because in FreeBSD ticks are 32-bit. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/completion.h head/sys/compat/linuxkpi/common/include/linux/jiffies.h head/sys/compat/linuxkpi/common/include/linux/timer.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/completion.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/completion.h Thu Aug 10 13:01:19 2017 (r322356) +++ head/sys/compat/linuxkpi/common/include/linux/completion.h Thu Aug 10 13:05:40 2017 (r322357) @@ -61,8 +61,8 @@ struct completion { linux_completion_done(c) extern void linux_complete_common(struct completion *, int); -extern long linux_wait_for_common(struct completion *, int); -extern long linux_wait_for_timeout_common(struct completion *, long, int); +extern int linux_wait_for_common(struct completion *, int); +extern int linux_wait_for_timeout_common(struct completion *, int, int); extern int linux_try_wait_for_completion(struct completion *); extern int linux_completion_done(struct completion *); Modified: head/sys/compat/linuxkpi/common/include/linux/jiffies.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/jiffies.h Thu Aug 10 13:01:19 2017 (r322356) +++ head/sys/compat/linuxkpi/common/include/linux/jiffies.h Thu Aug 10 13:05:40 2017 (r322357) @@ -141,7 +141,7 @@ get_jiffies_64(void) } static inline int -linux_timer_jiffies_until(unsigned long expires) +linux_timer_jiffies_until(int expires) { int delta = expires - jiffies; /* guard against already expired values */ Modified: head/sys/compat/linuxkpi/common/include/linux/timer.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/timer.h Thu Aug 10 13:01:19 2017 (r322356) +++ head/sys/compat/linuxkpi/common/include/linux/timer.h Thu Aug 10 13:05:40 2017 (r322357) @@ -41,7 +41,7 @@ struct timer_list { struct callout timer_callout; void (*function) (unsigned long); unsigned long data; - unsigned long expires; + int expires; }; extern unsigned long linux_timer_hz_mask; @@ -65,7 +65,7 @@ extern unsigned long linux_timer_hz_mask; callout_init(&(timer)->timer_callout, 1); \ } while (0) -extern void mod_timer(struct timer_list *, unsigned long); +extern void mod_timer(struct timer_list *, int); extern void add_timer(struct timer_list *); extern void add_timer_on(struct timer_list *, int cpu); @@ -73,7 +73,7 @@ extern void add_timer_on(struct timer_list *, int cpu) #define del_timer_sync(timer) callout_drain(&(timer)->timer_callout) #define timer_pending(timer) callout_pending(&(timer)->timer_callout) #define round_jiffies(j) \ - ((unsigned long)(((j) + linux_timer_hz_mask) & ~linux_timer_hz_mask)) + ((int)(((j) + linux_timer_hz_mask) & ~linux_timer_hz_mask)) #define round_jiffies_relative(j) round_jiffies(j) #define round_jiffies_up(j) round_jiffies(j) #define round_jiffies_up_relative(j) round_jiffies_up(j) Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Aug 10 13:01:19 2017 (r322356) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Thu Aug 10 13:05:40 2017 (r322357) @@ -1598,7 +1598,7 @@ linux_timer_callback_wrapper(void *context) } void -mod_timer(struct timer_list *timer, unsigned long expires) +mod_timer(struct timer_list *timer, int expires) { timer->expires = expires; @@ -1660,10 +1660,10 @@ linux_complete_common(struct completion *c, int all) /* * Indefinite wait for done != 0 with or without signals. */ -long +int linux_wait_for_common(struct completion *c, int flags) { - long error; + int error; if (SCHEDULER_STOPPED()) return (0); @@ -1700,10 +1700,11 @@ intr: /* * Time limited wait for done != 0 with or without signals. */ -long -linux_wait_for_timeout_common(struct completion *c, long timeout, int flags) +int +linux_wait_for_timeout_common(struct completion *c, int timeout, int flags) { - long end = jiffies + timeout, error; + int end = jiffies + timeout; + int error; int ret; if (SCHEDULER_STOPPED()) From owner-svn-src-all@freebsd.org Thu Aug 10 13:32:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17A48DD2CC4; Thu, 10 Aug 2017 13:32:06 +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 mx1.freebsd.org (Postfix) with ESMTPS id D66C3E20; Thu, 10 Aug 2017 13:32:05 +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 v7ADW5iS008389; Thu, 10 Aug 2017 13:32:05 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ADW52T008388; Thu, 10 Aug 2017 13:32:05 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708101332.v7ADW52T008388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 10 Aug 2017 13:32:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322358 - head/release/packages X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/packages X-SVN-Commit-Revision: 322358 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 13:32:06 -0000 Author: gjb Date: Thu Aug 10 13:32:04 2017 New Revision: 322358 URL: https://svnweb.freebsd.org/changeset/base/322358 Log: Further revise r322327 and r322352 in release/packages/kernel.ucl. Use PPID and PID to kill off the pre-install and parent pkg(8) processes unless 'Y' or 'y' are entered at the prompt if the user wants to proceed with upgrading the kernel and userland at the same time. This restores some of the logic and intent of r322327, with the caveat of printing "child process terminated unexpectedly." MFC after: 5 days MFC with: r322327, r322352 Sponsored by: The FreeBSD Foundation Modified: head/release/packages/kernel.ucl Modified: head/release/packages/kernel.ucl ============================================================================== --- head/release/packages/kernel.ucl Thu Aug 10 13:05:40 2017 (r322357) +++ head/release/packages/kernel.ucl Thu Aug 10 13:32:04 2017 (r322358) @@ -40,7 +40,17 @@ scripts: { echo " pkg upgrade" echo echo "****************************************************************" - sleep 5 + echo + echo "Do you want to continue anyway? (N/y)" + read ANSWER + case ${ANSWER} in + [Yy]) + exit 0 + ;; + *) + kill ${PPID} ${PID} + ;; + esac EOD post-install = < Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEE33DD34E6; Thu, 10 Aug 2017 13:45:57 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE329174C; Thu, 10 Aug 2017 13:45:57 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ADjunl012425; Thu, 10 Aug 2017 13:45:56 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ADjuCl012424; Thu, 10 Aug 2017 13:45:56 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201708101345.v7ADjuCl012424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 10 Aug 2017 13:45:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322359 - head/sys/dev/ofw X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ofw X-SVN-Commit-Revision: 322359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 13:45:58 -0000 Author: mw Date: Thu Aug 10 13:45:56 2017 New Revision: 322359 URL: https://svnweb.freebsd.org/changeset/base/322359 Log: Enable OF_setprop API function to add property in FDT This patch modifies function ofw_fdt_setprop (called by OF_setprop), so that it can add property, when replacing is not possible. Adding property is needed to fixup FDT's that have missing properties. Submitted by: Patryk Duda Reviewed by: nwhitehorn, cognet (mentor) Approved by: cognet (mentor) Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D11879 Modified: head/sys/dev/ofw/ofw_fdt.c Modified: head/sys/dev/ofw/ofw_fdt.c ============================================================================== --- head/sys/dev/ofw/ofw_fdt.c Thu Aug 10 13:32:04 2017 (r322358) +++ head/sys/dev/ofw/ofw_fdt.c Thu Aug 10 13:45:56 2017 (r322359) @@ -381,7 +381,11 @@ ofw_fdt_setprop(ofw_t ofw, phandle_t package, const ch if (offset < 0) return (-1); - return (fdt_setprop_inplace(fdtp, offset, propname, buf, len)); + if (fdt_setprop_inplace(fdtp, offset, propname, buf, len) != 0) + /* Try to add property, when setting value inplace failed */ + return (fdt_setprop(fdtp, offset, propname, buf, len)); + + return (0); } /* Convert a device specifier to a fully qualified pathname. */ From owner-svn-src-all@freebsd.org Thu Aug 10 13:51:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02870DD380F; Thu, 10 Aug 2017 13:51:06 +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 mx1.freebsd.org (Postfix) with ESMTPS id D19641B60; Thu, 10 Aug 2017 13:51:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ADp4g4012645; Thu, 10 Aug 2017 13:51:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ADp4N1012641; Thu, 10 Aug 2017 13:51:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708101351.v7ADp4N1012641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 10 Aug 2017 13:51:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322360 - head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD X-SVN-Commit-Revision: 322360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 13:51:06 -0000 Author: emaste Date: Thu Aug 10 13:51:04 2017 New Revision: 322360 URL: https://svnweb.freebsd.org/changeset/base/322360 Log: lldb: Report inferior signals as signals, not exceptions, on FreeBSD This is the FreeBSD equivalent of LLVM r238549. This serves 2 purposes: * LLDB should handle inferior process signals SIGSEGV/SIGILL/SIGBUS/ SIGFPE the way it is suppose to be handled. Prior to this fix these signals will neither create a coredump, nor exit from the debugger or work for signal handling scenario. * eInvalidCrashReason need not report "unknown crash reason" if we have a valid si_signo llvm.org/pr23699 Patch by Karnajit Wangkhem Differential Revision: https://reviews.llvm.org/D35223 Submitted by: Karnajit Wangkhem Obtained from: LLVM r310591 Modified: head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.h head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Modified: head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp Thu Aug 10 13:45:56 2017 (r322359) +++ head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp Thu Aug 10 13:51:04 2017 (r322360) @@ -375,6 +375,7 @@ void FreeBSDThread::Notify(const ProcessMessage &messa LimboNotify(message); break; + case ProcessMessage::eCrashMessage: case ProcessMessage::eSignalMessage: SignalNotify(message); break; @@ -395,10 +396,6 @@ void FreeBSDThread::Notify(const ProcessMessage &messa WatchNotify(message); break; - case ProcessMessage::eCrashMessage: - CrashNotify(message); - break; - case ProcessMessage::eExecMessage: ExecNotify(message); break; @@ -577,27 +574,19 @@ void FreeBSDThread::LimboNotify(const ProcessMessage & void FreeBSDThread::SignalNotify(const ProcessMessage &message) { int signo = message.GetSignal(); - SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo)); + if (message.GetKind() == ProcessMessage::eCrashMessage) { + std::string stop_description = GetCrashReasonString( + message.GetCrashReason(), message.GetFaultAddress()); + SetStopInfo(StopInfo::CreateStopReasonWithSignal( + *this, signo, stop_description.c_str())); + } else { + SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo)); + } } void FreeBSDThread::SignalDeliveredNotify(const ProcessMessage &message) { int signo = message.GetSignal(); SetStopInfo(StopInfo::CreateStopReasonWithSignal(*this, signo)); -} - -void FreeBSDThread::CrashNotify(const ProcessMessage &message) { - // FIXME: Update stop reason as per bugzilla 14598 - int signo = message.GetSignal(); - - assert(message.GetKind() == ProcessMessage::eCrashMessage); - - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); - if (log) - log->Printf("FreeBSDThread::%s () signo = %i, reason = '%s'", __FUNCTION__, - signo, message.PrintCrashReason()); - - SetStopInfo(lldb::StopInfoSP(new POSIXCrashStopInfo( - *this, signo, message.GetCrashReason(), message.GetFaultAddress()))); } unsigned FreeBSDThread::GetRegisterIndexFromOffset(unsigned offset) { Modified: head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp Thu Aug 10 13:45:56 2017 (r322359) +++ head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.cpp Thu Aug 10 13:51:04 2017 (r322360) @@ -28,22 +28,6 @@ bool POSIXLimboStopInfo::ShouldStop(Event *event_ptr) bool POSIXLimboStopInfo::ShouldNotify(Event *event_ptr) { return false; } //===----------------------------------------------------------------------===// -// POSIXCrashStopInfo - -POSIXCrashStopInfo::POSIXCrashStopInfo(FreeBSDThread &thread, uint32_t status, - CrashReason reason, - lldb::addr_t fault_addr) - : POSIXStopInfo(thread, status) { - m_description = ::GetCrashReasonString(reason, fault_addr); -} - -POSIXCrashStopInfo::~POSIXCrashStopInfo() {} - -lldb::StopReason POSIXCrashStopInfo::GetStopReason() const { - return lldb::eStopReasonException; -} - -//===----------------------------------------------------------------------===// // POSIXNewThreadStopInfo POSIXNewThreadStopInfo::~POSIXNewThreadStopInfo() {} Modified: head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.h ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.h Thu Aug 10 13:45:56 2017 (r322359) +++ head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/POSIXStopInfo.h Thu Aug 10 13:51:04 2017 (r322360) @@ -45,19 +45,6 @@ class POSIXLimboStopInfo : public POSIXStopInfo { (pub }; //===----------------------------------------------------------------------===// -/// @class POSIXCrashStopInfo -/// @brief Represents the stop state of process that is ready to crash. -/// -class POSIXCrashStopInfo : public POSIXStopInfo { -public: - POSIXCrashStopInfo(FreeBSDThread &thread, uint32_t status, CrashReason reason, - lldb::addr_t fault_addr); - ~POSIXCrashStopInfo(); - - lldb::StopReason GetStopReason() const; -}; - -//===----------------------------------------------------------------------===// /// @class POSIXNewThreadStopInfo /// @brief Represents the stop state of process when a new thread is spawned. /// Modified: head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp ============================================================================== --- head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Thu Aug 10 13:45:56 2017 (r322359) +++ head/contrib/llvm/tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Thu Aug 10 13:51:04 2017 (r322360) @@ -1192,7 +1192,9 @@ ProcessMessage ProcessMonitor::MonitorSignal(ProcessMo case SIGBUS: lldb::addr_t fault_addr = reinterpret_cast(info->si_addr); const auto reason = GetCrashReason(*info); - return ProcessMessage::Crash(tid, reason, signo, fault_addr); + if (reason != CrashReason::eInvalidCrashReason) { + return ProcessMessage::Crash(tid, reason, signo, fault_addr); + } // else; Use atleast si_signo info for other si_code } // Everything else is "normal" and does not require any special action on From owner-svn-src-all@freebsd.org Thu Aug 10 14:18:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D33FDD3F06; Thu, 10 Aug 2017 14:18:12 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47C9F29A8; Thu, 10 Aug 2017 14:18:12 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AEIBpL024833; Thu, 10 Aug 2017 14:18:11 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AEI9bx024812; Thu, 10 Aug 2017 14:18:09 GMT (envelope-from br@FreeBSD.org) Message-Id: <201708101418.v7AEI9bx024812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 10 Aug 2017 14:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322361 - in head: lib/csu/riscv lib/libc/riscv/gen libexec/rtld-elf/riscv share/mk sys/boot/fdt/dts/riscv sys/conf sys/riscv/conf sys/riscv/include sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head: lib/csu/riscv lib/libc/riscv/gen libexec/rtld-elf/riscv share/mk sys/boot/fdt/dts/riscv sys/conf sys/riscv/conf sys/riscv/include sys/riscv/riscv X-SVN-Commit-Revision: 322361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 14:18:12 -0000 Author: br Date: Thu Aug 10 14:18:09 2017 New Revision: 322361 URL: https://svnweb.freebsd.org/changeset/base/322361 Log: Support for v1.10 (latest) of RISC-V privilege specification. New version is not compatible on supervisor mode with v1.9.1 (previous version). Highlights: o BBL (Berkeley Boot Loader) provides no initial page tables anymore allowing us to choose VM, to build page tables manually and enable MMU in S-mode. o SBI interface changed. o GENERIC kernel. FDT is now chosen standard for RISC-V hardware description. DTB is now provided by Spike (golden model simulator). This allows us to introduce GENERIC kernel. However, description for console and timer devices is not provided in DTB, so move these devices temporary to nexus bus. o Supervisor can't access userspace by default. Solution is to set SUM (permit Supervisor User Memory access) bit in sstatus register. o Compressed extension is now turned on by default. o External GCC 7.1 compiler used. o _gp renamed to __global_pointer$ o Compiler -march= string is now in use allowing us to choose required extensions (compressed, FPU, atomic, etc). Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11800 Deleted: head/sys/boot/fdt/dts/riscv/ head/sys/riscv/conf/LOWRISC head/sys/riscv/conf/LOWRISC.hints head/sys/riscv/conf/QEMU head/sys/riscv/conf/ROCKET head/sys/riscv/conf/SPIKE head/sys/riscv/riscv/sbi.S Modified: head/lib/csu/riscv/crt1.c head/lib/csu/riscv/crti.S head/lib/libc/riscv/gen/fabs.S head/libexec/rtld-elf/riscv/reloc.c head/share/mk/bsd.cpu.mk head/share/mk/bsd.stand.mk head/sys/conf/Makefile.riscv head/sys/conf/files.riscv head/sys/conf/kern.mk head/sys/riscv/conf/GENERIC head/sys/riscv/include/machdep.h head/sys/riscv/include/riscvreg.h head/sys/riscv/include/sbi.h head/sys/riscv/riscv/cpufunc_asm.S head/sys/riscv/riscv/exception.S head/sys/riscv/riscv/intr_machdep.c head/sys/riscv/riscv/locore.S head/sys/riscv/riscv/machdep.c head/sys/riscv/riscv/nexus.c head/sys/riscv/riscv/pmap.c head/sys/riscv/riscv/riscv_console.c head/sys/riscv/riscv/swtch.S head/sys/riscv/riscv/timer.c head/sys/riscv/riscv/trap.c head/sys/riscv/riscv/vm_machdep.c Modified: head/lib/csu/riscv/crt1.c ============================================================================== --- head/lib/csu/riscv/crt1.c Thu Aug 10 13:51:04 2017 (r322360) +++ head/lib/csu/riscv/crt1.c Thu Aug 10 14:18:09 2017 (r322361) @@ -1,7 +1,7 @@ /* LINTLIBRARY */ /*- * Copyright 1996-1998 John D. Polstra. - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -64,7 +64,10 @@ __asm(" .text \n" " slli t0, a0, 3 \n" /* mult by arg size */ " add a2, a1, t0 \n" /* env is after argv */ " addi a2, a2, 8 \n" /* argv is null terminated */ -" lla gp, _gp \n" /* load global pointer */ +" .option push \n" +" .option norelax \n" +" lla gp, __global_pointer$\n" +" .option pop \n" " call __start"); void Modified: head/lib/csu/riscv/crti.S ============================================================================== --- head/lib/csu/riscv/crti.S Thu Aug 10 13:51:04 2017 (r322360) +++ head/lib/csu/riscv/crti.S Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -35,12 +35,13 @@ #include __FBSDID("$FreeBSD$"); -# this puts _gp into .dynsym, so symlook_obj can now find that (see reloc.c) - .weak _gp -_gp: +# this puts __global_pointer$ into .dynsym, so symlook_obj can now find that +# (see reloc.c) + .weak __global_pointer$ +__global_pointer$: .section .init,"ax",@progbits - .align 2 + .align 0 .globl _init .type _init,@function _init: @@ -48,7 +49,7 @@ _init: sd ra, 0(sp) .section .fini,"ax",@progbits - .align 2 + .align 0 .globl _fini .type _fini,@function _fini: Modified: head/lib/libc/riscv/gen/fabs.S ============================================================================== --- head/lib/libc/riscv/gen/fabs.S Thu Aug 10 13:51:04 2017 (r322360) +++ head/lib/libc/riscv/gen/fabs.S Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -35,7 +35,9 @@ #include __FBSDID("$FreeBSD$"); +#ifndef SOFTFLOAT ENTRY(fabs) fabs.d fa0, fa0 ret END(fabs) +#endif Modified: head/libexec/rtld-elf/riscv/reloc.c ============================================================================== --- head/libexec/rtld-elf/riscv/reloc.c Thu Aug 10 13:51:04 2017 (r322360) +++ head/libexec/rtld-elf/riscv/reloc.c Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * This software was developed by SRI International and the University of @@ -62,7 +62,7 @@ set_gp(Obj_Entry *obj) __asm __volatile("mv %0, gp" : "=r"(old)); - symlook_init(&req, "_gp"); + symlook_init(&req, "__global_pointer$"); req.ventry = NULL; req.flags = SYMLOOK_EARLY; res = symlook_obj(&req, obj); Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Thu Aug 10 13:51:04 2017 (r322360) +++ head/share/mk/bsd.cpu.mk Thu Aug 10 14:18:09 2017 (r322361) @@ -364,8 +364,11 @@ CFLAGS += -mcpu=8540 -Wa,-me500 -mspe=yes -mabi=spe -m .if ${MACHINE_CPUARCH} == "riscv" .if ${TARGET_ARCH:Mriscv*sf} -CFLAGS += -mno-float -ACFLAGS += -mno-float +CFLAGS += -march=rv64imac -mabi=lp64 +ACFLAGS += -march=rv64imac -mabi=lp64 +.else +CFLAGS += -march=rv64imafdc -mabi=lp64 +ACFLAGS += -march=rv64imafdc -mabi=lp64 .endif .endif Modified: head/share/mk/bsd.stand.mk ============================================================================== --- head/share/mk/bsd.stand.mk Thu Aug 10 13:51:04 2017 (r322360) +++ head/share/mk/bsd.stand.mk Thu Aug 10 14:18:09 2017 (r322361) @@ -7,7 +7,7 @@ CFLAGS+= -ffreestanding -Wformat CFLAGS+= ${CFLAGS_NO_SIMD} -D_STANDALONE .if ${MACHINE_CPUARCH} == "riscv" -CFLAGS+= -mno-float +CFLAGS+= -march=rv64imac -mabi=lp64 .elif ${MACHINE_CPUARCH} != "aarch64" CFLAGS+= -msoft-float .endif Modified: head/sys/conf/Makefile.riscv ============================================================================== --- head/sys/conf/Makefile.riscv Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/conf/Makefile.riscv Thu Aug 10 14:18:09 2017 (r322361) @@ -28,6 +28,11 @@ S= ../../.. INCLUDES+= -I$S/contrib/libfdt +SYSTEM_LD= @${LD} -N -m ${LD_EMULATION} -Bdynamic -T ${LDSCRIPT} ${_LDFLAGS} \ + --no-warn-mismatch --warn-common --export-dynamic \ + --dynamic-linker /red/herring \ + -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o + .if !empty(DDB_ENABLED) CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls .endif Modified: head/sys/conf/files.riscv ============================================================================== --- head/sys/conf/files.riscv Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/conf/files.riscv Thu Aug 10 14:18:09 2017 (r322361) @@ -46,7 +46,6 @@ riscv/riscv/nexus.c standard riscv/riscv/ofw_machdep.c optional fdt riscv/riscv/pmap.c standard riscv/riscv/riscv_console.c optional rcons -riscv/riscv/sbi.S standard riscv/riscv/stack_machdep.c optional ddb | stack riscv/riscv/support.S standard riscv/riscv/swtch.S standard Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/conf/kern.mk Thu Aug 10 14:18:09 2017 (r322361) @@ -121,7 +121,7 @@ INLINE_LIMIT?= 8000 .endif .if ${MACHINE_CPUARCH} == "riscv" -CFLAGS.gcc+= -mcmodel=medany +CFLAGS.gcc+= -mcmodel=medany -march=rv64imafdc -mabi=lp64 INLINE_LIMIT?= 8000 .endif Modified: head/sys/riscv/conf/GENERIC ============================================================================== --- head/sys/riscv/conf/GENERIC Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/conf/GENERIC Thu Aug 10 14:18:09 2017 (r322361) @@ -75,6 +75,9 @@ options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.en options RCTL # Resource limits options SMP +# RISC-V SBI console +device rcons + # Uncomment for memory disk # options MD_ROOT # options MD_ROOT_SIZE=32768 # 32MB ram disk Modified: head/sys/riscv/include/machdep.h ============================================================================== --- head/sys/riscv/include/machdep.h Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/include/machdep.h Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -39,7 +39,10 @@ struct riscv_bootparams { vm_offset_t kern_l1pt; /* Kernel L1 base */ + vm_offset_t kern_phys; /* Kernel base (physical) addr */ vm_offset_t kern_stack; + vm_offset_t dtbp_virt; /* Device tree blob virtual addr */ + vm_offset_t dtbp_phys; /* Device tree blob physical addr */ }; extern vm_paddr_t physmap[]; Modified: head/sys/riscv/include/riscvreg.h ============================================================================== --- head/sys/riscv/include/riscvreg.h Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/include/riscvreg.h Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -51,6 +51,9 @@ #define EXCP_SUPERVISOR_ECALL 9 #define EXCP_HYPERVISOR_ECALL 10 #define EXCP_MACHINE_ECALL 11 +#define EXCP_INST_PAGE_FAULT 12 +#define EXCP_LOAD_PAGE_FAULT 13 +#define EXCP_STORE_PAGE_FAULT 15 #define EXCP_INTR (1ul << 63) #define SSTATUS_UIE (1 << 0) @@ -68,7 +71,7 @@ #define SSTATUS_FS_MASK (0x3 << SSTATUS_FS_SHIFT) #define SSTATUS_XS_SHIFT 15 #define SSTATUS_XS_MASK (0x3 << SSTATUS_XS_SHIFT) -#define SSTATUS_PUM (1 << 18) +#define SSTATUS_SUM (1 << 18) #define SSTATUS32_SD (1 << 63) #define SSTATUS64_SD (1 << 31) @@ -140,6 +143,15 @@ /* Note: sip register has no SIP_STIP bit in Spike simulator */ #define SIP_SSIP (1 << 1) #define SIP_STIP (1 << 5) + +#define SATP_PPN_S 0 +#define SATP_PPN_M (0xfffffffffff << SATP_PPN_S) +#define SATP_ASID_S 44 +#define SATP_ASID_M (0xffff << SATP_ASID_S) +#define SATP_MODE_S 60 +#define SATP_MODE_M (0xf << SATP_MODE_S) +#define SATP_MODE_SV39 (8ULL << SATP_MODE_S) +#define SATP_MODE_SV48 (9ULL << SATP_MODE_S) #if 0 /* lowRISC TODO */ Modified: head/sys/riscv/include/sbi.h ============================================================================== --- head/sys/riscv/include/sbi.h Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/include/sbi.h Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Ruslan Bukin + * Copyright (c) 2016-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -37,29 +37,97 @@ #ifndef _MACHINE_SBI_H_ #define _MACHINE_SBI_H_ -typedef struct { - uint64_t base; - uint64_t size; - uint64_t node_id; -} memory_block_info; +#define SBI_SET_TIMER 0 +#define SBI_CONSOLE_PUTCHAR 1 +#define SBI_CONSOLE_GETCHAR 2 +#define SBI_CLEAR_IPI 3 +#define SBI_SEND_IPI 4 +#define SBI_REMOTE_FENCE_I 5 +#define SBI_REMOTE_SFENCE_VMA 6 +#define SBI_REMOTE_SFENCE_VMA_ASID 7 +#define SBI_SHUTDOWN 8 -uint64_t sbi_query_memory(uint64_t id, memory_block_info *p); -uint64_t sbi_hart_id(void); -uint64_t sbi_num_harts(void); -uint64_t sbi_timebase(void); -void sbi_set_timer(uint64_t stime_value); -void sbi_send_ipi(uint64_t hart_id); -uint64_t sbi_clear_ipi(void); -void sbi_shutdown(void); +static __inline uint64_t +sbi_call(uint64_t arg7, uint64_t arg0, uint64_t arg1, uint64_t arg2) +{ -void sbi_console_putchar(unsigned char ch); -int sbi_console_getchar(void); + register uintptr_t a0 __asm ("a0") = (uintptr_t)(arg0); + register uintptr_t a1 __asm ("a1") = (uintptr_t)(arg1); + register uintptr_t a2 __asm ("a2") = (uintptr_t)(arg2); + register uintptr_t a7 __asm ("a7") = (uintptr_t)(arg7); + __asm __volatile( \ + "ecall" \ + :"+r"(a0) \ + :"r"(a1), "r"(a2), "r"(a7) \ + :"memory"); -void sbi_remote_sfence_vm(uint64_t hart_mask_ptr, uint64_t asid); -void sbi_remote_sfence_vm_range(uint64_t hart_mask_ptr, uint64_t asid, uint64_t start, uint64_t size); -void sbi_remote_fence_i(uint64_t hart_mask_ptr); + return (a0); +} -uint64_t sbi_mask_interrupt(uint64_t which); -uint64_t sbi_unmask_interrupt(uint64_t which); +static __inline void +sbi_console_putchar(int ch) +{ + + sbi_call(SBI_CONSOLE_PUTCHAR, ch, 0, 0); +} + +static __inline int +sbi_console_getchar(void) +{ + + return (sbi_call(SBI_CONSOLE_GETCHAR, 0, 0, 0)); +} + +static __inline void +sbi_set_timer(uint64_t val) +{ + + sbi_call(SBI_SET_TIMER, val, 0, 0); +} + +static __inline void +sbi_shutdown(void) +{ + + sbi_call(SBI_SHUTDOWN, 0, 0, 0); +} + +static __inline void +sbi_clear_ipi(void) +{ + + sbi_call(SBI_CLEAR_IPI, 0, 0, 0); +} + +static __inline void +sbi_send_ipi(const unsigned long *hart_mask) +{ + + sbi_call(SBI_SEND_IPI, (uint64_t)hart_mask, 0, 0); +} + +static __inline void +sbi_remote_fence_i(const unsigned long *hart_mask) +{ + + sbi_call(SBI_REMOTE_FENCE_I, (uint64_t)hart_mask, 0, 0); +} + +static __inline void +sbi_remote_sfence_vma(const unsigned long *hart_mask, + unsigned long start, unsigned long size) +{ + + sbi_call(SBI_REMOTE_SFENCE_VMA, (uint64_t)hart_mask, 0, 0); +} + +static __inline void +sbi_remote_sfence_vma_asid(const unsigned long *hart_mask, + unsigned long start, unsigned long size, + unsigned long asid) +{ + + sbi_call(SBI_REMOTE_SFENCE_VMA_ASID, (uint64_t)hart_mask, 0, 0); +} #endif /* !_MACHINE_SBI_H_ */ Modified: head/sys/riscv/riscv/cpufunc_asm.S ============================================================================== --- head/sys/riscv/riscv/cpufunc_asm.S Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/cpufunc_asm.S Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -51,12 +51,12 @@ END(riscv_nullop) */ ENTRY(riscv_tlb_flushID) - sfence.vm + sfence.vma ret END(riscv_tlb_flushID) ENTRY(riscv_tlb_flushID_SE) - sfence.vm + sfence.vma ret END(riscv_tlb_flushID_SE) @@ -64,7 +64,7 @@ END(riscv_tlb_flushID_SE) * void riscv_dcache_wb_range(vm_offset_t, vm_size_t) */ ENTRY(riscv_dcache_wb_range) - sfence.vm + sfence.vma ret END(riscv_dcache_wb_range) @@ -72,7 +72,7 @@ END(riscv_dcache_wb_range) * void riscv_dcache_wbinv_range(vm_offset_t, vm_size_t) */ ENTRY(riscv_dcache_wbinv_range) - sfence.vm + sfence.vma ret END(riscv_dcache_wbinv_range) @@ -80,7 +80,7 @@ END(riscv_dcache_wbinv_range) * void riscv_dcache_inv_range(vm_offset_t, vm_size_t) */ ENTRY(riscv_dcache_inv_range) - sfence.vm + sfence.vma ret END(riscv_dcache_inv_range) @@ -89,7 +89,7 @@ END(riscv_dcache_inv_range) */ ENTRY(riscv_idcache_wbinv_range) fence.i - sfence.vm + sfence.vma ret END(riscv_idcache_wbinv_range) Modified: head/sys/riscv/riscv/exception.S ============================================================================== --- head/sys/riscv/riscv/exception.S Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/exception.S Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -116,8 +116,11 @@ __FBSDID("$FreeBSD$"); .macro load_registers el ld t0, (TF_SSTATUS)(sp) .if \el == 0 - /* Ensure user interrupts will be enabled on eret. */ - li t1, SSTATUS_SPIE + /* + * Ensure user interrupts will be enabled on eret + * and supervisor mode can access userspace on trap. + */ + li t1, (SSTATUS_SPIE | SSTATUS_SUM) or t0, t0, t1 .else /* Modified: head/sys/riscv/riscv/intr_machdep.c ============================================================================== --- head/sys/riscv/riscv/intr_machdep.c Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/intr_machdep.c Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -265,12 +265,15 @@ riscv_unmask_ipi(void) static void ipi_send(struct pcpu *pc, int ipi) { + uintptr_t mask; CTR3(KTR_SMP, "%s: cpu=%d, ipi=%x", __func__, pc->pc_cpuid, ipi); atomic_set_32(&pc->pc_pending_ipis, ipi); - sbi_send_ipi(pc->pc_cpuid); + mask = (1 << (pc->pc_cpuid)); + sbi_send_ipi(&mask); + CTR1(KTR_SMP, "%s: sent", __func__); } @@ -302,16 +305,20 @@ void ipi_selected(cpuset_t cpus, u_int ipi) { struct pcpu *pc; + uintptr_t mask; CTR1(KTR_SMP, "ipi_selected: ipi: %x", ipi); + mask = 0; STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) { if (CPU_ISSET(pc->pc_cpuid, &cpus)) { CTR3(KTR_SMP, "%s: pc: %p, ipi: %x\n", __func__, pc, ipi); - ipi_send(pc, ipi); + atomic_set_32(&pc->pc_pending_ipis, ipi); + mask |= (1 << (pc->pc_cpuid)); } } + sbi_send_ipi(&mask); } #endif Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/locore.S Thu Aug 10 14:18:09 2017 (r322361) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -53,149 +53,119 @@ .text .globl _start _start: - /* Setup supervisor trap vector */ - la t0, cpu_exception_handler - csrw stvec, t0 + /* Get the physical address kernel loaded to */ + la t0, virt_map + ld t1, 0(t0) + sub t1, t1, t0 + li t2, KERNBASE + sub s9, t2, t1 /* s9 = physmem base */ + mv s10, a0 /* s10 = hart id */ + mv s11, a1 /* s11 = dtbp */ - /* Ensure sscratch is zero */ - li t0, 0 - csrw sscratch, t0 + li t0, SSTATUS_SUM + csrs sstatus, t0 - /* Load physical memory information */ - li a0, 0 - la a1, memory_info - call sbi_query_memory - - /* Store base to s6 */ - la s6, memory_info - ld s6, 0(s6) /* s6 = physmem base */ - /* Direct secondary cores to mpentry */ - call sbi_hart_id - bnez a0, mpentry + bnez s10, mpentry /* * Page tables */ - /* Create an L1 page for early devmap */ + /* Add L1 entry for kernel */ la s1, pagetable_l1 - la s2, pagetable_l2_devmap /* Link to next level PN */ - li t0, KERNBASE - sub s2, s2, t0 - add s2, s2, s6 + la s2, pagetable_l2 /* Link to next level PN */ srli s2, s2, PAGE_SHIFT - li a5, (VM_MAX_KERNEL_ADDRESS - L2_SIZE) + li a5, KERNBASE srli a5, a5, L1_SHIFT /* >> L1_SHIFT */ andi a5, a5, 0x1ff /* & 0x1ff */ li t4, PTE_V slli t5, s2, PTE_PPN0_S /* (s2 << PTE_PPN0_S) */ or t6, t4, t5 - /* Store single level1 PTE entry to position */ + /* Store L1 PTE entry to position */ li a6, PTE_SIZE mulw a5, a5, a6 add t0, s1, a5 sd t6, (t0) - /* Create an L1 page for SBI */ - la s1, pagetable_l1 - la s2, pagetable_l2_sbi /* Link to next level PN */ - li t0, KERNBASE - sub s2, s2, t0 - add s2, s2, s6 - srli s2, s2, PAGE_SHIFT - li a5, 511 - li t4, PTE_V - slli t5, s2, PTE_PPN0_S /* (s2 << PTE_PPN0_S) */ - or t6, t4, t5 + /* Level 2 superpages (512 x 2MiB) */ + la s1, pagetable_l2 + srli t4, s9, 21 /* Div physmem base by 2 MiB */ + li t2, 512 /* Build 512 entries */ + add t3, t4, t2 + li t5, 0 +2: + li t0, (PTE_V | PTE_RWX | PTE_D) + slli t2, t4, PTE_PPN1_S /* << PTE_PPN1_S */ + or t5, t0, t2 + sd t5, (s1) /* Store PTE entry to position */ + addi s1, s1, PTE_SIZE - /* Store SBI L1 PTE entry to position */ - li a6, PTE_SIZE - mulw a5, a5, a6 - add t0, s1, a5 - sd t6, (t0) + addi t4, t4, 1 + bltu t4, t3, 2b - /* Create an L2 page for SBI */ - la s1, pagetable_l2_sbi - la s2, pagetable_l3_sbi /* Link to next level PN */ - li t0, KERNBASE - sub s2, s2, t0 - add s2, s2, s6 + /* Create an L1 page for early devmap */ + la s1, pagetable_l1 + la s2, pagetable_l2_devmap /* Link to next level PN */ srli s2, s2, PAGE_SHIFT - li a5, 511 + + li a5, (VM_MAX_KERNEL_ADDRESS - L2_SIZE) + srli a5, a5, L1_SHIFT /* >> L1_SHIFT */ + andi a5, a5, 0x1ff /* & 0x1ff */ li t4, PTE_V slli t5, s2, PTE_PPN0_S /* (s2 << PTE_PPN0_S) */ or t6, t4, t5 - /* Store SBI L2 PTE entry to position */ + /* Store single level1 PTE entry to position */ li a6, PTE_SIZE mulw a5, a5, a6 add t0, s1, a5 sd t6, (t0) - /* Create an L3 page for SBI */ - la s1, pagetable_l3_sbi - li s2, 0x8000b000 + /* Create an L2 page superpage for DTB */ + la s1, pagetable_l2_devmap + mv s2, s11 srli s2, s2, PAGE_SHIFT - li a5, 511 - li t4, PTE_V | PTE_RX | PTE_W - slli t5, s2, PTE_PPN0_S /* (s2 << PTE_PPN0_S) */ - or t6, t4, t5 - /* Store SBI L3 PTE entry to position */ - li a6, PTE_SIZE - mulw a5, a5, a6 - add t0, s1, a5 - sd t6, (t0) - /* END SBI page creation */ + li t0, (PTE_V | PTE_RWX | PTE_D) + slli t2, s2, PTE_PPN0_S /* << PTE_PPN0_S */ + or t0, t0, t2 - /* Add L1 entry for kernel */ - la s1, pagetable_l1 - la s2, pagetable_l2 /* Link to next level PN */ - li t0, KERNBASE - sub s2, s2, t0 - add s2, s2, s6 - srli s2, s2, PAGE_SHIFT - - li a5, KERNBASE - srli a5, a5, L1_SHIFT /* >> L1_SHIFT */ - andi a5, a5, 0x1ff /* & 0x1ff */ - li t4, PTE_V - slli t5, s2, PTE_PPN0_S /* (s2 << PTE_PPN0_S) */ - or t6, t4, t5 - - /* Store L1 PTE entry to position */ + /* Store PTE entry to position */ li a6, PTE_SIZE + li a5, 510 mulw a5, a5, a6 - add t0, s1, a5 - sd t6, (t0) + add t1, s1, a5 + sd t0, (t1) - /* Level 2 superpages (512 x 2MiB) */ - la s1, pagetable_l2 - srli t4, s6, 21 /* Div physmem base by 2 MiB */ - li t2, 512 /* Build 512 entries */ - add t3, t4, t2 - li t5, 0 -2: - li t0, (PTE_V | PTE_RWX) - slli t2, t4, PTE_PPN1_S /* << PTE_PPN1_S */ - or t5, t0, t2 - sd t5, (s1) /* Store PTE entry to position */ - addi s1, s1, PTE_SIZE + /* Page tables END */ - addi t4, t4, 1 - bltu t4, t3, 2b + /* Setup supervisor trap vector */ + la t0, va + sub t0, t0, s9 + li t1, KERNBASE + add t0, t0, t1 + csrw stvec, t0 /* Set page tables base register */ la s2, pagetable_l1 - li t0, KERNBASE - sub s2, s2, t0 - add s2, s2, s6 srli s2, s2, PAGE_SHIFT + li t0, SATP_MODE_SV39 + or s2, s2, t0 + sfence.vma csrw sptbr, s2 +va: + /* Setup supervisor trap vector */ + la t0, cpu_exception_handler + csrw stvec, t0 + + /* Ensure sscratch is zero */ + li t0, 0 + csrw sscratch, t0 + /* Initialize stack pointer */ la s3, initstack_end mv sp, s3 @@ -210,14 +180,19 @@ _start: bltu a0, s1, 1b /* Fill riscv_bootparams */ - addi sp, sp, -16 + addi sp, sp, -40 la t0, pagetable_l1 sd t0, 0(sp) /* kern_l1pt */ + sd s9, 8(sp) /* kern_phys */ la t0, initstack_end - sd t0, 8(sp) /* kern_stack */ + sd t0, 16(sp) /* kern_stack */ + li t0, (VM_MAX_KERNEL_ADDRESS - 2 * L2_SIZE) + sd t0, 24(sp) /* dtbp_virt */ + sd s11, 32(sp) /* dtbp_phys */ + mv a0, sp call _C_LABEL(initriscv) /* Off we go */ call _C_LABEL(mi_startup) @@ -258,15 +233,17 @@ pagetable_l2: .space PAGE_SIZE pagetable_l2_devmap: .space PAGE_SIZE -pagetable_l2_sbi: - .space PAGE_SIZE -pagetable_l3_sbi: - .space PAGE_SIZE - .globl memory_info -memory_info: - .space (24) + .align 3 +virt_map: + .quad virt_map + /* Not in use, but required for linking. */ + .align 3 + .globl __global_pointer$ +__global_pointer$: + .space 8 + .globl init_pt_va init_pt_va: .quad pagetable_l2 /* XXX: Keep page tables VA */ @@ -284,6 +261,37 @@ END(mpentry) * Called by a core when it is being brought online. */ ENTRY(mpentry) + /* Setup stack pointer */ + la t0, secondary_stacks + li t1, (PAGE_SIZE * KSTACK_PAGES) + mulw t1, t1, s10 + add t0, t0, t1 + sub t0, t0, s9 + li t1, KERNBASE + add sp, t0, t1 + + /* Setup supervisor trap vector */ + la t0, mpva + sub t0, t0, s9 + li t1, KERNBASE + add t0, t0, t1 + csrw stvec, t0 + + /* Set page tables base register */ + la s2, pagetable_l1 + srli s2, s2, PAGE_SHIFT + li t0, SATP_MODE_SV39 + or s2, s2, t0 + sfence.vma + csrw sptbr, s2 +mpva: + /* Setup supervisor trap vector */ + la t0, cpu_exception_handler + csrw stvec, t0 + + /* Ensure sscratch is zero */ + li t0, 0 + csrw sscratch, t0 /* * Calculate the offset to __riscv_boot_ap * for current core, cpuid in a0. @@ -298,20 +306,6 @@ ENTRY(mpentry) /* Wait the kernel to be ready */ lw t1, 0(t0) beqz t1, 1b - - /* Set page tables base register */ - la s2, pagetable_l1 - li t0, KERNBASE - sub s2, s2, t0 - add s2, s2, s6 - srli s2, s2, PAGE_SHIFT - csrw sptbr, s2 - - /* Setup stack pointer */ - la t0, secondary_stacks - li t1, (PAGE_SIZE * KSTACK_PAGES) - mulw t1, t1, a0 - add sp, t0, t1 call init_secondary END(mpentry) Modified: head/sys/riscv/riscv/machdep.c ============================================================================== --- head/sys/riscv/riscv/machdep.c Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/machdep.c Thu Aug 10 14:18:09 2017 (r322361) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2014 Andrew Turner - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -105,6 +105,8 @@ int cold = 1; long realmem = 0; long Maxmem = 0; +#define DTB_SIZE_MAX (1024 * 1024) + #define PHYSMAP_SIZE (2 * (VM_PHYSSEG_MAX - 1)) vm_paddr_t physmap[PHYSMAP_SIZE]; u_int physmap_idx; @@ -117,7 +119,6 @@ int64_t idcache_line_size; /* The minimum cache line s extern int *end; extern int *initstack_end; -extern memory_block_info memory_info; struct pcpu *pcpup; @@ -315,6 +316,9 @@ CTASSERT(sizeof(((struct trapframe *)0)->tf_s) == CTASSERT(sizeof(((struct trapframe *)0)->tf_t) == sizeof((struct reg *)0)->t); +/* Support for FDT configurations only. */ +CTASSERT(FDT); + int get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) { @@ -714,16 +718,13 @@ add_physmap_entry(uint64_t base, uint64_t length, vm_p #ifdef FDT static void -try_load_dtb(caddr_t kmdp) +try_load_dtb(caddr_t kmdp, vm_offset_t dtbp) { - vm_offset_t dtbp; #if defined(FDT_DTB_STATIC) dtbp = (vm_offset_t)&fdt_static_dtb; -#else - /* TODO */ - dtbp = (vm_offset_t)NULL; #endif + if (dtbp == (vm_offset_t)NULL) { printf("ERROR loading DTB\n"); return; @@ -803,9 +804,14 @@ fake_preload_metadata(struct riscv_bootparams *rvbp __ void initriscv(struct riscv_bootparams *rvbp) { + struct mem_region mem_regions[FDT_MEM_REGIONS]; + vm_offset_t rstart, rend; + vm_offset_t s, e; + int mem_regions_sz; vm_offset_t lastaddr; vm_size_t kernlen; caddr_t kmdp; + int i; /* Set the module data location */ lastaddr = fake_preload_metadata(rvbp); @@ -821,27 +827,35 @@ initriscv(struct riscv_bootparams *rvbp) kern_envp = NULL; #ifdef FDT - try_load_dtb(kmdp); + try_load_dtb(kmdp, rvbp->dtbp_virt); #endif /* Load the physical memory ranges */ physmap_idx = 0; -#if 0 - struct mem_region mem_regions[FDT_MEM_REGIONS]; - int mem_regions_sz; - int i; +#ifdef FDT /* Grab physical memory regions information from device tree. */ if (fdt_get_mem_regions(mem_regions, &mem_regions_sz, NULL) != 0) panic("Cannot get physical memory regions"); - for (i = 0; i < mem_regions_sz; i++) - add_physmap_entry(mem_regions[i].mr_start, - mem_regions[i].mr_size, physmap, &physmap_idx); -#endif - add_physmap_entry(memory_info.base, memory_info.size, - physmap, &physmap_idx); + s = rvbp->dtbp_phys; + e = s + DTB_SIZE_MAX; + for (i = 0; i < mem_regions_sz; i++) { + rstart = mem_regions[i].mr_start; + rend = (mem_regions[i].mr_start + mem_regions[i].mr_size); + + if ((rstart < s) && (rend > e)) { + /* Exclude DTB region. */ + add_physmap_entry(rstart, (s - rstart), physmap, &physmap_idx); + add_physmap_entry(e, (rend - e), physmap, &physmap_idx); + } else { + add_physmap_entry(mem_regions[i].mr_start, + mem_regions[i].mr_size, physmap, &physmap_idx); + } + } +#endif + /* Set the pcpu data, this is needed by pmap_bootstrap */ pcpup = &__pcpu[0]; pcpu_init(pcpup, 0, sizeof(struct pcpu)); @@ -858,7 +872,7 @@ initriscv(struct riscv_bootparams *rvbp) /* Bootstrap enough of pmap to enter the kernel proper */ kernlen = (lastaddr - KERNBASE); - pmap_bootstrap(rvbp->kern_l1pt, memory_info.base, kernlen); + pmap_bootstrap(rvbp->kern_l1pt, mem_regions[0].mr_start, kernlen); cninit(); @@ -866,7 +880,7 @@ initriscv(struct riscv_bootparams *rvbp) /* set page table base register for thread0 */ thread0.td_pcb->pcb_l1addr = \ - (rvbp->kern_l1pt - KERNBASE + memory_info.base); + (rvbp->kern_l1pt - KERNBASE + rvbp->kern_phys); msgbufinit(msgbufp, msgbufsize); mutex_init(); Modified: head/sys/riscv/riscv/nexus.c ============================================================================== --- head/sys/riscv/riscv/nexus.c Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/nexus.c Thu Aug 10 14:18:09 2017 (r322361) @@ -156,6 +156,8 @@ nexus_attach(device_t dev) if (rman_init(&irq_rman) || rman_manage_region(&irq_rman, 0, ~0)) panic("nexus_attach irq_rman"); + nexus_add_child(dev, 8, "timer", 0); + nexus_add_child(dev, 9, "rcons", 0); nexus_add_child(dev, 10, "ofwbus", 0); bus_generic_probe(dev); Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Thu Aug 10 13:51:04 2017 (r322360) +++ head/sys/riscv/riscv/pmap.c Thu Aug 10 14:18:09 2017 (r322361) @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2014 The FreeBSD Foundation * All rights reserved. - * Copyright (c) 2015-2016 Ruslan Bukin + * Copyright (c) 2015-2017 Ruslan Bukin * All rights reserved. * * This code is derived from software contributed to Berkeley by @@ -596,8 +596,10 @@ pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart, min_pa = physmap[i]; if (physmap[i + 1] > max_pa) max_pa = physmap[i + 1]; - break; } + printf("physmap_idx %lx\n", physmap_idx); + printf("min_pa %lx\n", min_pa); + printf("max_pa %lx\n", max_pa); /* Create a direct map region early so we can use it for pa -> va */ pmap_bootstrap_dmap(l1pt, min_pa, max_pa); @@ -771,7 +773,7 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va) /* TODO */ sched_pin(); - __asm __volatile("sfence.vm"); + __asm __volatile("sfence.vma %0" :: "r" (va) : "memory"); sched_unpin(); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Aug 10 14:19:00 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31C04DD3F82; Thu, 10 Aug 2017 14:19:00 +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 mx1.freebsd.org (Postfix) with ESMTPS id F3E112B12; Thu, 10 Aug 2017 14:18:59 +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 v7AEIxmC024898; Thu, 10 Aug 2017 14:18:59 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AEIxlQ024897; Thu, 10 Aug 2017 14:18:59 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708101418.v7AEIxlQ024897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 10 Aug 2017 14:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322362 - head X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322362 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 14:19:00 -0000 Author: gjb Date: Thu Aug 10 14:18:58 2017 New Revision: 322362 URL: https://svnweb.freebsd.org/changeset/base/322362 Log: Indent nested conditionals for readability. Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Aug 10 14:18:09 2017 (r322361) +++ head/Makefile.inc1 Thu Aug 10 14:18:58 2017 (r322362) @@ -1632,7 +1632,7 @@ create-world-package-${pkgname}: .PHONY create-kernel-packages: .PHONY _default_flavor= -default .if exists(${KSTAGEDIR}/kernel.meta) -.for flavor in "" -debug +. for flavor in "" -debug create-kernel-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},} create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap .PHONY @cd ${KSTAGEDIR}/${DISTDIR} ; \ @@ -1658,12 +1658,12 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul -p ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \ -r ${KSTAGEDIR}/${DISTDIR} \ -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} -.endfor +. endfor .endif .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" -.for _kernel in ${BUILDKERNELS:[2..-1]} -.if exists(${KSTAGEDIR}/kernel.${_kernel}.meta) -.for flavor in "" -debug +. for _kernel in ${BUILDKERNELS:[2..-1]} +. if exists(${KSTAGEDIR}/kernel.${_kernel}.meta) +. for flavor in "" -debug create-kernel-packages: create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel} create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel}: _pkgbootstrap .PHONY @cd ${KSTAGEDIR}/kernel.${_kernel} ; \ @@ -1689,9 +1689,9 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_ -p ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \ -r ${KSTAGEDIR}/kernel.${_kernel} \ -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} -.endfor -.endif -.endfor +. endfor +. endif +. endfor .endif sign-packages: _pkgbootstrap .PHONY From owner-svn-src-all@freebsd.org Thu Aug 10 14:21:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57D49DD401E; Thu, 10 Aug 2017 14:21:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C2622D0D; Thu, 10 Aug 2017 14:21:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x22f.google.com with SMTP id m34so13634633iti.1; Thu, 10 Aug 2017 07:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=InPxDjAGd6j69YsgWblsD4SvkErAPL0pB9E8f/Kkdko=; b=F8AdsgnNWdhI780bS6h5GCkPxbzHdeMoqGgnQbucZSIZVgrSKCRGDucjPk0Z76NPGB 8K8nsKscadpa5OyjmBSsoaPVD+GFnS7d4bgCf4q6Z46Tz8jHqLS4CkiBN/G2Swkh8rZA IjJwBWu4tgaBF9dfBwMPL1EsWqKcq8kEkQrS9/Qj13VTw1Q06fLW3pi9PJhhKwpfsiqX 0/sFXdLkctuiww78fe/M/uT1nuVsculSoL3qu9vTDA0lmhJdfVau9c0hN7fSnJhgeIot rdYhPgF6ywF8/hO2LmL9dKkWqH/b0HcDsRfeQt8YsMfyRkXwtc7f07Ss13Yr/z0OxeU6 /DZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=InPxDjAGd6j69YsgWblsD4SvkErAPL0pB9E8f/Kkdko=; b=imusECMd+uqPZxBbhl6zZCOuovFaur64S4dy6Nriy99PLMfUffZBS5Ow6/sspSz6ba EdgUzGN7rQHLgPICNrtfFHiABzTKVSyP/WpVUPvi4emy8WFTVjg+EvHGV8zU6JWAjCDL etkEmsBuNzhRQnwbLNc2NESGUSpqlcQngYdJTi4aSASCEXnc8bPEBsPhB6K/irNkeltW QGQvtLg3XaEwubq98aNX/+LCSNSpoN1rwMUy8YXLMRpaKrP6aC9PUDl5qDQDmwemLYlO 8OdqKRygE7YHrJsiRDG41txLA1SyxMlyAOezGCdAouogNqxQnIVT1MQrKSC7iUC1H8r8 Sx8Q== X-Gm-Message-State: AIVw11038g2QM0TRXO+3rkW2w5gZ4sJMQ9BkewYwMlmuCII8tlgVQSlT T2HEX+7GUphTlS/L7qZjUFxjFA9go1UHfrQ= X-Received: by 10.36.113.70 with SMTP id n67mr11710213itc.39.1502374880201; Thu, 10 Aug 2017 07:21:20 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.24.66 with HTTP; Thu, 10 Aug 2017 07:20:59 -0700 (PDT) In-Reply-To: <201708100915.v7A9FIke002476@repo.freebsd.org> References: <201708100915.v7A9FIke002476@repo.freebsd.org> From: Ed Maste Date: Thu, 10 Aug 2017 10:20:59 -0400 X-Google-Sender-Auth: EkT6eAI6OkcwBwUUCu1IBf4fEC4 Message-ID: Subject: Re: svn commit: r322347 - in head/sys/x86: acpica include x86 xen To: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 14:21:21 -0000 On 10 August 2017 at 05:15, Roger Pau Monn=C3=A9 wrote= : > Author: royger > Date: Thu Aug 10 09:15:18 2017 > New Revision: 322347 > URL: https://svnweb.freebsd.org/changeset/base/322347 > > Log: > apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase i386 is failing with: 13:55:08 --- mptable.o --- 13:55:08 /usr/src/sys/x86/x86/mptable.c:333:3: error: use of undeclared identifier 'mp_ncpus' 13:55:08 mp_ncpus =3D 2; 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:334:3: error: use of undeclared identifier 'mp_maxid' 13:55:08 mp_maxid =3D 1; 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:359:3: error: use of undeclared identifier 'cpu_mask' 13:55:08 cpu_mask =3D 0; 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:360:51: error: use of undeclared identifier 'cpu_mask' 13:55:08 mptable_walk_table(mptable_setup_cpus_handler, &cpu_mask); 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:480:39: error: use of undeclared identifier 'mp_ncpus' 13:55:08 proc->apic_id < MAX_LAPIC_ID && mp_ncpus < MAXCPU) { 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:481:4: error: use of undeclared identifier 'mp_ncpus' 13:55:08 mp_ncpus++; 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:482:4: error: use of undeclared identifier 'mp_maxid' 13:55:08 mp_maxid =3D mp_ncpus - 1; 13:55:08 ^ 13:55:08 /usr/src/sys/x86/x86/mptable.c:482:15: error: use of undeclared identifier 'mp_ncpus' 13:55:08 mp_maxid =3D mp_ncpus - 1; 13:55:08 ^ 13:55:08 8 errors generated. 13:55:08 *** [mptable.o] Error code 1 https://ci.freebsd.org/job/FreeBSD-head-i386-build/3457/console From owner-svn-src-all@freebsd.org Thu Aug 10 14:54:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 062E6DD4D50; Thu, 10 Aug 2017 14:54:38 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6CB4634E8; Thu, 10 Aug 2017 14:54:37 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AEsajX041632; Thu, 10 Aug 2017 14:54:36 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AEsa0A041631; Thu, 10 Aug 2017 14:54:36 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201708101454.v7AEsa0A041631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 10 Aug 2017 14:54:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322363 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 322363 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 14:54:38 -0000 Author: sbruno Date: Thu Aug 10 14:54:36 2017 New Revision: 322363 URL: https://svnweb.freebsd.org/changeset/base/322363 Log: Purge deprecated locking macros. Submitted by: Matt Macy Sponsored by: Limelight Networks Modified: head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/if_em.h ============================================================================== --- head/sys/dev/e1000/if_em.h Thu Aug 10 14:18:58 2017 (r322362) +++ head/sys/dev/e1000/if_em.h Thu Aug 10 14:54:36 2017 (r322363) @@ -555,26 +555,6 @@ typedef struct _em_vendor_info_t { void em_dump_rs(struct adapter *); -#define EM_CORE_LOCK_INIT(_sc, _name) \ - mtx_init(&(_sc)->core_mtx, _name, "EM Core Lock", MTX_DEF) -#define EM_TX_LOCK_INIT(_sc, _name) \ - mtx_init(&(_sc)->tx_mtx, _name, "EM TX Lock", MTX_DEF) -#define EM_RX_LOCK_INIT(_sc, _name) \ - mtx_init(&(_sc)->rx_mtx, _name, "EM RX Lock", MTX_DEF) -#define EM_CORE_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->core_mtx) -#define EM_TX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->tx_mtx) -#define EM_RX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->rx_mtx) -#define EM_CORE_LOCK(_sc) mtx_lock(&(_sc)->core_mtx) -#define EM_TX_LOCK(_sc) mtx_lock(&(_sc)->tx_mtx) -#define EM_TX_TRYLOCK(_sc) mtx_trylock(&(_sc)->tx_mtx) -#define EM_RX_LOCK(_sc) mtx_lock(&(_sc)->rx_mtx) -#define EM_CORE_UNLOCK(_sc) mtx_unlock(&(_sc)->core_mtx) -#define EM_TX_UNLOCK(_sc) mtx_unlock(&(_sc)->tx_mtx) -#define EM_RX_UNLOCK(_sc) mtx_unlock(&(_sc)->rx_mtx) -#define EM_CORE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->core_mtx, MA_OWNED) -#define EM_TX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->tx_mtx, MA_OWNED) -#define EM_RX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->rx_mtx, MA_OWNED) - #define EM_RSSRK_SIZE 4 #define EM_RSSRK_VAL(key, i) (key[(i) * EM_RSSRK_SIZE] | \ key[(i) * EM_RSSRK_SIZE + 1] << 8 | \ From owner-svn-src-all@freebsd.org Thu Aug 10 14:59:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64CD9DD4F2C; Thu, 10 Aug 2017 14:59:20 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8395F637EE; Thu, 10 Aug 2017 14:59:19 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AExIIN041860; Thu, 10 Aug 2017 14:59:18 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AExHlf041850; Thu, 10 Aug 2017 14:59:17 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708101459.v7AExHlf041850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 10 Aug 2017 14:59:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322364 - in head/sys/dev: mpr mps X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in head/sys/dev: mpr mps X-SVN-Commit-Revision: 322364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 14:59:20 -0000 Author: ken Date: Thu Aug 10 14:59:17 2017 New Revision: 322364 URL: https://svnweb.freebsd.org/changeset/base/322364 Log: Changes to make mps(4) and mpr(4) handle reinit with reallocation. When the mps(4) and mpr(4) drivers need to reinitialize the firmware, they sometimes need to reallocate all of the memory allocated by the driver. The reallocation happens whenever the IOC Facts change. That should only happen after a firmware upgrade. If the reinitialization happens as a result of a timed out command sent to the card, the command that timed out and triggered the reinit may have been freed if iocfacts_allocate() reallocated all memory. If the caller attempts to access the command after that, the kernel will panic because the caller will be dereferencing freed memory. The solution is to set a flag in the softc when we reallocate, and avoid dereferencing the command strucure if we've reallocated. The changes are largely the same in both drivers, since mpr(4) is a derivative of mps(4). o In iocfacts_allocate(), if the IOC Facts have changed and we need to reallocate, set the REALLOCATED flag in the softc. o Change wait_command() to take a struct mps_command ** instead of a struct mps_command *. This allows us to NULL out the caller's command pointer if we have to reinit the controller and the data structures get reallocated. (The REALLOCATED flag will be set in the softc if that has happened.) o In every place that calls wait_command(), make sure we handle the case where the command is NULL after the call. o The mpr(4) driver has mpr_request_polled() which can also reinitialize the card. Also check for reallocation there. Reviewed by: scottl, slm MFC after: 1 week Sponsored by: Spectra Logic Modified: head/sys/dev/mpr/mpr.c head/sys/dev/mpr/mpr_config.c head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mpr_sas_lsi.c head/sys/dev/mpr/mpr_user.c head/sys/dev/mpr/mprvar.h head/sys/dev/mps/mps.c head/sys/dev/mps/mps_config.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mps_sas_lsi.c head/sys/dev/mps/mps_user.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mpr/mpr.c Thu Aug 10 14:59:17 2017 (r322364) @@ -436,6 +436,8 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at /* Only deallocate and reallocate if relevant IOC Facts have changed */ reallocating = FALSE; + sc->mpr_flags &= ~MPR_FLAGS_REALLOCATED; + if ((!attaching) && ((saved_facts.MsgVersion != sc->facts->MsgVersion) || (saved_facts.HeaderVersion != sc->facts->HeaderVersion) || @@ -458,6 +460,9 @@ mpr_iocfacts_allocate(struct mpr_softc *sc, uint8_t at (saved_facts.MaxPersistentEntries != sc->facts->MaxPersistentEntries))) { reallocating = TRUE; + + /* Record that we reallocated everything */ + sc->mpr_flags |= MPR_FLAGS_REALLOCATED; } /* @@ -2229,8 +2234,8 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_eve uint8_t *mask) { MPI2_EVENT_NOTIFICATION_REQUEST *evtreq; - MPI2_EVENT_NOTIFICATION_REPLY *reply; - struct mpr_command *cm; + MPI2_EVENT_NOTIFICATION_REPLY *reply = NULL; + struct mpr_command *cm = NULL; struct mpr_event_handle *eh; int error, i; @@ -2263,8 +2268,9 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_eve cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_request_polled(sc, cm); - reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply; if ((reply == NULL) || (reply->IOCStatus & MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_SUCCESS) error = ENXIO; @@ -2274,7 +2280,8 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_eve mpr_dprint(sc, MPR_TRACE, "%s finished error %d\n", __func__, error); - mpr_free_command(sc, cm); + if (cm != NULL) + mpr_free_command(sc, cm); return (error); } @@ -3260,11 +3267,12 @@ mpr_map_command(struct mpr_softc *sc, struct mpr_comma * be executed and enqueued automatically. Other errors come from msleep(). */ int -mpr_wait_command(struct mpr_softc *sc, struct mpr_command *cm, int timeout, +mpr_wait_command(struct mpr_softc *sc, struct mpr_command **cmp, int timeout, int sleep_flag) { int error, rc; struct timeval cur_time, start_time; + struct mpr_command *cm = *cmp; if (sc->mpr_flags & MPR_FLAGS_DIAGRESET) return EBUSY; @@ -3319,6 +3327,13 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm rc = mpr_reinit(sc); mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); + if (sc->mpr_flags & MPR_FLAGS_REALLOCATED) { + /* + * Tell the caller that we freed the command in a + * reinit. + */ + *cmp = NULL; + } error = ETIMEDOUT; } return (error); @@ -3329,10 +3344,11 @@ mpr_wait_command(struct mpr_softc *sc, struct mpr_comm * completion. Its use should be rare. */ int -mpr_request_polled(struct mpr_softc *sc, struct mpr_command *cm) +mpr_request_polled(struct mpr_softc *sc, struct mpr_command **cmp) { - int error, timeout = 0, rc; + int error, rc; struct timeval cur_time, start_time; + struct mpr_command *cm = *cmp; error = 0; @@ -3340,7 +3356,7 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co cm->cm_complete = NULL; mpr_map_command(sc, cm); - getmicrotime(&start_time); + getmicrouptime(&start_time); while ((cm->cm_flags & MPR_CM_FLAGS_COMPLETE) == 0) { mpr_intr_locked(sc); @@ -3353,9 +3369,9 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co /* * Check for real-time timeout and fail if more than 60 seconds. */ - getmicrotime(&cur_time); - timeout = cur_time.tv_sec - start_time.tv_sec; - if (timeout > 60) { + getmicrouptime(&cur_time); + timevalsub(&cur_time, &start_time); + if (cur_time.tv_sec > 60) { mpr_dprint(sc, MPR_FAULT, "polling failed\n"); error = ETIMEDOUT; break; @@ -3367,6 +3383,14 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co rc = mpr_reinit(sc); mpr_dprint(sc, MPR_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); + + if (sc->mpr_flags & MPR_FLAGS_REALLOCATED) { + /* + * Tell the caller that we freed the command in a + * reinit. + */ + *cmp = NULL; + } } return (error); } @@ -3432,11 +3456,12 @@ mpr_read_config_page(struct mpr_softc *sc, struct mpr_ cm->cm_complete = mpr_config_complete; return (mpr_map_command(sc, cm)); } else { - error = mpr_wait_command(sc, cm, 0, CAN_SLEEP); + error = mpr_wait_command(sc, &cm, 0, CAN_SLEEP); if (error) { mpr_dprint(sc, MPR_FAULT, "Error %d reading config page\n", error); - mpr_free_command(sc, cm); + if (cm != NULL) + mpr_free_command(sc, cm); return (error); } mpr_config_complete(sc, cm); Modified: head/sys/dev/mpr/mpr_config.c ============================================================================== --- head/sys/dev/mpr/mpr_config.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mpr/mpr_config.c Thu Aug 10 14:59:17 2017 (r322364) @@ -95,8 +95,9 @@ mpr_config_get_ioc_pg8(struct mpr_softc *sc, Mpi2Confi request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -153,8 +154,9 @@ mpr_config_get_ioc_pg8(struct mpr_softc *sc, Mpi2Confi } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -225,8 +227,9 @@ mpr_config_get_iounit_pg8(struct mpr_softc *sc, Mpi2Co request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -283,8 +286,9 @@ mpr_config_get_iounit_pg8(struct mpr_softc *sc, Mpi2Co } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -393,8 +397,9 @@ mpr_config_get_dpm_pg0(struct mpr_softc *sc, Mpi2Confi MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -453,8 +458,9 @@ mpr_config_get_dpm_pg0(struct mpr_softc *sc, Mpi2Confi goto out; } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -529,8 +535,9 @@ int mpr_config_set_dpm_pg0(struct mpr_softc *sc, Mpi2C request->PageAddress |= htole16(entry_idx); cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -591,8 +598,9 @@ int mpr_config_set_dpm_pg0(struct mpr_softc *sc, Mpi2C bcopy(config_page, page, MIN(cm->cm_length, (sizeof(Mpi2DriverMappingPage0_t)))); cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -664,8 +672,9 @@ mpr_config_get_sas_device_pg0(struct mpr_softc *sc, Mp request->ExtPageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -724,8 +733,9 @@ mpr_config_get_sas_device_pg0(struct mpr_softc *sc, Mp } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -799,8 +809,9 @@ mpr_config_get_pcie_device_pg0(struct mpr_softc *sc, M request->ExtPageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -859,8 +870,9 @@ mpr_config_get_pcie_device_pg0(struct mpr_softc *sc, M } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -934,8 +946,9 @@ mpr_config_get_pcie_device_pg2(struct mpr_softc *sc, M request->ExtPageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -994,8 +1007,9 @@ mpr_config_get_pcie_device_pg2(struct mpr_softc *sc, M } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1066,8 +1080,9 @@ mpr_config_get_bios_pg3(struct mpr_softc *sc, Mpi2Conf request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1124,8 +1139,9 @@ mpr_config_get_bios_pg3(struct mpr_softc *sc, Mpi2Conf } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1173,7 +1189,7 @@ mpr_config_get_raid_volume_pg0(struct mpr_softc *sc, M *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 page_address) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mpr_command *cm; Mpi2RaidVolPage0_t *page = NULL; int error = 0; @@ -1201,8 +1217,9 @@ mpr_config_get_raid_volume_pg0(struct mpr_softc *sc, M * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1258,8 +1275,9 @@ mpr_config_get_raid_volume_pg0(struct mpr_softc *sc, M * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1325,8 +1343,9 @@ mpr_config_get_raid_volume_pg1(struct mpr_softc *sc, M request->Header.PageLength = request->Header.PageVersion = 0; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1384,8 +1403,9 @@ mpr_config_get_raid_volume_pg1(struct mpr_softc *sc, M } cm->cm_data = page; - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1459,7 +1479,7 @@ mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2C Mpi2RaidPhysDiskPage0_t *config_page, u32 page_address) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mpr_command *cm; Mpi2RaidPhysDiskPage0_t *page = NULL; int error = 0; @@ -1487,8 +1507,9 @@ mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2C * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1544,8 +1565,9 @@ mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2C * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mpr_request_polled(sc, cm); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mpr/mpr_sas.c Thu Aug 10 14:59:17 2017 (r322364) @@ -1193,13 +1193,8 @@ mprsas_complete_all_commands(struct mpr_softc *sc) completed = 1; } - if (cm->cm_sc->io_cmds_active != 0) { + if (cm->cm_sc->io_cmds_active != 0) cm->cm_sc->io_cmds_active--; - } else { - mpr_dprint(cm->cm_sc, MPR_INFO, "Warning: " - "io_cmds_active is out of sync - resynching to " - "0\n"); - } if ((completed == 0) && (cm->cm_state != MPR_CM_STATE_FREE)) { /* this should never happen, but if it does, log */ Modified: head/sys/dev/mpr/mpr_sas_lsi.c ============================================================================== --- head/sys/dev/mpr/mpr_sas_lsi.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mpr/mpr_sas_lsi.c Thu Aug 10 14:59:17 2017 (r322364) @@ -324,7 +324,7 @@ mprsas_fw_work(struct mpr_softc *sc, struct mpr_fw_eve { // build RAID Action message Mpi2RaidActionRequest_t *action; - Mpi2RaidActionReply_t *reply; + Mpi2RaidActionReply_t *reply = NULL; struct mpr_command *cm; int error = 0; if ((cm = mpr_alloc_command(sc)) == NULL) { @@ -344,8 +344,10 @@ mprsas_fw_work(struct mpr_softc *sc, struct mpr_fw_eve action->PhysDiskNum = element->PhysDiskNum; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; - error = mpr_request_polled(sc, cm); - reply = (Mpi2RaidActionReply_t *)cm->cm_reply; + error = mpr_request_polled(sc, &cm); + if (cm != NULL) + reply = (Mpi2RaidActionReply_t *) + cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1132,12 +1134,14 @@ mprsas_get_sata_identify(struct mpr_softc *sc, u16 han "command\n", __func__); callout_reset(&cm->cm_callout, MPR_ATA_ID_TIMEOUT * hz, mprsas_ata_id_timeout, cm); - error = mpr_wait_command(sc, cm, 60, CAN_SLEEP); + error = mpr_wait_command(sc, &cm, 60, CAN_SLEEP); mpr_dprint(sc, MPR_XINFO, "%s stop timeout counter for SATA ID " "command\n", __func__); + /* XXX KDM need to fix the case where this command is destroyed */ callout_stop(&cm->cm_callout); - reply = (Mpi2SataPassthroughReply_t *)cm->cm_reply; + if (cm != NULL) + reply = (Mpi2SataPassthroughReply_t *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1603,7 +1607,7 @@ mprsas_ir_shutdown(struct mpr_softc *sc) action->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; mpr_lock(sc); - mpr_wait_command(sc, cm, 5, CAN_SLEEP); + mpr_wait_command(sc, &cm, 5, CAN_SLEEP); mpr_unlock(sc); /* Modified: head/sys/dev/mpr/mpr_user.c ============================================================================== --- head/sys/dev/mpr/mpr_user.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mpr/mpr_user.c Thu Aug 10 14:59:17 2017 (r322364) @@ -652,7 +652,7 @@ static int mpr_user_command(struct mpr_softc *sc, struct mpr_usr_command *cmd) { MPI2_REQUEST_HEADER *hdr; - MPI2_DEFAULT_REPLY *rpl; + MPI2_DEFAULT_REPLY *rpl = NULL; void *buf = NULL; struct mpr_command *cm = NULL; int err = 0; @@ -664,7 +664,7 @@ mpr_user_command(struct mpr_softc *sc, struct mpr_usr_ if (cm == NULL) { mpr_printf(sc, "%s: no mpr requests\n", __func__); err = ENOMEM; - goto Ret; + goto RetFree; } mpr_unlock(sc); @@ -706,15 +706,16 @@ mpr_user_command(struct mpr_softc *sc, struct mpr_usr_ goto RetFreeUnlocked; mpr_lock(sc); - err = mpr_wait_command(sc, cm, 30, CAN_SLEEP); + err = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); - if (err) { + if (err || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, err); - goto Ret; + goto RetFree; } - rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; + if (cm != NULL) + rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; if (rpl != NULL) sz = rpl->MsgLength * 4; else @@ -734,9 +735,9 @@ mpr_user_command(struct mpr_softc *sc, struct mpr_usr_ RetFreeUnlocked: mpr_lock(sc); +RetFree: if (cm != NULL) mpr_free_command(sc, cm); -Ret: mpr_unlock(sc); if (buf != NULL) free(buf, M_MPRUSER); @@ -850,7 +851,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru err = 1; } else { mprsas_prepare_for_tm(sc, cm, targ, CAM_LUN_WILDCARD); - err = mpr_wait_command(sc, cm, 30, CAN_SLEEP); + err = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); } if (err != 0) { @@ -861,7 +862,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru /* * Copy the reply data and sense data to user space. */ - if (cm->cm_reply != NULL) { + if ((cm != NULL) && (cm->cm_reply != NULL)) { rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; sz = rpl->MsgLength * 4; @@ -1054,13 +1055,12 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru mpr_lock(sc); - err = mpr_wait_command(sc, cm, 30, CAN_SLEEP); + err = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); - if (err) { + if (err || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, err); - mpr_unlock(sc); - goto RetFreeUnlocked; + goto RetFree; } /* @@ -1153,6 +1153,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru RetFreeUnlocked: mpr_lock(sc); +RetFree: if (cm != NULL) { if (cm->cm_data) free(cm->cm_data, M_MPRUSER); @@ -1301,8 +1302,8 @@ mpr_post_fw_diag_buffer(struct mpr_softc *sc, /* * Send command synchronously. */ - status = mpr_wait_command(sc, cm, 30, CAN_SLEEP); - if (status) { + status = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); + if (status || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, status); status = MPR_DIAG_FAILURE; @@ -1333,7 +1334,8 @@ mpr_post_fw_diag_buffer(struct mpr_softc *sc, status = MPR_DIAG_SUCCESS; done: - mpr_free_command(sc, cm); + if (cm != NULL) + mpr_free_command(sc, cm); return (status); } @@ -1387,8 +1389,8 @@ mpr_release_fw_diag_buffer(struct mpr_softc *sc, /* * Send command synchronously. */ - status = mpr_wait_command(sc, cm, 30, CAN_SLEEP); - if (status) { + status = mpr_wait_command(sc, &cm, 30, CAN_SLEEP); + if (status || (cm == NULL)) { mpr_printf(sc, "%s: invalid request: error %d\n", __func__, status); status = MPR_DIAG_FAILURE; @@ -1423,6 +1425,9 @@ mpr_release_fw_diag_buffer(struct mpr_softc *sc, } done: + if (cm != NULL) + mpr_free_command(sc, cm); + return (status); } Modified: head/sys/dev/mpr/mprvar.h ============================================================================== --- head/sys/dev/mpr/mprvar.h Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mpr/mprvar.h Thu Aug 10 14:59:17 2017 (r322364) @@ -275,6 +275,7 @@ struct mpr_softc { #define MPR_FLAGS_DIAGRESET (1 << 4) #define MPR_FLAGS_ATTACH_DONE (1 << 5) #define MPR_FLAGS_GEN35_IOC (1 << 6) +#define MPR_FLAGS_REALLOCATED (1 << 7) u_int mpr_debug; u_int disable_msix; u_int disable_msi; @@ -732,9 +733,9 @@ void mprsas_record_event(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event_reply); int mpr_map_command(struct mpr_softc *sc, struct mpr_command *cm); -int mpr_wait_command(struct mpr_softc *sc, struct mpr_command *cm, int timeout, +int mpr_wait_command(struct mpr_softc *sc, struct mpr_command **cm, int timeout, int sleep_flag); -int mpr_request_polled(struct mpr_softc *sc, struct mpr_command *cm); +int mpr_request_polled(struct mpr_softc *sc, struct mpr_command **cm); int mpr_config_get_bios_pg3(struct mpr_softc *sc, Mpi2ConfigReply_t *mpi_reply, Mpi2BiosPage3_t *config_page); Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mps/mps.c Thu Aug 10 14:59:17 2017 (r322364) @@ -427,6 +427,8 @@ mps_iocfacts_allocate(struct mps_softc *sc, uint8_t at /* Only deallocate and reallocate if relevant IOC Facts have changed */ reallocating = FALSE; + sc->mps_flags &= ~MPS_FLAGS_REALLOCATED; + if ((!attaching) && ((saved_facts.MsgVersion != sc->facts->MsgVersion) || (saved_facts.HeaderVersion != sc->facts->HeaderVersion) || @@ -447,6 +449,9 @@ mps_iocfacts_allocate(struct mps_softc *sc, uint8_t at (saved_facts.MaxPersistentEntries != sc->facts->MaxPersistentEntries))) { reallocating = TRUE; + + /* Record that we reallocated everything */ + sc->mps_flags |= MPS_FLAGS_REALLOCATED; } /* @@ -2075,7 +2080,7 @@ mps_update_events(struct mps_softc *sc, struct mps_eve u32 *mask) { MPI2_EVENT_NOTIFICATION_REQUEST *evtreq; - MPI2_EVENT_NOTIFICATION_REPLY *reply; + MPI2_EVENT_NOTIFICATION_REPLY *reply = NULL; struct mps_command *cm; int error, i; @@ -2113,8 +2118,9 @@ mps_update_events(struct mps_softc *sc, struct mps_eve cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, 0); - reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, 0); + if (cm != NULL) + reply = (MPI2_EVENT_NOTIFICATION_REPLY *)cm->cm_reply; if ((reply == NULL) || (reply->IOCStatus & MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_SUCCESS) error = ENXIO; @@ -2124,7 +2130,8 @@ mps_update_events(struct mps_softc *sc, struct mps_eve mps_dprint(sc, MPS_TRACE, "%s finished error %d\n", __func__, error); - mps_free_command(sc, cm); + if (cm != NULL) + mps_free_command(sc, cm); return (error); } @@ -2530,11 +2537,12 @@ mps_map_command(struct mps_softc *sc, struct mps_comma * be executed and enqueued automatically. Other errors come from msleep(). */ int -mps_wait_command(struct mps_softc *sc, struct mps_command *cm, int timeout, +mps_wait_command(struct mps_softc *sc, struct mps_command **cmp, int timeout, int sleep_flag) { int error, rc; struct timeval cur_time, start_time; + struct mps_command *cm = *cmp; if (sc->mps_flags & MPS_FLAGS_DIAGRESET) return EBUSY; @@ -2588,6 +2596,13 @@ mps_wait_command(struct mps_softc *sc, struct mps_comm rc = mps_reinit(sc); mps_dprint(sc, MPS_FAULT, "Reinit %s\n", (rc == 0) ? "success" : "failed"); + if (sc->mps_flags & MPS_FLAGS_REALLOCATED) { + /* + * Tell the caller that we freed the command in a + * reinit. + */ + *cmp = NULL; + } error = ETIMEDOUT; } return (error); @@ -2654,11 +2669,12 @@ mps_read_config_page(struct mps_softc *sc, struct mps_ cm->cm_complete = mps_config_complete; return (mps_map_command(sc, cm)); } else { - error = mps_wait_command(sc, cm, 0, CAN_SLEEP); + error = mps_wait_command(sc, &cm, 0, CAN_SLEEP); if (error) { mps_dprint(sc, MPS_FAULT, "Error %d reading config page\n", error); - mps_free_command(sc, cm); + if (cm != NULL) + mps_free_command(sc, cm); return (error); } mps_config_complete(sc, cm); Modified: head/sys/dev/mps/mps_config.c ============================================================================== --- head/sys/dev/mps/mps_config.c Thu Aug 10 14:54:36 2017 (r322363) +++ head/sys/dev/mps/mps_config.c Thu Aug 10 14:59:17 2017 (r322364) @@ -71,7 +71,7 @@ mps_config_get_ioc_pg8(struct mps_softc *sc, Mpi2Confi Mpi2IOCPage8_t *config_page) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; MPI2_CONFIG_PAGE_IOC_8 *page = NULL; int error = 0; @@ -94,8 +94,9 @@ mps_config_get_ioc_pg8(struct mps_softc *sc, Mpi2Confi request->Header.PageVersion = MPI2_IOCPAGE8_PAGEVERSION; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -152,8 +153,9 @@ mps_config_get_ioc_pg8(struct mps_softc *sc, Mpi2Confi } cm->cm_data = page; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -200,7 +202,7 @@ int mps_config_get_man_pg10(struct mps_softc *sc, Mpi2ConfigReply_t *mpi_reply) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; pMpi2ManufacturingPagePS_t page = NULL; uint32_t *pPS_info; @@ -230,8 +232,9 @@ mps_config_get_man_pg10(struct mps_softc *sc, Mpi2Conf * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_wait_command(sc, cm, 60, 0); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, 0); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -286,8 +289,9 @@ mps_config_get_man_pg10(struct mps_softc *sc, Mpi2Conf * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_wait_command(sc, cm, 60, 0); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, 0); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -559,7 +563,7 @@ mps_config_get_dpm_pg0(struct mps_softc *sc, Mpi2Confi Mpi2DriverMappingPage0_t *config_page, u16 sz) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; Mpi2DriverMappingPage0_t *page = NULL; int error = 0; @@ -586,8 +590,9 @@ mps_config_get_dpm_pg0(struct mps_softc *sc, Mpi2Confi MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -646,8 +651,9 @@ mps_config_get_dpm_pg0(struct mps_softc *sc, Mpi2Confi goto out; } cm->cm_data = page; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -695,7 +701,7 @@ int mps_config_set_dpm_pg0(struct mps_softc *sc, Mpi2C Mpi2DriverMappingPage0_t *config_page, u16 entry_idx) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; MPI2_CONFIG_PAGE_DRIVER_MAPPING_0 *page = NULL; int error = 0; @@ -722,8 +728,9 @@ int mps_config_set_dpm_pg0(struct mps_softc *sc, Mpi2C request->PageAddress |= htole16(entry_idx); cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -784,8 +791,9 @@ int mps_config_set_dpm_pg0(struct mps_softc *sc, Mpi2C bcopy(config_page, page, MIN(cm->cm_length, (sizeof(Mpi2DriverMappingPage0_t)))); cm->cm_data = page; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -833,7 +841,7 @@ mps_config_get_sas_device_pg0(struct mps_softc *sc, Mp *mpi_reply, Mpi2SasDevicePage0_t *config_page, u32 form, u16 handle) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; Mpi2SasDevicePage0_t *page = NULL; int error = 0; @@ -857,8 +865,9 @@ mps_config_get_sas_device_pg0(struct mps_softc *sc, Mp request->Header.PageVersion = MPI2_SASDEVICE0_PAGEVERSION; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -917,8 +926,9 @@ mps_config_get_sas_device_pg0(struct mps_softc *sc, Mp } cm->cm_data = page; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -966,7 +976,7 @@ mps_config_get_bios_pg3(struct mps_softc *sc, Mpi2Conf Mpi2BiosPage3_t *config_page) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; Mpi2BiosPage3_t *page = NULL; int error = 0; @@ -989,8 +999,9 @@ mps_config_get_bios_pg3(struct mps_softc *sc, Mpi2Conf request->Header.PageVersion = MPI2_BIOSPAGE3_PAGEVERSION; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1047,8 +1058,9 @@ mps_config_get_bios_pg3(struct mps_softc *sc, Mpi2Conf } cm->cm_data = page; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* @@ -1096,7 +1108,7 @@ mps_config_get_raid_volume_pg0(struct mps_softc *sc, M *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 page_address) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; Mpi2RaidVolPage0_t *page = NULL; int error = 0; @@ -1124,8 +1136,9 @@ mps_config_get_raid_volume_pg0(struct mps_softc *sc, M * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_wait_command(sc, cm, 60, 0); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, 0); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1181,8 +1194,9 @@ mps_config_get_raid_volume_pg0(struct mps_softc *sc, M * This page must be polled because the IOC isn't ready yet when this * page is needed. */ - error = mps_wait_command(sc, cm, 60, 0); - reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; + error = mps_wait_command(sc, &cm, 60, 0); + if (cm != NULL) + reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; if (error || (reply == NULL)) { /* FIXME */ /* If the poll returns error then we need to do diag reset */ @@ -1225,7 +1239,7 @@ mps_config_get_raid_volume_pg1(struct mps_softc *sc, M *mpi_reply, Mpi2RaidVolPage1_t *config_page, u32 form, u16 handle) { MPI2_CONFIG_REQUEST *request; - MPI2_CONFIG_REPLY *reply; + MPI2_CONFIG_REPLY *reply = NULL; struct mps_command *cm; Mpi2RaidVolPage1_t *page = NULL; int error = 0; @@ -1248,8 +1262,9 @@ mps_config_get_raid_volume_pg1(struct mps_softc *sc, M request->Header.PageVersion = MPI2_RAIDVOLPAGE1_PAGEVERSION; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; - error = mps_wait_command(sc, cm, 60, CAN_SLEEP); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Aug 10 15:31:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CD12DD5CF8; Thu, 10 Aug 2017 15:31:47 +0000 (UTC) (envelope-from rcyu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 E7BCB651EF; Thu, 10 Aug 2017 15:31:46 +0000 (UTC) (envelope-from rcyu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AFVkJi055909; Thu, 10 Aug 2017 15:31:46 GMT (envelope-from rcyu@FreeBSD.org) Received: (from rcyu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AFVkPf055908; Thu, 10 Aug 2017 15:31:46 GMT (envelope-from rcyu@FreeBSD.org) Message-Id: <201708101531.v7AFVkPf055908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rcyu set sender to rcyu@FreeBSD.org using -f From: Ruey-Cherng Yu Date: Thu, 10 Aug 2017 15:31:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322365 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: rcyu X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 15:31:47 -0000 Author: rcyu (doc committer) Date: Thu Aug 10 15:31:45 2017 New Revision: 322365 URL: https://svnweb.freebsd.org/changeset/base/322365 Log: Add myself. Reported by: mckusick Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 14:59:17 2017 (r322364) +++ head/usr.bin/calendar/calendars/calendar.freebsd Thu Aug 10 15:31:45 2017 (r322365) @@ -144,6 +144,7 @@ 04/11 Bruce A. Mah born in Fresno, California, United States, 1969 04/12 Patrick Gardella born in Columbus, Ohio, United States, 1967 04/12 Ed Schouten born in Oss, the Netherlands, 1986 +04/12 Ruey-Cherng Yu born in Keelung, Taiwan, 1978 04/13 Oliver Braun born in Nuremberg, Bavaria, Germany, 1972 04/14 Crist J. Clark born in Milwaukee, Wisconsin, United States, 1970 04/14 Glen J. Barber born in Wilkes-Barre, Pennsylvania, United States, 1981 From owner-svn-src-all@freebsd.org Thu Aug 10 15:34:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32618DD5E37; Thu, 10 Aug 2017 15:34:52 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C98B654D1; Thu, 10 Aug 2017 15:34:51 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AFYp9m059147; Thu, 10 Aug 2017 15:34:51 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AFYpxH059145; Thu, 10 Aug 2017 15:34:51 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708101534.v7AFYpxH059145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 10 Aug 2017 15:34:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322367 - in stable/10: lib/libmt usr.bin/mt X-SVN-Group: stable-10 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in stable/10: lib/libmt usr.bin/mt X-SVN-Commit-Revision: 322367 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 15:34:52 -0000 Author: ken Date: Thu Aug 10 15:34:50 2017 New Revision: 322367 URL: https://svnweb.freebsd.org/changeset/base/322367 Log: MFC r320991, r322016: ------------------------------------------------------------------------ r320991 | ken | 2017-07-14 10:45:46 -0600 (Fri, 14 Jul 2017) | 17 lines Add IBM TS1155 density codes to libmt and the mt(1) man page. These are taken directly from the density report from a TS1155 tape drive. (Using mt getdensity) lib/libmt/mtlib.c: Add 3592B5 encrypted/unencrypted density codes, and bpmm/bpi values. The bpmm/bpi values are the same as TS1150, but there are 50% more tracks. usr.bin/mt/mt.1: Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi values and number of tracks. Bump the man page date. Sponsored by: Spectra Logic ------------------------------------------------------------------------ r322016 | ken | 2017-08-03 09:04:54 -0600 (Thu, 03 Aug 2017) | 6 lines Oracle T10000 tape drives use PRML encoding. Source: Oracle T10000 SCSI reference guide. Sponsored by: Spectra Logic ------------------------------------------------------------------------ Modified: stable/10/lib/libmt/mtlib.c stable/10/usr.bin/mt/mt.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libmt/mtlib.c ============================================================================== --- stable/10/lib/libmt/mtlib.c Thu Aug 10 15:34:49 2017 (r322366) +++ stable/10/lib/libmt/mtlib.c Thu Aug 10 15:34:50 2017 (r322367) @@ -641,6 +641,7 @@ static struct densities { { 0x53, 13452, 341681, "3592A3 (unencrypted)" }, { 0x54, 19686, 500024, "3592A4 (unencrypted)" }, { 0x55, 20670, 525018, "3592A5 (unencrypted)" }, + { 0x56, 20670, 525018, "3592B5 (unencrypted)" }, { 0x58, 15142, 384607, "LTO-5" }, { 0x5A, 15142, 384607, "LTO-6" }, { 0x5C, 19107, 485318, "LTO-7" }, @@ -650,6 +651,7 @@ static struct densities { { 0x73, 13452, 341681, "3592A3 (encrypted)" }, { 0x74, 19686, 500024, "3592A4 (encrypted)" }, { 0x75, 20670, 525018, "3592A5 (encrypted)" }, + { 0x76, 20670, 525018, "3592B5 (encrypted)" }, { 0x8c, 1789, 45434, "EXB-8500c" }, { 0x90, 1703, 43245, "EXB-8200c" }, { 0, 0, 0, NULL } Modified: stable/10/usr.bin/mt/mt.1 ============================================================================== --- stable/10/usr.bin/mt/mt.1 Thu Aug 10 15:34:49 2017 (r322366) +++ stable/10/usr.bin/mt/mt.1 Thu Aug 10 15:34:50 2017 (r322367) @@ -29,7 +29,7 @@ .\" @(#)mt.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd May 11, 2017 +.Dd August 3, 2017 .Dt MT 1 .Os .Sh NAME @@ -509,15 +509,16 @@ Value Width Tracks Density Code Typ 0x47 3.81 (0.25) ? 6,417 (163,000) CS DAT-72 0x48 12.7 (0.5) 448 5,236 (133,000) PRML C SDLTapeI(110) 6,8,13 0x49 12.7 (0.5) 448 7,598 (193,000) PRML C SDLTapeI(160) 6,8 -0x4A 12.7 (0.5) 768 ? C T10000A 10 -0x4B 12.7 (0.5) 1152 ? C T10000B 10 -0x4C 12.7 (0.5) 3584 ? C T10000C 10 -0x4D 12.7 (0.5) 4608 ? C T10000D 10 +0x4A 12.7 (0.5) 768 ? PRML C T10000A 10 +0x4B 12.7 (0.5) 1152 ? PRML C T10000B 10 +0x4C 12.7 (0.5) 3584 ? PRML C T10000C 10 +0x4D 12.7 (0.5) 4608 ? PRML C T10000D 10 0x51 12.7 (0.5) 512 11,800 (299,720) C 3592A1 (unencrypted) 0x52 12.7 (0.5) 896 11,800 (299,720) C 3592A2 (unencrypted) 0x53 12.7 (0.5) 1152 13,452 (341,681) C 3592A3 (unencrypted) 0x54 12.7 (0.5) 2560 19,686 (500,024) C 3592A4 (unencrypted) 0x55 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (unencrypted) +0x56 12.7 (0.5) 7680 20,670 (525,018) C 3592B5 (unencrypted) 0x58 12.7 (0.5) 1280 15,142 (384,607) C LTO-5 0x5A 12.7 (0.5) 2176 15,142 (384,607) C LTO-6 0x5C 12.7 (0.5) 3584 19,107 (485,318) C LTO-7 @@ -527,6 +528,7 @@ Value Width Tracks Density Code Typ 0x73 12.7 (0.5) 1152 13,452 (341,681) C 3592A3 (encrypted) 0x74 12.7 (0.5) 2560 19,686 (500,024) C 3592A4 (encrypted) 0x75 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (encrypted) +0x76 12.7 (0.5) 7680 20,670 (525,018) C 3592B5 (encrypted) 0x8c 8.0 (0.315) 1 1,789 (45,434) RLL CS EXB-8500c 5,9 0x90 8.0 (0.315) 1 1,703 (43,245) RLL CS EXB-8200c 5,9 .Ed From owner-svn-src-all@freebsd.org Thu Aug 10 15:34:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D9CADD5E2F; Thu, 10 Aug 2017 15:34:51 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0726E654D0; Thu, 10 Aug 2017 15:34:50 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AFYolf059101; Thu, 10 Aug 2017 15:34:50 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AFYom6059099; Thu, 10 Aug 2017 15:34:50 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708101534.v7AFYom6059099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 10 Aug 2017 15:34: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: r322366 - in stable/11: lib/libmt usr.bin/mt X-SVN-Group: stable-11 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in stable/11: lib/libmt usr.bin/mt X-SVN-Commit-Revision: 322366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 15:34:51 -0000 Author: ken Date: Thu Aug 10 15:34:49 2017 New Revision: 322366 URL: https://svnweb.freebsd.org/changeset/base/322366 Log: MFC r320991, r322016: ------------------------------------------------------------------------ r320991 | ken | 2017-07-14 10:45:46 -0600 (Fri, 14 Jul 2017) | 17 lines Add IBM TS1155 density codes to libmt and the mt(1) man page. These are taken directly from the density report from a TS1155 tape drive. (Using mt getdensity) lib/libmt/mtlib.c: Add 3592B5 encrypted/unencrypted density codes, and bpmm/bpi values. The bpmm/bpi values are the same as TS1150, but there are 50% more tracks. usr.bin/mt/mt.1: Add 3592B5 encrypted/unencrypted density codes, bpmm/bpi values and number of tracks. Bump the man page date. Sponsored by: Spectra Logic ------------------------------------------------------------------------ r322016 | ken | 2017-08-03 09:04:54 -0600 (Thu, 03 Aug 2017) | 6 lines Oracle T10000 tape drives use PRML encoding. Source: Oracle T10000 SCSI reference guide. Sponsored by: Spectra Logic ------------------------------------------------------------------------ Modified: stable/11/lib/libmt/mtlib.c stable/11/usr.bin/mt/mt.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libmt/mtlib.c ============================================================================== --- stable/11/lib/libmt/mtlib.c Thu Aug 10 15:31:45 2017 (r322365) +++ stable/11/lib/libmt/mtlib.c Thu Aug 10 15:34:49 2017 (r322366) @@ -641,6 +641,7 @@ static struct densities { { 0x53, 13452, 341681, "3592A3 (unencrypted)" }, { 0x54, 19686, 500024, "3592A4 (unencrypted)" }, { 0x55, 20670, 525018, "3592A5 (unencrypted)" }, + { 0x56, 20670, 525018, "3592B5 (unencrypted)" }, { 0x58, 15142, 384607, "LTO-5" }, { 0x5A, 15142, 384607, "LTO-6" }, { 0x5C, 19107, 485318, "LTO-7" }, @@ -650,6 +651,7 @@ static struct densities { { 0x73, 13452, 341681, "3592A3 (encrypted)" }, { 0x74, 19686, 500024, "3592A4 (encrypted)" }, { 0x75, 20670, 525018, "3592A5 (encrypted)" }, + { 0x76, 20670, 525018, "3592B5 (encrypted)" }, { 0x8c, 1789, 45434, "EXB-8500c" }, { 0x90, 1703, 43245, "EXB-8200c" }, { 0, 0, 0, NULL } Modified: stable/11/usr.bin/mt/mt.1 ============================================================================== --- stable/11/usr.bin/mt/mt.1 Thu Aug 10 15:31:45 2017 (r322365) +++ stable/11/usr.bin/mt/mt.1 Thu Aug 10 15:34:49 2017 (r322366) @@ -29,7 +29,7 @@ .\" @(#)mt.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd May 11, 2017 +.Dd August 3, 2017 .Dt MT 1 .Os .Sh NAME @@ -509,15 +509,16 @@ Value Width Tracks Density Code Typ 0x47 3.81 (0.25) ? 6,417 (163,000) CS DAT-72 0x48 12.7 (0.5) 448 5,236 (133,000) PRML C SDLTapeI(110) 6,8,13 0x49 12.7 (0.5) 448 7,598 (193,000) PRML C SDLTapeI(160) 6,8 -0x4A 12.7 (0.5) 768 ? C T10000A 10 -0x4B 12.7 (0.5) 1152 ? C T10000B 10 -0x4C 12.7 (0.5) 3584 ? C T10000C 10 -0x4D 12.7 (0.5) 4608 ? C T10000D 10 +0x4A 12.7 (0.5) 768 ? PRML C T10000A 10 +0x4B 12.7 (0.5) 1152 ? PRML C T10000B 10 +0x4C 12.7 (0.5) 3584 ? PRML C T10000C 10 +0x4D 12.7 (0.5) 4608 ? PRML C T10000D 10 0x51 12.7 (0.5) 512 11,800 (299,720) C 3592A1 (unencrypted) 0x52 12.7 (0.5) 896 11,800 (299,720) C 3592A2 (unencrypted) 0x53 12.7 (0.5) 1152 13,452 (341,681) C 3592A3 (unencrypted) 0x54 12.7 (0.5) 2560 19,686 (500,024) C 3592A4 (unencrypted) 0x55 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (unencrypted) +0x56 12.7 (0.5) 7680 20,670 (525,018) C 3592B5 (unencrypted) 0x58 12.7 (0.5) 1280 15,142 (384,607) C LTO-5 0x5A 12.7 (0.5) 2176 15,142 (384,607) C LTO-6 0x5C 12.7 (0.5) 3584 19,107 (485,318) C LTO-7 @@ -527,6 +528,7 @@ Value Width Tracks Density Code Typ 0x73 12.7 (0.5) 1152 13,452 (341,681) C 3592A3 (encrypted) 0x74 12.7 (0.5) 2560 19,686 (500,024) C 3592A4 (encrypted) 0x75 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (encrypted) +0x76 12.7 (0.5) 7680 20,670 (525,018) C 3592B5 (encrypted) 0x8c 8.0 (0.315) 1 1,789 (45,434) RLL CS EXB-8500c 5,9 0x90 8.0 (0.315) 1 1,703 (43,245) RLL CS EXB-8200c 5,9 .Ed From owner-svn-src-all@freebsd.org Thu Aug 10 15:42:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E624FDD62F9; Thu, 10 Aug 2017 15:42:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 B430365FAF; Thu, 10 Aug 2017 15:42:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AFgPJF064596; Thu, 10 Aug 2017 15:42:25 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AFgPmQ064595; Thu, 10 Aug 2017 15:42:25 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708101542.v7AFgPmQ064595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 10 Aug 2017 15:42:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322368 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 322368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 15:42:27 -0000 Author: pfg Date: Thu Aug 10 15:42:25 2017 New Revision: 322368 URL: https://svnweb.freebsd.org/changeset/base/322368 Log: fnmatch(3): improve POSIX conformance. In a recent interpretation[1], "\\" shall return a non-zero value (indicating either no match or an error). The fix involves a change over r254091 and now the behavior matches the Sun/IBM/HP closed source implementations and also likely musl libc. Submitted by: Joerg Schilling MFC after: 1 week [1] http://austingroupbugs.net/view.php?id=806 Modified: head/lib/libc/gen/fnmatch.c Modified: head/lib/libc/gen/fnmatch.c ============================================================================== --- head/lib/libc/gen/fnmatch.c Thu Aug 10 15:34:50 2017 (r322367) +++ head/lib/libc/gen/fnmatch.c Thu Aug 10 15:42:25 2017 (r322368) @@ -184,7 +184,8 @@ fnmatch1(const char *pattern, const char *string, cons if (!(flags & FNM_NOESCAPE)) { pclen = mbrtowc(&pc, pattern, MB_LEN_MAX, &patmbs); - if (pclen == (size_t)-1 || pclen == (size_t)-2) + if (pclen == 0 || pclen == (size_t)-1 || + pclen == (size_t)-2) return (FNM_NOMATCH); pattern += pclen; } From owner-svn-src-all@freebsd.org Thu Aug 10 16:45:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B4DCDD78CE; Thu, 10 Aug 2017 16:45:07 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5B4468B88; Thu, 10 Aug 2017 16:45:06 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AGj51o089921; Thu, 10 Aug 2017 16:45:05 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AGj5r4089920; Thu, 10 Aug 2017 16:45:05 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201708101645.v7AGj5r4089920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Thu, 10 Aug 2017 16:45:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322369 - head/lib/libutil X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libutil X-SVN-Commit-Revision: 322369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 16:45:07 -0000 Author: oshogbo Date: Thu Aug 10 16:45:05 2017 New Revision: 322369 URL: https://svnweb.freebsd.org/changeset/base/322369 Log: Store directory descriptor in the pidfh structure and use unlinkat(2) function instead of unlink(2). Now when pidfile_remove() uses unlinkat(2) to remove the pidfile it is safe to use this function in capability mode. Style fix: sort headers. PR: 220524 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D11692 Modified: head/lib/libutil/pidfile.c Modified: head/lib/libutil/pidfile.c ============================================================================== --- head/lib/libutil/pidfile.c Thu Aug 10 15:42:25 2017 (r322368) +++ head/lib/libutil/pidfile.c Thu Aug 10 16:45:05 2017 (r322369) @@ -31,19 +31,22 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include #include #include -#include -#include #include #include -#include -#include -#include +#include struct pidfh { + int pf_dirfd; int pf_fd; - char pf_path[MAXPATHLEN + 1]; + char pf_dir[MAXPATHLEN + 1]; + char pf_filename[MAXPATHLEN + 1]; dev_t pf_dev; ino_t pf_ino; }; @@ -68,12 +71,12 @@ pidfile_verify(const struct pidfh *pfh) } static int -pidfile_read(const char *path, pid_t *pidptr) +pidfile_read(int dirfd, const char *filename, pid_t *pidptr) { char buf[16], *endptr; int error, fd, i; - fd = open(path, O_RDONLY | O_CLOEXEC); + fd = openat(dirfd, filename, O_RDONLY | O_CLOEXEC); if (fd == -1) return (errno); @@ -98,32 +101,50 @@ pidfile_open(const char *path, mode_t mode, pid_t *pid { struct pidfh *pfh; struct stat sb; - int error, fd, len, count; + int error, fd, dirfd, dirlen, filenamelen, count; struct timespec rqtp; pfh = malloc(sizeof(*pfh)); if (pfh == NULL) return (NULL); - if (path == NULL) - len = snprintf(pfh->pf_path, sizeof(pfh->pf_path), - "/var/run/%s.pid", getprogname()); - else - len = snprintf(pfh->pf_path, sizeof(pfh->pf_path), + if (path == NULL) { + dirlen = snprintf(pfh->pf_dir, sizeof(pfh->pf_dir), + "/var/run/"); + filenamelen = snprintf(pfh->pf_filename, + sizeof(pfh->pf_filename), "%s.pid", getprogname()); + } else { + dirlen = snprintf(pfh->pf_dir, sizeof(pfh->pf_dir), "%s", path); - if (len >= (int)sizeof(pfh->pf_path)) { + filenamelen = snprintf(pfh->pf_filename, + sizeof(pfh->pf_filename), "%s", path); + + dirname(pfh->pf_dir); + basename(pfh->pf_filename); + } + + if (dirlen >= (int)sizeof(pfh->pf_dir) || + filenamelen >= (int)sizeof(pfh->pf_filename)) { free(pfh); errno = ENAMETOOLONG; return (NULL); } + dirfd = open(pfh->pf_dir, O_CLOEXEC | O_DIRECTORY | O_NONBLOCK); + if (dirfd == -1) { + error = errno; + free(pfh); + errno = error; + return (NULL); + } + /* * Open the PID file and obtain exclusive lock. * We truncate PID file here only to remove old PID immediately, * PID file will be truncated again in pidfile_write(), so * pidfile_write() can be called multiple times. */ - fd = flopen(pfh->pf_path, + fd = flopenat(dirfd, pfh->pf_filename, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NONBLOCK, mode); if (fd == -1) { if (errno == EWOULDBLOCK) { @@ -134,8 +155,8 @@ pidfile_open(const char *path, mode_t mode, pid_t *pid rqtp.tv_sec = 0; rqtp.tv_nsec = 5000000; for (;;) { - errno = pidfile_read(pfh->pf_path, - pidptr); + errno = pidfile_read(dirfd, + pfh->pf_filename, pidptr); if (errno != EAGAIN || --count == 0) break; nanosleep(&rqtp, 0); @@ -146,7 +167,10 @@ pidfile_open(const char *path, mode_t mode, pid_t *pid errno = EEXIST; } } + error = errno; + close(dirfd); free(pfh); + errno = error; return (NULL); } @@ -156,13 +180,15 @@ pidfile_open(const char *path, mode_t mode, pid_t *pid */ if (fstat(fd, &sb) == -1) { error = errno; - unlink(pfh->pf_path); + unlinkat(dirfd, pfh->pf_filename, 0); + close(dirfd); close(fd); free(pfh); errno = error; return (NULL); } + pfh->pf_dirfd = dirfd; pfh->pf_fd = fd; pfh->pf_dev = sb.st_dev; pfh->pf_ino = sb.st_ino; @@ -223,6 +249,9 @@ pidfile_close(struct pidfh *pfh) if (close(pfh->pf_fd) == -1) error = errno; + if (close(pfh->pf_dirfd) == -1 && error == 0) + error = errno; + free(pfh); if (error != 0) { errno = error; @@ -242,12 +271,12 @@ _pidfile_remove(struct pidfh *pfh, int freeit) return (-1); } - if (unlink(pfh->pf_path) == -1) + if (unlinkat(pfh->pf_dirfd, pfh->pf_filename, 0) == -1) error = errno; - if (close(pfh->pf_fd) == -1) { - if (error == 0) - error = errno; - } + if (close(pfh->pf_fd) == -1 && error == 0) + error = errno; + if (close(pfh->pf_dirfd) == -1 && error == 0) + error = errno; if (freeit) free(pfh); else From owner-svn-src-all@freebsd.org Thu Aug 10 16:50:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E24FDD7A9D; Thu, 10 Aug 2017 16:50:15 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7F3C6936E; Thu, 10 Aug 2017 16:50:14 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AGoDeu090171; Thu, 10 Aug 2017 16:50:13 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AGoD6I090170; Thu, 10 Aug 2017 16:50:13 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201708101650.v7AGoD6I090170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Thu, 10 Aug 2017 16:50:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322370 - head/lib/libutil X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libutil X-SVN-Commit-Revision: 322370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 16:50:15 -0000 Author: oshogbo Date: Thu Aug 10 16:50:13 2017 New Revision: 322370 URL: https://svnweb.freebsd.org/changeset/base/322370 Log: Limit descriptors stored in the pidfh structure. Reviewed by: markj, cem Differential Revision: https://reviews.freebsd.org/D11741 Modified: head/lib/libutil/pidfile.c Modified: head/lib/libutil/pidfile.c ============================================================================== --- head/lib/libutil/pidfile.c Thu Aug 10 16:45:05 2017 (r322369) +++ head/lib/libutil/pidfile.c Thu Aug 10 16:50:13 2017 (r322370) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -103,6 +104,7 @@ pidfile_open(const char *path, mode_t mode, pid_t *pid struct stat sb; int error, fd, dirfd, dirlen, filenamelen, count; struct timespec rqtp; + cap_rights_t caprights; pfh = malloc(sizeof(*pfh)); if (pfh == NULL) @@ -179,21 +181,35 @@ pidfile_open(const char *path, mode_t mode, pid_t *pid * to the proper descriptor. */ if (fstat(fd, &sb) == -1) { - error = errno; - unlinkat(dirfd, pfh->pf_filename, 0); - close(dirfd); - close(fd); - free(pfh); - errno = error; - return (NULL); + goto failed; } + if (cap_rights_limit(dirfd, + cap_rights_init(&caprights, CAP_UNLINKAT)) < 0 && errno != ENOSYS) { + goto failed; + } + + if (cap_rights_limit(fd, cap_rights_init(&caprights, CAP_PWRITE, + CAP_FSTAT, CAP_FTRUNCATE)) < 0 && + errno != ENOSYS) { + goto failed; + } + pfh->pf_dirfd = dirfd; pfh->pf_fd = fd; pfh->pf_dev = sb.st_dev; pfh->pf_ino = sb.st_ino; return (pfh); + +failed: + error = errno; + unlinkat(dirfd, pfh->pf_filename, 0); + close(dirfd); + close(fd); + free(pfh); + errno = error; + return (NULL); } int From owner-svn-src-all@freebsd.org Thu Aug 10 17:03:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9130BDD81FE; Thu, 10 Aug 2017 17:03:47 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 5DFFE69D34; Thu, 10 Aug 2017 17:03:47 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AH3k5k098214; Thu, 10 Aug 2017 17:03:46 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AH3kju098213; Thu, 10 Aug 2017 17:03:46 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201708101703.v7AH3kju098213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 10 Aug 2017 17:03:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322371 - head/lib/libc/tests/gen X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libc/tests/gen X-SVN-Commit-Revision: 322371 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 17:03:47 -0000 Author: pfg Date: Thu Aug 10 17:03:46 2017 New Revision: 322371 URL: https://svnweb.freebsd.org/changeset/base/322371 Log: fnmatch(3): Update testcase for r322368. Modified: head/lib/libc/tests/gen/fnmatch_testcases.h Modified: head/lib/libc/tests/gen/fnmatch_testcases.h ============================================================================== --- head/lib/libc/tests/gen/fnmatch_testcases.h Thu Aug 10 16:50:13 2017 (r322370) +++ head/lib/libc/tests/gen/fnmatch_testcases.h Thu Aug 10 17:03:46 2017 (r322371) @@ -131,7 +131,7 @@ struct testcase { { "\\(", "\\(", 0, FNM_NOMATCH }, { "\\a", "\\a", 0, FNM_NOMATCH }, { "\\", "\\", 0, FNM_NOMATCH }, - { "\\", "", 0, 0 }, + { "\\", "", 0, FNM_NOMATCH }, { "\\*", "\\*", FNM_NOESCAPE, 0 }, { "\\?", "\\?", FNM_NOESCAPE, 0 }, { "\\", "\\", FNM_NOESCAPE, 0 }, From owner-svn-src-all@freebsd.org Thu Aug 10 17:46:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 601B2DD8BB3; Thu, 10 Aug 2017 17:46:58 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 2FAC26ADF7; Thu, 10 Aug 2017 17:46:58 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AHkvbV014741; Thu, 10 Aug 2017 17:46:57 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AHkvdw014739; Thu, 10 Aug 2017 17:46:57 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201708101746.v7AHkvdw014739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Thu, 10 Aug 2017 17:46:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322372 - in head/sys/x86: acpica x86 X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: in head/sys/x86: acpica x86 X-SVN-Commit-Revision: 322372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 17:46:58 -0000 Author: royger Date: Thu Aug 10 17:46:57 2017 New Revision: 322372 URL: https://svnweb.freebsd.org/changeset/base/322372 Log: mptable: fix i386 build failure Reported by: emaste X-MFC-with: r322347 Modified: head/sys/x86/acpica/madt.c head/sys/x86/x86/mptable.c Modified: head/sys/x86/acpica/madt.c ============================================================================== --- head/sys/x86/acpica/madt.c Thu Aug 10 17:03:46 2017 (r322371) +++ head/sys/x86/acpica/madt.c Thu Aug 10 17:46:57 2017 (r322372) @@ -325,12 +325,17 @@ static void madt_parse_cpu(unsigned int apic_id, unsigned int flags) { - if (!(flags & ACPI_MADT_ENABLED) || mp_ncpus == MAXCPU || + if (!(flags & ACPI_MADT_ENABLED) || +#ifdef SMP + mp_ncpus == MAXCPU || +#endif apic_id > MAX_APIC_ID) return; +#ifdef SMP mp_ncpus++; mp_maxid = mp_ncpus - 1; +#endif max_apic_id = max(apic_id, max_apic_id); } Modified: head/sys/x86/x86/mptable.c ============================================================================== --- head/sys/x86/x86/mptable.c Thu Aug 10 17:03:46 2017 (r322371) +++ head/sys/x86/x86/mptable.c Thu Aug 10 17:46:57 2017 (r322372) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef NEW_PCIB #include #endif @@ -330,8 +331,10 @@ mptable_probe_cpus(void) /* Is this a pre-defined config? */ if (mpfps->config_type != 0) { +#ifdef SMP mp_ncpus = 2; mp_maxid = 1; +#endif max_apic_id = 1; } else { mptable_walk_table(mptable_probe_cpus_handler, &cpu_mask); @@ -346,6 +349,7 @@ static int mptable_setup_local(void) { vm_paddr_t addr; + u_int cpu_mask; /* Is this a pre-defined config? */ printf("MPTable: <"); @@ -478,8 +482,10 @@ mptable_probe_cpus_handler(u_char *entry, void *arg) proc = (proc_entry_ptr)entry; if (proc->cpu_flags & PROCENTRY_FLAG_EN && proc->apic_id < MAX_LAPIC_ID && mp_ncpus < MAXCPU) { +#ifdef SMP mp_ncpus++; mp_maxid = mp_ncpus - 1; +#endif max_apic_id = max(max_apic_id, proc->apic_id); } break; From owner-svn-src-all@freebsd.org Thu Aug 10 17:48:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CC5DDD8CDD; Thu, 10 Aug 2017 17:48:59 +0000 (UTC) (envelope-from royger@gmail.com) Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B31D46AFE2; Thu, 10 Aug 2017 17:48:58 +0000 (UTC) (envelope-from royger@gmail.com) Received: by mail-wm0-x233.google.com with SMTP id i66so28820246wmg.0; Thu, 10 Aug 2017 10:48:58 -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:content-transfer-encoding:in-reply-to :user-agent; bh=XAxHsNMlZYUppIGhBkZpXNl0hYKIA5XoJkiYa+3hwBA=; b=L1HlJTzK5/MQ6ZzI5kIUFs/MGv49K5lX6JSMy3+ycJ4pcFNVzIQKjUApleQHx5ECmh HCYmvenFSoppMmobvnKXpZY3S9YBi53GPJ+kCKhkymz8+4n3+AZ5lYjPDBbgKePnp4RS p+Y2WZe2jTwANP6Kn3HmudVD29EB4iXS2L8EOPfRFGbj41I5S8NR/cGWnMJft7VgI4R5 i+prp4pOtzHB9rP72oPl8Rv3OywnKJ6TmavzxLpt2IzWauJtyCdfiYvafN76oXamJl5U faxZlvbdWCNrKywTabTq4/ruVdQRif6yT/XnazS9ixXGiJDzBde7ftIKR7jV8kVzFxvv mTag== 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 :content-transfer-encoding:in-reply-to:user-agent; bh=XAxHsNMlZYUppIGhBkZpXNl0hYKIA5XoJkiYa+3hwBA=; b=jl44L7zqG59benMTkEGYzmqQ2E26a6JZarBT9kMe+HrqeTnWAkiJK5Mgw9mJwndPFX /Jm2YCXzrzHflKZvlHGrYNoFVa4ZO4wCcpMaNbVGRhfvgj43eIfXSpd2uJvqx3PeyUF2 ZsaqUvsfn/BXRTk7rKcqNYutStIE4FHgeoUEQPdaiHDzWh4+SAkxzw1iT/Sd6EzAY2uo VIRWzIaO4R3PfK2C5uUyGLDb6485JUIaYBDF+YyfRFsmY8e18xF7EFkJZU0bTA7lXLB3 hTkNWEMPUFPl77+/ZSM50BIav0qzP4UnejfLEkNQFbS0iTdj16bjzQScEAT6xUWK8e3f NsNg== X-Gm-Message-State: AHYfb5h0Q2vhlVJD3+f15cOWJaZElAMLYH4WN577tmngJK5LtcebE7BQ 14Otvm3PTBbAX33m X-Received: by 10.80.164.173 with SMTP id w42mr12883328edb.76.1502387336925; Thu, 10 Aug 2017 10:48:56 -0700 (PDT) Received: from localhost (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id i23sm2679866edj.13.2017.08.10.10.48.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Aug 2017 10:48:56 -0700 (PDT) Sender: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Date: Thu, 10 Aug 2017 18:48:53 +0100 From: Roger Pau =?iso-8859-1?Q?Monn=E9?= To: Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r322347 - in head/sys/x86: acpica include x86 xen Message-ID: <20170810174853.6xzxzxscm4cmd5vy@dhcp-3-128.uk.xensource.com> References: <201708100915.v7A9FIke002476@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170714 (1.8.3) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 17:48:59 -0000 On Thu, Aug 10, 2017 at 10:20:59AM -0400, Ed Maste wrote: > On 10 August 2017 at 05:15, Roger Pau Monné wrote: > > Author: royger > > Date: Thu Aug 10 09:15:18 2017 > > New Revision: 322347 > > URL: https://svnweb.freebsd.org/changeset/base/322347 > > > > Log: > > apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase > > i386 is failing with: Thanks for the heads up! Should be fixed in r322372, will keep an eye on the CI. Roger. From owner-svn-src-all@freebsd.org Thu Aug 10 19:42:31 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5918DDB425; Thu, 10 Aug 2017 19:42:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72DCF6F0E9; Thu, 10 Aug 2017 19:42:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AJgUSm064776; Thu, 10 Aug 2017 19:42:30 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AJgUui064775; Thu, 10 Aug 2017 19:42:30 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708101942.v7AJgUui064775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 10 Aug 2017 19:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322373 - head/sys/arm/ti/am335x X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/ti/am335x X-SVN-Commit-Revision: 322373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 19:42:31 -0000 Author: ian Date: Thu Aug 10 19:42:30 2017 New Revision: 322373 URL: https://svnweb.freebsd.org/changeset/base/322373 Log: Ensure the clocks driver is attached before any drivers that need to enable clocks in their attach(). Modified: head/sys/arm/ti/am335x/am335x_prcm.c Modified: head/sys/arm/ti/am335x/am335x_prcm.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_prcm.c Thu Aug 10 17:46:57 2017 (r322372) +++ head/sys/arm/ti/am335x/am335x_prcm.c Thu Aug 10 19:42:30 2017 (r322373) @@ -465,8 +465,8 @@ static driver_t am335x_prcm_driver = { static devclass_t am335x_prcm_devclass; -DRIVER_MODULE(am335x_prcm, simplebus, am335x_prcm_driver, - am335x_prcm_devclass, 0, 0); +EARLY_DRIVER_MODULE(am335x_prcm, simplebus, am335x_prcm_driver, + am335x_prcm_devclass, 0, 0, BUS_PASS_TIMER + BUS_PASS_ORDER_EARLY); MODULE_VERSION(am335x_prcm, 1); MODULE_DEPEND(am335x_prcm, ti_scm, 1, 1, 1); From owner-svn-src-all@freebsd.org Thu Aug 10 20:26:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A740DDC30D; Thu, 10 Aug 2017 20:26:09 +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 mx1.freebsd.org (Postfix) with ESMTPS id CBCDF703E3; Thu, 10 Aug 2017 20:26:08 +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 v7AKQ84q081033; Thu, 10 Aug 2017 20:26:08 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AKQ8LJ081032; Thu, 10 Aug 2017 20:26:08 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708102026.v7AKQ8LJ081032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 10 Aug 2017 20:26:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322374 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/bsdinstall/scripts X-SVN-Commit-Revision: 322374 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 20:26:09 -0000 Author: emaste Date: Thu Aug 10 20:26:07 2017 New Revision: 322374 URL: https://svnweb.freebsd.org/changeset/base/322374 Log: bsdinstall: record DHCP config after obtaining lease Previously we added an ifconfig_$INTERFACE line to rc.conf for each unsuccessful DCHP attempt. PR: 219515 Reviewed by: allanjude MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D11967 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Thu Aug 10 19:42:30 2017 (r322373) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Thu Aug 10 20:26:07 2017 (r322374) @@ -48,8 +48,6 @@ esac dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --yesno 'Would you like to use DHCP to configure this interface?' 0 0 if [ $? -eq $DIALOG_OK ]; then - echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/._rc.conf.net - if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0 err=$( dhclient $INTERFACE 2>&1 ) @@ -59,6 +57,7 @@ if [ $? -eq $DIALOG_OK ]; then exec $0 ${INTERFACE} "${IFCONFIG_PREFIX}" fi fi + echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/._rc.conf.net exit 0 fi From owner-svn-src-all@freebsd.org Thu Aug 10 21:39:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B7BEDDD810; Thu, 10 Aug 2017 21:39:11 +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 mx1.freebsd.org (Postfix) with ESMTPS id 454A072447; Thu, 10 Aug 2017 21:39:11 +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 v7ALdAL0009774; Thu, 10 Aug 2017 21:39:10 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ALdAOP009773; Thu, 10 Aug 2017 21:39:10 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708102139.v7ALdAOP009773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 10 Aug 2017 21:39:10 +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: r322375 - stable/11/usr.sbin/tzsetup X-SVN-Group: stable-11 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/11/usr.sbin/tzsetup X-SVN-Commit-Revision: 322375 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 21:39:11 -0000 Author: marius Date: Thu Aug 10 21:39:10 2017 New Revision: 322375 URL: https://svnweb.freebsd.org/changeset/base/322375 Log: MFC: r322097, r322203 - Since r301131, /etc/localtime is also installed when selecting UTC in interactive configurations. Thus, the code added in r220172 which treats a NULL zone file name as UTC and removes /etc/localtime in that case can go again. - Consistently refer to "could not delete" (as chosen by the oldest such code in here) when unlink(2) fails instead of a to mixture of "delete" and "unlink" in error messages. Modified: stable/11/usr.sbin/tzsetup/tzsetup.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/11/usr.sbin/tzsetup/tzsetup.c Thu Aug 10 20:26:07 2017 (r322374) +++ stable/11/usr.sbin/tzsetup/tzsetup.c Thu Aug 10 21:39:10 2017 (r322375) @@ -107,7 +107,7 @@ xdialog_count_rows(const char *p) rows++; } - return rows ? rows : 1; + return (rows ? rows : 1); } static int @@ -124,7 +124,7 @@ xdialog_count_columns(const char *p) len = strlen(p); max_len = MAX(max_len, len); - return max_len; + return (max_len); } static int @@ -164,7 +164,8 @@ xdialog_menu(const char *title, const char *cprompt, i tag_x = MAX(tag_x, l + k + 2); } } - width = MAX(xdialog_count_columns(cprompt), title != NULL ? xdialog_count_columns(title) : 0); + width = MAX(xdialog_count_columns(cprompt), title != NULL ? + xdialog_count_columns(title) : 0); width = MAX(width, tag_x + 4) + 4; } width = MAX(width, 24); @@ -199,7 +200,7 @@ again: free(listitems); dlg_restore_vars(&save_vars); - return result; + return (result); } static int usedialog = 1; @@ -269,7 +270,7 @@ continent_country_menu(dialogMenuItem *continent) int rv; if (strcmp(continent->title, "UTC") == 0) - return set_zone_utc(); + return (set_zone_utc()); /* Short cut -- if there's only one country, don't post a menu. */ if (contp->nitems == 1) @@ -642,7 +643,7 @@ set_zone_menu(dialogMenuItem *dmi) static int set_zone_utc(void) { - if (!confirm_zone(NULL)) + if (!confirm_zone("UTC")) return (DITEM_FAILURE | DITEM_RECREATE); return (install_zoneinfo("UTC")); @@ -656,7 +657,7 @@ confirm_zone(const char *filename) struct tm *tm; int rv; - setenv("TZ", filename == NULL ? "" : filename, 1); + setenv("TZ", filename, 1); tzset(); tm = localtime(&t); @@ -714,11 +715,8 @@ install_zoneinfo_file(const char *zoneinfo_file) #ifdef VERBOSE snprintf(title, sizeof(title), "Info"); - if (zoneinfo_file == NULL) + if (copymode) snprintf(prompt, sizeof(prompt), - "Removing %s", path_localtime); - else if (copymode) - snprintf(prompt, sizeof(prompt), "Copying %s to %s", zoneinfo_file, path_localtime); else snprintf(prompt, sizeof(prompt), @@ -733,49 +731,6 @@ install_zoneinfo_file(const char *zoneinfo_file) #endif if (reallydoit) { - if (zoneinfo_file == NULL) { - if (unlink(path_localtime) < 0 && errno != ENOENT) { - snprintf(title, sizeof(title), "Error"); - snprintf(prompt, sizeof(prompt), - "Could not delete %s: %s", path_localtime, - strerror(errno)); -#ifdef HAVE_DIALOG - if (usedialog) - dialog_msgbox(title, prompt, 8, 72, 1); - else -#endif - fprintf(stderr, "%s\n", prompt); - - return (DITEM_FAILURE | DITEM_RECREATE); - } - if (unlink(path_db) < 0 && errno != ENOENT) { - snprintf(title, sizeof(title), "Error"); - snprintf(prompt, sizeof(prompt), - "Could not delete %s: %s", path_db, - strerror(errno)); -#ifdef HAVE_DIALOG - if (usedialog) - dialog_msgbox(title, prompt, 8, 72, 1); - else -#endif - fprintf(stderr, "%s\n", prompt); - - return (DITEM_FAILURE | DITEM_RECREATE); - } -#ifdef VERBOSE - snprintf(title, sizeof(title), "Done"); - snprintf(prompt, sizeof(prompt), - "Removed %s", path_localtime); -#ifdef HAVE_DIALOG - if (usedialog) - dialog_msgbox(title, prompt, 8, 72, 1); - else -#endif - fprintf(stderr, "%s\n", prompt); -#endif - return (DITEM_LEAVE_MENU); - } - if (copymode) { fd1 = open(zoneinfo_file, O_RDONLY, 0); if (fd1 < 0) { @@ -794,7 +749,7 @@ install_zoneinfo_file(const char *zoneinfo_file) if (unlink(path_localtime) < 0 && errno != ENOENT) { snprintf(prompt, sizeof(prompt), - "Could not unlink %s: %s", + "Could not delete %s: %s", path_localtime, strerror(errno)); #ifdef HAVE_DIALOG if (usedialog) { @@ -859,7 +814,7 @@ install_zoneinfo_file(const char *zoneinfo_file) } if (unlink(path_localtime) < 0 && errno != ENOENT) { snprintf(prompt, sizeof(prompt), - "Could not unlink %s: %s", + "Could not delete %s: %s", path_localtime, strerror(errno)); #ifdef HAVE_DIALOG if (usedialog) { @@ -999,7 +954,6 @@ main(int argc, char **argv) sprintf(path_wall_cmos_clock, "%s/%s", chrootenv, _PATH_WALL_CMOS_CLOCK); } - /* Override the user-supplied umask. */ (void)umask(S_IWGRP | S_IWOTH); From owner-svn-src-all@freebsd.org Thu Aug 10 21:39:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A245FDDD852; Thu, 10 Aug 2017 21:39:23 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7DA97724ED; Thu, 10 Aug 2017 21:39:23 +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 v7ALdMNw009826; Thu, 10 Aug 2017 21:39:22 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ALdMYg009825; Thu, 10 Aug 2017 21:39:22 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708102139.v7ALdMYg009825@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 10 Aug 2017 21:39:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322376 - stable/10/usr.sbin/tzsetup X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/usr.sbin/tzsetup X-SVN-Commit-Revision: 322376 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 21:39:23 -0000 Author: marius Date: Thu Aug 10 21:39:22 2017 New Revision: 322376 URL: https://svnweb.freebsd.org/changeset/base/322376 Log: MFC: r322097, r322203 - Since r301131 (MFCed to stable/10 in r321895), /etc/localtime is also installed when selecting UTC in interactive configurations. Thus, the code added in r220172 which treats a NULL zone file name as UTC and removes /etc/localtime in that case can go again. - Consistently refer to "could not delete" (as chosen by the oldest such code in here) when unlink(2) fails instead of a to mixture of "delete" and "unlink" in error messages. Modified: stable/10/usr.sbin/tzsetup/tzsetup.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/10/usr.sbin/tzsetup/tzsetup.c Thu Aug 10 21:39:10 2017 (r322375) +++ stable/10/usr.sbin/tzsetup/tzsetup.c Thu Aug 10 21:39:22 2017 (r322376) @@ -107,7 +107,7 @@ xdialog_count_rows(const char *p) rows++; } - return rows ? rows : 1; + return (rows ? rows : 1); } static int @@ -124,7 +124,7 @@ xdialog_count_columns(const char *p) len = strlen(p); max_len = MAX(max_len, len); - return max_len; + return (max_len); } static int @@ -164,7 +164,8 @@ xdialog_menu(const char *title, const char *cprompt, i tag_x = MAX(tag_x, l + k + 2); } } - width = MAX(xdialog_count_columns(cprompt), title != NULL ? xdialog_count_columns(title) : 0); + width = MAX(xdialog_count_columns(cprompt), title != NULL ? + xdialog_count_columns(title) : 0); width = MAX(width, tag_x + 4) + 4; } width = MAX(width, 24); @@ -199,7 +200,7 @@ again: free(listitems); dlg_restore_vars(&save_vars); - return result; + return (result); } static int usedialog = 1; @@ -269,7 +270,7 @@ continent_country_menu(dialogMenuItem *continent) int rv; if (strcmp(continent->title, "UTC") == 0) - return set_zone_utc(); + return (set_zone_utc()); /* Short cut -- if there's only one country, don't post a menu. */ if (contp->nitems == 1) @@ -642,7 +643,7 @@ set_zone_menu(dialogMenuItem *dmi) static int set_zone_utc(void) { - if (!confirm_zone(NULL)) + if (!confirm_zone("UTC")) return (DITEM_FAILURE | DITEM_RECREATE); return (install_zoneinfo("UTC")); @@ -656,7 +657,7 @@ confirm_zone(const char *filename) struct tm *tm; int rv; - setenv("TZ", filename == NULL ? "" : filename, 1); + setenv("TZ", filename, 1); tzset(); tm = localtime(&t); @@ -714,11 +715,8 @@ install_zoneinfo_file(const char *zoneinfo_file) #ifdef VERBOSE snprintf(title, sizeof(title), "Info"); - if (zoneinfo_file == NULL) + if (copymode) snprintf(prompt, sizeof(prompt), - "Removing %s", path_localtime); - else if (copymode) - snprintf(prompt, sizeof(prompt), "Copying %s to %s", zoneinfo_file, path_localtime); else snprintf(prompt, sizeof(prompt), @@ -733,49 +731,6 @@ install_zoneinfo_file(const char *zoneinfo_file) #endif if (reallydoit) { - if (zoneinfo_file == NULL) { - if (unlink(path_localtime) < 0 && errno != ENOENT) { - snprintf(title, sizeof(title), "Error"); - snprintf(prompt, sizeof(prompt), - "Could not delete %s: %s", path_localtime, - strerror(errno)); -#ifdef HAVE_DIALOG - if (usedialog) - dialog_msgbox(title, prompt, 8, 72, 1); - else -#endif - fprintf(stderr, "%s\n", prompt); - - return (DITEM_FAILURE | DITEM_RECREATE); - } - if (unlink(path_db) < 0 && errno != ENOENT) { - snprintf(title, sizeof(title), "Error"); - snprintf(prompt, sizeof(prompt), - "Could not delete %s: %s", path_db, - strerror(errno)); -#ifdef HAVE_DIALOG - if (usedialog) - dialog_msgbox(title, prompt, 8, 72, 1); - else -#endif - fprintf(stderr, "%s\n", prompt); - - return (DITEM_FAILURE | DITEM_RECREATE); - } -#ifdef VERBOSE - snprintf(title, sizeof(title), "Done"); - snprintf(prompt, sizeof(prompt), - "Removed %s", path_localtime); -#ifdef HAVE_DIALOG - if (usedialog) - dialog_msgbox(title, prompt, 8, 72, 1); - else -#endif - fprintf(stderr, "%s\n", prompt); -#endif - return (DITEM_LEAVE_MENU); - } - if (copymode) { fd1 = open(zoneinfo_file, O_RDONLY, 0); if (fd1 < 0) { @@ -794,7 +749,7 @@ install_zoneinfo_file(const char *zoneinfo_file) if (unlink(path_localtime) < 0 && errno != ENOENT) { snprintf(prompt, sizeof(prompt), - "Could not unlink %s: %s", + "Could not delete %s: %s", path_localtime, strerror(errno)); #ifdef HAVE_DIALOG if (usedialog) { @@ -859,7 +814,7 @@ install_zoneinfo_file(const char *zoneinfo_file) } if (unlink(path_localtime) < 0 && errno != ENOENT) { snprintf(prompt, sizeof(prompt), - "Could not unlink %s: %s", + "Could not delete %s: %s", path_localtime, strerror(errno)); #ifdef HAVE_DIALOG if (usedialog) { @@ -999,7 +954,6 @@ main(int argc, char **argv) sprintf(path_wall_cmos_clock, "%s/%s", chrootenv, _PATH_WALL_CMOS_CLOCK); } - /* Override the user-supplied umask. */ (void)umask(S_IWGRP | S_IWOTH); From owner-svn-src-all@freebsd.org Thu Aug 10 21:48:37 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74E3CDDDB8E; Thu, 10 Aug 2017 21:48:37 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 1EA9072A10; Thu, 10 Aug 2017 21:48:37 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7ALma4i014091; Thu, 10 Aug 2017 21:48:36 GMT (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7ALmY8i014074; Thu, 10 Aug 2017 21:48:34 GMT (envelope-from peter@FreeBSD.org) Message-Id: <201708102148.v7ALmY8i014074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peter set sender to peter@FreeBSD.org using -f From: Peter Wemm Date: Thu, 10 Aug 2017 21:48:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322377 - in vendor/subversion/dist: . subversion/include subversion/libsvn_client subversion/libsvn_fs_fs subversion/libsvn_fs_x subversion/libsvn_ra_svn subversion/libsvn_repos subver... X-SVN-Group: vendor X-SVN-Commit-Author: peter X-SVN-Commit-Paths: in vendor/subversion/dist: . subversion/include subversion/libsvn_client subversion/libsvn_fs_fs subversion/libsvn_fs_x subversion/libsvn_ra_svn subversion/libsvn_repos subversion/libsvn_subr subversi... X-SVN-Commit-Revision: 322377 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 21:48:37 -0000 Author: peter Date: Thu Aug 10 21:48:34 2017 New Revision: 322377 URL: https://svnweb.freebsd.org/changeset/base/322377 Log: Import subversion-1.9.7 Modified: vendor/subversion/dist/CHANGES vendor/subversion/dist/NOTICE vendor/subversion/dist/build-outputs.mk vendor/subversion/dist/configure vendor/subversion/dist/subversion/include/svn_version.h vendor/subversion/dist/subversion/libsvn_client/copy.c vendor/subversion/dist/subversion/libsvn_client/merge.c vendor/subversion/dist/subversion/libsvn_fs_fs/cached_data.c vendor/subversion/dist/subversion/libsvn_fs_fs/cached_data.h vendor/subversion/dist/subversion/libsvn_fs_fs/rep-cache-db.h vendor/subversion/dist/subversion/libsvn_fs_fs/rep-cache.c vendor/subversion/dist/subversion/libsvn_fs_fs/transaction.c vendor/subversion/dist/subversion/libsvn_fs_x/rep-cache-db.h vendor/subversion/dist/subversion/libsvn_ra_svn/client.c vendor/subversion/dist/subversion/libsvn_repos/dump.c vendor/subversion/dist/subversion/libsvn_subr/config_file.c vendor/subversion/dist/subversion/libsvn_subr/internal_statements.h vendor/subversion/dist/subversion/libsvn_subr/io.c vendor/subversion/dist/subversion/libsvn_subr/version.c vendor/subversion/dist/subversion/libsvn_wc/wc-checks.h vendor/subversion/dist/subversion/libsvn_wc/wc-metadata.h vendor/subversion/dist/subversion/libsvn_wc/wc-queries.h vendor/subversion/dist/subversion/svnadmin/svnadmin.c vendor/subversion/dist/win-tests.py Modified: vendor/subversion/dist/CHANGES ============================================================================== --- vendor/subversion/dist/CHANGES Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/CHANGES Thu Aug 10 21:48:34 2017 (r322377) @@ -1,3 +1,63 @@ +Version 1.9.7 +(10 Aug 2017, from /branches/1.9.x) +http://svn.apache.org/repos/asf/subversion/tags/1.9.7 + + User-visible changes: + - Client-side bugfixes: + * Fix arbitrary code execution vulnerability CVE-2017-9800 + See + for details. + + - Server-side bugfixes: + (none) + + - Bindings bugfixes: + (none) + + Developer-visible changes: + - General: + (none) + + - API changes: + (none) + + +Version 1.9.6 +(5 Jul 2017, from /branches/1.9.x) +http://svn.apache.org/repos/asf/subversion/tags/1.9.6 + + User-visible changes: + - Client-side bugfixes: + * cp/mv: improve error message when target is an unversioned dir (r1779948) + * merge: reduce memory usage with large amounts of mergeinfo (issue #4667) + + - Server-side bugfixes: + * 'svnadmin freeze': document the purpose more clearly (r1774109) + * dump: fix segfault when a revision has no revprops (r1781507) + * fsfs: improve error message upon failure to open rep-cache (r1781655) + * fsfs: never attempt to share directory representations (r1785053) + * fsfs: make consistency independent of hash algorithms (r1785737 et al) + This change makes Subversion resilient to collision attacks, including + SHA-1 collision attacks such as . See also our + documentation at and + . + + - Client-side and server-side bugfixes: + * work around an APR bug related to file truncation (r1759116) + + - Bindings bugfixes: + * javahl: follow redirects when opening a connection (r1667738, r1796720) + + Developer-visible changes: + - General: + * win_tests.py: make the --bin option work, rather than abort (r1706432) + (regression introduced in 1.9.2) + * windows: support building with 'zlibstat.lib' in install-layout (r1783704) + + - API changes: + (none) + + Version 1.9.5 (29 Nov 2016, from /branches/1.9.x) http://svn.apache.org/repos/asf/subversion/tags/1.9.5 @@ -19,7 +79,7 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.5 * fsfs: fix "offset too large" error during pack (issue #4657) * svnserve: enable hook script environments (r1769152) * fsfs: fix possible data reconstruction error (issue #4658) - * fix source of spurious 'incoming edit' tree conflicts (r1770108) + * fix source of spurious 'incoming edit' tree conflicts (r1760570) * fsfs: improve caching for large directories (r1721285) * fsfs: fix crash when encountering all-zero checksums (r1759686) * fsfs: fix potential source of repository corruptions (r1756266) @@ -34,19 +94,19 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.5 - Bindings bugfixes: * swig-pl: do not corrupt "{DATE}" revision variable (r1767768) - * javahl: fix temporary accepting SSL server certificates (r1764851) + * javahl: fix temporarily accepting SSL server certificates (r1764851) * swig-pl: fix possible stack corruption (r1683266, r1683267) Developer-visible changes: - General: * add zlib discovery through pkg-config (issue #4655) * fix potential build issue with invalid SVN_LOCALE_DIR (issue #4653) - * ruby: fix test failures with ruby >= 2.2 (r1766621) - * fix link error with --disable-keychain on OS X (r1765385) + * ruby: fix test failures with ruby >= 2.2 (r1766240) + * fix link error with --disable-keychain on OS X (r1761755) * swig: enable building with SWIG >= 3.0.6 (r1721488 et al) * swig: fix building with -Wdate-time in $CPPFLAGS (r1722164) * update serf download URI in build scripts (r1700130 et al) - * raise minimal httpd version from 2.0 to 2.2 (r1754193) + * raise minimal httpd version from 2.0 to 2.2 (r1754190) Version 1.9.4 @@ -105,7 +165,6 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.3 * svn: report lock/unlock errors as failures (r1701598 et al) * svn: cleanup user deleted external registrations (r1705843, r1710558) * svn: allow simple resolving of binary file text conflicts (r1703581) - * svnlook: properly remove tempfiles on diff errors (r1711346) * ra_serf: report built- and run-time versions of libserf (r1704847) * ra_serf: set Content-Type header in outgoing requests (r1715224 et al) * svn: fix merging deletes of svn:eol-style CRLF/CR files (r1703689 et al) @@ -118,6 +177,7 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.3 * mod_dav_svn: use LimitXMLRequestBody for skel-encoded requests (r1687812) * svnadmin dump: preserve no-op changes (r1709388 et al, issue #4598) * fsfs: avoid unneeded I/O when opening transactions (r1715793) + * svnlook: properly remove tempfiles on diff errors (r1711346) - Client-side and server-side bugfixes: * fix heap overflow in svn:// protocol parser (CVE-2015-5259) @@ -942,18 +1002,18 @@ http://svn.apache.org/repos/asf/subversion/tags/1.8.17 - Client-side bugfixes: * fix handling of newly secured subdirectories in working copy (r1724448) * ra_serf: fix deleting directories with many files (issue #4557) - * svnlook: properly remove tempfiles on diff errors (r1711346) * gpg-agent: properly handle passwords with percent characters (issue #4611) * merge: fix crash when merging to a local add (r1702299 et al) - Server-side bugfixes: * fsfs: fix possible data reconstruction error (issue #4658) + * svnlook: properly remove tempfiles on diff errors (r1711346) - Client-side and server-side bugfixes: * fix potential memory access bugs (r1722860 et al) - Bindings bugfixes: - * javahl: fix temporary accepting SSL server certificates (r1764851) + * javahl: fix temporarily accepting SSL server certificates (r1764851) * swig-pl: do not corrupt "{DATE}" revision variable (r1767768) * swig-pl: fix possible stack corruption (r1683266) Modified: vendor/subversion/dist/NOTICE ============================================================================== --- vendor/subversion/dist/NOTICE Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/NOTICE Thu Aug 10 21:48:34 2017 (r322377) @@ -1,5 +1,5 @@ Apache Subversion -Copyright 2016 The Apache Software Foundation +Copyright 2017 The Apache Software Foundation This product includes software developed by many people, and distributed under Contributor License Agreements to The Apache Software Foundation Modified: vendor/subversion/dist/build-outputs.mk ============================================================================== --- vendor/subversion/dist/build-outputs.mk Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/build-outputs.mk Thu Aug 10 21:48:34 2017 (r322377) @@ -2782,7 +2782,7 @@ subversion/libsvn_ra_serf/util_error.lo: subversion/li subversion/libsvn_ra_serf/xml.lo: subversion/libsvn_ra_serf/xml.c subversion/include/private/svn_dav_protocol.h subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_ra_private.h subversion/include/private/svn_string_private.h subversion/include/private/svn_subr_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_dav.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_version.h subversion/include/svn_xml.h subversion/libsvn_ra/ra_loader.h subversion/libsvn_ra_serf/blncache.h subversion/libsvn_ra_serf/ra_se rf.h subversion/svn_private_config.h -subversion/libsvn_ra_svn/client.lo: subversion/libsvn_ra_svn/client.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_fspath.h subversion/include/private/svn_ra_private.h subversion/include/private/svn_ra_svn_private.h subversion/include/private/svn_subr_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_compat.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_props.h subversion/include/svn_ra.h subversion/include/svn_ra_svn.h subversion/include/svn_string.h subversion/include/svn_time.h subversion/include/svn_types.h subversion/include/svn_version.h subversion/libsvn_ra/ra_loader.h sub version/libsvn_ra/wrapper_template.h subversion/libsvn_ra_svn/ra_svn.h subversion/svn_private_config.h +subversion/libsvn_ra_svn/client.lo: subversion/libsvn_ra_svn/client.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_fspath.h subversion/include/private/svn_ra_private.h subversion/include/private/svn_ra_svn_private.h subversion/include/private/svn_subr_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_compat.h subversion/include/svn_config.h subversion/include/svn_ctype.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_props.h subversion/include/svn_ra.h subversion/include/svn_ra_svn.h subversion/include/svn_string.h subversion/include/svn_time.h subversion/include/svn_types.h subversion/include/svn_version.h subve rsion/libsvn_ra/ra_loader.h subversion/libsvn_ra/wrapper_template.h subversion/libsvn_ra_svn/ra_svn.h subversion/svn_private_config.h subversion/libsvn_ra_svn/cram.lo: subversion/libsvn_ra_svn/cram.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_ra_svn_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_ra.h subversion/include/svn_ra_svn.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/libsvn_ra_svn/ra_svn.h subversion/svn_private_config.h Modified: vendor/subversion/dist/configure ============================================================================== --- vendor/subversion/dist/configure Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/configure Thu Aug 10 21:48:34 2017 (r322377) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for subversion 1.9.5. +# Generated by GNU Autoconf 2.69 for subversion 1.9.7. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='subversion' PACKAGE_TARNAME='subversion' -PACKAGE_VERSION='1.9.5' -PACKAGE_STRING='subversion 1.9.5' +PACKAGE_VERSION='1.9.7' +PACKAGE_STRING='subversion 1.9.7' PACKAGE_BUGREPORT='http://subversion.apache.org/' PACKAGE_URL='' @@ -1471,7 +1471,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures subversion 1.9.5 to adapt to many kinds of systems. +\`configure' configures subversion 1.9.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1537,7 +1537,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of subversion 1.9.5:";; + short | recursive ) echo "Configuration of subversion 1.9.7:";; esac cat <<\_ACEOF @@ -1751,7 +1751,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -subversion configure 1.9.5 +subversion configure 1.9.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2295,7 +2295,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by subversion $as_me 1.9.5, which was +It was created by subversion $as_me 1.9.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2675,8 +2675,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please -{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.9.5" >&5 -$as_echo "$as_me: Configuring Subversion 1.9.5" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.9.7" >&5 +$as_echo "$as_me: Configuring Subversion 1.9.7" >&6;} abs_srcdir="`cd $srcdir && pwd`" @@ -26756,7 +26756,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by subversion $as_me 1.9.5, which was +This file was extended by subversion $as_me 1.9.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -26822,7 +26822,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -subversion config.status 1.9.5 +subversion config.status 1.9.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: vendor/subversion/dist/subversion/include/svn_version.h ============================================================================== --- vendor/subversion/dist/subversion/include/svn_version.h Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/subversion/include/svn_version.h Thu Aug 10 21:48:34 2017 (r322377) @@ -70,7 +70,7 @@ extern "C" { * * @since New in 1.1. */ -#define SVN_VER_PATCH 5 +#define SVN_VER_PATCH 7 /** @deprecated Provided for backward compatibility with the 1.0 API. */ @@ -93,7 +93,7 @@ extern "C" { * * Always change this at the same time as SVN_VER_NUMTAG. */ -#define SVN_VER_TAG " (r1770682)" +#define SVN_VER_TAG " (r1800392)" /** Number tag: a string describing the version. @@ -117,7 +117,7 @@ extern "C" { * file version. Its value remains 0 in the repository except in release * tags where it is the revision from which the tag was created. */ -#define SVN_VER_REVISION 1770682 +#define SVN_VER_REVISION 1800392 /* Version strings composed from the above definitions. */ Modified: vendor/subversion/dist/subversion/libsvn_client/copy.c ============================================================================== --- vendor/subversion/dist/subversion/libsvn_client/copy.c Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/subversion/libsvn_client/copy.c Thu Aug 10 21:48:34 2017 (r322377) @@ -1057,10 +1057,24 @@ verify_wc_dsts(const apr_array_header_t *copy_pairs, ctx->wc_ctx, pair->dst_parent_abspath, FALSE, TRUE, iterpool)); - if (make_parents && dst_parent_kind == svn_node_none) + if (dst_parent_kind == svn_node_none) { - SVN_ERR(svn_client__make_local_parents(pair->dst_parent_abspath, - TRUE, ctx, iterpool)); + if (make_parents) + SVN_ERR(svn_client__make_local_parents(pair->dst_parent_abspath, + TRUE, ctx, iterpool)); + else + { + SVN_ERR(svn_io_check_path(pair->dst_parent_abspath, + &dst_parent_kind, scratch_pool)); + return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL, + (dst_parent_kind == svn_node_dir) + ? _("Directory '%s' is not under " + "version control") + : _("Path '%s' is not a directory"), + svn_dirent_local_style( + pair->dst_parent_abspath, + scratch_pool)); + } } else if (dst_parent_kind != svn_node_dir) { Modified: vendor/subversion/dist/subversion/libsvn_client/merge.c ============================================================================== --- vendor/subversion/dist/subversion/libsvn_client/merge.c Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/subversion/libsvn_client/merge.c Thu Aug 10 21:48:34 2017 (r322377) @@ -6465,6 +6465,7 @@ get_mergeinfo_paths(apr_array_header_t *children_with_ { int i; apr_pool_t *iterpool = svn_pool_create(scratch_pool); + apr_pool_t *swmi_pool; apr_hash_t *subtrees_with_mergeinfo; apr_hash_t *excluded_subtrees; apr_hash_t *switched_subtrees; @@ -6473,10 +6474,13 @@ get_mergeinfo_paths(apr_array_header_t *children_with_ struct pre_merge_status_baton_t pre_merge_status_baton; /* Case 1: Subtrees with explicit mergeinfo. */ + /* Use a subpool for subtrees_with_mergeinfo, as it can be very large + and is temporary. */ + swmi_pool = svn_pool_create(scratch_pool); SVN_ERR(get_wc_explicit_mergeinfo_catalog(&subtrees_with_mergeinfo, target->abspath, depth, ctx, - result_pool, scratch_pool)); + swmi_pool, swmi_pool)); if (subtrees_with_mergeinfo) { apr_hash_index_t *hi; @@ -6513,6 +6517,7 @@ get_mergeinfo_paths(apr_array_header_t *children_with_ children_with_mergeinfo->elt_size, compare_merge_path_t_as_paths); } + svn_pool_destroy(swmi_pool); /* Case 2: Switched subtrees Case 10: Paths at depths of 'empty' or 'files' @@ -12331,6 +12336,10 @@ find_last_merged_location(svn_client__pathrev_t **base svn_revnum_t youngest_merged_rev = SVN_INVALID_REVNUM; svn_mergeinfo_catalog_t target_mergeinfo_cat = NULL; + /* Using a local subpool for 'target_mergeinfo_cat' can make a big + reduction in overall memory usage. */ + apr_pool_t *tmic_pool = svn_pool_create(scratch_pool); + source_peg_rev.kind = svn_opt_revision_number; source_peg_rev.value.number = source_branch->tip->rev; source_start_rev.kind = svn_opt_revision_number; @@ -12351,7 +12360,7 @@ find_last_merged_location(svn_client__pathrev_t **base operative_rev_receiver, &youngest_merged_rev, ctx, ra_session, - result_pool, scratch_pool)); + tmic_pool, tmic_pool)); if (!SVN_IS_VALID_REVNUM(youngest_merged_rev)) { @@ -12387,7 +12396,7 @@ find_last_merged_location(svn_client__pathrev_t **base operative_rev_receiver, &oldest_eligible_rev, ctx, ra_session, - scratch_pool, scratch_pool)); + tmic_pool, tmic_pool)); /* If there are revisions eligible for merging, use the oldest one to calculate the base. Otherwise there are no operative revisions @@ -12409,6 +12418,7 @@ find_last_merged_location(svn_client__pathrev_t **base result_pool, scratch_pool)); } + svn_pool_destroy(tmic_pool); return SVN_NO_ERROR; } Modified: vendor/subversion/dist/subversion/libsvn_fs_fs/cached_data.c ============================================================================== --- vendor/subversion/dist/subversion/libsvn_fs_fs/cached_data.c Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/subversion/libsvn_fs_fs/cached_data.c Thu Aug 10 21:48:34 2017 (r322377) @@ -2029,8 +2029,13 @@ rep_read_contents(void *baton, SVN_ERR(skip_contents(rb, rb->fulltext_delivered)); } - /* Get the next block of data. */ - SVN_ERR(get_contents_from_windows(rb, buf, len)); + /* Get the next block of data. + * Keep in mind that the representation might be empty and leave us + * already positioned at the end of the rep. */ + if (rb->off == rb->len) + *len = 0; + else + SVN_ERR(get_contents_from_windows(rb, buf, len)); if (rb->current_fulltext) svn_stringbuf_appendbytes(rb->current_fulltext, buf, *len); @@ -2119,6 +2124,96 @@ svn_fs_fs__get_contents(svn_stream_t **contents_p, rep_read_contents); svn_stream_set_close(*contents_p, rep_read_contents_close); } + + return SVN_NO_ERROR; +} + +svn_error_t * +svn_fs_fs__get_contents_from_file(svn_stream_t **contents_p, + svn_fs_t *fs, + representation_t *rep, + apr_file_t *file, + apr_off_t offset, + apr_pool_t *pool) +{ + struct rep_read_baton *rb; + pair_cache_key_t fulltext_cache_key = { SVN_INVALID_REVNUM, 0 }; + rep_state_t *rs = apr_pcalloc(pool, sizeof(*rs)); + svn_fs_fs__rep_header_t *rh; + + /* Initialize the reader baton. Some members may added lazily + * while reading from the stream. */ + SVN_ERR(rep_read_get_baton(&rb, fs, rep, fulltext_cache_key, pool)); + + /* Continue constructing RS. Leave caches as NULL. */ + rs->size = rep->size; + rs->revision = SVN_INVALID_REVNUM; + rs->item_index = 0; + rs->ver = -1; + rs->start = -1; + + /* Provide just enough file access info to allow for a basic read from + * FILE but leave all index / footer info with empty values b/c FILE + * probably is not a complete revision file. */ + rs->sfile = apr_pcalloc(pool, sizeof(*rs->sfile)); + rs->sfile->revision = rep->revision; + rs->sfile->pool = pool; + rs->sfile->fs = fs; + rs->sfile->rfile = apr_pcalloc(pool, sizeof(*rs->sfile->rfile)); + rs->sfile->rfile->start_revision = SVN_INVALID_REVNUM; + rs->sfile->rfile->file = file; + rs->sfile->rfile->stream = svn_stream_from_aprfile2(file, TRUE, pool); + + /* Read the rep header. */ + SVN_ERR(aligned_seek(fs, file, NULL, offset, pool)); + SVN_ERR(svn_fs_fs__read_rep_header(&rh, rs->sfile->rfile->stream, + pool, pool)); + SVN_ERR(get_file_offset(&rs->start, rs, pool)); + rs->header_size = rh->header_size; + + /* Log the access. */ + SVN_ERR(dbg_log_access(fs, SVN_INVALID_REVNUM, 0, rh, + SVN_FS_FS__ITEM_TYPE_ANY_REP, pool)); + + /* Build the representation list (delta chain). */ + if (rh->type == svn_fs_fs__rep_plain) + { + rb->rs_list = apr_array_make(pool, 0, sizeof(rep_state_t *)); + rb->src_state = rs; + } + else if (rh->type == svn_fs_fs__rep_self_delta) + { + rb->rs_list = apr_array_make(pool, 1, sizeof(rep_state_t *)); + APR_ARRAY_PUSH(rb->rs_list, rep_state_t *) = rs; + rb->src_state = NULL; + } + else + { + representation_t next_rep = { 0 }; + + /* skip "SVNx" diff marker */ + rs->current = 4; + + /* REP's base rep is inside a proper revision. + * It can be reconstructed in the usual way. */ + next_rep.revision = rh->base_revision; + next_rep.item_index = rh->base_item_index; + next_rep.size = rh->base_length; + svn_fs_fs__id_txn_reset(&next_rep.txn_id); + + SVN_ERR(build_rep_list(&rb->rs_list, &rb->base_window, + &rb->src_state, &rb->len, rb->fs, &next_rep, + rb->filehandle_pool)); + + /* Insert the access to REP as the first element of the delta chain. */ + svn_sort__array_insert(rb->rs_list, &rs, 0); + } + + /* Now, the baton is complete and we can assemble the stream around it. */ + *contents_p = svn_stream_create(rb, pool); + svn_stream_set_read2(*contents_p, NULL /* only full read support */, + rep_read_contents); + svn_stream_set_close(*contents_p, rep_read_contents_close); return SVN_NO_ERROR; } Modified: vendor/subversion/dist/subversion/libsvn_fs_fs/cached_data.h ============================================================================== --- vendor/subversion/dist/subversion/libsvn_fs_fs/cached_data.h Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/subversion/libsvn_fs_fs/cached_data.h Thu Aug 10 21:48:34 2017 (r322377) @@ -81,6 +81,18 @@ svn_fs_fs__get_contents(svn_stream_t **contents_p, svn_boolean_t cache_fulltext, apr_pool_t *pool); +/* Set *CONTENTS_P to be a readable svn_stream_t that receives the text + representation REP as seen in filesystem FS. Read the latest element + of the delta chain from FILE at offset OFFSET. + Use POOL for allocations. */ +svn_error_t * +svn_fs_fs__get_contents_from_file(svn_stream_t **contents_p, + svn_fs_t *fs, + representation_t *rep, + apr_file_t *file, + apr_off_t offset, + apr_pool_t *pool); + /* Attempt to fetch the text representation of node-revision NODEREV as seen in filesystem FS and pass it along with the BATON to the PROCESSOR. Set *SUCCESS only of the data could be provided and the processing Modified: vendor/subversion/dist/subversion/libsvn_fs_fs/rep-cache-db.h ============================================================================== --- vendor/subversion/dist/subversion/libsvn_fs_fs/rep-cache-db.h Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/subversion/libsvn_fs_fs/rep-cache-db.h Thu Aug 10 21:48:34 2017 (r322377) @@ -1,4 +1,4 @@ -/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.5/subversion/libsvn_fs_fs/token-map.h. +/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.7/subversion/libsvn_fs_fs/token-map.h. * Do not edit this file -- edit the source and rerun gen-make.py */ #define STMT_CREATE_SCHEMA 0 Modified: vendor/subversion/dist/subversion/libsvn_fs_fs/rep-cache.c ============================================================================== --- vendor/subversion/dist/subversion/libsvn_fs_fs/rep-cache.c Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/subversion/libsvn_fs_fs/rep-cache.c Thu Aug 10 21:48:34 2017 (r322377) @@ -128,7 +128,10 @@ svn_fs_fs__open_rep_cache(svn_fs_t *fs, fs_fs_data_t *ffd = fs->fsap_data; svn_error_t *err = svn_atomic__init_once(&ffd->rep_cache_db_opened, open_rep_cache, fs, pool); - return svn_error_quick_wrap(err, _("Couldn't open rep-cache database")); + return svn_error_quick_wrapf(err, + _("Couldn't open rep-cache database '%s'"), + svn_dirent_local_style( + path_rep_cache_db(fs->path, pool), pool)); } svn_error_t * Modified: vendor/subversion/dist/subversion/libsvn_fs_fs/transaction.c ============================================================================== --- vendor/subversion/dist/subversion/libsvn_fs_fs/transaction.c Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/subversion/libsvn_fs_fs/transaction.c Thu Aug 10 21:48:34 2017 (r322377) @@ -2128,6 +2128,11 @@ rep_write_get_baton(struct rep_write_baton **wb_p, there may be new duplicate representations within the same uncommitted revision, those can be passed in REPS_HASH (maps a sha1 digest onto representation_t*), otherwise pass in NULL for REPS_HASH. + + The content of both representations will be compared, taking REP's content + from FILE at OFFSET. Only if they actually match, will *OLD_REP not be + NULL. + Use RESULT_POOL for *OLD_REP allocations and SCRATCH_POOL for temporaries. The lifetime of *OLD_REP is limited by both, RESULT_POOL and REP lifetime. */ @@ -2135,6 +2140,8 @@ static svn_error_t * get_shared_rep(representation_t **old_rep, svn_fs_t *fs, representation_t *rep, + apr_file_t *file, + apr_off_t offset, apr_hash_t *reps_hash, apr_pool_t *result_pool, apr_pool_t *scratch_pool) @@ -2142,6 +2149,10 @@ get_shared_rep(representation_t **old_rep, svn_error_t *err; fs_fs_data_t *ffd = fs->fsap_data; + svn_checksum_t checksum; + checksum.digest = rep->sha1_digest; + checksum.kind = svn_checksum_sha1; + /* Return NULL, if rep sharing has been disabled. */ *old_rep = NULL; if (!ffd->rep_sharing_allowed) @@ -2158,9 +2169,6 @@ get_shared_rep(representation_t **old_rep, /* If we haven't found anything yet, try harder and consult our DB. */ if (*old_rep == NULL) { - svn_checksum_t checksum; - checksum.digest = rep->sha1_digest; - checksum.kind = svn_checksum_sha1; err = svn_fs_fs__get_rep_reference(old_rep, fs, &checksum, result_pool); /* ### Other error codes that we shouldn't mask out? */ if (err == SVN_NO_ERROR) @@ -2235,6 +2243,72 @@ get_shared_rep(representation_t **old_rep, (*old_rep)->uniquifier = rep->uniquifier; } + /* If we (very likely) found a matching representation, compare the actual + * contents such that we can be sure that no rep-cache.db corruption or + * hash collision produced a false positive. */ + if (*old_rep) + { + apr_off_t old_position; + svn_stream_t *contents; + svn_stream_t *old_contents; + svn_boolean_t same; + + /* The existing representation may itself be part of the current + * transaction. In that case, it may be in different stages of + * the commit finalization process. + * + * OLD_REP_NORM is the same as that OLD_REP but it is assigned + * explicitly to REP's transaction if OLD_REP does not point + * to an already committed revision. This then prevents the + * revision lookup and the txn data will be accessed. + */ + representation_t old_rep_norm = **old_rep; + if ( !SVN_IS_VALID_REVNUM(old_rep_norm.revision) + || old_rep_norm.revision > ffd->youngest_rev_cache) + old_rep_norm.txn_id = rep->txn_id; + + /* Make sure we can later restore FILE's current position. */ + SVN_ERR(svn_fs_fs__get_file_offset(&old_position, file, scratch_pool)); + + /* Compare the two representations. + * Note that the stream comparison might also produce MD5 checksum + * errors or other failures in case of SHA1 collisions. */ + SVN_ERR(svn_fs_fs__get_contents_from_file(&contents, fs, rep, file, + offset, scratch_pool)); + SVN_ERR(svn_fs_fs__get_contents(&old_contents, fs, &old_rep_norm, + FALSE, scratch_pool)); + err = svn_stream_contents_same2(&same, contents, old_contents, + scratch_pool); + + /* A mismatch should be extremely rare. + * If it does happen, reject the commit. */ + if (!same || err) + { + /* SHA1 collision or worse. */ + svn_stringbuf_t *old_rep_str + = svn_fs_fs__unparse_representation(*old_rep, + ffd->format, FALSE, + scratch_pool, + scratch_pool); + svn_stringbuf_t *rep_str + = svn_fs_fs__unparse_representation(rep, + ffd->format, FALSE, + scratch_pool, + scratch_pool); + const char *checksum__str + = svn_checksum_to_cstring_display(&checksum, scratch_pool); + + return svn_error_createf(SVN_ERR_FS_GENERAL, + err, "SHA1 of reps '%s' and '%s' " + "matches (%s) but contents differ", + old_rep_str->data, rep_str->data, + checksum__str); + } + + /* Restore FILE's read / write position. */ + SVN_ERR(svn_io_file_seek(file, APR_SET, &old_position, scratch_pool)); + } + return SVN_NO_ERROR; } @@ -2293,8 +2367,8 @@ rep_write_contents_close(void *baton) /* Check and see if we already have a representation somewhere that's identical to the one we just wrote out. */ - SVN_ERR(get_shared_rep(&old_rep, b->fs, rep, NULL, b->result_pool, - b->scratch_pool)); + SVN_ERR(get_shared_rep(&old_rep, b->fs, rep, b->file, b->rep_offset, NULL, + b->result_pool, b->scratch_pool)); if (old_rep) { @@ -2519,11 +2593,16 @@ write_directory_to_stream(svn_stream_t *stream, /* Write out the COLLECTION as a text representation to file FILE using WRITER. In the process, record position, the total size of the dump and MD5 as well as SHA1 in REP. Add the representation of type ITEM_TYPE to - the indexes if necessary. If rep sharing has been enabled and REPS_HASH - is not NULL, it will be used in addition to the on-disk cache to find - earlier reps with the same content. When such existing reps can be - found, we will truncate the one just written from the file and return - the existing rep. Perform temporary allocations in SCRATCH_POOL. */ + the indexes if necessary. + + If ALLOW_REP_SHARING is FALSE, rep-sharing will not be used, regardless + of any other option and rep-sharing settings. If rep sharing has been + enabled and REPS_HASH is not NULL, it will be used in addition to the + on-disk cache to find earlier reps with the same content. If such + existing reps can be found, we will truncate the one just written from + the file and return the existing rep. + + Perform temporary allocations in SCRATCH_POOL. */ static svn_error_t * write_container_rep(representation_t *rep, apr_file_t *file, @@ -2531,14 +2610,15 @@ write_container_rep(representation_t *rep, collection_writer_t writer, svn_fs_t *fs, apr_hash_t *reps_hash, + svn_boolean_t allow_rep_sharing, apr_uint32_t item_type, apr_pool_t *scratch_pool) { svn_stream_t *stream; struct write_container_baton *whb; svn_checksum_ctx_t *fnv1a_checksum_ctx; - representation_t *old_rep; apr_off_t offset = 0; + svn_fs_fs__p2l_entry_t entry; SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); @@ -2562,58 +2642,62 @@ write_container_rep(representation_t *rep, /* Store the results. */ SVN_ERR(digests_final(rep, whb->md5_ctx, whb->sha1_ctx, scratch_pool)); + /* Update size info. */ + rep->expanded_size = whb->size; + rep->size = whb->size; + /* Check and see if we already have a representation somewhere that's identical to the one we just wrote out. */ - SVN_ERR(get_shared_rep(&old_rep, fs, rep, reps_hash, scratch_pool, - scratch_pool)); - - if (old_rep) + if (allow_rep_sharing) { - /* We need to erase from the protorev the data we just wrote. */ - SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + representation_t *old_rep; + SVN_ERR(get_shared_rep(&old_rep, fs, rep, file, offset, reps_hash, + scratch_pool, scratch_pool)); - /* Use the old rep for this content. */ - memcpy(rep, old_rep, sizeof (*rep)); + if (old_rep) + { + /* We need to erase from the protorev the data we just wrote. */ + SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + + /* Use the old rep for this content. */ + memcpy(rep, old_rep, sizeof (*rep)); + return SVN_NO_ERROR; + } } - else - { - svn_fs_fs__p2l_entry_t entry; - /* Write out our cosmetic end marker. */ - SVN_ERR(svn_stream_puts(whb->stream, "ENDREP\n")); + /* Write out our cosmetic end marker. */ + SVN_ERR(svn_stream_puts(whb->stream, "ENDREP\n")); - SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, - offset, scratch_pool)); + SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, + offset, scratch_pool)); - entry.offset = offset; - SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); - entry.size = offset - entry.offset; - entry.type = item_type; - entry.item.revision = SVN_INVALID_REVNUM; - entry.item.number = rep->item_index; - SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, - fnv1a_checksum_ctx, - scratch_pool)); + entry.offset = offset; + SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); + entry.size = offset - entry.offset; + entry.type = item_type; + entry.item.revision = SVN_INVALID_REVNUM; + entry.item.number = rep->item_index; + SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, + fnv1a_checksum_ctx, + scratch_pool)); - SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); + SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); - /* update the representation */ - rep->size = whb->size; - rep->expanded_size = whb->size; - } - return SVN_NO_ERROR; } /* Write out the COLLECTION pertaining to the NODEREV in FS as a deltified text representation to file FILE using WRITER. In the process, record the total size and the md5 digest in REP and add the representation of type - ITEM_TYPE to the indexes if necessary. If rep sharing has been enabled and - REPS_HASH is not NULL, it will be used in addition to the on-disk cache to - find earlier reps with the same content. When such existing reps can be - found, we will truncate the one just written from the file and return the - existing rep. + ITEM_TYPE to the indexes if necessary. + If ALLOW_REP_SHARING is FALSE, rep-sharing will not be used, regardless + of any other option and rep-sharing settings. If rep sharing has been + enabled and REPS_HASH is not NULL, it will be used in addition to the + on-disk cache to find earlier reps with the same content. If such + existing reps can be found, we will truncate the one just written from + the file and return the existing rep. + If ITEM_TYPE is IS_PROPS equals SVN_FS_FS__ITEM_TYPE_*_PROPS, assume that we want to a props representation as the base for our delta. Perform temporary allocations in SCRATCH_POOL. @@ -2626,6 +2710,7 @@ write_container_delta_rep(representation_t *rep, svn_fs_t *fs, node_revision_t *noderev, apr_hash_t *reps_hash, + svn_boolean_t allow_rep_sharing, apr_uint32_t item_type, apr_pool_t *scratch_pool) { @@ -2635,10 +2720,10 @@ write_container_delta_rep(representation_t *rep, svn_stream_t *file_stream; svn_stream_t *stream; representation_t *base_rep; - representation_t *old_rep; svn_checksum_ctx_t *fnv1a_checksum_ctx; svn_stream_t *source; svn_fs_fs__rep_header_t header = { 0 }; + svn_fs_fs__p2l_entry_t entry; apr_off_t rep_end = 0; apr_off_t delta_start = 0; @@ -2701,47 +2786,48 @@ write_container_delta_rep(representation_t *rep, /* Store the results. */ SVN_ERR(digests_final(rep, whb->md5_ctx, whb->sha1_ctx, scratch_pool)); + /* Update size info. */ + SVN_ERR(svn_fs_fs__get_file_offset(&rep_end, file, scratch_pool)); + rep->size = rep_end - delta_start; + rep->expanded_size = whb->size; + /* Check and see if we already have a representation somewhere that's identical to the one we just wrote out. */ - SVN_ERR(get_shared_rep(&old_rep, fs, rep, reps_hash, scratch_pool, - scratch_pool)); - - if (old_rep) + if (allow_rep_sharing) { - /* We need to erase from the protorev the data we just wrote. */ - SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + representation_t *old_rep; + SVN_ERR(get_shared_rep(&old_rep, fs, rep, file, offset, reps_hash, + scratch_pool, scratch_pool)); - /* Use the old rep for this content. */ - memcpy(rep, old_rep, sizeof (*rep)); + if (old_rep) + { + /* We need to erase from the protorev the data we just wrote. */ + SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + + /* Use the old rep for this content. */ + memcpy(rep, old_rep, sizeof (*rep)); + return SVN_NO_ERROR; + } } - else - { - svn_fs_fs__p2l_entry_t entry; - /* Write out our cosmetic end marker. */ - SVN_ERR(svn_fs_fs__get_file_offset(&rep_end, file, scratch_pool)); - SVN_ERR(svn_stream_puts(file_stream, "ENDREP\n")); + /* Write out our cosmetic end marker. */ + SVN_ERR(svn_stream_puts(file_stream, "ENDREP\n")); - SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, - offset, scratch_pool)); + SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, + offset, scratch_pool)); - entry.offset = offset; - SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); - entry.size = offset - entry.offset; - entry.type = item_type; - entry.item.revision = SVN_INVALID_REVNUM; - entry.item.number = rep->item_index; - SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, - fnv1a_checksum_ctx, - scratch_pool)); + entry.offset = offset; + SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); + entry.size = offset - entry.offset; + entry.type = item_type; + entry.item.revision = SVN_INVALID_REVNUM; + entry.item.number = rep->item_index; + SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, + fnv1a_checksum_ctx, + scratch_pool)); - SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); + SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); - /* update the representation */ - rep->expanded_size = whb->size; - rep->size = rep_end - delta_start; - } - return SVN_NO_ERROR; } @@ -2920,13 +3006,14 @@ write_final_rev(const svn_fs_id_t **new_id_p, SVN_ERR(write_container_delta_rep(noderev->data_rep, file, entries, write_directory_to_stream, - fs, noderev, NULL, + fs, noderev, NULL, FALSE, SVN_FS_FS__ITEM_TYPE_DIR_REP, pool)); else SVN_ERR(write_container_rep(noderev->data_rep, file, entries, write_directory_to_stream, fs, NULL, - SVN_FS_FS__ITEM_TYPE_DIR_REP, pool)); + FALSE, SVN_FS_FS__ITEM_TYPE_DIR_REP, + pool)); reset_txn_in_rep(noderev->data_rep); } @@ -2971,11 +3058,11 @@ write_final_rev(const svn_fs_id_t **new_id_p, if (ffd->deltify_properties) SVN_ERR(write_container_delta_rep(noderev->prop_rep, file, proplist, write_hash_to_stream, fs, noderev, - reps_hash, item_type, pool)); + reps_hash, TRUE, item_type, pool)); else SVN_ERR(write_container_rep(noderev->prop_rep, file, proplist, write_hash_to_stream, fs, reps_hash, - item_type, pool)); + TRUE, item_type, pool)); reset_txn_in_rep(noderev->prop_rep); } Modified: vendor/subversion/dist/subversion/libsvn_fs_x/rep-cache-db.h ============================================================================== --- vendor/subversion/dist/subversion/libsvn_fs_x/rep-cache-db.h Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/subversion/libsvn_fs_x/rep-cache-db.h Thu Aug 10 21:48:34 2017 (r322377) @@ -1,4 +1,4 @@ -/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.5/subversion/libsvn_fs_x/token-map.h. +/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.7/subversion/libsvn_fs_x/token-map.h. * Do not edit this file -- edit the source and rerun gen-make.py */ #define STMT_CREATE_SCHEMA 0 Modified: vendor/subversion/dist/subversion/libsvn_ra_svn/client.c ============================================================================== --- vendor/subversion/dist/subversion/libsvn_ra_svn/client.c Thu Aug 10 21:39:22 2017 (r322376) +++ vendor/subversion/dist/subversion/libsvn_ra_svn/client.c Thu Aug 10 21:48:34 2017 (r322377) @@ -46,6 +46,7 @@ #include "svn_props.h" #include "svn_mergeinfo.h" #include "svn_version.h" +#include "svn_ctype.h" #include "svn_private_config.h" @@ -396,7 +397,7 @@ static svn_error_t *find_tunnel_agent(const char *tunn * versions have it too. If the user is using some other ssh * implementation that doesn't accept it, they can override it * in the [tunnels] section of the config. */ - val = "$SVN_SSH ssh -q"; + val = "$SVN_SSH ssh -q --"; } if (!val || !*val) @@ -441,7 +442,7 @@ static svn_error_t *find_tunnel_agent(const char *tunn for (n = 0; cmd_argv[n] != NULL; n++) argv[n] = cmd_argv[n]; - argv[n++] = svn_path_uri_decode(hostinfo, pool); + argv[n++] = hostinfo; argv[n++] = "svnserve"; argv[n++] = "-t"; argv[n] = NULL; @@ -802,7 +803,33 @@ ra_svn_get_schemes(apr_pool_t *pool) } +/* A simple whitelist to ensure the following are valid: + * user@server + * [::1]:22 + * server-name + * server_name + * 127.0.0.1 + * with an extra restriction that a leading '-' is invalid. + */ +static svn_boolean_t +is_valid_hostinfo(const char *hostinfo) +{ + const char *p = hostinfo; + if (p[0] == '-') + return FALSE; + + while (*p) + { + if (!svn_ctype_isalnum(*p) && !strchr(":.-_[]@", *p)) + return FALSE; + + ++p; + } + + return TRUE; +} + static svn_error_t *ra_svn_open(svn_ra_session_t *session, const char **corrected_url, const char *url, @@ -835,8 +862,18 @@ static svn_error_t *ra_svn_open(svn_ra_session_t *sess || (callbacks->check_tunnel_func && callbacks->open_tunnel_func && !callbacks->check_tunnel_func(callbacks->tunnel_baton, tunnel)))) - SVN_ERR(find_tunnel_agent(tunnel, uri.hostinfo, &tunnel_argv, config, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Aug 10 22:03:29 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2C67DDDF19; Thu, 10 Aug 2017 22:03:29 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 4764E732F6; Thu, 10 Aug 2017 22:03:29 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AM3SGf022074; Thu, 10 Aug 2017 22:03:28 GMT (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AM3QJ7022058; Thu, 10 Aug 2017 22:03:26 GMT (envelope-from peter@FreeBSD.org) Message-Id: <201708102203.v7AM3QJ7022058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peter set sender to peter@FreeBSD.org using -f From: Peter Wemm Date: Thu, 10 Aug 2017 22:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322380 - in head/contrib/subversion: . subversion/include subversion/libsvn_client subversion/libsvn_fs_fs subversion/libsvn_fs_x subversion/libsvn_ra_svn subversion/libsvn_repos subve... X-SVN-Group: head X-SVN-Commit-Author: peter X-SVN-Commit-Paths: in head/contrib/subversion: . subversion/include subversion/libsvn_client subversion/libsvn_fs_fs subversion/libsvn_fs_x subversion/libsvn_ra_svn subversion/libsvn_repos subversion/libsvn_subr subvers... X-SVN-Commit-Revision: 322380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 22:03:29 -0000 Author: peter Date: Thu Aug 10 22:03:26 2017 New Revision: 322380 URL: https://svnweb.freebsd.org/changeset/base/322380 Log: Update subversion 1.9.5 -> 1.9.7 This includes a client-side fix for CVE-2017-9800. Modified: head/contrib/subversion/CHANGES head/contrib/subversion/NOTICE head/contrib/subversion/build-outputs.mk head/contrib/subversion/configure head/contrib/subversion/subversion/include/svn_version.h head/contrib/subversion/subversion/libsvn_client/copy.c head/contrib/subversion/subversion/libsvn_client/merge.c head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.h head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c head/contrib/subversion/subversion/libsvn_fs_fs/transaction.c head/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h head/contrib/subversion/subversion/libsvn_ra_svn/client.c head/contrib/subversion/subversion/libsvn_repos/dump.c head/contrib/subversion/subversion/libsvn_subr/config_file.c head/contrib/subversion/subversion/libsvn_subr/internal_statements.h head/contrib/subversion/subversion/libsvn_subr/io.c head/contrib/subversion/subversion/libsvn_subr/version.c head/contrib/subversion/subversion/libsvn_wc/wc-checks.h head/contrib/subversion/subversion/libsvn_wc/wc-metadata.h head/contrib/subversion/subversion/libsvn_wc/wc-queries.h head/contrib/subversion/subversion/svnadmin/svnadmin.c head/contrib/subversion/win-tests.py Directory Properties: head/contrib/subversion/ (props changed) Modified: head/contrib/subversion/CHANGES ============================================================================== --- head/contrib/subversion/CHANGES Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/CHANGES Thu Aug 10 22:03:26 2017 (r322380) @@ -1,3 +1,63 @@ +Version 1.9.7 +(10 Aug 2017, from /branches/1.9.x) +http://svn.apache.org/repos/asf/subversion/tags/1.9.7 + + User-visible changes: + - Client-side bugfixes: + * Fix arbitrary code execution vulnerability CVE-2017-9800 + See + for details. + + - Server-side bugfixes: + (none) + + - Bindings bugfixes: + (none) + + Developer-visible changes: + - General: + (none) + + - API changes: + (none) + + +Version 1.9.6 +(5 Jul 2017, from /branches/1.9.x) +http://svn.apache.org/repos/asf/subversion/tags/1.9.6 + + User-visible changes: + - Client-side bugfixes: + * cp/mv: improve error message when target is an unversioned dir (r1779948) + * merge: reduce memory usage with large amounts of mergeinfo (issue #4667) + + - Server-side bugfixes: + * 'svnadmin freeze': document the purpose more clearly (r1774109) + * dump: fix segfault when a revision has no revprops (r1781507) + * fsfs: improve error message upon failure to open rep-cache (r1781655) + * fsfs: never attempt to share directory representations (r1785053) + * fsfs: make consistency independent of hash algorithms (r1785737 et al) + This change makes Subversion resilient to collision attacks, including + SHA-1 collision attacks such as . See also our + documentation at and + . + + - Client-side and server-side bugfixes: + * work around an APR bug related to file truncation (r1759116) + + - Bindings bugfixes: + * javahl: follow redirects when opening a connection (r1667738, r1796720) + + Developer-visible changes: + - General: + * win_tests.py: make the --bin option work, rather than abort (r1706432) + (regression introduced in 1.9.2) + * windows: support building with 'zlibstat.lib' in install-layout (r1783704) + + - API changes: + (none) + + Version 1.9.5 (29 Nov 2016, from /branches/1.9.x) http://svn.apache.org/repos/asf/subversion/tags/1.9.5 @@ -19,7 +79,7 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.5 * fsfs: fix "offset too large" error during pack (issue #4657) * svnserve: enable hook script environments (r1769152) * fsfs: fix possible data reconstruction error (issue #4658) - * fix source of spurious 'incoming edit' tree conflicts (r1770108) + * fix source of spurious 'incoming edit' tree conflicts (r1760570) * fsfs: improve caching for large directories (r1721285) * fsfs: fix crash when encountering all-zero checksums (r1759686) * fsfs: fix potential source of repository corruptions (r1756266) @@ -34,19 +94,19 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.5 - Bindings bugfixes: * swig-pl: do not corrupt "{DATE}" revision variable (r1767768) - * javahl: fix temporary accepting SSL server certificates (r1764851) + * javahl: fix temporarily accepting SSL server certificates (r1764851) * swig-pl: fix possible stack corruption (r1683266, r1683267) Developer-visible changes: - General: * add zlib discovery through pkg-config (issue #4655) * fix potential build issue with invalid SVN_LOCALE_DIR (issue #4653) - * ruby: fix test failures with ruby >= 2.2 (r1766621) - * fix link error with --disable-keychain on OS X (r1765385) + * ruby: fix test failures with ruby >= 2.2 (r1766240) + * fix link error with --disable-keychain on OS X (r1761755) * swig: enable building with SWIG >= 3.0.6 (r1721488 et al) * swig: fix building with -Wdate-time in $CPPFLAGS (r1722164) * update serf download URI in build scripts (r1700130 et al) - * raise minimal httpd version from 2.0 to 2.2 (r1754193) + * raise minimal httpd version from 2.0 to 2.2 (r1754190) Version 1.9.4 @@ -105,7 +165,6 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.3 * svn: report lock/unlock errors as failures (r1701598 et al) * svn: cleanup user deleted external registrations (r1705843, r1710558) * svn: allow simple resolving of binary file text conflicts (r1703581) - * svnlook: properly remove tempfiles on diff errors (r1711346) * ra_serf: report built- and run-time versions of libserf (r1704847) * ra_serf: set Content-Type header in outgoing requests (r1715224 et al) * svn: fix merging deletes of svn:eol-style CRLF/CR files (r1703689 et al) @@ -118,6 +177,7 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.3 * mod_dav_svn: use LimitXMLRequestBody for skel-encoded requests (r1687812) * svnadmin dump: preserve no-op changes (r1709388 et al, issue #4598) * fsfs: avoid unneeded I/O when opening transactions (r1715793) + * svnlook: properly remove tempfiles on diff errors (r1711346) - Client-side and server-side bugfixes: * fix heap overflow in svn:// protocol parser (CVE-2015-5259) @@ -942,18 +1002,18 @@ http://svn.apache.org/repos/asf/subversion/tags/1.8.17 - Client-side bugfixes: * fix handling of newly secured subdirectories in working copy (r1724448) * ra_serf: fix deleting directories with many files (issue #4557) - * svnlook: properly remove tempfiles on diff errors (r1711346) * gpg-agent: properly handle passwords with percent characters (issue #4611) * merge: fix crash when merging to a local add (r1702299 et al) - Server-side bugfixes: * fsfs: fix possible data reconstruction error (issue #4658) + * svnlook: properly remove tempfiles on diff errors (r1711346) - Client-side and server-side bugfixes: * fix potential memory access bugs (r1722860 et al) - Bindings bugfixes: - * javahl: fix temporary accepting SSL server certificates (r1764851) + * javahl: fix temporarily accepting SSL server certificates (r1764851) * swig-pl: do not corrupt "{DATE}" revision variable (r1767768) * swig-pl: fix possible stack corruption (r1683266) Modified: head/contrib/subversion/NOTICE ============================================================================== --- head/contrib/subversion/NOTICE Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/NOTICE Thu Aug 10 22:03:26 2017 (r322380) @@ -1,5 +1,5 @@ Apache Subversion -Copyright 2016 The Apache Software Foundation +Copyright 2017 The Apache Software Foundation This product includes software developed by many people, and distributed under Contributor License Agreements to The Apache Software Foundation Modified: head/contrib/subversion/build-outputs.mk ============================================================================== --- head/contrib/subversion/build-outputs.mk Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/build-outputs.mk Thu Aug 10 22:03:26 2017 (r322380) @@ -2782,7 +2782,7 @@ subversion/libsvn_ra_serf/util_error.lo: subversion/li subversion/libsvn_ra_serf/xml.lo: subversion/libsvn_ra_serf/xml.c subversion/include/private/svn_dav_protocol.h subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_ra_private.h subversion/include/private/svn_string_private.h subversion/include/private/svn_subr_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_dav.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_version.h subversion/include/svn_xml.h subversion/libsvn_ra/ra_loader.h subversion/libsvn_ra_serf/blncache.h subversion/libsvn_ra_serf/ra_se rf.h subversion/svn_private_config.h -subversion/libsvn_ra_svn/client.lo: subversion/libsvn_ra_svn/client.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_fspath.h subversion/include/private/svn_ra_private.h subversion/include/private/svn_ra_svn_private.h subversion/include/private/svn_subr_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_compat.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_props.h subversion/include/svn_ra.h subversion/include/svn_ra_svn.h subversion/include/svn_string.h subversion/include/svn_time.h subversion/include/svn_types.h subversion/include/svn_version.h subversion/libsvn_ra/ra_loader.h sub version/libsvn_ra/wrapper_template.h subversion/libsvn_ra_svn/ra_svn.h subversion/svn_private_config.h +subversion/libsvn_ra_svn/client.lo: subversion/libsvn_ra_svn/client.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_fspath.h subversion/include/private/svn_ra_private.h subversion/include/private/svn_ra_svn_private.h subversion/include/private/svn_subr_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_compat.h subversion/include/svn_config.h subversion/include/svn_ctype.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_props.h subversion/include/svn_ra.h subversion/include/svn_ra_svn.h subversion/include/svn_string.h subversion/include/svn_time.h subversion/include/svn_types.h subversion/include/svn_version.h subve rsion/libsvn_ra/ra_loader.h subversion/libsvn_ra/wrapper_template.h subversion/libsvn_ra_svn/ra_svn.h subversion/svn_private_config.h subversion/libsvn_ra_svn/cram.lo: subversion/libsvn_ra_svn/cram.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_ra_svn_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_ra.h subversion/include/svn_ra_svn.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/libsvn_ra_svn/ra_svn.h subversion/svn_private_config.h Modified: head/contrib/subversion/configure ============================================================================== --- head/contrib/subversion/configure Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/configure Thu Aug 10 22:03:26 2017 (r322380) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for subversion 1.9.5. +# Generated by GNU Autoconf 2.69 for subversion 1.9.7. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='subversion' PACKAGE_TARNAME='subversion' -PACKAGE_VERSION='1.9.5' -PACKAGE_STRING='subversion 1.9.5' +PACKAGE_VERSION='1.9.7' +PACKAGE_STRING='subversion 1.9.7' PACKAGE_BUGREPORT='http://subversion.apache.org/' PACKAGE_URL='' @@ -1471,7 +1471,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures subversion 1.9.5 to adapt to many kinds of systems. +\`configure' configures subversion 1.9.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1537,7 +1537,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of subversion 1.9.5:";; + short | recursive ) echo "Configuration of subversion 1.9.7:";; esac cat <<\_ACEOF @@ -1751,7 +1751,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -subversion configure 1.9.5 +subversion configure 1.9.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2295,7 +2295,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by subversion $as_me 1.9.5, which was +It was created by subversion $as_me 1.9.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2675,8 +2675,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please -{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.9.5" >&5 -$as_echo "$as_me: Configuring Subversion 1.9.5" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.9.7" >&5 +$as_echo "$as_me: Configuring Subversion 1.9.7" >&6;} abs_srcdir="`cd $srcdir && pwd`" @@ -26756,7 +26756,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by subversion $as_me 1.9.5, which was +This file was extended by subversion $as_me 1.9.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -26822,7 +26822,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -subversion config.status 1.9.5 +subversion config.status 1.9.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: head/contrib/subversion/subversion/include/svn_version.h ============================================================================== --- head/contrib/subversion/subversion/include/svn_version.h Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/include/svn_version.h Thu Aug 10 22:03:26 2017 (r322380) @@ -70,7 +70,7 @@ extern "C" { * * @since New in 1.1. */ -#define SVN_VER_PATCH 5 +#define SVN_VER_PATCH 7 /** @deprecated Provided for backward compatibility with the 1.0 API. */ @@ -93,7 +93,7 @@ extern "C" { * * Always change this at the same time as SVN_VER_NUMTAG. */ -#define SVN_VER_TAG " (r1770682)" +#define SVN_VER_TAG " (r1800392)" /** Number tag: a string describing the version. @@ -117,7 +117,7 @@ extern "C" { * file version. Its value remains 0 in the repository except in release * tags where it is the revision from which the tag was created. */ -#define SVN_VER_REVISION 1770682 +#define SVN_VER_REVISION 1800392 /* Version strings composed from the above definitions. */ Modified: head/contrib/subversion/subversion/libsvn_client/copy.c ============================================================================== --- head/contrib/subversion/subversion/libsvn_client/copy.c Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_client/copy.c Thu Aug 10 22:03:26 2017 (r322380) @@ -1057,10 +1057,24 @@ verify_wc_dsts(const apr_array_header_t *copy_pairs, ctx->wc_ctx, pair->dst_parent_abspath, FALSE, TRUE, iterpool)); - if (make_parents && dst_parent_kind == svn_node_none) + if (dst_parent_kind == svn_node_none) { - SVN_ERR(svn_client__make_local_parents(pair->dst_parent_abspath, - TRUE, ctx, iterpool)); + if (make_parents) + SVN_ERR(svn_client__make_local_parents(pair->dst_parent_abspath, + TRUE, ctx, iterpool)); + else + { + SVN_ERR(svn_io_check_path(pair->dst_parent_abspath, + &dst_parent_kind, scratch_pool)); + return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL, + (dst_parent_kind == svn_node_dir) + ? _("Directory '%s' is not under " + "version control") + : _("Path '%s' is not a directory"), + svn_dirent_local_style( + pair->dst_parent_abspath, + scratch_pool)); + } } else if (dst_parent_kind != svn_node_dir) { Modified: head/contrib/subversion/subversion/libsvn_client/merge.c ============================================================================== --- head/contrib/subversion/subversion/libsvn_client/merge.c Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_client/merge.c Thu Aug 10 22:03:26 2017 (r322380) @@ -6465,6 +6465,7 @@ get_mergeinfo_paths(apr_array_header_t *children_with_ { int i; apr_pool_t *iterpool = svn_pool_create(scratch_pool); + apr_pool_t *swmi_pool; apr_hash_t *subtrees_with_mergeinfo; apr_hash_t *excluded_subtrees; apr_hash_t *switched_subtrees; @@ -6473,10 +6474,13 @@ get_mergeinfo_paths(apr_array_header_t *children_with_ struct pre_merge_status_baton_t pre_merge_status_baton; /* Case 1: Subtrees with explicit mergeinfo. */ + /* Use a subpool for subtrees_with_mergeinfo, as it can be very large + and is temporary. */ + swmi_pool = svn_pool_create(scratch_pool); SVN_ERR(get_wc_explicit_mergeinfo_catalog(&subtrees_with_mergeinfo, target->abspath, depth, ctx, - result_pool, scratch_pool)); + swmi_pool, swmi_pool)); if (subtrees_with_mergeinfo) { apr_hash_index_t *hi; @@ -6513,6 +6517,7 @@ get_mergeinfo_paths(apr_array_header_t *children_with_ children_with_mergeinfo->elt_size, compare_merge_path_t_as_paths); } + svn_pool_destroy(swmi_pool); /* Case 2: Switched subtrees Case 10: Paths at depths of 'empty' or 'files' @@ -12331,6 +12336,10 @@ find_last_merged_location(svn_client__pathrev_t **base svn_revnum_t youngest_merged_rev = SVN_INVALID_REVNUM; svn_mergeinfo_catalog_t target_mergeinfo_cat = NULL; + /* Using a local subpool for 'target_mergeinfo_cat' can make a big + reduction in overall memory usage. */ + apr_pool_t *tmic_pool = svn_pool_create(scratch_pool); + source_peg_rev.kind = svn_opt_revision_number; source_peg_rev.value.number = source_branch->tip->rev; source_start_rev.kind = svn_opt_revision_number; @@ -12351,7 +12360,7 @@ find_last_merged_location(svn_client__pathrev_t **base operative_rev_receiver, &youngest_merged_rev, ctx, ra_session, - result_pool, scratch_pool)); + tmic_pool, tmic_pool)); if (!SVN_IS_VALID_REVNUM(youngest_merged_rev)) { @@ -12387,7 +12396,7 @@ find_last_merged_location(svn_client__pathrev_t **base operative_rev_receiver, &oldest_eligible_rev, ctx, ra_session, - scratch_pool, scratch_pool)); + tmic_pool, tmic_pool)); /* If there are revisions eligible for merging, use the oldest one to calculate the base. Otherwise there are no operative revisions @@ -12409,6 +12418,7 @@ find_last_merged_location(svn_client__pathrev_t **base result_pool, scratch_pool)); } + svn_pool_destroy(tmic_pool); return SVN_NO_ERROR; } Modified: head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c ============================================================================== --- head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c Thu Aug 10 22:03:26 2017 (r322380) @@ -2029,8 +2029,13 @@ rep_read_contents(void *baton, SVN_ERR(skip_contents(rb, rb->fulltext_delivered)); } - /* Get the next block of data. */ - SVN_ERR(get_contents_from_windows(rb, buf, len)); + /* Get the next block of data. + * Keep in mind that the representation might be empty and leave us + * already positioned at the end of the rep. */ + if (rb->off == rb->len) + *len = 0; + else + SVN_ERR(get_contents_from_windows(rb, buf, len)); if (rb->current_fulltext) svn_stringbuf_appendbytes(rb->current_fulltext, buf, *len); @@ -2119,6 +2124,96 @@ svn_fs_fs__get_contents(svn_stream_t **contents_p, rep_read_contents); svn_stream_set_close(*contents_p, rep_read_contents_close); } + + return SVN_NO_ERROR; +} + +svn_error_t * +svn_fs_fs__get_contents_from_file(svn_stream_t **contents_p, + svn_fs_t *fs, + representation_t *rep, + apr_file_t *file, + apr_off_t offset, + apr_pool_t *pool) +{ + struct rep_read_baton *rb; + pair_cache_key_t fulltext_cache_key = { SVN_INVALID_REVNUM, 0 }; + rep_state_t *rs = apr_pcalloc(pool, sizeof(*rs)); + svn_fs_fs__rep_header_t *rh; + + /* Initialize the reader baton. Some members may added lazily + * while reading from the stream. */ + SVN_ERR(rep_read_get_baton(&rb, fs, rep, fulltext_cache_key, pool)); + + /* Continue constructing RS. Leave caches as NULL. */ + rs->size = rep->size; + rs->revision = SVN_INVALID_REVNUM; + rs->item_index = 0; + rs->ver = -1; + rs->start = -1; + + /* Provide just enough file access info to allow for a basic read from + * FILE but leave all index / footer info with empty values b/c FILE + * probably is not a complete revision file. */ + rs->sfile = apr_pcalloc(pool, sizeof(*rs->sfile)); + rs->sfile->revision = rep->revision; + rs->sfile->pool = pool; + rs->sfile->fs = fs; + rs->sfile->rfile = apr_pcalloc(pool, sizeof(*rs->sfile->rfile)); + rs->sfile->rfile->start_revision = SVN_INVALID_REVNUM; + rs->sfile->rfile->file = file; + rs->sfile->rfile->stream = svn_stream_from_aprfile2(file, TRUE, pool); + + /* Read the rep header. */ + SVN_ERR(aligned_seek(fs, file, NULL, offset, pool)); + SVN_ERR(svn_fs_fs__read_rep_header(&rh, rs->sfile->rfile->stream, + pool, pool)); + SVN_ERR(get_file_offset(&rs->start, rs, pool)); + rs->header_size = rh->header_size; + + /* Log the access. */ + SVN_ERR(dbg_log_access(fs, SVN_INVALID_REVNUM, 0, rh, + SVN_FS_FS__ITEM_TYPE_ANY_REP, pool)); + + /* Build the representation list (delta chain). */ + if (rh->type == svn_fs_fs__rep_plain) + { + rb->rs_list = apr_array_make(pool, 0, sizeof(rep_state_t *)); + rb->src_state = rs; + } + else if (rh->type == svn_fs_fs__rep_self_delta) + { + rb->rs_list = apr_array_make(pool, 1, sizeof(rep_state_t *)); + APR_ARRAY_PUSH(rb->rs_list, rep_state_t *) = rs; + rb->src_state = NULL; + } + else + { + representation_t next_rep = { 0 }; + + /* skip "SVNx" diff marker */ + rs->current = 4; + + /* REP's base rep is inside a proper revision. + * It can be reconstructed in the usual way. */ + next_rep.revision = rh->base_revision; + next_rep.item_index = rh->base_item_index; + next_rep.size = rh->base_length; + svn_fs_fs__id_txn_reset(&next_rep.txn_id); + + SVN_ERR(build_rep_list(&rb->rs_list, &rb->base_window, + &rb->src_state, &rb->len, rb->fs, &next_rep, + rb->filehandle_pool)); + + /* Insert the access to REP as the first element of the delta chain. */ + svn_sort__array_insert(rb->rs_list, &rs, 0); + } + + /* Now, the baton is complete and we can assemble the stream around it. */ + *contents_p = svn_stream_create(rb, pool); + svn_stream_set_read2(*contents_p, NULL /* only full read support */, + rep_read_contents); + svn_stream_set_close(*contents_p, rep_read_contents_close); return SVN_NO_ERROR; } Modified: head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.h ============================================================================== --- head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.h Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_fs_fs/cached_data.h Thu Aug 10 22:03:26 2017 (r322380) @@ -81,6 +81,18 @@ svn_fs_fs__get_contents(svn_stream_t **contents_p, svn_boolean_t cache_fulltext, apr_pool_t *pool); +/* Set *CONTENTS_P to be a readable svn_stream_t that receives the text + representation REP as seen in filesystem FS. Read the latest element + of the delta chain from FILE at offset OFFSET. + Use POOL for allocations. */ +svn_error_t * +svn_fs_fs__get_contents_from_file(svn_stream_t **contents_p, + svn_fs_t *fs, + representation_t *rep, + apr_file_t *file, + apr_off_t offset, + apr_pool_t *pool); + /* Attempt to fetch the text representation of node-revision NODEREV as seen in filesystem FS and pass it along with the BATON to the PROCESSOR. Set *SUCCESS only of the data could be provided and the processing Modified: head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h ============================================================================== --- head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h Thu Aug 10 22:03:26 2017 (r322380) @@ -1,4 +1,4 @@ -/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.5/subversion/libsvn_fs_fs/token-map.h. +/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.7/subversion/libsvn_fs_fs/token-map.h. * Do not edit this file -- edit the source and rerun gen-make.py */ #define STMT_CREATE_SCHEMA 0 Modified: head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c ============================================================================== --- head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c Thu Aug 10 22:03:26 2017 (r322380) @@ -128,7 +128,10 @@ svn_fs_fs__open_rep_cache(svn_fs_t *fs, fs_fs_data_t *ffd = fs->fsap_data; svn_error_t *err = svn_atomic__init_once(&ffd->rep_cache_db_opened, open_rep_cache, fs, pool); - return svn_error_quick_wrap(err, _("Couldn't open rep-cache database")); + return svn_error_quick_wrapf(err, + _("Couldn't open rep-cache database '%s'"), + svn_dirent_local_style( + path_rep_cache_db(fs->path, pool), pool)); } svn_error_t * Modified: head/contrib/subversion/subversion/libsvn_fs_fs/transaction.c ============================================================================== --- head/contrib/subversion/subversion/libsvn_fs_fs/transaction.c Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_fs_fs/transaction.c Thu Aug 10 22:03:26 2017 (r322380) @@ -2128,6 +2128,11 @@ rep_write_get_baton(struct rep_write_baton **wb_p, there may be new duplicate representations within the same uncommitted revision, those can be passed in REPS_HASH (maps a sha1 digest onto representation_t*), otherwise pass in NULL for REPS_HASH. + + The content of both representations will be compared, taking REP's content + from FILE at OFFSET. Only if they actually match, will *OLD_REP not be + NULL. + Use RESULT_POOL for *OLD_REP allocations and SCRATCH_POOL for temporaries. The lifetime of *OLD_REP is limited by both, RESULT_POOL and REP lifetime. */ @@ -2135,6 +2140,8 @@ static svn_error_t * get_shared_rep(representation_t **old_rep, svn_fs_t *fs, representation_t *rep, + apr_file_t *file, + apr_off_t offset, apr_hash_t *reps_hash, apr_pool_t *result_pool, apr_pool_t *scratch_pool) @@ -2142,6 +2149,10 @@ get_shared_rep(representation_t **old_rep, svn_error_t *err; fs_fs_data_t *ffd = fs->fsap_data; + svn_checksum_t checksum; + checksum.digest = rep->sha1_digest; + checksum.kind = svn_checksum_sha1; + /* Return NULL, if rep sharing has been disabled. */ *old_rep = NULL; if (!ffd->rep_sharing_allowed) @@ -2158,9 +2169,6 @@ get_shared_rep(representation_t **old_rep, /* If we haven't found anything yet, try harder and consult our DB. */ if (*old_rep == NULL) { - svn_checksum_t checksum; - checksum.digest = rep->sha1_digest; - checksum.kind = svn_checksum_sha1; err = svn_fs_fs__get_rep_reference(old_rep, fs, &checksum, result_pool); /* ### Other error codes that we shouldn't mask out? */ if (err == SVN_NO_ERROR) @@ -2235,6 +2243,72 @@ get_shared_rep(representation_t **old_rep, (*old_rep)->uniquifier = rep->uniquifier; } + /* If we (very likely) found a matching representation, compare the actual + * contents such that we can be sure that no rep-cache.db corruption or + * hash collision produced a false positive. */ + if (*old_rep) + { + apr_off_t old_position; + svn_stream_t *contents; + svn_stream_t *old_contents; + svn_boolean_t same; + + /* The existing representation may itself be part of the current + * transaction. In that case, it may be in different stages of + * the commit finalization process. + * + * OLD_REP_NORM is the same as that OLD_REP but it is assigned + * explicitly to REP's transaction if OLD_REP does not point + * to an already committed revision. This then prevents the + * revision lookup and the txn data will be accessed. + */ + representation_t old_rep_norm = **old_rep; + if ( !SVN_IS_VALID_REVNUM(old_rep_norm.revision) + || old_rep_norm.revision > ffd->youngest_rev_cache) + old_rep_norm.txn_id = rep->txn_id; + + /* Make sure we can later restore FILE's current position. */ + SVN_ERR(svn_fs_fs__get_file_offset(&old_position, file, scratch_pool)); + + /* Compare the two representations. + * Note that the stream comparison might also produce MD5 checksum + * errors or other failures in case of SHA1 collisions. */ + SVN_ERR(svn_fs_fs__get_contents_from_file(&contents, fs, rep, file, + offset, scratch_pool)); + SVN_ERR(svn_fs_fs__get_contents(&old_contents, fs, &old_rep_norm, + FALSE, scratch_pool)); + err = svn_stream_contents_same2(&same, contents, old_contents, + scratch_pool); + + /* A mismatch should be extremely rare. + * If it does happen, reject the commit. */ + if (!same || err) + { + /* SHA1 collision or worse. */ + svn_stringbuf_t *old_rep_str + = svn_fs_fs__unparse_representation(*old_rep, + ffd->format, FALSE, + scratch_pool, + scratch_pool); + svn_stringbuf_t *rep_str + = svn_fs_fs__unparse_representation(rep, + ffd->format, FALSE, + scratch_pool, + scratch_pool); + const char *checksum__str + = svn_checksum_to_cstring_display(&checksum, scratch_pool); + + return svn_error_createf(SVN_ERR_FS_GENERAL, + err, "SHA1 of reps '%s' and '%s' " + "matches (%s) but contents differ", + old_rep_str->data, rep_str->data, + checksum__str); + } + + /* Restore FILE's read / write position. */ + SVN_ERR(svn_io_file_seek(file, APR_SET, &old_position, scratch_pool)); + } + return SVN_NO_ERROR; } @@ -2293,8 +2367,8 @@ rep_write_contents_close(void *baton) /* Check and see if we already have a representation somewhere that's identical to the one we just wrote out. */ - SVN_ERR(get_shared_rep(&old_rep, b->fs, rep, NULL, b->result_pool, - b->scratch_pool)); + SVN_ERR(get_shared_rep(&old_rep, b->fs, rep, b->file, b->rep_offset, NULL, + b->result_pool, b->scratch_pool)); if (old_rep) { @@ -2519,11 +2593,16 @@ write_directory_to_stream(svn_stream_t *stream, /* Write out the COLLECTION as a text representation to file FILE using WRITER. In the process, record position, the total size of the dump and MD5 as well as SHA1 in REP. Add the representation of type ITEM_TYPE to - the indexes if necessary. If rep sharing has been enabled and REPS_HASH - is not NULL, it will be used in addition to the on-disk cache to find - earlier reps with the same content. When such existing reps can be - found, we will truncate the one just written from the file and return - the existing rep. Perform temporary allocations in SCRATCH_POOL. */ + the indexes if necessary. + + If ALLOW_REP_SHARING is FALSE, rep-sharing will not be used, regardless + of any other option and rep-sharing settings. If rep sharing has been + enabled and REPS_HASH is not NULL, it will be used in addition to the + on-disk cache to find earlier reps with the same content. If such + existing reps can be found, we will truncate the one just written from + the file and return the existing rep. + + Perform temporary allocations in SCRATCH_POOL. */ static svn_error_t * write_container_rep(representation_t *rep, apr_file_t *file, @@ -2531,14 +2610,15 @@ write_container_rep(representation_t *rep, collection_writer_t writer, svn_fs_t *fs, apr_hash_t *reps_hash, + svn_boolean_t allow_rep_sharing, apr_uint32_t item_type, apr_pool_t *scratch_pool) { svn_stream_t *stream; struct write_container_baton *whb; svn_checksum_ctx_t *fnv1a_checksum_ctx; - representation_t *old_rep; apr_off_t offset = 0; + svn_fs_fs__p2l_entry_t entry; SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); @@ -2562,58 +2642,62 @@ write_container_rep(representation_t *rep, /* Store the results. */ SVN_ERR(digests_final(rep, whb->md5_ctx, whb->sha1_ctx, scratch_pool)); + /* Update size info. */ + rep->expanded_size = whb->size; + rep->size = whb->size; + /* Check and see if we already have a representation somewhere that's identical to the one we just wrote out. */ - SVN_ERR(get_shared_rep(&old_rep, fs, rep, reps_hash, scratch_pool, - scratch_pool)); - - if (old_rep) + if (allow_rep_sharing) { - /* We need to erase from the protorev the data we just wrote. */ - SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + representation_t *old_rep; + SVN_ERR(get_shared_rep(&old_rep, fs, rep, file, offset, reps_hash, + scratch_pool, scratch_pool)); - /* Use the old rep for this content. */ - memcpy(rep, old_rep, sizeof (*rep)); + if (old_rep) + { + /* We need to erase from the protorev the data we just wrote. */ + SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + + /* Use the old rep for this content. */ + memcpy(rep, old_rep, sizeof (*rep)); + return SVN_NO_ERROR; + } } - else - { - svn_fs_fs__p2l_entry_t entry; - /* Write out our cosmetic end marker. */ - SVN_ERR(svn_stream_puts(whb->stream, "ENDREP\n")); + /* Write out our cosmetic end marker. */ + SVN_ERR(svn_stream_puts(whb->stream, "ENDREP\n")); - SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, - offset, scratch_pool)); + SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, + offset, scratch_pool)); - entry.offset = offset; - SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); - entry.size = offset - entry.offset; - entry.type = item_type; - entry.item.revision = SVN_INVALID_REVNUM; - entry.item.number = rep->item_index; - SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, - fnv1a_checksum_ctx, - scratch_pool)); + entry.offset = offset; + SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); + entry.size = offset - entry.offset; + entry.type = item_type; + entry.item.revision = SVN_INVALID_REVNUM; + entry.item.number = rep->item_index; + SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, + fnv1a_checksum_ctx, + scratch_pool)); - SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); + SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); - /* update the representation */ - rep->size = whb->size; - rep->expanded_size = whb->size; - } - return SVN_NO_ERROR; } /* Write out the COLLECTION pertaining to the NODEREV in FS as a deltified text representation to file FILE using WRITER. In the process, record the total size and the md5 digest in REP and add the representation of type - ITEM_TYPE to the indexes if necessary. If rep sharing has been enabled and - REPS_HASH is not NULL, it will be used in addition to the on-disk cache to - find earlier reps with the same content. When such existing reps can be - found, we will truncate the one just written from the file and return the - existing rep. + ITEM_TYPE to the indexes if necessary. + If ALLOW_REP_SHARING is FALSE, rep-sharing will not be used, regardless + of any other option and rep-sharing settings. If rep sharing has been + enabled and REPS_HASH is not NULL, it will be used in addition to the + on-disk cache to find earlier reps with the same content. If such + existing reps can be found, we will truncate the one just written from + the file and return the existing rep. + If ITEM_TYPE is IS_PROPS equals SVN_FS_FS__ITEM_TYPE_*_PROPS, assume that we want to a props representation as the base for our delta. Perform temporary allocations in SCRATCH_POOL. @@ -2626,6 +2710,7 @@ write_container_delta_rep(representation_t *rep, svn_fs_t *fs, node_revision_t *noderev, apr_hash_t *reps_hash, + svn_boolean_t allow_rep_sharing, apr_uint32_t item_type, apr_pool_t *scratch_pool) { @@ -2635,10 +2720,10 @@ write_container_delta_rep(representation_t *rep, svn_stream_t *file_stream; svn_stream_t *stream; representation_t *base_rep; - representation_t *old_rep; svn_checksum_ctx_t *fnv1a_checksum_ctx; svn_stream_t *source; svn_fs_fs__rep_header_t header = { 0 }; + svn_fs_fs__p2l_entry_t entry; apr_off_t rep_end = 0; apr_off_t delta_start = 0; @@ -2701,47 +2786,48 @@ write_container_delta_rep(representation_t *rep, /* Store the results. */ SVN_ERR(digests_final(rep, whb->md5_ctx, whb->sha1_ctx, scratch_pool)); + /* Update size info. */ + SVN_ERR(svn_fs_fs__get_file_offset(&rep_end, file, scratch_pool)); + rep->size = rep_end - delta_start; + rep->expanded_size = whb->size; + /* Check and see if we already have a representation somewhere that's identical to the one we just wrote out. */ - SVN_ERR(get_shared_rep(&old_rep, fs, rep, reps_hash, scratch_pool, - scratch_pool)); - - if (old_rep) + if (allow_rep_sharing) { - /* We need to erase from the protorev the data we just wrote. */ - SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + representation_t *old_rep; + SVN_ERR(get_shared_rep(&old_rep, fs, rep, file, offset, reps_hash, + scratch_pool, scratch_pool)); - /* Use the old rep for this content. */ - memcpy(rep, old_rep, sizeof (*rep)); + if (old_rep) + { + /* We need to erase from the protorev the data we just wrote. */ + SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + + /* Use the old rep for this content. */ + memcpy(rep, old_rep, sizeof (*rep)); + return SVN_NO_ERROR; + } } - else - { - svn_fs_fs__p2l_entry_t entry; - /* Write out our cosmetic end marker. */ - SVN_ERR(svn_fs_fs__get_file_offset(&rep_end, file, scratch_pool)); - SVN_ERR(svn_stream_puts(file_stream, "ENDREP\n")); + /* Write out our cosmetic end marker. */ + SVN_ERR(svn_stream_puts(file_stream, "ENDREP\n")); - SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, - offset, scratch_pool)); + SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, + offset, scratch_pool)); - entry.offset = offset; - SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); - entry.size = offset - entry.offset; - entry.type = item_type; - entry.item.revision = SVN_INVALID_REVNUM; - entry.item.number = rep->item_index; - SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, - fnv1a_checksum_ctx, - scratch_pool)); + entry.offset = offset; + SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); + entry.size = offset - entry.offset; + entry.type = item_type; + entry.item.revision = SVN_INVALID_REVNUM; + entry.item.number = rep->item_index; + SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, + fnv1a_checksum_ctx, + scratch_pool)); - SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); + SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); - /* update the representation */ - rep->expanded_size = whb->size; - rep->size = rep_end - delta_start; - } - return SVN_NO_ERROR; } @@ -2920,13 +3006,14 @@ write_final_rev(const svn_fs_id_t **new_id_p, SVN_ERR(write_container_delta_rep(noderev->data_rep, file, entries, write_directory_to_stream, - fs, noderev, NULL, + fs, noderev, NULL, FALSE, SVN_FS_FS__ITEM_TYPE_DIR_REP, pool)); else SVN_ERR(write_container_rep(noderev->data_rep, file, entries, write_directory_to_stream, fs, NULL, - SVN_FS_FS__ITEM_TYPE_DIR_REP, pool)); + FALSE, SVN_FS_FS__ITEM_TYPE_DIR_REP, + pool)); reset_txn_in_rep(noderev->data_rep); } @@ -2971,11 +3058,11 @@ write_final_rev(const svn_fs_id_t **new_id_p, if (ffd->deltify_properties) SVN_ERR(write_container_delta_rep(noderev->prop_rep, file, proplist, write_hash_to_stream, fs, noderev, - reps_hash, item_type, pool)); + reps_hash, TRUE, item_type, pool)); else SVN_ERR(write_container_rep(noderev->prop_rep, file, proplist, write_hash_to_stream, fs, reps_hash, - item_type, pool)); + TRUE, item_type, pool)); reset_txn_in_rep(noderev->prop_rep); } Modified: head/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h ============================================================================== --- head/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h Thu Aug 10 22:03:26 2017 (r322380) @@ -1,4 +1,4 @@ -/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.5/subversion/libsvn_fs_x/token-map.h. +/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.7/subversion/libsvn_fs_x/token-map.h. * Do not edit this file -- edit the source and rerun gen-make.py */ #define STMT_CREATE_SCHEMA 0 Modified: head/contrib/subversion/subversion/libsvn_ra_svn/client.c ============================================================================== --- head/contrib/subversion/subversion/libsvn_ra_svn/client.c Thu Aug 10 22:00:08 2017 (r322379) +++ head/contrib/subversion/subversion/libsvn_ra_svn/client.c Thu Aug 10 22:03:26 2017 (r322380) @@ -46,6 +46,7 @@ #include "svn_props.h" #include "svn_mergeinfo.h" #include "svn_version.h" +#include "svn_ctype.h" #include "svn_private_config.h" @@ -396,7 +397,7 @@ static svn_error_t *find_tunnel_agent(const char *tunn * versions have it too. If the user is using some other ssh * implementation that doesn't accept it, they can override it * in the [tunnels] section of the config. */ - val = "$SVN_SSH ssh -q"; + val = "$SVN_SSH ssh -q --"; } if (!val || !*val) @@ -441,7 +442,7 @@ static svn_error_t *find_tunnel_agent(const char *tunn for (n = 0; cmd_argv[n] != NULL; n++) argv[n] = cmd_argv[n]; - argv[n++] = svn_path_uri_decode(hostinfo, pool); + argv[n++] = hostinfo; argv[n++] = "svnserve"; argv[n++] = "-t"; argv[n] = NULL; @@ -802,7 +803,33 @@ ra_svn_get_schemes(apr_pool_t *pool) } +/* A simple whitelist to ensure the following are valid: + * user@server + * [::1]:22 + * server-name + * server_name + * 127.0.0.1 + * with an extra restriction that a leading '-' is invalid. + */ +static svn_boolean_t +is_valid_hostinfo(const char *hostinfo) +{ + const char *p = hostinfo; + if (p[0] == '-') + return FALSE; + + while (*p) + { + if (!svn_ctype_isalnum(*p) && !strchr(":.-_[]@", *p)) + return FALSE; + + ++p; + } + + return TRUE; +} + static svn_error_t *ra_svn_open(svn_ra_session_t *session, const char **corrected_url, const char *url, @@ -835,8 +862,18 @@ static svn_error_t *ra_svn_open(svn_ra_session_t *sess || (callbacks->check_tunnel_func && callbacks->open_tunnel_func && !callbacks->check_tunnel_func(callbacks->tunnel_baton, tunnel)))) - SVN_ERR(find_tunnel_agent(tunnel, uri.hostinfo, &tunnel_argv, config, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Aug 10 22:04:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 467E6DDDFB3; Thu, 10 Aug 2017 22:04:56 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 ED1A67345F; Thu, 10 Aug 2017 22:04:55 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AM4t1Y022172; Thu, 10 Aug 2017 22:04:55 GMT (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AM4tgg022171; Thu, 10 Aug 2017 22:04:55 GMT (envelope-from peter@FreeBSD.org) Message-Id: <201708102204.v7AM4tgg022171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peter set sender to peter@FreeBSD.org using -f From: Peter Wemm Date: Thu, 10 Aug 2017 22:04:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322381 - vendor/subversion/subversion-1.9.7 X-SVN-Group: vendor X-SVN-Commit-Author: peter X-SVN-Commit-Paths: vendor/subversion/subversion-1.9.7 X-SVN-Commit-Revision: 322381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 22:04:56 -0000 Author: peter Date: Thu Aug 10 22:04:54 2017 New Revision: 322381 URL: https://svnweb.freebsd.org/changeset/base/322381 Log: Tag subversion-1.9.7 import. Added: vendor/subversion/subversion-1.9.7/ - copied from r322380, vendor/subversion/dist/ From owner-svn-src-all@freebsd.org Thu Aug 10 22:15:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD40BC0827B; Thu, 10 Aug 2017 22:15:44 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 4383473A03; Thu, 10 Aug 2017 22:15:44 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7AMFhJc026252; Thu, 10 Aug 2017 22:15:43 GMT (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AMFgDw026247; Thu, 10 Aug 2017 22:15:42 GMT (envelope-from peter@FreeBSD.org) Message-Id: <201708102215.v7AMFgDw026247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peter set sender to peter@FreeBSD.org using -f From: Peter Wemm Date: Thu, 10 Aug 2017 22:15:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322382 - in vendor/sqlite3/dist: . tea tea/generic X-SVN-Group: vendor X-SVN-Commit-Author: peter X-SVN-Commit-Paths: in vendor/sqlite3/dist: . tea tea/generic X-SVN-Commit-Revision: 322382 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 22:15:44 -0000 Author: peter Date: Thu Aug 10 22:15:42 2017 New Revision: 322382 URL: https://svnweb.freebsd.org/changeset/base/322382 Log: Import sqlite3-3.20.0 Modified: vendor/sqlite3/dist/Makefile.msc vendor/sqlite3/dist/configure vendor/sqlite3/dist/configure.ac vendor/sqlite3/dist/shell.c vendor/sqlite3/dist/sqlite3.c vendor/sqlite3/dist/sqlite3.h vendor/sqlite3/dist/sqlite3ext.h vendor/sqlite3/dist/tea/configure vendor/sqlite3/dist/tea/configure.ac vendor/sqlite3/dist/tea/generic/tclsqlite3.c Modified: vendor/sqlite3/dist/Makefile.msc ============================================================================== --- vendor/sqlite3/dist/Makefile.msc Thu Aug 10 22:04:54 2017 (r322381) +++ vendor/sqlite3/dist/Makefile.msc Thu Aug 10 22:15:42 2017 (r322382) @@ -21,9 +21,16 @@ TOP = . # Set this non-0 to enable full warnings (-W4, etc) when compiling. # !IFNDEF USE_FULLWARN -USE_FULLWARN = 0 +USE_FULLWARN = 1 !ENDIF +# Set this non-0 to enable treating warnings as errors (-WX, etc) when +# compiling. +# +!IFNDEF USE_FATAL_WARN +USE_FATAL_WARN = 0 +!ENDIF + # Set this non-0 to enable full runtime error checks (-RTC1, etc). This # has no effect if (any) optimizations are enabled. # @@ -31,6 +38,13 @@ USE_FULLWARN = 0 USE_RUNTIME_CHECKS = 0 !ENDIF +# Set this non-0 to create a SQLite amalgamation file that excludes the +# various built-in extensions. +# +!IFNDEF MINIMAL_AMALGAMATION +MINIMAL_AMALGAMATION = 0 +!ENDIF + # Set this non-0 to use "stdcall" calling convention for the core library # and shell executable. # @@ -255,12 +269,15 @@ SQLITE3EXEPDB = /pdb:sqlite3sh.pdb !ENDIF !ENDIF + # These are the "standard" SQLite compilation options used when compiling for # the Windows platform. # !IFNDEF OPT_FEATURE_FLAGS +!IF $(MINIMAL_AMALGAMATION)==0 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1 +!ENDIF OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1 !ENDIF @@ -444,6 +461,12 @@ TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $ TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS) !ENDIF +# Check if warnings should be treated as errors when compiling. +# +!IF $(USE_FATAL_WARN)!=0 +TCC = $(TCC) -WX +!ENDIF + TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS) @@ -622,7 +645,11 @@ RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1 !IF $(DEBUG)>2 TCC = $(TCC) -DSQLITE_DEBUG=1 RCC = $(RCC) -DSQLITE_DEBUG=1 +!IF $(DYNAMIC_SHELL)==0 +TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE +RCC = $(RCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE !ENDIF +!ENDIF !IF $(DEBUG)>4 || $(OSTRACE)!=0 TCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1 @@ -900,7 +927,7 @@ LIBRESOBJS = # when the shell is not being dynamically linked. # !IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0 -SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_STMTVTAB !ENDIF @@ -927,7 +954,7 @@ Replace.exe: sqlite3.def: Replace.exe $(LIBOBJ) echo EXPORTS > sqlite3.def dumpbin /all $(LIBOBJ) \ - | .\Replace.exe "^\s+/EXPORT:_?(sqlite3_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \ + | .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \ | sort >> sqlite3.def $(SQLITE3EXE): $(TOP)\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H) Modified: vendor/sqlite3/dist/configure ============================================================================== --- vendor/sqlite3/dist/configure Thu Aug 10 22:04:54 2017 (r322381) +++ vendor/sqlite3/dist/configure Thu Aug 10 22:15:42 2017 (r322382) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.14.1. +# Generated by GNU Autoconf 2.69 for sqlite 3.20.0. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.14.1' -PACKAGE_STRING='sqlite 3.14.1' +PACKAGE_VERSION='3.20.0' +PACKAGE_STRING='sqlite 3.20.0' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1330,7 +1330,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.14.1 to adapt to many kinds of systems. +\`configure' configures sqlite 3.20.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1400,7 +1400,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.14.1:";; + short | recursive ) echo "Configuration of sqlite 3.20.0:";; esac cat <<\_ACEOF @@ -1521,7 +1521,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.14.1 +sqlite configure 3.20.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1936,7 +1936,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.14.1, which was +It was created by sqlite $as_me 3.20.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2802,7 +2802,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.14.1' + VERSION='3.20.0' cat >>confdefs.h <<_ACEOF @@ -13108,7 +13108,7 @@ for ac_lib in '' edit; do ac_res="none required" else ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" + LIBS="-l$ac_lib -ltinfo $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_readline=$ac_res @@ -13136,7 +13136,7 @@ if test "$ac_res" != no; then : $as_echo "#define HAVE_EDITLINE 1" >>confdefs.h - READLINE_LIBS=$LIBS + READLINE_LIBS="$LIBS -ltinfo" enable_readline=no fi @@ -14227,7 +14227,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.14.1, which was +This file was extended by sqlite $as_me 3.20.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14284,7 +14284,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.14.1 +sqlite config.status 3.20.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: vendor/sqlite3/dist/configure.ac ============================================================================== --- vendor/sqlite3/dist/configure.ac Thu Aug 10 22:04:54 2017 (r322381) +++ vendor/sqlite3/dist/configure.ac Thu Aug 10 22:15:42 2017 (r322382) @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.14.1, http://www.sqlite.org) +AC_INIT(sqlite, 3.20.0, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) # Use automake. @@ -55,9 +55,9 @@ AS_IF([ test x"$enable_editline" != xno ],[ LIBS="" AC_SEARCH_LIBS([readline],[edit],[ AC_DEFINE([HAVE_EDITLINE],1,Define to use BSD editline) - READLINE_LIBS=$LIBS + READLINE_LIBS="$LIBS -ltinfo" enable_readline=no - ]) + ],[],[-ltinfo]) AS_UNSET(ac_cv_search_readline) LIBS=$sLIBS ]) Modified: vendor/sqlite3/dist/shell.c ============================================================================== --- vendor/sqlite3/dist/shell.c Thu Aug 10 22:04:54 2017 (r322381) +++ vendor/sqlite3/dist/shell.c Thu Aug 10 22:15:42 2017 (r322382) @@ -1,3 +1,21 @@ +/* DO NOT EDIT! +** This file is automatically generated by the script in the canonical +** SQLite source tree at tool/mkshellc.tcl. That script combines source +** code from various constituent source files of SQLite into this single +** "shell.c" file used to implement the SQLite command-line shell. +** +** Most of the code found below comes from the "src/shell.c.in" file in +** the canonical SQLite source tree. That main file contains "INCLUDE" +** lines that specify other files in the canonical source tree that are +** inserted to getnerate this complete program source file. +** +** The code from multiple files is combined into this single "shell.c" +** source file to help make the command-line program easier to compile. +** +** To modify this program, get a copy of the canonical SQLite source tree, +** edit the src/shell.c.in" and/or some of the other files that are included +** by "src/shell.c.in", then rerun the tool/mkshellc.tcl script. +*/ /* ** 2001 September 15 ** @@ -18,11 +36,25 @@ #endif /* -** If requested, include the SQLite compiler options file for MSVC. +** Warning pragmas copied from msvc.h in the core. */ -#if defined(INCLUDE_MSVC_H) -#include "msvc.h" -#endif +#if defined(_MSC_VER) +#pragma warning(disable : 4054) +#pragma warning(disable : 4055) +#pragma warning(disable : 4100) +#pragma warning(disable : 4127) +#pragma warning(disable : 4130) +#pragma warning(disable : 4152) +#pragma warning(disable : 4189) +#pragma warning(disable : 4206) +#pragma warning(disable : 4210) +#pragma warning(disable : 4232) +#pragma warning(disable : 4244) +#pragma warning(disable : 4305) +#pragma warning(disable : 4306) +#pragma warning(disable : 4702) +#pragma warning(disable : 4706) +#endif /* defined(_MSC_VER) */ /* ** No support for loadable extensions in VxWorks. @@ -143,6 +175,7 @@ extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR); extern char *sqlite3_win32_mbcs_to_utf8_v2(const char *, int); extern char *sqlite3_win32_utf8_to_mbcs_v2(const char *, int); +extern LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText); #endif /* On Windows, we normally run with output mode of TEXT so that \n characters @@ -426,7 +459,37 @@ static void SQLITE_CDECL iotracePrintf(const char *zFo } #endif +/* +** Output string zUtf to stream pOut as w characters. If w is negative, +** then right-justify the text. W is the width in UTF-8 characters, not +** in bytes. This is different from the %*.*s specification in printf +** since with %*.*s the width is measured in bytes, not characters. +*/ +static void utf8_width_print(FILE *pOut, int w, const char *zUtf){ + int i; + int n; + int aw = w<0 ? -w : w; + char zBuf[1000]; + if( aw>(int)sizeof(zBuf)/3 ) aw = (int)sizeof(zBuf)/3; + for(i=n=0; zUtf[i]; i++){ + if( (zUtf[i]&0xc0)!=0x80 ){ + n++; + if( n==aw ){ + do{ i++; }while( (zUtf[i]&0xc0)==0x80 ); + break; + } + } + } + if( n>=aw ){ + utf8_printf(pOut, "%.*s", i, zUtf); + }else if( w<0 ){ + utf8_printf(pOut, "%*s%s", aw-n, "", zUtf); + }else{ + utf8_printf(pOut, "%s%*s", zUtf, aw-n, ""); + } +} + /* ** Determines if a string is a number of not. */ @@ -455,28 +518,6 @@ static int isNumber(const char *z, int *realnum){ } /* -** A global char* and an SQL function to access its current value -** from within an SQL statement. This program used to use the -** sqlite_exec_printf() API to substitue a string into an SQL statement. -** The correct way to do this with sqlite3 is to use the bind API, but -** since the shell is built around the callback paradigm it would be a lot -** of work. Instead just use this hack, which is quite harmless. -*/ -static const char *zShellStatic = 0; -static void shellstaticFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - assert( 0==argc ); - assert( zShellStatic ); - UNUSED_PARAMETER(argc); - UNUSED_PARAMETER(argv); - sqlite3_result_text(context, zShellStatic, -1, SQLITE_STATIC); -} - - -/* ** Compute a string length that is limited to what can be stored in ** lower 30 bits of a 32-bit signed integer. */ @@ -487,6 +528,18 @@ static int strlen30(const char *z){ } /* +** Return the length of a string in characters. Multibyte UTF8 characters +** count as a single character. +*/ +static int strlenChar(const char *z){ + int n = 0; + while( *z ){ + if( (0xc0&*(z++))!=0x80 ) n++; + } + return n; +} + +/* ** This routine reads a line of text from FILE in, stores ** the text in memory obtained from malloc() and returns a pointer ** to the text. NULL is returned at end of file, or if malloc() @@ -524,7 +577,7 @@ static char *local_getline(char *zLine, FILE *in){ #if defined(_WIN32) || defined(WIN32) /* For interactive input on Windows systems, translate the ** multi-byte characterset characters into UTF-8. */ - if( stdin_is_interactive ){ + if( stdin_is_interactive && in==stdin ){ char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0); if( zTrans ){ int nTrans = strlen30(zTrans)+1; @@ -576,7 +629,1534 @@ static char *one_input_line(FILE *in, char *zPrior, in } return zResult; } +/* +** A variable length string to which one can append text. +*/ +typedef struct ShellText ShellText; +struct ShellText { + char *z; + int n; + int nAlloc; +}; +/* +** Initialize and destroy a ShellText object +*/ +static void initText(ShellText *p){ + memset(p, 0, sizeof(*p)); +} +static void freeText(ShellText *p){ + free(p->z); + initText(p); +} + +/* zIn is either a pointer to a NULL-terminated string in memory obtained +** from malloc(), or a NULL pointer. The string pointed to by zAppend is +** added to zIn, and the result returned in memory obtained from malloc(). +** zIn, if it was not NULL, is freed. +** +** If the third argument, quote, is not '\0', then it is used as a +** quote character for zAppend. +*/ +static void appendText(ShellText *p, char const *zAppend, char quote){ + int len; + int i; + int nAppend = strlen30(zAppend); + + len = nAppend+p->n+1; + if( quote ){ + len += 2; + for(i=0; in+len>=p->nAlloc ){ + p->nAlloc = p->nAlloc*2 + len + 20; + p->z = realloc(p->z, p->nAlloc); + if( p->z==0 ){ + memset(p, 0, sizeof(*p)); + return; + } + } + + if( quote ){ + char *zCsr = p->z+p->n; + *zCsr++ = quote; + for(i=0; in = (int)(zCsr - p->z); + *zCsr = '\0'; + }else{ + memcpy(p->z+p->n, zAppend, nAppend); + p->n += nAppend; + p->z[p->n] = '\0'; + } +} + +/* +** Attempt to determine if identifier zName needs to be quoted, either +** because it contains non-alphanumeric characters, or because it is an +** SQLite keyword. Be conservative in this estimate: When in doubt assume +** that quoting is required. +** +** Return '"' if quoting is required. Return 0 if no quoting is required. +*/ +static char quoteChar(const char *zName){ + /* All SQLite keywords, in alphabetical order */ + static const char *azKeywords[] = { + "ABORT", "ACTION", "ADD", "AFTER", "ALL", "ALTER", "ANALYZE", "AND", "AS", + "ASC", "ATTACH", "AUTOINCREMENT", "BEFORE", "BEGIN", "BETWEEN", "BY", + "CASCADE", "CASE", "CAST", "CHECK", "COLLATE", "COLUMN", "COMMIT", + "CONFLICT", "CONSTRAINT", "CREATE", "CROSS", "CURRENT_DATE", + "CURRENT_TIME", "CURRENT_TIMESTAMP", "DATABASE", "DEFAULT", "DEFERRABLE", + "DEFERRED", "DELETE", "DESC", "DETACH", "DISTINCT", "DROP", "EACH", + "ELSE", "END", "ESCAPE", "EXCEPT", "EXCLUSIVE", "EXISTS", "EXPLAIN", + "FAIL", "FOR", "FOREIGN", "FROM", "FULL", "GLOB", "GROUP", "HAVING", "IF", + "IGNORE", "IMMEDIATE", "IN", "INDEX", "INDEXED", "INITIALLY", "INNER", + "INSERT", "INSTEAD", "INTERSECT", "INTO", "IS", "ISNULL", "JOIN", "KEY", + "LEFT", "LIKE", "LIMIT", "MATCH", "NATURAL", "NO", "NOT", "NOTNULL", + "NULL", "OF", "OFFSET", "ON", "OR", "ORDER", "OUTER", "PLAN", "PRAGMA", + "PRIMARY", "QUERY", "RAISE", "RECURSIVE", "REFERENCES", "REGEXP", + "REINDEX", "RELEASE", "RENAME", "REPLACE", "RESTRICT", "RIGHT", + "ROLLBACK", "ROW", "SAVEPOINT", "SELECT", "SET", "TABLE", "TEMP", + "TEMPORARY", "THEN", "TO", "TRANSACTION", "TRIGGER", "UNION", "UNIQUE", + "UPDATE", "USING", "VACUUM", "VALUES", "VIEW", "VIRTUAL", "WHEN", "WHERE", + "WITH", "WITHOUT", + }; + int i, lwr, upr, mid, c; + if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"'; + for(i=0; zName[i]; i++){ + if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"'; + } + lwr = 0; + upr = sizeof(azKeywords)/sizeof(azKeywords[0]) - 1; + while( lwr<=upr ){ + mid = (lwr+upr)/2; + c = sqlite3_stricmp(azKeywords[mid], zName); + if( c==0 ) return '"'; + if( c<0 ){ + lwr = mid+1; + }else{ + upr = mid-1; + } + } + return 0; +} + +/* +** SQL function: shell_add_schema(S,X) +** +** Add the schema name X to the CREATE statement in S and return the result. +** Examples: +** +** CREATE TABLE t1(x) -> CREATE TABLE xyz.t1(x); +** +** Also works on +** +** CREATE INDEX +** CREATE UNIQUE INDEX +** CREATE VIEW +** CREATE TRIGGER +** CREATE VIRTUAL TABLE +** +** This UDF is used by the .schema command to insert the schema name of +** attached databases into the middle of the sqlite_master.sql field. +*/ +static void shellAddSchemaName( + sqlite3_context *pCtx, + int nVal, + sqlite3_value **apVal +){ + static const char *aPrefix[] = { + "TABLE", + "INDEX", + "UNIQUE INDEX", + "VIEW", + "TRIGGER", + "VIRTUAL TABLE" + }; + int i = 0; + const char *zIn = (const char*)sqlite3_value_text(apVal[0]); + const char *zSchema = (const char*)sqlite3_value_text(apVal[1]); + assert( nVal==2 ); + if( zIn!=0 && strncmp(zIn, "CREATE ", 7)==0 ){ + for(i=0; i<(int)(sizeof(aPrefix)/sizeof(aPrefix[0])); i++){ + int n = strlen30(aPrefix[i]); + if( strncmp(zIn+7, aPrefix[i], n)==0 && zIn[n+7]==' ' ){ + char cQuote = quoteChar(zSchema); + char *z; + if( cQuote ){ + z = sqlite3_mprintf("%.*s \"%w\".%s", n+7, zIn, zSchema, zIn+n+8); + }else{ + z = sqlite3_mprintf("%.*s %s.%s", n+7, zIn, zSchema, zIn+n+8); + } + sqlite3_result_text(pCtx, z, -1, sqlite3_free); + return; + } + } + } + sqlite3_result_value(pCtx, apVal[0]); +} + +/* +** The source code for several run-time loadable extensions is inserted +** below by the ../tool/mkshellc.tcl script. Before processing that included +** code, we need to override some macros to make the included program code +** work here in the middle of this regular program. +*/ +#define SQLITE_EXTENSION_INIT1 +#define SQLITE_EXTENSION_INIT2(X) (void)(X) + +/************************* Begin ../ext/misc/shathree.c ******************/ +/* +** 2017-03-08 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This SQLite extension implements a functions that compute SHA1 hashes. +** Two SQL functions are implemented: +** +** sha3(X,SIZE) +** sha3_query(Y,SIZE) +** +** The sha3(X) function computes the SHA3 hash of the input X, or NULL if +** X is NULL. +** +** The sha3_query(Y) function evalutes all queries in the SQL statements of Y +** and returns a hash of their results. +** +** The SIZE argument is optional. If omitted, the SHA3-256 hash algorithm +** is used. If SIZE is included it must be one of the integers 224, 256, +** 384, or 512, to determine SHA3 hash variant that is computed. +*/ +SQLITE_EXTENSION_INIT1 +#include +#include +#include +typedef sqlite3_uint64 u64; + +/****************************************************************************** +** The Hash Engine +*/ +/* +** Macros to determine whether the machine is big or little endian, +** and whether or not that determination is run-time or compile-time. +** +** For best performance, an attempt is made to guess at the byte-order +** using C-preprocessor macros. If that is unsuccessful, or if +** -DSHA3_BYTEORDER=0 is set, then byte-order is determined +** at run-time. +*/ +#ifndef SHA3_BYTEORDER +# if defined(i386) || defined(__i386__) || defined(_M_IX86) || \ + defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \ + defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \ + defined(__arm__) +# define SHA3_BYTEORDER 1234 +# elif defined(sparc) || defined(__ppc__) +# define SHA3_BYTEORDER 4321 +# else +# define SHA3_BYTEORDER 0 +# endif +#endif + + +/* +** State structure for a SHA3 hash in progress +*/ +typedef struct SHA3Context SHA3Context; +struct SHA3Context { + union { + u64 s[25]; /* Keccak state. 5x5 lines of 64 bits each */ + unsigned char x[1600]; /* ... or 1600 bytes */ + } u; + unsigned nRate; /* Bytes of input accepted per Keccak iteration */ + unsigned nLoaded; /* Input bytes loaded into u.x[] so far this cycle */ + unsigned ixMask; /* Insert next input into u.x[nLoaded^ixMask]. */ +}; + +/* +** A single step of the Keccak mixing function for a 1600-bit state +*/ +static void KeccakF1600Step(SHA3Context *p){ + int i; + u64 B0, B1, B2, B3, B4; + u64 C0, C1, C2, C3, C4; + u64 D0, D1, D2, D3, D4; + static const u64 RC[] = { + 0x0000000000000001ULL, 0x0000000000008082ULL, + 0x800000000000808aULL, 0x8000000080008000ULL, + 0x000000000000808bULL, 0x0000000080000001ULL, + 0x8000000080008081ULL, 0x8000000000008009ULL, + 0x000000000000008aULL, 0x0000000000000088ULL, + 0x0000000080008009ULL, 0x000000008000000aULL, + 0x000000008000808bULL, 0x800000000000008bULL, + 0x8000000000008089ULL, 0x8000000000008003ULL, + 0x8000000000008002ULL, 0x8000000000000080ULL, + 0x000000000000800aULL, 0x800000008000000aULL, + 0x8000000080008081ULL, 0x8000000000008080ULL, + 0x0000000080000001ULL, 0x8000000080008008ULL + }; +# define A00 (p->u.s[0]) +# define A01 (p->u.s[1]) +# define A02 (p->u.s[2]) +# define A03 (p->u.s[3]) +# define A04 (p->u.s[4]) +# define A10 (p->u.s[5]) +# define A11 (p->u.s[6]) +# define A12 (p->u.s[7]) +# define A13 (p->u.s[8]) +# define A14 (p->u.s[9]) +# define A20 (p->u.s[10]) +# define A21 (p->u.s[11]) +# define A22 (p->u.s[12]) +# define A23 (p->u.s[13]) +# define A24 (p->u.s[14]) +# define A30 (p->u.s[15]) +# define A31 (p->u.s[16]) +# define A32 (p->u.s[17]) +# define A33 (p->u.s[18]) +# define A34 (p->u.s[19]) +# define A40 (p->u.s[20]) +# define A41 (p->u.s[21]) +# define A42 (p->u.s[22]) +# define A43 (p->u.s[23]) +# define A44 (p->u.s[24]) +# define ROL64(a,x) ((a<>(64-x))) + + for(i=0; i<24; i+=4){ + C0 = A00^A10^A20^A30^A40; + C1 = A01^A11^A21^A31^A41; + C2 = A02^A12^A22^A32^A42; + C3 = A03^A13^A23^A33^A43; + C4 = A04^A14^A24^A34^A44; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A11^D1), 44); + B2 = ROL64((A22^D2), 43); + B3 = ROL64((A33^D3), 21); + B4 = ROL64((A44^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i]; + A11 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A20^D0), 3); + B3 = ROL64((A31^D1), 45); + B4 = ROL64((A42^D2), 61); + B0 = ROL64((A03^D3), 28); + B1 = ROL64((A14^D4), 20); + A20 = B0 ^((~B1)& B2 ); + A31 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A40^D0), 18); + B0 = ROL64((A01^D1), 1); + B1 = ROL64((A12^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A34^D4), 8); + A40 = B0 ^((~B1)& B2 ); + A01 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A10^D0), 36); + B2 = ROL64((A21^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A43^D3), 56); + B0 = ROL64((A04^D4), 27); + A10 = B0 ^((~B1)& B2 ); + A21 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A30^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A02^D2), 62); + B1 = ROL64((A13^D3), 55); + B2 = ROL64((A24^D4), 39); + A30 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + C0 = A00^A20^A40^A10^A30; + C1 = A11^A31^A01^A21^A41; + C2 = A22^A42^A12^A32^A02; + C3 = A33^A03^A23^A43^A13; + C4 = A44^A14^A34^A04^A24; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A31^D1), 44); + B2 = ROL64((A12^D2), 43); + B3 = ROL64((A43^D3), 21); + B4 = ROL64((A24^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i+1]; + A31 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A40^D0), 3); + B3 = ROL64((A21^D1), 45); + B4 = ROL64((A02^D2), 61); + B0 = ROL64((A33^D3), 28); + B1 = ROL64((A14^D4), 20); + A40 = B0 ^((~B1)& B2 ); + A21 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A30^D0), 18); + B0 = ROL64((A11^D1), 1); + B1 = ROL64((A42^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A04^D4), 8); + A30 = B0 ^((~B1)& B2 ); + A11 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A20^D0), 36); + B2 = ROL64((A01^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A13^D3), 56); + B0 = ROL64((A44^D4), 27); + A20 = B0 ^((~B1)& B2 ); + A01 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A10^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A22^D2), 62); + B1 = ROL64((A03^D3), 55); + B2 = ROL64((A34^D4), 39); + A10 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + C0 = A00^A40^A30^A20^A10; + C1 = A31^A21^A11^A01^A41; + C2 = A12^A02^A42^A32^A22; + C3 = A43^A33^A23^A13^A03; + C4 = A24^A14^A04^A44^A34; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A21^D1), 44); + B2 = ROL64((A42^D2), 43); + B3 = ROL64((A13^D3), 21); + B4 = ROL64((A34^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i+2]; + A21 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A30^D0), 3); + B3 = ROL64((A01^D1), 45); + B4 = ROL64((A22^D2), 61); + B0 = ROL64((A43^D3), 28); + B1 = ROL64((A14^D4), 20); + A30 = B0 ^((~B1)& B2 ); + A01 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A10^D0), 18); + B0 = ROL64((A31^D1), 1); + B1 = ROL64((A02^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A44^D4), 8); + A10 = B0 ^((~B1)& B2 ); + A31 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A40^D0), 36); + B2 = ROL64((A11^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A03^D3), 56); + B0 = ROL64((A24^D4), 27); + A40 = B0 ^((~B1)& B2 ); + A11 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A20^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A12^D2), 62); + B1 = ROL64((A33^D3), 55); + B2 = ROL64((A04^D4), 39); + A20 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + C0 = A00^A30^A10^A40^A20; + C1 = A21^A01^A31^A11^A41; + C2 = A42^A22^A02^A32^A12; + C3 = A13^A43^A23^A03^A33; + C4 = A34^A14^A44^A24^A04; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A01^D1), 44); + B2 = ROL64((A02^D2), 43); + B3 = ROL64((A03^D3), 21); + B4 = ROL64((A04^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i+3]; + A01 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A10^D0), 3); + B3 = ROL64((A11^D1), 45); + B4 = ROL64((A12^D2), 61); + B0 = ROL64((A13^D3), 28); + B1 = ROL64((A14^D4), 20); + A10 = B0 ^((~B1)& B2 ); + A11 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A20^D0), 18); + B0 = ROL64((A21^D1), 1); + B1 = ROL64((A22^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A24^D4), 8); + A20 = B0 ^((~B1)& B2 ); + A21 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A30^D0), 36); + B2 = ROL64((A31^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A33^D3), 56); + B0 = ROL64((A34^D4), 27); + A30 = B0 ^((~B1)& B2 ); + A31 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A40^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A42^D2), 62); + B1 = ROL64((A43^D3), 55); + B2 = ROL64((A44^D4), 39); + A40 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + } +} + +/* +** Initialize a new hash. iSize determines the size of the hash +** in bits and should be one of 224, 256, 384, or 512. Or iSize +** can be zero to use the default hash size of 256 bits. +*/ +static void SHA3Init(SHA3Context *p, int iSize){ + memset(p, 0, sizeof(*p)); + if( iSize>=128 && iSize<=512 ){ + p->nRate = (1600 - ((iSize + 31)&~31)*2)/8; + }else{ + p->nRate = (1600 - 2*256)/8; + } +#if SHA3_BYTEORDER==1234 + /* Known to be little-endian at compile-time. No-op */ +#elif SHA3_BYTEORDER==4321 + p->ixMask = 7; /* Big-endian */ +#else + { + static unsigned int one = 1; + if( 1==*(unsigned char*)&one ){ + /* Little endian. No byte swapping. */ + p->ixMask = 0; + }else{ + /* Big endian. Byte swap. */ + p->ixMask = 7; + } + } +#endif +} + +/* +** Make consecutive calls to the SHA3Update function to add new content +** to the hash +*/ +static void SHA3Update( + SHA3Context *p, + const unsigned char *aData, + unsigned int nData +){ + unsigned int i = 0; +#if SHA3_BYTEORDER==1234 + if( (p->nLoaded % 8)==0 && ((aData - (const unsigned char*)0)&7)==0 ){ + for(; i+7u.s[p->nLoaded/8] ^= *(u64*)&aData[i]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Aug 10 22:43:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6B44C0886F; Thu, 10 Aug 2017 22:43: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 mx1.freebsd.org (Postfix) with ESMTPS id B5FE0744B9; Thu, 10 Aug 2017 22:43: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 v7AMhcYJ038266; Thu, 10 Aug 2017 22:43:38 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7AMhcoN038265; Thu, 10 Aug 2017 22:43:38 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708102243.v7AMhcoN038265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 10 Aug 2017 22:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322383 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 322383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 10 Aug 2017 22:43:40 -0000 Author: markj Date: Thu Aug 10 22:43:38 2017 New Revision: 322383 URL: https://svnweb.freebsd.org/changeset/base/322383 Log: Make vm_page_sunbusy() assert that the page is unlocked. Reviewed by: kib MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11946 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Aug 10 22:15:42 2017 (r322382) +++ head/sys/vm/vm_page.c Thu Aug 10 22:43:38 2017 (r322383) @@ -757,6 +757,7 @@ vm_page_sunbusy(vm_page_t m) { u_int x; + vm_page_lock_assert(m, MA_NOTOWNED); vm_page_assert_sbusied(m); for (;;) { From owner-svn-src-all@freebsd.org Fri Aug 11 00:00:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D60E7C7A980; Fri, 11 Aug 2017 00:00:02 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 9007B76ADD; Fri, 11 Aug 2017 00:00:02 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7B001ia067107; Fri, 11 Aug 2017 00:00:01 GMT (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7B001kI067102; Fri, 11 Aug 2017 00:00:01 GMT (envelope-from peter@FreeBSD.org) Message-Id: <201708110000.v7B001kI067102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peter set sender to peter@FreeBSD.org using -f From: Peter Wemm Date: Fri, 11 Aug 2017 00:00:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322386 - in head/contrib/sqlite3: . tea tea/generic X-SVN-Group: head X-SVN-Commit-Author: peter X-SVN-Commit-Paths: in head/contrib/sqlite3: . tea tea/generic X-SVN-Commit-Revision: 322386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 00:00:03 -0000 Author: peter Date: Fri Aug 11 00:00:01 2017 New Revision: 322386 URL: https://svnweb.freebsd.org/changeset/base/322386 Log: Update from sqlite3-3.14.1 to sqlite3-3.20.0. This is a private lib. This fixes a possible client-side crash when parsing corrupt databases. Modified: head/contrib/sqlite3/Makefile.msc head/contrib/sqlite3/configure head/contrib/sqlite3/configure.ac head/contrib/sqlite3/shell.c head/contrib/sqlite3/sqlite3.c head/contrib/sqlite3/sqlite3.h head/contrib/sqlite3/sqlite3ext.h head/contrib/sqlite3/tea/configure head/contrib/sqlite3/tea/configure.ac head/contrib/sqlite3/tea/generic/tclsqlite3.c Directory Properties: head/contrib/sqlite3/ (props changed) Modified: head/contrib/sqlite3/Makefile.msc ============================================================================== --- head/contrib/sqlite3/Makefile.msc Thu Aug 10 23:45:32 2017 (r322385) +++ head/contrib/sqlite3/Makefile.msc Fri Aug 11 00:00:01 2017 (r322386) @@ -21,9 +21,16 @@ TOP = . # Set this non-0 to enable full warnings (-W4, etc) when compiling. # !IFNDEF USE_FULLWARN -USE_FULLWARN = 0 +USE_FULLWARN = 1 !ENDIF +# Set this non-0 to enable treating warnings as errors (-WX, etc) when +# compiling. +# +!IFNDEF USE_FATAL_WARN +USE_FATAL_WARN = 0 +!ENDIF + # Set this non-0 to enable full runtime error checks (-RTC1, etc). This # has no effect if (any) optimizations are enabled. # @@ -31,6 +38,13 @@ USE_FULLWARN = 0 USE_RUNTIME_CHECKS = 0 !ENDIF +# Set this non-0 to create a SQLite amalgamation file that excludes the +# various built-in extensions. +# +!IFNDEF MINIMAL_AMALGAMATION +MINIMAL_AMALGAMATION = 0 +!ENDIF + # Set this non-0 to use "stdcall" calling convention for the core library # and shell executable. # @@ -255,12 +269,15 @@ SQLITE3EXEPDB = /pdb:sqlite3sh.pdb !ENDIF !ENDIF + # These are the "standard" SQLite compilation options used when compiling for # the Windows platform. # !IFNDEF OPT_FEATURE_FLAGS +!IF $(MINIMAL_AMALGAMATION)==0 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1 +!ENDIF OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1 !ENDIF @@ -444,6 +461,12 @@ TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $ TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS) !ENDIF +# Check if warnings should be treated as errors when compiling. +# +!IF $(USE_FATAL_WARN)!=0 +TCC = $(TCC) -WX +!ENDIF + TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS) @@ -622,7 +645,11 @@ RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1 !IF $(DEBUG)>2 TCC = $(TCC) -DSQLITE_DEBUG=1 RCC = $(RCC) -DSQLITE_DEBUG=1 +!IF $(DYNAMIC_SHELL)==0 +TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE +RCC = $(RCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE !ENDIF +!ENDIF !IF $(DEBUG)>4 || $(OSTRACE)!=0 TCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1 @@ -900,7 +927,7 @@ LIBRESOBJS = # when the shell is not being dynamically linked. # !IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0 -SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_STMTVTAB !ENDIF @@ -927,7 +954,7 @@ Replace.exe: sqlite3.def: Replace.exe $(LIBOBJ) echo EXPORTS > sqlite3.def dumpbin /all $(LIBOBJ) \ - | .\Replace.exe "^\s+/EXPORT:_?(sqlite3_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \ + | .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \ | sort >> sqlite3.def $(SQLITE3EXE): $(TOP)\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H) Modified: head/contrib/sqlite3/configure ============================================================================== --- head/contrib/sqlite3/configure Thu Aug 10 23:45:32 2017 (r322385) +++ head/contrib/sqlite3/configure Fri Aug 11 00:00:01 2017 (r322386) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.14.1. +# Generated by GNU Autoconf 2.69 for sqlite 3.20.0. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.14.1' -PACKAGE_STRING='sqlite 3.14.1' +PACKAGE_VERSION='3.20.0' +PACKAGE_STRING='sqlite 3.20.0' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1330,7 +1330,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.14.1 to adapt to many kinds of systems. +\`configure' configures sqlite 3.20.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1400,7 +1400,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.14.1:";; + short | recursive ) echo "Configuration of sqlite 3.20.0:";; esac cat <<\_ACEOF @@ -1521,7 +1521,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.14.1 +sqlite configure 3.20.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1936,7 +1936,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.14.1, which was +It was created by sqlite $as_me 3.20.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2802,7 +2802,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.14.1' + VERSION='3.20.0' cat >>confdefs.h <<_ACEOF @@ -13108,7 +13108,7 @@ for ac_lib in '' edit; do ac_res="none required" else ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" + LIBS="-l$ac_lib -ltinfo $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_readline=$ac_res @@ -13136,7 +13136,7 @@ if test "$ac_res" != no; then : $as_echo "#define HAVE_EDITLINE 1" >>confdefs.h - READLINE_LIBS=$LIBS + READLINE_LIBS="$LIBS -ltinfo" enable_readline=no fi @@ -14227,7 +14227,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.14.1, which was +This file was extended by sqlite $as_me 3.20.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14284,7 +14284,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.14.1 +sqlite config.status 3.20.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: head/contrib/sqlite3/configure.ac ============================================================================== --- head/contrib/sqlite3/configure.ac Thu Aug 10 23:45:32 2017 (r322385) +++ head/contrib/sqlite3/configure.ac Fri Aug 11 00:00:01 2017 (r322386) @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.14.1, http://www.sqlite.org) +AC_INIT(sqlite, 3.20.0, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) # Use automake. @@ -55,9 +55,9 @@ AS_IF([ test x"$enable_editline" != xno ],[ LIBS="" AC_SEARCH_LIBS([readline],[edit],[ AC_DEFINE([HAVE_EDITLINE],1,Define to use BSD editline) - READLINE_LIBS=$LIBS + READLINE_LIBS="$LIBS -ltinfo" enable_readline=no - ]) + ],[],[-ltinfo]) AS_UNSET(ac_cv_search_readline) LIBS=$sLIBS ]) Modified: head/contrib/sqlite3/shell.c ============================================================================== --- head/contrib/sqlite3/shell.c Thu Aug 10 23:45:32 2017 (r322385) +++ head/contrib/sqlite3/shell.c Fri Aug 11 00:00:01 2017 (r322386) @@ -1,3 +1,21 @@ +/* DO NOT EDIT! +** This file is automatically generated by the script in the canonical +** SQLite source tree at tool/mkshellc.tcl. That script combines source +** code from various constituent source files of SQLite into this single +** "shell.c" file used to implement the SQLite command-line shell. +** +** Most of the code found below comes from the "src/shell.c.in" file in +** the canonical SQLite source tree. That main file contains "INCLUDE" +** lines that specify other files in the canonical source tree that are +** inserted to getnerate this complete program source file. +** +** The code from multiple files is combined into this single "shell.c" +** source file to help make the command-line program easier to compile. +** +** To modify this program, get a copy of the canonical SQLite source tree, +** edit the src/shell.c.in" and/or some of the other files that are included +** by "src/shell.c.in", then rerun the tool/mkshellc.tcl script. +*/ /* ** 2001 September 15 ** @@ -18,11 +36,25 @@ #endif /* -** If requested, include the SQLite compiler options file for MSVC. +** Warning pragmas copied from msvc.h in the core. */ -#if defined(INCLUDE_MSVC_H) -#include "msvc.h" -#endif +#if defined(_MSC_VER) +#pragma warning(disable : 4054) +#pragma warning(disable : 4055) +#pragma warning(disable : 4100) +#pragma warning(disable : 4127) +#pragma warning(disable : 4130) +#pragma warning(disable : 4152) +#pragma warning(disable : 4189) +#pragma warning(disable : 4206) +#pragma warning(disable : 4210) +#pragma warning(disable : 4232) +#pragma warning(disable : 4244) +#pragma warning(disable : 4305) +#pragma warning(disable : 4306) +#pragma warning(disable : 4702) +#pragma warning(disable : 4706) +#endif /* defined(_MSC_VER) */ /* ** No support for loadable extensions in VxWorks. @@ -143,6 +175,7 @@ extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR); extern char *sqlite3_win32_mbcs_to_utf8_v2(const char *, int); extern char *sqlite3_win32_utf8_to_mbcs_v2(const char *, int); +extern LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText); #endif /* On Windows, we normally run with output mode of TEXT so that \n characters @@ -426,7 +459,37 @@ static void SQLITE_CDECL iotracePrintf(const char *zFo } #endif +/* +** Output string zUtf to stream pOut as w characters. If w is negative, +** then right-justify the text. W is the width in UTF-8 characters, not +** in bytes. This is different from the %*.*s specification in printf +** since with %*.*s the width is measured in bytes, not characters. +*/ +static void utf8_width_print(FILE *pOut, int w, const char *zUtf){ + int i; + int n; + int aw = w<0 ? -w : w; + char zBuf[1000]; + if( aw>(int)sizeof(zBuf)/3 ) aw = (int)sizeof(zBuf)/3; + for(i=n=0; zUtf[i]; i++){ + if( (zUtf[i]&0xc0)!=0x80 ){ + n++; + if( n==aw ){ + do{ i++; }while( (zUtf[i]&0xc0)==0x80 ); + break; + } + } + } + if( n>=aw ){ + utf8_printf(pOut, "%.*s", i, zUtf); + }else if( w<0 ){ + utf8_printf(pOut, "%*s%s", aw-n, "", zUtf); + }else{ + utf8_printf(pOut, "%s%*s", zUtf, aw-n, ""); + } +} + /* ** Determines if a string is a number of not. */ @@ -455,28 +518,6 @@ static int isNumber(const char *z, int *realnum){ } /* -** A global char* and an SQL function to access its current value -** from within an SQL statement. This program used to use the -** sqlite_exec_printf() API to substitue a string into an SQL statement. -** The correct way to do this with sqlite3 is to use the bind API, but -** since the shell is built around the callback paradigm it would be a lot -** of work. Instead just use this hack, which is quite harmless. -*/ -static const char *zShellStatic = 0; -static void shellstaticFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - assert( 0==argc ); - assert( zShellStatic ); - UNUSED_PARAMETER(argc); - UNUSED_PARAMETER(argv); - sqlite3_result_text(context, zShellStatic, -1, SQLITE_STATIC); -} - - -/* ** Compute a string length that is limited to what can be stored in ** lower 30 bits of a 32-bit signed integer. */ @@ -487,6 +528,18 @@ static int strlen30(const char *z){ } /* +** Return the length of a string in characters. Multibyte UTF8 characters +** count as a single character. +*/ +static int strlenChar(const char *z){ + int n = 0; + while( *z ){ + if( (0xc0&*(z++))!=0x80 ) n++; + } + return n; +} + +/* ** This routine reads a line of text from FILE in, stores ** the text in memory obtained from malloc() and returns a pointer ** to the text. NULL is returned at end of file, or if malloc() @@ -524,7 +577,7 @@ static char *local_getline(char *zLine, FILE *in){ #if defined(_WIN32) || defined(WIN32) /* For interactive input on Windows systems, translate the ** multi-byte characterset characters into UTF-8. */ - if( stdin_is_interactive ){ + if( stdin_is_interactive && in==stdin ){ char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0); if( zTrans ){ int nTrans = strlen30(zTrans)+1; @@ -576,7 +629,1534 @@ static char *one_input_line(FILE *in, char *zPrior, in } return zResult; } +/* +** A variable length string to which one can append text. +*/ +typedef struct ShellText ShellText; +struct ShellText { + char *z; + int n; + int nAlloc; +}; +/* +** Initialize and destroy a ShellText object +*/ +static void initText(ShellText *p){ + memset(p, 0, sizeof(*p)); +} +static void freeText(ShellText *p){ + free(p->z); + initText(p); +} + +/* zIn is either a pointer to a NULL-terminated string in memory obtained +** from malloc(), or a NULL pointer. The string pointed to by zAppend is +** added to zIn, and the result returned in memory obtained from malloc(). +** zIn, if it was not NULL, is freed. +** +** If the third argument, quote, is not '\0', then it is used as a +** quote character for zAppend. +*/ +static void appendText(ShellText *p, char const *zAppend, char quote){ + int len; + int i; + int nAppend = strlen30(zAppend); + + len = nAppend+p->n+1; + if( quote ){ + len += 2; + for(i=0; in+len>=p->nAlloc ){ + p->nAlloc = p->nAlloc*2 + len + 20; + p->z = realloc(p->z, p->nAlloc); + if( p->z==0 ){ + memset(p, 0, sizeof(*p)); + return; + } + } + + if( quote ){ + char *zCsr = p->z+p->n; + *zCsr++ = quote; + for(i=0; in = (int)(zCsr - p->z); + *zCsr = '\0'; + }else{ + memcpy(p->z+p->n, zAppend, nAppend); + p->n += nAppend; + p->z[p->n] = '\0'; + } +} + +/* +** Attempt to determine if identifier zName needs to be quoted, either +** because it contains non-alphanumeric characters, or because it is an +** SQLite keyword. Be conservative in this estimate: When in doubt assume +** that quoting is required. +** +** Return '"' if quoting is required. Return 0 if no quoting is required. +*/ +static char quoteChar(const char *zName){ + /* All SQLite keywords, in alphabetical order */ + static const char *azKeywords[] = { + "ABORT", "ACTION", "ADD", "AFTER", "ALL", "ALTER", "ANALYZE", "AND", "AS", + "ASC", "ATTACH", "AUTOINCREMENT", "BEFORE", "BEGIN", "BETWEEN", "BY", + "CASCADE", "CASE", "CAST", "CHECK", "COLLATE", "COLUMN", "COMMIT", + "CONFLICT", "CONSTRAINT", "CREATE", "CROSS", "CURRENT_DATE", + "CURRENT_TIME", "CURRENT_TIMESTAMP", "DATABASE", "DEFAULT", "DEFERRABLE", + "DEFERRED", "DELETE", "DESC", "DETACH", "DISTINCT", "DROP", "EACH", + "ELSE", "END", "ESCAPE", "EXCEPT", "EXCLUSIVE", "EXISTS", "EXPLAIN", + "FAIL", "FOR", "FOREIGN", "FROM", "FULL", "GLOB", "GROUP", "HAVING", "IF", + "IGNORE", "IMMEDIATE", "IN", "INDEX", "INDEXED", "INITIALLY", "INNER", + "INSERT", "INSTEAD", "INTERSECT", "INTO", "IS", "ISNULL", "JOIN", "KEY", + "LEFT", "LIKE", "LIMIT", "MATCH", "NATURAL", "NO", "NOT", "NOTNULL", + "NULL", "OF", "OFFSET", "ON", "OR", "ORDER", "OUTER", "PLAN", "PRAGMA", + "PRIMARY", "QUERY", "RAISE", "RECURSIVE", "REFERENCES", "REGEXP", + "REINDEX", "RELEASE", "RENAME", "REPLACE", "RESTRICT", "RIGHT", + "ROLLBACK", "ROW", "SAVEPOINT", "SELECT", "SET", "TABLE", "TEMP", + "TEMPORARY", "THEN", "TO", "TRANSACTION", "TRIGGER", "UNION", "UNIQUE", + "UPDATE", "USING", "VACUUM", "VALUES", "VIEW", "VIRTUAL", "WHEN", "WHERE", + "WITH", "WITHOUT", + }; + int i, lwr, upr, mid, c; + if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"'; + for(i=0; zName[i]; i++){ + if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"'; + } + lwr = 0; + upr = sizeof(azKeywords)/sizeof(azKeywords[0]) - 1; + while( lwr<=upr ){ + mid = (lwr+upr)/2; + c = sqlite3_stricmp(azKeywords[mid], zName); + if( c==0 ) return '"'; + if( c<0 ){ + lwr = mid+1; + }else{ + upr = mid-1; + } + } + return 0; +} + +/* +** SQL function: shell_add_schema(S,X) +** +** Add the schema name X to the CREATE statement in S and return the result. +** Examples: +** +** CREATE TABLE t1(x) -> CREATE TABLE xyz.t1(x); +** +** Also works on +** +** CREATE INDEX +** CREATE UNIQUE INDEX +** CREATE VIEW +** CREATE TRIGGER +** CREATE VIRTUAL TABLE +** +** This UDF is used by the .schema command to insert the schema name of +** attached databases into the middle of the sqlite_master.sql field. +*/ +static void shellAddSchemaName( + sqlite3_context *pCtx, + int nVal, + sqlite3_value **apVal +){ + static const char *aPrefix[] = { + "TABLE", + "INDEX", + "UNIQUE INDEX", + "VIEW", + "TRIGGER", + "VIRTUAL TABLE" + }; + int i = 0; + const char *zIn = (const char*)sqlite3_value_text(apVal[0]); + const char *zSchema = (const char*)sqlite3_value_text(apVal[1]); + assert( nVal==2 ); + if( zIn!=0 && strncmp(zIn, "CREATE ", 7)==0 ){ + for(i=0; i<(int)(sizeof(aPrefix)/sizeof(aPrefix[0])); i++){ + int n = strlen30(aPrefix[i]); + if( strncmp(zIn+7, aPrefix[i], n)==0 && zIn[n+7]==' ' ){ + char cQuote = quoteChar(zSchema); + char *z; + if( cQuote ){ + z = sqlite3_mprintf("%.*s \"%w\".%s", n+7, zIn, zSchema, zIn+n+8); + }else{ + z = sqlite3_mprintf("%.*s %s.%s", n+7, zIn, zSchema, zIn+n+8); + } + sqlite3_result_text(pCtx, z, -1, sqlite3_free); + return; + } + } + } + sqlite3_result_value(pCtx, apVal[0]); +} + +/* +** The source code for several run-time loadable extensions is inserted +** below by the ../tool/mkshellc.tcl script. Before processing that included +** code, we need to override some macros to make the included program code +** work here in the middle of this regular program. +*/ +#define SQLITE_EXTENSION_INIT1 +#define SQLITE_EXTENSION_INIT2(X) (void)(X) + +/************************* Begin ../ext/misc/shathree.c ******************/ +/* +** 2017-03-08 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This SQLite extension implements a functions that compute SHA1 hashes. +** Two SQL functions are implemented: +** +** sha3(X,SIZE) +** sha3_query(Y,SIZE) +** +** The sha3(X) function computes the SHA3 hash of the input X, or NULL if +** X is NULL. +** +** The sha3_query(Y) function evalutes all queries in the SQL statements of Y +** and returns a hash of their results. +** +** The SIZE argument is optional. If omitted, the SHA3-256 hash algorithm +** is used. If SIZE is included it must be one of the integers 224, 256, +** 384, or 512, to determine SHA3 hash variant that is computed. +*/ +SQLITE_EXTENSION_INIT1 +#include +#include +#include +typedef sqlite3_uint64 u64; + +/****************************************************************************** +** The Hash Engine +*/ +/* +** Macros to determine whether the machine is big or little endian, +** and whether or not that determination is run-time or compile-time. +** +** For best performance, an attempt is made to guess at the byte-order +** using C-preprocessor macros. If that is unsuccessful, or if +** -DSHA3_BYTEORDER=0 is set, then byte-order is determined +** at run-time. +*/ +#ifndef SHA3_BYTEORDER +# if defined(i386) || defined(__i386__) || defined(_M_IX86) || \ + defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \ + defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \ + defined(__arm__) +# define SHA3_BYTEORDER 1234 +# elif defined(sparc) || defined(__ppc__) +# define SHA3_BYTEORDER 4321 +# else +# define SHA3_BYTEORDER 0 +# endif +#endif + + +/* +** State structure for a SHA3 hash in progress +*/ +typedef struct SHA3Context SHA3Context; +struct SHA3Context { + union { + u64 s[25]; /* Keccak state. 5x5 lines of 64 bits each */ + unsigned char x[1600]; /* ... or 1600 bytes */ + } u; + unsigned nRate; /* Bytes of input accepted per Keccak iteration */ + unsigned nLoaded; /* Input bytes loaded into u.x[] so far this cycle */ + unsigned ixMask; /* Insert next input into u.x[nLoaded^ixMask]. */ +}; + +/* +** A single step of the Keccak mixing function for a 1600-bit state +*/ +static void KeccakF1600Step(SHA3Context *p){ + int i; + u64 B0, B1, B2, B3, B4; + u64 C0, C1, C2, C3, C4; + u64 D0, D1, D2, D3, D4; + static const u64 RC[] = { + 0x0000000000000001ULL, 0x0000000000008082ULL, + 0x800000000000808aULL, 0x8000000080008000ULL, + 0x000000000000808bULL, 0x0000000080000001ULL, + 0x8000000080008081ULL, 0x8000000000008009ULL, + 0x000000000000008aULL, 0x0000000000000088ULL, + 0x0000000080008009ULL, 0x000000008000000aULL, + 0x000000008000808bULL, 0x800000000000008bULL, + 0x8000000000008089ULL, 0x8000000000008003ULL, + 0x8000000000008002ULL, 0x8000000000000080ULL, + 0x000000000000800aULL, 0x800000008000000aULL, + 0x8000000080008081ULL, 0x8000000000008080ULL, + 0x0000000080000001ULL, 0x8000000080008008ULL + }; +# define A00 (p->u.s[0]) +# define A01 (p->u.s[1]) +# define A02 (p->u.s[2]) +# define A03 (p->u.s[3]) +# define A04 (p->u.s[4]) +# define A10 (p->u.s[5]) +# define A11 (p->u.s[6]) +# define A12 (p->u.s[7]) +# define A13 (p->u.s[8]) +# define A14 (p->u.s[9]) +# define A20 (p->u.s[10]) +# define A21 (p->u.s[11]) +# define A22 (p->u.s[12]) +# define A23 (p->u.s[13]) +# define A24 (p->u.s[14]) +# define A30 (p->u.s[15]) +# define A31 (p->u.s[16]) +# define A32 (p->u.s[17]) +# define A33 (p->u.s[18]) +# define A34 (p->u.s[19]) +# define A40 (p->u.s[20]) +# define A41 (p->u.s[21]) +# define A42 (p->u.s[22]) +# define A43 (p->u.s[23]) +# define A44 (p->u.s[24]) +# define ROL64(a,x) ((a<>(64-x))) + + for(i=0; i<24; i+=4){ + C0 = A00^A10^A20^A30^A40; + C1 = A01^A11^A21^A31^A41; + C2 = A02^A12^A22^A32^A42; + C3 = A03^A13^A23^A33^A43; + C4 = A04^A14^A24^A34^A44; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A11^D1), 44); + B2 = ROL64((A22^D2), 43); + B3 = ROL64((A33^D3), 21); + B4 = ROL64((A44^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i]; + A11 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A20^D0), 3); + B3 = ROL64((A31^D1), 45); + B4 = ROL64((A42^D2), 61); + B0 = ROL64((A03^D3), 28); + B1 = ROL64((A14^D4), 20); + A20 = B0 ^((~B1)& B2 ); + A31 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A40^D0), 18); + B0 = ROL64((A01^D1), 1); + B1 = ROL64((A12^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A34^D4), 8); + A40 = B0 ^((~B1)& B2 ); + A01 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A10^D0), 36); + B2 = ROL64((A21^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A43^D3), 56); + B0 = ROL64((A04^D4), 27); + A10 = B0 ^((~B1)& B2 ); + A21 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A30^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A02^D2), 62); + B1 = ROL64((A13^D3), 55); + B2 = ROL64((A24^D4), 39); + A30 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + C0 = A00^A20^A40^A10^A30; + C1 = A11^A31^A01^A21^A41; + C2 = A22^A42^A12^A32^A02; + C3 = A33^A03^A23^A43^A13; + C4 = A44^A14^A34^A04^A24; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A31^D1), 44); + B2 = ROL64((A12^D2), 43); + B3 = ROL64((A43^D3), 21); + B4 = ROL64((A24^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i+1]; + A31 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A40^D0), 3); + B3 = ROL64((A21^D1), 45); + B4 = ROL64((A02^D2), 61); + B0 = ROL64((A33^D3), 28); + B1 = ROL64((A14^D4), 20); + A40 = B0 ^((~B1)& B2 ); + A21 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A30^D0), 18); + B0 = ROL64((A11^D1), 1); + B1 = ROL64((A42^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A04^D4), 8); + A30 = B0 ^((~B1)& B2 ); + A11 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A20^D0), 36); + B2 = ROL64((A01^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A13^D3), 56); + B0 = ROL64((A44^D4), 27); + A20 = B0 ^((~B1)& B2 ); + A01 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A10^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A22^D2), 62); + B1 = ROL64((A03^D3), 55); + B2 = ROL64((A34^D4), 39); + A10 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + C0 = A00^A40^A30^A20^A10; + C1 = A31^A21^A11^A01^A41; + C2 = A12^A02^A42^A32^A22; + C3 = A43^A33^A23^A13^A03; + C4 = A24^A14^A04^A44^A34; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A21^D1), 44); + B2 = ROL64((A42^D2), 43); + B3 = ROL64((A13^D3), 21); + B4 = ROL64((A34^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i+2]; + A21 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A30^D0), 3); + B3 = ROL64((A01^D1), 45); + B4 = ROL64((A22^D2), 61); + B0 = ROL64((A43^D3), 28); + B1 = ROL64((A14^D4), 20); + A30 = B0 ^((~B1)& B2 ); + A01 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A10^D0), 18); + B0 = ROL64((A31^D1), 1); + B1 = ROL64((A02^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A44^D4), 8); + A10 = B0 ^((~B1)& B2 ); + A31 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A40^D0), 36); + B2 = ROL64((A11^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A03^D3), 56); + B0 = ROL64((A24^D4), 27); + A40 = B0 ^((~B1)& B2 ); + A11 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A20^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A12^D2), 62); + B1 = ROL64((A33^D3), 55); + B2 = ROL64((A04^D4), 39); + A20 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + C0 = A00^A30^A10^A40^A20; + C1 = A21^A01^A31^A11^A41; + C2 = A42^A22^A02^A32^A12; + C3 = A13^A43^A23^A03^A33; + C4 = A34^A14^A44^A24^A04; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A01^D1), 44); + B2 = ROL64((A02^D2), 43); + B3 = ROL64((A03^D3), 21); + B4 = ROL64((A04^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i+3]; + A01 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A10^D0), 3); + B3 = ROL64((A11^D1), 45); + B4 = ROL64((A12^D2), 61); + B0 = ROL64((A13^D3), 28); + B1 = ROL64((A14^D4), 20); + A10 = B0 ^((~B1)& B2 ); + A11 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A20^D0), 18); + B0 = ROL64((A21^D1), 1); + B1 = ROL64((A22^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A24^D4), 8); + A20 = B0 ^((~B1)& B2 ); + A21 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A30^D0), 36); + B2 = ROL64((A31^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A33^D3), 56); + B0 = ROL64((A34^D4), 27); + A30 = B0 ^((~B1)& B2 ); + A31 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A40^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A42^D2), 62); + B1 = ROL64((A43^D3), 55); + B2 = ROL64((A44^D4), 39); + A40 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + } +} + +/* +** Initialize a new hash. iSize determines the size of the hash +** in bits and should be one of 224, 256, 384, or 512. Or iSize +** can be zero to use the default hash size of 256 bits. +*/ +static void SHA3Init(SHA3Context *p, int iSize){ + memset(p, 0, sizeof(*p)); + if( iSize>=128 && iSize<=512 ){ + p->nRate = (1600 - ((iSize + 31)&~31)*2)/8; + }else{ + p->nRate = (1600 - 2*256)/8; + } +#if SHA3_BYTEORDER==1234 + /* Known to be little-endian at compile-time. No-op */ +#elif SHA3_BYTEORDER==4321 + p->ixMask = 7; /* Big-endian */ +#else + { + static unsigned int one = 1; + if( 1==*(unsigned char*)&one ){ + /* Little endian. No byte swapping. */ + p->ixMask = 0; + }else{ + /* Big endian. Byte swap. */ + p->ixMask = 7; + } + } +#endif +} + +/* +** Make consecutive calls to the SHA3Update function to add new content +** to the hash +*/ +static void SHA3Update( + SHA3Context *p, + const unsigned char *aData, + unsigned int nData +){ + unsigned int i = 0; +#if SHA3_BYTEORDER==1234 + if( (p->nLoaded % 8)==0 && ((aData - (const unsigned char*)0)&7)==0 ){ + for(; i+7u.s[p->nLoaded/8] ^= *(u64*)&aData[i]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Aug 11 00:01:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6DCAC7ACFC; Fri, 11 Aug 2017 00:01:23 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 6AD8476E2D; Fri, 11 Aug 2017 00:01:23 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7B01Mjl067201; Fri, 11 Aug 2017 00:01:22 GMT (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7B01M1m067200; Fri, 11 Aug 2017 00:01:22 GMT (envelope-from peter@FreeBSD.org) Message-Id: <201708110001.v7B01M1m067200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peter set sender to peter@FreeBSD.org using -f From: Peter Wemm Date: Fri, 11 Aug 2017 00:01:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r322387 - vendor/sqlite3/sqlite-3200000 X-SVN-Group: vendor X-SVN-Commit-Author: peter X-SVN-Commit-Paths: vendor/sqlite3/sqlite-3200000 X-SVN-Commit-Revision: 322387 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 00:01:23 -0000 Author: peter Date: Fri Aug 11 00:01:22 2017 New Revision: 322387 URL: https://svnweb.freebsd.org/changeset/base/322387 Log: Tag import of sqlite-3.20.0 Added: vendor/sqlite3/sqlite-3200000/ - copied from r322386, vendor/sqlite3/dist/ From owner-svn-src-all@freebsd.org Fri Aug 11 00:41:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C2B9C7D6CC; Fri, 11 Aug 2017 00:41:20 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5A8C27C3B6; Fri, 11 Aug 2017 00:41:20 +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 v7B0fJq0083384; Fri, 11 Aug 2017 00:41:19 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7B0fJ3x083379; Fri, 11 Aug 2017 00:41:19 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708110041.v7B0fJ3x083379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Fri, 11 Aug 2017 00:41:19 +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: r322388 - stable/11/sys/dev/mmc X-SVN-Group: stable-11 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/11/sys/dev/mmc X-SVN-Commit-Revision: 322388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 00:41:20 -0000 Author: marius Date: Fri Aug 11 00:41:19 2017 New Revision: 322388 URL: https://svnweb.freebsd.org/changeset/base/322388 Log: MFC: r322209 - If available, use TRIM instead of ERASE for implementing BIO_DELETE. This also involves adding a quirk table as TRIM is broken for some Kingston eMMC devices, though. Compared to ERASE (declared "legacy" in the eMMC specification v5.1), TRIM has the advantage of operating on write sectors rather than on erase sectors, which typically are of a much larger size. Thus, employing TRIM, we don't need to fiddle with coalescing BIO_DELETE requests that are also of (write) sector units into erase sectors, which might not even add up in all cases. - For some SanDisk iNAND devices, the CMD38 argument, e. g. ERASE, TRIM etc., has to be specified via EXT_CSD[113], which now is also handled via a quirk. - My initial understanding was that for eMMC partitions, the granularity should be used as erase sector size, e. g. 128 KB for boot partitions. However, rereading the relevant parts of the eMMC specification v5.1, this isn't actually correct. So drop the code which used partition granularities for delmaxsize and stripesize. For the most part, this change is a NOP, though, because a) for ERASE, mmcsd_delete() used the erase sector size unconditionally for all partitions anyway and b) g_disk_limit() doesn't actually take the stripesize into account. - Take some more advantage of mmcsd_errmsg() in mmcsd(4) for making error codes human readable. Modified: stable/11/sys/dev/mmc/bridge.h stable/11/sys/dev/mmc/mmc.c stable/11/sys/dev/mmc/mmcreg.h stable/11/sys/dev/mmc/mmcsd.c stable/11/sys/dev/mmc/mmcvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mmc/bridge.h ============================================================================== --- stable/11/sys/dev/mmc/bridge.h Fri Aug 11 00:01:22 2017 (r322387) +++ stable/11/sys/dev/mmc/bridge.h Fri Aug 11 00:41:19 2017 (r322388) @@ -179,7 +179,7 @@ struct mmc_host { extern driver_t mmc_driver; extern devclass_t mmc_devclass; -#define MMC_VERSION 4 +#define MMC_VERSION 5 #define MMC_DECLARE_BRIDGE(name) \ DRIVER_MODULE(mmc, name, mmc_driver, mmc_devclass, NULL, NULL); \ Modified: stable/11/sys/dev/mmc/mmc.c ============================================================================== --- stable/11/sys/dev/mmc/mmc.c Fri Aug 11 00:01:22 2017 (r322387) +++ stable/11/sys/dev/mmc/mmc.c Fri Aug 11 00:41:19 2017 (r322388) @@ -104,12 +104,34 @@ struct mmc_ivars { uint32_t hs_tran_speed; /* Max speed in high speed mode */ uint32_t erase_sector; /* Card native erase sector size */ uint32_t cmd6_time; /* Generic switch timeout [us] */ + uint32_t quirks; /* Quirks as per mmc_quirk->quirks */ char card_id_string[64];/* Formatted CID info (serial, MFG, etc) */ char card_sn_string[16];/* Formatted serial # for disk->d_ident */ }; #define CMD_RETRIES 3 +static const struct mmc_quirk mmc_quirks[] = { + /* + * For some SanDisk iNAND devices, the CMD38 argument needs to be + * provided in EXT_CSD[113]. + */ + { 0x2, 0x100, "SEM02G", MMC_QUIRK_INAND_CMD38 }, + { 0x2, 0x100, "SEM04G", MMC_QUIRK_INAND_CMD38 }, + { 0x2, 0x100, "SEM08G", MMC_QUIRK_INAND_CMD38 }, + { 0x2, 0x100, "SEM16G", MMC_QUIRK_INAND_CMD38 }, + { 0x2, 0x100, "SEM32G", MMC_QUIRK_INAND_CMD38 }, + + /* + * Disable TRIM for Kingston eMMCs where a firmware bug can lead to + * unrecoverable data corruption. + */ + { 0x70, MMC_QUIRK_OID_ANY, "V10008", MMC_QUIRK_BROKEN_TRIM }, + { 0x70, MMC_QUIRK_OID_ANY, "V10016", MMC_QUIRK_BROKEN_TRIM }, + + { 0x0, 0x0, NULL, 0x0 } +}; + static SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, NULL, "mmc driver"); static int mmc_debug; @@ -1109,7 +1131,7 @@ mmc_format_card_id_string(struct mmc_ivars *ivar) /* * Format a card ID string for use by the mmcsd driver, it's what * appears between the <> in the following: - * mmcsd0: 968MB at mmc0 + * mmcsd0: 968MB at mmc0 * 22.5MHz/4bit/128-block * * Also format just the card serial number, which the mmcsd driver will @@ -1547,6 +1569,7 @@ mmc_log_card(device_t dev, struct mmc_ivars *ivar, int break; } } + device_printf(dev, " quirks: %b\n", ivar->quirks, MMC_QUIRKS_FMT); device_printf(dev, " bus: %ubit, %uMHz (%s timing)\n", (ivar->bus_width == bus_width_1 ? 1 : (ivar->bus_width == bus_width_4 ? 4 : 8)), @@ -1563,6 +1586,7 @@ mmc_discover_cards(struct mmc_softc *sc) u_char switch_res[64]; uint32_t raw_cid[4]; struct mmc_ivars *ivar = NULL; + const struct mmc_quirk *quirk; device_t child; int err, host_caps, i, newcard; uint32_t resp, sec_count, status; @@ -1870,6 +1894,18 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->raw_ext_csd[EXT_CSD_REV] >= 5); child_common: + for (quirk = &mmc_quirks[0]; quirk->mid != 0x0; quirk++) { + if ((quirk->mid == MMC_QUIRK_MID_ANY || + quirk->mid == ivar->cid.mid) && + (quirk->oid == MMC_QUIRK_OID_ANY || + quirk->oid == ivar->cid.oid) && + strncmp(quirk->pnm, ivar->cid.pnm, + sizeof(ivar->cid.pnm)) == 0) { + ivar->quirks = quirk->quirks; + break; + } + } + /* * Some cards that report maximum I/O block sizes greater * than 512 require the block length to be set to 512, even @@ -2470,6 +2506,12 @@ mmc_read_ivar(device_t bus, device_t child, int which, break; case MMC_IVAR_MAX_DATA: *result = mmcbr_get_max_data(bus); + break; + case MMC_IVAR_CMD6_TIMEOUT: + *result = ivar->cmd6_time; + break; + case MMC_IVAR_QUIRKS: + *result = ivar->quirks; break; case MMC_IVAR_CARD_ID_STRING: *(char **)result = ivar->card_id_string; Modified: stable/11/sys/dev/mmc/mmcreg.h ============================================================================== --- stable/11/sys/dev/mmc/mmcreg.h Fri Aug 11 00:01:22 2017 (r322387) +++ stable/11/sys/dev/mmc/mmcreg.h Fri Aug 11 00:41:19 2017 (r322388) @@ -238,6 +238,13 @@ struct mmc_request { #define MMC_ERASE_GROUP_END 36 /* 37 -- reserved old command */ #define MMC_ERASE 38 +#define MMC_ERASE_ERASE 0x00000000 +#define MMC_ERASE_TRIM 0x00000001 +#define MMC_ERASE_FULE 0x00000002 +#define MMC_ERASE_DISCARD 0x00000003 +#define MMC_ERASE_SECURE_ERASE 0x80000000 +#define MMC_ERASE_SECURE_TRIM1 0x80000001 +#define MMC_ERASE_SECURE_TRIM2 0x80008000 /* Class 9: I/O mode commands */ #define MMC_FAST_IO 39 @@ -321,6 +328,7 @@ struct mmc_request { #define EXT_CSD_ERASE_TO_MULT 223 /* RO */ #define EXT_CSD_ERASE_GRP_SIZE 224 /* RO */ #define EXT_CSD_BOOT_SIZE_MULT 226 /* RO */ +#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ #define EXT_CSD_PWR_CL_200_195 236 /* RO */ #define EXT_CSD_PWR_CL_200_360 237 /* RO */ #define EXT_CSD_PWR_CL_52_195_DDR 238 /* RO */ @@ -405,6 +413,22 @@ struct mmc_request { #define EXT_CSD_STROBE_SUPPORT_EN 0x01 +#define EXT_CSD_SEC_FEATURE_SUPPORT_ER_EN 0x01 +#define EXT_CSD_SEC_FEATURE_SUPPORT_BD_BLK_EN 0x04 +#define EXT_CSD_SEC_FEATURE_SUPPORT_GB_CL_EN 0x10 +#define EXT_CSD_SEC_FEATURE_SUPPORT_SANITIZE 0x40 + +/* + * Vendor specific EXT_CSD fields + */ +/* SanDisk iNAND */ +#define EXT_CSD_INAND_CMD38 113 +#define EXT_CSD_INAND_CMD38_ERASE 0x00 +#define EXT_CSD_INAND_CMD38_TRIM 0x01 +#define EXT_CSD_INAND_CMD38_SECURE_ERASE 0x80 +#define EXT_CSD_INAND_CMD38_SECURE_TRIM1 0x81 +#define EXT_CSD_INAND_CMD38_SECURE_TRIM2 0x82 + #define MMC_TYPE_HS_26_MAX 26000000 #define MMC_TYPE_HS_52_MAX 52000000 #define MMC_TYPE_DDR52_MAX 52000000 @@ -498,8 +522,7 @@ struct mmc_cid { uint8_t fwrev; }; -struct mmc_csd -{ +struct mmc_csd { uint8_t csd_structure; uint8_t spec_vers; uint16_t ccc; @@ -525,16 +548,14 @@ struct mmc_csd wp_grp_enable:1; }; -struct mmc_scr -{ +struct mmc_scr { unsigned char sda_vsn; unsigned char bus_widths; #define SD_SCR_BUS_WIDTH_1 (1 << 0) #define SD_SCR_BUS_WIDTH_4 (1 << 2) }; -struct mmc_sd_status -{ +struct mmc_sd_status { uint8_t bus_width; uint8_t secured_mode; uint16_t card_type; @@ -546,6 +567,19 @@ struct mmc_sd_status uint8_t erase_timeout; uint8_t erase_offset; }; + +struct mmc_quirk { + uint32_t mid; +#define MMC_QUIRK_MID_ANY ((uint32_t)-1) + uint16_t oid; +#define MMC_QUIRK_OID_ANY ((uint16_t)-1) + const char *pnm; + uint32_t quirks; +#define MMC_QUIRK_INAND_CMD38 0x0001 +#define MMC_QUIRK_BROKEN_TRIM 0x0002 +}; + +#define MMC_QUIRKS_FMT "\020" "\001INAND_CMD38" "\002BROKEN_TRIM" /* * Various MMC/SD constants Modified: stable/11/sys/dev/mmc/mmcsd.c ============================================================================== --- stable/11/sys/dev/mmc/mmcsd.c Fri Aug 11 00:01:22 2017 (r322387) +++ stable/11/sys/dev/mmc/mmcsd.c Fri Aug 11 00:41:19 2017 (r322388) @@ -126,6 +126,10 @@ struct mmcsd_softc { uint8_t part_curr; /* Partition currently switched to */ uint8_t ext_csd[MMC_EXTCSD_SIZE]; uint16_t rca; + uint32_t flags; +#define MMCSD_INAND_CMD38 0x0001 +#define MMCSD_USE_TRIM 0x0002 + uint32_t cmd6_time; /* Generic switch timeout [us] */ uint32_t part_time; /* Partition switch timeout [us] */ off_t enh_base; /* Enhanced user data area slice base ... */ off_t enh_size; /* ... and size [bytes] */ @@ -168,9 +172,10 @@ static int mmcsd_ioctl_rpmb(struct cdev *dev, u_long c int fflag, struct thread *td); static void mmcsd_add_part(struct mmcsd_softc *sc, u_int type, - const char *name, u_int cnt, off_t media_size, off_t erase_size, bool ro); + const char *name, u_int cnt, off_t media_size, bool ro); static int mmcsd_bus_bit_width(device_t dev); static daddr_t mmcsd_delete(struct mmcsd_part *part, struct bio *bp); +static const char *mmcsd_errmsg(int e); static int mmcsd_ioctl(struct mmcsd_part *part, u_long cmd, void *data, int fflag); static int mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic, @@ -221,6 +226,7 @@ mmcsd_attach(device_t dev) off_t erase_size, sector_size, size, wp_size; uintmax_t bytes; int err, i; + uint32_t quirks; uint8_t rev; bool comp, ro; char unit[2]; @@ -239,21 +245,48 @@ mmcsd_attach(device_t dev) * place either. */ sc->max_data = mmc_get_max_data(dev); - sc->erase_sector = mmc_get_erase_sector(dev); sc->high_cap = mmc_get_high_cap(dev); sc->rca = mmc_get_rca(dev); + sc->cmd6_time = mmc_get_cmd6_timeout(dev); + quirks = mmc_get_quirks(dev); /* Only MMC >= 4.x devices support EXT_CSD. */ if (mmc_get_spec_vers(dev) >= 4) { MMCBUS_ACQUIRE_BUS(mmcbus, dev); err = mmc_send_ext_csd(mmcbus, dev, sc->ext_csd); MMCBUS_RELEASE_BUS(mmcbus, dev); - if (err != MMC_ERR_NONE) - bzero(sc->ext_csd, sizeof(sc->ext_csd)); + if (err != MMC_ERR_NONE) { + device_printf(dev, "Error reading EXT_CSD %s\n", + mmcsd_errmsg(err)); + return (ENXIO); + } } ext_csd = sc->ext_csd; + if ((quirks & MMC_QUIRK_INAND_CMD38) != 0) { + if (mmc_get_spec_vers(dev) < 4) { + device_printf(dev, + "MMC_QUIRK_INAND_CMD38 set but no EXT_CSD\n"); + return (EINVAL); + } + sc->flags |= MMCSD_INAND_CMD38; + } + /* + * EXT_CSD_SEC_FEATURE_SUPPORT_GB_CL_EN denotes support for both + * insecure and secure TRIM. + */ + if ((ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT] & + EXT_CSD_SEC_FEATURE_SUPPORT_GB_CL_EN) != 0 && + (quirks & MMC_QUIRK_BROKEN_TRIM) == 0) { + if (bootverbose) + device_printf(dev, "taking advantage of TRIM\n"); + sc->flags |= MMCSD_USE_TRIM; + sc->erase_sector = 1; + } else + sc->erase_sector = mmc_get_erase_sector(dev); + + /* * Enhanced user data area and general purpose partitions are only * supported in revision 1.4 (EXT_CSD_REV == 4) and later, the RPMB * partition in revision 1.5 (MMC v4.41, EXT_CSD_REV == 5) and later. @@ -306,8 +339,7 @@ mmcsd_attach(device_t dev) */ ro = mmc_get_read_only(dev); mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_DEFAULT, "mmcsd", - device_get_unit(dev), mmc_get_media_size(dev) * sector_size, - sc->erase_sector * sector_size, ro); + device_get_unit(dev), mmc_get_media_size(dev) * sector_size, ro); if (mmc_get_spec_vers(dev) < 3) return (0); @@ -332,11 +364,11 @@ mmcsd_attach(device_t dev) size = ext_csd[EXT_CSD_BOOT_SIZE_MULT] * MMC_BOOT_RPMB_BLOCK_SIZE; if (size > 0 && (mmcbr_get_caps(mmcbus) & MMC_CAP_BOOT_NOACC) == 0) { mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_BOOT0, - MMCSD_FMT_BOOT, 0, size, MMC_BOOT_RPMB_BLOCK_SIZE, + MMCSD_FMT_BOOT, 0, size, ro | ((ext_csd[EXT_CSD_BOOT_WP_STATUS] & EXT_CSD_BOOT_WP_STATUS_BOOT0_MASK) != 0)); mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_BOOT1, - MMCSD_FMT_BOOT, 1, size, MMC_BOOT_RPMB_BLOCK_SIZE, + MMCSD_FMT_BOOT, 1, size, ro | ((ext_csd[EXT_CSD_BOOT_WP_STATUS] & EXT_CSD_BOOT_WP_STATUS_BOOT1_MASK) != 0)); } @@ -345,7 +377,7 @@ mmcsd_attach(device_t dev) size = ext_csd[EXT_CSD_RPMB_MULT] * MMC_BOOT_RPMB_BLOCK_SIZE; if (rev >= 5 && size > 0) mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_RPMB, - MMCSD_FMT_RPMB, 0, size, MMC_BOOT_RPMB_BLOCK_SIZE, ro); + MMCSD_FMT_RPMB, 0, size, ro); if (rev <= 3 || comp == FALSE) return (0); @@ -365,8 +397,7 @@ mmcsd_attach(device_t dev) if (size == 0) continue; mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_GP0 + i, - MMCSD_FMT_GP, i, size * erase_size * wp_size, - erase_size, ro); + MMCSD_FMT_GP, i, size * erase_size * wp_size, ro); } } return (0); @@ -419,7 +450,7 @@ static struct cdevsw mmcsd_rpmb_cdevsw = { static void mmcsd_add_part(struct mmcsd_softc *sc, u_int type, const char *name, u_int cnt, - off_t media_size, off_t erase_size, bool ro) + off_t media_size, bool ro) { struct make_dev_args args; device_t dev, mmcbus; @@ -482,10 +513,10 @@ mmcsd_add_part(struct mmcsd_softc *sc, u_int type, con d->d_sectorsize = mmc_get_sector_size(dev); d->d_maxsize = sc->max_data * d->d_sectorsize; d->d_mediasize = media_size; - d->d_stripesize = erase_size; + d->d_stripesize = sc->erase_sector * d->d_sectorsize; d->d_unit = cnt; d->d_flags = DISKFLAG_CANDELETE; - d->d_delmaxsize = erase_size; + d->d_delmaxsize = mmc_get_erase_sector(dev) * d->d_sectorsize; strlcpy(d->d_ident, mmc_get_card_sn_string(dev), sizeof(d->d_ident)); strlcpy(d->d_descr, mmc_get_card_id_string(dev), @@ -1151,6 +1182,8 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) struct mmcsd_softc *sc; device_t dev, mmcbus; u_int erase_sector, sz; + int err; + bool use_trim; sc = part->sc; dev = sc->dev; @@ -1159,24 +1192,46 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) block = bp->bio_pblkno; sz = part->disk->d_sectorsize; end = bp->bio_pblkno + (bp->bio_bcount / sz); - /* Coalesce with part remaining from previous request. */ - if (block > part->eblock && block <= part->eend) - block = part->eblock; - if (end >= part->eblock && end < part->eend) - end = part->eend; - /* Safe round to the erase sector boundaries. */ - erase_sector = sc->erase_sector; - start = block + erase_sector - 1; /* Round up. */ - start -= start % erase_sector; - stop = end; /* Round down. */ - stop -= end % erase_sector; - /* We can't erase an area smaller than a sector, store it for later. */ - if (start >= stop) { - part->eblock = block; - part->eend = end; - return (end); + use_trim = sc->flags & MMCSD_USE_TRIM; + if (use_trim == true) { + start = block; + stop = end; + } else { + /* Coalesce with the remainder of the previous request. */ + if (block > part->eblock && block <= part->eend) + block = part->eblock; + if (end >= part->eblock && end < part->eend) + end = part->eend; + /* Safely round to the erase sector boundaries. */ + erase_sector = sc->erase_sector; + start = block + erase_sector - 1; /* Round up. */ + start -= start % erase_sector; + stop = end; /* Round down. */ + stop -= end % erase_sector; + /* + * We can't erase an area smaller than an erase sector, so + * store it for later. + */ + if (start >= stop) { + part->eblock = block; + part->eend = end; + return (end); + } } + if ((sc->flags & MMCSD_INAND_CMD38) != 0) { + err = mmc_switch(mmcbus, dev, sc->rca, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_INAND_CMD38, use_trim == true ? + EXT_CSD_INAND_CMD38_TRIM : EXT_CSD_INAND_CMD38_ERASE, + sc->cmd6_time, true); + if (err != MMC_ERR_NONE) { + device_printf(dev, + "Setting iNAND erase command failed %s\n", + mmcsd_errmsg(err)); + return (block); + } + } + /* * Pause re-tuning so it won't interfere with the order of erase * commands. Note that these latter don't use the data lines, so @@ -1198,8 +1253,8 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { - device_printf(dev, "Setting erase start position failed %d\n", - req.cmd->error); + device_printf(dev, "Setting erase start position failed %s\n", + mmcsd_errmsg(req.cmd->error)); block = bp->bio_pblkno; goto unpause; } @@ -1218,8 +1273,8 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { - device_printf(dev, "Setting erase stop position failed %d\n", - req.cmd->error); + device_printf(dev, "Setting erase stop position failed %s\n", + mmcsd_errmsg(req.cmd->error)); block = bp->bio_pblkno; goto unpause; } @@ -1228,23 +1283,24 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) memset(&cmd, 0, sizeof(cmd)); req.cmd = &cmd; cmd.opcode = MMC_ERASE; - cmd.arg = 0; + cmd.arg = use_trim == true ? MMC_ERASE_TRIM : MMC_ERASE_ERASE; cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { - device_printf(dev, "erase err3: %d\n", req.cmd->error); - device_printf(dev, "Issuing erase command failed %d\n", - req.cmd->error); + device_printf(dev, "Issuing erase command failed %s\n", + mmcsd_errmsg(req.cmd->error)); block = bp->bio_pblkno; goto unpause; } - /* Store one of remaining parts for the next call. */ - if (bp->bio_pblkno >= part->eblock || block == start) { - part->eblock = stop; /* Predict next forward. */ - part->eend = end; - } else { - part->eblock = block; /* Predict next backward. */ - part->eend = start; + if (use_trim == false) { + /* Store one of the remaining parts for the next call. */ + if (bp->bio_pblkno >= part->eblock || block == start) { + part->eblock = stop; /* Predict next forward. */ + part->eend = end; + } else { + part->eblock = block; /* Predict next backward. */ + part->eend = start; + } } block = end; unpause: Modified: stable/11/sys/dev/mmc/mmcvar.h ============================================================================== --- stable/11/sys/dev/mmc/mmcvar.h Fri Aug 11 00:01:22 2017 (r322387) +++ stable/11/sys/dev/mmc/mmcvar.h Fri Aug 11 00:41:19 2017 (r322388) @@ -68,6 +68,8 @@ enum mmc_device_ivars { MMC_IVAR_BUS_WIDTH, MMC_IVAR_ERASE_SECTOR, MMC_IVAR_MAX_DATA, + MMC_IVAR_CMD6_TIMEOUT, + MMC_IVAR_QUIRKS, MMC_IVAR_CARD_ID_STRING, MMC_IVAR_CARD_SN_STRING, }; @@ -90,6 +92,8 @@ MMC_ACCESSOR(card_type, CARD_TYPE, int) MMC_ACCESSOR(bus_width, BUS_WIDTH, int) MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int) MMC_ACCESSOR(max_data, MAX_DATA, int) +MMC_ACCESSOR(cmd6_timeout, CMD6_TIMEOUT, u_int) +MMC_ACCESSOR(quirks, QUIRKS, u_int) MMC_ACCESSOR(card_id_string, CARD_ID_STRING, const char *) MMC_ACCESSOR(card_sn_string, CARD_SN_STRING, const char *) From owner-svn-src-all@freebsd.org Fri Aug 11 00:41:45 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D806C7D792; Fri, 11 Aug 2017 00:41:45 +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 mx1.freebsd.org (Postfix) with ESMTPS id F1B057C622; Fri, 11 Aug 2017 00:41:44 +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 v7B0fiFR084320; Fri, 11 Aug 2017 00:41:44 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7B0fhE6084315; Fri, 11 Aug 2017 00:41:43 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708110041.v7B0fhE6084315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Fri, 11 Aug 2017 00:41:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322389 - stable/10/sys/dev/mmc X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/sys/dev/mmc X-SVN-Commit-Revision: 322389 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 00:41:45 -0000 Author: marius Date: Fri Aug 11 00:41:43 2017 New Revision: 322389 URL: https://svnweb.freebsd.org/changeset/base/322389 Log: MFC: r322209 - If available, use TRIM instead of ERASE for implementing BIO_DELETE. This also involves adding a quirk table as TRIM is broken for some Kingston eMMC devices, though. Compared to ERASE (declared "legacy" in the eMMC specification v5.1), TRIM has the advantage of operating on write sectors rather than on erase sectors, which typically are of a much larger size. Thus, employing TRIM, we don't need to fiddle with coalescing BIO_DELETE requests that are also of (write) sector units into erase sectors, which might not even add up in all cases. - For some SanDisk iNAND devices, the CMD38 argument, e. g. ERASE, TRIM etc., has to be specified via EXT_CSD[113], which now is also handled via a quirk. - My initial understanding was that for eMMC partitions, the granularity should be used as erase sector size, e. g. 128 KB for boot partitions. However, rereading the relevant parts of the eMMC specification v5.1, this isn't actually correct. So drop the code which used partition granularities for delmaxsize and stripesize. For the most part, this change is a NOP, though, because a) for ERASE, mmcsd_delete() used the erase sector size unconditionally for all partitions anyway and b) g_disk_limit() doesn't actually take the stripesize into account. - Take some more advantage of mmcsd_errmsg() in mmcsd(4) for making error codes human readable. Modified: stable/10/sys/dev/mmc/bridge.h stable/10/sys/dev/mmc/mmc.c stable/10/sys/dev/mmc/mmcreg.h stable/10/sys/dev/mmc/mmcsd.c stable/10/sys/dev/mmc/mmcvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mmc/bridge.h ============================================================================== --- stable/10/sys/dev/mmc/bridge.h Fri Aug 11 00:41:19 2017 (r322388) +++ stable/10/sys/dev/mmc/bridge.h Fri Aug 11 00:41:43 2017 (r322389) @@ -179,7 +179,7 @@ struct mmc_host { extern driver_t mmc_driver; extern devclass_t mmc_devclass; -#define MMC_VERSION 4 +#define MMC_VERSION 5 #define MMC_DECLARE_BRIDGE(name) \ DRIVER_MODULE(mmc, name, mmc_driver, mmc_devclass, NULL, NULL); \ Modified: stable/10/sys/dev/mmc/mmc.c ============================================================================== --- stable/10/sys/dev/mmc/mmc.c Fri Aug 11 00:41:19 2017 (r322388) +++ stable/10/sys/dev/mmc/mmc.c Fri Aug 11 00:41:43 2017 (r322389) @@ -104,12 +104,34 @@ struct mmc_ivars { uint32_t hs_tran_speed; /* Max speed in high speed mode */ uint32_t erase_sector; /* Card native erase sector size */ uint32_t cmd6_time; /* Generic switch timeout [us] */ + uint32_t quirks; /* Quirks as per mmc_quirk->quirks */ char card_id_string[64];/* Formatted CID info (serial, MFG, etc) */ char card_sn_string[16];/* Formatted serial # for disk->d_ident */ }; #define CMD_RETRIES 3 +static const struct mmc_quirk mmc_quirks[] = { + /* + * For some SanDisk iNAND devices, the CMD38 argument needs to be + * provided in EXT_CSD[113]. + */ + { 0x2, 0x100, "SEM02G", MMC_QUIRK_INAND_CMD38 }, + { 0x2, 0x100, "SEM04G", MMC_QUIRK_INAND_CMD38 }, + { 0x2, 0x100, "SEM08G", MMC_QUIRK_INAND_CMD38 }, + { 0x2, 0x100, "SEM16G", MMC_QUIRK_INAND_CMD38 }, + { 0x2, 0x100, "SEM32G", MMC_QUIRK_INAND_CMD38 }, + + /* + * Disable TRIM for Kingston eMMCs where a firmware bug can lead to + * unrecoverable data corruption. + */ + { 0x70, MMC_QUIRK_OID_ANY, "V10008", MMC_QUIRK_BROKEN_TRIM }, + { 0x70, MMC_QUIRK_OID_ANY, "V10016", MMC_QUIRK_BROKEN_TRIM }, + + { 0x0, 0x0, NULL, 0x0 } +}; + static SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, NULL, "mmc driver"); static int mmc_debug; @@ -1110,7 +1132,7 @@ mmc_format_card_id_string(struct mmc_ivars *ivar) /* * Format a card ID string for use by the mmcsd driver, it's what * appears between the <> in the following: - * mmcsd0: 968MB at mmc0 + * mmcsd0: 968MB at mmc0 * 22.5MHz/4bit/128-block * * Also format just the card serial number, which the mmcsd driver will @@ -1548,6 +1570,7 @@ mmc_log_card(device_t dev, struct mmc_ivars *ivar, int break; } } + device_printf(dev, " quirks: %b\n", ivar->quirks, MMC_QUIRKS_FMT); device_printf(dev, " bus: %ubit, %uMHz (%s timing)\n", (ivar->bus_width == bus_width_1 ? 1 : (ivar->bus_width == bus_width_4 ? 4 : 8)), @@ -1564,6 +1587,7 @@ mmc_discover_cards(struct mmc_softc *sc) u_char switch_res[64]; uint32_t raw_cid[4]; struct mmc_ivars *ivar = NULL; + const struct mmc_quirk *quirk; device_t child; int err, host_caps, i, newcard; uint32_t resp, sec_count, status; @@ -1871,6 +1895,18 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->raw_ext_csd[EXT_CSD_REV] >= 5); child_common: + for (quirk = &mmc_quirks[0]; quirk->mid != 0x0; quirk++) { + if ((quirk->mid == MMC_QUIRK_MID_ANY || + quirk->mid == ivar->cid.mid) && + (quirk->oid == MMC_QUIRK_OID_ANY || + quirk->oid == ivar->cid.oid) && + strncmp(quirk->pnm, ivar->cid.pnm, + sizeof(ivar->cid.pnm)) == 0) { + ivar->quirks = quirk->quirks; + break; + } + } + /* * Some cards that report maximum I/O block sizes greater * than 512 require the block length to be set to 512, even @@ -2471,6 +2507,12 @@ mmc_read_ivar(device_t bus, device_t child, int which, break; case MMC_IVAR_MAX_DATA: *result = mmcbr_get_max_data(bus); + break; + case MMC_IVAR_CMD6_TIMEOUT: + *result = ivar->cmd6_time; + break; + case MMC_IVAR_QUIRKS: + *result = ivar->quirks; break; case MMC_IVAR_CARD_ID_STRING: *(char **)result = ivar->card_id_string; Modified: stable/10/sys/dev/mmc/mmcreg.h ============================================================================== --- stable/10/sys/dev/mmc/mmcreg.h Fri Aug 11 00:41:19 2017 (r322388) +++ stable/10/sys/dev/mmc/mmcreg.h Fri Aug 11 00:41:43 2017 (r322389) @@ -238,6 +238,13 @@ struct mmc_request { #define MMC_ERASE_GROUP_END 36 /* 37 -- reserved old command */ #define MMC_ERASE 38 +#define MMC_ERASE_ERASE 0x00000000 +#define MMC_ERASE_TRIM 0x00000001 +#define MMC_ERASE_FULE 0x00000002 +#define MMC_ERASE_DISCARD 0x00000003 +#define MMC_ERASE_SECURE_ERASE 0x80000000 +#define MMC_ERASE_SECURE_TRIM1 0x80000001 +#define MMC_ERASE_SECURE_TRIM2 0x80008000 /* Class 9: I/O mode commands */ #define MMC_FAST_IO 39 @@ -321,6 +328,7 @@ struct mmc_request { #define EXT_CSD_ERASE_TO_MULT 223 /* RO */ #define EXT_CSD_ERASE_GRP_SIZE 224 /* RO */ #define EXT_CSD_BOOT_SIZE_MULT 226 /* RO */ +#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ #define EXT_CSD_PWR_CL_200_195 236 /* RO */ #define EXT_CSD_PWR_CL_200_360 237 /* RO */ #define EXT_CSD_PWR_CL_52_195_DDR 238 /* RO */ @@ -405,6 +413,22 @@ struct mmc_request { #define EXT_CSD_STROBE_SUPPORT_EN 0x01 +#define EXT_CSD_SEC_FEATURE_SUPPORT_ER_EN 0x01 +#define EXT_CSD_SEC_FEATURE_SUPPORT_BD_BLK_EN 0x04 +#define EXT_CSD_SEC_FEATURE_SUPPORT_GB_CL_EN 0x10 +#define EXT_CSD_SEC_FEATURE_SUPPORT_SANITIZE 0x40 + +/* + * Vendor specific EXT_CSD fields + */ +/* SanDisk iNAND */ +#define EXT_CSD_INAND_CMD38 113 +#define EXT_CSD_INAND_CMD38_ERASE 0x00 +#define EXT_CSD_INAND_CMD38_TRIM 0x01 +#define EXT_CSD_INAND_CMD38_SECURE_ERASE 0x80 +#define EXT_CSD_INAND_CMD38_SECURE_TRIM1 0x81 +#define EXT_CSD_INAND_CMD38_SECURE_TRIM2 0x82 + #define MMC_TYPE_HS_26_MAX 26000000 #define MMC_TYPE_HS_52_MAX 52000000 #define MMC_TYPE_DDR52_MAX 52000000 @@ -498,8 +522,7 @@ struct mmc_cid { uint8_t fwrev; }; -struct mmc_csd -{ +struct mmc_csd { uint8_t csd_structure; uint8_t spec_vers; uint16_t ccc; @@ -525,16 +548,14 @@ struct mmc_csd wp_grp_enable:1; }; -struct mmc_scr -{ +struct mmc_scr { unsigned char sda_vsn; unsigned char bus_widths; #define SD_SCR_BUS_WIDTH_1 (1 << 0) #define SD_SCR_BUS_WIDTH_4 (1 << 2) }; -struct mmc_sd_status -{ +struct mmc_sd_status { uint8_t bus_width; uint8_t secured_mode; uint16_t card_type; @@ -546,6 +567,19 @@ struct mmc_sd_status uint8_t erase_timeout; uint8_t erase_offset; }; + +struct mmc_quirk { + uint32_t mid; +#define MMC_QUIRK_MID_ANY ((uint32_t)-1) + uint16_t oid; +#define MMC_QUIRK_OID_ANY ((uint16_t)-1) + const char *pnm; + uint32_t quirks; +#define MMC_QUIRK_INAND_CMD38 0x0001 +#define MMC_QUIRK_BROKEN_TRIM 0x0002 +}; + +#define MMC_QUIRKS_FMT "\020" "\001INAND_CMD38" "\002BROKEN_TRIM" /* * Various MMC/SD constants Modified: stable/10/sys/dev/mmc/mmcsd.c ============================================================================== --- stable/10/sys/dev/mmc/mmcsd.c Fri Aug 11 00:41:19 2017 (r322388) +++ stable/10/sys/dev/mmc/mmcsd.c Fri Aug 11 00:41:43 2017 (r322389) @@ -126,6 +126,10 @@ struct mmcsd_softc { uint8_t part_curr; /* Partition currently switched to */ uint8_t ext_csd[MMC_EXTCSD_SIZE]; uint16_t rca; + uint32_t flags; +#define MMCSD_INAND_CMD38 0x0001 +#define MMCSD_USE_TRIM 0x0002 + uint32_t cmd6_time; /* Generic switch timeout [us] */ uint32_t part_time; /* Partition switch timeout [us] */ off_t enh_base; /* Enhanced user data area slice base ... */ off_t enh_size; /* ... and size [bytes] */ @@ -168,9 +172,10 @@ static int mmcsd_ioctl_rpmb(struct cdev *dev, u_long c int fflag, struct thread *td); static void mmcsd_add_part(struct mmcsd_softc *sc, u_int type, - const char *name, u_int cnt, off_t media_size, off_t erase_size, bool ro); + const char *name, u_int cnt, off_t media_size, bool ro); static int mmcsd_bus_bit_width(device_t dev); static daddr_t mmcsd_delete(struct mmcsd_part *part, struct bio *bp); +static const char *mmcsd_errmsg(int e); static int mmcsd_ioctl(struct mmcsd_part *part, u_long cmd, void *data, int fflag); static int mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic, @@ -221,6 +226,7 @@ mmcsd_attach(device_t dev) off_t erase_size, sector_size, size, wp_size; uintmax_t bytes; int err, i; + uint32_t quirks; uint8_t rev; bool comp, ro; char unit[2]; @@ -239,21 +245,48 @@ mmcsd_attach(device_t dev) * place either. */ sc->max_data = mmc_get_max_data(dev); - sc->erase_sector = mmc_get_erase_sector(dev); sc->high_cap = mmc_get_high_cap(dev); sc->rca = mmc_get_rca(dev); + sc->cmd6_time = mmc_get_cmd6_timeout(dev); + quirks = mmc_get_quirks(dev); /* Only MMC >= 4.x devices support EXT_CSD. */ if (mmc_get_spec_vers(dev) >= 4) { MMCBUS_ACQUIRE_BUS(mmcbus, dev); err = mmc_send_ext_csd(mmcbus, dev, sc->ext_csd); MMCBUS_RELEASE_BUS(mmcbus, dev); - if (err != MMC_ERR_NONE) - bzero(sc->ext_csd, sizeof(sc->ext_csd)); + if (err != MMC_ERR_NONE) { + device_printf(dev, "Error reading EXT_CSD %s\n", + mmcsd_errmsg(err)); + return (ENXIO); + } } ext_csd = sc->ext_csd; + if ((quirks & MMC_QUIRK_INAND_CMD38) != 0) { + if (mmc_get_spec_vers(dev) < 4) { + device_printf(dev, + "MMC_QUIRK_INAND_CMD38 set but no EXT_CSD\n"); + return (EINVAL); + } + sc->flags |= MMCSD_INAND_CMD38; + } + /* + * EXT_CSD_SEC_FEATURE_SUPPORT_GB_CL_EN denotes support for both + * insecure and secure TRIM. + */ + if ((ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT] & + EXT_CSD_SEC_FEATURE_SUPPORT_GB_CL_EN) != 0 && + (quirks & MMC_QUIRK_BROKEN_TRIM) == 0) { + if (bootverbose) + device_printf(dev, "taking advantage of TRIM\n"); + sc->flags |= MMCSD_USE_TRIM; + sc->erase_sector = 1; + } else + sc->erase_sector = mmc_get_erase_sector(dev); + + /* * Enhanced user data area and general purpose partitions are only * supported in revision 1.4 (EXT_CSD_REV == 4) and later, the RPMB * partition in revision 1.5 (MMC v4.41, EXT_CSD_REV == 5) and later. @@ -306,8 +339,7 @@ mmcsd_attach(device_t dev) */ ro = mmc_get_read_only(dev); mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_DEFAULT, "mmcsd", - device_get_unit(dev), mmc_get_media_size(dev) * sector_size, - sc->erase_sector * sector_size, ro); + device_get_unit(dev), mmc_get_media_size(dev) * sector_size, ro); if (mmc_get_spec_vers(dev) < 3) return (0); @@ -332,11 +364,11 @@ mmcsd_attach(device_t dev) size = ext_csd[EXT_CSD_BOOT_SIZE_MULT] * MMC_BOOT_RPMB_BLOCK_SIZE; if (size > 0 && (mmcbr_get_caps(mmcbus) & MMC_CAP_BOOT_NOACC) == 0) { mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_BOOT0, - MMCSD_FMT_BOOT, 0, size, MMC_BOOT_RPMB_BLOCK_SIZE, + MMCSD_FMT_BOOT, 0, size, ro | ((ext_csd[EXT_CSD_BOOT_WP_STATUS] & EXT_CSD_BOOT_WP_STATUS_BOOT0_MASK) != 0)); mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_BOOT1, - MMCSD_FMT_BOOT, 1, size, MMC_BOOT_RPMB_BLOCK_SIZE, + MMCSD_FMT_BOOT, 1, size, ro | ((ext_csd[EXT_CSD_BOOT_WP_STATUS] & EXT_CSD_BOOT_WP_STATUS_BOOT1_MASK) != 0)); } @@ -345,7 +377,7 @@ mmcsd_attach(device_t dev) size = ext_csd[EXT_CSD_RPMB_MULT] * MMC_BOOT_RPMB_BLOCK_SIZE; if (rev >= 5 && size > 0) mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_RPMB, - MMCSD_FMT_RPMB, 0, size, MMC_BOOT_RPMB_BLOCK_SIZE, ro); + MMCSD_FMT_RPMB, 0, size, ro); if (rev <= 3 || comp == FALSE) return (0); @@ -365,8 +397,7 @@ mmcsd_attach(device_t dev) if (size == 0) continue; mmcsd_add_part(sc, EXT_CSD_PART_CONFIG_ACC_GP0 + i, - MMCSD_FMT_GP, i, size * erase_size * wp_size, - erase_size, ro); + MMCSD_FMT_GP, i, size * erase_size * wp_size, ro); } } return (0); @@ -419,7 +450,7 @@ static struct cdevsw mmcsd_rpmb_cdevsw = { static void mmcsd_add_part(struct mmcsd_softc *sc, u_int type, const char *name, u_int cnt, - off_t media_size, off_t erase_size, bool ro) + off_t media_size, bool ro) { struct make_dev_args args; device_t dev, mmcbus; @@ -482,10 +513,10 @@ mmcsd_add_part(struct mmcsd_softc *sc, u_int type, con d->d_sectorsize = mmc_get_sector_size(dev); d->d_maxsize = sc->max_data * d->d_sectorsize; d->d_mediasize = media_size; - d->d_stripesize = erase_size; + d->d_stripesize = sc->erase_sector * d->d_sectorsize; d->d_unit = cnt; d->d_flags = DISKFLAG_CANDELETE; - d->d_delmaxsize = erase_size; + d->d_delmaxsize = mmc_get_erase_sector(dev) * d->d_sectorsize; strlcpy(d->d_ident, mmc_get_card_sn_string(dev), sizeof(d->d_ident)); strlcpy(d->d_descr, mmc_get_card_id_string(dev), @@ -1151,6 +1182,8 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) struct mmcsd_softc *sc; device_t dev, mmcbus; u_int erase_sector, sz; + int err; + bool use_trim; sc = part->sc; dev = sc->dev; @@ -1159,24 +1192,46 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) block = bp->bio_pblkno; sz = part->disk->d_sectorsize; end = bp->bio_pblkno + (bp->bio_bcount / sz); - /* Coalesce with part remaining from previous request. */ - if (block > part->eblock && block <= part->eend) - block = part->eblock; - if (end >= part->eblock && end < part->eend) - end = part->eend; - /* Safe round to the erase sector boundaries. */ - erase_sector = sc->erase_sector; - start = block + erase_sector - 1; /* Round up. */ - start -= start % erase_sector; - stop = end; /* Round down. */ - stop -= end % erase_sector; - /* We can't erase an area smaller than a sector, store it for later. */ - if (start >= stop) { - part->eblock = block; - part->eend = end; - return (end); + use_trim = sc->flags & MMCSD_USE_TRIM; + if (use_trim == true) { + start = block; + stop = end; + } else { + /* Coalesce with the remainder of the previous request. */ + if (block > part->eblock && block <= part->eend) + block = part->eblock; + if (end >= part->eblock && end < part->eend) + end = part->eend; + /* Safely round to the erase sector boundaries. */ + erase_sector = sc->erase_sector; + start = block + erase_sector - 1; /* Round up. */ + start -= start % erase_sector; + stop = end; /* Round down. */ + stop -= end % erase_sector; + /* + * We can't erase an area smaller than an erase sector, so + * store it for later. + */ + if (start >= stop) { + part->eblock = block; + part->eend = end; + return (end); + } } + if ((sc->flags & MMCSD_INAND_CMD38) != 0) { + err = mmc_switch(mmcbus, dev, sc->rca, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_INAND_CMD38, use_trim == true ? + EXT_CSD_INAND_CMD38_TRIM : EXT_CSD_INAND_CMD38_ERASE, + sc->cmd6_time, true); + if (err != MMC_ERR_NONE) { + device_printf(dev, + "Setting iNAND erase command failed %s\n", + mmcsd_errmsg(err)); + return (block); + } + } + /* * Pause re-tuning so it won't interfere with the order of erase * commands. Note that these latter don't use the data lines, so @@ -1198,8 +1253,8 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { - device_printf(dev, "Setting erase start position failed %d\n", - req.cmd->error); + device_printf(dev, "Setting erase start position failed %s\n", + mmcsd_errmsg(req.cmd->error)); block = bp->bio_pblkno; goto unpause; } @@ -1218,8 +1273,8 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { - device_printf(dev, "Setting erase stop position failed %d\n", - req.cmd->error); + device_printf(dev, "Setting erase stop position failed %s\n", + mmcsd_errmsg(req.cmd->error)); block = bp->bio_pblkno; goto unpause; } @@ -1228,23 +1283,24 @@ mmcsd_delete(struct mmcsd_part *part, struct bio *bp) memset(&cmd, 0, sizeof(cmd)); req.cmd = &cmd; cmd.opcode = MMC_ERASE; - cmd.arg = 0; + cmd.arg = use_trim == true ? MMC_ERASE_TRIM : MMC_ERASE_ERASE; cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; MMCBUS_WAIT_FOR_REQUEST(mmcbus, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { - device_printf(dev, "erase err3: %d\n", req.cmd->error); - device_printf(dev, "Issuing erase command failed %d\n", - req.cmd->error); + device_printf(dev, "Issuing erase command failed %s\n", + mmcsd_errmsg(req.cmd->error)); block = bp->bio_pblkno; goto unpause; } - /* Store one of remaining parts for the next call. */ - if (bp->bio_pblkno >= part->eblock || block == start) { - part->eblock = stop; /* Predict next forward. */ - part->eend = end; - } else { - part->eblock = block; /* Predict next backward. */ - part->eend = start; + if (use_trim == false) { + /* Store one of the remaining parts for the next call. */ + if (bp->bio_pblkno >= part->eblock || block == start) { + part->eblock = stop; /* Predict next forward. */ + part->eend = end; + } else { + part->eblock = block; /* Predict next backward. */ + part->eend = start; + } } block = end; unpause: Modified: stable/10/sys/dev/mmc/mmcvar.h ============================================================================== --- stable/10/sys/dev/mmc/mmcvar.h Fri Aug 11 00:41:19 2017 (r322388) +++ stable/10/sys/dev/mmc/mmcvar.h Fri Aug 11 00:41:43 2017 (r322389) @@ -68,6 +68,8 @@ enum mmc_device_ivars { MMC_IVAR_BUS_WIDTH, MMC_IVAR_ERASE_SECTOR, MMC_IVAR_MAX_DATA, + MMC_IVAR_CMD6_TIMEOUT, + MMC_IVAR_QUIRKS, MMC_IVAR_CARD_ID_STRING, MMC_IVAR_CARD_SN_STRING, }; @@ -90,6 +92,8 @@ MMC_ACCESSOR(card_type, CARD_TYPE, int) MMC_ACCESSOR(bus_width, BUS_WIDTH, int) MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int) MMC_ACCESSOR(max_data, MAX_DATA, int) +MMC_ACCESSOR(cmd6_timeout, CMD6_TIMEOUT, u_int) +MMC_ACCESSOR(quirks, QUIRKS, u_int) MMC_ACCESSOR(card_id_string, CARD_ID_STRING, const char *) MMC_ACCESSOR(card_sn_string, CARD_SN_STRING, const char *) From owner-svn-src-all@freebsd.org Fri Aug 11 00:43:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A16EC7DA91; Fri, 11 Aug 2017 00:43:51 +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 mx1.freebsd.org (Postfix) with ESMTPS id 67C747C810; Fri, 11 Aug 2017 00:43:51 +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 v7B0ho7g087579; Fri, 11 Aug 2017 00:43:50 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7B0ho5E087578; Fri, 11 Aug 2017 00:43:50 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201708110043.v7B0ho5E087578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Fri, 11 Aug 2017 00:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r322390 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: marius X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 322390 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 00:43:51 -0000 Author: marius Date: Fri Aug 11 00:43:50 2017 New Revision: 322390 URL: https://svnweb.freebsd.org/changeset/base/322390 Log: Require explicit re@ approval for commits to stable/10, as the code freeze for 10.4-RELEASE is now in effect. Approved by: re (implicit) Modified: svnadmin/conf/approvers Modified: svnadmin/conf/approvers ============================================================================== --- svnadmin/conf/approvers Fri Aug 11 00:41:43 2017 (r322389) +++ svnadmin/conf/approvers Fri Aug 11 00:43:50 2017 (r322390) @@ -18,7 +18,7 @@ # #^head/ re #^stable/11/ re -#^stable/10/ re +^stable/10/ re ^release/ re ^releng/11.[0-1]/ (security-officer|so) ^releng/10.[0-3]/ (security-officer|so) From owner-svn-src-all@freebsd.org Fri Aug 11 03:09:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08E75D7D0C7; Fri, 11 Aug 2017 03:09: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 mx1.freebsd.org (Postfix) with ESMTPS id CA76881623; Fri, 11 Aug 2017 03:09:12 +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 v7B39C8i044251; Fri, 11 Aug 2017 03:09:12 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7B39C7d044250; Fri, 11 Aug 2017 03:09:12 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708110309.v7B39C7d044250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Aug 2017 03:09:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322391 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 322391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 03:09:13 -0000 Author: markj Date: Fri Aug 11 03:09:11 2017 New Revision: 322391 URL: https://svnweb.freebsd.org/changeset/base/322391 Log: Micro-optimize kmem_unback(). We can remove some unnecessary object radix tree lookups by using the object memq to iterate over pages in the specified range. This does not, however, eliminate the lookup needed in vm_page_free_toq() to remove each tree entry. Reviewed by: alc, kib (previous revision) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11945 Modified: head/sys/vm/vm_kern.c Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Fri Aug 11 00:43:50 2017 (r322390) +++ head/sys/vm/vm_kern.c Fri Aug 11 03:09:11 2017 (r322391) @@ -386,17 +386,19 @@ retry: void kmem_unback(vm_object_t object, vm_offset_t addr, vm_size_t size) { - vm_page_t m; - vm_offset_t i, offset; + vm_page_t m, next; + vm_offset_t end, offset; KASSERT(object == kmem_object || object == kernel_object, ("kmem_unback: only supports kernel objects.")); pmap_remove(kernel_pmap, addr, addr + size); offset = addr - VM_MIN_KERNEL_ADDRESS; + end = offset + size; VM_OBJECT_WLOCK(object); - for (i = 0; i < size; i += PAGE_SIZE) { - m = vm_page_lookup(object, atop(offset + i)); + for (m = vm_page_lookup(object, atop(offset)); offset < end; + offset += PAGE_SIZE, m = next) { + next = vm_page_next(m); vm_page_unwire(m, PQ_NONE); vm_page_free(m); } From owner-svn-src-all@freebsd.org Fri Aug 11 03:21:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 875AFD7DED8; Fri, 11 Aug 2017 03:21:41 +0000 (UTC) (envelope-from cy.schubert@komquats.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 3A77E81D92; Fri, 11 Aug 2017 03:21:40 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id g0VvdLIZNI8mCg0Vwddjuc; Thu, 10 Aug 2017 21:21:33 -0600 X-Authority-Analysis: v=2.2 cv=HahkdmM8 c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=KeKAF7QvOSUA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=xLBErZT-l1r7BnHmJr8A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 5427C8B1; Thu, 10 Aug 2017 20:21:31 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id v7B3KGAb026027; Thu, 10 Aug 2017 20:20:16 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201708110320.v7B3KGAb026027@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Peter Wemm cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322380 - in head/contrib/subversion: . subversion/include subversion/libsvn_client subversion/libsvn_fs_fs subversion/libsvn_fs_x subversion/libsvn_ra_svn subversion/libsvn_repos subve... In-Reply-To: Message from Peter Wemm of "Thu, 10 Aug 2017 22:03:26 -0000." <201708102203.v7AM3QJ7022058@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 10 Aug 2017 20:20:16 -0700 X-CMAE-Envelope: MS4wfCme+HKjTRjtFzmn5e+JCooyDMfl7l5APJc5bP8gesqn22A/cCslyim7Efg3fkGLdsI/gYkemxtLR8OOeKZo/842Qn/X1Y2obo2g+OB6pmG/0egQJA43 pTmhOtE96jckb+6LXscdTAbLE5g8Q8mXTZJahgpfKk3MWIZPsH0WbTZ45k/5pxXTxk26VMkJcaOJIdugeiBvq4fEIgMmDK1YFyH25iE+bzF6fdPqyAot8p6l Qg+mgzl3pX7XgfATK/kFLE2B+0dkQY7cKFY13uTkRlAfBHTumDw3oZROPh6QqPwv X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 03:21:41 -0000 In message <201708102203.v7AM3QJ7022058@repo.freebsd.org>, Peter Wemm writes: > Author: peter > Date: Thu Aug 10 22:03:26 2017 > New Revision: 322380 > URL: https://svnweb.freebsd.org/changeset/base/322380 > > Log: > Update subversion 1.9.5 -> 1.9.7 Cool. Thanks. I'll submit a PR or phab diff for the port... Currently build/run testing here. -- 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 Fri Aug 11 03:59:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EA10D928F6; Fri, 11 Aug 2017 03:59:50 +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 mx1.freebsd.org (Postfix) with ESMTPS id 18D6B8316C; Fri, 11 Aug 2017 03:59:50 +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 v7B3xnsq064491; Fri, 11 Aug 2017 03:59:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7B3xnl4064488; Fri, 11 Aug 2017 03:59:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708110359.v7B3xnl4064488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Aug 2017 03:59:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322392 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 322392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 03:59:50 -0000 Author: markj Date: Fri Aug 11 03:59:48 2017 New Revision: 322392 URL: https://svnweb.freebsd.org/changeset/base/322392 Log: Add a specialized function for DRM drivers to register themselves. Such drivers attach to a vgapci bus rather than directly to a pci bus. For the rest of the LinuxKPI to work correctly in this case, we override the vgapci bus' ivars with those of the grandparent. Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11932 Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h head/sys/compat/linuxkpi/common/src/linux_pci.c Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/pci.h Fri Aug 11 03:09:11 2017 (r322391) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Fri Aug 11 03:59:48 2017 (r322392) @@ -187,8 +187,14 @@ struct pci_driver { devclass_t bsdclass; struct device_driver driver; const struct pci_error_handlers *err_handler; + bool isdrm; }; +struct pci_bus { + struct pci_dev *self; + int number; +}; + extern struct list_head pci_drivers; extern struct list_head pci_devices; extern spinlock_t pci_lock; @@ -199,6 +205,7 @@ struct pci_dev { struct device dev; struct list_head links; struct pci_driver *pdrv; + struct pci_bus *bus; uint64_t dma_mask; uint16_t device; uint16_t vendor; @@ -502,8 +509,12 @@ pci_write_config_dword(struct pci_dev *pdev, int where return (0); } -extern int pci_register_driver(struct pci_driver *pdrv); -extern void pci_unregister_driver(struct pci_driver *pdrv); +int linux_pci_register_driver(struct pci_driver *pdrv); +int linux_pci_register_drm_driver(struct pci_driver *pdrv); +void linux_pci_unregister_driver(struct pci_driver *pdrv); + +#define pci_register_driver(pdrv) linux_pci_register_driver(pdrv) +#define pci_unregister_driver(pdrv) linux_pci_unregister_driver(pdrv) struct msix_entry { int entry; Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Fri Aug 11 03:09:11 2017 (r322391) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Fri Aug 11 03:59:48 2017 (r322392) @@ -118,17 +118,29 @@ static int linux_pci_attach(device_t dev) { struct resource_list_entry *rle; + struct pci_bus *pbus; struct pci_dev *pdev; struct pci_devinfo *dinfo; struct pci_driver *pdrv; const struct pci_device_id *id; + device_t parent; + devclass_t devclass; int error; - dinfo = device_get_ivars(dev); - linux_set_current(curthread); + pdrv = linux_pci_find(dev, &id); pdev = device_get_softc(dev); + + parent = device_get_parent(dev); + devclass = device_get_devclass(parent); + if (pdrv->isdrm) { + dinfo = device_get_ivars(parent); + device_set_ivars(dev, dinfo); + } else { + dinfo = device_get_ivars(dev); + } + pdev->dev.parent = &linux_root_device; pdev->dev.bsddev = dev; INIT_LIST_HEAD(&pdev->dev.irqents); @@ -151,6 +163,13 @@ linux_pci_attach(device_t dev) else pdev->dev.irq = LINUX_IRQ_INVALID; pdev->irq = pdev->dev.irq; + + if (pdev->bus == NULL) { + pbus = malloc(sizeof(*pbus), M_DEVBUF, M_WAITOK | M_ZERO); + pbus->self = pdev; + pdev->bus = pbus; + } + DROP_GIANT(); spin_lock(&pci_lock); list_add(&pdev->links, &pci_devices); @@ -246,14 +265,11 @@ linux_pci_shutdown(device_t dev) return (0); } -int -pci_register_driver(struct pci_driver *pdrv) +static int +_linux_pci_register_driver(struct pci_driver *pdrv, devclass_t dc) { - devclass_t bus; - int error = 0; + int error; - bus = devclass_find("pci"); - linux_set_current(curthread); spin_lock(&pci_lock); list_add(&pdrv->links, &pci_drivers); @@ -263,16 +279,39 @@ pci_register_driver(struct pci_driver *pdrv) pdrv->bsddriver.size = sizeof(struct pci_dev); mtx_lock(&Giant); - if (bus != NULL) { - error = devclass_add_driver(bus, &pdrv->bsddriver, - BUS_PASS_DEFAULT, &pdrv->bsdclass); - } + error = devclass_add_driver(dc, &pdrv->bsddriver, + BUS_PASS_DEFAULT, &pdrv->bsdclass); mtx_unlock(&Giant); return (-error); } +int +linux_pci_register_driver(struct pci_driver *pdrv) +{ + devclass_t dc; + + dc = devclass_find("pci"); + if (dc == NULL) + return (-ENXIO); + pdrv->isdrm = false; + return (_linux_pci_register_driver(pdrv, dc)); +} + +int +linux_pci_register_drm_driver(struct pci_driver *pdrv) +{ + devclass_t dc; + + dc = devclass_create("vgapci"); + if (dc == NULL) + return (-ENXIO); + pdrv->isdrm = true; + pdrv->name = "drmn"; + return (_linux_pci_register_driver(pdrv, dc)); +} + void -pci_unregister_driver(struct pci_driver *pdrv) +linux_pci_unregister_driver(struct pci_driver *pdrv) { devclass_t bus; From owner-svn-src-all@freebsd.org Fri Aug 11 07:27:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB9B9DC836E; Fri, 11 Aug 2017 07:27:56 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 771A864648; Fri, 11 Aug 2017 07:27:56 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7B7RtAX049464; Fri, 11 Aug 2017 07:27:55 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7B7Rt4O049463; Fri, 11 Aug 2017 07:27:55 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201708110727.v7B7Rt4O049463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Fri, 11 Aug 2017 07:27:55 +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: r322393 - stable/11/usr.sbin/bluetooth/rfcomm_pppd X-SVN-Group: stable-11 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/11/usr.sbin/bluetooth/rfcomm_pppd X-SVN-Commit-Revision: 322393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 07:27:56 -0000 Author: avos Date: Fri Aug 11 07:27:55 2017 New Revision: 322393 URL: https://svnweb.freebsd.org/changeset/base/322393 Log: MFC r322124: rfcomm_pppd.8: fix a typo (SPD -> SDP). Modified: stable/11/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 ============================================================================== --- stable/11/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 Fri Aug 11 03:59:48 2017 (r322392) +++ stable/11/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.8 Fri Aug 11 07:27:55 2017 (r322393) @@ -348,7 +348,7 @@ label. The .Nm utility in server mode will try to register the Bluetooth LAN Access Over PPP -service with the local SPD daemon. +service with the local SDP daemon. If the local SDP daemon is not running, .Nm will exit with an error. From owner-svn-src-all@freebsd.org Fri Aug 11 07:29:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E245DC848C; Fri, 11 Aug 2017 07:29:52 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 CB929647A3; Fri, 11 Aug 2017 07:29:51 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7B7ToTl049572; Fri, 11 Aug 2017 07:29:50 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7B7ToBI049571; Fri, 11 Aug 2017 07:29:50 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201708110729.v7B7ToBI049571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Fri, 11 Aug 2017 07:29: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: r322394 - stable/11/sys/amd64/cloudabi64 X-SVN-Group: stable-11 X-SVN-Commit-Author: ed X-SVN-Commit-Paths: stable/11/sys/amd64/cloudabi64 X-SVN-Commit-Revision: 322394 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 07:29:52 -0000 Author: ed Date: Fri Aug 11 07:29:50 2017 New Revision: 322394 URL: https://svnweb.freebsd.org/changeset/base/322394 Log: MFC r321924: Keep top page on CloudABI to work around AMD Ryzen stability issues. Similar to r321899, reduce sv_maxuser by one page inside of CloudABI. This ensures that the stack, the vDSO and any allocations cannot touch the top page of user virtual memory. Considering that CloudABI userspace is completely oblivious to virtual memory layout, don't bother making this conditional based on the CPU of the running system. Modified: stable/11/sys/amd64/cloudabi64/cloudabi64_sysvec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/cloudabi64/cloudabi64_sysvec.c ============================================================================== --- stable/11/sys/amd64/cloudabi64/cloudabi64_sysvec.c Fri Aug 11 07:27:55 2017 (r322393) +++ stable/11/sys/amd64/cloudabi64/cloudabi64_sysvec.c Fri Aug 11 07:29:50 2017 (r322394) @@ -199,7 +199,8 @@ static struct sysentvec cloudabi64_elf_sysvec = { .sv_coredump = elf64_coredump, .sv_pagesize = PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, - .sv_maxuser = VM_MAXUSER_ADDRESS, + /* Keep top page reserved to work around AMD Ryzen stability issues. */ + .sv_maxuser = VM_MAXUSER_ADDRESS - PAGE_SIZE, .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, .sv_copyout_strings = cloudabi64_copyout_strings, .sv_setregs = cloudabi64_proc_setregs, From owner-svn-src-all@freebsd.org Fri Aug 11 10:05:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01B60DC2918; Fri, 11 Aug 2017 10:05:43 +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 mx1.freebsd.org (Postfix) with ESMTPS id C35B06AADC; Fri, 11 Aug 2017 10:05:42 +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 v7BA5fS1015492; Fri, 11 Aug 2017 10:05:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BA5f05015491; Fri, 11 Aug 2017 10:05:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708111005.v7BA5f05015491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Aug 2017 10:05: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: r322395 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 322395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 10:05:43 -0000 Author: kib Date: Fri Aug 11 10:05:41 2017 New Revision: 322395 URL: https://svnweb.freebsd.org/changeset/base/322395 Log: MFC r322050: Relax visibility for some termios symbols. Modified: stable/11/sys/sys/_termios.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/_termios.h ============================================================================== --- stable/11/sys/sys/_termios.h Fri Aug 11 07:29:50 2017 (r322394) +++ stable/11/sys/sys/_termios.h Fri Aug 11 10:05:41 2017 (r322395) @@ -91,8 +91,10 @@ #define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */ #define IXON 0x00000200 /* enable output flow control */ #define IXOFF 0x00000400 /* enable input flow control */ -#if __BSD_VISIBLE +#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 #define IXANY 0x00000800 /* any char will restart after stop */ +#endif +#if __BSD_VISIBLE #define IMAXBEL 0x00002000 /* ring bell on input queue full */ #endif @@ -100,12 +102,16 @@ * Output flags - software output processing */ #define OPOST 0x00000001 /* enable following output processing */ -#if __BSD_VISIBLE +#if __XSI_VISIBLE #define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */ +#endif +#if __BSD_VISIBLE #define TABDLY 0x00000004 /* tab delay mask */ #define TAB0 0x00000000 /* no tab delay and expansion */ #define TAB3 0x00000004 /* expand tabs to spaces */ #define ONOEOT 0x00000008 /* discard EOT's (^D) on output) */ +#endif +#if __XSI_VISIBLE #define OCRNL 0x00000010 /* map CR to NL on output */ #define ONOCR 0x00000020 /* no CR output at column 0 */ #define ONLRET 0x00000040 /* NL performs CR function */ From owner-svn-src-all@freebsd.org Fri Aug 11 10:08:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4A5CDC2B90; Fri, 11 Aug 2017 10:08:19 +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 mx1.freebsd.org (Postfix) with ESMTPS id B39DB6ACAE; Fri, 11 Aug 2017 10:08:19 +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 v7BA8IdH015632; Fri, 11 Aug 2017 10:08:18 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BA8Inx015631; Fri, 11 Aug 2017 10:08:18 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708111008.v7BA8Inx015631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Aug 2017 10:08:18 +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: r322396 - stable/11/usr.sbin/pmcstat X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/usr.sbin/pmcstat X-SVN-Commit-Revision: 322396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 10:08:20 -0000 Author: kib Date: Fri Aug 11 10:08:18 2017 New Revision: 322396 URL: https://svnweb.freebsd.org/changeset/base/322396 Log: MFC r322059: Fix off by one in calculation of the number of buckets for the pc addresses. Modified: stable/11/usr.sbin/pmcstat/pmcpl_gprof.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/pmcstat/pmcpl_gprof.c ============================================================================== --- stable/11/usr.sbin/pmcstat/pmcpl_gprof.c Fri Aug 11 10:05:41 2017 (r322395) +++ stable/11/usr.sbin/pmcstat/pmcpl_gprof.c Fri Aug 11 10:08:18 2017 (r322396) @@ -468,8 +468,8 @@ pmcpl_gmon_process(struct pmcstat_process *pp, struct image, pmcid); pgf->pgf_pmcid = pmcid; assert(image->pi_end > image->pi_start); - pgf->pgf_nbuckets = (image->pi_end - image->pi_start) / - FUNCTION_ALIGNMENT; /* see */ + pgf->pgf_nbuckets = howmany(image->pi_end - image->pi_start, + FUNCTION_ALIGNMENT); /* see */ pgf->pgf_ndatabytes = sizeof(struct gmonhdr) + pgf->pgf_nbuckets * hc_sz; pgf->pgf_nsamples = 0; From owner-svn-src-all@freebsd.org Fri Aug 11 10:10:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10B78DC2DF5; Fri, 11 Aug 2017 10:10:16 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E33676AE32; Fri, 11 Aug 2017 10:10:15 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1129) id 226A710B93; Fri, 11 Aug 2017 10:10:15 +0000 (UTC) Date: Fri, 11 Aug 2017 10:10:15 +0000 From: Li-Wen Hsu To: Roger Pau Monn Cc: Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r322347 - in head/sys/x86: acpica include x86 xen Message-ID: <20170811101015.GA83032@freefall.freebsd.org> References: <201708100915.v7A9FIke002476@repo.freebsd.org> <20170810174853.6xzxzxscm4cmd5vy@dhcp-3-128.uk.xensource.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170810174853.6xzxzxscm4cmd5vy@dhcp-3-128.uk.xensource.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 10:10:16 -0000 On Thu, Aug 10, 2017 at 18:48:53 +0100, Roger Pau Monn wrote: > On Thu, Aug 10, 2017 at 10:20:59AM -0400, Ed Maste wrote: > > On 10 August 2017 at 05:15, Roger Pau Monné wrote: > > > Author: royger > > > Date: Thu Aug 10 09:15:18 2017 > > > New Revision: 322347 > > > URL: https://svnweb.freebsd.org/changeset/base/322347 > > > > > > Log: > > > apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase > > > > i386 is failing with: > > Thanks for the heads up! Should be fixed in r322372, will keep an eye on > the CI. It seems i386 LINT is still failing: /workspace/src/sys/x86/acpica/srat.c:446:28: error: implicit declaration of function 'PHYS_TO_DMAP' is invalid in C99 [-Werror,-Wimplicit-function-declaration] cpus = (struct cpu_info *)PHYS_TO_DMAP(addr); ^ Could you also chcek this one? https://ci.freebsd.org/job/FreeBSD-head-i386-LINT/2833/console Thanks, Li-Wen -- Li-Wen Hsu https://lwhsu.org From owner-svn-src-all@freebsd.org Fri Aug 11 10:44:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A5FBDC4F5B; Fri, 11 Aug 2017 10:44:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 073666C477; Fri, 11 Aug 2017 10:44:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BAifPR032307; Fri, 11 Aug 2017 10:44:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BAif9v032305; Fri, 11 Aug 2017 10:44:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201708111044.v7BAif9v032305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 11 Aug 2017 10:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322397 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 322397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 10:44:42 -0000 Author: hselasky Date: Fri Aug 11 10:44:40 2017 New Revision: 322397 URL: https://svnweb.freebsd.org/changeset/base/322397 Log: Make sure the "vm_flags" and "vm_page_prot" fields get set correctly in the VM area structure in the LinuxKPI when doing mmap() and that unsupported bits are masked away. While at it fix some redundant use of parenthesing inside some related macros. Found by: KrishnamRaju ErapaRaju MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/page.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/page.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/page.h Fri Aug 11 10:08:18 2017 (r322396) +++ head/sys/compat/linuxkpi/common/include/linux/page.h Fri Aug 11 10:44:40 2017 (r322397) @@ -48,38 +48,36 @@ typedef unsigned long pgprot_t; #define page vm_page -#define LINUXKPI_PROT_VALID (1 << 4) -#define LINUXKPI_CACHE_MODE_SHIFT 3 +#define LINUXKPI_PROT_VALID (1 << 3) +#define LINUXKPI_CACHE_MODE_SHIFT 4 +CTASSERT((VM_PROT_ALL & -LINUXKPI_PROT_VALID) == 0); + static inline pgprot_t cachemode2protval(vm_memattr_t attr) { - return ((attr | LINUXKPI_PROT_VALID) << LINUXKPI_CACHE_MODE_SHIFT); + return ((attr << LINUXKPI_CACHE_MODE_SHIFT) | LINUXKPI_PROT_VALID); } static inline vm_memattr_t pgprot2cachemode(pgprot_t prot) { - int val; - - val = prot >> LINUXKPI_CACHE_MODE_SHIFT; - - if (val & LINUXKPI_PROT_VALID) - return (val & ~LINUXKPI_PROT_VALID); + if (prot & LINUXKPI_PROT_VALID) + return (prot >> LINUXKPI_CACHE_MODE_SHIFT); else return (VM_MEMATTR_DEFAULT); } -#define virt_to_page(x) PHYS_TO_VM_PAGE(vtophys((x))) -#define page_to_pfn(pp) (VM_PAGE_TO_PHYS((pp)) >> PAGE_SHIFT) +#define virt_to_page(x) PHYS_TO_VM_PAGE(vtophys(x)) +#define page_to_pfn(pp) (VM_PAGE_TO_PHYS(pp) >> PAGE_SHIFT) #define pfn_to_page(pfn) (PHYS_TO_VM_PAGE((pfn) << PAGE_SHIFT)) -#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) +#define nth_page(page,n) pfn_to_page(page_to_pfn(page) + (n)) -#define clear_page(page) memset((page), 0, PAGE_SIZE) +#define clear_page(page) memset(page, 0, PAGE_SIZE) #define pgprot_noncached(prot) \ - ((prot) | cachemode2protval(VM_MEMATTR_UNCACHEABLE)) + (((prot) & VM_PROT_ALL) | cachemode2protval(VM_MEMATTR_UNCACHEABLE)) #define pgprot_writecombine(prot) \ - ((prot) | cachemode2protval(VM_MEMATTR_WRITE_COMBINING)) + (((prot) & VM_PROT_ALL) | cachemode2protval(VM_MEMATTR_WRITE_COMBINING)) #undef PAGE_MASK #define PAGE_MASK (~(PAGE_SIZE-1)) Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Fri Aug 11 10:08:18 2017 (r322396) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Fri Aug 11 10:44:40 2017 (r322397) @@ -1210,7 +1210,7 @@ linux_dev_mmap_single(struct cdev *dev, vm_ooffset_t * vmap->vm_end = size; vmap->vm_pgoff = *offset / PAGE_SIZE; vmap->vm_pfn = 0; - vmap->vm_flags = vmap->vm_page_prot = nprot; + vmap->vm_flags = vmap->vm_page_prot = (nprot & VM_PROT_ALL); vmap->vm_ops = NULL; vmap->vm_file = get_file(filp); vmap->vm_mm = mm; From owner-svn-src-all@freebsd.org Fri Aug 11 11:38:05 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F06A1DC8288; Fri, 11 Aug 2017 11:38:05 +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 mx1.freebsd.org (Postfix) with ESMTPS id BDB976E243; Fri, 11 Aug 2017 11:38:05 +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 v7BBc474052867; Fri, 11 Aug 2017 11:38:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BBc4lw052866; Fri, 11 Aug 2017 11:38:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708111138.v7BBc4lw052866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 11 Aug 2017 11:38:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r322399 - stable/10/usr.sbin/pmcstat X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/usr.sbin/pmcstat X-SVN-Commit-Revision: 322399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 11:38:06 -0000 Author: kib Date: Fri Aug 11 11:38:04 2017 New Revision: 322399 URL: https://svnweb.freebsd.org/changeset/base/322399 Log: MFC r322059: Fix off by one in calculation of the number of buckets for the pc addresses. Approved by: re (marius) Modified: stable/10/usr.sbin/pmcstat/pmcpl_gprof.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pmcstat/pmcpl_gprof.c ============================================================================== --- stable/10/usr.sbin/pmcstat/pmcpl_gprof.c Fri Aug 11 10:59:34 2017 (r322398) +++ stable/10/usr.sbin/pmcstat/pmcpl_gprof.c Fri Aug 11 11:38:04 2017 (r322399) @@ -464,8 +464,8 @@ pmcpl_gmon_process(struct pmcstat_process *pp, struct image, pmcid); pgf->pgf_pmcid = pmcid; assert(image->pi_end > image->pi_start); - pgf->pgf_nbuckets = (image->pi_end - image->pi_start) / - FUNCTION_ALIGNMENT; /* see */ + pgf->pgf_nbuckets = howmany(image->pi_end - image->pi_start, + FUNCTION_ALIGNMENT); /* see */ pgf->pgf_ndatabytes = sizeof(struct gmonhdr) + pgf->pgf_nbuckets * hc_sz; pgf->pgf_nsamples = 0; From owner-svn-src-all@freebsd.org Fri Aug 11 12:45:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6B0EDCC8BE; Fri, 11 Aug 2017 12:45:59 +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 mx1.freebsd.org (Postfix) with ESMTPS id B617A7084A; Fri, 11 Aug 2017 12:45:59 +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 v7BCjwXP081417; Fri, 11 Aug 2017 12:45:58 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BCjwPV081416; Fri, 11 Aug 2017 12:45:58 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201708111245.v7BCjwPV081416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 11 Aug 2017 12:45:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322400 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 12:46:00 -0000 Author: andrew Date: Fri Aug 11 12:45:58 2017 New Revision: 322400 URL: https://svnweb.freebsd.org/changeset/base/322400 Log: Only return the current cpu if it's in the cpumask. When we restrict the cpumask it probably means we are unable to sent interrupts to CPUs outside the map. As such only return the current CPU when it's within the mask otherwise return the first valid CPU. This is needed on ThunderX as, in a dual socket configuration, we are unable to send MSI/MSI-X interrupts between sockets. Reviewed by: mmel Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11957 Modified: head/sys/kern/subr_intr.c Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Fri Aug 11 11:38:04 2017 (r322399) +++ head/sys/kern/subr_intr.c Fri Aug 11 12:45:58 2017 (r322400) @@ -1169,9 +1169,17 @@ intr_bind_irq(device_t dev, struct resource *res, int u_int intr_irq_next_cpu(u_int last_cpu, cpuset_t *cpumask) { + u_int cpu; - if (!irq_assign_cpu || mp_ncpus == 1) - return (PCPU_GET(cpuid)); + KASSERT(!CPU_EMPTY(cpumask), ("%s: Empty CPU mask", __func__)); + if (!irq_assign_cpu || mp_ncpus == 1) { + cpu = PCPU_GET(cpuid); + + if (CPU_ISSET(cpu, cpumask)) + return (curcpu); + + return (CPU_FFS(cpumask) - 1); + } do { last_cpu++; From owner-svn-src-all@freebsd.org Fri Aug 11 14:18:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E86B7DD1A6A; Fri, 11 Aug 2017 14:18:12 +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 mx1.freebsd.org (Postfix) with ESMTPS id C470173B65; Fri, 11 Aug 2017 14:18:12 +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 v7BEICQ7018524; Fri, 11 Aug 2017 14:18:12 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BEICB1018523; Fri, 11 Aug 2017 14:18:12 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708111418.v7BEICB1018523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 11 Aug 2017 14:18:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322401 - head X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 14:18:13 -0000 Author: gjb Date: Fri Aug 11 14:18:11 2017 New Revision: 322401 URL: https://svnweb.freebsd.org/changeset/base/322401 Log: Avoid creating kernel-dbg.txz distribution sets and kernel-debug packages when MK_DEBUG_FILES is 'no'. MFC after: 5 days Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Aug 11 12:45:58 2017 (r322400) +++ head/Makefile.inc1 Fri Aug 11 14:18:11 2017 (r322401) @@ -1493,20 +1493,24 @@ packagekernel: .PHONY @${DESTDIR}/${DISTDIR}/kernel.meta | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz .endif +.if ${MK_DEBUG_FILES} != "no" cd ${DESTDIR}/${DISTDIR}/kernel; \ tar cvf - --include '*/*/*.debug' \ @${DESTDIR}/${DISTDIR}/kernel.meta | \ ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz +.endif .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" .for _kernel in ${BUILDKERNELS:[2..-1]} cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ tar cvf - --exclude '*.debug' \ @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz +.if ${MK_DEBUG_FILES} != "no" cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ tar cvf - --include '*/*/*.debug' \ @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz +.endif .endfor .endif .else @@ -1515,17 +1519,21 @@ packagekernel: .PHONY tar cvf - --exclude '*.debug' . | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz .endif +.if ${MK_DEBUG_FILES} != "no" cd ${DESTDIR}/${DISTDIR}/kernel; \ tar cvf - --include '*/*/*.debug' $$(eval find .) | \ ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz +.endif .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" .for _kernel in ${BUILDKERNELS:[2..-1]} cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ tar cvf - --exclude '*.debug' . | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz +.if ${MK_DEBUG_FILES} != "no" cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ tar cvf - --include '*/*/*.debug' $$(eval find .) | \ ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz +.endif .endfor .endif .endif @@ -1632,7 +1640,10 @@ create-world-package-${pkgname}: .PHONY create-kernel-packages: .PHONY _default_flavor= -default .if exists(${KSTAGEDIR}/kernel.meta) -. for flavor in "" -debug +.if ${MK_DEBUG_FILES} != "no" +_debug=-debug +.endif +. for flavor in "" ${_debug} create-kernel-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},} create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap .PHONY @cd ${KSTAGEDIR}/${DISTDIR} ; \ @@ -1663,7 +1674,10 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" . for _kernel in ${BUILDKERNELS:[2..-1]} . if exists(${KSTAGEDIR}/kernel.${_kernel}.meta) -. for flavor in "" -debug +. if ${MK_DEBUG_FILES} != "no" +_debug=-debug +. endif +. for flavor in "" ${_debug} create-kernel-packages: create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel} create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel}: _pkgbootstrap .PHONY @cd ${KSTAGEDIR}/kernel.${_kernel} ; \ From owner-svn-src-all@freebsd.org Fri Aug 11 14:19:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A3F2DD1C64; Fri, 11 Aug 2017 14:19:32 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4888673D3C; Fri, 11 Aug 2017 14:19:32 +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 v7BEJV8E018607; Fri, 11 Aug 2017 14:19:31 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BEJVvF018606; Fri, 11 Aug 2017 14:19:31 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708111419.v7BEJVvF018606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 11 Aug 2017 14:19:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322402 - head X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 322402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 14:19:32 -0000 Author: gjb Date: Fri Aug 11 14:19:31 2017 New Revision: 322402 URL: https://svnweb.freebsd.org/changeset/base/322402 Log: Fix indentation from r322401. MFC after: 3 days MFC with: r322401 Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Aug 11 14:18:11 2017 (r322401) +++ head/Makefile.inc1 Fri Aug 11 14:19:31 2017 (r322402) @@ -1640,9 +1640,9 @@ create-world-package-${pkgname}: .PHONY create-kernel-packages: .PHONY _default_flavor= -default .if exists(${KSTAGEDIR}/kernel.meta) -.if ${MK_DEBUG_FILES} != "no" +. if ${MK_DEBUG_FILES} != "no" _debug=-debug -.endif +. endif . for flavor in "" ${_debug} create-kernel-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},} create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap .PHONY @@ -1674,9 +1674,9 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" . for _kernel in ${BUILDKERNELS:[2..-1]} . if exists(${KSTAGEDIR}/kernel.${_kernel}.meta) -. if ${MK_DEBUG_FILES} != "no" +. if ${MK_DEBUG_FILES} != "no" _debug=-debug -. endif +. endif . for flavor in "" ${_debug} create-kernel-packages: create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel} create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kernel}: _pkgbootstrap .PHONY From owner-svn-src-all@freebsd.org Fri Aug 11 14:19:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC3DFDD1CFA; Fri, 11 Aug 2017 14:19:56 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 7B65F73E89; Fri, 11 Aug 2017 14:19:56 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BEJtkw018665; Fri, 11 Aug 2017 14:19:55 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BEJt6O018664; Fri, 11 Aug 2017 14:19:55 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201708111419.v7BEJt6O018664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Fri, 11 Aug 2017 14:19:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322403 - head/sys/x86/acpica X-SVN-Group: head X-SVN-Commit-Author: royger X-SVN-Commit-Paths: head/sys/x86/acpica X-SVN-Commit-Revision: 322403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 14:19:56 -0000 Author: royger Date: Fri Aug 11 14:19:55 2017 New Revision: 322403 URL: https://svnweb.freebsd.org/changeset/base/322403 Log: acpi/srat: fix build without DMAP Use pmap_mapbios to map memory used to store the cpus array. Reported by: lwhsu X-MFC-with: r322348 Modified: head/sys/x86/acpica/srat.c Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Fri Aug 11 14:19:31 2017 (r322402) +++ head/sys/x86/acpica/srat.c Fri Aug 11 14:19:55 2017 (r322403) @@ -443,7 +443,12 @@ parse_srat(void) ("Not enough memory for SRAT table items")); phys_avail[idx + 1] = addr - 1; - cpus = (struct cpu_info *)PHYS_TO_DMAP(addr); + /* + * We cannot rely on PHYS_TO_DMAP because this code is also used in + * i386, so use pmap_mapbios to map the memory, this will end up using + * the default memory attribute (WB), and the DMAP when available. + */ + cpus = (struct cpu_info *)pmap_mapbios(addr, size); /* * Make a pass over the table to populate the cpus[] and @@ -529,6 +534,10 @@ srat_set_cpus(void *dummy) printf("SRAT: CPU %u has memory domain %d\n", i, cpu->domain); } + + /* Last usage of the cpus array, unmap it. */ + pmap_unmapdev((vm_offset_t)cpus, sizeof(*cpus) * (max_apic_id + 1)); + cpus = NULL; } SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL); From owner-svn-src-all@freebsd.org Fri Aug 11 14:28:27 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12091DD26C0; Fri, 11 Aug 2017 14:28:27 +0000 (UTC) (envelope-from royger@gmail.com) Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 95FC57468B; Fri, 11 Aug 2017 14:28:26 +0000 (UTC) (envelope-from royger@gmail.com) Received: by mail-wm0-x22a.google.com with SMTP id f15so48865181wmg.1; Fri, 11 Aug 2017 07:28:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=5pRxAOR7Osl0Y7dfH0e8K1pNpFiMM9PFYhGps8kliwc=; b=ItEoEYmPKrXzq9JJAu3zfngi7kKRmeSOyotaMiV/1s/dWWWpIUC7TXxGxs6hIDh4gc aeUFP7xVIq4bMgJIwN3uwv4hahQ3HOwcsA47vgsaIhipTriDI9F+HKQYczLgD6cFmC/q rH3H9sQZWKBB20magvs59x7KkEUgtc98chTG3e2uudAZb3AQDNncBjlxyBB1TKX23ufK ZGb7jmcVwJzxV6fqlpcQg8biptQSWkiqZf2DhtS2AKVS7s3p9wt5Qp6SBEwhI87tQGny J9dVKW2dfdsn1L3YrvEaA+F2PjaWBNegHcDcVS+Na4hrawzs1UsYl4NhEh73z8yzdM0w kB7g== 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 :content-transfer-encoding:in-reply-to:user-agent; bh=5pRxAOR7Osl0Y7dfH0e8K1pNpFiMM9PFYhGps8kliwc=; b=Icq985iExbrkLFdNlhvUtJCE5kJicxW5L9fH9mMm4bnbVPYMCh599QZIK2ooI7xFpW ZtmSJkW/FE5JXOoiLczfWIc1Tb/oEr3KYLI+jsHo/tgh7/As67Aa6sUwAHylr7L5vrpo TMoMZfXXbmYyg+2LTSTT/BDFP2qUqsYpyVdZA5R+PQDgpzQYbScGC2gr+rbUXVOVLyU3 LUjajncbeEH5ZfSbBcH4v76BRV2IrSutIwqrwUCNjAloF5Ll20r8Y6y19Z4LqZbVkSC4 hoBeXUAxP52f4lGe1kgIH/mXhozQEOK7bt34VMszWx82N+7F8vbGKQi8wZsnC7D8/dY3 Lsqw== X-Gm-Message-State: AHYfb5jUKRGYgFFDa0jVZqfyOnXiIRT799/Rb2ldQBB4GZWezfMmvjV0 Fhwt04DXOV7iklyp X-Received: by 10.80.241.66 with SMTP id z2mr15688245edl.21.1502461704938; Fri, 11 Aug 2017 07:28:24 -0700 (PDT) Received: from localhost (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id g44sm743299edc.27.2017.08.11.07.28.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Aug 2017 07:28:22 -0700 (PDT) Sender: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Date: Fri, 11 Aug 2017 15:28:17 +0100 From: Roger Pau Monn To: Li-Wen Hsu Cc: Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r322347 - in head/sys/x86: acpica include x86 xen Message-ID: <20170811142817.vdcz5pzn45zild55@dhcp-3-128.uk.xensource.com> References: <201708100915.v7A9FIke002476@repo.freebsd.org> <20170810174853.6xzxzxscm4cmd5vy@dhcp-3-128.uk.xensource.com> <20170811101015.GA83032@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170811101015.GA83032@freefall.freebsd.org> User-Agent: NeoMutt/20170714 (1.8.3) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 14:28:27 -0000 On Fri, Aug 11, 2017 at 10:10:15AM +0000, Li-Wen Hsu wrote: > On Thu, Aug 10, 2017 at 18:48:53 +0100, Roger Pau Monn wrote: > > On Thu, Aug 10, 2017 at 10:20:59AM -0400, Ed Maste wrote: > > > On 10 August 2017 at 05:15, Roger Pau Monné wrote: > > > > Author: royger > > > > Date: Thu Aug 10 09:15:18 2017 > > > > New Revision: 322347 > > > > URL: https://svnweb.freebsd.org/changeset/base/322347 > > > > > > > > Log: > > > > apic_enumerator: only set mp_ncpus and mp_maxid at probe cpus phase > > > > > > i386 is failing with: > > > > Thanks for the heads up! Should be fixed in r322372, will keep an eye on > > the CI. > > It seems i386 LINT is still failing: > > /workspace/src/sys/x86/acpica/srat.c:446:28: error: implicit declaration of function 'PHYS_TO_DMAP' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > cpus = (struct cpu_info *)PHYS_TO_DMAP(addr); > ^ > > Could you also chcek this one? https://ci.freebsd.org/job/FreeBSD-head-i386-LINT/2833/console Sorry again for the breakage, should be fixed in r322403. Not sure if it makes much sense to parse the SRAT on i386 anyway. Roger. From owner-svn-src-all@freebsd.org Fri Aug 11 16:27:55 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1D8DDD94BF; Fri, 11 Aug 2017 16:27:55 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FA0A7CBC0; Fri, 11 Aug 2017 16:27:55 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BGRs44072576; Fri, 11 Aug 2017 16:27:54 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BGRsa7072575; Fri, 11 Aug 2017 16:27:54 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201708111627.v7BGRsa7072575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Fri, 11 Aug 2017 16:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322404 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 16:27:55 -0000 Author: alc Date: Fri Aug 11 16:27:54 2017 New Revision: 322404 URL: https://svnweb.freebsd.org/changeset/base/322404 Log: An invalid page can't be dirty. Reviewed by: kib MFC after: 1 week Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Fri Aug 11 14:19:55 2017 (r322403) +++ head/sys/kern/kern_sendfile.c Fri Aug 11 16:27:54 2017 (r322404) @@ -355,7 +355,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o &a)) { pmap_zero_page(pa[i]); pa[i]->valid = VM_PAGE_BITS_ALL; - pa[i]->dirty = 0; + MPASS(pa[i]->dirty == 0); vm_page_xunbusy(pa[i]); i++; continue; From owner-svn-src-all@freebsd.org Fri Aug 11 16:29:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A98ADD95F9; Fri, 11 Aug 2017 16:29: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 mx1.freebsd.org (Postfix) with ESMTPS id 1655E7CD30; Fri, 11 Aug 2017 16:29:24 +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 v7BGTNxA072671; Fri, 11 Aug 2017 16:29:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BGTMpO072666; Fri, 11 Aug 2017 16:29:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708111629.v7BGTMpO072666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Aug 2017 16:29:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322405 - in head/sys: kern sparc64/sparc64 vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern sparc64/sparc64 vm X-SVN-Commit-Revision: 322405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 16:29:24 -0000 Author: markj Date: Fri Aug 11 16:29:22 2017 New Revision: 322405 URL: https://svnweb.freebsd.org/changeset/base/322405 Log: Modify vm_page_grab_pages() to handle VM_ALLOC_NOWAIT. This will allow its use in sendfile_swapin(). Reviewed by: alc, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11942 Modified: head/sys/kern/vfs_bio.c head/sys/sparc64/sparc64/pmap.c head/sys/vm/vm_glue.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Fri Aug 11 16:27:54 2017 (r322404) +++ head/sys/kern/vfs_bio.c Fri Aug 11 16:29:22 2017 (r322405) @@ -2746,7 +2746,7 @@ vfs_vmio_extend(struct buf *bp, int desiredpages, int * deadlocks once allocbuf() is called after * pages are vfs_busy_pages(). */ - vm_page_grab_pages(obj, + (void)vm_page_grab_pages(obj, OFF_TO_IDX(bp->b_offset) + bp->b_npages, VM_ALLOC_SYSTEM | VM_ALLOC_IGN_SBUSY | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED, Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Fri Aug 11 16:27:54 2017 (r322404) +++ head/sys/sparc64/sparc64/pmap.c Fri Aug 11 16:29:22 2017 (r322405) @@ -1248,7 +1248,7 @@ pmap_pinit(pmap_t pm) CPU_ZERO(&pm->pm_active); VM_OBJECT_WLOCK(pm->pm_tsb_obj); - vm_page_grab_pages(pm->pm_tsb_obj, 0, VM_ALLOC_NORMAL | + (void)vm_page_grab_pages(pm->pm_tsb_obj, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED | VM_ALLOC_ZERO, ma, TSB_PAGES); VM_OBJECT_WUNLOCK(pm->pm_tsb_obj); for (i = 0; i < TSB_PAGES; i++) Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Fri Aug 11 16:27:54 2017 (r322404) +++ head/sys/vm/vm_glue.c Fri Aug 11 16:29:22 2017 (r322405) @@ -391,7 +391,7 @@ vm_thread_new(struct thread *td, int pages) * page of stack. */ VM_OBJECT_WLOCK(ksobj); - vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | + (void)vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED, ma, pages); for (i = 0; i < pages; i++) ma[i]->valid = VM_PAGE_BITS_ALL; @@ -568,7 +568,7 @@ vm_thread_swapin(struct thread *td) pages = td->td_kstack_pages; ksobj = td->td_kstack_obj; VM_OBJECT_WLOCK(ksobj); - vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_WIRED, ma, + (void)vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_WIRED, ma, pages); for (int i = 0; i < pages;) { int j, a, count, rv; Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Aug 11 16:27:54 2017 (r322404) +++ head/sys/vm/vm_page.c Fri Aug 11 16:29:22 2017 (r322405) @@ -3173,13 +3173,15 @@ retrylookup: * optional allocation flags: * VM_ALLOC_IGN_SBUSY do not sleep on soft busy pages * VM_ALLOC_NOBUSY do not exclusive busy the page + * VM_ALLOC_NOWAIT do not sleep * VM_ALLOC_SBUSY set page to sbusy state * VM_ALLOC_WIRED wire the pages * VM_ALLOC_ZERO zero and validate any invalid pages * - * This routine may sleep. + * If VM_ALLOC_NOWAIT is not specified, this routine may sleep. Otherwise, it + * may return a partial prefix of the requested range. */ -void +int vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, vm_page_t *ma, int count) { @@ -3197,7 +3199,7 @@ vm_page_grab_pages(vm_object_t object, vm_pindex_t pin (allocflags & VM_ALLOC_IGN_SBUSY) != 0, ("vm_page_grab_pages: VM_ALLOC_SBUSY/IGN_SBUSY mismatch")); if (count == 0) - return; + return (0); i = 0; retrylookup: m = vm_page_lookup(object, pindex + i); @@ -3206,6 +3208,8 @@ retrylookup: sleep = (allocflags & VM_ALLOC_IGN_SBUSY) != 0 ? vm_page_xbusied(m) : vm_page_busied(m); if (sleep) { + if ((allocflags & VM_ALLOC_NOWAIT) != 0) + break; /* * Reference the page before unlocking and * sleeping so that the page daemon is less @@ -3233,6 +3237,8 @@ retrylookup: m = vm_page_alloc(object, pindex + i, (allocflags & ~VM_ALLOC_IGN_SBUSY) | VM_ALLOC_COUNT(count - i)); if (m == NULL) { + if ((allocflags & VM_ALLOC_NOWAIT) != 0) + break; VM_OBJECT_WUNLOCK(object); VM_WAIT; VM_OBJECT_WLOCK(object); @@ -3247,6 +3253,7 @@ retrylookup: ma[i] = m; m = vm_page_next(m); } + return (i); } /* Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Fri Aug 11 16:27:54 2017 (r322404) +++ head/sys/vm/vm_page.h Fri Aug 11 16:29:22 2017 (r322405) @@ -419,7 +419,7 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); #define VM_ALLOC_IGN_SBUSY 0x1000 /* (gp) Ignore shared busy flag */ #define VM_ALLOC_NODUMP 0x2000 /* (ag) don't include in dump */ #define VM_ALLOC_SBUSY 0x4000 /* (acgp) Shared busy the page */ -#define VM_ALLOC_NOWAIT 0x8000 /* (g) Do not sleep, return NULL */ +#define VM_ALLOC_NOWAIT 0x8000 /* (gp) Do not sleep */ #define VM_ALLOC_COUNT_SHIFT 16 #define VM_ALLOC_COUNT(count) ((count) << VM_ALLOC_COUNT_SHIFT) @@ -470,7 +470,7 @@ vm_page_t vm_page_alloc_contig(vm_object_t object, vm_ vm_paddr_t boundary, vm_memattr_t memattr); vm_page_t vm_page_alloc_freelist(int, int); vm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int); -void vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, +int vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, vm_page_t *ma, int count); int vm_page_try_to_free (vm_page_t); void vm_page_deactivate (vm_page_t); From owner-svn-src-all@freebsd.org Fri Aug 11 16:32:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A22BDD99DB; Fri, 11 Aug 2017 16:32:26 +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 mx1.freebsd.org (Postfix) with ESMTPS id DCACF7D21F; Fri, 11 Aug 2017 16:32:25 +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 v7BGWPWF076375; Fri, 11 Aug 2017 16:32:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BGWPMN076374; Fri, 11 Aug 2017 16:32:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708111632.v7BGWPMN076374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Aug 2017 16:32:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322406 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 16:32:26 -0000 Author: markj Date: Fri Aug 11 16:32:24 2017 New Revision: 322406 URL: https://svnweb.freebsd.org/changeset/base/322406 Log: Have sendfile_swapin() use vm_page_grab_pages(). Reviewed by: alc, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11942 Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Fri Aug 11 16:29:22 2017 (r322405) +++ head/sys/kern/kern_sendfile.c Fri Aug 11 16:32:24 2017 (r322406) @@ -309,7 +309,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o int npages, int rhpages, int flags) { vm_page_t *pa = sfio->pa; - int nios; + int grabbed, nios; nios = 0; flags = (flags & SF_NODISKIO) ? VM_ALLOC_NOWAIT : 0; @@ -319,14 +319,14 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o * only required pages. Readahead pages are dealt with later. */ VM_OBJECT_WLOCK(obj); - for (int i = 0; i < npages; i++) { - pa[i] = vm_page_grab(obj, OFF_TO_IDX(vmoff(i, off)), - VM_ALLOC_WIRED | VM_ALLOC_NORMAL | flags); - if (pa[i] == NULL) { - npages = i; - rhpages = 0; - break; - } + + grabbed = vm_page_grab_pages(obj, OFF_TO_IDX(off), + VM_ALLOC_NORMAL | VM_ALLOC_WIRED | flags, pa, npages); + if (grabbed < npages) { + for (int i = grabbed; i < npages; i++) + pa[i] = NULL; + npages = grabbed; + rhpages = 0; } for (int i = 0; i < npages;) { From owner-svn-src-all@freebsd.org Fri Aug 11 17:05:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BAEDDDBD29; Fri, 11 Aug 2017 17:05:32 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 3801A7EEA2; Fri, 11 Aug 2017 17:05:32 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BH5V3Z088967; Fri, 11 Aug 2017 17:05:31 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BH5V7r088966; Fri, 11 Aug 2017 17:05:31 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708111705.v7BH5V7r088966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Fri, 11 Aug 2017 17:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322407 - head/sys/libkern/x86 X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/libkern/x86 X-SVN-Commit-Revision: 322407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 17:05:32 -0000 Author: rlibby Date: Fri Aug 11 17:05:31 2017 New Revision: 322407 URL: https://svnweb.freebsd.org/changeset/base/322407 Log: x86/crc32_sse42.c: quiet unused function warning Reviewed by: cem Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11980 Modified: head/sys/libkern/x86/crc32_sse42.c Modified: head/sys/libkern/x86/crc32_sse42.c ============================================================================== --- head/sys/libkern/x86/crc32_sse42.c Fri Aug 11 16:32:24 2017 (r322406) +++ head/sys/libkern/x86/crc32_sse42.c Fri Aug 11 17:05:31 2017 (r322407) @@ -52,19 +52,21 @@ _mm_crc32_u8(uint32_t x, uint8_t y) return (x); } -static __inline uint32_t -_mm_crc32_u32(uint32_t x, uint32_t y) -{ - __asm("crc32l %1,%0" : "+r" (x) : "r" (y)); - return (x); -} - +#ifdef __amd64__ static __inline uint64_t _mm_crc32_u64(uint64_t x, uint64_t y) { __asm("crc32q %1,%0" : "+r" (x) : "r" (y)); return (x); } +#else +static __inline uint32_t +_mm_crc32_u32(uint32_t x, uint32_t y) +{ + __asm("crc32l %1,%0" : "+r" (x) : "r" (y)); + return (x); +} +#endif /* CRC-32C (iSCSI) polynomial in reversed bit order. */ #define POLY 0x82f63b78 From owner-svn-src-all@freebsd.org Fri Aug 11 17:43:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAE7CDDDE87; Fri, 11 Aug 2017 17:43:26 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 71D7D80432; Fri, 11 Aug 2017 17:43:26 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BHhPuh005448; Fri, 11 Aug 2017 17:43:25 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BHhPET005443; Fri, 11 Aug 2017 17:43:25 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201708111743.v7BHhPET005443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Fri, 11 Aug 2017 17:43:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322408 - in head/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Group: head X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: in head/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe X-SVN-Commit-Revision: 322408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 17:43:26 -0000 Author: davidcs Date: Fri Aug 11 17:43:25 2017 New Revision: 322408 URL: https://svnweb.freebsd.org/changeset/base/322408 Log: Performance enhancements to reduce CPU utililization for large number of TCP connections (order of tens of thousands), with predominantly Transmits. Choice to perform receive operations either in IThread or Taskqueue Thread. Submitted by:Vaishali.Kulkarni@cavium.com MFC after:5 days Modified: head/sys/dev/qlnx/qlnxe/qlnx_def.h head/sys/dev/qlnx/qlnxe/qlnx_os.c head/sys/dev/qlnx/qlnxe/qlnx_ver.h head/sys/modules/qlnx/qlnxe/Makefile Modified: head/sys/dev/qlnx/qlnxe/qlnx_def.h ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_def.h Fri Aug 11 17:05:31 2017 (r322407) +++ head/sys/dev/qlnx/qlnxe/qlnx_def.h Fri Aug 11 17:43:25 2017 (r322408) @@ -50,9 +50,10 @@ struct qlnx_ivec { typedef struct qlnx_ivec qlnx_ivec_t; -//#define QLNX_MAX_RSS 30 -#define QLNX_MAX_RSS 16 -#define QLNX_MAX_TC 1 +//#define QLNX_MAX_RSS 30 +#define QLNX_MAX_RSS 36 +#define QLNX_DEFAULT_RSS 16 +#define QLNX_MAX_TC 1 enum QLNX_STATE { QLNX_STATE_CLOSED, @@ -201,6 +202,17 @@ struct qlnx_fastpath { uint64_t tx_pkts_freed; uint64_t tx_pkts_transmitted; uint64_t tx_pkts_completed; + uint64_t tx_tso_pkts; + uint64_t tx_non_tso_pkts; + +#ifdef QLNX_TRACE_PERF_DATA + uint64_t tx_pkts_trans_ctx; + uint64_t tx_pkts_compl_ctx; + uint64_t tx_pkts_trans_fp; + uint64_t tx_pkts_compl_fp; + uint64_t tx_pkts_compl_intr; +#endif + uint64_t tx_lso_wnd_min_len; uint64_t tx_defrag; uint64_t tx_nsegs_gt_elem_left; @@ -209,6 +221,13 @@ struct qlnx_fastpath { uint32_t tx_tso_max_pkt_len; uint32_t tx_tso_min_pkt_len; uint64_t tx_pkts[QLNX_FP_MAX_SEGS]; + +#ifdef QLNX_TRACE_PERF_DATA + uint64_t tx_pkts_hist[QLNX_FP_MAX_SEGS]; + uint64_t tx_comInt[QLNX_FP_MAX_SEGS]; + uint64_t tx_pkts_q[QLNX_FP_MAX_SEGS]; +#endif + uint64_t err_tx_nsegs_gt_elem_left; uint64_t err_tx_dmamap_create; uint64_t err_tx_defrag_dmamap_load; @@ -301,8 +320,13 @@ typedef struct qlnx_link_output qlnx_link_output_t; #define QLNX_MFW_VERSION_LENGTH 32 #define QLNX_STORMFW_VERSION_LENGTH 32 -#define QLNX_TX_ELEM_RESERVE 2 +#define QLNX_TX_ELEM_RESERVE 2 +#define QLNX_TX_ELEM_THRESH 128 +#define QLNX_TX_ELEM_MAX_THRESH 512 +#define QLNX_TX_ELEM_MIN_THRESH 32 +#define QLNX_TX_COMPL_THRESH 32 + #define QLNX_TPA_MAX_AGG_BUFFERS (20) #define QLNX_MAX_NUM_MULTICAST_ADDRS ECORE_MAX_MC_ADDRS @@ -454,6 +478,7 @@ struct qlnx_host { qlnx_storm_stats_t storm_stats[QLNX_STORM_STATS_TOTAL]; uint32_t storm_stats_index; uint32_t storm_stats_enable; + uint32_t storm_stats_gather; uint32_t personality; }; @@ -470,8 +495,11 @@ typedef struct qlnx_host qlnx_host_t; #define QLNX_MAX_MTU 9000 #define QLNX_MAX_SEGMENTS_NON_TSO (ETH_TX_MAX_BDS_PER_NON_LSO_PACKET - 1) -#define QLNX_MAX_TSO_FRAME_SIZE ((64 * 1024 - 1) + 22) +//#define QLNX_MAX_TSO_FRAME_SIZE ((64 * 1024 - 1) + 22) +#define QLNX_MAX_TSO_FRAME_SIZE 65536 +#define QLNX_MAX_TX_MBUF_SIZE 65536 /* bytes - bd_len = 16bits */ + #define QL_MAC_CMP(mac1, mac2) \ ((((*(uint32_t *) mac1) == (*(uint32_t *) mac2) && \ (*(uint16_t *)(mac1 + 4)) == (*(uint16_t *)(mac2 + 4)))) ? 0 : 1) @@ -702,6 +730,18 @@ extern void qlnx_fill_link(struct ecore_hwfn *hwfn, #define CQE_HAS_VLAN(flags) \ ((flags) & (PARSING_AND_ERR_FLAGS_TAG8021QEXIST_MASK \ << PARSING_AND_ERR_FLAGS_TAG8021QEXIST_SHIFT)) + +#if defined(__i386__) || defined(__amd64__) + +static __inline +void prefetch(void *x) +{ + __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); +} + +#else +#define prefetch(x) +#endif #endif /* #ifndef _QLNX_DEF_H_ */ Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_os.c Fri Aug 11 17:05:31 2017 (r322407) +++ head/sys/dev/qlnx/qlnxe/qlnx_os.c Fri Aug 11 17:43:25 2017 (r322408) @@ -94,6 +94,8 @@ static int qlnx_get_ifq_snd_maxlen(qlnx_host_t *ha); static uint32_t qlnx_get_optics(qlnx_host_t *ha, struct qlnx_link_output *if_link); static int qlnx_transmit(struct ifnet *ifp, struct mbuf *mp); +static int qlnx_transmit_locked(struct ifnet *ifp, struct qlnx_fastpath *fp, + struct mbuf *mp); static void qlnx_qflush(struct ifnet *ifp); static int qlnx_alloc_parent_dma_tag(qlnx_host_t *ha); @@ -133,6 +135,8 @@ static void qlnx_timer(void *arg); static int qlnx_alloc_tx_br(qlnx_host_t *ha, struct qlnx_fastpath *fp); static void qlnx_free_tx_br(qlnx_host_t *ha, struct qlnx_fastpath *fp); static void qlnx_trigger_dump(qlnx_host_t *ha); +static uint16_t qlnx_num_tx_compl(qlnx_host_t *ha, struct qlnx_fastpath *fp, + struct qlnx_tx_queue *txq); static void qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, struct qlnx_tx_queue *txq); static int qlnx_rx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, int budget, @@ -215,6 +219,12 @@ char qlnx_name_str[NAME_SIZE]; #define QLOGIC_PCI_DEVICE_ID_8070 0x8070 #endif +SYSCTL_NODE(_hw, OID_AUTO, qlnxe, CTLFLAG_RD, 0, "qlnxe driver parameters"); +/* Number of Queues: 0 (Auto) or 1 to 32 (fixed queue number) */ +static int qlnxe_queue_count = QLNX_DEFAULT_RSS; +SYSCTL_INT(_hw_qlnxe, OID_AUTO, queue_count, CTLFLAG_RDTUN, + &qlnxe_queue_count, 0, "Multi-Queue queue count"); + static int qlnx_valid_device(device_t dev) { @@ -302,7 +312,26 @@ qlnx_pci_probe(device_t dev) return (BUS_PROBE_DEFAULT); } +static uint16_t +qlnx_num_tx_compl(qlnx_host_t *ha, struct qlnx_fastpath *fp, + struct qlnx_tx_queue *txq) +{ + u16 hw_bd_cons; + u16 ecore_cons_idx; + uint16_t diff; + hw_bd_cons = le16toh(*txq->hw_cons_ptr); + + ecore_cons_idx = ecore_chain_get_cons_idx(&txq->tx_pbl); + if (hw_bd_cons < ecore_cons_idx) { + diff = (1 << 16) - (ecore_cons_idx - hw_bd_cons); + } else { + diff = hw_bd_cons - ecore_cons_idx; + } + return diff; +} + + static void qlnx_sp_intr(void *arg) { @@ -395,14 +424,11 @@ qlnx_fp_taskqueue(void *context, int pending) struct qlnx_fastpath *fp; qlnx_host_t *ha; struct ifnet *ifp; - struct mbuf *mp; - int ret = -1; - struct thread *cthread; #ifdef QLNX_RCV_IN_TASKQ int lro_enable; int rx_int = 0, total_rx_count = 0; - + struct thread *cthread; #endif /* #ifdef QLNX_RCV_IN_TASKQ */ fp = context; @@ -410,6 +436,12 @@ qlnx_fp_taskqueue(void *context, int pending) if (fp == NULL) return; + ha = (qlnx_host_t *)fp->edev; + + ifp = ha->ifp; + +#ifdef QLNX_RCV_IN_TASKQ + cthread = curthread; thread_lock(cthread); @@ -419,112 +451,81 @@ qlnx_fp_taskqueue(void *context, int pending) thread_unlock(cthread); - ha = (qlnx_host_t *)fp->edev; + lro_enable = ifp->if_capenable & IFCAP_LRO; - ifp = ha->ifp; + rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); -#ifdef QLNX_RCV_IN_TASKQ - { - lro_enable = ifp->if_capenable & IFCAP_LRO; + if (rx_int) { + fp->rx_pkts += rx_int; + total_rx_count += rx_int; + } - rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, lro_enable); - - if (rx_int) { - fp->rx_pkts += rx_int; - total_rx_count += rx_int; - } - #ifdef QLNX_SOFT_LRO - { - struct lro_ctrl *lro; - - lro = &fp->rxq->lro; + { + struct lro_ctrl *lro; - if (lro_enable && total_rx_count) { + lro = &fp->rxq->lro; + if (lro_enable && total_rx_count) { + #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) - if (ha->dbg_trace_lro_cnt) { - if (lro->lro_mbuf_count & ~1023) - fp->lro_cnt_1024++; - else if (lro->lro_mbuf_count & ~511) - fp->lro_cnt_512++; - else if (lro->lro_mbuf_count & ~255) - fp->lro_cnt_256++; - else if (lro->lro_mbuf_count & ~127) - fp->lro_cnt_128++; - else if (lro->lro_mbuf_count & ~63) - fp->lro_cnt_64++; - } - tcp_lro_flush_all(lro); + if (ha->dbg_trace_lro_cnt) { + if (lro->lro_mbuf_count & ~1023) + fp->lro_cnt_1024++; + else if (lro->lro_mbuf_count & ~511) + fp->lro_cnt_512++; + else if (lro->lro_mbuf_count & ~255) + fp->lro_cnt_256++; + else if (lro->lro_mbuf_count & ~127) + fp->lro_cnt_128++; + else if (lro->lro_mbuf_count & ~63) + fp->lro_cnt_64++; + } + tcp_lro_flush_all(lro); #else - struct lro_entry *queued; + struct lro_entry *queued; - while ((!SLIST_EMPTY(&lro->lro_active))) { - queued = SLIST_FIRST(&lro->lro_active); - SLIST_REMOVE_HEAD(&lro->lro_active, next); - tcp_lro_flush(lro, queued); - } -#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ + while ((!SLIST_EMPTY(&lro->lro_active))) { + queued = SLIST_FIRST(&lro->lro_active); + SLIST_REMOVE_HEAD(&lro->lro_active, next); + tcp_lro_flush(lro, queued); } +#endif /* #if (__FreeBSD_version >= 1100101) || (defined QLNX_QSORT_LRO) */ } + } #endif /* #ifdef QLNX_SOFT_LRO */ - ecore_sb_update_sb_idx(fp->sb_info); - rmb(); - } + ecore_sb_update_sb_idx(fp->sb_info); + rmb(); #endif /* #ifdef QLNX_RCV_IN_TASKQ */ - mtx_lock(&fp->tx_mtx); + if(ifp->if_drv_flags & IFF_DRV_RUNNING) { - if (((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) || (!ha->link_up)) { + if (!drbr_empty(ifp, fp->tx_br)) { - mtx_unlock(&fp->tx_mtx); - goto qlnx_fp_taskqueue_exit; - } + if(mtx_trylock(&fp->tx_mtx)) { - mp = drbr_peek(ifp, fp->tx_br); +#ifdef QLNX_TRACE_PERF_DATA + tx_pkts = fp->tx_pkts_transmitted; + tx_compl = fp->tx_pkts_completed; +#endif - while (mp != NULL) { + qlnx_transmit_locked(ifp, fp, NULL); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - ret = qlnx_send(ha, fp, &mp); - } else { - ret = -1; - } - - if (ret) { - - if (mp != NULL) { - drbr_putback(ifp, fp->tx_br, mp); - } else { - fp->tx_pkts_processed++; - drbr_advance(ifp, fp->tx_br); +#ifdef QLNX_TRACE_PERF_DATA + fp->tx_pkts_trans_fp += + (fp->tx_pkts_transmitted - tx_pkts); + fp->tx_pkts_compl_fp += + (fp->tx_pkts_completed - tx_compl); +#endif + mtx_unlock(&fp->tx_mtx); } - - mtx_unlock(&fp->tx_mtx); - - goto qlnx_fp_taskqueue_exit; - - } else { - drbr_advance(ifp, fp->tx_br); - fp->tx_pkts_transmitted++; - fp->tx_pkts_processed++; } - - if (fp->tx_ring_full) - break; - - mp = drbr_peek(ifp, fp->tx_br); } - mtx_unlock(&fp->tx_mtx); - -qlnx_fp_taskqueue_exit: - #ifdef QLNX_RCV_IN_TASKQ if (rx_int) { if (fp->fp_taskqueue != NULL) @@ -537,7 +538,7 @@ qlnx_fp_taskqueue_exit: } #endif /* #ifdef QLNX_RCV_IN_TASKQ */ - QL_DPRINT2(ha, "exit ret = %d\n", ret); + QL_DPRINT2(ha, "exit \n"); return; } @@ -611,6 +612,17 @@ qlnx_drain_fp_taskqueues(qlnx_host_t *ha) return; } +static void +qlnx_get_params(qlnx_host_t *ha) +{ + if ((qlnxe_queue_count < 0) || (qlnxe_queue_count > QLNX_MAX_RSS)) { + device_printf(ha->pci_dev, "invalid queue_count value (%d)\n", + qlnxe_queue_count); + qlnxe_queue_count = 0; + } + return; +} + /* * Name: qlnx_pci_attach * Function: attaches the device to the operating system @@ -706,10 +718,21 @@ qlnx_pci_attach(device_t dev) if (qlnx_init_hw(ha) != 0) goto qlnx_pci_attach_err; + qlnx_get_params(ha); + + if((pci_get_device(dev) == QLOGIC_PCI_DEVICE_ID_1644) && + (qlnxe_queue_count == QLNX_DEFAULT_RSS)) { + qlnxe_queue_count = QLNX_MAX_RSS; + } + /* * Allocate MSI-x vectors */ - ha->num_rss = QLNX_MAX_RSS; + if(qlnxe_queue_count == 0) + ha->num_rss = QLNX_DEFAULT_RSS; + else + ha->num_rss = qlnxe_queue_count; + ha->num_tc = QLNX_MAX_TC; ha->msix_count = pci_msix_count(dev); @@ -1236,6 +1259,44 @@ qlnx_add_fp_stats_sysctls(qlnx_host_t *ha) CTLFLAG_RD, &ha->fp_array[i].tx_pkts_completed, "No. of transmit completions"); + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_non_tso_pkts", + CTLFLAG_RD, &ha->fp_array[i].tx_non_tso_pkts, + "No. of non LSO transmited packets"); + +#ifdef QLNX_TRACE_PERF_DATA + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_trans_ctx", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_trans_ctx, + "No. of transmitted packets in transmit context"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_compl_ctx", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_compl_ctx, + "No. of transmit completions in transmit context"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_trans_fp", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_trans_fp, + "No. of transmitted packets in taskqueue"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_compl_fp", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_compl_fp, + "No. of transmit completions in taskqueue"); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_pkts_compl_intr", + CTLFLAG_RD, &ha->fp_array[i].tx_pkts_compl_intr, + "No. of transmit completions in interrupt ctx"); +#endif + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, "tx_tso_pkts", + CTLFLAG_RD, &ha->fp_array[i].tx_tso_pkts, + "No. of LSO transmited packets"); + SYSCTL_ADD_QUAD(ctx, node_children, OID_AUTO, "tx_lso_wnd_min_len", CTLFLAG_RD, &ha->fp_array[i].tx_lso_wnd_min_len, @@ -1284,6 +1345,39 @@ qlnx_add_fp_stats_sysctls(qlnx_host_t *ha) &ha->fp_array[i].tx_pkts[j], name_str); } +#ifdef QLNX_TRACE_PERF_DATA + for (j = 0; j < 18; j++) { + + bzero(name_str, (sizeof(uint8_t) * sizeof(name_str))); + snprintf(name_str, sizeof(name_str), + "tx_pkts_hist_%02d", (j+1)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, name_str, CTLFLAG_RD, + &ha->fp_array[i].tx_pkts_hist[j], name_str); + } + for (j = 0; j < 5; j++) { + + bzero(name_str, (sizeof(uint8_t) * sizeof(name_str))); + snprintf(name_str, sizeof(name_str), + "tx_comInt_%02d", (j+1)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, name_str, CTLFLAG_RD, + &ha->fp_array[i].tx_comInt[j], name_str); + } + for (j = 0; j < 18; j++) { + + bzero(name_str, (sizeof(uint8_t) * sizeof(name_str))); + snprintf(name_str, sizeof(name_str), + "tx_pkts_q_%02d", (j+1)); + + SYSCTL_ADD_QUAD(ctx, node_children, + OID_AUTO, name_str, CTLFLAG_RD, + &ha->fp_array[i].tx_pkts_q[j], name_str); + } +#endif + SYSCTL_ADD_QUAD(ctx, node_children, OID_AUTO, "err_tx_nsegs_gt_elem_left", CTLFLAG_RD, &ha->fp_array[i].err_tx_nsegs_gt_elem_left, @@ -1979,6 +2073,12 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha) ifp->if_capabilities |= IFCAP_TSO6; ifp->if_capabilities |= IFCAP_LRO; + ifp->if_hw_tsomax = QLNX_MAX_TSO_FRAME_SIZE - + (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); + ifp->if_hw_tsomaxsegcount = QLNX_MAX_SEGMENTS - 1 /* hdr */; + ifp->if_hw_tsomaxsegsize = QLNX_MAX_TX_MBUF_SIZE; + + ifp->if_capenable = ifp->if_capabilities; ifp->if_hwassist = CSUM_IP; @@ -2543,6 +2643,7 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, u16 hw_bd_cons; u16 ecore_cons_idx; uint16_t diff; + uint16_t idx, idx2; hw_bd_cons = le16toh(*txq->hw_cons_ptr); @@ -2580,6 +2681,11 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, qlnx_trigger_dump(ha); } + idx = (txq->sw_tx_cons + 1) & (TX_RING_SIZE - 1); + idx2 = (txq->sw_tx_cons + 2) & (TX_RING_SIZE - 1); + prefetch(txq->sw_tx_ring[idx].mp); + prefetch(txq->sw_tx_ring[idx2].mp); + qlnx_free_tx_pkt(ha, fp, txq); txq->sw_tx_cons = (txq->sw_tx_cons + 1) & (TX_RING_SIZE - 1); @@ -2588,12 +2694,71 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, } static int +qlnx_transmit_locked(struct ifnet *ifp,struct qlnx_fastpath *fp, struct mbuf *mp) +{ + int ret = 0; + struct qlnx_tx_queue *txq; + qlnx_host_t * ha; + uint16_t elem_left; + + txq = fp->txq[0]; + ha = (qlnx_host_t *)fp->edev; + + + if ((!(ifp->if_drv_flags & IFF_DRV_RUNNING)) || (!ha->link_up)) { + if(mp != NULL) + ret = drbr_enqueue(ifp, fp->tx_br, mp); + return (ret); + } + + if(mp != NULL) + ret = drbr_enqueue(ifp, fp->tx_br, mp); + + mp = drbr_peek(ifp, fp->tx_br); + + while (mp != NULL) { + + if (qlnx_send(ha, fp, &mp)) { + + if (mp != NULL) { + drbr_putback(ifp, fp->tx_br, mp); + } else { + fp->tx_pkts_processed++; + drbr_advance(ifp, fp->tx_br); + } + goto qlnx_transmit_locked_exit; + + } else { + drbr_advance(ifp, fp->tx_br); + fp->tx_pkts_transmitted++; + fp->tx_pkts_processed++; + } + + mp = drbr_peek(ifp, fp->tx_br); + } + +qlnx_transmit_locked_exit: + if((qlnx_num_tx_compl(ha,fp, fp->txq[0]) > QLNX_TX_COMPL_THRESH) || + ((int)(elem_left = ecore_chain_get_elem_left(&txq->tx_pbl)) + < QLNX_TX_ELEM_MAX_THRESH)) + (void)qlnx_tx_int(ha, fp, fp->txq[0]); + + QL_DPRINT2(ha, "%s: exit ret = %d\n", __func__, ret); + return ret; +} + + +static int qlnx_transmit(struct ifnet *ifp, struct mbuf *mp) { qlnx_host_t *ha = (qlnx_host_t *)ifp->if_softc; struct qlnx_fastpath *fp; int rss_id = 0, ret = 0; +#ifdef QLNX_TRACEPERF_DATA + uint64_t tx_pkts = 0, tx_compl = 0; +#endif + QL_DPRINT2(ha, "enter\n"); #if __FreeBSD_version >= 1100000 @@ -2611,15 +2776,27 @@ qlnx_transmit(struct ifnet *ifp, struct mbuf *mp) goto qlnx_transmit_exit; } - if (mp != NULL) { - ret = drbr_enqueue(ifp, fp->tx_br, mp); - } + if (mtx_trylock(&fp->tx_mtx)) { - if (fp->fp_taskqueue != NULL) - taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); +#ifdef QLNX_TRACEPERF_DATA + tx_pkts = fp->tx_pkts_transmitted; + tx_compl = fp->tx_pkts_completed; +#endif - ret = 0; + ret = qlnx_transmit_locked(ifp, fp, mp); +#ifdef QLNX_TRACEPERF_DATA + fp->tx_pkts_trans_ctx += (fp->tx_pkts_transmitted - tx_pkts); + fp->tx_pkts_compl_ctx += (fp->tx_pkts_completed - tx_compl); +#endif + mtx_unlock(&fp->tx_mtx); + } else { + if (mp != NULL && (fp->fp_taskqueue != NULL)) { + ret = drbr_enqueue(ifp, fp->tx_br, mp); + taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); + } + } + qlnx_transmit_exit: QL_DPRINT2(ha, "exit ret = %d\n", ret); @@ -2799,6 +2976,10 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s uint32_t nbds_in_hdr = 0; uint32_t offset = 0; +#ifdef QLNX_TRACE_PERF_DATA + uint16_t bd_used; +#endif + QL_DPRINT8(ha, "enter\n"); if (!ha->link_up) @@ -2811,15 +2992,15 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s txq = fp->txq[0]; - if (fp->tx_ring_full) { - elem_left = ecore_chain_get_elem_left(&txq->tx_pbl); + if ((int)(elem_left = ecore_chain_get_elem_left(&txq->tx_pbl)) < + QLNX_TX_ELEM_MIN_THRESH) { - if (elem_left < (TX_RING_SIZE >> 4)) - return (-1); - else - fp->tx_ring_full = 0; - } + fp->tx_nsegs_gt_elem_left++; + fp->err_tx_nsegs_gt_elem_left++; + return (ENOBUFS); + } + idx = txq->sw_tx_prod; map = txq->sw_tx_ring[idx].map; @@ -2829,14 +3010,18 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s BUS_DMA_NOWAIT); if (ha->dbg_trace_tso_pkt_len) { - if (!fp->tx_tso_min_pkt_len) { - fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; - fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; - } else { - if (fp->tx_tso_min_pkt_len > m_head->m_pkthdr.len) + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + if (!fp->tx_tso_min_pkt_len) { fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; - if (fp->tx_tso_max_pkt_len < m_head->m_pkthdr.len) - fp->tx_tso_max_pkt_len = m_head->m_pkthdr.len; + fp->tx_tso_min_pkt_len = m_head->m_pkthdr.len; + } else { + if (fp->tx_tso_min_pkt_len > m_head->m_pkthdr.len) + fp->tx_tso_min_pkt_len = + m_head->m_pkthdr.len; + if (fp->tx_tso_max_pkt_len < m_head->m_pkthdr.len) + fp->tx_tso_max_pkt_len = + m_head->m_pkthdr.len; + } } } @@ -2923,6 +3108,105 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s fp->tx_pkts[(QLNX_FP_MAX_SEGS - 1)]++; } +#ifdef QLNX_TRACE_PERF_DATA + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + if(m_head->m_pkthdr.len <= 2048) + fp->tx_pkts_hist[0]++; + else if((m_head->m_pkthdr.len > 2048) && + (m_head->m_pkthdr.len <= 4096)) + fp->tx_pkts_hist[1]++; + else if((m_head->m_pkthdr.len > 4096) && + (m_head->m_pkthdr.len <= 8192)) + fp->tx_pkts_hist[2]++; + else if((m_head->m_pkthdr.len > 8192) && + (m_head->m_pkthdr.len <= 12288 )) + fp->tx_pkts_hist[3]++; + else if((m_head->m_pkthdr.len > 11288) && + (m_head->m_pkthdr.len <= 16394)) + fp->tx_pkts_hist[4]++; + else if((m_head->m_pkthdr.len > 16384) && + (m_head->m_pkthdr.len <= 20480)) + fp->tx_pkts_hist[5]++; + else if((m_head->m_pkthdr.len > 20480) && + (m_head->m_pkthdr.len <= 24576)) + fp->tx_pkts_hist[6]++; + else if((m_head->m_pkthdr.len > 24576) && + (m_head->m_pkthdr.len <= 28672)) + fp->tx_pkts_hist[7]++; + else if((m_head->m_pkthdr.len > 28762) && + (m_head->m_pkthdr.len <= 32768)) + fp->tx_pkts_hist[8]++; + else if((m_head->m_pkthdr.len > 32768) && + (m_head->m_pkthdr.len <= 36864)) + fp->tx_pkts_hist[9]++; + else if((m_head->m_pkthdr.len > 36864) && + (m_head->m_pkthdr.len <= 40960)) + fp->tx_pkts_hist[10]++; + else if((m_head->m_pkthdr.len > 40960) && + (m_head->m_pkthdr.len <= 45056)) + fp->tx_pkts_hist[11]++; + else if((m_head->m_pkthdr.len > 45056) && + (m_head->m_pkthdr.len <= 49152)) + fp->tx_pkts_hist[12]++; + else if((m_head->m_pkthdr.len > 49512) && + m_head->m_pkthdr.len <= 53248)) + fp->tx_pkts_hist[13]++; + else if((m_head->m_pkthdr.len > 53248) && + (m_head->m_pkthdr.len <= 57344)) + fp->tx_pkts_hist[14]++; + else if((m_head->m_pkthdr.len > 53248) && + (m_head->m_pkthdr.len <= 57344)) + fp->tx_pkts_hist[15]++; + else if((m_head->m_pkthdr.len > 57344) && + (m_head->m_pkthdr.len <= 61440)) + fp->tx_pkts_hist[16]++; + else + fp->tx_pkts_hist[17]++; + } + + if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + + elem_left = ecore_chain_get_elem_left(&txq->tx_pbl); + bd_used = TX_RING_SIZE - elem_left; + + if(bd_used <= 100) + fp->tx_pkts_q[0]++; + else if((bd_used > 100) && (bd_used <= 500)) + fp->tx_pkts_q[1]++; + else if((bd_used > 500) && (bd_used <= 1000)) + fp->tx_pkts_q[2]++; + else if((bd_used > 1000) && (bd_used <= 2000)) + fp->tx_pkts_q[3]++; + else if((bd_used > 3000) && (bd_used <= 4000)) + fp->tx_pkts_q[4]++; + else if((bd_used > 4000) && (bd_used <= 5000)) + fp->tx_pkts_q[5]++; + else if((bd_used > 6000) && (bd_used <= 7000)) + fp->tx_pkts_q[6]++; + else if((bd_used > 7000) && (bd_used <= 8000)) + fp->tx_pkts_q[7]++; + else if((bd_used > 8000) && (bd_used <= 9000)) + fp->tx_pkts_q[8]++; + else if((bd_used > 9000) && (bd_used <= 10000)) + fp->tx_pkts_q[9]++; + else if((bd_used > 10000) && (bd_used <= 11000)) + fp->tx_pkts_q[10]++; + else if((bd_used > 11000) && (bd_used <= 12000)) + fp->tx_pkts_q[11]++; + else if((bd_used > 12000) && (bd_used <= 13000)) + fp->tx_pkts_q[12]++; + else if((bd_used > 13000) && (bd_used <= 14000)) + fp->tx_pkts_q[13]++; + else if((bd_used > 14000) && (bd_used <= 15000)) + fp->tx_pkts_q[14]++; + else if((bd_used > 15000) && (bd_used <= 16000)) + fp->tx_pkts_q[15]++; + else + fp->tx_pkts_q[16]++; + } + +#endif /* end of QLNX_TRACE_PERF_DATA */ + if ((nsegs + QLNX_TX_ELEM_RESERVE) > (int)(elem_left = ecore_chain_get_elem_left(&txq->tx_pbl))) { @@ -2943,7 +3227,8 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s fp->err_tx_nsegs_gt_elem_left++; fp->tx_ring_full = 1; - ha->storm_stats_enable = 1; + if (ha->storm_stats_enable) + ha->storm_stats_gather = 1; return (ENOBUFS); } } @@ -3131,6 +3416,7 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s third_bd->data.bitfields |= (nbds_in_hdr<tx_tso_pkts++; } else { segs++; for (seg_idx = 1; seg_idx < nsegs; seg_idx++) { @@ -3147,6 +3433,7 @@ qlnx_send(qlnx_host_t *ha, struct qlnx_fastpath *fp, s << ETH_TX_DATA_1ST_BD_PKT_LEN_SHIFT; first_bd->data.bitfields = htole16(first_bd->data.bitfields); + fp->tx_non_tso_pkts++; } @@ -4303,8 +4590,10 @@ qlnx_fp_isr(void *arg) if (fp->fp_taskqueue != NULL) taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task); #else - int rx_int = 0, total_rx_count = 0; - int lro_enable, tc; + int rx_int = 0, total_rx_count = 0; + int lro_enable, tc; + struct qlnx_tx_queue *txq; + uint16_t elem_left; lro_enable = ha->ifp->if_capenable & IFCAP_LRO; @@ -4312,10 +4601,36 @@ qlnx_fp_isr(void *arg) do { for (tc = 0; tc < ha->num_tc; tc++) { - if (mtx_trylock(&fp->tx_mtx)) { - qlnx_tx_int(ha, fp, fp->txq[tc]); - mtx_unlock(&fp->tx_mtx); - } + + txq = fp->txq[tc]; + + if((int)(elem_left = + ecore_chain_get_elem_left(&txq->tx_pbl)) < + QLNX_TX_ELEM_THRESH) { + + if (mtx_trylock(&fp->tx_mtx)) { +#ifdef QLNX_TRACE_PERF_DATA + tx_compl = fp->tx_pkts_completed; +#endif + + qlnx_tx_int(ha, fp, fp->txq[tc]); +#ifdef QLNX_TRACE_PERF_DATA + fp->tx_pkts_compl_intr += + (fp->tx_pkts_completed - tx_compl); + if ((fp->tx_pkts_completed - tx_compl) <= 32) + fp->tx_comInt[0]++; + else if (((fp->tx_pkts_completed - tx_compl) > 32) && + ((fp->tx_pkts_completed - tx_compl) <= 64)) + fp->tx_comInt[1]++; + else if(((fp->tx_pkts_completed - tx_compl) > 64) && + ((fp->tx_pkts_completed - tx_compl) <= 128)) + fp->tx_comInt[2]++; + else if(((fp->tx_pkts_completed - tx_compl) > 128)) + fp->tx_comInt[3]++; +#endif + mtx_unlock(&fp->tx_mtx); + } + } } rx_int = qlnx_rx_int(ha, fp, ha->rx_pkt_threshold, @@ -4328,7 +4643,6 @@ qlnx_fp_isr(void *arg) } while (rx_int); - #ifdef QLNX_SOFT_LRO { struct lro_ctrl *lro; @@ -4608,8 +4922,8 @@ qlnx_alloc_tx_dma_tag(qlnx_host_t *ha) NULL, NULL, /* filter, filterarg */ QLNX_MAX_TSO_FRAME_SIZE, /* maxsize */ QLNX_MAX_SEGMENTS, /* nsegments */ - (PAGE_SIZE * 4), /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ + QLNX_MAX_TX_MBUF_SIZE, /* maxsegsize */ + 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ &ha->tx_tag)) { @@ -4642,7 +4956,7 @@ qlnx_alloc_rx_dma_tag(qlnx_host_t *ha) MJUM9BYTES, /* maxsize */ 1, /* nsegments */ MJUM9BYTES, /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ + 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ &ha->rx_tag)) { @@ -5255,6 +5569,14 @@ qlnx_init_fp(qlnx_host_t *ha) fp->tx_pkts_freed = 0; fp->tx_pkts_transmitted = 0; fp->tx_pkts_completed = 0; + +#ifdef QLNX_TRACE_PERF_DATA + fp->tx_pkts_trans_ctx = 0; + fp->tx_pkts_compl_ctx = 0; + fp->tx_pkts_trans_fp = 0; + fp->tx_pkts_compl_fp = 0; + fp->tx_pkts_compl_intr = 0; +#endif fp->tx_lso_wnd_min_len = 0; fp->tx_defrag = 0; fp->tx_nsegs_gt_elem_left = 0; @@ -6606,7 +6928,7 @@ qlnx_timer(void *arg) ecore_get_vport_stats(&ha->cdev, &ha->hw_stats); - if (ha->storm_stats_enable) + if (ha->storm_stats_gather) qlnx_sample_storm_stats(ha); callout_reset(&ha->qlnx_callout, hz, qlnx_timer, ha); @@ -6855,7 +7177,7 @@ qlnx_sample_storm_stats(qlnx_host_t *ha) struct ecore_hwfn *hwfn; if (ha->storm_stats_index >= QLNX_STORM_STATS_SAMPLES_PER_HWFN) { - ha->storm_stats_enable = 0; + ha->storm_stats_gather = 0; return; } Modified: head/sys/dev/qlnx/qlnxe/qlnx_ver.h ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_ver.h Fri Aug 11 17:05:31 2017 (r322407) +++ head/sys/dev/qlnx/qlnxe/qlnx_ver.h Fri Aug 11 17:43:25 2017 (r322408) @@ -39,5 +39,5 @@ #define QLNX_VERSION_MAJOR 1 #define QLNX_VERSION_MINOR 4 -#define QLNX_VERSION_BUILD 6 +#define QLNX_VERSION_BUILD 7 Modified: head/sys/modules/qlnx/qlnxe/Makefile ============================================================================== --- head/sys/modules/qlnx/qlnxe/Makefile Fri Aug 11 17:05:31 2017 (r322407) +++ head/sys/modules/qlnx/qlnxe/Makefile Fri Aug 11 17:43:25 2017 (r322408) @@ -52,7 +52,7 @@ SRCS+= pci_if.h .include -CFLAGS += -DQLNX_DEBUG +#CFLAGS += -DQLNX_DEBUG CFLAGS += -DECORE_PACKAGE CFLAGS += -DCONFIG_ECORE_L2 CFLAGS += -DECORE_CONFIG_DIRECT_HWFN From owner-svn-src-all@freebsd.org Fri Aug 11 18:09:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35D19DDF054; Fri, 11 Aug 2017 18:09:28 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0396B8105C; Fri, 11 Aug 2017 18:09:27 +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 v7BI9RKF014245; Fri, 11 Aug 2017 18:09:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BI9R06014244; Fri, 11 Aug 2017 18:09:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708111809.v7BI9R06014244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 11 Aug 2017 18:09:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322409 - head/sys/arm/at91 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm/at91 X-SVN-Commit-Revision: 322409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 18:09:28 -0000 Author: emaste Date: Fri Aug 11 18:09:26 2017 New Revision: 322409 URL: https://svnweb.freebsd.org/changeset/base/322409 Log: Rename at91_pmc's M_PMC malloc type to avoid duplicate definition M_PMC is defined in sys/dev/hwpmc/hwpmc_mod.c, and the LINT kernel build fails when linking with lld due to a duplicate symbol error. Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/at91/at91_pmc.c Modified: head/sys/arm/at91/at91_pmc.c ============================================================================== --- head/sys/arm/at91/at91_pmc.c Fri Aug 11 17:43:25 2017 (r322408) +++ head/sys/arm/at91/at91_pmc.c Fri Aug 11 18:09:26 2017 (r322409) @@ -63,8 +63,8 @@ static struct at91_pmc_softc { static uint32_t pllb_init; -MALLOC_DECLARE(M_PMC); -MALLOC_DEFINE(M_PMC, "at91_pmc_clocks", "AT91 PMC Clock descriptors"); +MALLOC_DECLARE(M_PMC_CLK); +MALLOC_DEFINE(M_PMC_CLK, "at91_pmc_clocks", "AT91 PMC Clock descriptors"); #define AT91_PMC_BASE 0xffffc00 @@ -300,12 +300,12 @@ at91_pmc_clock_add(const char *name, uint32_t irq, struct at91_pmc_clock *clk; int i, buflen; - clk = malloc(sizeof(*clk), M_PMC, M_NOWAIT | M_ZERO); + clk = malloc(sizeof(*clk), M_PMC_CLK, M_NOWAIT | M_ZERO); if (clk == NULL) goto err; buflen = strlen(name) + 1; - clk->name = malloc(buflen, M_PMC, M_NOWAIT); + clk->name = malloc(buflen, M_PMC_CLK, M_NOWAIT); if (clk->name == NULL) goto err; @@ -326,8 +326,8 @@ at91_pmc_clock_add(const char *name, uint32_t irq, err: if (clk != NULL) { if (clk->name != NULL) - free(clk->name, M_PMC); - free(clk, M_PMC); + free(clk->name, M_PMC_CLK); + free(clk, M_PMC_CLK); } panic("could not allocate pmc clock '%s'", name); From owner-svn-src-all@freebsd.org Fri Aug 11 18:40:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 108D3DE0994; Fri, 11 Aug 2017 18:40:19 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-io0-x241.google.com (mail-io0-x241.google.com [IPv6:2607:f8b0:4001:c06::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBBBF82353; Fri, 11 Aug 2017 18:40:18 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-io0-x241.google.com with SMTP id q64so3946608ioi.0; Fri, 11 Aug 2017 11:40:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=VTWNxO4gcQgtT7+0+aeH7a3UF7zz78wDDfl1ri+XYLQ=; b=j3eQQSkzEURa0lhNSG7U1KWiEn1X1r5fhBuAONUK0aPID73dNrBT4gyw96KrYBR266 b6Fh1QkOl5X2HfZ/xN7nji+QRNK0R2LIs9r1W4sTbogzxgODcqNryr2ewYW6E/ncwB7J lG6NhNzRLFOTg0+lBJjYvv6UFi97wFXh+LzX2IUe1Byr7Kubyyb+1Y/0SBgs+jaIa7Qc 9dtbw7i7DFzTUvGD8BXp4p+5T+Kt9Zrfa+NPkxHjs5888XOOFnlCrS7A2w+PO5AkryVK vQmlrWENDK1heqqd3yHjDXaD/OLeqtk3DB7PVmLDB1jiGrwiGWdLuA6XbkvrtMpv+DVx bmYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=VTWNxO4gcQgtT7+0+aeH7a3UF7zz78wDDfl1ri+XYLQ=; b=m5JkozCZFY0T2XSYO5qcita7EgVtVz5trV4RoXqTyJef1Zv5OvUeZy0W435DdNrvQk ddPb7c+iS5nxiGYqOo2oJGPLwwgItx+bX2wmNTMzXzeKQqwzw/rv4cIsMs2QDctTlElp AiZGOuIZ+lCOvQbEcryVpgkCwHKFfyDd7Au7vo2SNtlPQGa9WXLvwZGmntBXw7jv7xdQ nDrt7W9n6orH8Xv4DwW7hqN/TDVzDXdwhuDO6AF9XMrdPRsJq7KBzZLIuzUNk0Es9sso hItDw1WQJiX02X8QV1HbWN2g5dIXretlAiq18qawaNcgYRsk75nRjeYDpBCph9kOpCdT RxGQ== X-Gm-Message-State: AHYfb5hGZ7S/hwchroS28Zv/8hOEj5/85dxHH7/LyB4O7tMIimNN1ukP qSfq7pQ+LsXwktgGLyc= X-Received: by 10.107.52.6 with SMTP id b6mr10814381ioa.162.1502476818126; Fri, 11 Aug 2017 11:40:18 -0700 (PDT) Received: from ?IPv6:2607:fb90:6c47:db5a:5118:d2cf:3ecb:8385? ([2607:fb90:6c47:db5a:5118:d2cf:3ecb:8385]) by smtp.gmail.com with ESMTPSA id d96sm673222ioj.75.2017.08.11.11.40.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Aug 2017 11:40:17 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r322371 - head/lib/libc/tests/gen From: Ngie Cooper X-Mailer: iPhone Mail (14G60) In-Reply-To: <201708101703.v7AH3kju098213@repo.freebsd.org> Date: Fri, 11 Aug 2017 12:40:15 -0600 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <29D777B5-212F-47DD-991D-34C2A69F90E3@gmail.com> References: <201708101703.v7AH3kju098213@repo.freebsd.org> To: "Pedro F. Giffuni" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 18:40:19 -0000 > On Aug 10, 2017, at 11:03, Pedro F. Giffuni wrote: > > Author: pfg > Date: Thu Aug 10 17:03:46 2017 > New Revision: 322371 > URL: https://svnweb.freebsd.org/changeset/base/322371 > > Log: > fnmatch(3): Update testcase for r322368. > > Modified: > head/lib/libc/tests/gen/fnmatch_testcases.h Thank you!! -Ngie From owner-svn-src-all@freebsd.org Fri Aug 11 18:43:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B6F3DE0D73; Fri, 11 Aug 2017 18:43:54 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 188BA8290D; Fri, 11 Aug 2017 18:43:54 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BIhrI8030560; Fri, 11 Aug 2017 18:43:53 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BIhrri030559; Fri, 11 Aug 2017 18:43:53 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201708111843.v7BIhrri030559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 11 Aug 2017 18:43:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322410 - head/usr.bin/mt X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: head/usr.bin/mt X-SVN-Commit-Revision: 322410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 18:43:54 -0000 Author: ken Date: Fri Aug 11 18:43:52 2017 New Revision: 322410 URL: https://svnweb.freebsd.org/changeset/base/322410 Log: Add historical notes on QIC tape drives and fix a couple of issues in mt(1). o Density code 0x5 is also known as QIC-11, and should have a footnote reference. o Add notes on QIC tape drives from the bug report. These may help anyone trying to use a QIC drive. o Take out a "more more" instance found by igor. o Bump the man page date. The PR is 14 years old, so it's past time to retire it. PR: doc/53596 Submitted by: tedm@toybox.placo.com Reviewed by: bcr Sponsored by: Spectra Logic Modified: head/usr.bin/mt/mt.1 Modified: head/usr.bin/mt/mt.1 ============================================================================== --- head/usr.bin/mt/mt.1 Fri Aug 11 18:09:26 2017 (r322409) +++ head/usr.bin/mt/mt.1 Fri Aug 11 18:43:52 2017 (r322410) @@ -29,7 +29,7 @@ .\" @(#)mt.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd August 3, 2017 +.Dd August 11, 2017 .Dt MT 1 .Os .Sh NAME @@ -333,7 +333,7 @@ The default protection method used is Reed-Solomon CRC 1), as specified in ECMA-319. The default protection information length used with Reed-Solomon CRC is 4 bytes. -To enable all settings except one more more settings, specify the +To enable all settings except one more setting, specify the .Fl e argument and then explicitly disable settings that you do not wish to enable. @@ -463,7 +463,7 @@ Value Width Tracks Density Code Typ 0x01 12.7 (0.5) 9 32 (800) NRZI R X3.22-1983 2 0x02 12.7 (0.5) 9 63 (1,600) PE R X3.39-1986 2 0x03 12.7 (0.5) 9 246 (6,250) GCR R X3.54-1986 2 -0x05 6.3 (0.25) 4/9 315 (8,000) GCR C X3.136-1986 1 +0x05 6.3 (0.25) 4/9 315 (8,000) GCR C X3.136-1986 1,3 0x06 12.7 (0.5) 9 126 (3,200) PE R X3.157-1987 2 0x07 6.3 (0.25) 4 252 (6,400) IMFM C X3.116-1986 1 0x08 3.81 (0.15) 4 315 (8,000) GCR CS X3.158-1987 1 @@ -566,6 +566,60 @@ NOTES density code is 0x8c. 13. This density code (0x48) was also used for DAT-160. .Ed +.Bd -literal -offset 2n +NOTE ON QIC STREAMERS + +The following is a table of Data Cartridge types as used in the 1/4 inch +tape drives such as the Archive Viper 150, Wangtek 5525ES, and Tandberg +TDC4220 tape drives: + +Value Reference Format Cartridge Type Capacity Tracks Length +----- --------- ------ -------------- -------- ------ ------ + +0x05 QIC-11 DC300 15MB 4 300ft +0x05 QIC-11 DC300XL/P 20MB 4 450ft +0x05 QIC-11 DC600 27MB 4 600ft +0x05 X3.136-1986 QIC-24 DC615A 15MB 9 150ft +0x05 X3.136-1986 QIC-24 DC300XL/P 45MB 9 450ft +0x05 X3.136-1986 QIC-24 DC600A 60MB 9 600ft +0x0F QIC-120 QIC-120 DC600A/DC6150 120MB 15 620ft +0x10 QIC-150 QIC-150 DC600XTD/DC6150 150MB 18 620ft +0x10 QIC-150 QIC-150 DC6250 250MB 18 1,020ft +0x11 QIC-320 QIC-525 DC6320 320MB 26 620ft +0x11 QIC-320 QIC-525 DC6525 525MB 26 1,020ft +0x1E QIC-1000C QIC-1000 DC9100/DL9135 1.0GB 30 760ft +0x1E QIC-1000C QIC-1000 DC9150 1.2GB 30 950ft +0x22 QIC-2GB(C) QIC-2GB DC9200 2.0GB 42 950ft +0x22 QIC-2GB(C) QIC-2GB DC9250 2.5GB 42 1,200ft +.Ed +.Pp +Notes: +.Pp +QIC-24, QIC-120, QIC-150 use fixed blocksize of 512 bytes, QIC-525, QIC-1000 +and QIC-2GB can use blocksize of 1,024 bytes. +DDS (DAT) drives generally use variable blocks. +.Pp +QIC-02 and QIC-36 are interface standards for tape drives. +The QIC-02 and QIC-36 streamers such as the Wangtek 5250EQ are otherwise +identical to their SCSI versions (i.e.: Wangtek 5250ES). +.Pp +It seems that the 150MB and larger streamers cannot write QIC-24 9 track +formats, only read them. +.Pp +DC600A cartridges marked "10,000ftpi" can only be used as QIC-11, QIC-24, +and QIC-120 format. +DC600A cartridges marked 12,500ftpi can be used as both QIC-120 and QIC-150 +format. +.Pp +Some manufacturers do not use "DC" on their cartridges. +Verbatim uses DL, Maxell uses MC, Sony uses QD, Quill uses DQ. +.Pp +3M/Imation & Fuji use DC. +Thus a DL6250, MC-6250, QD6250, DQ6250 are all identical media to a DC6250. +.Pp +QIC tape media is not "connected" to the take up reels and will de-spool +if the tape drive has dust covering the light sensor that looks for the end +of tape holes in the media. .Sh ENVIRONMENT .Bl -tag -width ".Ev TAPE" .It Ev TAPE From owner-svn-src-all@freebsd.org Fri Aug 11 19:02:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02346D9441F; Fri, 11 Aug 2017 19:02:13 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C37E7837AF; Fri, 11 Aug 2017 19:02:12 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BJ2BkI038632; Fri, 11 Aug 2017 19:02:11 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BJ2BEG038353; Fri, 11 Aug 2017 19:02:11 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708111902.v7BJ2BEG038353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 11 Aug 2017 19:02:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322411 - in head/sys: dev/xen/timer isa x86/isa X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys: dev/xen/timer isa x86/isa X-SVN-Commit-Revision: 322411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 19:02:13 -0000 Author: ian Date: Fri Aug 11 19:02:11 2017 New Revision: 322411 URL: https://svnweb.freebsd.org/changeset/base/322411 Log: Stop calling atrtc_set() from the xen timer clock_settime() method. That removes the only reference to atrtc_set() from outside of atrtc.c, so make it static. The xen timer driver registers as a realtime clock with 1us resolution. In the past that resulted in only the xen timer's clock_settime() getting called, so it would call atrtc_set() to set the hardware clock as well. As of r32090, the clock_settime() method of all registered realtime clocks gets called, so the xen driver no longer needs to chain-call the lower-resolution driver. Thanks to royger@ for talking me through the xen stuff, and for testing. Modified: head/sys/dev/xen/timer/timer.c head/sys/isa/rtc.h head/sys/x86/isa/atrtc.c Modified: head/sys/dev/xen/timer/timer.c ============================================================================== --- head/sys/dev/xen/timer/timer.c Fri Aug 11 18:43:52 2017 (r322410) +++ head/sys/dev/xen/timer/timer.c Fri Aug 11 19:02:11 2017 (r322411) @@ -64,8 +64,6 @@ __FBSDID("$FreeBSD$"); #include -#include - #include "clock_if.h" static devclass_t xentimer_devclass; @@ -228,9 +226,6 @@ xentimer_settime(device_t dev __unused, struct timespe */ if (!xen_initial_domain()) return (0); - - /* Set the native RTC. */ - atrtc_set(ts); settime.cmd = XENPF_settime64; settime.u.settime64.mbz = 0; Modified: head/sys/isa/rtc.h ============================================================================== --- head/sys/isa/rtc.h Fri Aug 11 18:43:52 2017 (r322410) +++ head/sys/isa/rtc.h Fri Aug 11 19:02:11 2017 (r322411) @@ -118,7 +118,6 @@ extern int atrtcclock_disable; int rtcin(int reg); void atrtc_restore(void); void writertc(int reg, u_char val); -void atrtc_set(struct timespec *ts); #endif #endif /* _I386_ISA_RTC_H_ */ Modified: head/sys/x86/isa/atrtc.c ============================================================================== --- head/sys/x86/isa/atrtc.c Fri Aug 11 18:43:52 2017 (r322410) +++ head/sys/x86/isa/atrtc.c Fri Aug 11 19:02:11 2017 (r322411) @@ -164,7 +164,7 @@ atrtc_restore(void) rtcin(RTC_INTR); } -void +static void atrtc_set(struct timespec *ts) { struct clocktime ct; From owner-svn-src-all@freebsd.org Fri Aug 11 19:21:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8964DB5989; Fri, 11 Aug 2017 19:21:41 +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 mx1.freebsd.org (Postfix) with ESMTPS id B597A6A0; Fri, 11 Aug 2017 19:21:41 +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 v7BJLefA044687; Fri, 11 Aug 2017 19:21:40 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BJLeLF044683; Fri, 11 Aug 2017 19:21:40 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201708111921.v7BJLeLF044683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 11 Aug 2017 19:21:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322412 - in head: . release/packages share/mk X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in head: . release/packages share/mk X-SVN-Commit-Revision: 322412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 19:21:42 -0000 Author: gjb Date: Fri Aug 11 19:21:40 2017 New Revision: 322412 URL: https://svnweb.freebsd.org/changeset/base/322412 Log: Add SVNVERSION_CMD to bsd.own.mk, adding the capability to include svnversion metadata to the runtime and kernel packages. Instead of traversing src/sys, as is done by newvers.sh for uname(1), a full tree walk is done to prevent userland and/or modifications from not being reflected in a modified tree (M). MFC after: 5 days Sponsored by: The FreeBSD Foundation Modified: head/Makefile.inc1 head/release/packages/kernel.ucl head/release/packages/runtime.ucl head/share/mk/bsd.own.mk Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Aug 11 19:02:11 2017 (r322411) +++ head/Makefile.inc1 Fri Aug 11 19:21:40 2017 (r322412) @@ -346,6 +346,12 @@ SVN= ${_P}/${_S} . endfor .endif SVNFLAGS?= -r HEAD +.if !defined(VCS_REVISION) && empty(VCS_REVISION) +_VCS_REVISION?= $$(eval ${SVNVERSION_CMD} ${SRCDIR}) +. if !empty(_VCS_REVISION) +VCS_REVISION= $$(echo r${_VCS_REVISION}) +. endif +.endif .if !defined(OSRELDATE) .if exists(/usr/include/osreldate.h) @@ -1626,9 +1632,10 @@ create-world-package-${pkgname}: .PHONY @awk -F\" ' \ /^name/ { printf("===> Creating %s-", $$2); next } \ /^version/ { print $$2; next } \ - ' ${WSTAGEDIR}/${pkgname}.ucl ; + ' ${WSTAGEDIR}/${pkgname}.ucl @if [ "${pkgname}" == "runtime" ]; then \ sed -i '' -e "s/%KERNCONF%/${INSTALLKERNEL:tl}/" ${WSTAGEDIR}/${pkgname}.ucl ; \ + sed -i '' -e "s/%VCS_REVISION%/${VCS_REVISION}/" ${WSTAGEDIR}/${pkgname}.ucl ; \ fi ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \ create -M ${WSTAGEDIR}/${pkgname}.ucl \ @@ -1658,6 +1665,7 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul -e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ -e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \ + -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ ${SRCDIR}/release/packages/kernel.ucl \ > ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ awk -F\" ' \ @@ -1692,6 +1700,7 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_ -e "s/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \ -e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \ -e "s/%PWD_MKDB_ENDIAN%/$${pwd_arg}/g" \ + -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ ${SRCDIR}/release/packages/kernel.ucl \ > ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \ awk -F\" ' \ Modified: head/release/packages/kernel.ucl ============================================================================== --- head/release/packages/kernel.ucl Fri Aug 11 19:02:11 2017 (r322411) +++ head/release/packages/kernel.ucl Fri Aug 11 19:21:40 2017 (r322412) @@ -5,7 +5,7 @@ name = "FreeBSD-%PKGNAME%" origin = "base" version = "%VERSION%" -comment = "%COMMENT%" +comment = "%COMMENT% %VCS_REVISION%" categories = [ base ] maintainer = "re@FreeBSD.org" www = "https://www.FreeBSD.org" Modified: head/release/packages/runtime.ucl ============================================================================== --- head/release/packages/runtime.ucl Fri Aug 11 19:02:11 2017 (r322411) +++ head/release/packages/runtime.ucl Fri Aug 11 19:21:40 2017 (r322412) @@ -5,7 +5,7 @@ name = "FreeBSD-%PKGNAME%" origin = "base" version = "%VERSION%" -comment = "%COMMENT%" +comment = "%COMMENT% %VCS_REVISION%" categories = [ base ] maintainer = "re@FreeBSD.org" www = "https://www.FreeBSD.org" Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Fri Aug 11 19:02:11 2017 (r322411) +++ head/share/mk/bsd.own.mk Fri Aug 11 19:21:40 2017 (r322412) @@ -233,6 +233,17 @@ XZ_CMD?= xz -T ${XZ_THREADS} XZ_CMD?= xz .endif +.if !defined(SVNVERSION_CMD) && empty(SVNVERSION_CMD) +. for _D in ${PATH:S,:, ,g} +. if exists(${_D}/svnversion) +SVNVERSION_CMD?=${_D}/svnversion +. endif +. if exists(${_D}/svnliteversion) +SVNVERSION_CMD?=${_D}/svnliteversion +. endif +. endfor +.endif + PKG_CMD?= pkg # Pointer to the top directory into which tests are installed. Should not be From owner-svn-src-all@freebsd.org Fri Aug 11 19:24:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4D48DB5DB6; Fri, 11 Aug 2017 19:24:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 74EC99E9; Fri, 11 Aug 2017 19:24:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BJO8bg047121; Fri, 11 Aug 2017 19:24:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BJO8H6047120; Fri, 11 Aug 2017 19:24:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708111924.v7BJO8H6047120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Aug 2017 19:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322413 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 322413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 19:24:09 -0000 Author: markj Date: Fri Aug 11 19:24:08 2017 New Revision: 322413 URL: https://svnweb.freebsd.org/changeset/base/322413 Log: Bump KERNELDUMP_BUFFER_SIZE to 4096. The encrypted kernel dump code writes data in blocks of this size. A buffer size of 4096 allows encrypted dumps to work with 4Kn drives. Reviewed by: cem Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11870 Modified: head/sys/sys/kerneldump.h Modified: head/sys/sys/kerneldump.h ============================================================================== --- head/sys/sys/kerneldump.h Fri Aug 11 19:21:40 2017 (r322412) +++ head/sys/sys/kerneldump.h Fri Aug 11 19:24:08 2017 (r322413) @@ -58,7 +58,7 @@ #define KERNELDUMP_ENC_NONE 0 #define KERNELDUMP_ENC_AES_256_CBC 1 -#define KERNELDUMP_BUFFER_SIZE 1024 +#define KERNELDUMP_BUFFER_SIZE 4096 #define KERNELDUMP_IV_MAX_SIZE 32 #define KERNELDUMP_KEY_MAX_SIZE 64 #define KERNELDUMP_ENCKEY_MAX_SIZE (16384 / 8) From owner-svn-src-all@freebsd.org Fri Aug 11 19:49:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECCC7DB7856; Fri, 11 Aug 2017 19:49:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBEDD18F3; Fri, 11 Aug 2017 19:49:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BJnTnV055133; Fri, 11 Aug 2017 19:49:29 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BJnTqd055132; Fri, 11 Aug 2017 19:49:29 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708111949.v7BJnTqd055132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 11 Aug 2017 19:49:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322414 - head/sys/arm/conf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm/conf X-SVN-Commit-Revision: 322414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 19:49:31 -0000 Author: emaste Date: Fri Aug 11 19:49:29 2017 New Revision: 322414 URL: https://svnweb.freebsd.org/changeset/base/322414 Log: arm: enable ARM_MANY_BOARD in NOTES for LINT build Added in r238189, ARM_MANY_BOARD adds support for multiple ARM boards in a single kernel. Include it for LINT builds to avoid duplicate symbol errors when linking with lld. Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/conf/NOTES Modified: head/sys/arm/conf/NOTES ============================================================================== --- head/sys/arm/conf/NOTES Fri Aug 11 19:24:08 2017 (r322413) +++ head/sys/arm/conf/NOTES Fri Aug 11 19:49:29 2017 (r322414) @@ -36,6 +36,7 @@ options SOC_MV_DISCOVERY options SOC_MV_KIRKWOOD options SOC_MV_ORION +options ARM_MANY_BOARD device at91_board_bwct device at91_board_ethernut5 device at91_board_hl200 From owner-svn-src-all@freebsd.org Fri Aug 11 20:11:44 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B49D2DC2DD8; Fri, 11 Aug 2017 20:11:44 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7FA2C265A; Fri, 11 Aug 2017 20:11:44 +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 v7BKBhmj064954; Fri, 11 Aug 2017 20:11:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BKBh5D064953; Fri, 11 Aug 2017 20:11:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708112011.v7BKBh5D064953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 11 Aug 2017 20:11:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322415 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322415 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 20:11:44 -0000 Author: emaste Date: Fri Aug 11 20:11:43 2017 New Revision: 322415 URL: https://svnweb.freebsd.org/changeset/base/322415 Log: lldb: enable on i386 It is functional on FreeBSD/i386 as of r322326. Sponsored by: The FreeBSD Foundation Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri Aug 11 19:49:29 2017 (r322414) +++ head/share/mk/src.opts.mk Fri Aug 11 20:11:43 2017 (r322415) @@ -255,7 +255,7 @@ __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .else __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .endif -.if ${__T} == "aarch64" || ${__T} == "amd64" +.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" __DEFAULT_YES_OPTIONS+=LLDB .else __DEFAULT_NO_OPTIONS+=LLDB From owner-svn-src-all@freebsd.org Fri Aug 11 20:44:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04FC5DC4FB8; Fri, 11 Aug 2017 20:44:19 +0000 (UTC) (envelope-from bhd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 C653E3730; Fri, 11 Aug 2017 20:44:18 +0000 (UTC) (envelope-from bhd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BKiHN7079274; Fri, 11 Aug 2017 20:44:17 GMT (envelope-from bhd@FreeBSD.org) Received: (from bhd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BKiHYU079273; Fri, 11 Aug 2017 20:44:17 GMT (envelope-from bhd@FreeBSD.org) Message-Id: <201708112044.v7BKiHYU079273@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bhd set sender to bhd@FreeBSD.org using -f From: Bjoern Heidotting Date: Fri, 11 Aug 2017 20:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322416 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: bhd X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 322416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 20:44:19 -0000 Author: bhd (doc committer) Date: Fri Aug 11 20:44:17 2017 New Revision: 322416 URL: https://svnweb.freebsd.org/changeset/base/322416 Log: add myself to calendar.freebsd Requested by: mckusick Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 11 20:11:43 2017 (r322415) +++ head/usr.bin/calendar/calendars/calendar.freebsd Fri Aug 11 20:44:17 2017 (r322416) @@ -60,6 +60,7 @@ 02/04 Eitan Adler born in West Hempstead, New York, United States, 1991 02/05 Frank Laszlo born in Howell, Michigan, United States, 1983 02/06 Julien Charbon born in Saint Etienne, Loire, France, 1978 +02/07 Bjoern Heidotting born in Uelsen, Germany, 1980 02/10 David Greenman born in Portland, Oregon, United States, 1968 02/10 Paul Richards born in Ammanford, Carmarthenshire, United Kingdom, 1968 02/10 Simon Barner born in Rosenheim, Bayern, Germany, 1980 From owner-svn-src-all@freebsd.org Fri Aug 11 20:46:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AC1FDC528B; Fri, 11 Aug 2017 20:46:58 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 35F4438F4; Fri, 11 Aug 2017 20:46:57 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id E406010AF0F; Fri, 11 Aug 2017 16:46:49 -0400 (EDT) From: John Baldwin To: Roger Pau =?ISO-8859-1?Q?Monn=E9?= Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322403 - head/sys/x86/acpica Date: Fri, 11 Aug 2017 12:14:09 -0700 Message-ID: <1711735.ULtvsIt8zT@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201708111419.v7BEJt6O018664@repo.freebsd.org> References: <201708111419.v7BEJt6O018664@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 11 Aug 2017 16:46:50 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 20:46:58 -0000 On Friday, August 11, 2017 02:19:55 PM Roger Pau Monn=E9 wrote: > Author: royger > Date: Fri Aug 11 14:19:55 2017 > New Revision: 322403 > URL: https://svnweb.freebsd.org/changeset/base/322403 >=20 > Log: > acpi/srat: fix build without DMAP > =20 > Use pmap_mapbios to map memory used to store the cpus array. > =20 > Reported by:=09lwhsu > X-MFC-with:=09r322348 >=20 > Modified: > head/sys/x86/acpica/srat.c >=20 > Modified: head/sys/x86/acpica/srat.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/x86/acpica/srat.c=09Fri Aug 11 14:19:31 2017=09(r322402)= > +++ head/sys/x86/acpica/srat.c=09Fri Aug 11 14:19:55 2017=09(r322403)= > @@ -443,7 +443,12 @@ parse_srat(void) > =09 ("Not enough memory for SRAT table items")); > =09phys_avail[idx + 1] =3D addr - 1; > =20 > -=09cpus =3D (struct cpu_info *)PHYS_TO_DMAP(addr); > +=09/* > +=09 * We cannot rely on PHYS_TO_DMAP because this code is also used = in > +=09 * i386, so use pmap_mapbios to map the memory, this will end up = using > +=09 * the default memory attribute (WB), and the DMAP when available= . > +=09 */ > +=09cpus =3D (struct cpu_info *)pmap_mapbios(addr, size); > =20 > =09/* > =09 * Make a pass over the table to populate the cpus[] and > @@ -529,6 +534,10 @@ srat_set_cpus(void *dummy) > =09=09=09printf("SRAT: CPU %u has memory domain %d\n", i, > =09=09=09 cpu->domain); > =09} > + > +=09/* Last usage of the cpus array, unmap it. */ > +=09pmap_unmapdev((vm_offset_t)cpus, sizeof(*cpus) * (max_apic_id + 1= )); Please pair pmap_mapbios with pmap_unmapbios. --=20 John Baldwin From owner-svn-src-all@freebsd.org Fri Aug 11 22:41:26 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 381A0DCC5DE; Fri, 11 Aug 2017 22:41:26 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 144D767D95; Fri, 11 Aug 2017 22:41:26 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7BMfPGu028266; Fri, 11 Aug 2017 22:41:25 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BMfP5X028262; Fri, 11 Aug 2017 22:41:25 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708112241.v7BMfP5X028262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Fri, 11 Aug 2017 22:41:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322418 - head/lib/msun/src X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/lib/msun/src X-SVN-Commit-Revision: 322418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 22:41:26 -0000 Author: rlibby Date: Fri Aug 11 22:41:24 2017 New Revision: 322418 URL: https://svnweb.freebsd.org/changeset/base/322418 Log: lib/msun: avoid referring to broken LDBL_MAX LDBL_MAX is broken on i386: https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September/000288.html Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32 for some time, and newer versions of gcc are now warning that the "floating constant exceeds range of 'long double'". Avoid this by referring to half the value of LDBL_MAX instead. Reviewed by: bde Approved by: markj (mentor) Sponsored by: Dell EMC Isilon Modified: head/lib/msun/src/catrigl.c head/lib/msun/src/math_private.h head/lib/msun/src/s_csqrtl.c Modified: head/lib/msun/src/catrigl.c ============================================================================== --- head/lib/msun/src/catrigl.c Fri Aug 11 22:39:38 2017 (r322417) +++ head/lib/msun/src/catrigl.c Fri Aug 11 22:41:24 2017 (r322418) @@ -307,7 +307,7 @@ clog_for_large_values(long double complex z) ay = t; } - if (ax > LDBL_MAX / 2) + if (ax >= HALF_LDBL_MAX) return (CMPLXL(logl(hypotl(x / m_e, y / m_e)) + 1, atan2l(y, x))); Modified: head/lib/msun/src/math_private.h ============================================================================== --- head/lib/msun/src/math_private.h Fri Aug 11 22:39:38 2017 (r322417) +++ head/lib/msun/src/math_private.h Fri Aug 11 22:41:24 2017 (r322418) @@ -272,6 +272,15 @@ do { \ #define LD80C(m, ex, v) { .e = (v), } #endif +/* + * XXX LDBL_MAX is broken on i386. If the precise value of LDBL_MAX is not + * needed, this may be worked around by instead referring to a proxy, such + * as HALF_LDBL_MAX, below. HALF_LDBL_MAX is approximately LDBL_MAX / 2, + * actually just greater than. Note that 2 * HALF_LDBL_MAX will always + * overflow to infinity, regardless of the precision and rounding modes. + */ +#define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L) + #ifdef FLT_EVAL_METHOD /* * Attempt to get strict C99 semantics for assignment with non-C99 compilers. Modified: head/lib/msun/src/s_csqrtl.c ============================================================================== --- head/lib/msun/src/s_csqrtl.c Fri Aug 11 22:39:38 2017 (r322417) +++ head/lib/msun/src/s_csqrtl.c Fri Aug 11 22:41:24 2017 (r322418) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #pragma STDC CX_LIMITED_RANGE ON /* We risk spurious overflow for components >= LDBL_MAX / (1 + sqrt(2)). */ -#define THRESH (LDBL_MAX / 2.414213562373095048801688724209698L) +#define THRESH (HALF_LDBL_MAX / 1.207106781186547524400844362104849L) long double complex csqrtl(long double complex z) From owner-svn-src-all@freebsd.org Fri Aug 11 22:47:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00112DCCBC7; Fri, 11 Aug 2017 22:47:33 +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 mx1.freebsd.org (Postfix) with ESMTPS id BEE61681E4; Fri, 11 Aug 2017 22:47:33 +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 v7BMlWmE030822; Fri, 11 Aug 2017 22:47:32 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7BMlWuq030821; Fri, 11 Aug 2017 22:47:32 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708112247.v7BMlWuq030821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 11 Aug 2017 22:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322419 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 322419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 11 Aug 2017 22:47:34 -0000 Author: jhb Date: Fri Aug 11 22:47:32 2017 New Revision: 322419 URL: https://svnweb.freebsd.org/changeset/base/322419 Log: Fix a typo. Modified: head/sys/arm64/arm64/vfp.c Modified: head/sys/arm64/arm64/vfp.c ============================================================================== --- head/sys/arm64/arm64/vfp.c Fri Aug 11 22:41:24 2017 (r322418) +++ head/sys/arm64/arm64/vfp.c Fri Aug 11 22:47:32 2017 (r322419) @@ -206,7 +206,7 @@ vfp_restore_state(void) /* * If the previous thread on this cpu to use the VFP was not the - * current threas, or the current thread last used it on a different + * current thread, or the current thread last used it on a different * cpu we need to restore the old state. */ if (PCPU_GET(fpcurthread) != curthread || cpu != curpcb->pcb_vfpcpu) { From owner-svn-src-all@freebsd.org Sat Aug 12 02:57:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77EA2DDB252; Sat, 12 Aug 2017 02:57:38 +0000 (UTC) (envelope-from David.Somayajulu@cavium.com) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0066.outbound.protection.outlook.com [104.47.40.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 23D116F4A9; Sat, 12 Aug 2017 02:57:37 +0000 (UTC) (envelope-from David.Somayajulu@cavium.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=5mAN0LgbORV3fWHx8IsvenDvzOHVeZHEcIzolini+8w=; b=MGSopwOha77CvlNRtooiHiW26KJtJ8+HR9wcBhQs/CBZUIOFmJCaSFFCq6Z6b/nbQR8N5FAPU/I/aEUoOTH1iDohCBe7YeMo1/HmFKlpaqf3m8bvYIyfvFOvugk8UJo8sYRtANq5eWZagtsKd5yA6ui66t8ZYeR2HwTD+smivCw= Received: from BY2PR07MB1474.namprd07.prod.outlook.com (10.162.76.152) by BY2PR07MB1475.namprd07.prod.outlook.com (10.162.76.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1320.16; Sat, 12 Aug 2017 02:57:35 +0000 Received: from BY2PR07MB1474.namprd07.prod.outlook.com ([10.162.76.152]) by BY2PR07MB1474.namprd07.prod.outlook.com ([10.162.76.152]) with mapi id 15.01.1320.021; Sat, 12 Aug 2017 02:57:35 +0000 From: "Somayajulu, David" To: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: RE: svn commit: r322331 - in head/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe Thread-Topic: svn commit: r322331 - in head/sys: dev/qlnx/qlnxe modules/qlnx/qlnxe Thread-Index: AQHTEV2FHCrAquH5BEm/2TOYjHsfd6KACmCg Date: Sat, 12 Aug 2017 02:57:35 +0000 Message-ID: References: <201708092218.v79MInEd032026@repo.freebsd.org> In-Reply-To: <201708092218.v79MInEd032026@repo.freebsd.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=David.Somayajulu@cavium.com; x-originating-ip: [198.186.0.2] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BY2PR07MB1475; 6:xfAB+J4FepulCoil78wre5mwzF0rL/sTCTISpW9O59jrqZL3erSqijLeVfTwertNum3jhZSX6Oe+H3Gqx5oq4LD4NQ1Em2nBCWZfmIUDf1ZdpeyHMnBVtURjokWqWv2WAkczamoBBBdREBErq+50CEiDmGVK8lxZeFUC+BAu+oQ1LbOgGp07Bfy0gQYj0S4dBo/T3AVTMYYi9sWhOUB1fXoZ32nqDBiaFN4owXvNfpq1z/5vWGs7AvihOEppSCrq/ceIgcGjTn9SepRTrgI6DXqOAOPF3+lutvYPyXB4YbxWlmJ1VSSoiW+DKtRiPHmXf9pmflfoVN5u5C4UuGW0gg==; 5:/xsTfHa7tvKOI27Et5XnyNWHvU90z7khMpZB0dAIUihSRwhqcvYDFqXySttWejzt1XTcOl1WdJ/FNyI3FdSrl+UaCZ6eD0lXs+mKZbFrNfmxaMhPUUhvcGYmwnLgQGHaFJe/1mSJh74+lgA2Ai0oug==; 24:zdyHUUshwAQyC/SeyWcF6OIHA3qYW20/ijf6gWBmy68MjkcuVhFQycIJHlxCk0Yrod+gq9XVxOMpjKJ+/m3i1huzQy1ZKkaRDS1xEoUYLf8=; 7:YK5cSb7P8KyFWOK7mnPqFMbavo2GUBceE+nIVIShuLFFlagN0DdEwHjBn4Qh5WcpfN4Z0wcLgrFrL5sonfUkKe20hBCz+BIkrIC/uOhskETxntFvgCJmPFrU4qyDbNkZ3G+/YVne9DE79GCJz17WPaSaMw0HXca5RSomt7ocwAiuIDeEuk/pGrTP4dtpfzxXcemFrZ6Uvy25iUg1higui41cDwI/nT3v6A7xTbhTvBc= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: eba61a82-acdb-4563-81b4-08d4e12de2b5 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR07MB1475; x-ms-traffictypediagnostic: BY2PR07MB1475: x-exchange-antispam-report-test: UriScan:(56005881305849); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123555025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR07MB1475; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR07MB1475; x-forefront-prvs: 039735BC4E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(53754006)(377454003)(199003)(189002)(13464003)(54356999)(101416001)(6246003)(106356001)(76176999)(189998001)(86362001)(2906002)(50986999)(105586002)(55016002)(6436002)(2501003)(99286003)(229853002)(33656002)(8936002)(66066001)(74316002)(68736007)(81156014)(8676002)(25786009)(97736004)(6306002)(81166006)(14454004)(5660300001)(53936002)(77096006)(2201001)(478600001)(9686003)(72206003)(7736002)(6506006)(305945005)(7696004)(53546010)(2950100002)(3280700002)(3846002)(102836003)(2900100001)(3660700001)(6116002)(450100002)(966005); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR07MB1475; H:BY2PR07MB1474.namprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Aug 2017 02:57:35.5753 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB1475 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 02:57:38 -0000 SEkgQWxsLA0KQXBvbG9naXplIGZvciB0aGUgaW5jb252ZW5pZW5jZS4gDQpJIGZvcmdvdCB0byBt ZW50aW9uIHRoZSBmb2xsb3dpbmcuDQoNCk1GQyBhZnRlcjo1IGRheXMNCg0KVGhhbmtzDQpEYXZp ZCBTLiAoZGF2aWRjc0BmcmVlYnNkLm9yZykNCi0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQpG cm9tOiBvd25lci1zcmMtY29tbWl0dGVyc0BmcmVlYnNkLm9yZyBbbWFpbHRvOm93bmVyLXNyYy1j b21taXR0ZXJzQGZyZWVic2Qub3JnXSBPbiBCZWhhbGYgT2YgRGF2aWQgQyBTb21heWFqdWx1DQpT ZW50OiBXZWRuZXNkYXksIEF1Z3VzdCAwOSwgMjAxNyAzOjE5IFBNDQpUbzogc3JjLWNvbW1pdHRl cnNAZnJlZWJzZC5vcmc7IHN2bi1zcmMtYWxsQGZyZWVic2Qub3JnOyBzdm4tc3JjLWhlYWRAZnJl ZWJzZC5vcmcNClN1YmplY3Q6IHN2biBjb21taXQ6IHIzMjIzMzEgLSBpbiBoZWFkL3N5czogZGV2 L3FsbngvcWxueGUgbW9kdWxlcy9xbG54L3FsbnhlDQoNCkF1dGhvcjogZGF2aWRjcw0KRGF0ZTog V2VkIEF1ZyAgOSAyMjoxODo0OSAyMDE3DQpOZXcgUmV2aXNpb246IDMyMjMzMQ0KVVJMOiBodHRw czovL3N2bndlYi5mcmVlYnNkLm9yZy9jaGFuZ2VzZXQvYmFzZS8zMjIzMzENCg0KTG9nOg0KICBQ cm92aWRlIGNvbXBpbGUgdG8gY2hvb3NlIHJlY2VpdmUgcHJvY2Vzc2luZyBpbiBlaXRoZXIgSXRo cmVhZCBvciBUYXNrcXVldWUgVGhyZWFkLg0KDQpNb2RpZmllZDoNCiAgaGVhZC9zeXMvZGV2L3Fs bngvcWxueGUvcWxueF9vcy5jDQogIGhlYWQvc3lzL2Rldi9xbG54L3FsbnhlL3FsbnhfdmVyLmgN CiAgaGVhZC9zeXMvbW9kdWxlcy9xbG54L3FsbnhlL01ha2VmaWxlDQoNCk1vZGlmaWVkOiBoZWFk L3N5cy9kZXYvcWxueC9xbG54ZS9xbG54X29zLmMgPT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQotLS0g aGVhZC9zeXMvZGV2L3FsbngvcWxueGUvcWxueF9vcy5jCVdlZCBBdWcgIDkgMjE6NDQ6NTUgMjAx NwkocjMyMjMzMCkNCisrKyBoZWFkL3N5cy9kZXYvcWxueC9xbG54ZS9xbG54X29zLmMJV2VkIEF1 ZyAgOSAyMjoxODo0OSAyMDE3CShyMzIyMzMxKQ0KQEAgLTM5NywxMCArMzk3LDE0IEBAIHFsbnhf ZnBfdGFza3F1ZXVlKHZvaWQgKmNvbnRleHQsIGludCBwZW5kaW5nKQ0KICAgICAgICAgc3RydWN0 IGlmbmV0CQkqaWZwOw0KICAgICAgICAgc3RydWN0IG1idWYJCSptcDsNCiAgICAgICAgIGludAkJ CXJldCA9IC0xOw0KKwlzdHJ1Y3QgdGhyZWFkCQkqY3RocmVhZDsNCisNCisjaWZkZWYgUUxOWF9S Q1ZfSU5fVEFTS1ENCiAJaW50CQkJbHJvX2VuYWJsZTsNCiAJaW50CQkJcnhfaW50ID0gMCwgdG90 YWxfcnhfY291bnQgPSAwOw0KLQlzdHJ1Y3QgdGhyZWFkCQkqY3RocmVhZDsNCiANCisjZW5kaWYg LyogI2lmZGVmIFFMTlhfUkNWX0lOX1RBU0tRICovDQorDQogICAgICAgICBmcCA9IGNvbnRleHQ7 DQogDQogICAgICAgICBpZiAoZnAgPT0gTlVMTCkNCkBAIC00MTksNTUgKzQyMyw2MCBAQCBxbG54 X2ZwX3Rhc2txdWV1ZSh2b2lkICpjb250ZXh0LCBpbnQgcGVuZGluZykNCiANCiAgICAgICAgIGlm cCA9IGhhLT5pZnA7DQogDQotCWxyb19lbmFibGUgPSBoYS0+aWZwLT5pZl9jYXBlbmFibGUgJiBJ RkNBUF9MUk87DQorI2lmZGVmIFFMTlhfUkNWX0lOX1RBU0tRDQorCXsNCisJCWxyb19lbmFibGUg PSBpZnAtPmlmX2NhcGVuYWJsZSAmIElGQ0FQX0xSTzsNCiANCi0JcnhfaW50ID0gcWxueF9yeF9p bnQoaGEsIGZwLCBoYS0+cnhfcGt0X3RocmVzaG9sZCwgbHJvX2VuYWJsZSk7DQorCQlyeF9pbnQg PSBxbG54X3J4X2ludChoYSwgZnAsIGhhLT5yeF9wa3RfdGhyZXNob2xkLCBscm9fZW5hYmxlKTsN CiANCi0JaWYgKHJ4X2ludCkgew0KLQkJZnAtPnJ4X3BrdHMgKz0gcnhfaW50Ow0KLQkJdG90YWxf cnhfY291bnQgKz0gcnhfaW50Ow0KLQl9DQorCQlpZiAocnhfaW50KSB7DQorCQkJZnAtPnJ4X3Br dHMgKz0gcnhfaW50Ow0KKwkJCXRvdGFsX3J4X2NvdW50ICs9IHJ4X2ludDsNCisJCX0NCiANCiAj aWZkZWYgUUxOWF9TT0ZUX0xSTw0KLQl7DQotCQlzdHJ1Y3QgbHJvX2N0cmwgKmxybzsNCisJCXsN CisJCQlzdHJ1Y3QgbHJvX2N0cmwgKmxybzsNCisJDQorCQkJbHJvID0gJmZwLT5yeHEtPmxybzsN CiANCi0JCWxybyA9ICZmcC0+cnhxLT5scm87DQorCQkJaWYgKGxyb19lbmFibGUgJiYgdG90YWxf cnhfY291bnQpIHsNCiANCi0JCWlmIChscm9fZW5hYmxlICYmIHRvdGFsX3J4X2NvdW50KSB7DQot DQogI2lmIChfX0ZyZWVCU0RfdmVyc2lvbiA+PSAxMTAwMTAxKSB8fCAoZGVmaW5lZCBRTE5YX1FT T1JUX0xSTykNCiANCi0JCQlpZiAoaGEtPmRiZ190cmFjZV9scm9fY250KSB7DQotCQkJCWlmIChs cm8tPmxyb19tYnVmX2NvdW50ICYgfjEwMjMpDQotCQkJCQlmcC0+bHJvX2NudF8xMDI0Kys7DQot CQkJCWVsc2UgaWYgKGxyby0+bHJvX21idWZfY291bnQgJiB+NTExKQ0KLQkJCQkJZnAtPmxyb19j bnRfNTEyKys7DQotCQkJCWVsc2UgaWYgKGxyby0+bHJvX21idWZfY291bnQgJiB+MjU1KQ0KLQkJ CQkJZnAtPmxyb19jbnRfMjU2Kys7DQotCQkJCWVsc2UgaWYgKGxyby0+bHJvX21idWZfY291bnQg JiB+MTI3KQ0KLQkJCQkJZnAtPmxyb19jbnRfMTI4Kys7DQotCQkJCWVsc2UgaWYgKGxyby0+bHJv X21idWZfY291bnQgJiB+NjMpDQotCQkJCQlmcC0+bHJvX2NudF82NCsrOw0KLQkJCX0NCi0JCQl0 Y3BfbHJvX2ZsdXNoX2FsbChscm8pOw0KKwkJCQlpZiAoaGEtPmRiZ190cmFjZV9scm9fY250KSB7 DQorCQkJCQlpZiAobHJvLT5scm9fbWJ1Zl9jb3VudCAmIH4xMDIzKQ0KKwkJCQkJCWZwLT5scm9f Y250XzEwMjQrKzsNCisJCQkJCWVsc2UgaWYgKGxyby0+bHJvX21idWZfY291bnQgJiB+NTExKQ0K KwkJCQkJCWZwLT5scm9fY250XzUxMisrOw0KKwkJCQkJZWxzZSBpZiAobHJvLT5scm9fbWJ1Zl9j b3VudCAmIH4yNTUpDQorCQkJCQkJZnAtPmxyb19jbnRfMjU2Kys7DQorCQkJCQllbHNlIGlmIChs cm8tPmxyb19tYnVmX2NvdW50ICYgfjEyNykNCisJCQkJCQlmcC0+bHJvX2NudF8xMjgrKzsNCisJ CQkJCWVsc2UgaWYgKGxyby0+bHJvX21idWZfY291bnQgJiB+NjMpDQorCQkJCQkJZnAtPmxyb19j bnRfNjQrKzsNCisJCQkJfQ0KKwkJCQl0Y3BfbHJvX2ZsdXNoX2FsbChscm8pOw0KIA0KICNlbHNl DQotCQkJc3RydWN0IGxyb19lbnRyeSAqcXVldWVkOw0KKwkJCQlzdHJ1Y3QgbHJvX2VudHJ5ICpx dWV1ZWQ7DQogDQotCQkJd2hpbGUgKCghU0xJU1RfRU1QVFkoJmxyby0+bHJvX2FjdGl2ZSkpKSB7 DQotCQkJCXF1ZXVlZCA9IFNMSVNUX0ZJUlNUKCZscm8tPmxyb19hY3RpdmUpOw0KLQkJCQlTTElT VF9SRU1PVkVfSEVBRCgmbHJvLT5scm9fYWN0aXZlLCBuZXh0KTsNCi0JCQkJdGNwX2xyb19mbHVz aChscm8sIHF1ZXVlZCk7DQotCQkJfQ0KKwkJCQl3aGlsZSAoKCFTTElTVF9FTVBUWSgmbHJvLT5s cm9fYWN0aXZlKSkpIHsNCisJCQkJCXF1ZXVlZCA9IFNMSVNUX0ZJUlNUKCZscm8tPmxyb19hY3Rp dmUpOw0KKwkJCQkJU0xJU1RfUkVNT1ZFX0hFQUQoJmxyby0+bHJvX2FjdGl2ZSwgbmV4dCk7DQor CQkJCQl0Y3BfbHJvX2ZsdXNoKGxybywgcXVldWVkKTsNCisJCQkJfQ0KICNlbmRpZiAvKiAjaWYg KF9fRnJlZUJTRF92ZXJzaW9uID49IDExMDAxMDEpIHx8IChkZWZpbmVkIFFMTlhfUVNPUlRfTFJP KSAqLw0KKwkJCX0NCiAJCX0NCi0JfQ0KICNlbmRpZiAvKiAjaWZkZWYgUUxOWF9TT0ZUX0xSTyAq Lw0KIA0KLQllY29yZV9zYl91cGRhdGVfc2JfaWR4KGZwLT5zYl9pbmZvKTsNCi0Jcm1iKCk7DQor CQllY29yZV9zYl91cGRhdGVfc2JfaWR4KGZwLT5zYl9pbmZvKTsNCisJCXJtYigpOw0KKwl9DQog DQorI2VuZGlmIC8qICNpZmRlZiBRTE5YX1JDVl9JTl9UQVNLUSAqLw0KKw0KICAgICAgICAgbXR4 X2xvY2soJmZwLT50eF9tdHgpOw0KIA0KICAgICAgICAgaWYgKCgoaWZwLT5pZl9kcnZfZmxhZ3Mg JiAoSUZGX0RSVl9SVU5OSU5HIHwgSUZGX0RSVl9PQUNUSVZFKSkgIT0gQEAgLTQ3NywxMCArNDg2 LDYgQEAgcWxueF9mcF90YXNrcXVldWUodm9pZCAqY29udGV4dCwgaW50IHBlbmRpbmcpDQogICAg ICAgICAgICAgICAgIGdvdG8gcWxueF9mcF90YXNrcXVldWVfZXhpdDsNCiAgICAgICAgIH0NCiAN Ci0vLwlmb3IgKHRjID0gMDsgdGMgPCBoYS0+bnVtX3RjOyB0YysrKSB7DQotLy8JCSh2b2lkKXFs bnhfdHhfaW50KGhhLCBmcCwgZnAtPnR4cVt0Y10pOw0KLS8vCX0NCi0NCiAgICAgICAgIG1wID0g ZHJicl9wZWVrKGlmcCwgZnAtPnR4X2JyKTsNCiANCiAgICAgICAgIHdoaWxlIChtcCAhPSBOVUxM KSB7DQpAQCAtNTE2LDEzICs1MjEsMTEgQEAgcWxueF9mcF90YXNrcXVldWUodm9pZCAqY29udGV4 dCwgaW50IHBlbmRpbmcpDQogICAgICAgICAgICAgICAgIG1wID0gZHJicl9wZWVrKGlmcCwgZnAt PnR4X2JyKTsNCiAgICAgICAgIH0NCiANCi0vLwlmb3IgKHRjID0gMDsgdGMgPCBoYS0+bnVtX3Rj OyB0YysrKSB7DQotLy8JCSh2b2lkKXFsbnhfdHhfaW50KGhhLCBmcCwgZnAtPnR4cVt0Y10pOw0K LS8vCX0NCi0NCiAgICAgICAgIG10eF91bmxvY2soJmZwLT50eF9tdHgpOw0KIA0KIHFsbnhfZnBf dGFza3F1ZXVlX2V4aXQ6DQorDQorI2lmZGVmIFFMTlhfUkNWX0lOX1RBU0tRDQogCWlmIChyeF9p bnQpIHsNCiAJCWlmIChmcC0+ZnBfdGFza3F1ZXVlICE9IE5VTEwpDQogCQkJdGFza3F1ZXVlX2Vu cXVldWUoZnAtPmZwX3Rhc2txdWV1ZSwgJmZwLT5mcF90YXNrKTsgQEAgLTUzMiw2ICs1MzUsNyBA QCBxbG54X2ZwX3Rhc2txdWV1ZV9leGl0Og0KIAkJfQ0KIAkJZWNvcmVfc2JfYWNrKGZwLT5zYl9p bmZvLCBJR1VfSU5UX0VOQUJMRSwgMSk7DQogCX0NCisjZW5kaWYgLyogI2lmZGVmIFFMTlhfUkNW X0lOX1RBU0tRICovDQogDQogICAgICAgICBRTF9EUFJJTlQyKGhhLCAiZXhpdCByZXQgPSAlZFxu IiwgcmV0KTsNCiAgICAgICAgIHJldHVybjsNCkBAIC00MjYyLDYgKzQyNjYsNyBAQCBuZXh0X2Nx ZToJLyogZG9uJ3QgY29uc3VtZSBiZCByeCBidWZmZXIgKi8NCiAgICAgICAgIHJldHVybiByeF9w a3Q7DQogfQ0KIA0KKw0KIC8qDQogICogZmFzdCBwYXRoIGludGVycnVwdA0KICAqLw0KQEAgLTQy OTIsOSArNDI5Nyw4MiBAQCBxbG54X2ZwX2lzcih2b2lkICphcmcpDQogICAgICAgICBpZiAoZnAg PT0gTlVMTCkgew0KICAgICAgICAgICAgICAgICBoYS0+ZXJyX2ZwX251bGwrKzsNCiAgICAgICAg IH0gZWxzZSB7DQorDQorI2lmZGVmIFFMTlhfUkNWX0lOX1RBU0tRDQogICAgICAgICAgICAgICAg IGVjb3JlX3NiX2FjayhmcC0+c2JfaW5mbywgSUdVX0lOVF9ESVNBQkxFLCAwKTsNCiAJCWlmIChm cC0+ZnBfdGFza3F1ZXVlICE9IE5VTEwpDQogCQkJdGFza3F1ZXVlX2VucXVldWUoZnAtPmZwX3Rh c2txdWV1ZSwgJmZwLT5mcF90YXNrKTsNCisjZWxzZQ0KKwkJaW50CXJ4X2ludCA9IDAsIHRvdGFs X3J4X2NvdW50ID0gMDsNCisJCWludCAJbHJvX2VuYWJsZSwgdGM7DQorDQorCQlscm9fZW5hYmxl ID0gaGEtPmlmcC0+aWZfY2FwZW5hYmxlICYgSUZDQVBfTFJPOw0KKw0KKyAgICAgICAgICAgICAg ICBlY29yZV9zYl9hY2soZnAtPnNiX2luZm8sIElHVV9JTlRfRElTQUJMRSwgMCk7DQorDQorICAg ICAgICAgICAgICAgIGRvIHsNCisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHRjID0gMDsg dGMgPCBoYS0+bnVtX3RjOyB0YysrKSB7DQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBpZiAobXR4X3RyeWxvY2soJmZwLT50eF9tdHgpKSB7DQorICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHFsbnhfdHhfaW50KGhhLCBmcCwgZnAtPnR4cVt0Y10pOw0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtdHhfdW5sb2NrKCZmcC0+dHhf bXR4KTsNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCisgICAgICAgICAgICAg ICAgICAgICAgICB9DQorDQorICAgICAgICAgICAgICAgICAgICAgICAgcnhfaW50ID0gcWxueF9y eF9pbnQoaGEsIGZwLCBoYS0+cnhfcGt0X3RocmVzaG9sZCwNCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgbHJvX2VuYWJsZSk7DQorDQorICAgICAgICAgICAgICAgICAg ICAgICAgaWYgKHJ4X2ludCkgew0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnAt PnJ4X3BrdHMgKz0gcnhfaW50Ow0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG90 YWxfcnhfY291bnQgKz0gcnhfaW50Ow0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0NCisNCisg ICAgICAgICAgICAgICAgfSB3aGlsZSAocnhfaW50KTsNCisNCisNCisjaWZkZWYgUUxOWF9TT0ZU X0xSTw0KKyAgICAgICAgICAgICAgICB7DQorICAgICAgICAgICAgICAgICAgICAgICAgc3RydWN0 IGxyb19jdHJsICpscm87DQorDQorICAgICAgICAgICAgICAgICAgICAgICAgbHJvID0gJmZwLT5y eHEtPmxybzsNCisNCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobHJvX2VuYWJsZSAmJiB0 b3RhbF9yeF9jb3VudCkgew0KKw0KKyNpZiAoX19GcmVlQlNEX3ZlcnNpb24gPj0gMTEwMDEwMSkg fHwgKGRlZmluZWQgUUxOWF9RU09SVF9MUk8pDQorDQorI2lmZGVmIFFMTlhfVFJBQ0VfTFJPX0NO VA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxyby0+bHJvX21idWZfY291 bnQgJiB+MTAyMykNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnAt Pmxyb19jbnRfMTAyNCsrOw0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBp ZiAobHJvLT5scm9fbWJ1Zl9jb3VudCAmIH41MTEpDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIGZwLT5scm9fY250XzUxMisrOw0KKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgZWxzZSBpZiAobHJvLT5scm9fbWJ1Zl9jb3VudCAmIH4yNTUpDQorICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZwLT5scm9fY250XzI1NisrOw0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAobHJvLT5scm9fbWJ1Zl9jb3Vu dCAmIH4xMjcpDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZwLT5s cm9fY250XzEyOCsrOw0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAo bHJvLT5scm9fbWJ1Zl9jb3VudCAmIH42MykNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgZnAtPmxyb19jbnRfNjQrKzsgI2VuZGlmIC8qIA0KKyNpZmRlZiBRTE5YX1RS QUNFX0xST19DTlQgKi8NCisNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRjcF9s cm9fZmx1c2hfYWxsKGxybyk7DQorDQorI2Vsc2UNCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIHN0cnVjdCBscm9fZW50cnkgKnF1ZXVlZDsNCisNCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIHdoaWxlICgoIVNMSVNUX0VNUFRZKCZscm8tPmxyb19hY3RpdmUpKSkgew0K KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxdWV1ZWQgPSBTTElTVF9G SVJTVCgmbHJvLT5scm9fYWN0aXZlKTsNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgU0xJU1RfUkVNT1ZFX0hFQUQoJmxyby0+bHJvX2FjdGl2ZSwgXA0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5leHQpOw0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Y3BfbHJvX2ZsdXNoKGxybywgcXVldWVk KTsNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCisjZW5kaWYgLyogI2lmIChf X0ZyZWVCU0RfdmVyc2lvbiA+PSAxMTAwMTAxKSB8fCAoZGVmaW5lZCBRTE5YX1FTT1JUX0xSTykg Ki8NCisgICAgICAgICAgICAgICAgICAgICAgICB9DQorICAgICAgICAgICAgICAgIH0NCisjZW5k aWYgLyogI2lmZGVmIFFMTlhfU09GVF9MUk8gKi8NCisNCisgICAgICAgICAgICAgICAgZWNvcmVf c2JfdXBkYXRlX3NiX2lkeChmcC0+c2JfaW5mbyk7DQorICAgICAgICAgICAgICAgIHJtYigpOw0K KyAgICAgICAgICAgICAgICBlY29yZV9zYl9hY2soZnAtPnNiX2luZm8sIElHVV9JTlRfRU5BQkxF LCAxKTsNCisNCisjZW5kaWYgLyogI2lmZGVmIFFMTlhfUkNWX0lOX1RBU0tRICovDQogICAgICAg ICB9DQogDQogICAgICAgICByZXR1cm47DQoNCk1vZGlmaWVkOiBoZWFkL3N5cy9kZXYvcWxueC9x bG54ZS9xbG54X3Zlci5oDQo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0NCi0tLSBoZWFkL3N5cy9kZXYv cWxueC9xbG54ZS9xbG54X3Zlci5oCVdlZCBBdWcgIDkgMjE6NDQ6NTUgMjAxNwkocjMyMjMzMCkN CisrKyBoZWFkL3N5cy9kZXYvcWxueC9xbG54ZS9xbG54X3Zlci5oCVdlZCBBdWcgIDkgMjI6MTg6 NDkgMjAxNwkocjMyMjMzMSkNCkBAIC0zOSw1ICszOSw1IEBADQogDQogI2RlZmluZSBRTE5YX1ZF UlNJT05fTUFKT1IgICAgICAxDQogI2RlZmluZSBRTE5YX1ZFUlNJT05fTUlOT1IgICAgICA0DQot I2RlZmluZSBRTE5YX1ZFUlNJT05fQlVJTEQgICAgICA1DQorI2RlZmluZSBRTE5YX1ZFUlNJT05f QlVJTEQgICAgICA2DQogDQoNCk1vZGlmaWVkOiBoZWFkL3N5cy9tb2R1bGVzL3FsbngvcWxueGUv TWFrZWZpbGUNCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KLS0tIGhlYWQvc3lzL21vZHVsZXMvcWxu eC9xbG54ZS9NYWtlZmlsZQlXZWQgQXVnICA5IDIxOjQ0OjU1IDIwMTcJKHIzMjIzMzApDQorKysg aGVhZC9zeXMvbW9kdWxlcy9xbG54L3FsbnhlL01ha2VmaWxlCVdlZCBBdWcgIDkgMjI6MTg6NDkg MjAxNwkocjMyMjMzMSkNCkBAIC02NSw1ICs2NSw2IEBAIENGTEFHUys9IC1JJHtTUkNUT1B9L3N5 cy9jb21wYXQvbGludXhrcGkvY29tbW9uL2luY2x1ZA0KICNDRkxBR1MgKz0gLURRTE5YX1NPRlRf TFJPDQogI0NGTEFHUyArPSAtRFFMTlhfUVNPUlRfTFJPDQogI0NGTEFHUyArPSAtRFFMTlhfTUFY X0NPQUxFU0NFDQorI0NGTEFHUyArPSAtRFFMTlhfUkNWX0lOX1RBU0tRDQogDQogQ1dBUk5GTEFH Uys9IC1Xbm8tY2FzdC1xdWFsDQoNCg== From owner-svn-src-all@freebsd.org Sat Aug 12 08:51:20 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56B64DC7242; Sat, 12 Aug 2017 08:51:20 +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 mx1.freebsd.org (Postfix) with ESMTPS id 238EF7DBDD; Sat, 12 Aug 2017 08:51:20 +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 v7C8pJrs074221; Sat, 12 Aug 2017 08:51:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7C8pJ0m074220; Sat, 12 Aug 2017 08:51:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708120851.v7C8pJ0m074220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 12 Aug 2017 08:51:19 +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: r322422 - stable/11/share/man/man3 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/share/man/man3 X-SVN-Commit-Revision: 322422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 08:51:20 -0000 Author: kib Date: Sat Aug 12 08:51:19 2017 New Revision: 322422 URL: https://svnweb.freebsd.org/changeset/base/322422 Log: MFC r322077: Provide more detailed specification for major(), minor() and makedev(). Modified: stable/11/share/man/man3/makedev.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man3/makedev.3 ============================================================================== --- stable/11/share/man/man3/makedev.3 Fri Aug 11 23:12:28 2017 (r322421) +++ stable/11/share/man/man3/makedev.3 Sat Aug 12 08:51:19 2017 (r322422) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 28, 2008 +.Dd August 3, 2017 .Dt MAKEDEV 3 .Os .Sh NAME @@ -43,7 +43,7 @@ .Sh DESCRIPTION The .Fn makedev -macro allows a unique device number to be generated based on its +macro returns a device number created from the provided .Fa major and .Fa minor @@ -52,13 +52,26 @@ The .Fn major and .Fn minor -macros can be used to obtain the original numbers from the device number +macros return the original numbers from the device number .Fa dev . +In other words, for a value +.Va dev +of the type +.Vt dev_t , +and values +.Va ma , mi +of the type +.Vt int , +the assertions +.Dl dev == makedev(major(dev), minor(dev)) +.Dl ma == major(makedev(ma, mi)) +.Dl mi == minor(makedev(ma, mi)) +are valid. .Pp In previous implementations of .Fx all block and character devices were uniquely identified by a pair of -major and minor numbers. +stable major and minor numbers. The major number referred to a certain device class (e.g. disks, TTYs) while the minor number identified an instance within the device class. Later versions of @@ -66,7 +79,8 @@ Later versions of automatically generate a unique device number for each character device visible in .Pa /dev/ . -These numbers are not divided in device classes. +These numbers are not divided in device classes and are not guaranteed +to be stable upon reboot or driver reload. .Pp On .Fx @@ -78,11 +92,9 @@ conventional way. .Sh RETURN VALUES The .Fn major -macro returns a device major number that has a value between 0 and 255. -The +and .Fn minor -macro returns a device minor number whose value can span the complete -range of an +macros return numbers whose value can span the complete range of an .Vt int . .Sh SEE ALSO .Xr mknod 2 , From owner-svn-src-all@freebsd.org Sat Aug 12 10:22:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5A28DCC05E; Sat, 12 Aug 2017 10:22:19 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9F97580459; Sat, 12 Aug 2017 10:22:19 +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 v7CAMIDN014908; Sat, 12 Aug 2017 10:22:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CAMIqj014907; Sat, 12 Aug 2017 10:22:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201708121022.v7CAMIqj014907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 12 Aug 2017 10:22:18 +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: r322423 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/ctl X-SVN-Commit-Revision: 322423 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 10:22:20 -0000 Author: mav Date: Sat Aug 12 10:22:18 2017 New Revision: 322423 URL: https://svnweb.freebsd.org/changeset/base/322423 Log: MFC r322302: Do not loose CCB flags after r320493. There is at least CAM_UNLOCKED that should be kept. Modified: stable/11/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/11/sys/cam/ctl/scsi_ctl.c Sat Aug 12 08:51:19 2017 (r322422) +++ stable/11/sys/cam/ctl/scsi_ctl.c Sat Aug 12 10:22:18 2017 (r322423) @@ -1009,7 +1009,8 @@ ctlfe_requeue_ccb(struct cam_periph *periph, union ccb * target/lun. Reset the target and LUN fields back to the wildcard * values before we send them back down to the SIM. */ - xpt_setup_ccb(&ccb->ccb_h, periph->path, CAM_PRIORITY_NONE); + xpt_setup_ccb_flags(&ccb->ccb_h, periph->path, CAM_PRIORITY_NONE, + ccb->ccb_h.flags); xpt_action(ccb); } From owner-svn-src-all@freebsd.org Sat Aug 12 12:17:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 830EBDD2DA4; Sat, 12 Aug 2017 12:17:39 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 4FB7F83E99; Sat, 12 Aug 2017 12:17:39 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CCHcRA059745; Sat, 12 Aug 2017 12:17:38 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CCHcQV059744; Sat, 12 Aug 2017 12:17:38 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201708121217.v7CCHcQV059744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sat, 12 Aug 2017 12:17:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322424 - head/usr.bin/units X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: head/usr.bin/units X-SVN-Commit-Revision: 322424 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 12:17:39 -0000 Author: sevan (doc committer) Date: Sat Aug 12 12:17:38 2017 New Revision: 322424 URL: https://svnweb.freebsd.org/changeset/base/322424 Log: Correct the -H longopt equivillant PR: 209876 Submitted by: Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D11988 Modified: head/usr.bin/units/units.1 Modified: head/usr.bin/units/units.1 ============================================================================== --- head/usr.bin/units/units.1 Sat Aug 12 10:22:18 2017 (r322423) +++ head/usr.bin/units/units.1 Sat Aug 12 12:17:38 2017 (r322424) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd July 4, 2014 +.Dd August 12, 2017 .Dt UNITS 1 .Os .Sh NAME @@ -18,7 +18,7 @@ The following options are available: Show an overview of options .It Fl f Ar filename \&No , Fl -file Ar filename Specify the name of the units data file to load. -.It Fl H Ar filename \&No , Fl -historyfile Ar filename +.It Fl H Ar filename \&No , Fl -history Ar filename Ignored, for compatibility with GNU units. .It Fl e , Fl -exponential Behave as if -o '%6e' was typed. From owner-svn-src-all@freebsd.org Sat Aug 12 14:02:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49CB6DD859A; Sat, 12 Aug 2017 14:02:21 +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 mx1.freebsd.org (Postfix) with ESMTPS id 25CCD2A9C; Sat, 12 Aug 2017 14:02:21 +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 v7CE2KiQ005506; Sat, 12 Aug 2017 14:02:20 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CE2K1O005503; Sat, 12 Aug 2017 14:02:20 GMT (envelope-from np@FreeBSD.org) Message-Id: <201708121402.v7CE2K1O005503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sat, 12 Aug 2017 14:02:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322425 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 322425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 14:02:21 -0000 Author: np Date: Sat Aug 12 14:02:19 2017 New Revision: 322425 URL: https://svnweb.freebsd.org/changeset/base/322425 Log: cxgbe(4): Save the last reported link parameters and compare them with the current state to determine whether to generate a link-state change notification. This fixes a bug introduced in r321063 that caused the driver to sometimes skip these notifications. Reported by: Jason Eggleston @ LLNW MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Sat Aug 12 12:17:38 2017 (r322424) +++ head/sys/dev/cxgbe/adapter.h Sat Aug 12 14:02:19 2017 (r322425) @@ -287,6 +287,7 @@ struct port_info { uint8_t rx_chan_map; /* rx MPS channel bitmap */ struct link_config link_cfg; + struct link_config old_link_cfg; struct timeval last_refreshed; struct port_stats stats; @@ -1124,8 +1125,8 @@ extern device_method_t cxgbe_methods[]; int t4_os_find_pci_capability(struct adapter *, int); int t4_os_pci_save_state(struct adapter *); int t4_os_pci_restore_state(struct adapter *); -void t4_os_portmod_changed(struct port_info *, int, int, struct link_config *); -void t4_os_link_changed(struct port_info *, struct link_config *); +void t4_os_portmod_changed(struct port_info *); +void t4_os_link_changed(struct port_info *); void t4_iterate(void (*)(struct adapter *, void *), void *); void t4_init_devnames(struct adapter *); void t4_add_adapter(struct adapter *); Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Sat Aug 12 12:17:38 2017 (r322424) +++ head/sys/dev/cxgbe/common/t4_hw.c Sat Aug 12 14:02:19 2017 (r322425) @@ -7715,7 +7715,7 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be6 int i, old_ptype, old_mtype; int chan = G_FW_PORT_CMD_PORTID(be32_to_cpu(p->op_to_portid)); struct port_info *pi = NULL; - struct link_config *lc, old_lc; + struct link_config *lc, *old_lc; for_each_port(adap, i) { pi = adap2pinfo(adap, i); @@ -7724,19 +7724,20 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be6 } lc = &pi->link_cfg; - old_lc = *lc; + old_lc = &pi->old_link_cfg; old_ptype = pi->port_type; old_mtype = pi->mod_type; handle_port_info(pi, &p->u.info); if (old_ptype != pi->port_type || old_mtype != pi->mod_type) { - t4_os_portmod_changed(pi, old_ptype, old_mtype, - &old_lc); + t4_os_portmod_changed(pi); } - if (old_lc.link_ok != lc->link_ok || - old_lc.speed != lc->speed || - old_lc.fc != lc->fc) { - t4_os_link_changed(pi, &old_lc); + if (old_lc->link_ok != lc->link_ok || + old_lc->speed != lc->speed || + old_lc->fec != lc->fec || + old_lc->fc != lc->fc) { + t4_os_link_changed(pi); + *old_lc = *lc; } } else { CH_WARN_RATELIMIT(adap, "Unknown firmware reply %d\n", opcode); Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Sat Aug 12 12:17:38 2017 (r322424) +++ head/sys/dev/cxgbe/t4_main.c Sat Aug 12 14:02:19 2017 (r322425) @@ -4335,7 +4335,8 @@ cxgbe_uninit_synchronized(struct vi_info *vi) pi->link_cfg.link_ok = 0; pi->link_cfg.speed = 0; pi->link_cfg.link_down_rc = 255; - t4_os_link_changed(pi, NULL); + t4_os_link_changed(pi); + pi->old_link_cfg = pi->link_cfg; return (0); } @@ -9274,8 +9275,7 @@ t4_os_pci_restore_state(struct adapter *sc) } void -t4_os_portmod_changed(struct port_info *pi, int old_ptype, int old_mtype, - struct link_config *old_lc) +t4_os_portmod_changed(struct port_info *pi) { struct vi_info *vi; struct ifnet *ifp; @@ -9312,7 +9312,7 @@ t4_os_portmod_changed(struct port_info *pi, int old_pt } void -t4_os_link_changed(struct port_info *pi, struct link_config *old_lc) +t4_os_link_changed(struct port_info *pi) { struct vi_info *vi; struct ifnet *ifp; From owner-svn-src-all@freebsd.org Sat Aug 12 14:58:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1E6DDDB928; Sat, 12 Aug 2017 14:58:10 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7C4C063B9A; Sat, 12 Aug 2017 14:58:10 +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 v7CEw9bI026909; Sat, 12 Aug 2017 14:58:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CEw9HP026908; Sat, 12 Aug 2017 14:58:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708121458.v7CEw9HP026908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 12 Aug 2017 14:58:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322426 - head/lib/libc/string X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/string X-SVN-Commit-Revision: 322426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 14:58:10 -0000 Author: kib Date: Sat Aug 12 14:58:09 2017 New Revision: 322426 URL: https://svnweb.freebsd.org/changeset/base/322426 Log: Fix indent. Submitted by: Yuri Pankov MFC after: 3 days Modified: head/lib/libc/string/memset_s.c Modified: head/lib/libc/string/memset_s.c ============================================================================== --- head/lib/libc/string/memset_s.c Sat Aug 12 14:02:19 2017 (r322425) +++ head/lib/libc/string/memset_s.c Sat Aug 12 14:58:09 2017 (r322426) @@ -49,7 +49,7 @@ memset_s(void *s, rsize_t smax, int c, rsize_t n) __throw_constraint_handler_s("memset_s : s is NULL", ret); } else if (smax > RSIZE_MAX) { __throw_constraint_handler_s("memset_s : smax > RSIZE_MAX", - ret); + ret); } else if (n > RSIZE_MAX) { __throw_constraint_handler_s("memset_s : n > RSIZE_MAX", ret); } else { From owner-svn-src-all@freebsd.org Sat Aug 12 15:18:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78C82DDCAF4; Sat, 12 Aug 2017 15:18: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 mx1.freebsd.org (Postfix) with ESMTPS id 54A0B64755; Sat, 12 Aug 2017 15:18: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 v7CFIHiP035167; Sat, 12 Aug 2017 15:18:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CFIHld035164; Sat, 12 Aug 2017 15:18:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708121518.v7CFIHld035164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 12 Aug 2017 15:18:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322427 - in head/lib/libc: stdlib string tests/string X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/lib/libc: stdlib string tests/string X-SVN-Commit-Revision: 322427 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 15:18:18 -0000 Author: kib Date: Sat Aug 12 15:18:17 2017 New Revision: 322427 URL: https://svnweb.freebsd.org/changeset/base/322427 Log: Improve standard compliance for memset_s() and abort_handler_s(). abort_handler_s() currently simply calls abort(), though the standard specifies more: "Writes an implementation-defined message to stderr which must include the string pointed to by msg and calls abort()." memset_s() is missing error condition "n > smax", and does not invoke the constraint handler after filling the buffer: "following errors are detected at runtime and call the currently installed constraint handler function after storing ch in every location of the destination range [dest, dest+destsz) if dest and destsz are themselves valid", one of the errors is "n > smax" itself. Submitted by: Yuri Pankov MFC after: 1 week Differential revision: https://reviews.freebsd.org/D11991 Modified: head/lib/libc/stdlib/set_constraint_handler_s.c head/lib/libc/string/memset_s.c head/lib/libc/tests/string/memset_s_test.c Modified: head/lib/libc/stdlib/set_constraint_handler_s.c ============================================================================== --- head/lib/libc/stdlib/set_constraint_handler_s.c Sat Aug 12 14:58:09 2017 (r322426) +++ head/lib/libc/stdlib/set_constraint_handler_s.c Sat Aug 12 15:18:17 2017 (r322427) @@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "un-namespace.h" #include "libc_private.h" @@ -81,10 +83,14 @@ __throw_constraint_handler_s(const char * restrict msg } void -abort_handler_s(const char * restrict msg __unused, - void * restrict ptr __unused, errno_t error __unused) +abort_handler_s(const char * restrict msg, void * restrict ptr __unused, + errno_t error __unused) { + static const char ahs[] = "abort_handler_s : "; + (void) _write(STDERR_FILENO, ahs, sizeof(ahs) - 1); + (void) _write(STDERR_FILENO, msg, strlen(msg)); + (void) _write(STDERR_FILENO, "\n", 1); abort(); } Modified: head/lib/libc/string/memset_s.c ============================================================================== --- head/lib/libc/string/memset_s.c Sat Aug 12 14:58:09 2017 (r322426) +++ head/lib/libc/string/memset_s.c Sat Aug 12 15:18:17 2017 (r322427) @@ -42,7 +42,7 @@ memset_s(void *s, rsize_t smax, int c, rsize_t n) volatile unsigned char *dst; ret = EINVAL; - lim = smax; + lim = n < smax ? n : smax; v = (unsigned char)c; dst = (unsigned char *)s; if (s == NULL) { @@ -53,11 +53,14 @@ memset_s(void *s, rsize_t smax, int c, rsize_t n) } else if (n > RSIZE_MAX) { __throw_constraint_handler_s("memset_s : n > RSIZE_MAX", ret); } else { - if (n < smax) - lim = n; while (lim > 0) dst[--lim] = v; - ret = 0; + if (n > smax) { + __throw_constraint_handler_s("memset_s : n > smax", + ret); + } else { + ret = 0; + } } return (ret); } Modified: head/lib/libc/tests/string/memset_s_test.c ============================================================================== --- head/lib/libc/tests/string/memset_s_test.c Sat Aug 12 14:58:09 2017 (r322426) +++ head/lib/libc/tests/string/memset_s_test.c Sat Aug 12 15:18:17 2017 (r322427) @@ -109,13 +109,18 @@ ATF_TC_BODY(n_lt_smax, tc) assert(b[2] == 3); } -/* n > smax */ +/* n > smax, handler */ ATF_TC_WITHOUT_HEAD(n_gt_smax); ATF_TC_BODY(n_gt_smax, tc) { char b[3] = {1, 2, 3}; - assert(memset_s(&b[0], 1, 9, 3) == 0); + e = 0; + m = NULL; + set_constraint_handler_s(h); + assert(memset_s(&b[0], 1, 9, 3) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s : n > smax") == 0); assert(b[0] == 9); assert(b[1] == 2); assert(b[2] == 3); From owner-svn-src-all@freebsd.org Sat Aug 12 15:51:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CAF2DDEC69; Sat, 12 Aug 2017 15:51:47 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 46D7E65F39; Sat, 12 Aug 2017 15:51:47 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CFpkkf048900; Sat, 12 Aug 2017 15:51:46 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CFpkbS048899; Sat, 12 Aug 2017 15:51:46 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201708121551.v7CFpkbS048899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sat, 12 Aug 2017 15:51:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322428 - head/usr.bin/mkesdb X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: head/usr.bin/mkesdb X-SVN-Commit-Revision: 322428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 15:51:47 -0000 Author: sevan (doc committer) Date: Sat Aug 12 15:51:46 2017 New Revision: 322428 URL: https://svnweb.freebsd.org/changeset/base/322428 Log: Set usage() to show -d flag mkesdb supports the -d flag for enabling debug mode, as documented in the manual. PR: 209865 Submitted by: Maya Rashish Reviewed by: imp Approved by: bcr (mentor) Obtained from: NetBSD MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D11987 Modified: head/usr.bin/mkesdb/yacc.y Modified: head/usr.bin/mkesdb/yacc.y ============================================================================== --- head/usr.bin/mkesdb/yacc.y Sat Aug 12 15:18:17 2017 (r322427) +++ head/usr.bin/mkesdb/yacc.y Sat Aug 12 15:51:46 2017 (r322428) @@ -278,8 +278,8 @@ usage(void) { errx(EXIT_FAILURE, "usage:\n" - "\t%s [-o outfile] [infile]\n" - "\t%s -m [-o outfile] [infile]", + "\t%s [-d] [-o outfile] [infile]\n" + "\t%s -m [-d] [-o outfile] [infile]", getprogname(), getprogname()); } From owner-svn-src-all@freebsd.org Sat Aug 12 16:16:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 528A1DE0127; Sat, 12 Aug 2017 16:16:38 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-pg0-f51.google.com (mail-pg0-f51.google.com [74.125.83.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D6E966BE3; Sat, 12 Aug 2017 16:16:37 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-pg0-f51.google.com with SMTP id l64so26213210pge.5; Sat, 12 Aug 2017 09:16:37 -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:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=HwktBXzSMQLFrKNqzfmXGAr/jt9+iFq0lg2sXAmuRqQ=; b=TR961h7XHbZVlZVytk8t8sLEokAtEP/7Qf/WuJ6n/7nYoThlT0NSKqehQhk7kZgMWq 8gcTaQdBoVkPvXDXZGZY8UvWVOy4+32uSBqwtZFNEPOHJuERyK6VittRa4DCbUnQIDb1 kdLR82u2lU27HE8P5n5hXfwW7S7djp4ccwC490rN/v8eQzJTDI3WXnwy+MyyAceE8OtG CBA/LruWomQXp4pNEAwjdpi4noYI32zM+MMhVtpzTMSj+5cKQ8iSKAVf9DW7ciOp0vdv cNaf0xwqZJg29A/S5AEiylb/wfCTMyz/mETvd8OBMhY0f3cqIHExyJ1WKki0c8QVxJLA TJLg== X-Gm-Message-State: AHYfb5gKyg9wl9vZcFcvTH5NePr1KDwl3EL6uFIDft/V57gOvfstqilS tbA2ohBZSyT7ByvB14g= X-Received: by 10.99.175.1 with SMTP id w1mr18442935pge.392.1502554596955; Sat, 12 Aug 2017 09:16:36 -0700 (PDT) Received: from mail-pf0-f176.google.com (mail-pf0-f176.google.com. [209.85.192.176]) by smtp.gmail.com with ESMTPSA id b4sm6517025pfg.132.2017.08.12.09.16.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Aug 2017 09:16:36 -0700 (PDT) Received: by mail-pf0-f176.google.com with SMTP id h68so26873173pfk.0; Sat, 12 Aug 2017 09:16:36 -0700 (PDT) X-Received: by 10.98.70.200 with SMTP id o69mr19948077pfi.325.1502554596638; Sat, 12 Aug 2017 09:16:36 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.100.150.15 with HTTP; Sat, 12 Aug 2017 09:16:36 -0700 (PDT) In-Reply-To: <201708121518.v7CFIHld035164@repo.freebsd.org> References: <201708121518.v7CFIHld035164@repo.freebsd.org> From: Conrad Meyer Date: Sat, 12 Aug 2017 09:16:36 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322427 - in head/lib/libc: stdlib string tests/string To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 16:16:38 -0000 On Sat, Aug 12, 2017 at 8:18 AM, Konstantin Belousov wrote: > Author: kib > Date: Sat Aug 12 15:18:17 2017 > New Revision: 322427 > URL: https://svnweb.freebsd.org/changeset/base/322427 > > Log: > Improve standard compliance for memset_s() and abort_handler_s(). > > abort_handler_s() currently simply calls abort(), though the standard > specifies more: "Writes an implementation-defined message to stderr > which must include the string pointed to by msg and calls abort()." > > memset_s() is missing error condition "n > smax", and does not invoke > the constraint handler after filling the buffer: "following errors are > detected at runtime and call the currently installed constraint > handler function after storing ch in every location of the destination > range [dest, dest+destsz) if dest and destsz are themselves valid", > one of the errors is "n > smax" itself. > > Submitted by: Yuri Pankov > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D11991 PR: 221323 From owner-svn-src-all@freebsd.org Sat Aug 12 16:26:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9492FDE0982 for ; Sat, 12 Aug 2017 16:26:35 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (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 78F4E67152 for ; Sat, 12 Aug 2017 16:26:35 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: feb95366-7f7a-11e7-b49e-71a67e0dab63 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id feb95366-7f7a-11e7-b49e-71a67e0dab63; Sat, 12 Aug 2017 16:26:29 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v7CGQV8E003870; Sat, 12 Aug 2017 10:26:31 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1502555191.47886.30.camel@freebsd.org> Subject: Re: svn commit: r322418 - head/lib/msun/src From: Ian Lepore To: Ryan Libby , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sat, 12 Aug 2017 10:26:31 -0600 In-Reply-To: <201708112241.v7BMfP5X028262@repo.freebsd.org> References: <201708112241.v7BMfP5X028262@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 16:26:35 -0000 On Fri, 2017-08-11 at 22:41 +0000, Ryan Libby wrote: > Author: rlibby > Date: Fri Aug 11 22:41:24 2017 > New Revision: 322418 > URL: https://svnweb.freebsd.org/changeset/base/322418 > > Log: >   lib/msun: avoid referring to broken LDBL_MAX >    >   LDBL_MAX is broken on i386: >   https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September > /000288.html >    >   Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32 >   for some time, and newer versions of gcc are now warning that the >   "floating constant exceeds range of 'long double'".  Avoid this by >   referring to half the value of LDBL_MAX instead. >    >   Reviewed by: bde >   Approved by: markj (mentor) >   Sponsored by: Dell EMC Isilon > I now get this error when building toolchain for sparc: cc -isystem /b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/include -L/b/staging/freebsd/head/obj/sparc64.spar c64/b/staging/freebsd/head/src/tmp/usr/lib -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/lib --sysroot=/b/ staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/ src/tmp/usr/bin -fPIC -DPIC -g -O2 -pipe -I/b/staging/freebsd/head/src/lib/msun/ld128 -I/b/staging/freebsd/head/src/lib/msun/sparc64 -I/b/sta ging/freebsd/head/src/lib/msun/src -I/b/staging/freebsd/head/src/lib/libc/include  -I/b/staging/freebsd/head/src/lib/libc/sparc64   -MD  -MF. depend.catrigl.pico -MTcatrigl.pico -std=gnu99 -fstack-protector-strong -Wsystem-headers -Werror -Wno-pointer-sign -Wno-unknown-pragmas     - c /b/staging/freebsd/head/src/lib/msun/src/catrigl.c -o catrigl.pico /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting "0x0.8p" and "(" does not give a valid preprocessing token /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: exponent has no digits /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting ")" and "L" does not give a valid preprocessing token /b/staging/freebsd/head/src/lib/msun/src/catrigl.c: In function 'clog_for_large_values': /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310: error: expected ')' before 'L' *** [catrigl.pico] Error code 1 From owner-svn-src-all@freebsd.org Sat Aug 12 16:57:41 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B436DD93620; Sat, 12 Aug 2017 16:57:41 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-pg0-f44.google.com (mail-pg0-f44.google.com [74.125.83.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EE9B681FF; Sat, 12 Aug 2017 16:57:41 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-pg0-f44.google.com with SMTP id v77so26473135pgb.3; Sat, 12 Aug 2017 09:57:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=VhR92VbNFOvyGUQmoqImmA6Aq6yT5mnaXSghQ0cZGPM=; b=ksTNz+hKAfN6Iu+CDalg8IS8aueTjNUk+EuqE2Tand4o0lsK7LqdgVftDqiN5wBOGA MFRsUlnkn11XLj8jgtDaoPCR29vnii0oT9pNRTHbqM3RKWJ/7o0tiB76GNh6Fd+gXF6K UU3vWanNKHy9O494TjG1i9bjSjdEv0QfFh2fUFkOBvyW5gbcq6EzIsS7NvQeecdMmzAu LiWyBcB8cthmuxhQKuucY+VZ9llB12L4hHFE/ZbEXd5+DzJ8dbVhpjooKe/81E1pZbdk m2STP3cjfv6kcow6qIRu8/0B5jXnCQeZODaWgK/EUrxszE5viajiP+OkhPT7ql4gNyAq T2rw== X-Gm-Message-State: AHYfb5jDN0b8VQtOsQVggAGTwMMRwxaKDNn1uYyRDz+0h6cdHqA2a7qJ +6+KYrAUbksM1pkQ8ck6Ig== X-Received: by 10.98.198.145 with SMTP id x17mr20199330pfk.272.1502557054862; Sat, 12 Aug 2017 09:57:34 -0700 (PDT) Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com. [209.85.192.181]) by smtp.gmail.com with ESMTPSA id f15sm7228583pfj.127.2017.08.12.09.57.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Aug 2017 09:57:34 -0700 (PDT) Received: by mail-pf0-f181.google.com with SMTP id t86so27034684pfe.2; Sat, 12 Aug 2017 09:57:33 -0700 (PDT) X-Received: by 10.99.96.67 with SMTP id u64mr18496115pgb.424.1502557053761; Sat, 12 Aug 2017 09:57:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.207.193 with HTTP; Sat, 12 Aug 2017 09:57:33 -0700 (PDT) In-Reply-To: <1502555191.47886.30.camel@freebsd.org> References: <201708112241.v7BMfP5X028262@repo.freebsd.org> <1502555191.47886.30.camel@freebsd.org> From: Ryan Libby Date: Sat, 12 Aug 2017 09:57:33 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322418 - head/lib/msun/src To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 16:57:41 -0000 On Sat, Aug 12, 2017 at 9:26 AM, Ian Lepore wrote: > On Fri, 2017-08-11 at 22:41 +0000, Ryan Libby wrote: >> Author: rlibby >> Date: Fri Aug 11 22:41:24 2017 >> New Revision: 322418 >> URL: https://svnweb.freebsd.org/changeset/base/322418 >> >> Log: >> lib/msun: avoid referring to broken LDBL_MAX >> >> LDBL_MAX is broken on i386: >> https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September >> /000288.html >> >> Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32 >> for some time, and newer versions of gcc are now warning that the >> "floating constant exceeds range of 'long double'". Avoid this by >> referring to half the value of LDBL_MAX instead. >> >> Reviewed by: bde >> Approved by: markj (mentor) >> Sponsored by: Dell EMC Isilon >> > > I now get this error when building toolchain for sparc: > > cc -isystem /b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/include -L/b/staging/freebsd/head/obj/sparc64.spar > c64/b/staging/freebsd/head/src/tmp/usr/lib -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/lib --sysroot=/b/ > staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/ > src/tmp/usr/bin -fPIC -DPIC -g -O2 -pipe -I/b/staging/freebsd/head/src/lib/msun/ld128 -I/b/staging/freebsd/head/src/lib/msun/sparc64 -I/b/sta > ging/freebsd/head/src/lib/msun/src -I/b/staging/freebsd/head/src/lib/libc/include -I/b/staging/freebsd/head/src/lib/libc/sparc64 -MD -MF. > depend.catrigl.pico -MTcatrigl.pico -std=gnu99 -fstack-protector-strong -Wsystem-headers -Werror -Wno-pointer-sign -Wno-unknown-pragmas - > c /b/staging/freebsd/head/src/lib/msun/src/catrigl.c -o catrigl.pico > /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting "0x0.8p" and "(" does not give a valid preprocessing token > /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: exponent has no digits > /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting ")" and "L" does not give a valid preprocessing token > /b/staging/freebsd/head/src/lib/msun/src/catrigl.c: In function 'clog_for_large_values': > /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310: error: expected ')' before 'L' > *** [catrigl.pico] Error code 1 Thanks, I see it. It also shows up on the sparc64 ci build [1]. Let me see if I can find a quick fix, else I guess we can just back it out for now. [1] https://ci.freebsd.org/job/FreeBSD-head-sparc64-build/2534/ From owner-svn-src-all@freebsd.org Sat Aug 12 17:07:28 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4D98D93F9A; Sat, 12 Aug 2017 17:07:28 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9EA696871B; Sat, 12 Aug 2017 17:07:28 +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 v7CH7Rca079852; Sat, 12 Aug 2017 17:07:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CH7Rjh079846; Sat, 12 Aug 2017 17:07:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708121707.v7CH7Rjh079846@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 12 Aug 2017 17:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322429 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk X-SVN-Commit-Revision: 322429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 17:07:28 -0000 Author: imp Date: Sat Aug 12 17:07:27 2017 New Revision: 322429 URL: https://svnweb.freebsd.org/changeset/base/322429 Log: Make _TO_CPUARCH macro for ARCH to CPUARCH conversions Consolidate all the regular expressions to convert from MACHINE_ARCH to MACHINE_CPUARCH into a variable and use that variable in preference to the almost identical copies in the tree (which should have been identical). Differential Revision: https://reviews.freebsd.org/D11986 Modified: head/Makefile head/gnu/usr.bin/binutils/Makefile.inc0 head/gnu/usr.bin/cc/Makefile.tgt head/gnu/usr.bin/gdb/Makefile.inc head/gnu/usr.bin/gdb/libgdb/Makefile head/share/mk/sys.mk Modified: head/Makefile ============================================================================== --- head/Makefile Sat Aug 12 15:51:46 2017 (r322428) +++ head/Makefile Sat Aug 12 17:07:27 2017 (r322429) @@ -245,12 +245,17 @@ _MAKE+= MK_META_MODE=no .endif # !exists(/dev/filemon) && !defined(NO_FILEMON) .endif # !defined(_CAN_USE_META_MODE) -# Guess machine architecture from machine type, and vice versa. +# Guess target architecture from target type, and vice versa, based on +# historic FreeBSD practice of tending to have TARGET == TARGET_ARCH +# expanding to TARGET == TARGET_CPUARCH in recent times, with known +# exceptions. .if !defined(TARGET_ARCH) && defined(TARGET) +# T->TA mapping is usually TARGET with arm64 the odd man out _TARGET_ARCH= ${TARGET:S/arm64/aarch64/} .elif !defined(TARGET) && defined(TARGET_ARCH) && \ ${TARGET_ARCH} != ${MACHINE_ARCH} -_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/powerpcspe/powerpc/:C/riscv64(sf)?/riscv/} +# TA->T mapping is accidentally CPUARCH with aarch64 the odd man out +_TARGET= ${TARGET_ARCH:${__TO_CPUARCH}:C/aarch64/arm64/} .endif .if defined(TARGET) && !defined(_TARGET) _TARGET=${TARGET} Modified: head/gnu/usr.bin/binutils/Makefile.inc0 ============================================================================== --- head/gnu/usr.bin/binutils/Makefile.inc0 Sat Aug 12 15:51:46 2017 (r322428) +++ head/gnu/usr.bin/binutils/Makefile.inc0 Sat Aug 12 17:07:27 2017 (r322429) @@ -7,7 +7,7 @@ VERSION= "2.17.50 [FreeBSD] 2007-07-03" .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/cc/Makefile.tgt ============================================================================== --- head/gnu/usr.bin/cc/Makefile.tgt Sat Aug 12 15:51:46 2017 (r322428) +++ head/gnu/usr.bin/cc/Makefile.tgt Sat Aug 12 17:07:27 2017 (r322429) @@ -4,7 +4,7 @@ # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv64/} +TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/gdb/Makefile.inc ============================================================================== --- head/gnu/usr.bin/gdb/Makefile.inc Sat Aug 12 15:51:46 2017 (r322428) +++ head/gnu/usr.bin/gdb/Makefile.inc Sat Aug 12 17:07:27 2017 (r322429) @@ -23,7 +23,7 @@ OBJ_RL= ${OBJTOP}/gnu/lib/libreadline/readline # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/gnu/usr.bin/gdb/libgdb/Makefile ============================================================================== --- head/gnu/usr.bin/gdb/libgdb/Makefile Sat Aug 12 15:51:46 2017 (r322428) +++ head/gnu/usr.bin/gdb/libgdb/Makefile Sat Aug 12 17:07:27 2017 (r322429) @@ -4,7 +4,7 @@ # MACHINE_CPUARCH, but there's no easy way to export make functions... .if defined(TARGET_ARCH) -TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/} +TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}} .else TARGET_CPUARCH=${MACHINE_CPUARCH} .endif Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Sat Aug 12 15:51:46 2017 (r322428) +++ head/share/mk/sys.mk Sat Aug 12 17:07:27 2017 (r322429) @@ -8,12 +8,13 @@ unix ?= We run FreeBSD, not UNIX. # # MACHINE_CPUARCH defines a collection of MACHINE_ARCH. Machines with # the same MACHINE_ARCH can run each other's binaries, so it necessarily -# has word size and endian swizzled in. However, support files for +# has word size and endian swizzled in. However, the source files for # these machines often are shared amongst all combinations of size # and/or endian. This is called MACHINE_CPU in NetBSD, but that's used # for something different in FreeBSD. # -MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/} +__TO_CPUARCH=C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/ +MACHINE_CPUARCH=${MACHINE_ARCH:${__TO_CPUARCH}} .endif From owner-svn-src-all@freebsd.org Sat Aug 12 17:07:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27C92D9400E; Sat, 12 Aug 2017 17:07:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E06ED6874B; Sat, 12 Aug 2017 17:07:33 +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 v7CH7XEN079905; Sat, 12 Aug 2017 17:07:33 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CH7X78079904; Sat, 12 Aug 2017 17:07:33 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708121707.v7CH7X78079904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 12 Aug 2017 17:07:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322430 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 17:07:34 -0000 Author: imp Date: Sat Aug 12 17:07:32 2017 New Revision: 322430 URL: https://svnweb.freebsd.org/changeset/base/322430 Log: arm*hf is no longer a thing, remove it from the conversion now that it's easy. Submitted by: andyt@ Modified: head/share/mk/sys.mk Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Sat Aug 12 17:07:27 2017 (r322429) +++ head/share/mk/sys.mk Sat Aug 12 17:07:32 2017 (r322430) @@ -13,7 +13,7 @@ unix ?= We run FreeBSD, not UNIX. # and/or endian. This is called MACHINE_CPU in NetBSD, but that's used # for something different in FreeBSD. # -__TO_CPUARCH=C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/ +__TO_CPUARCH=C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/ MACHINE_CPUARCH=${MACHINE_ARCH:${__TO_CPUARCH}} .endif From owner-svn-src-all@freebsd.org Sat Aug 12 17:39:35 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B802DB6422; Sat, 12 Aug 2017 17:39:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AC9A6A0D2; Sat, 12 Aug 2017 17:39:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CHdWDn092505; Sat, 12 Aug 2017 17:39:32 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CHdWYG092504; Sat, 12 Aug 2017 17:39:32 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201708121739.v7CHdWYG092504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 12 Aug 2017 17:39:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322431 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 322431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 17:39:35 -0000 Author: ian Date: Sat Aug 12 17:39:32 2017 New Revision: 322431 URL: https://svnweb.freebsd.org/changeset/base/322431 Log: Bid for the device with BUS_PROBE_GENERIC, because this is very much a generic driver with minimal feature support for a large number of chips. More featureful per-chip drivers might exist (especially out-of-tree) and those should win the bidding even if they use BUS_PROBE_DEFAULT. Modified: head/sys/dev/iicbus/nxprtc.c Modified: head/sys/dev/iicbus/nxprtc.c ============================================================================== --- head/sys/dev/iicbus/nxprtc.c Sat Aug 12 17:07:32 2017 (r322430) +++ head/sys/dev/iicbus/nxprtc.c Sat Aug 12 17:39:32 2017 (r322431) @@ -702,7 +702,7 @@ nxprtc_probe(device_t dev) #endif device_set_desc(dev, desc_strings[chiptype]); - return (BUS_PROBE_DEFAULT); + return (BUS_PROBE_GENERIC); } static int From owner-svn-src-all@freebsd.org Sat Aug 12 17:46:52 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23BC8DB7049; Sat, 12 Aug 2017 17:46:52 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 E5C076A787; Sat, 12 Aug 2017 17:46:51 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CHkokc096567; Sat, 12 Aug 2017 17:46:50 GMT (envelope-from sevan@FreeBSD.org) Received: (from sevan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CHkoGT096566; Sat, 12 Aug 2017 17:46:50 GMT (envelope-from sevan@FreeBSD.org) Message-Id: <201708121746.v7CHkoGT096566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sevan set sender to sevan@FreeBSD.org using -f From: Sevan Janiyan Date: Sat, 12 Aug 2017 17:46:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322432 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: sevan X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 322432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 17:46:52 -0000 Author: sevan (doc committer) Date: Sat Aug 12 17:46:50 2017 New Revision: 322432 URL: https://svnweb.freebsd.org/changeset/base/322432 Log: Add missing header. S_IRUSR is defined in sys/stat.h PR: 209229 Submitted by: Approved by: bcr (mentor) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D12007 Modified: head/lib/libc/sys/shmget.2 Modified: head/lib/libc/sys/shmget.2 ============================================================================== --- head/lib/libc/sys/shmget.2 Sat Aug 12 17:39:32 2017 (r322431) +++ head/lib/libc/sys/shmget.2 Sat Aug 12 17:46:50 2017 (r322432) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 17, 2010 +.Dd August 12, 2017 .Dt SHMGET 2 .Os .Sh NAME @@ -35,6 +35,7 @@ .Lb libc .Sh SYNOPSIS .In sys/types.h +.In sys/stat.h .In sys/ipc.h .In sys/shm.h .Ft int From owner-svn-src-all@freebsd.org Sat Aug 12 17:50:23 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84C26DB7464; Sat, 12 Aug 2017 17:50:23 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5E6926A9AF; Sat, 12 Aug 2017 17:50:23 +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 v7CHoMH1096758; Sat, 12 Aug 2017 17:50:22 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CHoMeG096756; Sat, 12 Aug 2017 17:50:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201708121750.v7CHoMeG096756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 12 Aug 2017 17:50: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: r322433 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 322433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 17:50:23 -0000 Author: dim Date: Sat Aug 12 17:50:22 2017 New Revision: 322433 URL: https://svnweb.freebsd.org/changeset/base/322433 Log: MFC r321684: Don't use libc++ when cross-building for gcc arches Since we imported clang 5.0.0, the version check in Makefile.inc1 which checks whether to use libc++ fires even when the compiler for the target architecture is gcc 4.2.1. This is because only X_COMPILER_VERSION is checked. Also check X_COMPILER_TYPE, so it will only use libc++ when an external gcc toolchain is used. Reviewed by: emaste, rpokala Differential Revision: https://reviews.freebsd.org/D11776 MFC r322170: Follow-up to r321684 (Don't use libc++ when cross-building for gcc arches), and handle two more cases where libc++ includes could be incorrectly enabled, in case the host compiler is clang 5.0.0, and the target (cross) compiler is gcc 4.2.1. Noted by: bdrewery Modified: stable/11/Makefile.inc1 stable/11/Makefile.libcompat Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Sat Aug 12 17:46:50 2017 (r322432) +++ stable/11/Makefile.inc1 Sat Aug 12 17:50:22 2017 (r322433) @@ -589,8 +589,7 @@ TARGET_ABI= gnueabi # is added before the port PREFIX library path. XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib # Force using libc++ for external GCC. -# XXX: This should be checking MK_GNUCXX == no -.if ${X_COMPILER_VERSION} >= 40800 +.if ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \ -nostdinc++ -L${WORLDTMP}/../lib/libc++ .endif @@ -2537,8 +2536,7 @@ CD2CFLAGS+= -isystem ${XDDESTDIR}/usr/include -L${XDDE # combined with --sysroot. CD2CFLAGS+= -B${XDDESTDIR}/usr/lib # Force using libc++ for external GCC. -# XXX: This should be checking MK_GNUCXX == no -.if ${X_COMPILER_VERSION} >= 40800 +.if ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 CD2CXXFLAGS+= -isystem ${XDDESTDIR}/usr/include/c++/v1 -std=c++11 \ -nostdinc++ .endif Modified: stable/11/Makefile.libcompat ============================================================================== --- stable/11/Makefile.libcompat Sat Aug 12 17:46:50 2017 (r322432) +++ stable/11/Makefile.libcompat Sat Aug 12 17:50:22 2017 (r322433) @@ -82,8 +82,7 @@ LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat # sysroot path which --sysroot does not actually do for headers. LIBCOMPATCFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include # Force using libc++ for external GCC. -# XXX: This should be checking MK_GNUCXX == no -.if ${X_COMPILER_VERSION} >= 40800 && \ +.if ${X_COMPILER_TYPE} == gcc && ${X_COMPILER_VERSION} >= 40800 && \ (${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no") LIBCOMPATCXXFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \ -nostdinc++ -L${LIBCOMPAT_OBJTREE}${.CURDIR}/lib/libc++ From owner-svn-src-all@freebsd.org Sat Aug 12 17:55:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42168DB7A80; Sat, 12 Aug 2017 17:55:54 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-pf0-f180.google.com (mail-pf0-f180.google.com [209.85.192.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B6E56ADF7; Sat, 12 Aug 2017 17:55:53 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-pf0-f180.google.com with SMTP id t86so27328961pfe.2; Sat, 12 Aug 2017 10:55:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=wo1LcNez6oa2HxQYx3ewCFu2SCftSL/b9PCL6Wjgjvc=; b=bf4C242SCT9f7jJsJTtgiluqwZ9Cwk71nZkU25lYMufD5wTJ17lQXEqMnZrZnjd6OK 08BLalJVLIHdIYN/0/too6ykZHD0Ldl7+BnJaAYFy27yhkn/uG9SAqBKQOO9FyVlb5si dsK1YIDIVuLJxTiZl9UQt4xeHmc68fVS00M45wlj8FotMQkgmwXWwmXb4GT5Te5UUoOo EHrmWdfCrnGfW6soV92/JXh8WELG04CN6ssqvhWTgCGg9dc9AaawMd2mtoV2O+QzI5lu 2nqGbN81pSgah9xLN/KVjkXSAJ3w5+SFMG+y2KERnsndEVQXLYDYBVLxhK3Xo1w3qRfB BzGg== X-Gm-Message-State: AHYfb5jfoLzr1lOQvf3SuQVVX3Yx+PjxjetXUcMa/DUYWvXF9lpfV+aq bZ2Hq66bzVwMB4RwXzb4DQ== X-Received: by 10.98.64.196 with SMTP id f65mr19762026pfd.123.1502560552948; Sat, 12 Aug 2017 10:55:52 -0700 (PDT) Received: from mail-pg0-f52.google.com (mail-pg0-f52.google.com. [74.125.83.52]) by smtp.gmail.com with ESMTPSA id e128sm6394626pfg.114.2017.08.12.10.55.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Aug 2017 10:55:52 -0700 (PDT) Received: by mail-pg0-f52.google.com with SMTP id u5so26886378pgn.0; Sat, 12 Aug 2017 10:55:52 -0700 (PDT) X-Received: by 10.98.78.73 with SMTP id c70mr19765970pfb.17.1502560552402; Sat, 12 Aug 2017 10:55:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.207.193 with HTTP; Sat, 12 Aug 2017 10:55:51 -0700 (PDT) In-Reply-To: References: <201708112241.v7BMfP5X028262@repo.freebsd.org> <1502555191.47886.30.camel@freebsd.org> From: Ryan Libby Date: Sat, 12 Aug 2017 10:55:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322418 - head/lib/msun/src To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Bruce Evans Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 17:55:54 -0000 On Sat, Aug 12, 2017 at 9:57 AM, Ryan Libby wrote: > On Sat, Aug 12, 2017 at 9:26 AM, Ian Lepore wrote: >> On Fri, 2017-08-11 at 22:41 +0000, Ryan Libby wrote: >>> Author: rlibby >>> Date: Fri Aug 11 22:41:24 2017 >>> New Revision: 322418 >>> URL: https://svnweb.freebsd.org/changeset/base/322418 >>> >>> Log: >>> lib/msun: avoid referring to broken LDBL_MAX >>> >>> LDBL_MAX is broken on i386: >>> https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September >>> /000288.html >>> >>> Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32 >>> for some time, and newer versions of gcc are now warning that the >>> "floating constant exceeds range of 'long double'". Avoid this by >>> referring to half the value of LDBL_MAX instead. >>> >>> Reviewed by: bde >>> Approved by: markj (mentor) >>> Sponsored by: Dell EMC Isilon >>> >> >> I now get this error when building toolchain for sparc: >> >> cc -isystem /b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/include -L/b/staging/freebsd/head/obj/sparc64.spar >> c64/b/staging/freebsd/head/src/tmp/usr/lib -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/lib --sysroot=/b/ >> staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/ >> src/tmp/usr/bin -fPIC -DPIC -g -O2 -pipe -I/b/staging/freebsd/head/src/lib/msun/ld128 -I/b/staging/freebsd/head/src/lib/msun/sparc64 -I/b/sta >> ging/freebsd/head/src/lib/msun/src -I/b/staging/freebsd/head/src/lib/libc/include -I/b/staging/freebsd/head/src/lib/libc/sparc64 -MD -MF. >> depend.catrigl.pico -MTcatrigl.pico -std=gnu99 -fstack-protector-strong -Wsystem-headers -Werror -Wno-pointer-sign -Wno-unknown-pragmas - >> c /b/staging/freebsd/head/src/lib/msun/src/catrigl.c -o catrigl.pico >> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting "0x0.8p" and "(" does not give a valid preprocessing token >> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: exponent has no digits >> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting ")" and "L" does not give a valid preprocessing token >> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c: In function 'clog_for_large_values': >> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310: error: expected ')' before 'L' >> *** [catrigl.pico] Error code 1 > > Thanks, I see it. It also shows up on the sparc64 ci build [1]. Let me > see if I can find a quick fix, else I guess we can just back it out for > now. > > [1] https://ci.freebsd.org/job/FreeBSD-head-sparc64-build/2534/ A few possible quick fixes: - Change the {arm64,riscv,sparc64}/include/float.h LDBL_MAX_EXP definitions from (+16384) to 16384. - Change HALF_LDBL_MAX from #define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L) to #if LDBL_MAX_EXP != 0x4000 #error "Unsupported long double format" #endif #define HALF_LDBL_MAX 0x0.8p16384L - Change the HALF_LDBL_MAX constant to a variable constructed with LD80C(), I think with LD80C(0x8000000000000000, 16383, 5.9486574767861588254e+4931L) but this also requires #error for LDBL_MAX_EXP != 0x4000, so not really any better than the above. I think I will back the patch out for now and go back to review. From owner-svn-src-all@freebsd.org Sat Aug 12 18:11:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94112DC2BD3; Sat, 12 Aug 2017 18:11:42 +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 mx1.freebsd.org (Postfix) with ESMTPS id 636FE6B7B4; Sat, 12 Aug 2017 18:11:42 +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 v7CIBfU9005344; Sat, 12 Aug 2017 18:11:41 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CIBf29005343; Sat, 12 Aug 2017 18:11:41 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201708121811.v7CIBf29005343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sat, 12 Aug 2017 18:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322434 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 18:11:42 -0000 Author: lwhsu (ports committer) Date: Sat Aug 12 18:11:41 2017 New Revision: 322434 URL: https://svnweb.freebsd.org/changeset/base/322434 Log: Re-remove excess / for installing SYMLINKS This excess / was introduced in r280129, and fixed in r295230, but got re-introduced while merging another branch in r298107. Approved by: gjb Differential Revision: https://reviews.freebsd.org/D11995 Modified: head/share/mk/bsd.links.mk Modified: head/share/mk/bsd.links.mk ============================================================================== --- head/share/mk/bsd.links.mk Sat Aug 12 17:50:22 2017 (r322433) +++ head/share/mk/bsd.links.mk Sat Aug 12 18:11:41 2017 (r322434) @@ -20,5 +20,5 @@ _installlinks: .endfor .for s t in ${SYMLINKS} @${ECHO} "${t} -> ${s}" ;\ - ${INSTALL_SYMLINK} ${TAG_ARGS} ${s} ${DESTDIR}/${t} + ${INSTALL_SYMLINK} ${TAG_ARGS} ${s} ${DESTDIR}${t} .endfor From owner-svn-src-all@freebsd.org Sat Aug 12 18:28:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87A2DDC3B7C; Sat, 12 Aug 2017 18:28:03 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 5722B6C01C; Sat, 12 Aug 2017 18:28:03 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CIS2b9013816; Sat, 12 Aug 2017 18:28:02 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CIS2RY013813; Sat, 12 Aug 2017 18:28:02 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201708121828.v7CIS2RY013813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Sat, 12 Aug 2017 18:28:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322435 - head/lib/msun/src X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/lib/msun/src X-SVN-Commit-Revision: 322435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 18:28:03 -0000 Author: rlibby Date: Sat Aug 12 18:28:02 2017 New Revision: 322435 URL: https://svnweb.freebsd.org/changeset/base/322435 Log: Revert r322418, LDBL_MAX_EXP unsuitable for macro pasting on some arches Either need a different way to spell HALF_LDBL_MAX, or a different way to spell LDBL_MAX_EXP, or a different approach. Reported by: ian Modified: head/lib/msun/src/catrigl.c head/lib/msun/src/math_private.h head/lib/msun/src/s_csqrtl.c Modified: head/lib/msun/src/catrigl.c ============================================================================== --- head/lib/msun/src/catrigl.c Sat Aug 12 18:11:41 2017 (r322434) +++ head/lib/msun/src/catrigl.c Sat Aug 12 18:28:02 2017 (r322435) @@ -307,7 +307,7 @@ clog_for_large_values(long double complex z) ay = t; } - if (ax >= HALF_LDBL_MAX) + if (ax > LDBL_MAX / 2) return (CMPLXL(logl(hypotl(x / m_e, y / m_e)) + 1, atan2l(y, x))); Modified: head/lib/msun/src/math_private.h ============================================================================== --- head/lib/msun/src/math_private.h Sat Aug 12 18:11:41 2017 (r322434) +++ head/lib/msun/src/math_private.h Sat Aug 12 18:28:02 2017 (r322435) @@ -272,15 +272,6 @@ do { \ #define LD80C(m, ex, v) { .e = (v), } #endif -/* - * XXX LDBL_MAX is broken on i386. If the precise value of LDBL_MAX is not - * needed, this may be worked around by instead referring to a proxy, such - * as HALF_LDBL_MAX, below. HALF_LDBL_MAX is approximately LDBL_MAX / 2, - * actually just greater than. Note that 2 * HALF_LDBL_MAX will always - * overflow to infinity, regardless of the precision and rounding modes. - */ -#define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L) - #ifdef FLT_EVAL_METHOD /* * Attempt to get strict C99 semantics for assignment with non-C99 compilers. Modified: head/lib/msun/src/s_csqrtl.c ============================================================================== --- head/lib/msun/src/s_csqrtl.c Sat Aug 12 18:11:41 2017 (r322434) +++ head/lib/msun/src/s_csqrtl.c Sat Aug 12 18:28:02 2017 (r322435) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #pragma STDC CX_LIMITED_RANGE ON /* We risk spurious overflow for components >= LDBL_MAX / (1 + sqrt(2)). */ -#define THRESH (HALF_LDBL_MAX / 1.207106781186547524400844362104849L) +#define THRESH (LDBL_MAX / 2.414213562373095048801688724209698L) long double complex csqrtl(long double complex z) From owner-svn-src-all@freebsd.org Sat Aug 12 18:38:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8CCCDC48D9; Sat, 12 Aug 2017 18:38:19 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7306A6C7A9; Sat, 12 Aug 2017 18:38:19 +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 v7CIcIJr017757; Sat, 12 Aug 2017 18:38:18 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CIcIIn017756; Sat, 12 Aug 2017 18:38:18 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708121838.v7CIcIIn017756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 12 Aug 2017 18:38:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322436 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 322436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 18:38:19 -0000 Author: jhb Date: Sat Aug 12 18:38:18 2017 New Revision: 322436 URL: https://svnweb.freebsd.org/changeset/base/322436 Log: Don't panic for PT_GETFPREGS. Only fetch the VFP state from the CPU if the thread whose registers are being requested is the current thread. If a stopped thread's registers are being fetched by a debugger, the saved state in the PCB is already valid. Reviewed by: andrew MFC after: 1 week Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Sat Aug 12 18:28:02 2017 (r322435) +++ head/sys/arm64/arm64/machdep.c Sat Aug 12 18:38:18 2017 (r322436) @@ -222,7 +222,8 @@ fill_fpregs(struct thread *td, struct fpreg *regs) * If we have just been running VFP instructions we will * need to save the state to memcpy it below. */ - vfp_save_state(td, pcb); + if (td == curthread) + vfp_save_state(td, pcb); KASSERT(pcb->pcb_fpusaved == &pcb->pcb_fpustate, ("Called fill_fpregs while the kernel is using the VFP")); From owner-svn-src-all@freebsd.org Sat Aug 12 18:42:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 582D9DC4E57; Sat, 12 Aug 2017 18:42:56 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3433E6CC34; Sat, 12 Aug 2017 18:42:56 +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 v7CIgtQ6021492; Sat, 12 Aug 2017 18:42:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CIgtJA021488; Sat, 12 Aug 2017 18:42:55 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708121842.v7CIgtJA021488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 12 Aug 2017 18:42:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322437 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 322437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 18:42:56 -0000 Author: jhb Date: Sat Aug 12 18:42:54 2017 New Revision: 322437 URL: https://svnweb.freebsd.org/changeset/base/322437 Log: Reliably enable debug exceptions on all CPUs. Previously, debug exceptions were only enabled on the boot CPU if DDB was enabled in the dbg_monitor_init() function. APs also called this function, but since mp_machdep.c doesn't include opt_ddb.h, the APs ended up calling an empty stub defined in instead of the real function. Also, if DDB was not enabled in the kernel, the boot CPU would not enable debug exceptions. Fix this by adding a new dbg_init() function that always clears the OS lock to enable debug exceptions which the boot CPU and the APs call. This function also calls dbg_monitor_init() to enable hardware breakpoints from DDB on all CPUs if DDB is enabled. Eventually base support for hardware breakpoints/watchpoints will need to move out of the DDB-only debug_monitor.c for use by userland debuggers. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D12001 Modified: head/sys/arm64/arm64/debug_monitor.c head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/include/machdep.h Modified: head/sys/arm64/arm64/debug_monitor.c ============================================================================== --- head/sys/arm64/arm64/debug_monitor.c Sat Aug 12 18:38:18 2017 (r322436) +++ head/sys/arm64/arm64/debug_monitor.c Sat Aug 12 18:42:54 2017 (r322437) @@ -453,15 +453,12 @@ dbg_monitor_init(void) { u_int i; - /* Clear OS lock */ - WRITE_SPECIALREG(OSLAR_EL1, 0); - /* Find out many breakpoints and watchpoints we can use */ dbg_watchpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 20) & 0xf) + 1; dbg_breakpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 12) & 0xf) + 1; if (bootverbose && PCPU_GET(cpuid) == 0) { - db_printf("%d watchpoints and %d breakpoints supported\n", + printf("%d watchpoints and %d breakpoints supported\n", dbg_watchpoint_num, dbg_breakpoint_num); } Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Sat Aug 12 18:38:18 2017 (r322436) +++ head/sys/arm64/arm64/machdep.c Sat Aug 12 18:42:54 2017 (r322437) @@ -1051,11 +1051,24 @@ initarm(struct arm64_bootparams *abp) mutex_init(); init_param2(physmem); - dbg_monitor_init(); + dbg_init(); kdb_init(); pan_enable(); early_boot = 0; +} + +void +dbg_init(void) +{ + + /* Clear OS lock */ + WRITE_SPECIALREG(OSLAR_EL1, 0); + + /* This permits DDB to use debug registers for watchpoints. */ + dbg_monitor_init(); + + /* TODO: Eventually will need to initialize debug registers here. */ } #ifdef DDB Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Sat Aug 12 18:38:18 2017 (r322436) +++ head/sys/arm64/arm64/mp_machdep.c Sat Aug 12 18:42:54 2017 (r322437) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -272,7 +271,7 @@ init_secondary(uint64_t cpu) vfp_init(); #endif - dbg_monitor_init(); + dbg_init(); pan_enable(); /* Enable interrupts */ Modified: head/sys/arm64/include/machdep.h ============================================================================== --- head/sys/arm64/include/machdep.h Sat Aug 12 18:38:18 2017 (r322436) +++ head/sys/arm64/include/machdep.h Sat Aug 12 18:42:54 2017 (r322437) @@ -48,6 +48,7 @@ extern enum arm64_bus arm64_bus_method; extern vm_paddr_t physmap[]; extern u_int physmap_idx; +void dbg_init(void); void initarm(struct arm64_bootparams *); extern void (*pagezero)(void *); From owner-svn-src-all@freebsd.org Sat Aug 12 19:17:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C3D8DC6561; Sat, 12 Aug 2017 19:17:50 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 668656E362; Sat, 12 Aug 2017 19:17:50 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CJHnME035284; Sat, 12 Aug 2017 19:17:49 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CJHmUp035277; Sat, 12 Aug 2017 19:17:48 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201708121917.v7CJHmUp035277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 12 Aug 2017 19:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322438 - in head: bin/sh/tests bin/sh/tests/invocation etc/mtree X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: in head: bin/sh/tests bin/sh/tests/invocation etc/mtree X-SVN-Commit-Revision: 322438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 19:17:50 -0000 Author: jilles Date: Sat Aug 12 19:17:48 2017 New Revision: 322438 URL: https://svnweb.freebsd.org/changeset/base/322438 Log: sh: Add tests for sh -c that already pass. PR: 220587 Submitted by: Ryan Moeller Added: head/bin/sh/tests/invocation/ head/bin/sh/tests/invocation/Makefile (contents, props changed) head/bin/sh/tests/invocation/sh-ac1.0 (contents, props changed) head/bin/sh/tests/invocation/sh-c1.0 (contents, props changed) head/bin/sh/tests/invocation/sh-ca1.0 (contents, props changed) head/bin/sh/tests/invocation/sh-fca1.0 (contents, props changed) Modified: head/bin/sh/tests/Makefile head/etc/mtree/BSD.tests.dist Modified: head/bin/sh/tests/Makefile ============================================================================== --- head/bin/sh/tests/Makefile Sat Aug 12 18:42:54 2017 (r322437) +++ head/bin/sh/tests/Makefile Sat Aug 12 19:17:48 2017 (r322438) @@ -6,6 +6,7 @@ TESTS_SUBDIRS+= builtins TESTS_SUBDIRS+= errors TESTS_SUBDIRS+= execution TESTS_SUBDIRS+= expansion +TESTS_SUBDIRS+= invocation TESTS_SUBDIRS+= parameters TESTS_SUBDIRS+= parser TESTS_SUBDIRS+= set-e Added: head/bin/sh/tests/invocation/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/invocation/Makefile Sat Aug 12 19:17:48 2017 (r322438) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T} + +.PATH: ${.CURDIR:H} +ATF_TESTS_SH= functional_test + +${PACKAGE}FILES+= sh-ac1.0 +${PACKAGE}FILES+= sh-c1.0 +${PACKAGE}FILES+= sh-ca1.0 +${PACKAGE}FILES+= sh-fca1.0 + +.include Added: head/bin/sh/tests/invocation/sh-ac1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/invocation/sh-ac1.0 Sat Aug 12 19:17:48 2017 (r322438) @@ -0,0 +1,7 @@ +# $FreeBSD$ +# Test that attached options before c are processed + +case `${SH} -ac 'echo $-:$0' moo` in +*a*:moo) true ;; +*) false ;; +esac Added: head/bin/sh/tests/invocation/sh-c1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/invocation/sh-c1.0 Sat Aug 12 19:17:48 2017 (r322438) @@ -0,0 +1,4 @@ +# $FreeBSD$ +# Test that -c executes command_string with the given name and arg + +${SH} -c 'echo $0 $@' moo foo | grep -qx -- "moo foo" Added: head/bin/sh/tests/invocation/sh-ca1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/invocation/sh-ca1.0 Sat Aug 12 19:17:48 2017 (r322438) @@ -0,0 +1,7 @@ +# $FreeBSD$ +# Test that attached options after c are processed + +case `${SH} -ca 'echo $-:$0' moo` in +*a*:moo) true ;; +*) false ;; +esac Added: head/bin/sh/tests/invocation/sh-fca1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/invocation/sh-fca1.0 Sat Aug 12 19:17:48 2017 (r322438) @@ -0,0 +1,7 @@ +# $FreeBSD$ +# Test that attached options before and after c are processed + +case `${SH} -fca 'echo $-:$-:$0:$@' foo -bar` in +*f*:*a*:foo:-bar) true ;; +*) false ;; +esac Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Sat Aug 12 18:42:54 2017 (r322437) +++ head/etc/mtree/BSD.tests.dist Sat Aug 12 19:17:48 2017 (r322438) @@ -39,6 +39,8 @@ .. expansion .. + invocation + .. parameters .. parser From owner-svn-src-all@freebsd.org Sat Aug 12 19:45:10 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7832DC708D; Sat, 12 Aug 2017 19:45:10 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6E0F6F0E1; Sat, 12 Aug 2017 19:45:10 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 7B92F10AF07; Sat, 12 Aug 2017 15:45:09 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322437 - in head/sys/arm64: arm64 include Date: Sat, 12 Aug 2017 11:45:42 -0700 Message-ID: <2695757.2orfonibFk@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201708121842.v7CIgtJA021488@repo.freebsd.org> References: <201708121842.v7CIgtJA021488@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Sat, 12 Aug 2017 15:45:09 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 19:45:11 -0000 On Saturday, August 12, 2017 06:42:55 PM John Baldwin wrote: > Author: jhb > Date: Sat Aug 12 18:42:54 2017 > New Revision: 322437 > URL: https://svnweb.freebsd.org/changeset/base/322437 > > Log: > Reliably enable debug exceptions on all CPUs. > > Previously, debug exceptions were only enabled on the boot CPU if > DDB was enabled in the dbg_monitor_init() function. APs also called > this function, but since mp_machdep.c doesn't include opt_ddb.h, the > APs ended up calling an empty stub defined in > instead of the real function. Also, if DDB was not enabled in the kernel, > the boot CPU would not enable debug exceptions. > > Fix this by adding a new dbg_init() function that always clears the OS > lock to enable debug exceptions which the boot CPU and the APs call. > This function also calls dbg_monitor_init() to enable hardware breakpoints > from DDB on all CPUs if DDB is enabled. Eventually base support for > hardware breakpoints/watchpoints will need to move out of the DDB-only > debug_monitor.c for use by userland debuggers. > > Reviewed by: andrew > Differential Revision: https://reviews.freebsd.org/D12001 In particular, this fixes single stepping of userland processes when the process is running on a CPU other than CPU 0. -- John Baldwin From owner-svn-src-all@freebsd.org Sat Aug 12 21:20:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FA0CDC8F2B; Sat, 12 Aug 2017 21:20:53 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 DF72F71776; Sat, 12 Aug 2017 21:20:52 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CLKqHW087522; Sat, 12 Aug 2017 21:20:52 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CLKptr087517; Sat, 12 Aug 2017 21:20:51 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201708122120.v7CLKptr087517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 12 Aug 2017 21:20:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322439 - in head/usr.sbin/bluetooth: bthidcontrol bthidd X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: in head/usr.sbin/bluetooth: bthidcontrol bthidd X-SVN-Commit-Revision: 322439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 21:20:53 -0000 Author: wulf Date: Sat Aug 12 21:20:51 2017 New Revision: 322439 URL: https://svnweb.freebsd.org/changeset/base/322439 Log: bthidd(8): Add support for vendor_id, product_id and version. Extend bthidd.conf format to store vendor and product IDs of remote Bluetooth HID devices to make possible implementation of device specific quirks inside bthidd(8). Add support for querying of this information from device's SDP records with bthidcontrol(8) "Query" command. Submitted by: Dirk Engling Reviewed by: emax Approved by: bapt (mentor), gonzo (mentor) Differential Revision: https://reviews.freebsd.org/D3702 Modified: head/usr.sbin/bluetooth/bthidcontrol/sdp.c head/usr.sbin/bluetooth/bthidd/bthid_config.h head/usr.sbin/bluetooth/bthidd/bthidd.conf.sample head/usr.sbin/bluetooth/bthidd/lexer.l head/usr.sbin/bluetooth/bthidd/parser.y Modified: head/usr.sbin/bluetooth/bthidcontrol/sdp.c ============================================================================== --- head/usr.sbin/bluetooth/bthidcontrol/sdp.c Sat Aug 12 19:17:48 2017 (r322438) +++ head/usr.sbin/bluetooth/bthidcontrol/sdp.c Sat Aug 12 21:20:51 2017 (r322439) @@ -47,7 +47,20 @@ static int32_t hid_sdp_parse_protocol_descriptor_list static int32_t hid_sdp_parse_hid_descriptor (sdp_attr_p a); static int32_t hid_sdp_parse_boolean (sdp_attr_p a); +/* + * Hard coded attibute IDs taken from the + * DEVICE IDENTIFICATION PROFILE SPECIFICATION V13 p.12 + */ + +#define SDP_ATTR_DEVICE_ID_SERVICE_VENDORID 0x0201 +#define SDP_ATTR_DEVICE_ID_SERVICE_PRODUCTID 0x0202 +#define SDP_ATTR_DEVICE_ID_SERVICE_VERSION 0x0203 +#define SDP_ATTR_DEVICE_ID_RANGE SDP_ATTR_RANGE( \ + SDP_ATTR_DEVICE_ID_SERVICE_VENDORID, SDP_ATTR_DEVICE_ID_SERVICE_VERSION ) + static uint16_t service = SDP_SERVICE_CLASS_HUMAN_INTERFACE_DEVICE; +static uint16_t service_devid = SDP_SERVICE_CLASS_PNP_INFORMATION; +static uint32_t attrs_devid = SDP_ATTR_DEVICE_ID_RANGE; static uint32_t attrs[] = { SDP_ATTR_RANGE( SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST, @@ -85,27 +98,34 @@ static uint8_t buffer[nvalues][512]; return (((e) == 0)? 0 : -1); \ } +static void +hid_init_return_values() { + int i; + for (i = 0; i < nvalues; i ++) { + values[i].flags = SDP_ATTR_INVALID; + values[i].attr = 0; + values[i].vlen = sizeof(buffer[i]); + values[i].value = buffer[i]; + } +} + static int32_t hid_sdp_query(bdaddr_t const *local, struct hid_device *hd, int32_t *error) { void *ss = NULL; - uint8_t *hid_descriptor = NULL; + uint8_t *hid_descriptor = NULL, *v; int32_t i, control_psm = -1, interrupt_psm = -1, reconnect_initiate = -1, normally_connectable = 0, battery_power = 0, - hid_descriptor_length = -1; + hid_descriptor_length = -1, type; + int16_t vendor_id = 0, product_id = 0, version = 0; if (local == NULL) local = NG_HCI_BDADDR_ANY; if (hd == NULL) hid_sdp_query_exit(EINVAL); - for (i = 0; i < nvalues; i ++) { - values[i].flags = SDP_ATTR_INVALID; - values[i].attr = 0; - values[i].vlen = sizeof(buffer[i]); - values[i].value = buffer[i]; - } + hid_init_return_values(); if ((ss = sdp_open(local, &hd->bdaddr)) == NULL) hid_sdp_query_exit(ENOMEM); @@ -114,9 +134,6 @@ hid_sdp_query(bdaddr_t const *local, struct hid_device if (sdp_search(ss, 1, &service, nattrs, attrs, nvalues, values) != 0) hid_sdp_query_exit(sdp_error(ss)); - sdp_close(ss); - ss = NULL; - for (i = 0; i < nvalues; i ++) { if (values[i].flags != SDP_ATTR_OK) continue; @@ -151,11 +168,51 @@ hid_sdp_query(bdaddr_t const *local, struct hid_device } } + hid_init_return_values(); + + if (sdp_search(ss, 1, &service_devid, 1, &attrs_devid, nvalues, values) != 0) + hid_sdp_query_exit(sdp_error(ss)); + + sdp_close(ss); + ss = NULL; + + /* If search is successful, scan through return vals */ + for (i = 0; i < 3; i ++ ) { + if (values[i].flags == SDP_ATTR_INVALID ) + continue; + + /* Expecting tag + uint16_t on all 3 attributes */ + if (values[i].vlen != 3) + continue; + + /* Make sure, we're reading a uint16_t */ + v = values[i].value; + SDP_GET8(type, v); + if (type != SDP_DATA_UINT16 ) + continue; + + switch (values[i].attr) { + case SDP_ATTR_DEVICE_ID_SERVICE_VENDORID: + SDP_GET16(vendor_id, v); + break; + case SDP_ATTR_DEVICE_ID_SERVICE_PRODUCTID: + SDP_GET16(product_id, v); + break; + case SDP_ATTR_DEVICE_ID_SERVICE_VERSION: + SDP_GET16(version, v); + break; + default: + break; + } + } + if (control_psm == -1 || interrupt_psm == -1 || reconnect_initiate == -1 || hid_descriptor == NULL || hid_descriptor_length == -1) hid_sdp_query_exit(ENOATTR); - + hd->vendor_id = vendor_id; + hd->product_id = product_id; + hd->version = version; hd->control_psm = control_psm; hd->interrupt_psm = interrupt_psm; hd->reconnect_initiate = reconnect_initiate? 1 : 0; Modified: head/usr.sbin/bluetooth/bthidd/bthid_config.h ============================================================================== --- head/usr.sbin/bluetooth/bthidd/bthid_config.h Sat Aug 12 19:17:48 2017 (r322438) +++ head/usr.sbin/bluetooth/bthidd/bthid_config.h Sat Aug 12 21:20:51 2017 (r322439) @@ -42,6 +42,9 @@ struct hid_device bdaddr_t bdaddr; /* HID device BDADDR */ uint16_t control_psm; /* control PSM */ uint16_t interrupt_psm; /* interrupt PSM */ + uint16_t vendor_id; /* primary vendor id */ + uint16_t product_id; + uint16_t version; unsigned new_device : 1; unsigned reconnect_initiate : 1; unsigned battery_power : 1; Modified: head/usr.sbin/bluetooth/bthidd/bthidd.conf.sample ============================================================================== --- head/usr.sbin/bluetooth/bthidd/bthidd.conf.sample Sat Aug 12 19:17:48 2017 (r322438) +++ head/usr.sbin/bluetooth/bthidd/bthidd.conf.sample Sat Aug 12 21:20:51 2017 (r322439) @@ -2,6 +2,9 @@ device { bdaddr 00:50:f2:e5:68:84; + vendor_id 0x0000; + product_id 0x0000; + version 0x0000; control_psm 0x11; interrupt_psm 0x13; reconnect_initiate true; @@ -24,6 +27,9 @@ device { device { bdaddr 00:50:f2:e3:fb:e1; + vendor_id 0x0000; + product_id 0x0000; + version 0x0000; control_psm 0x11; interrupt_psm 0x13; reconnect_initiate true; Modified: head/usr.sbin/bluetooth/bthidd/lexer.l ============================================================================== --- head/usr.sbin/bluetooth/bthidd/lexer.l Sat Aug 12 19:17:48 2017 (r322438) +++ head/usr.sbin/bluetooth/bthidd/lexer.l Sat Aug 12 21:20:51 2017 (r322439) @@ -50,9 +50,13 @@ comment \#.* hexdigit [0-9a-fA-F] hexbyte {hexdigit}{hexdigit}? +hexword {hexdigit}{hexdigit}?{hexdigit}?{hexdigit}? device_word device bdaddr_word bdaddr +vendor_id_word vendor_id +product_id_word product_id +version_word version control_psm_word control_psm interrupt_psm_word interrupt_psm reconnect_initiate_word reconnect_initiate @@ -64,6 +68,7 @@ false_word false bdaddrstring {hexbyte}:{hexbyte}:{hexbyte}:{hexbyte}:{hexbyte}:{hexbyte} hexbytestring 0x{hexbyte} +hexwordstring 0x{hexword} %% @@ -78,6 +83,9 @@ hexbytestring 0x{hexbyte} {device_word} return (T_DEVICE); {bdaddr_word} return (T_BDADDR); +{vendor_id_word} return (T_VENDOR_ID); +{product_id_word} return (T_PRODUCT_ID); +{version_word} return (T_VERSION); {control_psm_word} return (T_CONTROL_PSM); {interrupt_psm_word} return (T_INTERRUPT_PSM); {reconnect_initiate_word} return (T_RECONNECT_INITIATE); @@ -98,6 +106,14 @@ hexbytestring 0x{hexbyte} yylval.num = strtoul(yytext, &ep, 16); return (*ep == '\0'? T_HEXBYTE : T_ERROR); + } + +{hexwordstring} { + char *ep; + + yylval.num = strtoul(yytext, &ep, 16); + + return (*ep == '\0'? T_HEXWORD : T_ERROR); } . return (T_ERROR); Modified: head/usr.sbin/bluetooth/bthidd/parser.y ============================================================================== --- head/usr.sbin/bluetooth/bthidd/parser.y Sat Aug 12 19:17:48 2017 (r322438) +++ head/usr.sbin/bluetooth/bthidd/parser.y Sat Aug 12 21:20:51 2017 (r322439) @@ -87,8 +87,10 @@ static LIST_HEAD(, hid_device) hid_devices; %token T_BDADDRSTRING %token T_HEXBYTE -%token T_DEVICE T_BDADDR T_CONTROL_PSM T_INTERRUPT_PSM T_RECONNECT_INITIATE -%token T_BATTERY_POWER T_NORMALLY_CONNECTABLE T_HID_DESCRIPTOR +%token T_HEXWORD +%token T_DEVICE T_BDADDR T_VENDOR_ID T_PRODUCT_ID T_VERSION T_CONTROL_PSM +%token T_INTERRUPT_PSM T_RECONNECT_INITIATE T_BATTERY_POWER +%token T_NORMALLY_CONNECTABLE T_HID_DESCRIPTOR %token T_TRUE T_FALSE T_ERROR %% @@ -124,6 +126,9 @@ options: option ';' ; option: bdaddr + | vendor_id + | product_id + | version | control_psm | interrupt_psm | reconnect_initiate @@ -139,6 +144,24 @@ bdaddr: T_BDADDR T_BDADDRSTRING } ; +vendor_id: T_VENDOR_ID T_HEXWORD + { + hid_device->vendor_id = $2; + } + ; + +product_id: T_PRODUCT_ID T_HEXWORD + { + hid_device->product_id = $2; + } + ; + +version: T_VERSION T_HEXWORD + { + hid_device->version = $2; + } + ; + control_psm: T_CONTROL_PSM T_HEXBYTE { hid_device->control_psm = $2; @@ -307,6 +330,9 @@ print_hid_device(hid_device_p d, FILE *f) fprintf(f, "device {\n" \ " bdaddr %s;\n" \ +" vendor_id 0x%04x;\n" \ +" product_id 0x%04x;\n" \ +" version 0x%04x;\n" \ " control_psm 0x%x;\n" \ " interrupt_psm 0x%x;\n" \ " reconnect_initiate %s;\n" \ @@ -314,6 +340,7 @@ print_hid_device(hid_device_p d, FILE *f) " normally_connectable %s;\n" \ " hid_descriptor {", bt_ntoa(&d->bdaddr, NULL), + d->vendor_id, d->product_id, d->version, d->control_psm, d->interrupt_psm, d->reconnect_initiate? "true" : "false", d->battery_power? "true" : "false", From owner-svn-src-all@freebsd.org Sat Aug 12 21:23:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E65CDDC912D; Sat, 12 Aug 2017 21:23:34 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 C0D3D71B2F; Sat, 12 Aug 2017 21:23:34 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CLNX3p089387; Sat, 12 Aug 2017 21:23:33 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CLNXLx089383; Sat, 12 Aug 2017 21:23:33 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201708122123.v7CLNXLx089383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 12 Aug 2017 21:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322440 - head/usr.sbin/bluetooth/bthidd X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/usr.sbin/bluetooth/bthidd X-SVN-Commit-Revision: 322440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 21:23:35 -0000 Author: wulf Date: Sat Aug 12 21:23:33 2017 New Revision: 322440 URL: https://svnweb.freebsd.org/changeset/base/322440 Log: bthidd(8): Add support for Apple's magic mouse Note: Mouse's bthidd.conf record should contain vendor and device IDs to make proper device detection. If it does not contain IDs, regenerate record with "Query" command of recent bthidcontrol(8). Submitted by: Dirk Engling Reviewed by: emax Approved by: bapt (mentor), gonzo (mentor) Differential Revision: https://reviews.freebsd.org/D3702 Modified: head/usr.sbin/bluetooth/bthidd/bthidd.h head/usr.sbin/bluetooth/bthidd/hid.c head/usr.sbin/bluetooth/bthidd/server.c head/usr.sbin/bluetooth/bthidd/session.c Modified: head/usr.sbin/bluetooth/bthidd/bthidd.h ============================================================================== --- head/usr.sbin/bluetooth/bthidd/bthidd.h Sat Aug 12 21:20:51 2017 (r322439) +++ head/usr.sbin/bluetooth/bthidd/bthidd.h Sat Aug 12 21:23:33 2017 (r322440) @@ -60,6 +60,7 @@ struct bthid_session int32_t ctrl; /* control channel */ int32_t intr; /* interrupt channel */ int32_t vkbd; /* virual keyboard */ + void *ctx; /* product specific dev state */ bdaddr_t bdaddr;/* remote bdaddr */ uint16_t state; /* session state */ #define CLOSED 0 @@ -86,6 +87,7 @@ bthid_session_p session_by_bdaddr(bthid_server_p srv, bthid_session_p session_by_fd (bthid_server_p srv, int32_t fd); void session_close (bthid_session_p s); +void hid_initialise (bthid_session_p s); int32_t hid_control (bthid_session_p s, uint8_t *data, int32_t len); int32_t hid_interrupt (bthid_session_p s, uint8_t *data, int32_t len); Modified: head/usr.sbin/bluetooth/bthidd/hid.c ============================================================================== --- head/usr.sbin/bluetooth/bthidd/hid.c Sat Aug 12 21:20:51 2017 (r322439) +++ head/usr.sbin/bluetooth/bthidd/hid.c Sat Aug 12 21:23:33 2017 (r322440) @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -50,6 +51,50 @@ #include "kbd.h" /* + * Inoffical and unannounced report ids for Apple Mice and trackpad + */ +#define TRACKPAD_REPORT_ID 0x28 +#define AMM_REPORT_ID 0x29 +#define BATT_STAT_REPORT_ID 0x30 +#define BATT_STRENGTH_REPORT_ID 0x47 +#define SURFACE_REPORT_ID 0x61 + +/* + * Apple magic mouse (AMM) specific device state + */ +#define AMM_MAX_BUTTONS 16 +struct apple_state { + int y [AMM_MAX_BUTTONS]; + int button_state; +}; + +#define MAGIC_MOUSE(D) (((D)->vendor_id == 0x5ac) && ((D)->product_id == 0x30d)) +#define AMM_BASIC_BLOCK 5 +#define AMM_FINGER_BLOCK 8 +#define AMM_VALID_REPORT(L) (((L) >= AMM_BASIC_BLOCK) && \ + ((L) <= 16*AMM_FINGER_BLOCK + AMM_BASIC_BLOCK) && \ + ((L) % AMM_FINGER_BLOCK) == AMM_BASIC_BLOCK) +#define AMM_WHEEL_SPEED 100 + +/* + * Probe for per-device initialisation + */ +void +hid_initialise(bthid_session_p s) +{ + hid_device_p hid_device = get_hid_device(&s->bdaddr); + + if (hid_device && MAGIC_MOUSE(hid_device)) { + /* Magic report to enable trackpad on Apple's Magic Mouse */ + static uint8_t rep[] = {0x53, 0xd7, 0x01}; + + if ((s->ctx = calloc(1, sizeof(struct apple_state))) == NULL) + return; + write(s->ctrl, rep, 3); + } +} + +/* * Process data from control channel */ @@ -369,6 +414,91 @@ hid_interrupt(bthid_session_p s, uint8_t *data, int32_ } } hid_end_parse(d); + + /* + * Apple adheres to no standards and sends reports it does + * not introduce in its hid descriptor for its magic mouse. + * Handle those reports here. + */ + if (MAGIC_MOUSE(hid_device) && s->ctx) { + struct apple_state *c = (struct apple_state *)s->ctx; + int firm = 0, middle = 0; + int16_t v; + + data++, len--; /* Chomp report_id */ + + if (report_id != AMM_REPORT_ID || !AMM_VALID_REPORT(len)) + goto check_middle_button; + + /* + * The basics. When touches are detected, no normal mouse + * reports are sent. Collect clicks and dx/dy + */ + if (data[2] & 1) + mouse_butt |= 0x1; + if (data[2] & 2) + mouse_butt |= 0x4; + + if ((v = data[0] + ((data[2] & 0x0C) << 6))) + mouse_x += ((int16_t)(v << 6)) >> 6, mevents++; + if ((v = data[1] + ((data[2] & 0x30) << 4))) + mouse_y += ((int16_t)(v << 6)) >> 6, mevents++; + + /* + * The hard part: accumulate touch events and emulate middle + */ + for (data += AMM_BASIC_BLOCK, len -= AMM_BASIC_BLOCK; + len >= AMM_FINGER_BLOCK; + data += AMM_FINGER_BLOCK, len -= AMM_FINGER_BLOCK) { + int x, y, z, force, id; + + v = data[0] | ((data[1] & 0xf) << 8); + x = ((int16_t)(v << 4)) >> 4; + + v = (data[1] >> 4) | (data[2] << 4); + y = -(((int16_t)(v << 4)) >> 4); + + force = data[5] & 0x3f; + id = 0xf & ((data[5] >> 6) | (data[6] << 2)); + z = (y - c->y[id]) / AMM_WHEEL_SPEED; + + switch ((data[7] >> 4) & 0x7) { /* Phase */ + case 3: /* First touch */ + c->y[id] = y; + break; + case 4: /* Touch dragged */ + if (z) { + mouse_z += z; + c->y[id] += z * AMM_WHEEL_SPEED; + mevents++; + } + break; + default: + break; + } + /* Count firm touches vs. firm+middle touches */ + if (force >= 8 && ++firm && x > -350 && x < 350) + ++middle; + } + + /* + * If a new click is registered by mouse and there are firm + * touches which are all in center, make it a middle click + */ + if (mouse_butt && !c->button_state && firm && middle == firm) + mouse_butt = 0x2; + + /* + * If we're still clicking and have converted the click + * to a middle click, keep it middle clicking + */ +check_middle_button: + if (mouse_butt && c->button_state == 0x2) + mouse_butt = 0x2; + + if (mouse_butt != c->button_state) + c->button_state = mouse_butt, mevents++; + } /* * XXX FIXME Feed keyboard events into kernel. Modified: head/usr.sbin/bluetooth/bthidd/server.c ============================================================================== --- head/usr.sbin/bluetooth/bthidd/server.c Sat Aug 12 21:20:51 2017 (r322439) +++ head/usr.sbin/bluetooth/bthidd/server.c Sat Aug 12 21:23:33 2017 (r322440) @@ -289,6 +289,10 @@ server_accept(bthid_server_p srv, int32_t fd) srv->maxfd = s->vkbd; } + /* Pass device for probing after both channels are established */ + if (s->state == OPEN) + hid_initialise(s); + return (0); } Modified: head/usr.sbin/bluetooth/bthidd/session.c ============================================================================== --- head/usr.sbin/bluetooth/bthidd/session.c Sat Aug 12 21:20:51 2017 (r322439) +++ head/usr.sbin/bluetooth/bthidd/session.c Sat Aug 12 21:23:33 2017 (r322440) @@ -66,6 +66,7 @@ session_open(bthid_server_p srv, hid_device_p const d) memcpy(&s->bdaddr, &d->bdaddr, sizeof(s->bdaddr)); s->ctrl = -1; s->intr = -1; + s->ctx = NULL; if (d->keyboard) { /* Open /dev/vkbdctl */ @@ -176,6 +177,7 @@ session_close(bthid_session_p s) s->srv->maxfd --; } + free(s->ctx); free(s->keys1); free(s->keys2); From owner-svn-src-all@freebsd.org Sat Aug 12 21:26:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48BD2DC9383; Sat, 12 Aug 2017 21:26:47 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 17EB271D09; Sat, 12 Aug 2017 21:26:47 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CLQkgM089532; Sat, 12 Aug 2017 21:26:46 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CLQkJX089531; Sat, 12 Aug 2017 21:26:46 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708122126.v7CLQkJX089531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 12 Aug 2017 21:26:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322441 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 322441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 21:26:47 -0000 Author: ngie Date: Sat Aug 12 21:26:46 2017 New Revision: 322441 URL: https://svnweb.freebsd.org/changeset/base/322441 Log: Delete trailing whitespace MFC after: 1 month Modified: head/share/mk/bsd.cpu.mk Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Sat Aug 12 21:23:33 2017 (r322440) +++ head/share/mk/bsd.cpu.mk Sat Aug 12 21:26:46 2017 (r322441) @@ -399,7 +399,7 @@ CFLAGS_NO_SIMD= -mno-mmx -mno-sse .endif CFLAGS_NO_SIMD += ${CFLAGS_NO_SIMD.${COMPILER_TYPE}} -# Add in any architecture-specific CFLAGS. +# Add in any architecture-specific CFLAGS. # These come from make.conf or the command line or the environment. CFLAGS += ${CFLAGS.${MACHINE_ARCH}} CXXFLAGS += ${CXXFLAGS.${MACHINE_ARCH}} From owner-svn-src-all@freebsd.org Sat Aug 12 21:45:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9B32DCA4AF; Sat, 12 Aug 2017 21:45:56 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x231.google.com (mail-pg0-x231.google.com [IPv6:2607:f8b0:400e:c05::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A215B72623; Sat, 12 Aug 2017 21:45:56 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x231.google.com with SMTP id u185so27797869pgb.1; Sat, 12 Aug 2017 14:45:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=wHtsmVXHgznhA2o4GJz/Ajf4qyG7oqr+8UbML9lt+cQ=; b=YsLkoxRJPOSjvQBlc6DjWxTel/cTgiCYWY4GE0x/hhMlEPmp2XTlM8RdFxdcWwIoqh /aZw+M5/7x9c483htfYv+nKvHm2y52Te1apkYU3f4hB0qAWx0TI3eGF6CK4xuFzNcO6j DGAl3MzWGRZ7slJsbFrsv7TZNcb18grwU32InJTSYp15gRcftAjvDcwiu9ZQNA4GT9hq E3k4VTNjQ/U9VMgIG2dsdqWRocTTn8ktS3wYTeGecRU+r02tJH84seKopk30JDHLzlno aHz+lyxcARjcfbAwXSTYkfOuAf2QPlMBnQS/Y0WKRlFsJ2Y4/aZfscczf0a7eL0HVGDF aImg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=wHtsmVXHgznhA2o4GJz/Ajf4qyG7oqr+8UbML9lt+cQ=; b=aGDXuf7utKU85X5E95gABgj7HUGzmmjM/RB27AiutS6N1/aoMKcXdwCAh2tHLzKdbs YKxq85b6KA/uLk/W3M27XyFvjtGn9be2r26Xg8nftcWoqn1vddj3wsSo1aRbEb+e1NQ0 HOKFlp35p8yGgygyzfk9ArWwRQ6+2kBiRRFfosMp/wKA3Sff0dTiQGeX8i70OPQ2yiVk M82eSWGcUQnjp2gK5XCGcuCu98/a5yZWs+Q18UcROzzYRbVJOujCaj6tb4lwOvY7nl+d QtonvMVfpPtx+jv8U3Q9OAjkAwD+MZnDDQOWZDm5ZZSTafIx4mCU+LkLcLPDDb0SGXVj C7Rg== X-Gm-Message-State: AHYfb5h1qsMlEOE8qFfOtPKGMQbz0zNmihhcrzL4aNtpXIpPa6126Dod S/zf77CctXT5Ri00D7Q= X-Received: by 10.84.247.9 with SMTP id n9mr11207257pll.451.1502574355713; Sat, 12 Aug 2017 14:45:55 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id c7sm7367590pfg.29.2017.08.12.14.45.54 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 12 Aug 2017 14:45:54 -0700 (PDT) Subject: Re: svn commit: r322418 - head/lib/msun/src Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_D3F0B8CF-3165-4A57-B6AD-9A720E908915"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: Date: Sat, 12 Aug 2017 14:45:53 -0700 Cc: Ian Lepore , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Bruce Evans Message-Id: <5672BE7A-0640-4C8B-9B41-44AD83D7B59E@gmail.com> References: <201708112241.v7BMfP5X028262@repo.freebsd.org> <1502555191.47886.30.camel@freebsd.org> To: Ryan Libby X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 21:45:57 -0000 --Apple-Mail=_D3F0B8CF-3165-4A57-B6AD-9A720E908915 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 12, 2017, at 10:55, Ryan Libby wrote: =E2=80=A6 > A few possible quick fixes: >=20 > - Change the {arm64,riscv,sparc64}/include/float.h LDBL_MAX_EXP > definitions from (+16384) to 16384. >=20 > - Change HALF_LDBL_MAX from > #define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L) > to > #if LDBL_MAX_EXP !=3D 0x4000 > #error "Unsupported long double format" > #endif > #define HALF_LDBL_MAX 0x0.8p16384L >=20 > - Change the HALF_LDBL_MAX constant to a variable constructed with > LD80C(), I think with > LD80C(0x8000000000000000, 16383, 5.9486574767861588254e+4931L) > but this also requires #error for LDBL_MAX_EXP !=3D 0x4000, so not > really any better than the above. >=20 > I think I will back the patch out for now and go back to review. The issue is an inconsistency with how LDBL_MAX_EXP is defined in the MD = headers: $ grep -r LDBL_MAX_EXP sys/sparc64/ sys/sparc64/include/float.h:#define LDBL_MAX_EXP (+16384) $ grep -r LDBL_MAX_EXP sys/x86/ sys/x86/include/float.h:#define LDBL_MAX_EXP 16384 Cheers, -Ngie --Apple-Mail=_D3F0B8CF-3165-4A57-B6AD-9A720E908915 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZj3cRAAoJEPWDqSZpMIYVmIwQAMNw+sDbhRARTgI5+idAgLEn VJQASSEIYpWOJ8TkwoqRRY0oKGMS50thM9NCbHAEb2+6X0FyUbdkuVqj6oUw9qc7 8TjOEJIs2iLUTP2bnVtOdv6FpI3eiT0RljdVVXp9GdOm//JkHx9o7x5ym3VOD9d8 B2B44oJ9avveX217G8rrbTZD5KkyAZYMUDJOF8ir/eMVgpK+51QOgHtCxTVOyCnj GvrDJuyA6zTzJyx/CHigbLIp3BCLf97MigNZ2N/9w4f5MgYBy0ouOM2+VulcWVpM GAMM+NkLlAbucb2PgcsrT9YGblREcT7VSJJaqpn2nR7vAEQcEnadHXTvhVUtlK0b z2UsBz5TE3pOGFzJ0uUD1hMyeGUXf1F3ysSc8TWxfTnu5MF2eE+yOXdkdlJuN9ow 1i9/0XX93jeuJplMr4boS/dymcPJyU0VD9M86HltzNpqda5Wof5CDLgdkvsLNthV TPVN1ZL2DYvFsk8PwqcITlImTu6EzkzlueGHe4Mvcr3VWWkQccGh0yg8WQMKNw9E HZuNPw+turGtykjW0/BxgZ/r4vR+eyZ3CCYzXVO/JFRES830+Wn/CpYx/ylzPuF6 50gL/0HlnQ++3VGQv5X4y01EDIUyKW5fC4HZ/Cl6e/OSgFvg5fqktvD4lNUkj9vx CVMJGelbvypV6YiopWUa =5zwd -----END PGP SIGNATURE----- --Apple-Mail=_D3F0B8CF-3165-4A57-B6AD-9A720E908915-- From owner-svn-src-all@freebsd.org Sat Aug 12 21:53:51 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20346DCADC5; Sat, 12 Aug 2017 21:53:51 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x22d.google.com (mail-pf0-x22d.google.com [IPv6:2607:f8b0:400e:c00::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD8C972C9E; Sat, 12 Aug 2017 21:53:50 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x22d.google.com with SMTP id t86so28368647pfe.2; Sat, 12 Aug 2017 14:53:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=NRQz+pdrR2nC+04oKItrsJkhPkbfg/9wCT0PM8O0Zns=; b=apN5AiHpk8WTYIt3qa/cVH4VywRlx6OtU6+k2C/Uc9taW2yiq6ai1BgmBcINbqZ22B WuL+4QWn3zfXcq2beTm+i+YD9s2B984CfssnX2HGe+zUDvhpsaCCtDCL0uxQYHpwtr82 6PzYFzH7JeKrTXPkaRR74vzuhn5v/jjH5oG5RtHe7OvwbBijEXfed9Klf8e+CwxUYQ7B 2B3L/3P/k5X2FJBw28+rrRZ0Xyg7yOJx5C5zTTXHdL235V70OzFXzImXmZU8ERJ8oxcq KKDU+ojtFx5J//yu+auM2WzY7cnVJJ5apAxWNtciYWnTLzA/+e1rXUl6b3MqjLAKoTNS v7xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=NRQz+pdrR2nC+04oKItrsJkhPkbfg/9wCT0PM8O0Zns=; b=HdNyy6/fwCmzrqLcqxSna7h7BNsTA/V/Y5sZC8GPvTN3gEkcAcqNEwFMYUo9OdJdDY ZRhcqFKwZDHIhqNXLusKdLmjUva2JJQGrQnTFROdQ0FvnvMW6np82zW7ThlcyFkniA8F 3xBodIjgO6BtB2yTdNQATTmrivxUuAhQe7gVriNCgoDtaqKyZAgXIMje/rZSrQDcXPHt iF03cmOE4hkJxgu+f9pFbREoWfcLpbFpY2yCUuXtXrf3bv/vwezRWjbIUxhiFK4iMinR oxuSY4m0KB7F6gAEgwfBpPym3Kcd/OvxkRs1DsKbPq0DbyTjV5ef2LLdcOEtj/6NEzFx mkNg== X-Gm-Message-State: AHYfb5hGfBiNjSJaEYctSJghmWDhtnva7KdSgvb+meNBANDCAT7LI7mx 8u5bxWNTzZKKFg2HCx0= X-Received: by 10.84.229.12 with SMTP id b12mr17966024plk.325.1502574830111; Sat, 12 Aug 2017 14:53:50 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id t5sm7313432pfd.96.2017.08.12.14.53.49 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 12 Aug 2017 14:53:49 -0700 (PDT) Subject: Re: svn commit: r322418 - head/lib/msun/src Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_BDF55496-57E5-4C13-8DF1-81D59F02CDC5"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <5672BE7A-0640-4C8B-9B41-44AD83D7B59E@gmail.com> Date: Sat, 12 Aug 2017 14:53:48 -0700 Cc: Ian Lepore , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Bruce Evans Message-Id: References: <201708112241.v7BMfP5X028262@repo.freebsd.org> <1502555191.47886.30.camel@freebsd.org> <5672BE7A-0640-4C8B-9B41-44AD83D7B59E@gmail.com> To: Ryan Libby X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 21:53:51 -0000 --Apple-Mail=_BDF55496-57E5-4C13-8DF1-81D59F02CDC5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 12, 2017, at 14:45, Ngie Cooper (yaneurabeya) = wrote: >=20 >>=20 >> On Aug 12, 2017, at 10:55, Ryan Libby wrote: >=20 > =E2=80=A6 >=20 >> A few possible quick fixes: >>=20 >> - Change the {arm64,riscv,sparc64}/include/float.h LDBL_MAX_EXP >> definitions from (+16384) to 16384. >>=20 >> - Change HALF_LDBL_MAX from >> #define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L) >> to >> #if LDBL_MAX_EXP !=3D 0x4000 >> #error "Unsupported long double format" >> #endif >> #define HALF_LDBL_MAX 0x0.8p16384L >>=20 >> - Change the HALF_LDBL_MAX constant to a variable constructed with >> LD80C(), I think with >> LD80C(0x8000000000000000, 16383, 5.9486574767861588254e+4931L) >> but this also requires #error for LDBL_MAX_EXP !=3D 0x4000, so not >> really any better than the above. >>=20 >> I think I will back the patch out for now and go back to review. >=20 > The issue is an inconsistency with how LDBL_MAX_EXP is defined in the = MD headers: * is an -> is due to an > $ grep -r LDBL_MAX_EXP sys/sparc64/ > sys/sparc64/include/float.h:#define LDBL_MAX_EXP (+16384) > $ grep -r LDBL_MAX_EXP sys/x86/ > sys/x86/include/float.h:#define LDBL_MAX_EXP 16384 Here are the full gamut of definitions for LDBL_MAX_EXP. It = seems that sparc64 isn=E2=80=99t the only architecture using this = pattern: $ grep -r DBL_MAX_EXP sys/*/include sys/arm/include/float.h:#define DBL_MAX_EXP 1024 sys/arm/include/float.h:#define LDBL_MAX_EXP DBL_MAX_EXP sys/arm64/include/float.h:#define DBL_MAX_EXP 1024 sys/arm64/include/float.h:#define LDBL_MAX_EXP (+16384) sys/mips/include/float.h:#define DBL_MAX_EXP 1024 sys/mips/include/float.h:#define LDBL_MAX_EXP DBL_MAX_EXP sys/powerpc/include/float.h:#define DBL_MAX_EXP 1024 sys/powerpc/include/float.h:#define LDBL_MAX_EXP DBL_MAX_EXP sys/riscv/include/float.h:#define DBL_MAX_EXP 1024 sys/riscv/include/float.h:#define LDBL_MAX_EXP (+16384) sys/sparc64/include/float.h:#define DBL_MAX_EXP 1024 sys/sparc64/include/float.h:#define LDBL_MAX_EXP (+16384) sys/x86/include/float.h:#define DBL_MAX_EXP 1024 sys/x86/include/float.h:#define LDBL_MAX_EXP 16384 It might also be an inconsistency with how clang vs gcc [4.2.1] = handles __CONCAT, and what -std=3D flags are passed to ${CC} in the = Makefile, since the implementation is predicated by whether or not = it=E2=80=99s C++ or __STDC__ is defined. There might be an update that = we can grab from NetBSD (since the macro originated there). I don=E2=80=99t understand [right now] why the (+foo) form is = used *shrugs*. Cheers, -Ngie --Apple-Mail=_BDF55496-57E5-4C13-8DF1-81D59F02CDC5 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZj3jsAAoJEPWDqSZpMIYVuNIP/A2L0Q2+TY9QRBVFTFofoDJF PGjMe3E87pDLGuCePk0W3IBo6raGJ1tQw8WhYJast4H/z38J5VImuF0er//ZzUTf E76rB44simjn9tsM38lTNGFmBWKgvbrXJxTVFyEEE3tGL7rWW3sG0tf44HW3Z3tk cR/+8lO6RkFV3RodrPS1VhNFgV6WvzAgyyO4oYcx176HBdY/qlzXeFbww2swfgnZ rLTmmUQD4wLgfSSxkBCoKdru/YOGpCNeqQg1Dy7WDVBsMs2m7UL3RO0olgtdE0kr DDc2FCuUcDM2DpQBvG9PoRm3maK/OfVUgK16cc4np7mAg2cn4kERuSJMmE7PJFdS FOKcfBi+ACZJXFWkEGfEoUeW8QDjiBUC8sLfmuPQgjgYhyn9zsYhMj2bI6/W9L28 wzECELQl+F5yFxKg1QGRod/5BwqjLITTJSXMWGpuSE2tNMWiRxTpB/tjCofkbqES WhizL2QiZVdKZJLnUJAHW5IS4rAYdE4fZ3Y4rBwp3+TvZcDm+Y9z0XTIc6giUQfB kQkAxKRyz9wsW4Mw5wnb+RPiCSFpc4ptAD5OIQBY9UAJr9i7iT65IsBXZzDwobPj aygOzSs8hgQKQvJ5i+cUm80gcrKNIJRzR6LAMwhokrN+eFuTuPgp+JqIeUIKlFRa qrr+NeAAd4dM93ur8m4u =43lZ -----END PGP SIGNATURE----- --Apple-Mail=_BDF55496-57E5-4C13-8DF1-81D59F02CDC5-- From owner-svn-src-all@freebsd.org Sat Aug 12 22:12:12 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97F6BDCC0EA; Sat, 12 Aug 2017 22:12:12 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 4126A73699; Sat, 12 Aug 2017 22:12:12 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CMCBNY009710; Sat, 12 Aug 2017 22:12:11 GMT (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CMC9bA009694; Sat, 12 Aug 2017 22:12:09 GMT (envelope-from peter@FreeBSD.org) Message-Id: <201708122212.v7CMC9bA009694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peter set sender to peter@FreeBSD.org using -f From: Peter Wemm Date: Sat, 12 Aug 2017 22:12:09 +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: r322442 - in stable/11/contrib/subversion: . subversion/include subversion/libsvn_client subversion/libsvn_fs_fs subversion/libsvn_fs_x subversion/libsvn_ra_svn subversion/libsvn_repos ... X-SVN-Group: stable-11 X-SVN-Commit-Author: peter X-SVN-Commit-Paths: in stable/11/contrib/subversion: . subversion/include subversion/libsvn_client subversion/libsvn_fs_fs subversion/libsvn_fs_x subversion/libsvn_ra_svn subversion/libsvn_repos subversion/libsvn_subr su... X-SVN-Commit-Revision: 322442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 22:12:12 -0000 Author: peter Date: Sat Aug 12 22:12:09 2017 New Revision: 322442 URL: https://svnweb.freebsd.org/changeset/base/322442 Log: MFC: r322380 Update subversion 1.9.5 -> 1.9.7 Modified: stable/11/contrib/subversion/CHANGES stable/11/contrib/subversion/NOTICE stable/11/contrib/subversion/build-outputs.mk stable/11/contrib/subversion/configure stable/11/contrib/subversion/subversion/include/svn_version.h stable/11/contrib/subversion/subversion/libsvn_client/copy.c stable/11/contrib/subversion/subversion/libsvn_client/merge.c stable/11/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c stable/11/contrib/subversion/subversion/libsvn_fs_fs/cached_data.h stable/11/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h stable/11/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c stable/11/contrib/subversion/subversion/libsvn_fs_fs/transaction.c stable/11/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h stable/11/contrib/subversion/subversion/libsvn_ra_svn/client.c stable/11/contrib/subversion/subversion/libsvn_repos/dump.c stable/11/contrib/subversion/subversion/libsvn_subr/config_file.c stable/11/contrib/subversion/subversion/libsvn_subr/internal_statements.h stable/11/contrib/subversion/subversion/libsvn_subr/io.c stable/11/contrib/subversion/subversion/libsvn_subr/version.c stable/11/contrib/subversion/subversion/libsvn_wc/wc-checks.h stable/11/contrib/subversion/subversion/libsvn_wc/wc-metadata.h stable/11/contrib/subversion/subversion/libsvn_wc/wc-queries.h stable/11/contrib/subversion/subversion/svnadmin/svnadmin.c stable/11/contrib/subversion/win-tests.py Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/subversion/CHANGES ============================================================================== --- stable/11/contrib/subversion/CHANGES Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/CHANGES Sat Aug 12 22:12:09 2017 (r322442) @@ -1,3 +1,63 @@ +Version 1.9.7 +(10 Aug 2017, from /branches/1.9.x) +http://svn.apache.org/repos/asf/subversion/tags/1.9.7 + + User-visible changes: + - Client-side bugfixes: + * Fix arbitrary code execution vulnerability CVE-2017-9800 + See + for details. + + - Server-side bugfixes: + (none) + + - Bindings bugfixes: + (none) + + Developer-visible changes: + - General: + (none) + + - API changes: + (none) + + +Version 1.9.6 +(5 Jul 2017, from /branches/1.9.x) +http://svn.apache.org/repos/asf/subversion/tags/1.9.6 + + User-visible changes: + - Client-side bugfixes: + * cp/mv: improve error message when target is an unversioned dir (r1779948) + * merge: reduce memory usage with large amounts of mergeinfo (issue #4667) + + - Server-side bugfixes: + * 'svnadmin freeze': document the purpose more clearly (r1774109) + * dump: fix segfault when a revision has no revprops (r1781507) + * fsfs: improve error message upon failure to open rep-cache (r1781655) + * fsfs: never attempt to share directory representations (r1785053) + * fsfs: make consistency independent of hash algorithms (r1785737 et al) + This change makes Subversion resilient to collision attacks, including + SHA-1 collision attacks such as . See also our + documentation at and + . + + - Client-side and server-side bugfixes: + * work around an APR bug related to file truncation (r1759116) + + - Bindings bugfixes: + * javahl: follow redirects when opening a connection (r1667738, r1796720) + + Developer-visible changes: + - General: + * win_tests.py: make the --bin option work, rather than abort (r1706432) + (regression introduced in 1.9.2) + * windows: support building with 'zlibstat.lib' in install-layout (r1783704) + + - API changes: + (none) + + Version 1.9.5 (29 Nov 2016, from /branches/1.9.x) http://svn.apache.org/repos/asf/subversion/tags/1.9.5 @@ -19,7 +79,7 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.5 * fsfs: fix "offset too large" error during pack (issue #4657) * svnserve: enable hook script environments (r1769152) * fsfs: fix possible data reconstruction error (issue #4658) - * fix source of spurious 'incoming edit' tree conflicts (r1770108) + * fix source of spurious 'incoming edit' tree conflicts (r1760570) * fsfs: improve caching for large directories (r1721285) * fsfs: fix crash when encountering all-zero checksums (r1759686) * fsfs: fix potential source of repository corruptions (r1756266) @@ -34,19 +94,19 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.5 - Bindings bugfixes: * swig-pl: do not corrupt "{DATE}" revision variable (r1767768) - * javahl: fix temporary accepting SSL server certificates (r1764851) + * javahl: fix temporarily accepting SSL server certificates (r1764851) * swig-pl: fix possible stack corruption (r1683266, r1683267) Developer-visible changes: - General: * add zlib discovery through pkg-config (issue #4655) * fix potential build issue with invalid SVN_LOCALE_DIR (issue #4653) - * ruby: fix test failures with ruby >= 2.2 (r1766621) - * fix link error with --disable-keychain on OS X (r1765385) + * ruby: fix test failures with ruby >= 2.2 (r1766240) + * fix link error with --disable-keychain on OS X (r1761755) * swig: enable building with SWIG >= 3.0.6 (r1721488 et al) * swig: fix building with -Wdate-time in $CPPFLAGS (r1722164) * update serf download URI in build scripts (r1700130 et al) - * raise minimal httpd version from 2.0 to 2.2 (r1754193) + * raise minimal httpd version from 2.0 to 2.2 (r1754190) Version 1.9.4 @@ -105,7 +165,6 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.3 * svn: report lock/unlock errors as failures (r1701598 et al) * svn: cleanup user deleted external registrations (r1705843, r1710558) * svn: allow simple resolving of binary file text conflicts (r1703581) - * svnlook: properly remove tempfiles on diff errors (r1711346) * ra_serf: report built- and run-time versions of libserf (r1704847) * ra_serf: set Content-Type header in outgoing requests (r1715224 et al) * svn: fix merging deletes of svn:eol-style CRLF/CR files (r1703689 et al) @@ -118,6 +177,7 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.3 * mod_dav_svn: use LimitXMLRequestBody for skel-encoded requests (r1687812) * svnadmin dump: preserve no-op changes (r1709388 et al, issue #4598) * fsfs: avoid unneeded I/O when opening transactions (r1715793) + * svnlook: properly remove tempfiles on diff errors (r1711346) - Client-side and server-side bugfixes: * fix heap overflow in svn:// protocol parser (CVE-2015-5259) @@ -942,18 +1002,18 @@ http://svn.apache.org/repos/asf/subversion/tags/1.8.17 - Client-side bugfixes: * fix handling of newly secured subdirectories in working copy (r1724448) * ra_serf: fix deleting directories with many files (issue #4557) - * svnlook: properly remove tempfiles on diff errors (r1711346) * gpg-agent: properly handle passwords with percent characters (issue #4611) * merge: fix crash when merging to a local add (r1702299 et al) - Server-side bugfixes: * fsfs: fix possible data reconstruction error (issue #4658) + * svnlook: properly remove tempfiles on diff errors (r1711346) - Client-side and server-side bugfixes: * fix potential memory access bugs (r1722860 et al) - Bindings bugfixes: - * javahl: fix temporary accepting SSL server certificates (r1764851) + * javahl: fix temporarily accepting SSL server certificates (r1764851) * swig-pl: do not corrupt "{DATE}" revision variable (r1767768) * swig-pl: fix possible stack corruption (r1683266) Modified: stable/11/contrib/subversion/NOTICE ============================================================================== --- stable/11/contrib/subversion/NOTICE Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/NOTICE Sat Aug 12 22:12:09 2017 (r322442) @@ -1,5 +1,5 @@ Apache Subversion -Copyright 2016 The Apache Software Foundation +Copyright 2017 The Apache Software Foundation This product includes software developed by many people, and distributed under Contributor License Agreements to The Apache Software Foundation Modified: stable/11/contrib/subversion/build-outputs.mk ============================================================================== --- stable/11/contrib/subversion/build-outputs.mk Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/build-outputs.mk Sat Aug 12 22:12:09 2017 (r322442) @@ -2782,7 +2782,7 @@ subversion/libsvn_ra_serf/util_error.lo: subversion/li subversion/libsvn_ra_serf/xml.lo: subversion/libsvn_ra_serf/xml.c subversion/include/private/svn_dav_protocol.h subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_ra_private.h subversion/include/private/svn_string_private.h subversion/include/private/svn_subr_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_dav.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_version.h subversion/include/svn_xml.h subversion/libsvn_ra/ra_loader.h subversion/libsvn_ra_serf/blncache.h subversion/libsvn_ra_serf/ra_se rf.h subversion/svn_private_config.h -subversion/libsvn_ra_svn/client.lo: subversion/libsvn_ra_svn/client.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_fspath.h subversion/include/private/svn_ra_private.h subversion/include/private/svn_ra_svn_private.h subversion/include/private/svn_subr_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_compat.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_props.h subversion/include/svn_ra.h subversion/include/svn_ra_svn.h subversion/include/svn_string.h subversion/include/svn_time.h subversion/include/svn_types.h subversion/include/svn_version.h subversion/libsvn_ra/ra_loader.h sub version/libsvn_ra/wrapper_template.h subversion/libsvn_ra_svn/ra_svn.h subversion/svn_private_config.h +subversion/libsvn_ra_svn/client.lo: subversion/libsvn_ra_svn/client.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_fspath.h subversion/include/private/svn_ra_private.h subversion/include/private/svn_ra_svn_private.h subversion/include/private/svn_subr_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_compat.h subversion/include/svn_config.h subversion/include/svn_ctype.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_props.h subversion/include/svn_ra.h subversion/include/svn_ra_svn.h subversion/include/svn_string.h subversion/include/svn_time.h subversion/include/svn_types.h subversion/include/svn_version.h subve rsion/libsvn_ra/ra_loader.h subversion/libsvn_ra/wrapper_template.h subversion/libsvn_ra_svn/ra_svn.h subversion/svn_private_config.h subversion/libsvn_ra_svn/cram.lo: subversion/libsvn_ra_svn/cram.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_ra_svn_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_ra.h subversion/include/svn_ra_svn.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/libsvn_ra_svn/ra_svn.h subversion/svn_private_config.h Modified: stable/11/contrib/subversion/configure ============================================================================== --- stable/11/contrib/subversion/configure Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/configure Sat Aug 12 22:12:09 2017 (r322442) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for subversion 1.9.5. +# Generated by GNU Autoconf 2.69 for subversion 1.9.7. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='subversion' PACKAGE_TARNAME='subversion' -PACKAGE_VERSION='1.9.5' -PACKAGE_STRING='subversion 1.9.5' +PACKAGE_VERSION='1.9.7' +PACKAGE_STRING='subversion 1.9.7' PACKAGE_BUGREPORT='http://subversion.apache.org/' PACKAGE_URL='' @@ -1471,7 +1471,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures subversion 1.9.5 to adapt to many kinds of systems. +\`configure' configures subversion 1.9.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1537,7 +1537,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of subversion 1.9.5:";; + short | recursive ) echo "Configuration of subversion 1.9.7:";; esac cat <<\_ACEOF @@ -1751,7 +1751,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -subversion configure 1.9.5 +subversion configure 1.9.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2295,7 +2295,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by subversion $as_me 1.9.5, which was +It was created by subversion $as_me 1.9.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2675,8 +2675,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please -{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.9.5" >&5 -$as_echo "$as_me: Configuring Subversion 1.9.5" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.9.7" >&5 +$as_echo "$as_me: Configuring Subversion 1.9.7" >&6;} abs_srcdir="`cd $srcdir && pwd`" @@ -26756,7 +26756,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by subversion $as_me 1.9.5, which was +This file was extended by subversion $as_me 1.9.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -26822,7 +26822,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -subversion config.status 1.9.5 +subversion config.status 1.9.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/11/contrib/subversion/subversion/include/svn_version.h ============================================================================== --- stable/11/contrib/subversion/subversion/include/svn_version.h Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/subversion/include/svn_version.h Sat Aug 12 22:12:09 2017 (r322442) @@ -70,7 +70,7 @@ extern "C" { * * @since New in 1.1. */ -#define SVN_VER_PATCH 5 +#define SVN_VER_PATCH 7 /** @deprecated Provided for backward compatibility with the 1.0 API. */ @@ -93,7 +93,7 @@ extern "C" { * * Always change this at the same time as SVN_VER_NUMTAG. */ -#define SVN_VER_TAG " (r1770682)" +#define SVN_VER_TAG " (r1800392)" /** Number tag: a string describing the version. @@ -117,7 +117,7 @@ extern "C" { * file version. Its value remains 0 in the repository except in release * tags where it is the revision from which the tag was created. */ -#define SVN_VER_REVISION 1770682 +#define SVN_VER_REVISION 1800392 /* Version strings composed from the above definitions. */ Modified: stable/11/contrib/subversion/subversion/libsvn_client/copy.c ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_client/copy.c Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/subversion/libsvn_client/copy.c Sat Aug 12 22:12:09 2017 (r322442) @@ -1057,10 +1057,24 @@ verify_wc_dsts(const apr_array_header_t *copy_pairs, ctx->wc_ctx, pair->dst_parent_abspath, FALSE, TRUE, iterpool)); - if (make_parents && dst_parent_kind == svn_node_none) + if (dst_parent_kind == svn_node_none) { - SVN_ERR(svn_client__make_local_parents(pair->dst_parent_abspath, - TRUE, ctx, iterpool)); + if (make_parents) + SVN_ERR(svn_client__make_local_parents(pair->dst_parent_abspath, + TRUE, ctx, iterpool)); + else + { + SVN_ERR(svn_io_check_path(pair->dst_parent_abspath, + &dst_parent_kind, scratch_pool)); + return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL, + (dst_parent_kind == svn_node_dir) + ? _("Directory '%s' is not under " + "version control") + : _("Path '%s' is not a directory"), + svn_dirent_local_style( + pair->dst_parent_abspath, + scratch_pool)); + } } else if (dst_parent_kind != svn_node_dir) { Modified: stable/11/contrib/subversion/subversion/libsvn_client/merge.c ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_client/merge.c Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/subversion/libsvn_client/merge.c Sat Aug 12 22:12:09 2017 (r322442) @@ -6465,6 +6465,7 @@ get_mergeinfo_paths(apr_array_header_t *children_with_ { int i; apr_pool_t *iterpool = svn_pool_create(scratch_pool); + apr_pool_t *swmi_pool; apr_hash_t *subtrees_with_mergeinfo; apr_hash_t *excluded_subtrees; apr_hash_t *switched_subtrees; @@ -6473,10 +6474,13 @@ get_mergeinfo_paths(apr_array_header_t *children_with_ struct pre_merge_status_baton_t pre_merge_status_baton; /* Case 1: Subtrees with explicit mergeinfo. */ + /* Use a subpool for subtrees_with_mergeinfo, as it can be very large + and is temporary. */ + swmi_pool = svn_pool_create(scratch_pool); SVN_ERR(get_wc_explicit_mergeinfo_catalog(&subtrees_with_mergeinfo, target->abspath, depth, ctx, - result_pool, scratch_pool)); + swmi_pool, swmi_pool)); if (subtrees_with_mergeinfo) { apr_hash_index_t *hi; @@ -6513,6 +6517,7 @@ get_mergeinfo_paths(apr_array_header_t *children_with_ children_with_mergeinfo->elt_size, compare_merge_path_t_as_paths); } + svn_pool_destroy(swmi_pool); /* Case 2: Switched subtrees Case 10: Paths at depths of 'empty' or 'files' @@ -12331,6 +12336,10 @@ find_last_merged_location(svn_client__pathrev_t **base svn_revnum_t youngest_merged_rev = SVN_INVALID_REVNUM; svn_mergeinfo_catalog_t target_mergeinfo_cat = NULL; + /* Using a local subpool for 'target_mergeinfo_cat' can make a big + reduction in overall memory usage. */ + apr_pool_t *tmic_pool = svn_pool_create(scratch_pool); + source_peg_rev.kind = svn_opt_revision_number; source_peg_rev.value.number = source_branch->tip->rev; source_start_rev.kind = svn_opt_revision_number; @@ -12351,7 +12360,7 @@ find_last_merged_location(svn_client__pathrev_t **base operative_rev_receiver, &youngest_merged_rev, ctx, ra_session, - result_pool, scratch_pool)); + tmic_pool, tmic_pool)); if (!SVN_IS_VALID_REVNUM(youngest_merged_rev)) { @@ -12387,7 +12396,7 @@ find_last_merged_location(svn_client__pathrev_t **base operative_rev_receiver, &oldest_eligible_rev, ctx, ra_session, - scratch_pool, scratch_pool)); + tmic_pool, tmic_pool)); /* If there are revisions eligible for merging, use the oldest one to calculate the base. Otherwise there are no operative revisions @@ -12409,6 +12418,7 @@ find_last_merged_location(svn_client__pathrev_t **base result_pool, scratch_pool)); } + svn_pool_destroy(tmic_pool); return SVN_NO_ERROR; } Modified: stable/11/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c Sat Aug 12 22:12:09 2017 (r322442) @@ -2029,8 +2029,13 @@ rep_read_contents(void *baton, SVN_ERR(skip_contents(rb, rb->fulltext_delivered)); } - /* Get the next block of data. */ - SVN_ERR(get_contents_from_windows(rb, buf, len)); + /* Get the next block of data. + * Keep in mind that the representation might be empty and leave us + * already positioned at the end of the rep. */ + if (rb->off == rb->len) + *len = 0; + else + SVN_ERR(get_contents_from_windows(rb, buf, len)); if (rb->current_fulltext) svn_stringbuf_appendbytes(rb->current_fulltext, buf, *len); @@ -2119,6 +2124,96 @@ svn_fs_fs__get_contents(svn_stream_t **contents_p, rep_read_contents); svn_stream_set_close(*contents_p, rep_read_contents_close); } + + return SVN_NO_ERROR; +} + +svn_error_t * +svn_fs_fs__get_contents_from_file(svn_stream_t **contents_p, + svn_fs_t *fs, + representation_t *rep, + apr_file_t *file, + apr_off_t offset, + apr_pool_t *pool) +{ + struct rep_read_baton *rb; + pair_cache_key_t fulltext_cache_key = { SVN_INVALID_REVNUM, 0 }; + rep_state_t *rs = apr_pcalloc(pool, sizeof(*rs)); + svn_fs_fs__rep_header_t *rh; + + /* Initialize the reader baton. Some members may added lazily + * while reading from the stream. */ + SVN_ERR(rep_read_get_baton(&rb, fs, rep, fulltext_cache_key, pool)); + + /* Continue constructing RS. Leave caches as NULL. */ + rs->size = rep->size; + rs->revision = SVN_INVALID_REVNUM; + rs->item_index = 0; + rs->ver = -1; + rs->start = -1; + + /* Provide just enough file access info to allow for a basic read from + * FILE but leave all index / footer info with empty values b/c FILE + * probably is not a complete revision file. */ + rs->sfile = apr_pcalloc(pool, sizeof(*rs->sfile)); + rs->sfile->revision = rep->revision; + rs->sfile->pool = pool; + rs->sfile->fs = fs; + rs->sfile->rfile = apr_pcalloc(pool, sizeof(*rs->sfile->rfile)); + rs->sfile->rfile->start_revision = SVN_INVALID_REVNUM; + rs->sfile->rfile->file = file; + rs->sfile->rfile->stream = svn_stream_from_aprfile2(file, TRUE, pool); + + /* Read the rep header. */ + SVN_ERR(aligned_seek(fs, file, NULL, offset, pool)); + SVN_ERR(svn_fs_fs__read_rep_header(&rh, rs->sfile->rfile->stream, + pool, pool)); + SVN_ERR(get_file_offset(&rs->start, rs, pool)); + rs->header_size = rh->header_size; + + /* Log the access. */ + SVN_ERR(dbg_log_access(fs, SVN_INVALID_REVNUM, 0, rh, + SVN_FS_FS__ITEM_TYPE_ANY_REP, pool)); + + /* Build the representation list (delta chain). */ + if (rh->type == svn_fs_fs__rep_plain) + { + rb->rs_list = apr_array_make(pool, 0, sizeof(rep_state_t *)); + rb->src_state = rs; + } + else if (rh->type == svn_fs_fs__rep_self_delta) + { + rb->rs_list = apr_array_make(pool, 1, sizeof(rep_state_t *)); + APR_ARRAY_PUSH(rb->rs_list, rep_state_t *) = rs; + rb->src_state = NULL; + } + else + { + representation_t next_rep = { 0 }; + + /* skip "SVNx" diff marker */ + rs->current = 4; + + /* REP's base rep is inside a proper revision. + * It can be reconstructed in the usual way. */ + next_rep.revision = rh->base_revision; + next_rep.item_index = rh->base_item_index; + next_rep.size = rh->base_length; + svn_fs_fs__id_txn_reset(&next_rep.txn_id); + + SVN_ERR(build_rep_list(&rb->rs_list, &rb->base_window, + &rb->src_state, &rb->len, rb->fs, &next_rep, + rb->filehandle_pool)); + + /* Insert the access to REP as the first element of the delta chain. */ + svn_sort__array_insert(rb->rs_list, &rs, 0); + } + + /* Now, the baton is complete and we can assemble the stream around it. */ + *contents_p = svn_stream_create(rb, pool); + svn_stream_set_read2(*contents_p, NULL /* only full read support */, + rep_read_contents); + svn_stream_set_close(*contents_p, rep_read_contents_close); return SVN_NO_ERROR; } Modified: stable/11/contrib/subversion/subversion/libsvn_fs_fs/cached_data.h ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_fs_fs/cached_data.h Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/subversion/libsvn_fs_fs/cached_data.h Sat Aug 12 22:12:09 2017 (r322442) @@ -81,6 +81,18 @@ svn_fs_fs__get_contents(svn_stream_t **contents_p, svn_boolean_t cache_fulltext, apr_pool_t *pool); +/* Set *CONTENTS_P to be a readable svn_stream_t that receives the text + representation REP as seen in filesystem FS. Read the latest element + of the delta chain from FILE at offset OFFSET. + Use POOL for allocations. */ +svn_error_t * +svn_fs_fs__get_contents_from_file(svn_stream_t **contents_p, + svn_fs_t *fs, + representation_t *rep, + apr_file_t *file, + apr_off_t offset, + apr_pool_t *pool); + /* Attempt to fetch the text representation of node-revision NODEREV as seen in filesystem FS and pass it along with the BATON to the PROCESSOR. Set *SUCCESS only of the data could be provided and the processing Modified: stable/11/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h Sat Aug 12 22:12:09 2017 (r322442) @@ -1,4 +1,4 @@ -/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.5/subversion/libsvn_fs_fs/token-map.h. +/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.7/subversion/libsvn_fs_fs/token-map.h. * Do not edit this file -- edit the source and rerun gen-make.py */ #define STMT_CREATE_SCHEMA 0 Modified: stable/11/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c Sat Aug 12 22:12:09 2017 (r322442) @@ -128,7 +128,10 @@ svn_fs_fs__open_rep_cache(svn_fs_t *fs, fs_fs_data_t *ffd = fs->fsap_data; svn_error_t *err = svn_atomic__init_once(&ffd->rep_cache_db_opened, open_rep_cache, fs, pool); - return svn_error_quick_wrap(err, _("Couldn't open rep-cache database")); + return svn_error_quick_wrapf(err, + _("Couldn't open rep-cache database '%s'"), + svn_dirent_local_style( + path_rep_cache_db(fs->path, pool), pool)); } svn_error_t * Modified: stable/11/contrib/subversion/subversion/libsvn_fs_fs/transaction.c ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_fs_fs/transaction.c Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/subversion/libsvn_fs_fs/transaction.c Sat Aug 12 22:12:09 2017 (r322442) @@ -2128,6 +2128,11 @@ rep_write_get_baton(struct rep_write_baton **wb_p, there may be new duplicate representations within the same uncommitted revision, those can be passed in REPS_HASH (maps a sha1 digest onto representation_t*), otherwise pass in NULL for REPS_HASH. + + The content of both representations will be compared, taking REP's content + from FILE at OFFSET. Only if they actually match, will *OLD_REP not be + NULL. + Use RESULT_POOL for *OLD_REP allocations and SCRATCH_POOL for temporaries. The lifetime of *OLD_REP is limited by both, RESULT_POOL and REP lifetime. */ @@ -2135,6 +2140,8 @@ static svn_error_t * get_shared_rep(representation_t **old_rep, svn_fs_t *fs, representation_t *rep, + apr_file_t *file, + apr_off_t offset, apr_hash_t *reps_hash, apr_pool_t *result_pool, apr_pool_t *scratch_pool) @@ -2142,6 +2149,10 @@ get_shared_rep(representation_t **old_rep, svn_error_t *err; fs_fs_data_t *ffd = fs->fsap_data; + svn_checksum_t checksum; + checksum.digest = rep->sha1_digest; + checksum.kind = svn_checksum_sha1; + /* Return NULL, if rep sharing has been disabled. */ *old_rep = NULL; if (!ffd->rep_sharing_allowed) @@ -2158,9 +2169,6 @@ get_shared_rep(representation_t **old_rep, /* If we haven't found anything yet, try harder and consult our DB. */ if (*old_rep == NULL) { - svn_checksum_t checksum; - checksum.digest = rep->sha1_digest; - checksum.kind = svn_checksum_sha1; err = svn_fs_fs__get_rep_reference(old_rep, fs, &checksum, result_pool); /* ### Other error codes that we shouldn't mask out? */ if (err == SVN_NO_ERROR) @@ -2235,6 +2243,72 @@ get_shared_rep(representation_t **old_rep, (*old_rep)->uniquifier = rep->uniquifier; } + /* If we (very likely) found a matching representation, compare the actual + * contents such that we can be sure that no rep-cache.db corruption or + * hash collision produced a false positive. */ + if (*old_rep) + { + apr_off_t old_position; + svn_stream_t *contents; + svn_stream_t *old_contents; + svn_boolean_t same; + + /* The existing representation may itself be part of the current + * transaction. In that case, it may be in different stages of + * the commit finalization process. + * + * OLD_REP_NORM is the same as that OLD_REP but it is assigned + * explicitly to REP's transaction if OLD_REP does not point + * to an already committed revision. This then prevents the + * revision lookup and the txn data will be accessed. + */ + representation_t old_rep_norm = **old_rep; + if ( !SVN_IS_VALID_REVNUM(old_rep_norm.revision) + || old_rep_norm.revision > ffd->youngest_rev_cache) + old_rep_norm.txn_id = rep->txn_id; + + /* Make sure we can later restore FILE's current position. */ + SVN_ERR(svn_fs_fs__get_file_offset(&old_position, file, scratch_pool)); + + /* Compare the two representations. + * Note that the stream comparison might also produce MD5 checksum + * errors or other failures in case of SHA1 collisions. */ + SVN_ERR(svn_fs_fs__get_contents_from_file(&contents, fs, rep, file, + offset, scratch_pool)); + SVN_ERR(svn_fs_fs__get_contents(&old_contents, fs, &old_rep_norm, + FALSE, scratch_pool)); + err = svn_stream_contents_same2(&same, contents, old_contents, + scratch_pool); + + /* A mismatch should be extremely rare. + * If it does happen, reject the commit. */ + if (!same || err) + { + /* SHA1 collision or worse. */ + svn_stringbuf_t *old_rep_str + = svn_fs_fs__unparse_representation(*old_rep, + ffd->format, FALSE, + scratch_pool, + scratch_pool); + svn_stringbuf_t *rep_str + = svn_fs_fs__unparse_representation(rep, + ffd->format, FALSE, + scratch_pool, + scratch_pool); + const char *checksum__str + = svn_checksum_to_cstring_display(&checksum, scratch_pool); + + return svn_error_createf(SVN_ERR_FS_GENERAL, + err, "SHA1 of reps '%s' and '%s' " + "matches (%s) but contents differ", + old_rep_str->data, rep_str->data, + checksum__str); + } + + /* Restore FILE's read / write position. */ + SVN_ERR(svn_io_file_seek(file, APR_SET, &old_position, scratch_pool)); + } + return SVN_NO_ERROR; } @@ -2293,8 +2367,8 @@ rep_write_contents_close(void *baton) /* Check and see if we already have a representation somewhere that's identical to the one we just wrote out. */ - SVN_ERR(get_shared_rep(&old_rep, b->fs, rep, NULL, b->result_pool, - b->scratch_pool)); + SVN_ERR(get_shared_rep(&old_rep, b->fs, rep, b->file, b->rep_offset, NULL, + b->result_pool, b->scratch_pool)); if (old_rep) { @@ -2519,11 +2593,16 @@ write_directory_to_stream(svn_stream_t *stream, /* Write out the COLLECTION as a text representation to file FILE using WRITER. In the process, record position, the total size of the dump and MD5 as well as SHA1 in REP. Add the representation of type ITEM_TYPE to - the indexes if necessary. If rep sharing has been enabled and REPS_HASH - is not NULL, it will be used in addition to the on-disk cache to find - earlier reps with the same content. When such existing reps can be - found, we will truncate the one just written from the file and return - the existing rep. Perform temporary allocations in SCRATCH_POOL. */ + the indexes if necessary. + + If ALLOW_REP_SHARING is FALSE, rep-sharing will not be used, regardless + of any other option and rep-sharing settings. If rep sharing has been + enabled and REPS_HASH is not NULL, it will be used in addition to the + on-disk cache to find earlier reps with the same content. If such + existing reps can be found, we will truncate the one just written from + the file and return the existing rep. + + Perform temporary allocations in SCRATCH_POOL. */ static svn_error_t * write_container_rep(representation_t *rep, apr_file_t *file, @@ -2531,14 +2610,15 @@ write_container_rep(representation_t *rep, collection_writer_t writer, svn_fs_t *fs, apr_hash_t *reps_hash, + svn_boolean_t allow_rep_sharing, apr_uint32_t item_type, apr_pool_t *scratch_pool) { svn_stream_t *stream; struct write_container_baton *whb; svn_checksum_ctx_t *fnv1a_checksum_ctx; - representation_t *old_rep; apr_off_t offset = 0; + svn_fs_fs__p2l_entry_t entry; SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); @@ -2562,58 +2642,62 @@ write_container_rep(representation_t *rep, /* Store the results. */ SVN_ERR(digests_final(rep, whb->md5_ctx, whb->sha1_ctx, scratch_pool)); + /* Update size info. */ + rep->expanded_size = whb->size; + rep->size = whb->size; + /* Check and see if we already have a representation somewhere that's identical to the one we just wrote out. */ - SVN_ERR(get_shared_rep(&old_rep, fs, rep, reps_hash, scratch_pool, - scratch_pool)); - - if (old_rep) + if (allow_rep_sharing) { - /* We need to erase from the protorev the data we just wrote. */ - SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + representation_t *old_rep; + SVN_ERR(get_shared_rep(&old_rep, fs, rep, file, offset, reps_hash, + scratch_pool, scratch_pool)); - /* Use the old rep for this content. */ - memcpy(rep, old_rep, sizeof (*rep)); + if (old_rep) + { + /* We need to erase from the protorev the data we just wrote. */ + SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + + /* Use the old rep for this content. */ + memcpy(rep, old_rep, sizeof (*rep)); + return SVN_NO_ERROR; + } } - else - { - svn_fs_fs__p2l_entry_t entry; - /* Write out our cosmetic end marker. */ - SVN_ERR(svn_stream_puts(whb->stream, "ENDREP\n")); + /* Write out our cosmetic end marker. */ + SVN_ERR(svn_stream_puts(whb->stream, "ENDREP\n")); - SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, - offset, scratch_pool)); + SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, + offset, scratch_pool)); - entry.offset = offset; - SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); - entry.size = offset - entry.offset; - entry.type = item_type; - entry.item.revision = SVN_INVALID_REVNUM; - entry.item.number = rep->item_index; - SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, - fnv1a_checksum_ctx, - scratch_pool)); + entry.offset = offset; + SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); + entry.size = offset - entry.offset; + entry.type = item_type; + entry.item.revision = SVN_INVALID_REVNUM; + entry.item.number = rep->item_index; + SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, + fnv1a_checksum_ctx, + scratch_pool)); - SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); + SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); - /* update the representation */ - rep->size = whb->size; - rep->expanded_size = whb->size; - } - return SVN_NO_ERROR; } /* Write out the COLLECTION pertaining to the NODEREV in FS as a deltified text representation to file FILE using WRITER. In the process, record the total size and the md5 digest in REP and add the representation of type - ITEM_TYPE to the indexes if necessary. If rep sharing has been enabled and - REPS_HASH is not NULL, it will be used in addition to the on-disk cache to - find earlier reps with the same content. When such existing reps can be - found, we will truncate the one just written from the file and return the - existing rep. + ITEM_TYPE to the indexes if necessary. + If ALLOW_REP_SHARING is FALSE, rep-sharing will not be used, regardless + of any other option and rep-sharing settings. If rep sharing has been + enabled and REPS_HASH is not NULL, it will be used in addition to the + on-disk cache to find earlier reps with the same content. If such + existing reps can be found, we will truncate the one just written from + the file and return the existing rep. + If ITEM_TYPE is IS_PROPS equals SVN_FS_FS__ITEM_TYPE_*_PROPS, assume that we want to a props representation as the base for our delta. Perform temporary allocations in SCRATCH_POOL. @@ -2626,6 +2710,7 @@ write_container_delta_rep(representation_t *rep, svn_fs_t *fs, node_revision_t *noderev, apr_hash_t *reps_hash, + svn_boolean_t allow_rep_sharing, apr_uint32_t item_type, apr_pool_t *scratch_pool) { @@ -2635,10 +2720,10 @@ write_container_delta_rep(representation_t *rep, svn_stream_t *file_stream; svn_stream_t *stream; representation_t *base_rep; - representation_t *old_rep; svn_checksum_ctx_t *fnv1a_checksum_ctx; svn_stream_t *source; svn_fs_fs__rep_header_t header = { 0 }; + svn_fs_fs__p2l_entry_t entry; apr_off_t rep_end = 0; apr_off_t delta_start = 0; @@ -2701,47 +2786,48 @@ write_container_delta_rep(representation_t *rep, /* Store the results. */ SVN_ERR(digests_final(rep, whb->md5_ctx, whb->sha1_ctx, scratch_pool)); + /* Update size info. */ + SVN_ERR(svn_fs_fs__get_file_offset(&rep_end, file, scratch_pool)); + rep->size = rep_end - delta_start; + rep->expanded_size = whb->size; + /* Check and see if we already have a representation somewhere that's identical to the one we just wrote out. */ - SVN_ERR(get_shared_rep(&old_rep, fs, rep, reps_hash, scratch_pool, - scratch_pool)); - - if (old_rep) + if (allow_rep_sharing) { - /* We need to erase from the protorev the data we just wrote. */ - SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + representation_t *old_rep; + SVN_ERR(get_shared_rep(&old_rep, fs, rep, file, offset, reps_hash, + scratch_pool, scratch_pool)); - /* Use the old rep for this content. */ - memcpy(rep, old_rep, sizeof (*rep)); + if (old_rep) + { + /* We need to erase from the protorev the data we just wrote. */ + SVN_ERR(svn_io_file_trunc(file, offset, scratch_pool)); + + /* Use the old rep for this content. */ + memcpy(rep, old_rep, sizeof (*rep)); + return SVN_NO_ERROR; + } } - else - { - svn_fs_fs__p2l_entry_t entry; - /* Write out our cosmetic end marker. */ - SVN_ERR(svn_fs_fs__get_file_offset(&rep_end, file, scratch_pool)); - SVN_ERR(svn_stream_puts(file_stream, "ENDREP\n")); + /* Write out our cosmetic end marker. */ + SVN_ERR(svn_stream_puts(file_stream, "ENDREP\n")); - SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, - offset, scratch_pool)); + SVN_ERR(allocate_item_index(&rep->item_index, fs, &rep->txn_id, + offset, scratch_pool)); - entry.offset = offset; - SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); - entry.size = offset - entry.offset; - entry.type = item_type; - entry.item.revision = SVN_INVALID_REVNUM; - entry.item.number = rep->item_index; - SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, - fnv1a_checksum_ctx, - scratch_pool)); + entry.offset = offset; + SVN_ERR(svn_fs_fs__get_file_offset(&offset, file, scratch_pool)); + entry.size = offset - entry.offset; + entry.type = item_type; + entry.item.revision = SVN_INVALID_REVNUM; + entry.item.number = rep->item_index; + SVN_ERR(fnv1a_checksum_finalize(&entry.fnv1_checksum, + fnv1a_checksum_ctx, + scratch_pool)); - SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); + SVN_ERR(store_p2l_index_entry(fs, &rep->txn_id, &entry, scratch_pool)); - /* update the representation */ - rep->expanded_size = whb->size; - rep->size = rep_end - delta_start; - } - return SVN_NO_ERROR; } @@ -2920,13 +3006,14 @@ write_final_rev(const svn_fs_id_t **new_id_p, SVN_ERR(write_container_delta_rep(noderev->data_rep, file, entries, write_directory_to_stream, - fs, noderev, NULL, + fs, noderev, NULL, FALSE, SVN_FS_FS__ITEM_TYPE_DIR_REP, pool)); else SVN_ERR(write_container_rep(noderev->data_rep, file, entries, write_directory_to_stream, fs, NULL, - SVN_FS_FS__ITEM_TYPE_DIR_REP, pool)); + FALSE, SVN_FS_FS__ITEM_TYPE_DIR_REP, + pool)); reset_txn_in_rep(noderev->data_rep); } @@ -2971,11 +3058,11 @@ write_final_rev(const svn_fs_id_t **new_id_p, if (ffd->deltify_properties) SVN_ERR(write_container_delta_rep(noderev->prop_rep, file, proplist, write_hash_to_stream, fs, noderev, - reps_hash, item_type, pool)); + reps_hash, TRUE, item_type, pool)); else SVN_ERR(write_container_rep(noderev->prop_rep, file, proplist, write_hash_to_stream, fs, reps_hash, - item_type, pool)); + TRUE, item_type, pool)); reset_txn_in_rep(noderev->prop_rep); } Modified: stable/11/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h Sat Aug 12 22:12:09 2017 (r322442) @@ -1,4 +1,4 @@ -/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.5/subversion/libsvn_fs_x/token-map.h. +/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.7/subversion/libsvn_fs_x/token-map.h. * Do not edit this file -- edit the source and rerun gen-make.py */ #define STMT_CREATE_SCHEMA 0 Modified: stable/11/contrib/subversion/subversion/libsvn_ra_svn/client.c ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_ra_svn/client.c Sat Aug 12 21:26:46 2017 (r322441) +++ stable/11/contrib/subversion/subversion/libsvn_ra_svn/client.c Sat Aug 12 22:12:09 2017 (r322442) @@ -46,6 +46,7 @@ #include "svn_props.h" #include "svn_mergeinfo.h" #include "svn_version.h" +#include "svn_ctype.h" #include "svn_private_config.h" @@ -396,7 +397,7 @@ static svn_error_t *find_tunnel_agent(const char *tunn * versions have it too. If the user is using some other ssh * implementation that doesn't accept it, they can override it * in the [tunnels] section of the config. */ - val = "$SVN_SSH ssh -q"; + val = "$SVN_SSH ssh -q --"; } if (!val || !*val) @@ -441,7 +442,7 @@ static svn_error_t *find_tunnel_agent(const char *tunn for (n = 0; cmd_argv[n] != NULL; n++) argv[n] = cmd_argv[n]; - argv[n++] = svn_path_uri_decode(hostinfo, pool); + argv[n++] = hostinfo; argv[n++] = "svnserve"; argv[n++] = "-t"; argv[n] = NULL; @@ -802,7 +803,33 @@ ra_svn_get_schemes(apr_pool_t *pool) } +/* A simple whitelist to ensure the following are valid: + * user@server + * [::1]:22 + * server-name + * server_name + * 127.0.0.1 + * with an extra restriction that a leading '-' is invalid. + */ +static svn_boolean_t +is_valid_hostinfo(const char *hostinfo) +{ + const char *p = hostinfo; + if (p[0] == '-') + return FALSE; + + while (*p) + { + if (!svn_ctype_isalnum(*p) && !strchr(":.-_[]@", *p)) + return FALSE; + + ++p; + } + + return TRUE; +} + static svn_error_t *ra_svn_open(svn_ra_session_t *session, const char **corrected_url, const char *url, @@ -835,8 +862,18 @@ static svn_error_t *ra_svn_open(svn_ra_session_t *sess || (callbacks->check_tunnel_func && callbacks->open_tunnel_func && !callbacks->check_tunnel_func(callbacks->tunnel_baton, tunnel)))) - SVN_ERR(find_tunnel_agent(tunnel, uri.hostinfo, &tunnel_argv, config, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Aug 12 22:13:07 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5851FDCC255; Sat, 12 Aug 2017 22:13:07 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 2774173910; Sat, 12 Aug 2017 22:13:07 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CMD66V009801; Sat, 12 Aug 2017 22:13:06 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CMD6gN009800; Sat, 12 Aug 2017 22:13:06 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201708122213.v7CMD6gN009800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sat, 12 Aug 2017 22:13:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322443 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 322443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 22:13:07 -0000 Author: nwhitehorn Date: Sat Aug 12 22:13:06 2017 New Revision: 322443 URL: https://svnweb.freebsd.org/changeset/base/322443 Log: Move NVME controller shutdown from being called as part of module unloading to being called through the newbus DEVICE_SHUTDOWN() path. This ensures that the NVME controller gets shut down before the device and bus disappear and prevents data corruption on shutdown on at least Samsung EVO 960 SSDs. PR: kern/211852 Reviewed by: imp MFC after: 2 weeks Modified: head/sys/dev/nvme/nvme.c Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Sat Aug 12 22:12:09 2017 (r322442) +++ head/sys/dev/nvme/nvme.c Sat Aug 12 22:13:06 2017 (r322443) @@ -58,6 +58,7 @@ MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) memory allocati static int nvme_probe(device_t); static int nvme_attach(device_t); static int nvme_detach(device_t); +static int nvme_shutdown(device_t); static int nvme_modevent(module_t mod, int type, void *arg); static devclass_t nvme_devclass; @@ -67,6 +68,7 @@ static device_method_t nvme_pci_methods[] = { DEVMETHOD(device_probe, nvme_probe), DEVMETHOD(device_attach, nvme_attach), DEVMETHOD(device_detach, nvme_detach), + DEVMETHOD(device_shutdown, nvme_shutdown), { 0, 0 } }; @@ -179,22 +181,15 @@ nvme_unload(void) { } -static void -nvme_shutdown(void) +static int +nvme_shutdown(device_t dev) { - device_t *devlist; struct nvme_controller *ctrlr; - int dev, devcount; - if (devclass_get_devices(nvme_devclass, &devlist, &devcount)) - return; + ctrlr = DEVICE2SOFTC(dev); + nvme_ctrlr_shutdown(ctrlr); - for (dev = 0; dev < devcount; dev++) { - ctrlr = DEVICE2SOFTC(devlist[dev]); - nvme_ctrlr_shutdown(ctrlr); - } - - free(devlist, M_TEMP); + return (0); } static int @@ -207,9 +202,6 @@ nvme_modevent(module_t mod, int type, void *arg) break; case MOD_UNLOAD: nvme_unload(); - break; - case MOD_SHUTDOWN: - nvme_shutdown(); break; default: break; From owner-svn-src-all@freebsd.org Sat Aug 12 22:14:11 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 495FBDCC40A; Sat, 12 Aug 2017 22:14:11 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 0034273B4D; Sat, 12 Aug 2017 22:14:10 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CMEASD010056; Sat, 12 Aug 2017 22:14:10 GMT (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CME9SL010051; Sat, 12 Aug 2017 22:14:09 GMT (envelope-from peter@FreeBSD.org) Message-Id: <201708122214.v7CME9SL010051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peter set sender to peter@FreeBSD.org using -f From: Peter Wemm Date: Sat, 12 Aug 2017 22:14:09 +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: r322444 - in stable/11/contrib/sqlite3: . tea tea/generic X-SVN-Group: stable-11 X-SVN-Commit-Author: peter X-SVN-Commit-Paths: in stable/11/contrib/sqlite3: . tea tea/generic X-SVN-Commit-Revision: 322444 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 22:14:11 -0000 Author: peter Date: Sat Aug 12 22:14:09 2017 New Revision: 322444 URL: https://svnweb.freebsd.org/changeset/base/322444 Log: MFC: r322386 Update private sqlite3-3.14.1 to sqlite3-3.20.0. Modified: stable/11/contrib/sqlite3/Makefile.msc stable/11/contrib/sqlite3/configure stable/11/contrib/sqlite3/configure.ac stable/11/contrib/sqlite3/shell.c stable/11/contrib/sqlite3/sqlite3.c stable/11/contrib/sqlite3/sqlite3.h stable/11/contrib/sqlite3/sqlite3ext.h stable/11/contrib/sqlite3/tea/configure stable/11/contrib/sqlite3/tea/configure.ac stable/11/contrib/sqlite3/tea/generic/tclsqlite3.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/sqlite3/Makefile.msc ============================================================================== --- stable/11/contrib/sqlite3/Makefile.msc Sat Aug 12 22:13:06 2017 (r322443) +++ stable/11/contrib/sqlite3/Makefile.msc Sat Aug 12 22:14:09 2017 (r322444) @@ -21,9 +21,16 @@ TOP = . # Set this non-0 to enable full warnings (-W4, etc) when compiling. # !IFNDEF USE_FULLWARN -USE_FULLWARN = 0 +USE_FULLWARN = 1 !ENDIF +# Set this non-0 to enable treating warnings as errors (-WX, etc) when +# compiling. +# +!IFNDEF USE_FATAL_WARN +USE_FATAL_WARN = 0 +!ENDIF + # Set this non-0 to enable full runtime error checks (-RTC1, etc). This # has no effect if (any) optimizations are enabled. # @@ -31,6 +38,13 @@ USE_FULLWARN = 0 USE_RUNTIME_CHECKS = 0 !ENDIF +# Set this non-0 to create a SQLite amalgamation file that excludes the +# various built-in extensions. +# +!IFNDEF MINIMAL_AMALGAMATION +MINIMAL_AMALGAMATION = 0 +!ENDIF + # Set this non-0 to use "stdcall" calling convention for the core library # and shell executable. # @@ -255,12 +269,15 @@ SQLITE3EXEPDB = /pdb:sqlite3sh.pdb !ENDIF !ENDIF + # These are the "standard" SQLite compilation options used when compiling for # the Windows platform. # !IFNDEF OPT_FEATURE_FLAGS +!IF $(MINIMAL_AMALGAMATION)==0 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1 +!ENDIF OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1 !ENDIF @@ -444,6 +461,12 @@ TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1 $(CCOPTS) $ TCC = $(CC) -nologo -W3 $(CCOPTS) $(TCCOPTS) !ENDIF +# Check if warnings should be treated as errors when compiling. +# +!IF $(USE_FATAL_WARN)!=0 +TCC = $(TCC) -WX +!ENDIF + TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -fp:precise RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS) @@ -622,7 +645,11 @@ RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1 !IF $(DEBUG)>2 TCC = $(TCC) -DSQLITE_DEBUG=1 RCC = $(RCC) -DSQLITE_DEBUG=1 +!IF $(DYNAMIC_SHELL)==0 +TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE +RCC = $(RCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE !ENDIF +!ENDIF !IF $(DEBUG)>4 || $(OSTRACE)!=0 TCC = $(TCC) -DSQLITE_FORCE_OS_TRACE=1 -DSQLITE_DEBUG_OS_TRACE=1 @@ -900,7 +927,7 @@ LIBRESOBJS = # when the shell is not being dynamically linked. # !IF $(DYNAMIC_SHELL)==0 && $(FOR_WIN10)==0 -SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_SHELL_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_STMTVTAB !ENDIF @@ -927,7 +954,7 @@ Replace.exe: sqlite3.def: Replace.exe $(LIBOBJ) echo EXPORTS > sqlite3.def dumpbin /all $(LIBOBJ) \ - | .\Replace.exe "^\s+/EXPORT:_?(sqlite3_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \ + | .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \ | sort >> sqlite3.def $(SQLITE3EXE): $(TOP)\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H) Modified: stable/11/contrib/sqlite3/configure ============================================================================== --- stable/11/contrib/sqlite3/configure Sat Aug 12 22:13:06 2017 (r322443) +++ stable/11/contrib/sqlite3/configure Sat Aug 12 22:14:09 2017 (r322444) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.14.1. +# Generated by GNU Autoconf 2.69 for sqlite 3.20.0. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.14.1' -PACKAGE_STRING='sqlite 3.14.1' +PACKAGE_VERSION='3.20.0' +PACKAGE_STRING='sqlite 3.20.0' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1330,7 +1330,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.14.1 to adapt to many kinds of systems. +\`configure' configures sqlite 3.20.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1400,7 +1400,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.14.1:";; + short | recursive ) echo "Configuration of sqlite 3.20.0:";; esac cat <<\_ACEOF @@ -1521,7 +1521,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.14.1 +sqlite configure 3.20.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1936,7 +1936,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.14.1, which was +It was created by sqlite $as_me 3.20.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2802,7 +2802,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.14.1' + VERSION='3.20.0' cat >>confdefs.h <<_ACEOF @@ -13108,7 +13108,7 @@ for ac_lib in '' edit; do ac_res="none required" else ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" + LIBS="-l$ac_lib -ltinfo $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_readline=$ac_res @@ -13136,7 +13136,7 @@ if test "$ac_res" != no; then : $as_echo "#define HAVE_EDITLINE 1" >>confdefs.h - READLINE_LIBS=$LIBS + READLINE_LIBS="$LIBS -ltinfo" enable_readline=no fi @@ -14227,7 +14227,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.14.1, which was +This file was extended by sqlite $as_me 3.20.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14284,7 +14284,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.14.1 +sqlite config.status 3.20.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/11/contrib/sqlite3/configure.ac ============================================================================== --- stable/11/contrib/sqlite3/configure.ac Sat Aug 12 22:13:06 2017 (r322443) +++ stable/11/contrib/sqlite3/configure.ac Sat Aug 12 22:14:09 2017 (r322444) @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.14.1, http://www.sqlite.org) +AC_INIT(sqlite, 3.20.0, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) # Use automake. @@ -55,9 +55,9 @@ AS_IF([ test x"$enable_editline" != xno ],[ LIBS="" AC_SEARCH_LIBS([readline],[edit],[ AC_DEFINE([HAVE_EDITLINE],1,Define to use BSD editline) - READLINE_LIBS=$LIBS + READLINE_LIBS="$LIBS -ltinfo" enable_readline=no - ]) + ],[],[-ltinfo]) AS_UNSET(ac_cv_search_readline) LIBS=$sLIBS ]) Modified: stable/11/contrib/sqlite3/shell.c ============================================================================== --- stable/11/contrib/sqlite3/shell.c Sat Aug 12 22:13:06 2017 (r322443) +++ stable/11/contrib/sqlite3/shell.c Sat Aug 12 22:14:09 2017 (r322444) @@ -1,3 +1,21 @@ +/* DO NOT EDIT! +** This file is automatically generated by the script in the canonical +** SQLite source tree at tool/mkshellc.tcl. That script combines source +** code from various constituent source files of SQLite into this single +** "shell.c" file used to implement the SQLite command-line shell. +** +** Most of the code found below comes from the "src/shell.c.in" file in +** the canonical SQLite source tree. That main file contains "INCLUDE" +** lines that specify other files in the canonical source tree that are +** inserted to getnerate this complete program source file. +** +** The code from multiple files is combined into this single "shell.c" +** source file to help make the command-line program easier to compile. +** +** To modify this program, get a copy of the canonical SQLite source tree, +** edit the src/shell.c.in" and/or some of the other files that are included +** by "src/shell.c.in", then rerun the tool/mkshellc.tcl script. +*/ /* ** 2001 September 15 ** @@ -18,11 +36,25 @@ #endif /* -** If requested, include the SQLite compiler options file for MSVC. +** Warning pragmas copied from msvc.h in the core. */ -#if defined(INCLUDE_MSVC_H) -#include "msvc.h" -#endif +#if defined(_MSC_VER) +#pragma warning(disable : 4054) +#pragma warning(disable : 4055) +#pragma warning(disable : 4100) +#pragma warning(disable : 4127) +#pragma warning(disable : 4130) +#pragma warning(disable : 4152) +#pragma warning(disable : 4189) +#pragma warning(disable : 4206) +#pragma warning(disable : 4210) +#pragma warning(disable : 4232) +#pragma warning(disable : 4244) +#pragma warning(disable : 4305) +#pragma warning(disable : 4306) +#pragma warning(disable : 4702) +#pragma warning(disable : 4706) +#endif /* defined(_MSC_VER) */ /* ** No support for loadable extensions in VxWorks. @@ -143,6 +175,7 @@ extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR); extern char *sqlite3_win32_mbcs_to_utf8_v2(const char *, int); extern char *sqlite3_win32_utf8_to_mbcs_v2(const char *, int); +extern LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText); #endif /* On Windows, we normally run with output mode of TEXT so that \n characters @@ -426,7 +459,37 @@ static void SQLITE_CDECL iotracePrintf(const char *zFo } #endif +/* +** Output string zUtf to stream pOut as w characters. If w is negative, +** then right-justify the text. W is the width in UTF-8 characters, not +** in bytes. This is different from the %*.*s specification in printf +** since with %*.*s the width is measured in bytes, not characters. +*/ +static void utf8_width_print(FILE *pOut, int w, const char *zUtf){ + int i; + int n; + int aw = w<0 ? -w : w; + char zBuf[1000]; + if( aw>(int)sizeof(zBuf)/3 ) aw = (int)sizeof(zBuf)/3; + for(i=n=0; zUtf[i]; i++){ + if( (zUtf[i]&0xc0)!=0x80 ){ + n++; + if( n==aw ){ + do{ i++; }while( (zUtf[i]&0xc0)==0x80 ); + break; + } + } + } + if( n>=aw ){ + utf8_printf(pOut, "%.*s", i, zUtf); + }else if( w<0 ){ + utf8_printf(pOut, "%*s%s", aw-n, "", zUtf); + }else{ + utf8_printf(pOut, "%s%*s", zUtf, aw-n, ""); + } +} + /* ** Determines if a string is a number of not. */ @@ -455,28 +518,6 @@ static int isNumber(const char *z, int *realnum){ } /* -** A global char* and an SQL function to access its current value -** from within an SQL statement. This program used to use the -** sqlite_exec_printf() API to substitue a string into an SQL statement. -** The correct way to do this with sqlite3 is to use the bind API, but -** since the shell is built around the callback paradigm it would be a lot -** of work. Instead just use this hack, which is quite harmless. -*/ -static const char *zShellStatic = 0; -static void shellstaticFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - assert( 0==argc ); - assert( zShellStatic ); - UNUSED_PARAMETER(argc); - UNUSED_PARAMETER(argv); - sqlite3_result_text(context, zShellStatic, -1, SQLITE_STATIC); -} - - -/* ** Compute a string length that is limited to what can be stored in ** lower 30 bits of a 32-bit signed integer. */ @@ -487,6 +528,18 @@ static int strlen30(const char *z){ } /* +** Return the length of a string in characters. Multibyte UTF8 characters +** count as a single character. +*/ +static int strlenChar(const char *z){ + int n = 0; + while( *z ){ + if( (0xc0&*(z++))!=0x80 ) n++; + } + return n; +} + +/* ** This routine reads a line of text from FILE in, stores ** the text in memory obtained from malloc() and returns a pointer ** to the text. NULL is returned at end of file, or if malloc() @@ -524,7 +577,7 @@ static char *local_getline(char *zLine, FILE *in){ #if defined(_WIN32) || defined(WIN32) /* For interactive input on Windows systems, translate the ** multi-byte characterset characters into UTF-8. */ - if( stdin_is_interactive ){ + if( stdin_is_interactive && in==stdin ){ char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0); if( zTrans ){ int nTrans = strlen30(zTrans)+1; @@ -576,7 +629,1534 @@ static char *one_input_line(FILE *in, char *zPrior, in } return zResult; } +/* +** A variable length string to which one can append text. +*/ +typedef struct ShellText ShellText; +struct ShellText { + char *z; + int n; + int nAlloc; +}; +/* +** Initialize and destroy a ShellText object +*/ +static void initText(ShellText *p){ + memset(p, 0, sizeof(*p)); +} +static void freeText(ShellText *p){ + free(p->z); + initText(p); +} + +/* zIn is either a pointer to a NULL-terminated string in memory obtained +** from malloc(), or a NULL pointer. The string pointed to by zAppend is +** added to zIn, and the result returned in memory obtained from malloc(). +** zIn, if it was not NULL, is freed. +** +** If the third argument, quote, is not '\0', then it is used as a +** quote character for zAppend. +*/ +static void appendText(ShellText *p, char const *zAppend, char quote){ + int len; + int i; + int nAppend = strlen30(zAppend); + + len = nAppend+p->n+1; + if( quote ){ + len += 2; + for(i=0; in+len>=p->nAlloc ){ + p->nAlloc = p->nAlloc*2 + len + 20; + p->z = realloc(p->z, p->nAlloc); + if( p->z==0 ){ + memset(p, 0, sizeof(*p)); + return; + } + } + + if( quote ){ + char *zCsr = p->z+p->n; + *zCsr++ = quote; + for(i=0; in = (int)(zCsr - p->z); + *zCsr = '\0'; + }else{ + memcpy(p->z+p->n, zAppend, nAppend); + p->n += nAppend; + p->z[p->n] = '\0'; + } +} + +/* +** Attempt to determine if identifier zName needs to be quoted, either +** because it contains non-alphanumeric characters, or because it is an +** SQLite keyword. Be conservative in this estimate: When in doubt assume +** that quoting is required. +** +** Return '"' if quoting is required. Return 0 if no quoting is required. +*/ +static char quoteChar(const char *zName){ + /* All SQLite keywords, in alphabetical order */ + static const char *azKeywords[] = { + "ABORT", "ACTION", "ADD", "AFTER", "ALL", "ALTER", "ANALYZE", "AND", "AS", + "ASC", "ATTACH", "AUTOINCREMENT", "BEFORE", "BEGIN", "BETWEEN", "BY", + "CASCADE", "CASE", "CAST", "CHECK", "COLLATE", "COLUMN", "COMMIT", + "CONFLICT", "CONSTRAINT", "CREATE", "CROSS", "CURRENT_DATE", + "CURRENT_TIME", "CURRENT_TIMESTAMP", "DATABASE", "DEFAULT", "DEFERRABLE", + "DEFERRED", "DELETE", "DESC", "DETACH", "DISTINCT", "DROP", "EACH", + "ELSE", "END", "ESCAPE", "EXCEPT", "EXCLUSIVE", "EXISTS", "EXPLAIN", + "FAIL", "FOR", "FOREIGN", "FROM", "FULL", "GLOB", "GROUP", "HAVING", "IF", + "IGNORE", "IMMEDIATE", "IN", "INDEX", "INDEXED", "INITIALLY", "INNER", + "INSERT", "INSTEAD", "INTERSECT", "INTO", "IS", "ISNULL", "JOIN", "KEY", + "LEFT", "LIKE", "LIMIT", "MATCH", "NATURAL", "NO", "NOT", "NOTNULL", + "NULL", "OF", "OFFSET", "ON", "OR", "ORDER", "OUTER", "PLAN", "PRAGMA", + "PRIMARY", "QUERY", "RAISE", "RECURSIVE", "REFERENCES", "REGEXP", + "REINDEX", "RELEASE", "RENAME", "REPLACE", "RESTRICT", "RIGHT", + "ROLLBACK", "ROW", "SAVEPOINT", "SELECT", "SET", "TABLE", "TEMP", + "TEMPORARY", "THEN", "TO", "TRANSACTION", "TRIGGER", "UNION", "UNIQUE", + "UPDATE", "USING", "VACUUM", "VALUES", "VIEW", "VIRTUAL", "WHEN", "WHERE", + "WITH", "WITHOUT", + }; + int i, lwr, upr, mid, c; + if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"'; + for(i=0; zName[i]; i++){ + if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"'; + } + lwr = 0; + upr = sizeof(azKeywords)/sizeof(azKeywords[0]) - 1; + while( lwr<=upr ){ + mid = (lwr+upr)/2; + c = sqlite3_stricmp(azKeywords[mid], zName); + if( c==0 ) return '"'; + if( c<0 ){ + lwr = mid+1; + }else{ + upr = mid-1; + } + } + return 0; +} + +/* +** SQL function: shell_add_schema(S,X) +** +** Add the schema name X to the CREATE statement in S and return the result. +** Examples: +** +** CREATE TABLE t1(x) -> CREATE TABLE xyz.t1(x); +** +** Also works on +** +** CREATE INDEX +** CREATE UNIQUE INDEX +** CREATE VIEW +** CREATE TRIGGER +** CREATE VIRTUAL TABLE +** +** This UDF is used by the .schema command to insert the schema name of +** attached databases into the middle of the sqlite_master.sql field. +*/ +static void shellAddSchemaName( + sqlite3_context *pCtx, + int nVal, + sqlite3_value **apVal +){ + static const char *aPrefix[] = { + "TABLE", + "INDEX", + "UNIQUE INDEX", + "VIEW", + "TRIGGER", + "VIRTUAL TABLE" + }; + int i = 0; + const char *zIn = (const char*)sqlite3_value_text(apVal[0]); + const char *zSchema = (const char*)sqlite3_value_text(apVal[1]); + assert( nVal==2 ); + if( zIn!=0 && strncmp(zIn, "CREATE ", 7)==0 ){ + for(i=0; i<(int)(sizeof(aPrefix)/sizeof(aPrefix[0])); i++){ + int n = strlen30(aPrefix[i]); + if( strncmp(zIn+7, aPrefix[i], n)==0 && zIn[n+7]==' ' ){ + char cQuote = quoteChar(zSchema); + char *z; + if( cQuote ){ + z = sqlite3_mprintf("%.*s \"%w\".%s", n+7, zIn, zSchema, zIn+n+8); + }else{ + z = sqlite3_mprintf("%.*s %s.%s", n+7, zIn, zSchema, zIn+n+8); + } + sqlite3_result_text(pCtx, z, -1, sqlite3_free); + return; + } + } + } + sqlite3_result_value(pCtx, apVal[0]); +} + +/* +** The source code for several run-time loadable extensions is inserted +** below by the ../tool/mkshellc.tcl script. Before processing that included +** code, we need to override some macros to make the included program code +** work here in the middle of this regular program. +*/ +#define SQLITE_EXTENSION_INIT1 +#define SQLITE_EXTENSION_INIT2(X) (void)(X) + +/************************* Begin ../ext/misc/shathree.c ******************/ +/* +** 2017-03-08 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This SQLite extension implements a functions that compute SHA1 hashes. +** Two SQL functions are implemented: +** +** sha3(X,SIZE) +** sha3_query(Y,SIZE) +** +** The sha3(X) function computes the SHA3 hash of the input X, or NULL if +** X is NULL. +** +** The sha3_query(Y) function evalutes all queries in the SQL statements of Y +** and returns a hash of their results. +** +** The SIZE argument is optional. If omitted, the SHA3-256 hash algorithm +** is used. If SIZE is included it must be one of the integers 224, 256, +** 384, or 512, to determine SHA3 hash variant that is computed. +*/ +SQLITE_EXTENSION_INIT1 +#include +#include +#include +typedef sqlite3_uint64 u64; + +/****************************************************************************** +** The Hash Engine +*/ +/* +** Macros to determine whether the machine is big or little endian, +** and whether or not that determination is run-time or compile-time. +** +** For best performance, an attempt is made to guess at the byte-order +** using C-preprocessor macros. If that is unsuccessful, or if +** -DSHA3_BYTEORDER=0 is set, then byte-order is determined +** at run-time. +*/ +#ifndef SHA3_BYTEORDER +# if defined(i386) || defined(__i386__) || defined(_M_IX86) || \ + defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \ + defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \ + defined(__arm__) +# define SHA3_BYTEORDER 1234 +# elif defined(sparc) || defined(__ppc__) +# define SHA3_BYTEORDER 4321 +# else +# define SHA3_BYTEORDER 0 +# endif +#endif + + +/* +** State structure for a SHA3 hash in progress +*/ +typedef struct SHA3Context SHA3Context; +struct SHA3Context { + union { + u64 s[25]; /* Keccak state. 5x5 lines of 64 bits each */ + unsigned char x[1600]; /* ... or 1600 bytes */ + } u; + unsigned nRate; /* Bytes of input accepted per Keccak iteration */ + unsigned nLoaded; /* Input bytes loaded into u.x[] so far this cycle */ + unsigned ixMask; /* Insert next input into u.x[nLoaded^ixMask]. */ +}; + +/* +** A single step of the Keccak mixing function for a 1600-bit state +*/ +static void KeccakF1600Step(SHA3Context *p){ + int i; + u64 B0, B1, B2, B3, B4; + u64 C0, C1, C2, C3, C4; + u64 D0, D1, D2, D3, D4; + static const u64 RC[] = { + 0x0000000000000001ULL, 0x0000000000008082ULL, + 0x800000000000808aULL, 0x8000000080008000ULL, + 0x000000000000808bULL, 0x0000000080000001ULL, + 0x8000000080008081ULL, 0x8000000000008009ULL, + 0x000000000000008aULL, 0x0000000000000088ULL, + 0x0000000080008009ULL, 0x000000008000000aULL, + 0x000000008000808bULL, 0x800000000000008bULL, + 0x8000000000008089ULL, 0x8000000000008003ULL, + 0x8000000000008002ULL, 0x8000000000000080ULL, + 0x000000000000800aULL, 0x800000008000000aULL, + 0x8000000080008081ULL, 0x8000000000008080ULL, + 0x0000000080000001ULL, 0x8000000080008008ULL + }; +# define A00 (p->u.s[0]) +# define A01 (p->u.s[1]) +# define A02 (p->u.s[2]) +# define A03 (p->u.s[3]) +# define A04 (p->u.s[4]) +# define A10 (p->u.s[5]) +# define A11 (p->u.s[6]) +# define A12 (p->u.s[7]) +# define A13 (p->u.s[8]) +# define A14 (p->u.s[9]) +# define A20 (p->u.s[10]) +# define A21 (p->u.s[11]) +# define A22 (p->u.s[12]) +# define A23 (p->u.s[13]) +# define A24 (p->u.s[14]) +# define A30 (p->u.s[15]) +# define A31 (p->u.s[16]) +# define A32 (p->u.s[17]) +# define A33 (p->u.s[18]) +# define A34 (p->u.s[19]) +# define A40 (p->u.s[20]) +# define A41 (p->u.s[21]) +# define A42 (p->u.s[22]) +# define A43 (p->u.s[23]) +# define A44 (p->u.s[24]) +# define ROL64(a,x) ((a<>(64-x))) + + for(i=0; i<24; i+=4){ + C0 = A00^A10^A20^A30^A40; + C1 = A01^A11^A21^A31^A41; + C2 = A02^A12^A22^A32^A42; + C3 = A03^A13^A23^A33^A43; + C4 = A04^A14^A24^A34^A44; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A11^D1), 44); + B2 = ROL64((A22^D2), 43); + B3 = ROL64((A33^D3), 21); + B4 = ROL64((A44^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i]; + A11 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A20^D0), 3); + B3 = ROL64((A31^D1), 45); + B4 = ROL64((A42^D2), 61); + B0 = ROL64((A03^D3), 28); + B1 = ROL64((A14^D4), 20); + A20 = B0 ^((~B1)& B2 ); + A31 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A40^D0), 18); + B0 = ROL64((A01^D1), 1); + B1 = ROL64((A12^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A34^D4), 8); + A40 = B0 ^((~B1)& B2 ); + A01 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A10^D0), 36); + B2 = ROL64((A21^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A43^D3), 56); + B0 = ROL64((A04^D4), 27); + A10 = B0 ^((~B1)& B2 ); + A21 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A30^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A02^D2), 62); + B1 = ROL64((A13^D3), 55); + B2 = ROL64((A24^D4), 39); + A30 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + C0 = A00^A20^A40^A10^A30; + C1 = A11^A31^A01^A21^A41; + C2 = A22^A42^A12^A32^A02; + C3 = A33^A03^A23^A43^A13; + C4 = A44^A14^A34^A04^A24; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A31^D1), 44); + B2 = ROL64((A12^D2), 43); + B3 = ROL64((A43^D3), 21); + B4 = ROL64((A24^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i+1]; + A31 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A40^D0), 3); + B3 = ROL64((A21^D1), 45); + B4 = ROL64((A02^D2), 61); + B0 = ROL64((A33^D3), 28); + B1 = ROL64((A14^D4), 20); + A40 = B0 ^((~B1)& B2 ); + A21 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A30^D0), 18); + B0 = ROL64((A11^D1), 1); + B1 = ROL64((A42^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A04^D4), 8); + A30 = B0 ^((~B1)& B2 ); + A11 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A20^D0), 36); + B2 = ROL64((A01^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A13^D3), 56); + B0 = ROL64((A44^D4), 27); + A20 = B0 ^((~B1)& B2 ); + A01 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A10^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A22^D2), 62); + B1 = ROL64((A03^D3), 55); + B2 = ROL64((A34^D4), 39); + A10 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + C0 = A00^A40^A30^A20^A10; + C1 = A31^A21^A11^A01^A41; + C2 = A12^A02^A42^A32^A22; + C3 = A43^A33^A23^A13^A03; + C4 = A24^A14^A04^A44^A34; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A21^D1), 44); + B2 = ROL64((A42^D2), 43); + B3 = ROL64((A13^D3), 21); + B4 = ROL64((A34^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i+2]; + A21 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A30^D0), 3); + B3 = ROL64((A01^D1), 45); + B4 = ROL64((A22^D2), 61); + B0 = ROL64((A43^D3), 28); + B1 = ROL64((A14^D4), 20); + A30 = B0 ^((~B1)& B2 ); + A01 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A10^D0), 18); + B0 = ROL64((A31^D1), 1); + B1 = ROL64((A02^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A44^D4), 8); + A10 = B0 ^((~B1)& B2 ); + A31 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A40^D0), 36); + B2 = ROL64((A11^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A03^D3), 56); + B0 = ROL64((A24^D4), 27); + A40 = B0 ^((~B1)& B2 ); + A11 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A20^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A12^D2), 62); + B1 = ROL64((A33^D3), 55); + B2 = ROL64((A04^D4), 39); + A20 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + C0 = A00^A30^A10^A40^A20; + C1 = A21^A01^A31^A11^A41; + C2 = A42^A22^A02^A32^A12; + C3 = A13^A43^A23^A03^A33; + C4 = A34^A14^A44^A24^A04; + D0 = C4^ROL64(C1, 1); + D1 = C0^ROL64(C2, 1); + D2 = C1^ROL64(C3, 1); + D3 = C2^ROL64(C4, 1); + D4 = C3^ROL64(C0, 1); + + B0 = (A00^D0); + B1 = ROL64((A01^D1), 44); + B2 = ROL64((A02^D2), 43); + B3 = ROL64((A03^D3), 21); + B4 = ROL64((A04^D4), 14); + A00 = B0 ^((~B1)& B2 ); + A00 ^= RC[i+3]; + A01 = B1 ^((~B2)& B3 ); + A02 = B2 ^((~B3)& B4 ); + A03 = B3 ^((~B4)& B0 ); + A04 = B4 ^((~B0)& B1 ); + + B2 = ROL64((A10^D0), 3); + B3 = ROL64((A11^D1), 45); + B4 = ROL64((A12^D2), 61); + B0 = ROL64((A13^D3), 28); + B1 = ROL64((A14^D4), 20); + A10 = B0 ^((~B1)& B2 ); + A11 = B1 ^((~B2)& B3 ); + A12 = B2 ^((~B3)& B4 ); + A13 = B3 ^((~B4)& B0 ); + A14 = B4 ^((~B0)& B1 ); + + B4 = ROL64((A20^D0), 18); + B0 = ROL64((A21^D1), 1); + B1 = ROL64((A22^D2), 6); + B2 = ROL64((A23^D3), 25); + B3 = ROL64((A24^D4), 8); + A20 = B0 ^((~B1)& B2 ); + A21 = B1 ^((~B2)& B3 ); + A22 = B2 ^((~B3)& B4 ); + A23 = B3 ^((~B4)& B0 ); + A24 = B4 ^((~B0)& B1 ); + + B1 = ROL64((A30^D0), 36); + B2 = ROL64((A31^D1), 10); + B3 = ROL64((A32^D2), 15); + B4 = ROL64((A33^D3), 56); + B0 = ROL64((A34^D4), 27); + A30 = B0 ^((~B1)& B2 ); + A31 = B1 ^((~B2)& B3 ); + A32 = B2 ^((~B3)& B4 ); + A33 = B3 ^((~B4)& B0 ); + A34 = B4 ^((~B0)& B1 ); + + B3 = ROL64((A40^D0), 41); + B4 = ROL64((A41^D1), 2); + B0 = ROL64((A42^D2), 62); + B1 = ROL64((A43^D3), 55); + B2 = ROL64((A44^D4), 39); + A40 = B0 ^((~B1)& B2 ); + A41 = B1 ^((~B2)& B3 ); + A42 = B2 ^((~B3)& B4 ); + A43 = B3 ^((~B4)& B0 ); + A44 = B4 ^((~B0)& B1 ); + } +} + +/* +** Initialize a new hash. iSize determines the size of the hash +** in bits and should be one of 224, 256, 384, or 512. Or iSize +** can be zero to use the default hash size of 256 bits. +*/ +static void SHA3Init(SHA3Context *p, int iSize){ + memset(p, 0, sizeof(*p)); + if( iSize>=128 && iSize<=512 ){ + p->nRate = (1600 - ((iSize + 31)&~31)*2)/8; + }else{ + p->nRate = (1600 - 2*256)/8; + } +#if SHA3_BYTEORDER==1234 + /* Known to be little-endian at compile-time. No-op */ +#elif SHA3_BYTEORDER==4321 + p->ixMask = 7; /* Big-endian */ +#else + { + static unsigned int one = 1; + if( 1==*(unsigned char*)&one ){ + /* Little endian. No byte swapping. */ + p->ixMask = 0; + }else{ + /* Big endian. Byte swap. */ + p->ixMask = 7; + } + } +#endif +} + +/* +** Make consecutive calls to the SHA3Update function to add new content +** to the hash +*/ +static void SHA3Update( + SHA3Context *p, + const unsigned char *aData, + unsigned int nData +){ + unsigned int i = 0; +#if SHA3_BYTEORDER==1234 + if( (p->nLoaded % 8)==0 && ((aData - (const unsigned char*)0)&7)==0 ){ + for(; i+7u.s[p->nLoaded/8] ^= *(u64*)&aData[i]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Aug 12 22:20:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3614DCCA98; Sat, 12 Aug 2017 22:20:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 7320773ECF; Sat, 12 Aug 2017 22:20:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CMK8e1010296; Sat, 12 Aug 2017 22:20:08 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CMK8Md010295; Sat, 12 Aug 2017 22:20:08 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708122220.v7CMK8Md010295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 12 Aug 2017 22:20:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322445 - head/lib/ncurses/ncurses X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/ncurses/ncurses X-SVN-Commit-Revision: 322445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 22:20:09 -0000 Author: ngie Date: Sat Aug 12 22:20:08 2017 New Revision: 322445 URL: https://svnweb.freebsd.org/changeset/base/322445 Log: Hide `sccsid` under #if 0, per example in style(9) This fixes a -Wunused warning with gcc 6.3.0/7.0.0. MFC after: 1 week Modified: head/lib/ncurses/ncurses/termcap.c Modified: head/lib/ncurses/ncurses/termcap.c ============================================================================== --- head/lib/ncurses/ncurses/termcap.c Sat Aug 12 22:14:09 2017 (r322444) +++ head/lib/ncurses/ncurses/termcap.c Sat Aug 12 22:20:08 2017 (r322445) @@ -59,9 +59,11 @@ #include __FBSDID("$FreeBSD$"); +#if 0 #ifndef lint static const char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint */ +#endif #include #include From owner-svn-src-all@freebsd.org Sat Aug 12 23:40:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E4A0DD1F53; Sat, 12 Aug 2017 23:40:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 0B13D769B2; Sat, 12 Aug 2017 23:40:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CNe2o8042763; Sat, 12 Aug 2017 23:40:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CNe2HX042762; Sat, 12 Aug 2017 23:40:02 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201708122340.v7CNe2HX042762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 12 Aug 2017 23:40: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: r322446 - stable/11/lib/libxo/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/11/lib/libxo/tests X-SVN-Commit-Revision: 322446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages 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, 12 Aug 2017 23:40:03 -0000 Author: ngie Date: Sat Aug 12 23:40:01 2017 New Revision: 322446 URL: https://svnweb.freebsd.org/changeset/base/322446 Log: MFC r322023: Remove special-case logic for running tests on host machines I'm not sure what process sjg@ was using, but using CHECKDIR=${.OBJDIR} with "make check" on ^/head is the correct thing to do. This unbreaks "make check" for me (unsandboxed, not using CHECKDIR=${.OBJDIR}). While here, fix a whitespace nit with LIBADD. Modified: stable/11/lib/libxo/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libxo/tests/Makefile ============================================================================== --- stable/11/lib/libxo/tests/Makefile Sat Aug 12 22:20:08 2017 (r322445) +++ stable/11/lib/libxo/tests/Makefile Sat Aug 12 23:40:01 2017 (r322446) @@ -242,13 +242,8 @@ PROGS+= test_11 CFLAGS+= -I${LIBXOSRC}/libxo -I${.CURDIR:H} -LIBADD= xo util +LIBADD= xo util SUBDIR+= encoder - -.if ${MACHINE} == "host" -# make it easy to test without install -TESTSDIR= ${.OBJDIR} -.endif .include