From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 00:56:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E35CD4D3; Sun, 17 Mar 2013 00:56:17 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D4AC5A66; Sun, 17 Mar 2013 00:56:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2H0uHHO076322; Sun, 17 Mar 2013 00:56:17 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2H0uHDO076321; Sun, 17 Mar 2013 00:56:17 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201303170056.r2H0uHDO076321@svn.freebsd.org> From: Andrew Turner Date: Sun, 17 Mar 2013 00:56:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248400 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 00:56:18 -0000 Author: andrew Date: Sun Mar 17 00:56:17 2013 New Revision: 248400 URL: http://svnweb.freebsd.org/changeset/base/248400 Log: The -mno-apcs-frame argument is unavaliable on clang, also ignore it there. Modified: head/sys/conf/Makefile.arm Modified: head/sys/conf/Makefile.arm ============================================================================== --- head/sys/conf/Makefile.arm Sun Mar 17 00:11:44 2013 (r248399) +++ head/sys/conf/Makefile.arm Sun Mar 17 00:56:17 2013 (r248400) @@ -44,7 +44,7 @@ CFLAGS += -mno-thumb-interwork .endif .if empty(DDB_ENABLED) -.if !defined(WITH_ARM_EABI) +.if !defined(WITH_ARM_EABI) && ${COMPILER_TYPE} != "clang" CFLAGS += -mno-apcs-frame .endif .elif defined(WITH_ARM_EABI) From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 01:03:42 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6775291F; Sun, 17 Mar 2013 01:03:42 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 43EE1A9A; Sun, 17 Mar 2013 01:03:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2H13gQN079126; Sun, 17 Mar 2013 01:03:42 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2H13gPl079125; Sun, 17 Mar 2013 01:03:42 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201303170103.r2H13gPl079125@svn.freebsd.org> From: Andrew Turner Date: Sun, 17 Mar 2013 01:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248401 - head/gnu/lib/libgcc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 01:03:42 -0000 Author: andrew Date: Sun Mar 17 01:03:41 2013 New Revision: 248401 URL: http://svnweb.freebsd.org/changeset/base/248401 Log: Link libgcc_s against compiler-rt on ARM EABI. This allows us to use all of the symbols in compiler-rt, including the ones not available in the old libgcc. This fixes the build with clang which generates calls to funstions that are missing from libgcc_s. Modified: head/gnu/lib/libgcc/Makefile Modified: head/gnu/lib/libgcc/Makefile ============================================================================== --- head/gnu/lib/libgcc/Makefile Sun Mar 17 00:56:17 2013 (r248400) +++ head/gnu/lib/libgcc/Makefile Sun Mar 17 01:03:41 2013 (r248401) @@ -123,10 +123,10 @@ CFLAGS+= -fheinous-gnu-extensions LIB1ASMSRC = lib1funcs.asm LIB1ASMFUNCS = _dvmd_tls _bb_init_func .if ${MK_ARM_EABI} != "no" -LIB1ASMFUNCS+= _addsubdf3 _addsubsf3 _cmpdf2 _cmpsf2 _fixdfsi _fixsfsi \ - _fixunsdfsi _fixunsdfsi _muldivdf3 _muldivsf3 _udivsi3 - LIB2ADDEH = unwind-arm.c libunwind.S pr-support.c unwind-c.c +# Some compilers generate __aeabi_ functions libgcc_s is missing +DPADD+= ${LIBGCC} +LDADD+= -lgcc .else LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c .endif From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 03:04:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6ABD1F4B; Sun, 17 Mar 2013 03:04:44 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5CFBAE5C; Sun, 17 Mar 2013 03:04:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2H34iDH016882; Sun, 17 Mar 2013 03:04:44 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2H34hUu016878; Sun, 17 Mar 2013 03:04:43 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201303170304.r2H34hUu016878@svn.freebsd.org> From: Ian Lepore Date: Sun, 17 Mar 2013 03:04:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248407 - in head/sys/arm: broadcom/bcm2835 include ti ti/cpsw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 03:04:44 -0000 Author: ian Date: Sun Mar 17 03:04:43 2013 New Revision: 248407 URL: http://svnweb.freebsd.org/changeset/base/248407 Log: Add a macro that gets the physical address of a memory mapped device register from a bus space resource. Note that this macro is just for ARM, and is intended to have a short lifespan. The DMA engines in some SoCs need the physical address of a memory-mapped device register as one of the arguments for the transfer. Several scattered ad-hoc solutions have been converted to use this macro, which now also serves to mark the places where a more complete fix needs to be applied (after that fix has been designed). Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c head/sys/arm/include/bus.h head/sys/arm/ti/cpsw/if_cpsw.c head/sys/arm/ti/ti_mmchs.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Mar 17 01:54:35 2013 (r248406) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Mar 17 03:04:43 2013 (r248407) @@ -173,7 +173,6 @@ bcm_sdhci_attach(device_t dev) int default_freq; void *buffer; vm_paddr_t buffer_phys; - void *va; sc->sc_dev = dev; sc->sc_req = NULL; @@ -284,9 +283,8 @@ bcm_sdhci_attach(device_t dev) sc->sc_dma_buffer = buffer; sc->sc_dma_buffer_phys = buffer_phys; - va = (void*)rman_get_start(sc->sc_mem_res); - sc->sc_sdhci_buffer_phys = - pmap_kextract((vm_offset_t)va) + SDHCI_BUFFER; + sc->sc_sdhci_buffer_phys = BUS_SPACE_PHYSADDR(sc->sc_mem_res, + SDHCI_BUFFER); bus_generic_probe(dev); bus_generic_attach(dev); Modified: head/sys/arm/include/bus.h ============================================================================== --- head/sys/arm/include/bus.h Sun Mar 17 01:54:35 2013 (r248406) +++ head/sys/arm/include/bus.h Sun Mar 17 03:04:43 2013 (r248407) @@ -725,4 +725,12 @@ bs_c_8_proto(f); #include +/* + * Get the physical address of a bus space memory-mapped resource. + * Doing this as a macro is a temporary solution until a more robust fix is + * designed. It also serves to mark the locations needing that fix. + */ +#define BUS_SPACE_PHYSADDR(res, offs) \ + (vtophys(rman_get_start(res)+(offs))) + #endif /* _MACHINE_BUS_H_ */ Modified: head/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- head/sys/arm/ti/cpsw/if_cpsw.c Sun Mar 17 01:54:35 2013 (r248406) +++ head/sys/arm/ti/cpsw/if_cpsw.c Sun Mar 17 03:04:43 2013 (r248407) @@ -327,7 +327,7 @@ cpsw_debugf(const char *fmt, ...) #define cpsw_cpdma_bd_offset(i) (CPSW_CPPI_RAM_OFFSET + ((i)*16)) #define cpsw_cpdma_bd_paddr(sc, slot) \ - (slot->bd_offset + vtophys(rman_get_start(sc->res[0]))) + BUS_SPACE_PHYSADDR(sc->res[0], slot->bd_offset) #define cpsw_cpdma_read_bd(sc, slot, val) \ bus_read_region_4(sc->res[0], slot->bd_offset, (uint32_t *) val, 4) #define cpsw_cpdma_write_bd(sc, slot, val) \ Modified: head/sys/arm/ti/ti_mmchs.c ============================================================================== --- head/sys/arm/ti/ti_mmchs.c Sun Mar 17 01:54:35 2013 (r248406) +++ head/sys/arm/ti/ti_mmchs.c Sun Mar 17 03:04:43 2013 (r248407) @@ -1584,7 +1584,6 @@ static int ti_mmchs_activate(device_t dev) { struct ti_mmchs_softc *sc = device_get_softc(dev); - unsigned long addr; int rid; int err; @@ -1630,8 +1629,8 @@ ti_mmchs_activate(device_t dev) panic("Unknown OMAP device\n"); /* Get the physical address of the MMC data register, needed for DMA */ - addr = vtophys(rman_get_start(sc->sc_mem_res)); - sc->sc_data_reg_paddr = addr + sc->sc_reg_off + MMCHS_DATA; + sc->sc_data_reg_paddr = BUS_SPACE_PHYSADDR(sc->sc_mem_res, + sc->sc_reg_off + MMCHS_DATA); /* Set the initial power state to off */ sc->sc_cur_power_mode = power_off; From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 06:33:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2050EEBB; Sun, 17 Mar 2013 06:33:50 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 09494341; Sun, 17 Mar 2013 06:33:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2H6Xn8S079896; Sun, 17 Mar 2013 06:33:49 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2H6Xnj6079895; Sun, 17 Mar 2013 06:33:49 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201303170633.r2H6Xnj6079895@svn.freebsd.org> From: Andrew Turner Date: Sun, 17 Mar 2013 06:33:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248411 - head/sys/modules/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 06:33:50 -0000 Author: andrew Date: Sun Mar 17 06:33:49 2013 New Revision: 248411 URL: http://svnweb.freebsd.org/changeset/base/248411 Log: In the uart module build ofw_bus_if.h on arm along with sparc64 as LINT fails when built locally without it. Modified: head/sys/modules/uart/Makefile Modified: head/sys/modules/uart/Makefile ============================================================================== --- head/sys/modules/uart/Makefile Sun Mar 17 03:09:08 2013 (r248410) +++ head/sys/modules/uart/Makefile Sun Mar 17 06:33:49 2013 (r248411) @@ -4,6 +4,9 @@ .if ${MACHINE_CPUARCH} == "sparc64" uart_bus_ebus= uart_bus_ebus.c +.endif + +.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "sparc64" ofw_bus_if= ofw_bus_if.h .endif From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 06:36:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E4E22C1; Sun, 17 Mar 2013 06:36:04 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C1C7534B; Sun, 17 Mar 2013 06:36:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2H6a49w080243; Sun, 17 Mar 2013 06:36:04 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2H6a4fe080241; Sun, 17 Mar 2013 06:36:04 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201303170636.r2H6a4fe080241@svn.freebsd.org> From: Joel Dahl Date: Sun, 17 Mar 2013 06:36:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248412 - head/usr.bin/renice X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 06:36:05 -0000 Author: joel (doc committer) Date: Sun Mar 17 06:36:04 2013 New Revision: 248412 URL: http://svnweb.freebsd.org/changeset/base/248412 Log: Move example to EXAMPLES. Modified: head/usr.bin/renice/renice.8 Modified: head/usr.bin/renice/renice.8 ============================================================================== --- head/usr.bin/renice/renice.8 Sun Mar 17 06:33:49 2013 (r248411) +++ head/usr.bin/renice/renice.8 Sun Mar 17 06:36:04 2013 (r248412) @@ -85,13 +85,6 @@ Reset the interpretation to be (the default) process ID's. .El .Pp -For example, -.Pp -.Dl "renice +1 987 -u daemon root -p 32" -.Pp -would change the priority of process ID's 987 and 32, and -all processes owned by users daemon and root. -.Pp Users other than the super-user may only alter the priority of processes they own, and can only monotonically increase their ``nice value'' @@ -116,6 +109,11 @@ anything negative (to make things go ver .It Pa /etc/passwd to map user names to user ID's .El +.Sh EXAMPLES +Change the priority of process ID's 987 and 32, and +all processes owned by users daemon and root. +.Pp +.Dl "renice +1 987 -u daemon root -p 32" .Sh SEE ALSO .Xr nice 1 , .Xr rtprio 1 , From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 06:54:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4019E406; Sun, 17 Mar 2013 06:54:05 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BA5943CF; Sun, 17 Mar 2013 06:54:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2H6s4A9085714; Sun, 17 Mar 2013 06:54:04 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2H6s4pk085713; Sun, 17 Mar 2013 06:54:04 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201303170654.r2H6s4pk085713@svn.freebsd.org> From: Joel Dahl Date: Sun, 17 Mar 2013 06:54:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248413 - head/usr.sbin/ac X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 06:54:05 -0000 Author: joel (doc committer) Date: Sun Mar 17 06:54:04 2013 New Revision: 248413 URL: http://svnweb.freebsd.org/changeset/base/248413 Log: Move example to EXAMPLES. Modified: head/usr.sbin/ac/ac.8 Modified: head/usr.sbin/ac/ac.8 ============================================================================== --- head/usr.sbin/ac/ac.8 Sun Mar 17 06:36:04 2013 (r248412) +++ head/usr.sbin/ac/ac.8 Sun Mar 17 06:54:04 2013 (r248413) @@ -105,17 +105,6 @@ hand. No login or connect time accounting is performed if .Pa /var/log/utx.log does not exist. -.Pp -For example, -.Bd -literal -offset indent -ac -p -t "ttyd*" > modems -ac -p -t "!ttyd*" > other -.Ed -.Pp -allows times recorded in -.Pa modems -to be charged out at a different rate than -.Pa other . .Sh FILES .Bl -tag -width /var/log/utx.log -compact .It Pa /var/log/utx.log @@ -123,6 +112,15 @@ connect time accounting file .El .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Allow times recorded in +.Pa modems +to be charged out at a different rate than +.Pa other : +.Bd -literal -offset indent +ac -p -t "ttyd*" > modems +ac -p -t "!ttyd*" > other +.Ed .Sh SEE ALSO .Xr login 1 , .Xr getutxent 3 , From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 06:57:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4EBB7666; Sun, 17 Mar 2013 06:57:26 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3C6F93E7; Sun, 17 Mar 2013 06:57:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2H6vQiR086268; Sun, 17 Mar 2013 06:57:26 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2H6vPZE086266; Sun, 17 Mar 2013 06:57:25 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201303170657.r2H6vPZE086266@svn.freebsd.org> From: Joel Dahl Date: Sun, 17 Mar 2013 06:57:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248414 - in head/usr.bin: head tail X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 06:57:26 -0000 Author: joel (doc committer) Date: Sun Mar 17 06:57:25 2013 New Revision: 248414 URL: http://svnweb.freebsd.org/changeset/base/248414 Log: Remove EOL whitespace accidentally introduced in r248393. Modified: head/usr.bin/head/head.1 head/usr.bin/tail/tail.1 Modified: head/usr.bin/head/head.1 ============================================================================== --- head/usr.bin/head/head.1 Sun Mar 17 06:54:04 2013 (r248413) +++ head/usr.bin/head/head.1 Sun Mar 17 06:57:25 2013 (r248414) @@ -28,7 +28,7 @@ .\" @(#)head.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd March 16, 2013 +.Dd March 16, 2013 .Dt HEAD 1 .Os .Sh NAME Modified: head/usr.bin/tail/tail.1 ============================================================================== --- head/usr.bin/tail/tail.1 Sun Mar 17 06:54:04 2013 (r248413) +++ head/usr.bin/tail/tail.1 Sun Mar 17 06:57:25 2013 (r248414) @@ -31,7 +31,7 @@ .\" @(#)tail.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd March 16, 2013 +.Dd March 16, 2013 .Dt TAIL 1 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 07:28:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CDF9CAC4; Sun, 17 Mar 2013 07:28:18 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BF7CD676; Sun, 17 Mar 2013 07:28:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2H7SHPq095619; Sun, 17 Mar 2013 07:28:17 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2H7SHf4095618; Sun, 17 Mar 2013 07:28:17 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201303170728.r2H7SHf4095618@svn.freebsd.org> From: Rui Paulo Date: Sun, 17 Mar 2013 07:28:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248415 - head/sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 07:28:18 -0000 Author: rpaulo Date: Sun Mar 17 07:28:17 2013 New Revision: 248415 URL: http://svnweb.freebsd.org/changeset/base/248415 Log: Fix a typo in a comment. Modified: head/sys/dev/acpica/acpi_powerres.c Modified: head/sys/dev/acpica/acpi_powerres.c ============================================================================== --- head/sys/dev/acpica/acpi_powerres.c Sun Mar 17 06:57:25 2013 (r248414) +++ head/sys/dev/acpica/acpi_powerres.c Sun Mar 17 07:28:17 2013 (r248415) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); * resource, and only deactivate it when there are no powered devices. * * Note that this only manages resources for known devices. There is an - * ugly case where we may turn of power to a device which is in use because + * ugly case where we may turn off power to a device which is in use because * we don't know that it depends on a given resource. We should perhaps * try to be smarter about this, but a more complete solution would involve * scanning all of the ACPI namespace to find devices we're not currently From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 07:37:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EBA99D41; Sun, 17 Mar 2013 07:37:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D269C69D; Sun, 17 Mar 2013 07:37:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2H7bA1p098522; Sun, 17 Mar 2013 07:37:10 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2H7bABw098520; Sun, 17 Mar 2013 07:37:10 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201303170737.r2H7bABw098520@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 17 Mar 2013 07:37:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248416 - head/sys/netinet/libalias X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 07:37:11 -0000 Author: glebius Date: Sun Mar 17 07:37:10 2013 New Revision: 248416 URL: http://svnweb.freebsd.org/changeset/base/248416 Log: In m_megapullup() instead of reserving some space at the end of packet, m_align() it, reserving space to prepend data. Reviewed by: mav Modified: head/sys/netinet/libalias/alias.c Modified: head/sys/netinet/libalias/alias.c ============================================================================== --- head/sys/netinet/libalias/alias.c Sun Mar 17 07:28:17 2013 (r248415) +++ head/sys/netinet/libalias/alias.c Sun Mar 17 07:37:10 2013 (r248416) @@ -1749,26 +1749,22 @@ LibAliasUnLoadAllModule(void) struct mbuf * m_megapullup(struct mbuf *m, int len) { struct mbuf *mcl; - + if (len > m->m_pkthdr.len) goto bad; - - /* Do not reallocate packet if it is sequentional, - * writable and has some extra space for expansion. - * XXX: Constant 100bytes is completely empirical. */ -#define RESERVE 100 - if (m->m_next == NULL && M_WRITABLE(m) && M_TRAILINGSPACE(m) >= RESERVE) + + if (m->m_next == NULL && M_WRITABLE(m)) return (m); - mcl = m_get2(len + RESERVE, M_NOWAIT, MT_DATA, M_PKTHDR); + mcl = m_get2(len, M_NOWAIT, MT_DATA, M_PKTHDR); if (mcl == NULL) goto bad; - + m_align(mcl, len); m_move_pkthdr(mcl, m); m_copydata(m, 0, len, mtod(mcl, caddr_t)); mcl->m_len = mcl->m_pkthdr.len = len; m_freem(m); - + return (mcl); bad: m_freem(m); From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 07:39:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 04F82ECC; Sun, 17 Mar 2013 07:39:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DD9786AD; Sun, 17 Mar 2013 07:39:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2H7djc8098889; Sun, 17 Mar 2013 07:39:45 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2H7djP1098888; Sun, 17 Mar 2013 07:39:45 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201303170739.r2H7djP1098888@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 17 Mar 2013 07:39:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248417 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 07:39:46 -0000 Author: glebius Date: Sun Mar 17 07:39:45 2013 New Revision: 248417 URL: http://svnweb.freebsd.org/changeset/base/248417 Log: Add MEXT_ALIGN() macro, similar to M_ALIGN() and MH_ALIGN(), but for mbufs with external buffer. Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sun Mar 17 07:37:10 2013 (r248416) +++ head/sys/sys/mbuf.h Sun Mar 17 07:39:45 2013 (r248417) @@ -195,7 +195,7 @@ struct mbuf { #define M_FIRSTFRAG 0x00001000 /* packet is first fragment */ #define M_LASTFRAG 0x00002000 /* packet is last fragment */ #define M_SKIP_FIREWALL 0x00004000 /* skip firewall processing */ -#define M_FREELIST 0x00008000 /* mbuf is on the free list */ + /* 0x00008000 free */ #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ #define M_PROMISC 0x00020000 /* packet was not for us */ #define M_NOFREE 0x00040000 /* do not free mbuf, embedded in cluster */ @@ -708,6 +708,18 @@ m_last(struct mbuf *m) } while (0) /* + * As above, for mbuf with external storage. + */ +#define MEXT_ALIGN(m, len) do { \ + KASSERT((m)->m_flags & M_EXT, \ + ("%s: MEXT_ALIGN not an M_EXT mbuf", __func__)); \ + KASSERT((m)->m_data == (m)->m_ext.ext_buf, \ + ("%s: MEXT_ALIGN not a virgin mbuf", __func__)); \ + (m)->m_data += ((m)->m_ext.ext_size - (len)) & \ + ~(sizeof(long) - 1); \ +} while (0) + +/* * Compute the amount of space available before the current start of data in * an mbuf. * From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 07:41:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BA5D4D7; Sun, 17 Mar 2013 07:41:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A2D4D6B8; Sun, 17 Mar 2013 07:41:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2H7fEjk000813; Sun, 17 Mar 2013 07:41:14 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2H7fE18000812; Sun, 17 Mar 2013 07:41:14 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201303170741.r2H7fE18000812@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 17 Mar 2013 07:41:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248418 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 07:41:14 -0000 Author: glebius Date: Sun Mar 17 07:41:14 2013 New Revision: 248418 URL: http://svnweb.freebsd.org/changeset/base/248418 Log: In m_align() add assertions that mbuf is virgin, similar to assertions in M_ALIGN(), MH_ALIGN, MEXT_ALIGN() macros. Modified: head/sys/kern/uipc_mbuf.c Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Sun Mar 17 07:39:45 2013 (r248417) +++ head/sys/kern/uipc_mbuf.c Sun Mar 17 07:41:14 2013 (r248418) @@ -395,7 +395,7 @@ m_demote(struct mbuf *m0, int all) m_freem(m->m_nextpkt); m->m_nextpkt = NULL; } - m->m_flags = m->m_flags & (M_EXT|M_RDONLY|M_FREELIST|M_NOFREE); + m->m_flags = m->m_flags & (M_EXT|M_RDONLY|M_NOFREE); } } @@ -1877,14 +1877,22 @@ m_mbuftouio(struct uio *uio, struct mbuf void m_align(struct mbuf *m, int len) { +#ifdef INVARIANTS + const char *msg = "%s: not a virgin mbuf"; +#endif int adjust; - if (m->m_flags & M_EXT) + if (m->m_flags & M_EXT) { + KASSERT(m->m_data == m->m_ext.ext_buf, (msg, __func__)); adjust = m->m_ext.ext_size - len; - else if (m->m_flags & M_PKTHDR) + } else if (m->m_flags & M_PKTHDR) { + KASSERT(m->m_data == m->m_pktdat, (msg, __func__)); adjust = MHLEN - len; - else + } else { + KASSERT(m->m_data == m->m_dat, (msg, __func__)); adjust = MLEN - len; + } + m->m_data += adjust &~ (sizeof(long)-1); } From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 07:44:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 63EA9271; Sun, 17 Mar 2013 07:44:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id E6D796D6; Sun, 17 Mar 2013 07:44:16 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r2H7iFS5061846; Sun, 17 Mar 2013 11:44:15 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r2H7iFTE061845; Sun, 17 Mar 2013 11:44:15 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Sun, 17 Mar 2013 11:44:14 +0400 From: Gleb Smirnoff To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r248418 - head/sys/kern Message-ID: <20130317074414.GS48089@FreeBSD.org> References: <201303170741.r2H7fE18000812@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201303170741.r2H7fE18000812@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 07:44:17 -0000 In r248418 and r248417 another change from my tree leaked: - Removing M_FREELIST flag, that comes from historical mbuf allocator predating FreeBSD 5.x. On Sun, Mar 17, 2013 at 07:41:14AM +0000, Gleb Smirnoff wrote: T> Author: glebius T> Date: Sun Mar 17 07:41:14 2013 T> New Revision: 248418 T> URL: http://svnweb.freebsd.org/changeset/base/248418 T> T> Log: T> In m_align() add assertions that mbuf is virgin, similar to assertions T> in M_ALIGN(), MH_ALIGN, MEXT_ALIGN() macros. T> T> Modified: T> head/sys/kern/uipc_mbuf.c T> T> Modified: head/sys/kern/uipc_mbuf.c T> ============================================================================== T> --- head/sys/kern/uipc_mbuf.c Sun Mar 17 07:39:45 2013 (r248417) T> +++ head/sys/kern/uipc_mbuf.c Sun Mar 17 07:41:14 2013 (r248418) T> @@ -395,7 +395,7 @@ m_demote(struct mbuf *m0, int all) T> m_freem(m->m_nextpkt); T> m->m_nextpkt = NULL; T> } T> - m->m_flags = m->m_flags & (M_EXT|M_RDONLY|M_FREELIST|M_NOFREE); T> + m->m_flags = m->m_flags & (M_EXT|M_RDONLY|M_NOFREE); T> } T> } T> T> @@ -1877,14 +1877,22 @@ m_mbuftouio(struct uio *uio, struct mbuf T> void T> m_align(struct mbuf *m, int len) T> { T> +#ifdef INVARIANTS T> + const char *msg = "%s: not a virgin mbuf"; T> +#endif T> int adjust; T> T> - if (m->m_flags & M_EXT) T> + if (m->m_flags & M_EXT) { T> + KASSERT(m->m_data == m->m_ext.ext_buf, (msg, __func__)); T> adjust = m->m_ext.ext_size - len; T> - else if (m->m_flags & M_PKTHDR) T> + } else if (m->m_flags & M_PKTHDR) { T> + KASSERT(m->m_data == m->m_pktdat, (msg, __func__)); T> adjust = MHLEN - len; T> - else T> + } else { T> + KASSERT(m->m_data == m->m_dat, (msg, __func__)); T> adjust = MLEN - len; T> + } T> + T> m->m_data += adjust &~ (sizeof(long)-1); T> } T> -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 09:02:23 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4CF07623 for ; Sun, 17 Mar 2013 09:02:23 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 9FE64868 for ; Sun, 17 Mar 2013 09:02:22 +0000 (UTC) Received: (qmail 84498 invoked from network); 17 Mar 2013 10:13:57 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 17 Mar 2013 10:13:57 -0000 Message-ID: <51458691.4090107@freebsd.org> Date: Sun, 17 Mar 2013 10:02:09 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: Gleb Smirnoff Subject: Re: svn commit: r248417 - head/sys/sys References: <201303170739.r2H7djP1098888@svn.freebsd.org> In-Reply-To: <201303170739.r2H7djP1098888@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 09:02:23 -0000 On 17.03.2013 08:39, Gleb Smirnoff wrote: > Author: glebius > Date: Sun Mar 17 07:39:45 2013 > New Revision: 248417 > URL: http://svnweb.freebsd.org/changeset/base/248417 > > Log: > Add MEXT_ALIGN() macro, similar to M_ALIGN() and MH_ALIGN(), but for > mbufs with external buffer. While you are cleaning up the mbuf usage wouldn't it make sense to remove these macros, instead of adding new ones, and use m_align() which handles all these cases internally? IMHO we should not have the caller worry about the different types of mbuf's but to be able to apply a particular function which then does the right thing. This would remove a lot of duplicated code all over the tree again. While discussing m_align() it should be extended to do the inverse from aligning to the end as well. Many times mbufs have to have an offset from the start of the mbuf as well (ethernet). A negative len value could be used for that like in a_adj(). PS: It's really great you're doing this spring-cleaning. The mbuf area is littered with historic, complex and duplicate macros, functions and code. -- Andre > Modified: > head/sys/sys/mbuf.h > > Modified: head/sys/sys/mbuf.h > ============================================================================== > --- head/sys/sys/mbuf.h Sun Mar 17 07:37:10 2013 (r248416) > +++ head/sys/sys/mbuf.h Sun Mar 17 07:39:45 2013 (r248417) > @@ -195,7 +195,7 @@ struct mbuf { > #define M_FIRSTFRAG 0x00001000 /* packet is first fragment */ > #define M_LASTFRAG 0x00002000 /* packet is last fragment */ > #define M_SKIP_FIREWALL 0x00004000 /* skip firewall processing */ > -#define M_FREELIST 0x00008000 /* mbuf is on the free list */ > + /* 0x00008000 free */ > #define M_VLANTAG 0x00010000 /* ether_vtag is valid */ > #define M_PROMISC 0x00020000 /* packet was not for us */ > #define M_NOFREE 0x00040000 /* do not free mbuf, embedded in cluster */ > @@ -708,6 +708,18 @@ m_last(struct mbuf *m) > } while (0) > > /* > + * As above, for mbuf with external storage. > + */ > +#define MEXT_ALIGN(m, len) do { \ > + KASSERT((m)->m_flags & M_EXT, \ > + ("%s: MEXT_ALIGN not an M_EXT mbuf", __func__)); \ > + KASSERT((m)->m_data == (m)->m_ext.ext_buf, \ > + ("%s: MEXT_ALIGN not a virgin mbuf", __func__)); \ > + (m)->m_data += ((m)->m_ext.ext_size - (len)) & \ > + ~(sizeof(long) - 1); \ > +} while (0) > + > +/* > * Compute the amount of space available before the current start of data in > * an mbuf. > * > > From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 09:33:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 62A82E2F; Sun, 17 Mar 2013 09:33:48 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id C94D893B; Sun, 17 Mar 2013 09:33:47 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r2H9XdDr062104; Sun, 17 Mar 2013 13:33:39 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r2H9XdKu062103; Sun, 17 Mar 2013 13:33:39 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Sun, 17 Mar 2013 13:33:39 +0400 From: Gleb Smirnoff To: Andre Oppermann Subject: Re: svn commit: r248417 - head/sys/sys Message-ID: <20130317093339.GT48089@FreeBSD.org> References: <201303170739.r2H7djP1098888@svn.freebsd.org> <51458691.4090107@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <51458691.4090107@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 09:33:48 -0000 On Sun, Mar 17, 2013 at 10:02:09AM +0100, Andre Oppermann wrote: A> On 17.03.2013 08:39, Gleb Smirnoff wrote: A> > Author: glebius A> > Date: Sun Mar 17 07:39:45 2013 A> > New Revision: 248417 A> > URL: http://svnweb.freebsd.org/changeset/base/248417 A> > A> > Log: A> > Add MEXT_ALIGN() macro, similar to M_ALIGN() and MH_ALIGN(), but for A> > mbufs with external buffer. A> A> While you are cleaning up the mbuf usage wouldn't it make sense to remove A> these macros, instead of adding new ones, and use m_align() which handles A> all these cases internally? I'm thinking about this. Maybe it is worth to request tail alignment as a flag to the allocating function itself? -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 10:45:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 90FAF740 for ; Sun, 17 Mar 2013 10:45:46 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 01C27B0C for ; Sun, 17 Mar 2013 10:45:45 +0000 (UTC) Received: (qmail 84850 invoked from network); 17 Mar 2013 11:57:25 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 17 Mar 2013 11:57:25 -0000 Message-ID: <51459ED3.4040304@freebsd.org> Date: Sun, 17 Mar 2013 11:45:39 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: Gleb Smirnoff Subject: Re: svn commit: r248417 - head/sys/sys References: <201303170739.r2H7djP1098888@svn.freebsd.org> <51458691.4090107@freebsd.org> <20130317093339.GT48089@FreeBSD.org> In-Reply-To: <20130317093339.GT48089@FreeBSD.org> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 10:45:46 -0000 On 17.03.2013 10:33, Gleb Smirnoff wrote: > On Sun, Mar 17, 2013 at 10:02:09AM +0100, Andre Oppermann wrote: > A> On 17.03.2013 08:39, Gleb Smirnoff wrote: > A> > Author: glebius > A> > Date: Sun Mar 17 07:39:45 2013 > A> > New Revision: 248417 > A> > URL: http://svnweb.freebsd.org/changeset/base/248417 > A> > > A> > Log: > A> > Add MEXT_ALIGN() macro, similar to M_ALIGN() and MH_ALIGN(), but for > A> > mbufs with external buffer. > A> > A> While you are cleaning up the mbuf usage wouldn't it make sense to remove > A> these macros, instead of adding new ones, and use m_align() which handles > A> all these cases internally? > > I'm thinking about this. Maybe it is worth to request tail alignment as > a flag to the allocating function itself? IMHO that would overload the allocation function(s). The explicit step of doing m_align() for those who need it is fine and alerts the reader of what is going on. I'm all for simplification and unification, on the other hand it shouldn't be taken too far creating new complexity on the other side. -- Andre From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 15:11:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CC891CFE; Sun, 17 Mar 2013 15:11:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BEE8D6C5; Sun, 17 Mar 2013 15:11:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2HFBb3F041520; Sun, 17 Mar 2013 15:11:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2HFBbwT041516; Sun, 17 Mar 2013 15:11:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303171511.r2HFBbwT041516@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 17 Mar 2013 15:11:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248422 - in head/sys: fs/tmpfs ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 15:11:37 -0000 Author: kib Date: Sun Mar 17 15:11:37 2013 New Revision: 248422 URL: http://svnweb.freebsd.org/changeset/base/248422 Log: Remove negative name cache entry pointing to the target name, which could be instantiated while tdvp was unlocked. Reported by: Rick Miller Tested by: pho MFC after: 1 week Modified: head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Sun Mar 17 10:57:04 2013 (r248421) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Sun Mar 17 15:11:37 2013 (r248422) @@ -1297,6 +1297,7 @@ tmpfs_rename(struct vop_rename_args *v) cache_purge(fvp); if (tvp != NULL) cache_purge(tvp); + cache_purge_negative(tdvp); error = 0; Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Sun Mar 17 10:57:04 2013 (r248421) +++ head/sys/ufs/ufs/ufs_vnops.c Sun Mar 17 15:11:37 2013 (r248422) @@ -1554,6 +1554,7 @@ relock: cache_purge(fvp); if (tvp) cache_purge(tvp); + cache_purge_negative(tdvp); unlockout: vput(fdvp); From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 15:53:28 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DC795B12; Sun, 17 Mar 2013 15:53:28 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B7F227EF; Sun, 17 Mar 2013 15:53:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2HFrSxp054210; Sun, 17 Mar 2013 15:53:28 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2HFrSTV054209; Sun, 17 Mar 2013 15:53:28 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201303171553.r2HFrSTV054209@svn.freebsd.org> From: Martin Matuska Date: Sun, 17 Mar 2013 15:53:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248426 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 15:53:28 -0000 Author: mm Date: Sun Mar 17 15:53:27 2013 New Revision: 248426 URL: http://svnweb.freebsd.org/changeset/base/248426 Log: Fix typo in sysctl description Reported by: Jeremy Chadwick MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sun Mar 17 15:35:23 2013 (r248425) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sun Mar 17 15:53:27 2013 (r248426) @@ -271,7 +271,7 @@ uint64_t zfs_deadman_synctime = 1000ULL; TUNABLE_QUAD("vfs.zfs.deadman_synctime", &zfs_deadman_synctime); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime, CTLFLAG_RDTUN, &zfs_deadman_synctime, 0, - "Stalled ZFS I/O expiration time in units of vfs.zfs.txg_synctime_ms"); + "Stalled ZFS I/O expiration time in units of vfs.zfs.txg.synctime_ms"); /* * Default value of -1 for zfs_deadman_enabled is resolved in From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 16:31:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 56A9D8C0; Sun, 17 Mar 2013 16:31:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3A3658F8; Sun, 17 Mar 2013 16:31:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2HGVADX066303; Sun, 17 Mar 2013 16:31:10 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2HGVAFp066301; Sun, 17 Mar 2013 16:31:10 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201303171631.r2HGVAFp066301@svn.freebsd.org> From: Ian Lepore Date: Sun, 17 Mar 2013 16:31:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248430 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 16:31:10 -0000 Author: ian Date: Sun Mar 17 16:31:09 2013 New Revision: 248430 URL: http://svnweb.freebsd.org/changeset/base/248430 Log: Eliminate an intermediate buffer and some memcpy() operations, and do DMA directly to/from the buffers passed in from higher layer drivers. Reviewed by: gonzo Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Mar 17 16:23:19 2013 (r248429) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Mar 17 16:31:09 2013 (r248430) @@ -122,9 +122,7 @@ struct bcm_sdhci_softc { int sc_dma_ch; bus_dma_tag_t sc_dma_tag; bus_dmamap_t sc_dma_map; - void *sc_dma_buffer; - vm_paddr_t sc_dma_buffer_phys; - vm_paddr_t sc_sdhci_buffer_phys;; + vm_paddr_t sc_sdhci_buffer_phys; }; static int bcm_sdhci_probe(device_t); @@ -171,8 +169,6 @@ bcm_sdhci_attach(device_t dev) phandle_t node; pcell_t cell; int default_freq; - void *buffer; - vm_paddr_t buffer_phys; sc->sc_dev = dev; sc->sc_req = NULL; @@ -209,7 +205,7 @@ bcm_sdhci_attach(device_t dev) goto fail; } - if (bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + if (bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, NULL, bcm_sdhci_intr, sc, &sc->sc_intrhand)) { bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); @@ -242,7 +238,7 @@ bcm_sdhci_attach(device_t dev) bcm_dma_setup_intr(sc->sc_dma_ch, bcm_sdhci_dma_intr, sc); - /* Allocate DMA buffers */ + /* Allocate bus_dma resources. */ err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, @@ -255,34 +251,12 @@ bcm_sdhci_attach(device_t dev) goto fail; } - err = bus_dmamem_alloc(sc->sc_dma_tag, &buffer, - BUS_DMA_WAITOK | BUS_DMA_COHERENT| BUS_DMA_ZERO, - &sc->sc_dma_map); - - if (err) { - device_printf(dev, "cannot allocate DMA memory\n"); - goto fail; - } - - err = bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, buffer, - BCM_SDHCI_BUFFER_SIZE, bcm_dmamap_cb, &buffer_phys, - BUS_DMA_WAITOK); + err = bus_dmamap_create(sc->sc_dma_tag, 0, &sc->sc_dma_map); if (err) { - device_printf(dev, "cannot load DMA memory\n"); - goto fail; - } - - /* - * Sanity check: two least bits of address should be zero - */ - if ((uintptr_t)buffer & 3) { - device_printf(dev, - "DMA address is not word-aligned\n"); + device_printf(dev, "bus_dmamap_create failed\n"); goto fail; } - sc->sc_dma_buffer = buffer; - sc->sc_dma_buffer_phys = buffer_phys; sc->sc_sdhci_buffer_phys = BUS_SPACE_PHYSADDR(sc->sc_mem_res, SDHCI_BUFFER); @@ -445,27 +419,23 @@ bcm_sdhci_dma_intr(int ch, void *arg) struct bcm_sdhci_softc *sc = (struct bcm_sdhci_softc *)arg; struct sdhci_slot *slot = &sc->sc_slot; uint32_t reg, mask; - void *buffer; + bus_addr_t pmem; + vm_paddr_t pdst, psrc; size_t len; - int left; + int left, sync_op; mtx_lock(&slot->mtx); - /* copy DMA buffer to VA if READ */ len = bcm_dma_length(sc->sc_dma_ch); if (slot->curcmd->data->flags & MMC_DATA_READ) { - bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, - BUS_DMASYNC_POSTREAD); - + sync_op = BUS_DMASYNC_POSTREAD; mask = SDHCI_INT_DATA_AVAIL; - /* all dma data in single or contiguous page */ - buffer = (uint8_t*)(slot->curcmd->data->data) + slot->offset; - memcpy(buffer, sc->sc_dma_buffer, len); } else { - bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, - BUS_DMASYNC_POSTWRITE); + sync_op = BUS_DMASYNC_POSTWRITE; mask = SDHCI_INT_SPACE_AVAIL; } + bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); + bus_dmamap_unload(sc->sc_dma_tag, sc->sc_dma_map); slot->offset += len; sc->sc_dma_inuse = 0; @@ -499,27 +469,22 @@ bcm_sdhci_dma_intr(int ch, void *arg) SDHCI_INT_STATUS, mask); /* continue next DMA transfer */ + bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, + (uint8_t *)slot->curcmd->data->data + + slot->offset, left, bcm_dmamap_cb, &pmem, 0); if (slot->curcmd->data->flags & MMC_DATA_READ) { - bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, - BUS_DMASYNC_PREREAD); - - /* DMA start */ - if (bcm_dma_start(sc->sc_dma_ch, - sc->sc_sdhci_buffer_phys, - sc->sc_dma_buffer_phys, left) != 0) - device_printf(sc->sc_dev, "failed DMA start\n"); + psrc = sc->sc_sdhci_buffer_phys; + pdst = pmem; + sync_op = BUS_DMASYNC_PREREAD; } else { - buffer = (char*)slot->curcmd->data->data + slot->offset; - memcpy(sc->sc_dma_buffer, buffer, left); - - bus_dmamap_sync(sc->sc_dma_tag, - sc->sc_dma_map, BUS_DMASYNC_PREWRITE); - - /* DMA start */ - if (bcm_dma_start(sc->sc_dma_ch, - sc->sc_dma_buffer_phys, - sc->sc_sdhci_buffer_phys, left) != 0) - device_printf(sc->sc_dev, "failed DMA start\n"); + psrc = pmem; + pdst = sc->sc_sdhci_buffer_phys; + sync_op = BUS_DMASYNC_PREWRITE; + } + bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, sync_op); + if (bcm_dma_start(sc->sc_dma_ch, psrc, pdst, left)) { + /* XXX stop xfer, other error recovery? */ + device_printf(sc->sc_dev, "failed DMA start\n"); } } else { /* wait for next data by INT */ @@ -540,6 +505,7 @@ bcm_sdhci_read_dma(struct sdhci_slot *sl { struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); size_t left; + bus_addr_t paddr; if (sc->sc_dma_inuse) { device_printf(sc->sc_dev, "DMA in use\n"); @@ -560,12 +526,16 @@ bcm_sdhci_read_dma(struct sdhci_slot *sl BCM_DMA_INC_ADDR, (left & 0xf) ? BCM_DMA_32BIT : BCM_DMA_128BIT); + bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, + (uint8_t *)slot->curcmd->data->data + slot->offset, left, + bcm_dmamap_cb, &paddr, 0); + bus_dmamap_sync(sc->sc_dma_tag, sc->sc_dma_map, BUS_DMASYNC_PREREAD); /* DMA start */ if (bcm_dma_start(sc->sc_dma_ch, sc->sc_sdhci_buffer_phys, - sc->sc_dma_buffer_phys, left) != 0) + paddr, left) != 0) device_printf(sc->sc_dev, "failed DMA start\n"); } @@ -573,8 +543,8 @@ static void bcm_sdhci_write_dma(struct sdhci_slot *slot) { struct bcm_sdhci_softc *sc = device_get_softc(slot->bus); - char *buffer; size_t left; + bus_addr_t paddr; if (sc->sc_dma_inuse) { device_printf(sc->sc_dev, "DMA in use\n"); @@ -589,8 +559,9 @@ bcm_sdhci_write_dma(struct sdhci_slot *s KASSERT((left & 3) == 0, ("%s: len = %d, not word-aligned", __func__, left)); - buffer = (char*)slot->curcmd->data->data + slot->offset; - memcpy(sc->sc_dma_buffer, buffer, left); + bus_dmamap_load(sc->sc_dma_tag, sc->sc_dma_map, + (uint8_t *)slot->curcmd->data->data + slot->offset, left, + bcm_dmamap_cb, &paddr, 0); bcm_dma_setup_src(sc->sc_dma_ch, BCM_DMA_DREQ_NONE, BCM_DMA_INC_ADDR, @@ -602,7 +573,7 @@ bcm_sdhci_write_dma(struct sdhci_slot *s BUS_DMASYNC_PREWRITE); /* DMA start */ - if (bcm_dma_start(sc->sc_dma_ch, sc->sc_dma_buffer_phys, + if (bcm_dma_start(sc->sc_dma_ch, paddr, sc->sc_sdhci_buffer_phys, left) != 0) device_printf(sc->sc_dev, "failed DMA start\n"); } @@ -612,11 +583,16 @@ bcm_sdhci_will_handle_transfer(device_t { size_t left; - /* Do not use DMA for transfers less then block size */ + /* + * Do not use DMA for transfers less than block size or with a length + * that is not a multiple of four. + */ left = min(BCM_DMA_BLOCK_SIZE, slot->curcmd->data->len - slot->offset); if (left < BCM_DMA_BLOCK_SIZE) return (0); + if (left & 0x03) + return (0); return (1); } From owner-svn-src-head@FreeBSD.ORG Sun Mar 17 22:51:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3A70D972; Sun, 17 Mar 2013 22:51:59 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 147C07A1; Sun, 17 Mar 2013 22:51:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2HMpwjW085041; Sun, 17 Mar 2013 22:51:58 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2HMpw9U085037; Sun, 17 Mar 2013 22:51:58 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201303172251.r2HMpw9U085037@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 17 Mar 2013 22:51:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248446 - head/usr.bin/find X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 22:51:59 -0000 Author: jilles Date: Sun Mar 17 22:51:58 2013 New Revision: 248446 URL: http://svnweb.freebsd.org/changeset/base/248446 Log: find: Include nanoseconds when comparing timestamps of files. When comparing to the timestamp of a given file using -newer, -Xnewer and -newerXY (where X and Y are one of m, c, a, B), include nanoseconds in the comparison. The primaries that compare a timestamp of a file to a given value (-Xmin, -Xtime, -newerXt) continue to compare times in whole seconds. Note that the default value 0 of vfs.timestamp_precision almost always causes the nanoseconds part to be 0. However, touch -d can set a timestamp to the microsecond regardless of that sysctl. MFC after: 1 week Modified: head/usr.bin/find/find.h head/usr.bin/find/function.c Modified: head/usr.bin/find/find.h ============================================================================== --- head/usr.bin/find/find.h Sun Mar 17 22:24:08 2013 (r248445) +++ head/usr.bin/find/find.h Sun Mar 17 22:51:58 2013 (r248446) @@ -88,7 +88,7 @@ typedef struct _plandata { nlink_t _l_data; /* link count */ short _d_data; /* level depth (-1 to N) */ off_t _o_data; /* file size */ - time_t _t_data; /* time value */ + struct timespec _t_data; /* time value */ uid_t _u_data; /* uid */ short _mt_data; /* mount flags */ struct _plandata *_p_data[2]; /* PLAN trees */ Modified: head/usr.bin/find/function.c ============================================================================== --- head/usr.bin/find/function.c Sun Mar 17 22:24:08 2013 (r248445) +++ head/usr.bin/find/function.c Sun Mar 17 22:51:58 2013 (r248446) @@ -238,7 +238,7 @@ nextarg(OPTION *option, char ***argvp) */ #define TIME_CORRECT(p) \ if (((p)->flags & F_ELG_MASK) == F_LESSTHAN) \ - ++((p)->t_data); + ++((p)->t_data.tv_sec); /* * -[acm]min n functions -- @@ -255,16 +255,16 @@ f_Xmin(PLAN *plan, FTSENT *entry) { if (plan->flags & F_TIME_C) { COMPARE((now - entry->fts_statp->st_ctime + - 60 - 1) / 60, plan->t_data); + 60 - 1) / 60, plan->t_data.tv_sec); } else if (plan->flags & F_TIME_A) { COMPARE((now - entry->fts_statp->st_atime + - 60 - 1) / 60, plan->t_data); + 60 - 1) / 60, plan->t_data.tv_sec); } else if (plan->flags & F_TIME_B) { COMPARE((now - entry->fts_statp->st_birthtime + - 60 - 1) / 60, plan->t_data); + 60 - 1) / 60, plan->t_data.tv_sec); } else { COMPARE((now - entry->fts_statp->st_mtime + - 60 - 1) / 60, plan->t_data); + 60 - 1) / 60, plan->t_data.tv_sec); } } @@ -278,7 +278,8 @@ c_Xmin(OPTION *option, char ***argvp) ftsoptions &= ~FTS_NOSTAT; new = palloc(option); - new->t_data = find_parsenum(new, option->name, nmins, NULL); + new->t_data.tv_sec = find_parsenum(new, option->name, nmins, NULL); + new->t_data.tv_nsec = 0; TIME_CORRECT(new); return new; } @@ -309,9 +310,9 @@ f_Xtime(PLAN *plan, FTSENT *entry) xtime = entry->fts_statp->st_mtime; if (plan->flags & F_EXACTTIME) - COMPARE(now - xtime, plan->t_data); + COMPARE(now - xtime, plan->t_data.tv_sec); else - COMPARE((now - xtime + 86400 - 1) / 86400, plan->t_data); + COMPARE((now - xtime + 86400 - 1) / 86400, plan->t_data.tv_sec); } PLAN * @@ -324,7 +325,8 @@ c_Xtime(OPTION *option, char ***argvp) ftsoptions &= ~FTS_NOSTAT; new = palloc(option); - new->t_data = find_parsetime(new, option->name, value); + new->t_data.tv_sec = find_parsetime(new, option->name, value); + new->t_data.tv_nsec = 0; if (!(new->flags & F_EXACTTIME)) TIME_CORRECT(new); return new; @@ -1152,14 +1154,19 @@ c_name(OPTION *option, char ***argvp) int f_newer(PLAN *plan, FTSENT *entry) { + struct timespec ft; + if (plan->flags & F_TIME_C) - return entry->fts_statp->st_ctime > plan->t_data; + ft = entry->fts_statp->st_ctim; else if (plan->flags & F_TIME_A) - return entry->fts_statp->st_atime > plan->t_data; + ft = entry->fts_statp->st_atim; else if (plan->flags & F_TIME_B) - return entry->fts_statp->st_birthtime > plan->t_data; + ft = entry->fts_statp->st_birthtim; else - return entry->fts_statp->st_mtime > plan->t_data; + ft = entry->fts_statp->st_mtim; + return (ft.tv_sec > plan->t_data.tv_sec || + (ft.tv_sec == plan->t_data.tv_sec && + ft.tv_nsec > plan->t_data.tv_nsec)); } PLAN * @@ -1175,20 +1182,22 @@ c_newer(OPTION *option, char ***argvp) new = palloc(option); /* compare against what */ if (option->flags & F_TIME2_T) { - new->t_data = get_date(fn_or_tspec); - if (new->t_data == (time_t) -1) + new->t_data.tv_sec = get_date(fn_or_tspec); + if (new->t_data.tv_sec == (time_t) -1) errx(1, "Can't parse date/time: %s", fn_or_tspec); + /* Use the seconds only in the comparison. */ + new->t_data.tv_nsec = 999999999; } else { if (stat(fn_or_tspec, &sb)) err(1, "%s", fn_or_tspec); if (option->flags & F_TIME2_C) - new->t_data = sb.st_ctime; + new->t_data = sb.st_ctim; else if (option->flags & F_TIME2_A) - new->t_data = sb.st_atime; + new->t_data = sb.st_atim; else if (option->flags & F_TIME2_B) - new->t_data = sb.st_birthtime; + new->t_data = sb.st_birthtim; else - new->t_data = sb.st_mtime; + new->t_data = sb.st_mtim; } return new; } From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 00:25:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B188B4D7; Mon, 18 Mar 2013 00:25:04 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9DDBEAA3; Mon, 18 Mar 2013 00:25:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2I0P4Gn013555; Mon, 18 Mar 2013 00:25:04 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2I0P2ak013542; Mon, 18 Mar 2013 00:25:02 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303180025.r2I0P2ak013542@svn.freebsd.org> From: Attilio Rao Date: Mon, 18 Mar 2013 00:25:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248449 - in head/sys: amd64/amd64 amd64/include conf i386/i386 i386/include i386/xen vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 00:25:04 -0000 Author: attilio Date: Mon Mar 18 00:25:02 2013 New Revision: 248449 URL: http://svnweb.freebsd.org/changeset/base/248449 Log: Sync back vmcontention branch into HEAD: Replace the per-object resident and cached pages splay tree with a path-compressed multi-digit radix trie. Along with this, switch also the x86-specific handling of idle page tables to using the radix trie. This change is supposed to do the following: - Allowing the acquisition of read locking for lookup operations of the resident/cached pages collections as the per-vm_page_t splay iterators are now removed. - Increase the scalability of the operations on the page collections. The radix trie does rely on the consumers locking to ensure atomicity of its operations. In order to avoid deadlocks the bisection nodes are pre-allocated in the UMA zone. This can be done safely because the algorithm needs at maximum one new node per insert which means the maximum number of the desired nodes is the number of available physical frames themselves. However, not all the times a new bisection node is really needed. The radix trie implements path-compression because UFS indirect blocks can lead to several objects with a very sparse trie, increasing the number of levels to usually scan. It also helps in the nodes pre-fetching by introducing the single node per-insert property. This code is not generalized (yet) because of the possible loss of performance by having much of the sizes in play configurable. However, efforts to make this code more general and then reusable in further different consumers might be really done. The only KPI change is the removal of the function vm_page_splay() which is now reaped. The only KBI change, instead, is the removal of the left/right iterators from struct vm_page, which are now reaped. Further technical notes broken into mealpieces can be retrieved from the svn branch: http://svn.freebsd.org/base/user/attilio/vmcontention/ Sponsored by: EMC / Isilon storage division In collaboration with: alc, jeff Tested by: flo, pho, jhb, davide Tested by: ian (arm) Tested by: andreast (powerpc) Added: head/sys/vm/_vm_radix.h - copied unchanged from r248448, user/attilio/vmcontention/sys/vm/_vm_radix.h head/sys/vm/vm_radix.c - copied unchanged from r248448, user/attilio/vmcontention/sys/vm/vm_radix.c head/sys/vm/vm_radix.h - copied unchanged from r248448, user/attilio/vmcontention/sys/vm/vm_radix.h Modified: head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h head/sys/conf/files head/sys/i386/i386/pmap.c head/sys/i386/include/pmap.h head/sys/i386/xen/pmap.c head/sys/vm/vm_object.c head/sys/vm/vm_object.h head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_reserv.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sun Mar 17 23:53:06 2013 (r248448) +++ head/sys/amd64/amd64/pmap.c Mon Mar 18 00:25:02 2013 (r248449) @@ -131,6 +131,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1497,7 +1498,8 @@ pmap_free_zero_pages(vm_page_t free) while (free != NULL) { m = free; - free = m->right; + free = (void *)m->object; + m->object = NULL; /* Preserve the page's PG_ZERO setting. */ vm_page_free_toq(m); } @@ -1516,7 +1518,7 @@ pmap_add_delayed_free_list(vm_page_t m, m->flags |= PG_ZERO; else m->flags &= ~PG_ZERO; - m->right = *free; + m->object = (void *)*free; *free = m; } @@ -1526,31 +1528,12 @@ pmap_add_delayed_free_list(vm_page_t m, * for mapping a distinct range of virtual addresses. The pmap's collection is * ordered by this virtual address range. */ -static void +static __inline void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte) { - vm_page_t root; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - root = pmap->pm_root; - if (root == NULL) { - mpte->left = NULL; - mpte->right = NULL; - } else { - root = vm_page_splay(mpte->pindex, root); - if (mpte->pindex < root->pindex) { - mpte->left = root->left; - mpte->right = root; - root->left = NULL; - } else if (mpte->pindex == root->pindex) - panic("pmap_insert_pt_page: pindex already inserted"); - else { - mpte->right = root->right; - mpte->left = root; - root->right = NULL; - } - } - pmap->pm_root = mpte; + vm_radix_insert(&pmap->pm_root, mpte); } /* @@ -1558,19 +1541,12 @@ pmap_insert_pt_page(pmap_t pmap, vm_page * specified pmap's collection of idle page table pages. Returns NULL if there * is no page table page corresponding to the specified virtual address. */ -static vm_page_t +static __inline vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va) { - vm_page_t mpte; - vm_pindex_t pindex = pmap_pde_pindex(va); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if ((mpte = pmap->pm_root) != NULL && mpte->pindex != pindex) { - mpte = vm_page_splay(pindex, mpte); - if ((pmap->pm_root = mpte)->pindex != pindex) - mpte = NULL; - } - return (mpte); + return (vm_radix_lookup(&pmap->pm_root, pmap_pde_pindex(va))); } /* @@ -1578,25 +1554,12 @@ pmap_lookup_pt_page(pmap_t pmap, vm_offs * of idle page table pages. The specified page table page must be a member of * the pmap's collection. */ -static void +static __inline void pmap_remove_pt_page(pmap_t pmap, vm_page_t mpte) { - vm_page_t root; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if (mpte != pmap->pm_root) { - root = vm_page_splay(mpte->pindex, pmap->pm_root); - KASSERT(mpte == root, - ("pmap_remove_pt_page: mpte %p is missing from pmap %p", - mpte, pmap)); - } - if (mpte->left == NULL) - root = mpte->right; - else { - root = vm_page_splay(mpte->pindex, mpte->left); - root->right = mpte->right; - } - pmap->pm_root = root; + vm_radix_remove(&pmap->pm_root, mpte->pindex); } /* @@ -1693,7 +1656,7 @@ pmap_pinit0(pmap_t pmap) PMAP_LOCK_INIT(pmap); pmap->pm_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(KPML4phys); - pmap->pm_root = NULL; + pmap->pm_root.rt_root = 0; CPU_ZERO(&pmap->pm_active); PCPU_SET(curpmap, pmap); TAILQ_INIT(&pmap->pm_pvchunk); @@ -1734,7 +1697,7 @@ pmap_pinit(pmap_t pmap) /* install self-referential address mapping entry(s) */ pmap->pm_pml4[PML4PML4I] = VM_PAGE_TO_PHYS(pml4pg) | PG_V | PG_RW | PG_A | PG_M; - pmap->pm_root = NULL; + pmap->pm_root.rt_root = 0; CPU_ZERO(&pmap->pm_active); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); @@ -1976,7 +1939,7 @@ pmap_release(pmap_t pmap) KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); - KASSERT(pmap->pm_root == NULL, + KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_release: pmap has reserved page table page(s)")); m = PHYS_TO_VM_PAGE(pmap->pm_pml4[PML4PML4I] & PG_FRAME); @@ -2273,7 +2236,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, str } if (m_pc == NULL && free != NULL) { m_pc = free; - free = m_pc->right; + free = (void *)m_pc->object; /* Recycle a freed page table page. */ m_pc->wire_count = 1; atomic_add_int(&cnt.v_wire_count, 1); Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Sun Mar 17 23:53:06 2013 (r248448) +++ head/sys/amd64/include/pmap.h Mon Mar 18 00:25:02 2013 (r248449) @@ -150,6 +150,8 @@ #include #include +#include + typedef u_int64_t pd_entry_t; typedef u_int64_t pt_entry_t; typedef u_int64_t pdp_entry_t; @@ -250,7 +252,7 @@ struct pmap { cpuset_t pm_active; /* active on cpus */ /* spare u_int here due to padding */ struct pmap_statistics pm_stats; /* pmap statistics */ - vm_page_t pm_root; /* spare page table pages */ + struct vm_radix pm_root; /* spare page table pages */ }; typedef struct pmap *pmap_t; Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Mar 17 23:53:06 2013 (r248448) +++ head/sys/conf/files Mon Mar 18 00:25:02 2013 (r248449) @@ -3630,6 +3630,7 @@ vm/vm_page.c standard vm/vm_pageout.c standard vm/vm_pager.c standard vm/vm_phys.c standard +vm/vm_radix.c standard vm/vm_reserv.c standard vm/vm_unix.c standard vm/vm_zeroidle.c standard Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sun Mar 17 23:53:06 2013 (r248448) +++ head/sys/i386/i386/pmap.c Mon Mar 18 00:25:02 2013 (r248449) @@ -133,6 +133,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1573,7 +1574,8 @@ pmap_free_zero_pages(vm_page_t free) while (free != NULL) { m = free; - free = m->right; + free = (void *)m->object; + m->object = NULL; /* Preserve the page's PG_ZERO setting. */ vm_page_free_toq(m); } @@ -1592,7 +1594,7 @@ pmap_add_delayed_free_list(vm_page_t m, m->flags |= PG_ZERO; else m->flags &= ~PG_ZERO; - m->right = *free; + m->object = (void *)*free; *free = m; } @@ -1602,31 +1604,12 @@ pmap_add_delayed_free_list(vm_page_t m, * for mapping a distinct range of virtual addresses. The pmap's collection is * ordered by this virtual address range. */ -static void +static __inline void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte) { - vm_page_t root; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - root = pmap->pm_root; - if (root == NULL) { - mpte->left = NULL; - mpte->right = NULL; - } else { - root = vm_page_splay(mpte->pindex, root); - if (mpte->pindex < root->pindex) { - mpte->left = root->left; - mpte->right = root; - root->left = NULL; - } else if (mpte->pindex == root->pindex) - panic("pmap_insert_pt_page: pindex already inserted"); - else { - mpte->right = root->right; - mpte->left = root; - root->right = NULL; - } - } - pmap->pm_root = mpte; + vm_radix_insert(&pmap->pm_root, mpte); } /* @@ -1634,19 +1617,12 @@ pmap_insert_pt_page(pmap_t pmap, vm_page * specified pmap's collection of idle page table pages. Returns NULL if there * is no page table page corresponding to the specified virtual address. */ -static vm_page_t +static __inline vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va) { - vm_page_t mpte; - vm_pindex_t pindex = va >> PDRSHIFT; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if ((mpte = pmap->pm_root) != NULL && mpte->pindex != pindex) { - mpte = vm_page_splay(pindex, mpte); - if ((pmap->pm_root = mpte)->pindex != pindex) - mpte = NULL; - } - return (mpte); + return (vm_radix_lookup(&pmap->pm_root, va >> PDRSHIFT)); } /* @@ -1654,21 +1630,12 @@ pmap_lookup_pt_page(pmap_t pmap, vm_offs * of idle page table pages. The specified page table page must be a member of * the pmap's collection. */ -static void +static __inline void pmap_remove_pt_page(pmap_t pmap, vm_page_t mpte) { - vm_page_t root; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if (mpte != pmap->pm_root) - vm_page_splay(mpte->pindex, pmap->pm_root); - if (mpte->left == NULL) - root = mpte->right; - else { - root = vm_page_splay(mpte->pindex, mpte->left); - root->right = mpte->right; - } - pmap->pm_root = root; + vm_radix_remove(&pmap->pm_root, mpte->pindex); } /* @@ -1755,7 +1722,7 @@ pmap_pinit0(pmap_t pmap) #ifdef PAE pmap->pm_pdpt = (pdpt_entry_t *)(KERNBASE + (vm_offset_t)IdlePDPT); #endif - pmap->pm_root = NULL; + pmap->pm_root.rt_root = 0; CPU_ZERO(&pmap->pm_active); PCPU_SET(curpmap, pmap); TAILQ_INIT(&pmap->pm_pvchunk); @@ -1794,9 +1761,9 @@ pmap_pinit(pmap_t pmap) KASSERT(pmap_kextract((vm_offset_t)pmap->pm_pdpt) < (4ULL<<30), ("pmap_pinit: pdpt above 4g")); #endif - pmap->pm_root = NULL; + pmap->pm_root.rt_root = 0; } - KASSERT(pmap->pm_root == NULL, + KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_pinit: pmap has reserved page table page(s)")); /* @@ -2060,7 +2027,7 @@ pmap_release(pmap_t pmap) KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); - KASSERT(pmap->pm_root == NULL, + KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_release: pmap has reserved page table page(s)")); pmap_lazyfix(pmap); @@ -2343,7 +2310,7 @@ out: } if (m_pc == NULL && pv_vafree != 0 && free != NULL) { m_pc = free; - free = m_pc->right; + free = (void *)m_pc->object; /* Recycle a freed page table page. */ m_pc->wire_count = 1; atomic_add_int(&cnt.v_wire_count, 1); Modified: head/sys/i386/include/pmap.h ============================================================================== --- head/sys/i386/include/pmap.h Sun Mar 17 23:53:06 2013 (r248448) +++ head/sys/i386/include/pmap.h Mon Mar 18 00:25:02 2013 (r248449) @@ -159,6 +159,8 @@ #include #include +#include + #ifdef PAE typedef uint64_t pdpt_entry_t; @@ -441,7 +443,7 @@ struct pmap { pdpt_entry_t *pm_pdpt; /* KVA of page director pointer table */ #endif - vm_page_t pm_root; /* spare page table pages */ + struct vm_radix pm_root; /* spare page table pages */ }; typedef struct pmap *pmap_t; Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Sun Mar 17 23:53:06 2013 (r248448) +++ head/sys/i386/xen/pmap.c Mon Mar 18 00:25:02 2013 (r248449) @@ -1335,7 +1335,8 @@ pmap_free_zero_pages(vm_page_t free) while (free != NULL) { m = free; - free = m->right; + free = (void *)m->object; + m->object = NULL; vm_page_free_zero(m); } } @@ -1393,7 +1394,7 @@ _pmap_unwire_ptp(pmap_t pmap, vm_page_t * Put page on a list so that it is released after * *ALL* TLB shootdown is done */ - m->right = *free; + m->object = (void *)*free; *free = m; } @@ -2090,7 +2091,7 @@ out: } if (m_pc == NULL && pv_vafree != 0 && free != NULL) { m_pc = free; - free = m_pc->right; + free = (void *)m_pc->object; /* Recycle a freed page table page. */ m_pc->wire_count = 1; atomic_add_int(&cnt.v_wire_count, 1); Copied: head/sys/vm/_vm_radix.h (from r248448, user/attilio/vmcontention/sys/vm/_vm_radix.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/vm/_vm_radix.h Mon Mar 18 00:25:02 2013 (r248449, copy of r248448, user/attilio/vmcontention/sys/vm/_vm_radix.h) @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2013 EMC Corp. + * Copyright (c) 2011 Jeffrey Roberson + * Copyright (c) 2008 Mayur Shardul + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __VM_RADIX_H_ +#define __VM_RADIX_H_ + +/* + * Radix tree root. + */ +struct vm_radix { + uintptr_t rt_root; +}; + +#ifdef _KERNEL + +static __inline boolean_t +vm_radix_is_empty(struct vm_radix *rtree) +{ + + return (rtree->rt_root == 0); +} + +#endif /* _KERNEL */ +#endif /* !__VM_RADIX_H_ */ Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Sun Mar 17 23:53:06 2013 (r248448) +++ head/sys/vm/vm_object.c Mon Mar 18 00:25:02 2013 (r248449) @@ -94,6 +94,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -167,8 +168,8 @@ vm_object_zdtor(void *mem, int size, voi object = (vm_object_t)mem; KASSERT(TAILQ_EMPTY(&object->memq), ("object %p has resident pages in its memq", object)); - KASSERT(object->root == NULL, - ("object %p has resident pages in its tree", object)); + KASSERT(vm_radix_is_empty(&object->rtree), + ("object %p has resident pages in its trie", object)); #if VM_NRESERVLEVEL > 0 KASSERT(LIST_EMPTY(&object->rvq), ("object %p has reservations", @@ -199,11 +200,11 @@ vm_object_zinit(void *mem, int size, int rw_init_flags(&object->lock, "vm object", RW_DUPOK); /* These are true for any object that has been freed */ - object->root = NULL; + object->rtree.rt_root = 0; object->paging_in_progress = 0; object->resident_page_count = 0; object->shadow_count = 0; - object->cache = NULL; + object->cache.rt_root = 0; return (0); } @@ -295,6 +296,8 @@ vm_object_init(void) NULL, #endif vm_object_zinit, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM|UMA_ZONE_NOFREE); + + vm_radix_init(); } void @@ -742,7 +745,7 @@ vm_object_terminate(vm_object_t object) * modified by the preceding loop. */ if (object->resident_page_count != 0) { - object->root = NULL; + vm_radix_reclaim_allnodes(&object->rtree); TAILQ_INIT(&object->memq); object->resident_page_count = 0; if (object->type == OBJT_VNODE) Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Sun Mar 17 23:53:06 2013 (r248448) +++ head/sys/vm/vm_object.h Mon Mar 18 00:25:02 2013 (r248449) @@ -72,6 +72,8 @@ #include #include +#include + /* * Types defined: * @@ -79,10 +81,10 @@ * * The root of cached pages pool is protected by both the per-object lock * and the free pages queue mutex. - * On insert in the cache splay tree, the per-object lock is expected + * On insert in the cache radix trie, the per-object lock is expected * to be already held and the free pages queue mutex will be * acquired during the operation too. - * On remove and lookup from the cache splay tree, only the free + * On remove and lookup from the cache radix trie, only the free * pages queue mutex is expected to be locked. * These rules allow for reliably checking for the presence of cached * pages with only the per-object lock held, thereby reducing contention @@ -101,7 +103,7 @@ struct vm_object { LIST_HEAD(, vm_object) shadow_head; /* objects that this is a shadow for */ LIST_ENTRY(vm_object) shadow_list; /* chain of shadow objects */ TAILQ_HEAD(, vm_page) memq; /* list of resident pages */ - vm_page_t root; /* root of the resident page splay tree */ + struct vm_radix rtree; /* root of the resident page radix trie*/ vm_pindex_t size; /* Object size */ int generation; /* generation ID */ int ref_count; /* How many refs?? */ @@ -116,7 +118,7 @@ struct vm_object { vm_ooffset_t backing_object_offset;/* Offset in backing object */ TAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */ LIST_HEAD(, vm_reserv) rvq; /* list of reservations */ - vm_page_t cache; /* (o + f) root of the cache page splay tree */ + struct vm_radix cache; /* (o + f) root of the cache page radix trie */ void *handle; union { /* @@ -246,7 +248,7 @@ static __inline boolean_t vm_object_cache_is_empty(vm_object_t object) { - return (object->cache == NULL); + return (vm_radix_is_empty(&object->cache)); } vm_object_t vm_object_allocate (objtype_t, vm_pindex_t); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Mar 17 23:53:06 2013 (r248448) +++ head/sys/vm/vm_page.c Mon Mar 18 00:25:02 2013 (r248449) @@ -110,6 +110,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -794,63 +795,6 @@ vm_page_dirty_KBI(vm_page_t m) } /* - * vm_page_splay: - * - * Implements Sleator and Tarjan's top-down splay algorithm. Returns - * the vm_page containing the given pindex. If, however, that - * pindex is not found in the vm_object, returns a vm_page that is - * adjacent to the pindex, coming before or after it. - */ -vm_page_t -vm_page_splay(vm_pindex_t pindex, vm_page_t root) -{ - struct vm_page dummy; - vm_page_t lefttreemax, righttreemin, y; - - if (root == NULL) - return (root); - lefttreemax = righttreemin = &dummy; - for (;; root = y) { - if (pindex < root->pindex) { - if ((y = root->left) == NULL) - break; - if (pindex < y->pindex) { - /* Rotate right. */ - root->left = y->right; - y->right = root; - root = y; - if ((y = root->left) == NULL) - break; - } - /* Link into the new root's right tree. */ - righttreemin->left = root; - righttreemin = root; - } else if (pindex > root->pindex) { - if ((y = root->right) == NULL) - break; - if (pindex > y->pindex) { - /* Rotate left. */ - root->right = y->left; - y->left = root; - root = y; - if ((y = root->right) == NULL) - break; - } - /* Link into the new root's left tree. */ - lefttreemax->right = root; - lefttreemax = root; - } else - break; - } - /* Assemble the new root. */ - lefttreemax->right = root->left; - righttreemin->left = root->right; - root->left = dummy.right; - root->right = dummy.left; - return (root); -} - -/* * vm_page_insert: [ internal use only ] * * Inserts the given mem entry into the object and object list. @@ -865,7 +809,7 @@ vm_page_splay(vm_pindex_t pindex, vm_pag void vm_page_insert(vm_page_t m, vm_object_t object, vm_pindex_t pindex) { - vm_page_t root; + vm_page_t neighbor; VM_OBJECT_ASSERT_WLOCKED(object); if (m->object != NULL) @@ -880,28 +824,19 @@ vm_page_insert(vm_page_t m, vm_object_t /* * Now link into the object's ordered list of backed pages. */ - root = object->root; - if (root == NULL) { - m->left = NULL; - m->right = NULL; + if (object->resident_page_count == 0) { TAILQ_INSERT_TAIL(&object->memq, m, listq); } else { - root = vm_page_splay(pindex, root); - if (pindex < root->pindex) { - m->left = root->left; - m->right = root; - root->left = NULL; - TAILQ_INSERT_BEFORE(root, m, listq); - } else if (pindex == root->pindex) - panic("vm_page_insert: offset already allocated"); - else { - m->right = root->right; - m->left = root; - root->right = NULL; - TAILQ_INSERT_AFTER(&object->memq, root, m, listq); - } + neighbor = vm_radix_lookup_le(&object->rtree, pindex); + if (neighbor != NULL) { + KASSERT(pindex > neighbor->pindex, + ("vm_page_insert: offset %ju less than %ju", + (uintmax_t)pindex, (uintmax_t)neighbor->pindex)); + TAILQ_INSERT_AFTER(&object->memq, neighbor, m, listq); + } else + TAILQ_INSERT_HEAD(&object->memq, m, listq); } - object->root = m; + vm_radix_insert(&object->rtree, m); /* * Show that the object has one more resident page. @@ -937,7 +872,6 @@ void vm_page_remove(vm_page_t m) { vm_object_t object; - vm_page_t next, prev, root; if ((m->oflags & VPO_UNMANAGED) == 0) vm_page_lock_assert(m, MA_OWNED); @@ -952,42 +886,7 @@ vm_page_remove(vm_page_t m) /* * Now remove from the object's list of backed pages. */ - if ((next = TAILQ_NEXT(m, listq)) != NULL && next->left == m) { - /* - * Since the page's successor in the list is also its parent - * in the tree, its right subtree must be empty. - */ - next->left = m->left; - KASSERT(m->right == NULL, - ("vm_page_remove: page %p has right child", m)); - } else if ((prev = TAILQ_PREV(m, pglist, listq)) != NULL && - prev->right == m) { - /* - * Since the page's predecessor in the list is also its parent - * in the tree, its left subtree must be empty. - */ - KASSERT(m->left == NULL, - ("vm_page_remove: page %p has left child", m)); - prev->right = m->right; - } else { - if (m != object->root) - vm_page_splay(m->pindex, object->root); - if (m->left == NULL) - root = m->right; - else if (m->right == NULL) - root = m->left; - else { - /* - * Move the page's successor to the root, because - * pages are usually removed in ascending order. - */ - if (m->right != next) - vm_page_splay(m->pindex, m->right); - next->left = m->left; - root = next; - } - object->root = root; - } + vm_radix_remove(&object->rtree, m->pindex); TAILQ_REMOVE(&object->memq, m, listq); /* @@ -1015,15 +914,9 @@ vm_page_remove(vm_page_t m) vm_page_t vm_page_lookup(vm_object_t object, vm_pindex_t pindex) { - vm_page_t m; VM_OBJECT_ASSERT_WLOCKED(object); - if ((m = object->root) != NULL && m->pindex != pindex) { - m = vm_page_splay(pindex, m); - if ((object->root = m)->pindex != pindex) - m = NULL; - } - return (m); + return (vm_radix_lookup(&object->rtree, pindex)); } /* @@ -1040,13 +933,8 @@ vm_page_find_least(vm_object_t object, v vm_page_t m; VM_OBJECT_ASSERT_WLOCKED(object); - if ((m = TAILQ_FIRST(&object->memq)) != NULL) { - if (m->pindex < pindex) { - m = vm_page_splay(pindex, object->root); - if ((object->root = m)->pindex < pindex) - m = TAILQ_NEXT(m, listq); - } - } + if ((m = TAILQ_FIRST(&object->memq)) != NULL && m->pindex < pindex) + m = vm_radix_lookup_ge(&object->rtree, pindex); return (m); } @@ -1126,45 +1014,18 @@ vm_page_rename(vm_page_t m, vm_object_t void vm_page_cache_free(vm_object_t object, vm_pindex_t start, vm_pindex_t end) { - vm_page_t m, m_next; + vm_page_t m; boolean_t empty; mtx_lock(&vm_page_queue_free_mtx); - if (__predict_false(vm_object_cache_is_empty(object))) { + if (__predict_false(vm_radix_is_empty(&object->cache))) { mtx_unlock(&vm_page_queue_free_mtx); return; } - m = object->cache = vm_page_splay(start, object->cache); - if (m->pindex < start) { - if (m->right == NULL) - m = NULL; - else { - m_next = vm_page_splay(start, m->right); - m_next->left = m; - m->right = NULL; - m = object->cache = m_next; - } - } - - /* - * At this point, "m" is either (1) a reference to the page - * with the least pindex that is greater than or equal to - * "start" or (2) NULL. - */ - for (; m != NULL && (m->pindex < end || end == 0); m = m_next) { - /* - * Find "m"'s successor and remove "m" from the - * object's cache. - */ - if (m->right == NULL) { - object->cache = m->left; - m_next = NULL; - } else { - m_next = vm_page_splay(start, m->right); - m_next->left = m->left; - object->cache = m_next; - } - /* Convert "m" to a free page. */ + while ((m = vm_radix_lookup_ge(&object->cache, start)) != NULL) { + if (end != 0 && m->pindex >= end) + break; + vm_radix_remove(&object->cache, m->pindex); m->object = NULL; m->valid = 0; /* Clear PG_CACHED and set PG_FREE. */ @@ -1174,7 +1035,7 @@ vm_page_cache_free(vm_object_t object, v cnt.v_cache_count--; cnt.v_free_count++; } - empty = vm_object_cache_is_empty(object); + empty = vm_radix_is_empty(&object->cache); mtx_unlock(&vm_page_queue_free_mtx); if (object->type == OBJT_VNODE && empty) vdrop(object->handle); @@ -1189,15 +1050,9 @@ vm_page_cache_free(vm_object_t object, v static inline vm_page_t vm_page_cache_lookup(vm_object_t object, vm_pindex_t pindex) { - vm_page_t m; mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); - if ((m = object->cache) != NULL && m->pindex != pindex) { - m = vm_page_splay(pindex, m); - if ((object->cache = m)->pindex != pindex) - m = NULL; - } - return (m); + return (vm_radix_lookup(&object->cache, pindex)); } /* @@ -1209,28 +1064,11 @@ vm_page_cache_lookup(vm_object_t object, static void vm_page_cache_remove(vm_page_t m) { - vm_object_t object; - vm_page_t root; mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); KASSERT((m->flags & PG_CACHED) != 0, ("vm_page_cache_remove: page %p is not cached", m)); - object = m->object; - if (m != object->cache) { - root = vm_page_splay(m->pindex, object->cache); - KASSERT(root == m, - ("vm_page_cache_remove: page %p is not cached in object %p", - m, object)); - } - if (m->left == NULL) - root = m->right; - else if (m->right == NULL) - root = m->left; - else { - root = vm_page_splay(m->pindex, m->left); - root->right = m->right; - } - object->cache = root; + vm_radix_remove(&m->object->cache, m->pindex); m->object = NULL; cnt.v_cache_count--; } @@ -1250,7 +1088,7 @@ void vm_page_cache_transfer(vm_object_t orig_object, vm_pindex_t offidxstart, vm_object_t new_object) { - vm_page_t m, m_next; + vm_page_t m; /* * Insertion into an object's collection of cached pages @@ -1258,53 +1096,24 @@ vm_page_cache_transfer(vm_object_t orig_ * not. */ VM_OBJECT_ASSERT_WLOCKED(new_object); - KASSERT(vm_object_cache_is_empty(new_object), + KASSERT(vm_radix_is_empty(&new_object->cache), ("vm_page_cache_transfer: object %p has cached pages", new_object)); mtx_lock(&vm_page_queue_free_mtx); - if ((m = orig_object->cache) != NULL) { + while ((m = vm_radix_lookup_ge(&orig_object->cache, + offidxstart)) != NULL) { /* * Transfer all of the pages with offset greater than or * equal to 'offidxstart' from the original object's * cache to the new object's cache. */ - m = vm_page_splay(offidxstart, m); - if (m->pindex < offidxstart) { - orig_object->cache = m; - new_object->cache = m->right; - m->right = NULL; - } else { - orig_object->cache = m->left; - new_object->cache = m; - m->left = NULL; - } - while ((m = new_object->cache) != NULL) { - if ((m->pindex - offidxstart) >= new_object->size) { - /* - * Return all of the cached pages with - * offset greater than or equal to the - * new object's size to the original - * object's cache. - */ - new_object->cache = m->left; - m->left = orig_object->cache; - orig_object->cache = m; - break; - } - m_next = vm_page_splay(m->pindex, m->right); - /* Update the page's object and offset. */ - m->object = new_object; - m->pindex -= offidxstart; - if (m_next == NULL) - break; - m->right = NULL; - m_next->left = m; - new_object->cache = m_next; - } - KASSERT(vm_object_cache_is_empty(new_object) || - new_object->type == OBJT_SWAP, - ("vm_page_cache_transfer: object %p's type is incompatible" - " with cached pages", new_object)); + if ((m->pindex - offidxstart) >= new_object->size) + break; + vm_radix_remove(&orig_object->cache, m->pindex); + /* Update the page's object and offset. */ + m->object = new_object; + m->pindex -= offidxstart; + vm_radix_insert(&new_object->cache, m); } mtx_unlock(&vm_page_queue_free_mtx); } @@ -2324,7 +2133,7 @@ void vm_page_cache(vm_page_t m) { vm_object_t object; - vm_page_t next, prev, root; + boolean_t cache_was_empty; vm_page_lock_assert(m, MA_OWNED); object = m->object; @@ -2359,42 +2168,7 @@ vm_page_cache(vm_page_t m) * Remove the page from the object's collection of resident * pages. */ - if ((next = TAILQ_NEXT(m, listq)) != NULL && next->left == m) { - /* - * Since the page's successor in the list is also its parent - * in the tree, its right subtree must be empty. - */ - next->left = m->left; - KASSERT(m->right == NULL, - ("vm_page_cache: page %p has right child", m)); - } else if ((prev = TAILQ_PREV(m, pglist, listq)) != NULL && - prev->right == m) { - /* - * Since the page's predecessor in the list is also its parent - * in the tree, its left subtree must be empty. - */ - KASSERT(m->left == NULL, - ("vm_page_cache: page %p has left child", m)); - prev->right = m->right; - } else { - if (m != object->root) - vm_page_splay(m->pindex, object->root); - if (m->left == NULL) - root = m->right; - else if (m->right == NULL) - root = m->left; - else { - /* - * Move the page's successor to the root, because - * pages are usually removed in ascending order. - */ - if (m->right != next) - vm_page_splay(m->pindex, m->right); - next->left = m->left; - root = next; - } - object->root = root; - } + vm_radix_remove(&object->rtree, m->pindex); TAILQ_REMOVE(&object->memq, m, listq); object->resident_page_count--; @@ -2412,25 +2186,8 @@ vm_page_cache(vm_page_t m) mtx_lock(&vm_page_queue_free_mtx); m->flags |= PG_CACHED; cnt.v_cache_count++; - root = object->cache; - if (root == NULL) { - m->left = NULL; - m->right = NULL; - } else { - root = vm_page_splay(m->pindex, root); - if (m->pindex < root->pindex) { - m->left = root->left; - m->right = root; - root->left = NULL; - } else if (__predict_false(m->pindex == root->pindex)) - panic("vm_page_cache: offset already cached"); - else { - m->right = root->right; - m->left = root; - root->right = NULL; - } - } - object->cache = m; + cache_was_empty = vm_radix_is_empty(&object->cache); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 01:11:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 563C2E81; Mon, 18 Mar 2013 01:11:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 47C6ACB5; Mon, 18 Mar 2013 01:11:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2I1Brfl028363; Mon, 18 Mar 2013 01:11:53 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2I1Brkw028362; Mon, 18 Mar 2013 01:11:53 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303180111.r2I1Brkw028362@svn.freebsd.org> From: Adrian Chadd Date: Mon, 18 Mar 2013 01:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248450 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 01:11:53 -0000 Author: adrian Date: Mon Mar 18 01:11:52 2013 New Revision: 248450 URL: http://svnweb.freebsd.org/changeset/base/248450 Log: Log some more information when the RX buffer allocation failed. Modified: head/sys/dev/ath/if_ath_rx_edma.c Modified: head/sys/dev/ath/if_ath_rx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_rx_edma.c Mon Mar 18 00:25:02 2013 (r248449) +++ head/sys/dev/ath/if_ath_rx_edma.c Mon Mar 18 01:11:52 2013 (r248450) @@ -661,9 +661,12 @@ ath_edma_rxfifo_alloc(struct ath_softc * bf = ath_edma_rxbuf_alloc(sc); /* XXX should ensure the FIFO is not NULL? */ if (bf == NULL) { - device_printf(sc->sc_dev, "%s: Q%d: alloc failed?\n", + device_printf(sc->sc_dev, + "%s: Q%d: alloc failed: i=%d, nbufs=%d?\n", __func__, - qtype); + qtype, + i, + nbufs); break; } From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 01:12:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AFF5FFEF; Mon, 18 Mar 2013 01:12:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 990E7CBF; Mon, 18 Mar 2013 01:12:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2I1CaOC028536; Mon, 18 Mar 2013 01:12:36 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2I1Ca4O028535; Mon, 18 Mar 2013 01:12:36 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303180112.r2I1Ca4O028535@svn.freebsd.org> From: Adrian Chadd Date: Mon, 18 Mar 2013 01:12:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248451 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 01:12:36 -0000 Author: adrian Date: Mon Mar 18 01:12:36 2013 New Revision: 248451 URL: http://svnweb.freebsd.org/changeset/base/248451 Log: Dump out information about the RX descriptor free list and FIFO information. Modified: head/sys/dev/ath/if_ath_sysctl.c Modified: head/sys/dev/ath/if_ath_sysctl.c ============================================================================== --- head/sys/dev/ath/if_ath_sysctl.c Mon Mar 18 01:11:52 2013 (r248450) +++ head/sys/dev/ath/if_ath_sysctl.c Mon Mar 18 01:12:36 2013 (r248451) @@ -397,6 +397,22 @@ ath_sysctl_txagg(SYSCTL_HANDLER_ARGS) printf("Total mgmt TX buffers: %d; Total mgmt TX buffers busy: %d\n", t, i); + ATH_RX_LOCK(sc); + for (i = 0; i < 2; i++) { + printf("%d: fifolen: %d; head=%d; tail=%d\n", + i, + sc->sc_rxedma[i].m_fifolen, + sc->sc_rxedma[i].m_fifo_head, + sc->sc_rxedma[i].m_fifo_tail); + } + i = 0; + TAILQ_FOREACH(bf, &sc->sc_rxbuf, bf_list) { + i++; + } + printf("Total RX buffers in free list: %d buffers\n", + i); + ATH_RX_UNLOCK(sc); + return 0; } From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 01:22:30 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4358C7B8; Mon, 18 Mar 2013 01:22:30 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1475FD29; Mon, 18 Mar 2013 01:22:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2I1MTQ4031811; Mon, 18 Mar 2013 01:22:29 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2I1MTOP031810; Mon, 18 Mar 2013 01:22:29 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201303180122.r2I1MTOP031810@svn.freebsd.org> From: Kevin Lo Date: Mon, 18 Mar 2013 01:22:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248453 - head/lib/libc/stdlib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 01:22:30 -0000 Author: kevlo Date: Mon Mar 18 01:22:28 2013 New Revision: 248453 URL: http://svnweb.freebsd.org/changeset/base/248453 Log: Add restrict keyword to realpath manpage. Modified: head/lib/libc/stdlib/realpath.3 Modified: head/lib/libc/stdlib/realpath.3 ============================================================================== --- head/lib/libc/stdlib/realpath.3 Mon Mar 18 01:20:11 2013 (r248452) +++ head/lib/libc/stdlib/realpath.3 Mon Mar 18 01:22:28 2013 (r248453) @@ -42,7 +42,7 @@ .Sh SYNOPSIS .In stdlib.h .Ft "char *" -.Fn realpath "const char *pathname" "char *resolved_path" +.Fn realpath "const char * restrict pathname" "char * restrict resolved_path" .Sh DESCRIPTION The .Fn realpath From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 02:29:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CE2278CB; Mon, 18 Mar 2013 02:29:57 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BFD6EEF2; Mon, 18 Mar 2013 02:29:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2I2TvdL051711; Mon, 18 Mar 2013 02:29:57 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2I2Tv6h051710; Mon, 18 Mar 2013 02:29:57 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303180229.r2I2Tv6h051710@svn.freebsd.org> From: Adrian Chadd Date: Mon, 18 Mar 2013 02:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248455 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 02:29:57 -0000 Author: adrian Date: Mon Mar 18 02:29:57 2013 New Revision: 248455 URL: http://svnweb.freebsd.org/changeset/base/248455 Log: Print out the current fifo queue depth correctly - not just the max queue depth. Silly hat to me. Modified: head/sys/dev/ath/if_ath_sysctl.c Modified: head/sys/dev/ath/if_ath_sysctl.c ============================================================================== --- head/sys/dev/ath/if_ath_sysctl.c Mon Mar 18 01:30:54 2013 (r248454) +++ head/sys/dev/ath/if_ath_sysctl.c Mon Mar 18 02:29:57 2013 (r248455) @@ -399,8 +399,9 @@ ath_sysctl_txagg(SYSCTL_HANDLER_ARGS) ATH_RX_LOCK(sc); for (i = 0; i < 2; i++) { - printf("%d: fifolen: %d; head=%d; tail=%d\n", + printf("%d: fifolen: %d/%d; head=%d; tail=%d\n", i, + sc->sc_rxedma[i].m_fifo_depth, sc->sc_rxedma[i].m_fifolen, sc->sc_rxedma[i].m_fifo_head, sc->sc_rxedma[i].m_fifo_tail); From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 04:46:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D8214C43; Mon, 18 Mar 2013 04:46:17 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CAC113F6; Mon, 18 Mar 2013 04:46:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2I4kHfc094227; Mon, 18 Mar 2013 04:46:17 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2I4kHiM094224; Mon, 18 Mar 2013 04:46:17 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201303180446.r2I4kHiM094224@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 18 Mar 2013 04:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248456 - head/sys/dev/sis X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 04:46:17 -0000 Author: yongari Date: Mon Mar 18 04:46:17 2013 New Revision: 248456 URL: http://svnweb.freebsd.org/changeset/base/248456 Log: r119712 introduced SIS_TYPE_83816 but it was not actually set in driver such that checking against the type was always false. To detect NS DP83816, driver should have checked silicon revision register for NS controllers. While here, remove SIS_TYPE_83816 to not make the similar mistake again. Reported by: Brad Smith ( brad@openbsd ) Modified: head/sys/dev/sis/if_sis.c head/sys/dev/sis/if_sisreg.h Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Mon Mar 18 02:29:57 2013 (r248455) +++ head/sys/dev/sis/if_sis.c Mon Mar 18 04:46:17 2013 (r248456) @@ -625,7 +625,7 @@ sis_miibus_statchg(device_t dev) SIS_CLRBIT(sc, SIS_RX_CFG, SIS_RXCFG_RX_TXPKTS); } - if (sc->sis_type == SIS_TYPE_83816) { + if (sc->sis_type == SIS_TYPE_83815 && sc->sis_srr >= NS_SRR_16A) { /* * MPII03.D: Half Duplex Excessive Collisions. * Also page 49 in 83816 manual @@ -1989,7 +1989,7 @@ sis_initl(struct sis_softc *sc) return; } - if (sc->sis_type == SIS_TYPE_83815 || sc->sis_type == SIS_TYPE_83816) { + if (sc->sis_type == SIS_TYPE_83815) { if (sc->sis_manual_pad != 0) sc->sis_flags |= SIS_FLAG_MANUAL_PAD; else Modified: head/sys/dev/sis/if_sisreg.h ============================================================================== --- head/sys/dev/sis/if_sisreg.h Mon Mar 18 02:29:57 2013 (r248455) +++ head/sys/dev/sis/if_sisreg.h Mon Mar 18 04:46:17 2013 (r248456) @@ -439,7 +439,6 @@ struct sis_type { #define SIS_TYPE_900 1 #define SIS_TYPE_7016 2 #define SIS_TYPE_83815 3 -#define SIS_TYPE_83816 4 struct sis_txdesc { struct mbuf *tx_m; From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 05:30:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3CFEDF99; Mon, 18 Mar 2013 05:30:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2725F6CB; Mon, 18 Mar 2013 05:30:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2I5UK8t006963; Mon, 18 Mar 2013 05:30:20 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2I5UJJ3006928; Mon, 18 Mar 2013 05:30:19 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201303180530.r2I5UJJ3006928@svn.freebsd.org> From: Justin Hibbits Date: Mon, 18 Mar 2013 05:30:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248457 - in head/sys: cddl/contrib/opensolaris/uts/common/sys cddl/dev/dtrace/powerpc cddl/dev/fbt modules/dtrace modules/dtrace/dtraceall modules/dtrace/fbt powerpc/aim X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 05:30:20 -0000 Author: jhibbits Date: Mon Mar 18 05:30:18 2013 New Revision: 248457 URL: http://svnweb.freebsd.org/changeset/base/248457 Log: Add FBT for PowerPC DTrace. Also, clean up the DTrace assembly code, much of which is not necessary for PowerPC. The FBT module can likely be factored into 3 separate files: common, intel, and powerpc, rather than duplicating most of the code between the x86 and PowerPC flavors. All DTrace modules for PowerPC will be MFC'd together once Fasttrap is completed. Added: head/sys/cddl/dev/fbt/fbt_powerpc.c (contents, props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c head/sys/modules/dtrace/Makefile head/sys/modules/dtrace/dtraceall/dtraceall.c head/sys/modules/dtrace/fbt/Makefile head/sys/powerpc/aim/trap.c head/sys/powerpc/aim/trap_subr32.S head/sys/powerpc/aim/trap_subr64.S Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Mon Mar 18 04:46:17 2013 (r248456) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h Mon Mar 18 05:30:18 2013 (r248457) @@ -2313,10 +2313,10 @@ extern int dtrace_mach_aframes(void); #if defined(__i386) || defined(__amd64) extern int dtrace_instr_size(uchar_t *instr); extern int dtrace_instr_size_isa(uchar_t *, model_t, int *); -extern void dtrace_invop_add(int (*)(uintptr_t, uintptr_t *, uintptr_t)); -extern void dtrace_invop_remove(int (*)(uintptr_t, uintptr_t *, uintptr_t)); extern void dtrace_invop_callsite(void); #endif +extern void dtrace_invop_add(int (*)(uintptr_t, uintptr_t *, uintptr_t)); +extern void dtrace_invop_remove(int (*)(uintptr_t, uintptr_t *, uintptr_t)); #ifdef __sparc extern int dtrace_blksuword32(uintptr_t, uint32_t *, int); @@ -2349,6 +2349,15 @@ extern void dtrace_helpers_destroy(proc_ #define DTRACE_INVOP_NOP 4 #define DTRACE_INVOP_RET 5 +#elif defined(__powerpc__) + +#define DTRACE_INVOP_RET 1 +#define DTRACE_INVOP_BCTR 2 +#define DTRACE_INVOP_BLR 3 +#define DTRACE_INVOP_JUMP 4 +#define DTRACE_INVOP_MFLR_R0 5 +#define DTRACE_INVOP_NOP 6 + #endif #ifdef __cplusplus Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Mon Mar 18 04:46:17 2013 (r248456) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Mon Mar 18 05:30:18 2013 (r248457) @@ -85,10 +85,10 @@ ASENTRY_NOPROF(dtrace_cas32) 1: lwarx %r0,0,%r3 cmpw %r4,%r0 - bne 2f + bne 2f stwcx. %r5,0,%r3 - bne 1b -2: mr %r3,%r0 + bne 1b +2: mr %r3,%r0 blr END(dtrace_cas32) @@ -100,22 +100,15 @@ ASENTRY_NOPROF(dtrace_casptr) 1: lwarx %r0,0,%r3 cmpw %r4,%r0 - bne 2f + bne 2f stwcx. %r5,0,%r3 - bne 1b -2: mr %r3,%r0 + bne 1b +2: mr %r3,%r0 blr END(dtrace_casptr) /* -uintptr_t -dtrace_fulword(void *addr) -*/ -ASENTRY_NOPROF(dtrace_fulword) -END(dtrace_fulword) - -/* XXX: unoptimized void dtrace_copy(uintptr_t src, uintptr_t dest, size_t size) @@ -127,7 +120,7 @@ ASENTRY_NOPROF(dtrace_copy) lbzu %r3,1(%r7) stbu %r3,1(%r8) addme %r5,%r5 - beq 2f + beq 2f 2: blr END(dtrace_copy) @@ -144,42 +137,19 @@ ASENTRY_NOPROF(dtrace_copystr) lbzu %r3,1(%r7) stbu %r3,1(%r8) addme %r5,%r5 - beq 2f - or %r3,%r3,%r3 - beq 2f + beq 2f + or %r3,%r3,%r3 + beq 2f andi. %r0,%r5,0x0fff - beq 2f - lwz %r0,0(%r6) + beq 2f + lwz %r0,0(%r6) andi. %r0,%r0,CPU_DTRACE_BADADDR - beq 1b + beq 1b 2: blr END(dtrace_copystr) /* -void dtrace_invop_init(void) -*/ -ASENTRY_NOPROF(dtrace_invop_init) - /* XXX: impement it properly -- implement dtrace_invop_start */ - li %r0,0 - li %r3,dtrace_invop_jump_addr@l - addis %r3,%r3,dtrace_invop_jump_addr@ha - stw %r0,0(%r3) - blr -END(dtrace_invop_init) - -/* -void dtrace_invop_uninit(void) -*/ -ASENTRY_NOPROF(dtrace_invop_uninit) - li %r0,0 - li %r3,dtrace_invop_jump_addr@l - addis %r3,%r3,dtrace_invop_jump_addr@ha - stw %r0,0(%r3) - blr -END(dtrace_invop_uninit) - -/* * The panic() and cmn_err() functions invoke vpanic() as a common entry point * into the panic code implemented in panicsys(). vpanic() is responsible * for passing through the format string and arguments, and constructing a Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Mon Mar 18 04:46:17 2013 (r248456) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Mon Mar 18 05:30:18 2013 (r248457) @@ -567,3 +567,17 @@ dtrace_fuword64(void *uaddr) } return ret; } + +uintptr_t +dtrace_fulword(void *uaddr) +{ + uintptr_t ret = 0; + + if (dtrace_copycheck((uintptr_t)uaddr, (uintptr_t)&ret, sizeof(ret))) { + if (copyin((const void *)uaddr, (void *)&ret, sizeof(ret))) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + } + } + return ret; +} Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c Mon Mar 18 04:46:17 2013 (r248456) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c Mon Mar 18 05:30:18 2013 (r248457) @@ -49,8 +49,11 @@ __FBSDID("$FreeBSD$"); extern uintptr_t dtrace_in_probe_addr; extern int dtrace_in_probe; extern dtrace_id_t dtrace_probeid_error; +extern int (*dtrace_invop_jump_addr)(struct trapframe *); int dtrace_invop(uintptr_t, uintptr_t *, uintptr_t); +void dtrace_invop_init(void); +void dtrace_invop_uninit(void); typedef struct dtrace_invop_hdlr { int (*dtih_func)(uintptr_t, uintptr_t *, uintptr_t); @@ -72,6 +75,44 @@ dtrace_invop(uintptr_t addr, uintptr_t * return (0); } +void +dtrace_invop_add(int (*func)(uintptr_t, uintptr_t *, uintptr_t)) +{ + dtrace_invop_hdlr_t *hdlr; + + hdlr = kmem_alloc(sizeof (dtrace_invop_hdlr_t), KM_SLEEP); + hdlr->dtih_func = func; + hdlr->dtih_next = dtrace_invop_hdlr; + dtrace_invop_hdlr = hdlr; +} + +void +dtrace_invop_remove(int (*func)(uintptr_t, uintptr_t *, uintptr_t)) +{ + dtrace_invop_hdlr_t *hdlr = dtrace_invop_hdlr, *prev = NULL; + + for (;;) { + if (hdlr == NULL) + panic("attempt to remove non-existent invop handler"); + + if (hdlr->dtih_func == func) + break; + + prev = hdlr; + hdlr = hdlr->dtih_next; + } + + if (prev == NULL) { + ASSERT(dtrace_invop_hdlr == hdlr); + dtrace_invop_hdlr = hdlr->dtih_next; + } else { + ASSERT(dtrace_invop_hdlr != hdlr); + prev->dtih_next = hdlr->dtih_next; + } + + kmem_free(hdlr, 0); +} + /*ARGSUSED*/ void @@ -199,3 +240,36 @@ dtrace_probe_error(dtrace_state_t *state (uintptr_t)epid, (uintptr_t)which, (uintptr_t)fault, (uintptr_t)fltoffs); } + +static int +dtrace_invop_start(struct trapframe *frame) +{ + switch (dtrace_invop(frame->srr0, (uintptr_t *)frame, frame->fixreg[3])) { + case DTRACE_INVOP_JUMP: + break; + case DTRACE_INVOP_BCTR: + frame->srr0 = frame->ctr; + break; + case DTRACE_INVOP_BLR: + frame->srr0 = frame->lr; + break; + case DTRACE_INVOP_MFLR_R0: + frame->fixreg[0] = frame->lr ; + break; + default: + return (-1); + break; + } + + return (0); +} + +void dtrace_invop_init(void) +{ + dtrace_invop_jump_addr = dtrace_invop_start; +} + +void dtrace_invop_uninit(void) +{ + dtrace_invop_jump_addr = 0; +} Added: head/sys/cddl/dev/fbt/fbt_powerpc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/dev/fbt/fbt_powerpc.c Mon Mar 18 05:30:18 2013 (r248457) @@ -0,0 +1,1321 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * Portions Copyright 2006-2008 John Birrell jb@freebsd.org + * Portions Copyright 2013 Justin Hibbits jhibbits@freebsd.org + * + * $FreeBSD$ + * + */ + +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static MALLOC_DEFINE(M_FBT, "fbt", "Function Boundary Tracing"); + +#define FBT_PATCHVAL 0x7c810808 +#define FBT_MFLR_R0 0x7c0802a6 +#define FBT_MTLR_R0 0x7c0803a6 +#define FBT_BLR 0x4e800020 +#define FBT_BCTR 0x4e800030 +#define FBT_BRANCH 0x48000000 +#define FBT_BR_MASK 0x03fffffc +#define FBT_IS_JUMP(instr) ((instr & ~FBT_BR_MASK) == FBT_BRANCH) + +static d_open_t fbt_open; +static int fbt_unload(void); +static void fbt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *); +static void fbt_provide_module(void *, modctl_t *); +static void fbt_destroy(void *, dtrace_id_t, void *); +static void fbt_enable(void *, dtrace_id_t, void *); +static void fbt_disable(void *, dtrace_id_t, void *); +static void fbt_load(void *); +static void fbt_suspend(void *, dtrace_id_t, void *); +static void fbt_resume(void *, dtrace_id_t, void *); + +#define FBT_ENTRY "entry" +#define FBT_RETURN "return" +#define FBT_ADDR2NDX(addr) ((((uintptr_t)(addr)) >> 4) & fbt_probetab_mask) +#define FBT_PROBETAB_SIZE 0x8000 /* 32k entries -- 128K total */ + +static struct cdevsw fbt_cdevsw = { + .d_version = D_VERSION, + .d_open = fbt_open, + .d_name = "fbt", +}; + +static dtrace_pattr_t fbt_attr = { +{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, +{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, +}; + +static dtrace_pops_t fbt_pops = { + NULL, + fbt_provide_module, + fbt_enable, + fbt_disable, + fbt_suspend, + fbt_resume, + fbt_getargdesc, + NULL, + NULL, + fbt_destroy +}; + +typedef struct fbt_probe { + struct fbt_probe *fbtp_hashnext; + uint32_t *fbtp_patchpoint; + int8_t fbtp_rval; + uint32_t fbtp_patchval; + uint32_t fbtp_savedval; + uintptr_t fbtp_roffset; + dtrace_id_t fbtp_id; + const char *fbtp_name; + modctl_t *fbtp_ctl; + int fbtp_loadcnt; + int fbtp_primary; + int fbtp_invop_cnt; + int fbtp_symindx; + struct fbt_probe *fbtp_next; +} fbt_probe_t; + +static struct cdev *fbt_cdev; +static dtrace_provider_id_t fbt_id; +static fbt_probe_t **fbt_probetab; +static int fbt_probetab_size; +static int fbt_probetab_mask; +static int fbt_verbose = 0; + +static int +fbt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t rval) +{ + struct trapframe *frame = (struct trapframe *)stack; + solaris_cpu_t *cpu = &solaris_cpu[curcpu]; + fbt_probe_t *fbt = fbt_probetab[FBT_ADDR2NDX(addr)]; + uintptr_t tmp; + + for (; fbt != NULL; fbt = fbt->fbtp_hashnext) { + if ((uintptr_t)fbt->fbtp_patchpoint == addr) { + fbt->fbtp_invop_cnt++; + if (fbt->fbtp_roffset == 0) { + cpu->cpu_dtrace_caller = addr; + + dtrace_probe(fbt->fbtp_id, frame->fixreg[3], + frame->fixreg[4], frame->fixreg[5], + frame->fixreg[6], frame->fixreg[7]); + + cpu->cpu_dtrace_caller = 0; + } else { + + dtrace_probe(fbt->fbtp_id, fbt->fbtp_roffset, + rval, 0, 0, 0); + /* + * The caller doesn't have the fbt item, so + * fixup tail calls here. + */ + if (fbt->fbtp_rval == DTRACE_INVOP_JUMP) { + frame->srr0 = (uintptr_t)fbt->fbtp_patchpoint; + tmp = fbt->fbtp_savedval & FBT_BR_MASK; + /* Sign extend. */ + if (tmp & 0x02000000) + tmp |= 0xFC000000; + frame->srr0 += tmp; + } + cpu->cpu_dtrace_caller = 0; + } + + return (fbt->fbtp_rval); + } + } + + return (0); +} + +static int +fbt_provide_module_function(linker_file_t lf, int symindx, + linker_symval_t *symval, void *opaque) +{ + char *modname = opaque; + const char *name = symval->name; + fbt_probe_t *fbt, *retfbt; + int j; + int size; + u_int32_t *instr, *limit; + + if (strncmp(name, "dtrace_", 7) == 0 && + strncmp(name, "dtrace_safe_", 12) != 0) { + /* + * Anything beginning with "dtrace_" may be called + * from probe context unless it explicitly indicates + * that it won't be called from probe context by + * using the prefix "dtrace_safe_". + */ + return (0); + } + + if (name[0] == '_' && name[1] == '_') + return (0); + + size = symval->size; + + instr = (u_int32_t *) symval->value; + limit = (u_int32_t *) symval->value + symval->size; + + for (; instr < limit; instr++) + if (*instr == FBT_MFLR_R0) + break; + + if (*instr != FBT_MFLR_R0); + return (0); + + fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); + fbt->fbtp_name = name; + fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, + name, FBT_ENTRY, 3, fbt); + fbt->fbtp_patchpoint = instr; + fbt->fbtp_ctl = lf; + fbt->fbtp_loadcnt = lf->loadcnt; + fbt->fbtp_savedval = *instr; + fbt->fbtp_patchval = FBT_PATCHVAL; + fbt->fbtp_rval = DTRACE_INVOP_MFLR_R0; + fbt->fbtp_symindx = symindx; + + fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)]; + fbt_probetab[FBT_ADDR2NDX(instr)] = fbt; + + lf->fbt_nentries++; + + retfbt = NULL; +again: + if (instr >= limit) + return (0); + + /* + * We (desperately) want to avoid erroneously instrumenting a + * jump table To determine if we're looking at a true instruction + * sequence or an inline jump table that happens to contain the same + * byte sequences, we resort to some heuristic sleeze: we treat this + * instruction as being contained within a pointer, and see if that + * pointer points to within the body of the function. If it does, we + * refuse to instrument it. + */ + { + uint32_t *ptr; + + ptr = *(uint32_t **)instr; + + if (ptr >= (uint32_t *) symval->value && ptr < limit) { + instr++; + goto again; + } + } + + if (*instr == FBT_MFLR_R0) + return (0); + + if (*instr != FBT_MTLR_R0) { + instr++; + goto again; + } + + instr++; + + for (j = 0; j < 12 && instr < limit; j++, instr++) { + if ((*instr == FBT_BCTR) || (*instr == FBT_BLR) | + FBT_IS_JUMP(*instr)) + break; + } + + if (!(*instr == FBT_BCTR || *instr == FBT_BLR || FBT_IS_JUMP(*instr))) + goto again; + + /* + * We have a winner! + */ + fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); + fbt->fbtp_name = name; + + if (retfbt == NULL) { + fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, + name, FBT_RETURN, 3, fbt); + } else { + retfbt->fbtp_next = fbt; + fbt->fbtp_id = retfbt->fbtp_id; + } + + retfbt = fbt; + fbt->fbtp_patchpoint = instr; + fbt->fbtp_ctl = lf; + fbt->fbtp_loadcnt = lf->loadcnt; + fbt->fbtp_symindx = symindx; + + if (*instr == FBT_BCTR) + fbt->fbtp_rval = DTRACE_INVOP_BCTR; + else if (*instr == FBT_BLR) + fbt->fbtp_rval = DTRACE_INVOP_RET; + else + fbt->fbtp_rval = DTRACE_INVOP_JUMP; + + fbt->fbtp_savedval = *instr; + fbt->fbtp_patchval = FBT_PATCHVAL; + fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)]; + fbt_probetab[FBT_ADDR2NDX(instr)] = fbt; + + lf->fbt_nentries++; + + instr += size; + goto again; +} + +static void +fbt_provide_module(void *arg, modctl_t *lf) +{ + char modname[MAXPATHLEN]; + int i; + size_t len; + + strlcpy(modname, lf->filename, sizeof(modname)); + len = strlen(modname); + if (len > 3 && strcmp(modname + len - 3, ".ko") == 0) + modname[len - 3] = '\0'; + + /* + * Employees of dtrace and their families are ineligible. Void + * where prohibited. + */ + if (strcmp(modname, "dtrace") == 0) + return; + + /* + * The cyclic timer subsystem can be built as a module and DTrace + * depends on that, so it is ineligible too. + */ + if (strcmp(modname, "cyclic") == 0) + return; + + /* + * To register with DTrace, a module must list 'dtrace' as a + * dependency in order for the kernel linker to resolve + * symbols like dtrace_register(). All modules with such a + * dependency are ineligible for FBT tracing. + */ + for (i = 0; i < lf->ndeps; i++) + if (strncmp(lf->deps[i]->filename, "dtrace", 6) == 0) + return; + + if (lf->fbt_nentries) { + /* + * This module has some FBT entries allocated; we're afraid + * to screw with it. + */ + return; + } + + /* + * List the functions in the module and the symbol values. + */ + (void) linker_file_function_listall(lf, fbt_provide_module_function, modname); +} + +static void +fbt_destroy(void *arg, dtrace_id_t id, void *parg) +{ + fbt_probe_t *fbt = parg, *next, *hash, *last; + modctl_t *ctl; + int ndx; + + do { + ctl = fbt->fbtp_ctl; + + ctl->fbt_nentries--; + + /* + * Now we need to remove this probe from the fbt_probetab. + */ + ndx = FBT_ADDR2NDX(fbt->fbtp_patchpoint); + last = NULL; + hash = fbt_probetab[ndx]; + + while (hash != fbt) { + ASSERT(hash != NULL); + last = hash; + hash = hash->fbtp_hashnext; + } + + if (last != NULL) { + last->fbtp_hashnext = fbt->fbtp_hashnext; + } else { + fbt_probetab[ndx] = fbt->fbtp_hashnext; + } + + next = fbt->fbtp_next; + free(fbt, M_FBT); + + fbt = next; + } while (fbt != NULL); +} + +static void +fbt_enable(void *arg, dtrace_id_t id, void *parg) +{ + fbt_probe_t *fbt = parg; + modctl_t *ctl = fbt->fbtp_ctl; + + ctl->nenabled++; + + /* + * Now check that our modctl has the expected load count. If it + * doesn't, this module must have been unloaded and reloaded -- and + * we're not going to touch it. + */ + if (ctl->loadcnt != fbt->fbtp_loadcnt) { + if (fbt_verbose) { + printf("fbt is failing for probe %s " + "(module %s reloaded)", + fbt->fbtp_name, ctl->filename); + } + + return; + } + + for (; fbt != NULL; fbt = fbt->fbtp_next) { + *fbt->fbtp_patchpoint = fbt->fbtp_patchval; + } +} + +static void +fbt_disable(void *arg, dtrace_id_t id, void *parg) +{ + fbt_probe_t *fbt = parg; + modctl_t *ctl = fbt->fbtp_ctl; + + ASSERT(ctl->nenabled > 0); + ctl->nenabled--; + + if ((ctl->loadcnt != fbt->fbtp_loadcnt)) + return; + + for (; fbt != NULL; fbt = fbt->fbtp_next) + *fbt->fbtp_patchpoint = fbt->fbtp_savedval; +} + +static void +fbt_suspend(void *arg, dtrace_id_t id, void *parg) +{ + fbt_probe_t *fbt = parg; + modctl_t *ctl = fbt->fbtp_ctl; + + ASSERT(ctl->nenabled > 0); + + if ((ctl->loadcnt != fbt->fbtp_loadcnt)) + return; + + for (; fbt != NULL; fbt = fbt->fbtp_next) + *fbt->fbtp_patchpoint = fbt->fbtp_savedval; +} + +static void +fbt_resume(void *arg, dtrace_id_t id, void *parg) +{ + fbt_probe_t *fbt = parg; + modctl_t *ctl = fbt->fbtp_ctl; + + ASSERT(ctl->nenabled > 0); + + if ((ctl->loadcnt != fbt->fbtp_loadcnt)) + return; + + for (; fbt != NULL; fbt = fbt->fbtp_next) + *fbt->fbtp_patchpoint = fbt->fbtp_patchval; +} + +static int +fbt_ctfoff_init(modctl_t *lf, linker_ctf_t *lc) +{ + const Elf_Sym *symp = lc->symtab;; + const char *name; + const ctf_header_t *hp = (const ctf_header_t *) lc->ctftab; + const uint8_t *ctfdata = lc->ctftab + sizeof(ctf_header_t); + int i; + uint32_t *ctfoff; + uint32_t objtoff = hp->cth_objtoff; + uint32_t funcoff = hp->cth_funcoff; + ushort_t info; + ushort_t vlen; + + /* Sanity check. */ + if (hp->cth_magic != CTF_MAGIC) { + printf("Bad magic value in CTF data of '%s'\n",lf->pathname); + return (EINVAL); + } + + if (lc->symtab == NULL) { + printf("No symbol table in '%s'\n",lf->pathname); + return (EINVAL); + } + + if ((ctfoff = malloc(sizeof(uint32_t) * lc->nsym, M_LINKER, M_WAITOK)) == NULL) + return (ENOMEM); + + *lc->ctfoffp = ctfoff; + + for (i = 0; i < lc->nsym; i++, ctfoff++, symp++) { + if (symp->st_name == 0 || symp->st_shndx == SHN_UNDEF) { + *ctfoff = 0xffffffff; + continue; + } + + if (symp->st_name < lc->strcnt) + name = lc->strtab + symp->st_name; + else + name = "(?)"; + + switch (ELF_ST_TYPE(symp->st_info)) { + case STT_OBJECT: + if (objtoff >= hp->cth_funcoff || + (symp->st_shndx == SHN_ABS && symp->st_value == 0)) { + *ctfoff = 0xffffffff; + break; + } + + *ctfoff = objtoff; + objtoff += sizeof (ushort_t); + break; + + case STT_FUNC: + if (funcoff >= hp->cth_typeoff) { + *ctfoff = 0xffffffff; + break; + } + + *ctfoff = funcoff; + + info = *((const ushort_t *)(ctfdata + funcoff)); + vlen = CTF_INFO_VLEN(info); + + /* + * If we encounter a zero pad at the end, just skip it. + * Otherwise skip over the function and its return type + * (+2) and the argument list (vlen). + */ + if (CTF_INFO_KIND(info) == CTF_K_UNKNOWN && vlen == 0) + funcoff += sizeof (ushort_t); /* skip pad */ + else + funcoff += sizeof (ushort_t) * (vlen + 2); + break; + + default: + *ctfoff = 0xffffffff; + break; + } + } + + return (0); +} + +static ssize_t +fbt_get_ctt_size(uint8_t version, const ctf_type_t *tp, ssize_t *sizep, + ssize_t *incrementp) +{ + ssize_t size, increment; + + if (version > CTF_VERSION_1 && + tp->ctt_size == CTF_LSIZE_SENT) { + size = CTF_TYPE_LSIZE(tp); + increment = sizeof (ctf_type_t); + } else { + size = tp->ctt_size; + increment = sizeof (ctf_stype_t); + } + + if (sizep) + *sizep = size; + if (incrementp) + *incrementp = increment; + + return (size); +} + +static int +fbt_typoff_init(linker_ctf_t *lc) +{ + const ctf_header_t *hp = (const ctf_header_t *) lc->ctftab; + const ctf_type_t *tbuf; + const ctf_type_t *tend; + const ctf_type_t *tp; + const uint8_t *ctfdata = lc->ctftab + sizeof(ctf_header_t); + int ctf_typemax = 0; + uint32_t *xp; + ulong_t pop[CTF_K_MAX + 1] = { 0 }; + + + /* Sanity check. */ + if (hp->cth_magic != CTF_MAGIC) + return (EINVAL); + + tbuf = (const ctf_type_t *) (ctfdata + hp->cth_typeoff); + tend = (const ctf_type_t *) (ctfdata + hp->cth_stroff); + + int child = hp->cth_parname != 0; + + /* + * We make two passes through the entire type section. In this first + * pass, we count the number of each type and the total number of types. + */ + for (tp = tbuf; tp < tend; ctf_typemax++) { + ushort_t kind = CTF_INFO_KIND(tp->ctt_info); + ulong_t vlen = CTF_INFO_VLEN(tp->ctt_info); + ssize_t size, increment; + + size_t vbytes; + uint_t n; + + (void) fbt_get_ctt_size(hp->cth_version, tp, &size, &increment); + + switch (kind) { + case CTF_K_INTEGER: + case CTF_K_FLOAT: + vbytes = sizeof (uint_t); + break; + case CTF_K_ARRAY: + vbytes = sizeof (ctf_array_t); + break; + case CTF_K_FUNCTION: + vbytes = sizeof (ushort_t) * (vlen + (vlen & 1)); + break; + case CTF_K_STRUCT: + case CTF_K_UNION: + if (size < CTF_LSTRUCT_THRESH) { + ctf_member_t *mp = (ctf_member_t *) + ((uintptr_t)tp + increment); + + vbytes = sizeof (ctf_member_t) * vlen; + for (n = vlen; n != 0; n--, mp++) + child |= CTF_TYPE_ISCHILD(mp->ctm_type); + } else { + ctf_lmember_t *lmp = (ctf_lmember_t *) + ((uintptr_t)tp + increment); + + vbytes = sizeof (ctf_lmember_t) * vlen; + for (n = vlen; n != 0; n--, lmp++) + child |= + CTF_TYPE_ISCHILD(lmp->ctlm_type); + } + break; + case CTF_K_ENUM: + vbytes = sizeof (ctf_enum_t) * vlen; + break; + case CTF_K_FORWARD: + /* + * For forward declarations, ctt_type is the CTF_K_* + * kind for the tag, so bump that population count too. + * If ctt_type is unknown, treat the tag as a struct. + */ + if (tp->ctt_type == CTF_K_UNKNOWN || + tp->ctt_type >= CTF_K_MAX) + pop[CTF_K_STRUCT]++; + else + pop[tp->ctt_type]++; + /*FALLTHRU*/ + case CTF_K_UNKNOWN: + vbytes = 0; + break; + case CTF_K_POINTER: + case CTF_K_TYPEDEF: + case CTF_K_VOLATILE: + case CTF_K_CONST: + case CTF_K_RESTRICT: + child |= CTF_TYPE_ISCHILD(tp->ctt_type); + vbytes = 0; + break; + default: + printf("%s(%d): detected invalid CTF kind -- %u\n", __func__, __LINE__, kind); + return (EIO); + } + tp = (ctf_type_t *)((uintptr_t)tp + increment + vbytes); + pop[kind]++; + } + + *lc->typlenp = ctf_typemax; + + if ((xp = malloc(sizeof(uint32_t) * ctf_typemax, M_LINKER, M_ZERO | M_WAITOK)) == NULL) + return (ENOMEM); + + *lc->typoffp = xp; + + /* type id 0 is used as a sentinel value */ + *xp++ = 0; + + /* + * In the second pass, fill in the type offset. + */ + for (tp = tbuf; tp < tend; xp++) { + ushort_t kind = CTF_INFO_KIND(tp->ctt_info); + ulong_t vlen = CTF_INFO_VLEN(tp->ctt_info); + ssize_t size, increment; + + size_t vbytes; + uint_t n; + + (void) fbt_get_ctt_size(hp->cth_version, tp, &size, &increment); + + switch (kind) { + case CTF_K_INTEGER: + case CTF_K_FLOAT: + vbytes = sizeof (uint_t); + break; + case CTF_K_ARRAY: + vbytes = sizeof (ctf_array_t); + break; + case CTF_K_FUNCTION: + vbytes = sizeof (ushort_t) * (vlen + (vlen & 1)); + break; + case CTF_K_STRUCT: + case CTF_K_UNION: + if (size < CTF_LSTRUCT_THRESH) { + ctf_member_t *mp = (ctf_member_t *) + ((uintptr_t)tp + increment); + + vbytes = sizeof (ctf_member_t) * vlen; + for (n = vlen; n != 0; n--, mp++) + child |= CTF_TYPE_ISCHILD(mp->ctm_type); + } else { + ctf_lmember_t *lmp = (ctf_lmember_t *) + ((uintptr_t)tp + increment); + + vbytes = sizeof (ctf_lmember_t) * vlen; + for (n = vlen; n != 0; n--, lmp++) + child |= + CTF_TYPE_ISCHILD(lmp->ctlm_type); + } + break; + case CTF_K_ENUM: + vbytes = sizeof (ctf_enum_t) * vlen; + break; + case CTF_K_FORWARD: + case CTF_K_UNKNOWN: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 10:50:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CD309178D; Mon, 18 Mar 2013 10:50:51 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C01E472B; Mon, 18 Mar 2013 10:50:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2IAopJ3004854; Mon, 18 Mar 2013 10:50:51 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2IAopIJ004853; Mon, 18 Mar 2013 10:50:51 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201303181050.r2IAopIJ004853@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Mon, 18 Mar 2013 10:50:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248465 - head/crypto/openssh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 10:50:51 -0000 Author: des Date: Mon Mar 18 10:50:50 2013 New Revision: 248465 URL: http://svnweb.freebsd.org/changeset/base/248465 Log: Keep the default AuthorizedKeysFile setting. Although authorized_keys2 has been deprecated for a while, some people still use it and were unpleasantly surprised by this change. I may revert this commit at a later date if I can come up with a way to give users who still have authorized_keys2 files sufficient advance warning. MFC after: ASAP Modified: head/crypto/openssh/sshd_config Modified: head/crypto/openssh/sshd_config ============================================================================== --- head/crypto/openssh/sshd_config Mon Mar 18 09:52:17 2013 (r248464) +++ head/crypto/openssh/sshd_config Mon Mar 18 10:50:50 2013 (r248465) @@ -50,8 +50,7 @@ #PubkeyAuthentication yes # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 -# but this is overridden so installations will only check .ssh/authorized_keys -AuthorizedKeysFile .ssh/authorized_keys +#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2 #AuthorizedPrincipalsFile none From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 11:06:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 24AFC830; Mon, 18 Mar 2013 11:06:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 09147A84; Mon, 18 Mar 2013 11:06:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2I8MaPE060858; Mon, 18 Mar 2013 08:22:36 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2I8Ma76060857; Mon, 18 Mar 2013 08:22:36 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201303180822.r2I8Ma76060857@svn.freebsd.org> From: Andrew Turner Date: Mon, 18 Mar 2013 08:22:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248460 - head/contrib/binutils/gas/config X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 11:06:36 -0000 Author: andrew Date: Mon Mar 18 08:22:35 2013 New Revision: 248460 URL: http://svnweb.freebsd.org/changeset/base/248460 Log: Add support for the vmsr and vmrs instructions. This supports the system level version of the instructions. When used in userland the hardware only allows us to read/write FPSCR. Modified: head/contrib/binutils/gas/config/tc-arm.c Modified: head/contrib/binutils/gas/config/tc-arm.c ============================================================================== --- head/contrib/binutils/gas/config/tc-arm.c Mon Mar 18 07:41:08 2013 (r248459) +++ head/contrib/binutils/gas/config/tc-arm.c Mon Mar 18 08:22:35 2013 (r248460) @@ -651,6 +651,7 @@ struct asm_opcode #define BAD_ARGS _("bad arguments to instruction") #define BAD_PC _("r15 not allowed here") +#define BAD_SP _("r13 not allowed here") #define BAD_COND _("instruction cannot be conditional") #define BAD_OVERLAP _("registers may not be the same") #define BAD_HIREG _("lo register required") @@ -659,6 +660,7 @@ struct asm_opcode #define BAD_BRANCH _("branch must be last instruction in IT block") #define BAD_NOT_IT _("instruction not allowed in IT block") #define BAD_FPU _("selected FPU does not support instruction") +#define BAD_VMRS _("APSR_nzcv may only be used with fpscr") static struct hash_control *arm_ops_hsh; static struct hash_control *arm_cond_hsh; @@ -7095,6 +7097,68 @@ do_vfp_nsyn_msr (void) return SUCCESS; } +static int +do_vfp_vmrs (void) +{ + int rt; + + /* The destination register can be r0-r14 or APSR_nzcv */ + if (inst.operands[0].reg > 14) + { + inst.error = BAD_PC; + return FAIL; + } + + /* If the destination is r13 and not in ARM mode then unprefictable */ + if (thumb_mode && inst.operands[0].reg == REG_SP) + { + inst.error = BAD_SP; + return FAIL; + } + + /* If the destination is APSR_nzcv */ + if (inst.operands[0].isvec && inst.operands[1].reg != 1) + { + inst.error = BAD_VMRS; + return FAIL; + } + + if (inst.operands[0].isvec) + rt = 15; + else + rt = inst.operands[0].reg; + + /* Or in the registers to use */ + inst.instruction |= rt << 12; + inst.instruction |= inst.operands[1].reg << 16; + + return SUCCESS; +} + +static int +do_vfp_vmsr (void) +{ + /* The destination register can be r0-r14 or APSR_nzcv */ + if (inst.operands[1].reg > 14) + { + inst.error = BAD_PC; + return FAIL; + } + + /* If the destination is r13 and not in ARM mode then unprefictable */ + if (thumb_mode && inst.operands[0].reg == REG_SP) + { + inst.error = BAD_SP; + return FAIL; + } + + /* Or in the registers to use */ + inst.instruction |= inst.operands[1].reg << 12; + inst.instruction |= inst.operands[0].reg << 16; + + return SUCCESS; +} + static void do_mrs (void) { @@ -15726,6 +15790,8 @@ static const struct asm_opcode insns[] = cCE(ftouizs, ebc0ac0, 2, (RVS, RVS), vfp_sp_monadic), cCE(fmrx, ef00a10, 2, (RR, RVC), rd_rn), cCE(fmxr, ee00a10, 2, (RVC, RR), rn_rd), + cCE(vmrs, ef00a10, 2, (APSR_RR, RVC), vfp_vmrs), + cCE(vmsr, ee00a10, 2, (RVC, RR), vfp_vmsr), /* Memory operations. */ cCE(flds, d100a00, 2, (RVS, ADDRGLDC), vfp_sp_ldst), From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 11:06:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 45F5F835; Mon, 18 Mar 2013 11:06:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 38690A88; Mon, 18 Mar 2013 11:06:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2I7f8Oj048037; Mon, 18 Mar 2013 07:41:08 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2I7f8LC048036; Mon, 18 Mar 2013 07:41:08 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201303180741.r2I7f8LC048036@svn.freebsd.org> From: Andrew Turner Date: Mon, 18 Mar 2013 07:41:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248459 - head/contrib/binutils/gas/config X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 11:06:36 -0000 Author: andrew Date: Mon Mar 18 07:41:08 2013 New Revision: 248459 URL: http://svnweb.freebsd.org/changeset/base/248459 Log: Some ARM vmov similar to 'vmov.f32 s1, s2' will incorrectly have the second register added to the symbol table by the assembler. On further investigation it was found the problem was with the my_get_expression function. This is called by parse_big_immediate. Fix this by moving the call to parse_big_immediate to the end of the if, else if, ..., else block. Modified: head/contrib/binutils/gas/config/tc-arm.c Modified: head/contrib/binutils/gas/config/tc-arm.c ============================================================================== --- head/contrib/binutils/gas/config/tc-arm.c Mon Mar 18 07:02:58 2013 (r248458) +++ head/contrib/binutils/gas/config/tc-arm.c Mon Mar 18 07:41:08 2013 (r248459) @@ -5164,10 +5164,6 @@ parse_neon_mov (char **str, int *which_o Case 10: VMOV.F32 , # Case 11: VMOV.F64
, # */ inst.operands[i].immisfloat = 1; - else if (parse_big_immediate (&ptr, i) == SUCCESS) - /* Case 2: VMOV.
, # - Case 3: VMOV.
, # */ - ; else if ((val = arm_typed_reg_parse (&ptr, REG_TYPE_NSDQ, &rtype, &optype)) != FAIL) { @@ -5207,6 +5203,10 @@ parse_neon_mov (char **str, int *which_o inst.operands[i++].present = 1; } } + else if (parse_big_immediate (&ptr, i) == SUCCESS) + /* Case 2: VMOV.
, # + Case 3: VMOV.
, # */ + ; else { first_error (_("expected or or operand")); From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 11:06:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 275DA845; Mon, 18 Mar 2013 11:06:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 112D3A95; Mon, 18 Mar 2013 11:06:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2I72xcI036078; Mon, 18 Mar 2013 07:02:59 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2I72wHF036076; Mon, 18 Mar 2013 07:02:58 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201303180702.r2I72wHF036076@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 18 Mar 2013 07:02:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248458 - in head/sys/dev/usb: . wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 11:06:37 -0000 Author: hselasky Date: Mon Mar 18 07:02:58 2013 New Revision: 248458 URL: http://svnweb.freebsd.org/changeset/base/248458 Log: Add new USB ID. PR: usb/177013 MFC after: 1 week Modified: head/sys/dev/usb/usbdevs head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Mon Mar 18 05:30:18 2013 (r248457) +++ head/sys/dev/usb/usbdevs Mon Mar 18 07:02:58 2013 (r248458) @@ -2499,6 +2499,7 @@ product LOGITEC RT2870_2 0x0163 RT2870 product LOGITEC RT2870_3 0x0164 RT2870 product LOGITEC LANW300NU2 0x0166 LAN-W300N/U2 product LOGITEC LANW150NU2 0x0168 LAN-W150N/U2 +product LOGITEC LANW300NU2S 0x0169 LAN-W300N/U2S /* Longcheer Holdings, Ltd. products */ product LONGCHEER WM66 0x6061 Longcheer WM66 HSDPA Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Mon Mar 18 05:30:18 2013 (r248457) +++ head/sys/dev/usb/wlan/if_run.c Mon Mar 18 07:02:58 2013 (r248458) @@ -211,6 +211,7 @@ static const STRUCT_USB_HOST_ID run_devs RUN_DEV(LOGITEC, RT2870_3), RUN_DEV(LOGITEC, LANW300NU2), RUN_DEV(LOGITEC, LANW150NU2), + RUN_DEV(LOGITEC, LANW300NU2S), RUN_DEV(MELCO, RT2870_1), RUN_DEV(MELCO, RT2870_2), RUN_DEV(MELCO, WLIUCAG300N), From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 14:22:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 67E7161A; Mon, 18 Mar 2013 14:22:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 40571D9A; Mon, 18 Mar 2013 14:22:12 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 739B5B926; Mon, 18 Mar 2013 10:22:11 -0400 (EDT) From: John Baldwin To: Jilles Tjoelker Subject: Re: svn commit: r248446 - head/usr.bin/find Date: Mon, 18 Mar 2013 09:40:04 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <201303172251.r2HMpw9U085037@svn.freebsd.org> In-Reply-To: <201303172251.r2HMpw9U085037@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201303180940.04749.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 18 Mar 2013 10:22:11 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 14:22:12 -0000 On Sunday, March 17, 2013 6:51:58 pm Jilles Tjoelker wrote: > Author: jilles > Date: Sun Mar 17 22:51:58 2013 > New Revision: 248446 > URL: http://svnweb.freebsd.org/changeset/base/248446 > > Log: > find: Include nanoseconds when comparing timestamps of files. > > When comparing to the timestamp of a given file using -newer, -Xnewer and > -newerXY (where X and Y are one of m, c, a, B), include nanoseconds in the > comparison. > > The primaries that compare a timestamp of a file to a given value (-Xmin, > -Xtime, -newerXt) continue to compare times in whole seconds. > > Note that the default value 0 of vfs.timestamp_precision almost always > causes the nanoseconds part to be 0. However, touch -d can set a timestamp > to the microsecond regardless of that sysctl. There are also several NFS servers that use sub-second timestamps by default. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 14:22:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0FC3F61C; Mon, 18 Mar 2013 14:22:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id D1810D9B; Mon, 18 Mar 2013 14:22:14 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 29106B968; Mon, 18 Mar 2013 10:22:14 -0400 (EDT) From: John Baldwin To: Rui Paulo Subject: Re: svn commit: r247814 - in head: . sys/amd64/conf sys/cam/ctl sys/conf sys/i386/conf Date: Mon, 18 Mar 2013 09:42:03 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <201303042118.r24LIj5e008913@svn.freebsd.org> <201303131108.27005.jhb@freebsd.org> <6B59A612-B737-4E1F-AF56-0DA1D0733F0A@FreeBSD.org> In-Reply-To: <6B59A612-B737-4E1F-AF56-0DA1D0733F0A@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201303180942.03814.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 18 Mar 2013 10:22:14 -0400 (EDT) Cc: svn-src-head@freebsd.org, "Kenneth D. Merry" , svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 14:22:15 -0000 On Saturday, March 16, 2013 12:54:01 pm Rui Paulo wrote: > On 2013/03/13, at 8:08, John Baldwin wrote: > > > On Tuesday, March 12, 2013 5:09:21 pm Pawel Jakub Dawidek wrote: > >> On Mon, Mar 04, 2013 at 09:18:45PM +0000, Kenneth D. Merry wrote: > >>> Author: ken > >>> Date: Mon Mar 4 21:18:45 2013 > >>> New Revision: 247814 > >>> URL: http://svnweb.freebsd.org/changeset/base/247814 > >>> > >>> Log: > >>> Re-enable CTL in GENERIC on i386 and amd64, but turn on the CTL disable > >>> tunable by default. > >>> > >>> This will allow GENERIC configurations to boot on small memory boxes, but > >>> not require end users who want to use CTL to recompile their kernel. They > >>> can simply set kern.cam.ctl.disable=0 in loader.conf. > >> > >> Could you rename it to kern.cam.ctl.enable(d)? There was discussion at > >> some point about sysctl/tunable names and the consensus was, AFAIR, to > >> use positive(?) names as they are more obvious. > > > > Except that all the hints we use for devices are hint.foo.X.disable=1 :) > > > I think this is not correct. The `disabled' hint comes from > resource_disabled(), which checks for > "resource_int_value(name, unit, "disabled", &value);" Yes, it probably is disabled rather than disable, but the point about it being a negative "disable" hint vs a positive "enable" hint still stands. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 15:14:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0B779C16; Mon, 18 Mar 2013 15:14:37 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D9C2D1A1; Mon, 18 Mar 2013 15:14:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2IFEaVF088366; Mon, 18 Mar 2013 15:14:36 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2IFEadC088365; Mon, 18 Mar 2013 15:14:36 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201303181514.r2IFEadC088365@svn.freebsd.org> From: Andrew Turner Date: Mon, 18 Mar 2013 15:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248466 - head/contrib/binutils/gas/config X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 15:14:37 -0000 Author: andrew Date: Mon Mar 18 15:14:36 2013 New Revision: 248466 URL: http://svnweb.freebsd.org/changeset/base/248466 Log: do_vfp_vmrs and do_vfp_vmsr should not return anything. Modified: head/contrib/binutils/gas/config/tc-arm.c Modified: head/contrib/binutils/gas/config/tc-arm.c ============================================================================== --- head/contrib/binutils/gas/config/tc-arm.c Mon Mar 18 10:50:50 2013 (r248465) +++ head/contrib/binutils/gas/config/tc-arm.c Mon Mar 18 15:14:36 2013 (r248466) @@ -7097,7 +7097,7 @@ do_vfp_nsyn_msr (void) return SUCCESS; } -static int +static void do_vfp_vmrs (void) { int rt; @@ -7106,21 +7106,21 @@ do_vfp_vmrs (void) if (inst.operands[0].reg > 14) { inst.error = BAD_PC; - return FAIL; + return; } /* If the destination is r13 and not in ARM mode then unprefictable */ if (thumb_mode && inst.operands[0].reg == REG_SP) { inst.error = BAD_SP; - return FAIL; + return; } /* If the destination is APSR_nzcv */ if (inst.operands[0].isvec && inst.operands[1].reg != 1) { inst.error = BAD_VMRS; - return FAIL; + return; } if (inst.operands[0].isvec) @@ -7131,32 +7131,28 @@ do_vfp_vmrs (void) /* Or in the registers to use */ inst.instruction |= rt << 12; inst.instruction |= inst.operands[1].reg << 16; - - return SUCCESS; } -static int +static void do_vfp_vmsr (void) { /* The destination register can be r0-r14 or APSR_nzcv */ if (inst.operands[1].reg > 14) { inst.error = BAD_PC; - return FAIL; + return; } /* If the destination is r13 and not in ARM mode then unprefictable */ if (thumb_mode && inst.operands[0].reg == REG_SP) { inst.error = BAD_SP; - return FAIL; + return; } /* Or in the registers to use */ inst.instruction |= inst.operands[1].reg << 12; inst.instruction |= inst.operands[0].reg << 16; - - return SUCCESS; } static void From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 15:18:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 22276EAB; Mon, 18 Mar 2013 15:18:57 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EF4241D1; Mon, 18 Mar 2013 15:18:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2IFIueU088998; Mon, 18 Mar 2013 15:18:56 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2IFIu48088992; Mon, 18 Mar 2013 15:18:56 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201303181518.r2IFIu48088992@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 18 Mar 2013 15:18:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248467 - in head/sys: arm/include dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 15:18:57 -0000 Author: ray Date: Mon Mar 18 15:18:55 2013 New Revision: 248467 URL: http://svnweb.freebsd.org/changeset/base/248467 Log: o Switch to use physical addresses in rman for FDT. o Remove vtophys used to translate virtual address to physical in case rman carry virtual. Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/include/bus.h head/sys/dev/fdt/fdt_common.c head/sys/dev/fdt/fdtbus.c head/sys/dev/fdt/simplebus.c Modified: head/sys/arm/include/bus.h ============================================================================== --- head/sys/arm/include/bus.h Mon Mar 18 15:14:36 2013 (r248466) +++ head/sys/arm/include/bus.h Mon Mar 18 15:18:55 2013 (r248467) @@ -731,6 +731,6 @@ bs_c_8_proto(f); * designed. It also serves to mark the locations needing that fix. */ #define BUS_SPACE_PHYSADDR(res, offs) \ - (vtophys(rman_get_start(res)+(offs))) + ((u_int)(rman_get_start(res)+(offs))) #endif /* _MACHINE_BUS_H_ */ Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Mon Mar 18 15:14:36 2013 (r248466) +++ head/sys/dev/fdt/fdt_common.c Mon Mar 18 15:18:55 2013 (r248467) @@ -421,12 +421,12 @@ fdt_regsize(phandle_t node, u_long *base int fdt_reg_to_rl(phandle_t node, struct resource_list *rl) { - u_long start, end, count; + u_long count; pcell_t *reg, *regptr; pcell_t addr_cells, size_cells; int tuple_size, tuples; int i, rv; - bus_space_handle_t vaddr; + bus_space_handle_t start, end; long busaddr, bussize; if (fdt_addrsize_cells(OF_parent(node), &addr_cells, &size_cells) != 0) @@ -457,14 +457,12 @@ fdt_reg_to_rl(phandle_t node, struct res /* Calculate address range relative to base. */ start += busaddr; - if (bus_space_map(fdtbus_bs_tag, start, count, 0, &vaddr) != 0) - panic("Couldn't map the device memory"); - end = vaddr + count - 1; + end = start + count - 1; - debugf("reg addr start = %lx, end = %lx, count = %lx\n", vaddr, + debugf("reg addr start = %lx, end = %lx, count = %lx\n", start, end, count); - resource_list_add(rl, SYS_RES_MEMORY, i, vaddr, end, + resource_list_add(rl, SYS_RES_MEMORY, i, start, end, count); } rv = 0; Modified: head/sys/dev/fdt/fdtbus.c ============================================================================== --- head/sys/dev/fdt/fdtbus.c Mon Mar 18 15:14:36 2013 (r248466) +++ head/sys/dev/fdt/fdtbus.c Mon Mar 18 15:18:55 2013 (r248467) @@ -617,6 +617,16 @@ static int fdtbus_activate_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { + bus_space_handle_t p; + int error; + + if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { + error = bus_space_map(rman_get_bustag(res), + rman_get_bushandle(res), rman_get_size(res), 0, &p); + if (error) + return (error); + rman_set_bushandle(res, p); + } return (rman_activate_resource(res)); } Modified: head/sys/dev/fdt/simplebus.c ============================================================================== --- head/sys/dev/fdt/simplebus.c Mon Mar 18 15:14:36 2013 (r248466) +++ head/sys/dev/fdt/simplebus.c Mon Mar 18 15:18:55 2013 (r248467) @@ -179,7 +179,6 @@ simplebus_attach(device_t dev) device_printf(dev, "%s: could not process 'reg' " "property\n", di->di_ofw.obd_name); - /* XXX should unmap */ ofw_bus_gen_destroy_devinfo(&di->di_ofw); free(di, M_SIMPLEBUS); continue; @@ -189,7 +188,6 @@ simplebus_attach(device_t dev) device_printf(dev, "%s: could not process " "'interrupts' property\n", di->di_ofw.obd_name); resource_list_free(&di->di_res); - /* XXX should unmap */ ofw_bus_gen_destroy_devinfo(&di->di_ofw); free(di, M_SIMPLEBUS); continue; @@ -201,7 +199,6 @@ simplebus_attach(device_t dev) device_printf(dev, "could not add child: %s\n", di->di_ofw.obd_name); resource_list_free(&di->di_res); - /* XXX should unmap */ ofw_bus_gen_destroy_devinfo(&di->di_ofw); free(di, M_SIMPLEBUS); continue; From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 17:24:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0DC8BD44; Mon, 18 Mar 2013 17:24:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E4850AFD; Mon, 18 Mar 2013 17:24:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2IHO0Co028153; Mon, 18 Mar 2013 17:24:00 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2IHNx1g028131; Mon, 18 Mar 2013 17:23:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201303181723.r2IHNx1g028131@svn.freebsd.org> From: John Baldwin Date: Mon, 18 Mar 2013 17:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248470 - in head/sys: cddl/compat/opensolaris/sys kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 17:24:01 -0000 Author: jhb Date: Mon Mar 18 17:23:58 2013 New Revision: 248470 URL: http://svnweb.freebsd.org/changeset/base/248470 Log: Partially revert r195702. Deferring stops is now implemented via a set of calls to toggle TDF_SBDRY rather than passing PBDRY to individual sleep calls. - Remove the stop_allowed parameters from cursig() and issignal(). issignal() checks TDF_SBDRY directly. - Remove the PBDRY and SLEEPQ_STOP_ON_BDRY flags. Modified: head/sys/cddl/compat/opensolaris/sys/sig.h head/sys/kern/kern_sig.c head/sys/kern/kern_synch.c head/sys/kern/subr_sleepqueue.c head/sys/kern/subr_trap.c head/sys/sys/param.h head/sys/sys/signalvar.h head/sys/sys/sleepqueue.h Modified: head/sys/cddl/compat/opensolaris/sys/sig.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/sig.h Mon Mar 18 15:38:15 2013 (r248469) +++ head/sys/cddl/compat/opensolaris/sys/sig.h Mon Mar 18 17:23:58 2013 (r248470) @@ -55,7 +55,7 @@ issig(int why) p = td->td_proc; PROC_LOCK(p); mtx_lock(&p->p_sigacts->ps_mtx); - sig = cursig(td, SIG_STOP_ALLOWED); + sig = cursig(td); mtx_unlock(&p->p_sigacts->ps_mtx); PROC_UNLOCK(p); if (sig != 0) Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Mon Mar 18 15:38:15 2013 (r248469) +++ head/sys/kern/kern_sig.c Mon Mar 18 17:23:58 2013 (r248470) @@ -108,7 +108,7 @@ SDT_PROBE_ARGTYPE(proc, kernel, , signal static int coredump(struct thread *); static int killpg1(struct thread *td, int sig, int pgid, int all, ksiginfo_t *ksi); -static int issignal(struct thread *td, int stop_allowed); +static int issignal(struct thread *td); static int sigprop(int sig); static void tdsigwakeup(struct thread *, int, sig_t, int); static void sig_suspend_threads(struct thread *, struct proc *, int); @@ -565,14 +565,12 @@ sigqueue_delete_stopmask_proc(struct pro * action, the process stops in issignal(). */ int -cursig(struct thread *td, int stop_allowed) +cursig(struct thread *td) { PROC_LOCK_ASSERT(td->td_proc, MA_OWNED); - KASSERT(stop_allowed == SIG_STOP_ALLOWED || - stop_allowed == SIG_STOP_NOT_ALLOWED, ("cursig: stop_allowed")); mtx_assert(&td->td_proc->p_sigacts->ps_mtx, MA_OWNED); THREAD_LOCK_ASSERT(td, MA_NOTOWNED); - return (SIGPENDING(td) ? issignal(td, stop_allowed) : 0); + return (SIGPENDING(td) ? issignal(td) : 0); } /* @@ -1202,7 +1200,7 @@ kern_sigtimedwait(struct thread *td, sig SIGSETNAND(td->td_sigmask, waitset); for (;;) { mtx_lock(&ps->ps_mtx); - sig = cursig(td, SIG_STOP_ALLOWED); + sig = cursig(td); mtx_unlock(&ps->ps_mtx); if (sig != 0 && SIGISMEMBER(waitset, sig)) { if (sigqueue_get(&td->td_sigqueue, sig, ksi) != 0 || @@ -1465,7 +1463,7 @@ kern_sigsuspend(struct thread *td, sigse /* void */; thread_suspend_check(0); mtx_lock(&p->p_sigacts->ps_mtx); - while ((sig = cursig(td, SIG_STOP_ALLOWED)) != 0) + while ((sig = cursig(td)) != 0) has_sig += postsig(sig); mtx_unlock(&p->p_sigacts->ps_mtx); } @@ -2399,12 +2397,10 @@ static void sig_suspend_threads(struct thread *td, struct proc *p, int sending) { struct thread *td2; - int wakeup_swapper; PROC_LOCK_ASSERT(p, MA_OWNED); PROC_SLOCK_ASSERT(p, MA_OWNED); - wakeup_swapper = 0; FOREACH_THREAD_IN_PROC(p, td2) { thread_lock(td2); td2->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK; @@ -2431,8 +2427,6 @@ sig_suspend_threads(struct thread *td, s } thread_unlock(td2); } - if (wakeup_swapper) - kick_proc0(); } int @@ -2584,7 +2578,7 @@ sigallowstop() * postsig(sig); */ static int -issignal(struct thread *td, int stop_allowed) +issignal(struct thread *td) { struct proc *p; struct sigacts *ps; Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Mon Mar 18 15:38:15 2013 (r248469) +++ head/sys/kern/kern_synch.c Mon Mar 18 17:23:58 2013 (r248470) @@ -205,8 +205,6 @@ _sleep(void *ident, struct lock_object * sleepq_flags = SLEEPQ_SLEEP; if (catch) sleepq_flags |= SLEEPQ_INTERRUPTIBLE; - if (priority & PBDRY) - sleepq_flags |= SLEEPQ_STOP_ON_BDRY; sleepq_lock(ident); CTR5(KTR_PROC, "sleep: thread %ld (pid %ld, %s) on %s (%p)", Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Mon Mar 18 15:38:15 2013 (r248469) +++ head/sys/kern/subr_sleepqueue.c Mon Mar 18 17:23:58 2013 (r248470) @@ -405,7 +405,7 @@ sleepq_catch_signals(void *wchan, int pr struct thread *td; struct proc *p; struct sigacts *ps; - int sig, ret, stop_allowed; + int sig, ret; td = curthread; p = curproc; @@ -429,8 +429,6 @@ sleepq_catch_signals(void *wchan, int pr sleepq_switch(wchan, pri); return (0); } - stop_allowed = (td->td_flags & TDF_SBDRY) ? SIG_STOP_NOT_ALLOWED : - SIG_STOP_ALLOWED; thread_unlock(td); mtx_unlock_spin(&sc->sc_lock); CTR3(KTR_PROC, "sleepq catching signals: thread %p (pid %ld, %s)", @@ -438,7 +436,7 @@ sleepq_catch_signals(void *wchan, int pr PROC_LOCK(p); ps = p->p_sigacts; mtx_lock(&ps->ps_mtx); - sig = cursig(td, stop_allowed); + sig = cursig(td); if (sig == 0) { mtx_unlock(&ps->ps_mtx); ret = thread_suspend_check(1); Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Mon Mar 18 15:38:15 2013 (r248469) +++ head/sys/kern/subr_trap.c Mon Mar 18 17:23:58 2013 (r248470) @@ -267,7 +267,7 @@ ast(struct trapframe *framep) !SIGISEMPTY(p->p_siglist)) { PROC_LOCK(p); mtx_lock(&p->p_sigacts->ps_mtx); - while ((sig = cursig(td, SIG_STOP_ALLOWED)) != 0) + while ((sig = cursig(td)) != 0) postsig(sig); mtx_unlock(&p->p_sigacts->ps_mtx); PROC_UNLOCK(p); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Mar 18 15:38:15 2013 (r248469) +++ head/sys/sys/param.h Mon Mar 18 17:23:58 2013 (r248470) @@ -211,7 +211,6 @@ #define PRIMASK 0x0ff #define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */ #define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */ -#define PBDRY 0x400 /* for PCATCH stop is done on the user boundary */ #define NZERO 0 /* default "nice" */ Modified: head/sys/sys/signalvar.h ============================================================================== --- head/sys/sys/signalvar.h Mon Mar 18 15:38:15 2013 (r248469) +++ head/sys/sys/signalvar.h Mon Mar 18 17:23:58 2013 (r248470) @@ -318,16 +318,12 @@ struct thread; extern struct mtx sigio_lock; -/* Values for stop_allowed parameter for cursig(). */ -#define SIG_STOP_ALLOWED 100 -#define SIG_STOP_NOT_ALLOWED 101 - /* Flags for kern_sigprocmask(). */ #define SIGPROCMASK_OLD 0x0001 #define SIGPROCMASK_PROC_LOCKED 0x0002 #define SIGPROCMASK_PS_LOCKED 0x0004 -int cursig(struct thread *td, int stop_allowed); +int cursig(struct thread *td); int sigdeferstop(void); void sigallowstop(void); void execsigs(struct proc *p); Modified: head/sys/sys/sleepqueue.h ============================================================================== --- head/sys/sys/sleepqueue.h Mon Mar 18 15:38:15 2013 (r248469) +++ head/sys/sys/sleepqueue.h Mon Mar 18 17:23:58 2013 (r248470) @@ -93,8 +93,6 @@ struct thread; #define SLEEPQ_SX 0x03 /* Used by an sx lock. */ #define SLEEPQ_LK 0x04 /* Used by a lockmgr. */ #define SLEEPQ_INTERRUPTIBLE 0x100 /* Sleep is interruptible. */ -#define SLEEPQ_STOP_ON_BDRY 0x200 /* Stop sleeping thread on - user mode boundary */ void init_sleepqueues(void); int sleepq_abort(struct thread *td, int intrval); From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 18:04:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A6C9A156; Mon, 18 Mar 2013 18:04:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 98AB3E3C; Mon, 18 Mar 2013 18:04:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2II4At7040182; Mon, 18 Mar 2013 18:04:10 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2II4AjO040181; Mon, 18 Mar 2013 18:04:10 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201303181804.r2II4AjO040181@svn.freebsd.org> From: John Baldwin Date: Mon, 18 Mar 2013 18:04:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248471 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 18:04:10 -0000 Author: jhb Date: Mon Mar 18 18:04:09 2013 New Revision: 248471 URL: http://svnweb.freebsd.org/changeset/base/248471 Log: Tweak some comments. Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Mon Mar 18 17:23:58 2013 (r248470) +++ head/sys/kern/kern_sig.c Mon Mar 18 18:04:09 2013 (r248471) @@ -560,8 +560,8 @@ sigqueue_delete_stopmask_proc(struct pro } /* - * Determine signal that should be delivered to process p, the current - * process, 0 if none. If there is a pending stop signal with default + * Determine signal that should be delivered to thread td, the current + * thread, 0 if none. If there is a pending stop signal with default * action, the process stops in issignal(). */ int @@ -2148,9 +2148,9 @@ tdsendsignal(struct proc *p, struct thre * Some signals have a process-wide effect and a per-thread * component. Most processing occurs when the process next * tries to cross the user boundary, however there are some - * times when processing needs to be done immediatly, such as + * times when processing needs to be done immediately, such as * waking up threads so that they can cross the user boundary. - * We try do the per-process part here. + * We try to do the per-process part here. */ if (P_SHOULDSTOP(p)) { KASSERT(!(p->p_flag & P_WEXIT), From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 19:22:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AC1F97FE; Mon, 18 Mar 2013 19:22:51 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 948CF34F; Mon, 18 Mar 2013 19:22:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2IJMpZ2064614; Mon, 18 Mar 2013 19:22:51 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2IJMpfT064613; Mon, 18 Mar 2013 19:22:51 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201303181922.r2IJMpfT064613@svn.freebsd.org> From: Ryan Stone Date: Mon, 18 Mar 2013 19:22:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248472 - head/sys/dev/puc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 19:22:51 -0000 Author: rstone Date: Mon Mar 18 19:22:51 2013 New Revision: 248472 URL: http://svnweb.freebsd.org/changeset/base/248472 Log: Correct the definition for Exar XR17V258IV: we must use a config_function to specify the offset into the PCI memory spare at which each serial port will find its registers. This was already done for other Exar PCI serial devices; it was accidentally omitted for this specific device. Sponsored by: Sandvine Incorporated MFC after: 1 week Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Mon Mar 18 18:04:09 2013 (r248471) +++ head/sys/dev/puc/pucdata.c Mon Mar 18 19:22:51 2013 (r248472) @@ -629,6 +629,7 @@ const struct puc_cfg puc_pci_devices[] = "Exar XR17V258IV", DEFAULT_RCLK * 8, PUC_PORT_8S, 0x10, 0, -1, + .config_function = puc_config_exar }, /* The XR17V358 uses the 125MHz PCIe clock as its reference clock. */ From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 21:11:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4199CD37; Mon, 18 Mar 2013 21:11:32 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2A27AAF8; Mon, 18 Mar 2013 21:11:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2ILBWgx098547; Mon, 18 Mar 2013 21:11:32 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2ILBWBG098546; Mon, 18 Mar 2013 21:11:32 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201303182111.r2ILBWBG098546@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 18 Mar 2013 21:11:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248475 - head/sbin/geom/class/eli X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 21:11:32 -0000 Author: pjd Date: Mon Mar 18 21:11:31 2013 New Revision: 248475 URL: http://svnweb.freebsd.org/changeset/base/248475 Log: Reduce stack usage. Modified: head/sbin/geom/class/eli/geom_eli.c Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Mon Mar 18 20:36:25 2013 (r248474) +++ head/sbin/geom/class/eli/geom_eli.c Mon Mar 18 21:11:31 2013 (r248475) @@ -259,6 +259,8 @@ struct g_command class_commands[] = { static int verbose = 0; +#define BUFSIZE 1024 + static int eli_protect(struct gctl_req *req) { @@ -344,7 +346,7 @@ static int eli_genkey_files(struct gctl_req *req, bool new, const char *type, struct hmac_ctx *ctxp, char *passbuf, size_t passbufsize) { - char *p, buf[MAXPHYS], argname[16]; + char *p, buf[BUFSIZE], argname[16]; const char *file; int error, fd, i; ssize_t done; @@ -431,7 +433,7 @@ eli_genkey_passphrase_prompt(struct gctl } if (new) { - char tmpbuf[BUFSIZ]; + char tmpbuf[BUFSIZE]; p = readpassphrase("Reenter new passphrase: ", tmpbuf, sizeof(tmpbuf), @@ -460,7 +462,7 @@ static int eli_genkey_passphrase(struct gctl_req *req, struct g_eli_metadata *md, bool new, struct hmac_ctx *ctxp) { - char passbuf[MAXPHYS]; + char passbuf[BUFSIZE]; bool nopassphrase; int nfiles; From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 22:38:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DFC045E9; Mon, 18 Mar 2013 22:38:32 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B66A61C0; Mon, 18 Mar 2013 22:38:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2IMcWdS024768; Mon, 18 Mar 2013 22:38:32 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2IMcUnP024751; Mon, 18 Mar 2013 22:38:30 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201303182238.r2IMcUnP024751@svn.freebsd.org> From: Neel Natu Date: Mon, 18 Mar 2013 22:38:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248477 - in head: lib/libvmmapi usr.sbin/bhyve usr.sbin/bhyvectl usr.sbin/bhyveload X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 22:38:33 -0000 Author: neel Date: Mon Mar 18 22:38:30 2013 New Revision: 248477 URL: http://svnweb.freebsd.org/changeset/base/248477 Log: Simplify the assignment of memory to virtual machines by requiring a single command line option "-m " to specify the memory size. Prior to this change the user needed to explicitly specify the amount of memory allocated below 4G (-m ) and the amount above 4G (-M ). The "-M" option is no longer supported by 'bhyveload' and 'bhyve'. The start of the PCI hole is fixed at 3GB and cannot be directly changed using command line options. However it is still possible to change this in special circumstances via the 'vm_set_lowmem_limit()' API provided by libvmmapi. Submitted by: Dinakar Medavaram (initial version) Reviewed by: grehan Obtained from: NetApp Modified: head/lib/libvmmapi/vmmapi.c head/lib/libvmmapi/vmmapi.h head/usr.sbin/bhyve/acpi.c head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/bhyverun.h head/usr.sbin/bhyve/mptbl.c head/usr.sbin/bhyve/pci_emul.c head/usr.sbin/bhyve/pci_virtio_block.c head/usr.sbin/bhyve/pci_virtio_net.c head/usr.sbin/bhyvectl/bhyvectl.c head/usr.sbin/bhyveload/bhyveload.8 head/usr.sbin/bhyveload/bhyveload.c Modified: head/lib/libvmmapi/vmmapi.c ============================================================================== --- head/lib/libvmmapi/vmmapi.c Mon Mar 18 21:29:31 2013 (r248476) +++ head/lib/libvmmapi/vmmapi.c Mon Mar 18 22:38:30 2013 (r248477) @@ -48,8 +48,16 @@ __FBSDID("$FreeBSD$"); #include "vmmapi.h" +#define GB (1024 * 1024 * 1024UL) + struct vmctx { int fd; + uint32_t lowmem_limit; + enum vm_mmap_style vms; + size_t lowmem; + char *lowmem_addr; + size_t highmem; + char *highmem_addr; char *name; }; @@ -90,6 +98,7 @@ vm_open(const char *name) assert(vm != NULL); vm->fd = -1; + vm->lowmem_limit = 3 * GB; vm->name = (char *)(vm + 1); strcpy(vm->name, name); @@ -151,8 +160,22 @@ vm_get_memory_seg(struct vmctx *ctx, vm_ return (error); } -int -vm_setup_memory(struct vmctx *ctx, vm_paddr_t gpa, size_t len, char **mapaddr) +uint32_t +vm_get_lowmem_limit(struct vmctx *ctx) +{ + + return (ctx->lowmem_limit); +} + +void +vm_set_lowmem_limit(struct vmctx *ctx, uint32_t limit) +{ + + ctx->lowmem_limit = limit; +} + +static int +setup_memory_segment(struct vmctx *ctx, vm_paddr_t gpa, size_t len, char **addr) { int error; struct vm_memory_segment seg; @@ -165,20 +188,69 @@ vm_setup_memory(struct vmctx *ctx, vm_pa seg.gpa = gpa; seg.len = len; error = ioctl(ctx->fd, VM_MAP_MEMORY, &seg); - if (error == 0 && mapaddr != NULL) { - *mapaddr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, + if (error == 0 && addr != NULL) { + *addr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, ctx->fd, gpa); } return (error); } -char * -vm_map_memory(struct vmctx *ctx, vm_paddr_t gpa, size_t len) +int +vm_setup_memory(struct vmctx *ctx, size_t memsize, enum vm_mmap_style vms) +{ + char **addr; + int error; + + /* XXX VM_MMAP_SPARSE not implemented yet */ + assert(vms == VM_MMAP_NONE || vms == VM_MMAP_ALL); + ctx->vms = vms; + + /* + * If 'memsize' cannot fit entirely in the 'lowmem' segment then + * create another 'highmem' segment above 4GB for the remainder. + */ + if (memsize > ctx->lowmem_limit) { + ctx->lowmem = ctx->lowmem_limit; + ctx->highmem = memsize - ctx->lowmem; + } else { + ctx->lowmem = memsize; + ctx->highmem = 0; + } + + if (ctx->lowmem > 0) { + addr = (vms == VM_MMAP_ALL) ? &ctx->lowmem_addr : NULL; + error = setup_memory_segment(ctx, 0, ctx->lowmem, addr); + if (error) + return (error); + } + + if (ctx->highmem > 0) { + addr = (vms == VM_MMAP_ALL) ? &ctx->highmem_addr : NULL; + error = setup_memory_segment(ctx, 4*GB, ctx->highmem, addr); + if (error) + return (error); + } + + return (0); +} + +void * +vm_map_gpa(struct vmctx *ctx, vm_paddr_t gaddr, size_t len) { - /* Map 'len' bytes of memory at guest physical address 'gpa' */ - return ((char *)mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, - ctx->fd, gpa)); + /* XXX VM_MMAP_SPARSE not implemented yet */ + assert(ctx->vms == VM_MMAP_ALL); + + if (gaddr < ctx->lowmem && gaddr + len <= ctx->lowmem) + return ((void *)(ctx->lowmem_addr + gaddr)); + + if (gaddr >= 4*GB) { + gaddr -= 4*GB; + if (gaddr < ctx->highmem && gaddr + len <= ctx->highmem) + return ((void *)(ctx->highmem_addr + gaddr)); + } + + return (NULL); } int Modified: head/lib/libvmmapi/vmmapi.h ============================================================================== --- head/lib/libvmmapi/vmmapi.h Mon Mar 18 21:29:31 2013 (r248476) +++ head/lib/libvmmapi/vmmapi.h Mon Mar 18 22:38:30 2013 (r248477) @@ -32,24 +32,26 @@ struct vmctx; enum x2apic_state; +/* + * Different styles of mapping the memory assigned to a VM into the address + * space of the controlling process. + */ +enum vm_mmap_style { + VM_MMAP_NONE, /* no mapping */ + VM_MMAP_ALL, /* fully and statically mapped */ + VM_MMAP_SPARSE, /* mappings created on-demand */ +}; + int vm_create(const char *name); struct vmctx *vm_open(const char *name); void vm_destroy(struct vmctx *ctx); size_t vmm_get_mem_total(void); size_t vmm_get_mem_free(void); int vm_get_memory_seg(struct vmctx *ctx, vm_paddr_t gpa, size_t *ret_len); -/* - * Create a memory segment of 'len' bytes in the guest physical address space - * at offset 'gpa'. - * - * If 'mapaddr' is not NULL then this region is mmap'ed into the address - * space of the calling process. If there is an mmap error then *mapaddr - * will be set to MAP_FAILED. - */ - -int vm_setup_memory(struct vmctx *ctx, vm_paddr_t gpa, size_t len, - char **mapaddr); -char * vm_map_memory(struct vmctx *ctx, vm_paddr_t gpa, size_t len); +int vm_setup_memory(struct vmctx *ctx, size_t len, enum vm_mmap_style s); +void *vm_map_gpa(struct vmctx *ctx, vm_paddr_t gaddr, size_t len); +uint32_t vm_get_lowmem_limit(struct vmctx *ctx); +void vm_set_lowmem_limit(struct vmctx *ctx, uint32_t limit); int vm_set_desc(struct vmctx *ctx, int vcpu, int reg, uint64_t base, uint32_t limit, uint32_t access); int vm_get_desc(struct vmctx *ctx, int vcpu, int reg, Modified: head/usr.sbin/bhyve/acpi.c ============================================================================== --- head/usr.sbin/bhyve/acpi.c Mon Mar 18 21:29:31 2013 (r248476) +++ head/usr.sbin/bhyve/acpi.c Mon Mar 18 22:38:30 2013 (r248477) @@ -680,29 +680,26 @@ basl_end(struct basl_fio *in, struct bas } static int -basl_load(int fd, uint64_t off) +basl_load(struct vmctx *ctx, int fd, uint64_t off) { - struct stat sb; + struct stat sb; void *gaddr; - int err; - err = 0; - if (fstat(fd, &sb) < 0) { - err = errno; - } else { - gaddr = paddr_guest2host(basl_acpi_base + off, sb.st_size); - if (gaddr != NULL) { - if (read(fd, gaddr, sb.st_size) < 0) - err = errno; - } else - err = EFAULT; - } + if (fstat(fd, &sb) < 0) + return (errno); + + gaddr = paddr_guest2host(ctx, basl_acpi_base + off, sb.st_size); + if (gaddr == NULL) + return (EFAULT); - return (err); + if (read(fd, gaddr, sb.st_size) < 0) + return (errno); + + return (0); } static int -basl_compile(int (*fwrite_section)(FILE *fp), uint64_t offset) +basl_compile(struct vmctx *ctx, int (*fwrite_section)(FILE *), uint64_t offset) { struct basl_fio io[2]; static char iaslbuf[3*MAXPATHLEN + 10]; @@ -736,7 +733,7 @@ basl_compile(int (*fwrite_section)(FILE * Copy the aml output file into guest * memory at the specified location */ - err = basl_load(io[1].fd, offset); + err = basl_load(ctx, io[1].fd, offset); } } basl_end(&io[0], &io[1]); @@ -842,7 +839,7 @@ acpi_build(struct vmctx *ctx, int ncpu, * copying them into guest memory */ while (!err && basl_ftables[i].wsect != NULL) { - err = basl_compile(basl_ftables[i].wsect, + err = basl_compile(ctx, basl_ftables[i].wsect, basl_ftables[i].offset); i++; } Modified: head/usr.sbin/bhyve/bhyverun.c ============================================================================== --- head/usr.sbin/bhyve/bhyverun.c Mon Mar 18 21:29:31 2013 (r248476) +++ head/usr.sbin/bhyve/bhyverun.c Mon Mar 18 22:38:30 2013 (r248477) @@ -80,9 +80,6 @@ int guest_tslice = DEFAULT_GUEST_TSLICE; int guest_hz = DEFAULT_GUEST_HZ; char *vmname; -u_long lomem_sz; -u_long himem_sz; - int guest_ncpus; static int pincpu = -1; @@ -95,9 +92,6 @@ static int strictio; static int acpi; -static char *lomem_addr; -static char *himem_addr; - static char *progname; static const int BSP = 0; @@ -147,8 +141,7 @@ usage(int code) " -z: guest hz (default is %d)\n" " -s: PCI slot config\n" " -S: legacy PCI slot config\n" - " -m: lowmem in MB\n" - " -M: highmem in MB\n" + " -m: memory size in MB\n" " -x: mux vcpus to 1 hcpu\n" " -t: mux vcpu timeslice hz (default %d)\n", progname, DEFAULT_GDB_PORT, DEFAULT_GUEST_HZ, @@ -157,19 +150,10 @@ usage(int code) } void * -paddr_guest2host(uintptr_t gaddr, size_t len) +paddr_guest2host(struct vmctx *ctx, uintptr_t gaddr, size_t len) { - if (gaddr < lomem_sz && gaddr + len <= lomem_sz) - return ((void *)(lomem_addr + gaddr)); - - if (gaddr >= 4*GB) { - gaddr -= 4*GB; - if (gaddr < himem_sz && gaddr + len <= himem_sz) - return ((void *)(himem_addr + gaddr)); - } - - return (NULL); + return (vm_map_gpa(ctx, gaddr, len)); } int @@ -604,6 +588,7 @@ main(int argc, char *argv[]) int max_vcpus; struct vmctx *ctx; uint64_t rip; + size_t memsize; bvmcons = 0; inject_bkpt = 0; @@ -611,8 +596,9 @@ main(int argc, char *argv[]) gdb_port = DEFAULT_GDB_PORT; guest_ncpus = 1; ioapic = 0; + memsize = 256 * MB; - while ((c = getopt(argc, argv, "abehABHIPxp:g:c:z:s:S:n:m:M:")) != -1) { + while ((c = getopt(argc, argv, "abehABHIPxp:g:c:z:s:S:n:m:")) != -1) { switch (c) { case 'a': disable_x2apic = 1; @@ -651,10 +637,7 @@ main(int argc, char *argv[]) pci_parse_slot(optarg, 1); break; case 'm': - lomem_sz = strtoul(optarg, NULL, 0) * MB; - break; - case 'M': - himem_sz = strtoul(optarg, NULL, 0) * MB; + memsize = strtoul(optarg, NULL, 0) * MB; break; case 'H': guest_vmexit_on_hlt = 1; @@ -739,17 +722,10 @@ main(int argc, char *argv[]) exit(1); } - if (lomem_sz != 0) { - lomem_addr = vm_map_memory(ctx, 0, lomem_sz); - if (lomem_addr == (char *) MAP_FAILED) { - lomem_sz = 0; - } else if (himem_sz != 0) { - himem_addr = vm_map_memory(ctx, 4*GB, himem_sz); - if (himem_addr == (char *) MAP_FAILED) { - lomem_sz = 0; - himem_sz = 0; - } - } + err = vm_setup_memory(ctx, memsize, VM_MMAP_ALL); + if (err) { + fprintf(stderr, "Unable to setup memory (%d)\n", err); + exit(1); } init_inout(); Modified: head/usr.sbin/bhyve/bhyverun.h ============================================================================== --- head/usr.sbin/bhyve/bhyverun.h Mon Mar 18 21:29:31 2013 (r248476) +++ head/usr.sbin/bhyve/bhyverun.h Mon Mar 18 22:38:30 2013 (r248477) @@ -41,9 +41,7 @@ extern int guest_tslice; extern int guest_ncpus; extern char *vmname; -extern u_long lomem_sz, himem_sz; - -void *paddr_guest2host(uintptr_t addr, size_t len); +void *paddr_guest2host(struct vmctx *ctx, uintptr_t addr, size_t len); void fbsdrun_addcpu(struct vmctx *ctx, int cpu, uint64_t rip); int fbsdrun_muxed(void); Modified: head/usr.sbin/bhyve/mptbl.c ============================================================================== --- head/usr.sbin/bhyve/mptbl.c Mon Mar 18 21:29:31 2013 (r248476) +++ head/usr.sbin/bhyve/mptbl.c Mon Mar 18 22:38:30 2013 (r248477) @@ -349,7 +349,7 @@ mptable_build(struct vmctx *ctx, int ncp char *curraddr; char *startaddr; - startaddr = paddr_guest2host(MPTABLE_BASE, MPTABLE_MAX_LENGTH); + startaddr = paddr_guest2host(ctx, MPTABLE_BASE, MPTABLE_MAX_LENGTH); if (startaddr == NULL) { printf("mptable requires mapped mem\n"); return (ENOMEM); Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Mon Mar 18 21:29:31 2013 (r248476) +++ head/usr.sbin/bhyve/pci_emul.c Mon Mar 18 22:38:30 2013 (r248477) @@ -86,6 +86,8 @@ static struct lirqinfo { SET_DECLARE(pci_devemu_set, struct pci_devemu); +static uint32_t pci_hole_startaddr; + static uint64_t pci_emul_iobase; static uint64_t pci_emul_membase32; static uint64_t pci_emul_membase64; @@ -93,7 +95,6 @@ static uint64_t pci_emul_membase64; #define PCI_EMUL_IOBASE 0x2000 #define PCI_EMUL_IOLIMIT 0x10000 -#define PCI_EMUL_MEMBASE32 (lomem_sz) #define PCI_EMUL_MEMLIMIT32 0xE0000000 /* 3.5GB */ #define PCI_EMUL_MEMBASE64 0xD000000000UL @@ -870,8 +871,10 @@ init_pci(struct vmctx *ctx) int slot, func; int error; + pci_hole_startaddr = vm_get_lowmem_limit(ctx); + pci_emul_iobase = PCI_EMUL_IOBASE; - pci_emul_membase32 = PCI_EMUL_MEMBASE32; + pci_emul_membase32 = pci_hole_startaddr; pci_emul_membase64 = PCI_EMUL_MEMBASE64; for (slot = 0; slot < MAXSLOTS; slot++) { @@ -904,8 +907,8 @@ init_pci(struct vmctx *ctx) memset(&memp, 0, sizeof(struct mem_range)); memp.name = "PCI hole"; memp.flags = MEM_F_RW; - memp.base = lomem_sz; - memp.size = (4ULL * 1024 * 1024 * 1024) - lomem_sz; + memp.base = pci_hole_startaddr; + memp.size = (4ULL * 1024 * 1024 * 1024) - pci_hole_startaddr; memp.handler = pci_emul_fallback_handler; error = register_mem_fallback(&memp); Modified: head/usr.sbin/bhyve/pci_virtio_block.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_block.c Mon Mar 18 21:29:31 2013 (r248476) +++ head/usr.sbin/bhyve/pci_virtio_block.c Mon Mar 18 22:38:30 2013 (r248477) @@ -141,6 +141,7 @@ struct pci_vtblk_softc { uint16_t msix_table_idx_req; uint16_t msix_table_idx_cfg; }; +#define vtblk_ctx(sc) ((sc)->vbsc_pi->pi_vmctx) /* * Return the size of IO BAR that maps virtio header and device specific @@ -227,13 +228,14 @@ pci_vtblk_proc(struct pci_vtblk_softc *s assert(nsegs >= 3); assert(nsegs < VTBLK_MAXSEGS + 2); - vid = paddr_guest2host(vd->vd_addr, vd->vd_len); + vid = paddr_guest2host(vtblk_ctx(sc), vd->vd_addr, vd->vd_len); assert((vid->vd_flags & VRING_DESC_F_INDIRECT) == 0); /* * The first descriptor will be the read-only fixed header */ - vbh = paddr_guest2host(vid[0].vd_addr, sizeof(struct virtio_blk_hdr)); + vbh = paddr_guest2host(vtblk_ctx(sc), vid[0].vd_addr, + sizeof(struct virtio_blk_hdr)); assert(vid[0].vd_len == sizeof(struct virtio_blk_hdr)); assert(vid[0].vd_flags & VRING_DESC_F_NEXT); assert((vid[0].vd_flags & VRING_DESC_F_WRITE) == 0); @@ -252,8 +254,8 @@ pci_vtblk_proc(struct pci_vtblk_softc *s * Build up the iovec based on the guest's data descriptors */ for (i = 1, iolen = 0; i < nsegs - 1; i++) { - iov[i-1].iov_base = paddr_guest2host(vid[i].vd_addr, - vid[i].vd_len); + iov[i-1].iov_base = paddr_guest2host(vtblk_ctx(sc), + vid[i].vd_addr, vid[i].vd_len); iov[i-1].iov_len = vid[i].vd_len; iolen += vid[i].vd_len; @@ -271,7 +273,7 @@ pci_vtblk_proc(struct pci_vtblk_softc *s } /* Lastly, get the address of the status byte */ - status = paddr_guest2host(vid[nsegs - 1].vd_addr, 1); + status = paddr_guest2host(vtblk_ctx(sc), vid[nsegs - 1].vd_addr, 1); assert(vid[nsegs - 1].vd_len == 1); assert((vid[nsegs - 1].vd_flags & VRING_DESC_F_NEXT) == 0); assert(vid[nsegs - 1].vd_flags & VRING_DESC_F_WRITE); @@ -347,7 +349,7 @@ pci_vtblk_ring_init(struct pci_vtblk_sof hq = &sc->vbsc_q; hq->hq_size = VTBLK_RINGSZ; - hq->hq_dtable = paddr_guest2host(pfn << VRING_PFN, + hq->hq_dtable = paddr_guest2host(vtblk_ctx(sc), pfn << VRING_PFN, vring_size(VTBLK_RINGSZ)); hq->hq_avail_flags = (uint16_t *)(hq->hq_dtable + hq->hq_size); hq->hq_avail_idx = hq->hq_avail_flags + 1; Modified: head/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_net.c Mon Mar 18 21:29:31 2013 (r248476) +++ head/usr.sbin/bhyve/pci_virtio_net.c Mon Mar 18 22:38:30 2013 (r248477) @@ -148,6 +148,7 @@ struct pci_vtnet_softc { struct vring_hqueue vsc_hq[VTNET_MAXQ]; uint16_t vsc_msix_table_idx[VTNET_MAXQ]; }; +#define vtnet_ctx(sc) ((sc)->vsc_pi->pi_vmctx) /* * Return the size of IO BAR that maps virtio header and device specific @@ -331,7 +332,7 @@ pci_vtnet_tap_rx(struct pci_vtnet_softc * Get a pointer to the rx header, and use the * data immediately following it for the packet buffer. */ - vrx = paddr_guest2host(vd->vd_addr, vd->vd_len); + vrx = paddr_guest2host(vtnet_ctx(sc), vd->vd_addr, vd->vd_len); buf = (uint8_t *)(vrx + 1); len = read(sc->vsc_tapfd, buf, @@ -439,7 +440,8 @@ pci_vtnet_proctx(struct pci_vtnet_softc for (i = 0, plen = 0; i < VTNET_MAXSEGS; i++, vd = &hq->hq_dtable[vd->vd_next]) { - iov[i].iov_base = paddr_guest2host(vd->vd_addr, vd->vd_len); + iov[i].iov_base = paddr_guest2host(vtnet_ctx(sc), + vd->vd_addr, vd->vd_len); iov[i].iov_len = vd->vd_len; plen += vd->vd_len; tlen += vd->vd_len; @@ -522,7 +524,7 @@ pci_vtnet_ring_init(struct pci_vtnet_sof hq = &sc->vsc_hq[qnum]; hq->hq_size = pci_vtnet_qsize(qnum); - hq->hq_dtable = paddr_guest2host(pfn << VRING_PFN, + hq->hq_dtable = paddr_guest2host(vtnet_ctx(sc), pfn << VRING_PFN, vring_size(hq->hq_size)); hq->hq_avail_flags = (uint16_t *)(hq->hq_dtable + hq->hq_size); hq->hq_avail_idx = hq->hq_avail_flags + 1; Modified: head/usr.sbin/bhyvectl/bhyvectl.c ============================================================================== --- head/usr.sbin/bhyvectl/bhyvectl.c Mon Mar 18 21:29:31 2013 (r248476) +++ head/usr.sbin/bhyvectl/bhyvectl.c Mon Mar 18 22:38:30 2013 (r248477) @@ -186,9 +186,8 @@ usage(void) " [--set-x2apic-state=]\n" " [--get-x2apic-state]\n" " [--unassign-pptdev=]\n" - " [--set-lowmem=]\n" + " [--set-mem=]\n" " [--get-lowmem]\n" - " [--set-highmem=]\n" " [--get-highmem]\n", progname); exit(1); @@ -197,7 +196,7 @@ usage(void) static int get_stats, getcap, setcap, capval; static const char *capname; static int create, destroy, get_lowmem, get_highmem; -static uint64_t lowmem, highmem; +static uint64_t memsize; static int set_cr0, get_cr0, set_cr3, get_cr3, set_cr4, get_cr4; static int set_efer, get_efer; static int set_dr7, get_dr7; @@ -351,8 +350,7 @@ vm_set_vmcs_field(struct vmctx *ctx, int enum { VMNAME = 1000, /* avoid collision with return values from getopt */ VCPU, - SET_LOWMEM, - SET_HIGHMEM, + SET_MEM, SET_EFER, SET_CR0, SET_CR3, @@ -400,8 +398,7 @@ main(int argc, char *argv[]) struct option opts[] = { { "vm", REQ_ARG, 0, VMNAME }, { "cpu", REQ_ARG, 0, VCPU }, - { "set-lowmem", REQ_ARG, 0, SET_LOWMEM }, - { "set-highmem",REQ_ARG, 0, SET_HIGHMEM }, + { "set-mem", REQ_ARG, 0, SET_MEM }, { "set-efer", REQ_ARG, 0, SET_EFER }, { "set-cr0", REQ_ARG, 0, SET_CR0 }, { "set-cr3", REQ_ARG, 0, SET_CR3 }, @@ -572,13 +569,9 @@ main(int argc, char *argv[]) case VCPU: vcpu = atoi(optarg); break; - case SET_LOWMEM: - lowmem = atoi(optarg) * MB; - lowmem = roundup(lowmem, 2 * MB); - break; - case SET_HIGHMEM: - highmem = atoi(optarg) * MB; - highmem = roundup(highmem, 2 * MB); + case SET_MEM: + memsize = atoi(optarg) * MB; + memsize = roundup(memsize, 2 * MB); break; case SET_EFER: efer = strtoul(optarg, NULL, 0); @@ -702,11 +695,8 @@ main(int argc, char *argv[]) error = -1; } - if (!error && lowmem) - error = vm_setup_memory(ctx, 0, lowmem, NULL); - - if (!error && highmem) - error = vm_setup_memory(ctx, 4 * GB, highmem, NULL); + if (!error && memsize) + error = vm_setup_memory(ctx, memsize, VM_MMAP_NONE); if (!error && set_efer) error = vm_set_register(ctx, vcpu, VM_REG_GUEST_EFER, efer); Modified: head/usr.sbin/bhyveload/bhyveload.8 ============================================================================== --- head/usr.sbin/bhyveload/bhyveload.8 Mon Mar 18 21:29:31 2013 (r248476) +++ head/usr.sbin/bhyveload/bhyveload.8 Mon Mar 18 22:38:30 2013 (r248477) @@ -35,8 +35,7 @@ guest inside a bhyve virtual machine .Sh SYNOPSIS .Nm -.Op Fl m Ar lowmem -.Op Fl M Ar highmem +.Op Fl m Ar mem-size .Op Fl d Ar disk-path .Op Fl h Ar host-path .Ar vmname @@ -61,22 +60,13 @@ and will be created if it does not alrea .Sh OPTIONS The following options are available: .Bl -tag -width indent -.It Fl m Ar lowmem -.Ar lowmem -is the amount of memory allocated below 4GB in the guest's physical address -space. +.It Fl m Ar mem-size +.Ar mem-size +is the amount of memory allocated to the guest in units of megabytes. .Pp The default value of -.Ar lowmem -is 256MB. -.It Fl M Ar highmem -.Ar highmem -is the amount of memory allocated above 4GB in the guest's physical address -space. -.Pp -The default value of -.Ar highmem -is 0MB. +.Ar mem-size +is 256. .It Fl d Ar disk-path The .Ar disk-path @@ -93,16 +83,8 @@ that boots off the ISO image .Pa /freebsd/release.iso and has 1GB memory allocated to it: .Pp -.Dl "bhyveload -m 256 -M 768 -d /freebsd/release.iso freebsd-vm" +.Dl "bhyveload -m 1024 -d /freebsd/release.iso freebsd-vm" .Pp -In the example above the 1GB allocation is split in two segments: -.Pp -.Bl -dash -compact -.It -256MB below the 4GB boundary (0MB - 256MB) -.It -768MB above the 4GB boundary (4096MB - 4864MB) -.El .Sh SEE ALSO .Xr bhyve 4 , .Xr bhyve 8 , Modified: head/usr.sbin/bhyveload/bhyveload.c ============================================================================== --- head/usr.sbin/bhyveload/bhyveload.c Mon Mar 18 21:29:31 2013 (r248476) +++ head/usr.sbin/bhyveload/bhyveload.c Mon Mar 18 22:38:30 2013 (r248477) @@ -88,8 +88,7 @@ static char *host_base = "/"; static struct termios term, oldterm; static int disk_fd = -1; -static char *vmname, *progname, *membase; -static uint64_t lowmem, highmem; +static char *vmname, *progname; static struct vmctx *ctx; static uint64_t gdtbase, cr3, rsp; @@ -323,30 +322,30 @@ cb_diskioctl(void *arg, int unit, u_long static int cb_copyin(void *arg, const void *from, uint64_t to, size_t size) { + char *ptr; to &= 0x7fffffff; - if (to > lowmem) - return (EFAULT); - if (to + size > lowmem) - size = lowmem - to; - memcpy(&membase[to], from, size); + ptr = vm_map_gpa(ctx, to, size); + if (ptr == NULL) + return (EFAULT); + memcpy(ptr, from, size); return (0); } static int cb_copyout(void *arg, uint64_t from, void *to, size_t size) { + char *ptr; from &= 0x7fffffff; - if (from > lowmem) - return (EFAULT); - if (from + size > lowmem) - size = lowmem - from; - memcpy(to, &membase[from], size); + ptr = vm_map_gpa(ctx, from, size); + if (ptr == NULL) + return (EFAULT); + memcpy(to, ptr, size); return (0); } @@ -493,8 +492,8 @@ static void cb_getmem(void *arg, uint64_t *ret_lowmem, uint64_t *ret_highmem) { - *ret_lowmem = lowmem; - *ret_highmem = highmem; + vm_get_memory_seg(ctx, 0, ret_lowmem); + vm_get_memory_seg(ctx, 4 * GB, ret_highmem); } static const char * @@ -551,9 +550,9 @@ static void usage(void) { - printf("usage: %s [-d ] [-h ] " - "[-m ][-M ] " - "\n", progname); + fprintf(stderr, + "usage: %s [-m mem-size][-d ] [-h ] " + "\n", progname); exit(1); } @@ -562,16 +561,16 @@ main(int argc, char** argv) { void *h; void (*func)(struct loader_callbacks *, void *, int, int); + uint64_t mem_size; int opt, error; char *disk_image; progname = argv[0]; - lowmem = 128 * MB; - highmem = 0; + mem_size = 256 * MB; disk_image = NULL; - while ((opt = getopt(argc, argv, "d:h:m:M:")) != -1) { + while ((opt = getopt(argc, argv, "d:h:m:")) != -1) { switch (opt) { case 'd': disk_image = optarg; @@ -582,13 +581,9 @@ main(int argc, char** argv) break; case 'm': - lowmem = strtoul(optarg, NULL, 0) * MB; + mem_size = strtoul(optarg, NULL, 0) * MB; break; - case 'M': - highmem = strtoul(optarg, NULL, 0) * MB; - break; - case '?': usage(); } @@ -615,20 +610,12 @@ main(int argc, char** argv) exit(1); } - error = vm_setup_memory(ctx, 0, lowmem, &membase); + error = vm_setup_memory(ctx, mem_size, VM_MMAP_ALL); if (error) { - perror("vm_setup_memory(lowmem)"); + perror("vm_setup_memory"); exit(1); } - if (highmem != 0) { - error = vm_setup_memory(ctx, 4 * GB, highmem, NULL); - if (error) { - perror("vm_setup_memory(highmem)"); - exit(1); - } - } - tcgetattr(0, &term); oldterm = term; term.c_lflag &= ~(ICANON|ECHO); From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 23:22:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5D04CD44; Mon, 18 Mar 2013 23:22:48 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3FDFE33C; Mon, 18 Mar 2013 23:22:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2INMm9r039103; Mon, 18 Mar 2013 23:22:48 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2INMl1G039099; Mon, 18 Mar 2013 23:22:47 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201303182322.r2INMl1G039099@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 18 Mar 2013 23:22:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248478 - in head: share/man/man4 sys/dev/atkbdc sys/sys usr.sbin/moused X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 23:22:48 -0000 Author: jkim Date: Mon Mar 18 23:22:47 2013 New Revision: 248478 URL: http://svnweb.freebsd.org/changeset/base/248478 Log: Add preliminary support for IBM/Lenovo TrackPoint. PR: kern/147237 (based on the initial patch for 8.x) Tested by: glebius (device detection and suspend/resume) MFC after: 1 month Modified: head/share/man/man4/psm.4 head/sys/dev/atkbdc/psm.c head/sys/sys/mouse.h head/usr.sbin/moused/moused.c Modified: head/share/man/man4/psm.4 ============================================================================== --- head/share/man/man4/psm.4 Mon Mar 18 22:38:30 2013 (r248477) +++ head/share/man/man4/psm.4 Mon Mar 18 23:22:47 2013 (r248478) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2012 +.Dd March 18, 2013 .Dt PSM 4 .Os .Sh NAME @@ -339,6 +339,12 @@ at boot-time. This will enable .Nm to handle packets from guest devices (sticks) and extra buttons. +Similarly, extended support for IBM/Lenovo TrackPoint can be enabled +by setting +.Va hw.psm.trackpoint_support +to +.Em 1 +at boot-time. .Pp Tap and drag gestures can be disabled by setting .Va hw.psm.tap_enabled @@ -832,8 +838,8 @@ In contrast, some pad products, e.g.\& s and Interlink VersaPad, treat the tapping action as fourth button events. .Pp -It is reported that ALPS GlidePoint, Synaptics Touchpad, and -Interlink VersaPad require +It is reported that ALPS GlidePoint, Synaptics Touchpad, IBM/Lenovo +TrackPoint, and Interlink VersaPad require .Em INITAFTERSUSPEND flag in order to recover from suspended state. This flag is automatically set when one of these devices is detected by the Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Mon Mar 18 22:38:30 2013 (r248477) +++ head/sys/dev/atkbdc/psm.c Mon Mar 18 23:22:47 2013 (r248478) @@ -260,6 +260,38 @@ typedef struct synapticsaction { int in_vscroll; } synapticsaction_t; +enum { + TRACKPOINT_SYSCTL_SENSITIVITY, + TRACKPOINT_SYSCTL_NEGATIVE_INERTIA, + TRACKPOINT_SYSCTL_UPPER_PLATEAU, + TRACKPOINT_SYSCTL_BACKUP_RANGE, + TRACKPOINT_SYSCTL_DRAG_HYSTERESIS, + TRACKPOINT_SYSCTL_MINIMUM_DRAG, + TRACKPOINT_SYSCTL_UP_THRESHOLD, + TRACKPOINT_SYSCTL_THRESHOLD, + TRACKPOINT_SYSCTL_JENKS_CURVATURE, + TRACKPOINT_SYSCTL_Z_TIME, + TRACKPOINT_SYSCTL_PRESS_TO_SELECT, + TRACKPOINT_SYSCTL_SKIP_BACKUPS +}; + +typedef struct trackpointinfo { + struct sysctl_ctx_list sysctl_ctx; + struct sysctl_oid *sysctl_tree; + int sensitivity; + int inertia; + int uplateau; + int reach; + int draghys; + int mindrag; + int upthresh; + int threshold; + int jenks; + int ztime; + int pts; + int skipback; +} trackpointinfo_t; + /* driver control block */ struct psm_softc { /* Driver status information */ int unit; @@ -274,6 +306,8 @@ struct psm_softc { /* Driver status inf synapticshw_t synhw; /* Synaptics hardware information */ synapticsinfo_t syninfo; /* Synaptics configuration */ synapticsaction_t synaction; /* Synaptics action context */ + int tphw; /* TrackPoint hardware information */ + trackpointinfo_t tpinfo; /* TrackPoint configuration */ mousemode_t mode; /* operation mode */ mousemode_t dflt_mode; /* default operation mode */ mousestatus_t status; /* accumulated mouse movement */ @@ -344,6 +378,9 @@ TUNABLE_INT("hw.psm.tap_enabled", &tap_e static int synaptics_support = 0; TUNABLE_INT("hw.psm.synaptics_support", &synaptics_support); +static int trackpoint_support = 0; +TUNABLE_INT("hw.psm.trackpoint_support", &trackpoint_support); + static int verbose = PSM_DEBUG; TUNABLE_INT("debug.psm.loglevel", &verbose); @@ -432,6 +469,7 @@ static probefunc_t enable_4dmouse; static probefunc_t enable_4dplus; static probefunc_t enable_mmanplus; static probefunc_t enable_synaptics; +static probefunc_t enable_trackpoint; static probefunc_t enable_versapad; static struct { @@ -466,6 +504,8 @@ static struct { 0x80, MOUSE_PS2_PACKETSIZE, enable_kmouse }, { MOUSE_MODEL_VERSAPAD, /* Interlink electronics VersaPad */ 0xe8, MOUSE_PS2VERSA_PACKETSIZE, enable_versapad }, + { MOUSE_MODEL_TRACKPOINT, /* IBM/Lenovo TrackPoint */ + 0xc0, MOUSE_PS2_PACKETSIZE, enable_trackpoint }, { MOUSE_MODEL_GENERIC, 0xc0, MOUSE_PS2_PACKETSIZE, NULL }, }; @@ -708,6 +748,7 @@ model_name(int model) { MOUSE_MODEL_4DPLUS, "4D+ Mouse" }, { MOUSE_MODEL_SYNAPTICS, "Synaptics Touchpad" }, { MOUSE_MODEL_GENERIC, "Generic PS/2 mouse" }, + { MOUSE_MODEL_TRACKPOINT, "IBM/Lenovo TrackPoint" }, { MOUSE_MODEL_UNKNOWN, "Unknown" }, }; int i; @@ -1452,7 +1493,7 @@ psmattach(device_t dev) sc->config |= PSM_CONFIG_INITAFTERSUSPEND; break; default: - if (sc->synhw.infoMajor >= 4) + if (sc->synhw.infoMajor >= 4 || sc->tphw > 0) sc->config |= PSM_CONFIG_INITAFTERSUSPEND; break; } @@ -3442,6 +3483,7 @@ psmsoftintr(void *arg) goto next; break; + case MOUSE_MODEL_TRACKPOINT: case MOUSE_MODEL_GENERIC: default: break; @@ -4474,6 +4516,233 @@ enable_synaptics(KBDC kbdc, struct psm_s return (TRUE); } +/* IBM/Lenovo TrackPoint */ +static int +trackpoint_command(KBDC kbdc, int cmd, int loc, int val) +{ + const int seq[] = { 0xe2, cmd, loc, val }; + int i; + + for (i = 0; i < nitems(seq); i++) + if (send_aux_command(kbdc, seq[i]) != PSM_ACK) + return (EIO); + return (0); +} + +#define PSM_TPINFO(x) offsetof(struct psm_softc, tpinfo.x) +#define TPMASK 0 +#define TPLOC 1 +#define TPINFO 2 + +static int +trackpoint_sysctl(SYSCTL_HANDLER_ARGS) +{ + static const int data[][3] = { + { 0x00, 0x4a, PSM_TPINFO(sensitivity) }, + { 0x00, 0x4d, PSM_TPINFO(inertia) }, + { 0x00, 0x60, PSM_TPINFO(uplateau) }, + { 0x00, 0x57, PSM_TPINFO(reach) }, + { 0x00, 0x58, PSM_TPINFO(draghys) }, + { 0x00, 0x59, PSM_TPINFO(mindrag) }, + { 0x00, 0x5a, PSM_TPINFO(upthresh) }, + { 0x00, 0x5c, PSM_TPINFO(threshold) }, + { 0x00, 0x5d, PSM_TPINFO(jenks) }, + { 0x00, 0x5e, PSM_TPINFO(ztime) }, + { 0x01, 0x2c, PSM_TPINFO(pts) }, + { 0x08, 0x2d, PSM_TPINFO(skipback) } + }; + struct psm_softc *sc; + int error, newval, *oldvalp; + const int *tp; + + if (arg1 == NULL || arg2 < 0 || arg2 >= nitems(data)) + return (EINVAL); + sc = arg1; + tp = data[arg2]; + oldvalp = (int *)((intptr_t)sc + tp[TPINFO]); + newval = *oldvalp; + error = sysctl_handle_int(oidp, &newval, 0, req); + if (error != 0) + return (error); + if (newval == *oldvalp) + return (0); + if (newval < 0 || newval > (tp[TPMASK] == 0 ? 255 : 1)) + return (EINVAL); + error = trackpoint_command(sc->kbdc, tp[TPMASK] == 0 ? 0x81 : 0x47, + tp[TPLOC], tp[TPMASK] == 0 ? newval : tp[TPMASK]); + if (error != 0) + return (error); + *oldvalp = newval; + + return (0); +} + +static void +trackpoint_sysctl_create_tree(struct psm_softc *sc) +{ + + if (sc->tpinfo.sysctl_tree != NULL) + return; + + /* Attach extra trackpoint sysctl nodes under hw.psm.trackpoint */ + sysctl_ctx_init(&sc->tpinfo.sysctl_ctx); + sc->tpinfo.sysctl_tree = SYSCTL_ADD_NODE(&sc->tpinfo.sysctl_ctx, + SYSCTL_STATIC_CHILDREN(_hw_psm), OID_AUTO, "trackpoint", CTLFLAG_RD, + 0, "IBM/Lenovo TrackPoint"); + + /* hw.psm.trackpoint.sensitivity */ + sc->tpinfo.sensitivity = 0x64; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "sensitivity", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_SENSITIVITY, + trackpoint_sysctl, "I", + "Sensitivity"); + + /* hw.psm.trackpoint.negative_inertia */ + sc->tpinfo.inertia = 0x06; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "negative_inertia", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_NEGATIVE_INERTIA, + trackpoint_sysctl, "I", + "Negative inertia factor"); + + /* hw.psm.trackpoint.upper_plateau */ + sc->tpinfo.uplateau = 0x61; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "upper_plateau", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_UPPER_PLATEAU, + trackpoint_sysctl, "I", + "Transfer function upper plateau speed"); + + /* hw.psm.trackpoint.backup_range */ + sc->tpinfo.reach = 0x0a; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "backup_range", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_BACKUP_RANGE, + trackpoint_sysctl, "I", + "Backup range"); + + /* hw.psm.trackpoint.drag_hysteresis */ + sc->tpinfo.draghys = 0xff; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "drag_hysteresis", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_DRAG_HYSTERESIS, + trackpoint_sysctl, "I", + "Drag hysteresis"); + + /* hw.psm.trackpoint.minimum_drag */ + sc->tpinfo.mindrag = 0x14; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "minimum_drag", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_MINIMUM_DRAG, + trackpoint_sysctl, "I", + "Minimum drag"); + + /* hw.psm.trackpoint.up_threshold */ + sc->tpinfo.upthresh = 0xff; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "up_threshold", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_UP_THRESHOLD, + trackpoint_sysctl, "I", + "Up threshold for release"); + + /* hw.psm.trackpoint.threshold */ + sc->tpinfo.threshold = 0x08; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "threshold", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_THRESHOLD, + trackpoint_sysctl, "I", + "Threshold"); + + /* hw.psm.trackpoint.jenks_curvature */ + sc->tpinfo.jenks = 0x87; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "jenks_curvature", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_JENKS_CURVATURE, + trackpoint_sysctl, "I", + "Jenks curvature"); + + /* hw.psm.trackpoint.z_time */ + sc->tpinfo.ztime = 0x26; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "z_time", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_Z_TIME, + trackpoint_sysctl, "I", + "Z time constant"); + + /* hw.psm.trackpoint.press_to_select */ + sc->tpinfo.pts = 0x00; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "press_to_select", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_PRESS_TO_SELECT, + trackpoint_sysctl, "I", + "Press to Select"); + + /* hw.psm.trackpoint.skip_backups */ + sc->tpinfo.skipback = 0x00; + SYSCTL_ADD_PROC(&sc->tpinfo.sysctl_ctx, + SYSCTL_CHILDREN(sc->tpinfo.sysctl_tree), OID_AUTO, + "skip_backups", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, + sc, TRACKPOINT_SYSCTL_SKIP_BACKUPS, + trackpoint_sysctl, "I", + "Skip backups from drags"); +} + +static int +enable_trackpoint(KBDC kbdc, struct psm_softc *sc) +{ + int id; + + kbdc = sc->kbdc; + + if (send_aux_command(kbdc, 0xe1) != PSM_ACK || + read_aux_data(kbdc) != 0x01) + return (FALSE); + id = read_aux_data(kbdc); + if (id < 0x01) + return (FALSE); + if (sc != NULL) + sc->tphw = id; + if (!trackpoint_support) + return (FALSE); + + if (sc != NULL) { + /* Create sysctl tree. */ + trackpoint_sysctl_create_tree(sc); + + trackpoint_command(kbdc, 0x81, 0x4a, sc->tpinfo.sensitivity); + trackpoint_command(kbdc, 0x81, 0x4d, sc->tpinfo.inertia); + trackpoint_command(kbdc, 0x81, 0x60, sc->tpinfo.uplateau); + trackpoint_command(kbdc, 0x81, 0x57, sc->tpinfo.reach); + trackpoint_command(kbdc, 0x81, 0x58, sc->tpinfo.draghys); + trackpoint_command(kbdc, 0x81, 0x59, sc->tpinfo.mindrag); + trackpoint_command(kbdc, 0x81, 0x5a, sc->tpinfo.upthresh); + trackpoint_command(kbdc, 0x81, 0x5c, sc->tpinfo.threshold); + trackpoint_command(kbdc, 0x81, 0x5d, sc->tpinfo.jenks); + trackpoint_command(kbdc, 0x81, 0x5e, sc->tpinfo.ztime); + if (sc->tpinfo.pts == 0x01) + trackpoint_command(kbdc, 0x47, 0x2c, 0x01); + if (sc->tpinfo.skipback == 0x01) + trackpoint_command(kbdc, 0x47, 0x2d, 0x08); + + sc->hw.hwid = id; + sc->hw.buttons = 3; + } + + return (TRUE); +} + /* Interlink electronics VersaPad */ static int enable_versapad(KBDC kbdc, struct psm_softc *sc) Modified: head/sys/sys/mouse.h ============================================================================== --- head/sys/sys/mouse.h Mon Mar 18 22:38:30 2013 (r248477) +++ head/sys/sys/mouse.h Mon Mar 18 23:22:47 2013 (r248478) @@ -141,6 +141,7 @@ typedef struct synapticshw { #define MOUSE_MODEL_4D 11 #define MOUSE_MODEL_4DPLUS 12 #define MOUSE_MODEL_SYNAPTICS 13 +#define MOUSE_MODEL_TRACKPOINT 14 typedef struct mousemode { int protocol; /* MOUSE_PROTO_XXX */ Modified: head/usr.sbin/moused/moused.c ============================================================================== --- head/usr.sbin/moused/moused.c Mon Mar 18 22:38:30 2013 (r248477) +++ head/usr.sbin/moused/moused.c Mon Mar 18 23:22:47 2013 (r248478) @@ -245,6 +245,7 @@ static symtab_t rmodels[] = { { "4D Mouse", MOUSE_MODEL_4D, 0 }, { "4D+ Mouse", MOUSE_MODEL_4DPLUS, 0 }, { "Synaptics Touchpad", MOUSE_MODEL_SYNAPTICS, 0 }, + { "TrackPoint", MOUSE_MODEL_TRACKPOINT, 0 }, { "generic", MOUSE_MODEL_GENERIC, 0 }, { NULL, MOUSE_MODEL_UNKNOWN, 0 }, }; From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 23:31:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D6BD9FB7; Mon, 18 Mar 2013 23:31:22 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BF057383; Mon, 18 Mar 2013 23:31:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2INVMYV041985; Mon, 18 Mar 2013 23:31:22 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2INVMhm041984; Mon, 18 Mar 2013 23:31:22 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201303182331.r2INVMhm041984@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 18 Mar 2013 23:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248479 - head/sys/dev/atkbdc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 23:31:22 -0000 Author: jkim Date: Mon Mar 18 23:31:22 2013 New Revision: 248479 URL: http://svnweb.freebsd.org/changeset/base/248479 Log: List TrackPoint device before generic model. Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Mon Mar 18 23:22:47 2013 (r248478) +++ head/sys/dev/atkbdc/psm.c Mon Mar 18 23:31:22 2013 (r248479) @@ -747,8 +747,8 @@ model_name(int model) { MOUSE_MODEL_4D, "4D Mouse" }, { MOUSE_MODEL_4DPLUS, "4D+ Mouse" }, { MOUSE_MODEL_SYNAPTICS, "Synaptics Touchpad" }, - { MOUSE_MODEL_GENERIC, "Generic PS/2 mouse" }, { MOUSE_MODEL_TRACKPOINT, "IBM/Lenovo TrackPoint" }, + { MOUSE_MODEL_GENERIC, "Generic PS/2 mouse" }, { MOUSE_MODEL_UNKNOWN, "Unknown" }, }; int i; From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 23:35:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AA72A1F6; Mon, 18 Mar 2013 23:35:01 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 98EB83CE; Mon, 18 Mar 2013 23:35:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2INZ1p4042565; Mon, 18 Mar 2013 23:35:01 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2INZ1Cx042564; Mon, 18 Mar 2013 23:35:01 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201303182335.r2INZ1Cx042564@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 18 Mar 2013 23:35:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248480 - head/sys/dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 23:35:01 -0000 Author: ray Date: Mon Mar 18 23:35:01 2013 New Revision: 248480 URL: http://svnweb.freebsd.org/changeset/base/248480 Log: Allow simplebus to attach in less strict way, when "simple-bus" listed on not first position of compatible property, so simplebus driver can be generic driver for any bus listed as compatible with "simple-bus". Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/fdt/simplebus.c Modified: head/sys/dev/fdt/simplebus.c ============================================================================== --- head/sys/dev/fdt/simplebus.c Mon Mar 18 23:31:22 2013 (r248479) +++ head/sys/dev/fdt/simplebus.c Mon Mar 18 23:35:01 2013 (r248480) @@ -134,12 +134,12 @@ static int simplebus_probe(device_t dev) { - if (!ofw_bus_is_compatible_strict(dev, "simple-bus")) + if (!ofw_bus_is_compatible(dev, "simple-bus")) return (ENXIO); device_set_desc(dev, "Flattened device tree simple bus"); - return (BUS_PROBE_DEFAULT); + return (BUS_PROBE_GENERIC); } static int From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 23:38:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EF10E454; Mon, 18 Mar 2013 23:38:15 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D00383E3; Mon, 18 Mar 2013 23:38:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2INcFHY043060; Mon, 18 Mar 2013 23:38:15 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2INcFse043059; Mon, 18 Mar 2013 23:38:15 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201303182338.r2INcFse043059@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 18 Mar 2013 23:38:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248481 - head/sys/dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 23:38:16 -0000 Author: ray Date: Mon Mar 18 23:38:15 2013 New Revision: 248481 URL: http://svnweb.freebsd.org/changeset/base/248481 Log: Hide "no default resources for" warning under bootverbose. It's ok to use optional resources. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/fdt/simplebus.c Modified: head/sys/dev/fdt/simplebus.c ============================================================================== --- head/sys/dev/fdt/simplebus.c Mon Mar 18 23:35:01 2013 (r248480) +++ head/sys/dev/fdt/simplebus.c Mon Mar 18 23:38:15 2013 (r248481) @@ -251,8 +251,9 @@ simplebus_alloc_resource(device_t bus, d rle = resource_list_find(&di->di_res, type, *rid); if (rle == NULL) { - device_printf(bus, "no default resources for " - "rid = %d, type = %d\n", *rid, type); + if (bootverbose) + device_printf(bus, "no default resources for " + "rid = %d, type = %d\n", *rid, type); return (NULL); } start = rle->start; From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 23:41:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 033EF5D6; Mon, 18 Mar 2013 23:41:20 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D23BB3F4; Mon, 18 Mar 2013 23:41:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2INfJ62045082; Mon, 18 Mar 2013 23:41:19 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2INfJCt045080; Mon, 18 Mar 2013 23:41:19 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201303182341.r2INfJCt045080@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 18 Mar 2013 23:41:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248482 - head/sys/dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 23:41:20 -0000 Author: ray Date: Mon Mar 18 23:41:19 2013 New Revision: 248482 URL: http://svnweb.freebsd.org/changeset/base/248482 Log: Allow simplebus to attach to another simplebus. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/fdt/simplebus.c Modified: head/sys/dev/fdt/simplebus.c ============================================================================== --- head/sys/dev/fdt/simplebus.c Mon Mar 18 23:38:15 2013 (r248481) +++ head/sys/dev/fdt/simplebus.c Mon Mar 18 23:41:19 2013 (r248482) @@ -129,6 +129,8 @@ static driver_t simplebus_driver = { devclass_t simplebus_devclass; DRIVER_MODULE(simplebus, fdtbus, simplebus_driver, simplebus_devclass, 0, 0); +DRIVER_MODULE(simplebus, simplebus, simplebus_driver, simplebus_devclass, 0, + 0); static int simplebus_probe(device_t dev) From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 23:46:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DFA4F8E9; Mon, 18 Mar 2013 23:46:15 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D202C5FB; Mon, 18 Mar 2013 23:46:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2INkFcS045812; Mon, 18 Mar 2013 23:46:15 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2INkFmL045809; Mon, 18 Mar 2013 23:46:15 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201303182346.r2INkFmL045809@svn.freebsd.org> From: Neel Natu Date: Mon, 18 Mar 2013 23:46:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248484 - in head: etc/mtree share/examples share/examples/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 23:46:15 -0000 Author: neel Date: Mon Mar 18 23:46:14 2013 New Revision: 248484 URL: http://svnweb.freebsd.org/changeset/base/248484 Log: Add bhyve to examples. Requested by: alfred, julian Obtained from: NetApp Added: head/share/examples/bhyve/ head/share/examples/bhyve/vmrun.sh (contents, props changed) Modified: head/etc/mtree/BSD.usr.dist head/share/examples/Makefile Modified: head/etc/mtree/BSD.usr.dist ============================================================================== --- head/etc/mtree/BSD.usr.dist Mon Mar 18 23:46:02 2013 (r248483) +++ head/etc/mtree/BSD.usr.dist Mon Mar 18 23:46:14 2013 (r248484) @@ -217,6 +217,8 @@ .. atf .. + bhyve + .. bootforth .. csh Modified: head/share/examples/Makefile ============================================================================== --- head/share/examples/Makefile Mon Mar 18 23:46:02 2013 (r248483) +++ head/share/examples/Makefile Mon Mar 18 23:46:14 2013 (r248484) @@ -7,6 +7,7 @@ LDIRS= BSD_daemon \ FreeBSD_version \ IPv6 \ + bhyve \ bootforth \ csh \ cvsup \ @@ -42,6 +43,7 @@ XFILES= BSD_daemon/FreeBSD.pfa \ FreeBSD_version/Makefile \ FreeBSD_version/README \ IPv6/USAGE \ + bhyve/vmrun.sh \ bootforth/README \ bootforth/boot.4th \ bootforth/frames.4th \ Added: head/share/examples/bhyve/vmrun.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/bhyve/vmrun.sh Mon Mar 18 23:46:14 2013 (r248484) @@ -0,0 +1,179 @@ +#!/bin/sh +# +# Copyright (c) 2013 NetApp, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +LOADER=/usr/sbin/bhyveload +BHYVECTL=/usr/sbin/bhyvectl +FBSDRUN=/usr/sbin/bhyve + +DEFAULT_MEMSIZE=512 +DEFAULT_CPUS=2 +DEFAULT_TAPDEV=tap0 + +DEFAULT_VIRTIO_DISK="./diskdev" +DEFAULT_ISOFILE="./release.iso" + +usage() { + echo "Usage: vmrun.sh [-hai][-m ][-d ][-I ][-t ] " + echo " -h: display this help message" + echo " -a: force memory mapped local apic access" + echo " -c: number of virtual cpus (default is ${DEFAULT_CPUS})" + echo " -d: virtio diskdev file (default is ${DEFAULT_VIRTIO_DISK})" + echo " -i: force boot of the Installation CDROM image" + echo " -I: Installation CDROM image location (default is ${DEFAULT_ISOFILE})" + echo " -m: memory size in MB (default is ${DEFAULT_MEMSIZE}MB)" + echo " -t: tap device for virtio-net (default is $DEFAULT_TAPDEV)" + echo "" + echo " This script needs to be executed with superuser privileges" + echo "" + exit 1 +} + +if [ `id -u` -ne 0 ]; then + usage +fi + +kldstat -n vmm > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "vmm.ko is not loaded!" + exit 1 +fi + +force_install=0 +isofile=${DEFAULT_ISOFILE} +memsize=${DEFAULT_MEMSIZE} +cpus=${DEFAULT_CPUS} +virtio_diskdev=${DEFAULT_VIRTIO_DISK} +tapdev=${DEFAULT_TAPDEV} +apic_opt="" + +while getopts haic:I:m:d:t: c ; do + case $c in + h) + usage + ;; + a) + apic_opt="-a" + ;; + d) + virtio_diskdev=${OPTARG} + ;; + i) + force_install=1 + ;; + I) + isofile=${OPTARG} + ;; + c) + cpus=${OPTARG} + ;; + m) + memsize=${OPTARG} + ;; + t) + tapdev=${OPTARG} + ;; + \?) + usage + ;; + esac +done + +shift $((${OPTIND} - 1)) + +if [ $# -ne 1 ]; then + usage +fi + +vmname="$1" + +# Create the virtio diskdev file if needed +if [ ! -f ${virtio_diskdev} ]; then + echo "virtio disk device file \"${virtio_diskdev}\" does not exist." + echo "Creating it ..." + truncate -s 8G ${virtio_diskdev} > /dev/null +fi + +if [ ! -r ${virtio_diskdev} ]; then + echo "virtio disk device file \"${virtio_diskdev}\" is not readable" + exit 1 +fi + +if [ ! -w ${virtio_diskdev} ]; then + echo "virtio disk device file \"${virtio_diskdev}\" is not writable" + exit 1 +fi + +echo "Launching virtual machine \"$vmname\" ..." + +while [ 1 ]; do + ${BHYVECTL} --vm=${vmname} --destroy > /dev/null 2>&1 + + file ${virtio_diskdev} | grep ": x86 boot sector" > /dev/null + rc=$? + if [ $rc -ne 0 ]; then + file ${virtio_diskdev} | grep ": Unix Fast File sys" > /dev/null + rc=$? + fi + if [ $rc -ne 0 ]; then + need_install=1 + else + need_install=0 + fi + + if [ $force_install -eq 1 -o $need_install -eq 1 ]; then + if [ ! -r ${isofile} ]; then + echo -n "Installation CDROM image \"${isofile}\" " + echo "is not readable" + exit 1 + fi + BOOTDISK=${isofile} + installer_opt="-s 3:0,virtio-blk,${BOOTDISK}" + else + BOOTDISK=${virtio_diskdev} + installer_opt="" + fi + + ${LOADER} -m ${memsize} -d ${BOOTDISK} ${vmname} + if [ $? -ne 0 ]; then + break + fi + + ${FBSDRUN} -c ${cpus} -m ${memsize} ${apic_opt} -AI -H -P -g 0 \ + -s 0:0,hostbridge \ + -s 1:0,virtio-net,${tapdev} \ + -s 2:0,virtio-blk,${virtio_diskdev} \ + ${installer_opt} \ + -S 31,uart,stdio \ + ${vmname} + if [ $? -ne 0 ]; then + break + fi +done + +exit 99 From owner-svn-src-head@FreeBSD.ORG Mon Mar 18 23:51:40 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2E9EED57; Mon, 18 Mar 2013 23:51:40 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0B04A62B; Mon, 18 Mar 2013 23:51:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2INpdUN048198; Mon, 18 Mar 2013 23:51:39 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2INpdWU048197; Mon, 18 Mar 2013 23:51:39 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201303182351.r2INpdWU048197@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 18 Mar 2013 23:51:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248485 - head/sys/dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 23:51:40 -0000 Author: ray Date: Mon Mar 18 23:51:39 2013 New Revision: 248485 URL: http://svnweb.freebsd.org/changeset/base/248485 Log: Don't hesitate to ask parent to setup IRQ finally. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/fdt/simplebus.c Modified: head/sys/dev/fdt/simplebus.c ============================================================================== --- head/sys/dev/fdt/simplebus.c Mon Mar 18 23:46:14 2013 (r248484) +++ head/sys/dev/fdt/simplebus.c Mon Mar 18 23:51:39 2013 (r248485) @@ -286,9 +286,6 @@ simplebus_setup_intr(device_t bus, devic enum intr_polarity pol; int error, rid; - if (device_get_parent(child) != bus) - return (ECHILD); - di = device_get_ivars(child); if (di == NULL) return (ENXIO); From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 00:39:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D3BA69CF; Tue, 19 Mar 2013 00:39:02 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C658B870; Tue, 19 Mar 2013 00:39:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2J0d2vW061471; Tue, 19 Mar 2013 00:39:02 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2J0d2UT061470; Tue, 19 Mar 2013 00:39:02 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201303190039.r2J0d2UT061470@svn.freebsd.org> From: Justin Hibbits Date: Tue, 19 Mar 2013 00:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248486 - head/sys/modules/dtrace/fbt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 00:39:02 -0000 Author: jhibbits Date: Tue Mar 19 00:39:02 2013 New Revision: 248486 URL: http://svnweb.freebsd.org/changeset/base/248486 Log: Fix the powerpc64 build. MACHINE_CPUARCH is common for powerpc/powerpc64, not MACHINE_ARCH. Modified: head/sys/modules/dtrace/fbt/Makefile Modified: head/sys/modules/dtrace/fbt/Makefile ============================================================================== --- head/sys/modules/dtrace/fbt/Makefile Mon Mar 18 23:51:39 2013 (r248485) +++ head/sys/modules/dtrace/fbt/Makefile Tue Mar 19 00:39:02 2013 (r248486) @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../../../cddl/dev/fbt KMOD= fbt -.if ${MACHINE_ARCH} == "powerpc" +.if ${MACHINE_CPUARCH} == "powerpc" SRCS= fbt_powerpc.c .else SRCS= fbt.c From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 04:42:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 107124A2; Tue, 19 Mar 2013 04:42:05 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ECDDFED; Tue, 19 Mar 2013 04:42:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2J4g4Nk035825; Tue, 19 Mar 2013 04:42:04 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2J4g4Js035824; Tue, 19 Mar 2013 04:42:04 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201303190442.r2J4g4Js035824@svn.freebsd.org> From: Colin Percival Date: Tue, 19 Mar 2013 04:42:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248487 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 04:42:05 -0000 Author: cperciva Date: Tue Mar 19 04:42:04 2013 New Revision: 248487 URL: http://svnweb.freebsd.org/changeset/base/248487 Log: If dumpdev is AUTO but no dump device has been set -- i.e., there is no swap space configured for rc.d/dumpon to designate for dumping -- then exit silently rather than with a > realpath: /dev/dumpdev: No such file or directory error message. An argument could be made that we should print a (more informative) warning message; but given that under the same conditions the rc.d/dumpon script will already print a > No suitable dump device was found warning, it seems that printing an additional > Dump device does not exist. Savecore not run. warning would be superfluous. Modified: head/etc/rc.d/savecore Modified: head/etc/rc.d/savecore ============================================================================== --- head/etc/rc.d/savecore Tue Mar 19 00:39:02 2013 (r248486) +++ head/etc/rc.d/savecore Tue Mar 19 04:42:04 2013 (r248487) @@ -23,6 +23,9 @@ savecore_prestart() return 1 ;; [Aa][Uu][Tt][Oo]) + if [ ! -L /bin/realpath ]; then + return 1 + fi dumpdev=`/bin/realpath /dev/dumpdev` ;; esac From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 05:08:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AB14EAEB; Tue, 19 Mar 2013 05:08:26 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 866EC206; Tue, 19 Mar 2013 05:08:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2J58QsE042809; Tue, 19 Mar 2013 05:08:26 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2J58QH8042808; Tue, 19 Mar 2013 05:08:26 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201303190508.r2J58QH8042808@svn.freebsd.org> From: Colin Percival Date: Tue, 19 Mar 2013 05:08:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248488 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 05:08:26 -0000 Author: cperciva Date: Tue Mar 19 05:08:25 2013 New Revision: 248488 URL: http://svnweb.freebsd.org/changeset/base/248488 Log: Fix typo in previous commit: Exit if */dev/dumpdev* does not exist, not if */bin/realpath* does not exist... Submitted by: markj Pointy hat to: cperciva Modified: head/etc/rc.d/savecore Modified: head/etc/rc.d/savecore ============================================================================== --- head/etc/rc.d/savecore Tue Mar 19 04:42:04 2013 (r248487) +++ head/etc/rc.d/savecore Tue Mar 19 05:08:25 2013 (r248488) @@ -23,7 +23,7 @@ savecore_prestart() return 1 ;; [Aa][Uu][Tt][Oo]) - if [ ! -L /bin/realpath ]; then + if [ ! -L /dev/dumpdev ]; then return 1 fi dumpdev=`/bin/realpath /dev/dumpdev` From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 05:44:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 15521FD; Tue, 19 Mar 2013 05:44:26 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0219B319; Tue, 19 Mar 2013 05:44:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2J5iPKe054072; Tue, 19 Mar 2013 05:44:25 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2J5iP6G054071; Tue, 19 Mar 2013 05:44:25 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201303190544.r2J5iP6G054071@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 19 Mar 2013 05:44:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248489 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 05:44:26 -0000 Author: glebius Date: Tue Mar 19 05:44:25 2013 New Revision: 248489 URL: http://svnweb.freebsd.org/changeset/base/248489 Log: There are actually two different cases when mlock(2) returns ENOMEM. Clarify this, taking text from SUS. Reviewed by: kib Modified: head/lib/libc/sys/mlock.2 Modified: head/lib/libc/sys/mlock.2 ============================================================================== --- head/lib/libc/sys/mlock.2 Tue Mar 19 05:08:25 2013 (r248488) +++ head/lib/libc/sys/mlock.2 Tue Mar 19 05:44:25 2013 (r248489) @@ -28,7 +28,7 @@ .\" @(#)mlock.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd December 25, 2012 +.Dd March 18, 2013 .Dt MLOCK 2 .Os .Sh NAME @@ -138,7 +138,12 @@ is set to 0 and the caller is not the su .It Bq Er EINVAL The address given is not page aligned or the length is negative. .It Bq Er ENOMEM -Some portion of the indicated address range is not allocated. +Some or all of the address range specified by the addr and len +arguments does not correspond to valid mapped pages in the address space +of the process. +.It Bq Er ENOMEM +Locking the pages mapped by the specified range would exceed a limit on +the amount of memory that the process may lock. .El .Sh "SEE ALSO" .Xr fork 2 , From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 05:51:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7294E2D7; Tue, 19 Mar 2013 05:51:48 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 56B48354; Tue, 19 Mar 2013 05:51:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2J5pm3D056621; Tue, 19 Mar 2013 05:51:48 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2J5pm9a056619; Tue, 19 Mar 2013 05:51:48 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201303190551.r2J5pm9a056619@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 19 Mar 2013 05:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248490 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 05:51:48 -0000 Author: ae Date: Tue Mar 19 05:51:47 2013 New Revision: 248490 URL: http://svnweb.freebsd.org/changeset/base/248490 Log: Fix style and comments. Modified: head/sys/net/pfil.c head/sys/net/pfil.h Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Tue Mar 19 05:44:25 2013 (r248489) +++ head/sys/net/pfil.c Tue Mar 19 05:51:47 2013 (r248490) @@ -94,12 +94,13 @@ pfil_run_hooks(struct pfil_head *ph, str /* * pfil_try_rlock() acquires rm reader lock for specified head - * if this is immediately possible, + * if this is immediately possible. */ int pfil_try_rlock(struct pfil_head *ph, struct rm_priotracker *tracker) { - return PFIL_TRY_RLOCK(ph, tracker); + + return (PFIL_TRY_RLOCK(ph, tracker)); } /* @@ -108,6 +109,7 @@ pfil_try_rlock(struct pfil_head *ph, str void pfil_rlock(struct pfil_head *ph, struct rm_priotracker *tracker) { + PFIL_RLOCK(ph, tracker); } @@ -117,6 +119,7 @@ pfil_rlock(struct pfil_head *ph, struct void pfil_runlock(struct pfil_head *ph, struct rm_priotracker *tracker) { + PFIL_RUNLOCK(ph, tracker); } @@ -126,6 +129,7 @@ pfil_runlock(struct pfil_head *ph, struc void pfil_wlock(struct pfil_head *ph) { + PFIL_WLOCK(ph); } @@ -135,16 +139,19 @@ pfil_wlock(struct pfil_head *ph) void pfil_wunlock(struct pfil_head *ph) { + PFIL_WUNLOCK(ph); } /* - * pfil_wowned() releases writer lock for specified head. + * pfil_wowned() returns a non-zero value if the current thread owns + * an exclusive lock. */ int pfil_wowned(struct pfil_head *ph) { - return PFIL_WOWNED(ph); + + return (PFIL_WOWNED(ph)); } /* * pfil_head_register() registers a pfil_head with the packet filter hook Modified: head/sys/net/pfil.h ============================================================================== --- head/sys/net/pfil.h Tue Mar 19 05:44:25 2013 (r248489) +++ head/sys/net/pfil.h Tue Mar 19 05:51:47 2013 (r248490) @@ -123,14 +123,14 @@ struct pfil_head *pfil_head_get(int, u_l if ((p)->flags & PFIL_FLAG_PRIVATE_LOCK) \ PFIL_LOCK_DESTROY_REAL((p)->ph_plock); \ } while (0) -#define PFIL_TRY_RLOCK(p, t) rm_try_rlock((p)->ph_plock, (t)) -#define PFIL_RLOCK(p, t) rm_rlock((p)->ph_plock, (t)) -#define PFIL_WLOCK(p) rm_wlock((p)->ph_plock) -#define PFIL_RUNLOCK(p, t) rm_runlock((p)->ph_plock, (t)) -#define PFIL_WUNLOCK(p) rm_wunlock((p)->ph_plock) -#define PFIL_WOWNED(p) rm_wowned((p)->ph_plock) -#define PFIL_LIST_LOCK() mtx_lock(&pfil_global_lock) -#define PFIL_LIST_UNLOCK() mtx_unlock(&pfil_global_lock) +#define PFIL_TRY_RLOCK(p, t) rm_try_rlock((p)->ph_plock, (t)) +#define PFIL_RLOCK(p, t) rm_rlock((p)->ph_plock, (t)) +#define PFIL_WLOCK(p) rm_wlock((p)->ph_plock) +#define PFIL_RUNLOCK(p, t) rm_runlock((p)->ph_plock, (t)) +#define PFIL_WUNLOCK(p) rm_wunlock((p)->ph_plock) +#define PFIL_WOWNED(p) rm_wowned((p)->ph_plock) +#define PFIL_LIST_LOCK() mtx_lock(&pfil_global_lock) +#define PFIL_LIST_UNLOCK() mtx_unlock(&pfil_global_lock) static __inline struct packet_filter_hook * pfil_hook_get(int dir, struct pfil_head *ph) From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 06:04:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0639159D; Tue, 19 Mar 2013 06:04:18 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D4FCD3E6; Tue, 19 Mar 2013 06:04:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2J64HfR060015; Tue, 19 Mar 2013 06:04:17 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2J64Hng060013; Tue, 19 Mar 2013 06:04:17 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201303190604.r2J64Hng060013@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 19 Mar 2013 06:04:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248491 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 06:04:18 -0000 Author: ae Date: Tue Mar 19 06:04:17 2013 New Revision: 248491 URL: http://svnweb.freebsd.org/changeset/base/248491 Log: Separate the locking macros that are used in the packet flow path from others. This helps easy switch to use pfil(4) lock. Modified: head/sys/netpfil/ipfw/ip_fw2.c head/sys/netpfil/ipfw/ip_fw_private.h Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Tue Mar 19 05:51:47 2013 (r248490) +++ head/sys/netpfil/ipfw/ip_fw2.c Tue Mar 19 06:04:17 2013 (r248491) @@ -1203,9 +1203,9 @@ do { \ args->f_id.dst_port = dst_port = ntohs(dst_port); } - IPFW_RLOCK(chain); + IPFW_PF_RLOCK(chain); if (! V_ipfw_vnet_ready) { /* shutting down, leave NOW. */ - IPFW_RUNLOCK(chain); + IPFW_PF_RUNLOCK(chain); return (IP_FW_PASS); /* accept */ } if (args->rule.slot) { @@ -2459,7 +2459,7 @@ do { \ retval = IP_FW_DENY; printf("ipfw: ouch!, skip past end of rules, denying packet\n"); } - IPFW_RUNLOCK(chain); + IPFW_PF_RUNLOCK(chain); #ifdef __FreeBSD__ if (ucred_cache != NULL) crfree(ucred_cache); Modified: head/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_private.h Tue Mar 19 05:51:47 2013 (r248490) +++ head/sys/netpfil/ipfw/ip_fw_private.h Tue Mar 19 06:04:17 2013 (r248491) @@ -278,10 +278,12 @@ struct sockopt; /* used by tcp_var.h */ #define IPFW_RLOCK_ASSERT(_chain) rw_assert(&(_chain)->rwmtx, RA_RLOCKED) #define IPFW_WLOCK_ASSERT(_chain) rw_assert(&(_chain)->rwmtx, RA_WLOCKED) -#define IPFW_RLOCK(p) rw_rlock(&(p)->rwmtx) -#define IPFW_RUNLOCK(p) rw_runlock(&(p)->rwmtx) -#define IPFW_WLOCK(p) rw_wlock(&(p)->rwmtx) -#define IPFW_WUNLOCK(p) rw_wunlock(&(p)->rwmtx) +#define IPFW_RLOCK(p) rw_rlock(&(p)->rwmtx) +#define IPFW_RUNLOCK(p) rw_runlock(&(p)->rwmtx) +#define IPFW_WLOCK(p) rw_wlock(&(p)->rwmtx) +#define IPFW_WUNLOCK(p) rw_wunlock(&(p)->rwmtx) +#define IPFW_PF_RLOCK(p) IPFW_RLOCK(p) +#define IPFW_PF_RUNLOCK(p) IPFW_RUNLOCK(p) #define IPFW_UH_RLOCK_ASSERT(_chain) rw_assert(&(_chain)->uh_lock, RA_RLOCKED) #define IPFW_UH_WLOCK_ASSERT(_chain) rw_assert(&(_chain)->uh_lock, RA_WLOCKED) From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 07:25:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7016184E; Tue, 19 Mar 2013 07:25:59 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 58EF08E3; Tue, 19 Mar 2013 07:25:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2J7Pxg3084377; Tue, 19 Mar 2013 07:25:59 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2J7PxmG084376; Tue, 19 Mar 2013 07:25:59 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201303190725.r2J7PxmG084376@svn.freebsd.org> From: Joel Dahl Date: Tue, 19 Mar 2013 07:25:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248492 - head/usr.sbin/bhyveload X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 07:25:59 -0000 Author: joel (doc committer) Date: Tue Mar 19 07:25:58 2013 New Revision: 248492 URL: http://svnweb.freebsd.org/changeset/base/248492 Log: mdoc: remove superfluous paragraph macro. Modified: head/usr.sbin/bhyveload/bhyveload.8 Modified: head/usr.sbin/bhyveload/bhyveload.8 ============================================================================== --- head/usr.sbin/bhyveload/bhyveload.8 Tue Mar 19 06:04:17 2013 (r248491) +++ head/usr.sbin/bhyveload/bhyveload.8 Tue Mar 19 07:25:58 2013 (r248492) @@ -84,7 +84,6 @@ that boots off the ISO image and has 1GB memory allocated to it: .Pp .Dl "bhyveload -m 1024 -d /freebsd/release.iso freebsd-vm" -.Pp .Sh SEE ALSO .Xr bhyve 4 , .Xr bhyve 8 , From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 07:47:52 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 83974D31; Tue, 19 Mar 2013 07:47:52 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 766B299F; Tue, 19 Mar 2013 07:47:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2J7lq6O090438; Tue, 19 Mar 2013 07:47:52 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2J7lqfe090437; Tue, 19 Mar 2013 07:47:52 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201303190747.r2J7lqfe090437@svn.freebsd.org> From: Martin Matuska Date: Tue, 19 Mar 2013 07:47:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248493 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 07:47:52 -0000 Author: mm Date: Tue Mar 19 07:47:51 2013 New Revision: 248493 URL: http://svnweb.freebsd.org/changeset/base/248493 Log: Plug memory leak in dsl_check_snap_cb() This was unnoticed because the function is very rarely used. MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c 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 Mar 19 07:25:58 2013 (r248492) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Tue Mar 19 07:47:51 2013 (r248493) @@ -919,7 +919,8 @@ dsl_check_snap_cb(const char *name, void char *dsname; dsname = kmem_asprintf("%s@%s", name, da->snapname); - VERIFY(nvlist_add_boolean(da->nvl, dsname) == 0); + fnvlist_add_boolean(da->nvl, dsname); + kmem_free(dsname, strlen(dsname) + 1); return (0); } From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 08:44:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AE0B63C4; Tue, 19 Mar 2013 08:44:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id 3A463E77; Tue, 19 Mar 2013 08:44:45 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r2J8iiE9075296; Tue, 19 Mar 2013 12:44:44 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r2J8iiNr075295; Tue, 19 Mar 2013 12:44:44 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 19 Mar 2013 12:44:43 +0400 From: Gleb Smirnoff To: Jung-uk Kim Subject: Re: svn commit: r248478 - in head: share/man/man4 sys/dev/atkbdc sys/sys usr.sbin/moused Message-ID: <20130319084443.GS48089@FreeBSD.org> References: <201303182322.r2INMl1G039099@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201303182322.r2INMl1G039099@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 08:44:46 -0000 On Mon, Mar 18, 2013 at 11:22:47PM +0000, Jung-uk Kim wrote: J> Author: jkim J> Date: Mon Mar 18 23:22:47 2013 J> New Revision: 248478 J> URL: http://svnweb.freebsd.org/changeset/base/248478 J> J> Log: J> Add preliminary support for IBM/Lenovo TrackPoint. J> J> PR: kern/147237 (based on the initial patch for 8.x) J> Tested by: glebius (device detection and suspend/resume) J> MFC after: 1 month Thanks, Jung-uk! -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 12:35:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C855523F; Tue, 19 Mar 2013 12:35:34 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B0A93F6E; Tue, 19 Mar 2013 12:35:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JCZXnp078875; Tue, 19 Mar 2013 12:35:33 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JCZXCb078874; Tue, 19 Mar 2013 12:35:33 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201303191235.r2JCZXCb078874@svn.freebsd.org> From: Joel Dahl Date: Tue, 19 Mar 2013 12:35:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248496 - head/sbin/ldconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 12:35:34 -0000 Author: joel (doc committer) Date: Tue Mar 19 12:35:33 2013 New Revision: 248496 URL: http://svnweb.freebsd.org/changeset/base/248496 Log: Remove obsolete objformat information. Submitted by: db Modified: head/sbin/ldconfig/ldconfig.8 Modified: head/sbin/ldconfig/ldconfig.8 ============================================================================== --- head/sbin/ldconfig/ldconfig.8 Tue Mar 19 11:09:15 2013 (r248495) +++ head/sbin/ldconfig/ldconfig.8 Tue Mar 19 12:35:33 2013 (r248496) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 11, 2005 +.Dd March 19, 2013 .Dt LDCONFIG 8 .Os .Sh NAME @@ -162,21 +162,6 @@ In addition to building a set of hints for quick lookup, it also serves to specify the trusted collection of directories from which shared objects can be safely loaded. -.Sh ENVIRONMENT -.Bl -tag -width OBJFORMATxxx -compact -.It Ev OBJFORMAT -Overrides -.Pa /etc/objformat -(see below) to determine whether -.Fl aout -or -.Fl elf -is the default. -If set, its value should be either -.Ql aout -or -.Ql elf . -.El .Sh FILES .Bl -tag -width /var/run/ld-elf.so.hintsxxx -compact .It Pa /var/run/ld.so.hints @@ -196,17 +181,6 @@ invocations with Conventional configuration files containing directory names for invocations with .Fl 32 . -.It Pa /etc/objformat -Determines whether -.Fl aout -or -.Fl elf -is the default. -If present, it must consist of a single line -containing either -.Ql OBJFORMAT=aout -or -.Ql OBJFORMAT=elf . .El .Sh SEE ALSO .Xr ld 1 , From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 12:52:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 08C52B21; Tue, 19 Mar 2013 12:52:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EAA0D10D; Tue, 19 Mar 2013 12:52:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JCqDeq084442; Tue, 19 Mar 2013 12:52:13 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JCqDHr084440; Tue, 19 Mar 2013 12:52:13 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201303191252.r2JCqDHr084440@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 19 Mar 2013 12:52:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248499 - in head/sys/dev/usb: . serial X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 12:52:14 -0000 Author: hselasky Date: Tue Mar 19 12:52:13 2013 New Revision: 248499 URL: http://svnweb.freebsd.org/changeset/base/248499 Log: Add new USB ID. PR: usb/177105 MFC after: 1 week Modified: head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Tue Mar 19 12:51:18 2013 (r248498) +++ head/sys/dev/usb/serial/u3g.c Tue Mar 19 12:52:13 2013 (r248499) @@ -242,6 +242,8 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(DELL, U5730_2, 0), U3G_DEV(DELL, U5730_3, 0), U3G_DEV(DELL, U740, 0), + U3G_DEV(DLINK, DWR510_CD, U3GINIT_SCSIEJECT), + U3G_DEV(DLINK, DWR510, 0), U3G_DEV(DLINK3, DWM652, 0), U3G_DEV(HP, EV2200, 0), U3G_DEV(HP, HS2300, 0), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Mar 19 12:51:18 2013 (r248498) +++ head/sys/dev/usb/usbdevs Tue Mar 19 12:52:13 2013 (r248499) @@ -1516,6 +1516,8 @@ product DLINK DSB650TX3 0x400b 10/100 E product DLINK DSB650TX2 0x4102 10/100 Ethernet product DLINK DSB650 0xabc1 10/100 Ethernet product DLINK DUBH7 0xf103 DUB-H7 USB 2.0 7-Port Hub +product DLINK DWR510_CD 0xa805 DWR-510 CD-ROM Mode +product DLINK DWR510 0x7e12 DWR-510 product DLINK2 DWA120 0x3a0c DWA-120 product DLINK2 DWA120_NF 0x3a0d DWA-120 (no firmware) product DLINK2 DWLG122C1 0x3c03 DWL-G122 c1 From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 13:06:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BC406E0; Tue, 19 Mar 2013 13:06:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8B81B1A0; Tue, 19 Mar 2013 13:06:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JD6Ca9091015; Tue, 19 Mar 2013 13:06:12 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JD6CHj091013; Tue, 19 Mar 2013 13:06:12 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201303191306.r2JD6CHj091013@svn.freebsd.org> From: Ed Maste Date: Tue, 19 Mar 2013 13:06:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248500 - in head/sys: fs/nfsclient nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 13:06:12 -0000 Author: emaste Date: Tue Mar 19 13:06:11 2013 New Revision: 248500 URL: http://svnweb.freebsd.org/changeset/base/248500 Log: Fix remainder calculation when biosize is not a power of 2 In common configurations biosize is a power of two, but is not required to be so. Thanks to markj@ for spotting an additional case beyond my original patch. Reviewed by: rmacklem@ Modified: head/sys/fs/nfsclient/nfs_clbio.c head/sys/nfsclient/nfs_bio.c Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Tue Mar 19 12:52:13 2013 (r248499) +++ head/sys/fs/nfsclient/nfs_clbio.c Tue Mar 19 13:06:11 2013 (r248500) @@ -484,7 +484,7 @@ ncl_bioread(struct vnode *vp, struct uio case VREG: NFSINCRGLOBAL(newnfsstats.biocache_reads); lbn = uio->uio_offset / biosize; - on = uio->uio_offset & (biosize - 1); + on = uio->uio_offset - (lbn * biosize); /* * Start the read ahead(s), as required. @@ -1029,7 +1029,7 @@ flush_and_restart: do { NFSINCRGLOBAL(newnfsstats.biocache_writes); lbn = uio->uio_offset / biosize; - on = uio->uio_offset & (biosize-1); + on = uio->uio_offset - (lbn * biosize); n = MIN((unsigned)(biosize - on), uio->uio_resid); again: /* @@ -1847,7 +1847,7 @@ ncl_meta_setsize(struct vnode *vp, struc */ error = vtruncbuf(vp, cred, nsize, biosize); lbn = nsize / biosize; - bufsize = nsize & (biosize - 1); + bufsize = nsize - (lbn * biosize); bp = nfs_getcacheblk(vp, lbn, bufsize, td); if (!bp) return EINTR; Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Tue Mar 19 12:52:13 2013 (r248499) +++ head/sys/nfsclient/nfs_bio.c Tue Mar 19 13:06:11 2013 (r248500) @@ -475,7 +475,7 @@ nfs_bioread(struct vnode *vp, struct uio case VREG: nfsstats.biocache_reads++; lbn = uio->uio_offset / biosize; - on = uio->uio_offset & (biosize - 1); + on = uio->uio_offset - (lbn * biosize); /* * Start the read ahead(s), as required. @@ -1011,7 +1011,7 @@ flush_and_restart: do { nfsstats.biocache_writes++; lbn = uio->uio_offset / biosize; - on = uio->uio_offset & (biosize-1); + on = uio->uio_offset - (lbn * biosize); n = MIN((unsigned)(biosize - on), uio->uio_resid); again: /* @@ -1781,7 +1781,7 @@ nfs_meta_setsize(struct vnode *vp, struc */ error = vtruncbuf(vp, cred, nsize, biosize); lbn = nsize / biosize; - bufsize = nsize & (biosize - 1); + bufsize = nsize - (lbn * biosize); bp = nfs_getcacheblk(vp, lbn, bufsize, td); if (!bp) return EINTR; From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 13:10:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E41D129A; Tue, 19 Mar 2013 13:10:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CB3A91CE; Tue, 19 Mar 2013 13:10:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JDAETJ091759; Tue, 19 Mar 2013 13:10:14 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JDAEVh091758; Tue, 19 Mar 2013 13:10:14 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191310.r2JDAEVh091758@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 13:10:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248501 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 13:10:15 -0000 Author: kib Date: Tue Mar 19 13:10:14 2013 New Revision: 248501 URL: http://svnweb.freebsd.org/changeset/base/248501 Log: Assert that a ccb passed to cam_periph_mapmem() for XPT_SCSI_IO and XPT_ATA_IO holds virtual buffer address. Sponsored by: The FreeBSD Foundation Tested by: pho Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Tue Mar 19 13:06:11 2013 (r248500) +++ head/sys/cam/cam_periph.c Tue Mar 19 13:10:14 2013 (r248501) @@ -734,6 +734,8 @@ cam_periph_mapmem(union ccb *ccb, struct case XPT_CONT_TARGET_IO: if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE) return(0); + KASSERT((ccb->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR, + ("not VADDR for SCSI_IO %p %x\n", ccb, ccb->ccb_h.flags)); data_ptrs[0] = &ccb->csio.data_ptr; lengths[0] = ccb->csio.dxfer_len; @@ -743,6 +745,8 @@ cam_periph_mapmem(union ccb *ccb, struct case XPT_ATA_IO: if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE) return(0); + KASSERT((ccb->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR, + ("not VADDR for ATA_IO %p %x\n", ccb, ccb->ccb_h.flags)); data_ptrs[0] = &ccb->ataio.data_ptr; lengths[0] = ccb->ataio.dxfer_len; From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 13:13:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7E6EA43C; Tue, 19 Mar 2013 13:13:27 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6F70F1EE; Tue, 19 Mar 2013 13:13:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JDDRiP093918; Tue, 19 Mar 2013 13:13:27 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JDDRgg093916; Tue, 19 Mar 2013 13:13:27 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201303191313.r2JDDRgg093916@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 19 Mar 2013 13:13:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248502 - head/sys/dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 13:13:27 -0000 Author: ray Date: Tue Mar 19 13:13:26 2013 New Revision: 248502 URL: http://svnweb.freebsd.org/changeset/base/248502 Log: Cast "start" to u_long. Temporary fix to unbreak tinderbox. We need here max possible storage or dynamic, depend on size of address cell. Modified: head/sys/dev/fdt/fdt_common.c Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Tue Mar 19 13:10:14 2013 (r248501) +++ head/sys/dev/fdt/fdt_common.c Tue Mar 19 13:13:26 2013 (r248502) @@ -447,8 +447,8 @@ fdt_reg_to_rl(phandle_t node, struct res regptr = reg; for (i = 0; i < tuples; i++) { - rv = fdt_data_to_res(reg, addr_cells, size_cells, &start, - &count); + rv = fdt_data_to_res(reg, addr_cells, size_cells, + (u_long *)&start, &count); if (rv != 0) { resource_list_free(rl); goto out; From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 13:21:40 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 64800A96; Tue, 19 Mar 2013 13:21:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 56A80285; Tue, 19 Mar 2013 13:21:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JDLe6U096973; Tue, 19 Mar 2013 13:21:40 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JDLepK096972; Tue, 19 Mar 2013 13:21:40 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191321.r2JDLepK096972@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 13:21:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248504 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 13:21:40 -0000 Author: kib Date: Tue Mar 19 13:21:39 2013 New Revision: 248504 URL: http://svnweb.freebsd.org/changeset/base/248504 Log: Add a convenience macro bread_gb() to wrap a call to breadn_flags(). Comparing with bread(), it adds an argument to pass the flags to getblk(). Sponsored by: The FreeBSD Foundation Tested by: pho MFC after: 2 weeks Modified: head/sys/sys/buf.h Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Tue Mar 19 13:14:06 2013 (r248503) +++ head/sys/sys/buf.h Tue Mar 19 13:21:39 2013 (r248504) @@ -480,7 +480,10 @@ int buf_dirty_count_severe(void); void bremfree(struct buf *); void bremfreef(struct buf *); /* XXX Force bremfree, only for nfs. */ #define bread(vp, blkno, size, cred, bpp) \ - breadn_flags(vp, blkno, size, 0, 0, 0, cred, 0, bpp) + breadn_flags(vp, blkno, size, NULL, NULL, 0, cred, 0, bpp) +#define bread_gb(vp, blkno, size, cred, gbflags, bpp) \ + breadn_flags(vp, blkno, size, NULL, NULL, 0, cred, \ + gbflags, bpp) #define breadn(vp, blkno, size, rablkno, rabsize, cnt, cred, bpp) \ breadn_flags(vp, blkno, size, rablkno, rabsize, cnt, cred, 0, bpp) int breadn_flags(struct vnode *, daddr_t, int, daddr_t *, int *, int, From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 13:43:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2D766802; Tue, 19 Mar 2013 13:43:56 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1F930715; Tue, 19 Mar 2013 13:43:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JDhu1u003588; Tue, 19 Mar 2013 13:43:56 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JDhtXQ003587; Tue, 19 Mar 2013 13:43:55 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201303191343.r2JDhtXQ003587@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 19 Mar 2013 13:43:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248507 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 13:43:56 -0000 Author: glebius Date: Tue Mar 19 13:43:55 2013 New Revision: 248507 URL: http://svnweb.freebsd.org/changeset/base/248507 Log: iwn(4) doesn't support adhoc mode. PR: misc/177106 Submitted by: Hiren Panchasara Modified: head/share/man/man4/iwn.4 Modified: head/share/man/man4/iwn.4 ============================================================================== --- head/share/man/man4/iwn.4 Tue Mar 19 13:36:19 2013 (r248506) +++ head/share/man/man4/iwn.4 Tue Mar 19 13:43:55 2013 (r248507) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2012 +.Dd March 19, 2013 .Dt IWN 4 .Os .Sh NAME @@ -100,8 +100,7 @@ driver provides support for: .Pp .Nm supports -.Cm station , -.Cm adhoc , +.Cm station and .Cm monitor mode operation. From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 14:13:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6531C36E; Tue, 19 Mar 2013 14:13:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 475D5985; Tue, 19 Mar 2013 14:13:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JEDF7R013054; Tue, 19 Mar 2013 14:13:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JEDDlR013036; Tue, 19 Mar 2013 14:13:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191413.r2JEDDlR013036@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 14:13:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248508 - in head/sys: amd64/amd64 arm/arm geom i386/i386 i386/xen ia64/ia64 kern mips/mips powerpc/aim powerpc/powerpc sparc64/sparc64 sys vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 14:13:15 -0000 Author: kib Date: Tue Mar 19 14:13:12 2013 New Revision: 248508 URL: http://svnweb.freebsd.org/changeset/base/248508 Log: Implement the concept of the unmapped VMIO buffers, i.e. buffers which do not map the b_pages pages into buffer_map KVA. The use of the unmapped buffers eliminate the need to perform TLB shootdown for mapping on the buffer creation and reuse, greatly reducing the amount of IPIs for shootdown on big-SMP machines and eliminating up to 25-30% of the system time on i/o intensive workloads. The unmapped buffer should be explicitely requested by the GB_UNMAPPED flag by the consumer. For unmapped buffer, no KVA reservation is performed at all. The consumer might request unmapped buffer which does have a KVA reserve, to manually map it without recursing into buffer cache and blocking, with the GB_KVAALLOC flag. When the mapped buffer is requested and unmapped buffer already exists, the cache performs an upgrade, possibly reusing the KVA reservation. Unmapped buffer is translated into unmapped bio in g_vfs_strategy(). Unmapped bio carry a pointer to the vm_page_t array, offset and length instead of the data pointer. The provider which processes the bio should explicitely specify a readiness to accept unmapped bio, otherwise g_down geom thread performs the transient upgrade of the bio request by mapping the pages into the new bio_transient_map KVA submap. The bio_transient_map submap claims up to 10% of the buffer map, and the total buffer_map + bio_transient_map KVA usage stays the same. Still, it could be manually tuned by kern.bio_transient_maxcnt tunable, in the units of the transient mappings. Eventually, the bio_transient_map could be removed after all geom classes and drivers can accept unmapped i/o requests. Unmapped support can be turned off by the vfs.unmapped_buf_allowed tunable, disabling which makes the buffer (or cluster) creation requests to ignore GB_UNMAPPED and GB_KVAALLOC flags. Unmapped buffers are only enabled by default on the architectures where pmap_copy_page() was implemented and tested. In the rework, filesystem metadata is not the subject to maxbufspace limit anymore. Since the metadata buffers are always mapped, the buffers still have to fit into the buffer map, which provides a reasonable (but practically unreachable) upper bound on it. The non-metadata buffer allocations, both mapped and unmapped, is accounted against maxbufspace, as before. Effectively, this means that the maxbufspace is forced on mapped and unmapped buffers separately. The pre-patch bufspace limiting code did not worked, because buffer_map fragmentation does not allow the limit to be reached. By Jeff Roberson request, the getnewbuf() function was split into smaller single-purpose functions. Sponsored by: The FreeBSD Foundation Discussed with: jeff (previous version) Tested by: pho, scottl (previous version), jhb, bf MFC after: 2 weeks Modified: head/sys/amd64/amd64/pmap.c head/sys/arm/arm/pmap-v6.c head/sys/arm/arm/pmap.c head/sys/geom/geom.h head/sys/geom/geom_io.c head/sys/geom/geom_vfs.c head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c head/sys/ia64/ia64/pmap.c head/sys/kern/subr_bus_dma.c head/sys/kern/subr_param.c head/sys/kern/vfs_bio.c head/sys/kern/vfs_cluster.c head/sys/mips/mips/pmap.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/powerpc/pmap_dispatch.c head/sys/sparc64/sparc64/pmap.c head/sys/sys/bio.h head/sys/sys/buf.h head/sys/sys/systm.h head/sys/vm/vm.h head/sys/vm/vm_init.c head/sys/vm/vm_kern.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Mar 19 13:43:55 2013 (r248507) +++ head/sys/amd64/amd64/pmap.c Tue Mar 19 14:13:12 2013 (r248508) @@ -4235,6 +4235,8 @@ pmap_copy_page(vm_page_t msrc, vm_page_t pagecopy((void *)src, (void *)dst); } +int unmapped_buf_allowed = 1; + void pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], vm_offset_t b_offset, int xfersize) Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Tue Mar 19 13:43:55 2013 (r248507) +++ head/sys/arm/arm/pmap-v6.c Tue Mar 19 14:13:12 2013 (r248508) @@ -3312,6 +3312,8 @@ pmap_copy_page_generic(vm_paddr_t src, v mtx_unlock(&cmtx); } +int unmapped_buf_allowed = 1; + void pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], vm_offset_t b_offset, int xfersize) Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Tue Mar 19 13:43:55 2013 (r248507) +++ head/sys/arm/arm/pmap.c Tue Mar 19 14:13:12 2013 (r248508) @@ -4428,6 +4428,8 @@ pmap_copy_page(vm_page_t src, vm_page_t #endif } +int unmapped_buf_allowed = 1; + void pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], vm_offset_t b_offset, int xfersize) Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Tue Mar 19 13:43:55 2013 (r248507) +++ head/sys/geom/geom.h Tue Mar 19 14:13:12 2013 (r248508) @@ -205,6 +205,7 @@ struct g_provider { u_int flags; #define G_PF_WITHER 0x2 #define G_PF_ORPHAN 0x4 +#define G_PF_ACCEPT_UNMAPPED 0x8 /* Two fields for the implementing class to use */ void *private; Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Tue Mar 19 13:43:55 2013 (r248507) +++ head/sys/geom/geom_io.c Tue Mar 19 14:13:12 2013 (r248508) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2002 Poul-Henning Kamp * Copyright (c) 2002 Networks Associates Technology, Inc. + * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * * This software was developed for the FreeBSD Project by Poul-Henning Kamp @@ -8,6 +9,9 @@ * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the * DARPA CHATS research program. * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -44,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -51,6 +56,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include +#include +#include static struct g_bioq g_bio_run_down; static struct g_bioq g_bio_run_up; @@ -180,12 +192,17 @@ g_clone_bio(struct bio *bp) /* * BIO_ORDERED flag may be used by disk drivers to enforce * ordering restrictions, so this flag needs to be cloned. + * BIO_UNMAPPED should be inherited, to properly indicate + * which way the buffer is passed. * Other bio flags are not suitable for cloning. */ - bp2->bio_flags = bp->bio_flags & BIO_ORDERED; + bp2->bio_flags = bp->bio_flags & (BIO_ORDERED | BIO_UNMAPPED); bp2->bio_length = bp->bio_length; bp2->bio_offset = bp->bio_offset; bp2->bio_data = bp->bio_data; + bp2->bio_ma = bp->bio_ma; + bp2->bio_ma_n = bp->bio_ma_n; + bp2->bio_ma_offset = bp->bio_ma_offset; bp2->bio_attribute = bp->bio_attribute; /* Inherit classification info from the parent */ bp2->bio_classifier1 = bp->bio_classifier1; @@ -210,11 +227,15 @@ g_duplicate_bio(struct bio *bp) struct bio *bp2; bp2 = uma_zalloc(biozone, M_WAITOK | M_ZERO); + bp2->bio_flags = bp->bio_flags & BIO_UNMAPPED; bp2->bio_parent = bp; bp2->bio_cmd = bp->bio_cmd; bp2->bio_length = bp->bio_length; bp2->bio_offset = bp->bio_offset; bp2->bio_data = bp->bio_data; + bp2->bio_ma = bp->bio_ma; + bp2->bio_ma_n = bp->bio_ma_n; + bp2->bio_ma_offset = bp->bio_ma_offset; bp2->bio_attribute = bp->bio_attribute; bp->bio_children++; #ifdef KTR @@ -575,6 +596,83 @@ g_io_deliver(struct bio *bp, int error) return; } +SYSCTL_DECL(_kern_geom); + +static long transient_maps; +SYSCTL_LONG(_kern_geom, OID_AUTO, transient_maps, CTLFLAG_RD, + &transient_maps, 0, + "Total count of the transient mapping requests"); +u_int transient_map_retries = 10; +SYSCTL_UINT(_kern_geom, OID_AUTO, transient_map_retries, CTLFLAG_RW, + &transient_map_retries, 0, + "Max count of retries used before giving up on creating transient map"); +int transient_map_hard_failures; +SYSCTL_INT(_kern_geom, OID_AUTO, transient_map_hard_failures, CTLFLAG_RD, + &transient_map_hard_failures, 0, + "Failures to establish the transient mapping due to retry attempts " + "exhausted"); +int transient_map_soft_failures; +SYSCTL_INT(_kern_geom, OID_AUTO, transient_map_soft_failures, CTLFLAG_RD, + &transient_map_soft_failures, 0, + "Count of retried failures to establish the transient mapping"); +int inflight_transient_maps; +SYSCTL_INT(_kern_geom, OID_AUTO, inflight_transient_maps, CTLFLAG_RD, + &inflight_transient_maps, 0, + "Current count of the active transient maps"); + +static int +g_io_transient_map_bio(struct bio *bp) +{ + vm_offset_t addr; + long size; + u_int retried; + int rv; + + size = round_page(bp->bio_ma_offset + bp->bio_length); + KASSERT(size / PAGE_SIZE == bp->bio_ma_n, ("Bio too short %p", bp)); + addr = 0; + retried = 0; + atomic_add_long(&transient_maps, 1); +retry: + vm_map_lock(bio_transient_map); + if (vm_map_findspace(bio_transient_map, vm_map_min(bio_transient_map), + size, &addr)) { + vm_map_unlock(bio_transient_map); + if (transient_map_retries != 0 && + retried >= transient_map_retries) { + g_io_deliver(bp, EDEADLK/* XXXKIB */); + CTR2(KTR_GEOM, "g_down cannot map bp %p provider %s", + bp, bp->bio_to->name); + atomic_add_int(&transient_map_hard_failures, 1); + return (1); + } else { + /* + * Naive attempt to quisce the I/O to get more + * in-flight requests completed and defragment + * the bio_transient_map. + */ + CTR3(KTR_GEOM, "g_down retrymap bp %p provider %s r %d", + bp, bp->bio_to->name, retried); + pause("g_d_tra", hz / 10); + retried++; + atomic_add_int(&transient_map_soft_failures, 1); + goto retry; + } + } + rv = vm_map_insert(bio_transient_map, NULL, 0, addr, addr + size, + VM_PROT_RW, VM_PROT_RW, MAP_NOFAULT); + KASSERT(rv == KERN_SUCCESS, + ("vm_map_insert(bio_transient_map) rv %d %jx %lx", + rv, (uintmax_t)addr, size)); + vm_map_unlock(bio_transient_map); + atomic_add_int(&inflight_transient_maps, 1); + pmap_qenter((vm_offset_t)addr, bp->bio_ma, OFF_TO_IDX(size)); + bp->bio_data = (caddr_t)addr + bp->bio_ma_offset; + bp->bio_flags |= BIO_TRANSIENT_MAPPING; + bp->bio_flags &= ~BIO_UNMAPPED; + return (0); +} + void g_io_schedule_down(struct thread *tp __unused) { @@ -636,6 +734,12 @@ g_io_schedule_down(struct thread *tp __u default: break; } + if ((bp->bio_flags & BIO_UNMAPPED) != 0 && + (bp->bio_to->flags & G_PF_ACCEPT_UNMAPPED) == 0 && + (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE)) { + if (g_io_transient_map_bio(bp)) + continue; + } THREAD_NO_SLEEPING(); CTR4(KTR_GEOM, "g_down starting bp %p provider %s off %ld " "len %ld", bp, bp->bio_to->name, bp->bio_offset, Modified: head/sys/geom/geom_vfs.c ============================================================================== --- head/sys/geom/geom_vfs.c Tue Mar 19 13:43:55 2013 (r248507) +++ head/sys/geom/geom_vfs.c Tue Mar 19 14:13:12 2013 (r248508) @@ -188,14 +188,14 @@ g_vfs_strategy(struct bufobj *bo, struct bip = g_alloc_bio(); bip->bio_cmd = bp->b_iocmd; bip->bio_offset = bp->b_iooffset; - bip->bio_data = bp->b_data; - bip->bio_done = g_vfs_done; - bip->bio_caller2 = bp; bip->bio_length = bp->b_bcount; - if (bp->b_flags & B_BARRIER) { + bdata2bio(bp, bip); + if ((bp->b_flags & B_BARRIER) != 0) { bip->bio_flags |= BIO_ORDERED; bp->b_flags &= ~B_BARRIER; } + bip->bio_done = g_vfs_done; + bip->bio_caller2 = bp; g_io_request(bip, cp); } Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Tue Mar 19 13:43:55 2013 (r248507) +++ head/sys/i386/i386/pmap.c Tue Mar 19 14:13:12 2013 (r248508) @@ -4205,6 +4205,8 @@ pmap_copy_page(vm_page_t src, vm_page_t mtx_unlock(&sysmaps->lock); } +int unmapped_buf_allowed = 1; + void pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], vm_offset_t b_offset, int xfersize) Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Tue Mar 19 13:43:55 2013 (r248507) +++ head/sys/i386/xen/pmap.c Tue Mar 19 14:13:12 2013 (r248508) @@ -3448,6 +3448,8 @@ pmap_copy_page(vm_page_t src, vm_page_t mtx_unlock(&sysmaps->lock); } +int unmapped_buf_allowed = 1; + void pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], vm_offset_t b_offset, int xfersize) Modified: head/sys/ia64/ia64/pmap.c ============================================================================== --- head/sys/ia64/ia64/pmap.c Tue Mar 19 13:43:55 2013 (r248507) +++ head/sys/ia64/ia64/pmap.c Tue Mar 19 14:13:12 2013 (r248508) @@ -2014,6 +2014,8 @@ pmap_copy_page(vm_page_t msrc, vm_page_t bcopy(src, dst, PAGE_SIZE); } +int unmapped_buf_allowed; + void pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], vm_offset_t b_offset, int xfersize) Modified: head/sys/kern/subr_bus_dma.c ============================================================================== --- head/sys/kern/subr_bus_dma.c Tue Mar 19 13:43:55 2013 (r248507) +++ head/sys/kern/subr_bus_dma.c Tue Mar 19 14:13:12 2013 (r248508) @@ -126,11 +126,28 @@ static int _bus_dmamap_load_bio(bus_dma_tag_t dmat, bus_dmamap_t map, struct bio *bio, int *nsegs, int flags) { - int error; - - error = _bus_dmamap_load_buffer(dmat, map, bio->bio_data, - bio->bio_bcount, kernel_pmap, flags, NULL, nsegs); + vm_paddr_t paddr; + bus_size_t len, tlen; + int error, i, ma_offs; + + if ((bio->bio_flags & BIO_UNMAPPED) == 0) { + error = _bus_dmamap_load_buffer(dmat, map, bio->bio_data, + bio->bio_bcount, kernel_pmap, flags, NULL, nsegs); + return (error); + } + error = 0; + tlen = bio->bio_bcount; + ma_offs = bio->bio_ma_offset; + for (i = 0; tlen > 0; i++, tlen -= len) { + len = min(PAGE_SIZE - ma_offs, tlen); + paddr = VM_PAGE_TO_PHYS(bio->bio_ma[i]) + ma_offs; + error = _bus_dmamap_load_phys(dmat, map, paddr, len, + flags, NULL, nsegs); + if (error != 0) + break; + ma_offs = 0; + } return (error); } Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Tue Mar 19 13:43:55 2013 (r248507) +++ head/sys/kern/subr_param.c Tue Mar 19 14:13:12 2013 (r248508) @@ -92,6 +92,7 @@ int maxfiles; /* sys. wide open files int maxfilesperproc; /* per-proc open files limit */ int msgbufsize; /* size of kernel message buffer */ int nbuf; +int bio_transient_maxcnt; int ngroups_max; /* max # groups per process */ int nswbuf; pid_t pid_max = PID_MAX; @@ -118,6 +119,9 @@ SYSCTL_LONG(_kern, OID_AUTO, maxswzone, "Maximum memory for swap metadata"); SYSCTL_LONG(_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN, &maxbcache, 0, "Maximum value of vfs.maxbufspace"); +SYSCTL_INT(_kern, OID_AUTO, bio_transient_maxcnt, CTLFLAG_RDTUN, + &bio_transient_maxcnt, 0, + "Maximum number of transient BIOs mappings"); SYSCTL_ULONG(_kern, OID_AUTO, maxtsiz, CTLFLAG_RW | CTLFLAG_TUN, &maxtsiz, 0, "Maximum text size"); SYSCTL_ULONG(_kern, OID_AUTO, dfldsiz, CTLFLAG_RW | CTLFLAG_TUN, &dfldsiz, 0, @@ -266,6 +270,8 @@ init_param1(void) pid_max = PID_MAX; else if (pid_max < 300) pid_max = 300; + + TUNABLE_INT_FETCH("vfs.unmapped_buf_allowed", &unmapped_buf_allowed); } /* @@ -322,6 +328,7 @@ init_param2(long physpages) */ nbuf = NBUF; TUNABLE_INT_FETCH("kern.nbuf", &nbuf); + TUNABLE_INT_FETCH("kern.bio_transient_maxcnt", &bio_transient_maxcnt); /* * The default for maxpipekva is min(1/64 of the kernel address space, Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Mar 19 13:43:55 2013 (r248507) +++ head/sys/kern/vfs_bio.c Tue Mar 19 14:13:12 2013 (r248508) @@ -1,8 +1,12 @@ /*- * Copyright (c) 2004 Poul-Henning Kamp * Copyright (c) 1994,1997 John S. Dyson + * Copyright (c) 2013 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -92,6 +96,7 @@ struct buf_ops buf_ops_bio = { * carnal knowledge of buffers. This knowledge should be moved to vfs_bio.c. */ struct buf *buf; /* buffer header pool */ +caddr_t unmapped_buf; static struct proc *bufdaemonproc; @@ -132,6 +137,10 @@ SYSCTL_PROC(_vfs, OID_AUTO, bufspace, CT SYSCTL_LONG(_vfs, OID_AUTO, bufspace, CTLFLAG_RD, &bufspace, 0, "Virtual memory used for buffers"); #endif +static long unmapped_bufspace; +SYSCTL_LONG(_vfs, OID_AUTO, unmapped_bufspace, CTLFLAG_RD, + &unmapped_bufspace, 0, + "Amount of unmapped buffers, inclusive in the bufspace"); static long maxbufspace; SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0, "Maximum allowed value of bufspace (including buf_daemon)"); @@ -201,6 +210,10 @@ SYSCTL_INT(_vfs, OID_AUTO, getnewbufcall static int getnewbufrestarts; SYSCTL_INT(_vfs, OID_AUTO, getnewbufrestarts, CTLFLAG_RW, &getnewbufrestarts, 0, "Number of times getnewbuf has had to restart a buffer aquisition"); +static int mappingrestarts; +SYSCTL_INT(_vfs, OID_AUTO, mappingrestarts, CTLFLAG_RW, &mappingrestarts, 0, + "Number of times getblk has had to restart a buffer mapping for " + "unmapped buffer"); static int flushbufqtarget = 100; SYSCTL_INT(_vfs, OID_AUTO, flushbufqtarget, CTLFLAG_RW, &flushbufqtarget, 0, "Amount of work to do in flushbufqueues when helping bufdaemon"); @@ -210,6 +223,9 @@ SYSCTL_LONG(_vfs, OID_AUTO, notbufdflash static long barrierwrites; SYSCTL_LONG(_vfs, OID_AUTO, barrierwrites, CTLFLAG_RW, &barrierwrites, 0, "Number of barrier writes"); +SYSCTL_INT(_vfs, OID_AUTO, unmapped_buf_allowed, CTLFLAG_RD, + &unmapped_buf_allowed, 0, + "Permit the use of the unmapped i/o"); /* * Wakeup point for bufdaemon, as well as indicator of whether it is already @@ -281,6 +297,9 @@ static struct mtx nblock; /* Queues for free buffers with various properties */ static TAILQ_HEAD(bqueues, buf) bufqueues[BUFFER_QUEUES] = { { 0 } }; +#ifdef INVARIANTS +static int bq_len[BUFFER_QUEUES]; +#endif /* Lock for the bufqueues */ static struct mtx bqlock; @@ -511,7 +530,7 @@ caddr_t kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est) { int tuned_nbuf; - long maxbuf; + long maxbuf, maxbuf_sz, buf_sz, biotmap_sz; /* * physmem_est is in pages. Convert it to kilobytes (assumes @@ -555,6 +574,52 @@ kern_vfs_bio_buffer_alloc(caddr_t v, lon } /* + * Ideal allocation size for the transient bio submap if 10% + * of the maximal space buffer map. This roughly corresponds + * to the amount of the buffer mapped for typical UFS load. + * + * Clip the buffer map to reserve space for the transient + * BIOs, if its extent is bigger than 90% of the maximum + * buffer map extent on the platform. + * + * The fall-back to the maxbuf in case of maxbcache unset, + * allows to not trim the buffer KVA for the architectures + * with ample KVA space. + */ + if (bio_transient_maxcnt == 0) { + maxbuf_sz = maxbcache != 0 ? maxbcache : maxbuf * BKVASIZE; + buf_sz = (long)nbuf * BKVASIZE; + if (buf_sz < maxbuf_sz / 10 * 9) { + /* + * There is more KVA than memory. Do not + * adjust buffer map size, and assign the rest + * of maxbuf to transient map. + */ + biotmap_sz = maxbuf_sz - buf_sz; + } else { + /* + * Buffer map spans all KVA we could afford on + * this platform. Give 10% of the buffer map + * to the transient bio map. + */ + biotmap_sz = buf_sz / 10; + buf_sz -= biotmap_sz; + } + if (biotmap_sz / INT_MAX > MAXPHYS) + bio_transient_maxcnt = INT_MAX; + else + bio_transient_maxcnt = biotmap_sz / MAXPHYS; + /* + * Artifically limit to 1024 simultaneous in-flight I/Os + * using the transient mapping. + */ + if (bio_transient_maxcnt > 1024) + bio_transient_maxcnt = 1024; + if (tuned_nbuf) + nbuf = buf_sz / BKVASIZE; + } + + /* * swbufs are used as temporary holders for I/O, such as paging I/O. * We have no less then 16 and no more then 256. */ @@ -607,6 +672,9 @@ bufinit(void) LIST_INIT(&bp->b_dep); BUF_LOCKINIT(bp); TAILQ_INSERT_TAIL(&bufqueues[QUEUE_EMPTY], bp, b_freelist); +#ifdef INVARIANTS + bq_len[QUEUE_EMPTY]++; +#endif } /* @@ -675,6 +743,55 @@ bufinit(void) bogus_page = vm_page_alloc(NULL, 0, VM_ALLOC_NOOBJ | VM_ALLOC_NORMAL | VM_ALLOC_WIRED); + unmapped_buf = (caddr_t)kmem_alloc_nofault(kernel_map, MAXPHYS); +} + +#ifdef INVARIANTS +static inline void +vfs_buf_check_mapped(struct buf *bp) +{ + + KASSERT((bp->b_flags & B_UNMAPPED) == 0, + ("mapped buf %p %x", bp, bp->b_flags)); + KASSERT(bp->b_kvabase != unmapped_buf, + ("mapped buf: b_kvabase was not updated %p", bp)); + KASSERT(bp->b_data != unmapped_buf, + ("mapped buf: b_data was not updated %p", bp)); +} + +static inline void +vfs_buf_check_unmapped(struct buf *bp) +{ + + KASSERT((bp->b_flags & B_UNMAPPED) == B_UNMAPPED, + ("unmapped buf %p %x", bp, bp->b_flags)); + KASSERT(bp->b_kvabase == unmapped_buf, + ("unmapped buf: corrupted b_kvabase %p", bp)); + KASSERT(bp->b_data == unmapped_buf, + ("unmapped buf: corrupted b_data %p", bp)); +} + +#define BUF_CHECK_MAPPED(bp) vfs_buf_check_mapped(bp) +#define BUF_CHECK_UNMAPPED(bp) vfs_buf_check_unmapped(bp) +#else +#define BUF_CHECK_MAPPED(bp) do {} while (0) +#define BUF_CHECK_UNMAPPED(bp) do {} while (0) +#endif + +static void +bpmap_qenter(struct buf *bp) +{ + + BUF_CHECK_MAPPED(bp); + + /* + * bp->b_data is relative to bp->b_offset, but + * bp->b_offset may be offset into the first page. + */ + bp->b_data = (caddr_t)trunc_page((vm_offset_t)bp->b_data); + pmap_qenter((vm_offset_t)bp->b_data, bp->b_pages, bp->b_npages); + bp->b_data = (caddr_t)((vm_offset_t)bp->b_data | + (vm_offset_t)(bp->b_offset & PAGE_MASK)); } /* @@ -686,14 +803,26 @@ static void bfreekva(struct buf *bp) { - if (bp->b_kvasize) { - atomic_add_int(&buffreekvacnt, 1); - atomic_subtract_long(&bufspace, bp->b_kvasize); - vm_map_remove(buffer_map, (vm_offset_t) bp->b_kvabase, - (vm_offset_t) bp->b_kvabase + bp->b_kvasize); - bp->b_kvasize = 0; - bufspacewakeup(); + if (bp->b_kvasize == 0) + return; + + atomic_add_int(&buffreekvacnt, 1); + atomic_subtract_long(&bufspace, bp->b_kvasize); + if ((bp->b_flags & B_UNMAPPED) == 0) { + BUF_CHECK_MAPPED(bp); + vm_map_remove(buffer_map, (vm_offset_t)bp->b_kvabase, + (vm_offset_t)bp->b_kvabase + bp->b_kvasize); + } else { + BUF_CHECK_UNMAPPED(bp); + if ((bp->b_flags & B_KVAALLOC) != 0) { + vm_map_remove(buffer_map, (vm_offset_t)bp->b_kvaalloc, + (vm_offset_t)bp->b_kvaalloc + bp->b_kvasize); + } + atomic_subtract_long(&unmapped_bufspace, bp->b_kvasize); + bp->b_flags &= ~(B_UNMAPPED | B_KVAALLOC); } + bp->b_kvasize = 0; + bufspacewakeup(); } /* @@ -760,6 +889,11 @@ bremfreel(struct buf *bp) mtx_assert(&bqlock, MA_OWNED); TAILQ_REMOVE(&bufqueues[bp->b_qindex], bp, b_freelist); +#ifdef INVARIANTS + KASSERT(bq_len[bp->b_qindex] >= 1, ("queue %d underflow", + bp->b_qindex)); + bq_len[bp->b_qindex]--; +#endif bp->b_qindex = QUEUE_NONE; /* * If this was a delayed bremfree() we only need to remove the buffer @@ -1414,7 +1548,8 @@ brelse(struct buf *bp) } } - if ((bp->b_flags & B_INVAL) == 0) { + if ((bp->b_flags & (B_INVAL | B_UNMAPPED)) == 0) { + BUF_CHECK_MAPPED(bp); pmap_qenter( trunc_page((vm_offset_t)bp->b_data), bp->b_pages, bp->b_npages); @@ -1509,11 +1644,17 @@ brelse(struct buf *bp) bp->b_qindex = QUEUE_DIRTY; else bp->b_qindex = QUEUE_CLEAN; - if (bp->b_flags & B_AGE) - TAILQ_INSERT_HEAD(&bufqueues[bp->b_qindex], bp, b_freelist); - else - TAILQ_INSERT_TAIL(&bufqueues[bp->b_qindex], bp, b_freelist); + if (bp->b_flags & B_AGE) { + TAILQ_INSERT_HEAD(&bufqueues[bp->b_qindex], bp, + b_freelist); + } else { + TAILQ_INSERT_TAIL(&bufqueues[bp->b_qindex], bp, + b_freelist); + } } +#ifdef INVARIANTS + bq_len[bp->b_qindex]++; +#endif mtx_unlock(&bqlock); /* @@ -1604,6 +1745,9 @@ bqrelse(struct buf *bp) if (bp->b_flags & B_DELWRI) { bp->b_qindex = QUEUE_DIRTY; TAILQ_INSERT_TAIL(&bufqueues[bp->b_qindex], bp, b_freelist); +#ifdef INVARIANTS + bq_len[bp->b_qindex]++; +#endif } else { /* * The locking of the BO_LOCK for checking of the @@ -1616,6 +1760,9 @@ bqrelse(struct buf *bp) bp->b_qindex = QUEUE_CLEAN; TAILQ_INSERT_TAIL(&bufqueues[QUEUE_CLEAN], bp, b_freelist); +#ifdef INVARIANTS + bq_len[QUEUE_CLEAN]++; +#endif } else { /* * We are too low on memory, we have to try to free @@ -1657,7 +1804,11 @@ vfs_vmio_release(struct buf *bp) int i; vm_page_t m; - pmap_qremove(trunc_page((vm_offset_t)bp->b_data), bp->b_npages); + if ((bp->b_flags & B_UNMAPPED) == 0) { + BUF_CHECK_MAPPED(bp); + pmap_qremove(trunc_page((vm_offset_t)bp->b_data), bp->b_npages); + } else + BUF_CHECK_UNMAPPED(bp); VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); for (i = 0; i < bp->b_npages; i++) { m = bp->b_pages[i]; @@ -1761,8 +1912,10 @@ vfs_bio_awrite(struct buf *bp) int nwritten; int size; int maxcl; + int gbflags; bo = &vp->v_bufobj; + gbflags = (bp->b_flags & B_UNMAPPED) != 0 ? GB_UNMAPPED : 0; /* * right now we support clustered writing only to regular files. If * we find a clusterable block we could be in the middle of a cluster @@ -1794,7 +1947,7 @@ vfs_bio_awrite(struct buf *bp) if (ncl != 1) { BUF_UNLOCK(bp); nwritten = cluster_wbuild(vp, size, lblkno - j, ncl, - 0); + gbflags); return (nwritten); } } @@ -1811,46 +1964,207 @@ vfs_bio_awrite(struct buf *bp) return (nwritten); } +static void +setbufkva(struct buf *bp, vm_offset_t addr, int maxsize, int gbflags) +{ + + KASSERT((bp->b_flags & (B_UNMAPPED | B_KVAALLOC)) == 0 && + bp->b_kvasize == 0, ("call bfreekva(%p)", bp)); + if ((gbflags & GB_UNMAPPED) == 0) { + bp->b_kvabase = (caddr_t)addr; + } else if ((gbflags & GB_KVAALLOC) != 0) { + KASSERT((gbflags & GB_UNMAPPED) != 0, + ("GB_KVAALLOC without GB_UNMAPPED")); + bp->b_kvaalloc = (caddr_t)addr; + bp->b_flags |= B_UNMAPPED | B_KVAALLOC; + atomic_add_long(&unmapped_bufspace, bp->b_kvasize); + } + bp->b_kvasize = maxsize; +} + /* - * getnewbuf: - * - * Find and initialize a new buffer header, freeing up existing buffers - * in the bufqueues as necessary. The new buffer is returned locked. - * - * Important: B_INVAL is not set. If the caller wishes to throw the - * buffer away, the caller must set B_INVAL prior to calling brelse(). - * - * We block if: - * We have insufficient buffer headers - * We have insufficient buffer space - * buffer_map is too fragmented ( space reservation fails ) - * If we have to flush dirty buffers ( but we try to avoid this ) - * - * To avoid VFS layer recursion we do not flush dirty buffers ourselves. - * Instead we ask the buf daemon to do it for us. We attempt to - * avoid piecemeal wakeups of the pageout daemon. + * Allocate the buffer KVA and set b_kvasize. Also set b_kvabase if + * needed. */ +static int +allocbufkva(struct buf *bp, int maxsize, int gbflags) +{ + vm_offset_t addr; + int rv; -static struct buf * -getnewbuf(struct vnode *vp, int slpflag, int slptimeo, int size, int maxsize, - int gbflags) + bfreekva(bp); + addr = 0; + + vm_map_lock(buffer_map); + if (vm_map_findspace(buffer_map, vm_map_min(buffer_map), maxsize, + &addr)) { + vm_map_unlock(buffer_map); + /* + * Buffer map is too fragmented. Request the caller + * to defragment the map. + */ + atomic_add_int(&bufdefragcnt, 1); + return (1); + } + rv = vm_map_insert(buffer_map, NULL, 0, addr, addr + maxsize, + VM_PROT_RW, VM_PROT_RW, MAP_NOFAULT); + KASSERT(rv == KERN_SUCCESS, ("vm_map_insert(buffer_map) rv %d", rv)); + vm_map_unlock(buffer_map); + setbufkva(bp, addr, maxsize, gbflags); + atomic_add_long(&bufspace, bp->b_kvasize); + return (0); +} + +/* + * Ask the bufdaemon for help, or act as bufdaemon itself, when a + * locked vnode is supplied. + */ +static void +getnewbuf_bufd_help(struct vnode *vp, int gbflags, int slpflag, int slptimeo, + int defrag) { struct thread *td; - struct buf *bp; - struct buf *nbp; - int defrag = 0; - int nqindex; - static int flushingbufs; + char *waitmsg; + int fl, flags, norunbuf; + + mtx_assert(&bqlock, MA_OWNED); + + if (defrag) { + flags = VFS_BIO_NEED_BUFSPACE; + waitmsg = "nbufkv"; + } else if (bufspace >= hibufspace) { + waitmsg = "nbufbs"; + flags = VFS_BIO_NEED_BUFSPACE; + } else { + waitmsg = "newbuf"; + flags = VFS_BIO_NEED_ANY; + } + mtx_lock(&nblock); + needsbuffer |= flags; + mtx_unlock(&nblock); + mtx_unlock(&bqlock); + + bd_speedup(); /* heeeelp */ + if ((gbflags & GB_NOWAIT_BD) != 0) + return; td = curthread; + mtx_lock(&nblock); + while (needsbuffer & flags) { + if (vp != NULL && (td->td_pflags & TDP_BUFNEED) == 0) { + mtx_unlock(&nblock); + /* + * getblk() is called with a vnode locked, and + * some majority of the dirty buffers may as + * well belong to the vnode. Flushing the + * buffers there would make a progress that + * cannot be achieved by the buf_daemon, that + * cannot lock the vnode. + */ + norunbuf = ~(TDP_BUFNEED | TDP_NORUNNINGBUF) | + (td->td_pflags & TDP_NORUNNINGBUF); + /* play bufdaemon */ + td->td_pflags |= TDP_BUFNEED | TDP_NORUNNINGBUF; + fl = buf_do_flush(vp); + td->td_pflags &= norunbuf; + mtx_lock(&nblock); + if (fl != 0) + continue; + if ((needsbuffer & flags) == 0) + break; + } + if (msleep(&needsbuffer, &nblock, (PRIBIO + 4) | slpflag, + waitmsg, slptimeo)) + break; + } + mtx_unlock(&nblock); +} + +static void +getnewbuf_reuse_bp(struct buf *bp, int qindex) +{ + + CTR6(KTR_BUF, "getnewbuf(%p) vp %p flags %X kvasize %d bufsize %d " + "queue %d (recycling)", bp, bp->b_vp, bp->b_flags, + bp->b_kvasize, bp->b_bufsize, qindex); + mtx_assert(&bqlock, MA_NOTOWNED); + /* - * We can't afford to block since we might be holding a vnode lock, - * which may prevent system daemons from running. We deal with - * low-memory situations by proactively returning memory and running - * async I/O rather then sync I/O. + * Note: we no longer distinguish between VMIO and non-VMIO + * buffers. */ - atomic_add_int(&getnewbufcalls, 1); - atomic_subtract_int(&getnewbufrestarts, 1); + KASSERT((bp->b_flags & B_DELWRI) == 0, + ("delwri buffer %p found in queue %d", bp, qindex)); + + if (qindex == QUEUE_CLEAN) { + if (bp->b_flags & B_VMIO) { + bp->b_flags &= ~B_ASYNC; + vfs_vmio_release(bp); + } + if (bp->b_vp != NULL) + brelvp(bp); + } + + /* + * Get the rest of the buffer freed up. b_kva* is still valid + * after this operation. + */ + + if (bp->b_rcred != NOCRED) { + crfree(bp->b_rcred); + bp->b_rcred = NOCRED; + } + if (bp->b_wcred != NOCRED) { + crfree(bp->b_wcred); + bp->b_wcred = NOCRED; + } + if (!LIST_EMPTY(&bp->b_dep)) + buf_deallocate(bp); + if (bp->b_vflags & BV_BKGRDINPROG) + panic("losing buffer 3"); + KASSERT(bp->b_vp == NULL, ("bp: %p still has vnode %p. qindex: %d", + bp, bp->b_vp, qindex)); + KASSERT((bp->b_xflags & (BX_VNCLEAN|BX_VNDIRTY)) == 0, + ("bp: %p still on a buffer list. xflags %X", bp, bp->b_xflags)); + + if (bp->b_bufsize) + allocbuf(bp, 0); + + bp->b_flags &= B_UNMAPPED | B_KVAALLOC; + bp->b_ioflags = 0; + bp->b_xflags = 0; + KASSERT((bp->b_vflags & BV_INFREECNT) == 0, + ("buf %p still counted as free?", bp)); + bp->b_vflags = 0; + bp->b_vp = NULL; + bp->b_blkno = bp->b_lblkno = 0; + bp->b_offset = NOOFFSET; + bp->b_iodone = 0; + bp->b_error = 0; + bp->b_resid = 0; + bp->b_bcount = 0; + bp->b_npages = 0; + bp->b_dirtyoff = bp->b_dirtyend = 0; + bp->b_bufobj = NULL; + bp->b_pin_count = 0; + bp->b_fsprivate1 = NULL; + bp->b_fsprivate2 = NULL; + bp->b_fsprivate3 = NULL; + + LIST_INIT(&bp->b_dep); +} + +static int flushingbufs; + +static struct buf * +getnewbuf_scan(int maxsize, int defrag, int unmapped, int metadata) +{ + struct buf *bp, *nbp; + int nqindex, qindex, pass; + + KASSERT(!unmapped || !defrag, ("both unmapped and defrag")); + + pass = 1; restart: atomic_add_int(&getnewbufrestarts, 1); @@ -1860,66 +2174,90 @@ restart: * that if we are specially marked process, we are allowed to * dip into our reserves. * - * The scanning sequence is nominally: EMPTY->EMPTYKVA->CLEAN + * The scanning sequence is nominally: EMPTY->EMPTYKVA->CLEAN + * for the allocation of the mapped buffer. For unmapped, the + * easiest is to start with EMPTY outright. * * We start with EMPTYKVA. If the list is empty we backup to EMPTY. * However, there are a number of cases (defragging, reusing, ...) * where we cannot backup. */ + nbp = NULL; mtx_lock(&bqlock); - nqindex = QUEUE_EMPTYKVA; - nbp = TAILQ_FIRST(&bufqueues[QUEUE_EMPTYKVA]); - + if (!defrag && unmapped) { + nqindex = QUEUE_EMPTY; + nbp = TAILQ_FIRST(&bufqueues[QUEUE_EMPTY]); + } if (nbp == NULL) { - /* - * If no EMPTYKVA buffers and we are either - * defragging or reusing, locate a CLEAN buffer - * to free or reuse. If bufspace useage is low - * skip this step so we can allocate a new buffer. - */ - if (defrag || bufspace >= lobufspace) { - nqindex = QUEUE_CLEAN; - nbp = TAILQ_FIRST(&bufqueues[QUEUE_CLEAN]); - } + nqindex = QUEUE_EMPTYKVA; + nbp = TAILQ_FIRST(&bufqueues[QUEUE_EMPTYKVA]); + } - /* - * If we could not find or were not allowed to reuse a - * CLEAN buffer, check to see if it is ok to use an EMPTY - * buffer. We can only use an EMPTY buffer if allocating - * its KVA would not otherwise run us out of buffer space. - */ - if (nbp == NULL && defrag == 0 && - bufspace + maxsize < hibufspace) { - nqindex = QUEUE_EMPTY; - nbp = TAILQ_FIRST(&bufqueues[QUEUE_EMPTY]); - } + /* + * If no EMPTYKVA buffers and we are either defragging or + * reusing, locate a CLEAN buffer to free or reuse. If + * bufspace useage is low skip this step so we can allocate a + * new buffer. + */ + if (nbp == NULL && (defrag || bufspace >= lobufspace)) { + nqindex = QUEUE_CLEAN; + nbp = TAILQ_FIRST(&bufqueues[QUEUE_CLEAN]); + } + + /* + * If we could not find or were not allowed to reuse a CLEAN + * buffer, check to see if it is ok to use an EMPTY buffer. + * We can only use an EMPTY buffer if allocating its KVA would + * not otherwise run us out of buffer space. No KVA is needed + * for the unmapped allocation. + */ + if (nbp == NULL && defrag == 0 && (bufspace + maxsize < hibufspace || + metadata)) { + nqindex = QUEUE_EMPTY; + nbp = TAILQ_FIRST(&bufqueues[QUEUE_EMPTY]); + } + + /* + * All available buffers might be clean, retry ignoring the + * lobufspace as the last resort. + */ + if (nbp == NULL && !TAILQ_EMPTY(&bufqueues[QUEUE_CLEAN])) { + nqindex = QUEUE_CLEAN; + nbp = TAILQ_FIRST(&bufqueues[QUEUE_CLEAN]); } /* * Run scan, possibly freeing data and/or kva mappings on the fly * depending. */ - while ((bp = nbp) != NULL) { - int qindex = nqindex; + qindex = nqindex; /* - * Calculate next bp ( we can only use it if we do not block - * or do other fancy things ). + * Calculate next bp (we can only use it if we do not *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 14:15:42 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5C51A4FD; Tue, 19 Mar 2013 14:15:42 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4D31099F; Tue, 19 Mar 2013 14:15:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JEFgfI013516; Tue, 19 Mar 2013 14:15:42 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JEFg7h013515; Tue, 19 Mar 2013 14:15:42 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201303191415.r2JEFg7h013515@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 19 Mar 2013 14:15:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248509 - head/sys/dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 14:15:42 -0000 Author: ray Date: Tue Mar 19 14:15:41 2013 New Revision: 248509 URL: http://svnweb.freebsd.org/changeset/base/248509 Log: Return "start" and "end" to u_long world. Because rman handle addresses as u_long too. Discussed with: ian@ Pointy hat to: ray@ Modified: head/sys/dev/fdt/fdt_common.c Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Tue Mar 19 14:13:12 2013 (r248508) +++ head/sys/dev/fdt/fdt_common.c Tue Mar 19 14:15:41 2013 (r248509) @@ -421,12 +421,11 @@ fdt_regsize(phandle_t node, u_long *base int fdt_reg_to_rl(phandle_t node, struct resource_list *rl) { - u_long count; + u_long end, count, start; pcell_t *reg, *regptr; pcell_t addr_cells, size_cells; int tuple_size, tuples; int i, rv; - bus_space_handle_t start, end; long busaddr, bussize; if (fdt_addrsize_cells(OF_parent(node), &addr_cells, &size_cells) != 0) @@ -447,8 +446,8 @@ fdt_reg_to_rl(phandle_t node, struct res regptr = reg; for (i = 0; i < tuples; i++) { - rv = fdt_data_to_res(reg, addr_cells, size_cells, - (u_long *)&start, &count); + rv = fdt_data_to_res(reg, addr_cells, size_cells, &start, + &count); if (rv != 0) { resource_list_free(rl); goto out; From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 14:27:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6285EA51; Tue, 19 Mar 2013 14:27:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 322CBA3E; Tue, 19 Mar 2013 14:27:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JERFO4016915; Tue, 19 Mar 2013 14:27:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JERENe016911; Tue, 19 Mar 2013 14:27:14 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191427.r2JERENe016911@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 14:27:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248510 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 14:27:15 -0000 Author: kib Date: Tue Mar 19 14:27:14 2013 New Revision: 248510 URL: http://svnweb.freebsd.org/changeset/base/248510 Log: Add a helper function vfs_bio_bzero_buf() to zero the portion of the buffer, transparently handling mapped or unmapped buffers. Its intent is to replace the use of bzero(bp->b_data) in cases where the buffer might be unmapped, to avoid unneeded upgrades. Sponsored by: The FreeBSD Foundation Tested by: pho Modified: head/sys/kern/vfs_bio.c head/sys/sys/buf.h Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Mar 19 14:15:41 2013 (r248509) +++ head/sys/kern/vfs_bio.c Tue Mar 19 14:27:14 2013 (r248510) @@ -4176,6 +4176,32 @@ unlock: bp->b_resid = 0; } +void +vfs_bio_bzero_buf(struct buf *bp, int base, int size) +{ + vm_page_t m; + int i, n; + + if ((bp->b_flags & B_UNMAPPED) == 0) { + BUF_CHECK_MAPPED(bp); + bzero(bp->b_data + base, size); + } else { + BUF_CHECK_UNMAPPED(bp); + n = PAGE_SIZE - (base & PAGE_MASK); + VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); + for (i = base / PAGE_SIZE; size > 0 && i < bp->b_npages; ++i) { + m = bp->b_pages[i]; + if (n > size) + n = size; + pmap_zero_page_area(m, base & PAGE_MASK, n); + base += n; + size -= n; + n = PAGE_SIZE; + } + VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); + } +} + /* * vm_hold_load_pages and vm_hold_free_pages get pages into * a buffers address space. The pages are anonymous and are Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Tue Mar 19 14:15:41 2013 (r248509) +++ head/sys/sys/buf.h Tue Mar 19 14:27:14 2013 (r248510) @@ -519,6 +519,7 @@ int cluster_read(struct vnode *, u_quad_ struct ucred *, long, int, int, struct buf **); int cluster_wbuild(struct vnode *, long, daddr_t, int, int); void cluster_write(struct vnode *, struct buf *, u_quad_t, int, int); +void vfs_bio_bzero_buf(struct buf *bp, int base, int size); void vfs_bio_set_valid(struct buf *, int base, int size); void vfs_bio_clrbuf(struct buf *); void vfs_busy_pages(struct buf *, int clear_modify); From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 14:33:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 387D9CDB; Tue, 19 Mar 2013 14:33:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 29DCCA99; Tue, 19 Mar 2013 14:33:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JEX23x019340; Tue, 19 Mar 2013 14:33:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JEX2Za019339; Tue, 19 Mar 2013 14:33:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191433.r2JEX2Za019339@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 14:33:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248511 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 14:33:02 -0000 Author: kib Date: Tue Mar 19 14:33:01 2013 New Revision: 248511 URL: http://svnweb.freebsd.org/changeset/base/248511 Log: A flag for the filesystem to indicate to the upper levels that it accepts unmapped buffers for the VOP_STRATEGY(). Sponsored by: The FreeBSD Foundation Tested by: pho Modified: head/sys/sys/mount.h Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Tue Mar 19 14:27:14 2013 (r248510) +++ head/sys/sys/mount.h Tue Mar 19 14:33:01 2013 (r248511) @@ -351,6 +351,7 @@ void __mnt_vnode_markerfree_act #define MNTK_VGONE_WAITER 0x00000400 #define MNTK_LOOKUP_EXCL_DOTDOT 0x00000800 #define MNTK_MARKER 0x00001000 +#define MNTK_UNMAPPED_BUFS 0x00002000 #define MNTK_NOASYNC 0x00800000 /* disable async */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 14:36:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1B32CEEF; Tue, 19 Mar 2013 14:36:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E7615AC2; Tue, 19 Mar 2013 14:36:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JEaSoZ019888; Tue, 19 Mar 2013 14:36:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JEaS4S019887; Tue, 19 Mar 2013 14:36:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191436.r2JEaS4S019887@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 14:36:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248512 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 14:36:29 -0000 Author: kib Date: Tue Mar 19 14:36:28 2013 New Revision: 248512 URL: http://svnweb.freebsd.org/changeset/base/248512 Log: Pass unmapped buffers for page in requests if the filesystem indicated support for the unmapped i/o. Sponsored by: The FreeBSD Foundation Tested by: pho Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Tue Mar 19 14:33:01 2013 (r248511) +++ head/sys/vm/vnode_pager.c Tue Mar 19 14:36:28 2013 (r248512) @@ -698,6 +698,7 @@ vnode_pager_generic_getpages(vp, m, byte int runpg; int runend; struct buf *bp; + struct mount *mp; int count; int error; @@ -903,9 +904,21 @@ vnode_pager_generic_getpages(vp, m, byte kva = (vm_offset_t)bp->b_data; /* - * and map the pages to be read into the kva + * and map the pages to be read into the kva, if the filesystem + * requires mapped buffers. */ - pmap_qenter(kva, m, count); + mp = vp->v_mount; + if (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMAPPED_BUFS) != 0 && + unmapped_buf_allowed) { + bp->b_data = unmapped_buf; + bp->b_kvabase = unmapped_buf; + bp->b_offset = 0; + bp->b_flags |= B_UNMAPPED; + bp->b_npages = count; + for (i = 0; i < count; i++) + bp->b_pages[i] = m[i]; + } else + pmap_qenter(kva, m, count); /* build a minimal buffer header */ bp->b_iocmd = BIO_READ; @@ -934,11 +947,22 @@ vnode_pager_generic_getpages(vp, m, byte if ((bp->b_ioflags & BIO_ERROR) != 0) error = EIO; - if (!error) { - if (size != count * PAGE_SIZE) - bzero((caddr_t) kva + size, PAGE_SIZE * count - size); + if (error != 0 && size != count * PAGE_SIZE) { + if ((bp->b_flags & B_UNMAPPED) != 0) { + bp->b_flags &= ~B_UNMAPPED; + pmap_qenter(kva, m, count); + } + bzero((caddr_t)kva + size, PAGE_SIZE * count - size); + } + if ((bp->b_flags & B_UNMAPPED) == 0) + pmap_qremove(kva, count); + if (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMAPPED_BUFS) != 0) { + bp->b_data = (caddr_t)kva; + bp->b_kvabase = (caddr_t)kva; + bp->b_flags &= ~B_UNMAPPED; + for (i = 0; i < count; i++) + bp->b_pages[i] = NULL; } - pmap_qremove(kva, count); /* * free the buffer header back to the swap buffer pool From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 14:39:28 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5946D1C0; Tue, 19 Mar 2013 14:39:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4B0B3AF1; Tue, 19 Mar 2013 14:39:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JEdSmb020368; Tue, 19 Mar 2013 14:39:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JEdRJB020366; Tue, 19 Mar 2013 14:39:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191439.r2JEdRJB020366@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 14:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248514 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 14:39:28 -0000 Author: kib Date: Tue Mar 19 14:39:27 2013 New Revision: 248514 URL: http://svnweb.freebsd.org/changeset/base/248514 Log: Do not map the swap i/o pbufs if the geom provider for the swap partition accepts unmapped requests. Sponsored by: The FreeBSD Foundation Tested by: pho Modified: head/sys/vm/swap_pager.c head/sys/vm/swap_pager.h Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Tue Mar 19 14:39:19 2013 (r248513) +++ head/sys/vm/swap_pager.c Tue Mar 19 14:39:27 2013 (r248514) @@ -758,6 +758,17 @@ swp_pager_strategy(struct buf *bp) TAILQ_FOREACH(sp, &swtailq, sw_list) { if (bp->b_blkno >= sp->sw_first && bp->b_blkno < sp->sw_end) { mtx_unlock(&sw_dev_mtx); + if ((sp->sw_flags & SW_UNMAPPED) != 0 && + unmapped_buf_allowed) { + bp->b_kvaalloc = bp->b_data; + bp->b_data = unmapped_buf; + bp->b_kvabase = unmapped_buf; + bp->b_offset = 0; + bp->b_flags |= B_UNMAPPED; + } else { + pmap_qenter((vm_offset_t)bp->b_data, + &bp->b_pages[0], bp->b_bcount / PAGE_SIZE); + } sp->sw_strategy(bp, sp); return; } @@ -1155,11 +1166,6 @@ swap_pager_getpages(vm_object_t object, bp = getpbuf(&nsw_rcount); bp->b_flags |= B_PAGING; - /* - * map our page(s) into kva for input - */ - pmap_qenter((vm_offset_t)bp->b_data, m + i, j - i); - bp->b_iocmd = BIO_READ; bp->b_iodone = swp_pager_async_iodone; bp->b_rcred = crhold(thread0.td_ucred); @@ -1371,8 +1377,6 @@ swap_pager_putpages(vm_object_t object, bp->b_flags |= B_PAGING; bp->b_iocmd = BIO_WRITE; - pmap_qenter((vm_offset_t)bp->b_data, &m[i], n); - bp->b_rcred = crhold(thread0.td_ucred); bp->b_wcred = crhold(thread0.td_ucred); bp->b_bcount = PAGE_SIZE * n; @@ -1484,7 +1488,12 @@ swp_pager_async_iodone(struct buf *bp) /* * remove the mapping for kernel virtual */ - pmap_qremove((vm_offset_t)bp->b_data, bp->b_npages); + if ((bp->b_flags & B_UNMAPPED) != 0) { + bp->b_data = bp->b_kvaalloc; + bp->b_kvabase = bp->b_kvaalloc; + bp->b_flags &= ~B_UNMAPPED; + } else + pmap_qremove((vm_offset_t)bp->b_data, bp->b_npages); if (bp->b_npages) { object = bp->b_pages[0]->object; @@ -2144,7 +2153,8 @@ swapon_check_swzone(unsigned long npages } static void -swaponsomething(struct vnode *vp, void *id, u_long nblks, sw_strategy_t *strategy, sw_close_t *close, dev_t dev) +swaponsomething(struct vnode *vp, void *id, u_long nblks, + sw_strategy_t *strategy, sw_close_t *close, dev_t dev, int flags) { struct swdevt *sp, *tsp; swblk_t dvbase; @@ -2180,6 +2190,7 @@ swaponsomething(struct vnode *vp, void * sp->sw_used = 0; sp->sw_strategy = strategy; sp->sw_close = close; + sp->sw_flags = flags; sp->sw_blist = blist_create(nblks, M_WAITOK); /* @@ -2537,10 +2548,19 @@ swapgeom_strategy(struct buf *bp, struct bio->bio_caller2 = bp; bio->bio_cmd = bp->b_iocmd; - bio->bio_data = bp->b_data; bio->bio_offset = (bp->b_blkno - sp->sw_first) * PAGE_SIZE; bio->bio_length = bp->b_bcount; bio->bio_done = swapgeom_done; + if ((bp->b_flags & B_UNMAPPED) != 0) { + bio->bio_ma = bp->b_pages; + bio->bio_data = unmapped_buf; + bio->bio_ma_offset = (vm_offset_t)bp->b_offset & PAGE_MASK; + bio->bio_ma_n = bp->b_npages; + bio->bio_flags |= BIO_UNMAPPED; + } else { + bio->bio_data = bp->b_data; + bio->bio_ma = NULL; + } g_io_request(bio, cp); return; } @@ -2630,9 +2650,9 @@ swapongeom_ev(void *arg, int flags) } nblks = pp->mediasize / DEV_BSIZE; swaponsomething(swh->vp, cp, nblks, swapgeom_strategy, - swapgeom_close, dev2udev(swh->dev)); + swapgeom_close, dev2udev(swh->dev), + (pp->flags & G_PF_ACCEPT_UNMAPPED) != 0 ? SW_UNMAPPED : 0); swh->error = 0; - return; } static int @@ -2721,6 +2741,6 @@ swaponvp(struct thread *td, struct vnode return (error); swaponsomething(vp, vp, nblks, swapdev_strategy, swapdev_close, - NODEV); + NODEV, 0); return (0); } Modified: head/sys/vm/swap_pager.h ============================================================================== --- head/sys/vm/swap_pager.h Tue Mar 19 14:39:19 2013 (r248513) +++ head/sys/vm/swap_pager.h Tue Mar 19 14:39:27 2013 (r248514) @@ -68,6 +68,7 @@ struct swdevt { sw_close_t *sw_close; }; +#define SW_UNMAPPED 0x01 #define SW_CLOSING 0x04 #ifdef _KERNEL From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 14:43:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 070314B7; Tue, 19 Mar 2013 14:43:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DD95DB2B; Tue, 19 Mar 2013 14:43:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JEhwh7022575; Tue, 19 Mar 2013 14:43:58 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JEhvAI022565; Tue, 19 Mar 2013 14:43:57 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191443.r2JEhvAI022565@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 14:43:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248515 - in head/sys: cam kern sys ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 14:43:59 -0000 Author: kib Date: Tue Mar 19 14:43:57 2013 New Revision: 248515 URL: http://svnweb.freebsd.org/changeset/base/248515 Log: Do not remap usermode pages into KVA for physio. Sponsored by: The FreeBSD Foundation Tested by: pho Modified: head/sys/cam/cam_periph.c head/sys/kern/kern_physio.c head/sys/kern/vfs_aio.c head/sys/kern/vfs_bio.c head/sys/sys/buf.h head/sys/ufs/ffs/ffs_rawread.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Tue Mar 19 14:39:27 2013 (r248514) +++ head/sys/cam/cam_periph.c Tue Mar 19 14:43:57 2013 (r248515) @@ -850,7 +850,7 @@ cam_periph_mapmem(union ccb *ccb, struct * into a larger area of VM, or if userland races against * vmapbuf() after the useracc() check. */ - if (vmapbuf(mapinfo->bp[i]) < 0) { + if (vmapbuf(mapinfo->bp[i], 1) < 0) { for (j = 0; j < i; ++j) { *data_ptrs[j] = mapinfo->bp[j]->b_saveaddr; vunmapbuf(mapinfo->bp[j]); Modified: head/sys/kern/kern_physio.c ============================================================================== --- head/sys/kern/kern_physio.c Tue Mar 19 14:39:27 2013 (r248514) +++ head/sys/kern/kern_physio.c Tue Mar 19 14:43:57 2013 (r248515) @@ -92,7 +92,7 @@ physio(struct cdev *dev, struct uio *uio bp->b_blkno = btodb(bp->b_offset); if (uio->uio_segflg == UIO_USERSPACE) - if (vmapbuf(bp) < 0) { + if (vmapbuf(bp, 0) < 0) { error = EFAULT; goto doerror; } Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Tue Mar 19 14:39:27 2013 (r248514) +++ head/sys/kern/vfs_aio.c Tue Mar 19 14:43:57 2013 (r248515) @@ -1323,7 +1323,7 @@ aio_qphysio(struct proc *p, struct aiocb /* * Bring buffer into kernel space. */ - if (vmapbuf(bp) < 0) { + if (vmapbuf(bp, 1) < 0) { error = EFAULT; goto doerror; } Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Mar 19 14:39:27 2013 (r248514) +++ head/sys/kern/vfs_bio.c Tue Mar 19 14:43:57 2013 (r248515) @@ -4279,7 +4279,7 @@ vm_hold_free_pages(struct buf *bp, int n * check the return value. */ int -vmapbuf(struct buf *bp) +vmapbuf(struct buf *bp, int mapbuf) { caddr_t kva; vm_prot_t prot; @@ -4294,12 +4294,19 @@ vmapbuf(struct buf *bp) (vm_offset_t)bp->b_data, bp->b_bufsize, prot, bp->b_pages, btoc(MAXPHYS))) < 0) return (-1); - pmap_qenter((vm_offset_t)bp->b_saveaddr, bp->b_pages, pidx); - - kva = bp->b_saveaddr; bp->b_npages = pidx; - bp->b_saveaddr = bp->b_data; - bp->b_data = kva + (((vm_offset_t) bp->b_data) & PAGE_MASK); + if (mapbuf || !unmapped_buf_allowed) { + pmap_qenter((vm_offset_t)bp->b_saveaddr, bp->b_pages, pidx); + kva = bp->b_saveaddr; + bp->b_saveaddr = bp->b_data; + bp->b_data = kva + (((vm_offset_t)bp->b_data) & PAGE_MASK); + bp->b_flags &= ~B_UNMAPPED; + } else { + bp->b_flags |= B_UNMAPPED; + bp->b_offset = ((vm_offset_t)bp->b_data) & PAGE_MASK; + bp->b_saveaddr = bp->b_data; + bp->b_data = unmapped_buf; + } return(0); } @@ -4313,7 +4320,10 @@ vunmapbuf(struct buf *bp) int npages; npages = bp->b_npages; - pmap_qremove(trunc_page((vm_offset_t)bp->b_data), npages); + if (bp->b_flags & B_UNMAPPED) + bp->b_flags &= ~B_UNMAPPED; + else + pmap_qremove(trunc_page((vm_offset_t)bp->b_data), npages); vm_page_unhold_pages(bp->b_pages, npages); bp->b_data = bp->b_saveaddr; Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Tue Mar 19 14:39:27 2013 (r248514) +++ head/sys/sys/buf.h Tue Mar 19 14:43:57 2013 (r248515) @@ -524,7 +524,7 @@ void vfs_bio_set_valid(struct buf *, int void vfs_bio_clrbuf(struct buf *); void vfs_busy_pages(struct buf *, int clear_modify); void vfs_unbusy_pages(struct buf *); -int vmapbuf(struct buf *); +int vmapbuf(struct buf *, int); void vunmapbuf(struct buf *); void relpbuf(struct buf *, int *); void brelvp(struct buf *); Modified: head/sys/ufs/ffs/ffs_rawread.c ============================================================================== --- head/sys/ufs/ffs/ffs_rawread.c Tue Mar 19 14:39:27 2013 (r248514) +++ head/sys/ufs/ffs/ffs_rawread.c Tue Mar 19 14:43:57 2013 (r248515) @@ -241,7 +241,7 @@ ffs_rawread_readahead(struct vnode *vp, bp->b_bcount = bsize - blockoff * DEV_BSIZE; bp->b_bufsize = bp->b_bcount; - if (vmapbuf(bp) < 0) + if (vmapbuf(bp, 1) < 0) return EFAULT; maybe_yield(); @@ -260,7 +260,7 @@ ffs_rawread_readahead(struct vnode *vp, bp->b_bcount = bsize * (1 + bforwards) - blockoff * DEV_BSIZE; bp->b_bufsize = bp->b_bcount; - if (vmapbuf(bp) < 0) + if (vmapbuf(bp, 1) < 0) return EFAULT; BO_STRATEGY(&dp->v_bufobj, bp); From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 14:49:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 58C4C898; Tue, 19 Mar 2013 14:49:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3276EBF4; Tue, 19 Mar 2013 14:49:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JEnGa5023346; Tue, 19 Mar 2013 14:49:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JEnF1m023342; Tue, 19 Mar 2013 14:49:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191449.r2JEnF1m023342@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 14:49:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248516 - head/sys/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 14:49:16 -0000 Author: kib Date: Tue Mar 19 14:49:15 2013 New Revision: 248516 URL: http://svnweb.freebsd.org/changeset/base/248516 Log: A flag for the geom disk driver to indicate that it accepts the unmapped i/o requests. Sponsored by: The FreeBSD Foundation Tested by: pho Modified: head/sys/geom/geom_disk.c head/sys/geom/geom_disk.h Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Tue Mar 19 14:43:57 2013 (r248515) +++ head/sys/geom/geom_disk.c Tue Mar 19 14:49:15 2013 (r248516) @@ -320,13 +320,29 @@ g_disk_start(struct bio *bp) do { bp2->bio_offset += off; bp2->bio_length -= off; - bp2->bio_data += off; + if ((bp->bio_flags & BIO_UNMAPPED) == 0) { + bp2->bio_data += off; + } else { + KASSERT((dp->d_flags & DISKFLAG_UNMAPPED_BIO) + != 0, + ("unmapped bio not supported by disk %s", + dp->d_name)); + bp2->bio_ma += off / PAGE_SIZE; + bp2->bio_ma_offset += off; + bp2->bio_ma_offset %= PAGE_SIZE; + bp2->bio_ma_n -= off / PAGE_SIZE; + } if (bp2->bio_length > dp->d_maxsize) { /* * XXX: If we have a stripesize we should really * use it here. */ bp2->bio_length = dp->d_maxsize; + if ((bp->bio_flags & BIO_UNMAPPED) != 0) { + bp2->bio_ma_n = howmany( + bp2->bio_ma_offset + + bp2->bio_length, PAGE_SIZE); + } off += dp->d_maxsize; /* * To avoid a race, we need to grab the next bio @@ -488,6 +504,8 @@ g_disk_create(void *arg, int flag) pp->sectorsize = dp->d_sectorsize; pp->stripeoffset = dp->d_stripeoffset; pp->stripesize = dp->d_stripesize; + if ((dp->d_flags & DISKFLAG_UNMAPPED_BIO) != 0) + pp->flags |= G_PF_ACCEPT_UNMAPPED; if (bootverbose) printf("GEOM: new disk %s\n", gp->name); sysctl_ctx_init(&sc->sysctl_ctx); Modified: head/sys/geom/geom_disk.h ============================================================================== --- head/sys/geom/geom_disk.h Tue Mar 19 14:43:57 2013 (r248515) +++ head/sys/geom/geom_disk.h Tue Mar 19 14:49:15 2013 (r248516) @@ -103,6 +103,7 @@ struct disk { #define DISKFLAG_OPEN 0x2 #define DISKFLAG_CANDELETE 0x4 #define DISKFLAG_CANFLUSHCACHE 0x8 +#define DISKFLAG_UNMAPPED_BIO 0x10 struct disk *disk_alloc(void); void disk_create(struct disk *disk, int version); From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 14:50:24 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9CEBBA92; Tue, 19 Mar 2013 14:50:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8EB7AC1C; Tue, 19 Mar 2013 14:50:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JEoOTT024962; Tue, 19 Mar 2013 14:50:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JEoOgt024961; Tue, 19 Mar 2013 14:50:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191450.r2JEoOgt024961@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 14:50:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248517 - head/sys/geom/part X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 14:50:24 -0000 Author: kib Date: Tue Mar 19 14:50:24 2013 New Revision: 248517 URL: http://svnweb.freebsd.org/changeset/base/248517 Log: The geom_part provider supports unmapped bio iff the underlying provider does so, since geom_part never inspects the bio_data. Sponsored by: The FreeBSD Foundation Tested by: pho Modified: head/sys/geom/part/g_part.c Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Tue Mar 19 14:49:15 2013 (r248516) +++ head/sys/geom/part/g_part.c Tue Mar 19 14:50:24 2013 (r248517) @@ -428,6 +428,7 @@ g_part_new_provider(struct g_geom *gp, s entry->gpe_pp->stripeoffset = pp->stripeoffset + entry->gpe_offset; if (pp->stripesize > 0) entry->gpe_pp->stripeoffset %= pp->stripesize; + entry->gpe_pp->flags |= pp->flags & G_PF_ACCEPT_UNMAPPED; g_error_provider(entry->gpe_pp, 0); } From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 14:53:24 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8B584C3F; Tue, 19 Mar 2013 14:53:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 64F0DC3C; Tue, 19 Mar 2013 14:53:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JErOmo025556; Tue, 19 Mar 2013 14:53:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JErOCl025555; Tue, 19 Mar 2013 14:53:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191453.r2JErOCl025555@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 14:53:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248518 - head/sys/dev/md X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 14:53:24 -0000 Author: kib Date: Tue Mar 19 14:53:23 2013 New Revision: 248518 URL: http://svnweb.freebsd.org/changeset/base/248518 Log: Support unmapped i/o for the md(4). The vnode-backed md(4) has to map the unmapped bio because VOP_READ() and VOP_WRITE() interfaces do not allow to pass unmapped requests to the filesystem. Vnode-backed md(4) uses pbufs instead of relying on the bio_transient_map, to avoid usual md deadlock. Sponsored by: The FreeBSD Foundation Tested by: pho, scottl Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Tue Mar 19 14:50:24 2013 (r248517) +++ head/sys/dev/md/md.c Tue Mar 19 14:53:23 2013 (r248518) @@ -18,11 +18,16 @@ * Copyright (c) 1988 University of Utah. * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. + * Copyright (c) 2013 The FreeBSD Foundation + * All rights reserved. * * This code is derived from software contributed to Berkeley by * the Systems Programming Group of the University of Utah Computer * Science Department. * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -59,6 +64,7 @@ #include #include #include +#include #include #include #include @@ -169,6 +175,8 @@ static LIST_HEAD(, md_s) md_softc_list = #define NMASK (NINDIR-1) static int nshift; +static int md_vnode_pbuf_freecnt; + struct indir { uintptr_t *array; u_int total; @@ -415,11 +423,103 @@ g_md_start(struct bio *bp) wakeup(sc); } +#define MD_MALLOC_MOVE_ZERO 1 +#define MD_MALLOC_MOVE_FILL 2 +#define MD_MALLOC_MOVE_READ 3 +#define MD_MALLOC_MOVE_WRITE 4 +#define MD_MALLOC_MOVE_CMP 5 + +static int +md_malloc_move(vm_page_t **mp, int *ma_offs, unsigned sectorsize, + void *ptr, u_char fill, int op) +{ + struct sf_buf *sf; + vm_page_t m, *mp1; + char *p, first; + off_t *uc; + unsigned n; + int error, i, ma_offs1, sz, first_read; + + m = NULL; + error = 0; + sf = NULL; + /* if (op == MD_MALLOC_MOVE_CMP) { gcc */ + first = 0; + first_read = 0; + uc = ptr; + mp1 = *mp; + ma_offs1 = *ma_offs; + /* } */ + sched_pin(); + for (n = sectorsize; n != 0; n -= sz) { + sz = imin(PAGE_SIZE - *ma_offs, n); + if (m != **mp) { + if (sf != NULL) + sf_buf_free(sf); + m = **mp; + sf = sf_buf_alloc(m, SFB_CPUPRIVATE | + (md_malloc_wait ? 0 : SFB_NOWAIT)); + if (sf == NULL) { + error = ENOMEM; + break; + } + } + p = (char *)sf_buf_kva(sf) + *ma_offs; + switch (op) { + case MD_MALLOC_MOVE_ZERO: + bzero(p, sz); + break; + case MD_MALLOC_MOVE_FILL: + memset(p, fill, sz); + break; + case MD_MALLOC_MOVE_READ: + bcopy(ptr, p, sz); + cpu_flush_dcache(p, sz); + break; + case MD_MALLOC_MOVE_WRITE: + bcopy(p, ptr, sz); + break; + case MD_MALLOC_MOVE_CMP: + for (i = 0; i < sz; i++, p++) { + if (!first_read) { + *uc = (u_char)*p; + first = *p; + first_read = 1; + } else if (*p != first) { + error = EDOOFUS; + break; + } + } + break; + default: + KASSERT(0, ("md_malloc_move unknown op %d\n", op)); + break; + } + if (error != 0) + break; + *ma_offs += sz; + *ma_offs %= PAGE_SIZE; + if (*ma_offs == 0) + (*mp)++; + ptr = (char *)ptr + sz; + } + + if (sf != NULL) + sf_buf_free(sf); + sched_unpin(); + if (op == MD_MALLOC_MOVE_CMP && error != 0) { + *mp = mp1; + *ma_offs = ma_offs1; + } + return (error); +} + static int mdstart_malloc(struct md_s *sc, struct bio *bp) { - int i, error; u_char *dst; + vm_page_t *m; + int i, error, error1, ma_offs, notmapped; off_t secno, nsec, uc; uintptr_t sp, osp; @@ -432,9 +532,17 @@ mdstart_malloc(struct md_s *sc, struct b return (EOPNOTSUPP); } + notmapped = (bp->bio_flags & BIO_UNMAPPED) != 0; + if (notmapped) { + m = bp->bio_ma; + ma_offs = bp->bio_ma_offset; + dst = NULL; + } else { + dst = bp->bio_data; + } + nsec = bp->bio_length / sc->sectorsize; secno = bp->bio_offset / sc->sectorsize; - dst = bp->bio_data; error = 0; while (nsec--) { osp = s_read(sc->indir, secno); @@ -442,21 +550,45 @@ mdstart_malloc(struct md_s *sc, struct b if (osp != 0) error = s_write(sc->indir, secno, 0); } else if (bp->bio_cmd == BIO_READ) { - if (osp == 0) - bzero(dst, sc->sectorsize); - else if (osp <= 255) - memset(dst, osp, sc->sectorsize); - else { - bcopy((void *)osp, dst, sc->sectorsize); - cpu_flush_dcache(dst, sc->sectorsize); + if (osp == 0) { + if (notmapped) { + error = md_malloc_move(&m, &ma_offs, + sc->sectorsize, NULL, 0, + MD_MALLOC_MOVE_ZERO); + } else + bzero(dst, sc->sectorsize); + } else if (osp <= 255) { + if (notmapped) { + error = md_malloc_move(&m, &ma_offs, + sc->sectorsize, NULL, osp, + MD_MALLOC_MOVE_FILL); + } else + memset(dst, osp, sc->sectorsize); + } else { + if (notmapped) { + error = md_malloc_move(&m, &ma_offs, + sc->sectorsize, (void *)osp, 0, + MD_MALLOC_MOVE_READ); + } else { + bcopy((void *)osp, dst, sc->sectorsize); + cpu_flush_dcache(dst, sc->sectorsize); + } } osp = 0; } else if (bp->bio_cmd == BIO_WRITE) { if (sc->flags & MD_COMPRESS) { - uc = dst[0]; - for (i = 1; i < sc->sectorsize; i++) - if (dst[i] != uc) - break; + if (notmapped) { + error1 = md_malloc_move(&m, &ma_offs, + sc->sectorsize, &uc, 0, + MD_MALLOC_MOVE_CMP); + i = error1 == 0 ? sc->sectorsize : 0; + } else { + uc = dst[0]; + for (i = 1; i < sc->sectorsize; i++) { + if (dst[i] != uc) + break; + } + } } else { i = 0; uc = 0; @@ -473,10 +605,26 @@ mdstart_malloc(struct md_s *sc, struct b error = ENOSPC; break; } - bcopy(dst, (void *)sp, sc->sectorsize); + if (notmapped) { + error = md_malloc_move(&m, + &ma_offs, sc->sectorsize, + (void *)sp, 0, + MD_MALLOC_MOVE_WRITE); + } else { + bcopy(dst, (void *)sp, + sc->sectorsize); + } error = s_write(sc->indir, secno, sp); } else { - bcopy(dst, (void *)osp, sc->sectorsize); + if (notmapped) { + error = md_malloc_move(&m, + &ma_offs, sc->sectorsize, + (void *)osp, 0, + MD_MALLOC_MOVE_WRITE); + } else { + bcopy(dst, (void *)osp, + sc->sectorsize); + } osp = 0; } } @@ -488,7 +636,8 @@ mdstart_malloc(struct md_s *sc, struct b if (error != 0) break; secno++; - dst += sc->sectorsize; + if (!notmapped) + dst += sc->sectorsize; } bp->bio_resid = 0; return (error); @@ -521,6 +670,7 @@ mdstart_vnode(struct md_s *sc, struct bi struct iovec aiov; struct mount *mp; struct vnode *vp; + struct buf *pb; struct thread *td; off_t end, zerosize; @@ -592,7 +742,17 @@ mdstart_vnode(struct md_s *sc, struct bi return (error); } - aiov.iov_base = bp->bio_data; + KASSERT(bp->bio_length <= MAXPHYS, ("bio_length %jd", + (uintmax_t)bp->bio_length)); + if ((bp->bio_flags & BIO_UNMAPPED) == 0) { + pb = NULL; + aiov.iov_base = bp->bio_data; + } else { + pb = getpbuf(&md_vnode_pbuf_freecnt); + pmap_qenter((vm_offset_t)pb->b_data, bp->bio_ma, bp->bio_ma_n); + aiov.iov_base = (void *)((vm_offset_t)pb->b_data + + bp->bio_ma_offset); + } aiov.iov_len = bp->bio_length; auio.uio_iov = &aiov; auio.uio_iovcnt = 1; @@ -622,6 +782,10 @@ mdstart_vnode(struct md_s *sc, struct bi VOP_UNLOCK(vp, 0); vn_finished_write(mp); } + if ((bp->bio_flags & BIO_UNMAPPED) != 0) { + pmap_qremove((vm_offset_t)pb->b_data, bp->bio_ma_n); + relpbuf(pb, &md_vnode_pbuf_freecnt); + } bp->bio_resid = auio.uio_resid; return (error); } @@ -629,11 +793,10 @@ mdstart_vnode(struct md_s *sc, struct bi static int mdstart_swap(struct md_s *sc, struct bio *bp) { - struct sf_buf *sf; - int rv, offs, len, lastend; - vm_pindex_t i, lastp; vm_page_t m; u_char *p; + vm_pindex_t i, lastp; + int rv, ma_offs, offs, len, lastend; switch (bp->bio_cmd) { case BIO_READ: @@ -645,6 +808,7 @@ mdstart_swap(struct md_s *sc, struct bio } p = bp->bio_data; + ma_offs = (bp->bio_flags & BIO_UNMAPPED) == 0 ? 0 : bp->bio_ma_offset; /* * offs is the offset at which to start operating on the @@ -662,19 +826,12 @@ mdstart_swap(struct md_s *sc, struct bio vm_object_pip_add(sc->object, 1); for (i = bp->bio_offset / PAGE_SIZE; i <= lastp; i++) { len = ((i == lastp) ? lastend : PAGE_SIZE) - offs; - - m = vm_page_grab(sc->object, i, - VM_ALLOC_NORMAL|VM_ALLOC_RETRY); - VM_OBJECT_WUNLOCK(sc->object); - sched_pin(); - sf = sf_buf_alloc(m, SFB_CPUPRIVATE); - VM_OBJECT_WLOCK(sc->object); + m = vm_page_grab(sc->object, i, VM_ALLOC_NORMAL | + VM_ALLOC_RETRY); if (bp->bio_cmd == BIO_READ) { if (m->valid != VM_PAGE_BITS_ALL) rv = vm_pager_get_pages(sc->object, &m, 1, 0); if (rv == VM_PAGER_ERROR) { - sf_buf_free(sf); - sched_unpin(); vm_page_wakeup(m); break; } else if (rv == VM_PAGER_FAIL) { @@ -684,40 +841,44 @@ mdstart_swap(struct md_s *sc, struct bio * valid. Do not set dirty, the page * can be recreated if thrown out. */ - bzero((void *)sf_buf_kva(sf), PAGE_SIZE); + pmap_zero_page(m); m->valid = VM_PAGE_BITS_ALL; } - bcopy((void *)(sf_buf_kva(sf) + offs), p, len); - cpu_flush_dcache(p, len); + if ((bp->bio_flags & BIO_UNMAPPED) != 0) { + pmap_copy_pages(&m, offs, bp->bio_ma, + ma_offs, len); + } else { + physcopyout(VM_PAGE_TO_PHYS(m) + offs, p, len); + cpu_flush_dcache(p, len); + } } else if (bp->bio_cmd == BIO_WRITE) { if (len != PAGE_SIZE && m->valid != VM_PAGE_BITS_ALL) rv = vm_pager_get_pages(sc->object, &m, 1, 0); if (rv == VM_PAGER_ERROR) { - sf_buf_free(sf); - sched_unpin(); vm_page_wakeup(m); break; } - bcopy(p, (void *)(sf_buf_kva(sf) + offs), len); + if ((bp->bio_flags & BIO_UNMAPPED) != 0) { + pmap_copy_pages(bp->bio_ma, ma_offs, &m, + offs, len); + } else { + physcopyin(p, VM_PAGE_TO_PHYS(m) + offs, len); + } m->valid = VM_PAGE_BITS_ALL; } else if (bp->bio_cmd == BIO_DELETE) { if (len != PAGE_SIZE && m->valid != VM_PAGE_BITS_ALL) rv = vm_pager_get_pages(sc->object, &m, 1, 0); if (rv == VM_PAGER_ERROR) { - sf_buf_free(sf); - sched_unpin(); vm_page_wakeup(m); break; } if (len != PAGE_SIZE) { - bzero((void *)(sf_buf_kva(sf) + offs), len); + pmap_zero_page_area(m, offs, len); vm_page_clear_dirty(m, offs, len); m->valid = VM_PAGE_BITS_ALL; } else vm_pager_page_unswapped(m); } - sf_buf_free(sf); - sched_unpin(); vm_page_wakeup(m); vm_page_lock(m); if (bp->bio_cmd == BIO_DELETE && len == PAGE_SIZE) @@ -731,6 +892,7 @@ mdstart_swap(struct md_s *sc, struct bio /* Actions on further pages start at offset 0 */ p += PAGE_SIZE - offs; offs = 0; + ma_offs += len; } vm_object_pip_subtract(sc->object, 1); VM_OBJECT_WUNLOCK(sc->object); @@ -846,6 +1008,7 @@ mdinit(struct md_s *sc) pp = g_new_providerf(gp, "md%d", sc->unit); pp->mediasize = sc->mediasize; pp->sectorsize = sc->sectorsize; + pp->flags |= G_PF_ACCEPT_UNMAPPED; sc->gp = gp; sc->pp = pp; g_error_provider(pp, 0); @@ -1372,6 +1535,7 @@ g_md_init(struct g_class *mp __unused) sx_xunlock(&md_sx); } } + md_vnode_pbuf_freecnt = nswbuf / 10; status_dev = make_dev(&mdctl_cdevsw, INT_MAX, UID_ROOT, GID_WHEEL, 0600, MDCTL_NAME); g_topology_lock(); From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 15:01:52 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 831BF217; Tue, 19 Mar 2013 15:01:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 660DBD66; Tue, 19 Mar 2013 15:01:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JF1qw6028465; Tue, 19 Mar 2013 15:01:52 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JF1pE9028455; Tue, 19 Mar 2013 15:01:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191501.r2JF1pE9028455@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 15:01:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248519 - in head/sys/cam: . ata scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 15:01:52 -0000 Author: kib Date: Tue Mar 19 15:01:50 2013 New Revision: 248519 URL: http://svnweb.freebsd.org/changeset/base/248519 Log: Support unmapped i/o for the md(4). The vnode-backed md(4) has to map the unmapped bio because VOP_READ() and VOP_WRITE() interfaces do not allow to pass unmapped requests to the filesystem. Vnode-backed md(4) uses pbufs instead of relying on the bio_transient_map, to avoid usual md deadlock. Sponsored by: The FreeBSD Foundation Tested by: pho, scottl Modified: head/sys/cam/ata/ata_da.c head/sys/cam/cam_ccb.h head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_all.h head/sys/cam/scsi/scsi_cd.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Tue Mar 19 14:53:23 2013 (r248518) +++ head/sys/cam/ata/ata_da.c Tue Mar 19 15:01:50 2013 (r248519) @@ -1167,6 +1167,8 @@ adaregister(struct cam_periph *periph, v ((softc->flags & ADA_FLAG_CAN_CFA) && !(softc->flags & ADA_FLAG_CAN_48BIT))) softc->disk->d_flags |= DISKFLAG_CANDELETE; + if ((cpi.hba_misc & PIM_UNMAPPED) != 0) + softc->disk->d_flags |= DISKFLAG_UNMAPPED_BIO; strlcpy(softc->disk->d_descr, cgd->ident_data.model, MIN(sizeof(softc->disk->d_descr), sizeof(cgd->ident_data.model))); strlcpy(softc->disk->d_ident, cgd->ident_data.serial, @@ -1431,13 +1433,19 @@ adastart(struct cam_periph *periph, unio return; } #endif + KASSERT((bp->bio_flags & BIO_UNMAPPED) == 0 || + round_page(bp->bio_bcount + bp->bio_ma_offset) / + PAGE_SIZE == bp->bio_ma_n, + ("Short bio %p", bp)); cam_fill_ataio(ataio, ada_retry_count, adadone, - bp->bio_cmd == BIO_READ ? - CAM_DIR_IN : CAM_DIR_OUT, + (bp->bio_cmd == BIO_READ ? CAM_DIR_IN : + CAM_DIR_OUT) | ((bp->bio_flags & BIO_UNMAPPED) + != 0 ? CAM_DATA_BIO : 0), tag_code, - bp->bio_data, + ((bp->bio_flags & BIO_UNMAPPED) != 0) ? (void *)bp : + bp->bio_data, bp->bio_bcount, ada_default_timeout*1000); Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Tue Mar 19 14:53:23 2013 (r248518) +++ head/sys/cam/cam_ccb.h Tue Mar 19 15:01:50 2013 (r248519) @@ -42,7 +42,6 @@ #include #include - /* General allocation length definitions for CCB structures */ #define IOCDBLEN CAM_MAX_CDBLEN /* Space for CDB bytes/pointer */ #define VUHBALEN 14 /* Vendor Unique HBA length */ @@ -572,7 +571,8 @@ typedef enum { PIM_NOINITIATOR = 0x20, /* Initiator role not supported. */ PIM_NOBUSRESET = 0x10, /* User has disabled initial BUS RESET */ PIM_NO_6_BYTE = 0x08, /* Do not send 6-byte commands */ - PIM_SEQSCAN = 0x04 /* Do bus scans sequentially, not in parallel */ + PIM_SEQSCAN = 0x04, /* Do bus scans sequentially, not in parallel */ + PIM_UNMAPPED = 0x02, } pi_miscflag; /* Path Inquiry CCB */ Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Tue Mar 19 14:53:23 2013 (r248518) +++ head/sys/cam/scsi/scsi_all.c Tue Mar 19 15:01:50 2013 (r248519) @@ -5679,7 +5679,11 @@ scsi_read_write(struct ccb_scsiio *csio, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout) { + int read; u_int8_t cdb_len; + + read = (readop & SCSI_RW_DIRMASK) == SCSI_RW_READ; + /* * Use the smallest possible command to perform the operation * as some legacy hardware does not support the 10 byte commands. @@ -5696,7 +5700,7 @@ scsi_read_write(struct ccb_scsiio *csio, struct scsi_rw_6 *scsi_cmd; scsi_cmd = (struct scsi_rw_6 *)&csio->cdb_io.cdb_bytes; - scsi_cmd->opcode = readop ? READ_6 : WRITE_6; + scsi_cmd->opcode = read ? READ_6 : WRITE_6; scsi_ulto3b(lba, scsi_cmd->addr); scsi_cmd->length = block_count & 0xff; scsi_cmd->control = 0; @@ -5715,7 +5719,7 @@ scsi_read_write(struct ccb_scsiio *csio, struct scsi_rw_10 *scsi_cmd; scsi_cmd = (struct scsi_rw_10 *)&csio->cdb_io.cdb_bytes; - scsi_cmd->opcode = readop ? READ_10 : WRITE_10; + scsi_cmd->opcode = read ? READ_10 : WRITE_10; scsi_cmd->byte2 = byte2; scsi_ulto4b(lba, scsi_cmd->addr); scsi_cmd->reserved = 0; @@ -5738,7 +5742,7 @@ scsi_read_write(struct ccb_scsiio *csio, struct scsi_rw_12 *scsi_cmd; scsi_cmd = (struct scsi_rw_12 *)&csio->cdb_io.cdb_bytes; - scsi_cmd->opcode = readop ? READ_12 : WRITE_12; + scsi_cmd->opcode = read ? READ_12 : WRITE_12; scsi_cmd->byte2 = byte2; scsi_ulto4b(lba, scsi_cmd->addr); scsi_cmd->reserved = 0; @@ -5760,7 +5764,7 @@ scsi_read_write(struct ccb_scsiio *csio, struct scsi_rw_16 *scsi_cmd; scsi_cmd = (struct scsi_rw_16 *)&csio->cdb_io.cdb_bytes; - scsi_cmd->opcode = readop ? READ_16 : WRITE_16; + scsi_cmd->opcode = read ? READ_16 : WRITE_16; scsi_cmd->byte2 = byte2; scsi_u64to8b(lba, scsi_cmd->addr); scsi_cmd->reserved = 0; @@ -5771,7 +5775,8 @@ scsi_read_write(struct ccb_scsiio *csio, cam_fill_csio(csio, retries, cbfcnp, - /*flags*/readop ? CAM_DIR_IN : CAM_DIR_OUT, + (read ? CAM_DIR_IN : CAM_DIR_OUT) | + ((readop & SCSI_RW_BIO) != 0 ? CAM_DATA_BIO : 0), tag_action, data_ptr, dxfer_len, Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Tue Mar 19 14:53:23 2013 (r248518) +++ head/sys/cam/scsi/scsi_all.h Tue Mar 19 15:01:50 2013 (r248519) @@ -2354,6 +2354,10 @@ void scsi_write_buffer(struct ccb_scsiio uint8_t *data_ptr, uint32_t param_list_length, uint8_t sense_len, uint32_t timeout); +#define SCSI_RW_READ 0x0001 +#define SCSI_RW_WRITE 0x0002 +#define SCSI_RW_DIRMASK 0x0003 +#define SCSI_RW_BIO 0x1000 void scsi_read_write(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int readop, u_int8_t byte2, Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Tue Mar 19 14:53:23 2013 (r248518) +++ head/sys/cam/scsi/scsi_cd.c Tue Mar 19 15:01:50 2013 (r248519) @@ -1575,7 +1575,8 @@ cdstart(struct cam_periph *periph, union /*retries*/ cd_retry_count, /* cbfcnp */ cddone, MSG_SIMPLE_Q_TAG, - /* read */bp->bio_cmd == BIO_READ, + /* read */bp->bio_cmd == BIO_READ ? + SCSI_RW_READ : SCSI_RW_WRITE, /* byte2 */ 0, /* minimum_cmd_size */ 10, /* lba */ bp->bio_offset / Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Tue Mar 19 14:53:23 2013 (r248518) +++ head/sys/cam/scsi/scsi_da.c Tue Mar 19 15:01:50 2013 (r248519) @@ -1184,7 +1184,7 @@ dadump(void *arg, void *virtual, vm_offs /*retries*/0, dadone, MSG_ORDERED_Q_TAG, - /*read*/FALSE, + /*read*/SCSI_RW_WRITE, /*byte2*/0, /*minimum_cmd_size*/ softc->minimum_cmd_size, offset / secsize, @@ -1757,6 +1757,8 @@ daregister(struct cam_periph *periph, vo softc->disk->d_flags = 0; if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0) softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; + if ((cpi.hba_misc & PIM_UNMAPPED) != 0) + softc->disk->d_flags |= DISKFLAG_UNMAPPED_BIO; cam_strvis(softc->disk->d_descr, cgd->inq_data.vendor, sizeof(cgd->inq_data.vendor), sizeof(softc->disk->d_descr)); strlcat(softc->disk->d_descr, " ", sizeof(softc->disk->d_descr)); @@ -1985,14 +1987,18 @@ dastart(struct cam_periph *periph, union /*retries*/da_retry_count, /*cbfcnp*/dadone, /*tag_action*/tag_code, - /*read_op*/bp->bio_cmd - == BIO_READ, + /*read_op*/(bp->bio_cmd == BIO_READ ? + SCSI_RW_READ : SCSI_RW_WRITE) | + ((bp->bio_flags & BIO_UNMAPPED) != 0 ? + SCSI_RW_BIO : 0), /*byte2*/0, softc->minimum_cmd_size, /*lba*/bp->bio_pblkno, /*block_count*/bp->bio_bcount / softc->params.secsize, - /*data_ptr*/ bp->bio_data, + /*data_ptr*/ (bp->bio_flags & + BIO_UNMAPPED) != 0 ? (void *)bp : + bp->bio_data, /*dxfer_len*/ bp->bio_bcount, /*sense_len*/SSD_FULL_SIZE, da_default_timeout * 1000); From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 15:05:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 870D5406; Tue, 19 Mar 2013 15:05:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6ED18D8B; Tue, 19 Mar 2013 15:05:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JF5Mie029097; Tue, 19 Mar 2013 15:05:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JF5Mo6029096; Tue, 19 Mar 2013 15:05:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191505.r2JF5Mo6029096@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 15:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248520 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 15:05:22 -0000 Author: kib Date: Tue Mar 19 15:05:21 2013 New Revision: 248520 URL: http://svnweb.freebsd.org/changeset/base/248520 Log: Commit the removal of a whitespace to record the proper commit message for the r248519: For the cam-attached HBAs, allow the driver to specify that it accepts the unmapped bio by the PIM_UNMAPPED flag. The CAM passes the CAM_DATA_BIO data transfer type request for the unmapped bio, and the driver could use the bus_dmamap_load_ccb() as a helper to transparently handle the ccb. Sponsored by: The FreeBSD Foundation Reviewed by: scottl Tested by: pho, scottl Modified: head/sys/cam/cam_ccb.h Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Tue Mar 19 15:01:50 2013 (r248519) +++ head/sys/cam/cam_ccb.h Tue Mar 19 15:05:21 2013 (r248520) @@ -99,7 +99,7 @@ typedef enum { CAM_MSGB_VALID = 0x10000000,/* Message buffer valid */ CAM_STATUS_VALID = 0x20000000,/* Status buffer valid */ CAM_DATAB_VALID = 0x40000000,/* Data buffer valid */ - + /* Host target Mode flags */ CAM_SEND_SENSE = 0x08000000,/* Send sense data with status */ CAM_TERM_IO = 0x10000000,/* Terminate I/O Message sup. */ From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 15:08:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B85F3753; Tue, 19 Mar 2013 15:08:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9AEBDDBE; Tue, 19 Mar 2013 15:08:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JF8GLX029744; Tue, 19 Mar 2013 15:08:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JF8FJE029739; Tue, 19 Mar 2013 15:08:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191508.r2JF8FJE029739@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 15:08:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248521 - in head/sys/ufs: ffs ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 15:08:16 -0000 Author: kib Date: Tue Mar 19 15:08:15 2013 New Revision: 248521 URL: http://svnweb.freebsd.org/changeset/base/248521 Log: UFS support of the unmapped i/o for the user data buffers. Sponsored by: The FreeBSD Foundation Tested by: pho, scottl, jhb, bf Modified: head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_balloc.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ffs/ffs_vnops.c head/sys/ufs/ufs/ufs_extern.h Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Tue Mar 19 15:05:21 2013 (r248520) +++ head/sys/ufs/ffs/ffs_alloc.c Tue Mar 19 15:08:15 2013 (r248521) @@ -254,7 +254,7 @@ ffs_realloccg(ip, lbprev, bprev, bpref, struct buf *bp; struct ufsmount *ump; u_int cg, request, reclaimed; - int error; + int error, gbflags; ufs2_daddr_t bno; static struct timeval lastfail; static int curfail; @@ -265,6 +265,8 @@ ffs_realloccg(ip, lbprev, bprev, bpref, fs = ip->i_fs; bp = NULL; ump = ip->i_ump; + gbflags = (flags & BA_UNMAPPED) != 0 ? GB_UNMAPPED : 0; + mtx_assert(UFS_MTX(ump), MA_OWNED); #ifdef INVARIANTS if (vp->v_mount->mnt_kern_flag & MNTK_SUSPENDED) @@ -296,7 +298,7 @@ retry: /* * Allocate the extra space in the buffer. */ - error = bread(vp, lbprev, osize, NOCRED, &bp); + error = bread_gb(vp, lbprev, osize, NOCRED, gbflags, &bp); if (error) { brelse(bp); return (error); @@ -332,7 +334,7 @@ retry: ip->i_flag |= IN_CHANGE | IN_UPDATE; allocbuf(bp, nsize); bp->b_flags |= B_DONE; - bzero(bp->b_data + osize, nsize - osize); + vfs_bio_bzero_buf(bp, osize, nsize - osize); if ((bp->b_flags & (B_MALLOC | B_VMIO)) == B_VMIO) vfs_bio_set_valid(bp, osize, nsize - osize); *bpp = bp; @@ -400,7 +402,7 @@ retry: ip->i_flag |= IN_CHANGE | IN_UPDATE; allocbuf(bp, nsize); bp->b_flags |= B_DONE; - bzero(bp->b_data + osize, nsize - osize); + vfs_bio_bzero_buf(bp, osize, nsize - osize); if ((bp->b_flags & (B_MALLOC | B_VMIO)) == B_VMIO) vfs_bio_set_valid(bp, osize, nsize - osize); *bpp = bp; Modified: head/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_balloc.c Tue Mar 19 15:05:21 2013 (r248520) +++ head/sys/ufs/ffs/ffs_balloc.c Tue Mar 19 15:08:15 2013 (r248521) @@ -107,7 +107,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t int saved_inbdflush; static struct timeval lastfail; static int curfail; - int reclaimed; + int gbflags, reclaimed; ip = VTOI(vp); dp = ip->i_din1; @@ -123,6 +123,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t return (EOPNOTSUPP); if (lbn < 0) return (EFBIG); + gbflags = (flags & BA_UNMAPPED) != 0 ? GB_UNMAPPED : 0; if (DOINGSOFTDEP(vp)) softdep_prealloc(vp, MNT_WAIT); @@ -211,7 +212,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t nsize, flags, cred, &newb); if (error) return (error); - bp = getblk(vp, lbn, nsize, 0, 0, 0); + bp = getblk(vp, lbn, nsize, 0, 0, gbflags); bp->b_blkno = fsbtodb(fs, newb); if (flags & BA_CLRBUF) vfs_bio_clrbuf(bp); @@ -255,7 +256,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t nb = newb; *allocblk++ = nb; *lbns_remfree++ = indirs[1].in_lbn; - bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, 0); + bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, gbflags); bp->b_blkno = fsbtodb(fs, nb); vfs_bio_clrbuf(bp); if (DOINGSOFTDEP(vp)) { @@ -389,7 +390,7 @@ retry: nb = newb; *allocblk++ = nb; *lbns_remfree++ = lbn; - nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, 0); + nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags); nbp->b_blkno = fsbtodb(fs, nb); if (flags & BA_CLRBUF) vfs_bio_clrbuf(nbp); @@ -418,16 +419,17 @@ retry: if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) { error = cluster_read(vp, ip->i_size, lbn, (int)fs->fs_bsize, NOCRED, - MAXBSIZE, seqcount, 0, &nbp); + MAXBSIZE, seqcount, gbflags, &nbp); } else { - error = bread(vp, lbn, (int)fs->fs_bsize, NOCRED, &nbp); + error = bread_gb(vp, lbn, (int)fs->fs_bsize, NOCRED, + gbflags, &nbp); } if (error) { brelse(nbp); goto fail; } } else { - nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, 0); + nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags); nbp->b_blkno = fsbtodb(fs, nb); } curthread_pflags_restore(saved_inbdflush); @@ -539,7 +541,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t int saved_inbdflush; static struct timeval lastfail; static int curfail; - int reclaimed; + int gbflags, reclaimed; ip = VTOI(vp); dp = ip->i_din2; @@ -553,6 +555,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t *bpp = NULL; if (lbn < 0) return (EFBIG); + gbflags = (flags & BA_UNMAPPED) != 0 ? GB_UNMAPPED : 0; if (DOINGSOFTDEP(vp)) softdep_prealloc(vp, MNT_WAIT); @@ -603,7 +606,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t panic("ffs_balloc_ufs2: BA_METAONLY for ext block"); nb = dp->di_extb[lbn]; if (nb != 0 && dp->di_extsize >= smalllblktosize(fs, lbn + 1)) { - error = bread(vp, -1 - lbn, fs->fs_bsize, NOCRED, &bp); + error = bread_gb(vp, -1 - lbn, fs->fs_bsize, NOCRED, + gbflags, &bp); if (error) { brelse(bp); return (error); @@ -620,7 +624,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t osize = fragroundup(fs, blkoff(fs, dp->di_extsize)); nsize = fragroundup(fs, size); if (nsize <= osize) { - error = bread(vp, -1 - lbn, osize, NOCRED, &bp); + error = bread_gb(vp, -1 - lbn, osize, NOCRED, + gbflags, &bp); if (error) { brelse(bp); return (error); @@ -653,7 +658,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t nsize, flags, cred, &newb); if (error) return (error); - bp = getblk(vp, -1 - lbn, nsize, 0, 0, 0); + bp = getblk(vp, -1 - lbn, nsize, 0, 0, gbflags); bp->b_blkno = fsbtodb(fs, newb); bp->b_xflags |= BX_ALTDATA; if (flags & BA_CLRBUF) @@ -707,7 +712,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t panic("ffs_balloc_ufs2: BA_METAONLY for direct block"); nb = dp->di_db[lbn]; if (nb != 0 && ip->i_size >= smalllblktosize(fs, lbn + 1)) { - error = bread(vp, lbn, fs->fs_bsize, NOCRED, &bp); + error = bread_gb(vp, lbn, fs->fs_bsize, NOCRED, + gbflags, &bp); if (error) { brelse(bp); return (error); @@ -723,7 +729,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t osize = fragroundup(fs, blkoff(fs, ip->i_size)); nsize = fragroundup(fs, size); if (nsize <= osize) { - error = bread(vp, lbn, osize, NOCRED, &bp); + error = bread_gb(vp, lbn, osize, NOCRED, + gbflags, &bp); if (error) { brelse(bp); return (error); @@ -753,7 +760,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t &dp->di_db[0]), nsize, flags, cred, &newb); if (error) return (error); - bp = getblk(vp, lbn, nsize, 0, 0, 0); + bp = getblk(vp, lbn, nsize, 0, 0, gbflags); bp->b_blkno = fsbtodb(fs, newb); if (flags & BA_CLRBUF) vfs_bio_clrbuf(bp); @@ -797,7 +804,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t nb = newb; *allocblk++ = nb; *lbns_remfree++ = indirs[1].in_lbn; - bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, 0); + bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, + GB_UNMAPPED); bp->b_blkno = fsbtodb(fs, nb); vfs_bio_clrbuf(bp); if (DOINGSOFTDEP(vp)) { @@ -862,7 +870,8 @@ retry: nb = newb; *allocblk++ = nb; *lbns_remfree++ = indirs[i].in_lbn; - nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0, 0); + nbp = getblk(vp, indirs[i].in_lbn, fs->fs_bsize, 0, 0, + GB_UNMAPPED); nbp->b_blkno = fsbtodb(fs, nb); vfs_bio_clrbuf(nbp); if (DOINGSOFTDEP(vp)) { @@ -931,7 +940,7 @@ retry: nb = newb; *allocblk++ = nb; *lbns_remfree++ = lbn; - nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, 0); + nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags); nbp->b_blkno = fsbtodb(fs, nb); if (flags & BA_CLRBUF) vfs_bio_clrbuf(nbp); @@ -966,16 +975,17 @@ retry: if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) { error = cluster_read(vp, ip->i_size, lbn, (int)fs->fs_bsize, NOCRED, - MAXBSIZE, seqcount, 0, &nbp); + MAXBSIZE, seqcount, gbflags, &nbp); } else { - error = bread(vp, lbn, (int)fs->fs_bsize, NOCRED, &nbp); + error = bread_gb(vp, lbn, (int)fs->fs_bsize, + NOCRED, gbflags, &nbp); } if (error) { brelse(nbp); goto fail; } } else { - nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, 0); + nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags); nbp->b_blkno = fsbtodb(fs, nb); } curthread_pflags_restore(saved_inbdflush); Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Tue Mar 19 15:05:21 2013 (r248520) +++ head/sys/ufs/ffs/ffs_vfsops.c Tue Mar 19 15:08:15 2013 (r248521) @@ -1076,7 +1076,7 @@ ffs_mountfs(devvp, mp, td) */ MNT_ILOCK(mp); mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED | - MNTK_NO_IOPF; + MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS; MNT_IUNLOCK(mp); #ifdef UFS_EXTATTR #ifdef UFS_EXTATTR_AUTOSTART @@ -2110,6 +2110,7 @@ ffs_bufwrite(struct buf *bp) * set b_lblkno and BKGRDMARKER before calling bgetvp() * to avoid confusing the splay tree and gbincore(). */ + KASSERT((bp->b_flags & B_UNMAPPED) == 0, ("Unmapped cg")); memcpy(newbp->b_data, bp->b_data, bp->b_bufsize); newbp->b_lblkno = bp->b_lblkno; newbp->b_xflags |= BX_BKGRDMARKER; Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Tue Mar 19 15:05:21 2013 (r248520) +++ head/sys/ufs/ffs/ffs_vnops.c Tue Mar 19 15:08:15 2013 (r248521) @@ -509,7 +509,8 @@ ffs_read(ap) /* * Don't do readahead if this is the end of the file. */ - error = bread(vp, lbn, size, NOCRED, &bp); + error = bread_gb(vp, lbn, size, NOCRED, + GB_UNMAPPED, &bp); } else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) { /* * Otherwise if we are allowed to cluster, @@ -520,7 +521,7 @@ ffs_read(ap) */ error = cluster_read(vp, ip->i_size, lbn, size, NOCRED, blkoffset + uio->uio_resid, - seqcount, 0, &bp); + seqcount, GB_UNMAPPED, &bp); } else if (seqcount > 1) { /* * If we are NOT allowed to cluster, then @@ -531,15 +532,16 @@ ffs_read(ap) * the 6th argument. */ int nextsize = blksize(fs, ip, nextlbn); - error = breadn(vp, lbn, - size, &nextlbn, &nextsize, 1, NOCRED, &bp); + error = breadn_flags(vp, lbn, size, &nextlbn, + &nextsize, 1, NOCRED, GB_UNMAPPED, &bp); } else { /* * Failing all of the above, just read what the * user asked for. Interestingly, the same as * the first option above. */ - error = bread(vp, lbn, size, NOCRED, &bp); + error = bread_gb(vp, lbn, size, NOCRED, + GB_UNMAPPED, &bp); } if (error) { brelse(bp); @@ -570,8 +572,13 @@ ffs_read(ap) xfersize = size; } - error = vn_io_fault_uiomove((char *)bp->b_data + blkoffset, - (int)xfersize, uio); + if ((bp->b_flags & B_UNMAPPED) == 0) { + error = vn_io_fault_uiomove((char *)bp->b_data + + blkoffset, (int)xfersize, uio); + } else { + error = vn_io_fault_pgmove(bp->b_pages, blkoffset, + (int)xfersize, uio); + } if (error) break; @@ -702,6 +709,7 @@ ffs_write(ap) flags = seqcount << BA_SEQSHIFT; if ((ioflag & IO_SYNC) && !DOINGASYNC(vp)) flags |= IO_SYNC; + flags |= BA_UNMAPPED; for (error = 0; uio->uio_resid > 0;) { lbn = lblkno(fs, uio->uio_offset); @@ -741,8 +749,13 @@ ffs_write(ap) if (size < xfersize) xfersize = size; - error = vn_io_fault_uiomove((char *)bp->b_data + blkoffset, - (int)xfersize, uio); + if ((bp->b_flags & B_UNMAPPED) == 0) { + error = vn_io_fault_uiomove((char *)bp->b_data + + blkoffset, (int)xfersize, uio); + } else { + error = vn_io_fault_pgmove(bp->b_pages, blkoffset, + (int)xfersize, uio); + } /* * If the buffer is not already filled and we encounter an * error while trying to fill it, we have to clear out any @@ -786,7 +799,7 @@ ffs_write(ap) if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) { bp->b_flags |= B_CLUSTEROK; cluster_write(vp, bp, ip->i_size, seqcount, - 0); + GB_UNMAPPED); } else { bawrite(bp); } Modified: head/sys/ufs/ufs/ufs_extern.h ============================================================================== --- head/sys/ufs/ufs/ufs_extern.h Tue Mar 19 15:05:21 2013 (r248520) +++ head/sys/ufs/ufs/ufs_extern.h Tue Mar 19 15:08:15 2013 (r248521) @@ -121,6 +121,7 @@ void softdep_revert_rmdir(struct inode * */ #define BA_CLRBUF 0x00010000 /* Clear invalid areas of buffer. */ #define BA_METAONLY 0x00020000 /* Return indirect block buffer. */ +#define BA_UNMAPPED 0x00040000 /* Do not mmap resulted buffer. */ #define BA_SEQMASK 0x7F000000 /* Bits holding seq heuristic. */ #define BA_SEQSHIFT 24 #define BA_SEQMAX 0x7F From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 15:09:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A3D4D9A8; Tue, 19 Mar 2013 15:09:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8B62EDD1; Tue, 19 Mar 2013 15:09:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JF9X9v030087; Tue, 19 Mar 2013 15:09:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JF9XQu030084; Tue, 19 Mar 2013 15:09:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191509.r2JF9XQu030084@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 15:09:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248522 - in head/sys/dev: ahci siis X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 15:09:33 -0000 Author: kib Date: Tue Mar 19 15:09:32 2013 New Revision: 248522 URL: http://svnweb.freebsd.org/changeset/base/248522 Log: ahci(4) and siis(4) are ready to process the unmapped i/o requests Sponsored by: The FreeBSD Foundation Tested by: pho Submitted by: bf (siis patch) Modified: head/sys/dev/ahci/ahci.c head/sys/dev/siis/siis.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Tue Mar 19 15:08:15 2013 (r248521) +++ head/sys/dev/ahci/ahci.c Tue Mar 19 15:09:32 2013 (r248522) @@ -2903,7 +2903,7 @@ ahciaction(struct cam_sim *sim, union cc if (ch->caps & AHCI_CAP_SPM) cpi->hba_inquiry |= PI_SATAPM; cpi->target_sprt = 0; - cpi->hba_misc = PIM_SEQSCAN; + cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED; cpi->hba_eng_cnt = 0; if (ch->caps & AHCI_CAP_SPM) cpi->max_target = 15; Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Tue Mar 19 15:08:15 2013 (r248521) +++ head/sys/dev/siis/siis.c Tue Mar 19 15:09:32 2013 (r248522) @@ -1939,7 +1939,7 @@ siisaction(struct cam_sim *sim, union cc cpi->hba_inquiry = PI_SDTR_ABLE | PI_TAG_ABLE; cpi->hba_inquiry |= PI_SATAPM; cpi->target_sprt = 0; - cpi->hba_misc = PIM_SEQSCAN; + cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED; cpi->hba_eng_cnt = 0; cpi->max_target = 15; cpi->max_lun = 0; From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 16:57:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E713AFA5; Tue, 19 Mar 2013 16:57:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D9C5A685; Tue, 19 Mar 2013 16:57:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JGv4QQ064063; Tue, 19 Mar 2013 16:57:04 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JGv4hk064062; Tue, 19 Mar 2013 16:57:04 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201303191657.r2JGv4hk064062@svn.freebsd.org> From: Warner Losh Date: Tue, 19 Mar 2013 16:57:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248525 - head/sbin/ldconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 16:57:05 -0000 Author: imp Date: Tue Mar 19 16:57:04 2013 New Revision: 248525 URL: http://svnweb.freebsd.org/changeset/base/248525 Log: Add a comment about why aout support is still here: We need it for compat2x, which is still in use, as evidence by recent bug reports. Modified: head/sbin/ldconfig/ldconfig.c Modified: head/sbin/ldconfig/ldconfig.c ============================================================================== --- head/sbin/ldconfig/ldconfig.c Tue Mar 19 16:33:43 2013 (r248524) +++ head/sbin/ldconfig/ldconfig.c Tue Mar 19 16:57:04 2013 (r248525) @@ -97,6 +97,13 @@ static void listhints(void); static int readhints(void); static void usage(void); +/* + * Note on aout/a.out support. + * To properly support shared libraries for compat2x, which are a.out, we need + * to support a.out here. As of 2013, bug reports are still coming in for this + * feature (on amd64 no less), so we know it is still in use. + */ + int main(int argc, char **argv) { From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 17:54:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D183E599; Tue, 19 Mar 2013 17:54:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C444C9E3; Tue, 19 Mar 2013 17:54:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JHscF9081677; Tue, 19 Mar 2013 17:54:38 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JHsci5081676; Tue, 19 Mar 2013 17:54:38 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303191754.r2JHsci5081676@svn.freebsd.org> From: Adrian Chadd Date: Tue, 19 Mar 2013 17:54:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248527 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 17:54:38 -0000 Author: adrian Date: Tue Mar 19 17:54:37 2013 New Revision: 248527 URL: http://svnweb.freebsd.org/changeset/base/248527 Log: Now that the tx map field is correctly populated for both edma and legacy chips, just use that. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Tue Mar 19 17:13:47 2013 (r248526) +++ head/sys/dev/ath/if_ath_tx.c Tue Mar 19 17:54:37 2013 (r248527) @@ -384,14 +384,11 @@ ath_tx_chaindesclist(struct ath_softc *s */ /* - * For now the HAL doesn't implement halNumTxMaps for non-EDMA - * (ie it's 0.) So just work around it. - * - * XXX TODO: populate halNumTxMaps for each HAL chip and - * then undo this hack. + * We need the number of TX data pointers in each descriptor. + * EDMA and later chips support 4 TX buffers per descriptor; + * previous chips just support one. */ - if (sc->sc_ah->ah_magic == 0x19741014) - numTxMaps = 4; + numTxMaps = sc->sc_tx_nmaps; /* * For EDMA and later chips ensure the TX map is fully populated From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 17:55:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 32B46718; Tue, 19 Mar 2013 17:55:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0B68D9F2; Tue, 19 Mar 2013 17:55:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JHta68081894; Tue, 19 Mar 2013 17:55:36 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JHtaCd081893; Tue, 19 Mar 2013 17:55:36 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303191755.r2JHtaCd081893@svn.freebsd.org> From: Adrian Chadd Date: Tue, 19 Mar 2013 17:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248528 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 17:55:37 -0000 Author: adrian Date: Tue Mar 19 17:55:36 2013 New Revision: 248528 URL: http://svnweb.freebsd.org/changeset/base/248528 Log: Add more TODO items. Modified: head/sys/dev/ath/if_ath_beacon.c Modified: head/sys/dev/ath/if_ath_beacon.c ============================================================================== --- head/sys/dev/ath/if_ath_beacon.c Tue Mar 19 17:54:37 2013 (r248527) +++ head/sys/dev/ath/if_ath_beacon.c Tue Mar 19 17:55:36 2013 (r248528) @@ -570,7 +570,14 @@ ath_beacon_generate(struct ath_softc *sc /* * Move frames from the s/w mcast q to the h/w cab q. - * XXX MORE_DATA bit + * XXX TODO: walk the list, update MORE_DATA bit + * XXX TODO: or maybe, set the MORE data bit in the + * TX descriptor(s) here? + * + * XXX TODO: we're still pushing a CABQ frame list to + * AR9380 hosts; but we don't (yet) populate + * the ATH_BUF_BUSY flag in the EDMA + * completion task (for CABQ, though!) */ bfm = TAILQ_FIRST(&avp->av_mcastq.axq_q); if (cabq->axq_link != NULL) { From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 19:32:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 472328ED; Tue, 19 Mar 2013 19:32:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 37A89F89; Tue, 19 Mar 2013 19:32:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JJWTU3013019; Tue, 19 Mar 2013 19:32:29 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JJWSUi013015; Tue, 19 Mar 2013 19:32:28 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303191932.r2JJWSUi013015@svn.freebsd.org> From: Adrian Chadd Date: Tue, 19 Mar 2013 19:32:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248529 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 19:32:29 -0000 Author: adrian Date: Tue Mar 19 19:32:28 2013 New Revision: 248529 URL: http://svnweb.freebsd.org/changeset/base/248529 Log: Break out the RX completion path into "FIFO check / refill" and "complete RX frames." The 128 entry RX FIFO is really easy to fill up and miss refilling when it's done in the ath taskq - as that gets blocked up doing RX completion, TX completion and other random things. So the 128 entry RX FIFO now gets emptied and refilled in the ath_intr() task (and it grabs / releases locks, so now ath_intr() can't just be a FAST handler yet!) but the locks aren't held for very long. The completion part is done in the ath taskqueue context. Details: * Create a new completed frame list - sc->sc_rx_rxlist; * Split the EDMA RX process queue into two halves - one that processes the RX FIFO and refills it with new frames; another that completes the completed frame list; * When tearing down the driver, flush whatever is in the deferred queue as well as what's in the FIFO; * Create two new RX methods - one that processes all RX queues, one that processes the given RX queue. When MSI is implemented, we get told which RX queue the interrupt came in on so we can specifically schedule that. (And I can do that with the non-MSI path too; I'll figure that out later.) * Convert the legacy code over to use these new RX methods; * Replace all the instances of the RX taskqueue enqueue with a call to a relevant RX method to enqueue one or all RX queues. Tested: * AR9380, STA * AR9580, STA * AR5413, STA Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_rx.c head/sys/dev/ath/if_ath_rx_edma.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Tue Mar 19 17:55:36 2013 (r248528) +++ head/sys/dev/ath/if_ath.c Tue Mar 19 19:32:28 2013 (r248529) @@ -837,6 +837,11 @@ ath_attach(u_int16_t devid, struct ath_s } /* + * Initialise the deferred completed RX buffer list. + */ + TAILQ_INIT(&sc->sc_rx_rxlist); + + /* * Indicate we need the 802.11 header padded to a * 32-bit boundary for 4-address and QoS frames. */ @@ -1711,7 +1716,7 @@ ath_intr(void *arg) * traffic so any frames held on the staging * queue are aged and potentially flushed. */ - taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask); + sc->sc_rx.recv_sched(sc, 1); #endif } } @@ -1751,13 +1756,13 @@ ath_intr(void *arg) if (! sc->sc_kickpcu) sc->sc_rxlink = NULL; sc->sc_kickpcu = 1; + ATH_PCU_UNLOCK(sc); /* * Enqueue an RX proc, to handled whatever * is in the RX queue. * This will then kick the PCU. */ - taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask); - ATH_PCU_UNLOCK(sc); + sc->sc_rx.recv_sched(sc, 1); } if (status & HAL_INT_TXURN) { sc->sc_stats.ast_txurn++; @@ -1770,7 +1775,7 @@ ath_intr(void *arg) */ if (status & (HAL_INT_RX | HAL_INT_RXHP | HAL_INT_RXLP)) { sc->sc_stats.ast_rx_intr++; - taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask); + sc->sc_rx.recv_sched(sc, 1); } if (status & HAL_INT_TX) { sc->sc_stats.ast_tx_intr++; Modified: head/sys/dev/ath/if_ath_rx.c ============================================================================== --- head/sys/dev/ath/if_ath_rx.c Tue Mar 19 17:55:36 2013 (r248528) +++ head/sys/dev/ath/if_ath_rx.c Tue Mar 19 19:32:28 2013 (r248529) @@ -1030,7 +1030,7 @@ rx_proc_next: * will reduce latency. */ if (npkts >= ATH_RX_MAX) - taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask); + sc->sc_rx.recv_sched(sc, resched); ATH_PCU_LOCK(sc); sc->sc_rxproc_cnt--; @@ -1181,6 +1181,21 @@ ath_legacy_dma_rxteardown(struct ath_sof return (0); } +static void +ath_legacy_recv_sched(struct ath_softc *sc, int dosched) +{ + + taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask); +} + +static void +ath_legacy_recv_sched_queue(struct ath_softc *sc, HAL_RX_QUEUE q, + int dosched) +{ + + taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask); +} + void ath_recv_setup_legacy(struct ath_softc *sc) { @@ -1200,4 +1215,6 @@ ath_recv_setup_legacy(struct ath_softc * sc->sc_rx.recv_setup = ath_legacy_dma_rxsetup; sc->sc_rx.recv_teardown = ath_legacy_dma_rxteardown; + sc->sc_rx.recv_sched = ath_legacy_recv_sched; + sc->sc_rx.recv_sched_queue = ath_legacy_recv_sched_queue; } Modified: head/sys/dev/ath/if_ath_rx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_rx_edma.c Tue Mar 19 17:55:36 2013 (r248528) +++ head/sys/dev/ath/if_ath_rx_edma.c Tue Mar 19 19:32:28 2013 (r248529) @@ -132,12 +132,8 @@ MALLOC_DECLARE(M_ATHDEV); /* * XXX TODO: * - * + Add an RX lock, just to ensure we don't have things clash; * + Make sure the FIFO is correctly flushed and reinitialised * through a reset; - * + Handle the "kickpcu" state where the FIFO overflows. - * + Implement a "flush" routine, which doesn't push any - * new frames into the FIFO. * + Verify multi-descriptor frames work! * + There's a "memory use after free" which needs to be tracked down * and fixed ASAP. I've seen this in the legacy path too, so it @@ -152,7 +148,9 @@ static int ath_edma_rxfifo_alloc(struct int nbufs); static int ath_edma_rxfifo_flush(struct ath_softc *sc, HAL_RX_QUEUE qtype); static void ath_edma_rxbuf_free(struct ath_softc *sc, struct ath_buf *bf); -static int ath_edma_recv_proc_queue(struct ath_softc *sc, +static void ath_edma_recv_proc_queue(struct ath_softc *sc, + HAL_RX_QUEUE qtype, int dosched); +static int ath_edma_recv_proc_deferred_queue(struct ath_softc *sc, HAL_RX_QUEUE qtype, int dosched); static void @@ -283,6 +281,24 @@ ath_edma_startrecv(struct ath_softc *sc) } static void +ath_edma_recv_sched_queue(struct ath_softc *sc, HAL_RX_QUEUE qtype, + int dosched) +{ + + ath_edma_recv_proc_queue(sc, qtype, dosched); + taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask); +} + +static void +ath_edma_recv_sched(struct ath_softc *sc, int dosched) +{ + + ath_edma_recv_proc_queue(sc, HAL_RX_QUEUE_HP, dosched); + ath_edma_recv_proc_queue(sc, HAL_RX_QUEUE_LP, dosched); + taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask); +} + +static void ath_edma_recv_flush(struct ath_softc *sc) { @@ -292,27 +308,27 @@ ath_edma_recv_flush(struct ath_softc *sc sc->sc_rxproc_cnt++; ATH_PCU_UNLOCK(sc); + /* + * Flush any active frames from FIFO -> deferred list + */ ath_edma_recv_proc_queue(sc, HAL_RX_QUEUE_HP, 0); ath_edma_recv_proc_queue(sc, HAL_RX_QUEUE_LP, 0); + /* + * Process what's in the deferred queue + */ + ath_edma_recv_proc_deferred_queue(sc, HAL_RX_QUEUE_HP, 0); + ath_edma_recv_proc_deferred_queue(sc, HAL_RX_QUEUE_LP, 0); + ATH_PCU_LOCK(sc); sc->sc_rxproc_cnt--; ATH_PCU_UNLOCK(sc); } /* - * Process frames from the current queue. - * - * TODO: - * - * + Add a "dosched" flag, so we don't reschedule any FIFO frames - * to the hardware or re-kick the PCU after 'kickpcu' is set. - * - * + Perhaps split "check FIFO contents" and "handle frames", so - * we can run the "check FIFO contents" in ath_intr(), but - * "handle frames" in the RX tasklet. + * Process frames from the current queue into the deferred queue. */ -static int +static void ath_edma_recv_proc_queue(struct ath_softc *sc, HAL_RX_QUEUE qtype, int dosched) { @@ -323,12 +339,8 @@ ath_edma_recv_proc_queue(struct ath_soft struct mbuf *m; struct ath_hal *ah = sc->sc_ah; uint64_t tsf; - int16_t nf; - int ngood = 0, npkts = 0; - ath_bufhead rxlist; - struct ath_buf *next; - - TAILQ_INIT(&rxlist); + uint16_t nf; + int npkts = 0; tsf = ath_hal_gettsf64(ah); nf = ath_hal_getchannoise(ah, sc->sc_curchan); @@ -386,7 +398,7 @@ ath_edma_recv_proc_queue(struct ath_soft * queue. */ re->m_fifo[re->m_fifo_head] = NULL; - TAILQ_INSERT_TAIL(&rxlist, bf, bf_list); + TAILQ_INSERT_TAIL(&sc->sc_rx_rxlist, bf, bf_list); /* Bump the descriptor FIFO stats */ INCR(re->m_fifo_head, re->m_fifolen); @@ -400,6 +412,78 @@ ath_edma_recv_proc_queue(struct ath_soft ATH_RX_UNLOCK(sc); + /* rx signal state monitoring */ + ath_hal_rxmonitor(ah, &sc->sc_halstats, sc->sc_curchan); + + ATH_KTR(sc, ATH_KTR_INTERRUPTS, 1, + "ath edma rx proc: npkts=%d\n", + npkts); + + /* Handle resched and kickpcu appropriately */ + ATH_PCU_LOCK(sc); + if (dosched && sc->sc_kickpcu) { + ATH_KTR(sc, ATH_KTR_ERROR, 0, + "ath_edma_recv_proc_queue(): kickpcu"); + device_printf(sc->sc_dev, + "%s: handled npkts %d\n", + __func__, npkts); + + /* + * XXX TODO: what should occur here? Just re-poke and + * re-enable the RX FIFO? + */ + sc->sc_kickpcu = 0; + } + ATH_PCU_UNLOCK(sc); + + return; +} + +/* + * Flush the deferred queue. + * + * This destructively flushes the deferred queue - it doesn't + * call the wireless stack on each mbuf. + */ +static void +ath_edma_flush_deferred_queue(struct ath_softc *sc) +{ + struct ath_buf *bf, *next; + + ATH_RX_LOCK_ASSERT(sc); + /* Free in one set, inside the lock */ + TAILQ_FOREACH_SAFE(bf, &sc->sc_rx_rxlist, bf_list, next) { + /* Free the buffer/mbuf */ + ath_edma_rxbuf_free(sc, bf); + } +} + +static int +ath_edma_recv_proc_deferred_queue(struct ath_softc *sc, HAL_RX_QUEUE qtype, + int dosched) +{ + int ngood = 0; + uint64_t tsf; + struct ath_buf *bf, *next; + struct ath_rx_status *rs; + int16_t nf; + ath_bufhead rxlist; + + TAILQ_INIT(&rxlist); + + nf = ath_hal_getchannoise(sc->sc_ah, sc->sc_curchan); + /* + * XXX TODO: the NF/TSF should be stamped on the bufs themselves, + * otherwise we may end up adding in the wrong values if this + * is delayed too far.. + */ + tsf = ath_hal_gettsf64(sc->sc_ah); + + /* Copy the list over */ + ATH_RX_LOCK(sc); + TAILQ_CONCAT(&rxlist, &sc->sc_rx_rxlist, bf_list); + ATH_RX_UNLOCK(sc); + /* Handle the completed descriptors */ TAILQ_FOREACH_SAFE(bf, &rxlist, bf_list, next) { /* @@ -417,6 +501,14 @@ ath_edma_recv_proc_queue(struct ath_soft ngood++; } + if (ngood) { + sc->sc_lastrx = tsf; + } + + ATH_KTR(sc, ATH_KTR_INTERRUPTS, 1, + "ath edma rx deferred proc: ngood=%d\n", + ngood); + /* Free in one set, inside the lock */ ATH_RX_LOCK(sc); TAILQ_FOREACH_SAFE(bf, &rxlist, bf_list, next) { @@ -425,32 +517,6 @@ ath_edma_recv_proc_queue(struct ath_soft } ATH_RX_UNLOCK(sc); - /* rx signal state monitoring */ - ath_hal_rxmonitor(ah, &sc->sc_halstats, sc->sc_curchan); - if (ngood) - sc->sc_lastrx = tsf; - - ATH_KTR(sc, ATH_KTR_INTERRUPTS, 2, - "ath edma rx proc: npkts=%d, ngood=%d", - npkts, ngood); - - /* Handle resched and kickpcu appropriately */ - ATH_PCU_LOCK(sc); - if (dosched && sc->sc_kickpcu) { - ATH_KTR(sc, ATH_KTR_ERROR, 0, - "ath_edma_recv_proc_queue(): kickpcu"); - device_printf(sc->sc_dev, - "%s: handled npkts %d ngood %d\n", - __func__, npkts, ngood); - - /* - * XXX TODO: what should occur here? Just re-poke and - * re-enable the RX FIFO? - */ - sc->sc_kickpcu = 0; - } - ATH_PCU_UNLOCK(sc); - return (ngood); } @@ -480,6 +546,9 @@ ath_edma_recv_tasklet(void *arg, int npe ath_edma_recv_proc_queue(sc, HAL_RX_QUEUE_HP, 1); ath_edma_recv_proc_queue(sc, HAL_RX_QUEUE_LP, 1); + ath_edma_recv_proc_deferred_queue(sc, HAL_RX_QUEUE_HP, 1); + ath_edma_recv_proc_deferred_queue(sc, HAL_RX_QUEUE_LP, 1); + /* XXX inside IF_LOCK ? */ if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0) { #ifdef IEEE80211_SUPPORT_SUPERG @@ -812,6 +881,7 @@ ath_edma_dma_rxteardown(struct ath_softc { ATH_RX_LOCK(sc); + ath_edma_flush_deferred_queue(sc); ath_edma_rxfifo_flush(sc, HAL_RX_QUEUE_HP); ath_edma_rxfifo_free(sc, HAL_RX_QUEUE_HP); @@ -854,4 +924,7 @@ ath_recv_setup_edma(struct ath_softc *sc sc->sc_rx.recv_setup = ath_edma_dma_rxsetup; sc->sc_rx.recv_teardown = ath_edma_dma_rxteardown; + + sc->sc_rx.recv_sched = ath_edma_recv_sched; + sc->sc_rx.recv_sched_queue = ath_edma_recv_sched_queue; } Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Tue Mar 19 17:55:36 2013 (r248528) +++ head/sys/dev/ath/if_athvar.h Tue Mar 19 19:32:28 2013 (r248529) @@ -442,6 +442,9 @@ typedef enum { } ATH_RESET_TYPE; struct ath_rx_methods { + void (*recv_sched_queue)(struct ath_softc *sc, + HAL_RX_QUEUE q, int dosched); + void (*recv_sched)(struct ath_softc *sc, int dosched); void (*recv_stop)(struct ath_softc *sc, int dodelay); int (*recv_start)(struct ath_softc *sc); void (*recv_flush)(struct ath_softc *sc); @@ -656,6 +659,7 @@ struct ath_softc { struct ath_descdma sc_rxdma; /* RX descriptors */ ath_bufhead sc_rxbuf; /* receive buffer */ + ath_bufhead sc_rx_rxlist; /* deferred RX completion */ u_int32_t *sc_rxlink; /* link ptr in last RX desc */ struct task sc_rxtask; /* rx int processing */ u_int8_t sc_defant; /* current default antenna */ From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 20:58:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2EB6BCD; Tue, 19 Mar 2013 20:58:20 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 063C66EF; Tue, 19 Mar 2013 20:58:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JKwJ8H039799; Tue, 19 Mar 2013 20:58:19 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JKwIwg039788; Tue, 19 Mar 2013 20:58:18 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201303192058.r2JKwIwg039788@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 19 Mar 2013 20:58:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248534 - in head: lib/libc/sys share/man/man4 sys/kern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 20:58:20 -0000 Author: jilles Date: Tue Mar 19 20:58:17 2013 New Revision: 248534 URL: http://svnweb.freebsd.org/changeset/base/248534 Log: Implement SOCK_CLOEXEC, SOCK_NONBLOCK and MSG_CMSG_CLOEXEC. This change allows creating file descriptors with close-on-exec set in some situations. SOCK_CLOEXEC and SOCK_NONBLOCK can be OR'ed in socket() and socketpair()'s type parameter, and MSG_CMSG_CLOEXEC to recvmsg() makes file descriptors (SCM_RIGHTS) atomically close-on-exec. The numerical values for SOCK_CLOEXEC and SOCK_NONBLOCK are as in NetBSD. MSG_CMSG_CLOEXEC is the first free bit for MSG_*. The SOCK_* flags are not passed to MAC because this may cause incorrect failures and can be done later via fcntl() anyway. On the other hand, audit is expected to cope with the new flags. For MSG_CMSG_CLOEXEC, unp_externalize() is extended to take a flags argument. Reviewed by: kib Modified: head/lib/libc/sys/recv.2 head/lib/libc/sys/socket.2 head/lib/libc/sys/socketpair.2 head/share/man/man4/unix.4 head/sys/kern/uipc_socket.c head/sys/kern/uipc_syscalls.c head/sys/kern/uipc_usrreq.c head/sys/sys/domain.h head/sys/sys/socket.h Modified: head/lib/libc/sys/recv.2 ============================================================================== --- head/lib/libc/sys/recv.2 Tue Mar 19 20:20:00 2013 (r248533) +++ head/lib/libc/sys/recv.2 Tue Mar 19 20:58:17 2013 (r248534) @@ -28,7 +28,7 @@ .\" @(#)recv.2 8.3 (Berkeley) 2/21/94 .\" $FreeBSD$ .\" -.Dd September 12, 2012 +.Dd March 19, 2013 .Dt RECV 2 .Os .Sh NAME @@ -121,11 +121,12 @@ argument to a function is formed by .Em or Ap ing one or more of the values: -.Bl -column ".Dv MSG_DONTWAIT" -offset indent +.Bl -column ".Dv MSG_CMSG_CLOEXEC" -offset indent .It Dv MSG_OOB Ta process out-of-band data .It Dv MSG_PEEK Ta peek at incoming message .It Dv MSG_WAITALL Ta wait for full request or error .It Dv MSG_DONTWAIT Ta do not block +.It Dv MSG_CMSG_CLOEXEC Ta set received fds close-on-exec .El .Pp The @@ -227,6 +228,10 @@ and .Fa cmsg_type set to .Dv SCM_RIGHTS . +The close-on-exec flag on received descriptors is set according to the +.Dv MSG_CMSG_CLOEXEC +flag passed to +.Fn recvmsg . .Pp Process credentials can also be passed as ancillary data for .Dv AF_UNIX Modified: head/lib/libc/sys/socket.2 ============================================================================== --- head/lib/libc/sys/socket.2 Tue Mar 19 20:20:00 2013 (r248533) +++ head/lib/libc/sys/socket.2 Tue Mar 19 20:58:17 2013 (r248534) @@ -28,7 +28,7 @@ .\" From: @(#)socket.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 7, 2012 +.Dd March 19, 2013 .Dt SOCKET 2 .Os .Sh NAME @@ -115,6 +115,15 @@ which is available only to the super-use which is planned, but not yet implemented, are not described here. .Pp +Additionally, the following flags are allowed in the +.Fa type +argument: +.Pp +.Bd -literal -offset indent -compact +SOCK_CLOEXEC Set close-on-exec on the new descriptor, +SOCK_NONBLOCK Set non-blocking mode on the new socket +.Ed +.Pp The .Fa protocol argument Modified: head/lib/libc/sys/socketpair.2 ============================================================================== --- head/lib/libc/sys/socketpair.2 Tue Mar 19 20:20:00 2013 (r248533) +++ head/lib/libc/sys/socketpair.2 Tue Mar 19 20:58:17 2013 (r248534) @@ -28,7 +28,7 @@ .\" @(#)socketpair.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd March 19, 2013 .Dt SOCKETPAIR 2 .Os .Sh NAME @@ -57,6 +57,14 @@ are returned in and .Fa sv Ns [1] . The two sockets are indistinguishable. +.Pp +The +.Dv SOCK_CLOEXEC +and +.Dv SOCK_NONBLOCK +flags in the +.Fa type +argument apply to both descriptors. .Sh RETURN VALUES .Rv -std socketpair .Sh ERRORS @@ -79,6 +87,7 @@ process address space. .Sh SEE ALSO .Xr pipe 2 , .Xr read 2 , +.Xr socket 2 , .Xr write 2 .Sh HISTORY The Modified: head/share/man/man4/unix.4 ============================================================================== --- head/share/man/man4/unix.4 Tue Mar 19 20:20:00 2013 (r248533) +++ head/share/man/man4/unix.4 Tue Mar 19 20:58:17 2013 (r248534) @@ -32,7 +32,7 @@ .\" @(#)unix.4 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd November 16, 2012 +.Dd March 19, 2013 .Dt UNIX 4 .Os .Sh NAME @@ -153,13 +153,15 @@ plus the size of the array of file descr .Pp The received descriptor is a .Em duplicate -of the sender's descriptor, as if it were created with a call to -.Xr dup 2 . -Per-process descriptor flags, set with -.Xr fcntl 2 , -are -.Em not -passed to a receiver. +of the sender's descriptor, as if it were created via +.Li dup(fd) +or +.Li fcntl(fd, F_DUPFD_CLOEXEC, 0) +depending on whether +.Dv MSG_CMSG_CLOEXEC +is passed in the +.Xr recvmsg 2 +call. Descriptors that are awaiting delivery, or that are purposely not received, are automatically closed by the system when the destination socket is closed. Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Tue Mar 19 20:20:00 2013 (r248533) +++ head/sys/kern/uipc_socket.c Tue Mar 19 20:58:17 2013 (r248534) @@ -1727,7 +1727,7 @@ dontblock: SOCKBUF_UNLOCK(&so->so_rcv); VNET_SO_ASSERT(so); error = (*pr->pr_domain->dom_externalize) - (cm, controlp); + (cm, controlp, flags); SOCKBUF_LOCK(&so->so_rcv); } else if (controlp != NULL) *controlp = cm; @@ -2361,7 +2361,7 @@ soreceive_dgram(struct socket *so, struc cm->m_next = NULL; if (pr->pr_domain->dom_externalize != NULL) { error = (*pr->pr_domain->dom_externalize) - (cm, controlp); + (cm, controlp, flags); } else if (controlp != NULL) *controlp = cm; else Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Tue Mar 19 20:20:00 2013 (r248533) +++ head/sys/kern/uipc_syscalls.c Tue Mar 19 20:58:17 2013 (r248534) @@ -164,25 +164,40 @@ sys_socket(td, uap) { struct socket *so; struct file *fp; - int fd, error; + int fd, error, type, oflag, fflag; AUDIT_ARG_SOCKET(uap->domain, uap->type, uap->protocol); + + type = uap->type; + oflag = 0; + fflag = 0; + if ((type & SOCK_CLOEXEC) != 0) { + type &= ~SOCK_CLOEXEC; + oflag |= O_CLOEXEC; + } + if ((type & SOCK_NONBLOCK) != 0) { + type &= ~SOCK_NONBLOCK; + fflag |= FNONBLOCK; + } + #ifdef MAC - error = mac_socket_check_create(td->td_ucred, uap->domain, uap->type, + error = mac_socket_check_create(td->td_ucred, uap->domain, type, uap->protocol); if (error) return (error); #endif - error = falloc(td, &fp, &fd, 0); + error = falloc(td, &fp, &fd, oflag); if (error) return (error); /* An extra reference on `fp' has been held for us by falloc(). */ - error = socreate(uap->domain, &so, uap->type, uap->protocol, + error = socreate(uap->domain, &so, type, uap->protocol, td->td_ucred, td); if (error) { fdclose(td->td_proc->p_fd, fp, fd, td); } else { - finit(fp, FREAD | FWRITE, DTYPE_SOCKET, so, &socketops); + finit(fp, FREAD | FWRITE | fflag, DTYPE_SOCKET, so, &socketops); + if ((fflag & FNONBLOCK) != 0) + (void) fo_ioctl(fp, FIONBIO, &fflag, td->td_ucred, td); td->td_retval[0] = fd; } fdrop(fp, td); @@ -648,9 +663,20 @@ kern_socketpair(struct thread *td, int d struct filedesc *fdp = td->td_proc->p_fd; struct file *fp1, *fp2; struct socket *so1, *so2; - int fd, error; + int fd, error, oflag, fflag; AUDIT_ARG_SOCKET(domain, type, protocol); + + oflag = 0; + fflag = 0; + if ((type & SOCK_CLOEXEC) != 0) { + type &= ~SOCK_CLOEXEC; + oflag |= O_CLOEXEC; + } + if ((type & SOCK_NONBLOCK) != 0) { + type &= ~SOCK_NONBLOCK; + fflag |= FNONBLOCK; + } #ifdef MAC /* We might want to have a separate check for socket pairs. */ error = mac_socket_check_create(td->td_ucred, domain, type, @@ -665,12 +691,12 @@ kern_socketpair(struct thread *td, int d if (error) goto free1; /* On success extra reference to `fp1' and 'fp2' is set by falloc. */ - error = falloc(td, &fp1, &fd, 0); + error = falloc(td, &fp1, &fd, oflag); if (error) goto free2; rsv[0] = fd; fp1->f_data = so1; /* so1 already has ref count */ - error = falloc(td, &fp2, &fd, 0); + error = falloc(td, &fp2, &fd, oflag); if (error) goto free3; fp2->f_data = so2; /* so2 already has ref count */ @@ -686,8 +712,14 @@ kern_socketpair(struct thread *td, int d if (error) goto free4; } - finit(fp1, FREAD | FWRITE, DTYPE_SOCKET, fp1->f_data, &socketops); - finit(fp2, FREAD | FWRITE, DTYPE_SOCKET, fp2->f_data, &socketops); + finit(fp1, FREAD | FWRITE | fflag, DTYPE_SOCKET, fp1->f_data, + &socketops); + finit(fp2, FREAD | FWRITE | fflag, DTYPE_SOCKET, fp2->f_data, + &socketops); + if ((fflag & FNONBLOCK) != 0) { + (void) fo_ioctl(fp1, FIONBIO, &fflag, td->td_ucred, td); + (void) fo_ioctl(fp2, FIONBIO, &fflag, td->td_ucred, td); + } fdrop(fp1, td); fdrop(fp2, td); return (0); Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Tue Mar 19 20:20:00 2013 (r248533) +++ head/sys/kern/uipc_usrreq.c Tue Mar 19 20:58:17 2013 (r248534) @@ -288,7 +288,7 @@ static void unp_freerights(struct filede static void unp_init(void); static int unp_internalize(struct mbuf **, struct thread *); static void unp_internalize_fp(struct file *); -static int unp_externalize(struct mbuf *, struct mbuf **); +static int unp_externalize(struct mbuf *, struct mbuf **, int); static int unp_externalize_fp(struct file *); static struct mbuf *unp_addsockcred(struct thread *, struct mbuf *); static void unp_process_defers(void * __unused, int); @@ -1695,7 +1695,7 @@ unp_freerights(struct filedescent **fdep } static int -unp_externalize(struct mbuf *control, struct mbuf **controlp) +unp_externalize(struct mbuf *control, struct mbuf **controlp, int flags) { struct thread *td = curthread; /* XXX */ struct cmsghdr *cm = mtod(control, struct cmsghdr *); @@ -1765,6 +1765,8 @@ unp_externalize(struct mbuf *control, st fde->fde_file = fdep[0]->fde_file; filecaps_move(&fdep[0]->fde_caps, &fde->fde_caps); + if ((flags & MSG_CMSG_CLOEXEC) != 0) + fde->fde_flags |= UF_EXCLOSE; unp_externalize_fp(fde->fde_file); *fdp = f; } Modified: head/sys/sys/domain.h ============================================================================== --- head/sys/sys/domain.h Tue Mar 19 20:20:00 2013 (r248533) +++ head/sys/sys/domain.h Tue Mar 19 20:58:17 2013 (r248534) @@ -51,7 +51,7 @@ struct domain { void (*dom_destroy) /* cleanup structures / state */ (void); int (*dom_externalize) /* externalize access rights */ - (struct mbuf *, struct mbuf **); + (struct mbuf *, struct mbuf **, int); void (*dom_dispose) /* dispose of internalized rights */ (struct mbuf *); struct protosw *dom_protosw, *dom_protoswNPROTOSW; Modified: head/sys/sys/socket.h ============================================================================== --- head/sys/sys/socket.h Tue Mar 19 20:20:00 2013 (r248533) +++ head/sys/sys/socket.h Tue Mar 19 20:58:17 2013 (r248534) @@ -95,6 +95,14 @@ typedef __uid_t uid_t; #endif #define SOCK_SEQPACKET 5 /* sequenced packet stream */ +#if __BSD_VISIBLE +/* + * Creation flags, OR'ed into socket() and socketpair() type argument. + */ +#define SOCK_CLOEXEC 0x10000000 +#define SOCK_NONBLOCK 0x20000000 +#endif + /* * Option flags per-socket. */ @@ -459,6 +467,7 @@ struct msghdr { #endif #if __BSD_VISIBLE #define MSG_NOSIGNAL 0x20000 /* do not generate SIGPIPE on EOF */ +#define MSG_CMSG_CLOEXEC 0x40000 /* make received fds close-on-exec */ #endif /* From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 21:40:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6AD60B65; Tue, 19 Mar 2013 21:40:15 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5C71F8B6; Tue, 19 Mar 2013 21:40:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JLeFYS052715; Tue, 19 Mar 2013 21:40:15 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JLeFgD052714; Tue, 19 Mar 2013 21:40:15 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201303192140.r2JLeFgD052714@svn.freebsd.org> From: Joel Dahl Date: Tue, 19 Mar 2013 21:40:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248535 - head/sbin/shutdown X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 21:40:15 -0000 Author: joel (doc committer) Date: Tue Mar 19 21:40:14 2013 New Revision: 248535 URL: http://svnweb.freebsd.org/changeset/base/248535 Log: Add simple example. Modified: head/sbin/shutdown/shutdown.8 Modified: head/sbin/shutdown/shutdown.8 ============================================================================== --- head/sbin/shutdown/shutdown.8 Tue Mar 19 20:58:17 2013 (r248534) +++ head/sbin/shutdown/shutdown.8 Tue Mar 19 21:40:14 2013 (r248535) @@ -28,7 +28,7 @@ .\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95 .\" $FreeBSD$ .\" -.Dd July 13, 2011 +.Dd March 19, 2013 .Dt SHUTDOWN 8 .Os .Sh NAME @@ -189,6 +189,11 @@ tells .Xr login 1 not to let anyone log in .El +.Sh EXAMPLES +Reboot the system in 30 minutes and display a warning message on the terminals +of all users currently logged in: +.Pp +.Dl # shutdown -r +30 \&"System will reboot\&" .Sh COMPATIBILITY The hours and minutes in the second time format may be separated by a colon (``:'') for backward compatibility. From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 02:42:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 68BC31AC; Wed, 20 Mar 2013 02:42:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4444162D; Wed, 20 Mar 2013 02:42:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2K2grm7046011; Wed, 20 Mar 2013 02:42:53 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2K2grxi046010; Wed, 20 Mar 2013 02:42:53 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303200242.r2K2grxi046010@svn.freebsd.org> From: Adrian Chadd Date: Wed, 20 Mar 2013 02:42:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248539 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 02:42:53 -0000 Author: adrian Date: Wed Mar 20 02:42:52 2013 New Revision: 248539 URL: http://svnweb.freebsd.org/changeset/base/248539 Log: Add VNET wrappers around the rest of the ieee80211 rtsock messages. I triggered the cac/radar messages when doing testing in DFS channels. Modified: head/sys/net80211/ieee80211_freebsd.c Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Tue Mar 19 22:27:15 2013 (r248538) +++ head/sys/net80211/ieee80211_freebsd.c Wed Mar 20 02:42:52 2013 (r248539) @@ -702,7 +702,9 @@ ieee80211_notify_csa(struct ieee80211com iev.iev_ieee = c->ic_ieee; iev.iev_mode = mode; iev.iev_count = count; + CURVNET_SET(ifp->if_vnet); rt_ieee80211msg(ifp, RTM_IEEE80211_CSA, &iev, sizeof(iev)); + CURVNET_RESTORE(); } void @@ -716,7 +718,9 @@ ieee80211_notify_radar(struct ieee80211c iev.iev_flags = c->ic_flags; iev.iev_freq = c->ic_freq; iev.iev_ieee = c->ic_ieee; + CURVNET_SET(ifp->if_vnet); rt_ieee80211msg(ifp, RTM_IEEE80211_RADAR, &iev, sizeof(iev)); + CURVNET_RESTORE(); } void @@ -731,7 +735,9 @@ ieee80211_notify_cac(struct ieee80211com iev.iev_freq = c->ic_freq; iev.iev_ieee = c->ic_ieee; iev.iev_type = type; + CURVNET_SET(ifp->if_vnet); rt_ieee80211msg(ifp, RTM_IEEE80211_CAC, &iev, sizeof(iev)); + CURVNET_RESTORE(); } void @@ -767,7 +773,9 @@ ieee80211_notify_country(struct ieee8021 IEEE80211_ADDR_COPY(iev.iev_addr, bssid); iev.iev_cc[0] = cc[0]; iev.iev_cc[1] = cc[1]; + CURVNET_SET(ifp->if_vnet); rt_ieee80211msg(ifp, RTM_IEEE80211_COUNTRY, &iev, sizeof(iev)); + CURVNET_RESTORE(); } void @@ -778,7 +786,9 @@ ieee80211_notify_radio(struct ieee80211c memset(&iev, 0, sizeof(iev)); iev.iev_state = state; + CURVNET_SET(ifp->if_vnet); rt_ieee80211msg(ifp, RTM_IEEE80211_RADIO, &iev, sizeof(iev)); + CURVNET_RESTORE(); } void From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 05:31:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8E52ACA1; Wed, 20 Mar 2013 05:31:35 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5E68BD26; Wed, 20 Mar 2013 05:31:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2K5VZbm098183; Wed, 20 Mar 2013 05:31:35 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2K5VZsI098181; Wed, 20 Mar 2013 05:31:35 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201303200531.r2K5VZsI098181@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 20 Mar 2013 05:31:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248542 - head/sys/dev/mii X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 05:31:35 -0000 Author: yongari Date: Wed Mar 20 05:31:34 2013 New Revision: 248542 URL: http://svnweb.freebsd.org/changeset/base/248542 Log: For RTL8211B or later PHYs, enable crossover detection and auto-correction. This change makes re(4) establish a link with a system using non-crossover UTP cable. Tested by: Michael BlackHeart < amdmiek <> gmail dot com > Modified: head/sys/dev/mii/rgephy.c head/sys/dev/mii/rgephyreg.h Modified: head/sys/dev/mii/rgephy.c ============================================================================== --- head/sys/dev/mii/rgephy.c Wed Mar 20 05:23:23 2013 (r248541) +++ head/sys/dev/mii/rgephy.c Wed Mar 20 05:31:34 2013 (r248542) @@ -488,7 +488,7 @@ rgephy_load_dspcode(struct mii_softc *sc static void rgephy_reset(struct mii_softc *sc) { - uint16_t ssr; + uint16_t pcr, ssr; if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev == 3) { /* RTL8211C(L) */ @@ -499,6 +499,15 @@ rgephy_reset(struct mii_softc *sc) } } + if (sc->mii_mpd_rev >= 2) { + pcr = PHY_READ(sc, RGEPHY_MII_PCR); + if ((pcr & RGEPHY_PCR_MDIX_AUTO) == 0) { + pcr &= ~RGEPHY_PCR_MDI_MASK; + pcr |= RGEPHY_PCR_MDIX_AUTO; + PHY_WRITE(sc, RGEPHY_MII_PCR, pcr); + } + } + mii_phy_reset(sc); DELAY(1000); rgephy_load_dspcode(sc); Modified: head/sys/dev/mii/rgephyreg.h ============================================================================== --- head/sys/dev/mii/rgephyreg.h Wed Mar 20 05:23:23 2013 (r248541) +++ head/sys/dev/mii/rgephyreg.h Wed Mar 20 05:31:34 2013 (r248542) @@ -138,6 +138,17 @@ #define RGEPHY_EXTSTS_T_HD_CAP 0x1000 /* 1000base-T HD capable */ /* RTL8211B(L)/RTL8211C(L) */ +#define RGEPHY_MII_PCR 0x10 /* PHY Specific control register */ +#define RGEPHY_PCR_ASSERT_CRS 0x0800 +#define RGEPHY_PCR_FORCE_LINK 0x0400 +#define RGEPHY_PCR_MDI_MASK 0x0060 +#define RGEPHY_PCR_MDIX_AUTO 0x0040 +#define RGEPHY_PCR_MDIX_MANUAL 0x0020 +#define RGEPHY_PCR_MDI_MANUAL 0x0000 +#define RGEPHY_PCR_CLK125_DIS 0x0010 +#define RGEPHY_PCR_JABBER_DIS 0x0001 + +/* RTL8211B(L)/RTL8211C(L) */ #define RGEPHY_MII_SSR 0x11 /* PHY Specific status register */ #define RGEPHY_SSR_S1000 0x8000 /* 1000Mbps */ #define RGEPHY_SSR_S100 0x4000 /* 100Mbps */ From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 05:44:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1DB9AE8E; Wed, 20 Mar 2013 05:44:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0D359D62; Wed, 20 Mar 2013 05:44:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2K5i3X1001543; Wed, 20 Mar 2013 05:44:03 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2K5i3PZ001542; Wed, 20 Mar 2013 05:44:03 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303200544.r2K5i3PZ001542@svn.freebsd.org> From: Adrian Chadd Date: Wed, 20 Mar 2013 05:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248543 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 05:44:04 -0000 Author: adrian Date: Wed Mar 20 05:44:03 2013 New Revision: 248543 URL: http://svnweb.freebsd.org/changeset/base/248543 Log: Fix the EDMA CABQ handling - for now, the CABQ takes a descriptor chain like the legacy chips expect. Modified: head/sys/dev/ath/if_ath_tx_edma.c Modified: head/sys/dev/ath/if_ath_tx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_edma.c Wed Mar 20 05:31:34 2013 (r248542) +++ head/sys/dev/ath/if_ath_tx_edma.c Wed Mar 20 05:44:03 2013 (r248543) @@ -267,6 +267,9 @@ ath_edma_xmit_handoff_mcast(struct ath_s /* sync descriptor to memory */ bus_dmamap_sync(sc->sc_dmat, bf_last->bf_dmamap, BUS_DMASYNC_PREWRITE); + + /* link descriptor */ + *txq->axq_link = bf->bf_daddr; } #ifdef ATH_DEBUG_ALQ From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 08:34:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 618F2F1A; Wed, 20 Mar 2013 08:34:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3D0A13F8; Wed, 20 Mar 2013 08:34:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2K8YVAX053257; Wed, 20 Mar 2013 08:34:31 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2K8YV9w053256; Wed, 20 Mar 2013 08:34:31 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201303200834.r2K8YV9w053256@svn.freebsd.org> From: Andrew Turner Date: Wed, 20 Mar 2013 08:34:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248548 - head/contrib/llvm/tools/clang/lib/Driver X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 08:34:31 -0000 Author: andrew Date: Wed Mar 20 08:34:30 2013 New Revision: 248548 URL: http://svnweb.freebsd.org/changeset/base/248548 Log: Pull in r177252 from upstream clang trunk: Make sure to use same EABI version for external assembler as for integrated as. This allows us to use gcc on a world built with clang on ARM. Modified: head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Modified: head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Wed Mar 20 08:26:16 2013 (r248547) +++ head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Wed Mar 20 08:34:30 2013 (r248548) @@ -5438,6 +5438,7 @@ void freebsd::Assemble::ConstructJob(Com switch(getToolChain().getTriple().getEnvironment()) { case llvm::Triple::GNUEABI: case llvm::Triple::EABI: + CmdArgs.push_back("-meabi=5"); break; default: From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 09:18:58 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2025CC0A; Wed, 20 Mar 2013 09:18:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id 7E5078A9; Wed, 20 Mar 2013 09:18:56 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r2K9IuJw089526; Wed, 20 Mar 2013 13:18:56 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r2K9IueA089525; Wed, 20 Mar 2013 13:18:56 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 20 Mar 2013 13:18:56 +0400 From: Gleb Smirnoff To: Jilles Tjoelker Subject: Re: svn commit: r248534 - in head: lib/libc/sys share/man/man4 sys/kern sys/sys Message-ID: <20130320091856.GI76816@FreeBSD.org> References: <201303192058.r2JKwIwg039788@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201303192058.r2JKwIwg039788@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 09:18:58 -0000 On Tue, Mar 19, 2013 at 08:58:18PM +0000, Jilles Tjoelker wrote: J> Author: jilles J> Date: Tue Mar 19 20:58:17 2013 J> New Revision: 248534 J> URL: http://svnweb.freebsd.org/changeset/base/248534 J> J> Log: J> Implement SOCK_CLOEXEC, SOCK_NONBLOCK and MSG_CMSG_CLOEXEC. J> J> This change allows creating file descriptors with close-on-exec set in some J> situations. SOCK_CLOEXEC and SOCK_NONBLOCK can be OR'ed in socket() and J> socketpair()'s type parameter, and MSG_CMSG_CLOEXEC to recvmsg() makes file J> descriptors (SCM_RIGHTS) atomically close-on-exec. J> J> The numerical values for SOCK_CLOEXEC and SOCK_NONBLOCK are as in NetBSD. J> MSG_CMSG_CLOEXEC is the first free bit for MSG_*. J> J> The SOCK_* flags are not passed to MAC because this may cause incorrect J> failures and can be done later via fcntl() anyway. On the other hand, audit J> is expected to cope with the new flags. J> J> For MSG_CMSG_CLOEXEC, unp_externalize() is extended to take a flags J> argument. IMO, it won't hurt if changes like this (bringing in new functionality) would bump __FreeBSD_version. -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 09:44:24 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A3618810; Wed, 20 Mar 2013 09:44:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7FBD7A76; Wed, 20 Mar 2013 09:44:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2K9iOMD074704; Wed, 20 Mar 2013 09:44:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2K9iOMg074703; Wed, 20 Mar 2013 09:44:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303200944.r2K9iOMg074703@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 20 Mar 2013 09:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248550 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 09:44:24 -0000 Author: kib Date: Wed Mar 20 09:44:23 2013 New Revision: 248550 URL: http://svnweb.freebsd.org/changeset/base/248550 Log: Fix the logic inversion in the r248512. Noted by: mckay Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Wed Mar 20 09:12:28 2013 (r248549) +++ head/sys/vm/vnode_pager.c Wed Mar 20 09:44:23 2013 (r248550) @@ -947,7 +947,7 @@ vnode_pager_generic_getpages(vp, m, byte if ((bp->b_ioflags & BIO_ERROR) != 0) error = EIO; - if (error != 0 && size != count * PAGE_SIZE) { + if (error == 0 && size != count * PAGE_SIZE) { if ((bp->b_flags & B_UNMAPPED) != 0) { bp->b_flags &= ~B_UNMAPPED; pmap_qenter(kva, m, count); From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 10:35:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6E66C3AE; Wed, 20 Mar 2013 10:35:35 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 44C2EDA6; Wed, 20 Mar 2013 10:35:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2KAZYJ2090092; Wed, 20 Mar 2013 10:35:34 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2KAZXj2090085; Wed, 20 Mar 2013 10:35:33 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201303201035.r2KAZXj2090085@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Wed, 20 Mar 2013 10:35:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248552 - in head: sbin/ipfw sys/netinet sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 10:35:35 -0000 Author: melifaro Date: Wed Mar 20 10:35:33 2013 New Revision: 248552 URL: http://svnweb.freebsd.org/changeset/base/248552 Log: Add ipfw support for setting/matching DiffServ codepoints (DSCP). Setting DSCP support is done via O_SETDSCP which works for both IPv4 and IPv6 packets. Fast checksum recalculation (RFC 1624) is done for IPv4. Dscp can be specified by name (AFXY, CSX, BE, EF), by value (0..63) or via tablearg. Matching DSCP is done via another opcode (O_DSCP) which accepts several classes at once (af11,af22,be). Classes are stored in bitmask (2 u32 words). Many people made their variants of this patch, the ones I'm aware of are (in alphabetic order): Dmitrii Tejblum Marcelo Araujo Roman Bogorodskiy (novel) Sergey Matveichuk (sem) Sergey Ryabin PR: kern/102471, kern/121122 MFC after: 2 weeks Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h head/sys/netinet/ip_fw.h head/sys/netpfil/ipfw/ip_fw2.c head/sys/netpfil/ipfw/ip_fw_log.c head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Wed Mar 20 09:56:20 2013 (r248551) +++ head/sbin/ipfw/ipfw.8 Wed Mar 20 10:35:33 2013 (r248552) @@ -960,6 +960,61 @@ It is possible to use the keyword with setfib. If the tablearg value is not within the compiled range of fibs, the packet's fib is set to 0. +.It Cm setdscp Ar DSCP | number | tablearg +Set specified DiffServ codepoint for an IPv4/IPv6 packet. +Processing continues at the next rule. +Supported values are: +.Pp +.Cm CS0 +.Pq Dv 000000 , +.Cm CS1 +.Pq Dv 001000 , +.Cm CS2 +.Pq Dv 010000 , +.Cm CS3 +.Pq Dv 011000 , +.Cm CS4 +.Pq Dv 100000 , +.Cm CS5 +.Pq Dv 101000 , +.Cm CS6 +.Pq Dv 110000 , +.Cm CS7 +.Pq Dv 111000 , +.Cm AF11 +.Pq Dv 001010 , +.Cm AF12 +.Pq Dv 001100 , +.Cm AF13 +.Pq Dv 001110 , +.Cm AF21 +.Pq Dv 010010 , +.Cm AF22 +.Pq Dv 010100 , +.Cm AF23 +.Pq Dv 010110 , +.Cm AF31 +.Pq Dv 011010 , +.Cm AF32 +.Pq Dv 011100 , +.Cm AF33 +.Pq Dv 011110 , +.Cm AF41 +.Pq Dv 100010 , +.Cm AF42 +.Pq Dv 100100 , +.Cm AF43 +.Pq Dv 100110 , +.Cm EF +.Pq Dv 101110 , +.Cm BE +.Pq Dv 000000 . +Additionally, DSCP value can be specified by number (0..64). +It is also possible to use the +.Cm tablearg +keyword with setdscp. +If the tablearg value is not within the 0..64 range, lower 6 bits of supplied +value are used. .It Cm reass Queue and reassemble IP fragments. If the packet is not fragmented, counters are updated and @@ -1454,6 +1509,17 @@ The supported IP types of service are: The absence of a particular type may be denoted with a .Ql \&! . +.It Cm dscp spec Ns Op , Ns Ar spec +Matches IPv4/IPv6 packets whose +.Cm DS +field value is contained in +.Ar spec +mask. +Multiple values can be specified via +the comma separated list. +Value can be one of keywords used in +.Cm setdscp +action or exact number. .It Cm ipttl Ar ttl-list Matches IPv4 packets whose time to live is included in .Ar ttl-list , @@ -2976,6 +3042,23 @@ configured on but coming in on .Li fxp1 would be dropped. +.Pp +The +.Cm setdscp +option could be used to (re)mark user traffic, +by adding the following to the appropriate place in ruleset: +.Pp +.Dl "ipfw add setdscp be ip from any to any dscp af11,af21" +.Pp +This rule drops all incoming packets that appear to be coming from another +directly connected system but on the wrong interface. +For example, a packet with a source address of +.Li 192.168.0.0/24 , +configured on +.Li fxp0 , +but coming in on +.Li fxp1 +would be dropped. .Ss DYNAMIC RULES In order to protect a site from flood attacks involving fake TCP packets, it is safer to use dynamic rules: Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Wed Mar 20 09:56:20 2013 (r248551) +++ head/sbin/ipfw/ipfw2.c Wed Mar 20 10:35:33 2013 (r248552) @@ -167,6 +167,32 @@ static struct _s_x f_iptos[] = { { NULL, 0 } }; +static struct _s_x f_ipdscp[] = { + { "af11", IPTOS_DSCP_AF11 >> 2 }, /* 001010 */ + { "af12", IPTOS_DSCP_AF12 >> 2 }, /* 001100 */ + { "af13", IPTOS_DSCP_AF13 >> 2 }, /* 001110 */ + { "af21", IPTOS_DSCP_AF21 >> 2 }, /* 010010 */ + { "af22", IPTOS_DSCP_AF22 >> 2 }, /* 010100 */ + { "af23", IPTOS_DSCP_AF23 >> 2 }, /* 010110 */ + { "af31", IPTOS_DSCP_AF31 >> 2 }, /* 011010 */ + { "af32", IPTOS_DSCP_AF32 >> 2 }, /* 011100 */ + { "af33", IPTOS_DSCP_AF33 >> 2 }, /* 011110 */ + { "af41", IPTOS_DSCP_AF41 >> 2 }, /* 100010 */ + { "af42", IPTOS_DSCP_AF42 >> 2 }, /* 100100 */ + { "af43", IPTOS_DSCP_AF43 >> 2 }, /* 100110 */ + { "be", IPTOS_DSCP_CS0 >> 2 }, /* 000000 */ + { "ef", IPTOS_DSCP_EF >> 2 }, /* 101110 */ + { "cs0", IPTOS_DSCP_CS0 >> 2 }, /* 000000 */ + { "cs1", IPTOS_DSCP_CS1 >> 2 }, /* 001000 */ + { "cs2", IPTOS_DSCP_CS2 >> 2 }, /* 010000 */ + { "cs3", IPTOS_DSCP_CS3 >> 2 }, /* 011000 */ + { "cs4", IPTOS_DSCP_CS4 >> 2 }, /* 100000 */ + { "cs5", IPTOS_DSCP_CS5 >> 2 }, /* 101000 */ + { "cs6", IPTOS_DSCP_CS6 >> 2 }, /* 110000 */ + { "cs7", IPTOS_DSCP_CS7 >> 2 }, /* 100000 */ + { NULL, 0 } +}; + static struct _s_x limit_masks[] = { {"all", DYN_SRC_ADDR|DYN_SRC_PORT|DYN_DST_ADDR|DYN_DST_PORT}, {"src-addr", DYN_SRC_ADDR}, @@ -237,6 +263,7 @@ static struct _s_x rule_actions[] = { { "nat", TOK_NAT }, { "reass", TOK_REASS }, { "setfib", TOK_SETFIB }, + { "setdscp", TOK_SETDSCP }, { "call", TOK_CALL }, { "return", TOK_RETURN }, { NULL, 0 } /* terminator */ @@ -714,6 +741,51 @@ fill_newports(ipfw_insn_u16 *cmd, char * return (i); } +/* + * Fill the body of the command with the list of DiffServ codepoints. + */ +static void +fill_dscp(ipfw_insn *cmd, char *av, int cblen) +{ + uint32_t *low, *high; + char *s = av, *a; + int code; + + cmd->opcode = O_DSCP; + cmd->len |= F_INSN_SIZE(ipfw_insn_u32) + 1; + + CHECK_CMDLEN; + + low = (uint32_t *)(cmd + 1); + high = low + 1; + + *low = 0; + *high = 0; + + while (s != NULL) { + a = strchr(s, ','); + + if (a != NULL) + *a++ = '\0'; + + if (isalpha(*s)) { + if ((code = match_token(f_ipdscp, s)) == -1) + errx(EX_DATAERR, "Unknown DSCP code"); + } else { + code = strtoul(s, NULL, 10); + if (code < 0 || code > 63) + errx(EX_DATAERR, "Invalid DSCP value"); + } + + if (code > 32) + *high |= 1 << (code - 32); + else + *low |= 1 << code; + + s = a; + } +} + static struct _s_x icmpcodes[] = { { "net", ICMP_UNREACH_NET }, { "host", ICMP_UNREACH_HOST }, @@ -972,6 +1044,32 @@ print_icmptypes(ipfw_insn_u32 *cmd) } } +static void +print_dscp(ipfw_insn_u32 *cmd) +{ + int i, c; + uint32_t *v; + char sep= ' '; + const char *code; + + printf(" dscp"); + i = 0; + c = 0; + v = cmd->d; + while (i < 64) { + if (*v & (1 << i)) { + if ((code = match_value(f_ipdscp, i)) != NULL) + printf("%c%s", sep, code); + else + printf("%c%d", sep, i); + sep = ','; + } + + if ((++i % 32) == 0) + v++; + } +} + /* * show_ipfw() prints the body of an ipfw rule. * Because the standard rule has at least proto src_ip dst_ip, we use @@ -1205,6 +1303,17 @@ show_ipfw(struct ip_fw *rule, int pcwidt PRINT_UINT_ARG("setfib ", cmd->arg1); break; + case O_SETDSCP: + { + const char *code; + + if ((code = match_value(f_ipdscp, cmd->arg1)) != NULL) + printf("setdscp %s", code); + else + PRINT_UINT_ARG("setdscp ", cmd->arg1); + } + break; + case O_REASS: printf("reass"); break; @@ -1500,6 +1609,10 @@ show_ipfw(struct ip_fw *rule, int pcwidt printf(" ipprecedence %u", (cmd->arg1) >> 5 ); break; + case O_DSCP: + print_dscp((ipfw_insn_u32 *)cmd); + break; + case O_IPLEN: if (F_LEN(cmd) == 1) printf(" iplen %u", cmd->arg1 ); @@ -3036,6 +3149,24 @@ chkarg: break; } + case TOK_SETDSCP: + { + int code; + + action->opcode = O_SETDSCP; + NEED1("missing DSCP code"); + if (_substrcmp(*av, "tablearg") == 0) { + action->arg1 = IP_FW_TABLEARG; + } else if (isalpha(*av[0])) { + if ((code = match_token(f_ipdscp, *av)) == -1) + errx(EX_DATAERR, "Unknown DSCP code"); + action->arg1 = code; + } else + action->arg1 = strtoul(*av, NULL, 10); + av++; + break; + } + case TOK_REASS: action->opcode = O_REASS; break; @@ -3448,6 +3579,12 @@ read_options: av++; break; + case TOK_DSCP: + NEED1("missing DSCP code"); + fill_dscp(cmd, *av, cblen); + av++; + break; + case TOK_IPOPTS: NEED1("missing argument for ipoptions"); fill_flags(cmd, O_IPOPT, f_ipopts, *av); Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Wed Mar 20 09:56:20 2013 (r248551) +++ head/sbin/ipfw/ipfw2.h Wed Mar 20 10:35:33 2013 (r248552) @@ -203,6 +203,7 @@ enum tokens { TOK_SETFIB, TOK_LOOKUP, TOK_SOCKARG, + TOK_SETDSCP, }; /* * the following macro returns an error message if we run out of Modified: head/sys/netinet/ip_fw.h ============================================================================== --- head/sys/netinet/ip_fw.h Wed Mar 20 09:56:20 2013 (r248551) +++ head/sys/netinet/ip_fw.h Wed Mar 20 10:35:33 2013 (r248552) @@ -218,6 +218,9 @@ enum ipfw_opcodes { /* arguments (4 byt O_FORWARD_IP6, /* fwd sockaddr_in6 */ + O_DSCP, /* 2 u32 = DSCP mask */ + O_SETDSCP, /* arg1=DSCP value */ + O_LAST_OPCODE /* not an opcode! */ }; Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Wed Mar 20 09:56:20 2013 (r248551) +++ head/sys/netpfil/ipfw/ip_fw2.c Wed Mar 20 10:35:33 2013 (r248552) @@ -1624,6 +1624,32 @@ do { \ flags_match(cmd, ip->ip_tos)); break; + case O_DSCP: + { + uint32_t *p; + uint16_t x; + + p = ((ipfw_insn_u32 *)cmd)->d; + + if (is_ipv4) + x = ip->ip_tos >> 2; + else if (is_ipv6) { + uint8_t *v; + v = &((struct ip6_hdr *)ip)->ip6_vfc; + x = (*v & 0x0F) << 2; + v++; + x |= *v >> 6; + } else + break; + + /* DSCP bitmask is stored as low_u32 high_u32 */ + if (x > 32) + match = *(p + 1) & (1 << (x - 32)); + else + match = *p & (1 << x); + } + break; + case O_TCPDATALEN: if (proto == IPPROTO_TCP && offset == 0) { struct tcphdr *tcp; @@ -2353,6 +2379,32 @@ do { \ break; } + case O_SETDSCP: { + uint16_t code; + + code = IP_FW_ARG_TABLEARG(cmd->arg1) & 0x3F; + l = 0; /* exit inner loop */ + if (is_ipv4) { + uint16_t a; + + a = ip->ip_tos; + ip->ip_tos = (code << 2) | (ip->ip_tos & 0x03); + a += ntohs(ip->ip_sum) - ip->ip_tos; + ip->ip_sum = htons(a); + } else if (is_ipv6) { + uint8_t *v; + + v = &((struct ip6_hdr *)ip)->ip6_vfc; + *v = (*v & 0xF0) | (code >> 2); + v++; + *v = (*v & 0x3F) | ((code & 0x03) << 6); + } else + break; + + IPFW_INC_RULE_COUNTER(f, pktlen); + break; + } + case O_NAT: if (!IPFW_NAT_LOADED) { retval = IP_FW_DENY; Modified: head/sys/netpfil/ipfw/ip_fw_log.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_log.c Wed Mar 20 09:56:20 2013 (r248551) +++ head/sys/netpfil/ipfw/ip_fw_log.c Wed Mar 20 10:35:33 2013 (r248552) @@ -292,10 +292,8 @@ ipfw_log(struct ip_fw *f, u_int hlen, st altq->qid); cmd += F_LEN(cmd); } - if (cmd->opcode == O_PROB) - cmd += F_LEN(cmd); - - if (cmd->opcode == O_TAG) + if (cmd->opcode == O_PROB || cmd->opcode == O_TAG || + cmd->opcode == O_SETDSCP) cmd += F_LEN(cmd); action = action2; Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Wed Mar 20 09:56:20 2013 (r248551) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Wed Mar 20 10:35:33 2013 (r248552) @@ -671,6 +671,10 @@ check_ipfw_struct(struct ip_fw *rule, in case O_IPID: case O_IPTTL: case O_IPLEN: + case O_DSCP: + if (cmdlen != F_INSN_SIZE(ipfw_insn_u32) + 1) + goto bad_size; + break; case O_TCPDATALEN: case O_TCPWIN: case O_TAGGED: @@ -738,6 +742,7 @@ check_ipfw_struct(struct ip_fw *rule, in case O_ACCEPT: case O_DENY: case O_REJECT: + case O_SETDSCP: #ifdef INET6 case O_UNREACH6: #endif From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 10:36:39 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5C888543; Wed, 20 Mar 2013 10:36:39 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 43852DB4; Wed, 20 Mar 2013 10:36:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2KAadP2090275; Wed, 20 Mar 2013 10:36:39 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2KAad9O090273; Wed, 20 Mar 2013 10:36:39 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201303201036.r2KAad9O090273@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Wed, 20 Mar 2013 10:36:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248553 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 10:36:39 -0000 Author: melifaro Date: Wed Mar 20 10:36:38 2013 New Revision: 248553 URL: http://svnweb.freebsd.org/changeset/base/248553 Log: Remove unused variable. Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Wed Mar 20 10:35:33 2013 (r248552) +++ head/sbin/ipfw/ipfw2.c Wed Mar 20 10:36:38 2013 (r248553) @@ -4122,10 +4122,9 @@ ipfw_table_handler(int ac, char *av[]) int do_add; int is_all; size_t len; - uint32_t a, mask; + uint32_t a; uint32_t tables_max; - mask = 0; // XXX uninitialized ? len = sizeof(tables_max); if (sysctlbyname("net.inet.ip.fw.tables_max", &tables_max, &len, NULL, 0) == -1) { From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 11:51:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C697C6E6; Wed, 20 Mar 2013 11:51:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A1A9216C; Wed, 20 Mar 2013 11:51:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2KBpRN5013499; Wed, 20 Mar 2013 11:51:27 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2KBpRYm013498; Wed, 20 Mar 2013 11:51:27 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201303201151.r2KBpRYm013498@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 20 Mar 2013 11:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248554 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 11:51:27 -0000 Author: hselasky Date: Wed Mar 20 11:51:26 2013 New Revision: 248554 URL: http://svnweb.freebsd.org/changeset/base/248554 Log: Fix spelling. Modified: head/sys/dev/usb/controller/xhci.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Wed Mar 20 10:36:38 2013 (r248553) +++ head/sys/dev/usb/controller/xhci.c Wed Mar 20 11:51:26 2013 (r248554) @@ -36,7 +36,8 @@ /* * A few words about the design implementation: This driver emulates * the concept about TDs which is found in EHCI specification. This - * way we avoid too much diveration among USB drivers. + * way we achieve that the USB controller drivers look similar to + * eachother which makes it easier to understand the code. */ #ifdef USB_GLOBAL_INCLUDE_FILE From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 15:39:28 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8333E83F; Wed, 20 Mar 2013 15:39:28 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 66E7CF5F; Wed, 20 Mar 2013 15:39:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2KFdS8k082240; Wed, 20 Mar 2013 15:39:28 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2KFdR1w082234; Wed, 20 Mar 2013 15:39:27 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201303201539.r2KFdR1w082234@svn.freebsd.org> From: Aleksandr Rybalko Date: Wed, 20 Mar 2013 15:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248557 - in head/sys: arm/conf arm/freescale arm/freescale/imx boot/fdt/dts dev/ata/chipsets dev/uart dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 15:39:28 -0000 Author: ray Date: Wed Mar 20 15:39:27 2013 New Revision: 248557 URL: http://svnweb.freebsd.org/changeset/base/248557 Log: Integrate Efika MX project back to home. Sponsored by: The FreeBSD Foundation Added: head/sys/arm/conf/EFIKA_MX (contents, props changed) head/sys/arm/freescale/ head/sys/arm/freescale/imx/ head/sys/arm/freescale/imx/bus_space.c (contents, props changed) head/sys/arm/freescale/imx/common.c (contents, props changed) head/sys/arm/freescale/imx/console.c (contents, props changed) head/sys/arm/freescale/imx/i2c.c (contents, props changed) head/sys/arm/freescale/imx/imx.files (contents, props changed) head/sys/arm/freescale/imx/imx51_ccm.c (contents, props changed) head/sys/arm/freescale/imx/imx51_ccmreg.h (contents, props changed) head/sys/arm/freescale/imx/imx51_ccmvar.h (contents, props changed) head/sys/arm/freescale/imx/imx51_dpllreg.h (contents, props changed) head/sys/arm/freescale/imx/imx51_gpio.c (contents, props changed) head/sys/arm/freescale/imx/imx51_iomux.c (contents, props changed) head/sys/arm/freescale/imx/imx51_iomuxreg.h (contents, props changed) head/sys/arm/freescale/imx/imx51_iomuxvar.h (contents, props changed) head/sys/arm/freescale/imx/imx51_ipuv3.c (contents, props changed) head/sys/arm/freescale/imx/imx51_ipuv3reg.h (contents, props changed) head/sys/arm/freescale/imx/imx51_sdmareg.h (contents, props changed) head/sys/arm/freescale/imx/imx51_ssireg.h (contents, props changed) head/sys/arm/freescale/imx/imx51_tzicreg.h (contents, props changed) head/sys/arm/freescale/imx/imx_gpt.c (contents, props changed) head/sys/arm/freescale/imx/imx_gptreg.h (contents, props changed) head/sys/arm/freescale/imx/imx_gptvar.h (contents, props changed) head/sys/arm/freescale/imx/imx_machdep.c (contents, props changed) head/sys/arm/freescale/imx/imx_wdog.c (contents, props changed) head/sys/arm/freescale/imx/imx_wdogreg.h (contents, props changed) head/sys/arm/freescale/imx/std.imx (contents, props changed) head/sys/arm/freescale/imx/tzic.c (contents, props changed) head/sys/boot/fdt/dts/efikamx.dts (contents, props changed) head/sys/boot/fdt/dts/imx51x.dtsi (contents, props changed) head/sys/dev/ata/chipsets/ata-fsl.c (contents, props changed) head/sys/dev/uart/uart_dev_imx.c (contents, props changed) head/sys/dev/uart/uart_dev_imx5xx.h (contents, props changed) head/sys/dev/usb/controller/ehci_imx.c (contents, props changed) Modified: head/sys/dev/uart/uart.h head/sys/dev/uart/uart_bus_fdt.c Added: head/sys/arm/conf/EFIKA_MX ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/EFIKA_MX Wed Mar 20 15:39:27 2013 (r248557) @@ -0,0 +1,177 @@ +# Kernel configuration for Efika MX Smarttop/Smartbook boards +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +ident EFIKA_MX + +include "../freescale/imx/std.imx" + +makeoptions WITHOUT_MODULES="ahc" + +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +#options DEBUG + +options SCHED_4BSD # 4BSD scheduler +#options PREEMPTION # Enable kernel thread preemption +options INET # InterNETworking +#options INET6 # IPv6 communications protocols +#options SCTP # Stream Control Transmission Protocol +options FFS # Berkeley Fast Filesystem +options SOFTUPDATES # Enable FFS soft updates support +options UFS_ACL # Support for access control lists +options UFS_DIRHASH # Improve performance on big directories +options UFS_GJOURNAL # Enable gjournal-based UFS journaling +#options MD_ROOT # MD is a potential root device +options NFSCL # New Network Filesystem Client +#options NFSD # New Network Filesystem Server +options NFSLOCKD # Network Lock Manager +options NFS_ROOT # NFS usable as /, requires NFSCL +options MSDOSFS # MSDOS Filesystem +options CD9660 # ISO 9660 Filesystem +#options PROCFS # Process filesystem (requires PSEUDOFS) +options PSEUDOFS # Pseudo-filesystem framework +options TMPFS # TMP Memory Filesystem +options GEOM_PART_GPT # GUID Partition Tables. +options GEOM_LABEL # Provides labelization +#options COMPAT_FREEBSD5 # Compatible with FreeBSD5 +#options COMPAT_FREEBSD6 # Compatible with FreeBSD6 +#options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI +options KTRACE # ktrace(1) support +options SYSVSHM # SYSV-style shared memory +options SYSVMSG # SYSV-style message queues +options SYSVSEM # SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions +options INCLUDE_CONFIG_FILE # Include this file in kernel + +# required for netbooting +#options BOOTP +#options BOOTP_COMPAT +#options BOOTP_NFSROOT +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=ue0 +# +options ROOTDEVNAME=\"ufs:ada0s2a\" + + +# kernel/memory size reduction +#options MUTEX_NOINLINE +#options NO_FFS_SNAPSHOT +#options NO_SWAPPING +#options NO_SYSCTL_DESCR +#options RWLOCK_NOINLINE + +# Debugging support. Always need this: +options KDB # Enable kernel debugger support. +# For minimum debugger support (stable branch) use: +#options KDB_TRACE # Print a stack trace for a panic. +# For full debugger support use this instead: +options DDB # Support DDB. +#options GDB # Support remote GDB. +options DEADLKRES # Enable the deadlock resolver +options INVARIANTS # Enable calls of extra sanity checking +options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +options WITNESS # Enable checks to detect deadlocks and cycles + +# The `bpf' device enables the Berkeley Packet Filter. +# Be aware of the administrative consequences of enabling this! +# Note that 'bpf' is required for DHCP. +device bpf # Berkeley packet filter + +# Pseudo devices. +device loop # Network loopback +device random # Entropy device +device ether # Ethernet support +#device vlan # 802.1Q VLAN support +#device tun # Packet tunnel. +#device md # Memory "disks" +#device gif # IPv6 and IPv4 tunneling +#device faith # IPv6-to-IPv4 relaying (translation) +#device firmware # firmware assist module + +# Serial (COM) ports +device uart # Multi-uart driver +options ALT_BREAK_TO_DEBUGGER + +device ata +device atapci # Only for helper functions +device imxata +options ATA_CAM +options ATA_STATIC_ID # Static device numbering + +device iomux # IO Multiplexor + +device gpio +device gpioled + +device fsliic +device iic +device iicbus + +# SCSI peripherals +device scbus # SCSI bus (required for SCSI) +device da # Direct Access (disks) +device cd # CD +device pass # Passthrough device (direct SCSI access) + +# USB support +#options USB_DEBUG # enable debug msgs +device ehci # OHCI USB interface +device usb # USB Bus (required) +device umass # Disks/Mass storage - Requires scbus and da +device uhid # "Human Interface Devices" +device u3g + +# USB Ethernet, requires miibus +device miibus +device aue # ADMtek USB Ethernet +device axe # ASIX Electronics USB Ethernet +device cdce # Generic USB over Ethernet +device cue # CATC USB Ethernet +device kue # Kawasaki LSI USB Ethernet +device rue # RealTek RTL8150 USB Ethernet +device udav # Davicom DM9601E USB + +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs + +# Watchdog timer. +# WARNING: can't be disabled!!! +device imxwdt # Watchdog + +# Wireless NIC cards +device wlan # 802.11 support +device wlan_wep # 802.11 WEP support +device wlan_ccmp # 802.11 CCMP support +device wlan_tkip # 802.11 TKIP support +device wlan_amrr # AMRR transmit rate control algorithm + +# Flattened Device Tree +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=efikamx.dts + +# NOTE: serial console will be disabled if syscons enabled +# Uncomment following lines for framebuffer/syscons support +device sc +device kbdmux +options SC_DFLT_FONT # compile font in +makeoptions SC_DFLT_FONT=cp437 +device ukbd # Allow keyboard like HIDs to control console + +device ums Added: head/sys/arm/freescale/imx/bus_space.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/freescale/imx/bus_space.c Wed Mar 20 15:39:27 2013 (r248557) @@ -0,0 +1,130 @@ +/*- + * Copyright (C) 2012 FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Oleksandr Tymoshenko under sponsorship + * from the FreeBSD Foundation. + * Portions of this software were developed by Oleksandr Rybalko + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of MARVELL nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include + +/* Prototypes for all the bus_space structure functions */ +bs_protos(generic); +bs_protos(generic_armv4); + +struct bus_space _base_tag = { + /* cookie */ + .bs_cookie = (void *) 0, + + /* mapping/unmapping */ + .bs_map = generic_bs_map, + .bs_unmap = generic_bs_unmap, + .bs_subregion = generic_bs_subregion, + + /* allocation/deallocation */ + .bs_alloc = generic_bs_alloc, + .bs_free = generic_bs_free, + + /* barrier */ + .bs_barrier = generic_bs_barrier, + + /* read (single) */ + .bs_r_1 = generic_bs_r_1, + .bs_r_2 = generic_armv4_bs_r_2, + .bs_r_4 = generic_bs_r_4, + .bs_r_8 = NULL, + + /* read multiple */ + .bs_rm_1 = generic_bs_rm_1, + .bs_rm_2 = generic_armv4_bs_rm_2, + .bs_rm_4 = generic_bs_rm_4, + .bs_rm_8 = NULL, + + /* read region */ + .bs_rr_1 = generic_bs_rr_1, + .bs_rr_2 = generic_armv4_bs_rr_2, + .bs_rr_4 = generic_bs_rr_4, + .bs_rr_8 = NULL, + + /* write (single) */ + .bs_w_1 = generic_bs_w_1, + .bs_w_2 = generic_armv4_bs_w_2, + .bs_w_4 = generic_bs_w_4, + .bs_w_8 = NULL, + + /* write multiple */ + .bs_wm_1 = generic_bs_wm_1, + .bs_wm_2 = generic_armv4_bs_wm_2, + .bs_wm_4 = generic_bs_wm_4, + .bs_wm_8 = NULL, + + /* write region */ + .bs_wr_1 = generic_bs_wr_1, + .bs_wr_2 = generic_armv4_bs_wr_2, + .bs_wr_4 = generic_bs_wr_4, + .bs_wr_8 = NULL, + + /* read multiple stream */ + .bs_rm_1_s = generic_bs_rm_1, + .bs_rm_2_s = generic_armv4_bs_rm_2, + .bs_rm_4_s = generic_bs_rm_4, + .bs_rm_8_s = NULL, + + /* write multiple stream */ + .bs_wm_1_s = generic_bs_wm_1, + .bs_wm_2_s = generic_armv4_bs_wm_2, + .bs_wm_4_s = generic_bs_wm_4, + .bs_wm_8_s = NULL, + + /* set multiple */ + /* XXX not implemented */ + + /* set region */ + .bs_sr_1 = NULL, + .bs_sr_2 = generic_armv4_bs_sr_2, + .bs_sr_4 = generic_bs_sr_4, + .bs_sr_8 = NULL, + + /* copy */ + .bs_c_1 = NULL, + .bs_c_2 = generic_armv4_bs_c_2, + .bs_c_4 = NULL, + .bs_c_8 = NULL, +}; + +bus_space_tag_t fdtbus_bs_tag = &_base_tag; Added: head/sys/arm/freescale/imx/common.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/freescale/imx/common.c Wed Mar 20 15:39:27 2013 (r248557) @@ -0,0 +1,75 @@ +/*- + * Copyright (C) 2008-2011 MARVELL INTERNATIONAL LTD. + * Copyright (c) 2012 The FreeBSD Foundation + * All rights reserved. + * + * Developed by Semihalf. + * + * Portions of this software were developed by Oleksandr Rybalko + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of MARVELL nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "opt_global.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +struct fdt_fixup_entry fdt_fixup_table[] = { + { NULL, NULL } +}; + +static int +fdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, + int *pol) +{ + + *interrupt = fdt32_to_cpu(intr[0]); + *trig = INTR_TRIGGER_CONFORM; + *pol = INTR_POLARITY_CONFORM; + + return (0); +} + +fdt_pic_decode_t fdt_pic_table[] = { + &fdt_intc_decode_ic, + NULL +}; Added: head/sys/arm/freescale/imx/console.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/freescale/imx/console.c Wed Mar 20 15:39:27 2013 (r248557) @@ -0,0 +1,164 @@ +/*- + * Copyright (c) 2012 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Oleksandr Rybalko under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* Simple UART console driver for Freescale i.MX515 */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +/* Allow it to be predefined, to be able to use another UART for console */ +#ifndef IMX_UART_BASE +#define IMX_UART_BASE 0xe3fbc000 /* UART1 */ +#endif + +#define IMX_RXD (u_int32_t *)(IMX_UART_BASE + 0x00) +#define IMX_TXD (u_int32_t *)(IMX_UART_BASE + 0x40) + +#define IMX_UFCR (u_int32_t *)(IMX_UART_BASE + 0x90) +#define IMX_USR1 (u_int32_t *)(IMX_UART_BASE + 0x94) +#define IMX_USR1_TRDY (1 << 13) + +#define IMX_USR2 (u_int32_t *)(IMX_UART_BASE + 0x98) +#define IMX_USR2_RDR (1 << 0) +#define IMX_USR2_TXFE (1 << 14) +#define IMX_USR2_TXDC (1 << 3) + +#define IMX_UTS (u_int32_t *)(IMX_UART_BASE + 0xb4) +#define IMX_UTS_TXFULL (1 << 4) + +/* + * uart related funcs + */ +static u_int32_t +uart_getreg(u_int32_t *bas) +{ + + return *((volatile u_int32_t *)(bas)) & 0xff; +} + +static void +uart_setreg(u_int32_t *bas, u_int32_t val) +{ + + *((volatile u_int32_t *)(bas)) = (u_int32_t)val; +} + +static int +ub_tstc(void) +{ + + return ((uart_getreg(IMX_USR2) & IMX_USR2_RDR) ? 1 : 0); +} + +static int +ub_getc(void) +{ + + while (!ub_tstc()); + __asm __volatile("nop"); + + return (uart_getreg(IMX_RXD) & 0xff); +} + +static void +ub_putc(unsigned char c) +{ + + if (c == '\n') + ub_putc('\r'); + + while (uart_getreg(IMX_UTS) & IMX_UTS_TXFULL) + __asm __volatile("nop"); + + uart_setreg(IMX_TXD, c); +} + +static cn_probe_t uart_cnprobe; +static cn_init_t uart_cninit; +static cn_term_t uart_cnterm; +static cn_getc_t uart_cngetc; +static cn_putc_t uart_cnputc; +static cn_grab_t uart_cngrab; +static cn_ungrab_t uart_cnungrab; + +static void +uart_cngrab(struct consdev *cp) +{ + +} + +static void +uart_cnungrab(struct consdev *cp) +{ + +} + + +static void +uart_cnprobe(struct consdev *cp) +{ + + sprintf(cp->cn_name, "uart"); + cp->cn_pri = CN_NORMAL; +} + +static void +uart_cninit(struct consdev *cp) +{ + uart_setreg(IMX_UFCR, 0x00004210); +} + +void +uart_cnputc(struct consdev *cp, int c) +{ + + ub_putc(c); +} + +int +uart_cngetc(struct consdev * cp) +{ + + return ub_getc(); +} + +static void +uart_cnterm(struct consdev * cp) +{ + +} + +CONSOLE_DRIVER(uart); Added: head/sys/arm/freescale/imx/i2c.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/freescale/imx/i2c.c Wed Mar 20 15:39:27 2013 (r248557) @@ -0,0 +1,492 @@ +/*- + * Copyright (C) 2008-2009 Semihalf, Michal Hajduk + * Copyright (c) 2012 The FreeBSD Foundation + * All rights reserved. + * + * Portions of this software were developed by Oleksandr Rybalko + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include "iicbus_if.h" + +#include +#include +#include +#include + +#define I2C_ADDR_REG 0x00 /* I2C slave address register */ +#define I2C_FDR_REG 0x04 /* I2C frequency divider register */ +#define I2C_CONTROL_REG 0x08 /* I2C control register */ +#define I2C_STATUS_REG 0x0C /* I2C status register */ +#define I2C_DATA_REG 0x10 /* I2C data register */ +#define I2C_DFSRR_REG 0x14 /* I2C Digital Filter Sampling rate */ + +#define I2CCR_MEN (1 << 7) /* Module enable */ +#define I2CCR_MSTA (1 << 5) /* Master/slave mode */ +#define I2CCR_MTX (1 << 4) /* Transmit/receive mode */ +#define I2CCR_TXAK (1 << 3) /* Transfer acknowledge */ +#define I2CCR_RSTA (1 << 2) /* Repeated START */ + +#define I2CSR_MCF (1 << 7) /* Data transfer */ +#define I2CSR_MASS (1 << 6) /* Addressed as a slave */ +#define I2CSR_MBB (1 << 5) /* Bus busy */ +#define I2CSR_MAL (1 << 4) /* Arbitration lost */ +#define I2CSR_SRW (1 << 2) /* Slave read/write */ +#define I2CSR_MIF (1 << 1) /* Module interrupt */ +#define I2CSR_RXAK (1 << 0) /* Received acknowledge */ + +#define I2C_BAUD_RATE_FAST 0x31 +#define I2C_BAUD_RATE_DEF 0x3F +#define I2C_DFSSR_DIV 0x10 + +#ifdef DEBUG +#define debugf(fmt, args...) do { printf("%s(): ", __func__); \ + printf(fmt,##args); } while (0) +#else +#define debugf(fmt, args...) +#endif + +struct i2c_softc { + device_t dev; + device_t iicbus; + struct resource *res; + struct mtx mutex; + int rid; + bus_space_handle_t bsh; + bus_space_tag_t bst; +}; + +static phandle_t i2c_get_node(device_t, device_t); +static int i2c_probe(device_t); +static int i2c_attach(device_t); + +static int i2c_repeated_start(device_t, u_char, int); +static int i2c_start(device_t, u_char, int); +static int i2c_stop(device_t); +static int i2c_reset(device_t, u_char, u_char, u_char *); +static int i2c_read(device_t, char *, int, int *, int, int); +static int i2c_write(device_t, const char *, int, int *, int); + +static device_method_t i2c_methods[] = { + DEVMETHOD(device_probe, i2c_probe), + DEVMETHOD(device_attach, i2c_attach), + + /* OFW methods */ + DEVMETHOD(ofw_bus_get_node, i2c_get_node), + + DEVMETHOD(iicbus_callback, iicbus_null_callback), + DEVMETHOD(iicbus_repeated_start, i2c_repeated_start), + DEVMETHOD(iicbus_start, i2c_start), + DEVMETHOD(iicbus_stop, i2c_stop), + DEVMETHOD(iicbus_reset, i2c_reset), + DEVMETHOD(iicbus_read, i2c_read), + DEVMETHOD(iicbus_write, i2c_write), + DEVMETHOD(iicbus_transfer, iicbus_transfer_gen), + + { 0, 0 } +}; + +static driver_t i2c_driver = { + "iichb", + i2c_methods, + sizeof(struct i2c_softc), +}; +static devclass_t i2c_devclass; + +DRIVER_MODULE(i2c, simplebus, i2c_driver, i2c_devclass, 0, 0); +DRIVER_MODULE(iicbus, i2c, iicbus_driver, iicbus_devclass, 0, 0); + +static phandle_t +i2c_get_node(device_t bus, device_t dev) +{ + /* + * Share controller node with iicbus device + */ + return ofw_bus_get_node(bus); +} + +static __inline void +i2c_write_reg(struct i2c_softc *sc, bus_size_t off, uint8_t val) +{ + + bus_space_write_1(sc->bst, sc->bsh, off, val); +} + +static __inline uint8_t +i2c_read_reg(struct i2c_softc *sc, bus_size_t off) +{ + + return (bus_space_read_1(sc->bst, sc->bsh, off)); +} + +static __inline void +i2c_flag_set(struct i2c_softc *sc, bus_size_t off, uint8_t mask) +{ + uint8_t status; + + status = i2c_read_reg(sc, off); + status |= mask; + i2c_write_reg(sc, off, status); +} + +/* Wait for transfer interrupt flag */ +static int +wait_for_iif(struct i2c_softc *sc) +{ + int retry; + + retry = 1000; + while (retry --) { + if (i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MIF) + return (IIC_NOERR); + DELAY(10); + } + + return (IIC_ETIMEOUT); +} + +/* Wait for free bus */ +static int +wait_for_nibb(struct i2c_softc *sc) +{ + int retry; + + retry = 1000; + while (retry --) { + if ((i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MBB) == 0) + return (IIC_NOERR); + DELAY(10); + } + + return (IIC_ETIMEOUT); +} + +/* Wait for transfer complete+interrupt flag */ +static int +wait_for_icf(struct i2c_softc *sc) +{ + int retry; + + retry = 1000; + while (retry --) { + + if ((i2c_read_reg(sc, I2C_STATUS_REG) & + (I2CSR_MCF|I2CSR_MIF)) == (I2CSR_MCF|I2CSR_MIF)) + return (IIC_NOERR); + DELAY(10); + } + + return (IIC_ETIMEOUT); +} + +static int +i2c_probe(device_t dev) +{ + struct i2c_softc *sc; + + if (!ofw_bus_is_compatible(dev, "fsl,imx-i2c")) + return (ENXIO); + + sc = device_get_softc(dev); + sc->rid = 0; + + sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rid, + RF_ACTIVE); + if (sc->res == NULL) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + + sc->bst = rman_get_bustag(sc->res); + sc->bsh = rman_get_bushandle(sc->res); + + /* Enable I2C */ + i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN); + bus_release_resource(dev, SYS_RES_MEMORY, sc->rid, sc->res); + device_set_desc(dev, "I2C bus controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +i2c_attach(device_t dev) +{ + struct i2c_softc *sc; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->rid = 0; + + mtx_init(&sc->mutex, device_get_nameunit(dev), "I2C", MTX_DEF); + + sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rid, + RF_ACTIVE); + if (sc->res == NULL) { + device_printf(dev, "could not allocate resources"); + mtx_destroy(&sc->mutex); + return (ENXIO); + } + + sc->bst = rman_get_bustag(sc->res); + sc->bsh = rman_get_bushandle(sc->res); + + sc->iicbus = device_add_child(dev, "iicbus", -1); + if (sc->iicbus == NULL) { + device_printf(dev, "could not add iicbus child"); + mtx_destroy(&sc->mutex); + return (ENXIO); + } + + bus_generic_attach(dev); + return (IIC_NOERR); +} + +static int +i2c_repeated_start(device_t dev, u_char slave, int timeout) +{ + struct i2c_softc *sc; + int error; + + sc = device_get_softc(dev); + + mtx_lock(&sc->mutex); + + i2c_write_reg(sc, I2C_ADDR_REG, slave); + if ((i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MBB) == 0) { + mtx_unlock(&sc->mutex); + return (IIC_EBUSBSY); + } + + /* Set repeated start condition */ + DELAY(10); + i2c_flag_set(sc, I2C_CONTROL_REG, I2CCR_RSTA); + DELAY(10); + /* Clear status */ + i2c_write_reg(sc, I2C_STATUS_REG, 0x0); + /* Write target address - LSB is R/W bit */ + i2c_write_reg(sc, I2C_DATA_REG, slave); + + error = wait_for_iif(sc); + + /* Clear status */ + i2c_write_reg(sc, I2C_STATUS_REG, 0x0); + + mtx_unlock(&sc->mutex); + + if (error) + return (error); + + return (IIC_NOERR); +} + +static int +i2c_start(device_t dev, u_char slave, int timeout) +{ + struct i2c_softc *sc; + int error; + + sc = device_get_softc(dev); + + mtx_lock(&sc->mutex); + i2c_write_reg(sc, I2C_ADDR_REG, slave); + if (i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MBB) { + mtx_unlock(&sc->mutex); + return (IIC_EBUSBSY); + } + + /* Set start condition */ + i2c_write_reg(sc, I2C_CONTROL_REG, + I2CCR_MEN | I2CCR_MSTA | I2CCR_TXAK); + DELAY(100); + i2c_write_reg(sc, I2C_CONTROL_REG, + I2CCR_MEN | I2CCR_MSTA | I2CCR_MTX | I2CCR_TXAK); + /* Clear status */ + i2c_write_reg(sc, I2C_STATUS_REG, 0x0); + /* Write target address - LSB is R/W bit */ + i2c_write_reg(sc, I2C_DATA_REG, slave); + + error = wait_for_iif(sc); + + mtx_unlock(&sc->mutex); + if (error) + return (error); + + return (IIC_NOERR); +} + + +static int +i2c_stop(device_t dev) +{ + struct i2c_softc *sc; + + sc = device_get_softc(dev); + mtx_lock(&sc->mutex); + i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | I2CCR_TXAK); + DELAY(100); + /* Reset controller if bus still busy after STOP */ + if (wait_for_nibb(sc) == IIC_ETIMEOUT) { + i2c_write_reg(sc, I2C_CONTROL_REG, 0); + DELAY(1000); + i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | I2CCR_TXAK); + + i2c_write_reg(sc, I2C_STATUS_REG, 0x0); + } + mtx_unlock(&sc->mutex); + + return (IIC_NOERR); +} + +static int +i2c_reset(device_t dev, u_char speed, u_char addr, u_char *oldadr) +{ + struct i2c_softc *sc; + uint8_t baud_rate; + + sc = device_get_softc(dev); + + switch (speed) { + case IIC_FAST: + baud_rate = I2C_BAUD_RATE_FAST; + break; + case IIC_SLOW: + case IIC_UNKNOWN: + case IIC_FASTEST: + default: + baud_rate = I2C_BAUD_RATE_DEF; + break; + } + + mtx_lock(&sc->mutex); + i2c_write_reg(sc, I2C_CONTROL_REG, 0x0); + i2c_write_reg(sc, I2C_STATUS_REG, 0x0); + DELAY(1000); + + i2c_write_reg(sc, I2C_FDR_REG, 20); + i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN); + DELAY(1000); + i2c_write_reg(sc, I2C_STATUS_REG, 0x0); + mtx_unlock(&sc->mutex); + + return (IIC_NOERR); +} + +static int +i2c_read(device_t dev, char *buf, int len, int *read, int last, int delay) +{ + struct i2c_softc *sc; + int error, reg; + + sc = device_get_softc(dev); + *read = 0; + + mtx_lock(&sc->mutex); + + if (len) { + if (len == 1) + i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | + I2CCR_MSTA | I2CCR_TXAK); + + else + i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | + I2CCR_MSTA); + + /* dummy read */ + i2c_read_reg(sc, I2C_DATA_REG); + DELAY(1000); + } + + while (*read < len) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 17:57:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8E519CA6; Wed, 20 Mar 2013 17:57:01 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 71CE1950; Wed, 20 Mar 2013 17:57:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2KHv1UQ025134; Wed, 20 Mar 2013 17:57:01 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2KHv0TF025124; Wed, 20 Mar 2013 17:57:00 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201303201757.r2KHv0TF025124@svn.freebsd.org> From: Kirk McKusick Date: Wed, 20 Mar 2013 17:57:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248561 - in head/sys: kern sys ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 17:57:01 -0000 Author: mckusick Date: Wed Mar 20 17:57:00 2013 New Revision: 248561 URL: http://svnweb.freebsd.org/changeset/base/248561 Log: When renaming a directory from one parent directory to another, we need to call ufs_checkpath() to walk from our new location to the root of the filesystem to ensure that we do not encounter ourselves along the way. Until now, we accomplished this by reading the ".." entries of each directory in our path until we reached the root (or encountered an error). This change tries to avoid the I/O of reading the ".." entries by first looking them up in the name cache and only doing the I/O when the name cache lookup fails. Reviewed by: kib Tested by: Peter Holm MFC after: 4 weeks Modified: head/sys/kern/vfs_cache.c head/sys/sys/vnode.h head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Wed Mar 20 16:30:17 2013 (r248560) +++ head/sys/kern/vfs_cache.c Wed Mar 20 17:57:00 2013 (r248561) @@ -1359,6 +1359,28 @@ vn_fullpath1(struct thread *td, struct v return (0); } +struct vnode * +vn_dir_dd_ino(struct vnode *vp) +{ + struct namecache *ncp; + struct vnode *ddvp; + + ASSERT_VOP_LOCKED(vp, "vn_dir_dd_ino"); + CACHE_RLOCK(); + TAILQ_FOREACH(ncp, &(vp->v_cache_dst), nc_dst) { + if ((ncp->nc_flag & NCF_ISDOTDOT) != 0) + continue; + ddvp = ncp->nc_dvp; + VI_LOCK(ddvp); + CACHE_RUNLOCK(); + if (vget(ddvp, LK_INTERLOCK | LK_SHARED | LK_NOWAIT, curthread)) + return (NULL); + return (ddvp); + } + CACHE_RUNLOCK(); + return (NULL); +} + int vn_commname(struct vnode *vp, char *buf, u_int buflen) { Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Wed Mar 20 16:30:17 2013 (r248560) +++ head/sys/sys/vnode.h Wed Mar 20 17:57:00 2013 (r248561) @@ -622,6 +622,8 @@ int vn_fullpath(struct thread *td, struc char **retbuf, char **freebuf); int vn_fullpath_global(struct thread *td, struct vnode *vn, char **retbuf, char **freebuf); +struct vnode * + vn_dir_dd_ino(struct vnode *vp); int vn_commname(struct vnode *vn, char *buf, u_int buflen); int vn_path_to_global_path(struct thread *td, struct vnode *vp, char *path, u_int pathlen); Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Wed Mar 20 16:30:17 2013 (r248560) +++ head/sys/ufs/ufs/ufs_lookup.c Wed Mar 20 17:57:00 2013 (r248561) @@ -1387,13 +1387,29 @@ ufs_dirempty(ip, parentino, cred) } static int -ufs_dir_dd_ino(struct vnode *vp, struct ucred *cred, ino_t *dd_ino) +ufs_dir_dd_ino(struct vnode *vp, struct ucred *cred, ino_t *dd_ino, + struct vnode **dd_vp) { struct dirtemplate dirbuf; + struct vnode *ddvp; int error, namlen; + ASSERT_VOP_LOCKED(vp, "ufs_dir_dd_ino"); if (vp->v_type != VDIR) return (ENOTDIR); + /* + * First check to see if we have it in the name cache. + */ + if ((ddvp = vn_dir_dd_ino(vp)) != NULL) { + KASSERT(ddvp->v_mount == vp->v_mount, + ("ufs_dir_dd_ino: Unexpected mount point crossing")); + *dd_ino = VTOI(ddvp)->i_number; + *dd_vp = ddvp; + return (0); + } + /* + * Have to read the directory. + */ error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf, sizeof (struct dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, NULL, NULL); @@ -1411,6 +1427,7 @@ ufs_dir_dd_ino(struct vnode *vp, struct dirbuf.dotdot_name[1] != '.') return (ENOTDIR); *dd_ino = dirbuf.dotdot_ino; + *dd_vp = NULL; return (0); } @@ -1435,7 +1452,7 @@ ufs_checkpath(ino_t source_ino, ino_t pa if (target->i_number == ROOTINO) return (0); for (;;) { - error = ufs_dir_dd_ino(vp, cred, &dd_ino); + error = ufs_dir_dd_ino(vp, cred, &dd_ino, &vp1); if (error != 0) break; if (dd_ino == source_ino) { @@ -1446,22 +1463,16 @@ ufs_checkpath(ino_t source_ino, ino_t pa break; if (dd_ino == parent_ino) break; - error = VFS_VGET(mp, dd_ino, LK_SHARED | LK_NOWAIT, &vp1); - if (error != 0) { - *wait_ino = dd_ino; - break; - } - /* Recheck that ".." still points to vp1 after relock of vp */ - error = ufs_dir_dd_ino(vp, cred, &dd_ino); - if (error != 0) { - vput(vp1); - break; - } - /* Redo the check of ".." if directory was reparented */ - if (dd_ino != VTOI(vp1)->i_number) { - vput(vp1); - continue; + if (vp1 == NULL) { + error = VFS_VGET(mp, dd_ino, LK_SHARED | LK_NOWAIT, + &vp1); + if (error != 0) { + *wait_ino = dd_ino; + break; + } } + KASSERT(dd_ino == VTOI(vp1)->i_number, + ("directory %d reparented\n", VTOI(vp1)->i_number)); if (vp != tvp) vput(vp); vp = vp1; @@ -1469,6 +1480,8 @@ ufs_checkpath(ino_t source_ino, ino_t pa if (error == ENOTDIR) panic("checkpath: .. not a directory\n"); + if (vp1 != NULL) + vput(vp1); if (vp != tvp) vput(vp); return (error); From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 21:07:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 879A7207; Wed, 20 Mar 2013 21:07:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5678F3F4; Wed, 20 Mar 2013 21:07:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2KL7oHe083822; Wed, 20 Mar 2013 21:07:50 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2KL7oD0083821; Wed, 20 Mar 2013 21:07:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303202107.r2KL7oD0083821@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 20 Mar 2013 21:07:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248562 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 21:07:50 -0000 Author: kib Date: Wed Mar 20 21:07:49 2013 New Revision: 248562 URL: http://svnweb.freebsd.org/changeset/base/248562 Log: When the journaled FFS volume is suspended due to the journal space becoming too low, the softdep flush thread processes the workitems, which frees the space in journal, and then unsuspends the fs. The softdep_flush() and other workitem processing functions busy the filesystem before iterating over the worklist, to prevent the parallel unmount from freeing the mount data. The vfs_busy() is called with MBF_NOWAIT flag. Now, if the unmount is already started and the filesystem is suspended due to low journal space, the journal is never flushed and filesystem is never unsuspended, because vfs_busy(MBF_NOWAIT) call cannot succeed for the unmounting fs, and softdep_flush() does not process the workitems. Unmount needs to write metadata, where it hangs in the "suspfs" state. Move the vn_start_write() call in the dounmount() before setting the MNTK_UNMOUNT flag. This practically ensures that softdep_flush() processed the pending journal writes by making dounmount() wait for the lift of the suspension. Sponsored by: The FreeBSD Foundation Reported and tested by: pho MFC after: 2 weeks Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Wed Mar 20 17:57:00 2013 (r248561) +++ head/sys/kern/vfs_mount.c Wed Mar 20 21:07:49 2013 (r248562) @@ -1256,12 +1256,14 @@ dounmount(mp, flags, td) return (error); } + vn_start_write(NULL, &mp, V_WAIT); MNT_ILOCK(mp); if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0 || !TAILQ_EMPTY(&mp->mnt_uppers)) { MNT_IUNLOCK(mp); if (coveredvp) VOP_UNLOCK(coveredvp, 0); + vn_finished_write(mp); return (EBUSY); } mp->mnt_kern_flag |= MNTK_UNMOUNT | MNTK_NOINSMNTQ; @@ -1281,7 +1283,6 @@ dounmount(mp, flags, td) KASSERT(error == 0, ("%s: invalid return value for msleep in the drain path @ %s:%d", __func__, __FILE__, __LINE__)); - vn_start_write(NULL, &mp, V_WAIT); if (mp->mnt_flag & MNT_EXPUBLIC) vfs_setpublicfs(NULL, NULL, NULL); From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 21:08:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 85C5A358; Wed, 20 Mar 2013 21:08:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 777723F9; Wed, 20 Mar 2013 21:08:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2KL81To083902; Wed, 20 Mar 2013 21:08:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2KL81Tn083901; Wed, 20 Mar 2013 21:08:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303202108.r2KL81Tn083901@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 20 Mar 2013 21:08:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248563 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 21:08:01 -0000 Author: kib Date: Wed Mar 20 21:08:00 2013 New Revision: 248563 URL: http://svnweb.freebsd.org/changeset/base/248563 Log: In bufwrite(), a dirty buffer is moved to the clean queue before the bufobj counter of the writes in progress is incremented. Other thread inspecting the bufobj would consider it clean. For the regular vnodes, the vnode lock is typically held both by the thread performing the bufwrite() and an other thread doing syncing, which prevents the situation. On the other hand, writes to the VCHR vnodes are done without holding vnode lock. Increment the write ref counter for the buffer object before calling bundirty(). Sponsored by: The FreeBSD Foundation Tested by: pho MFC after: 2 weeks Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Mar 20 21:07:49 2013 (r248562) +++ head/sys/kern/vfs_bio.c Wed Mar 20 21:08:00 2013 (r248563) @@ -1044,7 +1044,13 @@ bufwrite(struct buf *bp) else vp_md = 0; - /* Mark the buffer clean */ + /* + * Mark the buffer clean. Increment the bufobj write count + * before bundirty() call, to prevent other thread from seeing + * empty dirty list and zero counter for writes in progress, + * falsely indicating that the bufobj is clean. + */ + bufobj_wref(bp->b_bufobj); bundirty(bp); bp->b_flags &= ~B_DONE; @@ -1052,7 +1058,6 @@ bufwrite(struct buf *bp) bp->b_flags |= B_CACHE; bp->b_iocmd = BIO_WRITE; - bufobj_wref(bp->b_bufobj); vfs_busy_pages(bp, 1); /* From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 21:47:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0DAD424C; Wed, 20 Mar 2013 21:47:06 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CFA6376A; Wed, 20 Mar 2013 21:47:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2KLl5x6096284; Wed, 20 Mar 2013 21:47:05 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2KLl55R096283; Wed, 20 Mar 2013 21:47:05 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201303202147.r2KLl55R096283@svn.freebsd.org> From: Neel Natu Date: Wed, 20 Mar 2013 21:47:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248564 - head/tools/tools/netrate/netreceive X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 21:47:06 -0000 Author: neel Date: Wed Mar 20 21:47:05 2013 New Revision: 248564 URL: http://svnweb.freebsd.org/changeset/base/248564 Log: Set WARNS=3 so this actually compiles. Modified: head/tools/tools/netrate/netreceive/Makefile Modified: head/tools/tools/netrate/netreceive/Makefile ============================================================================== --- head/tools/tools/netrate/netreceive/Makefile Wed Mar 20 21:08:00 2013 (r248563) +++ head/tools/tools/netrate/netreceive/Makefile Wed Mar 20 21:47:05 2013 (r248564) @@ -6,4 +6,6 @@ PROG= netreceive NO_MAN= LDFLAGS += -lpthread +WARNS?= 3 + .include From owner-svn-src-head@FreeBSD.ORG Wed Mar 20 23:50:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4E6B7B2D; Wed, 20 Mar 2013 23:50:16 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (unknown [IPv6:2001:610:1108:5012::107]) by mx1.freebsd.org (Postfix) with ESMTP id 17739B36; Wed, 20 Mar 2013 23:50:16 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id C42C01203C9; Thu, 21 Mar 2013 00:50:01 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id AEA682848C; Thu, 21 Mar 2013 00:50:01 +0100 (CET) Date: Thu, 21 Mar 2013 00:50:01 +0100 From: Jilles Tjoelker To: Gleb Smirnoff Subject: Re: svn commit: r248534 - in head: lib/libc/sys share/man/man4 sys/kern sys/sys Message-ID: <20130320235001.GA60980@stack.nl> References: <201303192058.r2JKwIwg039788@svn.freebsd.org> <20130320091856.GI76816@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130320091856.GI76816@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 23:50:16 -0000 On Wed, Mar 20, 2013 at 01:18:56PM +0400, Gleb Smirnoff wrote: > On Tue, Mar 19, 2013 at 08:58:18PM +0000, Jilles Tjoelker wrote: > J> Author: jilles > J> Date: Tue Mar 19 20:58:17 2013 > J> New Revision: 248534 > J> URL: http://svnweb.freebsd.org/changeset/base/248534 > J> Log: > J> Implement SOCK_CLOEXEC, SOCK_NONBLOCK and MSG_CMSG_CLOEXEC. > J> This change allows creating file descriptors with close-on-exec set in some > J> situations. SOCK_CLOEXEC and SOCK_NONBLOCK can be OR'ed in socket() and > J> socketpair()'s type parameter, and MSG_CMSG_CLOEXEC to recvmsg() makes file > J> descriptors (SCM_RIGHTS) atomically close-on-exec. > J> The numerical values for SOCK_CLOEXEC and SOCK_NONBLOCK are as in NetBSD. > J> MSG_CMSG_CLOEXEC is the first free bit for MSG_*. > J> The SOCK_* flags are not passed to MAC because this may cause incorrect > J> failures and can be done later via fcntl() anyway. On the other hand, audit > J> is expected to cope with the new flags. > J> For MSG_CMSG_CLOEXEC, unp_externalize() is extended to take a flags > J> argument. > IMO, it won't hurt if changes like this (bringing in new functionality) > would bump __FreeBSD_version. This change can be detected via the new #defines, and I plan to add similar changes in the near future (see the hackers@ mail about this patch; some of them cannot be detected via the preprocessor or even at compile time). Therefore, I think a __FreeBSD_version bump is not yet appropriate. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 07:04:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5ED5DF51; Thu, 21 Mar 2013 07:04:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4FA21D1B; Thu, 21 Mar 2013 07:04:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2L74IUv068807; Thu, 21 Mar 2013 07:04:18 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2L74IR4068806; Thu, 21 Mar 2013 07:04:18 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201303210704.r2L74IR4068806@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 21 Mar 2013 07:04:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248566 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 07:04:18 -0000 Author: hselasky Date: Thu Mar 21 07:04:17 2013 New Revision: 248566 URL: http://svnweb.freebsd.org/changeset/base/248566 Log: Add new USB ID. PR: usb/177173 MFC after: 1 week Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Thu Mar 21 06:56:35 2013 (r248565) +++ head/sys/dev/usb/wlan/if_rum.c Thu Mar 21 07:04:17 2013 (r248566) @@ -120,6 +120,7 @@ static const STRUCT_USB_HOST_ID rum_devs RUM_DEV(HUAWEI3COM, WUB320G), RUM_DEV(MELCO, G54HP), RUM_DEV(MELCO, SG54HP), + RUM_DEV(MELCO, SG54HG), RUM_DEV(MELCO, WLIUCG), RUM_DEV(MELCO, WLRUCG), RUM_DEV(MELCO, WLRUCGAOSS), From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 07:25:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id ABF9B6AF; Thu, 21 Mar 2013 07:25:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9E0CDDF3; Thu, 21 Mar 2013 07:25:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2L7P8VZ075390; Thu, 21 Mar 2013 07:25:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2L7P8Bt075389; Thu, 21 Mar 2013 07:25:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303210725.r2L7P8Bt075389@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Mar 2013 07:25:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248567 - head/sys/fs/nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 07:25:08 -0000 Author: kib Date: Thu Mar 21 07:25:08 2013 New Revision: 248567 URL: http://svnweb.freebsd.org/changeset/base/248567 Log: Do not call vnode_pager_setsize() while a NFS node mutex is locked. vnode_pager_setsize() might sleep waiting for the page after EOF be unbusied. Call vnode_pager_setsize() both for the regular and directory vnodes. Reported by: mich Reviewed by: rmacklem Discussed with: avg, jhb MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clport.c Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Thu Mar 21 07:04:17 2013 (r248566) +++ head/sys/fs/nfsclient/nfs_clport.c Thu Mar 21 07:25:08 2013 (r248567) @@ -361,6 +361,8 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsnode *np; struct nfsmount *nmp; struct timespec mtime_save; + u_quad_t nsize; + int setnsize; /* * If v_type == VNON it is a new node, so fill in the v_type, @@ -418,6 +420,7 @@ nfscl_loadattrcache(struct vnode **vpp, } else vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0]; np->n_attrstamp = time_second; + setnsize = 0; if (vap->va_size != np->n_size) { if (vap->va_type == VREG) { if (dontshrink && vap->va_size < np->n_size) { @@ -444,10 +447,13 @@ nfscl_loadattrcache(struct vnode **vpp, np->n_size = vap->va_size; np->n_flag |= NSIZECHANGED; } - vnode_pager_setsize(vp, np->n_size); } else { np->n_size = vap->va_size; } + if (vap->va_type == VREG || vap->va_type == VDIR) { + setnsize = 1; + nsize = vap->va_size; + } } /* * The following checks are added to prevent a race between (say) @@ -480,6 +486,8 @@ nfscl_loadattrcache(struct vnode **vpp, KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, 0); #endif NFSUNLOCKNODE(np); + if (setnsize) + vnode_pager_setsize(vp, nsize); return (0); } From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 07:26:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0E0D2830; Thu, 21 Mar 2013 07:26:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 00067E05; Thu, 21 Mar 2013 07:26:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2L7QXh2075603; Thu, 21 Mar 2013 07:26:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2L7QXID075602; Thu, 21 Mar 2013 07:26:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303210726.r2L7QXID075602@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Mar 2013 07:26:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248568 - head/sys/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 07:26:34 -0000 Author: kib Date: Thu Mar 21 07:26:33 2013 New Revision: 248568 URL: http://svnweb.freebsd.org/changeset/base/248568 Log: Assert that transient mapping of the bio is only done when unmapped buffers are allowed. Sponsored by: The FreeBSD Foundation Modified: head/sys/geom/geom_io.c Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Thu Mar 21 07:25:08 2013 (r248567) +++ head/sys/geom/geom_io.c Thu Mar 21 07:26:33 2013 (r248568) @@ -628,6 +628,8 @@ g_io_transient_map_bio(struct bio *bp) u_int retried; int rv; + KASSERT(unmapped_buf_allowed, ("unmapped disabled")); + size = round_page(bp->bio_ma_offset + bp->bio_length); KASSERT(size / PAGE_SIZE == bp->bio_ma_n, ("Bio too short %p", bp)); addr = 0; From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 07:28:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 22BE79C5; Thu, 21 Mar 2013 07:28:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1507CE1E; Thu, 21 Mar 2013 07:28:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2L7SFOM075871; Thu, 21 Mar 2013 07:28:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2L7SFYI075868; Thu, 21 Mar 2013 07:28:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303210728.r2L7SFYI075868@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Mar 2013 07:28:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248569 - in head/sys: kern vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 07:28:16 -0000 Author: kib Date: Thu Mar 21 07:28:15 2013 New Revision: 248569 URL: http://svnweb.freebsd.org/changeset/base/248569 Log: Only size and create the bio_transient_map when unmapped buffers are enabled. Now, disabling the unmapped buffers should result in the kernel memory map identical to pre-r248550. Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/vfs_bio.c head/sys/vm/vm_init.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Mar 21 07:26:33 2013 (r248568) +++ head/sys/kern/vfs_bio.c Thu Mar 21 07:28:15 2013 (r248569) @@ -586,7 +586,7 @@ kern_vfs_bio_buffer_alloc(caddr_t v, lon * allows to not trim the buffer KVA for the architectures * with ample KVA space. */ - if (bio_transient_maxcnt == 0) { + if (bio_transient_maxcnt == 0 && unmapped_buf_allowed) { maxbuf_sz = maxbcache != 0 ? maxbcache : maxbuf * BKVASIZE; buf_sz = (long)nbuf * BKVASIZE; if (buf_sz < maxbuf_sz / 10 * 9) { Modified: head/sys/vm/vm_init.c ============================================================================== --- head/sys/vm/vm_init.c Thu Mar 21 07:26:33 2013 (r248568) +++ head/sys/vm/vm_init.c Thu Mar 21 07:28:15 2013 (r248569) @@ -189,10 +189,12 @@ again: buffer_map = kmem_suballoc(clean_map, &kmi->buffer_sva, &kmi->buffer_eva, (long)nbuf * BKVASIZE, FALSE); buffer_map->system_map = 1; - bio_transient_map = kmem_suballoc(clean_map, &kmi->bio_transient_sva, - &kmi->bio_transient_eva, (long)bio_transient_maxcnt * MAXPHYS, - FALSE); - bio_transient_map->system_map = 1; + if (bio_transient_maxcnt != 0) { + bio_transient_map = kmem_suballoc(clean_map, + &kmi->bio_transient_sva, &kmi->bio_transient_eva, + (long)bio_transient_maxcnt * MAXPHYS, FALSE); + bio_transient_map->system_map = 1; + } pager_map = kmem_suballoc(clean_map, &kmi->pager_sva, &kmi->pager_eva, (long)nswbuf * MAXPHYS, FALSE); pager_map->system_map = 1; From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 08:36:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F1113664; Thu, 21 Mar 2013 08:36:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E394229C; Thu, 21 Mar 2013 08:36:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2L8aGRS097163; Thu, 21 Mar 2013 08:36:16 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2L8aG2I097161; Thu, 21 Mar 2013 08:36:16 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201303210836.r2L8aG2I097161@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 21 Mar 2013 08:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248570 - head/sys/netgraph X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 08:36:17 -0000 Author: glebius Date: Thu Mar 21 08:36:15 2013 New Revision: 248570 URL: http://svnweb.freebsd.org/changeset/base/248570 Log: Add NGM_NAT_LIBALIAS_INFO command, that reports internal stats of libalias instance. To be used in the mpd5 daemon. Submitted by: Dmitry Luhtionov Modified: head/sys/netgraph/ng_nat.c head/sys/netgraph/ng_nat.h Modified: head/sys/netgraph/ng_nat.c ============================================================================== --- head/sys/netgraph/ng_nat.c Thu Mar 21 07:28:15 2013 (r248569) +++ head/sys/netgraph/ng_nat.c Thu Mar 21 08:36:15 2013 (r248570) @@ -145,6 +145,14 @@ static const struct ng_parse_type ng_nat &ng_nat_list_redirects_fields }; +/* Parse type for struct ng_nat_libalias_info. */ +static const struct ng_parse_struct_field ng_nat_libalias_info_fields[] + = NG_NAT_LIBALIAS_INFO; +static const struct ng_parse_type ng_nat_libalias_info_type = { + &ng_parse_struct_type, + &ng_nat_libalias_info_fields +}; + /* List of commands and how to convert arguments to/from ASCII. */ static const struct ng_cmdlist ng_nat_cmdlist[] = { { @@ -224,6 +232,13 @@ static const struct ng_cmdlist ng_nat_cm &ng_parse_string_type, NULL }, + { + NGM_NAT_COOKIE, + NGM_NAT_LIBALIAS_INFO, + "libaliasinfo", + NULL, + &ng_nat_libalias_info_type + }, { 0 } }; @@ -647,6 +662,36 @@ ng_nat_rcvmsg(node_p node, item_p item, error = ENOMEM; } break; + case NGM_NAT_LIBALIAS_INFO: + { + struct ng_nat_libalias_info *i; + + NG_MKRESPONSE(resp, msg, + sizeof(struct ng_nat_libalias_info), M_NOWAIT); + if (resp == NULL) { + error = ENOMEM; + break; + } + i = (struct ng_nat_libalias_info *)resp->data; +#define COPY(F) do { \ + if (priv->lib->F >= 0 && priv->lib->F < UINT32_MAX) \ + i->F = priv->lib->F; \ + else \ + i->F = UINT32_MAX; \ +} while (0) + + COPY(icmpLinkCount); + COPY(udpLinkCount); + COPY(tcpLinkCount); + COPY(pptpLinkCount); + COPY(sctpLinkCount); + COPY(protoLinkCount); + COPY(fragmentIdLinkCount); + COPY(fragmentPtrLinkCount); + COPY(sockCount); +#undef COPY + } + break; default: error = EINVAL; /* unknown command */ break; Modified: head/sys/netgraph/ng_nat.h ============================================================================== --- head/sys/netgraph/ng_nat.h Thu Mar 21 07:28:15 2013 (r248569) +++ head/sys/netgraph/ng_nat.h Thu Mar 21 08:36:15 2013 (r248570) @@ -172,6 +172,33 @@ struct ng_nat_list_redirects { { NULL } \ } +/* Structure returned by NGM_NAT_LIBALIAS_INFO */ +struct ng_nat_libalias_info { + uint32_t icmpLinkCount; + uint32_t udpLinkCount; + uint32_t tcpLinkCount; + uint32_t sctpLinkCount; + uint32_t pptpLinkCount; + uint32_t protoLinkCount; + uint32_t fragmentIdLinkCount; + uint32_t fragmentPtrLinkCount; + uint32_t sockCount; +}; + +/* Keep this in sync with the above structure definition */ +#define NG_NAT_LIBALIAS_INFO { \ + { "icmpLinkCount", &ng_parse_uint32_type }, \ + { "udpLinkCount", &ng_parse_uint32_type }, \ + { "tcpLinkCount", &ng_parse_uint32_type }, \ + { "sctpLinkCount", &ng_parse_uint32_type }, \ + { "pptpLinkCount", &ng_parse_uint32_type }, \ + { "protoLinkCount", &ng_parse_uint32_type }, \ + { "fragmentIdLinkCount", &ng_parse_uint32_type }, \ + { "fragmentPtrLinkCount", &ng_parse_uint32_type }, \ + { "sockCount", &ng_parse_uint32_type }, \ + { NULL } \ +} + enum { NGM_NAT_SET_IPADDR = 1, NGM_NAT_SET_MODE, @@ -184,4 +211,5 @@ enum { NGM_NAT_ADD_SERVER, NGM_NAT_LIST_REDIRECTS, NGM_NAT_PROXY_RULE, + NGM_NAT_LIBALIAS_INFO, }; From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 08:38:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 16629AB9; Thu, 21 Mar 2013 08:38:05 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 05F36320; Thu, 21 Mar 2013 08:38:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2L8c5Oq097440; Thu, 21 Mar 2013 08:38:05 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2L8c3OB097432; Thu, 21 Mar 2013 08:38:03 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201303210838.r2L8c3OB097432@svn.freebsd.org> From: Martin Matuska Date: Thu, 21 Mar 2013 08:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248571 - in head: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 08:38:05 -0000 Author: mm Date: Thu Mar 21 08:38:03 2013 New Revision: 248571 URL: http://svnweb.freebsd.org/changeset/base/248571 Log: Merge libzfs_core branch: includes MFV 238590, 238592, 247580 MFV 238590, 238592: In the first zfs ioctl restructuring phase, the libzfs_core library was introduced. It is a new thin library that wraps around kernel ioctl's. The idea is to provide a forward-compatible way of dealing with new features. Arguments are passed in nvlists and not random zfs_cmd fields, new-style ioctls are logged to pool history using a new method of history logging. http://blog.delphix.com/matt/2012/01/17/the-future-of-libzfs/ MFV 247580 [1]: To address issues of several deadlocks and race conditions the locking code around dsl_dataset was rewritten and the interface to synctasks was changed. User-Visible Changes: "zfs snapshot" can create more arbitrary snapshots at once (atomically) "zfs destroy" destroys multiple snapshots at once "zfs recv" has improved performance Backward Compatibility: I have extended the compatibility layer to support full backward compatibility by remapping or rewriting the responsible ioctl arguments. Old utilities are fully supported by the new kernel module. Forward Compatibility: New utilities work with old kernels with the following restrictions: - creating, destroying, holding and releasing of multiple snapshots at once is not supported, this includes recursive (-r) commands Illumos ZFS issues: 2882 implement libzfs_core 2900 "zfs snapshot" should be able to create multiple, arbitrary snapshots at once 3464 zfs synctask code needs restructuring References: https://www.illumos.org/issues/2882 https://www.illumos.org/issues/2900 https://www.illumos.org/issues/3464 [1] MFC after: 1 month Sponsored by: Hybrid Logic Inc. [1] Added: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c - copied unchanged from r248551, projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.h - copied unchanged from r248551, projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.h head/cddl/contrib/opensolaris/lib/libzfs_core/ - copied from r248551, projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs_core/ head/cddl/lib/libzfs_core/ - copied from r248551, projects/libzfs_core/cddl/lib/libzfs_core/ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c - copied unchanged from r248551, projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c - copied unchanged from r248551, projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h - copied unchanged from r248551, projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_destroy.h - copied unchanged from r248551, projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_destroy.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_userhold.h - copied unchanged from r248551, projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_userhold.h Modified: head/Makefile.inc1 head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/cmd/zhack/zhack.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h head/cddl/lib/Makefile head/cddl/lib/libzfs/Makefile head/cddl/sbin/zfs/Makefile head/cddl/sbin/zpool/Makefile head/cddl/usr.bin/zinject/Makefile head/cddl/usr.bin/ztest/Makefile head/cddl/usr.sbin/zdb/Makefile head/cddl/usr.sbin/zhack/Makefile head/rescue/rescue/Makefile head/share/mk/bsd.libnames.mk head/sys/cddl/compat/opensolaris/sys/cred.h head/sys/cddl/contrib/opensolaris/common/nvpair/fnvpair.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.h head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h head/sys/cddl/contrib/opensolaris/common/zfs/zprop_common.c head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deleg.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_prop.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfeature.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c head/sys/cddl/contrib/opensolaris/uts/common/sys/feature_tests.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/nvpair.h Directory Properties: head/cddl/ (props changed) head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zfs/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Mar 21 08:36:15 2013 (r248570) +++ head/Makefile.inc1 Thu Mar 21 08:38:03 2013 (r248571) @@ -1389,6 +1389,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1 lib/libopie lib/libpam ${_lib_libthr} \ lib/libradius lib/libsbuf lib/libtacplus \ ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ + ${_cddl_lib_libzfs_core} \ lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ ${_secure_lib_libssl} @@ -1417,7 +1418,9 @@ lib/libopie__L lib/libtacplus__L: lib/li .if ${MK_CDDL} != "no" _cddl_lib_libumem= cddl/lib/libumem _cddl_lib_libnvpair= cddl/lib/libnvpair +_cddl_lib_libzfs_core= cddl/lib/libzfs_core _cddl_lib= cddl/lib +cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L .endif .if ${MK_CRYPT} != "no" Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Mar 21 08:36:15 2013 (r248570) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Mar 21 08:38:03 2013 (r248571) @@ -57,6 +57,7 @@ #include #include #include +#include #undef ZFS_MAXNAMELEN #undef verify #include @@ -206,6 +207,27 @@ dump_packed_nvlist(objset_t *os, uint64_ nvlist_free(nv); } +/* ARGSUSED */ +static void +dump_history_offsets(objset_t *os, uint64_t object, void *data, size_t size) +{ + spa_history_phys_t *shp = data; + + if (shp == NULL) + return; + + (void) printf("\t\tpool_create_len = %llu\n", + (u_longlong_t)shp->sh_pool_create_len); + (void) printf("\t\tphys_max_off = %llu\n", + (u_longlong_t)shp->sh_phys_max_off); + (void) printf("\t\tbof = %llu\n", + (u_longlong_t)shp->sh_bof); + (void) printf("\t\teof = %llu\n", + (u_longlong_t)shp->sh_eof); + (void) printf("\t\trecords_lost = %llu\n", + (u_longlong_t)shp->sh_records_lost); +} + static void zdb_nicenum(uint64_t num, char *buf) { @@ -857,21 +879,22 @@ dump_history(spa_t *spa) for (int i = 0; i < num; i++) { uint64_t time, txg, ievent; char *cmd, *intstr; + boolean_t printed = B_FALSE; if (nvlist_lookup_uint64(events[i], ZPOOL_HIST_TIME, &time) != 0) - continue; + goto next; if (nvlist_lookup_string(events[i], ZPOOL_HIST_CMD, &cmd) != 0) { if (nvlist_lookup_uint64(events[i], ZPOOL_HIST_INT_EVENT, &ievent) != 0) - continue; + goto next; verify(nvlist_lookup_uint64(events[i], ZPOOL_HIST_TXG, &txg) == 0); verify(nvlist_lookup_string(events[i], ZPOOL_HIST_INT_STR, &intstr) == 0); - if (ievent >= LOG_END) - continue; + if (ievent >= ZFS_NUM_LEGACY_HISTORY_EVENTS) + goto next; (void) snprintf(internalstr, sizeof (internalstr), @@ -884,6 +907,14 @@ dump_history(spa_t *spa) (void) localtime_r(&tsec, &t); (void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t); (void) printf("%s %s\n", tbuf, cmd); + printed = B_TRUE; + +next: + if (dump_opt['h'] > 1) { + if (!printed) + (void) printf("unrecognized record:\n"); + dump_nvlist(events[i], 2); + } } } @@ -1496,7 +1527,7 @@ static object_viewer_t *object_viewer[DM dump_zap, /* other ZAP */ dump_zap, /* persistent error log */ dump_uint8, /* SPA history */ - dump_uint64, /* SPA history offsets */ + dump_history_offsets, /* SPA history offsets */ dump_zap, /* Pool properties */ dump_zap, /* DSL permissions */ dump_acl, /* ZFS ACL */ @@ -1661,7 +1692,9 @@ dump_dir(objset_t *os) int print_header = 1; int i, error; + dsl_pool_config_enter(dmu_objset_pool(os), FTAG); dmu_objset_fast_stat(os, &dds); + dsl_pool_config_exit(dmu_objset_pool(os), FTAG); if (dds.dds_type < DMU_OST_NUMTYPES) type = objset_types[dds.dds_type]; @@ -2070,7 +2103,6 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog NULL, NULL, ZIO_PRIORITY_ASYNC_READ, flags, zb)); free(data); - if (ioerr && !(flags & ZIO_FLAG_SPECULATIVE)) { zcb->zcb_haderrors = 1; zcb->zcb_errors[ioerr]++; Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Mar 21 08:36:15 2013 (r248570) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Mar 21 08:38:03 2013 (r248571) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 1, 2013 +.Dd March 21, 2013 .Dt ZFS 8 .Os .Sh NAME @@ -65,6 +65,7 @@ .Op Fl r .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... .Ar filesystem@snapname Ns | Ns Ar volume@snapname +.Ar filesystem@snapname Ns | Ns Ar volume@snapname Ns ... .Nm .Cm rollback .Op Fl rRf @@ -1617,7 +1618,11 @@ multiple snapshots. Destroy (or mark for deferred deletion) all snapshots with this name in descendent file systems. .It Fl R -Recursively destroy all dependents. +Recursively destroy all clones of these snapshots, including the clones, +snapshots, and children. +If this flag is specified, the +.Op fl d +flag will have no effect. .It Fl n Do a dry-run ("No-op") deletion. No data will be deleted. This is useful in conjunction with the @@ -1645,17 +1650,18 @@ behavior for mounted file systems in use .Op Fl r .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... .Ar filesystem@snapname Ns | Ns volume@snapname +.Ar filesystem@snapname Ns | Ns volume@snapname Ns ... .Xc .Pp -Creates a snapshot with the given name. All previous modifications by -successful system calls to the file system are part of the snapshot. See the +Creates snapshots with the given names. All previous modifications by +successful system calls to the file system are part of the snapshots. +Snapshots are taken atomically, so that all snapshots correspond to the same +moment in time. See the .Qq Sx Snapshots section for details. .Bl -tag -width indent .It Fl r -Recursively create snapshots of all descendent datasets. Snapshots are taken -atomically, so that all recursive snapshots correspond to the same moment in -time. +Recursively create snapshots of all descendent datasets .It Fl o Ar property Ns = Ns Ar value Sets the specified property; see .Qq Nm Cm create Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Mar 21 08:36:15 2013 (r248570) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Mar 21 08:38:03 2013 (r248571) @@ -58,6 +58,7 @@ #include #include +#include #include #include #include @@ -74,6 +75,7 @@ libzfs_handle_t *g_zfs; static FILE *mnttab_file; static char history_str[HIS_MAX_RECORD_LEN]; +static boolean_t log_history = B_TRUE; static int zfs_do_clone(int argc, char **argv); static int zfs_do_create(int argc, char **argv); @@ -276,7 +278,7 @@ get_usage(zfs_help_t idx) return (gettext("\tshare <-a | filesystem>\n")); case HELP_SNAPSHOT: return (gettext("\tsnapshot [-r] [-o property=value] ... " - "\n")); + " ...\n")); case HELP_UNMOUNT: return (gettext("\tunmount [-f] " "<-a | filesystem|mountpoint>\n")); @@ -914,11 +916,12 @@ typedef struct destroy_cbdata { boolean_t cb_parsable; boolean_t cb_dryrun; nvlist_t *cb_nvl; + nvlist_t *cb_batchedsnaps; /* first snap in contiguous run */ - zfs_handle_t *cb_firstsnap; + char *cb_firstsnap; /* previous snap in contiguous run */ - zfs_handle_t *cb_prevsnap; + char *cb_prevsnap; int64_t cb_snapused; char *cb_snapspec; } destroy_cbdata_t; @@ -1010,9 +1013,27 @@ destroy_callback(zfs_handle_t *zhp, void zfs_close(zhp); return (0); } + if (cb->cb_dryrun) { + zfs_close(zhp); + return (0); + } + + /* + * We batch up all contiguous snapshots (even of different + * filesystems) and destroy them with one ioctl. We can't + * simply do all snap deletions and then all fs deletions, + * because we must delete a clone before its origin. + */ + if (zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT) { + fnvlist_add_boolean(cb->cb_batchedsnaps, name); + } else { + int error = zfs_destroy_snaps_nvl(g_zfs, + cb->cb_batchedsnaps, B_FALSE); + fnvlist_free(cb->cb_batchedsnaps); + cb->cb_batchedsnaps = fnvlist_alloc(); - if (!cb->cb_dryrun) { - if (zfs_unmount(zhp, NULL, cb->cb_force ? MS_FORCE : 0) != 0 || + if (error != 0 || + zfs_unmount(zhp, NULL, cb->cb_force ? MS_FORCE : 0) != 0 || zfs_destroy(zhp, cb->cb_defer_destroy) != 0) { zfs_close(zhp); return (-1); @@ -1032,11 +1053,13 @@ destroy_print_cb(zfs_handle_t *zhp, void if (nvlist_exists(cb->cb_nvl, name)) { if (cb->cb_firstsnap == NULL) - cb->cb_firstsnap = zfs_handle_dup(zhp); + cb->cb_firstsnap = strdup(name); if (cb->cb_prevsnap != NULL) - zfs_close(cb->cb_prevsnap); + free(cb->cb_prevsnap); /* this snap continues the current range */ - cb->cb_prevsnap = zfs_handle_dup(zhp); + cb->cb_prevsnap = strdup(name); + if (cb->cb_firstsnap == NULL || cb->cb_prevsnap == NULL) + nomem(); if (cb->cb_verbose) { if (cb->cb_parsable) { (void) printf("destroy\t%s\n", name); @@ -1051,12 +1074,12 @@ destroy_print_cb(zfs_handle_t *zhp, void } else if (cb->cb_firstsnap != NULL) { /* end of this range */ uint64_t used = 0; - err = zfs_get_snapused_int(cb->cb_firstsnap, + err = lzc_snaprange_space(cb->cb_firstsnap, cb->cb_prevsnap, &used); cb->cb_snapused += used; - zfs_close(cb->cb_firstsnap); + free(cb->cb_firstsnap); cb->cb_firstsnap = NULL; - zfs_close(cb->cb_prevsnap); + free(cb->cb_prevsnap); cb->cb_prevsnap = NULL; } zfs_close(zhp); @@ -1073,13 +1096,13 @@ destroy_print_snapshots(zfs_handle_t *fs if (cb->cb_firstsnap != NULL) { uint64_t used = 0; if (err == 0) { - err = zfs_get_snapused_int(cb->cb_firstsnap, + err = lzc_snaprange_space(cb->cb_firstsnap, cb->cb_prevsnap, &used); } cb->cb_snapused += used; - zfs_close(cb->cb_firstsnap); + free(cb->cb_firstsnap); cb->cb_firstsnap = NULL; - zfs_close(cb->cb_prevsnap); + free(cb->cb_prevsnap); cb->cb_prevsnap = NULL; } return (err); @@ -1166,8 +1189,10 @@ static int zfs_do_destroy(int argc, char **argv) { destroy_cbdata_t cb = { 0 }; + int rv = 0; + int err = 0; int c; - zfs_handle_t *zhp; + zfs_handle_t *zhp = NULL; char *at; zfs_type_t type = ZFS_TYPE_DATASET; @@ -1221,11 +1246,9 @@ zfs_do_destroy(int argc, char **argv) at = strchr(argv[0], '@'); if (at != NULL) { - int err = 0; /* Build the list of snaps to destroy in cb_nvl. */ - if (nvlist_alloc(&cb.cb_nvl, NV_UNIQUE_NAME, 0) != 0) - nomem(); + cb.cb_nvl = fnvlist_alloc(); *at = '\0'; zhp = zfs_open(g_zfs, argv[0], @@ -1236,17 +1259,15 @@ zfs_do_destroy(int argc, char **argv) cb.cb_snapspec = at + 1; if (gather_snapshots(zfs_handle_dup(zhp), &cb) != 0 || cb.cb_error) { - zfs_close(zhp); - nvlist_free(cb.cb_nvl); - return (1); + rv = 1; + goto out; } if (nvlist_empty(cb.cb_nvl)) { (void) fprintf(stderr, gettext("could not find any " "snapshots to destroy; check snapshot names.\n")); - zfs_close(zhp); - nvlist_free(cb.cb_nvl); - return (1); + rv = 1; + goto out; } if (cb.cb_verbose) { @@ -1265,18 +1286,26 @@ zfs_do_destroy(int argc, char **argv) } if (!cb.cb_dryrun) { - if (cb.cb_doclones) + if (cb.cb_doclones) { + cb.cb_batchedsnaps = fnvlist_alloc(); err = destroy_clones(&cb); + if (err == 0) { + err = zfs_destroy_snaps_nvl(g_zfs, + cb.cb_batchedsnaps, B_FALSE); + } + if (err != 0) { + rv = 1; + goto out; + } + } if (err == 0) { - err = zfs_destroy_snaps_nvl(zhp, cb.cb_nvl, + err = zfs_destroy_snaps_nvl(g_zfs, cb.cb_nvl, cb.cb_defer_destroy); } } - zfs_close(zhp); - nvlist_free(cb.cb_nvl); if (err != 0) - return (1); + rv = 1; } else { /* Open the given dataset */ if ((zhp = zfs_open(g_zfs, argv[0], type)) == NULL) @@ -1297,8 +1326,8 @@ zfs_do_destroy(int argc, char **argv) zfs_get_name(zhp)); (void) fprintf(stderr, gettext("use 'zpool destroy %s' " "to destroy the pool itself\n"), zfs_get_name(zhp)); - zfs_close(zhp); - return (1); + rv = 1; + goto out; } /* @@ -1308,30 +1337,42 @@ zfs_do_destroy(int argc, char **argv) if (!cb.cb_doclones && zfs_iter_dependents(zhp, B_TRUE, destroy_check_dependent, &cb) != 0) { - zfs_close(zhp); - return (1); + rv = 1; + goto out; } if (cb.cb_error) { - zfs_close(zhp); - return (1); + rv = 1; + goto out; } + cb.cb_batchedsnaps = fnvlist_alloc(); if (zfs_iter_dependents(zhp, B_FALSE, destroy_callback, &cb) != 0) { - zfs_close(zhp); - return (1); + rv = 1; + goto out; } /* * Do the real thing. The callback will close the * handle regardless of whether it succeeds or not. */ - if (destroy_callback(zhp, &cb) != 0) - return (1); + err = destroy_callback(zhp, &cb); + zhp = NULL; + if (err == 0) { + err = zfs_destroy_snaps_nvl(g_zfs, + cb.cb_batchedsnaps, cb.cb_defer_destroy); + } + if (err != 0) + rv = 1; } - return (0); +out: + fnvlist_free(cb.cb_batchedsnaps); + fnvlist_free(cb.cb_nvl); + if (zhp != NULL) + zfs_close(zhp); + return (rv); } static boolean_t @@ -1932,9 +1973,11 @@ upgrade_set_callback(zfs_handle_t *zhp, /* * If they did "zfs upgrade -a", then we could * be doing ioctls to different pools. We need - * to log this history once to each pool. + * to log this history once to each pool, and bypass + * the normal history logging that happens in main(). */ - verify(zpool_stage_history(g_zfs, history_str) == 0); + (void) zpool_log_history(g_zfs, history_str); + log_history = B_FALSE; } if (zfs_prop_set(zhp, "version", verstr) == 0) cb->cb_numupgraded++; @@ -3472,6 +3515,32 @@ zfs_do_set(int argc, char **argv) return (ret); } +typedef struct snap_cbdata { + nvlist_t *sd_nvl; + boolean_t sd_recursive; + const char *sd_snapname; +} snap_cbdata_t; + +static int +zfs_snapshot_cb(zfs_handle_t *zhp, void *arg) +{ + snap_cbdata_t *sd = arg; + char *name; + int rv = 0; + int error; + + error = asprintf(&name, "%s@%s", zfs_get_name(zhp), sd->sd_snapname); + if (error == -1) + nomem(); + fnvlist_add_boolean(sd->sd_nvl, name); + free(name); + + if (sd->sd_recursive) + rv = zfs_iter_filesystems(zhp, zfs_snapshot_cb, sd); + zfs_close(zhp); + return (rv); +} + /* * zfs snapshot [-r] [-o prop=value] ... * @@ -3481,13 +3550,16 @@ zfs_do_set(int argc, char **argv) static int zfs_do_snapshot(int argc, char **argv) { - boolean_t recursive = B_FALSE; int ret = 0; char c; nvlist_t *props; + snap_cbdata_t sd = { 0 }; + boolean_t multiple_snaps = B_FALSE; if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0) nomem(); + if (nvlist_alloc(&sd.sd_nvl, NV_UNIQUE_NAME, 0) != 0) + nomem(); /* check options */ while ((c = getopt(argc, argv, "ro:")) != -1) { @@ -3497,7 +3569,8 @@ zfs_do_snapshot(int argc, char **argv) return (1); break; case 'r': - recursive = B_TRUE; + sd.sd_recursive = B_TRUE; + multiple_snaps = B_TRUE; break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), @@ -3514,18 +3587,35 @@ zfs_do_snapshot(int argc, char **argv) (void) fprintf(stderr, gettext("missing snapshot argument\n")); goto usage; } - if (argc > 1) { - (void) fprintf(stderr, gettext("too many arguments\n")); - goto usage; + + if (argc > 1) + multiple_snaps = B_TRUE; + for (; argc > 0; argc--, argv++) { + char *atp; + zfs_handle_t *zhp; + + atp = strchr(argv[0], '@'); + if (atp == NULL) + goto usage; + *atp = '\0'; + sd.sd_snapname = atp + 1; + zhp = zfs_open(g_zfs, argv[0], + ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); + if (zhp == NULL) + goto usage; + if (zfs_snapshot_cb(zhp, &sd) != 0) + goto usage; } - ret = zfs_snapshot(g_zfs, argv[0], recursive, props); + ret = zfs_snapshot_nvl(g_zfs, sd.sd_nvl, props); + nvlist_free(sd.sd_nvl); nvlist_free(props); - if (ret && recursive) + if (ret != 0 && multiple_snaps) (void) fprintf(stderr, gettext("no snapshots were created\n")); return (ret != 0); usage: + nvlist_free(sd.sd_nvl); nvlist_free(props); usage(B_FALSE); return (-1); @@ -5068,28 +5158,12 @@ cleanup2: return (error); } -/* - * zfs allow [-r] [-t] ... - * - * -r Recursively hold - * -t Temporary hold (hidden option) - * - * Apply a user-hold with the given tag to the list of snapshots. - */ static int zfs_do_allow(int argc, char **argv) { return (zfs_do_allow_unallow_impl(argc, argv, B_FALSE)); } -/* - * zfs unallow [-r] [-t] ... - * - * -r Recursively hold - * -t Temporary hold (hidden option) - * - * Apply a user-hold with the given tag to the list of snapshots. - */ static int zfs_do_unallow(int argc, char **argv) { @@ -5103,7 +5177,6 @@ zfs_do_hold_rele_impl(int argc, char **a int i; const char *tag; boolean_t recursive = B_FALSE; - boolean_t temphold = B_FALSE; const char *opts = holding ? "rt" : "r"; int c; @@ -5113,9 +5186,6 @@ zfs_do_hold_rele_impl(int argc, char **a case 'r': recursive = B_TRUE; break; - case 't': - temphold = B_TRUE; - break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); @@ -5164,7 +5234,7 @@ zfs_do_hold_rele_impl(int argc, char **a } if (holding) { if (zfs_hold(zhp, delim+1, tag, recursive, - temphold, B_FALSE, -1, 0, 0) != 0) + B_FALSE, -1) != 0) ++errors; } else { if (zfs_release(zhp, delim+1, tag, recursive) != 0) @@ -5180,7 +5250,6 @@ zfs_do_hold_rele_impl(int argc, char **a * zfs hold [-r] [-t] ... * * -r Recursively hold - * -t Temporary hold (hidden option) * * Apply a user-hold with the given tag to the list of snapshots. */ @@ -6602,8 +6671,7 @@ main(int argc, char **argv) return (1); } - zpool_set_history_str("zfs", argc, argv, history_str); - verify(zpool_stage_history(g_zfs, history_str) == 0); + zfs_save_arguments(argc, argv, history_str, sizeof (history_str)); libzfs_print_on_error(g_zfs, B_TRUE); @@ -6672,6 +6740,9 @@ main(int argc, char **argv) (void) fclose(mnttab_file); + if (ret == 0 && log_history) + (void) zpool_log_history(g_zfs, history_str); + libzfs_fini(g_zfs); /* Modified: head/cddl/contrib/opensolaris/cmd/zhack/zhack.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zhack/zhack.c Thu Mar 21 08:36:15 2013 (r248570) +++ head/cddl/contrib/opensolaris/cmd/zhack/zhack.c Thu Mar 21 08:38:03 2013 (r248571) @@ -46,6 +46,7 @@ #include #include #include +#include #undef ZFS_MAXNAMELEN #undef verify #include @@ -273,12 +274,15 @@ zhack_do_feature_stat(int argc, char **a } static void -feature_enable_sync(void *arg1, void *arg2, dmu_tx_t *tx) +feature_enable_sync(void *arg, dmu_tx_t *tx) { - spa_t *spa = arg1; - zfeature_info_t *feature = arg2; + spa_t *spa = dmu_tx_pool(tx)->dp_spa; + zfeature_info_t *feature = arg; spa_feature_enable(spa, feature, tx); + spa_history_log_internal(spa, "zhack enable feature", tx, + "name=%s can_readonly=%u", + feature->fi_guid, feature->fi_can_readonly); } static void @@ -341,8 +345,8 @@ zhack_do_feature_enable(int argc, char * if (0 == zap_contains(mos, spa->spa_feat_desc_obj, feature.fi_guid)) fatal("feature already enabled: %s", feature.fi_guid); - VERIFY3U(0, ==, dsl_sync_task_do(spa->spa_dsl_pool, NULL, - feature_enable_sync, spa, &feature, 5)); + VERIFY0(dsl_sync_task(spa_name(spa), NULL, + feature_enable_sync, &feature, 5)); spa_close(spa, FTAG); @@ -350,21 +354,25 @@ zhack_do_feature_enable(int argc, char * } static void -feature_incr_sync(void *arg1, void *arg2, dmu_tx_t *tx) +feature_incr_sync(void *arg, dmu_tx_t *tx) { - spa_t *spa = arg1; - zfeature_info_t *feature = arg2; + spa_t *spa = dmu_tx_pool(tx)->dp_spa; + zfeature_info_t *feature = arg; spa_feature_incr(spa, feature, tx); + spa_history_log_internal(spa, "zhack feature incr", tx, + "name=%s", feature->fi_guid); } static void -feature_decr_sync(void *arg1, void *arg2, dmu_tx_t *tx) +feature_decr_sync(void *arg, dmu_tx_t *tx) { - spa_t *spa = arg1; - zfeature_info_t *feature = arg2; + spa_t *spa = dmu_tx_pool(tx)->dp_spa; + zfeature_info_t *feature = arg; spa_feature_decr(spa, feature, tx); + spa_history_log_internal(spa, "zhack feature decr", tx, + "name=%s", feature->fi_guid); } static void @@ -435,8 +443,8 @@ zhack_do_feature_ref(int argc, char **ar if (decr && !spa_feature_is_active(spa, &feature)) fatal("feature refcount already 0: %s", feature.fi_guid); - VERIFY3U(0, ==, dsl_sync_task_do(spa->spa_dsl_pool, NULL, - decr ? feature_decr_sync : feature_incr_sync, spa, &feature, 5)); + VERIFY0(dsl_sync_task(spa_name(spa), NULL, + decr ? feature_decr_sync : feature_incr_sync, &feature, 5)); spa_close(spa, FTAG); } Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Mar 21 08:36:15 2013 (r248570) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Mar 21 08:38:03 2013 (r248571) @@ -192,9 +192,9 @@ static zpool_command_t command_table[] = #define NCOMMAND (sizeof (command_table) / sizeof (command_table[0])) -zpool_command_t *current_command; +static zpool_command_t *current_command; static char history_str[HIS_MAX_RECORD_LEN]; - +static boolean_t log_history = B_TRUE; static uint_t timestamp_fmt = NODATE; static const char * @@ -1093,7 +1093,10 @@ zpool_do_destroy(int argc, char **argv) return (1); } - ret = (zpool_destroy(zhp) != 0); + /* The history must be logged as part of the export */ + log_history = B_FALSE; + + ret = (zpool_destroy(zhp, history_str) != 0); zpool_close(zhp); @@ -1157,10 +1160,13 @@ zpool_do_export(int argc, char **argv) continue; } + /* The history must be logged as part of the export */ + log_history = B_FALSE; + if (hardforce) { - if (zpool_export_force(zhp) != 0) + if (zpool_export_force(zhp, history_str) != 0) ret = 1; - } else if (zpool_export(zhp, force) != 0) { + } else if (zpool_export(zhp, force, history_str) != 0) { ret = 1; } @@ -4563,6 +4569,14 @@ upgrade_cb(zpool_handle_t *zhp, void *ar if (count > 0) { cbp->cb_first = B_FALSE; printnl = B_TRUE; + /* + * If they did "zpool upgrade -a", then we could + * be doing ioctls to different pools. We need + * to log this history once to each pool, and bypass + * the normal history logging that happens in main(). + */ + (void) zpool_log_history(g_zfs, history_str); + log_history = B_FALSE; } } @@ -4924,8 +4938,8 @@ zpool_do_upgrade(int argc, char **argv) typedef struct hist_cbdata { boolean_t first; - int longfmt; - int internal; + boolean_t longfmt; + boolean_t internal; } hist_cbdata_t; /* @@ -4937,21 +4951,8 @@ get_history_one(zpool_handle_t *zhp, voi nvlist_t *nvhis; nvlist_t **records; uint_t numrecords; - char *cmdstr; - char *pathstr; - uint64_t dst_time; - time_t tsec; - struct tm t; - char tbuf[30]; int ret, i; - uint64_t who; - struct passwd *pwd; - char *hostname; - char *zonename; - char internalstr[MAXPATHLEN]; hist_cbdata_t *cb = (hist_cbdata_t *)data; - uint64_t txg; - uint64_t ievent; cb->first = B_FALSE; @@ -4963,64 +4964,94 @@ get_history_one(zpool_handle_t *zhp, voi verify(nvlist_lookup_nvlist_array(nvhis, ZPOOL_HIST_RECORD, &records, &numrecords) == 0); for (i = 0; i < numrecords; i++) { - if (nvlist_lookup_uint64(records[i], ZPOOL_HIST_TIME, - &dst_time) != 0) - continue; + nvlist_t *rec = records[i]; + char tbuf[30] = ""; - /* is it an internal event or a standard event? */ - if (nvlist_lookup_string(records[i], ZPOOL_HIST_CMD, - &cmdstr) != 0) { - if (cb->internal == 0) + if (nvlist_exists(rec, ZPOOL_HIST_TIME)) { + time_t tsec; + struct tm t; + + tsec = fnvlist_lookup_uint64(records[i], + ZPOOL_HIST_TIME); + (void) localtime_r(&tsec, &t); + (void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t); + } + + if (nvlist_exists(rec, ZPOOL_HIST_CMD)) { + (void) printf("%s %s", tbuf, + fnvlist_lookup_string(rec, ZPOOL_HIST_CMD)); + } else if (nvlist_exists(rec, ZPOOL_HIST_INT_EVENT)) { + int ievent = + fnvlist_lookup_uint64(rec, ZPOOL_HIST_INT_EVENT); + if (!cb->internal) continue; - - if (nvlist_lookup_uint64(records[i], - ZPOOL_HIST_INT_EVENT, &ievent) != 0) + if (ievent >= ZFS_NUM_LEGACY_HISTORY_EVENTS) { + (void) printf("%s unrecognized record:\n", + tbuf); + dump_nvlist(rec, 4); + continue; + } + (void) printf("%s [internal %s txg:%lld] %s", tbuf, + zfs_history_event_names[ievent], + fnvlist_lookup_uint64(rec, ZPOOL_HIST_TXG), + fnvlist_lookup_string(rec, ZPOOL_HIST_INT_STR)); + } else if (nvlist_exists(rec, ZPOOL_HIST_INT_NAME)) { + if (!cb->internal) continue; - verify(nvlist_lookup_uint64(records[i], - ZPOOL_HIST_TXG, &txg) == 0); - verify(nvlist_lookup_string(records[i], - ZPOOL_HIST_INT_STR, &pathstr) == 0); - if (ievent >= LOG_END) + (void) printf("%s [txg:%lld] %s", tbuf, + fnvlist_lookup_uint64(rec, ZPOOL_HIST_TXG), + fnvlist_lookup_string(rec, ZPOOL_HIST_INT_NAME)); + if (nvlist_exists(rec, ZPOOL_HIST_DSNAME)) { + (void) printf(" %s (%llu)", + fnvlist_lookup_string(rec, + ZPOOL_HIST_DSNAME), + fnvlist_lookup_uint64(rec, + ZPOOL_HIST_DSID)); + } + (void) printf(" %s", fnvlist_lookup_string(rec, + ZPOOL_HIST_INT_STR)); + } else if (nvlist_exists(rec, ZPOOL_HIST_IOCTL)) { + if (!cb->internal) continue; - (void) snprintf(internalstr, - sizeof (internalstr), - "[internal %s txg:%lld] %s", - zfs_history_event_names[ievent], txg, - pathstr); - cmdstr = internalstr; - } - tsec = dst_time; - (void) localtime_r(&tsec, &t); - (void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t); - (void) printf("%s %s", tbuf, cmdstr); + (void) printf("%s ioctl %s\n", tbuf, + fnvlist_lookup_string(rec, ZPOOL_HIST_IOCTL)); + if (nvlist_exists(rec, ZPOOL_HIST_INPUT_NVL)) { + (void) printf(" input:\n"); + dump_nvlist(fnvlist_lookup_nvlist(rec, + ZPOOL_HIST_INPUT_NVL), 8); + } + if (nvlist_exists(rec, ZPOOL_HIST_OUTPUT_NVL)) { + (void) printf(" output:\n"); + dump_nvlist(fnvlist_lookup_nvlist(rec, + ZPOOL_HIST_OUTPUT_NVL), 8); + } + } else { + if (!cb->internal) + continue; + (void) printf("%s unrecognized record:\n", tbuf); + dump_nvlist(rec, 4); + } if (!cb->longfmt) { (void) printf("\n"); continue; } (void) printf(" ["); - if (nvlist_lookup_uint64(records[i], - ZPOOL_HIST_WHO, &who) == 0) { - pwd = getpwuid((uid_t)who); - if (pwd) - (void) printf("user %s on", - pwd->pw_name); - else - (void) printf("user %d on", - (int)who); - } else { - (void) printf(gettext("no info]\n")); - continue; + if (nvlist_exists(rec, ZPOOL_HIST_WHO)) { + uid_t who = fnvlist_lookup_uint64(rec, ZPOOL_HIST_WHO); + struct passwd *pwd = getpwuid(who); + (void) printf("user %d ", (int)who); + if (pwd != NULL) + (void) printf("(%s) ", pwd->pw_name); + } + if (nvlist_exists(rec, ZPOOL_HIST_HOST)) { + (void) printf("on %s", + fnvlist_lookup_string(rec, ZPOOL_HIST_HOST)); + } + if (nvlist_exists(rec, ZPOOL_HIST_ZONE)) { + (void) printf(":%s", + fnvlist_lookup_string(rec, ZPOOL_HIST_ZONE)); } - if (nvlist_lookup_string(records[i], - ZPOOL_HIST_HOST, &hostname) == 0) { - (void) printf(" %s", hostname); - } - if (nvlist_lookup_string(records[i], - ZPOOL_HIST_ZONE, &zonename) == 0) { - (void) printf(":%s", zonename); - } - (void) printf("]"); (void) printf("\n"); } @@ -5035,8 +5066,6 @@ get_history_one(zpool_handle_t *zhp, voi * * Displays the history of commands that modified pools. */ - - int zpool_do_history(int argc, char **argv) { @@ -5049,10 +5078,10 @@ zpool_do_history(int argc, char **argv) while ((c = getopt(argc, argv, "li")) != -1) { switch (c) { case 'l': - cbdata.longfmt = 1; + cbdata.longfmt = B_TRUE; break; case 'i': - cbdata.internal = 1; + cbdata.internal = B_TRUE; break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), @@ -5277,8 +5306,7 @@ main(int argc, char **argv) if (strcmp(cmdname, "-?") == 0) usage(B_TRUE); - zpool_set_history_str("zpool", argc, argv, history_str); - verify(zpool_stage_history(g_zfs, history_str) == 0); + zfs_save_arguments(argc, argv, history_str, sizeof (history_str)); /* * Run the appropriate command. @@ -5305,6 +5333,9 @@ main(int argc, char **argv) usage(B_FALSE); } + if (ret == 0 && log_history) + (void) zpool_log_history(g_zfs, history_str); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 09:34:42 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DB25F93E; Thu, 21 Mar 2013 09:34:42 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BECBD7C1; Thu, 21 Mar 2013 09:34:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2L9YgLh015441; Thu, 21 Mar 2013 09:34:42 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2L9YgE0015437; Thu, 21 Mar 2013 09:34:42 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201303210934.r2L9YgE0015437@svn.freebsd.org> From: Steven Hartland Date: Thu, 21 Mar 2013 09:34:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248572 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 09:34:42 -0000 Author: smh Date: Thu Mar 21 09:34:41 2013 New Revision: 248572 URL: http://svnweb.freebsd.org/changeset/base/248572 Log: Add TRIM support for L2ARC. This adds TRIM support to cache vdevs. When ARC buffers are removed from the L2ARC in arc_hdr_destroy(), arc_release() or l2arc_evict(), the size previously occupied by the buffer gets scheduled for TRIMming. As always, actual TRIMs are only issued to the L2ARC after txg_trim_limit. Reviewed by: pjd (mentor) Approved by: pjd (mentor) Obtained from: https://github.com/dechamps/zfs/commit/31aae373994fd112256607edba7de2359da3e9dc MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Mar 21 08:38:03 2013 (r248571) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Mar 21 09:34:41 2013 (r248572) @@ -130,6 +130,7 @@ #endif #include #include +#include #include #include @@ -1691,6 +1692,8 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) } if (l2hdr != NULL) { + trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, + hdr->b_size); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); @@ -3528,6 +3531,8 @@ arc_release(arc_buf_t *buf, void *tag) buf->b_private = NULL; if (l2hdr) { + trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, + hdr->b_size); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -buf_size); @@ -4442,6 +4447,8 @@ l2arc_write_done(zio_t *zio) list_remove(buflist, ab); abl2 = ab->b_l2hdr; ab->b_l2hdr = NULL; + trim_map_free(abl2->b_dev->l2ad_vdev, abl2->b_daddr, + ab->b_size); kmem_free(abl2, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -ab->b_size); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h Thu Mar 21 08:38:03 2013 (r248571) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h Thu Mar 21 09:34:41 2013 (r248572) @@ -36,7 +36,7 @@ extern "C" { extern void trim_map_create(vdev_t *vd); extern void trim_map_destroy(vdev_t *vd); -extern void trim_map_free(zio_t *zio); +extern void trim_map_free(vdev_t *vd, uint64_t offset, uint64_t size); extern boolean_t trim_map_write_start(zio_t *zio); extern void trim_map_write_done(zio_t *zio); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Mar 21 08:38:03 2013 (r248571) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Mar 21 09:34:41 2013 (r248572) @@ -36,8 +36,8 @@ * than it would otherwise be as well as ensuring that entire * blocks are invalidated by writes. */ -#define TRIM_ZIO_END(zio) ((zio)->io_offset + \ - P2ROUNDUP((zio)->io_size, 1ULL << (zio)->io_vd->vdev_top->vdev_ashift)) +#define TRIM_ZIO_END(vd, offset, size) (offset + \ + P2ROUNDUP(size, 1ULL << vd->vdev_top->vdev_ashift)) typedef struct trim_map { list_t tm_head; /* List of segments sorted by txg. */ @@ -272,16 +272,15 @@ trim_map_free_locked(trim_map_t *tm, uin } void -trim_map_free(zio_t *zio) +trim_map_free(vdev_t *vd, uint64_t offset, uint64_t size) { - vdev_t *vd = zio->io_vd; trim_map_t *tm = vd->vdev_trimmap; if (zfs_notrim || vd->vdev_notrim || tm == NULL) return; mutex_enter(&tm->tm_lock); - trim_map_free_locked(tm, zio->io_offset, TRIM_ZIO_END(zio), + trim_map_free_locked(tm, offset, TRIM_ZIO_END(vd, offset, size), vd->vdev_spa->spa_syncing_txg); mutex_exit(&tm->tm_lock); } @@ -299,7 +298,7 @@ trim_map_write_start(zio_t *zio) return (B_TRUE); start = zio->io_offset; - end = TRIM_ZIO_END(zio); + end = TRIM_ZIO_END(zio->io_vd, start, zio->io_size); tsearch.ts_start = start; tsearch.ts_end = end; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Mar 21 08:38:03 2013 (r248571) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Mar 21 09:34:41 2013 (r248572) @@ -2475,7 +2475,7 @@ zio_vdev_io_start(zio_t *zio) } if (vd->vdev_ops->vdev_op_leaf && zio->io_type == ZIO_TYPE_FREE) { - trim_map_free(zio); + trim_map_free(vd, zio->io_offset, zio->io_size); return (ZIO_PIPELINE_CONTINUE); } From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 10:02:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4319F358; Thu, 21 Mar 2013 10:02:33 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1CF1E96A; Thu, 21 Mar 2013 10:02:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LA2WH7024161; Thu, 21 Mar 2013 10:02:32 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LA2WAq024160; Thu, 21 Mar 2013 10:02:32 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201303211002.r2LA2WAq024160@svn.freebsd.org> From: Steven Hartland Date: Thu, 21 Mar 2013 10:02:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248573 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 10:02:33 -0000 Author: smh Date: Thu Mar 21 10:02:32 2013 New Revision: 248573 URL: http://svnweb.freebsd.org/changeset/base/248573 Log: Don't register repair writes in the trim map. The trim map inflight writes tree assumes non-conflicting writes, i.e. that there will never be two simultaneous write I/Os to the same range on the same vdev. This seemed like a sane assumption; however, in actual testing, it appears that repair I/Os can very well conflict with "normal" writes. I'm not quite sure if these conflicting writes are supposed to happen or not, but in the mean time, let's ignore repair writes for now. This should be safe considering that, by definition, we never repair blocks that are freed. Reviewed by: pjd (mentor) Approved by: pjd (mentor) Obtained from: Source: https://github.com/dechamps/zfs/commit/6a3cebaf7c5fcc92007280b5d403c15d0e61dfe3 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Mar 21 09:34:41 2013 (r248572) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Mar 21 10:02:32 2013 (r248573) @@ -2558,7 +2558,13 @@ zio_vdev_io_start(zio_t *zio) } } - if (vd->vdev_ops->vdev_op_leaf && zio->io_type == ZIO_TYPE_WRITE) { + /* + * Note that we ignore repair writes for TRIM because they can conflict + * with normal writes. This isn't an issue because, by definition, we + * only repair blocks that aren't freed. + */ + if (vd->vdev_ops->vdev_op_leaf && zio->io_type == ZIO_TYPE_WRITE && + !(zio->io_flags & ZIO_FLAG_IO_REPAIR)) { if (!trim_map_write_start(zio)) return (ZIO_PIPELINE_STOP); } @@ -2580,13 +2586,12 @@ zio_vdev_io_done(zio_t *zio) zio->io_type == ZIO_TYPE_WRITE || zio->io_type == ZIO_TYPE_FREE); if (vd != NULL && vd->vdev_ops->vdev_op_leaf && - zio->io_type == ZIO_TYPE_WRITE) { - trim_map_write_done(zio); - } - - if (vd != NULL && vd->vdev_ops->vdev_op_leaf && (zio->io_type == ZIO_TYPE_READ || zio->io_type == ZIO_TYPE_WRITE)) { + if (zio->io_type == ZIO_TYPE_WRITE && + !(zio->io_flags & ZIO_FLAG_IO_REPAIR)) + trim_map_write_done(zio); + vdev_queue_io_done(zio); if (zio->io_type == ZIO_TYPE_WRITE) From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 10:16:11 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EAF2B716; Thu, 21 Mar 2013 10:16:11 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CCCB3A24; Thu, 21 Mar 2013 10:16:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LAGBSU028061; Thu, 21 Mar 2013 10:16:11 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LAGBsg028057; Thu, 21 Mar 2013 10:16:11 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201303211016.r2LAGBsg028057@svn.freebsd.org> From: Steven Hartland Date: Thu, 21 Mar 2013 10:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248574 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 10:16:12 -0000 Author: smh Date: Thu Mar 21 10:16:10 2013 New Revision: 248574 URL: http://svnweb.freebsd.org/changeset/base/248574 Log: Improve TXG handling in the TRIM module. This patch adds some improvements to the way the trim module considers TXGs: - Free ZIOs are registered with the TXG from the ZIO itself, not the current SPA syncing TXG (which may be out of date); - L2ARC are registered with a zero TXG number, as L2ARC has no concept of TXGs; - The TXG limit for issuing TRIMs is now computed from the last synced TXG, not the currently syncing TXG. Indeed, under extremely unlikely race conditions, there is a risk we could trim blocks which have been freed in a TXG that has not finished syncing, resulting in potential data corruption in case of a crash. Reviewed by: pjd (mentor) Approved by: pjd (mentor) Obtained from: https://github.com/dechamps/zfs/commit/5b46ad40d9081d75505d6f3bf04ac652445df366 MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Mar 21 10:02:32 2013 (r248573) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Mar 21 10:16:10 2013 (r248574) @@ -1693,7 +1693,7 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) if (l2hdr != NULL) { trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, - hdr->b_size); + hdr->b_size, 0); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); @@ -3532,7 +3532,7 @@ arc_release(arc_buf_t *buf, void *tag) if (l2hdr) { trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, - hdr->b_size); + hdr->b_size, 0); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -buf_size); @@ -4448,7 +4448,7 @@ l2arc_write_done(zio_t *zio) abl2 = ab->b_l2hdr; ab->b_l2hdr = NULL; trim_map_free(abl2->b_dev->l2ad_vdev, abl2->b_daddr, - ab->b_size); + ab->b_size, 0); kmem_free(abl2, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -ab->b_size); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h Thu Mar 21 10:02:32 2013 (r248573) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h Thu Mar 21 10:16:10 2013 (r248574) @@ -36,7 +36,7 @@ extern "C" { extern void trim_map_create(vdev_t *vd); extern void trim_map_destroy(vdev_t *vd); -extern void trim_map_free(vdev_t *vd, uint64_t offset, uint64_t size); +extern void trim_map_free(vdev_t *vd, uint64_t offset, uint64_t size, uint64_t txg); extern boolean_t trim_map_write_start(zio_t *zio); extern void trim_map_write_done(zio_t *zio); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Mar 21 10:02:32 2013 (r248573) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Mar 21 10:16:10 2013 (r248574) @@ -272,7 +272,7 @@ trim_map_free_locked(trim_map_t *tm, uin } void -trim_map_free(vdev_t *vd, uint64_t offset, uint64_t size) +trim_map_free(vdev_t *vd, uint64_t offset, uint64_t size, uint64_t txg) { trim_map_t *tm = vd->vdev_trimmap; @@ -280,8 +280,7 @@ trim_map_free(vdev_t *vd, uint64_t offse return; mutex_enter(&tm->tm_lock); - trim_map_free_locked(tm, offset, TRIM_ZIO_END(vd, offset, size), - vd->vdev_spa->spa_syncing_txg); + trim_map_free_locked(tm, offset, TRIM_ZIO_END(vd, offset, size), txg); mutex_exit(&tm->tm_lock); } @@ -387,7 +386,7 @@ trim_map_vdev_commit(spa_t *spa, zio_t * if (tm == NULL) return; - txglimit = MIN(spa->spa_syncing_txg, spa_freeze_txg(spa)) - + txglimit = MIN(spa_last_synced_txg(spa), spa_freeze_txg(spa)) - trim_txg_limit; mutex_enter(&tm->tm_lock); @@ -444,7 +443,7 @@ trim_map_commit(spa_t *spa, zio_t *zio, { int c; - if (vd == NULL || spa->spa_syncing_txg <= trim_txg_limit) + if (vd == NULL || spa_last_synced_txg(spa) <= trim_txg_limit) return; if (vd->vdev_ops->vdev_op_leaf) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Mar 21 10:02:32 2013 (r248573) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Mar 21 10:16:10 2013 (r248574) @@ -2475,7 +2475,7 @@ zio_vdev_io_start(zio_t *zio) } if (vd->vdev_ops->vdev_op_leaf && zio->io_type == ZIO_TYPE_FREE) { - trim_map_free(vd, zio->io_offset, zio->io_size); + trim_map_free(vd, zio->io_offset, zio->io_size, zio->io_txg); return (ZIO_PIPELINE_CONTINUE); } From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 10:29:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BBBC59D2; Thu, 21 Mar 2013 10:29:06 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9E732ABB; Thu, 21 Mar 2013 10:29:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LAT6PX031402; Thu, 21 Mar 2013 10:29:06 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LAT6ZB031399; Thu, 21 Mar 2013 10:29:06 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201303211029.r2LAT6ZB031399@svn.freebsd.org> From: Steven Hartland Date: Thu, 21 Mar 2013 10:29:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248575 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 10:29:06 -0000 Author: smh Date: Thu Mar 21 10:29:05 2013 New Revision: 248575 URL: http://svnweb.freebsd.org/changeset/base/248575 Log: TRIM cache devices based on time instead of TXGs. Currently, the trim module uses the same algorithm for data and cache devices when deciding to issue TRIM requests, based on how far in the past the TXG is. Unfortunately, this is not ideal for cache devices, because the L2ARC doesn't use the concept of TXGs at all. In fact, when using a pool for reading only, the L2ARC is written but the TXG counter doesn't increase, and so no new TRIM requests are issued to the cache device. This patch fixes the issue by using time instead of the TXG number as the criteria for trimming on cache devices. The basic delay principle stays the same, but parameters are expressed in seconds instead of TXGs. The new parameters are named trim_l2arc_limit and trim_l2arc_batch, and both default to 30 second. Reviewed by: pjd (mentor) Approved by: pjd (mentor) Obtained from: https://github.com/dechamps/zfs/commit/17122c31ac7f82875e837019205c21651c05f8cd MFC after: 2 weeks Modified: head/sys/cddl/compat/opensolaris/sys/time.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Modified: head/sys/cddl/compat/opensolaris/sys/time.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/time.h Thu Mar 21 10:16:10 2013 (r248574) +++ head/sys/cddl/compat/opensolaris/sys/time.h Thu Mar 21 10:29:05 2013 (r248575) @@ -35,6 +35,7 @@ #define MILLISEC 1000 #define MICROSEC 1000000 #define NANOSEC 1000000000 +#define TIME_MAX LLONG_MAX typedef longlong_t hrtime_t; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Mar 21 10:16:10 2013 (r248574) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Mar 21 10:29:05 2013 (r248575) @@ -27,6 +27,7 @@ #include #include #include +#include /* * Calculate the zio end, upgrading based on ashift which would be @@ -54,6 +55,7 @@ typedef struct trim_seg { uint64_t ts_start; /* Starting offset of this segment. */ uint64_t ts_end; /* Ending offset (non-inclusive). */ uint64_t ts_txg; /* Segment creation txg. */ + hrtime_t ts_time; /* Segment creation time. */ } trim_seg_t; extern boolean_t zfs_notrim; @@ -65,6 +67,11 @@ TUNABLE_INT("vfs.zfs.trim_txg_limit", &t SYSCTL_INT(_vfs_zfs, OID_AUTO, trim_txg_limit, CTLFLAG_RW, &trim_txg_limit, 0, "Delay TRIMs by that many TXGs."); +static int trim_l2arc_limit = 30; +TUNABLE_INT("vfs.zfs.trim_l2arc_limit", &trim_l2arc_limit); +SYSCTL_INT(_vfs_zfs, OID_AUTO, trim_l2arc_limit, CTLFLAG_RWTUN, &trim_l2arc_limit, 0, + "Delay TRIMs by this many seconds for cache devices."); + static void trim_map_vdev_commit_done(spa_t *spa, vdev_t *vd); static int @@ -176,10 +183,12 @@ trim_map_segment_add(trim_map_t *tm, uin avl_index_t where; trim_seg_t tsearch, *ts_before, *ts_after, *ts; boolean_t merge_before, merge_after; + hrtime_t time; ASSERT(MUTEX_HELD(&tm->tm_lock)); VERIFY(start < end); + time = gethrtime(); tsearch.ts_start = start; tsearch.ts_end = end; @@ -214,6 +223,7 @@ trim_map_segment_add(trim_map_t *tm, uin ts->ts_start = start; ts->ts_end = end; ts->ts_txg = txg; + ts->ts_time = time; avl_insert(&tm->tm_queued_frees, ts, where); list_insert_tail(&tm->tm_head, ts); } @@ -236,6 +246,7 @@ trim_map_segment_remove(trim_map_t *tm, nts->ts_start = end; nts->ts_end = ts->ts_end; nts->ts_txg = ts->ts_txg; + nts->ts_time = ts->ts_time; ts->ts_end = start; avl_insert_here(&tm->tm_queued_frees, nts, ts, AVL_AFTER); list_insert_after(&tm->tm_head, ts, nts); @@ -359,17 +370,18 @@ trim_map_write_done(zio_t *zio) /* * Return the oldest segment (the one with the lowest txg) or false if * the list is empty or the first element's txg is greater than txg given - * as function argument. + * as function argument, or the first element's time is greater than time + * given as function argument */ static trim_seg_t * -trim_map_first(trim_map_t *tm, uint64_t txg) +trim_map_first(trim_map_t *tm, uint64_t txg, hrtime_t time) { trim_seg_t *ts; ASSERT(MUTEX_HELD(&tm->tm_lock)); ts = list_head(&tm->tm_head); - if (ts != NULL && ts->ts_txg <= txg) + if (ts != NULL && ts->ts_txg <= txg && ts->ts_time <= time) return (ts); return (NULL); } @@ -380,20 +392,28 @@ trim_map_vdev_commit(spa_t *spa, zio_t * trim_map_t *tm = vd->vdev_trimmap; trim_seg_t *ts; uint64_t start, size, txglimit; + hrtime_t timelimit; ASSERT(vd->vdev_ops->vdev_op_leaf); if (tm == NULL) return; - txglimit = MIN(spa_last_synced_txg(spa), spa_freeze_txg(spa)) - - trim_txg_limit; + if (vd->vdev_isl2cache) { + timelimit = gethrtime() - trim_l2arc_limit * NANOSEC; + txglimit = UINT64_MAX; + } else { + timelimit = TIME_MAX; + txglimit = MIN(spa_last_synced_txg(spa), spa_freeze_txg(spa)) - + trim_txg_limit; + } mutex_enter(&tm->tm_lock); /* - * Loop until we send all frees up to the txglimit. + * Loop until we send all frees up to the txglimit + * or time limit if this is a cache device. */ - while ((ts = trim_map_first(tm, txglimit)) != NULL) { + while ((ts = trim_map_first(tm, txglimit, timelimit)) != NULL) { list_remove(&tm->tm_head, ts); avl_remove(&tm->tm_queued_frees, ts); avl_add(&tm->tm_inflight_frees, ts); From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 10:41:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F40ADDC0; Thu, 21 Mar 2013 10:41:30 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E6492B69; Thu, 21 Mar 2013 10:41:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LAfUaD036347; Thu, 21 Mar 2013 10:41:30 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LAfUTh036346; Thu, 21 Mar 2013 10:41:30 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201303211041.r2LAfUTh036346@svn.freebsd.org> From: Steven Hartland Date: Thu, 21 Mar 2013 10:41:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248576 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 10:41:31 -0000 Author: smh Date: Thu Mar 21 10:41:30 2013 New Revision: 248576 URL: http://svnweb.freebsd.org/changeset/base/248576 Log: Names the ZFS TRIM thread Reviewed by: pjd (mentor) Approved by: pjd (mentor) MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Mar 21 10:29:05 2013 (r248575) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Mar 21 10:41:30 2013 (r248576) @@ -496,6 +496,11 @@ trim_thread(void *arg) spa_t *spa = arg; zio_t *zio; +#ifdef _KERNEL + (void) snprintf(curthread->td_name, sizeof(curthread->td_name), + "trim %s", spa_name(spa)); +#endif + for (;;) { mutex_enter(&spa->spa_trim_lock); if (spa->spa_trim_thread == NULL) { From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 10:44:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9B36323D; Thu, 21 Mar 2013 10:44:53 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) by mx1.freebsd.org (Postfix) with ESMTP id 2A35DBF8; Thu, 21 Mar 2013 10:44:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.5/8.14.5) with ESMTP id r2LAip6e071088; Thu, 21 Mar 2013 14:44:51 +0400 (MSK) (envelope-from marck@rinet.ru) Date: Thu, 21 Mar 2013 14:44:51 +0400 (MSK) From: Dmitry Morozovsky To: Steven Hartland Subject: Re: svn commit: r248572 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys In-Reply-To: <201303210934.r2L9YgE0015437@svn.freebsd.org> Message-ID: References: <201303210934.r2L9YgE0015437@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (woozle.rinet.ru [0.0.0.0]); Thu, 21 Mar 2013 14:44:51 +0400 (MSK) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 10:44:53 -0000 On Thu, 21 Mar 2013, Steven Hartland wrote: > Author: smh > Date: Thu Mar 21 09:34:41 2013 > New Revision: 248572 > URL: http://svnweb.freebsd.org/changeset/base/248572 > > Log: > Add TRIM support for L2ARC. > > This adds TRIM support to cache vdevs. When ARC buffers are removed > from the L2ARC in arc_hdr_destroy(), arc_release() or l2arc_evict(), > the size previously occupied by the buffer gets scheduled for TRIMming. > As always, actual TRIMs are only issued to the L2ARC after > txg_trim_limit. > > Reviewed by: pjd (mentor) > Approved by: pjd (mentor) > Obtained from: https://github.com/dechamps/zfs/commit/31aae373994fd112256607edba7de2359da3e9dc > MFC after: 2 weeks Wow! Thank you very much. (I possibly missed -- when did TRIM support for regular ZFS MFCed to stable/9?) -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 11:02:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 886D8A13; Thu, 21 Mar 2013 11:02:09 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6C1EEDA6; Thu, 21 Mar 2013 11:02:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LB29gM042460; Thu, 21 Mar 2013 11:02:09 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LB29hv042459; Thu, 21 Mar 2013 11:02:09 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201303211102.r2LB29hv042459@svn.freebsd.org> From: Steven Hartland Date: Thu, 21 Mar 2013 11:02:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248577 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 11:02:09 -0000 Author: smh Date: Thu Mar 21 11:02:08 2013 New Revision: 248577 URL: http://svnweb.freebsd.org/changeset/base/248577 Log: Optimisation of TRIM processing. Previously TRIM processing was very bursty. This was made worse by the fact that TRIM requests on SSD's are typically much slower than reads or writes. This often resulted in stalls while large numbers of TRIM's where processed. In addition due to the way the TRIM thread was only woken by writes, deletes could stall in the queue for extensive periods of time. This patch adds a number of controls to how often the TRIM thread for each SPA processes its outstanding delete requests. vfs.zfs.trim.timeout: Delay TRIMs by up to this many seconds vfs.zfs.trim.txg_delay: Delay TRIMs by up to this many TXGs (reduced to 32) vfs.zfs.vdev.trim_max_bytes: Maximum pending TRIM bytes for a vdev vfs.zfs.vdev.trim_max_pending: Maximum pending TRIM segments for a vdev vfs.zfs.trim.max_interval: Maximum interval between TRIM queue processing (seconds) Given the most common TRIM implementation is ATA TRIM the current defaults are targeted at that. Reviewed by: pjd (mentor) Approved by: pjd (mentor) MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Mar 21 10:41:30 2013 (r248576) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Mar 21 11:02:08 2013 (r248577) @@ -40,6 +40,18 @@ #define TRIM_ZIO_END(vd, offset, size) (offset + \ P2ROUNDUP(size, 1ULL << vd->vdev_top->vdev_ashift)) +#define TRIM_MAP_SINC(tm, size) \ + atomic_add_64(&(tm)->tm_bytes, (size)) + +#define TRIM_MAP_SDEC(tm, size) \ + atomic_subtract_64(&(tm)->tm_bytes, (size)) + +#define TRIM_MAP_QINC(tm) \ + atomic_inc_64(&(tm)->tm_pending); \ + +#define TRIM_MAP_QDEC(tm) \ + atomic_dec_64(&(tm)->tm_pending); + typedef struct trim_map { list_t tm_head; /* List of segments sorted by txg. */ avl_tree_t tm_queued_frees; /* AVL tree of segments waiting for TRIM. */ @@ -47,6 +59,8 @@ typedef struct trim_map { avl_tree_t tm_inflight_writes; /* AVL tree of in-flight writes. */ list_t tm_pending_writes; /* Writes blocked on in-flight frees. */ kmutex_t tm_lock; + uint64_t tm_pending; /* Count of pending TRIMs. */ + uint64_t tm_bytes; /* Total size in bytes of queued TRIMs. */ } trim_map_t; typedef struct trim_seg { @@ -60,17 +74,41 @@ typedef struct trim_seg { extern boolean_t zfs_notrim; +static u_int trim_txg_delay = 32; +static u_int trim_timeout = 30; +static u_int trim_max_interval = 1; +/* Limit outstanding TRIMs to 2G (max size for a single TRIM request) */ +static uint64_t trim_vdev_max_bytes = 2147483648; +/* Limit outstanding TRIMs to 64 (max ranges for a single TRIM request) */ +static u_int trim_vdev_max_pending = 64; + SYSCTL_DECL(_vfs_zfs); -/* Delay TRIMs by that many TXGs. */ -static int trim_txg_limit = 64; -TUNABLE_INT("vfs.zfs.trim_txg_limit", &trim_txg_limit); -SYSCTL_INT(_vfs_zfs, OID_AUTO, trim_txg_limit, CTLFLAG_RW, &trim_txg_limit, 0, - "Delay TRIMs by that many TXGs."); - -static int trim_l2arc_limit = 30; -TUNABLE_INT("vfs.zfs.trim_l2arc_limit", &trim_l2arc_limit); -SYSCTL_INT(_vfs_zfs, OID_AUTO, trim_l2arc_limit, CTLFLAG_RWTUN, &trim_l2arc_limit, 0, - "Delay TRIMs by this many seconds for cache devices."); +SYSCTL_NODE(_vfs_zfs, OID_AUTO, trim, CTLFLAG_RD, 0, "ZFS TRIM"); + +TUNABLE_INT("vfs.zfs.trim.txg_delay", &trim_txg_delay); +SYSCTL_UINT(_vfs_zfs_trim, OID_AUTO, txg_delay, CTLFLAG_RWTUN, &trim_txg_delay, + 0, "Delay TRIMs by up to this many TXGs"); + +TUNABLE_INT("vfs.zfs.trim.timeout", &trim_timeout); +SYSCTL_UINT(_vfs_zfs_trim, OID_AUTO, timeout, CTLFLAG_RWTUN, &trim_timeout, 0, + "Delay TRIMs by up to this many seconds"); + +TUNABLE_INT("vfs.zfs.trim.max_interval", &trim_max_interval); +SYSCTL_UINT(_vfs_zfs_trim, OID_AUTO, max_interval, CTLFLAG_RWTUN, + &trim_max_interval, 0, + "Maximum interval between TRIM queue processing (seconds)"); + +SYSCTL_DECL(_vfs_zfs_vdev); +TUNABLE_QUAD("vfs.zfs.vdev.trim_max_bytes", &trim_vdev_max_bytes); +SYSCTL_QUAD(_vfs_zfs_vdev, OID_AUTO, trim_max_bytes, CTLFLAG_RWTUN, + &trim_vdev_max_bytes, 0, + "Maximum pending TRIM bytes for a vdev"); + +TUNABLE_INT("vfs.zfs.vdev.trim_max_pending", &trim_vdev_max_pending); +SYSCTL_UINT(_vfs_zfs_vdev, OID_AUTO, trim_max_pending, CTLFLAG_RWTUN, + &trim_vdev_max_pending, 0, + "Maximum pending TRIM segments for a vdev"); + static void trim_map_vdev_commit_done(spa_t *spa, vdev_t *vd); @@ -164,6 +202,8 @@ trim_map_destroy(vdev_t *vd) avl_remove(&tm->tm_queued_frees, ts); list_remove(&tm->tm_head, ts); kmem_free(ts, sizeof (*ts)); + TRIM_MAP_SDEC(tm, ts->ts_end - ts->ts_start); + TRIM_MAP_QDEC(tm); } mutex_exit(&tm->tm_lock); @@ -204,21 +244,31 @@ trim_map_segment_add(trim_map_t *tm, uin ts_before = avl_nearest(&tm->tm_queued_frees, where, AVL_BEFORE); ts_after = avl_nearest(&tm->tm_queued_frees, where, AVL_AFTER); - merge_before = (ts_before != NULL && ts_before->ts_end == start && - ts_before->ts_txg == txg); - merge_after = (ts_after != NULL && ts_after->ts_start == end && - ts_after->ts_txg == txg); + merge_before = (ts_before != NULL && ts_before->ts_end == start); + merge_after = (ts_after != NULL && ts_after->ts_start == end); if (merge_before && merge_after) { + TRIM_MAP_SINC(tm, ts_after->ts_start - ts_before->ts_end); + TRIM_MAP_QDEC(tm); avl_remove(&tm->tm_queued_frees, ts_before); list_remove(&tm->tm_head, ts_before); ts_after->ts_start = ts_before->ts_start; + ts_after->ts_txg = txg; + ts_after->ts_time = time; kmem_free(ts_before, sizeof (*ts_before)); } else if (merge_before) { + TRIM_MAP_SINC(tm, end - ts_before->ts_end); ts_before->ts_end = end; + ts_before->ts_txg = txg; + ts_before->ts_time = time; } else if (merge_after) { + TRIM_MAP_SINC(tm, ts_after->ts_start - start); ts_after->ts_start = start; + ts_after->ts_txg = txg; + ts_after->ts_time = time; } else { + TRIM_MAP_SINC(tm, end - start); + TRIM_MAP_QINC(tm); ts = kmem_alloc(sizeof (*ts), KM_SLEEP); ts->ts_start = start; ts->ts_end = end; @@ -241,6 +291,7 @@ trim_map_segment_remove(trim_map_t *tm, left_over = (ts->ts_start < start); right_over = (ts->ts_end > end); + TRIM_MAP_SDEC(tm, end - start); if (left_over && right_over) { nts = kmem_alloc(sizeof (*nts), KM_SLEEP); nts->ts_start = end; @@ -250,6 +301,7 @@ trim_map_segment_remove(trim_map_t *tm, ts->ts_end = start; avl_insert_here(&tm->tm_queued_frees, nts, ts, AVL_AFTER); list_insert_after(&tm->tm_head, ts, nts); + TRIM_MAP_QINC(tm); } else if (left_over) { ts->ts_end = start; } else if (right_over) { @@ -257,6 +309,7 @@ trim_map_segment_remove(trim_map_t *tm, } else { avl_remove(&tm->tm_queued_frees, ts); list_remove(&tm->tm_head, ts); + TRIM_MAP_QDEC(tm); kmem_free(ts, sizeof (*ts)); } } @@ -368,20 +421,25 @@ trim_map_write_done(zio_t *zio) } /* - * Return the oldest segment (the one with the lowest txg) or false if - * the list is empty or the first element's txg is greater than txg given - * as function argument, or the first element's time is greater than time - * given as function argument + * Return the oldest segment (the one with the lowest txg / time) or NULL if: + * 1. The list is empty + * 2. The first element's txg is greater than txgsafe + * 3. The first element's txg is not greater than the txg argument and the + * the first element's time is not greater than time argument */ static trim_seg_t * -trim_map_first(trim_map_t *tm, uint64_t txg, hrtime_t time) +trim_map_first(trim_map_t *tm, uint64_t txg, uint64_t txgsafe, hrtime_t time) { trim_seg_t *ts; ASSERT(MUTEX_HELD(&tm->tm_lock)); + VERIFY(txgsafe >= txg); ts = list_head(&tm->tm_head); - if (ts != NULL && ts->ts_txg <= txg && ts->ts_time <= time) + if (ts != NULL && ts->ts_txg <= txgsafe && + (ts->ts_txg <= txg || ts->ts_time <= time || + tm->tm_bytes > trim_vdev_max_bytes || + tm->tm_pending > trim_vdev_max_pending)) return (ts); return (NULL); } @@ -391,7 +449,7 @@ trim_map_vdev_commit(spa_t *spa, zio_t * { trim_map_t *tm = vd->vdev_trimmap; trim_seg_t *ts; - uint64_t start, size, txglimit; + uint64_t size, txgtarget, txgsafe; hrtime_t timelimit; ASSERT(vd->vdev_ops->vdev_op_leaf); @@ -399,26 +457,29 @@ trim_map_vdev_commit(spa_t *spa, zio_t * if (tm == NULL) return; + timelimit = gethrtime() - trim_timeout * NANOSEC; if (vd->vdev_isl2cache) { - timelimit = gethrtime() - trim_l2arc_limit * NANOSEC; - txglimit = UINT64_MAX; + txgsafe = UINT64_MAX; + txgtarget = UINT64_MAX; } else { - timelimit = TIME_MAX; - txglimit = MIN(spa_last_synced_txg(spa), spa_freeze_txg(spa)) - - trim_txg_limit; + txgsafe = MIN(spa_last_synced_txg(spa), spa_freeze_txg(spa)); + if (txgsafe > trim_txg_delay) + txgtarget = txgsafe - trim_txg_delay; + else + txgtarget = 0; } mutex_enter(&tm->tm_lock); - /* - * Loop until we send all frees up to the txglimit - * or time limit if this is a cache device. - */ - while ((ts = trim_map_first(tm, txglimit, timelimit)) != NULL) { + /* Loop until we have sent all outstanding free's */ + while ((ts = trim_map_first(tm, txgtarget, txgsafe, timelimit)) + != NULL) { list_remove(&tm->tm_head, ts); avl_remove(&tm->tm_queued_frees, ts); avl_add(&tm->tm_inflight_frees, ts); - zio_nowait(zio_trim(zio, spa, vd, ts->ts_start, - ts->ts_end - ts->ts_start)); + size = ts->ts_end - ts->ts_start; + zio_nowait(zio_trim(zio, spa, vd, ts->ts_start, size)); + TRIM_MAP_SDEC(tm, size); + TRIM_MAP_QDEC(tm); } mutex_exit(&tm->tm_lock); } @@ -463,7 +524,7 @@ trim_map_commit(spa_t *spa, zio_t *zio, { int c; - if (vd == NULL || spa_last_synced_txg(spa) <= trim_txg_limit) + if (vd == NULL) return; if (vd->vdev_ops->vdev_op_leaf) { @@ -509,7 +570,9 @@ trim_thread(void *arg) mutex_exit(&spa->spa_trim_lock); thread_exit(); } - cv_wait(&spa->spa_trim_cv, &spa->spa_trim_lock); + + (void) cv_timedwait(&spa->spa_trim_cv, &spa->spa_trim_lock, + hz * trim_max_interval); mutex_exit(&spa->spa_trim_lock); zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 11:16:03 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D5D3CFB2; Thu, 21 Mar 2013 11:16:03 +0000 (UTC) (envelope-from prvs=1792b855f9=killing@multiplay.co.uk) Received: from mail1.multiplay.co.uk (mail1.multiplay.co.uk [85.236.96.23]) by mx1.freebsd.org (Postfix) with ESMTP id 30C1FE61; Thu, 21 Mar 2013 11:16:02 +0000 (UTC) Received: from r2d2 ([82.12.16.150]) by mail1.multiplay.co.uk (mail1.multiplay.co.uk [85.236.96.23]) (MDaemon PRO v10.0.4) with ESMTP id md50002845143.msg; Thu, 21 Mar 2013 11:16:01 +0000 X-Spam-Processed: mail1.multiplay.co.uk, Thu, 21 Mar 2013 11:16:01 +0000 (not processed: message from valid local sender) X-MDDKIM-Result: neutral (mail1.multiplay.co.uk) X-MDDNSBL-Result: mail1.multiplay.co.uk, Thu, 21 Mar 2013 11:16:01 +0000 zen.spamhaus.org returned result of 127.0.0.11 X-MDRemoteIP: 82.12.16.150 X-Return-Path: prvs=1792b855f9=killing@multiplay.co.uk X-Envelope-From: killing@multiplay.co.uk Message-ID: <7730C76F790D4A2FAF0E433695BC3EC9@multiplay.co.uk> From: "Steven Hartland" To: "Dmitry Morozovsky" References: <201303210934.r2L9YgE0015437@svn.freebsd.org> Subject: Re: svn commit: r248572 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys Date: Thu, 21 Mar 2013 11:15:58 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 11:16:03 -0000 ----- Original Message ----- From: "Dmitry Morozovsky" > On Thu, 21 Mar 2013, Steven Hartland wrote: > >> Author: smh >> Date: Thu Mar 21 09:34:41 2013 >> New Revision: 248572 >> URL: http://svnweb.freebsd.org/changeset/base/248572 >> >> Log: >> Add TRIM support for L2ARC. >> >> This adds TRIM support to cache vdevs. When ARC buffers are removed >> from the L2ARC in arc_hdr_destroy(), arc_release() or l2arc_evict(), >> the size previously occupied by the buffer gets scheduled for TRIMming. >> As always, actual TRIMs are only issued to the L2ARC after >> txg_trim_limit. >> >> Reviewed by: pjd (mentor) >> Approved by: pjd (mentor) >> Obtained from: https://github.com/dechamps/zfs/commit/31aae373994fd112256607edba7de2359da3e9dc >> MFC after: 2 weeks > > Wow! > > Thank you very much. > > (I possibly missed -- when did TRIM support for regular ZFS MFCed to stable/9?) We've been doing extensive testing in production of ZFS TRIM and following this latest set of patches I intend to get TRIM MFC'ed to stable-8 & stable-9 baring any objections. Regards Steve ================================================ This e.mail is private and confidential between Multiplay (UK) Ltd. and the person or entity to whom it is addressed. In the event of misdirection, the recipient is prohibited from using, copying, printing or otherwise disseminating it or any information contained in it. In the event of misdirection, illegible or incomplete transmission please telephone +44 845 868 1337 or return the E.mail to postmaster@multiplay.co.uk. From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 11:22:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8CB362C9; Thu, 21 Mar 2013 11:22:13 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7E343EAE; Thu, 21 Mar 2013 11:22:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LBMDQM048800; Thu, 21 Mar 2013 11:22:13 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LBMDbi048799; Thu, 21 Mar 2013 11:22:13 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201303211122.r2LBMDbi048799@svn.freebsd.org> From: Joel Dahl Date: Thu, 21 Mar 2013 11:22:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248578 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 11:22:13 -0000 Author: joel (doc committer) Date: Thu Mar 21 11:22:13 2013 New Revision: 248578 URL: http://svnweb.freebsd.org/changeset/base/248578 Log: Remove EOL whitespace. Modified: head/sbin/ipfw/ipfw.8 Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Thu Mar 21 11:02:08 2013 (r248577) +++ head/sbin/ipfw/ipfw.8 Thu Mar 21 11:22:13 2013 (r248578) @@ -1515,7 +1515,7 @@ Matches IPv4/IPv6 packets whose field value is contained in .Ar spec mask. -Multiple values can be specified via +Multiple values can be specified via the comma separated list. Value can be one of keywords used in .Cm setdscp From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 11:25:21 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D96B949A; Thu, 21 Mar 2013 11:25:21 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CB9F1ED9; Thu, 21 Mar 2013 11:25:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LBPLQo049237; Thu, 21 Mar 2013 11:25:21 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LBPL6h049236; Thu, 21 Mar 2013 11:25:21 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201303211125.r2LBPL6h049236@svn.freebsd.org> From: Steven Hartland Date: Thu, 21 Mar 2013 11:25:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248579 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 11:25:21 -0000 Author: smh Date: Thu Mar 21 11:25:21 2013 New Revision: 248579 URL: http://svnweb.freebsd.org/changeset/base/248579 Log: Add missing descriptions for ZFS sysctls Reviewed by: pjd (mentor) Approved by: pjd (mentor) MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Thu Mar 21 11:22:13 2013 (r248578) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Thu Mar 21 11:25:21 2013 (r248579) @@ -78,10 +78,11 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_l &zfs_write_limit_max, 0, "Maximum data payload per txg"); TUNABLE_QUAD("vfs.zfs.write_limit_inflated", &zfs_write_limit_inflated); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_limit_inflated, CTLFLAG_RDTUN, - &zfs_write_limit_inflated, 0, ""); + &zfs_write_limit_inflated, 0, "Maximum size of the dynamic write limit"); TUNABLE_QUAD("vfs.zfs.write_limit_override", &zfs_write_limit_override); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_limit_override, CTLFLAG_RDTUN, - &zfs_write_limit_override, 0, ""); + &zfs_write_limit_override, 0, + "Force a txg if dirty buffers exceed this value (bytes)"); int dsl_pool_open_special_dir(dsl_pool_t *dp, const char *name, dsl_dir_t **ddp) From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 11:32:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B40B170E; Thu, 21 Mar 2013 11:32:44 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from ffe8.ukr.net (ffe8.ukr.net [195.214.192.88]) by mx1.freebsd.org (Postfix) with ESMTP id 4825DF2C; Thu, 21 Mar 2013 11:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=ffe; h=Date:Message-Id:From:To:References:In-Reply-To:Subject:Cc:Content-Type:Content-Transfer-Encoding:MIME-Version; bh=9YUZtfTBr8eW694phQ7wFO6+IQQYeU/qiATmOuBKuJQ=; b=YQtyv6OQmUI8hhrUOXrXi31rapE9BdAfo8E5fsZkJx1Q5iz0AaeXnc/9r/lh3LKVhHEyd2lT0s6NizaqpMFEinWOgF7WeQVBvLsRbvFHkm70ITqwECOgkAVx6sm/JSNHtmjszTRzgPZn2OzV+J7Mh4tV95i1W37ywc8OM8FEDAQ=; Received: from mail by ffe8.ukr.net with local ID 1UIdjY-000O2l-Gs ; Thu, 21 Mar 2013 13:32:36 +0200 MIME-Version: 1.0 Subject: Re: svn commit: r248567 - head/sys/fs/nfsclient In-Reply-To: <201303210725.r2L7P8Bt075389@svn.freebsd.org> References: <201303210725.r2L7P8Bt075389@svn.freebsd.org> To: "Konstantin Belousov" From: "fidaj " X-Mailer: freemail.ukr.net 4.0 Message-Id: <85985.1363865556.9610245778278711296@ffe8.ukr.net> Date: Thu, 21 Mar 2013 13:32:36 +0200 Content-Type: text/plain; charset="windows-1251" Content-Transfer-Encoding: binary Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 11:32:44 -0000 that commit breaks kernel built ... /usr/local/libexec/ccache/world/cc -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include /usr/obj/usr/src/sys/GENERIC/opt_global.h -I. -I@ -I@/contrib/altq -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common -g -fno-omit-frame-pointer -I/usr/obj/usr/src/sys/GENERIC -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -std=iso9899:1999 -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -c /usr/src/sys/modules/nfscl/../../fs/nfsclient/nfs_clvfsops.c /usr/local/libexec/ccache/world/cc -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include /usr/obj/usr/src/sys/GENERIC/opt_global.h -I. -I@ -I@/contrib/altq -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common -g -fno-omit-frame-pointer -I/usr/obj/usr/src/sys/GENERIC -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -std=iso9899:1999 -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -c /usr/src/sys/modules/nfscl/../../fs/nfsclient/nfs_clvnops.c ctfconvert -L VERSION -g nfs_diskless.o ctfconvert -L VERSION -g nfs_clkrpc.o ctfconvert -L VERSION -g nfs_clvfsops.o ctfconvert -L VERSION -g nfs_clsubs.o ctfconvert -L VERSION -g nfs_clrpcops.o ctfconvert -L VERSION -g nfs_clnfsiod.o ctfconvert -L VERSION -g nfs_clstate.o ctfconvert -L VERSION -g nfs_clbio.o ctfconvert -L VERSION -g nfs_clvnops.o ctfconvert -L VERSION -g nfs_clcomsubs.o ctfconvert -L VERSION -g nfs_clnode.o cc1: warnings being treated as errors /usr/src/sys/modules/nfscl/../../fs/nfsclient/nfs_clport.c: In function 'nfscl_loadattrcache': /usr/src/sys/modules/nfscl/../../fs/nfsclient/nfs_clport.c:364: warning: 'nsize' may be used uninitialized in this function *** [nfs_clport.o] Error code 1 1 error *** [all] Error code 2 1 error *** [modules-all] Error code 2 2 errors *** [buildkernel] Error code 2 1 error *** [buildkernel] Error code 2 Stop in /usr/src. Author: kib Date: Thu Mar 21 07:25:08 2013 New Revision: 248567 URL: http://svnweb.freebsd.org/changeset/base/248567 Log: Do not call vnode_pager_setsize() while a NFS node mutex is locked. vnode_pager_setsize() might sleep waiting for the page after EOF be unbusied. Call vnode_pager_setsize() both for the regular and directory vnodes. Reported by: mich Reviewed by: rmacklem Discussed with: avg, jhb MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clport.c Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Thu Mar 21 07:04:17 2013 (r248566) +++ head/sys/fs/nfsclient/nfs_clport.c Thu Mar 21 07:25:08 2013 (r248567) @@ -361,6 +361,8 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsnode *np; struct nfsmount *nmp; struct timespec mtime_save; + u_quad_t nsize; + int setnsize; /* * If v_type == VNON it is a new node, so fill in the v_type, @@ -418,6 +420,7 @@ nfscl_loadattrcache(struct vnode **vpp, } else vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0]; np->n_attrstamp = time_second; + setnsize = 0; if (vap->va_size != np->n_size) { if (vap->va_type == VREG) { if (dontshrink && vap->va_size < np->n_size) { @@ -444,10 +447,13 @@ nfscl_loadattrcache(struct vnode **vpp, np->n_size = vap->va_size; np->n_flag |= NSIZECHANGED; } - vnode_pager_setsize(vp, np->n_size); } else { np->n_size = vap->va_size; } + if (vap->va_type == VREG || vap->va_type == VDIR) { + setnsize = 1; + nsize = vap->va_size; + } } /* * The following checks are added to prevent a race between (say) @@ -480,6 +486,8 @@ nfscl_loadattrcache(struct vnode **vpp, KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, 0); #endif NFSUNLOCKNODE(np); + if (setnsize) + vnode_pager_setsize(vp, nsize); return (0); } From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 12:07:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 42E2631A; Thu, 21 Mar 2013 12:07:55 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from fsm1.ukr.net (fsm1.ukr.net [195.214.192.120]) by mx1.freebsd.org (Postfix) with ESMTP id EAFC31C6; Thu, 21 Mar 2013 12:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=JaNUidH7IbFhyUEJMWgbHbf9GO0DZJXeFHg+UAdSk70=; b=ausFApI27JoVOvmPXOW2ZReNu1Oh7KuXjaXJ54sWcr2HjGjQPBInX0F9R1ywU3r0ZH/qAauzUJw+Q+neT41GmZDeGik4ybw4FyATKerlKHa9MXuD9eEh1Qgd90buKqoi1M9WSJH4XqXVoz2DfFTnRXKmfNl8NpMzBAVyOhNxdRY=; Received: from [178.137.138.140] (helo=nonamehost) by fsm1.ukr.net with esmtpsa ID 1UIeHY-000KOB-8V ; Thu, 21 Mar 2013 14:07:45 +0200 Date: Thu, 21 Mar 2013 14:07:43 +0200 From: Ivan Klymenko To: Konstantin Belousov Subject: Re: svn commit: r248569 - in head/sys: kern vm Message-ID: <20130321140743.278dc727@nonamehost> In-Reply-To: <201303210728.r2L7SFYI075868@svn.freebsd.org> References: <201303210728.r2L7SFYI075868@svn.freebsd.org> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.17; amd64-portbld-freebsd10.0) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEWpqak/Pz/i4uIfHx8GBwZwcHAQEBA6o92AAAACHElEQVQ4jWWUTY7bMAyF6QzUPSEoa8PFHEBgqwuM4bVVg7MvZOj+R+ijpMTpjIwgkT7z75EKrdfattpXERG6zqvUOtAr2LCRYfEKcB4l/Q+2cc6XjQH7hv+2YZYreIk5nevZEPvuzUzptizHLzgDMnC5Wpbl7ewJlOEqlQF+DlCjgVLki0WV6FMDMsBxjlJiQulIznwZ+DxHiQyDyIg0wN3Oo6o6ZQ5s5AIfar+W2Wlmz+kCcb8tg6j3voMEwNrBQk69dDBDqw/urpqJH+m+Q6u/4QnoAeYpnUXC/s1iup9rhCd6xMgAqdDyAyFegbKkVAHeLCcOulPLawaoUIDos4M88iLNrVkU7uu5ccTDO6naJzWLum51C6Yb7y4HKKbdArLWir0PBiS8glJRBZHeyHl7J9lENpAC6qT9NlNG4u5hsVYDyJP6mlJJtY3oVju4WSUzHal1sDU17NASoBWSk40J2eBLBJhYrVmzC5gVALGpNIAiQgN6eGstOp9Oa6zFbbLTISYi28BGZDRUJKWeroECkCEkzXjUtbmmaKMfAx2RfbT69/cO+tgHcmx6AfyZOmj3NDIah0F0GB66d4CrdIoplNFFGHSpSheRxbo0W4S8azNItEoMWbw3uXAeJgCrmX5joz7CGXqSg6PcryEhnFr/C1C2ntPxBOYbdwY+8dO3+wZJyFlbMX9s8zNnvp/tLwAv03NB4j3HVpn8Awwm+GrlP6MVAAAAAElFTkSuQmCC Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 12:07:55 -0000 Kernel panic http://pkgupdate.nevosoft.ru/core.txt.0 http://pkgupdate.nevosoft.ru/vmcore.0 http://pkgupdate.nevosoft.ru/kernel http://pkgupdate.nevosoft.ru/kernel.symbols =D0=92 Thu, 21 Mar 2013 07:28:15 +0000 (UTC) Konstantin Belousov =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > Author: kib > Date: Thu Mar 21 07:28:15 2013 > New Revision: 248569 > URL: http://svnweb.freebsd.org/changeset/base/248569 >=20 > Log: > Only size and create the bio_transient_map when unmapped buffers are > enabled. Now, disabling the unmapped buffers should result in the > kernel memory map identical to pre-r248550. > =20 > Sponsored by: The FreeBSD Foundation >=20 > Modified: > head/sys/kern/vfs_bio.c > head/sys/vm/vm_init.c >=20 > Modified: head/sys/kern/vfs_bio.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/kern/vfs_bio.c Thu Mar 21 07:26:33 2013 > (r248568) +++ head/sys/kern/vfs_bio.c Thu Mar 21 07:28:15 > 2013 (r248569) @@ -586,7 +586,7 @@ > kern_vfs_bio_buffer_alloc(caddr_t v, lon > * allows to not trim the buffer KVA for the architectures > * with ample KVA space. > */ > - if (bio_transient_maxcnt =3D=3D 0) { > + if (bio_transient_maxcnt =3D=3D 0 && unmapped_buf_allowed) { > maxbuf_sz =3D maxbcache !=3D 0 ? maxbcache : maxbuf * > BKVASIZE; buf_sz =3D (long)nbuf * BKVASIZE; > if (buf_sz < maxbuf_sz / 10 * 9) { >=20 > Modified: head/sys/vm/vm_init.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/vm/vm_init.c Thu Mar 21 07:26:33 2013 > (r248568) +++ head/sys/vm/vm_init.c Thu Mar 21 07:28:15 > 2013 (r248569) @@ -189,10 +189,12 @@ again: > buffer_map =3D kmem_suballoc(clean_map, &kmi->buffer_sva, > &kmi->buffer_eva, (long)nbuf * BKVASIZE, FALSE); > buffer_map->system_map =3D 1; > - bio_transient_map =3D kmem_suballoc(clean_map, > &kmi->bio_transient_sva, > - &kmi->bio_transient_eva, (long)bio_transient_maxcnt * > MAXPHYS, > - FALSE); > - bio_transient_map->system_map =3D 1; > + if (bio_transient_maxcnt !=3D 0) { > + bio_transient_map =3D kmem_suballoc(clean_map, > + &kmi->bio_transient_sva, &kmi->bio_transient_eva, > + (long)bio_transient_maxcnt * MAXPHYS, FALSE); > + bio_transient_map->system_map =3D 1; > + } > pager_map =3D kmem_suballoc(clean_map, &kmi->pager_sva, > &kmi->pager_eva, (long)nswbuf * MAXPHYS, FALSE); > pager_map->system_map =3D 1; From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 12:42:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4EBDC8C2; Thu, 21 Mar 2013 12:42:26 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3F39F351; Thu, 21 Mar 2013 12:42:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LCgQoM072618; Thu, 21 Mar 2013 12:42:26 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LCgQRk072617; Thu, 21 Mar 2013 12:42:26 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303211242.r2LCgQRk072617@svn.freebsd.org> From: Eitan Adler Date: Thu, 21 Mar 2013 12:42:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248580 - head/games/fortune/datfiles X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 12:42:26 -0000 Author: eadler Date: Thu Mar 21 12:42:25 2013 New Revision: 248580 URL: http://svnweb.freebsd.org/changeset/base/248580 Log: Remove a reference to instant-server which has been removed from the ports tree in r313427. PR: 177012 Submitted by: Kevin Zheng Approved by: bcr (mentor) Modified: head/games/fortune/datfiles/freebsd-tips Modified: head/games/fortune/datfiles/freebsd-tips ============================================================================== --- head/games/fortune/datfiles/freebsd-tips Thu Mar 21 11:25:21 2013 (r248579) +++ head/games/fortune/datfiles/freebsd-tips Thu Mar 21 12:42:25 2013 (r248580) @@ -373,16 +373,6 @@ modes. % You can disable tcsh's terminal beep if you `set nobeep'. % -You can get a good generic server install by using the -instant-server port/package. If you have ports installed, you can -install it by doing - - # cd /usr/ports/misc/instant-server - # make install && make clean - -as root. This will install a collection of packages that is appropriate for -running a "generic" server. -% You can install extra packages for FreeBSD by using the ports system. If you have installed it, you can download, compile, and install software by just typing From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 12:59:24 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E83F62E0; Thu, 21 Mar 2013 12:59:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DA54E690; Thu, 21 Mar 2013 12:59:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LCxOwE076523; Thu, 21 Mar 2013 12:59:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LCxOtq076522; Thu, 21 Mar 2013 12:59:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303211259.r2LCxOtq076522@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Mar 2013 12:59:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248581 - head/sys/fs/nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 12:59:25 -0000 Author: kib Date: Thu Mar 21 12:59:24 2013 New Revision: 248581 URL: http://svnweb.freebsd.org/changeset/base/248581 Log: Initialize the variable to avoid (false) compiler warning about use of an uninitialized local. Reported by: Ivan Klymenko MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clport.c Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Thu Mar 21 12:42:25 2013 (r248580) +++ head/sys/fs/nfsclient/nfs_clport.c Thu Mar 21 12:59:24 2013 (r248581) @@ -421,6 +421,7 @@ nfscl_loadattrcache(struct vnode **vpp, vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0]; np->n_attrstamp = time_second; setnsize = 0; + nsize = 0; if (vap->va_size != np->n_size) { if (vap->va_type == VREG) { if (dontshrink && vap->va_size < np->n_size) { From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 13:02:43 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B76F05DE; Thu, 21 Mar 2013 13:02:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A93D16C6; Thu, 21 Mar 2013 13:02:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LD2hfr078828; Thu, 21 Mar 2013 13:02:43 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LD2hZ4078827; Thu, 21 Mar 2013 13:02:43 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201303211302.r2LD2hZ4078827@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 21 Mar 2013 13:02:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248582 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 13:02:43 -0000 Author: glebius Date: Thu Mar 21 13:02:43 2013 New Revision: 248582 URL: http://svnweb.freebsd.org/changeset/base/248582 Log: Document NGM_NAT_LIBALIAS_INFO. Submitted by: Dmitry Luhtionov Modified: head/share/man/man4/ng_nat.4 Modified: head/share/man/man4/ng_nat.4 ============================================================================== --- head/share/man/man4/ng_nat.4 Thu Mar 21 12:59:24 2013 (r248581) +++ head/share/man/man4/ng_nat.4 Thu Mar 21 13:02:43 2013 (r248582) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 1, 2008 +.Dd March 21, 2013 .Dt NG_NAT 4 .Os .Sh NAME @@ -239,6 +239,31 @@ supplied as argument). See .Xr libalias 3 for details. +.It Dv NGM_NAT_LIBALIAS_INFO Pq Ic libaliasinfo +Return internal statistics of +.Xr libalias 3 +instance as +.Vt "struct ng_nat_libalias_info" . +.Bd -literal +struct ng_nat_libalias_info { + uint32_t icmpLinkCount; + uint32_t udpLinkCount; + uint32_t tcpLinkCount; + uint32_t sctpLinkCount; + uint32_t pptpLinkCount; + uint32_t protoLinkCount; + uint32_t fragmentIdLinkCount; + uint32_t fragmentPtrLinkCount; + uint32_t sockCount; +}; +.Ed +In case of +.Nm +failed to retreive a certain counter +from its +.Xr libalias +instance, the corresponding field is returned as +.Va UINT32_MAX . .El .Pp In all redirection messages From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 13:06:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AB76E974; Thu, 21 Mar 2013 13:06:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9D4F2711; Thu, 21 Mar 2013 13:06:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LD6T5G079563; Thu, 21 Mar 2013 13:06:29 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LD6T2M079561; Thu, 21 Mar 2013 13:06:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303211306.r2LD6T2M079561@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Mar 2013 13:06:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248583 - head/sys/dev/twa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 13:06:29 -0000 Author: kib Date: Thu Mar 21 13:06:28 2013 New Revision: 248583 URL: http://svnweb.freebsd.org/changeset/base/248583 Log: Fix twa(4) after the r246713. The driver copies data around to satisfy some alignment restrictions. Do not set TW_OSLI_REQ_FLAGS_CCB flag for mapped data, pass the csio->data_ptr in the req->data. Do not put the ccb pointer into req->data ever, ccb is stored in req->orig_req already. Submitted by: Shuichi KITAGUCHI PR: kern/177020 Modified: head/sys/dev/twa/tw_osl_cam.c head/sys/dev/twa/tw_osl_freebsd.c Modified: head/sys/dev/twa/tw_osl_cam.c ============================================================================== --- head/sys/dev/twa/tw_osl_cam.c Thu Mar 21 13:02:43 2013 (r248582) +++ head/sys/dev/twa/tw_osl_cam.c Thu Mar 21 13:06:28 2013 (r248583) @@ -273,9 +273,13 @@ tw_osli_execute_scsi(struct tw_osli_req_ xpt_done(ccb); return(1); } - req->data = ccb; - req->length = csio->dxfer_len; - req->flags |= TW_OSLI_REQ_FLAGS_CCB; + if ((ccb_h->flags & CAM_DATA_MASK) == CAM_DATA_VADDR) { + if ((req->length = csio->dxfer_len) != 0) { + req->data = csio->data_ptr; + scsi_req->sgl_entries = 1; + } + } else + req->flags |= TW_OSLI_REQ_FLAGS_CCB; req->deadline = tw_osl_get_local_time() + (ccb_h->timeout / 1000); /* Modified: head/sys/dev/twa/tw_osl_freebsd.c ============================================================================== --- head/sys/dev/twa/tw_osl_freebsd.c Thu Mar 21 13:02:43 2013 (r248582) +++ head/sys/dev/twa/tw_osl_freebsd.c Thu Mar 21 13:06:28 2013 (r248583) @@ -1475,7 +1475,7 @@ tw_osli_map_request(struct tw_osli_req_c mtx_unlock_spin(sc->io_lock); } else if (req->flags & TW_OSLI_REQ_FLAGS_CCB) { error = bus_dmamap_load_ccb(sc->dma_tag, req->dma_map, - req->data, twa_map_load_data_callback, req, + req->orig_req, twa_map_load_data_callback, req, BUS_DMA_WAITOK); } else { /* From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 13:08:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8D57FCA5; Thu, 21 Mar 2013 13:08:26 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 322FF73D; Thu, 21 Mar 2013 13:08:25 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r2LD8LYQ066703; Thu, 21 Mar 2013 15:08:21 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.0 kib.kiev.ua r2LD8LYQ066703 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r2LD8LvQ066702; Thu, 21 Mar 2013 15:08:21 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 21 Mar 2013 15:08:21 +0200 From: Konstantin Belousov To: fidaj Subject: Re: svn commit: r248567 - head/sys/fs/nfsclient Message-ID: <20130321130821.GV3794@kib.kiev.ua> References: <201303210725.r2L7P8Bt075389@svn.freebsd.org> <85985.1363865556.9610245778278711296@ffe8.ukr.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nMmxhempUIP5R7tt" Content-Disposition: inline In-Reply-To: <85985.1363865556.9610245778278711296@ffe8.ukr.net> User-Agent: Mutt/1.5.21 (2010-09-15) 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 version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 13:08:26 -0000 --nMmxhempUIP5R7tt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 21, 2013 at 01:32:36PM +0200, fidaj wrote: >=20 >=20 >=20 > that commit breaks kernel built >=20 > ... > /usr/local/libexec/ccache/world/cc -O2 -pipe -fno-strict-aliasing -Werror > -D_KERNEL -DKLD_MODULE -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include > /usr/obj/usr/src/sys/GENERIC/opt_global.h -I. -I@ -I@/contrib/altq > -finline-limit=3D8000 --param inline-unit-growth=3D100 --param > large-function-growth=3D1000 -fno-common -g -fno-omit-frame-pointer > -I/usr/obj/usr/src/sys/GENERIC -mcmodel=3Dkernel -mno-red-zone -mno-mmx > -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding > -fstack-protector -std=3Diso9899:1999 -fstack-protector -Wall > -Wredundant-decls -Wnested-externs -Wstrict-prototypes > -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef > -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs > -fdiagnostics-show-option -c > /usr/src/sys/modules/nfscl/../../fs/nfsclient/nfs_clvfsops.c > /usr/local/libexec/ccache/world/cc -O2 -pipe -fno-strict-aliasing -Werror > -D_KERNEL -DKLD_MODULE -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include > /usr/obj/usr/src/sys/GENERIC/opt_global.h -I. -I@ -I@/contrib/altq > -finline-limit=3D8000 --param inline-unit-growth=3D100 --param > large-function-growth=3D1000 -fno-common -g -fno-omit-frame-pointer > -I/usr/obj/usr/src/sys/GENERIC -mcmodel=3Dkernel -mno-red-zone -mno-mmx > -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding > -fstack-protector -std=3Diso9899:1999 -fstack-protector -Wall > -Wredundant-decls -Wnested-externs -Wstrict-prototypes > -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef > -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs > -fdiagnostics-show-option -c > /usr/src/sys/modules/nfscl/../../fs/nfsclient/nfs_clvnops.c > ctfconvert -L VERSION -g nfs_diskless.o > ctfconvert -L VERSION -g nfs_clkrpc.o > ctfconvert -L VERSION -g nfs_clvfsops.o > ctfconvert -L VERSION -g nfs_clsubs.o > ctfconvert -L VERSION -g nfs_clrpcops.o > ctfconvert -L VERSION -g nfs_clnfsiod.o > ctfconvert -L VERSION -g nfs_clstate.o > ctfconvert -L VERSION -g nfs_clbio.o > ctfconvert -L VERSION -g nfs_clvnops.o > ctfconvert -L VERSION -g nfs_clcomsubs.o > ctfconvert -L VERSION -g nfs_clnode.o > cc1: warnings being treated as errors > /usr/src/sys/modules/nfscl/../../fs/nfsclient/nfs_clport.c: In function > 'nfscl_loadattrcache': > /usr/src/sys/modules/nfscl/../../fs/nfsclient/nfs_clport.c:364: warning: > 'nsize' may be used uninitialized in this function > *** [nfs_clport.o] Error code 1 > 1 error > *** [all] Error code 2 > 1 error > *** [modules-all] Error code 2 > 2 errors > *** [buildkernel] Error code 2 > 1 error > *** [buildkernel] Error code 2 >=20 > Stop in /usr/src. ccache ? What compiler is it ? Anyway, I committed the supposed fix in the r248581. --nMmxhempUIP5R7tt Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRSwZEAAoJEJDCuSvBvK1BWeQP/2K/NylHwRLUnjaC2V2ceGFA vCRoqHHtowuAQVFt+r15xrboiVdlClBTBq+AdKwC3wZkblfddGOKWC93a4SqTQ2+ HzmWzey5nnqZwJpx3VMudoNqwOY3AQEtBNSbRfEYI+FL3i/58+8y6eqEgQrcaEDx CcUEV701cvMnp8ANu64GBuomVPg8kzU1ulm22ahoJJOEydWAB8AnE8p90UeSzuum /EeSmfMXOJ9gJUAOWpr+bPm3+Yr1VzsQkcxR/OyDtq9dL0jI2NGcEiBLCpYWlPom o9AnaQs20rgcY7++ScFLaM6+BxZAHq3YmLCa4Xh7GVfSiIoE35YN0fc4VRuLUNDw dDjgVUsu1BemqZEufk8kf/y311wBUFY2xy7rcEc477u/HyKWeQOuzJaKfWwgoBEH zjyfkOfMG2ntnZp7e2UF6AJkZdz2BGbZacU5nNKrT1k07msCTxP0msk1G1L/3yTS y7bFfuPf/rLIuhXS+jMym/MKnO7RBEu8fcjVSGUNmsGC/r9OhUAARhifr0kH+dQk J5r6e+p9Ro9bYCFfuz8p7HtRyOVXBNpzabYF70sDHJYpeGgdeE4CnF7Z9qBF60sk Z1sFIVDM3GYfu40EFJgO9WhXlRuPpyXCUhB9thcuDuT5jU62F8VH6dqkD8FnNeer MNDNK6Bu1zISL0MpBR9J =z9Uc -----END PGP SIGNATURE----- --nMmxhempUIP5R7tt-- From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 13:45:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B9B47E31 for ; Thu, 21 Mar 2013 13:45:51 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx1.freebsd.org (Postfix) with ESMTP id 7A7539EB for ; Thu, 21 Mar 2013 13:45:51 +0000 (UTC) Received: by mail-vc0-f175.google.com with SMTP id hf12so2271509vcb.20 for ; Thu, 21 Mar 2013 06:45:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=3tCPohIJ8/FZSm2OIQB0KtzUHpbZytwh/qmpb/8gMIQ=; b=tynVFPObQkX84DPLvFdpTM6P82e+NKaOkOykTwjPZsSXP9gZaGJyxTcGbsjPUccKzH mKOg4MFvHTzj/QiYFj43W1QNu+kHVSX/R5QOOMr+rkOWmxBBX/3QCVLHCb25xzpsv6TL JfRRj8vb9PBc3NrUaeYb9i58Yj8WmFwqX62DU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=3tCPohIJ8/FZSm2OIQB0KtzUHpbZytwh/qmpb/8gMIQ=; b=BfzHzdXqS2+NPt4Xo3UHc+mc5xBKmzdGlmRlMOfV/NEYxKVf/I2cn/rFLVuy1lhsx3 ODleTafSFtLVVmidTsvlSd52ADfZXEGre0NjiGQhjCPKySvJKu2ouKJQM5xQVDSR56J0 n9gu5jjIRAWzE+9kLF9apWZvNKC6120Irf6JsNxYBm5/lZfJN8DYsghhP2dHCrJWioRD sNW8D2bq3d25jjO7u9C68lDC8RJKvL9A8G/3Y+ym/ZTXC94usL95vWlMPxZkK0LDf/cU jLFHpPKjDtWlQKhqrMzVEhXUt173HT0OWxE8Wphvt/dCZ+XguiwOI33FOfKsnJft5hW+ z/sA== MIME-Version: 1.0 X-Received: by 10.52.72.137 with SMTP id d9mr11309367vdv.105.1363873550776; Thu, 21 Mar 2013 06:45:50 -0700 (PDT) Received: by 10.221.11.72 with HTTP; Thu, 21 Mar 2013 06:45:50 -0700 (PDT) In-Reply-To: <20130321130821.GV3794@kib.kiev.ua> References: <201303210725.r2L7P8Bt075389@svn.freebsd.org> <85985.1363865556.9610245778278711296@ffe8.ukr.net> <20130321130821.GV3794@kib.kiev.ua> Date: Thu, 21 Mar 2013 06:45:50 -0700 Message-ID: Subject: Re: svn commit: r248567 - head/sys/fs/nfsclient From: Peter Wemm To: Konstantin Belousov Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQlHiYH9aSaZQ26yozu0RUl3jxY146WQ7HLJt08U7aBo0LhBkzt+2Lf0Mw1C7VPzXwcehqqQ Cc: fidaj , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 13:45:51 -0000 On Thu, Mar 21, 2013 at 6:08 AM, Konstantin Belousov wrote: > On Thu, Mar 21, 2013 at 01:32:36PM +0200, fidaj wrote: >> >> >> >> that commit breaks kernel built >> >> ... >> /usr/local/libexec/ccache/world/cc -O2 -pipe -fno-strict-aliasing -Werror >> -D_KERNEL -DKLD_MODULE -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include >> /usr/obj/usr/src/sys/GENERIC/opt_global.h -I. -I@ -I@/contrib/altq >> -finline-limit=8000 --param inline-unit-growth=100 --param >> large-function-growth=1000 -fno-common -g -fno-omit-frame-pointer >> -I/usr/obj/usr/src/sys/GENERIC -mcmodel=kernel -mno-red-zone -mno-mmx >> -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding >> -fstack-protector -std=iso9899:1999 -fstack-protector -Wall >> -Wredundant-decls -Wnested-externs -Wstrict-prototypes >> -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef >> -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs >> -fdiagnostics-show-option -c >> /usr/src/sys/modules/nfscl/../../fs/nfsclient/nfs_clvfsops.c >> /usr/local/libexec/ccache/world/cc -O2 -pipe -fno-strict-aliasing -Werror >> -D_KERNEL -DKLD_MODULE -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include >> /usr/obj/usr/src/sys/GENERIC/opt_global.h -I. -I@ -I@/contrib/altq >> -finline-limit=8000 --param inline-unit-growth=100 --param >> large-function-growth=1000 -fno-common -g -fno-omit-frame-pointer >> -I/usr/obj/usr/src/sys/GENERIC -mcmodel=kernel -mno-red-zone -mno-mmx >> -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding >> -fstack-protector -std=iso9899:1999 -fstack-protector -Wall >> -Wredundant-decls -Wnested-externs -Wstrict-prototypes >> -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef >> -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs >> -fdiagnostics-show-option -c >> /usr/src/sys/modules/nfscl/../../fs/nfsclient/nfs_clvnops.c >> ctfconvert -L VERSION -g nfs_diskless.o >> ctfconvert -L VERSION -g nfs_clkrpc.o >> ctfconvert -L VERSION -g nfs_clvfsops.o >> ctfconvert -L VERSION -g nfs_clsubs.o >> ctfconvert -L VERSION -g nfs_clrpcops.o >> ctfconvert -L VERSION -g nfs_clnfsiod.o >> ctfconvert -L VERSION -g nfs_clstate.o >> ctfconvert -L VERSION -g nfs_clbio.o >> ctfconvert -L VERSION -g nfs_clvnops.o >> ctfconvert -L VERSION -g nfs_clcomsubs.o >> ctfconvert -L VERSION -g nfs_clnode.o >> cc1: warnings being treated as errors >> /usr/src/sys/modules/nfscl/../../fs/nfsclient/nfs_clport.c: In function >> 'nfscl_loadattrcache': >> /usr/src/sys/modules/nfscl/../../fs/nfsclient/nfs_clport.c:364: warning: >> 'nsize' may be used uninitialized in this function >> *** [nfs_clport.o] Error code 1 >> 1 error >> *** [all] Error code 2 >> 1 error >> *** [modules-all] Error code 2 >> 2 errors >> *** [buildkernel] Error code 2 >> 1 error >> *** [buildkernel] Error code 2 >> >> Stop in /usr/src. > > ccache ? What compiler is it ? > Anyway, I committed the supposed fix in the r248581. Looks like a gcc-style message. Which version though is unclear. It is probably the usual thing where gcc can't tell if all the code paths are complete for initializing something and a false warning. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV bitcoin:188ZjyYLFJiEheQZw4UtU27e2FMLmuRBUE From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 13:56:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BF5763B7; Thu, 21 Mar 2013 13:56:57 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from fsm2.ukr.net (fsm2.ukr.net [195.214.192.121]) by mx1.freebsd.org (Postfix) with ESMTP id 72C1EA95; Thu, 21 Mar 2013 13:56:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=U0CCbEYWHYd2++UBfsUglaE29PYEb8WoSVawYYDu0zY=; b=TmHDKtrSoucqPkRu25X0K9foD3l3paPk+7TjMxsXM+7eXbXzZVVrIPlB5YNDmoND1o36F2TK6Z3CbZTom2I9GemM1VW3txEY8qTwS3jKjqI0yGgiRFjiYFZyRWZIoUf3zRxr+HsmF/OFXpLEbPjmnIDNlLat16e38HTHJ2+BQrM=; Received: from [178.137.138.140] (helo=nonamehost) by fsm2.ukr.net with esmtpsa ID 1UIfzC-0003Tz-5g ; Thu, 21 Mar 2013 15:56:54 +0200 Date: Thu, 21 Mar 2013 15:56:53 +0200 From: Ivan Klymenko To: Konstantin Belousov Subject: Re: svn commit: r248567 - head/sys/fs/nfsclient Message-ID: <20130321155653.7ee5b195@nonamehost> In-Reply-To: <20130321130821.GV3794@kib.kiev.ua> References: <201303210725.r2L7P8Bt075389@svn.freebsd.org> <85985.1363865556.9610245778278711296@ffe8.ukr.net> <20130321130821.GV3794@kib.kiev.ua> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.17; amd64-portbld-freebsd10.0) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEWpqak/Pz/i4uIfHx8GBwZwcHAQEBA6o92AAAACHElEQVQ4jWWUTY7bMAyF6QzUPSEoa8PFHEBgqwuM4bVVg7MvZOj+R+ijpMTpjIwgkT7z75EKrdfattpXERG6zqvUOtAr2LCRYfEKcB4l/Q+2cc6XjQH7hv+2YZYreIk5nevZEPvuzUzptizHLzgDMnC5Wpbl7ewJlOEqlQF+DlCjgVLki0WV6FMDMsBxjlJiQulIznwZ+DxHiQyDyIg0wN3Oo6o6ZQ5s5AIfar+W2Wlmz+kCcb8tg6j3voMEwNrBQk69dDBDqw/urpqJH+m+Q6u/4QnoAeYpnUXC/s1iup9rhCd6xMgAqdDyAyFegbKkVAHeLCcOulPLawaoUIDos4M88iLNrVkU7uu5ccTDO6naJzWLum51C6Yb7y4HKKbdArLWir0PBiS8glJRBZHeyHl7J9lENpAC6qT9NlNG4u5hsVYDyJP6mlJJtY3oVju4WSUzHal1sDU17NASoBWSk40J2eBLBJhYrVmzC5gVALGpNIAiQgN6eGstOp9Oa6zFbbLTISYi28BGZDRUJKWeroECkCEkzXjUtbmmaKMfAx2RfbT69/cO+tgHcmx6AfyZOmj3NDIah0F0GB66d4CrdIoplNFFGHSpSheRxbo0W4S8azNItEoMWbw3uXAeJgCrmX5joz7CGXqSg6PcryEhnFr/C1C2ntPxBOYbdwY+8dO3+wZJyFlbMX9s8zNnvp/tLwAv03NB4j3HVpn8Awwm+GrlP6MVAAAAAElFTkSuQmCC Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 13:56:57 -0000 =D0=92 Thu, 21 Mar 2013 15:08:21 +0200 Konstantin Belousov =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > ccache ? What compiler is it ? it is with ccache + gcc, with a ccache + clang build successful > Anyway, I committed the supposed fix in the r248581. Thank you, it helped. From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 14:01:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EEE0CAFC; Thu, 21 Mar 2013 14:01:32 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) by mx1.freebsd.org (Postfix) with ESMTP id 7DB8FB43; Thu, 21 Mar 2013 14:01:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.5/8.14.5) with ESMTP id r2LE1V2B073921; Thu, 21 Mar 2013 18:01:31 +0400 (MSK) (envelope-from marck@rinet.ru) Date: Thu, 21 Mar 2013 18:01:31 +0400 (MSK) From: Dmitry Morozovsky To: Steven Hartland Subject: Re: svn commit: r248572 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys In-Reply-To: <7730C76F790D4A2FAF0E433695BC3EC9@multiplay.co.uk> Message-ID: References: <201303210934.r2L9YgE0015437@svn.freebsd.org> <7730C76F790D4A2FAF0E433695BC3EC9@multiplay.co.uk> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (woozle.rinet.ru [0.0.0.0]); Thu, 21 Mar 2013 18:01:31 +0400 (MSK) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 14:01:33 -0000 On Thu, 21 Mar 2013, Steven Hartland wrote: > > (I possibly missed -- when did TRIM support for regular ZFS MFCed to > > stable/9?) > > We've been doing extensive testing in production of ZFS TRIM and following > this latest set of patches I intend to get TRIM MFC'ed to stable-8 & stable-9 > baring any objections. Great! Thank you for clarification, waiting eagerly :) -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 14:06:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EB0F3DE3; Thu, 21 Mar 2013 14:06:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DE0E5BFB; Thu, 21 Mar 2013 14:06:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LE6R5f097670; Thu, 21 Mar 2013 14:06:27 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LE6RX8097668; Thu, 21 Mar 2013 14:06:27 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201303211406.r2LE6RX8097668@svn.freebsd.org> From: John Baldwin Date: Thu, 21 Mar 2013 14:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248584 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 14:06:28 -0000 Author: jhb Date: Thu Mar 21 14:06:27 2013 New Revision: 248584 URL: http://svnweb.freebsd.org/changeset/base/248584 Log: Another NFS SIGSTOP related fix: Ignore thread suspend requests due to SIGSTOP if stop signals are currently deferred. This can occur if a process is stopped via SIGSTOP while a thread is running or runnable but before it has set TDF_SBDRY. Tested by: pho Reviewed by: kib MFC after: 1 week Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Thu Mar 21 13:06:28 2013 (r248583) +++ head/sys/kern/kern_thread.c Thu Mar 21 14:06:27 2013 (r248584) @@ -795,6 +795,17 @@ thread_suspend_check(int return_instead) return (ERESTART); /* + * Ignore suspend requests for stop signals if they + * are deferred. + */ + if (P_SHOULDSTOP(p) == P_STOPPED_SIG && + td->td_flags & TDF_SBDRY) { + KASSERT(return_instead, + ("TDF_SBDRY set for unsafe thread_suspend_check")); + return (0); + } + + /* * If the process is waiting for us to exit, * this thread should just suicide. * Assumes that P_SINGLE_EXIT implies P_STOPPED_SINGLE. From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 15:42:42 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7ECCE11D; Thu, 21 Mar 2013 15:42:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 594ED2CE; Thu, 21 Mar 2013 15:42:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LFgfiF028080; Thu, 21 Mar 2013 15:42:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LFgfcC028079; Thu, 21 Mar 2013 15:42:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201303211542.r2LFgfcC028079@svn.freebsd.org> From: Alexander Motin Date: Thu, 21 Mar 2013 15:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248585 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 15:42:42 -0000 Author: mav Date: Thu Mar 21 15:42:41 2013 New Revision: 248585 URL: http://svnweb.freebsd.org/changeset/base/248585 Log: Minimal timer period of 100us introduced in r244758 is overkill. While original 2us are indeed not enough, 3us are working quite well on my tests. To be more safe set minimal period to 5us and to be even more safe replicate here from HPET mechanism of rereading counter after programming comparator. This change allows to handle 30K of short nanosleep() calls per second on Raspberry Pi instead of just 8K before. Discussed with: gonzo Modified: head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c Thu Mar 21 14:06:27 2013 (r248584) +++ head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c Thu Mar 21 15:42:41 2013 (r248585) @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); #define DEFAULT_TIMER 3 #define DEFAULT_FREQUENCY 1000000 -#define MIN_PERIOD 100LLU +#define MIN_PERIOD 5LLU #define SYSTIMER_CS 0x00 #define SYSTIMER_CLO 0x04 @@ -121,7 +121,7 @@ static int bcm_systimer_start(struct eventtimer *et, sbintime_t first, sbintime_t period) { struct systimer *st = et->et_priv; - uint32_t clo; + uint32_t clo, clo1; uint32_t count; register_t s; @@ -131,12 +131,19 @@ bcm_systimer_start(struct eventtimer *et s = intr_disable(); clo = bcm_systimer_tc_read_4(SYSTIMER_CLO); +restart: clo += count; /* * Clear pending interrupts */ bcm_systimer_tc_write_4(SYSTIMER_CS, (1 << st->index)); bcm_systimer_tc_write_4(SYSTIMER_C0 + st->index*4, clo); + clo1 = bcm_systimer_tc_read_4(SYSTIMER_CLO); + if ((int32_t)(clo1 - clo) >= 0) { + count *= 2; + clo = clo1; + goto restart; + } st->enabled = 1; intr_restore(s); @@ -236,9 +243,9 @@ bcm_systimer_attach(device_t dev) sc->st[DEFAULT_TIMER].et.et_quality = 1000; sc->st[DEFAULT_TIMER].et.et_frequency = sc->sysclk_freq; sc->st[DEFAULT_TIMER].et.et_min_period = - (MIN_PERIOD << 32) / sc->st[DEFAULT_TIMER].et.et_frequency; + (MIN_PERIOD << 32) / sc->st[DEFAULT_TIMER].et.et_frequency + 1; sc->st[DEFAULT_TIMER].et.et_max_period = - (0xfffffffeLLU << 32) / sc->st[DEFAULT_TIMER].et.et_frequency; + (0x7ffffffeLLU << 32) / sc->st[DEFAULT_TIMER].et.et_frequency; sc->st[DEFAULT_TIMER].et.et_start = bcm_systimer_start; sc->st[DEFAULT_TIMER].et.et_stop = bcm_systimer_stop; sc->st[DEFAULT_TIMER].et.et_priv = &sc->st[DEFAULT_TIMER]; From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 16:04:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 368D3CE; Thu, 21 Mar 2013 16:04:35 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 299BB66A; Thu, 21 Mar 2013 16:04:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LG4Zei034735; Thu, 21 Mar 2013 16:04:35 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LG4ZTD034734; Thu, 21 Mar 2013 16:04:35 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201303211604.r2LG4ZTD034734@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 21 Mar 2013 16:04:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248586 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 16:04:35 -0000 Author: glebius Date: Thu Mar 21 16:04:34 2013 New Revision: 248586 URL: http://svnweb.freebsd.org/changeset/base/248586 Log: Document uma_find_refcnt(). Modified: head/share/man/man9/zone.9 Modified: head/share/man/man9/zone.9 ============================================================================== --- head/share/man/man9/zone.9 Thu Mar 21 15:42:41 2013 (r248585) +++ head/share/man/man9/zone.9 Thu Mar 21 16:04:34 2013 (r248586) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 7, 2012 +.Dd March 21, 2013 .Dt ZONE 9 .Os .Sh NAME @@ -34,6 +34,7 @@ .Nm uma_zalloc_arg , .Nm uma_zfree , .Nm uma_zfree_arg , +.Nm uma_find_refcnt , .Nm uma_zdestroy , .Nm uma_zone_set_max, .Nm uma_zone_get_max, @@ -58,6 +59,8 @@ .Fn uma_zfree "uma_zone_t zone" "void *item" .Ft void .Fn uma_zfree_arg "uma_zone_t zone" "void *item" "void *arg" +.Ft "uint32_t *" +.Fn uma_find_refcnt "uma_zone_t zone" "void *item" .Ft void .Fn uma_zdestroy "uma_zone_t zone" .Ft int @@ -175,6 +178,13 @@ and .Dv dtor functions, respectively. .Pp +If zone was created with +.Dv UMA_ZONE_REFCNT +flag, then pointer to reference counter for an item can be retrieved with +help of the +.Fn uma_find_refcnt +function. +.Pp Created zones, which are empty, can be destroyed using From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 16:19:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D9DDE8DE; Thu, 21 Mar 2013 16:19:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B404078A; Thu, 21 Mar 2013 16:19:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LGJksn038818; Thu, 21 Mar 2013 16:19:46 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LGJkmB038816; Thu, 21 Mar 2013 16:19:46 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201303211619.r2LGJkmB038816@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 21 Mar 2013 16:19:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248588 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 16:19:46 -0000 Author: glebius Date: Thu Mar 21 16:19:46 2013 New Revision: 248588 URL: http://svnweb.freebsd.org/changeset/base/248588 Log: Document some flags to the uma_zcreate(). Not all flags are documented, only those that at least are used in the kernel, or that definitely work. Modified: head/share/man/man9/zone.9 Modified: head/share/man/man9/zone.9 ============================================================================== --- head/share/man/man9/zone.9 Thu Mar 21 16:15:34 2013 (r248587) +++ head/share/man/man9/zone.9 Thu Mar 21 16:19:46 2013 (r248588) @@ -139,6 +139,60 @@ and .Fn uma_zfree but rather in a batch mode on several objects. .Pp +The +.Fa flags +argument of the +.Fn uma_zcreate +is a subset of the following flags: +.Bl -tag -width "foo" +.It Dv UMA_ZONE_NOFREE +Slabs of the zone are never returned back to VM. +.It Dv UMA_ZONE_REFCNT +Each item in the zone would have internal reference counter associated with it. +See +.Fn uma_find_refcnt . +.It Dv UMA_ZONE_NODUMP +Pages belonging to the zone will not be included into mini-dumps. +.It Dv UMA_ZONE_OFFPAGE +By default book-keeping of items within a slab is done in the slab page itself. +This flag explicitly tells subsystem that book-keeping structure should be +allocated separately from special internal zone. +This flag requires either +.Dv UMA_ZONE_VTOSLAB +or +.Dv UMA_ZONE_HASH , +since subsystem requires a mechanism to find a book-keeping structure +to an item beeing freed. +The subsystem may choose to prefer offpage book-keeping for certain zones +implicitly. +.It Dv UMA_ZONE_ZINIT +The zone will have its +.Ft uma_init +method set to internal method that initializes a new allocated slab +to all zeros. +Don't mistake +.Ft uma_init +method with +.Ft uma_ctor . +A zone with +.Dv UMA_ZONE_ZINIT +flag would not return zeroed memory on every +.Fn uma_zalloc . +.It Dv UMA_ZONE_HASH +The zone should use an internal hash table to find slab book-keeping +structure where an allocation being freed belongs to. +.It Dv UMA_ZONE_VTOSLAB +The zone should use special field of +.Vt vm_page_t +to find slab book-keeping structure where an allocation being freed belongs to. +.It Dv UMA_ZONE_MALLOC +The zone is for the +.Xr malloc 9 +subsystem. +.It Dv UMA_ZONE_VM +The zone is for the VM subsystem. +.El +.Pp To allocate an item from a zone, simply call .Fn uma_zalloc with a pointer to that zone From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 16:36:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CEB0544E; Thu, 21 Mar 2013 16:36:29 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id 28E6E9D8; Thu, 21 Mar 2013 16:36:28 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id CF2AE1CB; Thu, 21 Mar 2013 17:25:43 +0100 (CET) Date: Thu, 21 Mar 2013 17:30:44 +0100 From: Pawel Jakub Dawidek To: Konstantin Belousov Subject: Re: svn commit: r248519 - in head/sys/cam: . ata scsi Message-ID: <20130321163044.GD1347@garage.freebsd.pl> References: <201303191501.r2JF1pE9028455@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nYySOmuH/HDX6pKp" Content-Disposition: inline In-Reply-To: <201303191501.r2JF1pE9028455@svn.freebsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 16:36:29 -0000 --nYySOmuH/HDX6pKp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 19, 2013 at 03:01:51PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Tue Mar 19 15:01:50 2013 > New Revision: 248519 > URL: http://svnweb.freebsd.org/changeset/base/248519 >=20 > Log: > Support unmapped i/o for the md(4). > =20 > The vnode-backed md(4) has to map the unmapped bio because VOP_READ() > and VOP_WRITE() interfaces do not allow to pass unmapped requests to > the filesystem. Vnode-backed md(4) uses pbufs instead of relying on > the bio_transient_map, to avoid usual md deadlock. > =20 > Sponsored by: The FreeBSD Foundation > Tested by: pho, scottl This commit message belongs to r248518. > Modified: > head/sys/cam/ata/ata_da.c > head/sys/cam/cam_ccb.h > head/sys/cam/scsi/scsi_all.c > head/sys/cam/scsi/scsi_all.h > head/sys/cam/scsi/scsi_cd.c > head/sys/cam/scsi/scsi_da.c >=20 > Modified: head/sys/cam/ata/ata_da.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/cam/ata/ata_da.c Tue Mar 19 14:53:23 2013 (r248518) > +++ head/sys/cam/ata/ata_da.c Tue Mar 19 15:01:50 2013 (r248519) > @@ -1167,6 +1167,8 @@ adaregister(struct cam_periph *periph, v > ((softc->flags & ADA_FLAG_CAN_CFA) && > !(softc->flags & ADA_FLAG_CAN_48BIT))) > softc->disk->d_flags |=3D DISKFLAG_CANDELETE; > + if ((cpi.hba_misc & PIM_UNMAPPED) !=3D 0) > + softc->disk->d_flags |=3D DISKFLAG_UNMAPPED_BIO; > strlcpy(softc->disk->d_descr, cgd->ident_data.model, > MIN(sizeof(softc->disk->d_descr), sizeof(cgd->ident_data.model))); > strlcpy(softc->disk->d_ident, cgd->ident_data.serial, > @@ -1431,13 +1433,19 @@ adastart(struct cam_periph *periph, unio > return; > } > #endif > + KASSERT((bp->bio_flags & BIO_UNMAPPED) =3D=3D 0 || > + round_page(bp->bio_bcount + bp->bio_ma_offset) / > + PAGE_SIZE =3D=3D bp->bio_ma_n, > + ("Short bio %p", bp)); > cam_fill_ataio(ataio, > ada_retry_count, > adadone, > - bp->bio_cmd =3D=3D BIO_READ ? > - CAM_DIR_IN : CAM_DIR_OUT, > + (bp->bio_cmd =3D=3D BIO_READ ? CAM_DIR_IN : > + CAM_DIR_OUT) | ((bp->bio_flags & BIO_UNMAPPED) > + !=3D 0 ? CAM_DATA_BIO : 0), > tag_code, > - bp->bio_data, > + ((bp->bio_flags & BIO_UNMAPPED) !=3D 0) ? (void *)bp : > + bp->bio_data, > bp->bio_bcount, > ada_default_timeout*1000); > =20 >=20 > Modified: head/sys/cam/cam_ccb.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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/cam/cam_ccb.h Tue Mar 19 14:53:23 2013 (r248518) > +++ head/sys/cam/cam_ccb.h Tue Mar 19 15:01:50 2013 (r248519) > @@ -42,7 +42,6 @@ > #include > #include > =20 > - > /* General allocation length definitions for CCB structures */ > #define IOCDBLEN CAM_MAX_CDBLEN /* Space for CDB bytes/pointer */ > #define VUHBALEN 14 /* Vendor Unique HBA length */ > @@ -572,7 +571,8 @@ typedef enum { > PIM_NOINITIATOR =3D 0x20, /* Initiator role not supported. */ > PIM_NOBUSRESET =3D 0x10, /* User has disabled initial BUS RESET */ > PIM_NO_6_BYTE =3D 0x08, /* Do not send 6-byte commands */ > - PIM_SEQSCAN =3D 0x04 /* Do bus scans sequentially, not in parallel */ > + PIM_SEQSCAN =3D 0x04, /* Do bus scans sequentially, not in parallel */ > + PIM_UNMAPPED =3D 0x02, > } pi_miscflag; > =20 > /* Path Inquiry CCB */ >=20 > Modified: head/sys/cam/scsi/scsi_all.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/cam/scsi/scsi_all.c Tue Mar 19 14:53:23 2013 (r248518) > +++ head/sys/cam/scsi/scsi_all.c Tue Mar 19 15:01:50 2013 (r248519) > @@ -5679,7 +5679,11 @@ scsi_read_write(struct ccb_scsiio *csio, > u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, > u_int32_t timeout) > { > + int read; > u_int8_t cdb_len; > + > + read =3D (readop & SCSI_RW_DIRMASK) =3D=3D SCSI_RW_READ; > + > /* > * Use the smallest possible command to perform the operation > * as some legacy hardware does not support the 10 byte commands. > @@ -5696,7 +5700,7 @@ scsi_read_write(struct ccb_scsiio *csio, > struct scsi_rw_6 *scsi_cmd; > =20 > scsi_cmd =3D (struct scsi_rw_6 *)&csio->cdb_io.cdb_bytes; > - scsi_cmd->opcode =3D readop ? READ_6 : WRITE_6; > + scsi_cmd->opcode =3D read ? READ_6 : WRITE_6; > scsi_ulto3b(lba, scsi_cmd->addr); > scsi_cmd->length =3D block_count & 0xff; > scsi_cmd->control =3D 0; > @@ -5715,7 +5719,7 @@ scsi_read_write(struct ccb_scsiio *csio, > struct scsi_rw_10 *scsi_cmd; > =20 > scsi_cmd =3D (struct scsi_rw_10 *)&csio->cdb_io.cdb_bytes; > - scsi_cmd->opcode =3D readop ? READ_10 : WRITE_10; > + scsi_cmd->opcode =3D read ? READ_10 : WRITE_10; > scsi_cmd->byte2 =3D byte2; > scsi_ulto4b(lba, scsi_cmd->addr); > scsi_cmd->reserved =3D 0; > @@ -5738,7 +5742,7 @@ scsi_read_write(struct ccb_scsiio *csio, > struct scsi_rw_12 *scsi_cmd; > =20 > scsi_cmd =3D (struct scsi_rw_12 *)&csio->cdb_io.cdb_bytes; > - scsi_cmd->opcode =3D readop ? READ_12 : WRITE_12; > + scsi_cmd->opcode =3D read ? READ_12 : WRITE_12; > scsi_cmd->byte2 =3D byte2; > scsi_ulto4b(lba, scsi_cmd->addr); > scsi_cmd->reserved =3D 0; > @@ -5760,7 +5764,7 @@ scsi_read_write(struct ccb_scsiio *csio, > struct scsi_rw_16 *scsi_cmd; > =20 > scsi_cmd =3D (struct scsi_rw_16 *)&csio->cdb_io.cdb_bytes; > - scsi_cmd->opcode =3D readop ? READ_16 : WRITE_16; > + scsi_cmd->opcode =3D read ? READ_16 : WRITE_16; > scsi_cmd->byte2 =3D byte2; > scsi_u64to8b(lba, scsi_cmd->addr); > scsi_cmd->reserved =3D 0; > @@ -5771,7 +5775,8 @@ scsi_read_write(struct ccb_scsiio *csio, > cam_fill_csio(csio, > retries, > cbfcnp, > - /*flags*/readop ? CAM_DIR_IN : CAM_DIR_OUT, > + (read ? CAM_DIR_IN : CAM_DIR_OUT) | > + ((readop & SCSI_RW_BIO) !=3D 0 ? CAM_DATA_BIO : 0), > tag_action, > data_ptr, > dxfer_len, >=20 > Modified: head/sys/cam/scsi/scsi_all.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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/cam/scsi/scsi_all.h Tue Mar 19 14:53:23 2013 (r248518) > +++ head/sys/cam/scsi/scsi_all.h Tue Mar 19 15:01:50 2013 (r248519) > @@ -2354,6 +2354,10 @@ void scsi_write_buffer(struct ccb_scsiio > uint8_t *data_ptr, uint32_t param_list_length, > uint8_t sense_len, uint32_t timeout); > =20 > +#define SCSI_RW_READ 0x0001 > +#define SCSI_RW_WRITE 0x0002 > +#define SCSI_RW_DIRMASK 0x0003 > +#define SCSI_RW_BIO 0x1000 > void scsi_read_write(struct ccb_scsiio *csio, u_int32_t retries, > void (*cbfcnp)(struct cam_periph *, union ccb *), > u_int8_t tag_action, int readop, u_int8_t byte2,=20 >=20 > Modified: head/sys/cam/scsi/scsi_cd.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/cam/scsi/scsi_cd.c Tue Mar 19 14:53:23 2013 (r248518) > +++ head/sys/cam/scsi/scsi_cd.c Tue Mar 19 15:01:50 2013 (r248519) > @@ -1575,7 +1575,8 @@ cdstart(struct cam_periph *periph, union > /*retries*/ cd_retry_count, > /* cbfcnp */ cddone, > MSG_SIMPLE_Q_TAG, > - /* read */bp->bio_cmd =3D=3D BIO_READ, > + /* read */bp->bio_cmd =3D=3D BIO_READ ? > + SCSI_RW_READ : SCSI_RW_WRITE, > /* byte2 */ 0, > /* minimum_cmd_size */ 10, > /* lba */ bp->bio_offset / >=20 > Modified: head/sys/cam/scsi/scsi_da.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/cam/scsi/scsi_da.c Tue Mar 19 14:53:23 2013 (r248518) > +++ head/sys/cam/scsi/scsi_da.c Tue Mar 19 15:01:50 2013 (r248519) > @@ -1184,7 +1184,7 @@ dadump(void *arg, void *virtual, vm_offs > /*retries*/0, > dadone, > MSG_ORDERED_Q_TAG, > - /*read*/FALSE, > + /*read*/SCSI_RW_WRITE, > /*byte2*/0, > /*minimum_cmd_size*/ softc->minimum_cmd_size, > offset / secsize, > @@ -1757,6 +1757,8 @@ daregister(struct cam_periph *periph, vo > softc->disk->d_flags =3D 0; > if ((softc->quirks & DA_Q_NO_SYNC_CACHE) =3D=3D 0) > softc->disk->d_flags |=3D DISKFLAG_CANFLUSHCACHE; > + if ((cpi.hba_misc & PIM_UNMAPPED) !=3D 0) > + softc->disk->d_flags |=3D DISKFLAG_UNMAPPED_BIO; > cam_strvis(softc->disk->d_descr, cgd->inq_data.vendor, > sizeof(cgd->inq_data.vendor), sizeof(softc->disk->d_descr)); > strlcat(softc->disk->d_descr, " ", sizeof(softc->disk->d_descr)); > @@ -1985,14 +1987,18 @@ dastart(struct cam_periph *periph, union > /*retries*/da_retry_count, > /*cbfcnp*/dadone, > /*tag_action*/tag_code, > - /*read_op*/bp->bio_cmd > - =3D=3D BIO_READ, > + /*read_op*/(bp->bio_cmd =3D=3D BIO_READ ? > + SCSI_RW_READ : SCSI_RW_WRITE) | > + ((bp->bio_flags & BIO_UNMAPPED) !=3D 0 ? > + SCSI_RW_BIO : 0), > /*byte2*/0, > softc->minimum_cmd_size, > /*lba*/bp->bio_pblkno, > /*block_count*/bp->bio_bcount / > softc->params.secsize, > - /*data_ptr*/ bp->bio_data, > + /*data_ptr*/ (bp->bio_flags & > + BIO_UNMAPPED) !=3D 0 ? (void *)bp : > + bp->bio_data, > /*dxfer_len*/ bp->bio_bcount, > /*sense_len*/SSD_FULL_SIZE, > da_default_timeout * 1000); --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --nYySOmuH/HDX6pKp Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlFLNbQACgkQForvXbEpPzSvPQCfQHf6N8OAYneoGU8uBkU5SfaX 4qwAn2VM0jI5LAbLOdrtP67yGkSyMDrF =NoZM -----END PGP SIGNATURE----- --nYySOmuH/HDX6pKp-- From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 16:43:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5C933919; Thu, 21 Mar 2013 16:43:41 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id 255EEA73; Thu, 21 Mar 2013 16:43:40 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id A36861D9; Thu, 21 Mar 2013 17:40:20 +0100 (CET) Date: Thu, 21 Mar 2013 17:45:22 +0100 From: Pawel Jakub Dawidek To: Konstantin Belousov Subject: Re: svn commit: r248519 - in head/sys/cam: . ata scsi Message-ID: <20130321164521.GE1347@garage.freebsd.pl> References: <201303191501.r2JF1pE9028455@svn.freebsd.org> <20130321163044.GD1347@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nhYGnrYv1PEJ5gA2" Content-Disposition: inline In-Reply-To: <20130321163044.GD1347@garage.freebsd.pl> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 16:43:41 -0000 --nhYGnrYv1PEJ5gA2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 21, 2013 at 05:30:44PM +0100, Pawel Jakub Dawidek wrote: > On Tue, Mar 19, 2013 at 03:01:51PM +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Tue Mar 19 15:01:50 2013 > > New Revision: 248519 > > URL: http://svnweb.freebsd.org/changeset/base/248519 > >=20 > > Log: > > Support unmapped i/o for the md(4). > > =20 > > The vnode-backed md(4) has to map the unmapped bio because VOP_READ() > > and VOP_WRITE() interfaces do not allow to pass unmapped requests to > > the filesystem. Vnode-backed md(4) uses pbufs instead of relying on > > the bio_transient_map, to avoid usual md deadlock. > > =20 > > Sponsored by: The FreeBSD Foundation > > Tested by: pho, scottl >=20 > This commit message belongs to r248518. I saw you did force commit to head/sys/cam/cam_ccb.h with proper message. BTW. Not sure if you know, but it is possible to do forced commits without changing anything. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --nhYGnrYv1PEJ5gA2 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlFLOSEACgkQForvXbEpPzQ4GQCbBx3epUNAeQ1ENsVAOIOFZrsL HEEAnRLSheoyvAQZTa/JTiD66O0lK1UC =qGE7 -----END PGP SIGNATURE----- --nhYGnrYv1PEJ5gA2-- From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 18:14:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2FA697BC; Thu, 21 Mar 2013 18:14:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id B39ED1A1; Thu, 21 Mar 2013 18:14:52 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r2LIEmZh020742; Thu, 21 Mar 2013 20:14:48 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.0 kib.kiev.ua r2LIEmZh020742 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r2LIEmGP020741; Thu, 21 Mar 2013 20:14:48 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 21 Mar 2013 20:14:48 +0200 From: Konstantin Belousov To: Pawel Jakub Dawidek Subject: Re: svn commit: r248519 - in head/sys/cam: . ata scsi Message-ID: <20130321181448.GY3794@kib.kiev.ua> References: <201303191501.r2JF1pE9028455@svn.freebsd.org> <20130321163044.GD1347@garage.freebsd.pl> <20130321164521.GE1347@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fpyvi3H06m9AN3en" Content-Disposition: inline In-Reply-To: <20130321164521.GE1347@garage.freebsd.pl> User-Agent: Mutt/1.5.21 (2010-09-15) 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 version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 18:14:53 -0000 --fpyvi3H06m9AN3en Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 21, 2013 at 05:45:22PM +0100, Pawel Jakub Dawidek wrote: > On Thu, Mar 21, 2013 at 05:30:44PM +0100, Pawel Jakub Dawidek wrote: > > On Tue, Mar 19, 2013 at 03:01:51PM +0000, Konstantin Belousov wrote: > > > Author: kib > > > Date: Tue Mar 19 15:01:50 2013 > > > New Revision: 248519 > > > URL: http://svnweb.freebsd.org/changeset/base/248519 > > >=20 > > > Log: > > > Support unmapped i/o for the md(4). > > > =20 > > > The vnode-backed md(4) has to map the unmapped bio because VOP_READ= () > > > and VOP_WRITE() interfaces do not allow to pass unmapped requests to > > > the filesystem. Vnode-backed md(4) uses pbufs instead of relying on > > > the bio_transient_map, to avoid usual md deadlock. > > > =20 > > > Sponsored by: The FreeBSD Foundation > > > Tested by: pho, scottl > >=20 > > This commit message belongs to r248518. >=20 > I saw you did force commit to head/sys/cam/cam_ccb.h with proper > message. BTW. Not sure if you know, but it is possible to do forced > commits without changing anything. Yes, I know, and this is a hack. Also, the output of svn log=20 for such commit is confusing. --fpyvi3H06m9AN3en Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRS04YAAoJEJDCuSvBvK1B2DEP/jtk7nVxAcU3PZTqItDDG8h8 ukkrdOBQ3WYrkvPpAfLaKkOt5NwKUonhXo8IZhb1XedvpR5uVRLmPBvh15F9MDP/ wfm4t1rre/Vh1izlKVFswBbCD1yiE6j7HT3L9LWGSvBwJqms4Bn09kS6RwqYhRjk F+3Pt4/372O+36UFlij2Yb6+J7QIBrJ7jXBwx6aZDViMZId0GFLt9Ro/DOV01RQH zB/NmLSZXZquq0dRF/69uX5+wtYaXyx9kOJOk49hnK7vL2D2bi/zhUxDKnIAbhUz 4fOYYW6cTxwWsGGLdP1sJhPysC5M7FmDHJuMdkYzNC0O/cgWsRQvPnA3yoSdKFpw 25MJ/Tp9NMC/XBQ5ArX8wMOErgbRQT5Yt4WOAXpTwptmlwT6OQRTnUJk/7KLeICO 51hk6MFrN6eYmfrqVv9FDR4No5gDaRF/X5TXLarbTMbMP2VSCWIVqA63lrMaOwbh PPIfOgMlB+Dqqa3F9+puqHz0pekd67Iumb7i31RTyzlgDh/Li+4E3i06Rx9gub3X lf7xm+HaZLkNfgh5d3ztf6PRj6apJqh7qoGwSSVs/3R5kVAABRyLuMA7L5nk2Ati zmvbXF7RLtl2ai0kzSzSH3Q/nkKhRN11cyB/oNayp3zp+dZ7bS8JSGHUn7aCu+rh 8tscoTnr9gaphUisPbPg =kTxN -----END PGP SIGNATURE----- --fpyvi3H06m9AN3en-- From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 19:58:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5373D5F5; Thu, 21 Mar 2013 19:58:26 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2DFFC806; Thu, 21 Mar 2013 19:58:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LJwQ1x005653; Thu, 21 Mar 2013 19:58:26 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LJwQ3r005652; Thu, 21 Mar 2013 19:58:26 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303211958.r2LJwQ3r005652@svn.freebsd.org> From: Attilio Rao Date: Thu, 21 Mar 2013 19:58:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248591 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 19:58:26 -0000 Author: attilio Date: Thu Mar 21 19:58:25 2013 New Revision: 248591 URL: http://svnweb.freebsd.org/changeset/base/248591 Log: Fix a bug in UMTX_PROFILING: UMTX_PROFILING should really analyze the distribution of locks as they index entries in the umtxq_chains hash-table. However, the current implementation does add/dec the length counters for *every* thread insert/removal, measuring at all really userland contention and not the hash distribution. Fix this by correctly add/dec the length counters in the points where it is really needed. Please note that this bug brought us questioning in the past the quality of the umtx hash table distribution. To date with all the benchmarks I could try I was not able to reproduce any issue about the hash distribution on umtx. Sponsored by: EMC / Isilon storage division Reviewed by: jeff, davide MFC after: 2 weeks Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Thu Mar 21 18:59:02 2013 (r248590) +++ head/sys/kern/kern_umtx.c Thu Mar 21 19:58:25 2013 (r248591) @@ -542,19 +542,19 @@ umtxq_insert_queue(struct umtx_q *uq, in uh = uq->uq_spare_queue; uh->key = uq->uq_key; LIST_INSERT_HEAD(&uc->uc_queue[q], uh, link); +#ifdef UMTX_PROFILING + uc->length++; + if (uc->length > uc->max_length) { + uc->max_length = uc->length; + if (uc->max_length > max_length) + max_length = uc->max_length; + } +#endif } uq->uq_spare_queue = NULL; TAILQ_INSERT_TAIL(&uh->head, uq, uq_link); uh->length++; -#ifdef UMTX_PROFILING - uc->length++; - if (uc->length > uc->max_length) { - uc->max_length = uc->length; - if (uc->max_length > max_length) - max_length = uc->max_length; - } -#endif uq->uq_flags |= UQF_UMTXQ; uq->uq_cur_queue = uh; return; @@ -572,13 +572,13 @@ umtxq_remove_queue(struct umtx_q *uq, in uh = uq->uq_cur_queue; TAILQ_REMOVE(&uh->head, uq, uq_link); uh->length--; -#ifdef UMTX_PROFILING - uc->length--; -#endif uq->uq_flags &= ~UQF_UMTXQ; if (TAILQ_EMPTY(&uh->head)) { KASSERT(uh->length == 0, ("inconsistent umtxq_queue length")); +#ifdef UMTX_PROFILING + uc->length--; +#endif LIST_REMOVE(uh, link); } else { uh = LIST_FIRST(&uc->uc_spare_queue); From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 21:39:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D43C93C6; Thu, 21 Mar 2013 21:39:15 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C6363CC4; Thu, 21 Mar 2013 21:39:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LLdF1O037310; Thu, 21 Mar 2013 21:39:15 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LLdFms037308; Thu, 21 Mar 2013 21:39:15 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201303212139.r2LLdFms037308@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 21 Mar 2013 21:39:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248593 - in head: lib/libc/sys sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 21:39:15 -0000 Author: jilles Date: Thu Mar 21 21:39:15 2013 New Revision: 248593 URL: http://svnweb.freebsd.org/changeset/base/248593 Log: Allow O_CLOEXEC in posix_openpt() flags. PR: kern/162374 Reviewed by: ed Modified: head/lib/libc/sys/posix_openpt.2 head/sys/kern/tty_pts.c Modified: head/lib/libc/sys/posix_openpt.2 ============================================================================== --- head/lib/libc/sys/posix_openpt.2 Thu Mar 21 20:14:51 2013 (r248592) +++ head/lib/libc/sys/posix_openpt.2 Thu Mar 21 21:39:15 2013 (r248593) @@ -37,7 +37,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 20, 2008 +.Dd March 21, 2013 .Dt POSIX_OPENPT 2 .Os .Sh NAME @@ -71,7 +71,7 @@ Values for are constructed by a bitwise-inclusive OR of flags from the following list, defined in .In fcntl.h : -.Bl -tag -width ".Dv O_NOCTTY" +.Bl -tag -width ".Dv O_CLOEXEC" .It Dv O_RDWR Open for reading and writing. .It Dv O_NOCTTY @@ -79,6 +79,8 @@ If set .Fn posix_openpt shall not cause the terminal device to become the controlling terminal for the process. +.It Dv O_CLOEXEC +Set the close-on-exec flag for the new file descriptor. .El .Pp The @@ -116,6 +118,9 @@ The .Fn posix_openpt function conforms to .St -p1003.1-2001 . +The ability to use +.Dv O_CLOEXEC +is an extension to the standard. .Sh HISTORY The .Fn posix_openpt Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Thu Mar 21 20:14:51 2013 (r248592) +++ head/sys/kern/tty_pts.c Thu Mar 21 21:39:15 2013 (r248593) @@ -825,10 +825,10 @@ sys_posix_openpt(struct thread *td, stru * POSIX states it's unspecified when other flags are passed. We * don't allow this. */ - if (uap->flags & ~(O_RDWR|O_NOCTTY)) + if (uap->flags & ~(O_RDWR|O_NOCTTY|O_CLOEXEC)) return (EINVAL); - error = falloc(td, &fp, &fd, 0); + error = falloc(td, &fp, &fd, uap->flags); if (error) return (error); From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 22:36:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 86D01703; Thu, 21 Mar 2013 22:36:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 79043F37; Thu, 21 Mar 2013 22:36:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LMaihr055569; Thu, 21 Mar 2013 22:36:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LMaiQD055568; Thu, 21 Mar 2013 22:36:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303212236.r2LMaiQD055568@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 21 Mar 2013 22:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248596 - head/sys/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 22:36:44 -0000 Author: kib Date: Thu Mar 21 22:36:43 2013 New Revision: 248596 URL: http://svnweb.freebsd.org/changeset/base/248596 Log: Correct the page count when excess length is trimmed from the bio. Reported and tested by: Ivan Klymenko bio_offset + bp->bio_length; if (excess > bp->bio_to->mediasize) { + KASSERT((bp->bio_flags & BIO_UNMAPPED) == 0 || + round_page(bp->bio_ma_offset + + bp->bio_length) / PAGE_SIZE == bp->bio_ma_n, + ("excess bio %p too short", bp)); excess -= bp->bio_to->mediasize; bp->bio_length -= excess; + if ((bp->bio_flags & BIO_UNMAPPED) != 0) { + bp->bio_ma_n = round_page( + bp->bio_ma_offset + + bp->bio_length) / PAGE_SIZE; + } if (excess > 0) CTR3(KTR_GEOM, "g_down truncated bio " "%p provider %s by %d", bp, From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 22:44:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 39977B33; Thu, 21 Mar 2013 22:44:36 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 29F01FA1; Thu, 21 Mar 2013 22:44:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LMianT058230; Thu, 21 Mar 2013 22:44:36 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LMiYHV058219; Thu, 21 Mar 2013 22:44:34 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201303212244.r2LMiYHV058219@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 21 Mar 2013 22:44:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248597 - in head: bin/chflags bin/mv lib/libc/sys sys/compat/freebsd32 sys/fs/tmpfs sys/kern sys/sys tools/regression/pjdfstest X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 22:44:36 -0000 Author: pjd Date: Thu Mar 21 22:44:33 2013 New Revision: 248597 URL: http://svnweb.freebsd.org/changeset/base/248597 Log: - Make 'flags' argument to chflags(2), fchflags(2) and lchflags(2) of type u_long. Before this change it was of type int for syscalls, but prototypes in sys/stat.h and documentation for chflags(2) and fchflags(2) (but not for lchflags(2)) stated that it was u_long. Now some related functions use u_long type for flags (strtofflags(3), fflagstostr(3)). - Make path argument of type 'const char *' for consistency. Discussed on: arch Sponsored by: The FreeBSD Foundation Modified: head/bin/chflags/chflags.c head/bin/mv/mv.c head/lib/libc/sys/chflags.2 head/sys/compat/freebsd32/syscalls.master head/sys/fs/tmpfs/tmpfs.h head/sys/fs/tmpfs/tmpfs_subr.c head/sys/kern/syscalls.master head/sys/kern/vfs_syscalls.c head/sys/sys/stat.h head/tools/regression/pjdfstest/pjdfstest.c Modified: head/bin/chflags/chflags.c ============================================================================== --- head/bin/chflags/chflags.c Thu Mar 21 22:36:43 2013 (r248596) +++ head/bin/chflags/chflags.c Thu Mar 21 22:44:33 2013 (r248597) @@ -117,11 +117,7 @@ main(int argc, char *argv[]) } else fts_options = hflag ? FTS_PHYSICAL : FTS_LOGICAL; - /* XXX: Why don't chflags and lchflags have compatible prototypes? */ - if (hflag) - change_flags = (int (*)(const char *, unsigned long))lchflags; - else - change_flags = chflags; + change_flags = hflag ? lchflags : chflags; flags = *argv; if (*flags >= '0' && *flags <= '7') { Modified: head/bin/mv/mv.c ============================================================================== --- head/bin/mv/mv.c Thu Mar 21 22:36:43 2013 (r248596) +++ head/bin/mv/mv.c Thu Mar 21 22:44:33 2013 (r248597) @@ -337,7 +337,7 @@ err: if (unlink(to)) * on a file that we copied, i.e., that we didn't create.) */ errno = 0; - if (fchflags(to_fd, (u_long)sbp->st_flags)) + if (fchflags(to_fd, sbp->st_flags)) if (errno != EOPNOTSUPP || sbp->st_flags != 0) warn("%s: set flags (was: 0%07o)", to, sbp->st_flags); Modified: head/lib/libc/sys/chflags.2 ============================================================================== --- head/lib/libc/sys/chflags.2 Thu Mar 21 22:36:43 2013 (r248596) +++ head/lib/libc/sys/chflags.2 Thu Mar 21 22:44:33 2013 (r248597) @@ -42,11 +42,11 @@ .In sys/stat.h .In unistd.h .Ft int -.Fn chflags "const char *path" "u_long flags" +.Fn chflags "const char *path" "unsigned long flags" .Ft int -.Fn lchflags "const char *path" "int flags" +.Fn lchflags "const char *path" "unsigned long flags" .Ft int -.Fn fchflags "int fd" "u_long flags" +.Fn fchflags "int fd" "unsigned long flags" .Sh DESCRIPTION The file whose name is given by Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Thu Mar 21 22:36:43 2013 (r248596) +++ head/sys/compat/freebsd32/syscalls.master Thu Mar 21 22:44:33 2013 (r248597) @@ -114,8 +114,8 @@ 32 AUE_GETSOCKNAME NOPROTO { int getsockname(int fdes, caddr_t asa, \ int *alen); } 33 AUE_ACCESS NOPROTO { int access(char *path, int amode); } -34 AUE_CHFLAGS NOPROTO { int chflags(char *path, int flags); } -35 AUE_FCHFLAGS NOPROTO { int fchflags(int fd, int flags); } +34 AUE_CHFLAGS NOPROTO { int chflags(const char *path, u_long flags); } +35 AUE_FCHFLAGS NOPROTO { int fchflags(int fd, u_long flags); } 36 AUE_SYNC NOPROTO { int sync(void); } 37 AUE_KILL NOPROTO { int kill(int pid, int signum); } 38 AUE_STAT COMPAT { int freebsd32_stat(char *path, \ @@ -693,7 +693,8 @@ 389 AUE_NULL UNIMPL __mac_set_file 390 AUE_NULL NOPROTO { int kenv(int what, const char *name, \ char *value, int len); } -391 AUE_LCHFLAGS NOPROTO { int lchflags(const char *path, int flags); } +391 AUE_LCHFLAGS NOPROTO { int lchflags(const char *path, \ + u_long flags); } 392 AUE_NULL NOPROTO { int uuidgen(struct uuid *store, \ int count); } 393 AUE_SENDFILE STD { int freebsd32_sendfile(int fd, int s, \ Modified: head/sys/fs/tmpfs/tmpfs.h ============================================================================== --- head/sys/fs/tmpfs/tmpfs.h Thu Mar 21 22:36:43 2013 (r248596) +++ head/sys/fs/tmpfs/tmpfs.h Thu Mar 21 22:44:33 2013 (r248597) @@ -183,7 +183,7 @@ struct tmpfs_node { uid_t tn_uid; gid_t tn_gid; mode_t tn_mode; - int tn_flags; + u_long tn_flags; nlink_t tn_links; struct timespec tn_atime; struct timespec tn_mtime; @@ -418,7 +418,7 @@ int tmpfs_dir_getdents(struct tmpfs_node int tmpfs_dir_whiteout_add(struct vnode *, struct componentname *); void tmpfs_dir_whiteout_remove(struct vnode *, struct componentname *); int tmpfs_reg_resize(struct vnode *, off_t, boolean_t); -int tmpfs_chflags(struct vnode *, int, struct ucred *, struct thread *); +int tmpfs_chflags(struct vnode *, u_long, struct ucred *, struct thread *); int tmpfs_chmod(struct vnode *, mode_t, struct ucred *, struct thread *); int tmpfs_chown(struct vnode *, uid_t, gid_t, struct ucred *, struct thread *); Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Thu Mar 21 22:36:43 2013 (r248596) +++ head/sys/fs/tmpfs/tmpfs_subr.c Thu Mar 21 22:44:33 2013 (r248597) @@ -1355,7 +1355,8 @@ retry: * The vnode must be locked on entry and remain locked on exit. */ int -tmpfs_chflags(struct vnode *vp, int flags, struct ucred *cred, struct thread *p) +tmpfs_chflags(struct vnode *vp, u_long flags, struct ucred *cred, + struct thread *p) { int error; struct tmpfs_node *node; Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Thu Mar 21 22:36:43 2013 (r248596) +++ head/sys/kern/syscalls.master Thu Mar 21 22:44:33 2013 (r248597) @@ -115,8 +115,8 @@ struct sockaddr * __restrict asa, \ __socklen_t * __restrict alen); } 33 AUE_ACCESS STD { int access(char *path, int amode); } -34 AUE_CHFLAGS STD { int chflags(char *path, int flags); } -35 AUE_FCHFLAGS STD { int fchflags(int fd, int flags); } +34 AUE_CHFLAGS STD { int chflags(const char *path, u_long flags); } +35 AUE_FCHFLAGS STD { int fchflags(int fd, u_long flags); } 36 AUE_SYNC STD { int sync(void); } 37 AUE_KILL STD { int kill(int pid, int signum); } 38 AUE_STAT COMPAT { int stat(char *path, struct ostat *ub); } @@ -696,7 +696,8 @@ struct mac *mac_p); } 390 AUE_NULL STD { int kenv(int what, const char *name, \ char *value, int len); } -391 AUE_LCHFLAGS STD { int lchflags(const char *path, int flags); } +391 AUE_LCHFLAGS STD { int lchflags(const char *path, \ + u_long flags); } 392 AUE_NULL STD { int uuidgen(struct uuid *store, \ int count); } 393 AUE_SENDFILE STD { int sendfile(int fd, int s, off_t offset, \ Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Thu Mar 21 22:36:43 2013 (r248596) +++ head/sys/kern/vfs_syscalls.c Thu Mar 21 22:44:33 2013 (r248597) @@ -101,7 +101,7 @@ SDT_PROBE_ARGTYPE(vfs, , stat, reg, 1, " static int chroot_refuse_vdir_fds(struct filedesc *fdp); static int getutimes(const struct timeval *, enum uio_seg, struct timespec *); -static int setfflags(struct thread *td, struct vnode *, int); +static int setfflags(struct thread *td, struct vnode *, u_long); static int setutimes(struct thread *td, struct vnode *, const struct timespec *, int, int); static int vn_access(struct vnode *vp, int user_flags, struct ucred *cred, @@ -2615,7 +2615,7 @@ static int setfflags(td, vp, flags) struct thread *td; struct vnode *vp; - int flags; + u_long flags; { int error; struct mount *mp; @@ -2657,16 +2657,16 @@ setfflags(td, vp, flags) */ #ifndef _SYS_SYSPROTO_H_ struct chflags_args { - char *path; - int flags; + const char *path; + u_long flags; }; #endif int sys_chflags(td, uap) struct thread *td; register struct chflags_args /* { - char *path; - int flags; + const char *path; + u_long flags; } */ *uap; { int error; @@ -2689,8 +2689,8 @@ int sys_lchflags(td, uap) struct thread *td; register struct lchflags_args /* { - char *path; - int flags; + const char *path; + u_long flags; } */ *uap; { int error; @@ -2713,7 +2713,7 @@ sys_lchflags(td, uap) #ifndef _SYS_SYSPROTO_H_ struct fchflags_args { int fd; - int flags; + u_long flags; }; #endif int @@ -2721,7 +2721,7 @@ sys_fchflags(td, uap) struct thread *td; register struct fchflags_args /* { int fd; - int flags; + u_long flags; } */ *uap; { struct file *fp; Modified: head/sys/sys/stat.h ============================================================================== --- head/sys/sys/stat.h Thu Mar 21 22:36:43 2013 (r248596) +++ head/sys/sys/stat.h Thu Mar 21 22:44:33 2013 (r248597) @@ -306,7 +306,7 @@ int fchmodat(int, const char *, mode_t, #endif int fstat(int, struct stat *); #if __BSD_VISIBLE -int lchflags(const char *, int); +int lchflags(const char *, unsigned long); int lchmod(const char *, mode_t); #endif #if __POSIX_VISIBLE >= 200112 Modified: head/tools/regression/pjdfstest/pjdfstest.c ============================================================================== --- head/tools/regression/pjdfstest/pjdfstest.c Thu Mar 21 22:36:43 2013 (r248596) +++ head/tools/regression/pjdfstest/pjdfstest.c Thu Mar 21 22:44:33 2013 (r248597) @@ -831,7 +831,8 @@ call_syscall(struct syscall_desc *scall, #endif #ifdef HAS_LCHFLAGS case ACTION_LCHFLAGS: - rval = lchflags(STR(0), (int)str2flags(chflags_flags, STR(1))); + rval = lchflags(STR(0), + (unsigned long)str2flags(chflags_flags, STR(1))); break; #endif case ACTION_TRUNCATE: From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 22:47:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AC3A3CC9; Thu, 21 Mar 2013 22:47:04 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8FD61FB9; Thu, 21 Mar 2013 22:47:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LMl4fr058614; Thu, 21 Mar 2013 22:47:04 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LMl4bw058611; Thu, 21 Mar 2013 22:47:04 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201303212247.r2LMl4bw058611@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 21 Mar 2013 22:47:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248598 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 22:47:04 -0000 Author: pjd Date: Thu Mar 21 22:47:03 2013 New Revision: 248598 URL: http://svnweb.freebsd.org/changeset/base/248598 Log: Regenerate after r248597. Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/systrace_args.c head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Thu Mar 21 22:44:33 2013 (r248597) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Thu Mar 21 22:47:03 2013 (r248598) @@ -255,8 +255,8 @@ systrace_args(int sysnum, void *params, /* chflags */ case 34: { struct chflags_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - iarg[1] = p->flags; /* int */ + uarg[0] = (intptr_t) p->path; /* const char * */ + uarg[1] = p->flags; /* u_long */ *n_args = 2; break; } @@ -264,7 +264,7 @@ systrace_args(int sysnum, void *params, case 35: { struct fchflags_args *p = params; iarg[0] = p->fd; /* int */ - iarg[1] = p->flags; /* int */ + uarg[1] = p->flags; /* u_long */ *n_args = 2; break; } @@ -1925,7 +1925,7 @@ systrace_args(int sysnum, void *params, case 391: { struct lchflags_args *p = params; uarg[0] = (intptr_t) p->path; /* const char * */ - iarg[1] = p->flags; /* int */ + uarg[1] = p->flags; /* u_long */ *n_args = 2; break; } @@ -3546,10 +3546,10 @@ systrace_entry_setargdesc(int sysnum, in case 34: switch(ndx) { case 0: - p = "char *"; + p = "const char *"; break; case 1: - p = "int"; + p = "u_long"; break; default: break; @@ -3562,7 +3562,7 @@ systrace_entry_setargdesc(int sysnum, in p = "int"; break; case 1: - p = "int"; + p = "u_long"; break; default: break; @@ -6232,7 +6232,7 @@ systrace_entry_setargdesc(int sysnum, in p = "const char *"; break; case 1: - p = "int"; + p = "u_long"; break; default: break; Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Thu Mar 21 22:44:33 2013 (r248597) +++ head/sys/kern/systrace_args.c Thu Mar 21 22:47:03 2013 (r248598) @@ -252,8 +252,8 @@ systrace_args(int sysnum, void *params, /* chflags */ case 34: { struct chflags_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - iarg[1] = p->flags; /* int */ + uarg[0] = (intptr_t) p->path; /* const char * */ + uarg[1] = p->flags; /* u_long */ *n_args = 2; break; } @@ -261,7 +261,7 @@ systrace_args(int sysnum, void *params, case 35: { struct fchflags_args *p = params; iarg[0] = p->fd; /* int */ - iarg[1] = p->flags; /* int */ + uarg[1] = p->flags; /* u_long */ *n_args = 2; break; } @@ -2134,7 +2134,7 @@ systrace_args(int sysnum, void *params, case 391: { struct lchflags_args *p = params; uarg[0] = (intptr_t) p->path; /* const char * */ - iarg[1] = p->flags; /* int */ + uarg[1] = p->flags; /* u_long */ *n_args = 2; break; } @@ -3741,10 +3741,10 @@ systrace_entry_setargdesc(int sysnum, in case 34: switch(ndx) { case 0: - p = "char *"; + p = "const char *"; break; case 1: - p = "int"; + p = "u_long"; break; default: break; @@ -3757,7 +3757,7 @@ systrace_entry_setargdesc(int sysnum, in p = "int"; break; case 1: - p = "int"; + p = "u_long"; break; default: break; @@ -6799,7 +6799,7 @@ systrace_entry_setargdesc(int sysnum, in p = "const char *"; break; case 1: - p = "int"; + p = "u_long"; break; default: break; Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Thu Mar 21 22:44:33 2013 (r248597) +++ head/sys/sys/sysproto.h Thu Mar 21 22:47:03 2013 (r248598) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 247667 2013-03-02 21:11:30Z pjd + * created from FreeBSD: head/sys/kern/syscalls.master 248597 2013-03-21 22:44:33Z pjd */ #ifndef _SYS_SYSPROTO_H_ @@ -162,12 +162,12 @@ struct access_args { char amode_l_[PADL_(int)]; int amode; char amode_r_[PADR_(int)]; }; struct chflags_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; + char flags_l_[PADL_(u_long)]; u_long flags; char flags_r_[PADR_(u_long)]; }; struct fchflags_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char flags_l_[PADL_(u_long)]; u_long flags; char flags_r_[PADR_(u_long)]; }; struct sync_args { register_t dummy; @@ -1134,7 +1134,7 @@ struct kenv_args { }; struct lchflags_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char flags_l_[PADL_(u_long)]; u_long flags; char flags_r_[PADR_(u_long)]; }; struct uuidgen_args { char store_l_[PADL_(struct uuid *)]; struct uuid * store; char store_r_[PADR_(struct uuid *)]; From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 22:59:03 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6E9A3EFD; Thu, 21 Mar 2013 22:59:03 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5FF552F; Thu, 21 Mar 2013 22:59:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LMx38Y061792; Thu, 21 Mar 2013 22:59:03 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LMx1O8061777; Thu, 21 Mar 2013 22:59:01 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201303212259.r2LMx1O8061777@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 21 Mar 2013 22:59:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248599 - in head: contrib/openbsm/etc lib/libc/sys sys/bsm sys/compat/freebsd32 sys/kern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 22:59:03 -0000 Author: pjd Date: Thu Mar 21 22:59:01 2013 New Revision: 248599 URL: http://svnweb.freebsd.org/changeset/base/248599 Log: Implement chflagsat(2) system call, similar to fchmodat(2), but operates on file flags. Reviewed by: kib, jilles Sponsored by: The FreeBSD Foundation Modified: head/contrib/openbsm/etc/audit_event head/lib/libc/sys/Symbol.map head/sys/bsm/audit_kevents.h head/sys/compat/freebsd32/syscalls.master head/sys/kern/capabilities.conf head/sys/kern/syscalls.master head/sys/kern/vfs_syscalls.c head/sys/sys/capability.h head/sys/sys/stat.h Modified: head/contrib/openbsm/etc/audit_event ============================================================================== --- head/contrib/openbsm/etc/audit_event Thu Mar 21 22:47:03 2013 (r248598) +++ head/contrib/openbsm/etc/audit_event Thu Mar 21 22:59:01 2013 (r248599) @@ -570,6 +570,7 @@ 43206:AUE_CAP_FCNTLS_GET:cap_fcntls_get(2):fm 43207:AUE_BINDAT:bindat(2):nt 43208:AUE_CONNECTAT:connectat(2):nt +43209:AUE_CHFLAGSAT:chflagsat(2):fm # # Solaris userspace events. # Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Thu Mar 21 22:47:03 2013 (r248598) +++ head/lib/libc/sys/Symbol.map Thu Mar 21 22:59:01 2013 (r248599) @@ -386,6 +386,7 @@ FBSD_1.3 { cap_rights_get; cap_rights_limit; cap_sandboxed; + chflagsat; clock_getcpuclockid2; connectat; ffclock_getcounter; Modified: head/sys/bsm/audit_kevents.h ============================================================================== --- head/sys/bsm/audit_kevents.h Thu Mar 21 22:47:03 2013 (r248598) +++ head/sys/bsm/audit_kevents.h Thu Mar 21 22:59:01 2013 (r248599) @@ -610,6 +610,7 @@ #define AUE_CAP_FCNTLS_GET 43206 /* TrustedBSD. */ #define AUE_BINDAT 43207 /* TrustedBSD. */ #define AUE_CONNECTAT 43208 /* TrustedBSD. */ +#define AUE_CHFLAGSAT 43209 /* FreeBSD-specific. */ /* * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Thu Mar 21 22:47:03 2013 (r248598) +++ head/sys/compat/freebsd32/syscalls.master Thu Mar 21 22:59:01 2013 (r248599) @@ -1020,3 +1020,5 @@ int namelen); } 539 AUE_CONNECTAT NOPROTO { int connectat(int fd, int s, caddr_t name, \ int namelen); } +540 AUE_CHFLAGSAT NOPROTO { int chflagsat(int fd, const char *path, \ + u_long flags, int atflag); } Modified: head/sys/kern/capabilities.conf ============================================================================== --- head/sys/kern/capabilities.conf Thu Mar 21 22:47:03 2013 (r248598) +++ head/sys/kern/capabilities.conf Thu Mar 21 22:59:01 2013 (r248599) @@ -445,6 +445,7 @@ olio_listio ## ## Operations relative to directory capabilities. ## +chflagsat faccessat fchmodat fchownat Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Thu Mar 21 22:47:03 2013 (r248598) +++ head/sys/kern/syscalls.master Thu Mar 21 22:59:01 2013 (r248599) @@ -970,5 +970,7 @@ int namelen); } 539 AUE_CONNECTAT STD { int connectat(int fd, int s, caddr_t name, \ int namelen); } +540 AUE_CHFLAGSAT STD { int chflagsat(int fd, const char *path, \ + u_long flags, int atflag); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Thu Mar 21 22:47:03 2013 (r248598) +++ head/sys/kern/vfs_syscalls.c Thu Mar 21 22:59:01 2013 (r248599) @@ -101,6 +101,10 @@ SDT_PROBE_ARGTYPE(vfs, , stat, reg, 1, " static int chroot_refuse_vdir_fds(struct filedesc *fdp); static int getutimes(const struct timeval *, enum uio_seg, struct timespec *); +static int kern_chflags(struct thread *td, const char *path, + enum uio_seg pathseg, u_long flags); +static int kern_chflagsat(struct thread *td, int fd, const char *path, + enum uio_seg pathseg, u_long flags, int atflag); static int setfflags(struct thread *td, struct vnode *, u_long); static int setutimes(struct thread *td, struct vnode *, const struct timespec *, int, int); @@ -2669,17 +2673,38 @@ sys_chflags(td, uap) u_long flags; } */ *uap; { - int error; - struct nameidata nd; - AUDIT_ARG_FFLAGS(uap->flags); - NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->path, td); - if ((error = namei(&nd)) != 0) - return (error); - NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfflags(td, nd.ni_vp, uap->flags); - vrele(nd.ni_vp); - return (error); + return (kern_chflags(td, uap->path, UIO_USERSPACE, uap->flags)); +} + +#ifndef _SYS_SYSPROTO_H_ +struct chflagsat_args { + int fd; + const char *path; + u_long flags; + int atflag; +} +#endif +int +sys_chflagsat(struct thread *td, struct chflagsat_args *uap) +{ + int fd = uap->fd; + char *path = uap->path; + u_long flags = uap->flags; + int atflag = uap->atflag; + + if (atflag & ~AT_SYMLINK_NOFOLLOW) + return (EINVAL); + + return (kern_chflagsat(td, fd, path, UIO_USERSPACE, flags, atflag)); +} + +static int +kern_chflags(struct thread *td, const char *path, enum uio_seg pathseg, + u_long flags) +{ + + return (kern_chflagsat(td, AT_FDCWD, path, pathseg, flags, 0)); } /* @@ -2693,16 +2718,26 @@ sys_lchflags(td, uap) u_long flags; } */ *uap; { - int error; + + return (kern_chflagsat(td, AT_FDCWD, uap->path, UIO_USERSPACE, + uap->flags, AT_SYMLINK_NOFOLLOW)); +} + +static int +kern_chflagsat(struct thread *td, int fd, const char *path, + enum uio_seg pathseg, u_long flags, int atflag) +{ struct nameidata nd; + int error, follow; - AUDIT_ARG_FFLAGS(uap->flags); - NDINIT(&nd, LOOKUP, NOFOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->path, - td); + AUDIT_ARG_FFLAGS(flags); + follow = (atflag & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : FOLLOW; + NDINIT_ATRIGHTS(&nd, LOOKUP, follow | AUDITVNODE1, pathseg, path, fd, + CAP_FCHFLAGS, td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfflags(td, nd.ni_vp, uap->flags); + error = setfflags(td, nd.ni_vp, flags); vrele(nd.ni_vp); return (error); } Modified: head/sys/sys/capability.h ============================================================================== --- head/sys/sys/capability.h Thu Mar 21 22:47:03 2013 (r248598) +++ head/sys/sys/capability.h Thu Mar 21 22:59:01 2013 (r248599) @@ -102,6 +102,7 @@ /* VFS methods. */ #define CAP_FCHDIR 0x0000000000000200ULL #define CAP_FCHFLAGS 0x0000000000000100ULL +#define CAP_CHFLAGSAT CAP_FCHFLAGS #define CAP_FCHMOD 0x0000000000000400ULL #define CAP_FCHMODAT CAP_FCHMOD #define CAP_FCHOWN 0x0000000000000800ULL Modified: head/sys/sys/stat.h ============================================================================== --- head/sys/sys/stat.h Thu Mar 21 22:47:03 2013 (r248598) +++ head/sys/sys/stat.h Thu Mar 21 22:59:01 2013 (r248599) @@ -293,6 +293,7 @@ struct nstat { __BEGIN_DECLS #if __BSD_VISIBLE int chflags(const char *, unsigned long); +int chflagsat(int, const char *, unsigned long, int); #endif int chmod(const char *, mode_t); #if __BSD_VISIBLE From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 23:02:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 90BA7297; Thu, 21 Mar 2013 23:02:22 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 82C3FCD; Thu, 21 Mar 2013 23:02:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LN2M8Y064054; Thu, 21 Mar 2013 23:02:22 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LN2KvN064039; Thu, 21 Mar 2013 23:02:20 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201303212302.r2LN2KvN064039@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 21 Mar 2013 23:02:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248600 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 23:02:22 -0000 Author: pjd Date: Thu Mar 21 23:02:19 2013 New Revision: 248600 URL: http://svnweb.freebsd.org/changeset/base/248600 Log: Regenerate after r248599. Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Thu Mar 21 22:59:01 2013 (r248599) +++ head/sys/compat/freebsd32/freebsd32_proto.h Thu Mar 21 23:02:19 2013 (r248600) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247667 2013-03-02 21:11:30Z pjd + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 248599 2013-03-21 22:59:01Z pjd */ #ifndef _FREEBSD32_SYSPROTO_H_ Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Thu Mar 21 22:59:01 2013 (r248599) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Thu Mar 21 23:02:19 2013 (r248600) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247667 2013-03-02 21:11:30Z pjd + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 248599 2013-03-21 22:59:01Z pjd */ #define FREEBSD32_SYS_syscall 0 @@ -437,4 +437,5 @@ #define FREEBSD32_SYS_cap_fcntls_get 537 #define FREEBSD32_SYS_bindat 538 #define FREEBSD32_SYS_connectat 539 -#define FREEBSD32_SYS_MAXSYSCALL 540 +#define FREEBSD32_SYS_chflagsat 540 +#define FREEBSD32_SYS_MAXSYSCALL 541 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Thu Mar 21 22:59:01 2013 (r248599) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Thu Mar 21 23:02:19 2013 (r248600) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247667 2013-03-02 21:11:30Z pjd + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 248599 2013-03-21 22:59:01Z pjd */ const char *freebsd32_syscallnames[] = { @@ -563,4 +563,5 @@ const char *freebsd32_syscallnames[] = { "cap_fcntls_get", /* 537 = cap_fcntls_get */ "bindat", /* 538 = bindat */ "connectat", /* 539 = connectat */ + "chflagsat", /* 540 = chflagsat */ }; Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Thu Mar 21 22:59:01 2013 (r248599) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Thu Mar 21 23:02:19 2013 (r248600) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 247667 2013-03-02 21:11:30Z pjd + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 248599 2013-03-21 22:59:01Z pjd */ #include "opt_compat.h" @@ -600,4 +600,5 @@ struct sysent freebsd32_sysent[] = { { AS(cap_fcntls_get_args), (sy_call_t *)sys_cap_fcntls_get, AUE_CAP_FCNTLS_GET, NULL, 0, 0, 0, SY_THR_STATIC }, /* 537 = cap_fcntls_get */ { AS(bindat_args), (sy_call_t *)sys_bindat, AUE_BINDAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 538 = bindat */ { AS(connectat_args), (sy_call_t *)sys_connectat, AUE_CONNECTAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 539 = connectat */ + { AS(chflagsat_args), (sy_call_t *)sys_chflagsat, AUE_CHFLAGSAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 540 = chflagsat */ }; Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Thu Mar 21 22:59:01 2013 (r248599) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Thu Mar 21 23:02:19 2013 (r248600) @@ -3150,6 +3150,16 @@ systrace_args(int sysnum, void *params, *n_args = 4; break; } + /* chflagsat */ + case 540: { + struct chflagsat_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = (intptr_t) p->path; /* const char * */ + uarg[2] = p->flags; /* u_long */ + iarg[3] = p->atflag; /* int */ + *n_args = 4; + break; + } default: *n_args = 0; break; @@ -8414,6 +8424,25 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; + /* chflagsat */ + case 540: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "const char *"; + break; + case 2: + p = "u_long"; + break; + case 3: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -10211,6 +10240,11 @@ systrace_return_setargdesc(int sysnum, i if (ndx == 0 || ndx == 1) p = "int"; break; + /* chflagsat */ + case 540: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Thu Mar 21 22:59:01 2013 (r248599) +++ head/sys/kern/init_sysent.c Thu Mar 21 23:02:19 2013 (r248600) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 247667 2013-03-02 21:11:30Z pjd + * created from FreeBSD: head/sys/kern/syscalls.master 248599 2013-03-21 22:59:01Z pjd */ #include "opt_compat.h" @@ -574,4 +574,5 @@ struct sysent sysent[] = { { AS(cap_fcntls_get_args), (sy_call_t *)sys_cap_fcntls_get, AUE_CAP_FCNTLS_GET, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 537 = cap_fcntls_get */ { AS(bindat_args), (sy_call_t *)sys_bindat, AUE_BINDAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 538 = bindat */ { AS(connectat_args), (sy_call_t *)sys_connectat, AUE_CONNECTAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 539 = connectat */ + { AS(chflagsat_args), (sy_call_t *)sys_chflagsat, AUE_CHFLAGSAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 540 = chflagsat */ }; Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Thu Mar 21 22:59:01 2013 (r248599) +++ head/sys/kern/syscalls.c Thu Mar 21 23:02:19 2013 (r248600) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 247667 2013-03-02 21:11:30Z pjd + * created from FreeBSD: head/sys/kern/syscalls.master 248599 2013-03-21 22:59:01Z pjd */ const char *syscallnames[] = { @@ -547,4 +547,5 @@ const char *syscallnames[] = { "cap_fcntls_get", /* 537 = cap_fcntls_get */ "bindat", /* 538 = bindat */ "connectat", /* 539 = connectat */ + "chflagsat", /* 540 = chflagsat */ }; Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Thu Mar 21 22:59:01 2013 (r248599) +++ head/sys/kern/systrace_args.c Thu Mar 21 23:02:19 2013 (r248600) @@ -3348,6 +3348,16 @@ systrace_args(int sysnum, void *params, *n_args = 4; break; } + /* chflagsat */ + case 540: { + struct chflagsat_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = (intptr_t) p->path; /* const char * */ + uarg[2] = p->flags; /* u_long */ + iarg[3] = p->atflag; /* int */ + *n_args = 4; + break; + } default: *n_args = 0; break; @@ -8916,6 +8926,25 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; + /* chflagsat */ + case 540: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "const char *"; + break; + case 2: + p = "u_long"; + break; + case 3: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -10844,6 +10873,11 @@ systrace_return_setargdesc(int sysnum, i if (ndx == 0 || ndx == 1) p = "int"; break; + /* chflagsat */ + case 540: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Thu Mar 21 22:59:01 2013 (r248599) +++ head/sys/sys/syscall.h Thu Mar 21 23:02:19 2013 (r248600) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 247667 2013-03-02 21:11:30Z pjd + * created from FreeBSD: head/sys/kern/syscalls.master 248599 2013-03-21 22:59:01Z pjd */ #define SYS_syscall 0 @@ -459,4 +459,5 @@ #define SYS_cap_fcntls_get 537 #define SYS_bindat 538 #define SYS_connectat 539 -#define SYS_MAXSYSCALL 540 +#define SYS_chflagsat 540 +#define SYS_MAXSYSCALL 541 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Thu Mar 21 22:59:01 2013 (r248599) +++ head/sys/sys/syscall.mk Thu Mar 21 23:02:19 2013 (r248600) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 247667 2013-03-02 21:11:30Z pjd +# created from FreeBSD: head/sys/kern/syscalls.master 248599 2013-03-21 22:59:01Z pjd MIASM = \ syscall.o \ exit.o \ @@ -407,4 +407,5 @@ MIASM = \ cap_fcntls_limit.o \ cap_fcntls_get.o \ bindat.o \ - connectat.o + connectat.o \ + chflagsat.o Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Thu Mar 21 22:59:01 2013 (r248599) +++ head/sys/sys/sysproto.h Thu Mar 21 23:02:19 2013 (r248600) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 248597 2013-03-21 22:44:33Z pjd + * created from FreeBSD: head/sys/kern/syscalls.master 248599 2013-03-21 22:59:01Z pjd */ #ifndef _SYS_SYSPROTO_H_ @@ -1796,6 +1796,12 @@ struct connectat_args { char name_l_[PADL_(caddr_t)]; caddr_t name; char name_r_[PADR_(caddr_t)]; char namelen_l_[PADL_(int)]; int namelen; char namelen_r_[PADR_(int)]; }; +struct chflagsat_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; + char flags_l_[PADL_(u_long)]; u_long flags; char flags_r_[PADR_(u_long)]; + char atflag_l_[PADL_(int)]; int atflag; char atflag_r_[PADR_(int)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_sys_exit(struct thread *, struct sys_exit_args *); int sys_fork(struct thread *, struct fork_args *); @@ -2185,6 +2191,7 @@ int sys_cap_fcntls_limit(struct thread * int sys_cap_fcntls_get(struct thread *, struct cap_fcntls_get_args *); int sys_bindat(struct thread *, struct bindat_args *); int sys_connectat(struct thread *, struct connectat_args *); +int sys_chflagsat(struct thread *, struct chflagsat_args *); #ifdef COMPAT_43 @@ -2888,6 +2895,7 @@ int freebsd7_shmctl(struct thread *, str #define SYS_AUE_cap_fcntls_get AUE_CAP_FCNTLS_GET #define SYS_AUE_bindat AUE_BINDAT #define SYS_AUE_connectat AUE_CONNECTAT +#define SYS_AUE_chflagsat AUE_CHFLAGSAT #undef PAD_ #undef PADL_ From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 23:05:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3257143B; Thu, 21 Mar 2013 23:05:45 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 16614E5; Thu, 21 Mar 2013 23:05:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LN5ic4064673; Thu, 21 Mar 2013 23:05:44 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LN5irO064669; Thu, 21 Mar 2013 23:05:44 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201303212305.r2LN5irO064669@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 21 Mar 2013 23:05:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248601 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 23:05:45 -0000 Author: pjd Date: Thu Mar 21 23:05:44 2013 New Revision: 248601 URL: http://svnweb.freebsd.org/changeset/base/248601 Log: Document chflagsat(2). Obtained from: jilles Modified: head/lib/libc/sys/Makefile.inc head/lib/libc/sys/cap_rights_limit.2 head/lib/libc/sys/chflags.2 Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Thu Mar 21 23:02:19 2013 (r248600) +++ head/lib/libc/sys/Makefile.inc Thu Mar 21 23:05:44 2013 (r248601) @@ -278,7 +278,8 @@ MLINKS+=cap_fcntls_limit.2 cap_fcntls_ge MLINKS+=cap_ioctls_limit.2 cap_ioctls_get.2 MLINKS+=cap_rights_limit.2 cap_rights_get.2 MLINKS+=chdir.2 fchdir.2 -MLINKS+=chflags.2 fchflags.2 \ +MLINKS+=chflags.2 chflagsat.2 \ + chflags.2 fchflags.2 \ chflags.2 lchflags.2 MLINKS+=chmod.2 fchmod.2 \ chmod.2 fchmodat.2 \ Modified: head/lib/libc/sys/cap_rights_limit.2 ============================================================================== --- head/lib/libc/sys/cap_rights_limit.2 Thu Mar 21 23:02:19 2013 (r248600) +++ head/lib/libc/sys/cap_rights_limit.2 Thu Mar 21 23:05:44 2013 (r248601) @@ -159,7 +159,12 @@ Permit .Xr fchdir 2 . .It Dv CAP_FCHFLAGS Permit -.Xr fchflags 2 . +.Xr fchflags 2 +and +.Xr chflagsat 2 . +.It Dv CAP_CHFLAGSAT +An alias to +.Dv CAP_FCHFLAGS . .It Dv CAP_FCHMOD Permit .Xr fchmod 2 Modified: head/lib/libc/sys/chflags.2 ============================================================================== --- head/lib/libc/sys/chflags.2 Thu Mar 21 23:02:19 2013 (r248600) +++ head/lib/libc/sys/chflags.2 Thu Mar 21 23:05:44 2013 (r248601) @@ -28,7 +28,7 @@ .\" @(#)chflags.2 8.3 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd Apr 13, 2012 +.Dd March 22, 2013 .Dt CHFLAGS 2 .Os .Sh NAME @@ -47,6 +47,8 @@ .Fn lchflags "const char *path" "unsigned long flags" .Ft int .Fn fchflags "int fd" "unsigned long flags" +.Ft int +.Fn chflagsat "int fd" "const char *path" "unsigned long flags" "int atflag" .Sh DESCRIPTION The file whose name is given by @@ -66,6 +68,45 @@ in which case will change the flags of the link itself, rather than the file it points to. .Pp +The +.Fn chflagsat +is equivalent to either +.Fn chflags +or +.Fn lchflags +depending on the +.Fa atflag +except in the case where +.Fa path +specifies a relative path. +In this case the file to be changed is determined relative to the directory +associated with the file descriptor +.Fa fd +instead of the current working directory. +The values for the +.Fa atflag +are constructed by a bitwise-inclusive OR of flags from the following list, +defined in +.In fcntl.h : +.Bl -tag -width indent +.It Dv AT_SYMLINK_NOFOLLOW +If +.Fa path +names a symbolic link, then the flags of the symbolic link are changed. +.El +.Pp +If +.Fn chflagsat +is passed the special value +.Dv AT_FDCWD +in the +.Fa fd +parameter, the current working directory is used. +If also +.Fa atflag +is zero, the behavior is identical to a call to +.Fn chflags . +.Pp The flags specified are formed by .Em or Ns 'ing the following values @@ -236,3 +277,7 @@ The .Fn lchflags system call first appeared in .Fx 5.0 . +The +.Fn chflagsat +system call first appeared in +.Fx 10.0 . From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 23:06:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0697F5AE; Thu, 21 Mar 2013 23:06:12 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ED6B7EC; Thu, 21 Mar 2013 23:06:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LN6Bgb064811; Thu, 21 Mar 2013 23:06:11 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LN6BHd064810; Thu, 21 Mar 2013 23:06:11 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201303212306.r2LN6BHd064810@svn.freebsd.org> From: Steven Hartland Date: Thu, 21 Mar 2013 23:06:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248602 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 23:06:12 -0000 Author: smh Date: Thu Mar 21 23:06:11 2013 New Revision: 248602 URL: http://svnweb.freebsd.org/changeset/base/248602 Log: Fix for building libzpool under i386. Reviewed by: pjd (mentor) Approved by: pjd (mentor) MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Mar 21 23:05:44 2013 (r248601) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Mar 21 23:06:11 2013 (r248602) @@ -44,7 +44,7 @@ atomic_add_64(&(tm)->tm_bytes, (size)) #define TRIM_MAP_SDEC(tm, size) \ - atomic_subtract_64(&(tm)->tm_bytes, (size)) + atomic_add_64(&(tm)->tm_bytes, -(size)) #define TRIM_MAP_QINC(tm) \ atomic_inc_64(&(tm)->tm_pending); \ From owner-svn-src-head@FreeBSD.ORG Thu Mar 21 23:07:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7310F738; Thu, 21 Mar 2013 23:07:05 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 659B1FA; Thu, 21 Mar 2013 23:07:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2LN752A065001; Thu, 21 Mar 2013 23:07:05 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2LN74G1064998; Thu, 21 Mar 2013 23:07:04 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201303212307.r2LN74G1064998@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 21 Mar 2013 23:07:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248603 - in head/tools/regression: pjdfstest security/cap_test X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2013 23:07:05 -0000 Author: pjd Date: Thu Mar 21 23:07:04 2013 New Revision: 248603 URL: http://svnweb.freebsd.org/changeset/base/248603 Log: Update regression tests after adding chflagsat(2). Sponsored by: The FreeBSD Foundation Modified: head/tools/regression/pjdfstest/Makefile head/tools/regression/pjdfstest/pjdfstest.c head/tools/regression/security/cap_test/cap_test_capabilities.c Modified: head/tools/regression/pjdfstest/Makefile ============================================================================== --- head/tools/regression/pjdfstest/Makefile Thu Mar 21 23:06:11 2013 (r248602) +++ head/tools/regression/pjdfstest/Makefile Thu Mar 21 23:07:04 2013 (r248603) @@ -6,7 +6,7 @@ ${PROG}: ${PROG}.c @OSTYPE=`uname`; \ CFLAGS=-D__OS_$${OSTYPE}__; \ if [ $$OSTYPE = "FreeBSD" ]; then \ - CFLAGS="$$CFLAGS -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_FCHFLAGS -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL -DHAS_BINDAT -DHAS_CONNECTAT"; \ + CFLAGS="$$CFLAGS -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_FCHFLAGS -DHAS_CHFLAGSAT -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL -DHAS_BINDAT -DHAS_CONNECTAT"; \ elif [ $$OSTYPE = "SunOS" ]; then \ CFLAGS="$$CFLAGS -DHAS_TRUNCATE64 -DHAS_STAT64"; \ CFLAGS="$$CFLAGS -lsocket"; \ Modified: head/tools/regression/pjdfstest/pjdfstest.c ============================================================================== --- head/tools/regression/pjdfstest/pjdfstest.c Thu Mar 21 23:06:11 2013 (r248602) +++ head/tools/regression/pjdfstest/pjdfstest.c Thu Mar 21 23:07:04 2013 (r248603) @@ -105,6 +105,9 @@ enum action { #ifdef HAS_FCHFLAGS ACTION_FCHFLAGS, #endif +#ifdef HAS_CHFLAGSAT + ACTION_CHFLAGSAT, +#endif #ifdef HAS_LCHFLAGS ACTION_LCHFLAGS, #endif @@ -183,6 +186,9 @@ static struct syscall_desc syscalls[] = #ifdef HAS_FCHFLAGS { "fchflags", ACTION_FCHFLAGS, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, #endif +#ifdef HAS_CHFLAGSAT + { "chflagsat", ACTION_CHFLAGSAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_NONE } }, +#endif #ifdef HAS_LCHFLAGS { "lchflags", ACTION_LCHFLAGS, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, #endif @@ -306,6 +312,11 @@ static struct flag linkat_flags[] = { { 0, NULL } }; +static struct flag chflagsat_flags[] = { + { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" }, + { 0, NULL } +}; + static struct flag fchmodat_flags[] = { { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" }, { 0, NULL } @@ -829,6 +840,13 @@ call_syscall(struct syscall_desc *scall, (unsigned long)str2flags(chflags_flags, STR(1))); break; #endif +#ifdef HAS_CHFLAGSAT + case ACTION_CHFLAGSAT: + rval = chflagsat(NUM(0), STR(1), + (unsigned long)str2flags(chflags_flags, STR(2)), + (int)str2flags(chflagsat_flags, STR(3))); + break; +#endif #ifdef HAS_LCHFLAGS case ACTION_LCHFLAGS: rval = lchflags(STR(0), Modified: head/tools/regression/security/cap_test/cap_test_capabilities.c ============================================================================== --- head/tools/regression/security/cap_test/cap_test_capabilities.c Thu Mar 21 23:06:11 2013 (r248602) +++ head/tools/regression/security/cap_test/cap_test_capabilities.c Thu Mar 21 23:07:04 2013 (r248603) @@ -293,14 +293,12 @@ try_file_ops(int filefd, int dirfd, cap_ CHECK_RESULT(fchflags, CAP_FCHFLAGS, ret == 0 || (is_nfs && errno == EOPNOTSUPP)); -#ifdef TODO /* No such syscalls yet. */ - ret = openat(dirfd, "cap_fchflagsat", O_CREAT, 0600); + ret = openat(dirfd, "cap_chflagsat", O_CREAT, 0600); CHECK(ret >= 0); CHECK(close(ret) == 0); - ret = fchflagsat(dfd_cap, "cap_fchflagsat", UF_NODUMP, 0); - CHECK_RESULT(fchflagsat, CAP_FCHFLAGSAT | CAP_LOOKUP, ret == 0); - CHECK(unlinkat(dirfd, "cap_fchflagsat", 0) == 0); -#endif + ret = chflagsat(dfd_cap, "cap_chflagsat", UF_NODUMP, 0); + CHECK_RESULT(chflagsat, CAP_CHFLAGSAT | CAP_LOOKUP, ret == 0); + CHECK(unlinkat(dirfd, "cap_chflagsat", 0) == 0); ret = fchown(fd_cap, -1, -1); CHECK_RESULT(fchown, CAP_FCHOWN, ret == 0); From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 01:40:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 17E2ACA0; Fri, 22 Mar 2013 01:40:18 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0A4F0826; Fri, 22 Mar 2013 01:40:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2M1eHZv012449; Fri, 22 Mar 2013 01:40:17 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2M1eHCt012448; Fri, 22 Mar 2013 01:40:17 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201303220140.r2M1eHCt012448@svn.freebsd.org> From: Kevin Lo Date: Fri, 22 Mar 2013 01:40:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248607 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 01:40:18 -0000 Author: kevlo Date: Fri Mar 22 01:40:17 2013 New Revision: 248607 URL: http://svnweb.freebsd.org/changeset/base/248607 Log: Remove unused global variables. Reviewed by: ae, glebius Modified: head/sys/netinet6/in6_proto.c Modified: head/sys/netinet6/in6_proto.c ============================================================================== --- head/sys/netinet6/in6_proto.c Fri Mar 22 01:35:08 2013 (r248606) +++ head/sys/netinet6/in6_proto.c Fri Mar 22 01:40:17 2013 (r248607) @@ -431,16 +431,6 @@ VNET_DEFINE(int, nd6_onlink_ns_rfc4861) VNET_DEFINE(int, pmtu_expire) = 60*10; VNET_DEFINE(int, pmtu_probe) = 60*2; -/* raw IP6 parameters */ -/* - * Nominal space allocated to a raw ip socket. - */ -#define RIPV6SNDQ 8192 -#define RIPV6RCVQ 8192 - -VNET_DEFINE(u_long, rip6_sendspace) = RIPV6SNDQ; -VNET_DEFINE(u_long, rip6_recvspace) = RIPV6RCVQ; - /* ICMPV6 parameters */ VNET_DEFINE(int, icmp6_rediraccept) = 1;/* accept and process redirects */ VNET_DEFINE(int, icmp6_redirtimeout) = 10 * 60; /* 10 minutes */ @@ -449,11 +439,6 @@ VNET_DEFINE(int, icmp6errppslim) = 100; VNET_DEFINE(int, icmp6_nodeinfo) = (ICMP6_NODEINFO_FQDNOK|ICMP6_NODEINFO_NODEADDROK); -/* UDP on IP6 parameters */ -VNET_DEFINE(int, udp6_sendspace) = 9216;/* really max datagram size */ -VNET_DEFINE(int, udp6_recvspace) = 40 * (1024 + sizeof(struct sockaddr_in6)); - /* 40 1K datagrams */ - /* * sysctl related items. */ From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 01:45:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8A626E50; Fri, 22 Mar 2013 01:45:55 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7C42384B; Fri, 22 Mar 2013 01:45:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2M1jtbO013266; Fri, 22 Mar 2013 01:45:55 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2M1jtAX013265; Fri, 22 Mar 2013 01:45:55 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201303220145.r2M1jtAX013265@svn.freebsd.org> From: Kevin Lo Date: Fri, 22 Mar 2013 01:45:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248608 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 01:45:55 -0000 Author: kevlo Date: Fri Mar 22 01:45:54 2013 New Revision: 248608 URL: http://svnweb.freebsd.org/changeset/base/248608 Log: Clean up some unused leftover code. Pointed out by: ae Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Fri Mar 22 01:40:17 2013 (r248607) +++ head/sys/netinet6/nd6.c Fri Mar 22 01:45:54 2013 (r248608) @@ -120,8 +120,6 @@ VNET_DEFINE(struct nd_prhead, nd_prefix) VNET_DEFINE(int, nd6_recalc_reachtm_interval) = ND6_RECALC_REACHTM_INTERVAL; #define V_nd6_recalc_reachtm_interval VNET(nd6_recalc_reachtm_interval) -static struct sockaddr_in6 all1_sa; - int (*send_sendso_input_hook)(struct mbuf *, struct ifnet *, int, int); static int nd6_is_new_addr_neighbor(struct sockaddr_in6 *, @@ -141,15 +139,9 @@ VNET_DEFINE(struct callout, nd6_timer_ch void nd6_init(void) { - int i; LIST_INIT(&V_nd_prefix); - all1_sa.sin6_family = AF_INET6; - all1_sa.sin6_len = sizeof(struct sockaddr_in6); - for (i = 0; i < sizeof(all1_sa.sin6_addr); i++) - all1_sa.sin6_addr.s6_addr[i] = 0xff; - /* initialization of the default router list */ TAILQ_INIT(&V_nd_defrouter); From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 07:40:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 73833F3D; Fri, 22 Mar 2013 07:40:35 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 66479955; Fri, 22 Mar 2013 07:40:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2M7eZXK024448; Fri, 22 Mar 2013 07:40:35 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2M7eZhd024446; Fri, 22 Mar 2013 07:40:35 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201303220740.r2M7eZhd024446@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 22 Mar 2013 07:40:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248610 - in head/sys: fs/tmpfs kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 07:40:35 -0000 Author: pjd Date: Fri Mar 22 07:40:34 2013 New Revision: 248610 URL: http://svnweb.freebsd.org/changeset/base/248610 Log: - Constify local path variable for chflagsat(). - Use correct format characters (%lx) for u_long. This fixes the build broken in r248599. Modified: head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/kern/vfs_syscalls.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Fri Mar 22 07:30:36 2013 (r248609) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Fri Mar 22 07:40:34 2013 (r248610) @@ -1592,7 +1592,7 @@ tmpfs_print(struct vop_print_args *v) node = VP_TO_TMPFS_NODE(vp); - printf("tag VT_TMPFS, tmpfs_node %p, flags 0x%x, links %d\n", + printf("tag VT_TMPFS, tmpfs_node %p, flags 0x%lx, links %d\n", node, node->tn_flags, node->tn_links); printf("\tmode 0%o, owner %d, group %d, size %jd, status 0x%x\n", node->tn_mode, node->tn_uid, node->tn_gid, Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Fri Mar 22 07:30:36 2013 (r248609) +++ head/sys/kern/vfs_syscalls.c Fri Mar 22 07:40:34 2013 (r248610) @@ -2689,7 +2689,7 @@ int sys_chflagsat(struct thread *td, struct chflagsat_args *uap) { int fd = uap->fd; - char *path = uap->path; + const char *path = uap->path; u_long flags = uap->flags; int atflag = uap->atflag; From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 10:17:43 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9887277F; Fri, 22 Mar 2013 10:17:43 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7BCF38A7; Fri, 22 Mar 2013 10:17:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2MAHhjV080476; Fri, 22 Mar 2013 10:17:43 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2MAHgMh080467; Fri, 22 Mar 2013 10:17:42 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201303221017.r2MAHgMh080467@svn.freebsd.org> From: Martin Matuska Date: Fri, 22 Mar 2013 10:17:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248612 - in head: usr.bin/ar usr.bin/unzip usr.sbin/bsdinstall/distextract X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 10:17:43 -0000 Author: mm Date: Fri Mar 22 10:17:42 2013 New Revision: 248612 URL: http://svnweb.freebsd.org/changeset/base/248612 Log: Replace deprecated (or remove obsolete) libarchive 2.8 functions with libarchive 3.0 counterparts Modified: head/usr.bin/ar/acpyacc.y head/usr.bin/ar/read.c head/usr.bin/ar/write.c head/usr.bin/unzip/unzip.c head/usr.sbin/bsdinstall/distextract/distextract.c Modified: head/usr.bin/ar/acpyacc.y ============================================================================== --- head/usr.bin/ar/acpyacc.y Fri Mar 22 07:57:28 2013 (r248611) +++ head/usr.bin/ar/acpyacc.y Fri Mar 22 10:17:42 2013 (r248612) @@ -249,13 +249,12 @@ arscp_open(char *fname) if ((a = archive_read_new()) == NULL) bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_read_new failed"); - archive_read_support_compression_none(a); archive_read_support_format_ar(a); - AC(archive_read_open_file(a, fname, DEF_BLKSZ)); + AC(archive_read_open_filename(a, fname, DEF_BLKSZ)); if ((r = archive_read_next_header(a, &entry))) bsdar_warnc(bsdar, 0, "%s", archive_error_string(a)); AC(archive_read_close(a)); - AC(archive_read_finish(a)); + AC(archive_read_free(a)); if (r != ARCHIVE_OK) return; arscp_create(fname, fname); @@ -311,7 +310,7 @@ arscp_create(char *in, char *out) archive_write_set_format_ar_svr4(a); AC(archive_write_open_fd(a, ofd)); AC(archive_write_close(a)); - AC(archive_write_finish(a)); + AC(archive_write_free(a)); } /* Override previous target, if any. */ Modified: head/usr.bin/ar/read.c ============================================================================== --- head/usr.bin/ar/read.c Fri Mar 22 07:57:28 2013 (r248611) +++ head/usr.bin/ar/read.c Fri Mar 22 10:17:42 2013 (r248612) @@ -87,9 +87,8 @@ read_archive(struct bsdar *bsdar, char m if ((a = archive_read_new()) == NULL) bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_read_new failed"); - archive_read_support_compression_none(a); archive_read_support_format_ar(a); - AC(archive_read_open_file(a, bsdar->filename, DEF_BLKSZ)); + AC(archive_read_open_filename(a, bsdar->filename, DEF_BLKSZ)); for (;;) { r = archive_read_next_header(a, &entry); @@ -200,5 +199,5 @@ read_archive(struct bsdar *bsdar, char m } } AC(archive_read_close(a)); - AC(archive_read_finish(a)); + AC(archive_read_free(a)); } Modified: head/usr.bin/ar/write.c ============================================================================== --- head/usr.bin/ar/write.c Fri Mar 22 07:57:28 2013 (r248611) +++ head/usr.bin/ar/write.c Fri Mar 22 10:17:42 2013 (r248612) @@ -277,7 +277,6 @@ read_objs(struct bsdar *bsdar, const cha if ((a = archive_read_new()) == NULL) bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_read_new failed"); - archive_read_support_compression_none(a); archive_read_support_format_ar(a); AC(archive_read_open_filename(a, archive, DEF_BLKSZ)); for (;;) { @@ -363,7 +362,7 @@ read_objs(struct bsdar *bsdar, const cha TAILQ_INSERT_TAIL(&bsdar->v_obj, obj, objs); } AC(archive_read_close(a)); - AC(archive_read_finish(a)); + AC(archive_read_free(a)); } /* @@ -628,7 +627,6 @@ write_objs(struct bsdar *bsdar) bsdar_errc(bsdar, EX_SOFTWARE, 0, "archive_write_new failed"); archive_write_set_format_ar_svr4(a); - archive_write_set_compression_none(a); AC(archive_write_open_filename(a, bsdar->filename)); @@ -682,7 +680,7 @@ write_objs(struct bsdar *bsdar) } AC(archive_write_close(a)); - AC(archive_write_finish(a)); + AC(archive_write_free(a)); } /* Modified: head/usr.bin/unzip/unzip.c ============================================================================== --- head/usr.bin/unzip/unzip.c Fri Mar 22 07:57:28 2013 (r248611) +++ head/usr.bin/unzip/unzip.c Fri Mar 22 10:17:42 2013 (r248612) @@ -926,7 +926,7 @@ unzip(const char *fn) } ac(archive_read_close(a)); - (void)archive_read_finish(a); + (void)archive_read_free(a); if (t_opt) { if (error_count > 0) { Modified: head/usr.sbin/bsdinstall/distextract/distextract.c ============================================================================== --- head/usr.sbin/bsdinstall/distextract/distextract.c Fri Mar 22 07:57:28 2013 (r248611) +++ head/usr.sbin/bsdinstall/distextract/distextract.c Fri Mar 22 10:17:42 2013 (r248612) @@ -126,7 +126,7 @@ count_files(const char *file) /* Either we didn't have a manifest, or this archive wasn't there */ archive = archive_read_new(); archive_read_support_format_all(archive); - archive_read_support_compression_all(archive); + archive_read_support_filter_all(archive); sprintf(path, "%s/%s", getenv("BSDINSTALL_DISTDIR"), file); err = archive_read_open_filename(archive, path, 4096); if (err != ARCHIVE_OK) { @@ -188,7 +188,7 @@ extract_files(int nfiles, const char **f for (i = 0; i < nfiles; i++) { archive = archive_read_new(); archive_read_support_format_all(archive); - archive_read_support_compression_all(archive); + archive_read_support_filter_all(archive); sprintf(path, "%s/%s", getenv("BSDINSTALL_DISTDIR"), files[i]); err = archive_read_open_filename(archive, path, 4096); From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 13:36:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7DE2A604; Fri, 22 Mar 2013 13:36:08 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6C491AD4; Fri, 22 Mar 2013 13:36:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2MDa8X6054644; Fri, 22 Mar 2013 13:36:08 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2MDa4kC054606; Fri, 22 Mar 2013 13:36:04 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201303221336.r2MDa4kC054606@svn.freebsd.org> From: Martin Matuska Date: Fri, 22 Mar 2013 13:36:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248616 - in head: contrib/libarchive contrib/libarchive/cpio contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar contri... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 13:36:08 -0000 Author: mm Date: Fri Mar 22 13:36:03 2013 New Revision: 248616 URL: http://svnweb.freebsd.org/changeset/base/248616 Log: MFV r248590,248594: Update libarchive to 3.1.2 Some of new features: - support for lrzip and grzip compression - support for writing tar v7 format - b64encode and uuencode filters - support for __MACOSX directory in Zip archives - support for lzop compresion (external utility) Added: head/contrib/libarchive/cpio/test/test_extract.cpio.Z.uu - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.Z.uu head/contrib/libarchive/cpio/test/test_extract.cpio.bz2.uu - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.bz2.uu head/contrib/libarchive/cpio/test/test_extract.cpio.grz.uu - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.grz.uu head/contrib/libarchive/cpio/test/test_extract.cpio.gz.uu - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.gz.uu head/contrib/libarchive/cpio/test/test_extract.cpio.lrz.uu - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.lrz.uu head/contrib/libarchive/cpio/test/test_extract.cpio.lz.uu - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.lz.uu head/contrib/libarchive/cpio/test/test_extract.cpio.lzma.uu - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.lzma.uu head/contrib/libarchive/cpio/test/test_extract.cpio.lzo.uu - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.lzo.uu head/contrib/libarchive/cpio/test/test_extract.cpio.xz.uu - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.xz.uu head/contrib/libarchive/cpio/test/test_extract_cpio_Z.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract_cpio_Z.c head/contrib/libarchive/cpio/test/test_extract_cpio_bz2.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract_cpio_bz2.c head/contrib/libarchive/cpio/test/test_extract_cpio_grz.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract_cpio_grz.c head/contrib/libarchive/cpio/test/test_extract_cpio_gz.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract_cpio_gz.c head/contrib/libarchive/cpio/test/test_extract_cpio_lrz.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract_cpio_lrz.c head/contrib/libarchive/cpio/test/test_extract_cpio_lz.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract_cpio_lz.c head/contrib/libarchive/cpio/test/test_extract_cpio_lzma.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract_cpio_lzma.c head/contrib/libarchive/cpio/test/test_extract_cpio_lzo.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract_cpio_lzo.c head/contrib/libarchive/cpio/test/test_extract_cpio_xz.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_extract_cpio_xz.c head/contrib/libarchive/cpio/test/test_option_b64encode.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_option_b64encode.c head/contrib/libarchive/cpio/test/test_option_grzip.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_option_grzip.c head/contrib/libarchive/cpio/test/test_option_lrzip.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_option_lrzip.c head/contrib/libarchive/cpio/test/test_option_lzop.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_option_lzop.c head/contrib/libarchive/cpio/test/test_option_uuencode.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_option_uuencode.c head/contrib/libarchive/cpio/test/test_option_xz.c - copied unchanged from r248590, vendor/libarchive/dist/cpio/test/test_option_xz.c head/contrib/libarchive/libarchive/archive_cmdline.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_cmdline.c head/contrib/libarchive/libarchive/archive_cmdline_private.h - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_cmdline_private.h head/contrib/libarchive/libarchive/archive_read_append_filter.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_read_append_filter.c head/contrib/libarchive/libarchive/archive_read_set_format.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_read_set_format.c head/contrib/libarchive/libarchive/archive_read_support_filter_grzip.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_read_support_filter_grzip.c head/contrib/libarchive/libarchive/archive_read_support_filter_lrzip.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_read_support_filter_lrzip.c head/contrib/libarchive/libarchive/archive_read_support_filter_lzop.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_read_support_filter_lzop.c head/contrib/libarchive/libarchive/archive_write_add_filter_b64encode.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_write_add_filter_b64encode.c head/contrib/libarchive/libarchive/archive_write_add_filter_by_name.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_write_add_filter_by_name.c head/contrib/libarchive/libarchive/archive_write_add_filter_grzip.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_write_add_filter_grzip.c head/contrib/libarchive/libarchive/archive_write_add_filter_lrzip.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_write_add_filter_lrzip.c head/contrib/libarchive/libarchive/archive_write_add_filter_lzop.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_write_add_filter_lzop.c head/contrib/libarchive/libarchive/archive_write_add_filter_uuencode.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_write_add_filter_uuencode.c head/contrib/libarchive/libarchive/archive_write_set_format_v7tar.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/archive_write_set_format_v7tar.c head/contrib/libarchive/libarchive/filter_fork_posix.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/filter_fork_posix.c head/contrib/libarchive/libarchive/test/test_archive_cmdline.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_archive_cmdline.c head/contrib/libarchive/libarchive/test/test_archive_read_multiple_data_objects.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_archive_read_multiple_data_objects.c head/contrib/libarchive/libarchive/test/test_archive_write_add_filter_by_name.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_archive_write_add_filter_by_name.c head/contrib/libarchive/libarchive/test/test_archive_write_set_format_by_name.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_archive_write_set_format_by_name.c head/contrib/libarchive/libarchive/test/test_compat_lzop.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_compat_lzop.c head/contrib/libarchive/libarchive/test/test_compat_lzop_1.tar.lzo.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_compat_lzop_1.tar.lzo.uu head/contrib/libarchive/libarchive/test/test_compat_lzop_2.tar.lzo.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_compat_lzop_2.tar.lzo.uu head/contrib/libarchive/libarchive/test/test_compat_lzop_3.tar.lzo.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_compat_lzop_3.tar.lzo.uu head/contrib/libarchive/libarchive/test/test_compat_uudecode.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_compat_uudecode.c head/contrib/libarchive/libarchive/test/test_rar_multivolume_multiple_files.part1.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_multiple_files.part1.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_multiple_files.part2.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_multiple_files.part2.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_multiple_files.part3.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_multiple_files.part3.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_multiple_files.part4.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_multiple_files.part4.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_multiple_files.part5.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_multiple_files.part5.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_multiple_files.part6.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_multiple_files.part6.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_single_file.part1.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_single_file.part1.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_single_file.part2.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_single_file.part2.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_single_file.part3.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_single_file.part3.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_uncompressed_files.part01.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_uncompressed_files.part01.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_uncompressed_files.part02.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_uncompressed_files.part02.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_uncompressed_files.part03.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_uncompressed_files.part03.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_uncompressed_files.part04.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_uncompressed_files.part04.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_uncompressed_files.part05.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_uncompressed_files.part05.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_uncompressed_files.part06.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_uncompressed_files.part06.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_uncompressed_files.part07.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_uncompressed_files.part07.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_uncompressed_files.part08.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_uncompressed_files.part08.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_uncompressed_files.part09.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_uncompressed_files.part09.rar.uu head/contrib/libarchive/libarchive/test/test_rar_multivolume_uncompressed_files.part10.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_rar_multivolume_uncompressed_files.part10.rar.uu head/contrib/libarchive/libarchive/test/test_read_filter_grzip.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_filter_grzip.c head/contrib/libarchive/libarchive/test/test_read_filter_grzip.tar.grz.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_filter_grzip.tar.grz.uu head/contrib/libarchive/libarchive/test/test_read_filter_lrzip.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_filter_lrzip.c head/contrib/libarchive/libarchive/test/test_read_filter_lrzip.tar.lrz.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_filter_lrzip.tar.lrz.uu head/contrib/libarchive/libarchive/test/test_read_filter_lzop.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_filter_lzop.c head/contrib/libarchive/libarchive/test/test_read_filter_lzop.tar.lzo.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_filter_lzop.tar.lzo.uu head/contrib/libarchive/libarchive/test/test_read_filter_lzop_multiple_parts.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_filter_lzop_multiple_parts.c head/contrib/libarchive/libarchive/test/test_read_filter_lzop_multiple_parts.tar.lzo.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_filter_lzop_multiple_parts.tar.lzo.uu head/contrib/libarchive/libarchive/test/test_read_filter_program.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_filter_program.c head/contrib/libarchive/libarchive/test/test_read_filter_program_signature.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_filter_program_signature.c head/contrib/libarchive/libarchive/test/test_read_filter_uudecode.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_filter_uudecode.c head/contrib/libarchive/libarchive/test/test_read_format_mtree_nomagic2.mtree.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_format_mtree_nomagic2.mtree.uu head/contrib/libarchive/libarchive/test/test_read_format_mtree_nomagic3.mtree.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_format_mtree_nomagic3.mtree.uu head/contrib/libarchive/libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu head/contrib/libarchive/libarchive/test/test_read_format_rar_multivolume.part0002.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_format_rar_multivolume.part0002.rar.uu head/contrib/libarchive/libarchive/test/test_read_format_rar_multivolume.part0003.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_format_rar_multivolume.part0003.rar.uu head/contrib/libarchive/libarchive/test/test_read_format_rar_multivolume.part0004.rar.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_format_rar_multivolume.part0004.rar.uu head/contrib/libarchive/libarchive/test/test_read_format_zip_comment_stored.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_format_zip_comment_stored.c head/contrib/libarchive/libarchive/test/test_read_format_zip_comment_stored_1.zip.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_format_zip_comment_stored_1.zip.uu head/contrib/libarchive/libarchive/test/test_read_format_zip_comment_stored_2.zip.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_format_zip_comment_stored_2.zip.uu head/contrib/libarchive/libarchive/test/test_read_format_zip_mac_metadata.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_format_zip_mac_metadata.c head/contrib/libarchive/libarchive/test/test_read_format_zip_mac_metadata.zip.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_format_zip_mac_metadata.zip.uu head/contrib/libarchive/libarchive/test/test_read_format_zip_sfx.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_format_zip_sfx.c head/contrib/libarchive/libarchive/test/test_read_format_zip_sfx.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_format_zip_sfx.uu head/contrib/libarchive/libarchive/test/test_read_large_splitted_rar_aa.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_large_splitted_rar_aa.uu head/contrib/libarchive/libarchive/test/test_read_large_splitted_rar_ab.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_large_splitted_rar_ab.uu head/contrib/libarchive/libarchive/test/test_read_large_splitted_rar_ac.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_large_splitted_rar_ac.uu head/contrib/libarchive/libarchive/test/test_read_large_splitted_rar_ad.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_large_splitted_rar_ad.uu head/contrib/libarchive/libarchive/test/test_read_large_splitted_rar_ae.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_large_splitted_rar_ae.uu head/contrib/libarchive/libarchive/test/test_read_set_format.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_set_format.c head/contrib/libarchive/libarchive/test/test_read_splitted_rar_aa.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_splitted_rar_aa.uu head/contrib/libarchive/libarchive/test/test_read_splitted_rar_ab.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_splitted_rar_ab.uu head/contrib/libarchive/libarchive/test/test_read_splitted_rar_ac.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_splitted_rar_ac.uu head/contrib/libarchive/libarchive/test/test_read_splitted_rar_ad.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_read_splitted_rar_ad.uu head/contrib/libarchive/libarchive/test/test_splitted_rar_seek_support_aa.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_splitted_rar_seek_support_aa.uu head/contrib/libarchive/libarchive/test/test_splitted_rar_seek_support_ab.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_splitted_rar_seek_support_ab.uu head/contrib/libarchive/libarchive/test/test_splitted_rar_seek_support_ac.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_splitted_rar_seek_support_ac.uu head/contrib/libarchive/libarchive/test/test_write_disk_appledouble.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_disk_appledouble.c head/contrib/libarchive/libarchive/test/test_write_disk_appledouble.cpio.gz.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_disk_appledouble.cpio.gz.uu head/contrib/libarchive/libarchive/test/test_write_disk_hfs_compression.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_disk_hfs_compression.c head/contrib/libarchive/libarchive/test/test_write_disk_hfs_compression.tgz.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_disk_hfs_compression.tgz.uu head/contrib/libarchive/libarchive/test/test_write_disk_mac_metadata.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_disk_mac_metadata.c head/contrib/libarchive/libarchive/test/test_write_disk_mac_metadata.tar.gz.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_disk_mac_metadata.tar.gz.uu head/contrib/libarchive/libarchive/test/test_write_disk_no_hfs_compression.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_disk_no_hfs_compression.c head/contrib/libarchive/libarchive/test/test_write_disk_no_hfs_compression.tgz.uu - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_disk_no_hfs_compression.tgz.uu head/contrib/libarchive/libarchive/test/test_write_filter_b64encode.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_filter_b64encode.c head/contrib/libarchive/libarchive/test/test_write_filter_bzip2.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_filter_bzip2.c head/contrib/libarchive/libarchive/test/test_write_filter_compress.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_filter_compress.c head/contrib/libarchive/libarchive/test/test_write_filter_gzip.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_filter_gzip.c head/contrib/libarchive/libarchive/test/test_write_filter_gzip_timestamp.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_filter_gzip_timestamp.c head/contrib/libarchive/libarchive/test/test_write_filter_lrzip.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_filter_lrzip.c head/contrib/libarchive/libarchive/test/test_write_filter_lzip.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_filter_lzip.c head/contrib/libarchive/libarchive/test/test_write_filter_lzma.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_filter_lzma.c head/contrib/libarchive/libarchive/test/test_write_filter_lzop.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_filter_lzop.c head/contrib/libarchive/libarchive/test/test_write_filter_program.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_filter_program.c head/contrib/libarchive/libarchive/test/test_write_filter_uuencode.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_filter_uuencode.c head/contrib/libarchive/libarchive/test/test_write_filter_xz.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_filter_xz.c head/contrib/libarchive/libarchive/test/test_write_format_7zip_empty.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_format_7zip_empty.c head/contrib/libarchive/libarchive/test/test_write_format_7zip_large.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_format_7zip_large.c head/contrib/libarchive/libarchive/test/test_write_format_mtree_absolute_path.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_format_mtree_absolute_path.c head/contrib/libarchive/libarchive/test/test_write_format_mtree_classic.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_format_mtree_classic.c head/contrib/libarchive/libarchive/test/test_write_format_mtree_classic_indent.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_format_mtree_classic_indent.c head/contrib/libarchive/libarchive/test/test_write_format_mtree_no_separator.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_format_mtree_no_separator.c head/contrib/libarchive/libarchive/test/test_write_format_mtree_quoted_filename.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_format_mtree_quoted_filename.c head/contrib/libarchive/libarchive/test/test_write_format_tar_v7tar.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_format_tar_v7tar.c head/contrib/libarchive/libarchive/test/test_write_zip_set_compression_store.c - copied unchanged from r248590, vendor/libarchive/dist/libarchive/test/test_write_zip_set_compression_store.c head/contrib/libarchive/tar/creation_set.c - copied unchanged from r248590, vendor/libarchive/dist/tar/creation_set.c head/contrib/libarchive/tar/test/test_extract.tar.Z.uu - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract.tar.Z.uu head/contrib/libarchive/tar/test/test_extract.tar.bz2.uu - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract.tar.bz2.uu head/contrib/libarchive/tar/test/test_extract.tar.grz.uu - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract.tar.grz.uu head/contrib/libarchive/tar/test/test_extract.tar.gz.uu - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract.tar.gz.uu head/contrib/libarchive/tar/test/test_extract.tar.lrz.uu - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract.tar.lrz.uu head/contrib/libarchive/tar/test/test_extract.tar.lz.uu - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract.tar.lz.uu head/contrib/libarchive/tar/test/test_extract.tar.lzma.uu - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract.tar.lzma.uu head/contrib/libarchive/tar/test/test_extract.tar.lzo.uu - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract.tar.lzo.uu head/contrib/libarchive/tar/test/test_extract.tar.xz.uu - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract.tar.xz.uu head/contrib/libarchive/tar/test/test_extract_tar_Z.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract_tar_Z.c head/contrib/libarchive/tar/test/test_extract_tar_bz2.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract_tar_bz2.c head/contrib/libarchive/tar/test/test_extract_tar_grz.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract_tar_grz.c head/contrib/libarchive/tar/test/test_extract_tar_gz.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract_tar_gz.c head/contrib/libarchive/tar/test/test_extract_tar_lrz.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract_tar_lrz.c head/contrib/libarchive/tar/test/test_extract_tar_lz.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract_tar_lz.c head/contrib/libarchive/tar/test/test_extract_tar_lzma.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract_tar_lzma.c head/contrib/libarchive/tar/test/test_extract_tar_lzo.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract_tar_lzo.c head/contrib/libarchive/tar/test/test_extract_tar_xz.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_extract_tar_xz.c head/contrib/libarchive/tar/test/test_option_a.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_option_a.c head/contrib/libarchive/tar/test/test_option_b64encode.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_option_b64encode.c head/contrib/libarchive/tar/test/test_option_grzip.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_option_grzip.c head/contrib/libarchive/tar/test/test_option_j.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_option_j.c head/contrib/libarchive/tar/test/test_option_lrzip.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_option_lrzip.c head/contrib/libarchive/tar/test/test_option_lzma.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_option_lzma.c head/contrib/libarchive/tar/test/test_option_lzop.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_option_lzop.c head/contrib/libarchive/tar/test/test_option_older_than.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_option_older_than.c head/contrib/libarchive/tar/test/test_option_uuencode.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_option_uuencode.c head/contrib/libarchive/tar/test/test_option_xz.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_option_xz.c head/contrib/libarchive/tar/test/test_option_z.c - copied unchanged from r248590, vendor/libarchive/dist/tar/test/test_option_z.c head/contrib/libarchive/test_utils/ - copied from r248590, vendor/libarchive/dist/test_utils/ Deleted: head/contrib/libarchive/libarchive/filter_fork.c head/contrib/libarchive/libarchive/test/test_acl_freebsd.c head/contrib/libarchive/libarchive/test/test_read_compress_program.c head/contrib/libarchive/libarchive/test/test_read_uu.c head/contrib/libarchive/libarchive/test/test_write_compress.c head/contrib/libarchive/libarchive/test/test_write_compress_bzip2.c head/contrib/libarchive/libarchive/test/test_write_compress_gzip.c head/contrib/libarchive/libarchive/test/test_write_compress_lzip.c head/contrib/libarchive/libarchive/test/test_write_compress_lzma.c head/contrib/libarchive/libarchive/test/test_write_compress_program.c head/contrib/libarchive/libarchive/test/test_write_compress_xz.c Modified: head/contrib/libarchive/NEWS head/contrib/libarchive/README head/contrib/libarchive/cpio/bsdcpio.1 head/contrib/libarchive/cpio/cmdline.c head/contrib/libarchive/cpio/cpio.c head/contrib/libarchive/cpio/cpio.h head/contrib/libarchive/cpio/test/main.c head/contrib/libarchive/cpio/test/test.h head/contrib/libarchive/cpio/test/test_basic.c head/contrib/libarchive/cpio/test/test_format_newc.c head/contrib/libarchive/cpio/test/test_option_y.c head/contrib/libarchive/cpio/test/test_option_z.c head/contrib/libarchive/libarchive/archive.h head/contrib/libarchive/libarchive/archive_crypto.c head/contrib/libarchive/libarchive/archive_entry.c head/contrib/libarchive/libarchive/archive_entry.h head/contrib/libarchive/libarchive/archive_entry_link_resolver.c head/contrib/libarchive/libarchive/archive_match.c head/contrib/libarchive/libarchive/archive_options.c head/contrib/libarchive/libarchive/archive_ppmd7.c head/contrib/libarchive/libarchive/archive_private.h head/contrib/libarchive/libarchive/archive_rb.c head/contrib/libarchive/libarchive/archive_read.c head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c head/contrib/libarchive/libarchive/archive_read_disk_posix.c head/contrib/libarchive/libarchive/archive_read_extract.c head/contrib/libarchive/libarchive/archive_read_open_fd.c head/contrib/libarchive/libarchive/archive_read_open_file.c head/contrib/libarchive/libarchive/archive_read_open_filename.c head/contrib/libarchive/libarchive/archive_read_private.h head/contrib/libarchive/libarchive/archive_read_support_filter_all.c head/contrib/libarchive/libarchive/archive_read_support_filter_bzip2.c head/contrib/libarchive/libarchive/archive_read_support_filter_compress.c head/contrib/libarchive/libarchive/archive_read_support_filter_gzip.c head/contrib/libarchive/libarchive/archive_read_support_filter_program.c head/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c head/contrib/libarchive/libarchive/archive_read_support_filter_uu.c head/contrib/libarchive/libarchive/archive_read_support_filter_xz.c head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c head/contrib/libarchive/libarchive/archive_read_support_format_ar.c head/contrib/libarchive/libarchive/archive_read_support_format_cab.c head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c head/contrib/libarchive/libarchive/archive_read_support_format_empty.c head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c head/contrib/libarchive/libarchive/archive_read_support_format_lha.c head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c head/contrib/libarchive/libarchive/archive_read_support_format_rar.c head/contrib/libarchive/libarchive/archive_read_support_format_raw.c head/contrib/libarchive/libarchive/archive_read_support_format_tar.c head/contrib/libarchive/libarchive/archive_read_support_format_xar.c head/contrib/libarchive/libarchive/archive_read_support_format_zip.c head/contrib/libarchive/libarchive/archive_string.c head/contrib/libarchive/libarchive/archive_util.c head/contrib/libarchive/libarchive/archive_virtual.c head/contrib/libarchive/libarchive/archive_write.c head/contrib/libarchive/libarchive/archive_write_add_filter.c head/contrib/libarchive/libarchive/archive_write_add_filter_bzip2.c head/contrib/libarchive/libarchive/archive_write_add_filter_compress.c head/contrib/libarchive/libarchive/archive_write_add_filter_gzip.c head/contrib/libarchive/libarchive/archive_write_add_filter_program.c head/contrib/libarchive/libarchive/archive_write_add_filter_xz.c head/contrib/libarchive/libarchive/archive_write_disk_acl.c head/contrib/libarchive/libarchive/archive_write_disk_posix.c head/contrib/libarchive/libarchive/archive_write_free.3 head/contrib/libarchive/libarchive/archive_write_open_filename.c head/contrib/libarchive/libarchive/archive_write_private.h head/contrib/libarchive/libarchive/archive_write_set_format_7zip.c head/contrib/libarchive/libarchive/archive_write_set_format_ar.c head/contrib/libarchive/libarchive/archive_write_set_format_by_name.c head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c head/contrib/libarchive/libarchive/archive_write_set_format_mtree.c head/contrib/libarchive/libarchive/archive_write_set_format_pax.c head/contrib/libarchive/libarchive/archive_write_set_format_xar.c head/contrib/libarchive/libarchive/archive_write_set_format_zip.c head/contrib/libarchive/libarchive/archive_write_set_options.c head/contrib/libarchive/libarchive/filter_fork.h head/contrib/libarchive/libarchive/libarchive-formats.5 head/contrib/libarchive/libarchive/test/main.c head/contrib/libarchive/libarchive/test/test.h head/contrib/libarchive/libarchive/test/test_acl_freebsd_nfs4.c head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c head/contrib/libarchive/libarchive/test/test_acl_nfs4.c head/contrib/libarchive/libarchive/test/test_acl_pax.c head/contrib/libarchive/libarchive/test/test_acl_posix1e.c head/contrib/libarchive/libarchive/test/test_archive_clear_error.c head/contrib/libarchive/libarchive/test/test_archive_read_close_twice.c head/contrib/libarchive/libarchive/test/test_archive_read_close_twice_open_fd.c head/contrib/libarchive/libarchive/test/test_archive_read_close_twice_open_filename.c head/contrib/libarchive/libarchive/test/test_archive_read_set_filter_option.c head/contrib/libarchive/libarchive/test/test_archive_read_set_format_option.c head/contrib/libarchive/libarchive/test/test_archive_read_set_option.c head/contrib/libarchive/libarchive/test/test_archive_read_set_options.c head/contrib/libarchive/libarchive/test/test_archive_set_error.c head/contrib/libarchive/libarchive/test/test_archive_write_set_filter_option.c head/contrib/libarchive/libarchive/test/test_archive_write_set_format_option.c head/contrib/libarchive/libarchive/test/test_archive_write_set_option.c head/contrib/libarchive/libarchive/test/test_archive_write_set_options.c head/contrib/libarchive/libarchive/test/test_compat_bzip2.c head/contrib/libarchive/libarchive/test/test_compat_cpio.c head/contrib/libarchive/libarchive/test/test_compat_gtar.c head/contrib/libarchive/libarchive/test/test_compat_gzip.c head/contrib/libarchive/libarchive/test/test_compat_lzip.c head/contrib/libarchive/libarchive/test/test_compat_lzma.c head/contrib/libarchive/libarchive/test/test_compat_mac.c head/contrib/libarchive/libarchive/test/test_compat_tar_hardlink.c head/contrib/libarchive/libarchive/test/test_compat_xz.c head/contrib/libarchive/libarchive/test/test_compat_zip.c head/contrib/libarchive/libarchive/test/test_empty_write.c head/contrib/libarchive/libarchive/test/test_entry.c head/contrib/libarchive/libarchive/test/test_filter_count.c head/contrib/libarchive/libarchive/test/test_fuzz.c head/contrib/libarchive/libarchive/test/test_open_failure.c head/contrib/libarchive/libarchive/test/test_open_fd.c head/contrib/libarchive/libarchive/test/test_open_file.c head/contrib/libarchive/libarchive/test/test_open_filename.c head/contrib/libarchive/libarchive/test/test_pax_filename_encoding.c head/contrib/libarchive/libarchive/test/test_read_data_large.c head/contrib/libarchive/libarchive/test/test_read_disk.c head/contrib/libarchive/libarchive/test/test_read_extract.c head/contrib/libarchive/libarchive/test/test_read_format_7zip.c head/contrib/libarchive/libarchive/test/test_read_format_ar.c head/contrib/libarchive/libarchive/test/test_read_format_cab.c head/contrib/libarchive/libarchive/test/test_read_format_cab_filename.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_afio.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_bin.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_Z.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_be.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_bz2.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_gz.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_lzip.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_lzma.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_xz.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_filename.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_odc.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_gzip.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c head/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4c_Z.c head/contrib/libarchive/libarchive/test/test_read_format_empty.c head/contrib/libarchive/libarchive/test/test_read_format_gtar_gz.c head/contrib/libarchive/libarchive/test/test_read_format_gtar_lzma.c head/contrib/libarchive/libarchive/test/test_read_format_iso_Z.c head/contrib/libarchive/libarchive/test/test_read_format_iso_multi_extent.c head/contrib/libarchive/libarchive/test/test_read_format_iso_xorriso.c head/contrib/libarchive/libarchive/test/test_read_format_isojoliet_bz2.c head/contrib/libarchive/libarchive/test/test_read_format_isojoliet_long.c head/contrib/libarchive/libarchive/test/test_read_format_isojoliet_rr.c head/contrib/libarchive/libarchive/test/test_read_format_isojoliet_versioned.c head/contrib/libarchive/libarchive/test/test_read_format_isorr_bz2.c head/contrib/libarchive/libarchive/test/test_read_format_isorr_ce.c head/contrib/libarchive/libarchive/test/test_read_format_isorr_new_bz2.c head/contrib/libarchive/libarchive/test/test_read_format_isorr_rr_moved.c head/contrib/libarchive/libarchive/test/test_read_format_isozisofs_bz2.c head/contrib/libarchive/libarchive/test/test_read_format_lha.c head/contrib/libarchive/libarchive/test/test_read_format_lha_filename.c head/contrib/libarchive/libarchive/test/test_read_format_mtree.c head/contrib/libarchive/libarchive/test/test_read_format_pax_bz2.c head/contrib/libarchive/libarchive/test/test_read_format_rar.c head/contrib/libarchive/libarchive/test/test_read_format_tar.c head/contrib/libarchive/libarchive/test/test_read_format_tar_empty_filename.c head/contrib/libarchive/libarchive/test/test_read_format_tbz.c head/contrib/libarchive/libarchive/test/test_read_format_tgz.c head/contrib/libarchive/libarchive/test/test_read_format_tlz.c head/contrib/libarchive/libarchive/test/test_read_format_txz.c head/contrib/libarchive/libarchive/test/test_read_format_tz.c head/contrib/libarchive/libarchive/test/test_read_format_xar.c head/contrib/libarchive/libarchive/test/test_read_format_zip.c head/contrib/libarchive/libarchive/test/test_read_format_zip_filename.c head/contrib/libarchive/libarchive/test/test_read_pax_truncated.c head/contrib/libarchive/libarchive/test/test_read_truncated.c head/contrib/libarchive/libarchive/test/test_read_truncated_filter.c head/contrib/libarchive/libarchive/test/test_sparse_basic.c head/contrib/libarchive/libarchive/test/test_tar_filenames.c head/contrib/libarchive/libarchive/test/test_ustar_filenames.c head/contrib/libarchive/libarchive/test/test_write_disk_sparse.c head/contrib/libarchive/libarchive/test/test_write_format_7zip.c head/contrib/libarchive/libarchive/test/test_write_format_ar.c head/contrib/libarchive/libarchive/test/test_write_format_cpio.c head/contrib/libarchive/libarchive/test/test_write_format_cpio_empty.c head/contrib/libarchive/libarchive/test/test_write_format_cpio_newc.c head/contrib/libarchive/libarchive/test/test_write_format_cpio_odc.c head/contrib/libarchive/libarchive/test/test_write_format_gnutar.c head/contrib/libarchive/libarchive/test/test_write_format_iso9660.c head/contrib/libarchive/libarchive/test/test_write_format_iso9660_boot.c head/contrib/libarchive/libarchive/test/test_write_format_iso9660_empty.c head/contrib/libarchive/libarchive/test/test_write_format_iso9660_filename.c head/contrib/libarchive/libarchive/test/test_write_format_iso9660_zisofs.c head/contrib/libarchive/libarchive/test/test_write_format_mtree.c head/contrib/libarchive/libarchive/test/test_write_format_mtree_fflags.c head/contrib/libarchive/libarchive/test/test_write_format_pax.c head/contrib/libarchive/libarchive/test/test_write_format_shar_empty.c head/contrib/libarchive/libarchive/test/test_write_format_tar.c head/contrib/libarchive/libarchive/test/test_write_format_tar_empty.c head/contrib/libarchive/libarchive/test/test_write_format_tar_sparse.c head/contrib/libarchive/libarchive/test/test_write_format_tar_ustar.c head/contrib/libarchive/libarchive/test/test_write_format_xar.c head/contrib/libarchive/libarchive/test/test_write_format_xar_empty.c head/contrib/libarchive/libarchive/test/test_write_format_zip.c head/contrib/libarchive/libarchive/test/test_write_format_zip_empty.c head/contrib/libarchive/libarchive/test/test_write_format_zip_no_compression.c head/contrib/libarchive/libarchive/test/test_write_open_memory.c head/contrib/libarchive/tar/bsdtar.1 head/contrib/libarchive/tar/bsdtar.c head/contrib/libarchive/tar/bsdtar.h head/contrib/libarchive/tar/cmdline.c head/contrib/libarchive/tar/read.c head/contrib/libarchive/tar/subst.c head/contrib/libarchive/tar/test/main.c head/contrib/libarchive/tar/test/test.h head/contrib/libarchive/tar/test/test_copy.c head/contrib/libarchive/tar/test/test_option_newer_than.c head/contrib/libarchive/tar/test/test_option_r.c head/contrib/libarchive/tar/test/test_stdio.c head/contrib/libarchive/tar/util.c head/contrib/libarchive/tar/write.c head/lib/libarchive/Makefile head/lib/libarchive/config_freebsd.h head/lib/libarchive/test/Makefile head/usr.bin/ar/Makefile head/usr.bin/cpio/Makefile head/usr.bin/cpio/test/Makefile head/usr.bin/tar/Makefile head/usr.bin/tar/test/Makefile Directory Properties: head/contrib/libarchive/ (props changed) head/contrib/libarchive/cpio/ (props changed) head/contrib/libarchive/libarchive/ (props changed) head/contrib/libarchive/tar/ (props changed) Modified: head/contrib/libarchive/NEWS ============================================================================== --- head/contrib/libarchive/NEWS Fri Mar 22 13:34:22 2013 (r248615) +++ head/contrib/libarchive/NEWS Fri Mar 22 13:36:03 2013 (r248616) @@ -1,3 +1,30 @@ +Feb 09, 2013: libarchive 3.1.2 released + +Jan 28, 2013: libarchive's new website moved to http://www.libarchive.org. + +Jan 13, 2013: libarchive 3.1.1 released + +Jan 13, 2013: libarchive 3.1.0 released + +Dec 07, 2012: Implement functions to manually set the format and filters used. + +Nov 11, 2012: Add support for __MACOSX directory in Zip archives, which resource + forks are stored in. + +Oct 20, 2012: Add support for writing v7 tar format. + +Oct 09, 2012: Add support for grzip compression. + +Oct 07, 2012: Introduce b64encode filter. +Oct 07, 2012: Introduce uuencode filter. + +Oct 06, 2012: Add support for lzop. + +Sep 27, 2012: Implement function used to seek within data blocks. + (Currently only supported for uncompressed RAR archives). + +Apr 22, 2012: Add basic archive read and write filter support for lrzip. + Mar 27, 2012: libarchive 3.0.4 released Feb 05, 2012: libarchive development now hosted at GitHub. Modified: head/contrib/libarchive/README ============================================================================== --- head/contrib/libarchive/README Fri Mar 22 13:34:22 2013 (r248615) +++ head/contrib/libarchive/README Fri Mar 22 13:36:03 2013 (r248616) @@ -1,7 +1,7 @@ README for libarchive bundle. Questions? Issues? - * http://libarchive.github.com/ is the home for ongoing + * http://www.libarchive.org is the home for ongoing libarchive development, including documentation, and links to the libarchive mailing lists. * To report an issue, use the issue tracker at Modified: head/contrib/libarchive/cpio/bsdcpio.1 ============================================================================== --- head/contrib/libarchive/cpio/bsdcpio.1 Fri Mar 22 13:34:22 2013 (r248615) +++ head/contrib/libarchive/cpio/bsdcpio.1 Fri Mar 22 13:36:03 2013 (r248616) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 24, 2011 +.Dd October 7, 2012 .Dt CPIO 1 .Os .Sh NAME @@ -176,11 +176,21 @@ With this option, the target of the link (p mode only) Create links from the target directory to the original files, instead of copying. +.It Fl Fl lrzip +(o mode only) +Compress the resulting archive with +.Xr lrzip 1 . +In input mode, this option is ignored. .It Fl Fl lzma (o mode only) Compress the file with lzma-compatible compression before writing it. In input mode, this option is ignored; lzma compression is recognized automatically on input. +.It Fl Fl lzop +(o mode only) +Compress the resulting archive with +.Xr lzop 1 . +In input mode, this option is ignored. .It Fl m , Fl Fl preserve-modification-time (i and p modes) Set file modification time on created files to match Modified: head/contrib/libarchive/cpio/cmdline.c ============================================================================== --- head/contrib/libarchive/cpio/cmdline.c Fri Mar 22 13:34:22 2013 (r248615) +++ head/contrib/libarchive/cpio/cmdline.c Fri Mar 22 13:36:03 2013 (r248616) @@ -61,16 +61,20 @@ static const struct option { int required; /* 1 if this option requires an argument */ int equivalent; /* Equivalent short option. */ } cpio_longopts[] = { + { "b64encode", 0, OPTION_B64ENCODE }, { "create", 0, 'o' }, { "dot", 0, 'V' }, { "extract", 0, 'i' }, { "file", 1, 'F' }, { "format", 1, 'H' }, + { "grzip", 0, OPTION_GRZIP }, { "help", 0, 'h' }, { "insecure", 0, OPTION_INSECURE }, { "link", 0, 'l' }, { "list", 0, 't' }, + { "lrzip", 0, OPTION_LRZIP }, { "lzma", 0, OPTION_LZMA }, + { "lzop", 0, OPTION_LZOP }, { "make-directories", 0, 'd' }, { "no-preserve-owner", 0, OPTION_NO_PRESERVE_OWNER }, { "null", 0, '0' }, @@ -81,6 +85,7 @@ static const struct option { { "preserve-owner", 0, OPTION_PRESERVE_OWNER }, { "quiet", 0, OPTION_QUIET }, { "unconditional", 0, 'u' }, + { "uuencode", 0, OPTION_UUENCODE }, { "verbose", 0, 'v' }, { "version", 0, OPTION_VERSION }, { "xz", 0, 'J' }, Modified: head/contrib/libarchive/cpio/cpio.c ============================================================================== --- head/contrib/libarchive/cpio/cpio.c Fri Mar 22 13:34:22 2013 (r248615) +++ head/contrib/libarchive/cpio/cpio.c Fri Mar 22 13:36:03 2013 (r248616) @@ -207,6 +207,9 @@ main(int argc, char *argv[]) case 'B': /* POSIX 1997 */ cpio->bytes_per_block = 5120; break; + case OPTION_B64ENCODE: + cpio->add_filter = opt; + break; case 'C': /* NetBSD/OpenBSD */ cpio->bytes_per_block = atoi(cpio->argument); if (cpio->bytes_per_block <= 0) @@ -234,6 +237,9 @@ main(int argc, char *argv[]) lafe_errc(1, 0, "Error : %s", archive_error_string(cpio->matching)); break; + case OPTION_GRZIP: + cpio->compress = opt; + break; case 'H': /* GNU cpio (also --format) */ cpio->format = cpio->argument; break; @@ -265,7 +271,9 @@ main(int argc, char *argv[]) case 'l': /* POSIX 1997 */ cpio->option_link = 1; break; + case OPTION_LRZIP: case OPTION_LZMA: /* GNU tar, others */ + case OPTION_LZOP: /* GNU tar, others */ cpio->compress = opt; break; case 'm': /* POSIX 1997 */ @@ -326,6 +334,9 @@ main(int argc, char *argv[]) cpio->extract_flags &= ~ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER; break; + case OPTION_UUENCODE: + cpio->add_filter = opt; + break; case 'v': /* POSIX 1997 */ cpio->verbose++; break; @@ -417,6 +428,7 @@ main(int argc, char *argv[]) archive_match_free(cpio->matching); free_cache(cpio->gname_cache); free_cache(cpio->uname_cache); + free(cpio->destdir); return (cpio->return_value); } @@ -516,27 +528,49 @@ mode_out(struct cpio *cpio) if (cpio->archive == NULL) lafe_errc(1, 0, "Failed to allocate archive object"); switch (cpio->compress) { + case OPTION_GRZIP: + r = archive_write_add_filter_grzip(cpio->archive); + break; case 'J': - r = archive_write_set_compression_xz(cpio->archive); + r = archive_write_add_filter_xz(cpio->archive); + break; + case OPTION_LRZIP: + r = archive_write_add_filter_lrzip(cpio->archive); break; case OPTION_LZMA: - r = archive_write_set_compression_lzma(cpio->archive); + r = archive_write_add_filter_lzma(cpio->archive); + break; + case OPTION_LZOP: + r = archive_write_add_filter_lzop(cpio->archive); break; case 'j': case 'y': - r = archive_write_set_compression_bzip2(cpio->archive); + r = archive_write_add_filter_bzip2(cpio->archive); break; case 'z': - r = archive_write_set_compression_gzip(cpio->archive); + r = archive_write_add_filter_gzip(cpio->archive); break; case 'Z': - r = archive_write_set_compression_compress(cpio->archive); + r = archive_write_add_filter_compress(cpio->archive); break; default: - r = archive_write_set_compression_none(cpio->archive); + r = archive_write_add_filter_none(cpio->archive); break; } if (r < ARCHIVE_WARN) lafe_errc(1, 0, "Requested compression not available"); + switch (cpio->add_filter) { + case 0: + r = ARCHIVE_OK; + break; + case OPTION_B64ENCODE: + r = archive_write_add_filter_b64encode(cpio->archive); + break; + case OPTION_UUENCODE: + r = archive_write_add_filter_uuencode(cpio->archive); + break; + } + if (r < ARCHIVE_WARN) + lafe_errc(1, 0, "Requested filter not available"); r = archive_write_set_format_by_name(cpio->archive, cpio->format); if (r != ARCHIVE_OK) lafe_errc(1, 0, "%s", archive_error_string(cpio->archive)); @@ -548,7 +582,7 @@ mode_out(struct cpio *cpio) /* * The main loop: Copy each file into the output archive. */ - r = archive_write_open_file(cpio->archive, cpio->filename); + r = archive_write_open_filename(cpio->archive, cpio->filename); if (r != ARCHIVE_OK) lafe_errc(1, 0, "%s", archive_error_string(cpio->archive)); lr = lafe_line_reader("-", cpio->option_null); @@ -577,7 +611,7 @@ mode_out(struct cpio *cpio) if (!cpio->quiet) { int64_t blocks = - (archive_position_uncompressed(cpio->archive) + 511) + (archive_filter_bytes(cpio->archive, 0) + 511) / 512; fprintf(stderr, "%lu %s\n", (unsigned long)blocks, blocks == 1 ? "block" : "blocks"); @@ -806,18 +840,21 @@ entry_to_archive(struct cpio *cpio, stru exit(1); if (r >= ARCHIVE_WARN && archive_entry_size(entry) > 0 && fd >= 0) { - bytes_read = read(fd, cpio->buff, cpio->buff_size); + bytes_read = read(fd, cpio->buff, (unsigned)cpio->buff_size); while (bytes_read > 0) { - r = archive_write_data(cpio->archive, + ssize_t bytes_write; + bytes_write = archive_write_data(cpio->archive, cpio->buff, bytes_read); - if (r < 0) + if (bytes_write < 0) lafe_errc(1, archive_errno(cpio->archive), "%s", archive_error_string(cpio->archive)); - if (r < bytes_read) { + if (bytes_write < bytes_read) { lafe_warnc(0, - "Truncated write; file may have grown while being archived."); + "Truncated write; file may have " + "grown while being archived."); } - bytes_read = read(fd, cpio->buff, cpio->buff_size); + bytes_read = read(fd, cpio->buff, + (unsigned)cpio->buff_size); } } @@ -908,7 +945,8 @@ mode_in(struct cpio *cpio) archive_read_support_filter_all(a); archive_read_support_format_all(a); - if (archive_read_open_file(a, cpio->filename, cpio->bytes_per_block)) + if (archive_read_open_filename(a, cpio->filename, + cpio->bytes_per_block)) lafe_errc(1, archive_errno(a), "%s", archive_error_string(a)); for (;;) { @@ -957,7 +995,7 @@ mode_in(struct cpio *cpio) if (r != ARCHIVE_OK) lafe_errc(1, 0, "%s", archive_error_string(ext)); if (!cpio->quiet) { - int64_t blocks = (archive_position_uncompressed(a) + 511) + int64_t blocks = (archive_filter_bytes(a, 0) + 511) / 512; fprintf(stderr, "%lu %s\n", (unsigned long)blocks, blocks == 1 ? "block" : "blocks"); @@ -988,7 +1026,7 @@ extract_data(struct archive *ar, struct "%s", archive_error_string(ar)); exit(1); } - r = archive_write_data_block(aw, block, size, offset); + r = (int)archive_write_data_block(aw, block, size, offset); if (r != ARCHIVE_OK) { lafe_warnc(archive_errno(aw), "%s", archive_error_string(aw)); @@ -1010,7 +1048,8 @@ mode_list(struct cpio *cpio) archive_read_support_filter_all(a); archive_read_support_format_all(a); - if (archive_read_open_file(a, cpio->filename, cpio->bytes_per_block)) + if (archive_read_open_filename(a, cpio->filename, + cpio->bytes_per_block)) lafe_errc(1, archive_errno(a), "%s", archive_error_string(a)); for (;;) { @@ -1032,7 +1071,7 @@ mode_list(struct cpio *cpio) if (r != ARCHIVE_OK) lafe_errc(1, 0, "%s", archive_error_string(a)); if (!cpio->quiet) { - int64_t blocks = (archive_position_uncompressed(a) + 511) + int64_t blocks = (archive_filter_bytes(a, 0) + 511) / 512; fprintf(stderr, "%lu %s\n", (unsigned long)blocks, blocks == 1 ? "block" : "blocks"); @@ -1167,7 +1206,7 @@ mode_pass(struct cpio *cpio, const char if (!cpio->quiet) { int64_t blocks = - (archive_position_uncompressed(cpio->archive) + 511) + (archive_filter_bytes(cpio->archive, 0) + 511) / 512; fprintf(stderr, "%lu %s\n", (unsigned long)blocks, blocks == 1 ? "block" : "blocks"); Modified: head/contrib/libarchive/cpio/cpio.h ============================================================================== --- head/contrib/libarchive/cpio/cpio.h Fri Mar 22 13:34:22 2013 (r248615) +++ head/contrib/libarchive/cpio/cpio.h Fri Mar 22 13:36:03 2013 (r248616) @@ -44,6 +44,7 @@ struct cpio { const char *argument; /* Options */ + int add_filter; /* --uuencode */ const char *filename; int mode; /* -i -o -p */ int compress; /* -j, -y, or -z */ @@ -96,11 +97,16 @@ const char *owner_parse(const char *, in /* Fake short equivalents for long options that otherwise lack them. */ enum { - OPTION_INSECURE = 1, + OPTION_B64ENCODE = 1, + OPTION_GRZIP, + OPTION_INSECURE, + OPTION_LRZIP, OPTION_LZMA, + OPTION_LZOP, OPTION_NO_PRESERVE_OWNER, OPTION_PRESERVE_OWNER, OPTION_QUIET, + OPTION_UUENCODE, OPTION_VERSION }; Modified: head/contrib/libarchive/cpio/test/main.c ============================================================================== --- head/contrib/libarchive/cpio/test/main.c Fri Mar 22 13:34:22 2013 (r248615) +++ head/contrib/libarchive/cpio/test/main.c Fri Mar 22 13:36:03 2013 (r248616) @@ -24,6 +24,7 @@ */ #include "test.h" +#include "test_utils.h" #ifdef HAVE_SYS_IOCTL_H #include #endif @@ -91,6 +92,7 @@ __FBSDID("$FreeBSD$"); */ #if defined(_WIN32) && !defined(__CYGWIN__) #include +#include #include #ifndef F_OK #define F_OK (0) @@ -389,7 +391,6 @@ failure_finish(void *extra) fprintf(stderr, " *** forcing core dump so failure can be debugged ***\n"); abort(); - exit(1); } } @@ -622,8 +623,8 @@ assertion_equal_string(const char *file, if (v1 == v2 || (v1 != NULL && v2 != NULL && strcmp(v1, v2) == 0)) return (1); failure_start(file, line, "%s != %s", e1, e2); - l1 = strlen(e1); - l2 = strlen(e2); + l1 = (int)strlen(e1); + l2 = (int)strlen(e2); if (l1 < l2) l1 = l2; strdump(e1, v1, l1, utf8); @@ -746,6 +747,8 @@ assertion_equal_mem(const char *file, in assertion_count(file, line); if (v1 == v2 || (v1 != NULL && v2 != NULL && memcmp(v1, v2, l) == 0)) return (1); + if (v1 == NULL || v2 == NULL) + return (0); failure_start(file, line, "%s != %s", e1, e2); logprintf(" size %s = %d\n", ld, (int)l); @@ -839,9 +842,14 @@ assertion_equal_file(const char *filenam f1 = fopen(fn1, "rb"); f2 = fopen(fn2, "rb"); + if (f1 == NULL || f2 == NULL) { + if (f1) fclose(f1); + if (f2) fclose(f2); + return (0); + } for (;;) { - n1 = fread(buff1, 1, sizeof(buff1), f1); - n2 = fread(buff2, 1, sizeof(buff2), f2); + n1 = (int)fread(buff1, 1, sizeof(buff1), f1); + n2 = (int)fread(buff2, 1, sizeof(buff2), f2); if (n1 != n2) break; if (n1 == 0 && n2 == 0) { @@ -915,7 +923,7 @@ assertion_file_contents(const char *file return (0); } contents = malloc(s * 2); - n = fread(contents, 1, s * 2, f); + n = (int)fread(contents, 1, s * 2, f); fclose(f); if (n == s && memcmp(buff, contents, s) == 0) { free(contents); @@ -951,9 +959,9 @@ assertion_text_file_contents(const char failure_finish(NULL); return (0); } - s = strlen(buff); + s = (int)strlen(buff); contents = malloc(s * 2 + 128); - n = fread(contents, 1, s * 2 + 128 - 1, f); + n = (int)fread(contents, 1, s * 2 + 128 - 1, f); if (n >= 0) contents[n] = '\0'; fclose(f); @@ -1004,8 +1012,8 @@ assertion_file_contains_lines_any_order( char *buff; size_t buff_size; size_t expected_count, actual_count, i, j; - char **expected; - char *p, **actual; + char **expected = NULL; + char *p, **actual = NULL; char c; int expected_failure = 0, actual_failure = 0; @@ -1018,14 +1026,21 @@ assertion_file_contains_lines_any_order( return (0); } - /* Make a copy of the provided lines and count up the expected file size. */ - expected_count = 0; + /* Make a copy of the provided lines and count up the expected + * file size. */ for (i = 0; lines[i] != NULL; ++i) { } expected_count = i; - expected = malloc(sizeof(char *) * expected_count); - for (i = 0; lines[i] != NULL; ++i) { - expected[i] = strdup(lines[i]); + if (expected_count) { + expected = malloc(sizeof(char *) * expected_count); + if (expected == NULL) { + failure_start(pathname, line, "Can't allocate memory"); + failure_finish(NULL); + return (0); + } + for (i = 0; lines[i] != NULL; ++i) { + expected[i] = strdup(lines[i]); + } } /* Break the file into lines */ @@ -1037,11 +1052,19 @@ assertion_file_contains_lines_any_order( ++actual_count; c = *p; } - actual = malloc(sizeof(char *) * actual_count); - for (j = 0, p = buff; p < buff + buff_size; p += 1 + strlen(p)) { - if (*p != '\0') { - actual[j] = p; - ++j; + if (actual_count) { + actual = calloc(sizeof(char *), actual_count); + if (actual == NULL) { + failure_start(pathname, line, "Can't allocate memory"); + failure_finish(NULL); + free(expected); + return (0); + } + for (j = 0, p = buff; p < buff + buff_size; p += 1 + strlen(p)) { + if (*p != '\0') { + actual[j] = p; + ++j; + } } } @@ -1176,11 +1199,11 @@ assertion_file_time(const char *file, in #if defined(_WIN32) && !defined(__CYGWIN__) #define EPOC_TIME (116444736000000000ULL) - FILETIME ftime, fbirthtime, fatime, fmtime; + FILETIME fxtime, fbirthtime, fatime, fmtime; ULARGE_INTEGER wintm; HANDLE h; - ftime.dwLowDateTime = 0; - ftime.dwHighDateTime = 0; + fxtime.dwLowDateTime = 0; + fxtime.dwHighDateTime = 0; assertion_count(file, line); /* Note: FILE_FLAG_BACKUP_SEMANTICS applies to open @@ -1195,9 +1218,9 @@ assertion_file_time(const char *file, in } r = GetFileTime(h, &fbirthtime, &fatime, &fmtime); switch (type) { - case 'a': ftime = fatime; break; - case 'b': ftime = fbirthtime; break; - case 'm': ftime = fmtime; break; + case 'a': fxtime = fatime; break; + case 'b': fxtime = fbirthtime; break; + case 'm': fxtime = fmtime; break; } CloseHandle(h); if (r == 0) { @@ -1205,8 +1228,8 @@ assertion_file_time(const char *file, in failure_finish(NULL); return (0); } - wintm.LowPart = ftime.dwLowDateTime; - wintm.HighPart = ftime.dwHighDateTime; + wintm.LowPart = fxtime.dwLowDateTime; + wintm.HighPart = fxtime.dwHighDateTime; filet = (wintm.QuadPart - EPOC_TIME) / 10000000; filet_nsec = ((wintm.QuadPart - EPOC_TIME) % 10000000) * 100; nsec = (nsec / 100) * 100; /* Round the request */ @@ -1834,15 +1857,45 @@ canSymlink(void) return (value); } -/* - * Can this platform run the gzip program? - */ /* Platform-dependent options for hiding the output of a subcommand. */ #if defined(_WIN32) && !defined(__CYGWIN__) static const char *redirectArgs = ">NUL 2>NUL"; /* Win32 cmd.exe */ #else static const char *redirectArgs = ">/dev/null 2>/dev/null"; /* POSIX 'sh' */ #endif +/* + * Can this platform run the bzip2 program? + */ +int +canBzip2(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("bzip2 -d -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the grzip program? + */ +int +canGrzip(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("grzip -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the gzip program? + */ int canGzip(void) { @@ -1856,15 +1909,75 @@ canGzip(void) } /* - * Can this platform run the gunzip program? + * Can this platform run the lrzip program? */ int -canGunzip(void) +canLrzip(void) { static int tested = 0, value = 0; if (!tested) { tested = 1; - if (systemf("gunzip -V %s", redirectArgs) == 0) + if (systemf("lrzip -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the lzip program? + */ +int +canLzip(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("lzip -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the lzma program? + */ +int +canLzma(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("lzma -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the lzop program? + */ +int +canLzop(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("lzop -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the xz program? + */ +int +canXz(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("xz -V %s", redirectArgs) == 0) value = 1; } return (value); @@ -2124,7 +2237,7 @@ is_LargeInode(const char *file) /* Use "list.h" to create a list of all tests (functions and names). */ #undef DEFINE_TEST #define DEFINE_TEST(n) { n, #n, 0 }, -struct { void (*func)(void); const char *name; int failures; } tests[] = { +struct test_list_t tests[] = { #include "list.h" }; @@ -2377,65 +2490,6 @@ success: return strdup(buff); } -static int -get_test_set(int *test_set, int limit, const char *test) -{ - int start, end; - int idx = 0; - - if (test == NULL) { - /* Default: Run all tests. */ - for (;idx < limit; idx++) - test_set[idx] = idx; - return (limit); - } - if (*test >= '0' && *test <= '9') { - const char *vp = test; - start = 0; - while (*vp >= '0' && *vp <= '9') { - start *= 10; - start += *vp - '0'; - ++vp; - } - if (*vp == '\0') { - end = start; - } else if (*vp == '-') { - ++vp; - if (*vp == '\0') { - end = limit - 1; - } else { - end = 0; - while (*vp >= '0' && *vp <= '9') { - end *= 10; - end += *vp - '0'; - ++vp; - } - } - } else - return (-1); - if (start < 0 || end >= limit || start > end) - return (-1); - while (start <= end) - test_set[idx++] = start++; - } else { - size_t len = strlen(test); - for (start = 0; start < limit; ++start) { - const char *name = tests[start].name; - const char *p; - - while ((p = strchr(name, test[0])) != NULL) { - if (strncmp(p, test, len) == 0) { - test_set[idx++] = start; - break; - } else - name = p + 1; - } - - } - } - return ((idx == 0)?-1:idx); -} - int main(int argc, char **argv) { @@ -2720,10 +2774,11 @@ main(int argc, char **argv) do { int test_num; - test_num = get_test_set(test_set, limit, *argv); + test_num = get_test_set(test_set, limit, *argv, tests); if (test_num < 0) { printf("*** INVALID Test %s\n", *argv); free(refdir_alloc); + free(testprogdir); usage(progname); return (1); } Modified: head/contrib/libarchive/cpio/test/test.h ============================================================================== --- head/contrib/libarchive/cpio/test/test.h Fri Mar 22 13:34:22 2013 (r248615) +++ head/contrib/libarchive/cpio/test/test.h Fri Mar 22 13:36:03 2013 (r248616) @@ -266,11 +266,29 @@ void sleepUntilAfter(time_t); /* Return true if this platform can create symlinks. */ int canSymlink(void); +/* Return true if this platform can run the "bzip2" program. */ +int canBzip2(void); + +/* Return true if this platform can run the "grzip" program. */ +int canGrzip(void); + /* Return true if this platform can run the "gzip" program. */ int canGzip(void); -/* Return true if this platform can run the "gunzip" program. */ -int canGunzip(void); +/* Return true if this platform can run the "lrzip" program. */ +int canLrzip(void); + +/* Return true if this platform can run the "lzip" program. */ +int canLzip(void); + +/* Return true if this platform can run the "lzma" program. */ +int canLzma(void); + +/* Return true if this platform can run the "lzop" program. */ +int canLzop(void); + +/* Return true if this platform can run the "xz" program. */ +int canXz(void); /* Return true if this filesystem can handle nodump flags. */ int canNodump(void); Modified: head/contrib/libarchive/cpio/test/test_basic.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_basic.c Fri Mar 22 13:34:22 2013 (r248615) +++ head/contrib/libarchive/cpio/test/test_basic.c Fri Mar 22 13:36:03 2013 (r248616) @@ -148,7 +148,7 @@ DEFINE_TEST(test_basic) strncat(result, "bsdcpio: file: large inode number truncated: " "Numerical result out of range\n", - sizeof(result) - strlen(result)); + sizeof(result) - strlen(result) -1); /* hardlink to above file. */ assertMakeHardlink("linkfile", "file"); @@ -157,7 +157,7 @@ DEFINE_TEST(test_basic) strncat(result, "bsdcpio: linkfile: large inode number truncated: " "Numerical result out of range\n", - sizeof(result) - strlen(result)); + sizeof(result) - strlen(result) -1); /* Symlink to above file. */ if (canSymlink()) { @@ -167,7 +167,7 @@ DEFINE_TEST(test_basic) strncat(result, "bsdcpio: symlink: large inode number truncated: " "Numerical result out of range\n", - sizeof(result) - strlen(result)); + sizeof(result) - strlen(result) -1); } /* Another file with different permissions. */ @@ -177,7 +177,7 @@ DEFINE_TEST(test_basic) strncat(result, "bsdcpio: file2: large inode number truncated: " "Numerical result out of range\n", - sizeof(result) - strlen(result)); + sizeof(result) - strlen(result) -1); /* Directory. */ assertMakeDir("dir", 0775); @@ -186,8 +186,8 @@ DEFINE_TEST(test_basic) strncat(result, "bsdcpio: dir: large inode number truncated: " "Numerical result out of range\n", - sizeof(result) - strlen(result)); - strncat(result, "2 blocks\n", sizeof(result) - strlen(result)); + sizeof(result) - strlen(result) -1); + strncat(result, "2 blocks\n", sizeof(result) - strlen(result) -1); /* All done. */ fclose(filelist); Copied: head/contrib/libarchive/cpio/test/test_extract.cpio.Z.uu (from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.Z.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/cpio/test/test_extract.cpio.Z.uu Fri Mar 22 13:36:03 2013 (r248616, copy of r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.Z.uu) @@ -0,0 +1,7 @@ +begin 664 test_extract.cpio.Z +M'YV0,&X$'`B#!@P8,0XJC)$0A@T;!A'>J+%PHL*%%P_&D`%CAHP;!F7,B*C0 +M1L:+(LVD85,F!H`Q;]S0*2-S#H@W9D"H9!G#A8*!`@46U)A11L.'$6-8U+CT +M8D.G'#V"A"&#!L6+)D\>3+FRC(R7,6?6O)ESIU>?0`EJ7/'D!4# +` +end Copied: head/contrib/libarchive/cpio/test/test_extract.cpio.bz2.uu (from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.bz2.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/cpio/test/test_extract.cpio.bz2.uu Fri Mar 22 13:36:03 2013 (r248616, copy of r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.bz2.uu) @@ -0,0 +1,7 @@ +begin 664 test_extract.cpio.bz2 +M0EIH.3%!629365?=.4@``#G_@G*0(`#@`7^`(B04``LEC```!"``E`E(>I,H +M::'J&@_4C3:@E$AD#0&@&@%"E;V/1!XIP>#C9T[41`4PQ1A`@S*4F&BD@B0T +MBA$$-:\/@BQGNKU1G@%#`G+N0R%$JTHG(XBRB%1$V8F4#F_IWT=S4+ERVL(? +40V!'@1L4+AO_B[DBG"A(*^Z0,#J&)3G"\^YE?X_' +M_K._F':0[`DL%IQ=<,Z-JH>V$S,?.[`&42C7]J^XQ@9OY!Z$!$^JLQPKZU[: +/!M,+.$MY:Y(HS<<]U`&` +` +end Copied: head/contrib/libarchive/cpio/test/test_extract.cpio.gz.uu (from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.gz.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/cpio/test/test_extract.cpio.gz.uu Fri Mar 22 13:36:03 2013 (r248616, copy of r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.gz.uu) @@ -0,0 +1,7 @@ +begin 664 test_extract.cpio.gz +M'XL("`5X2FE=2K)"? +MI@`6T>,R0+?$B$A+3$RQ6F*$88D1PA*"P!"[J#$2)R3(T=/'-4A149%AF`,` +(305ZBP`"```` +` +end Copied: head/contrib/libarchive/cpio/test/test_extract.cpio.lrz.uu (from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.lrz.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/cpio/test/test_extract.cpio.lrz.uu Fri Mar 22 13:36:03 2013 (r248616, copy of r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.lrz.uu) @@ -0,0 +1,8 @@ +begin 664 test_extract.cpio.lrz +M3%):20`&``(``````````%T````!`0```@$`$`,`````#@`#`````"\``QH` +M&@````!W``$G`&4``#,``2(``0``#0$````U<-`Y!F$`MP$````8#=\$8#<1 +MR/BL39$D4M>["H7&@4%L/4*_(*VGB*YU>?RX.9]HL86'.A)H@Y;Z\^$?M^8_ +M!/-;62G.*7*A&A!_ENZ8$7]O-M7_.FTRC%BCGC95:6'9ZH3)QSCR4RX42P!` +/-E>/7"L[:OY"/A924S4$ +` +end Copied: head/contrib/libarchive/cpio/test/test_extract.cpio.lz.uu (from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.lz.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/cpio/test/test_extract.cpio.lz.uu Fri Mar 22 13:36:03 2013 (r248616, copy of r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.lz.uu) @@ -0,0 +1,6 @@ +begin 664 test_extract.cpio.lz +M3%I)4`$,`!@-WP1@-Q'(^*Q-D212U[L*A<:!06P]0K\@K:>(KG5Y_+@YGVBQ +MA8;_>8N3MLP="$0SJ#QKYB?@8 +G]@'$$7\&W^T*+9?6B=?__M$G@$T%>HL``@```````($````````` +` +end Copied: head/contrib/libarchive/cpio/test/test_extract.cpio.lzma.uu (from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.lzma.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/cpio/test/test_extract.cpio.lzma.uu Fri Mar 22 13:36:03 2013 (r248616, copy of r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.lzma.uu) @@ -0,0 +1,6 @@ +begin 664 test_extract.cpio.lzma +M70``@`#__________P`8#=\$8#<1R/BL39$D4M>["H7&@4%L/4*_(*VGB*YU +M>?RX.9]HL86'.A)H@Y;Z\^$?M^8_!/-;62G.*7*A&A!_HGF_WF+D[;.+!OW3 +:T_2I)V(;K[FNL#'W%T+L;ATS`A*3__[1Z``` +` +end Copied: head/contrib/libarchive/cpio/test/test_extract.cpio.lzo.uu (from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.lzo.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/cpio/test/test_extract.cpio.lzo.uu Fri Mar 22 13:36:03 2013 (r248616, copy of r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.lzo.uu) @@ -0,0 +1,9 @@ +begin 664 test_extract.cpio.lzo +MB4Q:3P`-"AH*$#`@8`E``04#```!``"!M%!R>-T`````$71E`$#-S4P,#`QE`!@`7`#"C`P,3(P,S(W-#`R,S2!`C:4`'````(R,V9I;&4Q +M`&-O;G1E;G1S(&]F((8"+@HOD0$R(`:1`31J$#`P+I$!,B^1`3(HD`%L$3L, +M`+P<+HH`,3,I1``(5%)!24Q%4B$A(0`@JP````$````````````````````` +*````$0`````````` +` +end Copied: head/contrib/libarchive/cpio/test/test_extract.cpio.xz.uu (from r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.xz.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/cpio/test/test_extract.cpio.xz.uu Fri Mar 22 13:36:03 2013 (r248616, copy of r248590, vendor/libarchive/dist/cpio/test/test_extract.cpio.xz.uu) @@ -0,0 +1,7 @@ +begin 664 test_extract.cpio.xz +M_3=Z6%H```3FUK1&`@`A`18```!T+^6CX`'_`&%=`!@-WP1@-Q'(^*Q-D212 +MU[L*A<:!06P]0K\@K:>(KG5Y_+@YGVBQA8;_>8N3MLXL&_=/3]*DG8ANON:ZP,?<70NQN'3"CP@``````J9FA +=#1$]4L<``7V`!`````?M;4JQQ&?[`@`````$65H` +` +end Copied: head/contrib/libarchive/cpio/test/test_extract_cpio_Z.c (from r248590, vendor/libarchive/dist/cpio/test/test_extract_cpio_Z.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/cpio/test/test_extract_cpio_Z.c Fri Mar 22 13:36:03 2013 (r248616, copy of r248590, vendor/libarchive/dist/cpio/test/test_extract_cpio_Z.c) @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2012 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_extract_cpio_Z) +{ + const char *reffile = "test_extract.cpio.Z"; + + extract_reference_file(reffile); + assertEqualInt(0, systemf("%s -i < %s >test.out 2>test.err", + testprog, reffile)); + + assertFileExists("file1"); + assertTextFileContents("contents of file1.\n", "file1"); + assertFileExists("file2"); + assertTextFileContents("contents of file2.\n", "file2"); + assertEmptyFile("test.out"); + assertTextFileContents("1 block\n", "test.err"); +} Copied: head/contrib/libarchive/cpio/test/test_extract_cpio_bz2.c (from r248590, vendor/libarchive/dist/cpio/test/test_extract_cpio_bz2.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/cpio/test/test_extract_cpio_bz2.c Fri Mar 22 13:36:03 2013 (r248616, copy of r248590, vendor/libarchive/dist/cpio/test/test_extract_cpio_bz2.c) @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 2012 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_extract_cpio_bz2) +{ + const char *reffile = "test_extract.cpio.bz2"; + int f; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 14:10:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4F8C558C; Fri, 22 Mar 2013 14:10:16 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2711EE1C; Fri, 22 Mar 2013 14:10:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2MEAGoF066930; Fri, 22 Mar 2013 14:10:16 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2MEAFmW066927; Fri, 22 Mar 2013 14:10:15 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201303221410.r2MEAFmW066927@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Fri, 22 Mar 2013 14:10:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248617 - in head: secure/libexec/ssh-keysign share/examples/etc share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 14:10:16 -0000 Author: des Date: Fri Mar 22 14:10:15 2013 New Revision: 248617 URL: http://svnweb.freebsd.org/changeset/base/248617 Log: Retire the mislabeled ENABLE_SUID_SSH knob. Modified: head/secure/libexec/ssh-keysign/Makefile head/share/examples/etc/make.conf head/share/man/man5/make.conf.5 Modified: head/secure/libexec/ssh-keysign/Makefile ============================================================================== --- head/secure/libexec/ssh-keysign/Makefile Fri Mar 22 13:36:03 2013 (r248616) +++ head/secure/libexec/ssh-keysign/Makefile Fri Mar 22 14:10:15 2013 (r248617) @@ -4,9 +4,7 @@ PROG= ssh-keysign SRCS= ssh-keysign.c readconf.c roaming_dummy.c MAN= ssh-keysign.8 CFLAGS+=-I${SSHDIR} -include ssh_namespace.h -.if defined(ENABLE_SUID_SSH) -BINMODE=4511 -.endif +BINMODE=4555 DPADD= ${LIBSSH} ${LIBCRYPT} ${LIBCRYPTO} ${LIBZ} LDADD= -lssh -lcrypt -lcrypto -lz Modified: head/share/examples/etc/make.conf ============================================================================== --- head/share/examples/etc/make.conf Fri Mar 22 13:36:03 2013 (r248616) +++ head/share/examples/etc/make.conf Fri Mar 22 14:10:15 2013 (r248617) @@ -102,9 +102,6 @@ # Mtree will follow symlinks. #MTREE_FOLLOWS_SYMLINKS= -L # -# To enable installing ssh(1) with the setuid bit turned on. -#ENABLE_SUID_SSH= -# # To enable installing newgrp(1) with the setuid bit turned on. # Without the setuid bit, newgrp cannot change users' groups. #ENABLE_SUID_NEWGRP= Modified: head/share/man/man5/make.conf.5 ============================================================================== --- head/share/man/man5/make.conf.5 Fri Mar 22 13:36:03 2013 (r248616) +++ head/share/man/man5/make.conf.5 Fri Mar 22 14:10:15 2013 (r248617) @@ -454,11 +454,6 @@ with the set-user-ID bit set. Otherwise, .Xr newgrp 1 will not be able to change users' groups. -.It Va ENABLE_SUID_SSH -.Pq Vt bool -Set this to install -.Xr ssh 1 -with the set-user-ID bit turned on. .It Va LOADER_TFTP_SUPPORT .Pq Vt bool By default the From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 17:55:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 35CDF70; Fri, 22 Mar 2013 17:55:41 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 25D4D2DE; Fri, 22 Mar 2013 17:55:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2MHteCf048030; Fri, 22 Mar 2013 17:55:40 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2MHtdY7048017; Fri, 22 Mar 2013 17:55:39 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201303221755.r2MHtdY7048017@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Fri, 22 Mar 2013 17:55:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248619 - in head: crypto/openssh crypto/openssh/openbsd-compat crypto/openssh/scard secure/lib/libssh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 17:55:41 -0000 Author: des Date: Fri Mar 22 17:55:38 2013 New Revision: 248619 URL: http://svnweb.freebsd.org/changeset/base/248619 Log: Upgrade to OpenSSH 6.2p1. The most important new features are support for a key revocation list and more fine-grained authentication control. Added: head/crypto/openssh/PROTOCOL.krl - copied unchanged from r248613, vendor-crypto/openssh/dist/PROTOCOL.krl head/crypto/openssh/krl.c - copied unchanged from r248613, vendor-crypto/openssh/dist/krl.c head/crypto/openssh/krl.h - copied unchanged from r248613, vendor-crypto/openssh/dist/krl.h head/crypto/openssh/openbsd-compat/bsd-setres_id.c - copied unchanged from r248613, vendor-crypto/openssh/dist/openbsd-compat/bsd-setres_id.c head/crypto/openssh/openbsd-compat/bsd-setres_id.h - copied unchanged from r248613, vendor-crypto/openssh/dist/openbsd-compat/bsd-setres_id.h head/crypto/openssh/openbsd-compat/strtoull.c - copied unchanged from r248613, vendor-crypto/openssh/dist/openbsd-compat/strtoull.c head/crypto/openssh/scard/ - copied from r248613, vendor-crypto/openssh/dist/scard/ head/crypto/openssh/umac128.c (contents, props changed) Deleted: head/crypto/openssh/acss.c head/crypto/openssh/acss.h head/crypto/openssh/cipher-acss.c Modified: head/crypto/openssh/ChangeLog head/crypto/openssh/INSTALL head/crypto/openssh/PROTOCOL head/crypto/openssh/PROTOCOL.agent head/crypto/openssh/README head/crypto/openssh/auth-options.c head/crypto/openssh/auth-rsa.c head/crypto/openssh/auth.c head/crypto/openssh/auth.h head/crypto/openssh/auth1.c head/crypto/openssh/auth2-chall.c head/crypto/openssh/auth2-gss.c head/crypto/openssh/auth2-jpake.c head/crypto/openssh/auth2-pubkey.c head/crypto/openssh/auth2.c head/crypto/openssh/authfile.c head/crypto/openssh/channels.c head/crypto/openssh/cipher-aes.c head/crypto/openssh/cipher-ctr.c head/crypto/openssh/cipher.c head/crypto/openssh/cipher.h head/crypto/openssh/clientloop.c head/crypto/openssh/clientloop.h head/crypto/openssh/compat.c head/crypto/openssh/config.h head/crypto/openssh/config.h.in head/crypto/openssh/defines.h head/crypto/openssh/includes.h head/crypto/openssh/kex.c head/crypto/openssh/kex.h head/crypto/openssh/key.c head/crypto/openssh/key.h head/crypto/openssh/log.c head/crypto/openssh/log.h head/crypto/openssh/loginrec.c head/crypto/openssh/mac.c head/crypto/openssh/moduli head/crypto/openssh/moduli.5 head/crypto/openssh/monitor.c head/crypto/openssh/monitor.h head/crypto/openssh/monitor_wrap.c head/crypto/openssh/mux.c head/crypto/openssh/myproposal.h head/crypto/openssh/openbsd-compat/bsd-misc.c head/crypto/openssh/openbsd-compat/bsd-misc.h head/crypto/openssh/openbsd-compat/openbsd-compat.h head/crypto/openssh/openbsd-compat/openssl-compat.h head/crypto/openssh/openbsd-compat/sys-queue.h head/crypto/openssh/openbsd-compat/sys-tree.h head/crypto/openssh/openbsd-compat/vis.c head/crypto/openssh/openbsd-compat/vis.h head/crypto/openssh/packet.c head/crypto/openssh/platform.c head/crypto/openssh/platform.h head/crypto/openssh/scp.1 head/crypto/openssh/scp.c head/crypto/openssh/servconf.c head/crypto/openssh/servconf.h head/crypto/openssh/serverloop.c head/crypto/openssh/session.c head/crypto/openssh/sftp-server.8 head/crypto/openssh/sftp-server.c head/crypto/openssh/sftp.1 head/crypto/openssh/sftp.c head/crypto/openssh/ssh-add.1 head/crypto/openssh/ssh-add.c head/crypto/openssh/ssh-gss.h head/crypto/openssh/ssh-keygen.1 head/crypto/openssh/ssh-keygen.c head/crypto/openssh/ssh-keyscan.1 head/crypto/openssh/ssh.1 head/crypto/openssh/ssh_config head/crypto/openssh/ssh_config.5 head/crypto/openssh/ssh_namespace.h head/crypto/openssh/sshconnect.c head/crypto/openssh/sshconnect2.c head/crypto/openssh/sshd.8 head/crypto/openssh/sshd.c head/crypto/openssh/sshd_config head/crypto/openssh/sshd_config.5 head/crypto/openssh/uidswap.c head/crypto/openssh/umac.c head/crypto/openssh/umac.h head/crypto/openssh/version.h head/secure/lib/libssh/Makefile Directory Properties: head/crypto/openssh/ (props changed) Modified: head/crypto/openssh/ChangeLog ============================================================================== --- head/crypto/openssh/ChangeLog Fri Mar 22 16:44:15 2013 (r248618) +++ head/crypto/openssh/ChangeLog Fri Mar 22 17:55:38 2013 (r248619) @@ -1,3 +1,673 @@ +20120322 + - (djm) [contrib/ssh-copy-id contrib/ssh-copy-id.1] Updated to Phil + Hands' greatly revised version. + - (djm) Release 6.2p1 + +20120318 + - (djm) [configure.ac log.c scp.c sshconnect2.c openbsd-compat/vis.c] + [openbsd-compat/vis.h] FreeBSD's strnvis isn't compatible with OpenBSD's + so mark it as broken. Patch from des AT des.no + +20120317 + - (tim) [configure.ac] OpenServer 5 wants lastlog even though it has none + of the bits the configure test looks for. + +20120316 + - (djm) [configure.ac] Disable utmp, wtmp and/or lastlog if the platform + is unable to successfully compile them. Based on patch from des AT + des.no + - (djm) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h] + Add a usleep replacement for platforms that lack it; ok dtucker + - (djm) [session.c] FreeBSD needs setusercontext(..., LOGIN_SETUMASK) to + occur after UID switch; patch from John Marshall via des AT des.no; + ok dtucker@ + +20120312 + - (dtucker) [regress/Makefile regress/cipher-speed.sh regress/test-exec.sh] + Improve portability of cipher-speed test, based mostly on a patch from + Iain Morgan. + - (dtucker) [auth.c configure.ac platform.c platform.h] Accept uid 2 ("bin") + in addition to root as an owner of system directories on AIX and HP-UX. + ok djm@ + +20130307 + - (dtucker) [INSTALL] Bump documented autoconf version to what we're + currently using. + - (dtucker) [defines.h] Remove SIZEOF_CHAR bits since the test for it + was removed in configure.ac rev 1.481 as it was redundant. + - (tim) [Makefile.in] Add another missing $(EXEEXT) I should have seen 3 days + ago. + - (djm) [configure.ac] Add a timeout to the select/rlimit test to give it a + chance to complete on broken systems; ok dtucker@ + +20130306 + - (dtucker) [regress/forward-control.sh] Wait longer for the forwarding + connection to start so that the test works on slower machines. + - (dtucker) [configure.ac] test that we can set number of file descriptors + to zero with setrlimit before enabling the rlimit sandbox. This affects + (at least) HPUX 11.11. + +20130305 + - (djm) [regress/modpipe.c] Compilation fix for AIX and parsing fix for + HP/UX. Spotted by Kevin Brott + - (dtucker) [configure.ac] use "=" for shell test and not "==". Spotted by + Amit Kulkarni and Kevin Brott. + - (dtucker) [Makefile.in] Remove trailing "\" on PATHS, which caused obscure + build breakage on (at least) HP-UX 11.11. Found by Amit Kulkarni and Kevin + Brott. + - (tim) [Makefile.in] Add missing $(EXEEXT). Found by Roumen Petrov. + +20130227 + - (djm) [README contrib/caldera/openssh.spec contrib/redhat/openssh.spec] + [contrib/suse/openssh.spec] Crank version numbers + - (tim) [regress/forward-control.sh] use sh in case login shell is csh. + - (tim) [regress/integrity.sh] shell portability fix. + - (tim) [regress/integrity.sh] keep old solaris awk from hanging. + - (tim) [regress/krl.sh] keep old solaris awk from hanging. + +20130226 + - OpenBSD CVS Sync + - djm@cvs.openbsd.org 2013/02/20 08:27:50 + [integrity.sh] + Add an option to modpipe that warns if the modification offset it not + reached in it's stream and turn it on for t-integrity. This should catch + cases where the session is not fuzzed for being too short (cf. my last + "oops" commit) + - (djm) [regress/integrity.sh] Run sshd via $SUDO; fixes tinderbox breakage + for UsePAM=yes configuration + +20130225 + - (dtucker) [configure.ac ssh-gss.h] bz#2073: additional #includes needed + to use Solaris native GSS libs. Patch from Pierre Ossman. + +20130223 + - (djm) [configure.ac includes.h loginrec.c mux.c sftp.c] Prefer + bsd/libutil.h to libutil.h to avoid deprecation warnings on Ubuntu. + ok tim + +20130222 + - (dtucker) [Makefile.in configure.ac] bz#2072: don't link krb5 libs to + ssh(1) since they're not needed. Patch from Pierre Ossman, ok djm. + - (dtucker) [configure.ac] bz#2073: look for Solaris' differently-named + libgss too. Patch from Pierre Ossman, ok djm. + - (djm) [configure.ac sandbox-seccomp-filter.c] Support for Linux + seccomp-bpf sandbox on ARM. Patch from shawnlandden AT gmail.com; + ok dtucker + +20130221 + - (tim) [regress/forward-control.sh] shell portability fix. + +20130220 + - (tim) [regress/cipher-speed.sh regress/try-ciphers.sh] shell portability fix. + - (tim) [krl.c Makefile.in regress/Makefile regress/modpipe.c] remove unneeded + err.h include from krl.c. Additional portability fixes for modpipe. OK djm + - OpenBSD CVS Sync + - djm@cvs.openbsd.org 2013/02/20 08:27:50 + [regress/integrity.sh regress/modpipe.c] + Add an option to modpipe that warns if the modification offset it not + reached in it's stream and turn it on for t-integrity. This should catch + cases where the session is not fuzzed for being too short (cf. my last + "oops" commit) + - djm@cvs.openbsd.org 2013/02/20 08:29:27 + [regress/modpipe.c] + s/Id/OpenBSD/ in RCS tag + +20130219 + - OpenBSD CVS Sync + - djm@cvs.openbsd.org 2013/02/18 22:26:47 + [integrity.sh] + crank the offset yet again; it was still fuzzing KEX one of Darren's + portable test hosts at 2800 + - djm@cvs.openbsd.org 2013/02/19 02:14:09 + [integrity.sh] + oops, forgot to increase the output of the ssh command to ensure that + we actually reach $offset + - (djm) [regress/integrity.sh] Skip SHA2-based MACs on configurations that + lack support for SHA2. + - (djm) [regress/modpipe.c] Add local err, and errx functions for platforms + that do not have them. + +20130217 + - OpenBSD CVS Sync + - djm@cvs.openbsd.org 2013/02/17 23:16:55 + [integrity.sh] + make the ssh command generates some output to ensure that there are at + least offset+tries bytes in the stream. + +20130216 + - OpenBSD CVS Sync + - djm@cvs.openbsd.org 2013/02/16 06:08:45 + [integrity.sh] + make sure the fuzz offset is actually past the end of KEX for all KEX + types. diffie-hellman-group-exchange-sha256 requires an offset around + 2700. Noticed via test failures in portable OpenSSH on platforms that + lack ECC and this the more byte-frugal ECDH KEX algorithms. + +20130215 + - (djm) [contrib/suse/rc.sshd] Use SSHD_BIN consistently; bz#2056 from + Iain Morgan + - (dtucker) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h] + Use getpgrp() if we don't have getpgid() (old BSDs, maybe others). + - (dtucker) [configure.ac openbsd-compat/Makefile.in openbsd-compat/strtoull.c + openbsd-compat/openbsd-compat.h] Add strtoull to compat library for + platforms that don't have it. + - (dtucker) [openbsd-compat/openbsd-compat.h] Add prototype for strtoul, + group strto* function prototypes together. + - (dtucker) [openbsd-compat/bsd-misc.c] Handle the case where setpgrp() takes + an argument. Pointed out by djm. + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2013/02/14 21:35:59 + [auth2-pubkey.c] + Correct error message that had a typo and was logging the wrong thing; + patch from Petr Lautrbach + - dtucker@cvs.openbsd.org 2013/02/15 00:21:01 + [sshconnect2.c] + Warn more loudly if an IdentityFile provided by the user cannot be read. + bz #1981, ok djm@ + +20130214 + - (djm) [regress/krl.sh] Don't use ecdsa keys in environment that lack ECC. + - (djm) [regress/krl.sh] typo; found by Iain Morgan + - (djm) [regress/integrity.sh] Start fuzzing from offset 2500 (instead + of 2300) to avoid clobbering the end of (non-MAC'd) KEX. Verified by + Iain Morgan + +20130212 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2013/01/24 21:45:37 + [krl.c] + fix handling of (unused) KRL signatures; skip string in correct buffer + - djm@cvs.openbsd.org 2013/01/24 22:08:56 + [krl.c] + skip serial lookup when cert's serial number is zero + - krw@cvs.openbsd.org 2013/01/25 05:00:27 + [krl.c] + Revert last. Breaks due to likely typo. Let djm@ fix later. + ok djm@ via dlg@ + - djm@cvs.openbsd.org 2013/01/25 10:22:19 + [krl.c] + redo last commit without the vi-vomit that snuck in: + skip serial lookup when cert's serial number is zero + (now with 100% better comment) + - djm@cvs.openbsd.org 2013/01/26 06:11:05 + [Makefile.in acss.c acss.h cipher-acss.c cipher.c] + [openbsd-compat/openssl-compat.h] + remove ACSS, now that it is gone from libcrypto too + - djm@cvs.openbsd.org 2013/01/27 10:06:12 + [krl.c] + actually use the xrealloc() return value; spotted by xi.wang AT gmail.com + - dtucker@cvs.openbsd.org 2013/02/06 00:20:42 + [servconf.c sshd_config sshd_config.5] + Change default of MaxStartups to 10:30:100 to start doing random early + drop at 10 connections up to 100 connections. This will make it harder + to DoS as CPUs have come a long way since the original value was set + back in 2000. Prompted by nion at debian org, ok markus@ + - dtucker@cvs.openbsd.org 2013/02/06 00:22:21 + [auth.c] + Fix comment, from jfree.e1 at gmail + - djm@cvs.openbsd.org 2013/02/08 00:41:12 + [sftp.c] + fix NULL deref when built without libedit and control characters + entered as command; debugging and patch from Iain Morgan an + Loganaden Velvindron in bz#1956 + - markus@cvs.openbsd.org 2013/02/10 21:19:34 + [version.h] + openssh 6.2 + - djm@cvs.openbsd.org 2013/02/10 23:32:10 + [ssh-keygen.c] + append to moduli file when screening candidates rather than overwriting. + allows resumption of interrupted screen; patch from Christophe Garault + in bz#1957; ok dtucker@ + - djm@cvs.openbsd.org 2013/02/10 23:35:24 + [packet.c] + record "Received disconnect" messages at ERROR rather than INFO priority, + since they are abnormal and result in a non-zero ssh exit status; patch + from Iain Morgan in bz#2057; ok dtucker@ + - dtucker@cvs.openbsd.org 2013/02/11 21:21:58 + [sshd.c] + Add openssl version to debug output similar to the client. ok markus@ + - djm@cvs.openbsd.org 2013/02/11 23:58:51 + [regress/try-ciphers.sh] + remove acss here too + - (djm) [regress/try-ciphers.sh] clean up CVS merge botch + +20130211 + - (djm) [configure.ac openbsd-compat/openssl-compat.h] Repair build on old + libcrypto that lacks EVP_CIPHER_CTX_ctrl + +20130208 + - (djm) [contrib/redhat/sshd.init] treat RETVAL as an integer; + patch from Iain Morgan in bz#2059 + - (dtucker) [configure.ac openbsd-compat/sys-tree.h] Test if compiler allows + __attribute__ on return values and work around if necessary. ok djm@ + +20130207 + - (djm) [configure.ac] Don't probe seccomp capability of running kernel + at configure time; the seccomp sandbox will fall back to rlimit at + runtime anyway. Patch from plautrba AT redhat.com in bz#2011 + +20130120 + - (djm) [cipher-aes.c cipher-ctr.c openbsd-compat/openssl-compat.h] + Move prototypes for replacement ciphers to openssl-compat.h; fix EVP + prototypes for openssl-1.0.0-fips. + - (djm) OpenBSD CVS Sync + - jmc@cvs.openbsd.org 2013/01/18 07:57:47 + [ssh-keygen.1] + tweak previous; + - jmc@cvs.openbsd.org 2013/01/18 07:59:46 + [ssh-keygen.c] + -u before -V in usage(); + - jmc@cvs.openbsd.org 2013/01/18 08:00:49 + [sshd_config.5] + tweak previous; + - jmc@cvs.openbsd.org 2013/01/18 08:39:04 + [ssh-keygen.1] + add -Q to the options list; ok djm + - jmc@cvs.openbsd.org 2013/01/18 21:48:43 + [ssh-keygen.1] + command-line (adj.) -> command line (n.); + - jmc@cvs.openbsd.org 2013/01/19 07:13:25 + [ssh-keygen.1] + fix some formatting; ok djm + - markus@cvs.openbsd.org 2013/01/19 12:34:55 + [krl.c] + RB_INSERT does not remove existing elments; ok djm@ + - (djm) [openbsd-compat/sys-tree.h] Sync with OpenBSD. krl.c needs newer + version. + - (djm) [regress/krl.sh] replacement for jot; most platforms lack it + +20130118 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2013/01/17 23:00:01 + [auth.c key.c key.h ssh-keygen.1 ssh-keygen.c sshd_config.5] + [krl.c krl.h PROTOCOL.krl] + add support for Key Revocation Lists (KRLs). These are a compact way to + represent lists of revoked keys and certificates, taking as little as + a single bit of incremental cost to revoke a certificate by serial number. + KRLs are loaded via the existing RevokedKeys sshd_config option. + feedback and ok markus@ + - djm@cvs.openbsd.org 2013/01/18 00:45:29 + [regress/Makefile regress/cert-userkey.sh regress/krl.sh] + Tests for Key Revocation Lists (KRLs) + - djm@cvs.openbsd.org 2013/01/18 03:00:32 + [krl.c] + fix KRL generation bug for list sections + +20130117 + - (djm) [regress/cipher-speed.sh regress/integrity.sh regress/try-ciphers.sh] + check for GCM support before testing GCM ciphers. + +20130112 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2013/01/12 11:22:04 + [cipher.c] + improve error message for integrity failure in AES-GCM modes; ok markus@ + - djm@cvs.openbsd.org 2013/01/12 11:23:53 + [regress/cipher-speed.sh regress/integrity.sh regress/try-ciphers.sh] + test AES-GCM modes; feedback markus@ + - (djm) [regress/integrity.sh] repair botched merge + +20130109 + - (djm) OpenBSD CVS Sync + - dtucker@cvs.openbsd.org 2012/12/14 05:26:43 + [auth.c] + use correct string in error message; from rustybsd at gmx.fr + - djm@cvs.openbsd.org 2013/01/02 00:32:07 + [clientloop.c mux.c] + channel_setup_local_fwd_listener() returns 0 on failure, not -ve + bz#2055 reported by mathieu.lacage AT gmail.com + - djm@cvs.openbsd.org 2013/01/02 00:33:49 + [PROTOCOL.agent] + correct format description for SSH_AGENTC_ADD_RSA_ID_CONSTRAINED + bz#2051 from david AT lechnology.com + - djm@cvs.openbsd.org 2013/01/03 05:49:36 + [servconf.h] + add a couple of ServerOptions members that should be copied to the privsep + child (for consistency, in this case they happen only to be accessed in + the monitor); ok dtucker@ + - djm@cvs.openbsd.org 2013/01/03 12:49:01 + [PROTOCOL] + fix description of MAC calculation for EtM modes; ok markus@ + - djm@cvs.openbsd.org 2013/01/03 12:54:49 + [sftp-server.8 sftp-server.c] + allow specification of an alternate start directory for sftp-server(8) + "I like this" markus@ + - djm@cvs.openbsd.org 2013/01/03 23:22:58 + [ssh-keygen.c] + allow fingerprinting of keys hosted in PKCS#11 tokens: ssh-keygen -lD ... + ok markus@ + - jmc@cvs.openbsd.org 2013/01/04 19:26:38 + [sftp-server.8 sftp-server.c] + sftp-server.8: add argument name to -d + sftp-server.c: add -d to usage() + ok djm + - markus@cvs.openbsd.org 2013/01/08 18:49:04 + [PROTOCOL authfile.c cipher.c cipher.h kex.c kex.h monitor_wrap.c] + [myproposal.h packet.c ssh_config.5 sshd_config.5] + support AES-GCM as defined in RFC 5647 (but with simpler KEX handling) + ok and feedback djm@ + - djm@cvs.openbsd.org 2013/01/09 05:40:17 + [ssh-keygen.c] + correctly initialise fingerprint type for fingerprinting PKCS#11 keys + - (djm) [cipher.c configure.ac openbsd-compat/openssl-compat.h] + Fix merge botch, automatically detect AES-GCM in OpenSSL, move a little + cipher compat code to openssl-compat.h + +20121217 + - (dtucker) [Makefile.in] Add some scaffolding so that the new regress + tests will work with VPATH directories. + +20121213 + - (djm) OpenBSD CVS Sync + - markus@cvs.openbsd.org 2012/12/12 16:45:52 + [packet.c] + reset incoming_packet buffer for each new packet in EtM-case, too; + this happens if packets are parsed only parially (e.g. ignore + messages sent when su/sudo turn off echo); noted by sthen/millert + - naddy@cvs.openbsd.org 2012/12/12 16:46:10 + [cipher.c] + use OpenSSL's EVP_aes_{128,192,256}_ctr() API and remove our hand-rolled + counter mode code; ok djm@ + - (djm) [configure.ac cipher-ctr.c] Adapt EVP AES CTR change to retain our + compat code for older OpenSSL + - (djm) [cipher.c] Fix missing prototype for compat code + +20121212 + - (djm) OpenBSD CVS Sync + - markus@cvs.openbsd.org 2012/12/11 22:16:21 + [monitor.c] + drain the log messages after receiving the keystate from the unpriv + child. otherwise it might block while sending. ok djm@ + - markus@cvs.openbsd.org 2012/12/11 22:31:18 + [PROTOCOL authfile.c cipher.c cipher.h kex.h mac.c myproposal.h] + [packet.c ssh_config.5 sshd_config.5] + add encrypt-then-mac (EtM) modes to openssh by defining new mac algorithms + that change the packet format and compute the MAC over the encrypted + message (including the packet size) instead of the plaintext data; + these EtM modes are considered more secure and used by default. + feedback and ok djm@ + - sthen@cvs.openbsd.org 2012/12/11 22:51:45 + [mac.c] + fix typo, s/tem/etm in hmac-ripemd160-tem. ok markus@ + - markus@cvs.openbsd.org 2012/12/11 22:32:56 + [regress/try-ciphers.sh] + add etm modes + - markus@cvs.openbsd.org 2012/12/11 22:42:11 + [regress/Makefile regress/modpipe.c regress/integrity.sh] + test the integrity of the packets; with djm@ + - markus@cvs.openbsd.org 2012/12/11 23:12:13 + [try-ciphers.sh] + add hmac-ripemd160-etm@openssh.com + - (djm) [mac.c] fix merge botch + - (djm) [regress/Makefile regress/integrity.sh] Make the integrity.sh test + work on platforms without 'jot' + - (djm) [regress/integrity.sh] Fix awk quoting, packet length skip + - (djm) [regress/Makefile] fix t-exec rule + +20121207 + - (dtucker) OpenBSD CVS Sync + - dtucker@cvs.openbsd.org 2012/12/06 06:06:54 + [regress/keys-command.sh] + Fix some problems with the keys-command test: + - use string comparison rather than numeric comparison + - check for existing KEY_COMMAND file and don't clobber if it exists + - clean up KEY_COMMAND file if we do create it. + - check that KEY_COMMAND is executable (which it won't be if eg /var/run + is mounted noexec). + ok djm. + - jmc@cvs.openbsd.org 2012/12/03 08:33:03 + [ssh-add.1 sshd_config.5] + tweak previous; + - markus@cvs.openbsd.org 2012/12/05 15:42:52 + [ssh-add.c] + prevent double-free of comment; ok djm@ + - dtucker@cvs.openbsd.org 2012/12/07 01:51:35 + [serverloop.c] + Cast signal to int for logging. A no-op on openbsd (they're always ints) + but will prevent warnings in portable. ok djm@ + +20121205 + - (tim) [defines.h] Some platforms are missing ULLONG_MAX. Feedback djm@. + +20121203 + - (djm) [openbsd-compat/sys-queue.h] Sync with OpenBSD to get + TAILQ_FOREACH_SAFE needed for upcoming changes. + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2012/12/02 20:26:11 + [ssh_config.5 sshconnect2.c] + Make IdentitiesOnly apply to keys obtained from a PKCS11Provider. + This allows control of which keys are offered from tokens using + IdentityFile. ok markus@ + - djm@cvs.openbsd.org 2012/12/02 20:42:15 + [ssh-add.1 ssh-add.c] + make deleting explicit keys "ssh-add -d" symmetric with adding keys - + try to delete the corresponding certificate too and respect the -k option + to allow deleting of the key only; feedback and ok markus@ + - djm@cvs.openbsd.org 2012/12/02 20:46:11 + [auth-options.c channels.c servconf.c servconf.h serverloop.c session.c] + [sshd_config.5] + make AllowTcpForwarding accept "local" and "remote" in addition to its + current "yes"/"no" to allow the server to specify whether just local or + remote TCP forwarding is enabled. ok markus@ + - dtucker@cvs.openbsd.org 2012/10/05 02:20:48 + [regress/cipher-speed.sh regress/try-ciphers.sh] + Add umac-128@openssh.com to the list of MACs to be tested + - djm@cvs.openbsd.org 2012/10/19 05:10:42 + [regress/cert-userkey.sh] + include a serial number when generating certs + - djm@cvs.openbsd.org 2012/11/22 22:49:30 + [regress/Makefile regress/keys-command.sh] + regress for AuthorizedKeysCommand; hints from markus@ + - djm@cvs.openbsd.org 2012/12/02 20:47:48 + [Makefile regress/forward-control.sh] + regress for AllowTcpForwarding local/remote; ok markus@ + - djm@cvs.openbsd.org 2012/12/03 00:14:06 + [auth2-chall.c ssh-keygen.c] + Fix compilation with -Wall -Werror (trivial type fixes) + - (djm) [configure.ac] Turn on -g for gcc compilers. Helps pre-installation + debugging. ok dtucker@ + - (djm) [configure.ac] Revert previous. configure.ac already does this + for us. + +20121114 + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2012/11/14 02:24:27 + [auth2-pubkey.c] + fix username passed to helper program + prepare stdio fds before closefrom() + spotted by landry@ + - djm@cvs.openbsd.org 2012/11/14 02:32:15 + [ssh-keygen.c] + allow the full range of unsigned serial numbers; 'fine' deraadt@ + - djm@cvs.openbsd.org 2012/12/02 20:34:10 + [auth.c auth.h auth1.c auth2-chall.c auth2-gss.c auth2-jpake.c auth2.c] + [monitor.c monitor.h] + Fixes logging of partial authentication when privsep is enabled + Previously, we recorded "Failed xxx" since we reset authenticated before + calling auth_log() in auth2.c. This adds an explcit "Partial" state. + + Add a "submethod" to auth_log() to report which submethod is used + for keyboard-interactive. + + Fix multiple authentication when one of the methods is + keyboard-interactive. + + ok markus@ + - dtucker@cvs.openbsd.org 2012/10/05 02:05:30 + [regress/multiplex.sh] + Use 'kill -0' to test for the presence of a pid since it's more portable + +20121107 + - (djm) OpenBSD CVS Sync + - eric@cvs.openbsd.org 2011/11/28 08:46:27 + [moduli.5] + fix formula + ok djm@ + - jmc@cvs.openbsd.org 2012/09/26 17:34:38 + [moduli.5] + last stage of rfc changes, using consistent Rs/Re blocks, and moving the + references into a STANDARDS section; + +20121105 + - (dtucker) [uidswap.c openbsd-compat/Makefile.in + openbsd-compat/bsd-setres_id.c openbsd-compat/bsd-setres_id.h + openbsd-compat/openbsd-compat.h] Move the fallback code for setting uids + and gids from uidswap.c to the compat library, which allows it to work with + the new setresuid calls in auth2-pubkey. with tim@, ok djm@ + - (dtucker) [auth2-pubkey.c] wrap paths.h in an ifdef for platforms that + don't have it. Spotted by tim@. + +20121104 + - (djm) OpenBSD CVS Sync + - jmc@cvs.openbsd.org 2012/10/31 08:04:50 + [sshd_config.5] + tweak previous; + - djm@cvs.openbsd.org 2012/11/04 10:38:43 + [auth2-pubkey.c sshd.c sshd_config.5] + Remove default of AuthorizedCommandUser. Administrators are now expected + to explicitly specify a user. feedback and ok markus@ + - djm@cvs.openbsd.org 2012/11/04 11:09:15 + [auth.h auth1.c auth2.c monitor.c servconf.c servconf.h sshd.c] + [sshd_config.5] + Support multiple required authentication via an AuthenticationMethods + option. This option lists one or more comma-separated lists of + authentication method names. Successful completion of all the methods in + any list is required for authentication to complete; + feedback and ok markus@ + +20121030 + - (djm) OpenBSD CVS Sync + - markus@cvs.openbsd.org 2012/10/05 12:34:39 + [sftp.c] + fix signed vs unsigned warning; feedback & ok: djm@ + - djm@cvs.openbsd.org 2012/10/30 21:29:55 + [auth-rsa.c auth.c auth.h auth2-pubkey.c servconf.c servconf.h] + [sshd.c sshd_config sshd_config.5] + new sshd_config option AuthorizedKeysCommand to support fetching + authorized_keys from a command in addition to (or instead of) from + the filesystem. The command is run as the target server user unless + another specified via a new AuthorizedKeysCommandUser option. + + patch originally by jchadima AT redhat.com, reworked by me; feedback + and ok markus@ + +20121019 + - (tim) [buildpkg.sh.in] Double up on some backslashes so they end up in + the generated file as intended. + +20121005 + - (dtucker) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2012/09/17 09:54:44 + [sftp.c] + an XXX for later + - markus@cvs.openbsd.org 2012/09/17 13:04:11 + [packet.c] + clear old keys on rekeing; ok djm + - dtucker@cvs.openbsd.org 2012/09/18 10:36:12 + [sftp.c] + Add bounds check on sftp tab-completion. Part of a patch from from + Jean-Marc Robert via tech@, ok djm + - dtucker@cvs.openbsd.org 2012/09/21 10:53:07 + [sftp.c] + Fix improper handling of absolute paths when PWD is part of the completed + path. Patch from Jean-Marc Robert via tech@, ok djm. + - dtucker@cvs.openbsd.org 2012/09/21 10:55:04 + [sftp.c] + Fix handling of filenames containing escaped globbing characters and + escape "#" and "*". Patch from Jean-Marc Robert via tech@, ok djm. + - jmc@cvs.openbsd.org 2012/09/26 16:12:13 + [ssh.1] + last stage of rfc changes, using consistent Rs/Re blocks, and moving the + references into a STANDARDS section; + - naddy@cvs.openbsd.org 2012/10/01 13:59:51 + [monitor_wrap.c] + pasto; ok djm@ + - djm@cvs.openbsd.org 2012/10/02 07:07:45 + [ssh-keygen.c] + fix -z option, broken in revision 1.215 + - markus@cvs.openbsd.org 2012/10/04 13:21:50 + [myproposal.h ssh_config.5 umac.h sshd_config.5 ssh.1 sshd.8 mac.c] + add umac128 variant; ok djm@ at n2k12 + - dtucker@cvs.openbsd.org 2012/09/06 04:11:07 + [regress/try-ciphers.sh] + Restore missing space. (Id sync only). + - dtucker@cvs.openbsd.org 2012/09/09 11:51:25 + [regress/multiplex.sh] + Add test for ssh -Ostop + - dtucker@cvs.openbsd.org 2012/09/10 00:49:21 + [regress/multiplex.sh] + Log -O cmd output to the log file and make logging consistent with the + other tests. Test clean shutdown of an existing channel when testing + "stop". + - dtucker@cvs.openbsd.org 2012/09/10 01:51:19 + [regress/multiplex.sh] + use -Ocheck and waiting for completions by PID to make multiplexing test + less racy and (hopefully) more reliable on slow hardware. + - [Makefile umac.c] Add special-case target to build umac128.o. + - [umac.c] Enforce allowed umac output sizes. From djm@. + - [Makefile.in] "Using $< in a non-suffix rule context is a GNUmake idiom". + +20120917 + - (dtucker) OpenBSD CVS Sync + - dtucker@cvs.openbsd.org 2012/09/13 23:37:36 + [servconf.c] + Fix comment line length + - markus@cvs.openbsd.org 2012/09/14 16:51:34 + [sshconnect.c] + remove unused variable + +20120907 + - (dtucker) OpenBSD CVS Sync + - dtucker@cvs.openbsd.org 2012/09/06 09:50:13 + [clientloop.c] + Make the escape command help (~?) context sensitive so that only commands + that will work in the current session are shown. ok markus@ + - jmc@cvs.openbsd.org 2012/09/06 13:57:42 + [ssh.1] + missing letter in previous; + - dtucker@cvs.openbsd.org 2012/09/07 00:30:19 + [clientloop.c] + Print '^Z' instead of a raw ^Z when the sequence is not supported. ok djm@ + - dtucker@cvs.openbsd.org 2012/09/07 01:10:21 + [clientloop.c] + Merge escape help text for ~v and ~V; ok djm@ + - dtucker@cvs.openbsd.org 2012/09/07 06:34:21 + [clientloop.c] + when muxmaster is run with -N, make it shut down gracefully when a client + sends it "-O stop" rather than hanging around (bz#1985). ok djm@ + +20120906 + - (dtucker) OpenBSD CVS Sync + - jmc@cvs.openbsd.org 2012/08/15 18:25:50 + [ssh-keygen.1] + a little more info on certificate validity; + requested by Ross L Richardson, and provided by djm + - dtucker@cvs.openbsd.org 2012/08/17 00:45:45 + [clientloop.c clientloop.h mux.c] + Force a clean shutdown of ControlMaster client sessions when the ~. escape + sequence is used. This means that ~. should now work in mux clients even + if the server is no longer responding. Found by tedu, ok djm. + - djm@cvs.openbsd.org 2012/08/17 01:22:56 + [kex.c] + add some comments about better handling first-KEX-follows notifications + from the server. Nothing uses these right now. No binary change + - djm@cvs.openbsd.org 2012/08/17 01:25:58 + [ssh-keygen.c] + print details of which host lines were deleted when using + "ssh-keygen -R host"; ok markus@ + - djm@cvs.openbsd.org 2012/08/17 01:30:00 + [compat.c sshconnect.c] + Send client banner immediately, rather than waiting for the server to + move first for SSH protocol 2 connections (the default). Patch based on + one in bz#1999 by tls AT panix.com, feedback dtucker@ ok markus@ + - dtucker@cvs.openbsd.org 2012/09/06 04:37:39 + [clientloop.c log.c ssh.1 log.h] + Add ~v and ~V escape sequences to raise and lower the logging level + respectively. Man page help from jmc, ok deraadt jmc + +20120830 + - (dtucker) [moduli] Import new moduli file. + 20120828 - (djm) Release openssh-6.1 @@ -172,6 +842,7 @@ [dns.c dns.h key.c key.h ssh-keygen.c] add support for RFC6594 SSHFP DNS records for ECDSA key types. patch from bugzilla-m67 AT nulld.me in bz#1978; ok + tweak markus@ + (Original authors Ondřej Surý, Ondřej Caletka and Daniel Black) - djm@cvs.openbsd.org 2012/06/01 00:49:35 [PROTOCOL.mux] correct types of port numbers (integers, not strings); bz#2004 from Modified: head/crypto/openssh/INSTALL ============================================================================== --- head/crypto/openssh/INSTALL Fri Mar 22 16:44:15 2013 (r248618) +++ head/crypto/openssh/INSTALL Fri Mar 22 17:55:38 2013 (r248619) @@ -89,7 +89,7 @@ http://nlnetlabs.nl/projects/ldns/ Autoconf: If you modify configure.ac or configure doesn't exist (eg if you checked -the code out of CVS yourself) then you will need autoconf-2.61 to rebuild +the code out of CVS yourself) then you will need autoconf-2.68 to rebuild the automatically generated files by running "autoreconf". Earlier versions may also work but this is not guaranteed. @@ -266,4 +266,4 @@ Please refer to the "reporting bugs" sec http://www.openssh.com/ -$Id: INSTALL,v 1.87 2011/11/04 00:25:25 dtucker Exp $ +$Id: INSTALL,v 1.88 2013/03/07 01:33:35 dtucker Exp $ Modified: head/crypto/openssh/PROTOCOL ============================================================================== --- head/crypto/openssh/PROTOCOL Fri Mar 22 16:44:15 2013 (r248618) +++ head/crypto/openssh/PROTOCOL Fri Mar 22 17:55:38 2013 (r248619) @@ -51,6 +51,46 @@ and ecdsa-sha2-nistp521 curves over GF(p curve points encoded using point compression are NOT accepted or generated. +1.5 transport: Protocol 2 Encrypt-then-MAC MAC algorithms + +OpenSSH supports MAC algorithms, whose names contain "-etm", that +perform the calculations in a different order to that defined in RFC +4253. These variants use the so-called "encrypt then MAC" ordering, +calculating the MAC over the packet ciphertext rather than the +plaintext. This ordering closes a security flaw in the SSH transport +protocol, where decryption of unauthenticated ciphertext provided a +"decryption oracle" that could, in conjunction with cipher flaws, reveal +session plaintext. + +Specifically, the "-etm" MAC algorithms modify the transport protocol +to calculate the MAC over the packet ciphertext and to send the packet +length unencrypted. This is necessary for the transport to obtain the +length of the packet and location of the MAC tag so that it may be +verified without decrypting unauthenticated data. + +As such, the MAC covers: + + mac = MAC(key, sequence_number || packet_length || encrypted_packet) + +where "packet_length" is encoded as a uint32 and "encrypted_packet" +contains: + + byte padding_length + byte[n1] payload; n1 = packet_length - padding_length - 1 + byte[n2] random padding; n2 = padding_length + +1.6 transport: AES-GCM + +OpenSSH supports the AES-GCM algorithm as specified in RFC 5647. +Because of problems with the specification of the key exchange +the behaviour of OpenSSH differs from the RFC as follows: + +AES-GCM is only negotiated as the cipher algorithms +"aes128-gcm@openssh.com" or "aes256-gcm@openssh.com" and never as +an MAC algorithm. Additionally, if AES-GCM is selected as the cipher +the exchanged MAC algorithms are ignored and there doesn't have to be +a matching MAC. + 2. Connection protocol changes 2.1. connection: Channel write close extension "eow@openssh.com" @@ -291,4 +331,4 @@ link(oldpath, newpath) and will respond This extension is advertised in the SSH_FXP_VERSION hello with version "1". -$OpenBSD: PROTOCOL,v 1.17 2010/12/04 00:18:01 djm Exp $ +$OpenBSD: PROTOCOL,v 1.20 2013/01/08 18:49:04 markus Exp $ Modified: head/crypto/openssh/PROTOCOL.agent ============================================================================== --- head/crypto/openssh/PROTOCOL.agent Fri Mar 22 16:44:15 2013 (r248618) +++ head/crypto/openssh/PROTOCOL.agent Fri Mar 22 17:55:38 2013 (r248619) @@ -152,7 +152,7 @@ fully specified using just rsa_q, rsa_p computation. "key_constraints" may only be present if the request type is -SSH_AGENTC_ADD_RSA_IDENTITY. +SSH_AGENTC_ADD_RSA_ID_CONSTRAINED. The agent will reply with a SSH_AGENT_SUCCESS if the key has been successfully added or a SSH_AGENT_FAILURE if an error occurred. @@ -557,4 +557,4 @@ Locking and unlocking affects both proto SSH_AGENT_CONSTRAIN_LIFETIME 1 SSH_AGENT_CONSTRAIN_CONFIRM 2 -$OpenBSD: PROTOCOL.agent,v 1.6 2010/08/31 11:54:45 djm Exp $ +$OpenBSD: PROTOCOL.agent,v 1.7 2013/01/02 00:33:49 djm Exp $ Copied: head/crypto/openssh/PROTOCOL.krl (from r248613, vendor-crypto/openssh/dist/PROTOCOL.krl) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/crypto/openssh/PROTOCOL.krl Fri Mar 22 17:55:38 2013 (r248619, copy of r248613, vendor-crypto/openssh/dist/PROTOCOL.krl) @@ -0,0 +1,164 @@ +This describes the key/certificate revocation list format for OpenSSH. + +1. Overall format + +The KRL consists of a header and zero or more sections. The header is: + +#define KRL_MAGIC 0x5353484b524c0a00ULL /* "SSHKRL\n\0" */ +#define KRL_FORMAT_VERSION 1 + + uint64 KRL_MAGIC + uint32 KRL_FORMAT_VERSION + uint64 krl_version + uint64 generated_date + uint64 flags + string reserved + string comment + +Where "krl_version" is a version number that increases each time the KRL +is modified, "generated_date" is the time in seconds since 1970-01-01 +00:00:00 UTC that the KRL was generated, "comment" is an optional comment +and "reserved" an extension field whose contents are currently ignored. +No "flags" are currently defined. + +Following the header are zero or more sections, each consisting of: + + byte section_type + string section_data + +Where "section_type" indicates the type of the "section_data". An exception +to this is the KRL_SECTION_SIGNATURE section, that has a slightly different +format (see below). + +The available section types are: + +#define KRL_SECTION_CERTIFICATES 1 +#define KRL_SECTION_EXPLICIT_KEY 2 +#define KRL_SECTION_FINGERPRINT_SHA1 3 +#define KRL_SECTION_SIGNATURE 4 + +3. Certificate serial section + +These sections use type KRL_SECTION_CERTIFICATES to revoke certificates by +serial number or key ID. The consist of the CA key that issued the +certificates to be revoked and a reserved field whose contents is currently +ignored. + + string ca_key + string reserved + +Followed by one or more sections: + + byte cert_section_type + string cert_section_data + +The certificate section types are: + +#define KRL_SECTION_CERT_SERIAL_LIST 0x20 +#define KRL_SECTION_CERT_SERIAL_RANGE 0x21 +#define KRL_SECTION_CERT_SERIAL_BITMAP 0x22 +#define KRL_SECTION_CERT_KEY_ID 0x23 + +2.1 Certificate serial list section + +This section is identified as KRL_SECTION_CERT_SERIAL_LIST. It revokes +certificates by listing their serial numbers. The cert_section_data in this +case contains: + + uint64 revoked_cert_serial + uint64 ... + +This section may appear multiple times. + +2.2. Certificate serial range section + +These sections use type KRL_SECTION_CERT_SERIAL_RANGE and hold +a range of serial numbers of certificates: + + uint64 serial_min + uint64 serial_max + +All certificates in the range serial_min <= serial <= serial_max are +revoked. + +This section may appear multiple times. + +2.3. Certificate serial bitmap section + +Bitmap sections use type KRL_SECTION_CERT_SERIAL_BITMAP and revoke keys +by listing their serial number in a bitmap. + + uint64 serial_offset + mpint revoked_keys_bitmap + +A bit set at index N in the bitmap corresponds to revocation of a keys with +serial number (serial_offset + N). + +This section may appear multiple times. + +2.4. Revoked key ID sections + +KRL_SECTION_CERT_KEY_ID sections revoke particular certificate "key +ID" strings. This may be useful in revoking all certificates +associated with a particular identity, e.g. a host or a user. + + string key_id[0] + ... + +This section must contain at least one "key_id". This section may appear +multiple times. + +3. Explicit key sections + +These sections, identified as KRL_SECTION_EXPLICIT_KEY, revoke keys +(not certificates). They are less space efficient than serial numbers, +but are able to revoke plain keys. + + string public_key_blob[0] + .... + +This section must contain at least one "public_key_blob". The blob +must be a raw key (i.e. not a certificate). + +This section may appear multiple times. + +4. SHA1 fingerprint sections + +These sections, identified as KRL_SECTION_FINGERPRINT_SHA1, revoke +plain keys (i.e. not certificates) by listing their SHA1 hashes: + + string public_key_hash[0] + .... + +This section must contain at least one "public_key_hash". The hash blob +is obtained by taking the SHA1 hash of the public key blob. Hashes in +this section must appear in numeric order, treating each hash as a big- +endian integer. + +This section may appear multiple times. + +5. KRL signature sections + +The KRL_SECTION_SIGNATURE section serves a different purpose to the +preceeding ones: to provide cryptographic authentication of a KRL that +is retrieved over a channel that does not provide integrity protection. +Its format is slightly different to the previously-described sections: +in order to simplify the signature generation, it includes as a "body" +two string components instead of one. + + byte KRL_SECTION_SIGNATURE + string signature_key + string signature + +The signature is calculated over the entire KRL from the KRL_MAGIC +to this subsection's "signature_key", including both and using the +signature generation rules appropriate for the type of "signature_key". + +This section must appear last in the KRL. If multiple signature sections +appear, they must appear consecutively at the end of the KRL file. + +Implementations that retrieve KRLs over untrusted channels must verify +signatures. Signature sections are optional for KRLs distributed by +trusted means. + +$OpenBSD: PROTOCOL.krl,v 1.2 2013/01/18 00:24:58 djm Exp $ Modified: head/crypto/openssh/README ============================================================================== --- head/crypto/openssh/README Fri Mar 22 16:44:15 2013 (r248618) +++ head/crypto/openssh/README Fri Mar 22 17:55:38 2013 (r248619) @@ -1,4 +1,4 @@ -See http://www.openssh.com/txt/release-6.1 for the release notes. +See http://www.openssh.com/txt/release-6.2 for the release notes. - A Japanese translation of this document and of the OpenSSH FAQ is - available at http://www.unixuser.org/~haruyama/security/openssh/index.html @@ -62,4 +62,4 @@ References - [6] http://www.openbsd.org/cgi-bin/man.cgi?query=style&sektion=9 [7] http://www.openssh.com/faq.html -$Id: README,v 1.81 2012/08/22 11:57:13 djm Exp $ +$Id: README,v 1.82 2013/02/26 23:48:19 djm Exp $ Modified: head/crypto/openssh/auth-options.c ============================================================================== --- head/crypto/openssh/auth-options.c Fri Mar 22 16:44:15 2013 (r248618) +++ head/crypto/openssh/auth-options.c Fri Mar 22 17:55:38 2013 (r248619) @@ -1,4 +1,4 @@ -/* $OpenBSD: auth-options.c,v 1.56 2011/10/18 04:58:26 djm Exp $ */ +/* $OpenBSD: auth-options.c,v 1.57 2012/12/02 20:46:11 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -349,7 +349,7 @@ auth_parse_options(struct passwd *pw, ch xfree(patterns); goto bad_option; } - if (options.allow_tcp_forwarding) + if ((options.allow_tcp_forwarding & FORWARD_LOCAL) != 0) channel_add_permitted_opens(host, port); xfree(patterns); goto next_option; Modified: head/crypto/openssh/auth-rsa.c ============================================================================== --- head/crypto/openssh/auth-rsa.c Fri Mar 22 16:44:15 2013 (r248618) +++ head/crypto/openssh/auth-rsa.c Fri Mar 22 17:55:38 2013 (r248619) @@ -1,4 +1,4 @@ -/* $OpenBSD: auth-rsa.c,v 1.80 2011/05/23 03:30:07 djm Exp $ */ +/* $OpenBSD: auth-rsa.c,v 1.81 2012/10/30 21:29:54 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -276,6 +276,8 @@ auth_rsa_key_allowed(struct passwd *pw, temporarily_use_uid(pw); for (i = 0; !allowed && i < options.num_authkeys_files; i++) { + if (strcasecmp(options.authorized_keys_files[i], "none") == 0) + continue; file = expand_authorized_keys( options.authorized_keys_files[i], pw); allowed = rsa_key_allowed_in_file(pw, file, client_n, rkey); Modified: head/crypto/openssh/auth.c ============================================================================== --- head/crypto/openssh/auth.c Fri Mar 22 16:44:15 2013 (r248618) +++ head/crypto/openssh/auth.c Fri Mar 22 17:55:38 2013 (r248619) @@ -1,4 +1,4 @@ -/* $OpenBSD: auth.c,v 1.96 2012/05/13 01:42:32 dtucker Exp $ */ +/* $OpenBSD: auth.c,v 1.101 2013/02/06 00:22:21 dtucker Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -72,6 +72,7 @@ __RCSID("$FreeBSD$"); #endif #include "authfile.h" #include "monitor_wrap.h" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 19:26:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 23CBF511; Fri, 22 Mar 2013 19:26:27 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-oa0-f50.google.com (mail-oa0-f50.google.com [209.85.219.50]) by mx1.freebsd.org (Postfix) with ESMTP id BFC3FE1B; Fri, 22 Mar 2013 19:26:26 +0000 (UTC) Received: by mail-oa0-f50.google.com with SMTP id n1so1901579oag.37 for ; Fri, 22 Mar 2013 12:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=lQgeo6JVonlJaryDjM6n8srJlUyWBURzO7rNZ+y8JKk=; b=h9hh7i1ieFKX1KIIjya7x48/BKmteK/pClEca4ZN//37tHrzQmGun2sy8t3mCH5GaQ kL5tgD5mxJS/gjWeZ1bQ9VvWUQvkGVCa1dgMOavggbS4jgLK5mGYUe/edDWr4d9g6bsi vT3uthB3JxFpV+vEwzcWRd6sX07ZIhpowamokjp8ENrbY3qamTx/p5PnYlA+3R+opBpc kbEtB9cSnbKJoOSRNnEbY6Sf99a7Atf8Ni6Kx4OPtAC26OzmJdw3UtrnRriJgW3F1+io 8grsk6sQmYJ1BrlpcYkK6b+pSAQeQ/XxDn5M0IO1Voko4oW/fYjZDxDAt/RuMqnuMqxH OgDw== MIME-Version: 1.0 X-Received: by 10.60.101.232 with SMTP id fj8mr2374604oeb.28.1363980385788; Fri, 22 Mar 2013 12:26:25 -0700 (PDT) Received: by 10.76.109.236 with HTTP; Fri, 22 Mar 2013 12:26:25 -0700 (PDT) In-Reply-To: <201303011955.r21JtAqn069123@svn.freebsd.org> References: <201303011955.r21JtAqn069123@svn.freebsd.org> Date: Fri, 22 Mar 2013 15:26:25 -0400 Message-ID: Subject: Re: svn commit: r247570 - head/sys/dev/aac From: Ryan Stone To: Marius Strobl Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 19:26:27 -0000 On Fri, Mar 1, 2013 at 2:55 PM, Marius Strobl wrote: > Author: marius > Date: Fri Mar 1 19:55:10 2013 > New Revision: 247570 > URL: http://svnweb.freebsd.org/changeset/base/247570 > > Log: > - Make tables, device ID strings etc const. This includes #ifdef'ing 0 > aac_command_status_table, which is actually unused since r111532. > While at it, make aac_if a pointer to the now const interface tables > instead of copying them over to the softc (this alone already reduces > the > size of aac.ko on amd64 by ~1 KiB). > - Remove redundant softc members. > - Use DEVMETHOD_END. > - Use NULL instead of 0 for pointers. > - Remove redundant bzero(9)'ing of the softc. > - Use pci_enable_busmaster(9) instead of duplicating it. > - Remove redundant checking for PCIM_CMD_MEMEN (resource allocation will > just fail). > - Canonicalize the error messages in case of resource allocation > failures. > - Add support for using MSI instead of INTx, controllable via the tunable > hw.aac.enable_msi (defaulting to on). > This doesn't seem to be working for the 2230S controller. It panics at mountroot with "panic: run_interrupt_driven_config_hooks". It works if I set hw.aac.enable_msi=0. This is happening with two different motherboards, so I'm not entirely sure if the problem is the BIOS or the driver. I put a verbose boot log here: http://people.freebsd.org/~rstone/aac_msi.log From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 20:04:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6A98CF87; Fri, 22 Mar 2013 20:04:45 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id E305C225; Fri, 22 Mar 2013 20:04:44 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.6/8.14.6/ALCHEMY.FRANKEN.DE) with ESMTP id r2MJpHpZ095985; Fri, 22 Mar 2013 20:51:17 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.6/8.14.6/Submit) id r2MJpHM8095984; Fri, 22 Mar 2013 20:51:17 +0100 (CET) (envelope-from marius) Date: Fri, 22 Mar 2013 20:51:17 +0100 From: Marius Strobl To: Ryan Stone Subject: Re: svn commit: r247570 - head/sys/dev/aac Message-ID: <20130322195117.GZ955@alchemy.franken.de> References: <201303011955.r21JtAqn069123@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 20:04:45 -0000 On Fri, Mar 22, 2013 at 03:26:25PM -0400, Ryan Stone wrote: > On Fri, Mar 1, 2013 at 2:55 PM, Marius Strobl wrote: > > > Author: marius > > Date: Fri Mar 1 19:55:10 2013 > > New Revision: 247570 > > URL: http://svnweb.freebsd.org/changeset/base/247570 > > > > Log: > > - Make tables, device ID strings etc const. This includes #ifdef'ing 0 > > aac_command_status_table, which is actually unused since r111532. > > While at it, make aac_if a pointer to the now const interface tables > > instead of copying them over to the softc (this alone already reduces > > the > > size of aac.ko on amd64 by ~1 KiB). > > - Remove redundant softc members. > > - Use DEVMETHOD_END. > > - Use NULL instead of 0 for pointers. > > - Remove redundant bzero(9)'ing of the softc. > > - Use pci_enable_busmaster(9) instead of duplicating it. > > - Remove redundant checking for PCIM_CMD_MEMEN (resource allocation will > > just fail). > > - Canonicalize the error messages in case of resource allocation > > failures. > > - Add support for using MSI instead of INTx, controllable via the tunable > > hw.aac.enable_msi (defaulting to on). > > > > This doesn't seem to be working for the 2230S controller. It panics at > mountroot with "panic: run_interrupt_driven_config_hooks". It works if I > set hw.aac.enable_msi=0. This is happening with two different > motherboards, so I'm not entirely sure if the problem is the BIOS or the > driver. I put a verbose boot log here: > http://people.freebsd.org/~rstone/aac_msi.log Hrm, I had checked the corresponding linux driver and it does nothing special for enabling the use of an MSI and neither excludes certain controller variants in this regard. On the other hand, it doesn't default to using an MSI either. It's unfortunate that nothing else in that system uses an MSI so far. Do you happen to have an easy way of testing whether MSIs generally work with that machine, e.g. by giving a sufficiently new Ethernet card a try? Marius From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 20:12:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 449F66D7; Fri, 22 Mar 2013 20:12:26 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 36D2B2B5; Fri, 22 Mar 2013 20:12:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2MKCQvI006637; Fri, 22 Mar 2013 20:12:26 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2MKCQga006636; Fri, 22 Mar 2013 20:12:26 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201303222012.r2MKCQga006636@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 22 Mar 2013 20:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248620 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 20:12:26 -0000 Author: jilles Date: Fri Mar 22 20:12:25 2013 New Revision: 248620 URL: http://svnweb.freebsd.org/changeset/base/248620 Log: rc.d/sysctl: Fix error messages about unknown OIDs. There are three situations where the sysctl script is called: 1. "start", very early 2. "lastload", near the end of rc 3. "reload", at admin request while the system is booted Ignore unknown OIDs in situation 1 because kernel modules may not be loaded yet and complain about them in situations 2 and 3. PR: conf/174595 Submitted by: Olivier Smedts Modified: head/etc/rc.d/sysctl Modified: head/etc/rc.d/sysctl ============================================================================== --- head/etc/rc.d/sysctl Fri Mar 22 17:55:38 2013 (r248619) +++ head/etc/rc.d/sysctl Fri Mar 22 20:12:25 2013 (r248620) @@ -11,7 +11,7 @@ name="sysctl" command="/sbin/sysctl" stop_cmd=":" start_cmd="sysctl_start" -reload_cmd="sysctl_start" +reload_cmd="sysctl_start last" lastload_cmd="sysctl_start last" extra_commands="reload lastload" @@ -19,10 +19,10 @@ sysctl_start() { case $1 in last) - command_args="-i -f" + command_args="-f" ;; *) - command_args="-f" + command_args="-i -f" ;; esac From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 20:44:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0AC6053E; Fri, 22 Mar 2013 20:44:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D907A708; Fri, 22 Mar 2013 20:44:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2MKiHbq018961; Fri, 22 Mar 2013 20:44:17 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2MKiHPh018943; Fri, 22 Mar 2013 20:44:17 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201303222044.r2MKiHPh018943@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 22 Mar 2013 20:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248621 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 20:44:18 -0000 Author: glebius Date: Fri Mar 22 20:44:16 2013 New Revision: 248621 URL: http://svnweb.freebsd.org/changeset/base/248621 Log: Remove __FreeBSD_version ifdefs. Modified: head/sys/net/if_arcsubr.c head/sys/net/if_lagg.c head/sys/net/if_lagg.h Modified: head/sys/net/if_arcsubr.c ============================================================================== --- head/sys/net/if_arcsubr.c Fri Mar 22 20:12:25 2013 (r248620) +++ head/sys/net/if_arcsubr.c Fri Mar 22 20:44:16 2013 (r248621) @@ -638,11 +638,7 @@ arc_ifattach(struct ifnet *ifp, u_int8_t ifp->if_resolvemulti = arc_resolvemulti; if (ifp->if_baudrate == 0) ifp->if_baudrate = 2500000; -#if __FreeBSD_version < 500000 - ifa = ifnet_addrs[ifp->if_index - 1]; -#else ifa = ifp->if_addr; -#endif KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__)); sdl = (struct sockaddr_dl *)ifa->ifa_addr; sdl->sdl_type = IFT_ARCNET; Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Fri Mar 22 20:12:25 2013 (r248620) +++ head/sys/net/if_lagg.c Fri Mar 22 20:44:16 2013 (r248621) @@ -219,7 +219,6 @@ static moduledata_t lagg_mod = { DECLARE_MODULE(if_lagg, lagg_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(if_lagg, 1); -#if __FreeBSD_version >= 800000 /* * This routine is run via an vlan * config EVENT @@ -261,7 +260,6 @@ lagg_unregister_vlan(void *arg, struct i } LAGG_RUNLOCK(sc); } -#endif static int lagg_clone_create(struct if_clone *ifc, int unit, caddr_t params) @@ -330,12 +328,10 @@ lagg_clone_create(struct if_clone *ifc, */ ether_ifattach(ifp, eaddr); -#if __FreeBSD_version >= 800000 sc->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, lagg_register_vlan, sc, EVENTHANDLER_PRI_FIRST); sc->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, lagg_unregister_vlan, sc, EVENTHANDLER_PRI_FIRST); -#endif /* Insert into the global list of laggs */ mtx_lock(&lagg_list_mtx); @@ -356,10 +352,8 @@ lagg_clone_destroy(struct ifnet *ifp) lagg_stop(sc); ifp->if_flags &= ~IFF_UP; -#if __FreeBSD_version >= 800000 EVENTHANDLER_DEREGISTER(vlan_config, sc->vlan_attach); EVENTHANDLER_DEREGISTER(vlan_unconfig, sc->vlan_detach); -#endif /* Shutdown and remove lagg ports */ while ((lp = SLIST_FIRST(&sc->sc_ports)) != NULL) Modified: head/sys/net/if_lagg.h ============================================================================== --- head/sys/net/if_lagg.h Fri Mar 22 20:12:25 2013 (r248620) +++ head/sys/net/if_lagg.h Fri Mar 22 20:44:16 2013 (r248621) @@ -215,10 +215,8 @@ struct lagg_softc { void (*sc_lladdr)(struct lagg_softc *); void (*sc_req)(struct lagg_softc *, caddr_t); void (*sc_portreq)(struct lagg_port *, caddr_t); -#if __FreeBSD_version >= 800000 eventhandler_tag vlan_attach; eventhandler_tag vlan_detach; -#endif struct sysctl_ctx_list ctx; /* sysctl variables */ int use_flowid; /* use M_FLOWID */ }; From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 21:45:30 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7D4E51D6; Fri, 22 Mar 2013 21:45:30 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 604E6CEE; Fri, 22 Mar 2013 21:45:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2MLjU1f043422; Fri, 22 Mar 2013 21:45:30 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2MLjScQ043397; Fri, 22 Mar 2013 21:45:28 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201303222145.r2MLjScQ043397@svn.freebsd.org> From: Kirk McKusick Date: Fri, 22 Mar 2013 21:45:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248623 - in head: sbin/dumpfs sbin/newfs sbin/tunefs sys/ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 21:45:30 -0000 Author: mckusick Date: Fri Mar 22 21:45:28 2013 New Revision: 248623 URL: http://svnweb.freebsd.org/changeset/base/248623 Log: The purpose of this change to the FFS layout policy is to reduce the running time for a full fsck. It also reduces the random access time for large files and speeds the traversal time for directory tree walks. The key idea is to reserve a small area in each cylinder group immediately following the inode blocks for the use of metadata, specifically indirect blocks and directory contents. The new policy is to preferentially place metadata in the metadata area and everything else in the blocks that follow the metadata area. The size of this area can be set when creating a filesystem using newfs(8) or changed in an existing filesystem using tunefs(8). Both utilities use the `-k held-for-metadata-blocks' option to specify the amount of space to be held for metadata blocks in each cylinder group. By default, newfs(8) sets this area to half of minfree (typically 4% of the data area). This work was inspired by a paper presented at Usenix's FAST '13: www.usenix.org/conference/fast13/ffsck-fast-file-system-checker Details of this implementation appears in the April 2013 of ;login: www.usenix.org/publications/login/april-2013-volume-38-number-2. A copy of the April 2013 ;login: paper can also be downloaded from: www.mckusick.com/publications/faster_fsck.pdf. Reviewed by: kib Tested by: Peter Holm MFC after: 4 weeks Modified: head/sbin/dumpfs/dumpfs.c head/sbin/newfs/mkfs.c head/sbin/newfs/newfs.8 head/sbin/newfs/newfs.c head/sbin/newfs/newfs.h head/sbin/tunefs/tunefs.8 head/sbin/tunefs/tunefs.c head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_balloc.c head/sys/ufs/ffs/fs.h Modified: head/sbin/dumpfs/dumpfs.c ============================================================================== --- head/sbin/dumpfs/dumpfs.c Fri Mar 22 21:11:17 2013 (r248622) +++ head/sbin/dumpfs/dumpfs.c Fri Mar 22 21:45:28 2013 (r248623) @@ -241,8 +241,8 @@ dumpfs(const char *name) afs.fs_sblkno, afs.fs_cblkno, afs.fs_iblkno, afs.fs_dblkno); printf("cgrotor\t%d\tfmod\t%d\tronly\t%d\tclean\t%d\n", afs.fs_cgrotor, afs.fs_fmod, afs.fs_ronly, afs.fs_clean); - printf("avgfpdir %d\tavgfilesize %d\n", - afs.fs_avgfpdir, afs.fs_avgfilesize); + printf("metaspace %jd\tavgfpdir %d\tavgfilesize %d\n", + afs.fs_metaspace, afs.fs_avgfpdir, afs.fs_avgfilesize); printf("flags\t"); if (afs.fs_old_flags & FS_FLAGS_UPDATED) fsflags = afs.fs_flags; Modified: head/sbin/newfs/mkfs.c ============================================================================== --- head/sbin/newfs/mkfs.c Fri Mar 22 21:11:17 2013 (r248622) +++ head/sbin/newfs/mkfs.c Fri Mar 22 21:45:28 2013 (r248623) @@ -444,6 +444,12 @@ restart: if (sblock.fs_sbsize > SBLOCKSIZE) sblock.fs_sbsize = SBLOCKSIZE; sblock.fs_minfree = minfree; + if (metaspace > 0 && metaspace < sblock.fs_fpg / 2) + sblock.fs_metaspace = blknum(&sblock, metaspace); + else if (metaspace != -1) + /* reserve half of minfree for metadata blocks */ + sblock.fs_metaspace = blknum(&sblock, + (sblock.fs_fpg * minfree) / 200); if (maxbpg == 0) sblock.fs_maxbpg = MAXBLKPG(sblock.fs_bsize); else Modified: head/sbin/newfs/newfs.8 ============================================================================== --- head/sbin/newfs/newfs.8 Fri Mar 22 21:11:17 2013 (r248622) +++ head/sbin/newfs/newfs.8 Fri Mar 22 21:45:28 2013 (r248623) @@ -50,6 +50,7 @@ .Op Fl g Ar avgfilesize .Op Fl h Ar avgfpdir .Op Fl i Ar bytes +.Op Fl k Ar held-for-metadata-blocks .Op Fl m Ar free-space .Op Fl o Ar optimization .Op Fl p Ar partition @@ -163,6 +164,17 @@ This flag is implemented by running the .Xr tunefs 8 utility found in the user's .Dv $PATH . +.It Fl k Ar held-for-metadata-blocks +Set the amount of space to be held for metadata blocks in each cylinder group. +When set, the file system preference routines will try to save +the specified amount of space immediately following the inode blocks +in each cylinder group for use by metadata blocks. +Clustering the metadata blocks speeds up random file access +and decreases the running time of +.Xr fsck 8 . +By default +.Xr newfs 8 +sets it to half of the space reserved to minfree. .It Fl l Enable multilabel MAC on the new file system. .It Fl m Ar free-space Modified: head/sbin/newfs/newfs.c ============================================================================== --- head/sbin/newfs/newfs.c Fri Mar 22 21:11:17 2013 (r248622) +++ head/sbin/newfs/newfs.c Fri Mar 22 21:45:28 2013 (r248623) @@ -102,6 +102,7 @@ int bsize = 0; /* block size */ int maxbsize = 0; /* maximum clustering */ int maxblkspercg = MAXBLKSPERCG; /* maximum blocks per cylinder group */ int minfree = MINFREE; /* free space threshold */ +int metaspace; /* space held for metadata blocks */ int opt = DEFAULTOPT; /* optimization preference (space or time) */ int density; /* number of bytes per inode */ int maxcontig = 0; /* max contiguous blocks to allocate */ @@ -141,7 +142,7 @@ main(int argc, char *argv[]) part_name = 'c'; reserved = 0; while ((ch = getopt(argc, argv, - "EJL:NO:RS:T:UXa:b:c:d:e:f:g:h:i:jlm:no:p:r:s:t")) != -1) + "EJL:NO:RS:T:UXa:b:c:d:e:f:g:h:i:jk:lm:no:p:r:s:t")) != -1) switch (ch) { case 'E': Eflag = 1; @@ -248,6 +249,13 @@ main(int argc, char *argv[]) case 'l': lflag = 1; break; + case 'k': + if ((metaspace = atoi(optarg)) < 0) + errx(1, "%s: bad metadata space %%", optarg); + if (metaspace == 0) + /* force to stay zero in mkfs */ + metaspace = -1; + break; case 'm': if ((minfree = atoi(optarg)) < 0 || minfree > 99) errx(1, "%s: bad free space %%", optarg); @@ -501,6 +509,7 @@ usage() fprintf(stderr, "\t-h average files per directory\n"); fprintf(stderr, "\t-i number of bytes per inode\n"); fprintf(stderr, "\t-j enable soft updates journaling\n"); + fprintf(stderr, "\t-k space to hold for metadata blocks\n"); fprintf(stderr, "\t-l enable multilabel MAC\n"); fprintf(stderr, "\t-n do not create .snap directory\n"); fprintf(stderr, "\t-m minimum free space %%\n"); Modified: head/sbin/newfs/newfs.h ============================================================================== --- head/sbin/newfs/newfs.h Fri Mar 22 21:11:17 2013 (r248622) +++ head/sbin/newfs/newfs.h Fri Mar 22 21:45:28 2013 (r248623) @@ -96,6 +96,7 @@ extern int bsize; /* block size */ extern int maxbsize; /* maximum clustering */ extern int maxblkspercg; /* maximum blocks per cylinder group */ extern int minfree; /* free space threshold */ +extern int metaspace; /* space held for metadata blocks */ extern int opt; /* optimization preference (space or time) */ extern int density; /* number of bytes per inode */ extern int maxcontig; /* max contiguous blocks to allocate */ Modified: head/sbin/tunefs/tunefs.8 ============================================================================== --- head/sbin/tunefs/tunefs.8 Fri Mar 22 21:11:17 2013 (r248622) +++ head/sbin/tunefs/tunefs.8 Fri Mar 22 21:45:28 2013 (r248623) @@ -42,6 +42,7 @@ .Op Fl f Ar avgfilesize .Op Fl j Cm enable | disable .Op Fl J Cm enable | disable +.Op Fl k Ar held-for-metadata-blocks .Op Fl L Ar volname .Op Fl l Cm enable | disable .Op Fl m Ar minfree @@ -96,6 +97,19 @@ Specify the expected average file size. Turn on/off soft updates journaling. .It Fl J Cm enable | disable Turn on/off gjournal flag. +.It Fl k Ar held-for-metadata-blocks +Set the amount of space to be held for metadata blocks. +When set, the file system preference routines will try to save +the specified amount of space immediately following the inode blocks +in each cylinder group for use by metadata blocks. +Clustering the metadata blocks speeds up random file access +and decreases the running time of +.Xr fsck 8 . +While this option can be set at any time, +it is most effective if set before any data is loaded into the file system. +By default +.Xr newfs 8 +sets it to half of the space reserved to minfree. .It Fl L Ar volname Add/modify an optional file system volume label. .It Fl l Cm enable | disable Modified: head/sbin/tunefs/tunefs.c ============================================================================== --- head/sbin/tunefs/tunefs.c Fri Mar 22 21:11:17 2013 (r248622) +++ head/sbin/tunefs/tunefs.c Fri Mar 22 21:45:28 2013 (r248623) @@ -89,10 +89,9 @@ main(int argc, char *argv[]) const char *special, *on; const char *name; int active; - int Aflag, aflag, eflag, evalue, fflag, fvalue, jflag, Jflag, Lflag; - int lflag, mflag, mvalue, Nflag, nflag, oflag, ovalue, pflag, sflag; - int tflag; - int svalue, Svalue; + int Aflag, aflag, eflag, evalue, fflag, fvalue, jflag, Jflag, kflag; + int kvalue, Lflag, lflag, mflag, mvalue, Nflag, nflag, oflag, ovalue; + int pflag, sflag, svalue, Svalue, tflag; int ch, found_arg, i; const char *chg[2]; struct ufs_args args; @@ -100,13 +99,13 @@ main(int argc, char *argv[]) if (argc < 3) usage(); - Aflag = aflag = eflag = fflag = jflag = Jflag = Lflag = lflag = 0; - mflag = Nflag = nflag = oflag = pflag = sflag = tflag = 0; + Aflag = aflag = eflag = fflag = jflag = Jflag = kflag = Lflag = 0; + lflag = mflag = Nflag = nflag = oflag = pflag = sflag = tflag = 0; avalue = jvalue = Jvalue = Lvalue = lvalue = Nvalue = nvalue = NULL; evalue = fvalue = mvalue = ovalue = svalue = Svalue = 0; active = 0; found_arg = 0; /* At least one arg is required. */ - while ((ch = getopt(argc, argv, "Aa:e:f:j:J:L:l:m:N:n:o:ps:S:t:")) + while ((ch = getopt(argc, argv, "Aa:e:f:j:J:k:L:l:m:N:n:o:ps:S:t:")) != -1) switch (ch) { @@ -171,6 +170,14 @@ main(int argc, char *argv[]) Jflag = 1; break; + case 'k': + found_arg = 1; + name = "space to hold for metadata blocks"; + kvalue = atoi(optarg); + if (mvalue < 0) + errx(10, "bad %s (%s)", name, optarg); + kflag = 1; + break; case 'L': found_arg = 1; @@ -404,6 +411,22 @@ main(int argc, char *argv[]) } } } + if (kflag) { + name = "space to hold for metadata blocks"; + if (sblock.fs_metaspace == kvalue) + warnx("%s remains unchanged as %d", name, kvalue); + else { + kvalue = blknum(&sblock, kvalue); + if (kvalue > sblock.fs_fpg / 2) { + kvalue = blknum(&sblock, sblock.fs_fpg / 2); + warnx("%s cannot exceed half the file system " + "space", name); + } + warnx("%s changes from %jd to %d", + name, sblock.fs_metaspace, kvalue); + sblock.fs_metaspace = kvalue; + } + } if (lflag) { name = "multilabel"; if (strcmp(lvalue, "enable") == 0) { @@ -1064,7 +1087,7 @@ usage(void) { fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n", "usage: tunefs [-A] [-a enable | disable] [-e maxbpg] [-f avgfilesize]", -" [-J enable | disable] [-j enable | disable]", +" [-J enable | disable] [-j enable | disable] [-k metaspace]", " [-L volname] [-l enable | disable] [-m minfree]", " [-N enable | disable] [-n enable | disable]", " [-o space | time] [-p] [-s avgfpdir] [-t enable | disable]", @@ -1097,6 +1120,8 @@ printfs(void) sblock.fs_avgfpdir); warnx("minimum percentage of free space: (-m) %d%%", sblock.fs_minfree); + warnx("space to hold for metadata blocks: (-k) %jd", + sblock.fs_metaspace); warnx("optimization preference: (-o) %s", sblock.fs_optim == FS_OPTSPACE ? "space" : "time"); if (sblock.fs_minfree >= MINFREE && Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Fri Mar 22 21:11:17 2013 (r248622) +++ head/sys/ufs/ffs/ffs_alloc.c Fri Mar 22 21:45:28 2013 (r248623) @@ -817,15 +817,6 @@ ffs_reallocblks_ufs2(ap) UFS_LOCK(ump); pref = ffs_blkpref_ufs2(ip, start_lbn, soff, sbap); /* - * Skip a block for the first indirect block. Indirect blocks are - * usually initially laid out in a good position between the data - * blocks, but block reallocation would usually destroy locality by - * moving them out of the way to make room for data blocks if we - * didn't compensate here. - */ - if (start_lbn == NDADDR) - pref += fs->fs_frag; - /* * Search the block map looking for an allocation of the desired size. */ if ((newblk = ffs_hashalloc(ip, dtog(fs, pref), pref, @@ -1090,7 +1081,7 @@ ffs_dirpref(pip) struct inode *pip; { struct fs *fs; - u_int cg, prefcg, dirsize, cgsize; + int cg, prefcg, dirsize, cgsize; u_int avgifree, avgbfree, avgndir, curdirsize; u_int minifree, minbfree, maxndir; u_int mincg, minndir; @@ -1158,6 +1149,22 @@ ffs_dirpref(pip) * Limit number of dirs in one cg and reserve space for * regular files, but only if we have no deficit in * inodes or space. + * + * We are trying to find a suitable cylinder group nearby + * our preferred cylinder group to place a new directory. + * We scan from our preferred cylinder group forward looking + * for a cylinder group that meets our criterion. If we get + * to the final cylinder group and do not find anything, + * we start scanning backwards from our preferred cylinder + * group. The ideal would be to alternate looking forward + * and backward, but that is just too complex to code for + * the gain it would get. The most likely place where the + * backward scan would take effect is when we start near + * the end of the filesystem and do not find anything from + * where we are to the end. In that case, scanning backward + * will likely find us a suitable cylinder group much closer + * to our desired location than if we were to start scanning + * forward from the beginning of the filesystem. */ prefcg = ino_to_cg(fs, pip->i_number); for (cg = prefcg; cg < fs->fs_ncg; cg++) @@ -1167,7 +1174,7 @@ ffs_dirpref(pip) if (fs->fs_contigdirs[cg] < maxcontigdirs) return ((ino_t)(fs->fs_ipg * cg)); } - for (cg = 0; cg < prefcg; cg++) + for (cg = prefcg - 1; cg >= 0; cg--) if (fs->fs_cs(fs, cg).cs_ndir < maxndir && fs->fs_cs(fs, cg).cs_nifree >= minifree && fs->fs_cs(fs, cg).cs_nbfree >= minbfree) { @@ -1180,7 +1187,7 @@ ffs_dirpref(pip) for (cg = prefcg; cg < fs->fs_ncg; cg++) if (fs->fs_cs(fs, cg).cs_nifree >= avgifree) return ((ino_t)(fs->fs_ipg * cg)); - for (cg = 0; cg < prefcg; cg++) + for (cg = prefcg - 1; cg >= 0; cg--) if (fs->fs_cs(fs, cg).cs_nifree >= avgifree) break; return ((ino_t)(fs->fs_ipg * cg)); @@ -1193,9 +1200,15 @@ ffs_dirpref(pip) * * If no blocks have been allocated in the first section, the policy is to * request a block in the same cylinder group as the inode that describes - * the file. If no blocks have been allocated in any other section, the - * policy is to place the section in a cylinder group with a greater than - * average number of free blocks. An appropriate cylinder group is found + * the file. The first indirect is allocated immediately following the last + * direct block and the data blocks for the first indirect immediately + * follow it. + * + * If no blocks have been allocated in any other section, the indirect + * block(s) are allocated in the same cylinder group as its inode in an + * area reserved immediately following the inode blocks. The policy for + * the data blocks is to place them in a cylinder group with a greater than + * average number of free blocks. An appropriate cylinder group is found * by using a rotor that sweeps the cylinder groups. When a new group of * blocks is needed, the sweep begins in the cylinder group following the * cylinder group from which the previous allocation was made. The sweep @@ -1218,39 +1231,78 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap) ufs1_daddr_t *bap; { struct fs *fs; - u_int cg; + u_int cg, inocg; u_int avgbfree, startcg; ufs2_daddr_t pref; + KASSERT(indx <= 0 || bap != NULL, ("need non-NULL bap")); mtx_assert(UFS_MTX(ip->i_ump), MA_OWNED); fs = ip->i_fs; /* - * If we are allocating the first indirect block, try to place it - * immediately following the last direct block. - * + * Allocation of indirect blocks is indicated by passing negative + * values in indx: -1 for single indirect, -2 for double indirect, + * -3 for triple indirect. As noted below, we attempt to allocate + * the first indirect inline with the file data. For all later + * indirect blocks, the data is often allocated in other cylinder + * groups. However to speed random file access and to speed up + * fsck, the filesystem reserves the first fs_metaspace blocks + * (typically half of fs_minfree) of the data area of each cylinder + * group to hold these later indirect blocks. + */ + inocg = ino_to_cg(fs, ip->i_number); + if (indx < 0) { + /* + * Our preference for indirect blocks is the zone at the + * beginning of the inode's cylinder group data area that + * we try to reserve for indirect blocks. + */ + pref = cgmeta(fs, inocg); + /* + * If we are allocating the first indirect block, try to + * place it immediately following the last direct block. + */ + if (indx == -1 && lbn < NDADDR + NINDIR(fs) && + ip->i_din1->di_db[NDADDR - 1] != 0) + pref = ip->i_din1->di_db[NDADDR - 1] + fs->fs_frag; + return (pref); + } + /* * If we are allocating the first data block in the first indirect - * block, try to place it immediately following the indirect block. + * block and the indirect has been allocated in the data block area, + * try to place it immediately following the indirect block. */ if (lbn == NDADDR) { - pref = ip->i_din1->di_db[NDADDR - 1]; - if (bap == NULL && pref != 0) - return (pref + fs->fs_frag); pref = ip->i_din1->di_ib[0]; - if (pref != 0) + if (pref != 0 && pref >= cgdata(fs, inocg) && + pref < cgbase(fs, inocg + 1)) return (pref + fs->fs_frag); } + /* + * If we are at the beginning of a file, or we have already allocated + * the maximum number of blocks per cylinder group, or we do not + * have a block allocated immediately preceeding us, then we need + * to decide where to start allocating new blocks. + */ if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { - if (lbn < NDADDR + NINDIR(fs)) { - cg = ino_to_cg(fs, ip->i_number); - return (cgbase(fs, cg) + fs->fs_frag); - } + /* + * If we are allocating a directory data block, we want + * to place it in the metadata area. + */ + if ((ip->i_mode & IFMT) == IFDIR) + return (cgmeta(fs, inocg)); + /* + * Until we fill all the direct and all the first indirect's + * blocks, we try to allocate in the data area of the inode's + * cylinder group. + */ + if (lbn < NDADDR + NINDIR(fs)) + return (cgdata(fs, inocg)); /* * Find a cylinder with greater than average number of * unused data blocks. */ if (indx == 0 || bap[indx - 1] == 0) - startcg = - ino_to_cg(fs, ip->i_number) + lbn / fs->fs_maxbpg; + startcg = inocg + lbn / fs->fs_maxbpg; else startcg = dtog(fs, bap[indx - 1]) + 1; startcg %= fs->fs_ncg; @@ -1258,17 +1310,17 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap) for (cg = startcg; cg < fs->fs_ncg; cg++) if (fs->fs_cs(fs, cg).cs_nbfree >= avgbfree) { fs->fs_cgrotor = cg; - return (cgbase(fs, cg) + fs->fs_frag); + return (cgdata(fs, cg)); } for (cg = 0; cg <= startcg; cg++) if (fs->fs_cs(fs, cg).cs_nbfree >= avgbfree) { fs->fs_cgrotor = cg; - return (cgbase(fs, cg) + fs->fs_frag); + return (cgdata(fs, cg)); } return (0); } /* - * We just always try to lay things out contiguously. + * Otherwise, we just always try to lay things out contiguously. */ return (bap[indx - 1] + fs->fs_frag); } @@ -1284,39 +1336,78 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap) ufs2_daddr_t *bap; { struct fs *fs; - u_int cg; + u_int cg, inocg; u_int avgbfree, startcg; ufs2_daddr_t pref; + KASSERT(indx <= 0 || bap != NULL, ("need non-NULL bap")); mtx_assert(UFS_MTX(ip->i_ump), MA_OWNED); fs = ip->i_fs; /* - * If we are allocating the first indirect block, try to place it - * immediately following the last direct block. - * + * Allocation of indirect blocks is indicated by passing negative + * values in indx: -1 for single indirect, -2 for double indirect, + * -3 for triple indirect. As noted below, we attempt to allocate + * the first indirect inline with the file data. For all later + * indirect blocks, the data is often allocated in other cylinder + * groups. However to speed random file access and to speed up + * fsck, the filesystem reserves the first fs_metaspace blocks + * (typically half of fs_minfree) of the data area of each cylinder + * group to hold these later indirect blocks. + */ + inocg = ino_to_cg(fs, ip->i_number); + if (indx < 0) { + /* + * Our preference for indirect blocks is the zone at the + * beginning of the inode's cylinder group data area that + * we try to reserve for indirect blocks. + */ + pref = cgmeta(fs, inocg); + /* + * If we are allocating the first indirect block, try to + * place it immediately following the last direct block. + */ + if (indx == -1 && lbn < NDADDR + NINDIR(fs) && + ip->i_din2->di_db[NDADDR - 1] != 0) + pref = ip->i_din2->di_db[NDADDR - 1] + fs->fs_frag; + return (pref); + } + /* * If we are allocating the first data block in the first indirect - * block, try to place it immediately following the indirect block. + * block and the indirect has been allocated in the data block area, + * try to place it immediately following the indirect block. */ if (lbn == NDADDR) { - pref = ip->i_din1->di_db[NDADDR - 1]; - if (bap == NULL && pref != 0) - return (pref + fs->fs_frag); - pref = ip->i_din1->di_ib[0]; - if (pref != 0) + pref = ip->i_din2->di_ib[0]; + if (pref != 0 && pref >= cgdata(fs, inocg) && + pref < cgbase(fs, inocg + 1)) return (pref + fs->fs_frag); } + /* + * If we are at the beginning of a file, or we have already allocated + * the maximum number of blocks per cylinder group, or we do not + * have a block allocated immediately preceeding us, then we need + * to decide where to start allocating new blocks. + */ if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { - if (lbn < NDADDR + NINDIR(fs)) { - cg = ino_to_cg(fs, ip->i_number); - return (cgbase(fs, cg) + fs->fs_frag); - } + /* + * If we are allocating a directory data block, we want + * to place it in the metadata area. + */ + if ((ip->i_mode & IFMT) == IFDIR) + return (cgmeta(fs, inocg)); + /* + * Until we fill all the direct and all the first indirect's + * blocks, we try to allocate in the data area of the inode's + * cylinder group. + */ + if (lbn < NDADDR + NINDIR(fs)) + return (cgdata(fs, inocg)); /* * Find a cylinder with greater than average number of * unused data blocks. */ if (indx == 0 || bap[indx - 1] == 0) - startcg = - ino_to_cg(fs, ip->i_number) + lbn / fs->fs_maxbpg; + startcg = inocg + lbn / fs->fs_maxbpg; else startcg = dtog(fs, bap[indx - 1]) + 1; startcg %= fs->fs_ncg; @@ -1324,17 +1415,17 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap) for (cg = startcg; cg < fs->fs_ncg; cg++) if (fs->fs_cs(fs, cg).cs_nbfree >= avgbfree) { fs->fs_cgrotor = cg; - return (cgbase(fs, cg) + fs->fs_frag); + return (cgdata(fs, cg)); } for (cg = 0; cg <= startcg; cg++) if (fs->fs_cs(fs, cg).cs_nbfree >= avgbfree) { fs->fs_cgrotor = cg; - return (cgbase(fs, cg) + fs->fs_frag); + return (cgdata(fs, cg)); } return (0); } /* - * We just always try to lay things out contiguously. + * Otherwise, we just always try to lay things out contiguously. */ return (bap[indx - 1] + fs->fs_frag); } @@ -1611,31 +1702,37 @@ ffs_alloccgblk(ip, bp, bpref, size) ufs1_daddr_t bno; ufs2_daddr_t blkno; u_int8_t *blksfree; - int i; + int i, cgbpref; fs = ip->i_fs; ump = ip->i_ump; mtx_assert(UFS_MTX(ump), MA_OWNED); cgp = (struct cg *)bp->b_data; blksfree = cg_blksfree(cgp); - if (bpref == 0 || dtog(fs, bpref) != cgp->cg_cgx) { + if (bpref == 0) { bpref = cgp->cg_rotor; - } else { - bpref = blknum(fs, bpref); - bno = dtogd(fs, bpref); - /* - * if the requested block is available, use it - */ - if (ffs_isblock(fs, blksfree, fragstoblks(fs, bno))) - goto gotit; + } else if ((cgbpref = dtog(fs, bpref)) != cgp->cg_cgx) { + /* map bpref to correct zone in this cg */ + if (bpref < cgdata(fs, cgbpref)) + bpref = cgmeta(fs, cgp->cg_cgx); + else + bpref = cgdata(fs, cgp->cg_cgx); } /* + * if the requested block is available, use it + */ + bno = dtogd(fs, blknum(fs, bpref)); + if (ffs_isblock(fs, blksfree, fragstoblks(fs, bno))) + goto gotit; + /* * Take the next available block in this cylinder group. */ bno = ffs_mapsearch(fs, cgp, bpref, (int)fs->fs_frag); if (bno < 0) return (0); - cgp->cg_rotor = bno; + /* Update cg_rotor only if allocated from the data zone */ + if (bno >= dtogd(fs, cgdata(fs, cgp->cg_cgx))) + cgp->cg_rotor = bno; gotit: blkno = fragstoblks(fs, bno); ffs_clrblock(fs, blksfree, (long)blkno); @@ -1742,9 +1839,10 @@ ffs_clusteralloc(ip, cg, bpref, len, unu * be recalled to try an allocation in the next cylinder group. */ if (dtog(fs, bpref) != cg) - bpref = 0; + bpref = cgdata(fs, cg); else - bpref = fragstoblks(fs, dtogd(fs, blknum(fs, bpref))); + bpref = blknum(fs, bpref); + bpref = fragstoblks(fs, dtogd(fs, bpref)); mapp = &cg_clustersfree(cgp)[bpref / NBBY]; map = *mapp++; bit = 1 << (bpref % NBBY); Modified: head/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_balloc.c Fri Mar 22 21:11:17 2013 (r248622) +++ head/sys/ufs/ffs/ffs_balloc.c Fri Mar 22 21:45:28 2013 (r248623) @@ -246,7 +246,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t lbns_remfree = lbns; if (nb == 0) { UFS_LOCK(ump); - pref = ffs_blkpref_ufs1(ip, lbn, 0, (ufs1_daddr_t *)0); + pref = ffs_blkpref_ufs1(ip, lbn, -indirs[0].in_off - 1, + (ufs1_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags, cred, &newb)) != 0) { curthread_pflags_restore(saved_inbdflush); @@ -299,7 +300,8 @@ retry: } UFS_LOCK(ump); if (pref == 0) - pref = ffs_blkpref_ufs1(ip, lbn, 0, (ufs1_daddr_t *)0); + pref = ffs_blkpref_ufs1(ip, lbn, i - num - 1, + (ufs1_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags | IO_BUFLOCKED, cred, &newb)) != 0) { brelse(bp); @@ -794,7 +796,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t lbns_remfree = lbns; if (nb == 0) { UFS_LOCK(ump); - pref = ffs_blkpref_ufs2(ip, lbn, 0, (ufs2_daddr_t *)0); + pref = ffs_blkpref_ufs2(ip, lbn, -indirs[0].in_off - 1, + (ufs2_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags, cred, &newb)) != 0) { curthread_pflags_restore(saved_inbdflush); @@ -848,7 +851,8 @@ retry: } UFS_LOCK(ump); if (pref == 0) - pref = ffs_blkpref_ufs2(ip, lbn, 0, (ufs2_daddr_t *)0); + pref = ffs_blkpref_ufs2(ip, lbn, i - num - 1, + (ufs2_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, flags | IO_BUFLOCKED, cred, &newb)) != 0) { brelse(bp); Modified: head/sys/ufs/ffs/fs.h ============================================================================== --- head/sys/ufs/ffs/fs.h Fri Mar 22 21:11:17 2013 (r248622) +++ head/sys/ufs/ffs/fs.h Fri Mar 22 21:45:28 2013 (r248623) @@ -333,7 +333,8 @@ struct fs { int32_t fs_maxbsize; /* maximum blocking factor permitted */ int64_t fs_unrefs; /* number of unreferenced inodes */ int64_t fs_providersize; /* size of underlying GEOM provider */ - int64_t fs_sparecon64[15]; /* old rotation block list head */ + int64_t fs_metaspace; /* size of area reserved for metadata */ + int64_t fs_sparecon64[14]; /* old rotation block list head */ int64_t fs_sblockloc; /* byte offset of standard superblock */ struct csum_total fs_cstotal; /* (u) cylinder summary information */ ufs_time_t fs_time; /* last time written */ @@ -525,6 +526,8 @@ struct cg { * They calc filesystem addresses of cylinder group data structures. */ #define cgbase(fs, c) (((ufs2_daddr_t)(fs)->fs_fpg) * (c)) +#define cgdata(fs, c) (cgdmin(fs, c) + (fs)->fs_metaspace) /* data zone */ +#define cgmeta(fs, c) (cgdmin(fs, c)) /* meta data */ #define cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */ #define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */ #define cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */ From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 21:50:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A4CF85FB; Fri, 22 Mar 2013 21:50:32 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9801ED6B; Fri, 22 Mar 2013 21:50:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2MLoWdx044678; Fri, 22 Mar 2013 21:50:32 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2MLoWgq044677; Fri, 22 Mar 2013 21:50:32 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201303222150.r2MLoWgq044677@svn.freebsd.org> From: Olivier Houchard Date: Fri, 22 Mar 2013 21:50:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248624 - head/gnu/lib/libsupc++ X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 21:50:32 -0000 Author: cognet Date: Fri Mar 22 21:50:32 2013 New Revision: 248624 URL: http://svnweb.freebsd.org/changeset/base/248624 Log: As it's done for libstdc++, use SJLJ-based exceptions on arm when we're not using EABI, and use unwind-arm.h instead of unwind-generic.h when using EABI. Modified: head/gnu/lib/libsupc++/Makefile Modified: head/gnu/lib/libsupc++/Makefile ============================================================================== --- head/gnu/lib/libsupc++/Makefile Fri Mar 22 21:45:28 2013 (r248623) +++ head/gnu/lib/libsupc++/Makefile Fri Mar 22 21:50:32 2013 (r248624) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + GCCVER= 4.2 GCCDIR= ${.CURDIR}/../../../contrib/gcc GCCLIB= ${.CURDIR}/../../../contrib/gcclibs @@ -20,6 +22,9 @@ SRCS+= del_op.cc del_opnt.cc del_opv.cc SRCS+= cp-demangle.c CFLAGS+= -DIN_GLIBCPP_V3 -DHAVE_CONFIG_H +.if ${MACHINE_CPUARCH} == "arm" && ${MK_ARM_EABI} == "no" +CFLAGS+= -D_GLIBCXX_SJLJ_EXCEPTIONS=1 +.endif CFLAGS+= -I${GCCLIB}/include -I${SRCDIR} -I${GCCDIR} CFLAGS+= -I${.CURDIR}/../libstdc++ -I. CFLAGS+= -frandom-seed=RepeatabilityConsideredGood @@ -30,7 +35,13 @@ HDRS= exception new typeinfo cxxabi.h ex INCS= ${HDRS:S;^;${SRCDIR}/;} INCSDIR=${INCLUDEDIR}/c++/${GCCVER} +.if ${MACHINE_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no" +unwind.h: ${GCCDIR}/config/arm/unwind-arm.h +.else unwind.h: ${GCCDIR}/unwind-generic.h +.endif + +unwind.h: ln -sf ${.ALLSRC} ${.TARGET} SRCS+= unwind.h From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 21:50:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 71113797; Fri, 22 Mar 2013 21:50:45 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 618E7D80; Fri, 22 Mar 2013 21:50:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2MLojaD044762; Fri, 22 Mar 2013 21:50:45 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2MLoibe044748; Fri, 22 Mar 2013 21:50:44 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201303222150.r2MLoibe044748@svn.freebsd.org> From: Kirk McKusick Date: Fri, 22 Mar 2013 21:50:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248625 - head/sbin/fsck_ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 21:50:45 -0000 Author: mckusick Date: Fri Mar 22 21:50:43 2013 New Revision: 248625 URL: http://svnweb.freebsd.org/changeset/base/248625 Log: Speed up fsck by caching the cylinder group maps in pass1 so that they do not need to be read again in pass5. As this nearly doubles the memory requirement for fsck, the cache is thrown away if other memory needs in fsck would otherwise fail. Thus, the memory footprint of fsck remains unchanged in memory constrained environments. This work was inspired by a paper presented at Usenix's FAST '13: www.usenix.org/conference/fast13/ffsck-fast-file-system-checker Details of this implementation appears in the April 2013 of ;login: www.usenix.org/publications/login/april-2013-volume-38-number-2. A copy of the April 2013 ;login: paper can also be downloaded from: www.mckusick.com/publications/faster_fsck.pdf. Reviewed by: kib Tested by: Peter Holm MFC after: 4 weeks Modified: head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/fsutil.c head/sbin/fsck_ffs/inode.c head/sbin/fsck_ffs/pass1.c head/sbin/fsck_ffs/pass5.c head/sbin/fsck_ffs/setup.c head/sbin/fsck_ffs/suj.c Modified: head/sbin/fsck_ffs/fsck.h ============================================================================== --- head/sbin/fsck_ffs/fsck.h Fri Mar 22 21:50:32 2013 (r248624) +++ head/sbin/fsck_ffs/fsck.h Fri Mar 22 21:50:43 2013 (r248625) @@ -198,7 +198,6 @@ struct timespec totalreadtime[BT_NUMBUFT struct timespec startprog; struct bufarea sblk; /* file system superblock */ -struct bufarea cgblk; /* cylinder group blocks */ struct bufarea *pdirbp; /* current directory contents */ struct bufarea *pbp; /* current inode block */ @@ -216,9 +215,7 @@ struct bufarea *pbp; /* current inode b } while (0) #define sbdirty() dirty(&sblk) -#define cgdirty() dirty(&cgblk) #define sblock (*sblk.b_un.b_fs) -#define cgrp (*cgblk.b_un.b_cg) enum fixstate {DONTKNOW, NOFIX, FIX, IGNORE}; ino_t cursnapshot; @@ -361,6 +358,37 @@ struct ufs2_dinode ufs2_zino; #define EEXIT 8 /* Standard error exit. */ +int flushentry(void); +/* + * Wrapper for malloc() that flushes the cylinder group cache to try + * to get space. + */ +static inline void* +Malloc(int size) +{ + void *retval; + + while ((retval = malloc(size)) == NULL) + if (flushentry() == 0) + break; + return (retval); +} + +/* + * Wrapper for calloc() that flushes the cylinder group cache to try + * to get space. + */ +static inline void* +Calloc(int cnt, int size) +{ + void *retval; + + while ((retval = calloc(cnt, size)) == NULL) + if (flushentry() == 0) + break; + return (retval); +} + struct fstab; @@ -378,7 +406,7 @@ void cacheino(union dinode *dp, ino_t i void catch(int); void catchquit(int); int changeino(ino_t dir, const char *name, ino_t newnum); -int check_cgmagic(int cg, struct cg *cgp); +int check_cgmagic(int cg, struct bufarea *cgbp); int chkrange(ufs2_daddr_t blk, int cnt); void ckfini(int markclean); int ckinode(union dinode *dp, struct inodesc *); @@ -398,6 +426,7 @@ void freeino(ino_t ino); void freeinodebuf(void); int ftypeok(union dinode *dp); void getblk(struct bufarea *bp, ufs2_daddr_t blk, long size); +struct bufarea *cgget(int cg); struct bufarea *getdatablk(ufs2_daddr_t blkno, long size, int type); struct inoinfo *getinoinfo(ino_t inumber); union dinode *getnextinode(ino_t inumber, int rebuildcg); Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Fri Mar 22 21:50:32 2013 (r248624) +++ head/sbin/fsck_ffs/fsutil.c Fri Mar 22 21:50:43 2013 (r248625) @@ -70,6 +70,7 @@ static struct timespec startpass, finish struct timeval slowio_starttime; int slowio_delay_usec = 10000; /* Initial IO delay for background fsck */ int slowio_pollcnt; +static struct bufarea cgblk; /* backup buffer for cylinder group blocks */ static TAILQ_HEAD(buflist, bufarea) bufhead; /* head of buffer cache list */ static int numbufs; /* size of buffer cache */ static char *buftype[BT_NUMBUFTYPES] = BT_NAMES; @@ -163,7 +164,7 @@ bufinit(void) char *bufp; pbp = pdirbp = (struct bufarea *)0; - bufp = malloc((unsigned int)sblock.fs_bsize); + bufp = Malloc((unsigned int)sblock.fs_bsize); if (bufp == 0) errx(EEXIT, "cannot allocate buffer pool"); cgblk.b_un.b_buf = bufp; @@ -173,8 +174,8 @@ bufinit(void) if (bufcnt < MINBUFS) bufcnt = MINBUFS; for (i = 0; i < bufcnt; i++) { - bp = (struct bufarea *)malloc(sizeof(struct bufarea)); - bufp = malloc((unsigned int)sblock.fs_bsize); + bp = (struct bufarea *)Malloc(sizeof(struct bufarea)); + bufp = Malloc((unsigned int)sblock.fs_bsize); if (bp == NULL || bufp == NULL) { if (i >= MINBUFS) break; @@ -193,6 +194,57 @@ bufinit(void) } /* + * Manage cylinder group buffers. + */ +static struct bufarea *cgbufs; /* header for cylinder group cache */ +static int flushtries; /* number of tries to reclaim memory */ + +struct bufarea * +cgget(int cg) +{ + struct bufarea *cgbp; + struct cg *cgp; + + if (cgbufs == NULL) { + cgbufs = Calloc(sblock.fs_ncg, sizeof(struct bufarea)); + if (cgbufs == NULL) + errx(EEXIT, "cannot allocate cylinder group buffers"); + } + cgbp = &cgbufs[cg]; + if (cgbp->b_un.b_cg != NULL) + return (cgbp); + cgp = NULL; + if (flushtries == 0) + cgp = malloc((unsigned int)sblock.fs_cgsize); + if (cgp == NULL) { + getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize); + return (&cgblk); + } + cgbp->b_un.b_cg = cgp; + initbarea(cgbp, BT_CYLGRP); + getblk(cgbp, cgtod(&sblock, cg), sblock.fs_cgsize); + return (cgbp); +} + +/* + * Attempt to flush a cylinder group cache entry. + * Return whether the flush was successful. + */ +int +flushentry(void) +{ + struct bufarea *cgbp; + + cgbp = &cgbufs[flushtries++]; + if (cgbp->b_un.b_cg == NULL) + return (0); + flush(fswritefd, cgbp); + free(cgbp->b_un.b_buf); + cgbp->b_un.b_buf = NULL; + return (1); +} + +/* * Manage a cache of directory blocks. */ struct bufarea * @@ -363,6 +415,13 @@ ckfini(int markclean) } if (numbufs != cnt) errx(EEXIT, "panic: lost %d buffers", numbufs - cnt); + for (cnt = 0; cnt < sblock.fs_ncg; cnt++) { + if (cgbufs[cnt].b_un.b_cg == NULL) + continue; + flush(fswritefd, &cgbufs[cnt]); + free(cgbufs[cnt].b_un.b_cg); + } + free(cgbufs); pbp = pdirbp = (struct bufarea *)0; if (cursnapshot == 0 && sblock.fs_clean != markclean) { if ((sblock.fs_clean = markclean) != 0) { @@ -448,8 +507,8 @@ static void printIOstats(void) clock_gettime(CLOCK_REALTIME_PRECISE, &finishpass); timespecsub(&finishpass, &startpass); - msec = finishpass.tv_sec * 1000 + finishpass.tv_nsec / 1000000; - printf("Running time: %lld msec\n", msec); + printf("Running time: %d.%03ld msec\n", + finishpass.tv_sec, finishpass.tv_nsec / 1000000); printf("buffer reads by type:\n"); for (totalmsec = 0, i = 0; i < BT_NUMBUFTYPES; i++) totalmsec += readtime[i].tv_sec * 1000 + @@ -460,9 +519,10 @@ static void printIOstats(void) if (readcnt[i] == 0) continue; msec = readtime[i].tv_sec * 1000 + readtime[i].tv_nsec / 1000000; - printf("%21s:%8ld %2ld.%ld%% %8lld msec %2lld.%lld%%\n", + printf("%21s:%8ld %2ld.%ld%% %4d.%03ld sec %2jd.%jd%%\n", buftype[i], readcnt[i], readcnt[i] * 100 / diskreads, - (readcnt[i] * 1000 / diskreads) % 10, msec, + (readcnt[i] * 1000 / diskreads) % 10, + readtime[i].tv_sec, readtime[i].tv_nsec / 1000000, msec * 100 / totalmsec, (msec * 1000 / totalmsec) % 10); } printf("\n"); @@ -562,8 +622,9 @@ blerase(int fd, ufs2_daddr_t blk, long s * test fails, offer an option to rebuild the whole cylinder group. */ int -check_cgmagic(int cg, struct cg *cgp) +check_cgmagic(int cg, struct bufarea *cgbp) { + struct cg *cgp = cgbp->b_un.b_cg; /* * Extended cylinder group checks. @@ -623,7 +684,7 @@ check_cgmagic(int cg, struct cg *cgp) cgp->cg_nextfreeoff = cgp->cg_clusteroff + howmany(fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT); } - cgdirty(); + dirty(cgbp); return (0); } @@ -634,7 +695,8 @@ ufs2_daddr_t allocblk(long frags) { int i, j, k, cg, baseblk; - struct cg *cgp = &cgrp; + struct bufarea *cgbp; + struct cg *cgp; if (frags <= 0 || frags > sblock.fs_frag) return (0); @@ -650,8 +712,9 @@ allocblk(long frags) continue; } cg = dtog(&sblock, i + j); - getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize); - if (!check_cgmagic(cg, cgp)) + cgbp = cgget(cg); + cgp = cgbp->b_un.b_cg; + if (!check_cgmagic(cg, cgbp)) return (0); baseblk = dtogd(&sblock, i + j); for (k = 0; k < frags; k++) { @@ -663,7 +726,7 @@ allocblk(long frags) cgp->cg_cs.cs_nbfree--; else cgp->cg_cs.cs_nffree -= frags; - cgdirty(); + dirty(cgbp); return (i + j); } } Modified: head/sbin/fsck_ffs/inode.c ============================================================================== --- head/sbin/fsck_ffs/inode.c Fri Mar 22 21:50:32 2013 (r248624) +++ head/sbin/fsck_ffs/inode.c Fri Mar 22 21:50:43 2013 (r248625) @@ -423,7 +423,7 @@ setinodebuf(ino_t inum) partialsize = inobufsize; } initbarea(&inobuf, BT_INODES); - if ((inobuf.b_un.b_buf = malloc((unsigned)inobufsize)) == NULL) + if ((inobuf.b_un.b_buf = Malloc((unsigned)inobufsize)) == NULL) errx(EEXIT, "cannot allocate space for inode buffer"); } @@ -454,7 +454,7 @@ cacheino(union dinode *dp, ino_t inumber else blks = howmany(DIP(dp, di_size), sblock.fs_bsize); inp = (struct inoinfo *) - malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t)); + Malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t)); if (inp == NULL) errx(EEXIT, "cannot increase directory list"); inpp = &inphead[inumber % dirhash]; @@ -657,7 +657,8 @@ allocino(ino_t request, int type) { ino_t ino; union dinode *dp; - struct cg *cgp = &cgrp; + struct bufarea *cgbp; + struct cg *cgp; int cg; if (request == 0) @@ -670,8 +671,9 @@ allocino(ino_t request, int type) if (ino == maxino) return (0); cg = ino_to_cg(&sblock, ino); - getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize); - if (!check_cgmagic(cg, cgp)) + cgbp = cgget(cg); + cgp = cgbp->b_un.b_cg; + if (!check_cgmagic(cg, cgbp)) return (0); setbit(cg_inosused(cgp), ino % sblock.fs_ipg); cgp->cg_cs.cs_nifree--; @@ -687,7 +689,7 @@ allocino(ino_t request, int type) default: return (0); } - cgdirty(); + dirty(cgbp); dp = ginode(ino); DIP_SET(dp, di_db[0], allocblk((long)1)); if (DIP(dp, di_db[0]) == 0) { Modified: head/sbin/fsck_ffs/pass1.c ============================================================================== --- head/sbin/fsck_ffs/pass1.c Fri Mar 22 21:50:32 2013 (r248624) +++ head/sbin/fsck_ffs/pass1.c Fri Mar 22 21:50:43 2013 (r248625) @@ -61,6 +61,8 @@ pass1(void) { struct inostat *info; struct inodesc idesc; + struct bufarea *cgbp; + struct cg *cgp; ino_t inumber, inosused, mininos; ufs2_daddr_t i, cgd; u_int8_t *cp; @@ -92,12 +94,13 @@ pass1(void) for (c = 0; c < sblock.fs_ncg; c++) { inumber = c * sblock.fs_ipg; setinodebuf(inumber); - getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize); + cgbp = cgget(c); + cgp = cgbp->b_un.b_cg; rebuildcg = 0; - if (!check_cgmagic(c, &cgrp)) + if (!check_cgmagic(c, cgbp)) rebuildcg = 1; if (!rebuildcg && sblock.fs_magic == FS_UFS2_MAGIC) { - inosused = cgrp.cg_initediblk; + inosused = cgp->cg_initediblk; if (inosused > sblock.fs_ipg) { pfatal( "Too many initialized inodes (%ju > %d) in cylinder group %d\nReset to %d\n", @@ -127,7 +130,7 @@ pass1(void) * read only those inodes in from disk. */ if ((preen || inoopt) && usedsoftdep && !rebuildcg) { - cp = &cg_inosused(&cgrp)[(inosused - 1) / CHAR_BIT]; + cp = &cg_inosused(cgp)[(inosused - 1) / CHAR_BIT]; for ( ; inosused > 0; inosused -= CHAR_BIT, cp--) { if (*cp == 0) continue; @@ -149,7 +152,7 @@ pass1(void) inostathead[c].il_stat = 0; continue; } - info = calloc((unsigned)inosused, sizeof(struct inostat)); + info = Calloc((unsigned)inosused, sizeof(struct inostat)); if (info == NULL) errx(EEXIT, "cannot alloc %u bytes for inoinfo", (unsigned)(sizeof(struct inostat) * inosused)); @@ -169,7 +172,7 @@ pass1(void) * valid number for this cylinder group. */ if (checkinode(inumber, &idesc, rebuildcg) == 0 && - i > cgrp.cg_initediblk) + i > cgp->cg_initediblk) break; } /* @@ -181,16 +184,16 @@ pass1(void) mininos = roundup(inosused + INOPB(&sblock), INOPB(&sblock)); if (inoopt && !preen && !rebuildcg && sblock.fs_magic == FS_UFS2_MAGIC && - cgrp.cg_initediblk > 2 * INOPB(&sblock) && - mininos < cgrp.cg_initediblk) { - i = cgrp.cg_initediblk; + cgp->cg_initediblk > 2 * INOPB(&sblock) && + mininos < cgp->cg_initediblk) { + i = cgp->cg_initediblk; if (mininos < 2 * INOPB(&sblock)) - cgrp.cg_initediblk = 2 * INOPB(&sblock); + cgp->cg_initediblk = 2 * INOPB(&sblock); else - cgrp.cg_initediblk = mininos; + cgp->cg_initediblk = mininos; pwarn("CYLINDER GROUP %d: RESET FROM %ju TO %d %s\n", - c, i, cgrp.cg_initediblk, "VALID INODES"); - cgdirty(); + c, i, cgp->cg_initediblk, "VALID INODES"); + dirty(cgbp); } if (inosused < sblock.fs_ipg) continue; @@ -199,11 +202,11 @@ pass1(void) inosused = 0; else inosused = lastino - (c * sblock.fs_ipg); - if (rebuildcg && inosused > cgrp.cg_initediblk && + if (rebuildcg && inosused > cgp->cg_initediblk && sblock.fs_magic == FS_UFS2_MAGIC) { - cgrp.cg_initediblk = roundup(inosused, INOPB(&sblock)); + cgp->cg_initediblk = roundup(inosused, INOPB(&sblock)); pwarn("CYLINDER GROUP %d: FOUND %d VALID INODES\n", c, - cgrp.cg_initediblk); + cgp->cg_initediblk); } /* * If we were not able to determine in advance which inodes @@ -219,7 +222,7 @@ pass1(void) inostathead[c].il_stat = 0; continue; } - info = calloc((unsigned)inosused, sizeof(struct inostat)); + info = Calloc((unsigned)inosused, sizeof(struct inostat)); if (info == NULL) errx(EEXIT, "cannot alloc %u bytes for inoinfo", (unsigned)(sizeof(struct inostat) * inosused)); @@ -482,7 +485,7 @@ pass1check(struct inodesc *idesc) } return (STOP); } - new = (struct dups *)malloc(sizeof(struct dups)); + new = (struct dups *)Malloc(sizeof(struct dups)); if (new == NULL) { pfatal("DUP TABLE OVERFLOW."); if (reply("CONTINUE") == 0) { Modified: head/sbin/fsck_ffs/pass5.c ============================================================================== --- head/sbin/fsck_ffs/pass5.c Fri Mar 22 21:50:32 2013 (r248624) +++ head/sbin/fsck_ffs/pass5.c Fri Mar 22 21:50:43 2013 (r248625) @@ -59,14 +59,14 @@ pass5(void) int c, i, j, blk, frags, basesize, mapsize; int inomapsize, blkmapsize; struct fs *fs = &sblock; - struct cg *cg = &cgrp; ufs2_daddr_t d, dbase, dmax, start; int rewritecg = 0; struct csum *cs; struct csum_total cstotal; struct inodesc idesc[3]; char buf[MAXBSIZE]; - struct cg *newcg = (struct cg *)buf; + struct cg *cg, *newcg = (struct cg *)buf; + struct bufarea *cgbp; inoinfo(WINO)->ino_state = USTATE; memset(newcg, 0, (size_t)fs->fs_cgsize); @@ -162,7 +162,8 @@ pass5(void) c * 100 / sblock.fs_ncg); got_sigalarm = 0; } - getblk(&cgblk, cgtod(fs, c), fs->fs_cgsize); + cgbp = cgget(c); + cg = cgbp->b_un.b_cg; if (!cg_chkmagic(cg)) pfatal("CG %d: BAD MAGIC NUMBER\n", c); newcg->cg_time = cg->cg_time; @@ -324,14 +325,14 @@ pass5(void) } if (rewritecg) { memmove(cg, newcg, (size_t)fs->fs_cgsize); - cgdirty(); + dirty(cgbp); continue; } if (cursnapshot == 0 && memcmp(newcg, cg, basesize) != 0 && dofix(&idesc[2], "SUMMARY INFORMATION BAD")) { memmove(cg, newcg, (size_t)basesize); - cgdirty(); + dirty(cgbp); } if (bkgrdflag != 0 || usedsoftdep || debug) update_maps(cg, newcg, bkgrdflag); @@ -340,7 +341,7 @@ pass5(void) dofix(&idesc[1], "BLK(S) MISSING IN BIT MAPS")) { memmove(cg_inosused(cg), cg_inosused(newcg), (size_t)mapsize); - cgdirty(); + dirty(cgbp); } } if (cursnapshot == 0 && Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Fri Mar 22 21:50:32 2013 (r248624) +++ head/sbin/fsck_ffs/setup.c Fri Mar 22 21:50:43 2013 (r248625) @@ -240,7 +240,7 @@ setup(char *dev) * read in the summary info. */ asked = 0; - sblock.fs_csp = calloc(1, sblock.fs_cssize); + sblock.fs_csp = Calloc(1, sblock.fs_cssize); if (sblock.fs_csp == NULL) { printf("cannot alloc %u bytes for cg summary info\n", (unsigned)sblock.fs_cssize); @@ -265,13 +265,13 @@ setup(char *dev) * allocate and initialize the necessary maps */ bmapsize = roundup(howmany(maxfsblock, CHAR_BIT), sizeof(short)); - blockmap = calloc((unsigned)bmapsize, sizeof (char)); + blockmap = Calloc((unsigned)bmapsize, sizeof (char)); if (blockmap == NULL) { printf("cannot alloc %u bytes for blockmap\n", (unsigned)bmapsize); goto badsb; } - inostathead = calloc((unsigned)(sblock.fs_ncg), + inostathead = Calloc((unsigned)(sblock.fs_ncg), sizeof(struct inostatlist)); if (inostathead == NULL) { printf("cannot alloc %u bytes for inostathead\n", @@ -282,9 +282,9 @@ setup(char *dev) dirhash = numdirs; inplast = 0; listmax = numdirs + 10; - inpsort = (struct inoinfo **)calloc((unsigned)listmax, + inpsort = (struct inoinfo **)Calloc((unsigned)listmax, sizeof(struct inoinfo *)); - inphead = (struct inoinfo **)calloc((unsigned)numdirs, + inphead = (struct inoinfo **)Calloc((unsigned)numdirs, sizeof(struct inoinfo *)); if (inpsort == NULL || inphead == NULL) { printf("cannot alloc %ju bytes for inphead\n", @@ -444,8 +444,8 @@ sblock_init(void) lfdir = 0; initbarea(&sblk, BT_SUPERBLK); initbarea(&asblk, BT_SUPERBLK); - sblk.b_un.b_buf = malloc(SBLOCKSIZE); - asblk.b_un.b_buf = malloc(SBLOCKSIZE); + sblk.b_un.b_buf = Malloc(SBLOCKSIZE); + asblk.b_un.b_buf = Malloc(SBLOCKSIZE); if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL) errx(EEXIT, "cannot allocate space for superblock"); if ((lp = getdisklabel(NULL, fsreadfd))) Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Fri Mar 22 21:50:32 2013 (r248624) +++ head/sbin/fsck_ffs/suj.c Fri Mar 22 21:50:43 2013 (r248625) @@ -161,7 +161,7 @@ errmalloc(size_t n) { void *a; - a = malloc(n); + a = Malloc(n); if (a == NULL) err(EX_OSERR, "malloc(%zu)", n); return (a); @@ -194,7 +194,7 @@ opendisk(const char *devnam) { if (disk != NULL) return; - disk = malloc(sizeof(*disk)); + disk = Malloc(sizeof(*disk)); if (disk == NULL) err(EX_OSERR, "malloc(%zu)", sizeof(*disk)); if (ufs_disk_fillout(disk, devnam) == -1) { From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 22:46:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 06FAECC9; Fri, 22 Mar 2013 22:46:20 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EDE072AF; Fri, 22 Mar 2013 22:46:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2MMkJjw065344; Fri, 22 Mar 2013 22:46:19 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2MMkJaa065343; Fri, 22 Mar 2013 22:46:19 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201303222246.r2MMkJaa065343@svn.freebsd.org> From: Xin LI Date: Fri, 22 Mar 2013 22:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248627 - head/sys/dev/mfi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 22:46:20 -0000 Author: delphij Date: Fri Mar 22 22:46:19 2013 New Revision: 248627 URL: http://svnweb.freebsd.org/changeset/base/248627 Log: Don't attempt to reference sc before testing whether it's NULL. Submitted by: Sascha Wildner Obtained from: DragonFly MFC after: 2 weeks Modified: head/sys/dev/mfi/mfi_disk.c Modified: head/sys/dev/mfi/mfi_disk.c ============================================================================== --- head/sys/dev/mfi/mfi_disk.c Fri Mar 22 22:40:16 2013 (r248626) +++ head/sys/dev/mfi/mfi_disk.c Fri Mar 22 22:46:19 2013 (r248627) @@ -261,7 +261,6 @@ mfi_disk_strategy(struct bio *bio) struct mfi_softc *controller; sc = bio->bio_disk->d_drv1; - controller = sc->ld_controller; if (sc == NULL) { bio->bio_error = EINVAL; @@ -271,6 +270,7 @@ mfi_disk_strategy(struct bio *bio) return; } + controller = sc->ld_controller; if (controller->adpreset) { bio->bio_error = EBUSY; return; From owner-svn-src-head@FreeBSD.ORG Fri Mar 22 23:56:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B26A177B; Fri, 22 Mar 2013 23:56:31 +0000 (UTC) (envelope-from seanwbruno@gmail.com) Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by mx1.freebsd.org (Postfix) with ESMTP id 7DB7DAFE; Fri, 22 Mar 2013 23:56:31 +0000 (UTC) Received: by mail-pa0-f45.google.com with SMTP id kl13so157457pab.4 for ; Fri, 22 Mar 2013 16:56:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:subject:from:reply-to:to:cc:in-reply-to:references :content-type:date:message-id:mime-version:x-mailer; bh=d9fBzI0pheiT0qso9Z+kpSZHp5LWUSRPTZXbooMsfV0=; b=T5OiCMeMNKwD2xhZu90yAgGqx6zdT+jw/uImYmFvTOzQH5LXIb0JTLrvsN6+d4wK2L A9ZCNBAx0euXY+weqeCp5g61225tkHzKuARB6Sn0KtA3WgOmoGS+T9OiZvByltHNptgk 1YBN4Xr6fReWOhzkkj3AOHiOv+UFNZy2YW8JkmGXfrVRrATQXEgzK56DADV8/ZWaDK/y 7ZFcU85Wezele2htIeYYKTwGQyvYVFR4DpbpzAixZ+inzXOtPGww4fBH6HTzZKcnUS4D 2NdCAZtS0vzPa8dP8n7PmnaakkldNXd5kSp9Axrf0DDZ8oR9VyrZQM4vSjXCPQwd+Jrr Wb3w== X-Received: by 10.68.138.193 with SMTP id qs1mr5455573pbb.9.1363996116093; Fri, 22 Mar 2013 16:48:36 -0700 (PDT) Received: from [10.73.160.242] (nat-dip7.cfw-a-gci.corp.yahoo.com. [209.131.62.116]) by mx.google.com with ESMTPS id ip8sm3935010pbc.39.2013.03.22.16.48.34 (version=SSLv3 cipher=RC4-SHA bits=128/128); Fri, 22 Mar 2013 16:48:35 -0700 (PDT) Subject: Re: svn commit: r248625 - head/sbin/fsck_ffs From: Sean Bruno To: Kirk McKusick In-Reply-To: <201303222150.r2MLoibe044748@svn.freebsd.org> References: <201303222150.r2MLoibe044748@svn.freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-aC78PBwPjNSu90Qgo2Qi" Date: Fri, 22 Mar 2013 16:48:32 -0700 Message-ID: <1363996112.2270.19.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: sbruno@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 23:56:31 -0000 --=-aC78PBwPjNSu90Qgo2Qi Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On Fri, 2013-03-22 at 21:50 +0000, Kirk McKusick wrote: > Author: mckusick > Date: Fri Mar 22 21:50:43 2013 > New Revision: 248625 > URL: http://svnweb.freebsd.org/changeset/base/248625 >=20 > Log: > Speed up fsck by caching the cylinder group maps in pass1 so > that they do not need to be read again in pass5. As this nearly > doubles the memory requirement for fsck, the cache is thrown away > if other memory needs in fsck would otherwise fail. Thus, the > memory footprint of fsck remains unchanged in memory constrained > environments. Going to shovel this into svn in a minute. This repairs the clang build. http://people.freebsd.org/~sbruno/fsutil_c.txt Sean --=-aC78PBwPjNSu90Qgo2Qi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAABAgAGBQJRTO3QAAoJEBkJRdwI6BaHCGMH/AiQbDXc2/3me3pJucdbHK/G jmiAIcLgmQGUPvOJpvv8UuIZiQ3KVZSHR9MlcDUOh9im4HEn3OPttxJOAcBA/2GK uKVraDh89DjwaNhkjmSJxN3fXg7R8+32LJX/eeJxS1VVRbsUY2oRNbFsahKHP61l WGzCkC0sq2TgNQ56wEgDIGzuW2166DyVK2Qv0zZvqEHMV2nnAIQZd328EccwEgT4 GHuiqeTRNWliOXhh51xoXzPXkZnOThWWCdQ+PnfO46QqYK8iuumfj4uQvu1b4DTy TwFl5/rqHfGw8vRtZUydhC4Md4PNF5lStCDXu2iC53AABQ21p1AcvjfOFU4mimQ= =ZP2z -----END PGP SIGNATURE----- --=-aC78PBwPjNSu90Qgo2Qi-- From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 00:00:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4A4469A1; Sat, 23 Mar 2013 00:00:13 +0000 (UTC) (envelope-from seanwbruno@gmail.com) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by mx1.freebsd.org (Postfix) with ESMTP id 1696CB44; Sat, 23 Mar 2013 00:00:12 +0000 (UTC) Received: by mail-pd0-f169.google.com with SMTP id 3so1868982pdj.28 for ; Fri, 22 Mar 2013 17:00:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:subject:from:reply-to:to:cc:in-reply-to:references :content-type:date:message-id:mime-version:x-mailer; bh=QltWwBFTsp4aX86uDuOHl9wmmVx4wjlAjIFSzne8NvU=; b=WCVoeEsySkkzVlsIG+xDVjgd1NShWl4PchyXiYmpUrPlcZYd4wRsknI5qCVJ8hffSk 4pWKc87j+eCbTaV1bIUY4bKentvD5j8ew0KPrDRb3S9Eeq5lfa+HeUw1Nil78lUEoB7S tX8oLZE8uWsdN0jUEaWBtz4h07TJj7NVMoqfvUUrPD53sNfH4Omdkjaqq9M4OGH4UGlV 7c/hTcI9Tnqc6BiXXHzATcd5eNnkLpaGHflhIvdCkWrX+nFOU6+dRmapDAPf1Zbj1ngY ERTdWbeZ3Vjust84WNEeVBRfYM4MOtfAA+XKozlEWDnr8NRnAMmfWmX6TOP9imTSO0OG OM8g== X-Received: by 10.66.252.202 with SMTP id zu10mr6058583pac.75.1363996812576; Fri, 22 Mar 2013 17:00:12 -0700 (PDT) Received: from [10.73.160.242] (nat-dip7.cfw-a-gci.corp.yahoo.com. [209.131.62.116]) by mx.google.com with ESMTPS id qp13sm4015173pbb.3.2013.03.22.17.00.10 (version=SSLv3 cipher=RC4-SHA bits=128/128); Fri, 22 Mar 2013 17:00:11 -0700 (PDT) Subject: Re: svn commit: r248625 - head/sbin/fsck_ffs From: Sean Bruno To: Kirk McKusick In-Reply-To: <201303222150.r2MLoibe044748@svn.freebsd.org> References: <201303222150.r2MLoibe044748@svn.freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-EiqsU22rzNcc/Zza4QVn" Date: Fri, 22 Mar 2013 17:00:09 -0700 Message-ID: <1363996809.2270.20.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: sbruno@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 00:00:13 -0000 --=-EiqsU22rzNcc/Zza4QVn Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This completely breaks sbin/fsdb ...=20 Warning: Object directory not changed from original /home/sbruno/bsd/head/sbin/fsdb cc -O2 -pipe -I/home/sbruno/bsd/head/sbin/fsdb/../fsck_ffs -std=3Dgnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-conversion -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -c fsdb.c fsdb.c:444:23: error: use of undeclared identifier 'cgrp'; did you mean 'cgp'? struct cg *cgp =3D &cgrp; ^~~~ cgp fsdb.c:444:16: note: 'cgp' declared here struct cg *cgp =3D &cgrp; ^ fsdb.c:444:16: error: incompatible pointer types initializing 'struct cg *' with an expression of type 'struct cg **'; remove & [-Werror,-Wincompatible-pointer-types] struct cg *cgp =3D &cgrp; ^ ~~~~~ fsdb.c:476:10: error: use of undeclared identifier 'cgblk' getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize); ^ fsdb.c:477:14: error: use of undeclared identifier 'cgblk' memcpy(cgp, cgblk.b_un.b_cg, sblock.fs_cgsize); ^ 4 errors generated. *** [fsdb.o] Error code 1 On Fri, 2013-03-22 at 21:50 +0000, Kirk McKusick wrote: > Modified: head/sbin/fsck_ffs/fsck.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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sbin/fsck_ffs/fsck.h Fri Mar 22 21:50:32 > 2013 (r248624) > +++ head/sbin/fsck_ffs/fsck.h Fri Mar 22 21:50:43 > 2013 (r248625) > @@ -198,7 +198,6 @@ struct timespec totalreadtime[BT_NUMBUFT > struct timespec startprog; > =20 > struct bufarea sblk; /* file system superblock */ > -struct bufarea cgblk; /* cylinder group blocks */ > struct bufarea *pdirbp; /* current directory contents > */ > struct bufarea *pbp; /* current inode block */ > =20 > @@ -216,9 +215,7 @@ struct bufarea *pbp; /* current > inode b > } while (0) > =20 > #define sbdirty() dirty(&sblk) > -#define cgdirty() dirty(&cgblk) > #define sblock (*sblk.b_un.b_fs) > -#define cgrp (*cgblk.b_un.b_cg)=20 --=-EiqsU22rzNcc/Zza4QVn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAABAgAGBQJRTPCJAAoJEBkJRdwI6BaHx2UH/3oUXC3O/hzfnbeD4Shh9Yis 3ETvg61nt1ZSX4Z35RTYjQA36rR87PH5FP9ZhymuCEsYWtRLfpffEQfOX0F/KG/0 RS+L1xCGeLA/3oqHZ26r6WJtY7pEaJvu7NYHamaOqosmvd8H4YLLpBS/4n/rkq6T DPGgbSR2oNUfPzZyWhWBggFwmkLKMBIdolE1BXrP/lEi1CRYUFMonvbv4QWeL2bj n7pykq5GPyErbgvrU4DOgoqbn54NZD8tBEuH2cS494YidHlUCVy8DEOyYzHTkj2V fSCnB8i4LEruI2YjduQQ/LDYi210/lMMi0DFIAIuOlOUkKXXPHjqQKmgK9McVv0= =L3iS -----END PGP SIGNATURE----- --=-EiqsU22rzNcc/Zza4QVn-- From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 01:25:11 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EA69CA67; Sat, 23 Mar 2013 01:25:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DB3E661D; Sat, 23 Mar 2013 01:25:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2N1PBab014487; Sat, 23 Mar 2013 01:25:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2N1PBd4014484; Sat, 23 Mar 2013 01:25:11 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303230125.r2N1PBd4014484@svn.freebsd.org> From: Adrian Chadd Date: Sat, 23 Mar 2013 01:25:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248632 - head/tools/tools/ath/athalq X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 01:25:12 -0000 Author: adrian Date: Sat Mar 23 01:25:11 2013 New Revision: 248632 URL: http://svnweb.freebsd.org/changeset/base/248632 Log: Add AR9300 descriptor decoding. Added: head/tools/tools/ath/athalq/ar9300_ds.c (contents, props changed) head/tools/tools/ath/athalq/ar9300_ds.h (contents, props changed) Added: head/tools/tools/ath/athalq/ar9300_ds.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athalq/ar9300_ds.c Sat Mar 23 01:25:11 2013 (r248632) @@ -0,0 +1,343 @@ +/* + * Copyright (c) 2012 Adrian Chadd + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include "ar9300_ds.h" + +/* XXX should break this out into if_athvar.h */ + +#define MS(_v, _f) ( ((_v) & (_f)) >> _f##_S ) +#define MF(_v, _f) ( !! ((_v) & (_f))) + +static void +ar9300_decode_txstatus(struct if_ath_alq_payload *a) +{ + struct ar9300_txs txs; + + /* XXX assumes txs is smaller than PAYLOAD_LEN! */ + memcpy(&txs, &a->payload, sizeof(struct ar9300_txs)); + + printf("[%u.%06u] [%llu] TXSTATUS\n", + (unsigned int) be32toh(a->hdr.tstamp_sec), + (unsigned int) be32toh(a->hdr.tstamp_usec), + (unsigned long long) be64toh(a->hdr.threadid)); + printf(" DescId=0x%08x\n", txs.status1); + + printf(" DescLen=%d, TxQcuNum=%d, CtrlStat=%d, DescId=0x%04x\n", + txs.ds_info & 0xff, + MS(txs.ds_info, AR_tx_qcu_num), + MS(txs.ds_info, AR_ctrl_stat), + MS(txs.ds_info, AR_desc_id)); + + printf(" TxTimestamp=0x%08x\n", txs.status4); + + printf(" TxDone=%d, SeqNo=%d, TxOpExceed=%d, TXBFStatus=%d\n", + MF(txs.status8, AR_tx_done), + MS(txs.status8, AR_seq_num), + MF(txs.status8, AR_tx_op_exceeded), + MS(txs.status8, AR_TXBFStatus)); + + printf(" TXBfMismatch=%d, BFStreamMiss=%d, FinalTxIdx=%d\n", + MF(txs.status8, AR_tx_bf_bw_mismatch), + MF(txs.status8, AR_tx_bf_stream_miss), + MS(txs.status8, AR_final_tx_idx)); + + printf(" TxBfDestMiss=%d, TxBfExpired=%d, PwrMgmt=%d, Tid=%d," + " FastTsBit=%d\n", + MF(txs.status8, AR_tx_bf_dest_miss), + MF(txs.status8, AR_tx_bf_expired), + MF(txs.status8, AR_power_mgmt), + MS(txs.status8, AR_tx_tid), + MF(txs.status8, AR_tx_fast_ts)); + + printf(" Frmok=%d, xretries=%d, fifounderrun=%d, filt=%d\n", + MF(txs.status3, AR_frm_xmit_ok), + MF(txs.status3, AR_excessive_retries), + MF(txs.status3, AR_fifounderrun), + MF(txs.status3, AR_filtered)); + printf(" DelimUnderrun=%d, DataUnderun=%d, DescCfgErr=%d," + " TxTimerExceeded=%d\n", + MF(txs.status3, AR_tx_delim_underrun), + MF(txs.status3, AR_tx_data_underrun), + MF(txs.status3, AR_desc_cfg_err), + MF(txs.status3, AR_tx_timer_expired)); + + printf(" RTScnt=%d, FailCnt=%d, VRetryCnt=%d\n", + MS(txs.status3, AR_rts_fail_cnt), + MS(txs.status3, AR_data_fail_cnt), + MS(txs.status3, AR_virt_retry_cnt)); + + + + printf(" RX RSSI 0 [%d %d %d]\n", + MS(txs.status2, AR_tx_rssi_ant00), + MS(txs.status2, AR_tx_rssi_ant01), + MS(txs.status2, AR_tx_rssi_ant02)); + + printf(" RX RSSI 1 [%d %d %d] Comb=%d\n", + MS(txs.status7, AR_tx_rssi_ant10), + MS(txs.status7, AR_tx_rssi_ant11), + MS(txs.status7, AR_tx_rssi_ant12), + MS(txs.status7, AR_tx_rssi_combined)); + + printf(" BA Valid=%d\n", + MF(txs.status2, AR_tx_ba_status)); + + printf(" BALow=0x%08x\n", txs.status5); + printf(" BAHigh=0x%08x\n", txs.status6); + + printf("\n ------ \n"); +} + +/* + * Note - these are rounded up to 128 bytes; but we + * only use 96 bytes from it. + */ +static void +ar9300_decode_txdesc(struct if_ath_alq_payload *a) +{ + struct ar9300_txc txc; + + /* XXX assumes txs is smaller than PAYLOAD_LEN! */ + memcpy(&txc, &a->payload, 96); + + printf("[%u.%06u] [%llu] TXD\n", + (unsigned int) be32toh(a->hdr.tstamp_sec), + (unsigned int) be32toh(a->hdr.tstamp_usec), + (unsigned long long) be64toh(a->hdr.threadid)); + + printf(" DescLen=%d, TxQcuNum=%d, CtrlStat=%d, DescId=0x%04x\n", + txc.ds_info & 0xff, + MS(txc.ds_info, AR_tx_qcu_num), + MS(txc.ds_info, AR_ctrl_stat), + MS(txc.ds_info, AR_desc_id)); + + /* link */ + printf(" Link 0x%08x\n", txc.ds_link); + + /* data0 */ + printf(" Data0 0x%08x Len %d\n", + txc.ds_data0, + MS(txc.ds_ctl3, AR_buf_len)); + + /* data1 */ + printf(" Data1 0x%08x Len %d\n", + txc.ds_data1, + MS(txc.ds_ctl5, AR_buf_len)); + + /* data2 */ + printf(" Data2 0x%08x Len %d\n", + txc.ds_data2, + MS(txc.ds_ctl7, AR_buf_len)); + + /* data3 */ + printf(" Data3 0x%08x Len %d\n", + txc.ds_data3, + MS(txc.ds_ctl9, AR_buf_len)); + + + /* ctl10 */ + printf(" Desc ID=0x%04x, Chksum=0x%04x (ctl10=0x%08x)\n", + MS(txc.ds_ctl10, AR_tx_desc_id), + txc.ds_ctl10 & AR_tx_ptr_chk_sum, + txc.ds_ctl10); + + /* ctl11 */ + printf(" Frame Len=%d, VMF=%d, LowRxChain=%d, TxClrRetry=%d\n", + txc.ds_ctl11 & AR_frame_len, + MF(txc.ds_ctl11, AR_virt_more_frag), + MF(txc.ds_ctl11, AR_low_rx_chain), + MF(txc.ds_ctl11, AR_tx_clear_retry)); + printf(" TX power 0 = %d, RtsEna=%d, Veol=%d, ClrDstMask=%d\n", + MS(txc.ds_ctl11, AR_xmit_power0), + MF(txc.ds_ctl11, AR_rts_enable), + MF(txc.ds_ctl11, AR_veol), + MF(txc.ds_ctl11, AR_clr_dest_mask)); + printf(" TxIntrReq=%d, DestIdxValid=%d, CtsEnable=%d\n", + MF(txc.ds_ctl11, AR_tx_intr_req), + MF(txc.ds_ctl11, AR_dest_idx_valid), + MF(txc.ds_ctl11, AR_cts_enable)); + + /* ctl12 */ + printf(" Paprd Chain Mask=0x%x, TxMore=%d, DestIdx=%d," + " FrType=0x%x\n", + MS(txc.ds_ctl12, AR_paprd_chain_mask), + MF(txc.ds_ctl12, AR_tx_more), + MS(txc.ds_ctl12, AR_dest_idx), + MS(txc.ds_ctl12, AR_frame_type)); + printf(" NoAck=%d, InsertTs=%d, CorruptFcs=%d, ExtOnly=%d," + " ExtAndCtl=%d\n", + MF(txc.ds_ctl12, AR_no_ack), + MF(txc.ds_ctl12, AR_insert_ts), + MF(txc.ds_ctl12, AR_corrupt_fcs), + MF(txc.ds_ctl12, AR_ext_only), + MF(txc.ds_ctl12, AR_ext_and_ctl)); + printf(" IsAggr=%d, MoreRifs=%d, LocMode=%d\n", + MF(txc.ds_ctl12, AR_is_aggr), + MF(txc.ds_ctl12, AR_more_rifs), + MF(txc.ds_ctl12, AR_loc_mode)); + + + /* ctl13 */ + printf(" DurUpEna=%d, Burstdur=0x%04x\n", + MF(txc.ds_ctl13, AR_dur_update_ena), + MS(txc.ds_ctl13, AR_burst_dur)); + printf(" Try0=%d, Try1=%d, Try2=%d, Try3=%d\n", + MS(txc.ds_ctl13, AR_xmit_data_tries0), + MS(txc.ds_ctl13, AR_xmit_data_tries1), + MS(txc.ds_ctl13, AR_xmit_data_tries2), + MS(txc.ds_ctl13, AR_xmit_data_tries3)); + + /* ctl14 */ + printf(" rate0=0x%02x, rate1=0x%02x, rate2=0x%02x, rate3=0x%02x\n", + MS(txc.ds_ctl14, AR_xmit_rate0), + MS(txc.ds_ctl14, AR_xmit_rate1), + MS(txc.ds_ctl14, AR_xmit_rate2), + MS(txc.ds_ctl14, AR_xmit_rate3)); + + /* ctl15 */ + printf(" try 0: PktDur=%d, RTS/CTS ena=%d\n", + MS(txc.ds_ctl15, AR_packet_dur0), + MF(txc.ds_ctl15, AR_rts_cts_qual0)); + printf(" try 1: PktDur=%d, RTS/CTS ena=%d\n", + MS(txc.ds_ctl15, AR_packet_dur1), + MF(txc.ds_ctl15, AR_rts_cts_qual1)); + + /* ctl16 */ + printf(" try 2: PktDur=%d, RTS/CTS ena=%d\n", + MS(txc.ds_ctl16, AR_packet_dur2), + MF(txc.ds_ctl16, AR_rts_cts_qual2)); + printf(" try 3: PktDur=%d, RTS/CTS ena=%d\n", + MS(txc.ds_ctl16, AR_packet_dur3), + MF(txc.ds_ctl16, AR_rts_cts_qual3)); + + /* ctl17 */ + printf(" AggrLen=%d, PadDelim=%d, EncrType=%d, TxDcApStaSel=%d\n", + MS(txc.ds_ctl17, AR_aggr_len), + MS(txc.ds_ctl17, AR_pad_delim), + MS(txc.ds_ctl17, AR_encr_type), + MF(txc.ds_ctl17, AR_tx_dc_ap_sta_sel)); + printf(" Calib=%d LDPC=%d\n", + MF(txc.ds_ctl17, AR_calibrating), + MF(txc.ds_ctl17, AR_ldpc)); + + /* ctl18 */ + printf(" try 0: chainMask=0x%x, GI=%d, 2040=%d, STBC=%d\n", + MS(txc.ds_ctl18, AR_chain_sel0), + MF(txc.ds_ctl18, AR_gi0), + MF(txc.ds_ctl18, AR_2040_0), + MF(txc.ds_ctl18, AR_stbc0)); + printf(" try 1: chainMask=0x%x, GI=%d, 2040=%d, STBC=%d\n", + MS(txc.ds_ctl18, AR_chain_sel1), + MF(txc.ds_ctl18, AR_gi1), + MF(txc.ds_ctl18, AR_2040_1), + MF(txc.ds_ctl18, AR_stbc1)); + printf(" try 2: chainMask=0x%x, GI=%d, 2040=%d, STBC=%d\n", + MS(txc.ds_ctl18, AR_chain_sel2), + MF(txc.ds_ctl18, AR_gi2), + MF(txc.ds_ctl18, AR_2040_2), + MF(txc.ds_ctl18, AR_stbc2)); + printf(" try 3: chainMask=0x%x, GI=%d, 2040=%d, STBC=%d\n", + MS(txc.ds_ctl18, AR_chain_sel3), + MF(txc.ds_ctl18, AR_gi3), + MF(txc.ds_ctl18, AR_2040_3), + MF(txc.ds_ctl18, AR_stbc3)); + + /* ctl19 */ + printf(" NotSounding=%d\n", + MF(txc.ds_ctl19, AR_not_sounding)); + + printf(" try 0: ant=0x%08x, antsel=%d, ness=%d\n", + txc.ds_ctl19 & AR_tx_ant0, + MF(txc.ds_ctl19, AR_tx_ant_sel0), + MS(txc.ds_ctl19, AR_ness)); + + /* ctl20 */ + printf(" try 1: TxPower=%d, ant=0x%08x, antsel=%d, ness=%d\n", + MS(txc.ds_ctl20, AR_xmit_power1), + txc.ds_ctl20 & AR_tx_ant1, + MF(txc.ds_ctl20, AR_tx_ant_sel1), + MS(txc.ds_ctl20, AR_ness1)); + + /* ctl21 */ + printf(" try 2: TxPower=%d, ant=0x%08x, antsel=%d, ness=%d\n", + MS(txc.ds_ctl21, AR_xmit_power2), + txc.ds_ctl21 & AR_tx_ant2, + MF(txc.ds_ctl21, AR_tx_ant_sel2), + MS(txc.ds_ctl21, AR_ness2)); + + /* ctl22 */ + printf(" try 3: TxPower=%d, ant=0x%08x, antsel=%d, ness=%d\n", + MS(txc.ds_ctl22, AR_xmit_power3), + txc.ds_ctl22 & AR_tx_ant3, + MF(txc.ds_ctl22, AR_tx_ant_sel3), + MS(txc.ds_ctl22, AR_ness3)); + + printf("\n ------ \n"); +} + +static void +ar9300_decode_rxstatus(struct if_ath_alq_payload *a) +{ + struct ar9300_rxs rxs; + + /* XXX assumes rxs is smaller than PAYLOAD_LEN! */ + memcpy(&rxs, &a->payload, sizeof(struct ar9300_rxs)); + + printf("[%u.%06u] [%llu] RXSTATUS\n", + (unsigned int) be32toh(a->hdr.tstamp_sec), + (unsigned int) be32toh(a->hdr.tstamp_usec), + (unsigned long long) be64toh(a->hdr.threadid)); +} + +void +ar9300_alq_payload(struct if_ath_alq_payload *a) +{ + + switch (be16toh(a->hdr.op)) { + case ATH_ALQ_EDMA_TXSTATUS: /* TXSTATUS */ + ar9300_decode_txstatus(a); + break; + case ATH_ALQ_EDMA_RXSTATUS: /* RXSTATUS */ + ar9300_decode_rxstatus(a); + break; + case ATH_ALQ_EDMA_TXDESC: /* TXDESC */ + ar9300_decode_txdesc(a); + break; + default: + printf("[%d.%06d] [%lld] op: %d; len %d\n", + be32toh(a->hdr.tstamp_sec), + be32toh(a->hdr.tstamp_usec), + be64toh(a->hdr.threadid), + be16toh(a->hdr.op), be16toh(a->hdr.len)); + } +} Added: head/tools/tools/ath/athalq/ar9300_ds.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athalq/ar9300_ds.h Sat Mar 23 01:25:11 2013 (r248632) @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2012 Adrian Chadd + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ +#ifndef __AR9300_DS_H__ +#define __AR9300_DS_H__ + +extern void ar9300_alq_payload(struct if_ath_alq_payload *a); + +#endif /* __AR9300_DS_H__ */ From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 04:26:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8DEECD21; Sat, 23 Mar 2013 04:26:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from onyx.glenbarber.us (onyx.glenbarber.us [IPv6:2607:fc50:1000:c200::face]) by mx1.freebsd.org (Postfix) with ESMTP id 44725F68; Sat, 23 Mar 2013 04:26:14 +0000 (UTC) Received: from glenbarber.us (nucleus.glenbarber.us [IPv6:2001:470:8:1205:2:2:ff:29]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gjb) by onyx.glenbarber.us (Postfix) with ESMTPSA id 1F6A023F66A; Sat, 23 Mar 2013 00:26:11 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.8.0 onyx.glenbarber.us 1F6A023F66A Authentication-Results: onyx.glenbarber.us; dkim=none reason="no signature"; dkim-adsp=none Date: Sat, 23 Mar 2013 00:26:08 -0400 From: Glen Barber To: Kirk McKusick Subject: Re: svn commit: r248625 - head/sbin/fsck_ffs Message-ID: <20130323042608.GF1512@glenbarber.us> References: <201303222150.r2MLoibe044748@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cz6wLo+OExbGG7q/" Content-Disposition: inline In-Reply-To: <201303222150.r2MLoibe044748@svn.freebsd.org> X-Operating-System: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, Kirk McKusick , svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 04:26:14 -0000 --cz6wLo+OExbGG7q/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 22, 2013 at 09:50:44PM +0000, Kirk McKusick wrote: > Author: mckusick > Date: Fri Mar 22 21:50:43 2013 > New Revision: 248625 > URL: http://svnweb.freebsd.org/changeset/base/248625 >=20 This commit breaks sbin/fsdb: gjb@nucleus:~/freebsd/src/head/sbin/fsdb % make Warning: Object directory not changed from original /freebsd/src/head/sbin/fsdb /usr/local/libexec/ccache/world/cc -O2 -pipe -I/freebsd/src/head/sbin/fsdb/../fsck_ffs -std=3Dgnu99 -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -c fsdb.c fsdb.c: In function 'findblk': fsdb.c:444: error: 'cgrp' undeclared (first use in this function) fsdb.c:444: error: (Each undeclared identifier is reported only once fsdb.c:444: error: for each function it appears in.) fsdb.c:476: error: 'cgblk' undeclared (first use in this function) *** [fsdb.o] Error code 1 Stop in /freebsd/src/head/sbin/fsdb. Glen --cz6wLo+OExbGG7q/ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBCAAGBQJRTS7gAAoJEFJPDDeguUajvyoIAKluWguqBuP2U8MfBk6fs8Tg cSb4vijEV6eOVyp3bwqbZKMlUWs9Pa3Dt9/rp3ip9126Is+xZaspLjfyCCXfj+lK gKcnIh16mkXN4BGwvqmMThYnAeJOx0Pt3VqMShjsUP+/GUK26kyo7rcyhp94pgNq KDNot8H4ZoXd62L+yscY7MDcNPwkxz4rpb6zB60Ygp02LMXDRJG2S6pkdHG9WEJP r8BBUSrFeDW/U9wDNlKCQqtqa/uQzk6xMtIMwnPnlgoHJZx1wp8mkJZzFFVHjZne Z/Qll+VYpcvWq3HJ61vGfXq/xBhzhDPQ82dRcXA+qbDbEd21FkKfU3PEPe2f7RU= =SGaw -----END PGP SIGNATURE----- --cz6wLo+OExbGG7q/-- From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 04:26:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 948ADD24; Sat, 23 Mar 2013 04:26:15 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 78675F69; Sat, 23 Mar 2013 04:26:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2N4QFhZ073543; Sat, 23 Mar 2013 04:26:15 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2N4QEgm073533; Sat, 23 Mar 2013 04:26:14 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201303230426.r2N4QEgm073533@svn.freebsd.org> From: Sean Bruno Date: Sat, 23 Mar 2013 04:26:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248634 - head/sbin/fsck_ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 04:26:15 -0000 Author: sbruno Date: Sat Mar 23 04:26:13 2013 New Revision: 248634 URL: http://svnweb.freebsd.org/changeset/base/248634 Log: Revert svn r248625 Clang errors around printf could be trivially fixed, but the breakage in sbin/fsdb were to significant for this type of change. Submitter of this changeset has been notified and hopefully this can be restored soon. Modified: head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/fsutil.c head/sbin/fsck_ffs/inode.c head/sbin/fsck_ffs/pass1.c head/sbin/fsck_ffs/pass5.c head/sbin/fsck_ffs/setup.c head/sbin/fsck_ffs/suj.c Modified: head/sbin/fsck_ffs/fsck.h ============================================================================== --- head/sbin/fsck_ffs/fsck.h Sat Mar 23 03:28:20 2013 (r248633) +++ head/sbin/fsck_ffs/fsck.h Sat Mar 23 04:26:13 2013 (r248634) @@ -198,6 +198,7 @@ struct timespec totalreadtime[BT_NUMBUFT struct timespec startprog; struct bufarea sblk; /* file system superblock */ +struct bufarea cgblk; /* cylinder group blocks */ struct bufarea *pdirbp; /* current directory contents */ struct bufarea *pbp; /* current inode block */ @@ -215,7 +216,9 @@ struct bufarea *pbp; /* current inode b } while (0) #define sbdirty() dirty(&sblk) +#define cgdirty() dirty(&cgblk) #define sblock (*sblk.b_un.b_fs) +#define cgrp (*cgblk.b_un.b_cg) enum fixstate {DONTKNOW, NOFIX, FIX, IGNORE}; ino_t cursnapshot; @@ -358,37 +361,6 @@ struct ufs2_dinode ufs2_zino; #define EEXIT 8 /* Standard error exit. */ -int flushentry(void); -/* - * Wrapper for malloc() that flushes the cylinder group cache to try - * to get space. - */ -static inline void* -Malloc(int size) -{ - void *retval; - - while ((retval = malloc(size)) == NULL) - if (flushentry() == 0) - break; - return (retval); -} - -/* - * Wrapper for calloc() that flushes the cylinder group cache to try - * to get space. - */ -static inline void* -Calloc(int cnt, int size) -{ - void *retval; - - while ((retval = calloc(cnt, size)) == NULL) - if (flushentry() == 0) - break; - return (retval); -} - struct fstab; @@ -406,7 +378,7 @@ void cacheino(union dinode *dp, ino_t i void catch(int); void catchquit(int); int changeino(ino_t dir, const char *name, ino_t newnum); -int check_cgmagic(int cg, struct bufarea *cgbp); +int check_cgmagic(int cg, struct cg *cgp); int chkrange(ufs2_daddr_t blk, int cnt); void ckfini(int markclean); int ckinode(union dinode *dp, struct inodesc *); @@ -426,7 +398,6 @@ void freeino(ino_t ino); void freeinodebuf(void); int ftypeok(union dinode *dp); void getblk(struct bufarea *bp, ufs2_daddr_t blk, long size); -struct bufarea *cgget(int cg); struct bufarea *getdatablk(ufs2_daddr_t blkno, long size, int type); struct inoinfo *getinoinfo(ino_t inumber); union dinode *getnextinode(ino_t inumber, int rebuildcg); Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Sat Mar 23 03:28:20 2013 (r248633) +++ head/sbin/fsck_ffs/fsutil.c Sat Mar 23 04:26:13 2013 (r248634) @@ -70,7 +70,6 @@ static struct timespec startpass, finish struct timeval slowio_starttime; int slowio_delay_usec = 10000; /* Initial IO delay for background fsck */ int slowio_pollcnt; -static struct bufarea cgblk; /* backup buffer for cylinder group blocks */ static TAILQ_HEAD(buflist, bufarea) bufhead; /* head of buffer cache list */ static int numbufs; /* size of buffer cache */ static char *buftype[BT_NUMBUFTYPES] = BT_NAMES; @@ -164,7 +163,7 @@ bufinit(void) char *bufp; pbp = pdirbp = (struct bufarea *)0; - bufp = Malloc((unsigned int)sblock.fs_bsize); + bufp = malloc((unsigned int)sblock.fs_bsize); if (bufp == 0) errx(EEXIT, "cannot allocate buffer pool"); cgblk.b_un.b_buf = bufp; @@ -174,8 +173,8 @@ bufinit(void) if (bufcnt < MINBUFS) bufcnt = MINBUFS; for (i = 0; i < bufcnt; i++) { - bp = (struct bufarea *)Malloc(sizeof(struct bufarea)); - bufp = Malloc((unsigned int)sblock.fs_bsize); + bp = (struct bufarea *)malloc(sizeof(struct bufarea)); + bufp = malloc((unsigned int)sblock.fs_bsize); if (bp == NULL || bufp == NULL) { if (i >= MINBUFS) break; @@ -194,57 +193,6 @@ bufinit(void) } /* - * Manage cylinder group buffers. - */ -static struct bufarea *cgbufs; /* header for cylinder group cache */ -static int flushtries; /* number of tries to reclaim memory */ - -struct bufarea * -cgget(int cg) -{ - struct bufarea *cgbp; - struct cg *cgp; - - if (cgbufs == NULL) { - cgbufs = Calloc(sblock.fs_ncg, sizeof(struct bufarea)); - if (cgbufs == NULL) - errx(EEXIT, "cannot allocate cylinder group buffers"); - } - cgbp = &cgbufs[cg]; - if (cgbp->b_un.b_cg != NULL) - return (cgbp); - cgp = NULL; - if (flushtries == 0) - cgp = malloc((unsigned int)sblock.fs_cgsize); - if (cgp == NULL) { - getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize); - return (&cgblk); - } - cgbp->b_un.b_cg = cgp; - initbarea(cgbp, BT_CYLGRP); - getblk(cgbp, cgtod(&sblock, cg), sblock.fs_cgsize); - return (cgbp); -} - -/* - * Attempt to flush a cylinder group cache entry. - * Return whether the flush was successful. - */ -int -flushentry(void) -{ - struct bufarea *cgbp; - - cgbp = &cgbufs[flushtries++]; - if (cgbp->b_un.b_cg == NULL) - return (0); - flush(fswritefd, cgbp); - free(cgbp->b_un.b_buf); - cgbp->b_un.b_buf = NULL; - return (1); -} - -/* * Manage a cache of directory blocks. */ struct bufarea * @@ -415,13 +363,6 @@ ckfini(int markclean) } if (numbufs != cnt) errx(EEXIT, "panic: lost %d buffers", numbufs - cnt); - for (cnt = 0; cnt < sblock.fs_ncg; cnt++) { - if (cgbufs[cnt].b_un.b_cg == NULL) - continue; - flush(fswritefd, &cgbufs[cnt]); - free(cgbufs[cnt].b_un.b_cg); - } - free(cgbufs); pbp = pdirbp = (struct bufarea *)0; if (cursnapshot == 0 && sblock.fs_clean != markclean) { if ((sblock.fs_clean = markclean) != 0) { @@ -507,8 +448,8 @@ static void printIOstats(void) clock_gettime(CLOCK_REALTIME_PRECISE, &finishpass); timespecsub(&finishpass, &startpass); - printf("Running time: %d.%03ld msec\n", - finishpass.tv_sec, finishpass.tv_nsec / 1000000); + msec = finishpass.tv_sec * 1000 + finishpass.tv_nsec / 1000000; + printf("Running time: %lld msec\n", msec); printf("buffer reads by type:\n"); for (totalmsec = 0, i = 0; i < BT_NUMBUFTYPES; i++) totalmsec += readtime[i].tv_sec * 1000 + @@ -519,10 +460,9 @@ static void printIOstats(void) if (readcnt[i] == 0) continue; msec = readtime[i].tv_sec * 1000 + readtime[i].tv_nsec / 1000000; - printf("%21s:%8ld %2ld.%ld%% %4d.%03ld sec %2jd.%jd%%\n", + printf("%21s:%8ld %2ld.%ld%% %8lld msec %2lld.%lld%%\n", buftype[i], readcnt[i], readcnt[i] * 100 / diskreads, - (readcnt[i] * 1000 / diskreads) % 10, - readtime[i].tv_sec, readtime[i].tv_nsec / 1000000, + (readcnt[i] * 1000 / diskreads) % 10, msec, msec * 100 / totalmsec, (msec * 1000 / totalmsec) % 10); } printf("\n"); @@ -622,9 +562,8 @@ blerase(int fd, ufs2_daddr_t blk, long s * test fails, offer an option to rebuild the whole cylinder group. */ int -check_cgmagic(int cg, struct bufarea *cgbp) +check_cgmagic(int cg, struct cg *cgp) { - struct cg *cgp = cgbp->b_un.b_cg; /* * Extended cylinder group checks. @@ -684,7 +623,7 @@ check_cgmagic(int cg, struct bufarea *cg cgp->cg_nextfreeoff = cgp->cg_clusteroff + howmany(fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT); } - dirty(cgbp); + cgdirty(); return (0); } @@ -695,8 +634,7 @@ ufs2_daddr_t allocblk(long frags) { int i, j, k, cg, baseblk; - struct bufarea *cgbp; - struct cg *cgp; + struct cg *cgp = &cgrp; if (frags <= 0 || frags > sblock.fs_frag) return (0); @@ -712,9 +650,8 @@ allocblk(long frags) continue; } cg = dtog(&sblock, i + j); - cgbp = cgget(cg); - cgp = cgbp->b_un.b_cg; - if (!check_cgmagic(cg, cgbp)) + getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize); + if (!check_cgmagic(cg, cgp)) return (0); baseblk = dtogd(&sblock, i + j); for (k = 0; k < frags; k++) { @@ -726,7 +663,7 @@ allocblk(long frags) cgp->cg_cs.cs_nbfree--; else cgp->cg_cs.cs_nffree -= frags; - dirty(cgbp); + cgdirty(); return (i + j); } } Modified: head/sbin/fsck_ffs/inode.c ============================================================================== --- head/sbin/fsck_ffs/inode.c Sat Mar 23 03:28:20 2013 (r248633) +++ head/sbin/fsck_ffs/inode.c Sat Mar 23 04:26:13 2013 (r248634) @@ -423,7 +423,7 @@ setinodebuf(ino_t inum) partialsize = inobufsize; } initbarea(&inobuf, BT_INODES); - if ((inobuf.b_un.b_buf = Malloc((unsigned)inobufsize)) == NULL) + if ((inobuf.b_un.b_buf = malloc((unsigned)inobufsize)) == NULL) errx(EEXIT, "cannot allocate space for inode buffer"); } @@ -454,7 +454,7 @@ cacheino(union dinode *dp, ino_t inumber else blks = howmany(DIP(dp, di_size), sblock.fs_bsize); inp = (struct inoinfo *) - Malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t)); + malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t)); if (inp == NULL) errx(EEXIT, "cannot increase directory list"); inpp = &inphead[inumber % dirhash]; @@ -657,8 +657,7 @@ allocino(ino_t request, int type) { ino_t ino; union dinode *dp; - struct bufarea *cgbp; - struct cg *cgp; + struct cg *cgp = &cgrp; int cg; if (request == 0) @@ -671,9 +670,8 @@ allocino(ino_t request, int type) if (ino == maxino) return (0); cg = ino_to_cg(&sblock, ino); - cgbp = cgget(cg); - cgp = cgbp->b_un.b_cg; - if (!check_cgmagic(cg, cgbp)) + getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize); + if (!check_cgmagic(cg, cgp)) return (0); setbit(cg_inosused(cgp), ino % sblock.fs_ipg); cgp->cg_cs.cs_nifree--; @@ -689,7 +687,7 @@ allocino(ino_t request, int type) default: return (0); } - dirty(cgbp); + cgdirty(); dp = ginode(ino); DIP_SET(dp, di_db[0], allocblk((long)1)); if (DIP(dp, di_db[0]) == 0) { Modified: head/sbin/fsck_ffs/pass1.c ============================================================================== --- head/sbin/fsck_ffs/pass1.c Sat Mar 23 03:28:20 2013 (r248633) +++ head/sbin/fsck_ffs/pass1.c Sat Mar 23 04:26:13 2013 (r248634) @@ -61,8 +61,6 @@ pass1(void) { struct inostat *info; struct inodesc idesc; - struct bufarea *cgbp; - struct cg *cgp; ino_t inumber, inosused, mininos; ufs2_daddr_t i, cgd; u_int8_t *cp; @@ -94,13 +92,12 @@ pass1(void) for (c = 0; c < sblock.fs_ncg; c++) { inumber = c * sblock.fs_ipg; setinodebuf(inumber); - cgbp = cgget(c); - cgp = cgbp->b_un.b_cg; + getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize); rebuildcg = 0; - if (!check_cgmagic(c, cgbp)) + if (!check_cgmagic(c, &cgrp)) rebuildcg = 1; if (!rebuildcg && sblock.fs_magic == FS_UFS2_MAGIC) { - inosused = cgp->cg_initediblk; + inosused = cgrp.cg_initediblk; if (inosused > sblock.fs_ipg) { pfatal( "Too many initialized inodes (%ju > %d) in cylinder group %d\nReset to %d\n", @@ -130,7 +127,7 @@ pass1(void) * read only those inodes in from disk. */ if ((preen || inoopt) && usedsoftdep && !rebuildcg) { - cp = &cg_inosused(cgp)[(inosused - 1) / CHAR_BIT]; + cp = &cg_inosused(&cgrp)[(inosused - 1) / CHAR_BIT]; for ( ; inosused > 0; inosused -= CHAR_BIT, cp--) { if (*cp == 0) continue; @@ -152,7 +149,7 @@ pass1(void) inostathead[c].il_stat = 0; continue; } - info = Calloc((unsigned)inosused, sizeof(struct inostat)); + info = calloc((unsigned)inosused, sizeof(struct inostat)); if (info == NULL) errx(EEXIT, "cannot alloc %u bytes for inoinfo", (unsigned)(sizeof(struct inostat) * inosused)); @@ -172,7 +169,7 @@ pass1(void) * valid number for this cylinder group. */ if (checkinode(inumber, &idesc, rebuildcg) == 0 && - i > cgp->cg_initediblk) + i > cgrp.cg_initediblk) break; } /* @@ -184,16 +181,16 @@ pass1(void) mininos = roundup(inosused + INOPB(&sblock), INOPB(&sblock)); if (inoopt && !preen && !rebuildcg && sblock.fs_magic == FS_UFS2_MAGIC && - cgp->cg_initediblk > 2 * INOPB(&sblock) && - mininos < cgp->cg_initediblk) { - i = cgp->cg_initediblk; + cgrp.cg_initediblk > 2 * INOPB(&sblock) && + mininos < cgrp.cg_initediblk) { + i = cgrp.cg_initediblk; if (mininos < 2 * INOPB(&sblock)) - cgp->cg_initediblk = 2 * INOPB(&sblock); + cgrp.cg_initediblk = 2 * INOPB(&sblock); else - cgp->cg_initediblk = mininos; + cgrp.cg_initediblk = mininos; pwarn("CYLINDER GROUP %d: RESET FROM %ju TO %d %s\n", - c, i, cgp->cg_initediblk, "VALID INODES"); - dirty(cgbp); + c, i, cgrp.cg_initediblk, "VALID INODES"); + cgdirty(); } if (inosused < sblock.fs_ipg) continue; @@ -202,11 +199,11 @@ pass1(void) inosused = 0; else inosused = lastino - (c * sblock.fs_ipg); - if (rebuildcg && inosused > cgp->cg_initediblk && + if (rebuildcg && inosused > cgrp.cg_initediblk && sblock.fs_magic == FS_UFS2_MAGIC) { - cgp->cg_initediblk = roundup(inosused, INOPB(&sblock)); + cgrp.cg_initediblk = roundup(inosused, INOPB(&sblock)); pwarn("CYLINDER GROUP %d: FOUND %d VALID INODES\n", c, - cgp->cg_initediblk); + cgrp.cg_initediblk); } /* * If we were not able to determine in advance which inodes @@ -222,7 +219,7 @@ pass1(void) inostathead[c].il_stat = 0; continue; } - info = Calloc((unsigned)inosused, sizeof(struct inostat)); + info = calloc((unsigned)inosused, sizeof(struct inostat)); if (info == NULL) errx(EEXIT, "cannot alloc %u bytes for inoinfo", (unsigned)(sizeof(struct inostat) * inosused)); @@ -485,7 +482,7 @@ pass1check(struct inodesc *idesc) } return (STOP); } - new = (struct dups *)Malloc(sizeof(struct dups)); + new = (struct dups *)malloc(sizeof(struct dups)); if (new == NULL) { pfatal("DUP TABLE OVERFLOW."); if (reply("CONTINUE") == 0) { Modified: head/sbin/fsck_ffs/pass5.c ============================================================================== --- head/sbin/fsck_ffs/pass5.c Sat Mar 23 03:28:20 2013 (r248633) +++ head/sbin/fsck_ffs/pass5.c Sat Mar 23 04:26:13 2013 (r248634) @@ -59,14 +59,14 @@ pass5(void) int c, i, j, blk, frags, basesize, mapsize; int inomapsize, blkmapsize; struct fs *fs = &sblock; + struct cg *cg = &cgrp; ufs2_daddr_t d, dbase, dmax, start; int rewritecg = 0; struct csum *cs; struct csum_total cstotal; struct inodesc idesc[3]; char buf[MAXBSIZE]; - struct cg *cg, *newcg = (struct cg *)buf; - struct bufarea *cgbp; + struct cg *newcg = (struct cg *)buf; inoinfo(WINO)->ino_state = USTATE; memset(newcg, 0, (size_t)fs->fs_cgsize); @@ -162,8 +162,7 @@ pass5(void) c * 100 / sblock.fs_ncg); got_sigalarm = 0; } - cgbp = cgget(c); - cg = cgbp->b_un.b_cg; + getblk(&cgblk, cgtod(fs, c), fs->fs_cgsize); if (!cg_chkmagic(cg)) pfatal("CG %d: BAD MAGIC NUMBER\n", c); newcg->cg_time = cg->cg_time; @@ -325,14 +324,14 @@ pass5(void) } if (rewritecg) { memmove(cg, newcg, (size_t)fs->fs_cgsize); - dirty(cgbp); + cgdirty(); continue; } if (cursnapshot == 0 && memcmp(newcg, cg, basesize) != 0 && dofix(&idesc[2], "SUMMARY INFORMATION BAD")) { memmove(cg, newcg, (size_t)basesize); - dirty(cgbp); + cgdirty(); } if (bkgrdflag != 0 || usedsoftdep || debug) update_maps(cg, newcg, bkgrdflag); @@ -341,7 +340,7 @@ pass5(void) dofix(&idesc[1], "BLK(S) MISSING IN BIT MAPS")) { memmove(cg_inosused(cg), cg_inosused(newcg), (size_t)mapsize); - dirty(cgbp); + cgdirty(); } } if (cursnapshot == 0 && Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Sat Mar 23 03:28:20 2013 (r248633) +++ head/sbin/fsck_ffs/setup.c Sat Mar 23 04:26:13 2013 (r248634) @@ -240,7 +240,7 @@ setup(char *dev) * read in the summary info. */ asked = 0; - sblock.fs_csp = Calloc(1, sblock.fs_cssize); + sblock.fs_csp = calloc(1, sblock.fs_cssize); if (sblock.fs_csp == NULL) { printf("cannot alloc %u bytes for cg summary info\n", (unsigned)sblock.fs_cssize); @@ -265,13 +265,13 @@ setup(char *dev) * allocate and initialize the necessary maps */ bmapsize = roundup(howmany(maxfsblock, CHAR_BIT), sizeof(short)); - blockmap = Calloc((unsigned)bmapsize, sizeof (char)); + blockmap = calloc((unsigned)bmapsize, sizeof (char)); if (blockmap == NULL) { printf("cannot alloc %u bytes for blockmap\n", (unsigned)bmapsize); goto badsb; } - inostathead = Calloc((unsigned)(sblock.fs_ncg), + inostathead = calloc((unsigned)(sblock.fs_ncg), sizeof(struct inostatlist)); if (inostathead == NULL) { printf("cannot alloc %u bytes for inostathead\n", @@ -282,9 +282,9 @@ setup(char *dev) dirhash = numdirs; inplast = 0; listmax = numdirs + 10; - inpsort = (struct inoinfo **)Calloc((unsigned)listmax, + inpsort = (struct inoinfo **)calloc((unsigned)listmax, sizeof(struct inoinfo *)); - inphead = (struct inoinfo **)Calloc((unsigned)numdirs, + inphead = (struct inoinfo **)calloc((unsigned)numdirs, sizeof(struct inoinfo *)); if (inpsort == NULL || inphead == NULL) { printf("cannot alloc %ju bytes for inphead\n", @@ -444,8 +444,8 @@ sblock_init(void) lfdir = 0; initbarea(&sblk, BT_SUPERBLK); initbarea(&asblk, BT_SUPERBLK); - sblk.b_un.b_buf = Malloc(SBLOCKSIZE); - asblk.b_un.b_buf = Malloc(SBLOCKSIZE); + sblk.b_un.b_buf = malloc(SBLOCKSIZE); + asblk.b_un.b_buf = malloc(SBLOCKSIZE); if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL) errx(EEXIT, "cannot allocate space for superblock"); if ((lp = getdisklabel(NULL, fsreadfd))) Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Sat Mar 23 03:28:20 2013 (r248633) +++ head/sbin/fsck_ffs/suj.c Sat Mar 23 04:26:13 2013 (r248634) @@ -161,7 +161,7 @@ errmalloc(size_t n) { void *a; - a = Malloc(n); + a = malloc(n); if (a == NULL) err(EX_OSERR, "malloc(%zu)", n); return (a); @@ -194,7 +194,7 @@ opendisk(const char *devnam) { if (disk != NULL) return; - disk = Malloc(sizeof(*disk)); + disk = malloc(sizeof(*disk)); if (disk == NULL) err(EX_OSERR, "malloc(%zu)", sizeof(*disk)); if (ufs_disk_fillout(disk, devnam) == -1) { From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 07:57:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F1EF187A; Sat, 23 Mar 2013 07:57:30 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E53419E0; Sat, 23 Mar 2013 07:57:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2N7vUn6039831; Sat, 23 Mar 2013 07:57:30 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2N7vUop039830; Sat, 23 Mar 2013 07:57:30 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201303230757.r2N7vUop039830@svn.freebsd.org> From: Kirk McKusick Date: Sat, 23 Mar 2013 07:57:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248639 - head/sbin/fsdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 07:57:31 -0000 Author: mckusick Date: Sat Mar 23 07:57:30 2013 New Revision: 248639 URL: http://svnweb.freebsd.org/changeset/base/248639 Log: Fix the build after addition of cylinder group cacheing (r248625) Reported by: Glen Barber (gjb@) Pointy hat to: Kirk McKusick (mckusick@) Modified: head/sbin/fsdb/fsdb.c Modified: head/sbin/fsdb/fsdb.c ============================================================================== --- head/sbin/fsdb/fsdb.c Sat Mar 23 07:36:53 2013 (r248638) +++ head/sbin/fsdb/fsdb.c Sat Mar 23 07:57:30 2013 (r248639) @@ -441,7 +441,8 @@ CMDFUNCSTART(findblk) ino_t inum, inosused; uint32_t *wantedblk32; uint64_t *wantedblk64; - struct cg *cgp = &cgrp; + struct bufarea *cgbp; + struct cg *cgp; int c, i, is_ufs2; wantedblksize = (argc - 1); @@ -473,8 +474,8 @@ CMDFUNCSTART(findblk) */ inum = c * sblock.fs_ipg; /* Read cylinder group. */ - getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize); - memcpy(cgp, cgblk.b_un.b_cg, sblock.fs_cgsize); + cgbp = cgget(c); + cgp = cgbp->b_un.b_cg; /* * Get a highest used inode number for a given cylinder group. * For UFS1 all inodes initialized at the newfs stage. From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 08:07:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C34E2D73; Sat, 23 Mar 2013 08:07:51 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from onyx.glenbarber.us (onyx.glenbarber.us [IPv6:2607:fc50:1000:c200::face]) by mx1.freebsd.org (Postfix) with ESMTP id 99CBAA1D; Sat, 23 Mar 2013 08:07:51 +0000 (UTC) Received: from glenbarber.us (nucleus.glenbarber.us [IPv6:2001:470:8:1205:2:2:ff:29]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gjb) by onyx.glenbarber.us (Postfix) with ESMTPSA id 8EA3C23F66B; Sat, 23 Mar 2013 04:06:51 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.8.0 onyx.glenbarber.us 8EA3C23F66B Authentication-Results: onyx.glenbarber.us; dkim=none reason="no signature"; dkim-adsp=none Date: Sat, 23 Mar 2013 04:06:48 -0400 From: Glen Barber To: Kirk McKusick , Kirk McKusick Subject: Re: svn commit: r248639 - head/sbin/fsdb Message-ID: <20130323080648.GI1512@glenbarber.us> References: <201303230757.r2N7vUop039830@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jIYo0VRlfdMI9fLa" Content-Disposition: inline In-Reply-To: <201303230757.r2N7vUop039830@svn.freebsd.org> X-Operating-System: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 08:07:51 -0000 --jIYo0VRlfdMI9fLa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 23, 2013 at 07:57:30AM +0000, Kirk McKusick wrote: > Author: mckusick > Date: Sat Mar 23 07:57:30 2013 > New Revision: 248639 > URL: http://svnweb.freebsd.org/changeset/base/248639 >=20 > Log: > Fix the build after addition of cylinder group cacheing (r248625) > =20 > Reported by: Glen Barber (gjb@) > Pointy hat to: Kirk McKusick (mckusick@) >=20 > Modified: > head/sbin/fsdb/fsdb.c >=20 This is wrong. r248625 was reverted with r248634. head/ is now re-broken. gjb@nucleus:~/freebsd/newsrc/base/head/sbin/fsdb % make Warning: Object directory not changed from original /freebsd/newsrc/base/head/sbin/fsdb /usr/local/libexec/ccache/world/cc -O2 -pipe -I/freebsd/newsrc/base/head/sbin/fsdb/../fsck_ffs -std=3Dgnu99 -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-poin ter-sign -static -o fsdb fsdb.o fsdbutil.o dir.o ea.o fsutil.o inode.o pass1.o pass1b.o pass2.o pass3.o pass4.o pass5.o setup.o utilities.o ffs_subr.o ffs_tables.o -ledit -ltermcap fsdb.o: In function `findblk': fsdb.c:(.text+0x1916): undefined reference to `cgget' *** [fsdb] Error code 1 =20 Stop in /freebsd/newsrc/base/head/sbin/fsdb. Glen --jIYo0VRlfdMI9fLa Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBCAAGBQJRTWKYAAoJEFJPDDeguUajShkH/2HAKrLJlvHSOw0t/RBPHEdz uKODgTlZ0l8OIy+Y/0LCy1fVGVGBVvcSYxoVbHEiV4YnAd5J827Rcp4GgUk73IAZ hzcBoAZo51+4A+ZHRe/rgEm4l2CY22Xhly0IDgWN6CO4D+VU7tVnf8+jMpxC1Bid s+aTuM1lcbr+EutPBvQNdZLRoqZzEckOv85vrD8huc5Nn9f7+8YmaqQu/RdVflBp pqay52fMmOwMqDHuOvcCrWX/R42jOphijNk7lmvxwmpCegsKCWOPkB9iBEgneIPB YdfTkgr2cEe6+4jryEaiVF5d2JmRUe6fsp4mFuj8pZfO4khuoa/ZUyYa/htnZGg= =h+Ln -----END PGP SIGNATURE----- --jIYo0VRlfdMI9fLa-- From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 08:48:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6596497D; Sat, 23 Mar 2013 08:48:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 57738B04; Sat, 23 Mar 2013 08:48:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2N8mjDw055749; Sat, 23 Mar 2013 08:48:45 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2N8mjmT055747; Sat, 23 Mar 2013 08:48:45 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303230848.r2N8mjmT055747@svn.freebsd.org> From: Andriy Gapon Date: Sat, 23 Mar 2013 08:48:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248640 - head/sys/cddl/dev/fbt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 08:48:45 -0000 Author: avg Date: Sat Mar 23 08:48:44 2013 New Revision: 248640 URL: http://svnweb.freebsd.org/changeset/base/248640 Log: fbt_typoff_init: fix an off by one in determining required memory size This issue would be silent most of the time, but if the requested memory is a multiple of a page size, then accessing one element beyond the end would lead to a kernel page fault. Otherwise, the unlucky last type would just be inaccessible. Reported by: glebius Tested by: glebius MFC after: 6 days Modified: head/sys/cddl/dev/fbt/fbt.c Modified: head/sys/cddl/dev/fbt/fbt.c ============================================================================== --- head/sys/cddl/dev/fbt/fbt.c Sat Mar 23 07:57:30 2013 (r248639) +++ head/sys/cddl/dev/fbt/fbt.c Sat Mar 23 08:48:44 2013 (r248640) @@ -777,6 +777,8 @@ fbt_typoff_init(linker_ctf_t *lc) pop[kind]++; } + /* account for a sentinel value below */ + ctf_typemax++; *lc->typlenp = ctf_typemax; if ((xp = malloc(sizeof(uint32_t) * ctf_typemax, M_LINKER, M_ZERO | M_WAITOK)) == NULL) From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 08:50:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 64E24B08; Sat, 23 Mar 2013 08:50:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 57461B13; Sat, 23 Mar 2013 08:50:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2N8ov3L057646; Sat, 23 Mar 2013 08:50:57 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2N8ovZd057645; Sat, 23 Mar 2013 08:50:57 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303230850.r2N8ovZd057645@svn.freebsd.org> From: Andriy Gapon Date: Sat, 23 Mar 2013 08:50:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248641 - head/lib/libdwarf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 08:50:57 -0000 Author: avg Date: Sat Mar 23 08:50:56 2013 New Revision: 248641 URL: http://svnweb.freebsd.org/changeset/base/248641 Log: libdwarf: anonymous types are expected to have empty type names... or no type attributes at all. This is according to DWARF specification. MFC after: 13 days Modified: head/lib/libdwarf/dwarf_die.c Modified: head/lib/libdwarf/dwarf_die.c ============================================================================== --- head/lib/libdwarf/dwarf_die.c Sat Mar 23 08:48:44 2013 (r248640) +++ head/lib/libdwarf/dwarf_die.c Sat Mar 23 08:50:56 2013 (r248641) @@ -29,8 +29,6 @@ #include #include "_libdwarf.h" -static const char *anon_name = "__anon__"; - int dwarf_die_add(Dwarf_CU cu, int level, uint64_t offset, uint64_t abnum, Dwarf_Abbrev a, Dwarf_Die *diep, Dwarf_Error *err) { @@ -57,7 +55,7 @@ dwarf_die_add(Dwarf_CU cu, int level, ui die->die_abnum = abnum; die->die_a = a; die->die_cu = cu; - die->die_name = anon_name; + die->die_name = ""; /* Initialise the list of attribute values. */ STAILQ_INIT(&die->die_attrval); From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 08:52:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8F080C80; Sat, 23 Mar 2013 08:52:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 80EEDB1E; Sat, 23 Mar 2013 08:52:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2N8qpea057948; Sat, 23 Mar 2013 08:52:51 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2N8qpq7057947; Sat, 23 Mar 2013 08:52:51 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303230852.r2N8qpq7057947@svn.freebsd.org> From: Andriy Gapon Date: Sat, 23 Mar 2013 08:52:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248642 - head/sys/cddl/dev/fbt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 08:52:51 -0000 Author: avg Date: Sat Mar 23 08:52:50 2013 New Revision: 248642 URL: http://svnweb.freebsd.org/changeset/base/248642 Log: fbt_getargdesc: correctly handle types for return probes MFC after: 6 days Modified: head/sys/cddl/dev/fbt/fbt.c Modified: head/sys/cddl/dev/fbt/fbt.c ============================================================================== --- head/sys/cddl/dev/fbt/fbt.c Sat Mar 23 08:50:56 2013 (r248641) +++ head/sys/cddl/dev/fbt/fbt.c Sat Mar 23 08:52:50 2013 (r248642) @@ -1260,6 +1260,11 @@ fbt_getargdesc(void *arg __unused, dtrac uint32_t offset; ushort_t info, kind, n; + if (fbt->fbtp_roffset != 0 && desc->dtargd_ndx == 0) { + (void) strcpy(desc->dtargd_native, "int"); + return; + } + desc->dtargd_ndx = DTRACE_ARGNONE; /* Get a pointer to the CTF data and it's length. */ @@ -1310,12 +1315,19 @@ fbt_getargdesc(void *arg __unused, dtrac return; } - /* Check if the requested argument doesn't exist. */ - if (ndx >= n) - return; + if (fbt->fbtp_roffset != 0) { + /* Only return type is available for args[1] in return probe. */ + if (ndx > 1) + return; + ASSERT(ndx == 1); + } else { + /* Check if the requested argument doesn't exist. */ + if (ndx >= n) + return; - /* Skip the return type and arguments up to the one requested. */ - dp += ndx + 1; + /* Skip the return type and arguments up to the one requested. */ + dp += ndx + 1; + } if (fbt_type_name(&lc, *dp, desc->dtargd_native, sizeof(desc->dtargd_native)) > 0) desc->dtargd_ndx = ndx; From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 08:57:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 13AF8E1E; Sat, 23 Mar 2013 08:57:15 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 06FF7B3B; Sat, 23 Mar 2013 08:57:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2N8vEB8058605; Sat, 23 Mar 2013 08:57:14 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2N8vEAZ058604; Sat, 23 Mar 2013 08:57:14 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201303230857.r2N8vEAZ058604@svn.freebsd.org> From: Glen Barber Date: Sat, 23 Mar 2013 08:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248643 - head/sbin/fsdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 08:57:15 -0000 Author: gjb (doc,ports committer) Date: Sat Mar 23 08:57:14 2013 New Revision: 248643 URL: http://svnweb.freebsd.org/changeset/base/248643 Log: Revert r248639 to fix build failure on head/ Modified: head/sbin/fsdb/fsdb.c Modified: head/sbin/fsdb/fsdb.c ============================================================================== --- head/sbin/fsdb/fsdb.c Sat Mar 23 08:52:50 2013 (r248642) +++ head/sbin/fsdb/fsdb.c Sat Mar 23 08:57:14 2013 (r248643) @@ -441,8 +441,7 @@ CMDFUNCSTART(findblk) ino_t inum, inosused; uint32_t *wantedblk32; uint64_t *wantedblk64; - struct bufarea *cgbp; - struct cg *cgp; + struct cg *cgp = &cgrp; int c, i, is_ufs2; wantedblksize = (argc - 1); @@ -474,8 +473,8 @@ CMDFUNCSTART(findblk) */ inum = c * sblock.fs_ipg; /* Read cylinder group. */ - cgbp = cgget(c); - cgp = cgbp->b_un.b_cg; + getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize); + memcpy(cgp, cgblk.b_un.b_cg, sblock.fs_cgsize); /* * Get a highest used inode number for a given cylinder group. * For UFS1 all inodes initialized at the newfs stage. From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 08:57:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2CDD1F9A; Sat, 23 Mar 2013 08:57:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1CFABB4A; Sat, 23 Mar 2013 08:57:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2N8vs8S058717; Sat, 23 Mar 2013 08:57:54 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2N8vsHL058716; Sat, 23 Mar 2013 08:57:54 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303230857.r2N8vsHL058716@svn.freebsd.org> From: Andriy Gapon Date: Sat, 23 Mar 2013 08:57:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248644 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 08:57:55 -0000 Author: avg Date: Sat Mar 23 08:57:54 2013 New Revision: 248644 URL: http://svnweb.freebsd.org/changeset/base/248644 Log: dtrace: ensure that we can always catch a process (e.g. when -c is used) It is not guaranteed that a program has a symbol table entry for main and thus that it would be possible to set a breakpoint on it. Reviewed by: rpaulo Discussed with: rpaulo MFC after: 13 days Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Sat Mar 23 08:57:14 2013 (r248643) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Sat Mar 23 08:57:54 2013 (r248644) @@ -1115,7 +1115,7 @@ alloc: #if defined(sun) dtp->dt_prcmode = DT_PROC_STOP_PREINIT; #else - dtp->dt_prcmode = DT_PROC_STOP_MAIN; + dtp->dt_prcmode = DT_PROC_STOP_POSTINIT; #endif dtp->dt_linkmode = DT_LINK_KERNEL; dtp->dt_linktype = DT_LTYP_ELF; From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 08:59:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EF8AC1A6; Sat, 23 Mar 2013 08:59:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E19F2B56; Sat, 23 Mar 2013 08:59:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2N8xYbn058980; Sat, 23 Mar 2013 08:59:34 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2N8xYup058979; Sat, 23 Mar 2013 08:59:34 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201303230859.r2N8xYup058979@svn.freebsd.org> From: Andriy Gapon Date: Sat, 23 Mar 2013 08:59:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248645 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 08:59:35 -0000 Author: avg Date: Sat Mar 23 08:59:34 2013 New Revision: 248645 URL: http://svnweb.freebsd.org/changeset/base/248645 Log: post mountroot event after a real/final root is mounted not every time an intermediate root (including the first devfs) is mounted. This is also consistent with waking up via root_mount_complete. Reviewed by: jhb MFC after: 13 days Modified: head/sys/kern/vfs_mountroot.c Modified: head/sys/kern/vfs_mountroot.c ============================================================================== --- head/sys/kern/vfs_mountroot.c Sat Mar 23 08:57:54 2013 (r248644) +++ head/sys/kern/vfs_mountroot.c Sat Mar 23 08:59:34 2013 (r248645) @@ -199,8 +199,6 @@ set_rootvnode(void) VREF(rootvnode); FILEDESC_XUNLOCK(p->p_fd); - - EVENTHANDLER_INVOKE(mountroot); } static int @@ -991,6 +989,8 @@ vfs_mountroot(void) atomic_store_rel_int(&root_mount_complete, 1); wakeup(&root_mount_complete); mtx_unlock(&mountlist_mtx); + + EVENTHANDLER_INVOKE(mountroot); } static struct mntarg * From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 13:11:54 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DA547EB8; Sat, 23 Mar 2013 13:11:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CD38D395; Sat, 23 Mar 2013 13:11:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NDBs1G037367; Sat, 23 Mar 2013 13:11:54 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NDBsUs037366; Sat, 23 Mar 2013 13:11:54 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201303231311.r2NDBsUs037366@svn.freebsd.org> From: Alexander Motin Date: Sat, 23 Mar 2013 13:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248647 - head/usr.bin/systat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 13:11:54 -0000 Author: mav Date: Sat Mar 23 13:11:54 2013 New Revision: 248647 URL: http://svnweb.freebsd.org/changeset/base/248647 Log: Make `systat -vmstat` to use suffixes to display big floating point numbers that are not fitting into the specified field width, same as done for ints. In particular that allows to properly display disk tps above 100k, that are reachable with modern SSDs. Modified: head/usr.bin/systat/vmstat.c Modified: head/usr.bin/systat/vmstat.c ============================================================================== --- head/usr.bin/systat/vmstat.c Sat Mar 23 09:06:40 2013 (r248646) +++ head/usr.bin/systat/vmstat.c Sat Mar 23 13:11:54 2013 (r248647) @@ -703,6 +703,10 @@ putfloat(double f, int l, int lc, int w, snr = snprintf(b, sizeof(b), "%*.*f", w, d, f); if (snr != w) snr = snprintf(b, sizeof(b), "%*.0f", w, f); + if (snr != w) + snr = snprintf(b, sizeof(b), "%*.0fk", w - 1, f / 1000); + if (snr != w) + snr = snprintf(b, sizeof(b), "%*.0fM", w - 1, f / 1000000); if (snr != w) { while (--w >= 0) addch('*'); @@ -731,6 +735,10 @@ putlongdouble(long double f, int l, int snr = snprintf(b, sizeof(b), "%*.*Lf", w, d, f); if (snr != w) snr = snprintf(b, sizeof(b), "%*.0Lf", w, f); + if (snr != w) + snr = snprintf(b, sizeof(b), "%*.0Lfk", w - 1, f / 1000); + if (snr != w) + snr = snprintf(b, sizeof(b), "%*.0LfM", w - 1, f / 1000000); if (snr != w) { while (--w >= 0) addch('*'); From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 14:52:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 84C68566; Sat, 23 Mar 2013 14:52:32 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 774DE84B; Sat, 23 Mar 2013 14:52:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NEqWYF067881; Sat, 23 Mar 2013 14:52:32 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NEqW5b067880; Sat, 23 Mar 2013 14:52:32 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201303231452.r2NEqW5b067880@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Sat, 23 Mar 2013 14:52:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248648 - head/crypto/openssh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 14:52:32 -0000 Author: des Date: Sat Mar 23 14:52:31 2013 New Revision: 248648 URL: http://svnweb.freebsd.org/changeset/base/248648 Log: Revert r247892 now that this has been fixed upstream. Modified: head/crypto/openssh/FREEBSD-upgrade Modified: head/crypto/openssh/FREEBSD-upgrade ============================================================================== --- head/crypto/openssh/FREEBSD-upgrade Sat Mar 23 13:11:54 2013 (r248647) +++ head/crypto/openssh/FREEBSD-upgrade Sat Mar 23 14:52:31 2013 (r248648) @@ -43,7 +43,6 @@ 7) Run configure with the appropriate arguments: $ ./configure --prefix=/usr --sysconfdir=/etc/ssh \ - --disable-lastlog --disable-utmp --disable-wtmp \ --with-pam --with-tcp-wrappers --with-libedit \ --with-ssl-engine From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 15:11:54 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6FF429C7; Sat, 23 Mar 2013 15:11:54 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 53D328C8; Sat, 23 Mar 2013 15:11:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NFBsM6074293; Sat, 23 Mar 2013 15:11:54 GMT (envelope-from will@svn.freebsd.org) Received: (from will@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NFBrrr074289; Sat, 23 Mar 2013 15:11:53 GMT (envelope-from will@svn.freebsd.org) Message-Id: <201303231511.r2NFBrrr074289@svn.freebsd.org> From: Will Andrews Date: Sat, 23 Mar 2013 15:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248649 - in head: share/man/man9 sys/kern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 15:11:54 -0000 Author: will Date: Sat Mar 23 15:11:53 2013 New Revision: 248649 URL: http://svnweb.freebsd.org/changeset/base/248649 Log: Extend taskqueue(9) to enable per-taskqueue callbacks. The scope of these callbacks is primarily to support actions that affect the taskqueue's thread environments. They are entirely optional, and consequently are introduced as a new API: taskqueue_set_callback(). This interface allows the caller to specify that a taskqueue requires a callback and optional context pointer for a given callback type. The callback types included in this commit can be used to register a constructor and destructor for thread-local storage using osd(9). This allows a particular taskqueue to define that its threads require a specific type of TLS, without the need for a specially-orchestrated task-based mechanism for startup and shutdown in order to accomplish it. Two callback types are supported at this point: - TASKQUEUE_CALLBACK_TYPE_INIT, called by every thread when it starts, prior to processing any tasks. - TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, called by every thread when it exits, after it has processed its last task but before the taskqueue is reclaimed. While I'm here: - Add two new macros, TQ_ASSERT_LOCKED and TQ_ASSERT_UNLOCKED, and use them in appropriate locations. - Fix taskqueue.9 to mention taskqueue_start_threads(), which is a required interface for all consumers of taskqueue(9). Reviewed by: kib (all), eadler (taskqueue.9), brd (taskqueue.9) Approved by: ken (mentor) Sponsored by: Spectra Logic MFC after: 1 month Modified: head/share/man/man9/taskqueue.9 head/sys/kern/subr_taskqueue.c head/sys/sys/taskqueue.h Modified: head/share/man/man9/taskqueue.9 ============================================================================== --- head/share/man/man9/taskqueue.9 Sat Mar 23 14:52:31 2013 (r248648) +++ head/share/man/man9/taskqueue.9 Sat Mar 23 15:11:53 2013 (r248649) @@ -53,12 +53,23 @@ struct task { void *ta_context; /* argument for handler */ }; +enum taskqueue_callback_type { + TASKQUEUE_CALLBACK_TYPE_INIT, + TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, +}; + +typedef void (*taskqueue_callback_fn)(void *context); + struct timeout_task; .Ed .Ft struct taskqueue * .Fn taskqueue_create "const char *name" "int mflags" "taskqueue_enqueue_fn enqueue" "void *context" .Ft struct taskqueue * .Fn taskqueue_create_fast "const char *name" "int mflags" "taskqueue_enqueue_fn enqueue" "void *context" +.Ft int +.Fn taskqueue_start_threads "struct taskqueue **tqp" "int count" "int pri" "const char *name" "..." +.Ft void +.Fn taskqueue_set_callback "struct taskqueue *queue" "enum taskqueue_callback_type cb_type" "taskqueue_callback_fn callback" "void *context" .Ft void .Fn taskqueue_free "struct taskqueue *queue" .Ft int @@ -127,6 +138,23 @@ should be used to free the memory used b Any tasks that are on the queue will be executed at this time after which the thread servicing the queue will be signaled that it should exit. .Pp +Once a taskqueue has been created, its threads should be started using +.Fn taskqueue_start_threads . +Callbacks may optionally be registered using +.Fn taskqueue_set_callback . +Currently, callbacks may be registered for the following purposes: +.Bl -tag -width TASKQUEUE_CALLBACK_TYPE_SHUTDOWN +.It Dv TASKQUEUE_CALLBACK_TYPE_INIT +This callback is called by every thread in the taskqueue, before it executes +any tasks. +This callback must be set before the taskqueue's threads are started. +.It Dv TASKQUEUE_CALLBACK_TYPE_SHUTDOWN +This callback is called by every thread in the taskqueue, after it executes +its last task. +This callback will always be called before the taskqueue structure is +reclaimed. +.El +.Pp To add a task to the list of tasks queued on a taskqueue, call .Fn taskqueue_enqueue with pointers to the queue and task. Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Sat Mar 23 14:52:31 2013 (r248648) +++ head/sys/kern/subr_taskqueue.c Sat Mar 23 15:11:53 2013 (r248649) @@ -63,6 +63,8 @@ struct taskqueue { int tq_spin; int tq_flags; int tq_callouts; + taskqueue_callback_fn tq_callbacks[TASKQUEUE_NUM_CALLBACKS]; + void *tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS]; }; #define TQ_FLAGS_ACTIVE (1 << 0) @@ -78,6 +80,7 @@ struct taskqueue { else \ mtx_lock(&(tq)->tq_mutex); \ } while (0) +#define TQ_ASSERT_LOCKED(tq) mtx_assert(&(tq)->tq_mutex, MA_OWNED) #define TQ_UNLOCK(tq) \ do { \ @@ -86,6 +89,7 @@ struct taskqueue { else \ mtx_unlock(&(tq)->tq_mutex); \ } while (0) +#define TQ_ASSERT_UNLOCKED(tq) mtx_assert(&(tq)->tq_mutex, MA_NOTOWNED) void _timeout_task_init(struct taskqueue *queue, struct timeout_task *timeout_task, @@ -137,6 +141,23 @@ taskqueue_create(const char *name, int m MTX_DEF, "taskqueue"); } +void +taskqueue_set_callback(struct taskqueue *queue, + enum taskqueue_callback_type cb_type, taskqueue_callback_fn callback, + void *context) +{ + + KASSERT(((cb_type >= TASKQUEUE_CALLBACK_TYPE_MIN) && + (cb_type <= TASKQUEUE_CALLBACK_TYPE_MAX)), + ("Callback type %d not valid, must be %d-%d", cb_type, + TASKQUEUE_CALLBACK_TYPE_MIN, TASKQUEUE_CALLBACK_TYPE_MAX)); + KASSERT((queue->tq_callbacks[cb_type] == NULL), + ("Re-initialization of taskqueue callback?")); + + queue->tq_callbacks[cb_type] = callback; + queue->tq_cb_contexts[cb_type] = context; +} + /* * Signal a taskqueue thread to terminate. */ @@ -293,7 +314,7 @@ taskqueue_run_locked(struct taskqueue *q struct task *task; int pending; - mtx_assert(&queue->tq_mutex, MA_OWNED); + TQ_ASSERT_LOCKED(queue); tb.tb_running = NULL; TAILQ_INSERT_TAIL(&queue->tq_active, &tb, tb_link); @@ -332,7 +353,7 @@ task_is_running(struct taskqueue *queue, { struct taskqueue_busy *tb; - mtx_assert(&queue->tq_mutex, MA_OWNED); + TQ_ASSERT_LOCKED(queue); TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { if (tb->tb_running == task) return (1); @@ -489,6 +510,18 @@ taskqueue_start_threads(struct taskqueue return (0); } +static inline void +taskqueue_run_callback(struct taskqueue *tq, + enum taskqueue_callback_type cb_type) +{ + taskqueue_callback_fn tq_callback; + + TQ_ASSERT_UNLOCKED(tq); + tq_callback = tq->tq_callbacks[cb_type]; + if (tq_callback != NULL) + tq_callback(tq->tq_cb_contexts[cb_type]); +} + void taskqueue_thread_loop(void *arg) { @@ -496,6 +529,7 @@ taskqueue_thread_loop(void *arg) tqp = arg; tq = *tqp; + taskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_INIT); TQ_LOCK(tq); while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) { taskqueue_run_locked(tq); @@ -510,6 +544,15 @@ taskqueue_thread_loop(void *arg) } taskqueue_run_locked(tq); + /* + * This thread is on its way out, so just drop the lock temporarily + * in order to call the shutdown callback. This allows the callback + * to look at the taskqueue, even just before it dies. + */ + TQ_UNLOCK(tq); + taskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_SHUTDOWN); + TQ_LOCK(tq); + /* rendezvous with thread that asked us to terminate */ tq->tq_tcount--; wakeup_one(tq->tq_threads); @@ -525,7 +568,7 @@ taskqueue_thread_enqueue(void *context) tqp = context; tq = *tqp; - mtx_assert(&tq->tq_mutex, MA_OWNED); + TQ_ASSERT_LOCKED(tq); wakeup_one(tq); } Modified: head/sys/sys/taskqueue.h ============================================================================== --- head/sys/sys/taskqueue.h Sat Mar 23 14:52:31 2013 (r248648) +++ head/sys/sys/taskqueue.h Sat Mar 23 15:11:53 2013 (r248649) @@ -47,6 +47,16 @@ struct timeout_task { int f; }; +enum taskqueue_callback_type { + TASKQUEUE_CALLBACK_TYPE_INIT, + TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, +}; +#define TASKQUEUE_CALLBACK_TYPE_MIN TASKQUEUE_CALLBACK_TYPE_INIT +#define TASKQUEUE_CALLBACK_TYPE_MAX TASKQUEUE_CALLBACK_TYPE_SHUTDOWN +#define TASKQUEUE_NUM_CALLBACKS TASKQUEUE_CALLBACK_TYPE_MAX + 1 + +typedef void (*taskqueue_callback_fn)(void *context); + /* * A notification callback function which is called from * taskqueue_enqueue(). The context argument is given in the call to @@ -76,6 +86,9 @@ void taskqueue_run(struct taskqueue *que void taskqueue_block(struct taskqueue *queue); void taskqueue_unblock(struct taskqueue *queue); int taskqueue_member(struct taskqueue *queue, struct thread *td); +void taskqueue_set_callback(struct taskqueue *queue, + enum taskqueue_callback_type cb_type, + taskqueue_callback_fn callback, void *context); #define TASK_INITIALIZER(priority, func, context) \ { .ta_pending = 0, \ From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 15:47:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CD8A353F; Sat, 23 Mar 2013 15:47:45 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90]) by mx1.freebsd.org (Postfix) with ESMTP id 2015AA02; Sat, 23 Mar 2013 15:47:44 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 08CA925D3815; Sat, 23 Mar 2013 15:47:36 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 20BEEBE84AE; Sat, 23 Mar 2013 15:47:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id 8Nh_oc9lDsVc; Sat, 23 Mar 2013 15:47:34 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 0D881BE849B; Sat, 23 Mar 2013 15:47:34 +0000 (UTC) Date: Sat, 23 Mar 2013 15:47:33 +0000 (UTC) From: "Bjoern A. Zeeb" To: Martin Matuska , Peter Wemm Subject: Re: svn commit: r248571 - in head: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd... In-Reply-To: <201303210838.r2L8c3OB097432@svn.freebsd.org> Message-ID: References: <201303210838.r2L8c3OB097432@svn.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 15:47:45 -0000 On Thu, 21 Mar 2013, Martin Matuska wrote: > Author: mm > Date: Thu Mar 21 08:38:03 2013 > New Revision: 248571 > URL: http://svnweb.freebsd.org/changeset/base/248571 > > Log: > Merge libzfs_core branch: > includes MFV 238590, 238592, 247580 ... > Added: > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c > - copied unchanged from r248551, projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.h > - copied unchanged from r248551, projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.h > head/cddl/contrib/opensolaris/lib/libzfs_core/ > - copied from r248551, projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs_core/ > head/cddl/lib/libzfs_core/ > - copied from r248551, projects/libzfs_core/cddl/lib/libzfs_core/ > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c > - copied unchanged from r248551, projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c > - copied unchanged from r248551, projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h > - copied unchanged from r248551, projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_destroy.h > - copied unchanged from r248551, projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_destroy.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_userhold.h > - copied unchanged from r248551, projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_userhold.h in the theoretical event someone would want to compile zfs into the kernel, given r233578 added support for that, one would need this: mm, peter? Index: sys/conf/files =================================================================== --- sys/conf/files (revision 248649) +++ sys/conf/files (working copy) @@ -197,11 +197,13 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_s cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c optional zfs compile-with "${ZFS_C}" -- Bjoern A. Zeeb Charles Haddon Spurgeon: "Friendship is one of the sweetest joys of life. Many might have failed beneath the bitterness of their trial had they not found a friend." From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 16:20:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 05DDF6DF; Sat, 23 Mar 2013 16:20:46 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-qa0-f52.google.com (mail-qa0-f52.google.com [209.85.216.52]) by mx1.freebsd.org (Postfix) with ESMTP id 8D4FBBF4; Sat, 23 Mar 2013 16:20:45 +0000 (UTC) Received: by mail-qa0-f52.google.com with SMTP id bs12so781345qab.18 for ; Sat, 23 Mar 2013 09:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=LakhN2ZHNV7/3ZKN1IJfj2/JBdur2KiX8OHH+YWhuSc=; b=DIIFjVbjT+yqyKoe1GfNSSr0Oq2JHcS+yvsjgzYgUVsiwrTOBZJlv4ft78B7Dy6wbL etO0tSYU5mFLypWUW0k306HLmxgU0YApsgcN3jsbqyvlfXgr9tA1MFKOc/t8m1+htHVY e8bRDY9OR7Yc7ZD7y2dZOqA3Y+otwOdJuGMrEWuomJcwZqaWb5huncXO5k/N+8d68jpJ YM/G41XB8mPeNA+iiOwCQhwWe3fNyx0k9SM4jAhJwutyvYvD/1VJL+dR9mhWqsUO6jCf gefFUgiOiaV0LMBzj5IfVjcY7XUGLxprUDciSPio0sr61tGd7OeP4s+ETkKZaxltMcA5 tHXw== MIME-Version: 1.0 X-Received: by 10.49.25.202 with SMTP id e10mr1851252qeg.49.1364055638919; Sat, 23 Mar 2013 09:20:38 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.229.179.42 with HTTP; Sat, 23 Mar 2013 09:20:38 -0700 (PDT) In-Reply-To: <201303231511.r2NFBrrr074289@svn.freebsd.org> References: <201303231511.r2NFBrrr074289@svn.freebsd.org> Date: Sat, 23 Mar 2013 09:20:38 -0700 X-Google-Sender-Auth: p8rQpvr6sTykIL9cJEbPkzLD6P8 Message-ID: Subject: Re: svn commit: r248649 - in head: share/man/man9 sys/kern sys/sys From: mdf@FreeBSD.org To: Will Andrews Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 16:20:46 -0000 On Sat, Mar 23, 2013 at 8:11 AM, Will Andrews wrote: > Author: will > Date: Sat Mar 23 15:11:53 2013 > New Revision: 248649 > URL: http://svnweb.freebsd.org/changeset/base/248649 > > Log: > Extend taskqueue(9) to enable per-taskqueue callbacks. > > The scope of these callbacks is primarily to support actions that affect the > taskqueue's thread environments. They are entirely optional, and > consequently are introduced as a new API: taskqueue_set_callback(). > > This interface allows the caller to specify that a taskqueue requires a > callback and optional context pointer for a given callback type. > > The callback types included in this commit can be used to register a > constructor and destructor for thread-local storage using osd(9). This > allows a particular taskqueue to define that its threads require a specific > type of TLS, without the need for a specially-orchestrated task-based > mechanism for startup and shutdown in order to accomplish it. > > Two callback types are supported at this point: > > - TASKQUEUE_CALLBACK_TYPE_INIT, called by every thread when it starts, prior > to processing any tasks. > - TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, called by every thread when it exits, > after it has processed its last task but before the taskqueue is > reclaimed. > > While I'm here: > > - Add two new macros, TQ_ASSERT_LOCKED and TQ_ASSERT_UNLOCKED, and use them > in appropriate locations. > - Fix taskqueue.9 to mention taskqueue_start_threads(), which is a required > interface for all consumers of taskqueue(9). > > Reviewed by: kib (all), eadler (taskqueue.9), brd (taskqueue.9) > Approved by: ken (mentor) > Sponsored by: Spectra Logic > MFC after: 1 month > > Modified: > head/share/man/man9/taskqueue.9 > head/sys/kern/subr_taskqueue.c > head/sys/sys/taskqueue.h > > Modified: head/share/man/man9/taskqueue.9 > ============================================================================== > --- head/share/man/man9/taskqueue.9 Sat Mar 23 14:52:31 2013 (r248648) > +++ head/share/man/man9/taskqueue.9 Sat Mar 23 15:11:53 2013 (r248649) > @@ -53,12 +53,23 @@ struct task { > void *ta_context; /* argument for handler */ > }; > > +enum taskqueue_callback_type { > + TASKQUEUE_CALLBACK_TYPE_INIT, > + TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, > +}; > + > +typedef void (*taskqueue_callback_fn)(void *context); > + > struct timeout_task; > .Ed > .Ft struct taskqueue * > .Fn taskqueue_create "const char *name" "int mflags" "taskqueue_enqueue_fn enqueue" "void *context" > .Ft struct taskqueue * > .Fn taskqueue_create_fast "const char *name" "int mflags" "taskqueue_enqueue_fn enqueue" "void *context" > +.Ft int > +.Fn taskqueue_start_threads "struct taskqueue **tqp" "int count" "int pri" "const char *name" "..." > +.Ft void > +.Fn taskqueue_set_callback "struct taskqueue *queue" "enum taskqueue_callback_type cb_type" "taskqueue_callback_fn callback" "void *context" > .Ft void > .Fn taskqueue_free "struct taskqueue *queue" > .Ft int > @@ -127,6 +138,23 @@ should be used to free the memory used b > Any tasks that are on the queue will be executed at this time after > which the thread servicing the queue will be signaled that it should exit. > .Pp > +Once a taskqueue has been created, its threads should be started using > +.Fn taskqueue_start_threads . > +Callbacks may optionally be registered using > +.Fn taskqueue_set_callback . > +Currently, callbacks may be registered for the following purposes: > +.Bl -tag -width TASKQUEUE_CALLBACK_TYPE_SHUTDOWN > +.It Dv TASKQUEUE_CALLBACK_TYPE_INIT > +This callback is called by every thread in the taskqueue, before it executes > +any tasks. > +This callback must be set before the taskqueue's threads are started. > +.It Dv TASKQUEUE_CALLBACK_TYPE_SHUTDOWN > +This callback is called by every thread in the taskqueue, after it executes > +its last task. > +This callback will always be called before the taskqueue structure is > +reclaimed. > +.El > +.Pp > To add a task to the list of tasks queued on a taskqueue, call > .Fn taskqueue_enqueue > with pointers to the queue and task. > > Modified: head/sys/kern/subr_taskqueue.c > ============================================================================== > --- head/sys/kern/subr_taskqueue.c Sat Mar 23 14:52:31 2013 (r248648) > +++ head/sys/kern/subr_taskqueue.c Sat Mar 23 15:11:53 2013 (r248649) > @@ -63,6 +63,8 @@ struct taskqueue { > int tq_spin; > int tq_flags; > int tq_callouts; > + taskqueue_callback_fn tq_callbacks[TASKQUEUE_NUM_CALLBACKS]; > + void *tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS]; > }; > > #define TQ_FLAGS_ACTIVE (1 << 0) > @@ -78,6 +80,7 @@ struct taskqueue { > else \ > mtx_lock(&(tq)->tq_mutex); \ > } while (0) > +#define TQ_ASSERT_LOCKED(tq) mtx_assert(&(tq)->tq_mutex, MA_OWNED) > > #define TQ_UNLOCK(tq) \ > do { \ > @@ -86,6 +89,7 @@ struct taskqueue { > else \ > mtx_unlock(&(tq)->tq_mutex); \ > } while (0) > +#define TQ_ASSERT_UNLOCKED(tq) mtx_assert(&(tq)->tq_mutex, MA_NOTOWNED) > > void > _timeout_task_init(struct taskqueue *queue, struct timeout_task *timeout_task, > @@ -137,6 +141,23 @@ taskqueue_create(const char *name, int m > MTX_DEF, "taskqueue"); > } > > +void > +taskqueue_set_callback(struct taskqueue *queue, > + enum taskqueue_callback_type cb_type, taskqueue_callback_fn callback, > + void *context) > +{ > + > + KASSERT(((cb_type >= TASKQUEUE_CALLBACK_TYPE_MIN) && > + (cb_type <= TASKQUEUE_CALLBACK_TYPE_MAX)), > + ("Callback type %d not valid, must be %d-%d", cb_type, > + TASKQUEUE_CALLBACK_TYPE_MIN, TASKQUEUE_CALLBACK_TYPE_MAX)); > + KASSERT((queue->tq_callbacks[cb_type] == NULL), > + ("Re-initialization of taskqueue callback?")); > + > + queue->tq_callbacks[cb_type] = callback; > + queue->tq_cb_contexts[cb_type] = context; > +} > + > /* > * Signal a taskqueue thread to terminate. > */ > @@ -293,7 +314,7 @@ taskqueue_run_locked(struct taskqueue *q > struct task *task; > int pending; > > - mtx_assert(&queue->tq_mutex, MA_OWNED); > + TQ_ASSERT_LOCKED(queue); > tb.tb_running = NULL; > TAILQ_INSERT_TAIL(&queue->tq_active, &tb, tb_link); > > @@ -332,7 +353,7 @@ task_is_running(struct taskqueue *queue, > { > struct taskqueue_busy *tb; > > - mtx_assert(&queue->tq_mutex, MA_OWNED); > + TQ_ASSERT_LOCKED(queue); > TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { > if (tb->tb_running == task) > return (1); > @@ -489,6 +510,18 @@ taskqueue_start_threads(struct taskqueue > return (0); > } > > +static inline void > +taskqueue_run_callback(struct taskqueue *tq, > + enum taskqueue_callback_type cb_type) > +{ > + taskqueue_callback_fn tq_callback; > + > + TQ_ASSERT_UNLOCKED(tq); > + tq_callback = tq->tq_callbacks[cb_type]; > + if (tq_callback != NULL) > + tq_callback(tq->tq_cb_contexts[cb_type]); > +} > + > void > taskqueue_thread_loop(void *arg) > { > @@ -496,6 +529,7 @@ taskqueue_thread_loop(void *arg) > > tqp = arg; > tq = *tqp; > + taskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_INIT); > TQ_LOCK(tq); > while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) { > taskqueue_run_locked(tq); > @@ -510,6 +544,15 @@ taskqueue_thread_loop(void *arg) > } > taskqueue_run_locked(tq); > > + /* > + * This thread is on its way out, so just drop the lock temporarily > + * in order to call the shutdown callback. This allows the callback > + * to look at the taskqueue, even just before it dies. > + */ > + TQ_UNLOCK(tq); > + taskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_SHUTDOWN); > + TQ_LOCK(tq); > + > /* rendezvous with thread that asked us to terminate */ > tq->tq_tcount--; > wakeup_one(tq->tq_threads); > @@ -525,7 +568,7 @@ taskqueue_thread_enqueue(void *context) > tqp = context; > tq = *tqp; > > - mtx_assert(&tq->tq_mutex, MA_OWNED); > + TQ_ASSERT_LOCKED(tq); > wakeup_one(tq); > } > > > Modified: head/sys/sys/taskqueue.h > ============================================================================== > --- head/sys/sys/taskqueue.h Sat Mar 23 14:52:31 2013 (r248648) > +++ head/sys/sys/taskqueue.h Sat Mar 23 15:11:53 2013 (r248649) > @@ -47,6 +47,16 @@ struct timeout_task { > int f; > }; > > +enum taskqueue_callback_type { > + TASKQUEUE_CALLBACK_TYPE_INIT, > + TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, > +}; > +#define TASKQUEUE_CALLBACK_TYPE_MIN TASKQUEUE_CALLBACK_TYPE_INIT > +#define TASKQUEUE_CALLBACK_TYPE_MAX TASKQUEUE_CALLBACK_TYPE_SHUTDOWN > +#define TASKQUEUE_NUM_CALLBACKS TASKQUEUE_CALLBACK_TYPE_MAX + 1 This need parentheses to defensively guard against unexpected precedence of operators. While here, TASKQUEUE_CALLBACK_ is a very long prefix (19 characters!) Can this be named TQCB_ instead so it's not so verbose? Thanks, matthew From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 16:34:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5346C158E; Sat, 23 Mar 2013 16:34:57 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 45C1DA43; Sat, 23 Mar 2013 16:34:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NGYvVS099630; Sat, 23 Mar 2013 16:34:57 GMT (envelope-from will@svn.freebsd.org) Received: (from will@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NGYvoj099629; Sat, 23 Mar 2013 16:34:57 GMT (envelope-from will@svn.freebsd.org) Message-Id: <201303231634.r2NGYvoj099629@svn.freebsd.org> From: Will Andrews Date: Sat, 23 Mar 2013 16:34:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248653 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 16:34:57 -0000 Author: will Date: Sat Mar 23 16:34:56 2013 New Revision: 248653 URL: http://svnweb.freebsd.org/changeset/base/248653 Log: ZFS: Fix a panic while unmounting a busy filesystem. This particular scenario was easily reproduced using a NFS export. When the first 'zfs unmount' occurred, it returned EBUSY via this path, while vflush() had flushed references on the filesystem's root vnode, which in turn caused its v_interlock to be destroyed. The next time 'zfs unmount' was called, vflush() tried to obtain this lock, which caused this panic. Since vflush() on FreeBSD is a definitive call, there is no need to check vfsp->vfs_count after it completes. Simply #ifdef sun this check. Submitted by: avg Reviewed by: avg Approved by: ken (mentor) MFC after: 1 month Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Mar 23 16:06:20 2013 (r248652) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Mar 23 16:34:56 2013 (r248653) @@ -1968,6 +1968,7 @@ zfs_umount(vfs_t *vfsp, int fflag) return (ret); } +#ifdef sun if (!(fflag & MS_FORCE)) { /* * Check the number of active vnodes in the file system. @@ -1988,6 +1989,7 @@ zfs_umount(vfs_t *vfsp, int fflag) return (EBUSY); } } +#endif VERIFY(zfsvfs_teardown(zfsvfs, B_TRUE) == 0); os = zfsvfs->z_os; From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 16:45:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 024D421FF for ; Sat, 23 Mar 2013 16:45:30 +0000 (UTC) (envelope-from will@firepipe.net) Received: from mail-ie0-x231.google.com (mail-ie0-x231.google.com [IPv6:2607:f8b0:4001:c03::231]) by mx1.freebsd.org (Postfix) with ESMTP id C84BC802 for ; Sat, 23 Mar 2013 16:45:30 +0000 (UTC) Received: by mail-ie0-f177.google.com with SMTP id tp5so1567552ieb.8 for ; Sat, 23 Mar 2013 09:45:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=luCZdXh3ldj3Dizu46SUxWDRbUIxl+G7u4O8uLHiAVU=; b=jzx5fPV7VZvVS7RhgZWruySr3E6ZM5T/lCObpJHP8REYsm65BWozkqDgovFajDORop YbE7pUxxd86uI3VdLCEmeAskfQX6J8HgFztklfeFMyqLSTIaPuNctt1HGGHNQ6Bv1Z8j MSv8Z9F8OQI+5EOSkkuo7M3GXyB/w3kBHYftv/Qx3U/p2PrSfxLDffeNHGhjU96MoMz+ S4tPNNtihn36fQCuyvytUUcp2ik/hZ6NsUyQiL1CRd/A7EttoYGCxer6np+x8hcmfOXQ f0ho4QZYOSvT/+a8Q1dnw0vfzn8rDBbEuSrAeG6O5cqbOaDIacmJC7Ie/M4MeV7yCvyM dVZA== MIME-Version: 1.0 X-Received: by 10.50.124.103 with SMTP id mh7mr288903igb.103.1364057130350; Sat, 23 Mar 2013 09:45:30 -0700 (PDT) Received: by 10.231.247.74 with HTTP; Sat, 23 Mar 2013 09:45:30 -0700 (PDT) In-Reply-To: References: <201303231511.r2NFBrrr074289@svn.freebsd.org> Date: Sat, 23 Mar 2013 10:45:30 -0600 Message-ID: Subject: Re: svn commit: r248649 - in head: share/man/man9 sys/kern sys/sys From: Will Andrews To: Matthew Fleming X-Gm-Message-State: ALoCoQlT4Mi4xLicKLhMvu1O2uVF4r1tF7GUxmtahSy7zKJH84gFsN7nH+EcRRIv3LmRYJS8zOrs Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Will Andrews X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 16:45:31 -0000 I agree about the name length, it is a bit obnoxious. However, it is also descriptive. TQCB strikes me as perhaps a bit too far in the other direction. How about TQ_CALLBACK_? Is there an existing (pseudo) convention for callback names? Thanks, --Will. On Sat, Mar 23, 2013 at 10:20 AM, wrote: > On Sat, Mar 23, 2013 at 8:11 AM, Will Andrews wrote: > > Author: will > > Date: Sat Mar 23 15:11:53 2013 > > New Revision: 248649 > > URL: http://svnweb.freebsd.org/changeset/base/248649 > > > > Log: > > Extend taskqueue(9) to enable per-taskqueue callbacks. > > > > The scope of these callbacks is primarily to support actions that > affect the > > taskqueue's thread environments. They are entirely optional, and > > consequently are introduced as a new API: taskqueue_set_callback(). > > > > This interface allows the caller to specify that a taskqueue requires a > > callback and optional context pointer for a given callback type. > > > > The callback types included in this commit can be used to register a > > constructor and destructor for thread-local storage using osd(9). This > > allows a particular taskqueue to define that its threads require a > specific > > type of TLS, without the need for a specially-orchestrated task-based > > mechanism for startup and shutdown in order to accomplish it. > > > > Two callback types are supported at this point: > > > > - TASKQUEUE_CALLBACK_TYPE_INIT, called by every thread when it starts, > prior > > to processing any tasks. > > - TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, called by every thread when it > exits, > > after it has processed its last task but before the taskqueue is > > reclaimed. > > > > While I'm here: > > > > - Add two new macros, TQ_ASSERT_LOCKED and TQ_ASSERT_UNLOCKED, and use > them > > in appropriate locations. > > - Fix taskqueue.9 to mention taskqueue_start_threads(), which is a > required > > interface for all consumers of taskqueue(9). > > > > Reviewed by: kib (all), eadler (taskqueue.9), brd (taskqueue.9) > > Approved by: ken (mentor) > > Sponsored by: Spectra Logic > > MFC after: 1 month > > > > Modified: > > head/share/man/man9/taskqueue.9 > > head/sys/kern/subr_taskqueue.c > > head/sys/sys/taskqueue.h > > > > Modified: head/share/man/man9/taskqueue.9 > > > ============================================================================== > > --- head/share/man/man9/taskqueue.9 Sat Mar 23 14:52:31 2013 > (r248648) > > +++ head/share/man/man9/taskqueue.9 Sat Mar 23 15:11:53 2013 > (r248649) > > @@ -53,12 +53,23 @@ struct task { > > void *ta_context; /* argument for handler > */ > > }; > > > > +enum taskqueue_callback_type { > > + TASKQUEUE_CALLBACK_TYPE_INIT, > > + TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, > > +}; > > + > > +typedef void (*taskqueue_callback_fn)(void *context); > > + > > struct timeout_task; > > .Ed > > .Ft struct taskqueue * > > .Fn taskqueue_create "const char *name" "int mflags" > "taskqueue_enqueue_fn enqueue" "void *context" > > .Ft struct taskqueue * > > .Fn taskqueue_create_fast "const char *name" "int mflags" > "taskqueue_enqueue_fn enqueue" "void *context" > > +.Ft int > > +.Fn taskqueue_start_threads "struct taskqueue **tqp" "int count" "int > pri" "const char *name" "..." > > +.Ft void > > +.Fn taskqueue_set_callback "struct taskqueue *queue" "enum > taskqueue_callback_type cb_type" "taskqueue_callback_fn callback" "void > *context" > > .Ft void > > .Fn taskqueue_free "struct taskqueue *queue" > > .Ft int > > @@ -127,6 +138,23 @@ should be used to free the memory used b > > Any tasks that are on the queue will be executed at this time after > > which the thread servicing the queue will be signaled that it should > exit. > > .Pp > > +Once a taskqueue has been created, its threads should be started using > > +.Fn taskqueue_start_threads . > > +Callbacks may optionally be registered using > > +.Fn taskqueue_set_callback . > > +Currently, callbacks may be registered for the following purposes: > > +.Bl -tag -width TASKQUEUE_CALLBACK_TYPE_SHUTDOWN > > +.It Dv TASKQUEUE_CALLBACK_TYPE_INIT > > +This callback is called by every thread in the taskqueue, before it > executes > > +any tasks. > > +This callback must be set before the taskqueue's threads are started. > > +.It Dv TASKQUEUE_CALLBACK_TYPE_SHUTDOWN > > +This callback is called by every thread in the taskqueue, after it > executes > > +its last task. > > +This callback will always be called before the taskqueue structure is > > +reclaimed. > > +.El > > +.Pp > > To add a task to the list of tasks queued on a taskqueue, call > > .Fn taskqueue_enqueue > > with pointers to the queue and task. > > > > Modified: head/sys/kern/subr_taskqueue.c > > > ============================================================================== > > --- head/sys/kern/subr_taskqueue.c Sat Mar 23 14:52:31 2013 > (r248648) > > +++ head/sys/kern/subr_taskqueue.c Sat Mar 23 15:11:53 2013 > (r248649) > > @@ -63,6 +63,8 @@ struct taskqueue { > > int tq_spin; > > int tq_flags; > > int tq_callouts; > > + taskqueue_callback_fn tq_callbacks[TASKQUEUE_NUM_CALLBACKS]; > > + void *tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS]; > > }; > > > > #define TQ_FLAGS_ACTIVE (1 << 0) > > @@ -78,6 +80,7 @@ struct taskqueue { > > else \ > > mtx_lock(&(tq)->tq_mutex); \ > > } while (0) > > +#define TQ_ASSERT_LOCKED(tq) mtx_assert(&(tq)->tq_mutex, > MA_OWNED) > > > > #define TQ_UNLOCK(tq) > \ > > do { \ > > @@ -86,6 +89,7 @@ struct taskqueue { > > else \ > > mtx_unlock(&(tq)->tq_mutex); \ > > } while (0) > > +#define TQ_ASSERT_UNLOCKED(tq) mtx_assert(&(tq)->tq_mutex, > MA_NOTOWNED) > > > > void > > _timeout_task_init(struct taskqueue *queue, struct timeout_task > *timeout_task, > > @@ -137,6 +141,23 @@ taskqueue_create(const char *name, int m > > MTX_DEF, "taskqueue"); > > } > > > > +void > > +taskqueue_set_callback(struct taskqueue *queue, > > + enum taskqueue_callback_type cb_type, taskqueue_callback_fn > callback, > > + void *context) > > +{ > > + > > + KASSERT(((cb_type >= TASKQUEUE_CALLBACK_TYPE_MIN) && > > + (cb_type <= TASKQUEUE_CALLBACK_TYPE_MAX)), > > + ("Callback type %d not valid, must be %d-%d", cb_type, > > + TASKQUEUE_CALLBACK_TYPE_MIN, TASKQUEUE_CALLBACK_TYPE_MAX)); > > + KASSERT((queue->tq_callbacks[cb_type] == NULL), > > + ("Re-initialization of taskqueue callback?")); > > + > > + queue->tq_callbacks[cb_type] = callback; > > + queue->tq_cb_contexts[cb_type] = context; > > +} > > + > > /* > > * Signal a taskqueue thread to terminate. > > */ > > @@ -293,7 +314,7 @@ taskqueue_run_locked(struct taskqueue *q > > struct task *task; > > int pending; > > > > - mtx_assert(&queue->tq_mutex, MA_OWNED); > > + TQ_ASSERT_LOCKED(queue); > > tb.tb_running = NULL; > > TAILQ_INSERT_TAIL(&queue->tq_active, &tb, tb_link); > > > > @@ -332,7 +353,7 @@ task_is_running(struct taskqueue *queue, > > { > > struct taskqueue_busy *tb; > > > > - mtx_assert(&queue->tq_mutex, MA_OWNED); > > + TQ_ASSERT_LOCKED(queue); > > TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { > > if (tb->tb_running == task) > > return (1); > > @@ -489,6 +510,18 @@ taskqueue_start_threads(struct taskqueue > > return (0); > > } > > > > +static inline void > > +taskqueue_run_callback(struct taskqueue *tq, > > + enum taskqueue_callback_type cb_type) > > +{ > > + taskqueue_callback_fn tq_callback; > > + > > + TQ_ASSERT_UNLOCKED(tq); > > + tq_callback = tq->tq_callbacks[cb_type]; > > + if (tq_callback != NULL) > > + tq_callback(tq->tq_cb_contexts[cb_type]); > > +} > > + > > void > > taskqueue_thread_loop(void *arg) > > { > > @@ -496,6 +529,7 @@ taskqueue_thread_loop(void *arg) > > > > tqp = arg; > > tq = *tqp; > > + taskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_INIT); > > TQ_LOCK(tq); > > while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) { > > taskqueue_run_locked(tq); > > @@ -510,6 +544,15 @@ taskqueue_thread_loop(void *arg) > > } > > taskqueue_run_locked(tq); > > > > + /* > > + * This thread is on its way out, so just drop the lock > temporarily > > + * in order to call the shutdown callback. This allows the > callback > > + * to look at the taskqueue, even just before it dies. > > + */ > > + TQ_UNLOCK(tq); > > + taskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_SHUTDOWN); > > + TQ_LOCK(tq); > > + > > /* rendezvous with thread that asked us to terminate */ > > tq->tq_tcount--; > > wakeup_one(tq->tq_threads); > > @@ -525,7 +568,7 @@ taskqueue_thread_enqueue(void *context) > > tqp = context; > > tq = *tqp; > > > > - mtx_assert(&tq->tq_mutex, MA_OWNED); > > + TQ_ASSERT_LOCKED(tq); > > wakeup_one(tq); > > } > > > > > > Modified: head/sys/sys/taskqueue.h > > > ============================================================================== > > --- head/sys/sys/taskqueue.h Sat Mar 23 14:52:31 2013 (r248648) > > +++ head/sys/sys/taskqueue.h Sat Mar 23 15:11:53 2013 (r248649) > > @@ -47,6 +47,16 @@ struct timeout_task { > > int f; > > }; > > > > +enum taskqueue_callback_type { > > + TASKQUEUE_CALLBACK_TYPE_INIT, > > + TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, > > +}; > > +#define TASKQUEUE_CALLBACK_TYPE_MIN > TASKQUEUE_CALLBACK_TYPE_INIT > > +#define TASKQUEUE_CALLBACK_TYPE_MAX > TASKQUEUE_CALLBACK_TYPE_SHUTDOWN > > +#define TASKQUEUE_NUM_CALLBACKS > TASKQUEUE_CALLBACK_TYPE_MAX + 1 > > This need parentheses to defensively guard against unexpected > precedence of operators. > > While here, TASKQUEUE_CALLBACK_ is a very long prefix (19 characters!) > Can this be named TQCB_ instead so it's not so verbose? > > Thanks, > matthew > From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 16:55:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9474F2989; Sat, 23 Mar 2013 16:55:08 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 87467E28; Sat, 23 Mar 2013 16:55:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NGt83P005590; Sat, 23 Mar 2013 16:55:08 GMT (envelope-from will@svn.freebsd.org) Received: (from will@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NGt8uK005589; Sat, 23 Mar 2013 16:55:08 GMT (envelope-from will@svn.freebsd.org) Message-Id: <201303231655.r2NGt8uK005589@svn.freebsd.org> From: Will Andrews Date: Sat, 23 Mar 2013 16:55:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248654 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 16:55:08 -0000 Author: will Date: Sat Mar 23 16:55:07 2013 New Revision: 248654 URL: http://svnweb.freebsd.org/changeset/base/248654 Log: Be more explicit about what each bio_cmd & bio_flags value means. Reviewed by: ken (mentor) Modified: head/sys/sys/bio.h Modified: head/sys/sys/bio.h ============================================================================== --- head/sys/sys/bio.h Sat Mar 23 16:34:56 2013 (r248653) +++ head/sys/sys/bio.h Sat Mar 23 16:55:07 2013 (r248654) @@ -41,19 +41,23 @@ #include /* bio_cmd */ -#define BIO_READ 0x01 -#define BIO_WRITE 0x02 -#define BIO_DELETE 0x04 -#define BIO_GETATTR 0x08 -#define BIO_FLUSH 0x10 +#define BIO_READ 0x01 /* Read I/O data */ +#define BIO_WRITE 0x02 /* Write I/O data */ +#define BIO_DELETE 0x04 /* TRIM or free blocks, i.e. mark as unused */ +#define BIO_GETATTR 0x08 /* Get GEOM attributes of object */ +#define BIO_FLUSH 0x10 /* Commit outstanding I/O now */ #define BIO_CMD0 0x20 /* Available for local hacks */ #define BIO_CMD1 0x40 /* Available for local hacks */ #define BIO_CMD2 0x80 /* Available for local hacks */ /* bio_flags */ -#define BIO_ERROR 0x01 -#define BIO_DONE 0x02 -#define BIO_ONQUEUE 0x04 +#define BIO_ERROR 0x01 /* An error occurred processing this bio. */ +#define BIO_DONE 0x02 /* This bio is finished. */ +#define BIO_ONQUEUE 0x04 /* This bio is in a queue & not yet taken. */ +/* + * This bio must be executed after all previous bios in the queue have been + * executed, and before any successive bios can be executed. + */ #define BIO_ORDERED 0x08 #define BIO_UNMAPPED 0x10 #define BIO_TRANSIENT_MAPPING 0x20 From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 17:17:07 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2869C34F6; Sat, 23 Mar 2013 17:17:07 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0CE805F7; Sat, 23 Mar 2013 17:17:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NHH6BK012447; Sat, 23 Mar 2013 17:17:06 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NHH6O0012446; Sat, 23 Mar 2013 17:17:06 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201303231717.r2NHH6O0012446@svn.freebsd.org> From: Ian Lepore Date: Sat, 23 Mar 2013 17:17:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248655 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 17:17:07 -0000 Author: ian Date: Sat Mar 23 17:17:06 2013 New Revision: 248655 URL: http://svnweb.freebsd.org/changeset/base/248655 Log: Don't check and warn about pmap mismatch on every call to busdma sync. With some recent busdma refactoring, sometimes it happens that a sync op gets called when bus_dmamap_load() never got called, which results in a spurious warning about a map mismatch when no sync operations will actually happen anyway. Now the check is done only if a sync operation is actually performed, and the result of the check is a panic, not just a printf. Reviewed by: cognet (who prevented me from donning a point hat) Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Sat Mar 23 16:55:07 2013 (r248654) +++ head/sys/arm/arm/busdma_machdep-v6.c Sat Mar 23 17:17:06 2013 (r248655) @@ -1150,19 +1150,16 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus vm_offset_t bbuf; char _tmp_cl[arm_dcache_align], _tmp_clend[arm_dcache_align]; #endif - /* if buffer was from user space, it it possible that this - * is not the same vm map. The fix is to map each page in - * the buffer into the current address space (KVM) and then - * do the bounce copy or sync list cache operation. - * - * The sync list entries are already broken into - * their respective physical pages. - */ - if (!pmap_dmap_iscurrent(map->pmap)) - printf("_bus_dmamap_sync: wrong user map: %p %x\n", map->pmap, op); - + /* + * If the buffer was from user space, it is possible that this is not + * the same vm map, especially on a POST operation. It's not clear that + * dma on userland buffers can work at all right now, certainly not if a + * partial cacheline flush has to be handled. To be safe, until we're + * able to test direct userland dma, panic on a map mismatch. + */ if ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) { - + if (!pmap_dmap_iscurrent(map->pmap)) + panic("_bus_dmamap_sync: wrong user map for bounce sync."); /* Handle data bouncing. */ CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x op 0x%x " "performing bounce", __func__, dmat, dmat->flags, op); @@ -1188,9 +1185,6 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus } if (op & BUS_DMASYNC_POSTREAD) { - if (!pmap_dmap_iscurrent(map->pmap)) - panic("_bus_dmamap_sync: wrong user map. apply fix"); - cpu_dcache_inv_range((vm_offset_t)bpage->vaddr, bpage->datacount); l2cache_inv_range((vm_offset_t)bpage->vaddr, @@ -1230,6 +1224,8 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus return; if (map->sync_count != 0) { + if (!pmap_dmap_iscurrent(map->pmap)) + panic("_bus_dmamap_sync: wrong user map for sync."); /* ARM caches are not self-snooping for dma */ sl = &map->slist[0]; @@ -1303,8 +1299,6 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus #ifdef FIX_DMAP_BUS_DMASYNC_POSTREAD case BUS_DMASYNC_POSTREAD: - if (!pmap_dmap_iscurrent(map->pmap)) - panic("_bus_dmamap_sync: wrong user map. apply fix"); while (sl != end) { /* write back the unaligned portions */ vm_paddr_t physaddr; From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 18:36:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0CC2F26EE; Sat, 23 Mar 2013 18:36:17 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-qa0-f50.google.com (mail-qa0-f50.google.com [209.85.216.50]) by mx1.freebsd.org (Postfix) with ESMTP id 91AE497B; Sat, 23 Mar 2013 18:36:16 +0000 (UTC) Received: by mail-qa0-f50.google.com with SMTP id bv4so2260178qab.16 for ; Sat, 23 Mar 2013 11:36:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=ZCIJtjTof4uoqQi9sREbMayEH83PIN6Oj2pcVg/S0Z0=; b=n1rbBedZKSVXPcyS1Jdgjz0gVDWLUWyl9Y8lDHhJB3ZOvwyQ6C0o9lgYgtkJzVoy7B NcS1nT2TYPDQCrdArn2DZZcUj5mefAhEgnVfo59uuzmcgVKUZWki4tfhzRwMX6bZbpWP svmzpKTkKWKkAv+6mLQamtrFc4M6sMU7Gv6JQcMqJ/3lS87Chjmbz0glLjgPEqfoLBtx GIUQLBYaI1mWd0qAEK7O2oJIXc+wRymHyl2giMzv8Zhmp61uq5b6YuRx7SeELmSv8B7r G8gXvVgrzvAw+/qRbP7hxFWU9QSQcGSKii6D1nOS25c2bMZ4vNLAJPunJGzYLIhhGpSv pKSw== MIME-Version: 1.0 X-Received: by 10.49.117.106 with SMTP id kd10mr2205234qeb.25.1364063770406; Sat, 23 Mar 2013 11:36:10 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.229.179.42 with HTTP; Sat, 23 Mar 2013 11:36:10 -0700 (PDT) In-Reply-To: References: <201303231511.r2NFBrrr074289@svn.freebsd.org> Date: Sat, 23 Mar 2013 11:36:10 -0700 X-Google-Sender-Auth: X4zfaZmSQD2zD4ruP1cMLRYxqnM Message-ID: Subject: Re: svn commit: r248649 - in head: share/man/man9 sys/kern sys/sys From: mdf@FreeBSD.org To: Will Andrews Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Will Andrews X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 18:36:17 -0000 On Sat, Mar 23, 2013 at 9:45 AM, Will Andrews wrote: > I agree about the name length, it is a bit obnoxious. However, it is also > descriptive. TQCB strikes me as perhaps a bit too far in the other > direction. How about TQ_CALLBACK_? Is there an existing (pseudo) > convention for callback names? I'm not sure FreeBSD has anything standard, but at $WORK we use CB or cb frequently as an abbreviation for callback. TASKQUEUE -> TQ still removes 7 letters, which is a start. :-) Thanks, matthew > On Sat, Mar 23, 2013 at 10:20 AM, wrote: >> >> On Sat, Mar 23, 2013 at 8:11 AM, Will Andrews wrote: >> > Author: will >> > Date: Sat Mar 23 15:11:53 2013 >> > New Revision: 248649 >> > URL: http://svnweb.freebsd.org/changeset/base/248649 >> > >> > Log: >> > Extend taskqueue(9) to enable per-taskqueue callbacks. >> > >> > The scope of these callbacks is primarily to support actions that >> > affect the >> > taskqueue's thread environments. They are entirely optional, and >> > consequently are introduced as a new API: taskqueue_set_callback(). >> > >> > This interface allows the caller to specify that a taskqueue requires >> > a >> > callback and optional context pointer for a given callback type. >> > >> > The callback types included in this commit can be used to register a >> > constructor and destructor for thread-local storage using osd(9). >> > This >> > allows a particular taskqueue to define that its threads require a >> > specific >> > type of TLS, without the need for a specially-orchestrated task-based >> > mechanism for startup and shutdown in order to accomplish it. >> > >> > Two callback types are supported at this point: >> > >> > - TASKQUEUE_CALLBACK_TYPE_INIT, called by every thread when it starts, >> > prior >> > to processing any tasks. >> > - TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, called by every thread when it >> > exits, >> > after it has processed its last task but before the taskqueue is >> > reclaimed. >> > >> > While I'm here: >> > >> > - Add two new macros, TQ_ASSERT_LOCKED and TQ_ASSERT_UNLOCKED, and use >> > them >> > in appropriate locations. >> > - Fix taskqueue.9 to mention taskqueue_start_threads(), which is a >> > required >> > interface for all consumers of taskqueue(9). >> > >> > Reviewed by: kib (all), eadler (taskqueue.9), brd (taskqueue.9) >> > Approved by: ken (mentor) >> > Sponsored by: Spectra Logic >> > MFC after: 1 month >> > >> > Modified: >> > head/share/man/man9/taskqueue.9 >> > head/sys/kern/subr_taskqueue.c >> > head/sys/sys/taskqueue.h >> > >> > Modified: head/share/man/man9/taskqueue.9 >> > >> > ============================================================================== >> > --- head/share/man/man9/taskqueue.9 Sat Mar 23 14:52:31 2013 >> > (r248648) >> > +++ head/share/man/man9/taskqueue.9 Sat Mar 23 15:11:53 2013 >> > (r248649) >> > @@ -53,12 +53,23 @@ struct task { >> > void *ta_context; /* argument for handler >> > */ >> > }; >> > >> > +enum taskqueue_callback_type { >> > + TASKQUEUE_CALLBACK_TYPE_INIT, >> > + TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, >> > +}; >> > + >> > +typedef void (*taskqueue_callback_fn)(void *context); >> > + >> > struct timeout_task; >> > .Ed >> > .Ft struct taskqueue * >> > .Fn taskqueue_create "const char *name" "int mflags" >> > "taskqueue_enqueue_fn enqueue" "void *context" >> > .Ft struct taskqueue * >> > .Fn taskqueue_create_fast "const char *name" "int mflags" >> > "taskqueue_enqueue_fn enqueue" "void *context" >> > +.Ft int >> > +.Fn taskqueue_start_threads "struct taskqueue **tqp" "int count" "int >> > pri" "const char *name" "..." >> > +.Ft void >> > +.Fn taskqueue_set_callback "struct taskqueue *queue" "enum >> > taskqueue_callback_type cb_type" "taskqueue_callback_fn callback" "void >> > *context" >> > .Ft void >> > .Fn taskqueue_free "struct taskqueue *queue" >> > .Ft int >> > @@ -127,6 +138,23 @@ should be used to free the memory used b >> > Any tasks that are on the queue will be executed at this time after >> > which the thread servicing the queue will be signaled that it should >> > exit. >> > .Pp >> > +Once a taskqueue has been created, its threads should be started using >> > +.Fn taskqueue_start_threads . >> > +Callbacks may optionally be registered using >> > +.Fn taskqueue_set_callback . >> > +Currently, callbacks may be registered for the following purposes: >> > +.Bl -tag -width TASKQUEUE_CALLBACK_TYPE_SHUTDOWN >> > +.It Dv TASKQUEUE_CALLBACK_TYPE_INIT >> > +This callback is called by every thread in the taskqueue, before it >> > executes >> > +any tasks. >> > +This callback must be set before the taskqueue's threads are started. >> > +.It Dv TASKQUEUE_CALLBACK_TYPE_SHUTDOWN >> > +This callback is called by every thread in the taskqueue, after it >> > executes >> > +its last task. >> > +This callback will always be called before the taskqueue structure is >> > +reclaimed. >> > +.El >> > +.Pp >> > To add a task to the list of tasks queued on a taskqueue, call >> > .Fn taskqueue_enqueue >> > with pointers to the queue and task. >> > >> > Modified: head/sys/kern/subr_taskqueue.c >> > >> > ============================================================================== >> > --- head/sys/kern/subr_taskqueue.c Sat Mar 23 14:52:31 2013 >> > (r248648) >> > +++ head/sys/kern/subr_taskqueue.c Sat Mar 23 15:11:53 2013 >> > (r248649) >> > @@ -63,6 +63,8 @@ struct taskqueue { >> > int tq_spin; >> > int tq_flags; >> > int tq_callouts; >> > + taskqueue_callback_fn tq_callbacks[TASKQUEUE_NUM_CALLBACKS]; >> > + void >> > *tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS]; >> > }; >> > >> > #define TQ_FLAGS_ACTIVE (1 << 0) >> > @@ -78,6 +80,7 @@ struct taskqueue { >> > else >> > \ >> > mtx_lock(&(tq)->tq_mutex); >> > \ >> > } while (0) >> > +#define TQ_ASSERT_LOCKED(tq) mtx_assert(&(tq)->tq_mutex, >> > MA_OWNED) >> > >> > #define TQ_UNLOCK(tq) >> > \ >> > do { >> > \ >> > @@ -86,6 +89,7 @@ struct taskqueue { >> > else >> > \ >> > mtx_unlock(&(tq)->tq_mutex); >> > \ >> > } while (0) >> > +#define TQ_ASSERT_UNLOCKED(tq) mtx_assert(&(tq)->tq_mutex, >> > MA_NOTOWNED) >> > >> > void >> > _timeout_task_init(struct taskqueue *queue, struct timeout_task >> > *timeout_task, >> > @@ -137,6 +141,23 @@ taskqueue_create(const char *name, int m >> > MTX_DEF, "taskqueue"); >> > } >> > >> > +void >> > +taskqueue_set_callback(struct taskqueue *queue, >> > + enum taskqueue_callback_type cb_type, taskqueue_callback_fn >> > callback, >> > + void *context) >> > +{ >> > + >> > + KASSERT(((cb_type >= TASKQUEUE_CALLBACK_TYPE_MIN) && >> > + (cb_type <= TASKQUEUE_CALLBACK_TYPE_MAX)), >> > + ("Callback type %d not valid, must be %d-%d", cb_type, >> > + TASKQUEUE_CALLBACK_TYPE_MIN, TASKQUEUE_CALLBACK_TYPE_MAX)); >> > + KASSERT((queue->tq_callbacks[cb_type] == NULL), >> > + ("Re-initialization of taskqueue callback?")); >> > + >> > + queue->tq_callbacks[cb_type] = callback; >> > + queue->tq_cb_contexts[cb_type] = context; >> > +} >> > + >> > /* >> > * Signal a taskqueue thread to terminate. >> > */ >> > @@ -293,7 +314,7 @@ taskqueue_run_locked(struct taskqueue *q >> > struct task *task; >> > int pending; >> > >> > - mtx_assert(&queue->tq_mutex, MA_OWNED); >> > + TQ_ASSERT_LOCKED(queue); >> > tb.tb_running = NULL; >> > TAILQ_INSERT_TAIL(&queue->tq_active, &tb, tb_link); >> > >> > @@ -332,7 +353,7 @@ task_is_running(struct taskqueue *queue, >> > { >> > struct taskqueue_busy *tb; >> > >> > - mtx_assert(&queue->tq_mutex, MA_OWNED); >> > + TQ_ASSERT_LOCKED(queue); >> > TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { >> > if (tb->tb_running == task) >> > return (1); >> > @@ -489,6 +510,18 @@ taskqueue_start_threads(struct taskqueue >> > return (0); >> > } >> > >> > +static inline void >> > +taskqueue_run_callback(struct taskqueue *tq, >> > + enum taskqueue_callback_type cb_type) >> > +{ >> > + taskqueue_callback_fn tq_callback; >> > + >> > + TQ_ASSERT_UNLOCKED(tq); >> > + tq_callback = tq->tq_callbacks[cb_type]; >> > + if (tq_callback != NULL) >> > + tq_callback(tq->tq_cb_contexts[cb_type]); >> > +} >> > + >> > void >> > taskqueue_thread_loop(void *arg) >> > { >> > @@ -496,6 +529,7 @@ taskqueue_thread_loop(void *arg) >> > >> > tqp = arg; >> > tq = *tqp; >> > + taskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_INIT); >> > TQ_LOCK(tq); >> > while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) { >> > taskqueue_run_locked(tq); >> > @@ -510,6 +544,15 @@ taskqueue_thread_loop(void *arg) >> > } >> > taskqueue_run_locked(tq); >> > >> > + /* >> > + * This thread is on its way out, so just drop the lock >> > temporarily >> > + * in order to call the shutdown callback. This allows the >> > callback >> > + * to look at the taskqueue, even just before it dies. >> > + */ >> > + TQ_UNLOCK(tq); >> > + taskqueue_run_callback(tq, TASKQUEUE_CALLBACK_TYPE_SHUTDOWN); >> > + TQ_LOCK(tq); >> > + >> > /* rendezvous with thread that asked us to terminate */ >> > tq->tq_tcount--; >> > wakeup_one(tq->tq_threads); >> > @@ -525,7 +568,7 @@ taskqueue_thread_enqueue(void *context) >> > tqp = context; >> > tq = *tqp; >> > >> > - mtx_assert(&tq->tq_mutex, MA_OWNED); >> > + TQ_ASSERT_LOCKED(tq); >> > wakeup_one(tq); >> > } >> > >> > >> > Modified: head/sys/sys/taskqueue.h >> > >> > ============================================================================== >> > --- head/sys/sys/taskqueue.h Sat Mar 23 14:52:31 2013 >> > (r248648) >> > +++ head/sys/sys/taskqueue.h Sat Mar 23 15:11:53 2013 >> > (r248649) >> > @@ -47,6 +47,16 @@ struct timeout_task { >> > int f; >> > }; >> > >> > +enum taskqueue_callback_type { >> > + TASKQUEUE_CALLBACK_TYPE_INIT, >> > + TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, >> > +}; >> > +#define TASKQUEUE_CALLBACK_TYPE_MIN >> > TASKQUEUE_CALLBACK_TYPE_INIT >> > +#define TASKQUEUE_CALLBACK_TYPE_MAX >> > TASKQUEUE_CALLBACK_TYPE_SHUTDOWN >> > +#define TASKQUEUE_NUM_CALLBACKS >> > TASKQUEUE_CALLBACK_TYPE_MAX + 1 >> >> This need parentheses to defensively guard against unexpected >> precedence of operators. >> >> While here, TASKQUEUE_CALLBACK_ is a very long prefix (19 characters!) >> Can this be named TQCB_ instead so it's not so verbose? >> >> Thanks, >> matthew > > From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 19:04:58 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 913CE3833; Sat, 23 Mar 2013 19:04:58 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8347FD0B; Sat, 23 Mar 2013 19:04:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NJ4wF9046283; Sat, 23 Mar 2013 19:04:58 GMT (envelope-from jmg@svn.freebsd.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NJ4wZP046282; Sat, 23 Mar 2013 19:04:58 GMT (envelope-from jmg@svn.freebsd.org) Message-Id: <201303231904.r2NJ4wZP046282@svn.freebsd.org> From: John-Mark Gurney Date: Sat, 23 Mar 2013 19:04:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248656 - head/bin/ed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 19:04:58 -0000 Author: jmg Date: Sat Mar 23 19:04:57 2013 New Revision: 248656 URL: http://svnweb.freebsd.org/changeset/base/248656 Log: Fix compiling ed w/ WITHOUT_ED_CRYPTO... These variables aren't used.. Submitted by: deeptech71 at gmail dot com Modified: head/bin/ed/cbc.c Modified: head/bin/ed/cbc.c ============================================================================== --- head/bin/ed/cbc.c Sat Mar 23 17:17:06 2013 (r248655) +++ head/bin/ed/cbc.c Sat Mar 23 19:04:57 2013 (r248656) @@ -71,7 +71,6 @@ __FBSDID("$FreeBSD$"); #ifdef DES static DES_cblock ivec; /* initialization vector */ static DES_cblock pvec; /* padding vector */ -#endif static char bits[] = { /* used to extract bits from a char */ '\200', '\100', '\040', '\020', '\010', '\004', '\002', '\001' @@ -79,13 +78,12 @@ static char bits[] = { /* used to extr static int pflag; /* 1 to preserve parity bits */ -#ifdef DES static DES_key_schedule schedule; /* expanded DES key */ -#endif static unsigned char des_buf[8];/* shared buffer for get_des_char/put_des_char */ static int des_ct = 0; /* count for get_des_char/put_des_char */ static int des_n = 0; /* index for put_des_char/get_des_char */ +#endif /* init_des_cipher: initialize DES */ void From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 19:19:19 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CE667DBE; Sat, 23 Mar 2013 19:19:19 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C03F8E39; Sat, 23 Mar 2013 19:19:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NJJJfQ050452; Sat, 23 Mar 2013 19:19:19 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NJJJb6050451; Sat, 23 Mar 2013 19:19:19 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201303231919.r2NJJJb6050451@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sat, 23 Mar 2013 19:19:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248657 - head/sys/dev/drm2/ttm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 19:19:19 -0000 Author: dumbbell Date: Sat Mar 23 19:19:19 2013 New Revision: 248657 URL: http://svnweb.freebsd.org/changeset/base/248657 Log: drm/ttm: Fix TTM buffer object refcount This fixes memory leaks in the radeonkms driver. Reviewed by: Konstantin Belousov (kib@) Tested by: J.R. Oldroyd Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo_vm.c Sat Mar 23 19:04:57 2013 (r248656) +++ head/sys/dev/drm2/ttm/ttm_bo_vm.c Sat Mar 23 19:19:19 2013 (r248657) @@ -122,9 +122,7 @@ retry: m = NULL; reserve: - mtx_lock(&bo->glob->lru_lock); - ret = ttm_bo_reserve_locked(bo, false, false, false, 0); - mtx_unlock(&bo->glob->lru_lock); + ret = ttm_bo_reserve(bo, false, false, false, 0); if (unlikely(ret != 0)) { if (ret == -EBUSY) { kern_yield(0); @@ -253,10 +251,8 @@ static int ttm_bo_vm_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred, u_short *color) { - struct ttm_buffer_object *bo = handle; *color = 0; - (void)ttm_bo_reference(bo); return (0); } From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 20:00:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 63352CCA; Sat, 23 Mar 2013 20:00:04 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 542AB226; Sat, 23 Mar 2013 20:00:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NK047f062708; Sat, 23 Mar 2013 20:00:04 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NK02rF062690; Sat, 23 Mar 2013 20:00:02 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201303232000.r2NK02rF062690@svn.freebsd.org> From: Kirk McKusick Date: Sat, 23 Mar 2013 20:00:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248658 - in head/sbin: fsck_ffs fsdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 20:00:04 -0000 Author: mckusick Date: Sat Mar 23 20:00:02 2013 New Revision: 248658 URL: http://svnweb.freebsd.org/changeset/base/248658 Log: Revert 248634 and 248643 (e.g., restoring 248625 and 248639). Build verified by: Glen Barber (gjb@) Modified: head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/fsutil.c head/sbin/fsck_ffs/inode.c head/sbin/fsck_ffs/pass1.c head/sbin/fsck_ffs/pass5.c head/sbin/fsck_ffs/setup.c head/sbin/fsck_ffs/suj.c head/sbin/fsdb/fsdb.c Modified: head/sbin/fsck_ffs/fsck.h ============================================================================== --- head/sbin/fsck_ffs/fsck.h Sat Mar 23 19:19:19 2013 (r248657) +++ head/sbin/fsck_ffs/fsck.h Sat Mar 23 20:00:02 2013 (r248658) @@ -198,7 +198,6 @@ struct timespec totalreadtime[BT_NUMBUFT struct timespec startprog; struct bufarea sblk; /* file system superblock */ -struct bufarea cgblk; /* cylinder group blocks */ struct bufarea *pdirbp; /* current directory contents */ struct bufarea *pbp; /* current inode block */ @@ -216,9 +215,7 @@ struct bufarea *pbp; /* current inode b } while (0) #define sbdirty() dirty(&sblk) -#define cgdirty() dirty(&cgblk) #define sblock (*sblk.b_un.b_fs) -#define cgrp (*cgblk.b_un.b_cg) enum fixstate {DONTKNOW, NOFIX, FIX, IGNORE}; ino_t cursnapshot; @@ -361,6 +358,37 @@ struct ufs2_dinode ufs2_zino; #define EEXIT 8 /* Standard error exit. */ +int flushentry(void); +/* + * Wrapper for malloc() that flushes the cylinder group cache to try + * to get space. + */ +static inline void* +Malloc(int size) +{ + void *retval; + + while ((retval = malloc(size)) == NULL) + if (flushentry() == 0) + break; + return (retval); +} + +/* + * Wrapper for calloc() that flushes the cylinder group cache to try + * to get space. + */ +static inline void* +Calloc(int cnt, int size) +{ + void *retval; + + while ((retval = calloc(cnt, size)) == NULL) + if (flushentry() == 0) + break; + return (retval); +} + struct fstab; @@ -378,7 +406,7 @@ void cacheino(union dinode *dp, ino_t i void catch(int); void catchquit(int); int changeino(ino_t dir, const char *name, ino_t newnum); -int check_cgmagic(int cg, struct cg *cgp); +int check_cgmagic(int cg, struct bufarea *cgbp); int chkrange(ufs2_daddr_t blk, int cnt); void ckfini(int markclean); int ckinode(union dinode *dp, struct inodesc *); @@ -398,6 +426,7 @@ void freeino(ino_t ino); void freeinodebuf(void); int ftypeok(union dinode *dp); void getblk(struct bufarea *bp, ufs2_daddr_t blk, long size); +struct bufarea *cgget(int cg); struct bufarea *getdatablk(ufs2_daddr_t blkno, long size, int type); struct inoinfo *getinoinfo(ino_t inumber); union dinode *getnextinode(ino_t inumber, int rebuildcg); Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Sat Mar 23 19:19:19 2013 (r248657) +++ head/sbin/fsck_ffs/fsutil.c Sat Mar 23 20:00:02 2013 (r248658) @@ -70,6 +70,7 @@ static struct timespec startpass, finish struct timeval slowio_starttime; int slowio_delay_usec = 10000; /* Initial IO delay for background fsck */ int slowio_pollcnt; +static struct bufarea cgblk; /* backup buffer for cylinder group blocks */ static TAILQ_HEAD(buflist, bufarea) bufhead; /* head of buffer cache list */ static int numbufs; /* size of buffer cache */ static char *buftype[BT_NUMBUFTYPES] = BT_NAMES; @@ -163,7 +164,7 @@ bufinit(void) char *bufp; pbp = pdirbp = (struct bufarea *)0; - bufp = malloc((unsigned int)sblock.fs_bsize); + bufp = Malloc((unsigned int)sblock.fs_bsize); if (bufp == 0) errx(EEXIT, "cannot allocate buffer pool"); cgblk.b_un.b_buf = bufp; @@ -173,8 +174,8 @@ bufinit(void) if (bufcnt < MINBUFS) bufcnt = MINBUFS; for (i = 0; i < bufcnt; i++) { - bp = (struct bufarea *)malloc(sizeof(struct bufarea)); - bufp = malloc((unsigned int)sblock.fs_bsize); + bp = (struct bufarea *)Malloc(sizeof(struct bufarea)); + bufp = Malloc((unsigned int)sblock.fs_bsize); if (bp == NULL || bufp == NULL) { if (i >= MINBUFS) break; @@ -193,6 +194,57 @@ bufinit(void) } /* + * Manage cylinder group buffers. + */ +static struct bufarea *cgbufs; /* header for cylinder group cache */ +static int flushtries; /* number of tries to reclaim memory */ + +struct bufarea * +cgget(int cg) +{ + struct bufarea *cgbp; + struct cg *cgp; + + if (cgbufs == NULL) { + cgbufs = Calloc(sblock.fs_ncg, sizeof(struct bufarea)); + if (cgbufs == NULL) + errx(EEXIT, "cannot allocate cylinder group buffers"); + } + cgbp = &cgbufs[cg]; + if (cgbp->b_un.b_cg != NULL) + return (cgbp); + cgp = NULL; + if (flushtries == 0) + cgp = malloc((unsigned int)sblock.fs_cgsize); + if (cgp == NULL) { + getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize); + return (&cgblk); + } + cgbp->b_un.b_cg = cgp; + initbarea(cgbp, BT_CYLGRP); + getblk(cgbp, cgtod(&sblock, cg), sblock.fs_cgsize); + return (cgbp); +} + +/* + * Attempt to flush a cylinder group cache entry. + * Return whether the flush was successful. + */ +int +flushentry(void) +{ + struct bufarea *cgbp; + + cgbp = &cgbufs[flushtries++]; + if (cgbp->b_un.b_cg == NULL) + return (0); + flush(fswritefd, cgbp); + free(cgbp->b_un.b_buf); + cgbp->b_un.b_buf = NULL; + return (1); +} + +/* * Manage a cache of directory blocks. */ struct bufarea * @@ -363,6 +415,13 @@ ckfini(int markclean) } if (numbufs != cnt) errx(EEXIT, "panic: lost %d buffers", numbufs - cnt); + for (cnt = 0; cnt < sblock.fs_ncg; cnt++) { + if (cgbufs[cnt].b_un.b_cg == NULL) + continue; + flush(fswritefd, &cgbufs[cnt]); + free(cgbufs[cnt].b_un.b_cg); + } + free(cgbufs); pbp = pdirbp = (struct bufarea *)0; if (cursnapshot == 0 && sblock.fs_clean != markclean) { if ((sblock.fs_clean = markclean) != 0) { @@ -448,8 +507,8 @@ static void printIOstats(void) clock_gettime(CLOCK_REALTIME_PRECISE, &finishpass); timespecsub(&finishpass, &startpass); - msec = finishpass.tv_sec * 1000 + finishpass.tv_nsec / 1000000; - printf("Running time: %lld msec\n", msec); + printf("Running time: %d.%03ld msec\n", + finishpass.tv_sec, finishpass.tv_nsec / 1000000); printf("buffer reads by type:\n"); for (totalmsec = 0, i = 0; i < BT_NUMBUFTYPES; i++) totalmsec += readtime[i].tv_sec * 1000 + @@ -460,9 +519,10 @@ static void printIOstats(void) if (readcnt[i] == 0) continue; msec = readtime[i].tv_sec * 1000 + readtime[i].tv_nsec / 1000000; - printf("%21s:%8ld %2ld.%ld%% %8lld msec %2lld.%lld%%\n", + printf("%21s:%8ld %2ld.%ld%% %4d.%03ld sec %2jd.%jd%%\n", buftype[i], readcnt[i], readcnt[i] * 100 / diskreads, - (readcnt[i] * 1000 / diskreads) % 10, msec, + (readcnt[i] * 1000 / diskreads) % 10, + readtime[i].tv_sec, readtime[i].tv_nsec / 1000000, msec * 100 / totalmsec, (msec * 1000 / totalmsec) % 10); } printf("\n"); @@ -562,8 +622,9 @@ blerase(int fd, ufs2_daddr_t blk, long s * test fails, offer an option to rebuild the whole cylinder group. */ int -check_cgmagic(int cg, struct cg *cgp) +check_cgmagic(int cg, struct bufarea *cgbp) { + struct cg *cgp = cgbp->b_un.b_cg; /* * Extended cylinder group checks. @@ -623,7 +684,7 @@ check_cgmagic(int cg, struct cg *cgp) cgp->cg_nextfreeoff = cgp->cg_clusteroff + howmany(fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT); } - cgdirty(); + dirty(cgbp); return (0); } @@ -634,7 +695,8 @@ ufs2_daddr_t allocblk(long frags) { int i, j, k, cg, baseblk; - struct cg *cgp = &cgrp; + struct bufarea *cgbp; + struct cg *cgp; if (frags <= 0 || frags > sblock.fs_frag) return (0); @@ -650,8 +712,9 @@ allocblk(long frags) continue; } cg = dtog(&sblock, i + j); - getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize); - if (!check_cgmagic(cg, cgp)) + cgbp = cgget(cg); + cgp = cgbp->b_un.b_cg; + if (!check_cgmagic(cg, cgbp)) return (0); baseblk = dtogd(&sblock, i + j); for (k = 0; k < frags; k++) { @@ -663,7 +726,7 @@ allocblk(long frags) cgp->cg_cs.cs_nbfree--; else cgp->cg_cs.cs_nffree -= frags; - cgdirty(); + dirty(cgbp); return (i + j); } } Modified: head/sbin/fsck_ffs/inode.c ============================================================================== --- head/sbin/fsck_ffs/inode.c Sat Mar 23 19:19:19 2013 (r248657) +++ head/sbin/fsck_ffs/inode.c Sat Mar 23 20:00:02 2013 (r248658) @@ -423,7 +423,7 @@ setinodebuf(ino_t inum) partialsize = inobufsize; } initbarea(&inobuf, BT_INODES); - if ((inobuf.b_un.b_buf = malloc((unsigned)inobufsize)) == NULL) + if ((inobuf.b_un.b_buf = Malloc((unsigned)inobufsize)) == NULL) errx(EEXIT, "cannot allocate space for inode buffer"); } @@ -454,7 +454,7 @@ cacheino(union dinode *dp, ino_t inumber else blks = howmany(DIP(dp, di_size), sblock.fs_bsize); inp = (struct inoinfo *) - malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t)); + Malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t)); if (inp == NULL) errx(EEXIT, "cannot increase directory list"); inpp = &inphead[inumber % dirhash]; @@ -657,7 +657,8 @@ allocino(ino_t request, int type) { ino_t ino; union dinode *dp; - struct cg *cgp = &cgrp; + struct bufarea *cgbp; + struct cg *cgp; int cg; if (request == 0) @@ -670,8 +671,9 @@ allocino(ino_t request, int type) if (ino == maxino) return (0); cg = ino_to_cg(&sblock, ino); - getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize); - if (!check_cgmagic(cg, cgp)) + cgbp = cgget(cg); + cgp = cgbp->b_un.b_cg; + if (!check_cgmagic(cg, cgbp)) return (0); setbit(cg_inosused(cgp), ino % sblock.fs_ipg); cgp->cg_cs.cs_nifree--; @@ -687,7 +689,7 @@ allocino(ino_t request, int type) default: return (0); } - cgdirty(); + dirty(cgbp); dp = ginode(ino); DIP_SET(dp, di_db[0], allocblk((long)1)); if (DIP(dp, di_db[0]) == 0) { Modified: head/sbin/fsck_ffs/pass1.c ============================================================================== --- head/sbin/fsck_ffs/pass1.c Sat Mar 23 19:19:19 2013 (r248657) +++ head/sbin/fsck_ffs/pass1.c Sat Mar 23 20:00:02 2013 (r248658) @@ -61,6 +61,8 @@ pass1(void) { struct inostat *info; struct inodesc idesc; + struct bufarea *cgbp; + struct cg *cgp; ino_t inumber, inosused, mininos; ufs2_daddr_t i, cgd; u_int8_t *cp; @@ -92,12 +94,13 @@ pass1(void) for (c = 0; c < sblock.fs_ncg; c++) { inumber = c * sblock.fs_ipg; setinodebuf(inumber); - getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize); + cgbp = cgget(c); + cgp = cgbp->b_un.b_cg; rebuildcg = 0; - if (!check_cgmagic(c, &cgrp)) + if (!check_cgmagic(c, cgbp)) rebuildcg = 1; if (!rebuildcg && sblock.fs_magic == FS_UFS2_MAGIC) { - inosused = cgrp.cg_initediblk; + inosused = cgp->cg_initediblk; if (inosused > sblock.fs_ipg) { pfatal( "Too many initialized inodes (%ju > %d) in cylinder group %d\nReset to %d\n", @@ -127,7 +130,7 @@ pass1(void) * read only those inodes in from disk. */ if ((preen || inoopt) && usedsoftdep && !rebuildcg) { - cp = &cg_inosused(&cgrp)[(inosused - 1) / CHAR_BIT]; + cp = &cg_inosused(cgp)[(inosused - 1) / CHAR_BIT]; for ( ; inosused > 0; inosused -= CHAR_BIT, cp--) { if (*cp == 0) continue; @@ -149,7 +152,7 @@ pass1(void) inostathead[c].il_stat = 0; continue; } - info = calloc((unsigned)inosused, sizeof(struct inostat)); + info = Calloc((unsigned)inosused, sizeof(struct inostat)); if (info == NULL) errx(EEXIT, "cannot alloc %u bytes for inoinfo", (unsigned)(sizeof(struct inostat) * inosused)); @@ -169,7 +172,7 @@ pass1(void) * valid number for this cylinder group. */ if (checkinode(inumber, &idesc, rebuildcg) == 0 && - i > cgrp.cg_initediblk) + i > cgp->cg_initediblk) break; } /* @@ -181,16 +184,16 @@ pass1(void) mininos = roundup(inosused + INOPB(&sblock), INOPB(&sblock)); if (inoopt && !preen && !rebuildcg && sblock.fs_magic == FS_UFS2_MAGIC && - cgrp.cg_initediblk > 2 * INOPB(&sblock) && - mininos < cgrp.cg_initediblk) { - i = cgrp.cg_initediblk; + cgp->cg_initediblk > 2 * INOPB(&sblock) && + mininos < cgp->cg_initediblk) { + i = cgp->cg_initediblk; if (mininos < 2 * INOPB(&sblock)) - cgrp.cg_initediblk = 2 * INOPB(&sblock); + cgp->cg_initediblk = 2 * INOPB(&sblock); else - cgrp.cg_initediblk = mininos; + cgp->cg_initediblk = mininos; pwarn("CYLINDER GROUP %d: RESET FROM %ju TO %d %s\n", - c, i, cgrp.cg_initediblk, "VALID INODES"); - cgdirty(); + c, i, cgp->cg_initediblk, "VALID INODES"); + dirty(cgbp); } if (inosused < sblock.fs_ipg) continue; @@ -199,11 +202,11 @@ pass1(void) inosused = 0; else inosused = lastino - (c * sblock.fs_ipg); - if (rebuildcg && inosused > cgrp.cg_initediblk && + if (rebuildcg && inosused > cgp->cg_initediblk && sblock.fs_magic == FS_UFS2_MAGIC) { - cgrp.cg_initediblk = roundup(inosused, INOPB(&sblock)); + cgp->cg_initediblk = roundup(inosused, INOPB(&sblock)); pwarn("CYLINDER GROUP %d: FOUND %d VALID INODES\n", c, - cgrp.cg_initediblk); + cgp->cg_initediblk); } /* * If we were not able to determine in advance which inodes @@ -219,7 +222,7 @@ pass1(void) inostathead[c].il_stat = 0; continue; } - info = calloc((unsigned)inosused, sizeof(struct inostat)); + info = Calloc((unsigned)inosused, sizeof(struct inostat)); if (info == NULL) errx(EEXIT, "cannot alloc %u bytes for inoinfo", (unsigned)(sizeof(struct inostat) * inosused)); @@ -482,7 +485,7 @@ pass1check(struct inodesc *idesc) } return (STOP); } - new = (struct dups *)malloc(sizeof(struct dups)); + new = (struct dups *)Malloc(sizeof(struct dups)); if (new == NULL) { pfatal("DUP TABLE OVERFLOW."); if (reply("CONTINUE") == 0) { Modified: head/sbin/fsck_ffs/pass5.c ============================================================================== --- head/sbin/fsck_ffs/pass5.c Sat Mar 23 19:19:19 2013 (r248657) +++ head/sbin/fsck_ffs/pass5.c Sat Mar 23 20:00:02 2013 (r248658) @@ -59,14 +59,14 @@ pass5(void) int c, i, j, blk, frags, basesize, mapsize; int inomapsize, blkmapsize; struct fs *fs = &sblock; - struct cg *cg = &cgrp; ufs2_daddr_t d, dbase, dmax, start; int rewritecg = 0; struct csum *cs; struct csum_total cstotal; struct inodesc idesc[3]; char buf[MAXBSIZE]; - struct cg *newcg = (struct cg *)buf; + struct cg *cg, *newcg = (struct cg *)buf; + struct bufarea *cgbp; inoinfo(WINO)->ino_state = USTATE; memset(newcg, 0, (size_t)fs->fs_cgsize); @@ -162,7 +162,8 @@ pass5(void) c * 100 / sblock.fs_ncg); got_sigalarm = 0; } - getblk(&cgblk, cgtod(fs, c), fs->fs_cgsize); + cgbp = cgget(c); + cg = cgbp->b_un.b_cg; if (!cg_chkmagic(cg)) pfatal("CG %d: BAD MAGIC NUMBER\n", c); newcg->cg_time = cg->cg_time; @@ -324,14 +325,14 @@ pass5(void) } if (rewritecg) { memmove(cg, newcg, (size_t)fs->fs_cgsize); - cgdirty(); + dirty(cgbp); continue; } if (cursnapshot == 0 && memcmp(newcg, cg, basesize) != 0 && dofix(&idesc[2], "SUMMARY INFORMATION BAD")) { memmove(cg, newcg, (size_t)basesize); - cgdirty(); + dirty(cgbp); } if (bkgrdflag != 0 || usedsoftdep || debug) update_maps(cg, newcg, bkgrdflag); @@ -340,7 +341,7 @@ pass5(void) dofix(&idesc[1], "BLK(S) MISSING IN BIT MAPS")) { memmove(cg_inosused(cg), cg_inosused(newcg), (size_t)mapsize); - cgdirty(); + dirty(cgbp); } } if (cursnapshot == 0 && Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Sat Mar 23 19:19:19 2013 (r248657) +++ head/sbin/fsck_ffs/setup.c Sat Mar 23 20:00:02 2013 (r248658) @@ -240,7 +240,7 @@ setup(char *dev) * read in the summary info. */ asked = 0; - sblock.fs_csp = calloc(1, sblock.fs_cssize); + sblock.fs_csp = Calloc(1, sblock.fs_cssize); if (sblock.fs_csp == NULL) { printf("cannot alloc %u bytes for cg summary info\n", (unsigned)sblock.fs_cssize); @@ -265,13 +265,13 @@ setup(char *dev) * allocate and initialize the necessary maps */ bmapsize = roundup(howmany(maxfsblock, CHAR_BIT), sizeof(short)); - blockmap = calloc((unsigned)bmapsize, sizeof (char)); + blockmap = Calloc((unsigned)bmapsize, sizeof (char)); if (blockmap == NULL) { printf("cannot alloc %u bytes for blockmap\n", (unsigned)bmapsize); goto badsb; } - inostathead = calloc((unsigned)(sblock.fs_ncg), + inostathead = Calloc((unsigned)(sblock.fs_ncg), sizeof(struct inostatlist)); if (inostathead == NULL) { printf("cannot alloc %u bytes for inostathead\n", @@ -282,9 +282,9 @@ setup(char *dev) dirhash = numdirs; inplast = 0; listmax = numdirs + 10; - inpsort = (struct inoinfo **)calloc((unsigned)listmax, + inpsort = (struct inoinfo **)Calloc((unsigned)listmax, sizeof(struct inoinfo *)); - inphead = (struct inoinfo **)calloc((unsigned)numdirs, + inphead = (struct inoinfo **)Calloc((unsigned)numdirs, sizeof(struct inoinfo *)); if (inpsort == NULL || inphead == NULL) { printf("cannot alloc %ju bytes for inphead\n", @@ -444,8 +444,8 @@ sblock_init(void) lfdir = 0; initbarea(&sblk, BT_SUPERBLK); initbarea(&asblk, BT_SUPERBLK); - sblk.b_un.b_buf = malloc(SBLOCKSIZE); - asblk.b_un.b_buf = malloc(SBLOCKSIZE); + sblk.b_un.b_buf = Malloc(SBLOCKSIZE); + asblk.b_un.b_buf = Malloc(SBLOCKSIZE); if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL) errx(EEXIT, "cannot allocate space for superblock"); if ((lp = getdisklabel(NULL, fsreadfd))) Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Sat Mar 23 19:19:19 2013 (r248657) +++ head/sbin/fsck_ffs/suj.c Sat Mar 23 20:00:02 2013 (r248658) @@ -161,7 +161,7 @@ errmalloc(size_t n) { void *a; - a = malloc(n); + a = Malloc(n); if (a == NULL) err(EX_OSERR, "malloc(%zu)", n); return (a); @@ -194,7 +194,7 @@ opendisk(const char *devnam) { if (disk != NULL) return; - disk = malloc(sizeof(*disk)); + disk = Malloc(sizeof(*disk)); if (disk == NULL) err(EX_OSERR, "malloc(%zu)", sizeof(*disk)); if (ufs_disk_fillout(disk, devnam) == -1) { Modified: head/sbin/fsdb/fsdb.c ============================================================================== --- head/sbin/fsdb/fsdb.c Sat Mar 23 19:19:19 2013 (r248657) +++ head/sbin/fsdb/fsdb.c Sat Mar 23 20:00:02 2013 (r248658) @@ -441,7 +441,8 @@ CMDFUNCSTART(findblk) ino_t inum, inosused; uint32_t *wantedblk32; uint64_t *wantedblk64; - struct cg *cgp = &cgrp; + struct bufarea *cgbp; + struct cg *cgp; int c, i, is_ufs2; wantedblksize = (argc - 1); @@ -473,8 +474,8 @@ CMDFUNCSTART(findblk) */ inum = c * sblock.fs_ipg; /* Read cylinder group. */ - getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize); - memcpy(cgp, cgblk.b_un.b_cg, sblock.fs_cgsize); + cgbp = cgget(c); + cgp = cgbp->b_un.b_cg; /* * Get a highest used inode number for a given cylinder group. * For UFS1 all inodes initialized at the newfs stage. From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 20:01:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 70E82E89; Sat, 23 Mar 2013 20:01:46 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 62CD424C; Sat, 23 Mar 2013 20:01:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NK1ktm064612; Sat, 23 Mar 2013 20:01:46 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NK1kYn064611; Sat, 23 Mar 2013 20:01:46 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201303232001.r2NK1kYn064611@svn.freebsd.org> From: Martin Matuska Date: Sat, 23 Mar 2013 20:01:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248659 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 20:01:46 -0000 Author: mm Date: Sat Mar 23 20:01:45 2013 New Revision: 248659 URL: http://svnweb.freebsd.org/changeset/base/248659 Log: Fix kernel build with options ZFS after r24571 (libzfs_core). Submitted by: Bjoern A. Zeeb Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Mar 23 20:00:02 2013 (r248658) +++ head/sys/conf/files Sat Mar 23 20:01:45 2013 (r248659) @@ -197,10 +197,12 @@ cddl/contrib/opensolaris/uts/common/fs/z cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c optional zfs compile-with "${ZFS_C}" From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 20:02:11 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 921A8FFC; Sat, 23 Mar 2013 20:02:11 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mail.vx.sk (mail.vx.sk [IPv6:2a01:4f8:150:6101::4]) by mx1.freebsd.org (Postfix) with ESMTP id 1CC20255; Sat, 23 Mar 2013 20:02:11 +0000 (UTC) Received: from core.vx.sk (localhost [127.0.0.2]) by mail.vx.sk (Postfix) with ESMTP id 3737C27ADE; Sat, 23 Mar 2013 21:02:10 +0100 (CET) X-Virus-Scanned: amavisd-new at mail.vx.sk Received: from mail.vx.sk by core.vx.sk (amavisd-new, unix socket) with LMTP id hJy18GEvERkx; Sat, 23 Mar 2013 21:02:08 +0100 (CET) Received: from [10.9.8.1] (chello085216226145.chello.sk [85.216.226.145]) by mail.vx.sk (Postfix) with ESMTPSA id 2C5EE27AD4; Sat, 23 Mar 2013 21:02:08 +0100 (CET) Message-ID: <514E0A3D.6000706@FreeBSD.org> Date: Sat, 23 Mar 2013 21:02:05 +0100 From: Martin Matuska User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: "Bjoern A. Zeeb" Subject: Re: svn commit: r248571 - in head: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd... References: <201303210838.r2L8c3OB097432@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 20:02:11 -0000 Fixed in r248659. Thanks. On 23.3.2013 16:47, Bjoern A. Zeeb wrote: > On Thu, 21 Mar 2013, Martin Matuska wrote: > >> Author: mm >> Date: Thu Mar 21 08:38:03 2013 >> New Revision: 248571 >> URL: http://svnweb.freebsd.org/changeset/base/248571 >> >> Log: >> Merge libzfs_core branch: >> includes MFV 238590, 238592, 247580 > ... >> Added: >> head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c >> - copied unchanged from r248551, >> projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c >> head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.h >> - copied unchanged from r248551, >> projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.h >> head/cddl/contrib/opensolaris/lib/libzfs_core/ >> - copied from r248551, >> projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs_core/ >> head/cddl/lib/libzfs_core/ >> - copied from r248551, projects/libzfs_core/cddl/lib/libzfs_core/ >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c >> - copied unchanged from r248551, >> projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c >> - copied unchanged from r248551, >> projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h >> - copied unchanged from r248551, >> projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_destroy.h >> - copied unchanged from r248551, >> projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_destroy.h >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_userhold.h >> - copied unchanged from r248551, >> projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_userhold.h > > > in the theoretical event someone would want to compile zfs into the > kernel, > given r233578 added support for that, one would need this: > > mm, peter? > > Index: sys/conf/files > =================================================================== > --- sys/conf/files (revision 248649) > +++ sys/conf/files (working copy) > @@ -197,11 +197,13 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_s > cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c optional > zfs compile-with "${ZFS_C}" > cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c optional > zfs compile-with "${ZFS_C}" > cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c optional > zfs compile-with "${ZFS_C}" > +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c optional > zfs compile-with "${ZFS_C}" > cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c optional > zfs compile-with "${ZFS_C}" > cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c optional > zfs compile-with "${ZFS_C}" > cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c optional > zfs compile-with "${ZFS_C}" > cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c optional > zfs compile-with "${ZFS_C}" > cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c optional > zfs compile-with "${ZFS_C}" > +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c optional > zfs compile-with "${ZFS_C}" > cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c optional > zfs compile-with "${ZFS_C}" > cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c optional > zfs compile-with "${ZFS_C}" > cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c optional > zfs compile-with "${ZFS_C}" > > -- Martin Matuska FreeBSD committer http://blog.vx.sk From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 20:43:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E3647C66; Sat, 23 Mar 2013 20:43:26 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D56C76F8; Sat, 23 Mar 2013 20:43:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NKhQo5077228; Sat, 23 Mar 2013 20:43:26 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NKhQ9J077227; Sat, 23 Mar 2013 20:43:26 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201303232043.r2NKhQ9J077227@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sat, 23 Mar 2013 20:43:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248661 - head/sys/dev/drm2/ttm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 20:43:27 -0000 Author: dumbbell Date: Sat Mar 23 20:43:26 2013 New Revision: 248661 URL: http://svnweb.freebsd.org/changeset/base/248661 Log: drm/ttm: Explain why we don't need to acquire a ref in ttm_bo_vm_ctor() Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo_vm.c Sat Mar 23 20:17:32 2013 (r248660) +++ head/sys/dev/drm2/ttm/ttm_bo_vm.c Sat Mar 23 20:43:26 2013 (r248661) @@ -252,6 +252,11 @@ ttm_bo_vm_ctor(void *handle, vm_ooffset_ vm_ooffset_t foff, struct ucred *cred, u_short *color) { + /* + * We don't acquire a reference on bo->kref here, because it was + * already done in ttm_bo_mmap_single(). + */ + *color = 0; return (0); } From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 20:46:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 11437B6; Sat, 23 Mar 2013 20:46:48 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0357572C; Sat, 23 Mar 2013 20:46:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NKklIN077836; Sat, 23 Mar 2013 20:46:47 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NKklw1077835; Sat, 23 Mar 2013 20:46:47 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201303232046.r2NKklw1077835@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sat, 23 Mar 2013 20:46:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248663 - head/sys/dev/drm2/ttm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 20:46:48 -0000 Author: dumbbell Date: Sat Mar 23 20:46:47 2013 New Revision: 248663 URL: http://svnweb.freebsd.org/changeset/base/248663 Log: drm/ttm: Fix a typo: s/pTTM]/[TTM]/ Modified: head/sys/dev/drm2/ttm/ttm_memory.c Modified: head/sys/dev/drm2/ttm/ttm_memory.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_memory.c Sat Mar 23 20:43:28 2013 (r248662) +++ head/sys/dev/drm2/ttm/ttm_memory.c Sat Mar 23 20:46:47 2013 (r248663) @@ -51,7 +51,7 @@ MALLOC_DEFINE(M_TTM_ZONE, "ttm_zone", "T static void ttm_mem_zone_kobj_release(struct ttm_mem_zone *zone) { - printf("pTTM] Zone %7s: Used memory at exit: %llu kiB\n", + printf("[TTM] Zone %7s: Used memory at exit: %llu kiB\n", zone->name, (unsigned long long)zone->used_mem >> 10); free(zone, M_TTM_ZONE); } From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 21:34:11 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 43315C9E; Sat, 23 Mar 2013 21:34:11 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3589BA2A; Sat, 23 Mar 2013 21:34:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NLYBwV092760; Sat, 23 Mar 2013 21:34:11 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NLYBcs092759; Sat, 23 Mar 2013 21:34:11 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201303232134.r2NLYBcs092759@svn.freebsd.org> From: Martin Matuska Date: Sat, 23 Mar 2013 21:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248664 - head/contrib/libarchive/libarchive X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 21:34:11 -0000 Author: mm Date: Sat Mar 23 21:34:10 2013 New Revision: 248664 URL: http://svnweb.freebsd.org/changeset/base/248664 Log: Merge bugfix from vendor master branch: Limit write requests to at most INT_MAX. This prevents a certain common programming error (passing -1 to write) from leading to other problems deeper in the library. References: https://github.com/libarchive/libarchive/commit/22531545514043e0 Reported by: Xin Li Obtained from: libarchive (master branch) Modified: head/contrib/libarchive/libarchive/archive_write.c Modified: head/contrib/libarchive/libarchive/archive_write.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write.c Sat Mar 23 20:46:47 2013 (r248663) +++ head/contrib/libarchive/libarchive/archive_write.c Sat Mar 23 21:34:10 2013 (r248664) @@ -671,8 +671,13 @@ static ssize_t _archive_write_data(struct archive *_a, const void *buff, size_t s) { struct archive_write *a = (struct archive_write *)_a; + const size_t max_write = INT_MAX; + archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, ARCHIVE_STATE_DATA, "archive_write_data"); + /* In particular, this catches attempts to pass negative values. */ + if (s > max_write) + s = max_write; archive_clear_error(&a->archive); return ((a->format_write_data)(a, buff, s)); } From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 22:23:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 27C1EAC2; Sat, 23 Mar 2013 22:23:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 003DFDBD; Sat, 23 Mar 2013 22:23:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NMNFX6008193; Sat, 23 Mar 2013 22:23:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NMNFCK008192; Sat, 23 Mar 2013 22:23:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303232223.r2NMNFCK008192@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 23 Mar 2013 22:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248666 - head/sys/dev/drm2/ttm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 22:23:16 -0000 Author: kib Date: Sat Mar 23 22:23:15 2013 New Revision: 248666 URL: http://svnweb.freebsd.org/changeset/base/248666 Log: Do not call malloc(M_WAITOK) while bodev->fence_lock mutex is held. The ttm_buffer_object_transfer() does not need the mutex locked at all, except for the call to the driver sync_obj_ref() method. Reported and tested by: dumbbell MFC after: 2 weeks Modified: head/sys/dev/drm2/ttm/ttm_bo_util.c Modified: head/sys/dev/drm2/ttm/ttm_bo_util.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo_util.c Sat Mar 23 21:56:19 2013 (r248665) +++ head/sys/dev/drm2/ttm/ttm_bo_util.c Sat Mar 23 22:23:15 2013 (r248666) @@ -391,12 +391,11 @@ static void ttm_transfered_destroy(struc * !0: Failure. */ -static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, - struct ttm_buffer_object **new_obj) +static int +ttm_buffer_object_transfer(struct ttm_buffer_object *bo, + void *sync_obj, struct ttm_buffer_object **new_obj) { struct ttm_buffer_object *fbo; - struct ttm_bo_device *bdev = bo->bdev; - struct ttm_bo_driver *driver = bdev->driver; fbo = malloc(sizeof(*fbo), M_TTM_TRANSF_OBJ, M_ZERO | M_WAITOK); *fbo = *bo; @@ -413,7 +412,7 @@ static int ttm_buffer_object_transfer(st fbo->vm_node = NULL; atomic_set(&fbo->cpu_writers, 0); - fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj); + fbo->sync_obj = sync_obj; refcount_init(&fbo->list_kref, 1); refcount_init(&fbo->kref, 1); fbo->destroy = &ttm_transfered_destroy; @@ -594,6 +593,7 @@ int ttm_bo_move_accel_cleanup(struct ttm int ret; struct ttm_buffer_object *ghost_obj; void *tmp_obj = NULL; + void *sync_obj_ref; mtx_lock(&bdev->fence_lock); if (bo->sync_obj) { @@ -627,9 +627,10 @@ int ttm_bo_move_accel_cleanup(struct ttm set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); - /* ttm_buffer_object_transfer accesses bo->sync_obj */ - ret = ttm_buffer_object_transfer(bo, &ghost_obj); + sync_obj_ref = bo->bdev->driver->sync_obj_ref(bo->sync_obj); mtx_unlock(&bdev->fence_lock); + /* ttm_buffer_object_transfer accesses bo->sync_obj */ + ret = ttm_buffer_object_transfer(bo, sync_obj_ref, &ghost_obj); if (tmp_obj) driver->sync_obj_unref(&tmp_obj); From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 23:20:39 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1393462C; Sat, 23 Mar 2013 23:20:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 04BADD4; Sat, 23 Mar 2013 23:20:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NNKcE4025716; Sat, 23 Mar 2013 23:20:38 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NNKcqu025715; Sat, 23 Mar 2013 23:20:38 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303232320.r2NNKcqu025715@svn.freebsd.org> From: Adrian Chadd Date: Sat, 23 Mar 2013 23:20:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248668 - head/tools/tools/ath/athstats X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 23:20:39 -0000 Author: adrian Date: Sat Mar 23 23:20:38 2013 New Revision: 248668 URL: http://svnweb.freebsd.org/changeset/base/248668 Log: Expose the beacon miss counter. Modified: head/tools/tools/ath/athstats/athstats.c Modified: head/tools/tools/ath/athstats/athstats.c ============================================================================== --- head/tools/tools/ath/athstats/athstats.c Sat Mar 23 22:41:48 2013 (r248667) +++ head/tools/tools/ath/athstats/athstats.c Sat Mar 23 23:20:38 2013 (r248668) @@ -418,12 +418,14 @@ static const struct fmt athstats[] = { { 4, "asignal", "asig", "signal of last ack (dBm)" }, #define S_RX_SIGNAL AFTER(S_TX_SIGNAL) { 4, "signal", "sig", "avg recv signal (dBm)" }, +#define S_BMISSCOUNT AFTER(S_RX_SIGNAL) + { 8, "bmisscount", "bmisscnt", "beacon miss count" }, }; #define S_PHY_MIN S_RX_PHY_UNDERRUN #define S_PHY_MAX S_RX_PHY_CCK_RESTART #define S_LAST S_ANT_TX0 -#define S_MAX S_ANT_RX7+1 +#define S_MAX S_BMISSCOUNT+1 /* * XXX fold this into the external HAL definitions! -adrian @@ -752,6 +754,7 @@ ath_get_curstat(struct statfoo *sf, int case S_FF_RX: STAT(ff_rx); case S_FF_FLUSH: STAT(ff_flush); case S_TX_QFULL: STAT(tx_qfull); + case S_BMISSCOUNT: STAT(be_missed); case S_RX_NOISE: snprintf(b, bs, "%d", wf->cur.ath.ast_rx_noise); return 1; @@ -993,6 +996,7 @@ ath_get_totstat(struct statfoo *sf, int case S_FF_RX: STAT(ff_rx); case S_FF_FLUSH: STAT(ff_flush); case S_TX_QFULL: STAT(tx_qfull); + case S_BMISSCOUNT: STAT(be_missed); case S_RX_NOISE: snprintf(b, bs, "%d", wf->total.ath.ast_rx_noise); return 1; From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 23:27:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5E61E7D6; Sat, 23 Mar 2013 23:27:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5100EFD; Sat, 23 Mar 2013 23:27:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NNRHAb026782; Sat, 23 Mar 2013 23:27:17 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NNRHrQ026781; Sat, 23 Mar 2013 23:27:17 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303232327.r2NNRHrQ026781@svn.freebsd.org> From: Adrian Chadd Date: Sat, 23 Mar 2013 23:27:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248669 - head/tools/tools/ath/athstats X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 23:27:17 -0000 Author: adrian Date: Sat Mar 23 23:27:16 2013 New Revision: 248669 URL: http://svnweb.freebsd.org/changeset/base/248669 Log: More indentation fixes. Modified: head/tools/tools/ath/athstats/athstats.c Modified: head/tools/tools/ath/athstats/athstats.c ============================================================================== --- head/tools/tools/ath/athstats/athstats.c Sat Mar 23 23:20:38 2013 (r248668) +++ head/tools/tools/ath/athstats/athstats.c Sat Mar 23 23:27:16 2013 (r248669) @@ -86,7 +86,7 @@ static const struct fmt athstats[] = { #define S_TX_LINEAR AFTER(S_MIB) { 5, "txlinear", "txlinear", "tx linearized to cluster" }, #define S_BSTUCK AFTER(S_TX_LINEAR) - { 5, "bstuck", "bstuck", "stuck beacon conditions" }, + { 6, "bstuck", "bstuck", "stuck beacon conditions" }, #define S_INTRCOAL AFTER(S_BSTUCK) { 5, "intrcoal", "intrcoal", "interrupts coalesced" }, #define S_RATE AFTER(S_INTRCOAL) @@ -292,15 +292,15 @@ static const struct fmt athstats[] = { { 7, "txaggrfailall", "TXAFALL", "A-MPDU TX frame failures" }, #ifndef __linux__ #define S_CABQ_XMIT AFTER(S_TX_AGGR_FAILALL) - { 5, "cabxmit", "cabxmit", "cabq frames transmitted" }, + { 7, "cabxmit", "cabxmit", "cabq frames transmitted" }, #define S_CABQ_BUSY AFTER(S_CABQ_XMIT) - { 5, "cabqbusy", "cabqbusy", "cabq xmit overflowed beacon interval" }, + { 8, "cabqbusy", "cabqbusy", "cabq xmit overflowed beacon interval" }, #define S_TX_NODATA AFTER(S_CABQ_BUSY) - { 5, "txnodata", "txnodata", "tx discarded empty frame" }, + { 8, "txnodata", "txnodata", "tx discarded empty frame" }, #define S_TX_BUSDMA AFTER(S_TX_NODATA) - { 5, "txbusdma", "txbusdma", "tx failed for dma resrcs" }, + { 8, "txbusdma", "txbusdma", "tx failed for dma resrcs" }, #define S_RX_BUSDMA AFTER(S_TX_BUSDMA) - { 5, "rxbusdma", "rxbusdma", "rx setup failed for dma resrcs" }, + { 8, "rxbusdma", "rxbusdma", "rx setup failed for dma resrcs" }, #define S_FF_TXOK AFTER(S_RX_BUSDMA) #else #define S_FF_TXOK AFTER(S_TX_AGGR_FAILALL) From owner-svn-src-head@FreeBSD.ORG Sat Mar 23 23:51:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1A558B26; Sat, 23 Mar 2013 23:51:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0C47017A; Sat, 23 Mar 2013 23:51:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2NNpBPm034727; Sat, 23 Mar 2013 23:51:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2NNpBrZ034726; Sat, 23 Mar 2013 23:51:11 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303232351.r2NNpBrZ034726@svn.freebsd.org> From: Adrian Chadd Date: Sat, 23 Mar 2013 23:51:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248670 - head/sys/dev/ath/ath_hal/ar5416 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 23:51:12 -0000 Author: adrian Date: Sat Mar 23 23:51:11 2013 New Revision: 248670 URL: http://svnweb.freebsd.org/changeset/base/248670 Log: CABQ calculation changes to try and fix some weird corner cases leading to stuck beacons. * Set the cabq readytime (ie, how long to burst for) to 50% of the total beacon interval time * fix the cabq adjustment calculation based on how the beacon offset is calculated (the SWBA/DBA time offset.) This is all still a bit magic voodoo but it does seem to have further quietened issues with missed/stuck beacons under my local testing. In any case, it better matches what the reference HAL implements. Obtained from: Qualcomm Atheros Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Sat Mar 23 23:27:16 2013 (r248669) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Sat Mar 23 23:51:11 2013 (r248670) @@ -1191,10 +1191,10 @@ ar5416ResetTxQueue(struct ath_hal *ah, u * XXX which I gather is because of such a long * XXX cabq time.) */ - value = (ahp->ah_beaconInterval * 70 / 100) - - (ah->ah_config.ah_sw_beacon_response_time - + ah->ah_config.ah_dma_beacon_response_time) - - ah->ah_config.ah_additional_swba_backoff; + value = (ahp->ah_beaconInterval * 50 / 100) + - ah->ah_config.ah_additional_swba_backoff + - ah->ah_config.ah_sw_beacon_response_time + + ah->ah_config.ah_dma_beacon_response_time; /* * XXX Ensure it isn't too low - nothing lower * XXX than 10 TU