From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 02:02:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 79128106566C; Sun, 23 Sep 2012 02:02:00 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59F748FC14; Sun, 23 Sep 2012 02:02:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8N220xg089065; Sun, 23 Sep 2012 02:02:00 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8N220e4089058; Sun, 23 Sep 2012 02:02:00 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201209230202.q8N220e4089058@svn.freebsd.org> From: Andrew Turner Date: Sun, 23 Sep 2012 02:02:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240845 - in head/sys/arm: broadcom/bcm2835 lpc tegra ti X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 02:02:01 -0000 Author: andrew Date: Sun Sep 23 02:01:59 2012 New Revision: 240845 URL: http://svn.freebsd.org/changeset/base/240845 Log: Update different versions of physmap_init to be identical in preparation for merging them. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c head/sys/arm/lpc/lpc_machdep.c head/sys/arm/tegra/tegra2_machdep.c head/sys/arm/ti/ti_machdep.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sat Sep 22 22:41:38 2012 (r240844) +++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sun Sep 23 02:01:59 2012 (r240845) @@ -281,9 +281,19 @@ physmap_init(void) availmem_regions[i].mr_start + availmem_regions[i].mr_size, availmem_regions[i].mr_size); - phys_avail[j] = availmem_regions[i].mr_start; - phys_avail[j + 1] = availmem_regions[i].mr_start + - availmem_regions[i].mr_size; + /* + * We should not map the page at PA 0x0000000, the VM can't + * handle it, as pmap_extract() == 0 means failure. + */ + if (availmem_regions[i].mr_start > 0 || + availmem_regions[i].mr_size > PAGE_SIZE) { + phys_avail[j] = availmem_regions[i].mr_start; + if (phys_avail[j] == 0) + phys_avail[j] += PAGE_SIZE; + phys_avail[j + 1] = availmem_regions[i].mr_start + + availmem_regions[i].mr_size; + } else + j -= 2; } phys_avail[j] = 0; phys_avail[j + 1] = 0; Modified: head/sys/arm/lpc/lpc_machdep.c ============================================================================== --- head/sys/arm/lpc/lpc_machdep.c Sat Sep 22 22:41:38 2012 (r240844) +++ head/sys/arm/lpc/lpc_machdep.c Sun Sep 23 02:01:59 2012 (r240845) @@ -282,9 +282,19 @@ physmap_init(void) availmem_regions[i].mr_start + availmem_regions[i].mr_size, availmem_regions[i].mr_size); - phys_avail[j] = availmem_regions[i].mr_start; - phys_avail[j + 1] = availmem_regions[i].mr_start + - availmem_regions[i].mr_size; + /* + * We should not map the page at PA 0x0000000, the VM can't + * handle it, as pmap_extract() == 0 means failure. + */ + if (availmem_regions[i].mr_start > 0 || + availmem_regions[i].mr_size > PAGE_SIZE) { + phys_avail[j] = availmem_regions[i].mr_start; + if (phys_avail[j] == 0) + phys_avail[j] += PAGE_SIZE; + phys_avail[j + 1] = availmem_regions[i].mr_start + + availmem_regions[i].mr_size; + } else + j -= 2; } phys_avail[j] = 0; phys_avail[j + 1] = 0; Modified: head/sys/arm/tegra/tegra2_machdep.c ============================================================================== --- head/sys/arm/tegra/tegra2_machdep.c Sat Sep 22 22:41:38 2012 (r240844) +++ head/sys/arm/tegra/tegra2_machdep.c Sun Sep 23 02:01:59 2012 (r240845) @@ -273,9 +273,19 @@ physmap_init(void) availmem_regions[i].mr_start + availmem_regions[i].mr_size, availmem_regions[i].mr_size); - phys_avail[j] = availmem_regions[i].mr_start; - phys_avail[j + 1] = availmem_regions[i].mr_start + - availmem_regions[i].mr_size; + /* + * We should not map the page at PA 0x0000000, the VM can't + * handle it, as pmap_extract() == 0 means failure. + */ + if (availmem_regions[i].mr_start > 0 || + availmem_regions[i].mr_size > PAGE_SIZE) { + phys_avail[j] = availmem_regions[i].mr_start; + if (phys_avail[j] == 0) + phys_avail[j] += PAGE_SIZE; + phys_avail[j + 1] = availmem_regions[i].mr_start + + availmem_regions[i].mr_size; + } else + j -= 2; } phys_avail[j] = 0; phys_avail[j + 1] = 0; Modified: head/sys/arm/ti/ti_machdep.c ============================================================================== --- head/sys/arm/ti/ti_machdep.c Sat Sep 22 22:41:38 2012 (r240844) +++ head/sys/arm/ti/ti_machdep.c Sun Sep 23 02:01:59 2012 (r240845) @@ -205,7 +205,6 @@ physmap_init(void) phys_kernelend = KERNPHYSADDR + (virtual_avail - KERNVIRTADDR); kernload = KERNPHYSADDR; - ti_cpu_reset = NULL; /* * Remove kernel physical address range from avail @@ -282,9 +281,19 @@ physmap_init(void) availmem_regions[i].mr_start + availmem_regions[i].mr_size, availmem_regions[i].mr_size); - phys_avail[j] = availmem_regions[i].mr_start; - phys_avail[j + 1] = availmem_regions[i].mr_start + - availmem_regions[i].mr_size; + /* + * We should not map the page at PA 0x0000000, the VM can't + * handle it, as pmap_extract() == 0 means failure. + */ + if (availmem_regions[i].mr_start > 0 || + availmem_regions[i].mr_size > PAGE_SIZE) { + phys_avail[j] = availmem_regions[i].mr_start; + if (phys_avail[j] == 0) + phys_avail[j] += PAGE_SIZE; + phys_avail[j + 1] = availmem_regions[i].mr_start + + availmem_regions[i].mr_size; + } else + j -= 2; } phys_avail[j] = 0; phys_avail[j + 1] = 0; @@ -336,6 +345,7 @@ initarm(struct arm_boot_params *abp) /* Platform-specific initialisation */ pmap_bootstrap_lastaddr = DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE; + ti_cpu_reset = NULL; pcpu0_init(); From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 03:46:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 76DCA106566C; Sun, 23 Sep 2012 03:46:04 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 614558FC0C; Sun, 23 Sep 2012 03:46:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8N3k4GZ007527; Sun, 23 Sep 2012 03:46:04 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8N3k4WO007520; Sun, 23 Sep 2012 03:46:04 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201209230346.q8N3k4WO007520@svn.freebsd.org> From: Andrew Turner Date: Sun, 23 Sep 2012 03:46:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240846 - in head/sys/arm: broadcom/bcm2835 include mv tegra ti X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 03:46:04 -0000 Author: andrew Date: Sun Sep 23 03:46:03 2012 New Revision: 240846 URL: http://svn.freebsd.org/changeset/base/240846 Log: Pull out the SoC specific parts of initarm into separate functions Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c head/sys/arm/include/machdep.h head/sys/arm/mv/mv_machdep.c head/sys/arm/tegra/tegra2_machdep.c head/sys/arm/ti/ti_machdep.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sun Sep 23 02:01:59 2012 (r240845) +++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sun Sep 23 03:46:03 2012 (r240846) @@ -344,7 +344,7 @@ initarm(struct arm_boot_params *abp) while(1); /* Platform-specific initialisation */ - pmap_bootstrap_lastaddr = DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE; + pmap_bootstrap_lastaddr = initarm_lastaddr(); pcpu0_init(); @@ -484,6 +484,8 @@ initarm(struct arm_boot_params *abp) */ OF_interpret("perform-fixup", 0); + initarm_gpio_init(); + cninit(); physmem = memsize / PAGE_SIZE; @@ -495,6 +497,8 @@ initarm(struct arm_boot_params *abp) print_kernel_section_addr(); print_kenv(); + initarm_late_init(); + /* * Pages were allocated during the secondary bootstrap for the * stacks for different CPU modes. @@ -547,6 +551,23 @@ initarm(struct arm_boot_params *abp) sizeof(struct pcb))); } +vm_offset_t +initarm_lastaddr(void) +{ + + return (DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE); +} + +void +initarm_gpio_init(void) +{ +} + +void +initarm_late_init(void) +{ +} + #define FDT_DEVMAP_MAX (2) // FIXME static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { { 0, 0, 0, 0, 0, } Modified: head/sys/arm/include/machdep.h ============================================================================== --- head/sys/arm/include/machdep.h Sun Sep 23 02:01:59 2012 (r240845) +++ head/sys/arm/include/machdep.h Sun Sep 23 03:46:03 2012 (r240846) @@ -31,6 +31,11 @@ vm_offset_t linux_parse_boot_param(struc vm_offset_t fake_preload_metadata(struct arm_boot_params *abp); vm_offset_t parse_boot_param(struct arm_boot_params *abp); +/* Called by initarm */ +vm_offset_t initarm_lastaddr(void); +void initarm_gpio_init(void); +void initarm_late_init(void); + /* Setup standard arrays */ void arm_dump_avail_init( vm_offset_t memsize, size_t max); Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Sun Sep 23 02:01:59 2012 (r240845) +++ head/sys/arm/mv/mv_machdep.c Sun Sep 23 03:46:03 2012 (r240846) @@ -334,11 +334,8 @@ initarm(struct arm_boot_params *abp) &memsize) != 0) while(1); - if (fdt_immr_addr(MV_BASE) != 0) - while (1); - /* Platform-specific initialisation */ - pmap_bootstrap_lastaddr = fdt_immr_va - ARM_NOCACHE_KVA_SIZE; + pmap_bootstrap_lastaddr = initarm_lastaddr(); pcpu0_init(); @@ -472,12 +469,7 @@ initarm(struct arm_boot_params *abp) */ OF_interpret("perform-fixup", 0); - /* - * Re-initialise MPP. It is important to call this prior to using - * console as the physical connection can be routed via MPP. - */ - if (platform_mpp_init() != 0) - while (1); + initarm_gpio_init(); cninit(); @@ -494,17 +486,7 @@ initarm(struct arm_boot_params *abp) printf("WARNING: could not fully configure devmap, error=%d\n", err_devmap); - /* - * Re-initialise decode windows - */ -#if !defined(SOC_MV_FREY) - if (soc_decode_win() != 0) - printf("WARNING: could not re-initialise decode windows! " - "Running with existing settings...\n"); -#else - /* Disable watchdog and timers */ - write_cpu_ctrl(CPU_TIMERS_BASE + CPU_TIMER_CONTROL, 0); -#endif + initarm_late_init(); /* * Pages were allocated during the secondary bootstrap for the @@ -692,6 +674,45 @@ moveon: return (0); } +vm_offset_t +initarm_lastaddr(void) +{ + + if (fdt_immr_addr(MV_BASE) != 0) + while (1); + + /* Platform-specific initialisation */ + return (fdt_immr_va - ARM_NOCACHE_KVA_SIZE); +} + +void +initarm_gpio_init(void) +{ + + /* + * Re-initialise MPP. It is important to call this prior to using + * console as the physical connection can be routed via MPP. + */ + if (platform_mpp_init() != 0) + while (1); +} + +void +initarm_late_init(void) +{ + /* + * Re-initialise decode windows + */ +#if !defined(SOC_MV_FREY) + if (soc_decode_win() != 0) + printf("WARNING: could not re-initialise decode windows! " + "Running with existing settings...\n"); +#else + /* Disable watchdog and timers */ + write_cpu_ctrl(CPU_TIMERS_BASE + CPU_TIMER_CONTROL, 0); +#endif +} + #define FDT_DEVMAP_MAX (MV_WIN_CPU_MAX + 2) static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { { 0, 0, 0, 0, 0, } Modified: head/sys/arm/tegra/tegra2_machdep.c ============================================================================== --- head/sys/arm/tegra/tegra2_machdep.c Sun Sep 23 02:01:59 2012 (r240845) +++ head/sys/arm/tegra/tegra2_machdep.c Sun Sep 23 03:46:03 2012 (r240846) @@ -383,10 +383,8 @@ initarm(struct arm_boot_params *abp) &memsize) != 0) while(1); - if (fdt_immr_addr(TEGRA2_BASE) != 0) /* FIXME ???? */ - while (1); - - pmap_bootstrap_lastaddr = fdt_immr_va - ARM_NOCACHE_KVA_SIZE; + /* Platform-specific initialisation */ + pmap_bootstrap_lastaddr = initarm_lastaddr(); pcpu0_init(); @@ -520,6 +518,8 @@ initarm(struct arm_boot_params *abp) */ OF_interpret("perform-fixup", 0); + initarm_gpio_init(); + cninit(); physmem = memsize / PAGE_SIZE; @@ -535,6 +535,8 @@ initarm(struct arm_boot_params *abp) printf("WARNING: could not fully configure devmap, error=%d\n", err_devmap); + initarm_late_init(); + /* * Pages were allocated during the secondary bootstrap for the * stacks for different CPU modes. @@ -587,6 +589,26 @@ initarm(struct arm_boot_params *abp) sizeof(struct pcb))); } +vm_offset_t +initarm_lastaddr(void) +{ + + if (fdt_immr_addr(TEGRA2_BASE) != 0) /* FIXME ???? */ + while (1); + + return (fdt_immr_va - ARM_NOCACHE_KVA_SIZE); +} + +void +initarm_gpio_init(void) +{ +} + +void +initarm_late_init(void) +{ +} + #define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) /* FIXME */ static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { { 0, 0, 0, 0, 0, } Modified: head/sys/arm/ti/ti_machdep.c ============================================================================== --- head/sys/arm/ti/ti_machdep.c Sun Sep 23 02:01:59 2012 (r240845) +++ head/sys/arm/ti/ti_machdep.c Sun Sep 23 03:46:03 2012 (r240846) @@ -344,8 +344,7 @@ initarm(struct arm_boot_params *abp) while(1); /* Platform-specific initialisation */ - pmap_bootstrap_lastaddr = DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE; - ti_cpu_reset = NULL; + pmap_bootstrap_lastaddr = initarm_lastaddr(); pcpu0_init(); @@ -479,6 +478,8 @@ initarm(struct arm_boot_params *abp) */ OF_interpret("perform-fixup", 0); + initarm_gpio_init(); + cninit(); physmem = memsize / PAGE_SIZE; @@ -494,6 +495,8 @@ initarm(struct arm_boot_params *abp) printf("WARNING: could not fully configure devmap, error=%d\n", err_devmap); + initarm_late_init(); + /* * Pages were allocated during the secondary bootstrap for the * stacks for different CPU modes. @@ -546,6 +549,24 @@ initarm(struct arm_boot_params *abp) sizeof(struct pcb))); } +vm_offset_t +initarm_lastaddr(void) +{ + + ti_cpu_reset = NULL; + return (DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE); +} + +void +initarm_gpio_init(void) +{ +} + +void +initarm_late_init(void) +{ +} + #define FDT_DEVMAP_MAX (2) // FIXME static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { { 0, 0, 0, 0, 0, } From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 06:16:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 09E871065672; Sun, 23 Sep 2012 06:16:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8EAF8FC0C; Sun, 23 Sep 2012 06:16:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8N6G8PQ033716; Sun, 23 Sep 2012 06:16:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8N6G8Pi033714; Sun, 23 Sep 2012 06:16:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209230616.q8N6G8Pi033714@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 23 Sep 2012 06:16:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240847 - stable/9/usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 06:16:09 -0000 Author: kib Date: Sun Sep 23 06:16:08 2012 New Revision: 240847 URL: http://svn.freebsd.org/changeset/base/240847 Log: MFC r240546: Handle AT_TIMEKEEP in procstat(1) -x. PR: bin/171662 Modified: stable/9/usr.bin/procstat/procstat_auxv.c Directory Properties: stable/9/usr.bin/procstat/ (props changed) Modified: stable/9/usr.bin/procstat/procstat_auxv.c ============================================================================== --- stable/9/usr.bin/procstat/procstat_auxv.c Sun Sep 23 03:46:03 2012 (r240846) +++ stable/9/usr.bin/procstat/procstat_auxv.c Sun Sep 23 06:16:08 2012 (r240847) @@ -231,9 +231,11 @@ procstat_auxv(struct kinfo_proc *kipp) else PRINT(AT_STACKPROT, %s, "EXECUTABLE"); break; - case AT_COUNT: - PRINT(AT_COUNT, %ld, (long)auxv[i].a_un.a_val); +#ifdef AT_TIMEKEEP + case AT_TIMEKEEP: + PRINT(AT_TIMEKEEP, %p, auxv[i].a_un.a_ptr); break; +#endif default: PRINT_UNKNOWN(auxv[i].a_type, auxv[i].a_un.a_val); break; From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 07:23:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3803A1065673; Sun, 23 Sep 2012 07:23:19 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 231878FC15; Sun, 23 Sep 2012 07:23:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8N7NIFv045392; Sun, 23 Sep 2012 07:23:18 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8N7NIiv045390; Sun, 23 Sep 2012 07:23:18 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201209230723.q8N7NIiv045390@svn.freebsd.org> From: Michael Tuexen Date: Sun, 23 Sep 2012 07:23:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240848 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 07:23:19 -0000 Author: tuexen Date: Sun Sep 23 07:23:18 2012 New Revision: 240848 URL: http://svn.freebsd.org/changeset/base/240848 Log: Declare a static function as such. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sun Sep 23 06:16:08 2012 (r240847) +++ head/sys/netinet/sctp_output.c Sun Sep 23 07:23:18 2012 (r240848) @@ -6412,7 +6412,7 @@ error_out: } } -int +static int sctp_med_chunk_output(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_association *asoc, From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 07:43:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F189F106564A; Sun, 23 Sep 2012 07:43:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCB2B8FC0C; Sun, 23 Sep 2012 07:43:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8N7hAog048600; Sun, 23 Sep 2012 07:43:10 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8N7hA1w048598; Sun, 23 Sep 2012 07:43:10 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201209230743.q8N7hA1w048598@svn.freebsd.org> From: Michael Tuexen Date: Sun, 23 Sep 2012 07:43:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240849 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 07:43:11 -0000 Author: tuexen Date: Sun Sep 23 07:43:10 2012 New Revision: 240849 URL: http://svn.freebsd.org/changeset/base/240849 Log: Whitespace change. MFC after: 3 days Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sun Sep 23 07:23:18 2012 (r240848) +++ head/sys/netinet/sctp_pcb.c Sun Sep 23 07:43:10 2012 (r240849) @@ -3323,8 +3323,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, continue; } else if (TAILQ_EMPTY(&asoc->asoc.send_queue) && TAILQ_EMPTY(&asoc->asoc.sent_queue) && - (asoc->asoc.stream_queue_cnt == 0) - ) { + (asoc->asoc.stream_queue_cnt == 0)) { if (asoc->asoc.locked_on_sending) { goto abort_anyway; } From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 08:38:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 522AA106566C; Sun, 23 Sep 2012 08:38:07 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 238978FC12; Sun, 23 Sep 2012 08:38:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8N8c6J8056085; Sun, 23 Sep 2012 08:38:06 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8N8c6Tu056083; Sun, 23 Sep 2012 08:38:06 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201209230838.q8N8c6Tu056083@svn.freebsd.org> From: Kevin Lo Date: Sun, 23 Sep 2012 08:38:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240850 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 08:38:07 -0000 Author: kevlo Date: Sun Sep 23 08:38:06 2012 New Revision: 240850 URL: http://svn.freebsd.org/changeset/base/240850 Log: Avoid NULL dereference Modified: head/lib/libstand/nfs.c Modified: head/lib/libstand/nfs.c ============================================================================== --- head/lib/libstand/nfs.c Sun Sep 23 07:43:10 2012 (r240849) +++ head/lib/libstand/nfs.c Sun Sep 23 08:38:06 2012 (r240850) @@ -1256,8 +1256,10 @@ nfs_open(const char *upath, struct open_ error = 0; out: - free(newfd); - free(path); + if (newfd) + free(newfd); + if (path) + free(path); #else currfd->iodesc = desc; From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 08:44:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3D2F8106566C; Sun, 23 Sep 2012 08:44:13 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28CCE8FC17; Sun, 23 Sep 2012 08:44:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8N8iDIG056884; Sun, 23 Sep 2012 08:44:13 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8N8iCoW056882; Sun, 23 Sep 2012 08:44:12 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201209230844.q8N8iCoW056882@svn.freebsd.org> From: Kevin Lo Date: Sun, 23 Sep 2012 08:44:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240851 - head/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 08:44:13 -0000 Author: kevlo Date: Sun Sep 23 08:44:12 2012 New Revision: 240851 URL: http://svn.freebsd.org/changeset/base/240851 Log: Remove unused variable ma. Modified: head/sys/dev/mii/smscphy.c Modified: head/sys/dev/mii/smscphy.c ============================================================================== --- head/sys/dev/mii/smscphy.c Sun Sep 23 08:38:06 2012 (r240850) +++ head/sys/dev/mii/smscphy.c Sun Sep 23 08:44:12 2012 (r240851) @@ -97,11 +97,9 @@ static int smscphy_attach(device_t dev) { struct mii_softc *sc; - struct mii_attach_args *ma; const struct mii_phy_funcs *mpf; sc = device_get_softc(dev); - ma = device_get_ivars(dev); mpf = &smscphy_funcs; mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE, mpf, 1); mii_phy_setmedia(sc); From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 08:46:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7BCA106566C; Sun, 23 Sep 2012 08:46:45 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 425468FC15; Sun, 23 Sep 2012 08:46:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8N8kj7K057262; Sun, 23 Sep 2012 08:46:45 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8N8kjg4057260; Sun, 23 Sep 2012 08:46:45 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201209230846.q8N8kjg4057260@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 23 Sep 2012 08:46:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240852 - head/sys/boot/pc98/loader X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 08:46:45 -0000 Author: nyan Date: Sun Sep 23 08:46:44 2012 New Revision: 240852 URL: http://svn.freebsd.org/changeset/base/240852 Log: Cosmetic changes. Modified: head/sys/boot/pc98/loader/main.c Modified: head/sys/boot/pc98/loader/main.c ============================================================================== --- head/sys/boot/pc98/loader/main.c Sun Sep 23 08:44:12 2012 (r240851) +++ head/sys/boot/pc98/loader/main.c Sun Sep 23 08:46:44 2012 (r240852) @@ -207,9 +207,9 @@ main(void) static void extract_currdev(void) { - struct i386_devdesc new_currdev; - int major; - int biosdev = -1; + struct i386_devdesc new_currdev; + int major; + int biosdev = -1; /* Assume we are booting from a BIOS disk by default */ new_currdev.d_dev = &biosdisk; @@ -255,7 +255,7 @@ extract_currdev(void) } } new_currdev.d_type = new_currdev.d_dev->dv_type; - + /* * If we are booting off of a BIOS disk and we didn't succeed in determining * which one we booted off of, just use disk0: as a reasonable default. @@ -266,6 +266,7 @@ extract_currdev(void) "Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev); new_currdev.d_unit = 0; } + env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev), i386_setcurrdev, env_nounset); env_setenv("loaddev", EV_VOLATILE, i386_fmtdev(&new_currdev), env_noset, @@ -307,7 +308,7 @@ command_heap(int argc, char *argv[]) } /* ISA bus access functions for PnP, derived from */ -static int +static int isa_inb(int port) { u_char data; @@ -335,4 +336,3 @@ isa_outb(int port, int value) __asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port)); } } - From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 08:49:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4ECCB106566C; Sun, 23 Sep 2012 08:49:42 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39C808FC16; Sun, 23 Sep 2012 08:49:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8N8ngD0057772; Sun, 23 Sep 2012 08:49:42 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8N8ngnT057770; Sun, 23 Sep 2012 08:49:42 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201209230849.q8N8ngnT057770@svn.freebsd.org> From: Andrew Turner Date: Sun, 23 Sep 2012 08:49:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240853 - head/sys/arm/broadcom/bcm2835 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 08:49:42 -0000 Author: andrew Date: Sun Sep 23 08:49:41 2012 New Revision: 240853 URL: http://svn.freebsd.org/changeset/base/240853 Log: Fix a typo in a Broadcom initarm debug printf Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sun Sep 23 08:46:44 2012 (r240852) +++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sun Sep 23 08:49:41 2012 (r240853) @@ -491,7 +491,7 @@ initarm(struct arm_boot_params *abp) physmem = memsize / PAGE_SIZE; debugf("initarm: console initialized\n"); - debugf(" arg1 mmdp = 0x%08x\n", (uint32_t)kmdp); + debugf(" arg1 kmdp = 0x%08x\n", (uint32_t)kmdp); debugf(" boothowto = 0x%08x\n", boothowto); debugf(" dtbp = 0x%08x\n", (uint32_t)dtbp); print_kernel_section_addr(); From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 08:50:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F8C41065672; Sun, 23 Sep 2012 08:50:55 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B0F88FC19; Sun, 23 Sep 2012 08:50:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8N8otXl057981; Sun, 23 Sep 2012 08:50:55 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8N8otpU057979; Sun, 23 Sep 2012 08:50:55 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201209230850.q8N8otpU057979@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 23 Sep 2012 08:50:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240854 - head/sys/boot/pc98/loader X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 08:50:55 -0000 Author: nyan Date: Sun Sep 23 08:50:54 2012 New Revision: 240854 URL: http://svn.freebsd.org/changeset/base/240854 Log: MFi386: revision 240637 loader/i386: replace ugly inb/outb re-implementations with cpufunc.h Modified: head/sys/boot/pc98/loader/main.c Modified: head/sys/boot/pc98/loader/main.c ============================================================================== --- head/sys/boot/pc98/loader/main.c Sun Sep 23 08:49:41 2012 (r240853) +++ head/sys/boot/pc98/loader/main.c Sun Sep 23 08:50:54 2012 (r240854) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -307,32 +308,17 @@ command_heap(int argc, char *argv[]) return(CMD_OK); } -/* ISA bus access functions for PnP, derived from */ +/* ISA bus access functions for PnP. */ static int isa_inb(int port) { - u_char data; - - if (__builtin_constant_p(port) && - (((port) & 0xffff) < 0x100) && - ((port) < 0x10000)) { - __asm __volatile("inb %1,%0" : "=a" (data) : "id" ((u_short)(port))); - } else { - __asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port)); - } - return(data); + + return (inb(port)); } static void isa_outb(int port, int value) { - u_char al = value; - - if (__builtin_constant_p(port) && - (((port) & 0xffff) < 0x100) && - ((port) < 0x10000)) { - __asm __volatile("outb %0,%1" : : "a" (al), "id" ((u_short)(port))); - } else { - __asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port)); - } + + outb(port, value); } From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 09:13:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 51DD6106564A; Sun, 23 Sep 2012 09:13:58 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 234FD8FC0A; Sun, 23 Sep 2012 09:13:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8N9DvRx061279; Sun, 23 Sep 2012 09:13:57 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8N9DvCA061277; Sun, 23 Sep 2012 09:13:57 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201209230913.q8N9DvCA061277@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 23 Sep 2012 09:13:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240855 - head/sys/pc98/pc98 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 09:13:58 -0000 Author: nyan Date: Sun Sep 23 09:13:57 2012 New Revision: 240855 URL: http://svn.freebsd.org/changeset/base/240855 Log: MFi386: revision 237445 Commit changes missed from r237435. Properly calculate the signal trampoline addresses after the shared page is enabled. Handle FreeBSD ABIs without shared page support too. MFi386: revision 238792 Introduce curpcb magic variable. Modified: head/sys/pc98/pc98/machdep.c Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Sun Sep 23 08:50:54 2012 (r240854) +++ head/sys/pc98/pc98/machdep.c Sun Sep 23 09:13:57 2012 (r240855) @@ -407,7 +407,13 @@ osendsig(sig_t catcher, ksiginfo_t *ksi, } regs->tf_esp = (int)fp; - regs->tf_eip = PS_STRINGS - szosigcode; + if (p->p_sysent->sv_sigcode_base != 0) { + regs->tf_eip = p->p_sysent->sv_sigcode_base + szsigcode - + szosigcode; + } else { + /* a.out sysentvec does not use shared page */ + regs->tf_eip = p->p_sysent->sv_psstrings - szosigcode; + } regs->tf_eflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucodesel; regs->tf_ds = _udatasel; @@ -534,7 +540,8 @@ freebsd4_sendsig(sig_t catcher, ksiginfo } regs->tf_esp = (int)sfp; - regs->tf_eip = PS_STRINGS - szfreebsd4_sigcode; + regs->tf_eip = p->p_sysent->sv_sigcode_base + szsigcode - + szfreebsd4_sigcode; regs->tf_eflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucodesel; regs->tf_ds = _udatasel; @@ -685,7 +692,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, } regs->tf_esp = (int)sfp; - regs->tf_eip = PS_STRINGS - *(p->p_sysent->sv_szsigcode); + regs->tf_eip = p->p_sysent->sv_sigcode_base; regs->tf_eflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucodesel; regs->tf_ds = _udatasel; @@ -1412,7 +1419,7 @@ exec_setregs(struct thread *td, struct i pcb->pcb_dr3 = 0; pcb->pcb_dr6 = 0; pcb->pcb_dr7 = 0; - if (pcb == PCPU_GET(curpcb)) { + if (pcb == curpcb) { /* * Clear the debug registers on the running * CPU, otherwise they will end up affecting From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 09:39:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1F9BC106566B; Sun, 23 Sep 2012 09:39:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AE7C8FC19; Sun, 23 Sep 2012 09:39:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8N9d47q064729; Sun, 23 Sep 2012 09:39:04 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8N9d4WA064727; Sun, 23 Sep 2012 09:39:04 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201209230939.q8N9d4WA064727@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 23 Sep 2012 09:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240856 - head/sys/dev/usb/serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 09:39:05 -0000 Author: hselasky Date: Sun Sep 23 09:39:04 2012 New Revision: 240856 URL: http://svn.freebsd.org/changeset/base/240856 Log: Correct driver name. MFC after: 1 weeks Modified: head/sys/dev/usb/serial/uchcom.c Modified: head/sys/dev/usb/serial/uchcom.c ============================================================================== --- head/sys/dev/usb/serial/uchcom.c Sun Sep 23 09:13:57 2012 (r240855) +++ head/sys/dev/usb/serial/uchcom.c Sun Sep 23 09:39:04 2012 (r240856) @@ -870,7 +870,7 @@ static device_method_t uchcom_methods[] }; static driver_t uchcom_driver = { - .name = "ucom", + .name = "uchcom", .methods = uchcom_methods, .size = sizeof(struct uchcom_softc) }; From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 10:52:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 120B0106564A; Sun, 23 Sep 2012 10:52:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 8071D8FC0C; Sun, 23 Sep 2012 10:52:24 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q8NAqWBm032189; Sun, 23 Sep 2012 13:52:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q8NAqKcB097698; Sun, 23 Sep 2012 13:52:20 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q8NAqK64097697; Sun, 23 Sep 2012 13:52:20 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 23 Sep 2012 13:52:20 +0300 From: Konstantin Belousov To: Kevin Lo Message-ID: <20120923105220.GL37286@deviant.kiev.zoral.com.ua> References: <201209230838.q8N8c6Tu056083@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="l/31HQTn6peyh0iH" Content-Disposition: inline In-Reply-To: <201209230838.q8N8c6Tu056083@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240850 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 10:52:25 -0000 --l/31HQTn6peyh0iH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 23, 2012 at 08:38:06AM +0000, Kevin Lo wrote: > Author: kevlo > Date: Sun Sep 23 08:38:06 2012 > New Revision: 240850 > URL: http://svn.freebsd.org/changeset/base/240850 >=20 > Log: > Avoid NULL dereference >=20 > Modified: > head/lib/libstand/nfs.c >=20 > Modified: head/lib/libstand/nfs.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/lib/libstand/nfs.c Sun Sep 23 07:43:10 2012 (r240849) > +++ head/lib/libstand/nfs.c Sun Sep 23 08:38:06 2012 (r240850) > @@ -1256,8 +1256,10 @@ nfs_open(const char *upath, struct open_ > error =3D 0; > =20 > out: > - free(newfd); > - free(path); > + if (newfd) > + free(newfd); > + if (path) > + free(path); > #else > currfd->iodesc =3D desc; > =20 I do not see how this change is useful. libstand' Free() function handles NULL parameter fine, as well as all other free(3) implementations I am aware of. --l/31HQTn6peyh0iH Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlBe6eQACgkQC3+MBN1Mb4hugQCg52Fn6t82hUyiF2758uxHvo8I ODwAmgIE8px9fFG4S+rlBSl/awVotObJ =eZI4 -----END PGP SIGNATURE----- --l/31HQTn6peyh0iH-- From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 12:19:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 659C0106564A; Sun, 23 Sep 2012 12:19:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FA998FC08; Sun, 23 Sep 2012 12:19:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NCJK5J095996; Sun, 23 Sep 2012 12:19:20 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NCJKHF095993; Sun, 23 Sep 2012 12:19:20 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201209231219.q8NCJKHF095993@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 23 Sep 2012 12:19:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240857 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 12:19:20 -0000 Author: hselasky Date: Sun Sep 23 12:19:19 2012 New Revision: 240857 URL: http://svn.freebsd.org/changeset/base/240857 Log: DWC OTG host mode improvements. Add support for the 3-strikes and you are gone rule. Optimise use of channels so that when a channel is not ready another channel is used. Instead of using the SOF interrupt use the system timer to drive the host statemachine. This might give lower throughput and higher latency, but reduces the CPU usage significantly. The DWC OTG host mode support should not be considered for serious USB host controller applications. Some problems are still seen with LOW speed USB devices. Modified: head/sys/dev/usb/controller/dwc_otg.c head/sys/dev/usb/controller/dwc_otg.h head/sys/dev/usb/controller/dwc_otgreg.h Modified: head/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.c Sun Sep 23 09:39:04 2012 (r240856) +++ head/sys/dev/usb/controller/dwc_otg.c Sun Sep 23 12:19:19 2012 (r240857) @@ -104,7 +104,7 @@ __FBSDID("$FreeBSD$"); #define DWC_OTG_USE_HSIC 0 #ifdef USB_DEBUG -static int dwc_otg_debug = 0; +static int dwc_otg_debug; static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW, 0, "USB DWC OTG"); SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, debug, CTLFLAG_RW, @@ -132,6 +132,7 @@ static void dwc_otg_device_done(struct u static void dwc_otg_do_poll(struct usb_bus *); static void dwc_otg_standard_done(struct usb_xfer *); static void dwc_otg_root_intr(struct dwc_otg_softc *sc); +static void dwc_otg_interrupt_poll(struct dwc_otg_softc *sc); /* * Here is a configuration that the chip supports. @@ -160,23 +161,6 @@ dwc_otg_get_hw_ep_profile(struct usb_dev *ppf = NULL; } -static void -dwc_otg_request_sof(struct dwc_otg_softc *sc) -{ - sc->sc_sof_refs++; - sc->sc_irq_mask |= GINTMSK_SOFMSK; - DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask); -} - -static void -dwc_otg_release_sof(struct dwc_otg_softc *sc) -{ - if (--(sc->sc_sof_refs) == 0) { - sc->sc_irq_mask &= ~GINTMSK_SOFMSK; - DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask); - } -} - static int dwc_otg_init_fifo(struct dwc_otg_softc *sc, uint8_t mode) { @@ -227,12 +211,26 @@ dwc_otg_init_fifo(struct dwc_otg_softc * DWC_OTG_WRITE_4(sc, DOTG_HPTXFSIZ, ((fifo_size / 4) << 16) | (tx_start / 4)); + + for (x = 0; x != sc->sc_host_ch_max; x++) { + /* enable interrupts */ + DWC_OTG_WRITE_4(sc, DOTG_HCINTMSK(x), + HCINT_STALL | HCINT_BBLERR | + HCINT_XACTERR | HCINT_XFERCOMPL | + HCINT_NAK | HCINT_ACK | HCINT_NYET | + HCINT_CHHLTD | HCINT_FRMOVRUN | + HCINT_DATATGLERR); + } + + /* enable host channel interrupts */ + DWC_OTG_WRITE_4(sc, DOTG_HAINTMSK, + (1U << sc->sc_host_ch_max) - 1U); } if (mode == DWC_MODE_DEVICE) { DWC_OTG_WRITE_4(sc, DOTG_GNPTXFSIZ, - (0x10 << 16) | (tx_start / 4)); + (0x10 << 16) | (tx_start / 4)); fifo_size -= 0x40; tx_start += 0x40; @@ -487,11 +485,92 @@ dwc_otg_common_rx_ack(struct dwc_otg_sof sc->sc_last_rx_status = 0; } +static void +dwc_otg_clear_hcint(struct dwc_otg_softc *sc, uint8_t x) +{ + uint32_t hcint; + + hcint = DWC_OTG_READ_4(sc, DOTG_HCINT(x)); + DWC_OTG_WRITE_4(sc, DOTG_HCINT(x), hcint); + + /* clear buffered interrupts */ + sc->sc_chan_state[x].hcint = 0; +} + +static uint8_t +dwc_otg_host_channel_wait(struct dwc_otg_td *td) +{ + struct dwc_otg_softc *sc; + uint8_t x; + + x = td->channel; + + DPRINTF("CH=%d\n", x); + + /* get pointer to softc */ + sc = DWC_OTG_PC2SC(td->pc); + + if (sc->sc_chan_state[x].hcint & HCINT_HALTED_ONLY) { + dwc_otg_clear_hcint(sc, x); + return (1); + } + + if (x == 0) + return (0); /* wait */ + + /* find new disabled channel */ + for (x = 1; x != sc->sc_host_ch_max; x++) { + + uint32_t hcchar; + + if (sc->sc_chan_state[x].allocated) + continue; + + /* check if channel is enabled */ + hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(x)); + if (hcchar & (HCCHAR_CHENA | HCCHAR_CHDIS)) { + DPRINTF("CH=%d is BUSY\n", x); + continue; + } + + sc->sc_chan_state[td->channel].allocated = 0; + sc->sc_chan_state[x].allocated = 1; + + if (sc->sc_chan_state[td->channel].suspended) { + sc->sc_chan_state[td->channel].suspended = 0; + sc->sc_chan_state[x].suspended = 1; + } + + /* clear interrupts */ + dwc_otg_clear_hcint(sc, x); + + DPRINTF("CH=%d HCCHAR=0x%08x(0x%08x) " + "HCSPLT=0x%08x\n", x, td->hcchar, + hcchar, td->hcsplt); + + /* ack any pending messages */ + if (sc->sc_last_rx_status != 0 && + GRXSTSRD_CHNUM_GET(sc->sc_last_rx_status) == td->channel) { + /* get rid of message */ + dwc_otg_common_rx_ack(sc); + } + + /* move active channel */ + sc->sc_active_rx_ep &= ~(1 << td->channel); + sc->sc_active_rx_ep |= (1 << x); + + /* set channel */ + td->channel = x; + + return (1); /* new channel allocated */ + } + return (0); /* wait */ +} + static uint8_t dwc_otg_host_channel_alloc(struct dwc_otg_td *td) { struct dwc_otg_softc *sc; - uint32_t temp; uint8_t x; uint8_t max_channel; @@ -510,47 +589,79 @@ dwc_otg_host_channel_alloc(struct dwc_ot } for (; x != max_channel; x++) { - if (sc->sc_chan_state[x].hcchar == 0) { - /* check if channel is enabled */ - temp = DWC_OTG_READ_4(sc, DOTG_HCCHAR(x)); - if (temp & HCCHAR_CHENA) { - DPRINTF("CH=%d is BUSY\n", x); - continue; - } + uint32_t hcchar; - sc->sc_chan_state[x].hcchar = td->hcchar; - sc->sc_chan_state[x].hcsplt = td->hcsplt; + if (sc->sc_chan_state[x].allocated) + continue; + + /* check if channel is enabled */ + hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(x)); + if (hcchar & (HCCHAR_CHENA | HCCHAR_CHDIS)) { + DPRINTF("CH=%d is BUSY\n", x); + continue; + } - DPRINTF("HCCHAR=0x%08x(0x%08x) HCSPLT=0x%08x\n", - td->hcchar, temp, td->hcsplt); + sc->sc_chan_state[x].allocated = 1; - /* clear leftover interrupts */ - temp = DWC_OTG_READ_4(sc, DOTG_HCINT(x)); - DWC_OTG_WRITE_4(sc, DOTG_HCINT(x), temp); + /* clear interrupts */ + dwc_otg_clear_hcint(sc, x); + + DPRINTF("CH=%d HCCHAR=0x%08x(0x%08x) " + "HCSPLT=0x%08x\n", x, td->hcchar, + hcchar, td->hcsplt); + + /* set active channel */ + sc->sc_active_rx_ep |= (1 << x); - /* clear buffered interrupts */ - sc->sc_chan_state[x].hcint = 0; + /* set channel */ + td->channel = x; - /* clear state */ - sc->sc_chan_state[x].state = 0; + return (0); /* allocated */ + } + return (1); /* busy */ +} + +static void +dwc_otg_host_channel_disable(struct dwc_otg_softc *sc, uint8_t x) +{ + uint32_t hcchar; + hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(x)); + if (hcchar & (HCCHAR_CHENA | HCCHAR_CHDIS)) + DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(x), HCCHAR_CHENA | HCCHAR_CHDIS); +} + +static void +dwc_otg_host_channel_free(struct dwc_otg_td *td) +{ + struct dwc_otg_softc *sc; + uint8_t x; + + if (td->channel >= DWC_OTG_MAX_CHANNELS) + return; /* already freed */ - /* we've requested SOF interrupt */ - sc->sc_chan_state[x].sof_requested = 1; + /* free channel */ + x = td->channel; + td->channel = DWC_OTG_MAX_CHANNELS; - /* set channel */ - td->channel = x; + DPRINTF("CH=%d\n", x); - /* set active EP */ - sc->sc_active_rx_ep |= (1 << x); + /* get pointer to softc */ + sc = DWC_OTG_PC2SC(td->pc); - /* request SOF's */ - dwc_otg_request_sof(sc); + dwc_otg_host_channel_disable(sc, x); - return (0); /* allocated */ - } + sc->sc_chan_state[x].allocated = 0; + sc->sc_chan_state[x].suspended = 0; + + /* ack any pending messages */ + if (sc->sc_last_rx_status != 0 && + GRXSTSRD_CHNUM_GET(sc->sc_last_rx_status) == x) { + dwc_otg_common_rx_ack(sc); } - return (1); /* busy */ + + /* clear active channel */ + sc->sc_active_rx_ep &= ~(1 << x); } static uint8_t @@ -558,7 +669,8 @@ dwc_otg_host_setup_tx(struct dwc_otg_td { struct usb_device_request req __aligned(4); struct dwc_otg_softc *sc; - uint32_t temp; + uint32_t hcint; + uint32_t hcchar; if (dwc_otg_host_channel_alloc(td)) return (1); /* busy */ @@ -566,94 +678,93 @@ dwc_otg_host_setup_tx(struct dwc_otg_td /* get pointer to softc */ sc = DWC_OTG_PC2SC(td->pc); - temp = sc->sc_chan_state[td->channel].hcint; + hcint = sc->sc_chan_state[td->channel].hcint; DPRINTF("CH=%d ST=%d HCINT=0x%08x HCCHAR=0x%08x HCTSIZ=0x%08x\n", - td->channel, sc->sc_chan_state[td->channel].state, temp, + td->channel, td->state, hcint, DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel)), DWC_OTG_READ_4(sc, DOTG_HCTSIZ(td->channel))); - if (temp & HCINT_STALL) { + if (hcint & HCINT_STALL) { + DPRINTF("CH=%d STALL\n", td->channel); td->error_stall = 1; td->error_any = 1; return (0); /* complete */ } - if (temp & (HCINT_BBLERR | HCINT_XACTERR)) { - td->error_any = 1; - return (0); /* complete */ - } - - if (temp & HCINT_NAK) { - if ((sc->sc_sof_val & 1) != (td->sof_val & 1)) - return (1); /* busy */ - td->sof_val += 1; + if (hcint & HCINT_ERRORS) { + DPRINTF("CH=%d ERROR\n", td->channel); + td->errcnt++; + if (td->hcsplt != 0 || td->errcnt >= 3) { + td->error_any = 1; + return (0); /* complete */ + } } /* channel must be disabled before we can complete the transfer */ - if (temp & (HCINT_NAK | HCINT_ACK | HCINT_NYET)) { - uint32_t hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel)); - if (hcchar & HCCHAR_CHENA) { - DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel), - HCCHAR_CHENA | HCCHAR_CHDIS); - } else { - sc->sc_chan_state[td->channel].hcint |= HCINT_CHHLTD; + if (hcint & (HCINT_ERRORS | HCINT_RETRY | + HCINT_ACK | HCINT_NYET)) { + uint32_t hcchar; + + dwc_otg_host_channel_disable(sc, td->channel); + + hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel)); + + if (!(hcchar & HCCHAR_CHENA)) { + hcint |= HCINT_HALTED_ONLY; + sc->sc_chan_state[td->channel].hcint = hcint; } + if (!(hcint & HCINT_ERRORS)) + td->errcnt = 0; } - switch (sc->sc_chan_state[td->channel].state) { + switch (td->state) { case DWC_CHAN_ST_START: - if (sc->sc_chan_state[td->channel].hcsplt != 0) { - sc->sc_chan_state[td->channel].hcsplt &= - ~HCSPLT_COMPSPLT; - sc->sc_chan_state[td->channel].state = - DWC_CHAN_ST_WAIT_S_ANE; - } else { - sc->sc_chan_state[td->channel].state = - DWC_CHAN_ST_WAIT_ANE; - } goto send_pkt; + case DWC_CHAN_ST_WAIT_ANE: - if (!(sc->sc_chan_state[td->channel].hcint & HCINT_CHHLTD)) - break; - if (sc->sc_chan_state[td->channel].hcint & HCINT_NAK) + if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { + if (!dwc_otg_host_channel_wait(td)) + break; + td->did_nak = 1; goto send_pkt; - if (sc->sc_chan_state[td->channel].hcint & - (HCINT_ACK | HCINT_NYET)) { + } + if (hcint & (HCINT_ACK | HCINT_NYET)) { + if (!dwc_otg_host_channel_wait(td)) + break; td->offset += td->tx_bytes; td->remainder -= td->tx_bytes; td->toggle = 1; - sc->sc_chan_state[td->channel].hcint = 0; - sc->sc_chan_state[td->channel].state = 0; return (0); /* complete */ } break; case DWC_CHAN_ST_WAIT_S_ANE: - if (!(sc->sc_chan_state[td->channel].hcint & HCINT_CHHLTD)) - break; - if (sc->sc_chan_state[td->channel].hcint & HCINT_NAK) + if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { + if (!dwc_otg_host_channel_wait(td)) + break; + td->did_nak = 1; goto send_pkt; - if (sc->sc_chan_state[td->channel].hcint & - (HCINT_ACK | HCINT_NYET)) { - sc->sc_chan_state[td->channel].hcsplt |= HCSPLT_COMPSPLT; - sc->sc_chan_state[td->channel].state = - DWC_CHAN_ST_WAIT_C_ANE; + } + if (hcint & (HCINT_ACK | HCINT_NYET)) { + if (!dwc_otg_host_channel_wait(td)) + break; goto send_cpkt; } break; case DWC_CHAN_ST_WAIT_C_ANE: - if (!(sc->sc_chan_state[td->channel].hcint & HCINT_CHHLTD)) - break; - if (sc->sc_chan_state[td->channel].hcint & HCINT_NAK) + if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { + if (!dwc_otg_host_channel_wait(td)) + break; + td->did_nak = 1; goto send_cpkt; - if (sc->sc_chan_state[td->channel].hcint & - (HCINT_ACK | HCINT_NYET)) { + } + if (hcint & (HCINT_ACK | HCINT_NYET)) { + if (!dwc_otg_host_channel_wait(td)) + break; td->offset += td->tx_bytes; td->remainder -= td->tx_bytes; td->toggle = 1; - sc->sc_chan_state[td->channel].hcint = 0; - sc->sc_chan_state[td->channel].state = 0; return (0); /* complete */ } break; @@ -668,6 +779,13 @@ send_pkt: return (0); /* complete */ } + if (td->hcsplt != 0) { + td->hcsplt &= ~HCSPLT_COMPSPLT; + td->state = DWC_CHAN_ST_WAIT_S_ANE; + } else { + td->state = DWC_CHAN_ST_WAIT_ANE; + } + usbd_copy_out(td->pc, 0, &req, sizeof(req)); DWC_OTG_WRITE_4(sc, DOTG_HCTSIZ(td->channel), @@ -675,14 +793,13 @@ send_pkt: (1 << HCTSIZ_PKTCNT_SHIFT) | (HCTSIZ_PID_SETUP << HCTSIZ_PID_SHIFT)); - DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(td->channel), - sc->sc_chan_state[td->channel].hcsplt); + DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(td->channel), td->hcsplt); - temp = sc->sc_chan_state[td->channel].hcchar; - temp &= ~HCCHAR_EPDIR_IN; + hcchar = td->hcchar; + hcchar &= ~HCCHAR_EPDIR_IN; /* must enable channel before writing data to FIFO */ - DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel), temp); + DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel), hcchar); /* transfer data into FIFO */ bus_space_write_region_4(sc->sc_io_tag, sc->sc_io_hdl, @@ -691,26 +808,22 @@ send_pkt: /* store number of bytes transmitted */ td->tx_bytes = sizeof(req); - /* clear interrupts */ - sc->sc_chan_state[td->channel].hcint = 0; - return (1); /* busy */ send_cpkt: + td->hcsplt |= HCSPLT_COMPSPLT; + td->state = DWC_CHAN_ST_WAIT_C_ANE; + DWC_OTG_WRITE_4(sc, DOTG_HCTSIZ(td->channel), (HCTSIZ_PID_SETUP << HCTSIZ_PID_SHIFT)); - DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(td->channel), - sc->sc_chan_state[td->channel].hcsplt); + DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(td->channel), td->hcsplt); - temp = sc->sc_chan_state[td->channel].hcchar; - temp &= ~HCCHAR_EPDIR_IN; + hcchar = td->hcchar; + hcchar &= ~HCCHAR_EPDIR_IN; /* must enable channel before writing data to FIFO */ - DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel), temp); - - /* clear interrupts */ - sc->sc_chan_state[td->channel].hcint = 0; + DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel), hcchar); return (1); /* busy */ } @@ -847,58 +960,110 @@ not_complete: } static uint8_t -dwc_otg_host_data_rx(struct dwc_otg_td *td) +dwc_otg_host_rate_check(struct dwc_otg_td *td, + uint8_t do_inc) { struct dwc_otg_softc *sc; - uint32_t temp; - uint16_t count; uint8_t ep_type; + /* get pointer to softc */ + sc = DWC_OTG_PC2SC(td->pc); + + ep_type = ((td->hcchar & + HCCHAR_EPTYPE_MASK) >> HCCHAR_EPTYPE_SHIFT); + + if (sc->sc_chan_state[td->channel].suspended) + goto busy; + + if (ep_type == UE_ISOCHRONOUS) { + if (td->tmr_val & 1) + td->hcchar |= HCCHAR_ODDFRM; + else + td->hcchar &= ~HCCHAR_ODDFRM; + if (do_inc) + td->tmr_val += td->tmr_res; + } else if (ep_type == UE_INTERRUPT) { + if ((sc->sc_tmr_val & 0xFF) != td->tmr_val) + goto busy; + if (do_inc) + td->tmr_val += td->tmr_res; + } else if (td->did_nak != 0) { + goto busy; + } + + if (ep_type == UE_ISOCHRONOUS) { + td->toggle = 0; + } else if (td->set_toggle) { + td->set_toggle = 0; + td->toggle = 1; + } + return (0); +busy: + return (1); +} + +static uint8_t +dwc_otg_host_data_rx(struct dwc_otg_td *td) +{ + struct dwc_otg_softc *sc; + uint32_t hcint; + uint32_t hcchar; + uint32_t count; + if (dwc_otg_host_channel_alloc(td)) return (1); /* busy */ /* get pointer to softc */ sc = DWC_OTG_PC2SC(td->pc); - ep_type = ((sc->sc_chan_state[td->channel].hcchar & - HCCHAR_EPTYPE_MASK) >> HCCHAR_EPTYPE_SHIFT); - - temp = sc->sc_chan_state[td->channel].hcint; + hcint = sc->sc_chan_state[td->channel].hcint; DPRINTF("CH=%d ST=%d HCINT=0x%08x HCCHAR=0x%08x HCTSIZ=0x%08x\n", - td->channel, sc->sc_chan_state[td->channel].state, temp, + td->channel, td->state, hcint, DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel)), DWC_OTG_READ_4(sc, DOTG_HCTSIZ(td->channel))); - if (temp & HCINT_STALL) { + /* check interrupt bits */ + + if (hcint & HCINT_STALL) { + DPRINTF("CH=%d STALL\n", td->channel); td->error_stall = 1; td->error_any = 1; return (0); /* complete */ } - if (temp & (HCINT_BBLERR | HCINT_XACTERR)) { - td->error_any = 1; - return (0); /* complete */ + if (hcint & HCINT_ERRORS) { + DPRINTF("CH=%d ERROR\n", td->channel); + td->errcnt++; + if (td->hcsplt != 0 || td->errcnt >= 3) { + td->error_any = 1; + return (0); /* complete */ + } } /* channel must be disabled before we can complete the transfer */ - if (temp & (HCINT_NAK | HCINT_ACK | HCINT_NYET)) { - uint32_t hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel)); - if (hcchar & HCCHAR_CHENA) { - DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel), - HCCHAR_CHENA | HCCHAR_CHDIS); - } else { - sc->sc_chan_state[td->channel].hcint |= HCINT_CHHLTD; + if (hcint & (HCINT_ERRORS | HCINT_RETRY | + HCINT_ACK | HCINT_NYET)) { + + dwc_otg_host_channel_disable(sc, td->channel); + + hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel)); + + if (!(hcchar & HCCHAR_CHENA)) { + hcint |= HCINT_HALTED_ONLY; + sc->sc_chan_state[td->channel].hcint = hcint; } + if (!(hcint & HCINT_ERRORS)) + td->errcnt = 0; } /* check endpoint status */ if (sc->sc_last_rx_status == 0) - goto not_complete; + goto check_state; if (GRXSTSRD_CHNUM_GET(sc->sc_last_rx_status) != td->channel) - goto not_complete; + goto check_state; switch (sc->sc_last_rx_status & GRXSTSRD_PKTSTS_MASK) { case GRXSTSRH_IN_DATA: @@ -941,7 +1106,8 @@ dwc_otg_host_data_rx(struct dwc_otg_td * td->remainder -= count; td->offset += count; - sc->sc_chan_state[td->channel].hcint |= HCINT_SOFTWARE_ONLY; + hcint |= HCINT_SOFTWARE_ONLY | HCINT_ACK; + sc->sc_chan_state[td->channel].hcint = hcint; break; default: @@ -951,105 +1117,82 @@ dwc_otg_host_data_rx(struct dwc_otg_td * /* release FIFO */ dwc_otg_common_rx_ack(sc); -not_complete: - if (temp & HCINT_SUSPEND_ONLY) - return (1); /* busy */ - - if (ep_type == UE_ISOCHRONOUS) { - if ((sc->sc_sof_val & 0xFF) != td->sof_val) - return (1); /* busy */ - if (td->sof_val & 1) - sc->sc_chan_state[td->channel].hcchar |= HCCHAR_ODDFRM; - else - sc->sc_chan_state[td->channel].hcchar &= ~HCCHAR_ODDFRM; - td->sof_val += td->sof_res; - } else if (ep_type == UE_INTERRUPT) { - if ((sc->sc_sof_val & 0xFF) != td->sof_val) - return (1); /* busy */ - td->sof_val += td->sof_res; - } else if (temp & HCINT_NAK) { - if ((sc->sc_sof_val & 1) != (td->sof_val & 1)) - return (1); /* busy */ - td->sof_val += 1; - } - - switch (sc->sc_chan_state[td->channel].state) { +check_state: + switch (td->state) { case DWC_CHAN_ST_START: - if (sc->sc_chan_state[td->channel].hcsplt != 0) { - sc->sc_chan_state[td->channel].hcsplt &= - ~HCSPLT_COMPSPLT; - sc->sc_chan_state[td->channel].state = - DWC_CHAN_ST_WAIT_S_ANE; + if (td->hcsplt != 0) goto receive_spkt; - } else { - sc->sc_chan_state[td->channel].state = - DWC_CHAN_ST_WAIT_ANE; + else goto receive_pkt; - } + case DWC_CHAN_ST_WAIT_ANE: - if (!(sc->sc_chan_state[td->channel].hcint & HCINT_CHHLTD)) - break; - if (sc->sc_chan_state[td->channel].hcint & HCINT_NAK) - goto receive_pkt; - if (!(sc->sc_chan_state[td->channel].hcint & - HCINT_SOFTWARE_ONLY)) + if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { + if (!dwc_otg_host_channel_wait(td)) + break; + + if (td->hcsplt != 0) + goto receive_spkt; + else + goto receive_pkt; + } + if (!(hcint & HCINT_SOFTWARE_ONLY)) break; - if (sc->sc_chan_state[td->channel].hcint & - (HCINT_ACK | HCINT_NYET)) { + if (hcint & (HCINT_ACK | HCINT_NYET)) { + if (!dwc_otg_host_channel_wait(td)) + break; + /* check if we are complete */ if ((td->remainder == 0) || (td->got_short != 0)) { - if (td->short_pkt) { - /* we are complete */ - sc->sc_chan_state[ - td->channel].hcint = 0; - sc->sc_chan_state[ - td->channel].state = 0; - return (0); - } + if (td->short_pkt) + return (0); /* complete */ + /* * Else need to receive a zero length * packet. */ } - if (sc->sc_chan_state[td->channel].hcsplt != 0) { - sc->sc_chan_state[td->channel].hcsplt &= - ~HCSPLT_COMPSPLT; - sc->sc_chan_state[td->channel].state = - DWC_CHAN_ST_WAIT_S_ANE; + if (td->hcsplt != 0) goto receive_spkt; - } else { - sc->sc_chan_state[td->channel].state = - DWC_CHAN_ST_WAIT_ANE; + else goto receive_pkt; - } } break; + case DWC_CHAN_ST_WAIT_S_ANE: - if (!(sc->sc_chan_state[td->channel].hcint & HCINT_CHHLTD)) - break; - if (sc->sc_chan_state[td->channel].hcint & HCINT_NAK) + if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { + if (!dwc_otg_host_channel_wait(td)) + break; goto receive_spkt; - if (sc->sc_chan_state[td->channel].hcint & (HCINT_ACK | HCINT_NYET)) { - sc->sc_chan_state[td->channel].hcsplt |= - HCSPLT_COMPSPLT; - sc->sc_chan_state[td->channel].state = - DWC_CHAN_ST_WAIT_ANE; + } + if (hcint & (HCINT_ACK | HCINT_NYET)) { + if (!dwc_otg_host_channel_wait(td)) + break; goto receive_pkt; } break; + + case DWC_CHAN_ST_RX_PKT: + goto receive_pkt; + + case DWC_CHAN_ST_RX_SPKT: + goto receive_spkt; + default: break; } - return (1); /* busy */ + goto busy; receive_pkt: - if (ep_type == UE_ISOCHRONOUS) { - td->toggle = 0; - } else if (td->set_toggle) { - td->set_toggle = 0; - td->toggle = 1; + if (dwc_otg_host_rate_check(td, 1)) { + td->state = DWC_CHAN_ST_RX_PKT; + dwc_otg_host_channel_free(td); + goto busy; } + if (td->hcsplt != 0) + td->hcsplt |= HCSPLT_COMPSPLT; + td->state = DWC_CHAN_ST_WAIT_ANE; + /* receive one packet */ DWC_OTG_WRITE_4(sc, DOTG_HCTSIZ(td->channel), (td->max_packet_size << HCTSIZ_XFERSIZE_SHIFT) | @@ -1057,45 +1200,40 @@ receive_pkt: (td->toggle ? (HCTSIZ_PID_DATA1 << HCTSIZ_PID_SHIFT) : (HCTSIZ_PID_DATA0 << HCTSIZ_PID_SHIFT))); - DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(td->channel), - sc->sc_chan_state[td->channel].hcsplt); + DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(td->channel), td->hcsplt); - temp = sc->sc_chan_state[td->channel].hcchar; - temp |= HCCHAR_EPDIR_IN; + hcchar = td->hcchar; + hcchar |= HCCHAR_EPDIR_IN; /* must enable channel before data can be received */ - DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel), temp); + DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel), hcchar); - /* clear interrupts */ - sc->sc_chan_state[td->channel].hcint = 0; - - return (1); /* busy */ + goto busy; receive_spkt: - if (ep_type == UE_ISOCHRONOUS) { - td->toggle = 0; - } else if (td->set_toggle) { - td->set_toggle = 0; - td->toggle = 1; + if (dwc_otg_host_rate_check(td, 0)) { + td->state = DWC_CHAN_ST_RX_SPKT; + dwc_otg_host_channel_free(td); + goto busy; } + td->hcsplt &= ~HCSPLT_COMPSPLT; + td->state = DWC_CHAN_ST_WAIT_S_ANE; + /* receive one packet */ DWC_OTG_WRITE_4(sc, DOTG_HCTSIZ(td->channel), (td->toggle ? (HCTSIZ_PID_DATA1 << HCTSIZ_PID_SHIFT) : (HCTSIZ_PID_DATA0 << HCTSIZ_PID_SHIFT))); - DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(td->channel), - sc->sc_chan_state[td->channel].hcsplt); + DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(td->channel), td->hcsplt); - temp = sc->sc_chan_state[td->channel].hcchar; - temp |= HCCHAR_EPDIR_IN; + hcchar = td->hcchar; + hcchar |= HCCHAR_EPDIR_IN; /* must enable channel before data can be received */ - DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel), temp); - - /* clear interrupts */ - sc->sc_chan_state[td->channel].hcint = 0; + DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel), hcchar); +busy: return (1); /* busy */ } @@ -1217,7 +1355,8 @@ dwc_otg_host_data_tx(struct dwc_otg_td * { struct dwc_otg_softc *sc; uint32_t count; - uint32_t temp; + uint32_t hcint; + uint32_t hcchar; uint8_t ep_type; if (dwc_otg_host_channel_alloc(td)) @@ -1226,146 +1365,142 @@ dwc_otg_host_data_tx(struct dwc_otg_td * /* get pointer to softc */ sc = DWC_OTG_PC2SC(td->pc); - ep_type = ((sc->sc_chan_state[td->channel].hcchar & + ep_type = ((td->hcchar & HCCHAR_EPTYPE_MASK) >> HCCHAR_EPTYPE_SHIFT); - temp = sc->sc_chan_state[td->channel].hcint; + hcint = sc->sc_chan_state[td->channel].hcint; DPRINTF("CH=%d ST=%d HCINT=0x%08x HCCHAR=0x%08x HCTSIZ=0x%08x\n", - td->channel, sc->sc_chan_state[td->channel].state, temp, + td->channel, td->state, hcint, DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel)), DWC_OTG_READ_4(sc, DOTG_HCTSIZ(td->channel))); - if (temp & HCINT_STALL) { + if (hcint & HCINT_STALL) { + DPRINTF("CH=%d STALL\n", td->channel); td->error_stall = 1; td->error_any = 1; return (0); /* complete */ } - if (temp & (HCINT_BBLERR | HCINT_XACTERR)) { - td->error_any = 1; - return (0); /* complete */ + if (hcint & HCINT_ERRORS) { + DPRINTF("CH=%d ERROR\n", td->channel); + td->errcnt++; + if (td->hcsplt != 0 || td->errcnt >= 3) { + td->error_any = 1; + return (0); /* complete */ + } } /* channel must be disabled before we can complete the transfer */ - if (temp & (HCINT_NAK | HCINT_ACK | HCINT_NYET)) { - uint32_t hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel)); - if (hcchar & HCCHAR_CHENA) { - DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel), - HCCHAR_CHENA | HCCHAR_CHDIS); - } else { - sc->sc_chan_state[td->channel].hcint |= HCINT_CHHLTD; - } - } + if (hcint & (HCINT_ERRORS | HCINT_RETRY | + HCINT_ACK | HCINT_NYET)) { - if (ep_type == UE_ISOCHRONOUS) { - if ((sc->sc_sof_val & 0xFF) != td->sof_val) - return (1); /* busy */ - if (td->sof_val & 1) - sc->sc_chan_state[td->channel].hcchar |= HCCHAR_ODDFRM; - else - sc->sc_chan_state[td->channel].hcchar &= ~HCCHAR_ODDFRM; - td->sof_val += td->sof_res; - } else if (ep_type == UE_INTERRUPT) { - if ((sc->sc_sof_val & 0xFF) != td->sof_val) - return (1); /* busy */ - td->sof_val += td->sof_res; - } else if (temp & HCINT_NAK) { - if ((sc->sc_sof_val & 1) != (td->sof_val & 1)) - return (1); /* busy */ - td->sof_val += 1; + dwc_otg_host_channel_disable(sc, td->channel); + + hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel)); + + if (!(hcchar & HCCHAR_CHENA)) { + hcint |= HCINT_HALTED_ONLY; + sc->sc_chan_state[td->channel].hcint = hcint; + } + if (!(hcint & HCINT_ERRORS)) + td->errcnt = 0; } - switch (sc->sc_chan_state[td->channel].state) { + switch (td->state) { case DWC_CHAN_ST_START: - if (sc->sc_chan_state[td->channel].hcsplt != 0) { - sc->sc_chan_state[td->channel].hcsplt &= ~HCSPLT_COMPSPLT; - sc->sc_chan_state[td->channel].state = - DWC_CHAN_ST_WAIT_S_ANE; - } else { - sc->sc_chan_state[td->channel].state = - DWC_CHAN_ST_WAIT_ANE; - } goto send_pkt; + case DWC_CHAN_ST_WAIT_ANE: - if (!(sc->sc_chan_state[td->channel].hcint & HCINT_CHHLTD)) - break; - if (sc->sc_chan_state[td->channel].hcint & HCINT_NAK) + if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { + if (!dwc_otg_host_channel_wait(td)) + break; + td->did_nak = 1; goto send_pkt; - if (sc->sc_chan_state[td->channel].hcint & - (HCINT_ACK | HCINT_NYET)) { + } + if (hcint & (HCINT_ACK | HCINT_NYET)) { + if (!dwc_otg_host_channel_wait(td)) + break; + td->offset += td->tx_bytes; td->remainder -= td->tx_bytes; td->toggle ^= 1; /* check remainder */ if (td->remainder == 0) { - if (td->short_pkt) { - sc->sc_chan_state[td->channel].hcint = 0; - sc->sc_chan_state[td->channel].state = 0; + if (td->short_pkt) return (0); /* complete */ - } - /* else we need to transmit a short packet */ + /* + * Else we need to transmit a short + * packet: + */ } goto send_pkt; } break; case DWC_CHAN_ST_WAIT_S_ANE: - if (!(sc->sc_chan_state[td->channel].hcint & HCINT_CHHLTD)) - break; - if (sc->sc_chan_state[td->channel].hcint & HCINT_NAK) + if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 14:49:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 615A0106564A; Sun, 23 Sep 2012 14:49:29 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B7A78FC14; Sun, 23 Sep 2012 14:49:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NEnTda020523; Sun, 23 Sep 2012 14:49:29 GMT (envelope-from zeising@svn.freebsd.org) Received: (from zeising@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NEnTeI020521; Sun, 23 Sep 2012 14:49:29 GMT (envelope-from zeising@svn.freebsd.org) Message-Id: <201209231449.q8NEnTeI020521@svn.freebsd.org> From: Niclas Zeising Date: Sun, 23 Sep 2012 14:49:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240858 - stable/9/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 14:49:29 -0000 Author: zeising (doc,ports committer) Date: Sun Sep 23 14:49:28 2012 New Revision: 240858 URL: http://svn.freebsd.org/changeset/base/240858 Log: MFC r240205: Change the link pointing to more information about the Yarrow algorithm, the current link points to a irrelevant catchall site. PR: docs/171411 Submitted by: Mark Martinec (pr), zeising (patch) Approved by: joel (mentor) Modified: stable/9/share/man/man4/random.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/random.4 ============================================================================== --- stable/9/share/man/man4/random.4 Sun Sep 23 12:19:19 2012 (r240857) +++ stable/9/share/man/man4/random.4 Sun Sep 23 14:49:28 2012 (r240858) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 19, 2006 +.Dd September 7, 2012 .Dt RANDOM 4 .Os .Sh NAME @@ -142,7 +142,7 @@ if you wish to use them for entropy harv The other variables are explained in the paper describing the .Em Yarrow algorithm at -.Pa http://www.counterpane.com/yarrow.html . +.Pa http://www.schneier.com/yarrow.html . .Pp These variables are all limited in terms of the values they may contain: From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 14:50:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 571951065680; Sun, 23 Sep 2012 14:50:02 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3DA888FC0C; Sun, 23 Sep 2012 14:50:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NEo2AZ020635; Sun, 23 Sep 2012 14:50:02 GMT (envelope-from zeising@svn.freebsd.org) Received: (from zeising@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NEo26s020633; Sun, 23 Sep 2012 14:50:02 GMT (envelope-from zeising@svn.freebsd.org) Message-Id: <201209231450.q8NEo26s020633@svn.freebsd.org> From: Niclas Zeising Date: Sun, 23 Sep 2012 14:50:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240859 - stable/8/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 14:50:02 -0000 Author: zeising (doc,ports committer) Date: Sun Sep 23 14:50:01 2012 New Revision: 240859 URL: http://svn.freebsd.org/changeset/base/240859 Log: MFC r240205: Change the link pointing to more information about the Yarrow algorithm, the current link points to a irrelevant catchall site. PR: docs/171411 Submitted by: Mark Martinec (pr), zeising (patch) Approved by: joel (mentor) Modified: stable/8/share/man/man4/random.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/random.4 ============================================================================== --- stable/8/share/man/man4/random.4 Sun Sep 23 14:49:28 2012 (r240858) +++ stable/8/share/man/man4/random.4 Sun Sep 23 14:50:01 2012 (r240859) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 19, 2006 +.Dd September 7, 2012 .Dt RANDOM 4 .Os .Sh NAME @@ -143,7 +143,7 @@ if you wish to use them for entropy harv The other variables are explained in the paper describing the .Em Yarrow algorithm at -.Pa http://www.counterpane.com/yarrow.html . +.Pa http://www.schneier.com/yarrow.html . .Pp These variables are all limited in terms of the values they may contain: From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 17:33:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE58F106564A; Sun, 23 Sep 2012 17:33:17 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 998468FC08; Sun, 23 Sep 2012 17:33:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NHXHR1044171; Sun, 23 Sep 2012 17:33:17 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NHXHGa044168; Sun, 23 Sep 2012 17:33:17 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201209231733.q8NHXHGa044168@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 23 Sep 2012 17:33:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240860 - head/sys/powerpc/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 17:33:17 -0000 Author: nwhitehorn Date: Sun Sep 23 17:33:16 2012 New Revision: 240860 URL: http://svn.freebsd.org/changeset/base/240860 Log: Move the prototype for savectx from cpu.h to pcb.h, as it is on other platforms, as well as putting it in an #ifdef KERNEL block. MFC after: 2 weeks Modified: head/sys/powerpc/include/cpu.h head/sys/powerpc/include/pcb.h Modified: head/sys/powerpc/include/cpu.h ============================================================================== --- head/sys/powerpc/include/cpu.h Sun Sep 23 14:50:01 2012 (r240859) +++ head/sys/powerpc/include/cpu.h Sun Sep 23 17:33:16 2012 (r240860) @@ -98,7 +98,4 @@ void cpu_reset(void); void fork_trampoline(void); void swi_vm(void *); -/* XXX the following should not be here. */ -void savectx(struct pcb *) __returns_twice; - #endif /* _MACHINE_CPU_H_ */ Modified: head/sys/powerpc/include/pcb.h ============================================================================== --- head/sys/powerpc/include/pcb.h Sun Sep 23 14:50:01 2012 (r240859) +++ head/sys/powerpc/include/pcb.h Sun Sep 23 17:33:16 2012 (r240860) @@ -89,6 +89,7 @@ extern struct pmap *curpm; extern struct proc *fpuproc; void makectx(struct trapframe *, struct pcb *); +void savectx(struct pcb *) __returns_twice; #endif #endif /* _MACHINE_PCB_H_ */ From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 17:36:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B5FC71065675; Sun, 23 Sep 2012 17:36:01 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 975938FC08; Sun, 23 Sep 2012 17:36:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NHa1UC044619; Sun, 23 Sep 2012 17:36:01 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NHa1lD044617; Sun, 23 Sep 2012 17:36:01 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201209231736.q8NHa1lD044617@svn.freebsd.org> From: Steve Kargl Date: Sun, 23 Sep 2012 17:36:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240861 - head/lib/msun/ld80 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 17:36:01 -0000 Author: kargl Date: Sun Sep 23 17:36:01 2012 New Revision: 240861 URL: http://svn.freebsd.org/changeset/base/240861 Log: * Update the lookup table to use 53-bit high and low values. Also, update the comment to describe the choice of using a high and low decomposition of 2^(i/INTERNVAL) for 0 <= i <= INTERVAL in preparation for an implementation of expm1l. * Move the #define of INTERVAL above the comment, because the comment refers to INTERVAL. Reviewed by: bde Approved by: das (mentor) Modified: head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Sun Sep 23 17:33:16 2012 (r240860) +++ head/lib/msun/ld80/s_expl.c Sun Sep 23 17:36:01 2012 (r240861) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include "math.h" #include "math_private.h" +#define INTERVALS 128 #define BIAS (LDBL_MAX_EXP - 1) static const long double @@ -85,143 +86,145 @@ P6 = 1.3888891738560272e-3; /* 0x16c1 /* * 2^(i/INTERVALS) for i in [0,INTERVALS] is represented by two values where - * the first 47 (?!) bits of the significand is stored in hi and the next 53 - * bits are in lo. + * the first 53 bits of the significand is stored in hi and the next 53 + * bits are in lo. Tang's paper states that the trailing 6 bits of hi should + * be zero for his algorithm in both single and double precision, because + * the table is re-used in the implementation of expm1() where a floating + * point addition involving hi must be exact. The conversion of a 53-bit + * double into a 64-bit long double gives 11 trailing bit, which are zero. */ -#define INTERVALS 128 - static const struct { double hi; double lo; } s[INTERVALS] __aligned(16) = { 0x1p+0, 0x0p+0, - 0x1.0163da9fb330p+0, 0x1.ab6c25335719bp-47, - 0x1.02c9a3e77804p+0, 0x1.07737be56527cp-47, - 0x1.04315e86e7f8p+0, 0x1.2f5ce3e688369p-50, - 0x1.059b0d315854p+0, 0x1.a1d73e2a475b4p-47, - 0x1.0706b29ddf6cp+0, 0x1.dc6dc403a9d88p-48, - 0x1.0874518759bcp+0, 0x1.01186be4bb285p-49, - 0x1.09e3ecac6f38p+0, 0x1.a290f03062c27p-51, - 0x1.0b5586cf9890p+0, 0x1.ec5317256e308p-49, - 0x1.0cc922b7247cp+0, 0x1.ba03db82dc49fp-47, - 0x1.0e3ec32d3d18p+0, 0x1.10103a1727c58p-47, - 0x1.0fb66affed30p+0, 0x1.af232091dd8a1p-48, - 0x1.11301d0125b4p+0, 0x1.0a4ebbf1aed93p-48, - 0x1.12abdc06c31cp+0, 0x1.7f72575a649adp-49, - 0x1.1429aaea92dcp+0, 0x1.fb34101943b26p-48, - 0x1.15a98c8a58e4p+0, 0x1.12480d573dd56p-48, - 0x1.172b83c7d514p+0, 0x1.d6e6fbe462876p-47, - 0x1.18af9388c8dcp+0, 0x1.4dddfb85cd1e1p-47, - 0x1.1a35beb6fcb4p+0, 0x1.a9e5b4c7b4969p-47, - 0x1.1bbe084045ccp+0, 0x1.39ab1e72b4428p-48, - 0x1.1d4873168b98p+0, 0x1.53c02dc0144c8p-47, - 0x1.1ed5022fcd90p+0, 0x1.cb8819ff61122p-48, - 0x1.2063b88628ccp+0, 0x1.63b8eeb029509p-48, - 0x1.21f49917ddc8p+0, 0x1.62552fd29294cp-48, - 0x1.2387a6e75620p+0, 0x1.c3360fd6d8e0bp-47, - 0x1.251ce4fb2a60p+0, 0x1.f9ac155bef4f5p-47, - 0x1.26b4565e27ccp+0, 0x1.d257a673281d4p-48, - 0x1.284dfe1f5638p+0, 0x1.2d9e2b9e07941p-53, - 0x1.29e9df51fdecp+0, 0x1.09612e8afad12p-47, - 0x1.2b87fd0dad98p+0, 0x1.ffbbd48ca71f9p-49, - 0x1.2d285a6e4030p+0, 0x1.680123aa6da0fp-49, - 0x1.2ecafa93e2f4p+0, 0x1.611ca0f45d524p-48, - 0x1.306fe0a31b70p+0, 0x1.52de8d5a46306p-48, - 0x1.32170fc4cd80p+0, 0x1.89a9ce78e1804p-47, - 0x1.33c08b26416cp+0, 0x1.fa64e43086cb3p-47, - 0x1.356c55f929fcp+0, 0x1.864a311a3b1bap-47, - 0x1.371a7373aa9cp+0, 0x1.54e28aa05e8a9p-49, - 0x1.38cae6d05d84p+0, 0x1.2c2d4e586cdf7p-47, - 0x1.3a7db34e59fcp+0, 0x1.b750de494cf05p-47, - 0x1.3c32dc313a8cp+0, 0x1.242000f9145acp-47, - 0x1.3dea64c12340p+0, 0x1.11ada0911f09fp-47, - 0x1.3fa4504ac800p+0, 0x1.ba0bf701aa418p-48, - 0x1.4160a21f72e0p+0, 0x1.4fc2192dc79eep-47, - 0x1.431f5d950a88p+0, 0x1.6dc704439410dp-48, - 0x1.44e086061890p+0, 0x1.68189b7a04ef8p-47, - 0x1.46a41ed1d004p+0, 0x1.772512f45922ap-48, - 0x1.486a2b5c13ccp+0, 0x1.013c1a3b69063p-48, - 0x1.4a32af0d7d3cp+0, 0x1.e672d8bcf46f9p-48, - 0x1.4bfdad5362a0p+0, 0x1.38ea1cbd7f621p-47, - 0x1.4dcb299fddd0p+0, 0x1.ac766dde353c2p-49, - 0x1.4f9b2769d2c8p+0, 0x1.35699ec5b4d50p-47, - 0x1.516daa2cf664p+0, 0x1.c112f52c84d82p-52, - 0x1.5342b569d4f8p+0, 0x1.df0a83c49d86ap-52, - 0x1.551a4ca5d920p+0, 0x1.d8a5d8c40486ap-49, - 0x1.56f4736b527cp+0, 0x1.a66ecb004764fp-48, - 0x1.58d12d497c7cp+0, 0x1.e9295e15b9a1ep-47, - 0x1.5ab07dd48540p+0, 0x1.4ac64980a8c8fp-47, - 0x1.5c9268a59468p+0, 0x1.b80e258dc0b4cp-47, - 0x1.5e76f15ad214p+0, 0x1.0dd37c9840733p-49, - 0x1.605e1b976dc0p+0, 0x1.160edeb25490ep-49, - 0x1.6247eb03a558p+0, 0x1.2c7c3e81bf4b7p-50, - 0x1.6434634ccc30p+0, 0x1.fc76f8714c4eep-48, - 0x1.662388255220p+0, 0x1.24893ecf14dc8p-47, - 0x1.68155d44ca94p+0, 0x1.9840e2b913dd0p-47, - 0x1.6a09e667f3bcp+0, 0x1.921165f626cddp-49, - 0x1.6c012750bda8p+0, 0x1.f76bb54cc007ap-47, - 0x1.6dfb23c651a0p+0, 0x1.779107165f0dep-47, - 0x1.6ff7df951948p+0, 0x1.e7c3f0da79f11p-51, - 0x1.71f75e8ec5f4p+0, 0x1.9ee91b8797785p-47, - 0x1.73f9a48a5814p+0, 0x1.9deae4d273456p-47, - 0x1.75feb564267cp+0, 0x1.17edd35467491p-49, - 0x1.780694fde5d0p+0, 0x1.fb0cd7014042cp-47, - 0x1.7a11473eb018p+0, 0x1.b5f54408fdb37p-50, - 0x1.7c1ed0130c10p+0, 0x1.93e2499a22c9cp-47, - 0x1.7e2f336cf4e4p+0, 0x1.1082e815d0abdp-47, - 0x1.80427543e1a0p+0, 0x1.1b60de67649a3p-48, - 0x1.82589994cce0p+0, 0x1.28acf88afab35p-48, - 0x1.8471a4623c78p+0, 0x1.667297b5cbe32p-47, - 0x1.868d99b4492cp+0, 0x1.640720ec85613p-47, - 0x1.88ac7d98a668p+0, 0x1.966530bcdf2d5p-48, - 0x1.8ace5422aa0cp+0, 0x1.b5ba7c55a192dp-48, - 0x1.8cf3216b5448p+0, 0x1.7de55439a2c39p-49, - 0x1.8f1ae9915770p+0, 0x1.b15cc13a2e397p-47, - 0x1.9145b0b91ffcp+0, 0x1.622986d1a7daep-50, - 0x1.93737b0cdc5cp+0, 0x1.27a280e1f92a0p-47, - 0x1.95a44cbc8520p+0, 0x1.dd36906d2b420p-49, - 0x1.97d829fde4e4p+0, 0x1.f173d241f23d1p-49, - 0x1.9a0f170ca078p+0, 0x1.cdd1884dc6234p-47, - 0x1.9c49182a3f08p+0, 0x1.01c7c46b071f3p-48, - 0x1.9e86319e3230p+0, 0x1.18c12653c7326p-47, - 0x1.a0c667b5de54p+0, 0x1.2594d6d45c656p-47, - 0x1.a309bec4a2d0p+0, 0x1.9ac60b8fbb86dp-47, - 0x1.a5503b23e254p+0, 0x1.c8b424491caf8p-48, - 0x1.a799e1330b34p+0, 0x1.86f2dfb2b158fp-48, - 0x1.a9e6b5579fd8p+0, 0x1.fa1f5921deffap-47, - 0x1.ac36bbfd3f34p+0, 0x1.ce06dcb351893p-47, - 0x1.ae89f995ad38p+0, 0x1.6af439a68bb99p-47, - 0x1.b0e07298db64p+0, 0x1.2c8421566fe38p-47, - 0x1.b33a2b84f15cp+0, 0x1.d7b5fe873decap-47, - 0x1.b59728de5590p+0, 0x1.cc71c40888b24p-47, - 0x1.b7f76f2fb5e4p+0, 0x1.baa9ec206ad4fp-50, - 0x1.ba5b030a1064p+0, 0x1.30819678d5eb7p-49, - 0x1.bcc1e904bc1cp+0, 0x1.2247ba0f45b3dp-48, - 0x1.bf2c25bd71e0p+0, 0x1.10811ae04a31cp-49, - 0x1.c199bdd85528p+0, 0x1.c2220cb12a092p-48, - 0x1.c40ab5fffd04p+0, 0x1.d368a6fc1078cp-47, - 0x1.c67f12e57d14p+0, 0x1.694426ffa41e5p-49, - 0x1.c8f6d9406e78p+0, 0x1.a88d65e24402ep-47, - 0x1.cb720dcef904p+0, 0x1.48a81e5e8f4a5p-47, - 0x1.cdf0b555dc3cp+0, 0x1.ce227c4ac7d63p-47, - 0x1.d072d4a07894p+0, 0x1.dc68791790d0bp-47, - 0x1.d2f87080d89cp+0, 0x1.8c56f091cc4f5p-47, - 0x1.d5818dcfba48p+0, 0x1.c976816bad9b8p-50, - 0x1.d80e316c9838p+0, 0x1.7bb84f9d04880p-48, - 0x1.da9e603db328p+0, 0x1.5c2300696db53p-50, - 0x1.dd321f301b44p+0, 0x1.025b4aef1e032p-47, - 0x1.dfc97337b9b4p+0, 0x1.eb968cac39ed3p-48, - 0x1.e264614f5a10p+0, 0x1.45093b0fd0bd7p-47, - 0x1.e502ee78b3fcp+0, 0x1.b139e8980a9cdp-47, - 0x1.e7a51fbc74c8p+0, 0x1.a5aa4594191bcp-51, - 0x1.ea4afa2a490cp+0, 0x1.9858f73a18f5ep-48, - 0x1.ecf482d8e67cp+0, 0x1.846d81897dca5p-47, - 0x1.efa1bee615a0p+0, 0x1.3bb8fe90d496dp-47, - 0x1.f252b376bba8p+0, 0x1.74e8696fc3639p-48, - 0x1.f50765b6e454p+0, 0x1.9d3e12dd8a18bp-54, - 0x1.f7bfdad9cbe0p+0, 0x1.38913b4bfe72cp-48, - 0x1.fa7c1819e90cp+0, 0x1.82e90a7e74b26p-48, - 0x1.fd3c22b8f71cp+0, 0x1.884badd25995ep-47 + 0x1.0163da9fb3335p+0, 0x1.b61299ab8cdb7p-54, + 0x1.02c9a3e778060p+0, 0x1.dcdef95949ef4p-53, + 0x1.04315e86e7f84p+0, 0x1.7ae71f3441b49p-53, + 0x1.059b0d3158574p+0, 0x1.d73e2a475b465p-55, + 0x1.0706b29ddf6ddp+0, 0x1.8db880753b0f6p-53, + 0x1.0874518759bc8p+0, 0x1.186be4bb284ffp-57, + 0x1.09e3ecac6f383p+0, 0x1.1487818316136p-54, + 0x1.0b5586cf9890fp+0, 0x1.8a62e4adc610bp-54, + 0x1.0cc922b7247f7p+0, 0x1.01edc16e24f71p-54, + 0x1.0e3ec32d3d1a2p+0, 0x1.03a1727c57b53p-59, + 0x1.0fb66affed31ap+0, 0x1.e464123bb1428p-53, + 0x1.11301d0125b50p+0, 0x1.49d77e35db263p-53, + 0x1.12abdc06c31cbp+0, 0x1.f72575a649ad2p-53, + 0x1.1429aaea92ddfp+0, 0x1.66820328764b1p-53, + 0x1.15a98c8a58e51p+0, 0x1.2406ab9eeab0ap-55, + 0x1.172b83c7d517ap+0, 0x1.b9bef918a1d63p-53, + 0x1.18af9388c8de9p+0, 0x1.777ee1734784ap-53, + 0x1.1a35beb6fcb75p+0, 0x1.e5b4c7b4968e4p-55, + 0x1.1bbe084045cd3p+0, 0x1.3563ce56884fcp-53, + 0x1.1d4873168b9aap+0, 0x1.e016e00a2643cp-54, + 0x1.1ed5022fcd91cp+0, 0x1.71033fec2243ap-53, + 0x1.2063b88628cd6p+0, 0x1.dc775814a8495p-55, + 0x1.21f49917ddc96p+0, 0x1.2a97e9494a5eep-55, + 0x1.2387a6e756238p+0, 0x1.9b07eb6c70573p-54, + 0x1.251ce4fb2a63fp+0, 0x1.ac155bef4f4a4p-55, + 0x1.26b4565e27cddp+0, 0x1.2bd339940e9d9p-55, + 0x1.284dfe1f56380p+0, 0x1.2d9e2b9e07941p-53, + 0x1.29e9df51fdee1p+0, 0x1.612e8afad1255p-55, + 0x1.2b87fd0dad98fp+0, 0x1.fbbd48ca71f95p-53, + 0x1.2d285a6e4030bp+0, 0x1.0024754db41d5p-54, + 0x1.2ecafa93e2f56p+0, 0x1.1ca0f45d52383p-56, + 0x1.306fe0a31b715p+0, 0x1.6f46ad23182e4p-55, + 0x1.32170fc4cd831p+0, 0x1.a9ce78e18047cp-55, + 0x1.33c08b26416ffp+0, 0x1.32721843659a6p-54, + 0x1.356c55f929ff0p+0, 0x1.928c468ec6e76p-53, + 0x1.371a7373aa9cap+0, 0x1.4e28aa05e8a8fp-53, + 0x1.38cae6d05d865p+0, 0x1.0b53961b37da2p-53, + 0x1.3a7db34e59ff6p+0, 0x1.d43792533c144p-53, + 0x1.3c32dc313a8e4p+0, 0x1.08003e4516b1ep-53, + 0x1.3dea64c123422p+0, 0x1.ada0911f09ebcp-55, + 0x1.3fa4504ac801bp+0, 0x1.417ee03548306p-53, + 0x1.4160a21f72e29p+0, 0x1.f0864b71e7b6cp-53, + 0x1.431f5d950a896p+0, 0x1.b8e088728219ap-53, + 0x1.44e086061892dp+0, 0x1.89b7a04ef80d0p-59, + 0x1.46a41ed1d0057p+0, 0x1.c944bd1648a76p-54, + 0x1.486a2b5c13cd0p+0, 0x1.3c1a3b69062f0p-56, + 0x1.4a32af0d7d3dep+0, 0x1.9cb62f3d1be56p-54, + 0x1.4bfdad5362a27p+0, 0x1.d4397afec42e2p-56, + 0x1.4dcb299fddd0dp+0, 0x1.8ecdbbc6a7833p-54, + 0x1.4f9b2769d2ca6p+0, 0x1.5a67b16d3540ep-53, + 0x1.516daa2cf6641p+0, 0x1.8225ea5909b04p-53, + 0x1.5342b569d4f81p+0, 0x1.be1507893b0d5p-53, + 0x1.551a4ca5d920ep+0, 0x1.8a5d8c4048699p-53, + 0x1.56f4736b527dap+0, 0x1.9bb2c011d93adp-54, + 0x1.58d12d497c7fdp+0, 0x1.295e15b9a1de8p-55, + 0x1.5ab07dd485429p+0, 0x1.6324c054647adp-54, + 0x1.5c9268a5946b7p+0, 0x1.c4b1b816986a2p-60, + 0x1.5e76f15ad2148p+0, 0x1.ba6f93080e65ep-54, + 0x1.605e1b976dc08p+0, 0x1.60edeb25490dcp-53, + 0x1.6247eb03a5584p+0, 0x1.63e1f40dfa5b5p-53, + 0x1.6434634ccc31fp+0, 0x1.8edf0e2989db3p-53, + 0x1.6623882552224p+0, 0x1.224fb3c5371e6p-53, + 0x1.68155d44ca973p+0, 0x1.038ae44f73e65p-57, + 0x1.6a09e667f3bccp+0, 0x1.21165f626cdd5p-53, + 0x1.6c012750bdabep+0, 0x1.daed533001e9ep-53, + 0x1.6dfb23c651a2ep+0, 0x1.e441c597c3775p-53, + 0x1.6ff7df9519483p+0, 0x1.9f0fc369e7c42p-53, + 0x1.71f75e8ec5f73p+0, 0x1.ba46e1e5de15ap-53, + 0x1.73f9a48a58173p+0, 0x1.7ab9349cd1562p-53, + 0x1.75feb564267c8p+0, 0x1.7edd354674916p-53, + 0x1.780694fde5d3fp+0, 0x1.866b80a02162dp-54, + 0x1.7a11473eb0186p+0, 0x1.afaa2047ed9b4p-53, + 0x1.7c1ed0130c132p+0, 0x1.f124cd1164dd6p-54, + 0x1.7e2f336cf4e62p+0, 0x1.05d02ba15797ep-56, + 0x1.80427543e1a11p+0, 0x1.6c1bccec9346bp-53, + 0x1.82589994cce12p+0, 0x1.159f115f56694p-53, + 0x1.8471a4623c7acp+0, 0x1.9ca5ed72f8c81p-53, + 0x1.868d99b4492ecp+0, 0x1.01c83b21584a3p-53, + 0x1.88ac7d98a6699p+0, 0x1.994c2f37cb53ap-54, + 0x1.8ace5422aa0dbp+0, 0x1.6e9f156864b27p-54, + 0x1.8cf3216b5448bp+0, 0x1.de55439a2c38bp-53, + 0x1.8f1ae99157736p+0, 0x1.5cc13a2e3976cp-55, + 0x1.9145b0b91ffc5p+0, 0x1.114c368d3ed6ep-53, + 0x1.93737b0cdc5e4p+0, 0x1.e8a0387e4a814p-53, + 0x1.95a44cbc8520ep+0, 0x1.d36906d2b41f9p-53, + 0x1.97d829fde4e4fp+0, 0x1.173d241f23d18p-53, + 0x1.9a0f170ca07b9p+0, 0x1.7462137188ce7p-53, + 0x1.9c49182a3f090p+0, 0x1.c7c46b071f2bep-56, + 0x1.9e86319e32323p+0, 0x1.824ca78e64c6ep-56, + 0x1.a0c667b5de564p+0, 0x1.6535b51719567p-53, + 0x1.a309bec4a2d33p+0, 0x1.6305c7ddc36abp-54, + 0x1.a5503b23e255cp+0, 0x1.1684892395f0fp-53, + 0x1.a799e1330b358p+0, 0x1.bcb7ecac563c7p-54, + 0x1.a9e6b5579fdbfp+0, 0x1.0fac90ef7fd31p-54, + 0x1.ac36bbfd3f379p+0, 0x1.81b72cd4624ccp-53, + 0x1.ae89f995ad3adp+0, 0x1.7a1cd345dcc81p-54, + 0x1.b0e07298db665p+0, 0x1.2108559bf8deep-53, + 0x1.b33a2b84f15fap+0, 0x1.ed7fa1cf7b290p-53, + 0x1.b59728de55939p+0, 0x1.1c7102222c90ep-53, + 0x1.b7f76f2fb5e46p+0, 0x1.d54f610356a79p-53, + 0x1.ba5b030a10649p+0, 0x1.0819678d5eb69p-53, + 0x1.bcc1e904bc1d2p+0, 0x1.23dd07a2d9e84p-55, + 0x1.bf2c25bd71e08p+0, 0x1.0811ae04a31c7p-53, + 0x1.c199bdd85529cp+0, 0x1.11065895048ddp-55, + 0x1.c40ab5fffd07ap+0, 0x1.b4537e083c60ap-54, + 0x1.c67f12e57d14bp+0, 0x1.2884dff483cadp-54, + 0x1.c8f6d9406e7b5p+0, 0x1.1acbc48805c44p-56, + 0x1.cb720dcef9069p+0, 0x1.503cbd1e949dbp-56, + 0x1.cdf0b555dc3f9p+0, 0x1.889f12b1f58a3p-53, + 0x1.d072d4a07897bp+0, 0x1.1a1e45e4342b2p-53, + 0x1.d2f87080d89f1p+0, 0x1.15bc247313d44p-53, + 0x1.d5818dcfba487p+0, 0x1.2ed02d75b3707p-55, + 0x1.d80e316c98397p+0, 0x1.7709f3a09100cp-53, + 0x1.da9e603db3285p+0, 0x1.c2300696db532p-54, + 0x1.dd321f301b460p+0, 0x1.2da5778f018c3p-54, + 0x1.dfc97337b9b5ep+0, 0x1.72d195873da52p-53, + 0x1.e264614f5a128p+0, 0x1.424ec3f42f5b5p-53, + 0x1.e502ee78b3ff6p+0, 0x1.39e8980a9cc8fp-55, + 0x1.e7a51fbc74c83p+0, 0x1.2d522ca0c8de2p-54, + 0x1.ea4afa2a490d9p+0, 0x1.0b1ee7431ebb6p-53, + 0x1.ecf482d8e67f0p+0, 0x1.1b60625f7293ap-53, + 0x1.efa1bee615a27p+0, 0x1.dc7f486a4b6b0p-54, + 0x1.f252b376bba97p+0, 0x1.3a1a5bf0d8e43p-54, + 0x1.f50765b6e4540p+0, 0x1.9d3e12dd8a18bp-54, + 0x1.f7bfdad9cbe13p+0, 0x1.1227697fce57bp-53, + 0x1.fa7c1819e90d8p+0, 0x1.74853f3a5931ep-55, + 0x1.fd3c22b8f71f1p+0, 0x1.2eb74966579e7p-57 }; long double From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 17:42:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B9FD61065675; Sun, 23 Sep 2012 17:42:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5D378FC08; Sun, 23 Sep 2012 17:42:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NHgdqO045513; Sun, 23 Sep 2012 17:42:39 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NHgdDl045511; Sun, 23 Sep 2012 17:42:39 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201209231742.q8NHgdDl045511@svn.freebsd.org> From: Alan Cox Date: Sun, 23 Sep 2012 17:42:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240862 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 17:42:39 -0000 Author: alc Date: Sun Sep 23 17:42:39 2012 New Revision: 240862 URL: http://svn.freebsd.org/changeset/base/240862 Log: Address a race condition that was introduced in r238212. Unless the page queues lock is acquired before the page lock is released, there is no guarantee that the page will still be in that same page queue when vm_page_requeue() is called. Reported by: pho In collaboration with: kib MFC after: 3 days Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sun Sep 23 17:36:01 2012 (r240861) +++ head/sys/vm/vm_pageout.c Sun Sep 23 17:42:39 2012 (r240862) @@ -1125,9 +1125,9 @@ vm_pageout_scan(int pass) * Those objects are in a "rundown" state. */ if (!swap_pageouts_ok || (object->flags & OBJ_DEAD)) { + vm_page_lock_queues(); vm_page_unlock(m); VM_OBJECT_UNLOCK(object); - vm_page_lock_queues(); queues_locked = TRUE; vm_page_requeue(m); goto relock_queues; From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 17:47:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF959106566B; Sun, 23 Sep 2012 17:47:01 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA82B8FC14; Sun, 23 Sep 2012 17:47:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NHl14q046122; Sun, 23 Sep 2012 17:47:01 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NHl1cv046120; Sun, 23 Sep 2012 17:47:01 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201209231747.q8NHl1cv046120@svn.freebsd.org> From: Devin Teske Date: Sun, 23 Sep 2012 17:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240863 - head/usr.sbin/bsdconfig/share X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 17:47:01 -0000 Author: dteske Date: Sun Sep 23 17:47:01 2012 New Revision: 240863 URL: http://svn.freebsd.org/changeset/base/240863 Log: Always use RC_CONFS when set, even if NULL. Previously only used if non-NULL. Reviewed by: jilles, adrian (co-mentor) Approved by: adrian (co-mentor) Modified: head/usr.sbin/bsdconfig/share/sysrc.subr Modified: head/usr.sbin/bsdconfig/share/sysrc.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/sysrc.subr Sun Sep 23 17:42:39 2012 (r240862) +++ head/usr.sbin/bsdconfig/share/sysrc.subr Sun Sep 23 17:47:01 2012 (r240863) @@ -256,7 +256,7 @@ f_sysrc_find() # If RC_CONFS is defined, set $rc_conf_files to an explicit # value, modifying the default behavior of source_rc_confs(). # - [ "$RC_CONFS" ] && rc_conf_files="$RC_CONFS" + [ "${RC_CONFS+set}" ] && rc_conf_files="$RC_CONFS" # # Reverse the order of files in rc_conf_files (the boot process sources @@ -435,7 +435,7 @@ f_sysrc_set() # If RC_CONFS is defined, use $RC_CONFS # rather than $rc_conf_files. # - if [ "$RC_CONFS" ]; then + if [ "${RC_CONFS+set}" ]; then file="${RC_CONFS%%[$IFS]*}" else file=$( f_sysrc_get rc_conf_files ) @@ -554,7 +554,7 @@ f_sysrc_delete() # # Operate on each of the specified files # - for file in ${RC_CONFS:-$( f_sysrc_get rc_conf_files )}; do + for file in ${RC_CONFS-$( f_sysrc_get rc_conf_files )}; do [ -e "$file" ] || continue # From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 18:06:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F12431065673; Sun, 23 Sep 2012 18:06:27 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBDF48FC16; Sun, 23 Sep 2012 18:06:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NI6RJq048612; Sun, 23 Sep 2012 18:06:27 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NI6RPA048609; Sun, 23 Sep 2012 18:06:27 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201209231806.q8NI6RPA048609@svn.freebsd.org> From: Steve Kargl Date: Sun, 23 Sep 2012 18:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240864 - in head/lib/msun: ld128 ld80 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 18:06:28 -0000 Author: kargl Date: Sun Sep 23 18:06:27 2012 New Revision: 240864 URL: http://svn.freebsd.org/changeset/base/240864 Log: * ld80/s_expl.c: . Guard a comment from reformatting by indent(1). . Re-order variables in declarations to alphabetical order. . Remove a banal comment. * ld128/s_expl.c: . Add a comment to point to ld80/s_expl.c for implementation details. . Move the #define of INTERVAL to reduce the diff with ld80/s_expl.c. . twom10000 does not need to be volatile, so move its declaration. . Re-order variables in declarations to alphabetical order. . Add a comment that describes the argument reduction. . Remove the same banal comment found in ld80/s_expl.c. Reviewed by: bde Approved by: das (mentor) Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Sun Sep 23 17:47:01 2012 (r240863) +++ head/lib/msun/ld128/s_expl.c Sun Sep 23 18:06:27 2012 (r240864) @@ -27,24 +27,29 @@ #include __FBSDID("$FreeBSD$"); +/* + * ld128 version of s_expl.c. See ../ld80/s_expl.c for most comments. + */ + #include #include "fpmath.h" #include "math.h" #include "math_private.h" +#define INTERVALS 128 #define BIAS (LDBL_MAX_EXP - 1) -/* XXX Prevent gcc from erroneously constant folding this: */ -static volatile const long double twom10000 = 0x1p-10000L, tiny = 0x1p-10000L; +static volatile const long double tiny = 0x1p-10000L; static const long double -huge = 0x1p10000L, -o_threshold = 11356.523406294143949491931077970763428L, -u_threshold = -11433.462743336297878837243843452621503L, +INV_L = 1.84664965233787316142070359168242182e+02L, L1 = 5.41521234812457272982212595914567508e-03L, L2 = -1.02536706388947310094527932552595546e-29L, -INV_L = 1.84664965233787316142070359168242182e+02L; +huge = 0x1p10000L, +o_threshold = 11356.523406294143949491931077970763428L, +twom10000 = 0x1p-10000L, +u_threshold = -11433.462743336297878837243843452621503L; static const long double P2 = 5.00000000000000000000000000000000000e-1L, @@ -58,8 +63,6 @@ P9 = 2.755731922401038678178761995444688 P10 = 2.75573236172670046201884000197885520e-7L, P11 = 2.50517544183909126492878226167697856e-8L; -#define INTERVALS 128 - static const struct { long double hi; long double lo; @@ -225,9 +228,10 @@ expl(long double x) return (1.0L + x); } + /* Reduce x to (k*ln2 + midpoint[n2] + r1 + r2). */ fn = x * INV_L + 0x1.8p112 - 0x1.8p112; n = (int)fn; - n2 = (unsigned)n % INTERVALS; /* Tang's j. */ + n2 = (unsigned)n % INTERVALS; k = (n - n2) / INTERVALS; r1 = x - fn * L1; r2 = -fn * L2; Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Sun Sep 23 17:47:01 2012 (r240863) +++ head/lib/msun/ld80/s_expl.c Sun Sep 23 18:06:27 2012 (r240864) @@ -29,7 +29,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Compute the exponential of x for Intel 80-bit format. This is based on: * * PTP Tang, "Table-driven implementation of the exponential function @@ -70,9 +70,9 @@ static const double __aligned(64) * have at least 22 (= log2(|LDBL_MIN_EXP-extras|) + log2(INTERVALS)) lowest * bits zero so that multiplication of it by n is exact. */ +INV_L = 1.8466496523378731e+2, /* 0x171547652b82fe.0p-45 */ L1 = 5.4152123484527692e-3, /* 0x162e42ff000000.0p-60 */ L2 = -3.2819649005320973e-13, /* -0x1718432a1b0e26.0p-94 */ -INV_L = 1.8466496523378731e+2, /* 0x171547652b82fe.0p-45 */ /* * Domain [-0.002708, 0.002708], range ~[-5.7136e-24, 5.7110e-24]: * |exp(x) - p(x)| < 2**-77.2 @@ -231,7 +231,7 @@ long double expl(long double x) { union IEEEl2bits u, v; - long double fn, r, r1, r2, q, t, t23, t45, twopk, twopkp10000, z; + long double fn, q, r, r1, r2, t, t23, t45, twopk, twopkp10000, z; int k, n, n2; uint16_t hx, ix; @@ -268,7 +268,7 @@ expl(long double x) #else n = (int)fn; #endif - n2 = (unsigned)n % INTERVALS; /* Tang's j. */ + n2 = (unsigned)n % INTERVALS; k = (n - n2) / INTERVALS; r1 = x - fn * L1; r2 = -fn * L2; From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 18:13:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9414E106564A; Sun, 23 Sep 2012 18:13:47 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 612608FC1C; Sun, 23 Sep 2012 18:13:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NIDlp7049663; Sun, 23 Sep 2012 18:13:47 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NIDlIB049661; Sun, 23 Sep 2012 18:13:47 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201209231813.q8NIDlIB049661@svn.freebsd.org> From: Steve Kargl Date: Sun, 23 Sep 2012 18:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240865 - head/lib/msun/ld80 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 18:13:47 -0000 Author: kargl Date: Sun Sep 23 18:13:46 2012 New Revision: 240865 URL: http://svn.freebsd.org/changeset/base/240865 Log: Fix whitespace issue. Approved by: das (mentor, implicit) Modified: head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Sun Sep 23 18:06:27 2012 (r240864) +++ head/lib/msun/ld80/s_expl.c Sun Sep 23 18:13:46 2012 (r240865) @@ -251,7 +251,7 @@ expl(long double x) return (tiny * tiny); } else if (ix <= BIAS - 34) { /* |x| < 0x1p-33 */ /* includes pseudo-denormals */ - if (huge + x > 1.0L) /* trigger inexact iff x != 0 */ + if (huge + x > 1.0L) /* trigger inexact iff x != 0 */ return (1.0L + x); } From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 18:32:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B2F5F106564A; Sun, 23 Sep 2012 18:32:04 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8504D8FC15; Sun, 23 Sep 2012 18:32:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NIW4h9052387; Sun, 23 Sep 2012 18:32:04 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NIW4jD052384; Sun, 23 Sep 2012 18:32:04 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201209231832.q8NIW4jD052384@svn.freebsd.org> From: Steve Kargl Date: Sun, 23 Sep 2012 18:32:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240866 - in head/lib/msun: ld128 ld80 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 18:32:04 -0000 Author: kargl Date: Sun Sep 23 18:32:03 2012 New Revision: 240866 URL: http://svn.freebsd.org/changeset/base/240866 Log: * ld80/s_expl.c: . Fix the threshold for expl(x) where |x| is small. . Also update the previously incorrect comment to match the new threshold. * ld128/s_expl.c: . Re-order logic in exceptional cases to match the logic used in other long double functions. . Fix the threshold for expl(x) where is |x| is small. . Also update the previously incorrect comment to match the new threshold. Submitted by: bde Approved by: das (mentor) Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Sun Sep 23 18:13:46 2012 (r240865) +++ head/lib/msun/ld128/s_expl.c Sun Sep 23 18:32:03 2012 (r240866) @@ -211,19 +211,16 @@ expl(long double x) ix = hx & 0x7fff; if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */ if (ix == BIAS + LDBL_MAX_EXP) { - if (u.xbits.manh != 0 - || u.xbits.manl != 0 - || (hx & 0x8000) == 0) - return (x + x); /* x is NaN or +Inf */ - else - return (0.0); /* x is -Inf */ + if (hx & 0x8000 && u.xbits.manh == 0 && + u.xbits.manl == 0) + return (0.0L); /* x is -Inf */ + return (x + x); /* x is +Inf or NaN */ } if (x > o_threshold) return (huge * huge); if (x < u_threshold) return (tiny * tiny); - } else if (ix <= BIAS - 115) { /* |x| < 0x1p-33 */ - /* includes pseudo-denormals */ + } else if (ix < BIAS - 115) { /* |x| < 0x1p-115 */ if (huge + x > 1.0L) /* trigger inexact iff x != 0 */ return (1.0L + x); } Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Sun Sep 23 18:13:46 2012 (r240865) +++ head/lib/msun/ld80/s_expl.c Sun Sep 23 18:32:03 2012 (r240866) @@ -249,7 +249,7 @@ expl(long double x) return (huge * huge); if (x < u_threshold.e) return (tiny * tiny); - } else if (ix <= BIAS - 34) { /* |x| < 0x1p-33 */ + } else if (ix < BIAS - 66) { /* |x| < 0x1p-66 */ /* includes pseudo-denormals */ if (huge + x > 1.0L) /* trigger inexact iff x != 0 */ return (1.0L + x); From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 19:14:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B18011065673; Sun, 23 Sep 2012 19:14:14 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D60D8FC12; Sun, 23 Sep 2012 19:14:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NJEEiX058668; Sun, 23 Sep 2012 19:14:14 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NJEE2c058666; Sun, 23 Sep 2012 19:14:14 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201209231914.q8NJEE2c058666@svn.freebsd.org> From: Sean Bruno Date: Sun, 23 Sep 2012 19:14:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240867 - stable/9/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 19:14:14 -0000 Author: sbruno Date: Sun Sep 23 19:14:13 2012 New Revision: 240867 URL: http://svn.freebsd.org/changeset/base/240867 Log: MFC r238373 sys/dev/mfivar.h contains references to MFI_DEBUG, but it never gets turned on unless the file also includes opt_mfi.h. Submitted by: Andrew Boyer aboyer@averesystems.com Modified: stable/9/sys/dev/mfi/mfivar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mfi/mfivar.h ============================================================================== --- stable/9/sys/dev/mfi/mfivar.h Sun Sep 23 18:32:03 2012 (r240866) +++ stable/9/sys/dev/mfi/mfivar.h Sun Sep 23 19:14:13 2012 (r240867) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "opt_mfi.h" /* * SCSI structures and definitions are used from here, but no linking From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 19:27:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D97331065672; Sun, 23 Sep 2012 19:27:11 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-oa0-f54.google.com (mail-oa0-f54.google.com [209.85.219.54]) by mx1.freebsd.org (Postfix) with ESMTP id 662458FC08; Sun, 23 Sep 2012 19:27:11 +0000 (UTC) Received: by oagm1 with SMTP id m1so6150618oag.13 for ; Sun, 23 Sep 2012 12:27:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Aw3QYrW2Q8qFKprhoxZHRxRlzLXv1dZWcafzZzp+mBo=; b=mOiGj+MAIluH4Nf2b+dt8S3E4IUwcayZRlrfjaLY4EtqZwGClDMI/OPg/xShJ3BLty 9b7dV5vIKsGdUN5bYlrNrLkGHO29tORSJ170kz2ezOo9K9EWZ755dMNP56MIuxWP9bAw qMPxh72z0boE/6pdF0y9mWJwJMBFGxXUjVNNVAQ/mvM3/ofhbCzz0+afQnGxyDm/WJLb vWAAHt8wOVj+GnIeYurAtsaRYdxmeOidOoYQN2QGCVw91aA5wJB6hYWFkFjb9QDYTQs6 l8NKMY1hsk47LbXCPTkx/tNtA2xv+PUeK6kcAxLlk8m05LE3WcKwDPSRk3n8ev13KS36 gzxQ== MIME-Version: 1.0 Received: by 10.182.174.100 with SMTP id br4mr8156934obc.62.1348428430617; Sun, 23 Sep 2012 12:27:10 -0700 (PDT) Received: by 10.76.142.201 with HTTP; Sun, 23 Sep 2012 12:27:10 -0700 (PDT) In-Reply-To: <20120923105220.GL37286@deviant.kiev.zoral.com.ua> References: <201209230838.q8N8c6Tu056083@svn.freebsd.org> <20120923105220.GL37286@deviant.kiev.zoral.com.ua> Date: Sun, 23 Sep 2012 12:27:10 -0700 Message-ID: From: Garrett Cooper To: Konstantin Belousov Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, Kevin Lo , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240850 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 19:27:12 -0000 On Sun, Sep 23, 2012 at 3:52 AM, Konstantin Belousov wrote: > On Sun, Sep 23, 2012 at 08:38:06AM +0000, Kevin Lo wrote: >> Author: kevlo >> Date: Sun Sep 23 08:38:06 2012 >> New Revision: 240850 >> URL: http://svn.freebsd.org/changeset/base/240850 >> >> Log: >> Avoid NULL dereference >> >> Modified: >> head/lib/libstand/nfs.c ... > I do not see how this change is useful. libstand' Free() function handles > NULL parameter fine, as well as all other free(3) implementations I am > aware of. +1. free(3) should silently ignore NULL parameters passed into it. Thanks, Garrett From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 19:40:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 507DA106568D; Sun, 23 Sep 2012 19:40:59 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 31B478FC1A; Sun, 23 Sep 2012 19:40:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NJexk2062633; Sun, 23 Sep 2012 19:40:59 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NJewF7062617; Sun, 23 Sep 2012 19:40:58 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201209231940.q8NJewF7062617@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Sep 2012 19:40:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240868 - in head: cddl/lib/libzpool sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys sys/modules/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 19:40:59 -0000 Author: pjd Date: Sun Sep 23 19:40:58 2012 New Revision: 240868 URL: http://svn.freebsd.org/changeset/base/240868 Log: Add TRIM support. The code builds a map of regions that were freed. On every write the code consults the map and eventually removes ranges that were freed before, but are now overwritten. Freed blocks are not TRIMed immediately. There is a tunable that defines how many txg we should wait with TRIMming freed blocks (64 by default). There is a low priority thread that TRIMs ranges when the time comes. During TRIM we keep in-flight ranges on a list to detect colliding writes - we have to delay writes that collide with in-flight TRIMs in case something will be reordered and write will reached the disk before the TRIM. We don't have to do the same for in-flight writes, as colliding writes just remove ranges to TRIM. Sponsored by: multiplay.co.uk This work includes some important fixes and some improvements obtained from the zfsonlinux project, including TRIMming entire vdevs on pool create/add/attach and on pool import for spare and cache vdevs. Obtained from: zfsonlinux Submitted by: Etienne Dechamps Added: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c (contents, props changed) Modified: head/cddl/lib/libzpool/Makefile head/sys/cddl/compat/opensolaris/sys/dkio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.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/modules/zfs/Makefile Modified: head/cddl/lib/libzpool/Makefile ============================================================================== --- head/cddl/lib/libzpool/Makefile Sun Sep 23 19:14:13 2012 (r240867) +++ head/cddl/lib/libzpool/Makefile Sun Sep 23 19:40:58 2012 (r240868) @@ -26,7 +26,7 @@ ATOMIC_SRCS= opensolaris_atomic.c LIB= zpool -ZFS_COMMON_SRCS= ${ZFS_COMMON_OBJS:C/.o$/.c/} vdev_file.c +ZFS_COMMON_SRCS= ${ZFS_COMMON_OBJS:C/.o$/.c/} vdev_file.c trim_map.c ZFS_SHARED_SRCS= ${ZFS_SHARED_OBJS:C/.o$/.c/} KERNEL_SRCS= kernel.c taskq.c util.c LIST_SRCS= list.c Modified: head/sys/cddl/compat/opensolaris/sys/dkio.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/dkio.h Sun Sep 23 19:14:13 2012 (r240867) +++ head/sys/cddl/compat/opensolaris/sys/dkio.h Sun Sep 23 19:40:58 2012 (r240868) @@ -75,6 +75,8 @@ extern "C" { */ #define DKIOCFLUSHWRITECACHE (DKIOC|34) /* flush cache to phys medium */ +#define DKIOCTRIM (DKIOC|35) /* TRIM a block */ + struct dk_callback { void (*dkc_callback)(void *dkc_cookie, int error); void *dkc_cookie; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Sun Sep 23 19:14:13 2012 (r240867) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Sun Sep 23 19:40:58 2012 (r240868) @@ -393,7 +393,8 @@ void dsl_free_sync(zio_t *pio, dsl_pool_t *dp, uint64_t txg, const blkptr_t *bpp) { ASSERT(dsl_pool_sync_context(dp)); - zio_nowait(zio_free_sync(pio, dp->dp_spa, txg, bpp, pio->io_flags)); + zio_nowait(zio_free_sync(pio, dp->dp_spa, txg, bpp, BP_GET_PSIZE(bpp), + pio->io_flags)); } int @@ -1387,7 +1388,7 @@ dsl_scan_free_block_cb(void *arg, const } zio_nowait(zio_free_sync(scn->scn_zio_root, scn->scn_dp->dp_spa, - dmu_tx_get_txg(tx), bp, 0)); + dmu_tx_get_txg(tx), bp, BP_GET_PSIZE(bp), 0)); dsl_dir_diduse_space(tx->tx_pool->dp_free_dir, DD_USED_HEAD, -bp_get_dsize_sync(scn->scn_dp->dp_spa, bp), -BP_GET_PSIZE(bp), -BP_GET_UCSIZE(bp), tx); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Sep 23 19:14:13 2012 (r240867) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Sep 23 19:40:58 2012 (r240868) @@ -62,6 +62,7 @@ #include #include #include +#include #ifdef _KERNEL #include @@ -1001,6 +1002,11 @@ spa_activate(spa_t *spa, int mode) spa_create_zio_taskqs(spa); } + /* + * Start TRIM thread. + */ + trim_thread_create(spa); + list_create(&spa->spa_config_dirty_list, sizeof (vdev_t), offsetof(vdev_t, vdev_config_dirty_node)); list_create(&spa->spa_state_dirty_list, sizeof (vdev_t), @@ -1029,6 +1035,12 @@ spa_deactivate(spa_t *spa) ASSERT(spa->spa_async_zio_root == NULL); ASSERT(spa->spa_state != POOL_STATE_UNINITIALIZED); + /* + * Stop TRIM thread in case spa_unload() wasn't called directly + * before spa_deactivate(). + */ + trim_thread_destroy(spa); + txg_list_destroy(&spa->spa_vdev_txg_list); list_destroy(&spa->spa_config_dirty_list); @@ -1145,6 +1157,11 @@ spa_unload(spa_t *spa) ASSERT(MUTEX_HELD(&spa_namespace_lock)); /* + * Stop TRIM thread. + */ + trim_thread_destroy(spa); + + /* * Stop async tasks. */ spa_async_suspend(spa); @@ -5677,7 +5694,7 @@ spa_free_sync_cb(void *arg, const blkptr zio_t *zio = arg; zio_nowait(zio_free_sync(zio, zio->io_spa, dmu_tx_get_txg(tx), bp, - zio->io_flags)); + BP_GET_PSIZE(bp), zio->io_flags)); return (0); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Sun Sep 23 19:14:13 2012 (r240867) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Sun Sep 23 19:40:58 2012 (r240868) @@ -220,6 +220,9 @@ struct spa { spa_proc_state_t spa_proc_state; /* see definition */ struct proc *spa_proc; /* "zpool-poolname" process */ uint64_t spa_did; /* if procp != p0, did of t1 */ + kthread_t *spa_trim_thread; /* thread sending TRIM I/Os */ + kmutex_t spa_trim_lock; /* protects spa_trim_cv */ + kcondvar_t spa_trim_cv; /* used to notify TRIM thread */ boolean_t spa_autoreplace; /* autoreplace set in open */ int spa_vdev_locks; /* locks grabbed */ uint64_t spa_creation_version; /* version at pool creation */ Added: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h Sun Sep 23 19:40:58 2012 (r240868) @@ -0,0 +1,51 @@ +/* + * 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 + */ +/* + * Copyright (c) 2012 Pawel Jakub Dawidek . + * All rights reserved. + */ + +#ifndef _SYS_TRIM_MAP_H +#define _SYS_TRIM_MAP_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +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 boolean_t trim_map_write_start(zio_t *zio); +extern void trim_map_write_done(zio_t *zio); + +extern void trim_thread_create(spa_t *spa); +extern void trim_thread_destroy(spa_t *spa); +extern void trim_thread_wakeup(spa_t *spa); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_TRIM_MAP_H */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Sun Sep 23 19:14:13 2012 (r240867) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Sun Sep 23 19:40:58 2012 (r240868) @@ -46,6 +46,7 @@ typedef enum vdev_dtl_type { } vdev_dtl_type_t; extern boolean_t zfs_nocacheflush; +extern boolean_t zfs_notrim; extern int vdev_open(vdev_t *); extern void vdev_open_children(vdev_t *); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Sun Sep 23 19:14:13 2012 (r240867) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Sun Sep 23 19:40:58 2012 (r240868) @@ -182,6 +182,7 @@ struct vdev { uint64_t vdev_unspare; /* unspare when resilvering done */ hrtime_t vdev_last_try; /* last reopen time */ boolean_t vdev_nowritecache; /* true if flushwritecache failed */ + boolean_t vdev_notrim; /* true if trim failed */ boolean_t vdev_checkremove; /* temporary online test */ boolean_t vdev_forcefault; /* force online fault */ boolean_t vdev_splitting; /* split or repair in progress */ @@ -197,6 +198,7 @@ struct vdev { spa_aux_vdev_t *vdev_aux; /* for l2cache vdevs */ zio_t *vdev_probe_zio; /* root of current probe */ vdev_aux_t vdev_label_aux; /* on-disk aux state */ + struct trim_map *vdev_trimmap; /* * For DTrace to work in userland (libzpool) context, these fields must Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sun Sep 23 19:14:13 2012 (r240867) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sun Sep 23 19:40:58 2012 (r240868) @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -133,7 +134,8 @@ enum zio_compress { #define ZIO_PRIORITY_RESILVER (zio_priority_table[9]) #define ZIO_PRIORITY_SCRUB (zio_priority_table[10]) #define ZIO_PRIORITY_DDT_PREFETCH (zio_priority_table[11]) -#define ZIO_PRIORITY_TABLE_SIZE 12 +#define ZIO_PRIORITY_TRIM (zio_priority_table[12]) +#define ZIO_PRIORITY_TABLE_SIZE 13 #define ZIO_PIPELINE_CONTINUE 0x100 #define ZIO_PIPELINE_STOP 0x101 @@ -360,6 +362,39 @@ typedef struct zio_link { list_node_t zl_child_node; } zio_link_t; +/* + * Used for TRIM kstat. + */ +typedef struct zio_trim_stats { + /* + * Number of bytes successfully TRIMmed. + */ + kstat_named_t zio_trim_bytes; + + /* + * Number of successful TRIM requests. + */ + kstat_named_t zio_trim_success; + + /* + * Number of TRIM requests that failed because TRIM is not + * supported. + */ + kstat_named_t zio_trim_unsupported; + + /* + * Number of TRIM requests that failed for other reasons. + */ + kstat_named_t zio_trim_failed; +} zio_trim_stats_t; + +extern zio_trim_stats_t zio_trim_stats; + +#define ZIO_TRIM_STAT_INCR(stat, val) \ + atomic_add_64(&zio_trim_stats.stat.value.ui64, (val)); +#define ZIO_TRIM_STAT_BUMP(stat) \ + ZIO_TRIM_STAT_INCR(stat, 1); + struct zio { /* Core information about this I/O */ zbookmark_t io_bookmark; @@ -433,6 +468,8 @@ struct zio { /* FreeBSD only. */ struct ostask io_task; #endif + avl_node_t io_trim_node; + list_node_t io_trim_link; }; extern zio_t *zio_null(zio_t *pio, spa_t *spa, vdev_t *vd, @@ -463,8 +500,8 @@ extern zio_t *zio_claim(zio_t *pio, spa_ zio_done_func_t *done, void *priv, enum zio_flag flags); extern zio_t *zio_ioctl(zio_t *pio, spa_t *spa, vdev_t *vd, int cmd, - zio_done_func_t *done, void *priv, int priority, - enum zio_flag flags); + uint64_t offset, uint64_t size, zio_done_func_t *done, void *priv, + int priority, enum zio_flag flags); extern zio_t *zio_read_phys(zio_t *pio, vdev_t *vd, uint64_t offset, uint64_t size, void *data, int checksum, @@ -477,12 +514,14 @@ extern zio_t *zio_write_phys(zio_t *pio, boolean_t labels); extern zio_t *zio_free_sync(zio_t *pio, spa_t *spa, uint64_t txg, - const blkptr_t *bp, enum zio_flag flags); + const blkptr_t *bp, uint64_t size, enum zio_flag flags); extern int zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, blkptr_t *old_bp, uint64_t size, boolean_t use_slog); extern void zio_free_zil(spa_t *spa, uint64_t txg, blkptr_t *bp); extern void zio_flush(zio_t *zio, vdev_t *vd); +extern zio_t *zio_trim(zio_t *zio, spa_t *spa, vdev_t *vd, uint64_t offset, + uint64_t size); extern void zio_shrink(zio_t *zio, uint64_t size); extern int zio_wait(zio_t *zio); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h Sun Sep 23 19:14:13 2012 (r240867) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h Sun Sep 23 19:40:58 2012 (r240868) @@ -60,9 +60,9 @@ enum zio_stage { ZIO_STAGE_READY = 1 << 15, /* RWFCI */ - ZIO_STAGE_VDEV_IO_START = 1 << 16, /* RW--I */ - ZIO_STAGE_VDEV_IO_DONE = 1 << 17, /* RW--- */ - ZIO_STAGE_VDEV_IO_ASSESS = 1 << 18, /* RW--I */ + ZIO_STAGE_VDEV_IO_START = 1 << 16, /* RWF-I */ + ZIO_STAGE_VDEV_IO_DONE = 1 << 17, /* RWF-- */ + ZIO_STAGE_VDEV_IO_ASSESS = 1 << 18, /* RWF-I */ ZIO_STAGE_CHECKSUM_VERIFY = 1 << 19, /* R---- */ @@ -143,7 +143,9 @@ enum zio_stage { #define ZIO_FREE_PIPELINE \ (ZIO_INTERLOCK_STAGES | \ ZIO_STAGE_FREE_BP_INIT | \ - ZIO_STAGE_DVA_FREE) + ZIO_STAGE_DVA_FREE | \ + ZIO_STAGE_VDEV_IO_START | \ + ZIO_STAGE_VDEV_IO_ASSESS) #define ZIO_DDT_FREE_PIPELINE \ (ZIO_INTERLOCK_STAGES | \ Added: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Sun Sep 23 19:40:58 2012 (r240868) @@ -0,0 +1,541 @@ +/* + * 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 + */ +/* + * Copyright (c) 2012 Pawel Jakub Dawidek . + * All rights reserved. + */ + +#include +#include +#include +#include + +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. */ + avl_tree_t tm_inflight_frees; /* AVL tree of in-flight TRIMs. */ + 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; +} trim_map_t; + +typedef struct trim_seg { + avl_node_t ts_node; /* AVL node. */ + list_node_t ts_next; /* List element. */ + uint64_t ts_start; /* Starting offset of this segment. */ + uint64_t ts_end; /* Ending offset (non-inclusive). */ + uint64_t ts_txg; /* Segment creation txg. */ +} trim_seg_t; + +extern boolean_t zfs_notrim; + +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 void trim_map_vdev_commit_done(spa_t *spa, vdev_t *vd); + +static int +trim_map_seg_compare(const void *x1, const void *x2) +{ + const trim_seg_t *s1 = x1; + const trim_seg_t *s2 = x2; + + if (s1->ts_start < s2->ts_start) { + if (s1->ts_end > s2->ts_start) + return (0); + return (-1); + } + if (s1->ts_start > s2->ts_start) { + if (s1->ts_start < s2->ts_end) + return (0); + return (1); + } + return (0); +} + +static int +trim_map_zio_compare(const void *x1, const void *x2) +{ + const zio_t *z1 = x1; + const zio_t *z2 = x2; + + if (z1->io_offset < z2->io_offset) { + if (z1->io_offset + z1->io_size > z2->io_offset) + return (0); + return (-1); + } + if (z1->io_offset > z2->io_offset) { + if (z1->io_offset < z2->io_offset + z2->io_size) + return (0); + return (1); + } + return (0); +} + +void +trim_map_create(vdev_t *vd) +{ + trim_map_t *tm; + + ASSERT(vd->vdev_ops->vdev_op_leaf); + + if (zfs_notrim) + return; + + tm = kmem_zalloc(sizeof (*tm), KM_SLEEP); + mutex_init(&tm->tm_lock, NULL, MUTEX_DEFAULT, NULL); + list_create(&tm->tm_head, sizeof (trim_seg_t), + offsetof(trim_seg_t, ts_next)); + list_create(&tm->tm_pending_writes, sizeof (zio_t), + offsetof(zio_t, io_trim_link)); + avl_create(&tm->tm_queued_frees, trim_map_seg_compare, + sizeof (trim_seg_t), offsetof(trim_seg_t, ts_node)); + avl_create(&tm->tm_inflight_frees, trim_map_seg_compare, + sizeof (trim_seg_t), offsetof(trim_seg_t, ts_node)); + avl_create(&tm->tm_inflight_writes, trim_map_zio_compare, + sizeof (zio_t), offsetof(zio_t, io_trim_node)); + vd->vdev_trimmap = tm; +} + +void +trim_map_destroy(vdev_t *vd) +{ + trim_map_t *tm; + trim_seg_t *ts; + + ASSERT(vd->vdev_ops->vdev_op_leaf); + + if (zfs_notrim) + return; + + tm = vd->vdev_trimmap; + if (tm == NULL) + return; + + /* + * We may have been called before trim_map_vdev_commit_done() + * had a chance to run, so do it now to prune the remaining + * inflight frees. + */ + trim_map_vdev_commit_done(vd->vdev_spa, vd); + + mutex_enter(&tm->tm_lock); + while ((ts = list_head(&tm->tm_head)) != NULL) { + avl_remove(&tm->tm_queued_frees, ts); + list_remove(&tm->tm_head, ts); + kmem_free(ts, sizeof (*ts)); + } + mutex_exit(&tm->tm_lock); + + avl_destroy(&tm->tm_queued_frees); + avl_destroy(&tm->tm_inflight_frees); + avl_destroy(&tm->tm_inflight_writes); + list_destroy(&tm->tm_pending_writes); + list_destroy(&tm->tm_head); + mutex_destroy(&tm->tm_lock); + kmem_free(tm, sizeof (*tm)); + vd->vdev_trimmap = NULL; +} + +static void +trim_map_segment_add(trim_map_t *tm, uint64_t start, uint64_t end, uint64_t txg) +{ + avl_index_t where; + trim_seg_t tsearch, *ts_before, *ts_after, *ts; + boolean_t merge_before, merge_after; + + ASSERT(MUTEX_HELD(&tm->tm_lock)); + VERIFY(start < end); + + tsearch.ts_start = start; + tsearch.ts_end = end; + + ts = avl_find(&tm->tm_queued_frees, &tsearch, &where); + if (ts != NULL) { + if (start < ts->ts_start) + trim_map_segment_add(tm, start, ts->ts_start, txg); + if (end > ts->ts_end) + trim_map_segment_add(tm, ts->ts_end, end, txg); + return; + } + + 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); + + if (merge_before && merge_after) { + avl_remove(&tm->tm_queued_frees, ts_before); + list_remove(&tm->tm_head, ts_before); + ts_after->ts_start = ts_before->ts_start; + kmem_free(ts_before, sizeof (*ts_before)); + } else if (merge_before) { + ts_before->ts_end = end; + } else if (merge_after) { + ts_after->ts_start = start; + } else { + ts = kmem_alloc(sizeof (*ts), KM_SLEEP); + ts->ts_start = start; + ts->ts_end = end; + ts->ts_txg = txg; + avl_insert(&tm->tm_queued_frees, ts, where); + list_insert_tail(&tm->tm_head, ts); + } +} + +static void +trim_map_segment_remove(trim_map_t *tm, trim_seg_t *ts, uint64_t start, + uint64_t end) +{ + trim_seg_t *nts; + boolean_t left_over, right_over; + + ASSERT(MUTEX_HELD(&tm->tm_lock)); + + left_over = (ts->ts_start < start); + right_over = (ts->ts_end > end); + + if (left_over && right_over) { + nts = kmem_alloc(sizeof (*nts), KM_SLEEP); + nts->ts_start = end; + nts->ts_end = ts->ts_end; + nts->ts_txg = ts->ts_txg; + ts->ts_end = start; + avl_insert_here(&tm->tm_queued_frees, nts, ts, AVL_AFTER); + list_insert_after(&tm->tm_head, ts, nts); + } else if (left_over) { + ts->ts_end = start; + } else if (right_over) { + ts->ts_start = end; + } else { + avl_remove(&tm->tm_queued_frees, ts); + list_remove(&tm->tm_head, ts); + kmem_free(ts, sizeof (*ts)); + } +} + +static void +trim_map_free_locked(trim_map_t *tm, uint64_t start, uint64_t end, uint64_t txg) +{ + zio_t zsearch, *zs; + + ASSERT(MUTEX_HELD(&tm->tm_lock)); + + zsearch.io_offset = start; + zsearch.io_size = end - start; + + zs = avl_find(&tm->tm_inflight_writes, &zsearch, NULL); + if (zs == NULL) { + trim_map_segment_add(tm, start, end, txg); + return; + } + if (start < zs->io_offset) + trim_map_free_locked(tm, start, zs->io_offset, txg); + if (zs->io_offset + zs->io_size < end) + trim_map_free_locked(tm, zs->io_offset + zs->io_size, end, txg); +} + +void +trim_map_free(zio_t *zio) +{ + 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, zio->io_offset + zio->io_size, + vd->vdev_spa->spa_syncing_txg); + mutex_exit(&tm->tm_lock); +} + +boolean_t +trim_map_write_start(zio_t *zio) +{ + vdev_t *vd = zio->io_vd; + trim_map_t *tm = vd->vdev_trimmap; + trim_seg_t tsearch, *ts; + boolean_t left_over, right_over; + uint64_t start, end; + + if (zfs_notrim || vd->vdev_notrim || tm == NULL) + return (B_TRUE); + + start = zio->io_offset; + end = start + zio->io_size; + tsearch.ts_start = start; + tsearch.ts_end = end; + + mutex_enter(&tm->tm_lock); + + /* + * Checking for colliding in-flight frees. + */ + ts = avl_find(&tm->tm_inflight_frees, &tsearch, NULL); + if (ts != NULL) { + list_insert_tail(&tm->tm_pending_writes, zio); + mutex_exit(&tm->tm_lock); + return (B_FALSE); + } + + ts = avl_find(&tm->tm_queued_frees, &tsearch, NULL); + if (ts != NULL) { + /* + * Loop until all overlapping segments are removed. + */ + do { + trim_map_segment_remove(tm, ts, start, end); + ts = avl_find(&tm->tm_queued_frees, &tsearch, NULL); + } while (ts != NULL); + } + avl_add(&tm->tm_inflight_writes, zio); + + mutex_exit(&tm->tm_lock); + + return (B_TRUE); +} + +void +trim_map_write_done(zio_t *zio) +{ + vdev_t *vd = zio->io_vd; + trim_map_t *tm = vd->vdev_trimmap; + + /* + * Don't check for vdev_notrim, since the write could have + * started before vdev_notrim was set. + */ + if (zfs_notrim || tm == NULL) + return; + + mutex_enter(&tm->tm_lock); + /* + * Don't fail if the write isn't in the tree, since the write + * could have started after vdev_notrim was set. + */ + if (zio->io_trim_node.avl_child[0] || + zio->io_trim_node.avl_child[1] || + AVL_XPARENT(&zio->io_trim_node) || + tm->tm_inflight_writes.avl_root == &zio->io_trim_node) + avl_remove(&tm->tm_inflight_writes, zio); + mutex_exit(&tm->tm_lock); +} + +/* + * 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. + */ +static trim_seg_t * +trim_map_first(trim_map_t *tm, uint64_t txg) +{ + trim_seg_t *ts; + + ASSERT(MUTEX_HELD(&tm->tm_lock)); + + ts = list_head(&tm->tm_head); + if (ts != NULL && ts->ts_txg <= txg) + return (ts); + return (NULL); +} + +static void +trim_map_vdev_commit(spa_t *spa, zio_t *zio, vdev_t *vd) +{ + trim_map_t *tm = vd->vdev_trimmap; + trim_seg_t *ts; + uint64_t start, size, txglimit; + + ASSERT(vd->vdev_ops->vdev_op_leaf); + + if (tm == NULL) + return; + + txglimit = MIN(spa->spa_syncing_txg, spa_freeze_txg(spa)) - + trim_txg_limit; + + mutex_enter(&tm->tm_lock); + /* + * Loop until we send all frees up to the txglimit. + */ + while ((ts = trim_map_first(tm, txglimit)) != 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)); + } + mutex_exit(&tm->tm_lock); +} + +static void +trim_map_vdev_commit_done(spa_t *spa, vdev_t *vd) +{ + trim_map_t *tm = vd->vdev_trimmap; + trim_seg_t *ts; + list_t pending_writes; + zio_t *zio; + uint64_t start, size; + void *cookie; + + ASSERT(vd->vdev_ops->vdev_op_leaf); + + if (tm == NULL) + return; + + mutex_enter(&tm->tm_lock); + if (!avl_is_empty(&tm->tm_inflight_frees)) { + cookie = NULL; + while ((ts = avl_destroy_nodes(&tm->tm_inflight_frees, + &cookie)) != NULL) { + kmem_free(ts, sizeof (*ts)); + } + } + list_create(&pending_writes, sizeof (zio_t), offsetof(zio_t, + io_trim_link)); + list_move_tail(&pending_writes, &tm->tm_pending_writes); + mutex_exit(&tm->tm_lock); + + while ((zio = list_remove_head(&pending_writes)) != NULL) { + zio_vdev_io_reissue(zio); + zio_execute(zio); + } + list_destroy(&pending_writes); +} + +static void +trim_map_commit(spa_t *spa, zio_t *zio, vdev_t *vd) +{ + int c; + + if (vd == NULL || spa->spa_syncing_txg <= trim_txg_limit) + return; + + if (vd->vdev_ops->vdev_op_leaf) { + trim_map_vdev_commit(spa, zio, vd); + } else { + for (c = 0; c < vd->vdev_children; c++) + trim_map_commit(spa, zio, vd->vdev_child[c]); + } +} + +static void +trim_map_commit_done(spa_t *spa, vdev_t *vd) +{ + int c; + + if (vd == NULL) + return; + + if (vd->vdev_ops->vdev_op_leaf) { + trim_map_vdev_commit_done(spa, vd); + } else { + for (c = 0; c < vd->vdev_children; c++) + trim_map_commit_done(spa, vd->vdev_child[c]); + } +} + +static void +trim_thread(void *arg) +{ + spa_t *spa = arg; + zio_t *zio; + + for (;;) { + mutex_enter(&spa->spa_trim_lock); + if (spa->spa_trim_thread == NULL) { + spa->spa_trim_thread = curthread; + cv_signal(&spa->spa_trim_cv); + mutex_exit(&spa->spa_trim_lock); + thread_exit(); + } + cv_wait(&spa->spa_trim_cv, &spa->spa_trim_lock); + mutex_exit(&spa->spa_trim_lock); + + zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); + + spa_config_enter(spa, SCL_STATE, FTAG, RW_READER); + trim_map_commit(spa, zio, spa->spa_root_vdev); + (void) zio_wait(zio); + trim_map_commit_done(spa, spa->spa_root_vdev); + spa_config_exit(spa, SCL_STATE, FTAG); + } +} + +void +trim_thread_create(spa_t *spa) +{ + + if (zfs_notrim) + return; + + mutex_init(&spa->spa_trim_lock, NULL, MUTEX_DEFAULT, NULL); + cv_init(&spa->spa_trim_cv, NULL, CV_DEFAULT, NULL); + mutex_enter(&spa->spa_trim_lock); + spa->spa_trim_thread = thread_create(NULL, 0, trim_thread, spa, 0, &p0, + TS_RUN, minclsyspri); + mutex_exit(&spa->spa_trim_lock); +} + +void +trim_thread_destroy(spa_t *spa) +{ + + if (zfs_notrim) + return; + if (spa->spa_trim_thread == NULL) + return; + + mutex_enter(&spa->spa_trim_lock); + /* Setting spa_trim_thread to NULL tells the thread to stop. */ + spa->spa_trim_thread = NULL; + cv_signal(&spa->spa_trim_cv); + /* The thread will set it back to != NULL on exit. */ + while (spa->spa_trim_thread == NULL) + cv_wait(&spa->spa_trim_cv, &spa->spa_trim_lock); + spa->spa_trim_thread = NULL; + mutex_exit(&spa->spa_trim_lock); + + cv_destroy(&spa->spa_trim_cv); + mutex_destroy(&spa->spa_trim_lock); +} + +void +trim_thread_wakeup(spa_t *spa) +{ + + if (zfs_notrim) + return; + if (spa->spa_trim_thread == NULL) + return; + + mutex_enter(&spa->spa_trim_lock); + cv_signal(&spa->spa_trim_cv); + mutex_exit(&spa->spa_trim_lock); +} Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Sun Sep 23 19:14:13 2012 (r240867) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Sun Sep 23 19:40:58 2012 (r240868) @@ -42,6 +42,7 @@ #include #include #include +#include SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, vdev, CTLFLAG_RW, 0, "ZFS VDEV"); @@ -1195,6 +1196,11 @@ vdev_open(vdev_t *vd) if (vd->vdev_ishole || vd->vdev_ops == &vdev_missing_ops) return (0); + if (vd->vdev_ops->vdev_op_leaf) { + vd->vdev_notrim = B_FALSE; + trim_map_create(vd); + } + for (int c = 0; c < vd->vdev_children; c++) { if (vd->vdev_child[c]->vdev_state != VDEV_STATE_HEALTHY) { vdev_set_state(vd, B_TRUE, VDEV_STATE_DEGRADED, @@ -1439,6 +1445,9 @@ vdev_close(vdev_t *vd) vdev_cache_purge(vd); + if (vd->vdev_ops->vdev_op_leaf) + trim_map_destroy(vd); + /* * We record the previous state before we close it, so that if we are * doing a reopen(), we don't generate FMA ereports if we notice that Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Sep 23 19:14:13 2012 (r240867) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Sep 23 19:40:58 2012 (r240868) @@ -49,14 +49,17 @@ struct g_class zfs_vdev_class = { DECLARE_GEOM_CLASS(zfs_vdev_class, zfs_vdev); -/* - * Don't send BIO_FLUSH. - */ +SYSCTL_DECL(_vfs_zfs_vdev); +/* Don't send BIO_FLUSH. */ static int vdev_geom_bio_flush_disable = 0; TUNABLE_INT("vfs.zfs.vdev.bio_flush_disable", &vdev_geom_bio_flush_disable); -SYSCTL_DECL(_vfs_zfs_vdev); SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_flush_disable, CTLFLAG_RW, &vdev_geom_bio_flush_disable, 0, "Disable BIO_FLUSH"); +/* Don't send BIO_DELETE. */ +static int vdev_geom_bio_delete_disable = 0; +TUNABLE_INT("vfs.zfs.vdev.bio_delete_disable", &vdev_geom_bio_delete_disable); +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_delete_disable, CTLFLAG_RW, + &vdev_geom_bio_delete_disable, 0, "Disable BIO_DELETE"); static void vdev_geom_orphan(struct g_consumer *cp) @@ -499,8 +502,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi *ashift = highbit(MAX(pp->sectorsize, SPA_MINBLOCKSIZE)) - 1; /* - * Clear the nowritecache bit, so that on a vdev_reopen() we will - * try again. + * Clear the nowritecache settings, so that on a vdev_reopen() + * we will try again. */ vd->vdev_nowritecache = B_FALSE; @@ -546,6 +549,15 @@ vdev_geom_io_intr(struct bio *bp) */ vd->vdev_nowritecache = B_TRUE; } + if (bp->bio_cmd == BIO_DELETE && bp->bio_error == ENOTSUP) { + /* + * If we get ENOTSUP, we know that no future + * attempts will ever succeed. In this case we + * set a persistent bit so that we don't bother + * with the ioctl in the future. + */ + vd->vdev_notrim = B_TRUE; + } if (zio->io_error == EIO && !vd->vdev_remove_wanted) { /* * If provider's error is set we assume it is being @@ -588,17 +600,21 @@ vdev_geom_io_start(zio_t *zio) } switch (zio->io_cmd) { - case DKIOCFLUSHWRITECACHE: - if (zfs_nocacheflush || vdev_geom_bio_flush_disable) break; - if (vd->vdev_nowritecache) { zio->io_error = ENOTSUP; break; } - + goto sendreq; + case DKIOCTRIM: + if (vdev_geom_bio_delete_disable) + break; + if (vd->vdev_notrim) { + zio->io_error = ENOTSUP; + break; + } goto sendreq; default: zio->io_error = ENOTSUP; @@ -623,11 +639,21 @@ sendreq: bp->bio_length = zio->io_size; break; case ZIO_TYPE_IOCTL: - bp->bio_cmd = BIO_FLUSH; - bp->bio_flags |= BIO_ORDERED; - bp->bio_data = NULL; - bp->bio_offset = cp->provider->mediasize; - bp->bio_length = 0; + switch (zio->io_cmd) { + case DKIOCFLUSHWRITECACHE: + bp->bio_cmd = BIO_FLUSH; + bp->bio_flags |= BIO_ORDERED; + bp->bio_data = NULL; + bp->bio_offset = cp->provider->mediasize; + bp->bio_length = 0; + break; + case DKIOCTRIM: + bp->bio_cmd = BIO_DELETE; + bp->bio_data = NULL; + bp->bio_offset = zio->io_offset; + bp->bio_length = zio->io_size; + break; + } break; } bp->bio_done = vdev_geom_io_intr; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Sun Sep 23 19:14:13 2012 (r240867) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Sun Sep 23 19:40:58 2012 (r240868) @@ -145,6 +145,7 @@ #include #include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 19:48:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C612106566B; Sun, 23 Sep 2012 19:48:30 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D215F8FC16; Sun, 23 Sep 2012 19:48:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NJmTWA063897; Sun, 23 Sep 2012 19:48:29 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NJmTlN063895; Sun, 23 Sep 2012 19:48:29 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201209231948.q8NJmTlN063895@svn.freebsd.org> From: Andrew Turner Date: Sun, 23 Sep 2012 19:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240869 - head/sys/arm/broadcom/bcm2835 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 19:48:30 -0000 Author: andrew Date: Sun Sep 23 19:48:29 2012 New Revision: 240869 URL: http://svn.freebsd.org/changeset/base/240869 Log: Clean up the bcm2835 initarm. It is now identical to the other ARMv6 copies Tested by: Alexander Yerenkow Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sun Sep 23 19:40:58 2012 (r240868) +++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sun Sep 23 19:48:29 2012 (r240869) @@ -308,9 +308,9 @@ initarm(struct arm_boot_params *abp) uint32_t memsize, l2size; void *kmdp; u_int l1pagetable; - int i = 0, j = 0; + int i = 0, j = 0, err_devmap = 0; - lastaddr = fake_preload_metadata(abp); + lastaddr = parse_boot_param(abp); memsize = 0; set_cpufuncs(); @@ -440,6 +440,7 @@ initarm(struct arm_boot_params *abp) (((uint32_t)(lastaddr) - KERNVIRTADDR) + PAGE_MASK) & ~PAGE_MASK, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); + /* Map L1 directory and allocated L2 page tables */ pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa, L1_TABLE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); @@ -454,12 +455,6 @@ initarm(struct arm_boot_params *abp) freemempos - dpcpu.pv_va, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - - /* Map allocated DPCPU, stacks and msgbuf */ - pmap_map_chunk(l1pagetable, 0xf2200000, 0x20200000, - 0x00100000, - VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - /* Link and map the vector page */ pmap_link_l2pt(l1pagetable, ARM_VECTORS_HIGH, &kernel_pt_table[l2size - 1]); @@ -467,8 +462,7 @@ initarm(struct arm_boot_params *abp) VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE, PTE_CACHE); /* Map pmap_devmap[] entries */ - if (platform_devmap_init() != 0) - while (1); + err_devmap = platform_devmap_init(); pmap_devmap_bootstrap(l1pagetable, pmap_devmap_bootstrap_table); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) | @@ -497,6 +491,10 @@ initarm(struct arm_boot_params *abp) print_kernel_section_addr(); print_kenv(); + if (err_devmap != 0) + printf("WARNING: could not fully configure devmap, error=%d\n", + err_devmap); + initarm_late_init(); /* From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 20:12:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 474A2106566C; Sun, 23 Sep 2012 20:12:11 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 300B98FC0C; Sun, 23 Sep 2012 20:12:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NKCBAe067588; Sun, 23 Sep 2012 20:12:11 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NKCAj4067582; Sun, 23 Sep 2012 20:12:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201209232012.q8NKCAj4067582@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Sep 2012 20:12:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240870 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 20:12:11 -0000 Author: pjd Date: Sun Sep 23 20:12:10 2012 New Revision: 240870 URL: http://svn.freebsd.org/changeset/base/240870 Log: It is possible to recursively destroy snapshots even if the snapshot doesn't exist on a dataset we are starting from. For example if we have the following configuration: tank tank/foo tank/foo@snap tank/bar tank/bar@snap We can execute: # zfs destroy -t tank@snap eventhough tank@snap doesn't exit. Unfortunately it is not possible to do the same with recursive rename: # zfs rename -r tank@snap tank@pans cannot open 'tank@snap': dataset does not exist ...until now. This change allows to recursively rename snapshots even if snapshot doesn't exist on the starting dataset. Sponsored by: rsync.net MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Sep 23 19:48:29 2012 (r240869) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Sep 23 20:12:10 2012 (r240870) @@ -3081,6 +3081,7 @@ zfs_do_rename(int argc, char **argv) int ret = 0; int types; boolean_t parents = B_FALSE; + char *snapshot = NULL; /* check options */ while ((c = getopt(argc, argv, "fpru")) != -1) { @@ -3149,6 +3150,19 @@ zfs_do_rename(int argc, char **argv) else types = ZFS_TYPE_DATASET; + if (flags.recurse) { + /* + * When we do recursive rename we are fine when the given + * snapshot for the given dataset doesn't exist - it can + * still exists below. + */ + + snapshot = strchr(argv[0], '@'); + assert(snapshot != NULL); + *snapshot = '\0'; + snapshot++; + } + if ((zhp = zfs_open(g_zfs, argv[0], types)) == NULL) return (1); @@ -3159,7 +3173,7 @@ zfs_do_rename(int argc, char **argv) return (1); } - ret = (zfs_rename(zhp, argv[1], flags) != 0); + ret = (zfs_rename(zhp, snapshot, argv[1], flags) != 0); zfs_close(zhp); return (ret); Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sun Sep 23 19:48:29 2012 (r240869) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sun Sep 23 20:12:10 2012 (r240870) @@ -571,7 +571,8 @@ typedef struct renameflags { int forceunmount : 1; } renameflags_t; -extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t flags); +extern int zfs_rename(zfs_handle_t *, const char *, const char *, + renameflags_t flags); typedef struct sendflags { /* print informational messages (ie, -v was specified) */ Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Sep 23 19:48:29 2012 (r240869) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sun Sep 23 20:12:10 2012 (r240870) @@ -611,6 +611,22 @@ zfs_open(libzfs_handle_t *hdl, const cha return (NULL); } + if (zhp == NULL) { + char *at = strchr(path, '@'); + + if (at != NULL) + *at = '\0'; + errno = 0; + if ((zhp = make_dataset_handle(hdl, path)) == NULL) { + (void) zfs_standard_error(hdl, errno, errbuf); + return (NULL); + } + if (at != NULL) + *at = '@'; + (void) strlcpy(zhp->zfs_name, path, sizeof (zhp->zfs_name)); + zhp->zfs_type = ZFS_TYPE_SNAPSHOT; + } + if (!(types & zhp->zfs_type)) { (void) zfs_error(hdl, EZFS_BADTYPE, errbuf); zfs_close(zhp); @@ -3614,7 +3630,8 @@ zfs_rollback(zfs_handle_t *zhp, zfs_hand * Renames the given dataset. */ int -zfs_rename(zfs_handle_t *zhp, const char *target, renameflags_t flags) +zfs_rename(zfs_handle_t *zhp, const char *source, const char *target, + renameflags_t flags) { int ret; zfs_cmd_t zc = { 0 }; @@ -3634,6 +3651,18 @@ zfs_rename(zfs_handle_t *zhp, const char (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot rename to '%s'"), target); + if (source != NULL) { + /* + * This is recursive snapshots rename, put snapshot name + * (that might not exist) into zfs_name. + */ + assert(flags.recurse); + + (void) strlcat(zhp->zfs_name, "@", sizeof(zhp->zfs_name)); + (void) strlcat(zhp->zfs_name, source, sizeof(zhp->zfs_name)); + zhp->zfs_type = ZFS_TYPE_SNAPSHOT; + } + /* * Make sure the target name is valid */ 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 Sun Sep 23 19:48:29 2012 (r240869) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sun Sep 23 20:12:10 2012 (r240870) @@ -2520,6 +2520,7 @@ struct renamesnaparg { char failed[MAXPATHLEN]; char *oldsnap; char *newsnap; + int error; }; static int @@ -2557,6 +2558,9 @@ dsl_snapshot_rename_one(const char *name dsl_sync_task_create(ra->dstg, dsl_dataset_snapshot_rename_check, dsl_dataset_snapshot_rename_sync, ds, ra->newsnap, 0); + /* First successful rename clears the error. */ + ra->error = 0; + return (0); } @@ -2585,14 +2589,16 @@ dsl_recursive_rename(char *oldname, cons ra->oldsnap = strchr(oldname, '@') + 1; ra->newsnap = strchr(newname, '@') + 1; *ra->failed = '\0'; + ra->error = ENOENT; err = dmu_objset_find(fsname, dsl_snapshot_rename_one, ra, DS_FIND_CHILDREN); kmem_free(fsname, len); + if (err == 0) + err = ra->error; - if (err == 0) { + if (err == 0) err = dsl_sync_task_group_wait(ra->dstg); - } for (dst = list_head(&ra->dstg->dstg_tasks); dst; dst = list_next(&ra->dstg->dstg_tasks, dst)) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Sep 23 19:48:29 2012 (r240869) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Sep 23 20:12:10 2012 (r240870) @@ -766,7 +766,26 @@ zfs_secpolicy_rename_perms(const char *f static int zfs_secpolicy_rename(zfs_cmd_t *zc, cred_t *cr) { - return (zfs_secpolicy_rename_perms(zc->zc_name, zc->zc_value, cr)); + char *at = NULL; + int error; + + if ((zc->zc_cookie & 1) != 0) { + /* + * This is recursive rename, so the starting snapshot might + * not exist. Check file system or volume permission instead. + */ + at = strchr(zc->zc_name, '@'); + if (at == NULL) + return (EINVAL); + *at = '\0'; + } + + error = zfs_secpolicy_rename_perms(zc->zc_name, zc->zc_value, cr); + + if (at != NULL) + *at = '@'; + + return (error); } static int From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 20:16:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6F391065670; Sun, 23 Sep 2012 20:16:17 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91E118FC12; Sun, 23 Sep 2012 20:16:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NKGHTL068190; Sun, 23 Sep 2012 20:16:17 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NKGHde068187; Sun, 23 Sep 2012 20:16:17 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201209232016.q8NKGHde068187@svn.freebsd.org> From: Sean Bruno Date: Sun, 23 Sep 2012 20:16:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240871 - stable/8/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 20:16:17 -0000 Author: sbruno Date: Sun Sep 23 20:16:17 2012 New Revision: 240871 URL: http://svn.freebsd.org/changeset/base/240871 Log: MFC r238373 sys/dev/mfivar.h contains references to MFI_DEBUG, but it never gets turned on unless the file also includes opt_mfi.h. Submitted by: Andrew Boyer aboyer@averesystems.com Modified: stable/8/sys/dev/mfi/mfivar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/mfi/ (props changed) Modified: stable/8/sys/dev/mfi/mfivar.h ============================================================================== --- stable/8/sys/dev/mfi/mfivar.h Sun Sep 23 20:12:10 2012 (r240870) +++ stable/8/sys/dev/mfi/mfivar.h Sun Sep 23 20:16:17 2012 (r240871) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "opt_mfi.h" /* * SCSI structures and definitions are used from here, but no linking From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 20:16:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2F897106564A; Sun, 23 Sep 2012 20:16:46 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AEA88FC14; Sun, 23 Sep 2012 20:16:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NKGjrX068305; Sun, 23 Sep 2012 20:16:45 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NKGjnj068303; Sun, 23 Sep 2012 20:16:45 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201209232016.q8NKGjnj068303@svn.freebsd.org> From: Sean Bruno Date: Sun, 23 Sep 2012 20:16:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240872 - stable/7/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 20:16:46 -0000 Author: sbruno Date: Sun Sep 23 20:16:45 2012 New Revision: 240872 URL: http://svn.freebsd.org/changeset/base/240872 Log: MFC r238373 sys/dev/mfivar.h contains references to MFI_DEBUG, but it never gets turned on unless the file also includes opt_mfi.h. Submitted by: Andrew Boyer aboyer@averesystems.com Modified: stable/7/sys/dev/mfi/mfivar.h Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/mfi/mfivar.h ============================================================================== --- stable/7/sys/dev/mfi/mfivar.h Sun Sep 23 20:16:17 2012 (r240871) +++ stable/7/sys/dev/mfi/mfivar.h Sun Sep 23 20:16:45 2012 (r240872) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "opt_mfi.h" /* * SCSI structures and definitions are used from here, but no linking From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 20:17:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 702431065673; Sun, 23 Sep 2012 20:17:29 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B6D28FC1C; Sun, 23 Sep 2012 20:17:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NKHTn9068454; Sun, 23 Sep 2012 20:17:29 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NKHTZa068452; Sun, 23 Sep 2012 20:17:29 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201209232017.q8NKHTZa068452@svn.freebsd.org> From: Sean Bruno Date: Sun, 23 Sep 2012 20:17:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240873 - stable/9/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 20:17:29 -0000 Author: sbruno Date: Sun Sep 23 20:17:28 2012 New Revision: 240873 URL: http://svn.freebsd.org/changeset/base/240873 Log: MFC r238371 When an MFI command fails, the driver needs to set bio->bio_resid so that the upper levels notice. Otherwise we see commands silently failing leading to data corruption. This mirrors dadone() Submitted by: Andrew Boyer aboyer@averesystems.com Modified: stable/9/sys/dev/mfi/mfi_disk.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mfi/mfi_disk.c ============================================================================== --- stable/9/sys/dev/mfi/mfi_disk.c Sun Sep 23 20:16:45 2012 (r240872) +++ stable/9/sys/dev/mfi/mfi_disk.c Sun Sep 23 20:17:28 2012 (r240873) @@ -298,6 +298,7 @@ mfi_disk_complete(struct bio *bio) hdr = bio->bio_driver1; if (bio->bio_flags & BIO_ERROR) { + bio->bio_resid = bio->bio_bcount; if (bio->bio_error == 0) bio->bio_error = EIO; disk_err(bio, "hard error", -1, 1); From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 20:24:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98C18106566B; Sun, 23 Sep 2012 20:24:17 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 844A28FC0A; Sun, 23 Sep 2012 20:24:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NKOHnB069664; Sun, 23 Sep 2012 20:24:17 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NKOHfr069662; Sun, 23 Sep 2012 20:24:17 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201209232024.q8NKOHfr069662@svn.freebsd.org> From: Sean Bruno Date: Sun, 23 Sep 2012 20:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240874 - stable/8/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 20:24:17 -0000 Author: sbruno Date: Sun Sep 23 20:24:17 2012 New Revision: 240874 URL: http://svn.freebsd.org/changeset/base/240874 Log: MFC r238371 When an MFI command fails, the driver needs to set bio->bio_resid so that the upper levels notice. Otherwise we see commands silently failing leading to data corruption. This mirrors dadone() Submitted by: Andrew Boyer aboyer@averesystems.com Modified: stable/8/sys/dev/mfi/mfi_disk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/mfi/ (props changed) Modified: stable/8/sys/dev/mfi/mfi_disk.c ============================================================================== --- stable/8/sys/dev/mfi/mfi_disk.c Sun Sep 23 20:17:28 2012 (r240873) +++ stable/8/sys/dev/mfi/mfi_disk.c Sun Sep 23 20:24:17 2012 (r240874) @@ -298,6 +298,7 @@ mfi_disk_complete(struct bio *bio) hdr = bio->bio_driver1; if (bio->bio_flags & BIO_ERROR) { + bio->bio_resid = bio->bio_bcount; if (bio->bio_error == 0) bio->bio_error = EIO; disk_err(bio, "hard error", -1, 1); From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 20:24:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 638051065764; Sun, 23 Sep 2012 20:24:25 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BF358FC12; Sun, 23 Sep 2012 20:24:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NKOP0l069719; Sun, 23 Sep 2012 20:24:25 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NKOPdd069717; Sun, 23 Sep 2012 20:24:25 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201209232024.q8NKOPdd069717@svn.freebsd.org> From: Sean Bruno Date: Sun, 23 Sep 2012 20:24:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240875 - stable/7/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 20:24:26 -0000 Author: sbruno Date: Sun Sep 23 20:24:24 2012 New Revision: 240875 URL: http://svn.freebsd.org/changeset/base/240875 Log: MFC r238371 When an MFI command fails, the driver needs to set bio->bio_resid so that the upper levels notice. Otherwise we see commands silently failing leading to data corruption. This mirrors dadone() Submitted by: Andrew Boyer aboyer@averesystems.com Modified: stable/7/sys/dev/mfi/mfi_disk.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/mfi/mfi_disk.c ============================================================================== --- stable/7/sys/dev/mfi/mfi_disk.c Sun Sep 23 20:24:17 2012 (r240874) +++ stable/7/sys/dev/mfi/mfi_disk.c Sun Sep 23 20:24:24 2012 (r240875) @@ -291,6 +291,7 @@ mfi_disk_complete(struct bio *bio) hdr = bio->bio_driver1; if (bio->bio_flags & BIO_ERROR) { + bio->bio_resid = bio->bio_bcount; if (bio->bio_error == 0) bio->bio_error = EIO; disk_err(bio, "hard error", -1, 1); From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 20:28:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A55AD106566B; Sun, 23 Sep 2012 20:28:47 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 900EF8FC12; Sun, 23 Sep 2012 20:28:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NKSlAq070485; Sun, 23 Sep 2012 20:28:47 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NKSlh2070483; Sun, 23 Sep 2012 20:28:47 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201209232028.q8NKSlh2070483@svn.freebsd.org> From: Sean Bruno Date: Sun, 23 Sep 2012 20:28:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240876 - stable/9/sys/dev/aac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 20:28:47 -0000 Author: sbruno Date: Sun Sep 23 20:28:47 2012 New Revision: 240876 URL: http://svn.freebsd.org/changeset/base/240876 Log: MFC r238601 On BIO_ERROR, set bio_resid to stop losing data in the error case. Submitted by: Mark Johnston Modified: stable/9/sys/dev/aac/aac_disk.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/aac/aac_disk.c ============================================================================== --- stable/9/sys/dev/aac/aac_disk.c Sun Sep 23 20:24:24 2012 (r240875) +++ stable/9/sys/dev/aac/aac_disk.c Sun Sep 23 20:28:47 2012 (r240876) @@ -334,8 +334,10 @@ aac_biodone(struct bio *bp) { fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - if (bp->bio_flags & BIO_ERROR) + if (bp->bio_flags & BIO_ERROR) { + bp->bio_resid = bp->bio_bcount; disk_err(bp, "hard error", -1, 1); + } biodone(bp); } From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 20:31:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 08EA61065675; Sun, 23 Sep 2012 20:31:46 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E78EC8FC08; Sun, 23 Sep 2012 20:31:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NKVjSo071039; Sun, 23 Sep 2012 20:31:45 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NKVjRT071036; Sun, 23 Sep 2012 20:31:45 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201209232031.q8NKVjRT071036@svn.freebsd.org> From: Sean Bruno Date: Sun, 23 Sep 2012 20:31:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240877 - stable/8/sys/dev/aac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 20:31:46 -0000 Author: sbruno Date: Sun Sep 23 20:31:45 2012 New Revision: 240877 URL: http://svn.freebsd.org/changeset/base/240877 Log: MFC r238601 On BIO_ERROR, set bio_resid to stop losing data in the error case. Submitted by: Mark Johnston Modified: stable/8/sys/dev/aac/aac_disk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/aac/ (props changed) Modified: stable/8/sys/dev/aac/aac_disk.c ============================================================================== --- stable/8/sys/dev/aac/aac_disk.c Sun Sep 23 20:28:47 2012 (r240876) +++ stable/8/sys/dev/aac/aac_disk.c Sun Sep 23 20:31:45 2012 (r240877) @@ -334,8 +334,10 @@ aac_biodone(struct bio *bp) { fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - if (bp->bio_flags & BIO_ERROR) + if (bp->bio_flags & BIO_ERROR) { + bp->bio_resid = bp->bio_bcount; disk_err(bp, "hard error", -1, 1); + } biodone(bp); } From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 20:31:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04C46106571E; Sun, 23 Sep 2012 20:31:52 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC39D8FC12; Sun, 23 Sep 2012 20:31:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NKVqRc071095; Sun, 23 Sep 2012 20:31:52 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NKVqW3071093; Sun, 23 Sep 2012 20:31:52 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201209232031.q8NKVqW3071093@svn.freebsd.org> From: Sean Bruno Date: Sun, 23 Sep 2012 20:31:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240878 - stable/7/sys/dev/aac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 20:31:54 -0000 Author: sbruno Date: Sun Sep 23 20:31:52 2012 New Revision: 240878 URL: http://svn.freebsd.org/changeset/base/240878 Log: MFC r238601 On BIO_ERROR, set bio_resid to stop losing data in the error case. Submitted by: Mark Johnston Modified: stable/7/sys/dev/aac/aac_disk.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/aac/aac_disk.c ============================================================================== --- stable/7/sys/dev/aac/aac_disk.c Sun Sep 23 20:31:45 2012 (r240877) +++ stable/7/sys/dev/aac/aac_disk.c Sun Sep 23 20:31:52 2012 (r240878) @@ -331,8 +331,10 @@ aac_biodone(struct bio *bp) { fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - if (bp->bio_flags & BIO_ERROR) + if (bp->bio_flags & BIO_ERROR) { + bp->bio_resid = bp->bio_bcount; disk_err(bp, "hard error", -1, 1); + } biodone(bp); } From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 22:53:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77007106564A; Sun, 23 Sep 2012 22:53:40 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 48F228FC18; Sun, 23 Sep 2012 22:53:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8NMreYM094512; Sun, 23 Sep 2012 22:53:40 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8NMrers094507; Sun, 23 Sep 2012 22:53:40 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201209232253.q8NMrers094507@svn.freebsd.org> From: Sean Bruno Date: Sun, 23 Sep 2012 22:53:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240879 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 22:53:40 -0000 Author: sbruno Date: Sun Sep 23 22:53:39 2012 New Revision: 240879 URL: http://svn.freebsd.org/changeset/base/240879 Log: This patch fixes a nit in the em, lem, and igb driver statistics. Increment adapter->dropped_pkts instead of if_ierrors because if_ierrors is overwritten by hw stats collection. Submitted by: Andrew Boyer Reviewed by: Jack F Vogel MFC after: 2 weeks Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sun Sep 23 20:31:52 2012 (r240878) +++ head/sys/dev/e1000/if_em.c Sun Sep 23 22:53:39 2012 (r240879) @@ -4436,7 +4436,7 @@ em_rxeof(struct rx_ring *rxr, int count, if ((cur->errors & E1000_RXD_ERR_FRAME_ERR_MASK) || (rxr->discard == TRUE)) { - ifp->if_ierrors++; + adapter->dropped_pkts++; ++rxr->rx_discarded; if (!eop) /* Catch subsequent segs */ rxr->discard = TRUE; Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Sun Sep 23 20:31:52 2012 (r240878) +++ head/sys/dev/e1000/if_igb.c Sun Sep 23 22:53:39 2012 (r240879) @@ -4759,7 +4759,7 @@ igb_rxeof(struct igb_queue *que, int cou /* Make sure all segments of a bad packet are discarded */ if (((staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) != 0) || (rxr->discard)) { - ifp->if_ierrors++; + adapter->dropped_pkts++; ++rxr->rx_discarded; if (!eop) /* Catch subsequent segs */ rxr->discard = TRUE; Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Sun Sep 23 20:31:52 2012 (r240878) +++ head/sys/dev/e1000/if_lem.c Sun Sep 23 22:53:39 2012 (r240879) @@ -3562,7 +3562,7 @@ skip: adapter->lmp = NULL; } } else { - ifp->if_ierrors++; + adapter->dropped_pkts++; discard: /* Reuse loaded DMA map and just update mbuf chain */ mp = adapter->rx_buffer_area[i].m_head; From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 02:07:57 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A85F4106566B; Mon, 24 Sep 2012 02:07:57 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from ns.kevlo.org (kevlo.org [220.128.136.52]) by mx1.freebsd.org (Postfix) with ESMTP id 37F298FC0A; Mon, 24 Sep 2012 02:07:56 +0000 (UTC) Received: from srg.kevlo.org (git.kevlo.org [220.128.136.52]) by ns.kevlo.org (8.14.5/8.14.5) with ESMTP id q8O262pD003892; Mon, 24 Sep 2012 10:06:02 +0800 (CST) (envelope-from kevlo@FreeBSD.org) Message-ID: <505FC00B.5020204@FreeBSD.org> Date: Mon, 24 Sep 2012 10:06:03 +0800 From: Kevin Lo User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120829 Thunderbird/14.0 MIME-Version: 1.0 To: Garrett Cooper References: <201209230838.q8N8c6Tu056083@svn.freebsd.org> <20120923105220.GL37286@deviant.kiev.zoral.com.ua> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Konstantin Belousov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: Re: svn commit: r240850 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 02:07:57 -0000 On 2012/09/24 03:27, Garrett Cooper wrote: > On Sun, Sep 23, 2012 at 3:52 AM, Konstantin Belousov > wrote: >> On Sun, Sep 23, 2012 at 08:38:06AM +0000, Kevin Lo wrote: >>> Author: kevlo >>> Date: Sun Sep 23 08:38:06 2012 >>> New Revision: 240850 >>> URL: http://svn.freebsd.org/changeset/base/240850 >>> >>> Log: >>> Avoid NULL dereference >>> >>> Modified: >>> head/lib/libstand/nfs.c > ... > >> I do not see how this change is useful. libstand' Free() function handles >> NULL parameter fine, as well as all other free(3) implementations I am >> aware of. > +1. free(3) should silently ignore NULL parameters passed into it. Well, The patch is harmless. I suppose I could argue it is a safety belt against free(NULL) should be silently ignored. I have no problem changing it back, but there are two other places where the same comment could apply. Index: lib/libstand/nfs.c =================================================================== --- lib/libstand/nfs.c (revision 240879) +++ lib/libstand/nfs.c (working copy) @@ -606,10 +606,8 @@ nfs_open(const char *upath, struct open_file *f) error = 0; out: - if (newfd) - free(newfd); - if (path) - free(path); + free(newfd); + free(path); #else currfd->iodesc = desc; @@ -1256,10 +1254,8 @@ nfs_open(const char *upath, struct open_file *f) error = 0; out: - if (newfd) - free(newfd); - if (path) - free(path); + free(newfd); + free(path); #else currfd->iodesc = desc; > Thanks, > Garrett > Kevin From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 02:35:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C82A8106564A; Mon, 24 Sep 2012 02:35:04 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 82C6E8FC08; Mon, 24 Sep 2012 02:35:04 +0000 (UTC) Received: by pbbrp8 with SMTP id rp8so2114928pbb.13 for ; Sun, 23 Sep 2012 19:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:in-reply-to:mime-version:content-transfer-encoding :content-type:message-id:cc:x-mailer:from:subject:date:to; bh=MLQeSu3ljTUYNquewDlVtBGTONbtRH/XlKJTgShiZek=; b=JP48silRoH/0yXb1gWTk9I7pD0bIfCcqSsLI60fy0c9KJiIdGnERJIxOs63C3KCbNw xyam/d4pd+UQhOHrPaPoQmJykQ0mt3Xu+X3ZFuH3m4lqxXaAEChiv3ak6d4wB3lPRYiq 7gbdEBzR9XiaXVgwYRIAjIyFpyNKuOqSq049cazUSqnMqna6Btfv6sxjkK6RR57hfuA6 Ti7AYiOX0UB2q7pW4jhM/zHsKKTVi/tjSL3ZZrNw+o2kuN8ctiQd0ZIe39ZJL34GtsUw /QzxclHBlrlCnUNifqXqlKeKJVcQA+VE+glLg5l1bWBPLH7Ex2+/vMU5OzshqlnZfYZd 3yRg== Received: by 10.66.76.130 with SMTP id k2mr29164718paw.19.1348454104129; Sun, 23 Sep 2012 19:35:04 -0700 (PDT) Received: from [10.173.174.42] (mobile-166-147-095-147.mycingular.net. [166.147.95.147]) by mx.google.com with ESMTPS id pw9sm8857806pbb.42.2012.09.23.19.35.02 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 23 Sep 2012 19:35:03 -0700 (PDT) References: <201209230838.q8N8c6Tu056083@svn.freebsd.org> <20120923105220.GL37286@deviant.kiev.zoral.com.ua> <505FC00B.5020204@FreeBSD.org> In-Reply-To: <505FC00B.5020204@FreeBSD.org> Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Message-Id: <4ACBE05F-84F8-4870-B17B-6F670E4056C8@gmail.com> X-Mailer: iPhone Mail (9B206) From: Garrett Cooper Date: Sun, 23 Sep 2012 19:34:58 -0700 To: Kevin Lo Cc: Konstantin Belousov , "svn-src-head@FreeBSD.org" , "svn-src-all@FreeBSD.org" , "src-committers@FreeBSD.org" Subject: Re: svn commit: r240850 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 02:35:05 -0000 Sent from my iPhone On Sep 23, 2012, at 7:06 PM, Kevin Lo wrote: > On 2012/09/24 03:27, Garrett Cooper wrote: >> On Sun, Sep 23, 2012 at 3:52 AM, Konstantin Belousov >> wrote: >>> On Sun, Sep 23, 2012 at 08:38:06AM +0000, Kevin Lo wrote: >>>> Author: kevlo >>>> Date: Sun Sep 23 08:38:06 2012 >>>> New Revision: 240850 >>>> URL: http://svn.freebsd.org/changeset/base/240850 >>>> >>>> Log: >>>> Avoid NULL dereference >>>> >>>> Modified: >>>> head/lib/libstand/nfs.c >> ... >> >>> I do not see how this change is useful. libstand' Free() function handles >>> NULL parameter fine, as well as all other free(3) implementations I am >>> aware of. >> +1. free(3) should silently ignore NULL parameters passed into it. > > Well, The patch is harmless. I suppose I could argue it is a safety belt > against free(NULL) should be silently ignored. > I have no problem changing it back, but there are two other places where > the same comment could apply. > > Index: lib/libstand/nfs.c > =================================================================== > --- lib/libstand/nfs.c (revision 240879) > +++ lib/libstand/nfs.c (working copy) > @@ -606,10 +606,8 @@ nfs_open(const char *upath, struct open_file *f) > error = 0; > > out: > - if (newfd) > - free(newfd); > - if (path) > - free(path); > + free(newfd); > + free(path); > #else > currfd->iodesc = desc; > > @@ -1256,10 +1254,8 @@ nfs_open(const char *upath, struct open_file *f) > error = 0; > > out: > - if (newfd) > - free(newfd); > - if (path) > - free(path); > + free(newfd); > + free(path); > #else > currfd->iodesc = desc; Yeah -- that would be good. Thanks, -Garrett From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 03:13:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 05CA9106566C; Mon, 24 Sep 2012 03:13:51 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 208A614E803; Mon, 24 Sep 2012 03:13:50 +0000 (UTC) Message-ID: <505FCFED.2000101@FreeBSD.org> Date: Sun, 23 Sep 2012 20:13:49 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: Devin Teske References: <201209222216.q8MMG7w2053948@svn.freebsd.org> In-Reply-To: <201209222216.q8MMG7w2053948@svn.freebsd.org> X-Enigmail-Version: 1.4.4 OpenPGP: id=1A1ABC84 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 Subject: Re: svn commit: r240843 - head/usr.sbin/bsdconfig/timezone/share X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 03:13:51 -0000 On 09/22/2012 15:16, Devin Teske wrote: > - if : 2> /dev/null > "$_PATH_DB"; then > + if true 2> /dev/null > "$_PATH_DB"; then > cat <<-EOF > "$_PATH_DB" > $zoneinfo > EOF Is there a reason you're not using mktemp here? -- I am only one, but I am one. I cannot do everything, but I can do something. And I will not let what I cannot do interfere with what I can do. -- Edward Everett Hale, (1822 - 1909) From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 03:14:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 87181106564A; Mon, 24 Sep 2012 03:14:18 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72DC28FC12; Mon, 24 Sep 2012 03:14:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8O3EIQZ031550; Mon, 24 Sep 2012 03:14:18 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8O3EIXq031546; Mon, 24 Sep 2012 03:14:18 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201209240314.q8O3EIXq031546@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 24 Sep 2012 03:14:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240880 - in head: lib/libc/rpc sys/rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 03:14:18 -0000 Author: pfg Date: Mon Sep 24 03:14:17 2012 New Revision: 240880 URL: http://svn.freebsd.org/changeset/base/240880 Log: Partial revert of r239963: The following change caused rpc.lockd to exit after startup: ____ libtirpc: be sure to free cl_netid and cl_tp When creating a client with clnt_tli_create, it uses strdup to copy strings for these fields if nconf is passed in. clnt_dg_destroy frees these strings already. Make sure clnt_vc_destroy frees them in the same way. ____ MFC after: 3 days Reported by: David Wolfskill Tested by: David Wolfskill Modified: head/lib/libc/rpc/clnt_vc.c head/sys/rpc/clnt_vc.c Modified: head/lib/libc/rpc/clnt_vc.c ============================================================================== --- head/lib/libc/rpc/clnt_vc.c Sun Sep 23 22:53:39 2012 (r240879) +++ head/lib/libc/rpc/clnt_vc.c Mon Sep 24 03:14:17 2012 (r240880) @@ -672,10 +672,6 @@ clnt_vc_destroy(cl) if (ct->ct_addr.buf) free(ct->ct_addr.buf); mem_free(ct, sizeof(struct ct_data)); - if (cl->cl_netid && cl->cl_netid[0]) - mem_free(cl->cl_netid, strlen(cl->cl_netid) +1); - if (cl->cl_tp && cl->cl_tp[0]) - mem_free(cl->cl_tp, strlen(cl->cl_tp) +1); mem_free(cl, sizeof(CLIENT)); mutex_unlock(&clnt_fd_lock); thr_sigsetmask(SIG_SETMASK, &(mask), NULL); Modified: head/sys/rpc/clnt_vc.c ============================================================================== --- head/sys/rpc/clnt_vc.c Sun Sep 23 22:53:39 2012 (r240879) +++ head/sys/rpc/clnt_vc.c Mon Sep 24 03:14:17 2012 (r240880) @@ -836,10 +836,6 @@ clnt_vc_destroy(CLIENT *cl) soclose(so); } mem_free(ct, sizeof(struct ct_data)); - if (cl->cl_netid && cl->cl_netid[0]) - mem_free(cl->cl_netid, strlen(cl->cl_netid) +1); - if (cl->cl_tp && cl->cl_tp[0]) - mem_free(cl->cl_tp, strlen(cl->cl_tp) +1); mem_free(cl, sizeof(CLIENT)); } From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 04:28:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DC141065674; Mon, 24 Sep 2012 04:28:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id DB2CE8FC15; Mon, 24 Sep 2012 04:28:14 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q8O4SDPY057884; Mon, 24 Sep 2012 07:28:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q8O4S1fj004024; Mon, 24 Sep 2012 07:28:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q8O4S128004023; Mon, 24 Sep 2012 07:28:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 24 Sep 2012 07:28:01 +0300 From: Konstantin Belousov To: Kevin Lo Message-ID: <20120924042801.GQ37286@deviant.kiev.zoral.com.ua> References: <201209230838.q8N8c6Tu056083@svn.freebsd.org> <20120923105220.GL37286@deviant.kiev.zoral.com.ua> <505FC00B.5020204@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="A+JrWpA8iZwaHvaR" Content-Disposition: inline In-Reply-To: <505FC00B.5020204@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: Garrett Cooper , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: Re: svn commit: r240850 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 04:28:15 -0000 --A+JrWpA8iZwaHvaR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 24, 2012 at 10:06:03AM +0800, Kevin Lo wrote: > On 2012/09/24 03:27, Garrett Cooper wrote: > > On Sun, Sep 23, 2012 at 3:52 AM, Konstantin Belousov > > wrote: > >> On Sun, Sep 23, 2012 at 08:38:06AM +0000, Kevin Lo wrote: > >>> Author: kevlo > >>> Date: Sun Sep 23 08:38:06 2012 > >>> New Revision: 240850 > >>> URL: http://svn.freebsd.org/changeset/base/240850 > >>> > >>> Log: > >>> Avoid NULL dereference > >>> > >>> Modified: > >>> head/lib/libstand/nfs.c > > ... > > > >> I do not see how this change is useful. libstand' Free() function hand= les > >> NULL parameter fine, as well as all other free(3) implementations I am > >> aware of. > > +1. free(3) should silently ignore NULL parameters passed into it. >=20 > Well, The patch is harmless. I suppose I could argue it is a safety belt > against free(NULL) should be silently ignored. It is code bloat. > I have no problem changing it back, but there are two other places where > the same comment could apply. Yes, this is good to apply as well. >=20 > Index: lib/libstand/nfs.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 > --- lib/libstand/nfs.c (revision 240879) > +++ lib/libstand/nfs.c (working copy) > @@ -606,10 +606,8 @@ nfs_open(const char *upath, struct open_file *f) > error =3D 0; >=20 > out: > - if (newfd) > - free(newfd); > - if (path) > - free(path); > + free(newfd); > + free(path); > #else > currfd->iodesc =3D desc; >=20 > @@ -1256,10 +1254,8 @@ nfs_open(const char *upath, struct open_file *f) > error =3D 0; >=20 > out: > - if (newfd) > - free(newfd); > - if (path) > - free(path); > + free(newfd); > + free(path); > #else > currfd->iodesc =3D desc; >=20 >=20 > > Thanks, > > Garrett > > >=20 > Kevin --A+JrWpA8iZwaHvaR Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlBf4VAACgkQC3+MBN1Mb4ggZACfVhiiwDwkZ7D4ixXVVHMoSvc6 FTkAoK1g/WOn/HlG6kA7f5abtXmjcf9g =6NZP -----END PGP SIGNATURE----- --A+JrWpA8iZwaHvaR-- From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 05:24:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D21D1065670; Mon, 24 Sep 2012 05:24:11 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 194A48FC0C; Mon, 24 Sep 2012 05:24:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8O5OAj0050949; Mon, 24 Sep 2012 05:24:10 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8O5OApw050947; Mon, 24 Sep 2012 05:24:10 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201209240524.q8O5OApw050947@svn.freebsd.org> From: Kevin Lo Date: Mon, 24 Sep 2012 05:24:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240881 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 05:24:11 -0000 Author: kevlo Date: Mon Sep 24 05:24:10 2012 New Revision: 240881 URL: http://svn.freebsd.org/changeset/base/240881 Log: Revert r240850 and remove redundant NULL check before free(3). free(3) handles NULL parameter fine. Reviewed by: kib, Garrett Cooper Modified: head/lib/libstand/nfs.c Modified: head/lib/libstand/nfs.c ============================================================================== --- head/lib/libstand/nfs.c Mon Sep 24 03:14:17 2012 (r240880) +++ head/lib/libstand/nfs.c Mon Sep 24 05:24:10 2012 (r240881) @@ -606,10 +606,8 @@ nfs_open(const char *upath, struct open_ error = 0; out: - if (newfd) - free(newfd); - if (path) - free(path); + free(newfd); + free(path); #else currfd->iodesc = desc; @@ -1256,10 +1254,8 @@ nfs_open(const char *upath, struct open_ error = 0; out: - if (newfd) - free(newfd); - if (path) - free(path); + free(newfd); + free(path); #else currfd->iodesc = desc; From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 06:00:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CEF21065675; Mon, 24 Sep 2012 06:00:52 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 587418FC19; Mon, 24 Sep 2012 06:00:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8O60qUR055979; Mon, 24 Sep 2012 06:00:52 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8O60qwe055976; Mon, 24 Sep 2012 06:00:52 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201209240600.q8O60qwe055976@svn.freebsd.org> From: Adrian Chadd Date: Mon, 24 Sep 2012 06:00:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240882 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 06:00:52 -0000 Author: adrian Date: Mon Sep 24 06:00:51 2012 New Revision: 240882 URL: http://svn.freebsd.org/changeset/base/240882 Log: In (eventual) preparation for supporting disabling the whole 11n/software retry path - add some code to make it obvious (to me!) how to disable the software tx path. 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 Mon Sep 24 05:24:10 2012 (r240881) +++ head/sys/dev/ath/if_ath_tx.c Mon Sep 24 06:00:51 2012 (r240882) @@ -2012,6 +2012,7 @@ ath_tx_raw_start(struct ath_softc *sc, s DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: dooverride=%d\n", __func__, do_override); +#if 1 if (do_override) { bf->bf_state.bfs_txflags |= HAL_TXDESC_CLRDMASK; ath_tx_xmit_normal(sc, sc->sc_ac2q[pri], bf); @@ -2019,6 +2020,11 @@ ath_tx_raw_start(struct ath_softc *sc, s /* Queue to software queue */ ath_tx_swq(sc, ni, sc->sc_ac2q[pri], bf); } +#else + /* Direct-dispatch to the hardware */ + bf->bf_state.bfs_txflags |= HAL_TXDESC_CLRDMASK; + ath_tx_xmit_normal(sc, sc->sc_ac2q[pri], bf); +#endif ATH_TXQ_UNLOCK(sc->sc_ac2q[pri]); return 0; From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 06:42:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE6AE106564A; Mon, 24 Sep 2012 06:42:20 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D934F8FC0C; Mon, 24 Sep 2012 06:42:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8O6gKR5061709; Mon, 24 Sep 2012 06:42:20 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8O6gK5u061707; Mon, 24 Sep 2012 06:42:20 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201209240642.q8O6gK5u061707@svn.freebsd.org> From: Adrian Chadd Date: Mon, 24 Sep 2012 06:42:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240883 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 06:42:21 -0000 Author: adrian Date: Mon Sep 24 06:42:20 2012 New Revision: 240883 URL: http://svn.freebsd.org/changeset/base/240883 Log: Prepare for software retransmission of non-aggregate frames but ensure it's disabled. The previous commit to enable CLRDMASK setting didn't do it at all correctly for non-aggregate sessions - so the CLRDMASK bit would be cleared and never re-set. * move ath_tx_update_clrdmask() to be called by functions that setup descriptors and queue frames to the hardware, rather than scattered everywhere. * Force CLRDMASK to be set on all non-aggregate session frames being transmitted. * Use ath_tx_normal_comp() now on non-aggregate sessoin frames that are queued via ath_tx_xmit_normal(). That way the TID hwq is updated and they can trigger (eventual) filter frame queue resets and software retransmits. There's still a bit more work to do in this area to reverse the silly short-sightedness on my part, however it's likely going to be better to fix this now than just reverting the patch. Thanks to people on the freebsd-wireless@ mailing list for promptly pointing this out. 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 Mon Sep 24 06:00:51 2012 (r240882) +++ head/sys/dev/ath/if_ath_tx.c Mon Sep 24 06:42:20 2012 (r240883) @@ -1260,6 +1260,22 @@ ath_tx_do_ratelookup(struct ath_softc *s } /* + * Update the CLRDMASK bit in the ath_buf if it needs to be set. + */ +static void +ath_tx_update_clrdmask(struct ath_softc *sc, struct ath_tid *tid, + struct ath_buf *bf) +{ + + ATH_TID_LOCK_ASSERT(sc, tid); + + if (tid->clrdmask == 1) { + bf->bf_state.bfs_txflags |= HAL_TXDESC_CLRDMASK; + tid->clrdmask = 0; + } +} + +/* * Transmit the given frame to the hardware. * * The frame must already be setup; rate control must already have @@ -1274,9 +1290,25 @@ static void ath_tx_xmit_normal(struct ath_softc *sc, struct ath_txq *txq, struct ath_buf *bf) { + struct ath_node *an = ATH_NODE(bf->bf_node); + struct ath_tid *tid = &an->an_tid[bf->bf_state.bfs_tid]; ATH_TXQ_LOCK_ASSERT(txq); + /* + * For now, just enable CLRDMASK. ath_tx_xmit_normal() does + * set a completion handler however it doesn't (yet) properly + * handle the strict ordering requirements needed for normal, + * non-aggregate session frames. + * + * Once this is implemented, only set CLRDMASK like this for + * frames that must go out - eg management/raw frames. + */ + bf->bf_state.bfs_txflags |= HAL_TXDESC_CLRDMASK; + + /* See if clrdmask needs to be set */ + ath_tx_update_clrdmask(sc, tid, bf); + /* Setup the descriptor before handoff */ ath_tx_do_ratelookup(sc, bf); ath_tx_calc_duration(sc, bf); @@ -1285,8 +1317,11 @@ ath_tx_xmit_normal(struct ath_softc *sc, ath_tx_rate_fill_rcflags(sc, bf); ath_tx_setds(sc, bf); - /* XXX Bump TID HWQ counter */ - /* XXX Assign a completion handler */ + /* Track per-TID hardware queue depth correctly */ + tid->hwq_depth++; + + /* Assign the completion handler */ + bf->bf_comp = ath_tx_normal_comp; /* Hand off to hardware */ ath_tx_handoff(sc, txq, bf); @@ -2485,22 +2520,6 @@ ath_tx_tid_unsched(struct ath_softc *sc, } /* - * Update the CLRDMASK bit in the ath_buf if it needs to be set. - */ -static void -ath_tx_update_clrdmask(struct ath_softc *sc, struct ath_tid *tid, - struct ath_buf *bf) -{ - - ATH_TID_LOCK_ASSERT(sc, tid); - - if (tid->clrdmask == 1) { - bf->bf_state.bfs_txflags |= HAL_TXDESC_CLRDMASK; - tid->clrdmask = 0; - } -} - -/* * Assign a sequence number manually to the given frame. * * This should only be called for A-MPDU TX frames. @@ -2738,7 +2757,6 @@ ath_tx_swq(struct ath_softc *sc, struct } else if (txq->axq_depth < sc->sc_hwq_limit) { /* AMPDU not running, attempt direct dispatch */ DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: xmit_normal\n", __func__); - ath_tx_update_clrdmask(sc, atid, bf); ath_tx_xmit_normal(sc, txq, bf); } else { /* Busy; queue */ @@ -3432,6 +3450,19 @@ ath_tx_txq_drain(struct ath_softc *sc, s /* * Handle completion of non-aggregate session frames. + * + * This (currently) doesn't implement software retransmission of + * non-aggregate frames! + * + * Software retransmission of non-aggregate frames needs to obey + * the strict sequence number ordering, and drop any frames that + * will fail this. + * + * For now, filtered frames and frame transmission will cause + * all kinds of issues. So we don't support them. + * + * So anyone queuing frames via ath_tx_normal_xmit() or + * ath_tx_hw_queue_norm() must override and set CLRDMASK. */ void ath_tx_normal_comp(struct ath_softc *sc, struct ath_buf *bf, int fail) @@ -3450,10 +3481,23 @@ ath_tx_normal_comp(struct ath_softc *sc, atid->hwq_depth--; +#if 0 + /* + * If the frame was filtered, stick it on the filter frame + * queue and complain about it. It shouldn't happen! + */ + if ((ts->ts_status & HAL_TXERR_FILT) || + (ts->ts_status != 0 && atid->isfiltered)) { + device_printf(sc->sc_dev, + "%s: isfiltered=%d, ts_status=%d: huh?\n", + __func__, + atid->isfiltered, + ts->ts_status); + ath_tx_tid_filt_comp_buf(sc, atid, bf); + } +#endif if (atid->isfiltered) - device_printf(sc->sc_dev, "%s: isfiltered=1, normal_comp?\n", - __func__); - + device_printf(sc->sc_dev, "%s: filtered?!\n", __func__); if (atid->hwq_depth < 0) device_printf(sc->sc_dev, "%s: hwq_depth < 0: %d\n", __func__, atid->hwq_depth); @@ -3471,7 +3515,6 @@ ath_tx_normal_comp(struct ath_softc *sc, */ if (atid->isfiltered) ath_tx_tid_filt_comp_complete(sc, atid); - ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); /* @@ -4766,6 +4809,12 @@ ath_tx_tid_hw_queue_norm(struct ath_soft /* Normal completion handler */ bf->bf_comp = ath_tx_normal_comp; + /* + * Override this for now, until the non-aggregate + * completion handler correctly handles software retransmits. + */ + bf->bf_state.bfs_txflags |= HAL_TXDESC_CLRDMASK; + /* Update CLRDMASK just before this frame is queued */ ath_tx_update_clrdmask(sc, tid, bf); From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 08:23:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A3B1C106566C; Mon, 24 Sep 2012 08:23:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 533998FC15; Mon, 24 Sep 2012 08:23:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8O8N637078730; Mon, 24 Sep 2012 08:23:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8O8N6v0078728; Mon, 24 Sep 2012 08:23:06 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201209240823.q8O8N6v0078728@svn.freebsd.org> From: Alexander Motin Date: Mon, 24 Sep 2012 08:23:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240884 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 08:23:06 -0000 Author: mav Date: Mon Sep 24 08:23:05 2012 New Revision: 240884 URL: http://svn.freebsd.org/changeset/base/240884 Log: Fix panic caused by wrong pointer dereference, left after pin sense rewrite at r230551. Also while there, make sense polling use reported for each node separately instead of reporting accumulated total status. Submitted by: Barbara (1) MFC after: 3 days Modified: head/sys/dev/sound/pci/hda/hdaa.c Modified: head/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa.c Mon Sep 24 06:42:20 2012 (r240883) +++ head/sys/dev/sound/pci/hda/hdaa.c Mon Sep 24 08:23:05 2012 (r240884) @@ -627,7 +627,7 @@ hdaa_sense_init(struct hdaa_devinfo *dev (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) { device_printf(devinfo->dev, "No presence detection support at nid %d\n", - as[i].pins[15]); + w->nid); } else { if (w->unsol < 0) poll = 1; @@ -636,7 +636,7 @@ hdaa_sense_init(struct hdaa_devinfo *dev "Headphones redirection for " "association %d nid=%d using %s.\n", w->bindas, w->nid, - (poll != 0) ? "polling" : + (w->unsol < 0) ? "polling" : "unsolicited responses"); ); }; From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 08:32:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D3FD106566B; Mon, 24 Sep 2012 08:32:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67F4E8FC19; Mon, 24 Sep 2012 08:32:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8O8WK1v080420; Mon, 24 Sep 2012 08:32:20 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8O8WK2R080418; Mon, 24 Sep 2012 08:32:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201209240832.q8O8WK2R080418@svn.freebsd.org> From: Alexander Motin Date: Mon, 24 Sep 2012 08:32:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240885 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 08:32:20 -0000 Author: mav Date: Mon Sep 24 08:32:19 2012 New Revision: 240885 URL: http://svn.freebsd.org/changeset/base/240885 Log: Document ipv6 hook, present there for ages. Submitted by: Dmitry Luhtionov Modified: head/share/man/man4/ng_ppp.4 Modified: head/share/man/man4/ng_ppp.4 ============================================================================== --- head/share/man/man4/ng_ppp.4 Mon Sep 24 08:23:05 2012 (r240884) +++ head/share/man/man4/ng_ppp.4 Mon Sep 24 08:32:19 2012 (r240885) @@ -35,7 +35,7 @@ .\" $FreeBSD$ .\" $Whistle: ng_ppp.8,v 1.3 1999/01/25 23:46:27 archie Exp $ .\" -.Dd December 28, 2006 +.Dd September 24, 2012 .Dt NG_PPP 4 .Os .Sh NAME @@ -325,6 +325,8 @@ Connection to hook .It Dv inet IP packet data +.It Dv ipv6 +IPv6 packet data .It Dv atalk AppleTalk packet data .It Dv ipx From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 08:47:52 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A7F4106564A; Mon, 24 Sep 2012 08:47:52 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) by mx1.freebsd.org (Postfix) with ESMTP id D71F48FC17; Mon, 24 Sep 2012 08:47:51 +0000 (UTC) Received: from [192.168.0.2] (cpc2-cmbg15-2-0-cust445.5-4.cable.virginmedia.com [86.26.13.190]) (authenticated bits=0) by theravensnest.org (8.14.5/8.14.5) with ESMTP id q8O8lmMQ018429 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Mon, 24 Sep 2012 08:47:50 GMT (envelope-from theraven@FreeBSD.org) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=iso-8859-1 From: David Chisnall In-Reply-To: Date: Mon, 24 Sep 2012 09:47:45 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201209230838.q8N8c6Tu056083@svn.freebsd.org> <20120923105220.GL37286@deviant.kiev.zoral.com.ua> To: Garrett Cooper X-Mailer: Apple Mail (2.1278) Cc: Konstantin Belousov , Kevin Lo , svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r240850 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 08:47:52 -0000 On 23 Sep 2012, at 20:27, Garrett Cooper wrote: > +1. free(3) should silently ignore NULL parameters passed into it. Indeed. The C standard's description for free() states that: > If ptr is a null pointer, no action occurs. This means that a standards-compilant compiler is entirely at liberty to = elide these checks (not sure if GCC or LLVM does, but both have = optimisation passes that optimise based on assumptions about standard = library functions, although they may not run when compiled in a = freestanding environment). The only reasons for a NULL check before free() should be: - Sanity checking (i.e. this pointer is never meant to be NULL, assert = that it isnt) - Recursive cleanup (don't dereference this pointer to clean up its = elements if it is NULL) David= From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 09:14:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BFDCD106564A; Mon, 24 Sep 2012 09:14:30 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 3053B8FC12; Mon, 24 Sep 2012 09:14:29 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q8O9EY7s096629; Mon, 24 Sep 2012 12:14:35 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q8O9EM1Q033406; Mon, 24 Sep 2012 12:14:22 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q8O9EM4I033405; Mon, 24 Sep 2012 12:14:22 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 24 Sep 2012 12:14:22 +0300 From: Konstantin Belousov To: David Chisnall Message-ID: <20120924091422.GS37286@deviant.kiev.zoral.com.ua> References: <201209230838.q8N8c6Tu056083@svn.freebsd.org> <20120923105220.GL37286@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YW0vl6bOwYQ/J4Ih" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: Garrett Cooper , Kevin Lo , svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r240850 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 09:14:30 -0000 --YW0vl6bOwYQ/J4Ih Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 24, 2012 at 09:47:45AM +0100, David Chisnall wrote: > On 23 Sep 2012, at 20:27, Garrett Cooper wrote: >=20 > > +1. free(3) should silently ignore NULL parameters passed into it. >=20 > Indeed. The C standard's description for free() states that: >=20 > > If ptr is a null pointer, no action occurs. >=20 > This means that a standards-compilant compiler is entirely at liberty > to elide these checks (not sure if GCC or LLVM does, but both have > optimisation passes that optimise based on assumptions about standard > library functions, although they may not run when compiled in a > freestanding environment). > In this specific case your note is irrelevant, since libstand free() is not a function at all. Would you look at the code, you note that free() is the macro calling the function Free(). Indeed, in freestanding environment conforming compiler is denied to specially process free(). > The only reasons for a NULL check before free() should be: >=20 > - Sanity checking (i.e. this pointer is never meant to be NULL, assert th= at it isnt) > - Recursive cleanup (don't dereference this pointer to clean up its eleme= nts if it is NULL) - Non-standard free() which does not understand NULL. >=20 > David --YW0vl6bOwYQ/J4Ih Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlBgJG0ACgkQC3+MBN1Mb4jbwQCgrv1rUCY+COF/nrIAGNuweSEv BD4An0z/1vIFAuMaJJvOLWihXaha3cp5 =2CyZ -----END PGP SIGNATURE----- --YW0vl6bOwYQ/J4Ih-- From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 12:57:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4D1401065672; Mon, 24 Sep 2012 12:57:06 +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 9A8948FC0A; Mon, 24 Sep 2012 12:57:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.5/8.14.5) with ESMTP id q8OCuwrj039476; Mon, 24 Sep 2012 16:56:58 +0400 (MSK) (envelope-from marck@rinet.ru) Date: Mon, 24 Sep 2012 16:56:58 +0400 (MSK) From: Dmitry Morozovsky To: Pawel Jakub Dawidek In-Reply-To: <201209231940.q8NJewF7062617@svn.freebsd.org> Message-ID: References: <201209231940.q8NJewF7062617@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]); Mon, 24 Sep 2012 16:56:58 +0400 (MSK) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240868 - in head: cddl/lib/libzpool sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys sys/modules/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 12:57:06 -0000 On Sun, 23 Sep 2012, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Sun Sep 23 19:40:58 2012 > New Revision: 240868 > URL: http://svn.freebsd.org/changeset/base/240868 > > Log: > Add TRIM support. [snip] Yesss! ;-) Thank you very much. Based on your thoughts, how could you estimate stablility (and, therefore, MFCability) of this feature? -- 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-all@FreeBSD.ORG Mon Sep 24 15:02:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CD3701065673; Mon, 24 Sep 2012 15:02:31 +0000 (UTC) (envelope-from bjk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EE588FC0C; Mon, 24 Sep 2012 15:02:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8OF2VcE040566; Mon, 24 Sep 2012 15:02:31 GMT (envelope-from bjk@svn.freebsd.org) Received: (from bjk@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8OF2Vd5040564; Mon, 24 Sep 2012 15:02:31 GMT (envelope-from bjk@svn.freebsd.org) Message-Id: <201209241502.q8OF2Vd5040564@svn.freebsd.org> From: Benjamin Kaduk Date: Mon, 24 Sep 2012 15:02:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240887 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 15:02:31 -0000 Author: bjk (doc committer) Date: Mon Sep 24 15:02:31 2012 New Revision: 240887 URL: http://svn.freebsd.org/changeset/base/240887 Log: Minor man page cleanup -- fix grammar, markup fixes, and start each sentence on a new line. Approved by: hrs (mentor) Modified: head/share/man/man4/vale.4 Modified: head/share/man/man4/vale.4 ============================================================================== --- head/share/man/man4/vale.4 Mon Sep 24 14:54:27 2012 (r240886) +++ head/share/man/man4/vale.4 Mon Sep 24 15:02:31 2012 (r240887) @@ -39,7 +39,7 @@ .Sh DESCRIPTION .Nm is a feature of the -.Nm netmap +.Xr netmap 4 module that implements multiple Virtual switches that can be used to interconnect netmap clients, including traffic sources and sinks, packet forwarders, userspace firewalls, @@ -52,7 +52,7 @@ second (Mpps) per core with small frames with 1500 byte frames. .Sh OPERATION .Nm -dynamically creates switches and ports as client connect +dynamically creates switches and ports as clients connect to it using the .Xr netmap 4 API. @@ -68,7 +68,7 @@ indicates a specific switch (the colon i and .Pa port indicates a port within the switch. -Bridge and ports names are arbitrary strings, the only +Bridge and port names are arbitrary strings, the only constraint being that the full name must fit within 16 characters. .Pp @@ -77,13 +77,14 @@ See for details on the API. .Ss LIMITS .Nm -currently supports up to 4 switches, 16 ports per switch, -1024 buffers per port. These hard limits will be +currently supports up to 4 switches, 16 ports per switch, with +1024 buffers per port. +These hard limits will be changed to sysctl variables in future releases. .Sh SYSCTL VARIABLES .Nm uses the following sysctl variables to control operation: -.Bl -tag -width 12 +.Bl -tag -width dev.netmap.verbose .It dev.netmap.bridge The maximum number of packets processed internally in each iteration. @@ -120,12 +121,12 @@ June 2012, http://info.iet.unipi.it/~lui .An -nosplit The .Nm -switch has been designed and implemented in 2012 by +switch was designed and implemented in 2012 by .An Luigi Rizzo and .An Giuseppe Lettieri at the Universita` di Pisa. .Pp .Nm -has been funded by the European Commission within FP7 Projects +was funded by the European Commission within FP7 Projects CHANGE (257422) and OPENLAB (287581). From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 16:34:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DDB9106566B; Mon, 24 Sep 2012 16:34:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 600E18FC0A; Mon, 24 Sep 2012 16:34:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8OGYETo054465; Mon, 24 Sep 2012 16:34:14 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8OGYEXa054463; Mon, 24 Sep 2012 16:34:14 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201209241634.q8OGYEXa054463@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 24 Sep 2012 16:34:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240890 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 16:34:14 -0000 Author: hselasky Date: Mon Sep 24 16:34:13 2012 New Revision: 240890 URL: http://svn.freebsd.org/changeset/base/240890 Log: DWC OTG host mode improvements: - Make HSIC selection dynamic. - Make LOW speed USB devices work through HIGH speed USB HUB. Modified: head/sys/dev/usb/controller/dwc_otg.c Modified: head/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.c Mon Sep 24 15:16:06 2012 (r240889) +++ head/sys/dev/usb/controller/dwc_otg.c Mon Sep 24 16:34:13 2012 (r240890) @@ -101,12 +101,18 @@ __FBSDID("$FreeBSD$"); GINTMSK_HCHINTMSK | \ GINTSTS_PRTINT) -#define DWC_OTG_USE_HSIC 0 +static int dwc_otg_use_hsic; + +static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW, 0, "USB DWC OTG"); + +SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, use_hsic, CTLFLAG_RD, + &dwc_otg_use_hsic, 0, "DWC OTG uses HSIC interface"); + +TUNABLE_INT("hw.usb.dwc_otg.use_hsic", &dwc_otg_use_hsic); #ifdef USB_DEBUG static int dwc_otg_debug; -static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW, 0, "USB DWC OTG"); SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, debug, CTLFLAG_RW, &dwc_otg_debug, 0, "DWC OTG debug level"); #endif @@ -701,6 +707,15 @@ dwc_otg_host_setup_tx(struct dwc_otg_td } } + /* treat NYET like NAK, if SPLIT transactions are used */ + if (hcint & HCINT_NYET) { + if (td->hcsplt != 0) { + DPRINTF("CH=%d NYET+SPLIT\n", td->channel); + hcint &= ~HCINT_NYET; + hcint |= HCINT_NAK; + } + } + /* channel must be disabled before we can complete the transfer */ if (hcint & (HCINT_ERRORS | HCINT_RETRY | @@ -1041,6 +1056,15 @@ dwc_otg_host_data_rx(struct dwc_otg_td * } } + /* treat NYET like NAK, if SPLIT transactions are used */ + if (hcint & HCINT_NYET) { + if (td->hcsplt != 0) { + DPRINTF("CH=%d NYET+SPLIT\n", td->channel); + hcint &= ~HCINT_NYET; + hcint |= HCINT_NAK; + } + } + /* channel must be disabled before we can complete the transfer */ if (hcint & (HCINT_ERRORS | HCINT_RETRY | @@ -1391,6 +1415,15 @@ dwc_otg_host_data_tx(struct dwc_otg_td * } } + /* treat NYET like NAK, if SPLIT transactions are used */ + if (hcint & HCINT_NYET) { + if (td->hcsplt != 0) { + DPRINTF("CH=%d NYET+SPLIT\n", td->channel); + hcint &= ~HCINT_NYET; + hcint |= HCINT_NAK; + } + } + /* channel must be disabled before we can complete the transfer */ if (hcint & (HCINT_ERRORS | HCINT_RETRY | @@ -2979,7 +3012,7 @@ dwc_otg_init(struct dwc_otg_softc *sc) } /* select HSIC or non-HSIC mode */ - if (DWC_OTG_USE_HSIC) { + if (dwc_otg_use_hsic) { DWC_OTG_WRITE_4(sc, DOTG_GUSBCFG, GUSBCFG_PHYIF | GUSBCFG_TRD_TIM_SET(5) | temp); From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 16:45:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 70575106566B; Mon, 24 Sep 2012 16:45:40 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id 33A358FC08; Mon, 24 Sep 2012 16:45:40 +0000 (UTC) Received: from smtp.fisglobal.com ([10.132.206.15]) by ltcfislmsgpa04.fnfis.com (8.14.4/8.14.4) with ESMTP id q8OGiWKo001044 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Mon, 24 Sep 2012 11:45:32 -0500 Received: from [10.0.0.100] (10.14.152.61) by smtp.fisglobal.com (10.132.206.15) with Microsoft SMTP Server (TLS) id 14.2.309.2; Mon, 24 Sep 2012 11:45:24 -0500 MIME-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset="iso-8859-1" From: Devin Teske In-Reply-To: <505FCFED.2000101@FreeBSD.org> Date: Mon, 24 Sep 2012 09:45:22 -0700 Content-Transfer-Encoding: quoted-printable Message-ID: References: <201209222216.q8MMG7w2053948@svn.freebsd.org> <505FCFED.2000101@FreeBSD.org> To: Doug Barton X-Mailer: Apple Mail (2.1278) X-Originating-IP: [10.14.152.61] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.7.7855, 1.0.431, 0.0.0000 definitions=2012-09-24_04:2012-09-24, 2012-09-24, 1970-01-01 signatures=0 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Devin Teske , src-committers@freebsd.org Subject: Re: svn commit: r240843 - head/usr.sbin/bsdconfig/timezone/share X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Devin Teske List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 16:45:40 -0000 On Sep 23, 2012, at 8:13 PM, Doug Barton wrote: > On 09/22/2012 15:16, Devin Teske wrote: >> - if : 2> /dev/null > "$_PATH_DB"; then >> + if true 2> /dev/null > "$_PATH_DB"; then >> cat <<-EOF > "$_PATH_DB" >> $zoneinfo >> EOF >=20 > Is there a reason you're not using mktemp here? >=20 Hi Doug, There is indeed a reason that mktemp is not used in this situation. 1. No possibility of a race condition, so little-to-no need for mktemp. 2. Using mktemp in a "file-truncate operation" would just be "wrong" (quoti= ng others). --=20 Devin P.S. I posited your question to IRC to see what general consensus was and m= any agreed that mktemp is not right in this situation. _____________ The information contained in this message is proprietary and/or confidentia= l. If you are not the intended recipient, please: (i) delete the message an= d all copies; (ii) do not disclose, distribute or use the message in any ma= nner; and (iii) notify the sender immediately. In addition, please be aware= that any message addressed to our domain is subject to archiving and revie= w by persons other than the intended recipient. Thank you. From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 17:00:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBAFF1065677; Mon, 24 Sep 2012 17:00:37 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4D5488FC12; Mon, 24 Sep 2012 17:00:37 +0000 (UTC) Received: by ieak10 with SMTP id k10so11748402iea.13 for ; Mon, 24 Sep 2012 10:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=BggDEKjh7q+zyRCrEUkbzIB66N5bpvId3HvuvhIcO6M=; b=oxRQzFR70Eq6oQH5h6R5PBaGktZXkpgK3wrna1xg3MsnGpl3qOlNx1UqmAQIcMelih BMfZaq4F/YB0LeN3y56hAFazA3HZYQdfoEVizZPRUZD11pzNNLpkA5G42vdQl/aprKA4 DA9fHTgm50srXaNFLTRVi3LFOTEvCSn7DVYHR5K9MmrtUL+AmvM5jiwm4oXVTEyp5Oui XON3MI/Wz+sZ40O/+KSMOh/uRZYQSzmECL4gGTpWdvqr/QOX/hm8sRa5C/H6is0g9T8f 5cw/tW30dZD9Jqc5OKasbsIeuvytnk3enNuKZwJg1/BVAayI1sj3qV9LAV605wxDVUw4 ntgg== MIME-Version: 1.0 Received: by 10.50.173.41 with SMTP id bh9mr5778963igc.52.1348506036747; Mon, 24 Sep 2012 10:00:36 -0700 (PDT) Received: by 10.64.51.39 with HTTP; Mon, 24 Sep 2012 10:00:36 -0700 (PDT) In-Reply-To: References: <201209222216.q8MMG7w2053948@svn.freebsd.org> <505FCFED.2000101@FreeBSD.org> Date: Mon, 24 Sep 2012 10:00:36 -0700 Message-ID: From: Garrett Cooper To: Devin Teske Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Doug Barton , src-committers@freebsd.org Subject: Re: svn commit: r240843 - head/usr.sbin/bsdconfig/timezone/share X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 17:00:37 -0000 On Mon, Sep 24, 2012 at 9:45 AM, Devin Teske wrote: > > On Sep 23, 2012, at 8:13 PM, Doug Barton wrote: > >> On 09/22/2012 15:16, Devin Teske wrote: >>> - if : 2> /dev/null > "$_PATH_DB"; then >>> + if true 2> /dev/null > "$_PATH_DB"; then >>> cat <<-EOF > "$_PATH_DB" >>> $zoneinfo >>> EOF >> >> Is there a reason you're not using mktemp here? >> > > Hi Doug, > > There is indeed a reason that mktemp is not used in this situation. > > 1. No possibility of a race condition, so little-to-no need for mktemp. > 2. Using mktemp in a "file-truncate operation" would just be "wrong" (quoting others). > > P.S. I posited your question to IRC to see what general consensus was and many agreed that mktemp is not right in this situation. Indeed. It's either going to pass (truncate the file) or fail. No sense in using a temporary file here. Thanks, -Garrett From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 17:13:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8116C106566B; Mon, 24 Sep 2012 17:13:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C60F8FC08; Mon, 24 Sep 2012 17:13:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8OHDYNa060449; Mon, 24 Sep 2012 17:13:34 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8OHDYYp060446; Mon, 24 Sep 2012 17:13:34 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201209241713.q8OHDYYp060446@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 24 Sep 2012 17:13:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240891 - in head: etc usr.sbin/moused X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 17:13:34 -0000 Author: hselasky Date: Mon Sep 24 17:13:33 2012 New Revision: 240891 URL: http://svn.freebsd.org/changeset/base/240891 Log: Make sure moused is exiting as quick as possible after that the umsX character device returns a read error. Update devd.conf rules to use "DEVFS" events which are generated after that the umsX character device node has been created/destroyed, and then there should be no need for moused to wait up to 10 seconds for umsX to be ready. Opening umsX should not fail except if the kernel is low on memory. In that case the user can replug the USB mouse or use "usbconfig" to reset the device. In case of USB mouse devices, moused should neither retry to open its character device, once the first read error has happened. This is an indication of device detach. MFC after: 1 week Modified: head/etc/devd.conf head/usr.sbin/moused/moused.c Modified: head/etc/devd.conf ============================================================================== --- head/etc/devd.conf Mon Sep 24 16:34:13 2012 (r240890) +++ head/etc/devd.conf Mon Sep 24 17:13:33 2012 (r240891) @@ -115,14 +115,22 @@ detach 100 { action "/etc/rc.d/syscons setkeyboard /dev/kbd0"; }; -attach 100 { - device-name "ums[0-9]+"; - action "/etc/rc.d/moused quietstart $device-name"; +notify 100 { + match "system" "DEVFS"; + match "subsystem" "CDEV"; + match "type" "CREATE"; + match "cdev" "ums[0-9]+"; + + action "/etc/rc.d/moused quietstart $cdev"; }; -detach 100 { - device-name "ums[0-9]+"; - action "/etc/rc.d/moused stop $device-name"; +notify 100 { + match "system" "DEVFS"; + match "subsystem" "CDEV"; + match "type" "DESTROY"; + match "cdev" "ums[0-9]+"; + + action "/etc/rc.d/moused stop $cdev"; }; # Firmware download into the ActiveWire board. After the firmware download is Modified: head/usr.sbin/moused/moused.c ============================================================================== --- head/usr.sbin/moused/moused.c Mon Sep 24 16:34:13 2012 (r240890) +++ head/usr.sbin/moused/moused.c Mon Sep 24 17:13:33 2012 (r240891) @@ -408,6 +408,7 @@ static struct rodentparam { int cfd; /* /dev/consolectl file descriptor */ int mremsfd; /* mouse remote server file descriptor */ int mremcfd; /* mouse remote client file descriptor */ + int is_removable; /* set if device is removable, like USB */ long clickthreshold; /* double click speed in msec */ long button2timeout; /* 3 button emulation timeout */ mousehw_t hw; /* mouse device hardware information */ @@ -434,6 +435,7 @@ static struct rodentparam { .cfd = -1, .mremsfd = -1, .mremcfd = -1, + .is_removable = 0, .clickthreshold = DFLT_CLICKTHRESHOLD, .button2timeout = DFLT_BUTTON2TIMEOUT, .accelx = 1.0, @@ -570,7 +572,6 @@ main(int argc, char *argv[]) int c; int i; int j; - static int retry; for (i = 0; i < MOUSE_MAXBUTTON; ++i) mstate[i] = &bstate[i]; @@ -876,10 +877,8 @@ main(int argc, char *argv[]) usage(); } - retry = 1; - if (strncmp(rodent.portname, "/dev/ums", 8) == 0) { - retry = 5; - } + if (strncmp(rodent.portname, "/dev/ums", 8) == 0) + rodent.is_removable = 1; for (;;) { if (setjmp(env) == 0) { @@ -888,13 +887,8 @@ main(int argc, char *argv[]) signal(SIGQUIT, cleanup); signal(SIGTERM, cleanup); signal(SIGUSR1, pause_mouse); - for (i = 0; i < retry; ++i) { - if (i > 0) - sleep(2); - rodent.mfd = open(rodent.portname, O_RDWR | O_NONBLOCK); - if (rodent.mfd != -1 || errno != ENOENT) - break; - } + + rodent.mfd = open(rodent.portname, O_RDWR | O_NONBLOCK); if (rodent.mfd == -1) logerr(1, "unable to open %s", rodent.portname); if (r_identify() == MOUSE_PROTO_UNKNOWN) { @@ -944,6 +938,8 @@ main(int argc, char *argv[]) if (rodent.cfd != -1) close(rodent.cfd); rodent.mfd = rodent.cfd = -1; + if (rodent.is_removable) + exit(0); } /* NOT REACHED */ From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 17:31:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40653106564A; Mon, 24 Sep 2012 17:31:09 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B07C8FC0C; Mon, 24 Sep 2012 17:31:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8OHV9hl063123; Mon, 24 Sep 2012 17:31:09 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8OHV8vF063121; Mon, 24 Sep 2012 17:31:08 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201209241731.q8OHV8vF063121@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Mon, 24 Sep 2012 17:31:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240892 - head/sbin/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 17:31:09 -0000 Author: melifaro Date: Mon Sep 24 17:31:08 2012 New Revision: 240892 URL: http://svn.freebsd.org/changeset/base/240892 Log: Permit table to be used as IPv6 address. Reported by: Serhiy Popov MFC after: 2 weeks Modified: head/sbin/ipfw/ipv6.c Modified: head/sbin/ipfw/ipv6.c ============================================================================== --- head/sbin/ipfw/ipv6.c Mon Sep 24 17:13:33 2012 (r240891) +++ head/sbin/ipfw/ipv6.c Mon Sep 24 17:31:08 2012 (r240892) @@ -352,6 +352,22 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av) return (1); } + if (strncmp(av, "table(", 6) == 0) { + char *p = strchr(av + 6, ','); + uint32_t *dm = ((ipfw_insn_u32 *)cmd)->d; + + if (p) + *p++ = '\0'; + cmd->o.opcode = O_IP_DST_LOOKUP; + cmd->o.arg1 = strtoul(av + 6, NULL, 0); + if (p) { + cmd->o.len |= F_INSN_SIZE(ipfw_insn_u32); + dm[0] = strtoul(p, NULL, 0); + } else + cmd->o.len |= F_INSN_SIZE(ipfw_insn); + return (1); + } + av = strdup(av); while (av) { /* @@ -469,7 +485,11 @@ add_srcip6(ipfw_insn *cmd, char *av) { fill_ip6((ipfw_insn_ip6 *)cmd, av); - if (F_LEN(cmd) == 0) { /* any */ + if (cmd->opcode == O_IP_DST_SET) /* set */ + cmd->opcode = O_IP_SRC_SET; + else if (cmd->opcode == O_IP_DST_LOOKUP) /* table */ + cmd->opcode = O_IP_SRC_LOOKUP; + else if (F_LEN(cmd) == 0) { /* any */ } else if (F_LEN(cmd) == F_INSN_SIZE(ipfw_insn)) { /* "me" */ cmd->opcode = O_IP6_SRC_ME; } else if (F_LEN(cmd) == @@ -487,7 +507,11 @@ add_dstip6(ipfw_insn *cmd, char *av) { fill_ip6((ipfw_insn_ip6 *)cmd, av); - if (F_LEN(cmd) == 0) { /* any */ + if (cmd->opcode == O_IP_DST_SET) /* set */ + ; + else if (cmd->opcode == O_IP_DST_LOOKUP) /* table */ + ; + else if (F_LEN(cmd) == 0) { /* any */ } else if (F_LEN(cmd) == F_INSN_SIZE(ipfw_insn)) { /* "me" */ cmd->opcode = O_IP6_DST_ME; } else if (F_LEN(cmd) == From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 17:34:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B550E1065675; Mon, 24 Sep 2012 17:34:31 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FFE38FC12; Mon, 24 Sep 2012 17:34:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8OHYVnF063808; Mon, 24 Sep 2012 17:34:31 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8OHYVbB063806; Mon, 24 Sep 2012 17:34:31 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201209241734.q8OHYVbB063806@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Mon, 24 Sep 2012 17:34:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240893 - head/sbin/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 17:34:31 -0000 Author: melifaro Date: Mon Sep 24 17:34:30 2012 New Revision: 240893 URL: http://svn.freebsd.org/changeset/base/240893 Log: Whitespace fixes MFC after: 2 weeks Modified: head/sbin/ipfw/ipv6.c Modified: head/sbin/ipfw/ipv6.c ============================================================================== --- head/sbin/ipfw/ipv6.c Mon Sep 24 17:31:08 2012 (r240892) +++ head/sbin/ipfw/ipv6.c Mon Sep 24 17:34:30 2012 (r240893) @@ -336,21 +336,21 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av) * Note d[1] points to struct in6_add r mask6 of cmd */ - cmd->o.len &= ~F_LEN_MASK; /* zero len */ + cmd->o.len &= ~F_LEN_MASK; /* zero len */ - if (strcmp(av, "any") == 0) - return (1); + if (strcmp(av, "any") == 0) + return (1); - if (strcmp(av, "me") == 0) { /* Set the data for "me" opt*/ - cmd->o.len |= F_INSN_SIZE(ipfw_insn); - return (1); - } + if (strcmp(av, "me") == 0) { /* Set the data for "me" opt*/ + cmd->o.len |= F_INSN_SIZE(ipfw_insn); + return (1); + } - if (strcmp(av, "me6") == 0) { /* Set the data for "me" opt*/ - cmd->o.len |= F_INSN_SIZE(ipfw_insn); - return (1); - } + if (strcmp(av, "me6") == 0) { /* Set the data for "me" opt*/ + cmd->o.len |= F_INSN_SIZE(ipfw_insn); + return (1); + } if (strncmp(av, "table(", 6) == 0) { char *p = strchr(av + 6, ','); @@ -368,8 +368,8 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av) return (1); } - av = strdup(av); - while (av) { + av = strdup(av); + while (av) { /* * After the address we can have '/' indicating a mask, * or ',' indicating another address follows. From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 19:48:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3CCCE1065670; Mon, 24 Sep 2012 19:48:42 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0EA208FC14; Mon, 24 Sep 2012 19:48:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8OJmf5a085962; Mon, 24 Sep 2012 19:48:41 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8OJmfXO085960; Mon, 24 Sep 2012 19:48:41 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201209241948.q8OJmfXO085960@svn.freebsd.org> From: Adrian Chadd Date: Mon, 24 Sep 2012 19:48:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240895 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 19:48:42 -0000 Author: adrian Date: Mon Sep 24 19:48:41 2012 New Revision: 240895 URL: http://svn.freebsd.org/changeset/base/240895 Log: Debugging output fixes: * use the correct frame status - although the completion descriptor is the _last_ in the frame/aggregate, the status is currently stored in the _first_ buffer. * Print out ath_buf specific fields once, not per descriptor in an ath_buf. Modified: head/sys/dev/ath/if_ath_debug.c Modified: head/sys/dev/ath/if_ath_debug.c ============================================================================== --- head/sys/dev/ath/if_ath_debug.c Mon Sep 24 19:32:24 2012 (r240894) +++ head/sys/dev/ath/if_ath_debug.c Mon Sep 24 19:48:41 2012 (r240895) @@ -198,7 +198,7 @@ static void ath_printtxbuf_legacy(struct ath_softc *sc, const struct ath_buf *first_bf, u_int qnum, u_int ix, int done) { - const struct ath_tx_status *ts = &first_bf->bf_last->bf_status.ds_txstat; + const struct ath_tx_status *ts = &first_bf->bf_status.ds_txstat; const struct ath_buf *bf = first_bf; struct ath_hal *ah = sc->sc_ah; const struct ath_desc *ds; @@ -206,16 +206,17 @@ ath_printtxbuf_legacy(struct ath_softc * printf("Q%u[%3u]", qnum, ix); while (bf != NULL) { + printf(" (bf=%p, lastds=%p)\n", bf, first_bf->bf_lastds); + printf(" Seq: %d swtry: %d ADDBAW?: %d DOBAW?: %d\n", + bf->bf_state.bfs_seqno, + bf->bf_state.bfs_retries, + bf->bf_state.bfs_addedbaw, + bf->bf_state.bfs_dobaw); for (i = 0, ds = bf->bf_desc; i < bf->bf_nseg; i++, ds++) { printf(" (DS.V:%p DS.P:%p) L:%08x D:%08x F:%04x%s\n", ds, (const struct ath_desc *)bf->bf_daddr + i, ds->ds_link, ds->ds_data, bf->bf_state.bfs_txflags, !done ? "" : (ts->ts_status == 0) ? " *" : " !"); - printf(" Seq: %d swtry: %d ADDBAW?: %d DOBAW?: %d\n", - bf->bf_state.bfs_seqno, - bf->bf_state.bfs_retries, - bf->bf_state.bfs_addedbaw, - bf->bf_state.bfs_dobaw); printf(" %08x %08x %08x %08x %08x %08x\n", ds->ds_ctl0, ds->ds_ctl1, ds->ds_hw[0], ds->ds_hw[1], From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 20:00:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD93C106566C; Mon, 24 Sep 2012 20:00:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C7E878FC16; Mon, 24 Sep 2012 20:00:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8OK0VjG087849; Mon, 24 Sep 2012 20:00:31 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8OK0Vfi087846; Mon, 24 Sep 2012 20:00:31 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201209242000.q8OK0Vfi087846@svn.freebsd.org> From: Dimitry Andric Date: Mon, 24 Sep 2012 20:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240896 - stable/9/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 20:00:32 -0000 Author: dim Date: Mon Sep 24 20:00:31 2012 New Revision: 240896 URL: http://svn.freebsd.org/changeset/base/240896 Log: MFC r240144: After r240104, make sure the hpt27xx driver also compiles with clang, when it is statically linked into the kernel. Modified: stable/9/sys/conf/files.amd64 stable/9/sys/conf/files.i386 Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/conf/files.amd64 ============================================================================== --- stable/9/sys/conf/files.amd64 Mon Sep 24 19:48:41 2012 (r240895) +++ stable/9/sys/conf/files.amd64 Mon Sep 24 20:00:31 2012 (r240896) @@ -192,7 +192,8 @@ dev/fdc/fdc_acpi.c optional fdc dev/fdc/fdc_isa.c optional fdc isa dev/fdc/fdc_pccard.c optional fdc pccard dev/hpt27xx/os_bsd.c optional hpt27xx -dev/hpt27xx/osm_bsd.c optional hpt27xx +dev/hpt27xx/osm_bsd.c optional hpt27xx \ + compile-with "${NORMAL_C} ${NO_WFORMAT_SECURITY}" dev/hpt27xx/hpt27xx_config.c optional hpt27xx dev/hptmv/entry.c optional hptmv dev/hptmv/mv.c optional hptmv Modified: stable/9/sys/conf/files.i386 ============================================================================== --- stable/9/sys/conf/files.i386 Mon Sep 24 19:48:41 2012 (r240895) +++ stable/9/sys/conf/files.i386 Mon Sep 24 20:00:31 2012 (r240896) @@ -180,7 +180,8 @@ dev/glxiic/glxiic.c optional glxiic dev/glxsb/glxsb.c optional glxsb dev/glxsb/glxsb_hash.c optional glxsb dev/hpt27xx/os_bsd.c optional hpt27xx -dev/hpt27xx/osm_bsd.c optional hpt27xx +dev/hpt27xx/osm_bsd.c optional hpt27xx \ + compile-with "${NORMAL_C} ${NO_WFORMAT_SECURITY}" dev/hpt27xx/hpt27xx_config.c optional hpt27xx dev/hptmv/entry.c optional hptmv dev/hptmv/mv.c optional hptmv From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 20:03:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C3FB7106566B; Mon, 24 Sep 2012 20:03:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE8258FC0C; Mon, 24 Sep 2012 20:03:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8OK3DGp088319; Mon, 24 Sep 2012 20:03:13 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8OK3Dfj088317; Mon, 24 Sep 2012 20:03:13 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201209242003.q8OK3Dfj088317@svn.freebsd.org> From: Dimitry Andric Date: Mon, 24 Sep 2012 20:03:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240897 - stable/9/contrib/llvm/lib/Target/X86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 20:03:13 -0000 Author: dim Date: Mon Sep 24 20:03:13 2012 New Revision: 240897 URL: http://svn.freebsd.org/changeset/base/240897 Log: MFC r240531: Pull in r163967 from upstream llvm trunk: X86: Emitting x87 fsin/fcos for sinf/cosf is not safe without unsafe fp math. This should make clang emit calls to libm for sinf/cosf by default. Modified: stable/9/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Directory Properties: stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Mon Sep 24 20:00:31 2012 (r240896) +++ stable/9/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Mon Sep 24 20:03:13 2012 (r240897) @@ -641,7 +641,9 @@ X86TargetLowering::X86TargetLowering(X86 setOperationAction(ISD::FCOPYSIGN, MVT::f32, Expand); if (!TM.Options.UnsafeFPMath) { + setOperationAction(ISD::FSIN , MVT::f32 , Expand); setOperationAction(ISD::FSIN , MVT::f64 , Expand); + setOperationAction(ISD::FCOS , MVT::f32 , Expand); setOperationAction(ISD::FCOS , MVT::f64 , Expand); } addLegalFPImmediate(APFloat(+0.0)); // FLD0 From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 20:05:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96581106566B; Mon, 24 Sep 2012 20:05:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8192A8FC0C; Mon, 24 Sep 2012 20:05:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8OK5q1q088775; Mon, 24 Sep 2012 20:05:52 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8OK5qdv088772; Mon, 24 Sep 2012 20:05:52 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201209242005.q8OK5qdv088772@svn.freebsd.org> From: Dimitry Andric Date: Mon, 24 Sep 2012 20:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240898 - in stable/9/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 20:05:52 -0000 Author: dim Date: Mon Sep 24 20:05:52 2012 New Revision: 240898 URL: http://svn.freebsd.org/changeset/base/240898 Log: MFC r240773: After r205013, amd64 and i386 CPU family and model IDs were printed out in hexadecimal, but without any 0x prefix, which can be very misleading. Modified: stable/9/sys/amd64/amd64/identcpu.c stable/9/sys/i386/i386/identcpu.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/identcpu.c ============================================================================== --- stable/9/sys/amd64/amd64/identcpu.c Mon Sep 24 20:03:13 2012 (r240897) +++ stable/9/sys/amd64/amd64/identcpu.c Mon Sep 24 20:05:52 2012 (r240898) @@ -213,8 +213,8 @@ printcpuinfo(void) if (cpu_vendor_id == CPU_VENDOR_INTEL || cpu_vendor_id == CPU_VENDOR_AMD || cpu_vendor_id == CPU_VENDOR_CENTAUR) { - printf(" Family = %x", CPUID_TO_FAMILY(cpu_id)); - printf(" Model = %x", CPUID_TO_MODEL(cpu_id)); + printf(" Family = 0x%x", CPUID_TO_FAMILY(cpu_id)); + printf(" Model = 0x%x", CPUID_TO_MODEL(cpu_id)); printf(" Stepping = %u", cpu_id & CPUID_STEPPING); /* Modified: stable/9/sys/i386/i386/identcpu.c ============================================================================== --- stable/9/sys/i386/i386/identcpu.c Mon Sep 24 20:03:13 2012 (r240897) +++ stable/9/sys/i386/i386/identcpu.c Mon Sep 24 20:05:52 2012 (r240898) @@ -688,8 +688,8 @@ printcpuinfo(void) cpu_vendor_id == CPU_VENDOR_NSC || (cpu_vendor_id == CPU_VENDOR_CYRIX && ((cpu_id & 0xf00) > 0x500))) { - printf(" Family = %x", CPUID_TO_FAMILY(cpu_id)); - printf(" Model = %x", CPUID_TO_MODEL(cpu_id)); + printf(" Family = 0x%x", CPUID_TO_FAMILY(cpu_id)); + printf(" Model = 0x%x", CPUID_TO_MODEL(cpu_id)); printf(" Stepping = %u", cpu_id & CPUID_STEPPING); if (cpu_vendor_id == CPU_VENDOR_CYRIX) printf("\n DIR=0x%04x", cyrix_did); From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 20:35:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 700BF106566B; Mon, 24 Sep 2012 20:35:57 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 508138FC0A; Mon, 24 Sep 2012 20:35:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8OKZvJ2093780; Mon, 24 Sep 2012 20:35:57 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8OKZvUM093772; Mon, 24 Sep 2012 20:35:57 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201209242035.q8OKZvUM093772@svn.freebsd.org> From: Adrian Chadd Date: Mon, 24 Sep 2012 20:35:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240899 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 20:35:57 -0000 Author: adrian Date: Mon Sep 24 20:35:56 2012 New Revision: 240899 URL: http://svn.freebsd.org/changeset/base/240899 Log: Migrate the ath(4) KTR logging to use an ATH_KTR() macro. This should eventually be unified with ATH_DEBUG() so I can get both from one macro; that may take some time. Add some new probes for TX and TX completion. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_debug.h head/sys/dev/ath/if_ath_rx.c head/sys/dev/ath/if_ath_rx_edma.c head/sys/dev/ath/if_ath_sysctl.c head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Sep 24 20:05:52 2012 (r240898) +++ head/sys/dev/ath/if_ath.c Mon Sep 24 20:35:56 2012 (r240899) @@ -1519,9 +1519,9 @@ ath_intr(void *arg) */ ath_hal_getisr(ah, &status); /* NB: clears ISR too */ DPRINTF(sc, ATH_DEBUG_INTR, "%s: status 0x%x\n", __func__, status); - CTR1(ATH_KTR_INTR, "ath_intr: mask=0x%.8x", status); + ATH_KTR(sc, ATH_KTR_INTERRUPTS, 1, "ath_intr: mask=0x%.8x", status); #ifdef ATH_KTR_INTR_DEBUG - CTR5(ATH_KTR_INTR, + ATH_KTR(sc, ATH_KTR_INTERRUPTS, 5, "ath_intr: ISR=0x%.8x, ISR_S0=0x%.8x, ISR_S1=0x%.8x, ISR_S2=0x%.8x, ISR_S5=0x%.8x", ah->ah_intrstate[0], ah->ah_intrstate[1], @@ -1597,7 +1597,7 @@ ath_intr(void *arg) } if (status & HAL_INT_RXEOL) { int imask; - CTR0(ATH_KTR_ERR, "ath_intr: RXEOL"); + ATH_KTR(sc, ATH_KTR_ERROR, 0, "ath_intr: RXEOL"); ATH_PCU_LOCK(sc); /* * NB: the hardware should re-read the link when @@ -1663,6 +1663,11 @@ ath_intr(void *arg) ATH_PCU_LOCK(sc); txqs = 0xffffffff; ath_hal_gettxintrtxqs(sc->sc_ah, &txqs); + ATH_KTR(sc, ATH_KTR_INTERRUPTS, 3, + "ath_intr: TX; txqs=0x%08x, txq_active was 0x%08x, now 0x%08x", + txqs, + sc->sc_txq_active, + sc->sc_txq_active | txqs); sc->sc_txq_active |= txqs; ATH_PCU_UNLOCK(sc); } @@ -1701,7 +1706,7 @@ ath_intr(void *arg) } if (status & HAL_INT_RXORN) { /* NB: hal marks HAL_INT_FATAL when RXORN is fatal */ - CTR0(ATH_KTR_ERR, "ath_intr: RXORN"); + ATH_KTR(sc, ATH_KTR_ERROR, 0, "ath_intr: RXORN"); sc->sc_stats.ast_rxorn++; } } @@ -3637,6 +3642,14 @@ ath_tx_processq(struct ath_softc *sc, st __func__, txq->axq_qnum, (caddr_t)(uintptr_t) ath_hal_gettxbuf(sc->sc_ah, txq->axq_qnum), txq->axq_link); + + ATH_KTR(sc, ATH_KTR_TXCOMP, 4, + "ath_tx_processq: txq=%u head %p link %p depth %p", + txq->axq_qnum, + (caddr_t)(uintptr_t) ath_hal_gettxbuf(sc->sc_ah, txq->axq_qnum), + txq->axq_link, + txq->axq_depth); + nacked = 0; for (;;) { ATH_TXQ_LOCK(txq); @@ -3648,17 +3661,21 @@ ath_tx_processq(struct ath_softc *sc, st } ds = bf->bf_lastds; /* XXX must be setup correctly! */ ts = &bf->bf_status.ds_txstat; + status = ath_hal_txprocdesc(ah, ds, ts); #ifdef ATH_DEBUG if (sc->sc_debug & ATH_DEBUG_XMIT_DESC) ath_printtxbuf(sc, bf, txq->axq_qnum, 0, status == HAL_OK); - else if ((sc->sc_debug & ATH_DEBUG_RESET) && (dosched == 0)) { + else if ((sc->sc_debug & ATH_DEBUG_RESET) && (dosched == 0)) ath_printtxbuf(sc, bf, txq->axq_qnum, 0, status == HAL_OK); - } #endif + if (status == HAL_EINPROGRESS) { + ATH_KTR(sc, ATH_KTR_TXCOMP, 3, + "ath_tx_processq: txq=%u, bf=%p ds=%p, HAL_EINPROGRESS", + txq->axq_qnum, bf, ds); ATH_TXQ_UNLOCK(txq); break; } @@ -3684,6 +3701,10 @@ ath_tx_processq(struct ath_softc *sc, st txq->axq_aggr_depth--; ni = bf->bf_node; + + ATH_KTR(sc, ATH_KTR_TXCOMP, 5, + "ath_tx_processq: txq=%u, bf=%p, ds=%p, ni=%p, ts_status=0x%08x", + txq->axq_qnum, bf, ds, ni, ts->ts_status); /* * If unicast frame was ack'd update RSSI, * including the last rx time used to @@ -3702,8 +3723,6 @@ ath_tx_processq(struct ath_softc *sc, st * Update statistics and call completion */ ath_tx_process_buf_completion(sc, txq, ts, bf); - - } #ifdef IEEE80211_SUPPORT_SUPERG /* @@ -3720,6 +3739,10 @@ ath_tx_processq(struct ath_softc *sc, st ATH_TXQ_UNLOCK(txq); } + ATH_KTR(sc, ATH_KTR_TXCOMP, 1, + "ath_tx_processq: txq=%u: done", + txq->axq_qnum); + return nacked; } @@ -3742,6 +3765,9 @@ ath_tx_proc_q0(void *arg, int npending) sc->sc_txq_active &= ~txqs; ATH_PCU_UNLOCK(sc); + ATH_KTR(sc, ATH_KTR_TXCOMP, 1, + "ath_tx_proc_q0: txqs=0x%08x", txqs); + if (TXQACTIVE(txqs, 0) && ath_tx_processq(sc, &sc->sc_txq[0], 1)) /* XXX why is lastrx updated in tx code? */ sc->sc_lastrx = ath_hal_gettsf64(sc->sc_ah); @@ -3780,6 +3806,9 @@ ath_tx_proc_q0123(void *arg, int npendin sc->sc_txq_active &= ~txqs; ATH_PCU_UNLOCK(sc); + ATH_KTR(sc, ATH_KTR_TXCOMP, 1, + "ath_tx_proc_q0123: txqs=0x%08x", txqs); + /* * Process each active queue. */ @@ -3829,6 +3858,8 @@ ath_tx_proc(void *arg, int npending) sc->sc_txq_active &= ~txqs; ATH_PCU_UNLOCK(sc); + ATH_KTR(sc, ATH_KTR_TXCOMP, 1, "ath_tx_proc: txqs=0x%08x", txqs); + /* * Process each active queue. */ Modified: head/sys/dev/ath/if_ath_debug.h ============================================================================== --- head/sys/dev/ath/if_ath_debug.h Mon Sep 24 20:05:52 2012 (r240898) +++ head/sys/dev/ath/if_ath_debug.h Mon Sep 24 20:35:56 2012 (r240899) @@ -70,8 +70,21 @@ enum { ATH_DEBUG_ANY = 0xffffffffffffffffULL }; -#define ATH_KTR_INTR KTR_SPARE4 -#define ATH_KTR_ERR KTR_SPARE3 +enum { + ATH_KTR_RXPROC = 0x00000001, + ATH_KTR_TXPROC = 0x00000002, + ATH_KTR_TXCOMP = 0x00000004, + ATH_KTR_SWQ = 0x00000008, + ATH_KTR_INTERRUPTS = 0x00000010, + ATH_KTR_ERROR = 0x00000020, + ATH_KTR_NODE = 0x00000040, + ATH_KTR_TX = 0x00000080, +}; + +#define ATH_KTR(_sc, _km, _kf, ...) do { \ + if (sc->sc_ktrdebug & (_km)) \ + CTR##_kf(KTR_DEV, __VA_ARGS__); \ + } while (0) extern uint64_t ath_debug; @@ -92,8 +105,7 @@ extern void ath_printrxbuf(struct ath_so extern void ath_printtxbuf(struct ath_softc *, const struct ath_buf *bf, u_int qnum, u_int ix, int done); #else /* ATH_DEBUG */ -#define ATH_KTR_INTR 0 -#define ATH_KTR_ERR 0 +#define ATH_KTR(_sc, _km, _kf, ...) do { } while (0) #define IFF_DUMPPKTS(sc, m) \ ((sc->sc_ifp->if_flags & (IFF_DEBUG|IFF_LINK2)) == (IFF_DEBUG|IFF_LINK2)) Modified: head/sys/dev/ath/if_ath_rx.c ============================================================================== --- head/sys/dev/ath/if_ath_rx.c Mon Sep 24 20:05:52 2012 (r240898) +++ head/sys/dev/ath/if_ath_rx.c Mon Sep 24 20:35:56 2012 (r240899) @@ -900,7 +900,7 @@ rx_proc_next: if (ngood) sc->sc_lastrx = tsf; - CTR2(ATH_KTR_INTR, "ath_rx_proc: npkts=%d, ngood=%d", npkts, ngood); + ATH_KTR(sc, ATH_KTR_RXPROC, 2, "ath_rx_proc: npkts=%d, ngood=%d", npkts, ngood); /* Queue DFS tasklet if needed */ if (resched && ath_dfs_tasklet_needed(sc, sc->sc_curchan)) taskqueue_enqueue(sc->sc_tq, &sc->sc_dfstask); @@ -912,7 +912,7 @@ rx_proc_next: */ ATH_PCU_LOCK(sc); if (resched && sc->sc_kickpcu) { - CTR0(ATH_KTR_ERR, "ath_rx_proc: kickpcu"); + ATH_KTR(sc, ATH_KTR_ERROR, 0, "ath_rx_proc: kickpcu"); device_printf(sc->sc_dev, "%s: kickpcu; handled %d packets\n", __func__, npkts); @@ -957,7 +957,7 @@ ath_legacy_rx_tasklet(void *arg, int npe { struct ath_softc *sc = arg; - CTR1(ATH_KTR_INTR, "ath_rx_proc: pending=%d", npending); + ATH_KTR(sc, ATH_KTR_RXPROC, 1, "ath_rx_proc: pending=%d", npending); DPRINTF(sc, ATH_DEBUG_RX_PROC, "%s: pending %u\n", __func__, npending); ATH_PCU_LOCK(sc); if (sc->sc_inreset_cnt > 0) { Modified: head/sys/dev/ath/if_ath_rx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_rx_edma.c Mon Sep 24 20:05:52 2012 (r240898) +++ head/sys/dev/ath/if_ath_rx_edma.c Mon Sep 24 20:35:56 2012 (r240899) @@ -421,13 +421,15 @@ ath_edma_recv_proc_queue(struct ath_soft if (ngood) sc->sc_lastrx = tsf; - CTR2(ATH_KTR_INTR, "ath edma rx proc: npkts=%d, ngood=%d", + 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) { - CTR0(ATH_KTR_ERR, "ath_edma_recv_proc_queue(): 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); Modified: head/sys/dev/ath/if_ath_sysctl.c ============================================================================== --- head/sys/dev/ath/if_ath_sysctl.c Mon Sep 24 20:05:52 2012 (r240898) +++ head/sys/dev/ath/if_ath_sysctl.c Mon Sep 24 20:35:56 2012 (r240899) @@ -518,6 +518,9 @@ ath_sysctlattach(struct ath_softc *sc) SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "debug", CTLFLAG_RW, &sc->sc_debug, "control debugging printfs"); + SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "ktrdebug", CTLFLAG_RW, &sc->sc_ktrdebug, + "control debugging KTR"); #endif SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "slottime", CTLTYPE_INT | CTLFLAG_RW, sc, 0, Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Mon Sep 24 20:05:52 2012 (r240898) +++ head/sys/dev/ath/if_ath_tx.c Mon Sep 24 20:35:56 2012 (r240899) @@ -722,6 +722,10 @@ ath_tx_handoff_hw(struct ath_softc *sc, ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); qbusy = ath_hal_txqenabled(ah, txq->axq_qnum); + + ATH_KTR(sc, ATH_KTR_TX, 4, + "ath_tx_handoff: txq=%u, add bf=%p, qbusy=%d, depth=%d", + txq->axq_qnum, bf, qbusy, txq->axq_depth); if (txq->axq_link == NULL) { /* * Be careful writing the address to TXDP. If @@ -738,15 +742,24 @@ ath_tx_handoff_hw(struct ath_softc *sc, bf->bf_daddr); txq->axq_flags &= ~ATH_TXQ_PUTPENDING; DPRINTF(sc, ATH_DEBUG_XMIT, - "%s: TXDP[%u] = %p (%p) depth %d\n", + "%s: TXDP[%u] = %p (%p) lastds=%p depth %d\n", __func__, txq->axq_qnum, (caddr_t)bf->bf_daddr, bf->bf_desc, + bf->bf_lastds, + txq->axq_depth); + ATH_KTR(sc, ATH_KTR_TX, 5, + "ath_tx_handoff: TXDP[%u] = %p (%p) " + "lastds=%p depth %d", + txq->axq_qnum, + (caddr_t)bf->bf_daddr, bf->bf_desc, + bf->bf_lastds, txq->axq_depth); } else { txq->axq_flags |= ATH_TXQ_PUTPENDING; DPRINTF(sc, ATH_DEBUG_TDMA | ATH_DEBUG_XMIT, "%s: Q%u busy, defer enable\n", __func__, txq->axq_qnum); + ATH_KTR(sc, ATH_KTR_TX, 0, "defer enable"); } } else { *txq->axq_link = bf->bf_daddr; @@ -755,6 +768,12 @@ ath_tx_handoff_hw(struct ath_softc *sc, txq->axq_qnum, txq->axq_link, (caddr_t)bf->bf_daddr, bf->bf_desc, txq->axq_depth); + ATH_KTR(sc, ATH_KTR_TX, 5, + "ath_tx_handoff: link[%u](%p)=%p (%p) lastds=%p", + txq->axq_qnum, txq->axq_link, + (caddr_t)bf->bf_daddr, bf->bf_desc, + bf->bf_lastds); + if ((txq->axq_flags & ATH_TXQ_PUTPENDING) && !qbusy) { /* * The q was busy when we previously tried @@ -771,10 +790,24 @@ ath_tx_handoff_hw(struct ath_softc *sc, DPRINTF(sc, ATH_DEBUG_TDMA | ATH_DEBUG_XMIT, "%s: Q%u restarted\n", __func__, txq->axq_qnum); + ATH_KTR(sc, ATH_KTR_TX, 4, + "ath_tx_handoff: txq[%d] restarted, bf=%p " + "daddr=%p ds=%p", + txq->axq_qnum, + bf, + (caddr_t)bf->bf_daddr, + bf->bf_desc); } } #else ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); + ATH_KTR(sc, ATH_KTR_TX, 4, + "ath_tx_handoff: non-tdma: txq=%u, add bf=%p, qbusy=%d, " + "depth=%d", + txq->axq_qnum, + bf, + qbusy, + txq->axq_depth); if (txq->axq_link == NULL) { ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); DPRINTF(sc, ATH_DEBUG_XMIT, @@ -782,6 +815,14 @@ ath_tx_handoff_hw(struct ath_softc *sc, __func__, txq->axq_qnum, (caddr_t)bf->bf_daddr, bf->bf_desc, txq->axq_depth); + ATH_KTR(sc, ATH_KTR_TX, 5, + "ath_tx_handoff: non-tdma: TXDP[%u] = %p (%p) " + "lastds=%p depth %d", + txq->axq_qnum, + (caddr_t)bf->bf_daddr, bf->bf_desc, + bf->bf_lastds, + txq->axq_depth); + } else { *txq->axq_link = bf->bf_daddr; DPRINTF(sc, ATH_DEBUG_XMIT, @@ -789,12 +830,21 @@ ath_tx_handoff_hw(struct ath_softc *sc, txq->axq_qnum, txq->axq_link, (caddr_t)bf->bf_daddr, bf->bf_desc, txq->axq_depth); + ATH_KTR(sc, ATH_KTR_TX, 5, + "ath_tx_handoff: non-tdma: link[%u](%p)=%p (%p) " + "lastds=%d", + txq->axq_qnum, txq->axq_link, + (caddr_t)bf->bf_daddr, bf->bf_desc, + bf->bf_lastds); + } #endif /* IEEE80211_SUPPORT_TDMA */ if (bf->bf_state.bfs_aggr) txq->axq_aggr_depth++; ath_hal_gettxdesclinkptr(ah, bf->bf_lastds, &txq->axq_link); ath_hal_txstart(ah, txq->axq_qnum); + ATH_KTR(sc, ATH_KTR_TX, 1, + "ath_tx_handoff: txq=%u, txstart", txq->axq_qnum); } } @@ -1875,6 +1925,9 @@ ath_tx_raw_start(struct ath_softc *sc, s /* XXX honor IEEE80211_BPF_DATAPAD */ pktlen = m0->m_pkthdr.len - (hdrlen & 3) + IEEE80211_CRC_LEN; + ATH_KTR(sc, ATH_KTR_TX, 2, + "ath_tx_raw_start: ni=%p, bf=%p, raw", ni, bf); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: ismcast=%d\n", __func__, ismcast); @@ -2132,6 +2185,8 @@ ath_raw_xmit(struct ieee80211_node *ni, error = ENOBUFS; goto bad; } + ATH_KTR(sc, ATH_KTR_TX, 3, "ath_raw_xmit: m=%p, params=%p, bf=%p\n", + m, params, bf); if (params == NULL) { /* @@ -2162,6 +2217,11 @@ ath_raw_xmit(struct ieee80211_node *ni, return 0; bad2: + ATH_KTR(sc, ATH_KTR_TX, 3, "ath_raw_xmit: bad2: m=%p, params=%p, " + "bf=%p", + m, + params, + bf); ATH_TXBUF_LOCK(sc); ath_returnbuf_head(sc, bf); ATH_TXBUF_UNLOCK(sc); @@ -2170,6 +2230,8 @@ bad: sc->sc_txstart_cnt--; ATH_PCU_UNLOCK(sc); bad0: + ATH_KTR(sc, ATH_KTR_TX, 2, "ath_raw_xmit: bad0: m=%p, params=%p", + m, params); ifp->if_oerrors++; sc->sc_stats.ast_tx_raw_fail++; ieee80211_free_node(ni); @@ -2752,6 +2814,7 @@ ath_tx_swq(struct ath_softc *sc, struct DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: ampdu; swq'ing\n", __func__); + ath_tx_tid_sched(sc, atid); } } else if (txq->axq_depth < sc->sc_hwq_limit) { @@ -3240,7 +3303,7 @@ ath_tx_tid_drain_pkt(struct ath_softc *s static void ath_tx_tid_drain_print(struct ath_softc *sc, struct ath_node *an, - struct ath_tid *tid, struct ath_buf *bf) + const char *pfx, struct ath_tid *tid, struct ath_buf *bf) { struct ieee80211_node *ni = &an->an_node; struct ath_txq *txq = sc->sc_ac2q[tid->ac]; @@ -3249,18 +3312,19 @@ ath_tx_tid_drain_print(struct ath_softc tap = ath_tx_get_tx_tid(an, tid->tid); device_printf(sc->sc_dev, - "%s: node %p: bf=%p: addbaw=%d, dobaw=%d, " + "%s: %s: node %p: bf=%p: addbaw=%d, dobaw=%d, " "seqno=%d, retry=%d\n", - __func__, ni, bf, + __func__, pfx, ni, bf, bf->bf_state.bfs_addedbaw, bf->bf_state.bfs_dobaw, SEQNO(bf->bf_state.bfs_seqno), bf->bf_state.bfs_retries); device_printf(sc->sc_dev, - "%s: node %p: bf=%p: txq axq_depth=%d, axq_aggr_depth=%d\n", + "%s: node %p: bf=%p: txq[%d] axq_depth=%d, axq_aggr_depth=%d\n", __func__, ni, bf, - txq->axq_depth, - txq->axq_aggr_depth); + txq->axq_qnum, + txq->axq_depth, + txq->axq_aggr_depth); device_printf(sc->sc_dev, "%s: node %p: bf=%p: tid txq_depth=%d hwq_depth=%d, bar_wait=%d, isfiltered=%d\n", @@ -3323,7 +3387,7 @@ ath_tx_tid_drain(struct ath_softc *sc, s } if (t == 0) { - ath_tx_tid_drain_print(sc, an, tid, bf); + ath_tx_tid_drain_print(sc, an, "norm", tid, bf); t = 1; } @@ -3339,7 +3403,7 @@ ath_tx_tid_drain(struct ath_softc *sc, s break; if (t == 0) { - ath_tx_tid_drain_print(sc, an, tid, bf); + ath_tx_tid_drain_print(sc, an, "filt", tid, bf); t = 1; } @@ -3397,6 +3461,9 @@ ath_tx_node_flush(struct ath_softc *sc, TAILQ_INIT(&bf_cq); + ATH_KTR(sc, ATH_KTR_NODE, 1, "ath_tx_node_flush: flush node; ni=%p", + &an->an_node); + for (tid = 0; tid < IEEE80211_TID_SIZE; tid++) { struct ath_tid *atid = &an->an_tid[tid]; struct ath_txq *txq = sc->sc_ac2q[atid->ac]; Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Sep 24 20:05:52 2012 (r240898) +++ head/sys/dev/ath/if_athvar.h Mon Sep 24 20:35:56 2012 (r240899) @@ -445,6 +445,7 @@ struct ath_softc { struct ath_tx_aggr_stats sc_aggr_stats; struct ath_intr_stats sc_intr_stats; uint64_t sc_debug; + uint64_t sc_ktrdebug; int sc_nvaps; /* # vaps */ int sc_nstavaps; /* # station vaps */ int sc_nmeshvaps; /* # mbss vaps */ From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 21:40:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21000106566C; Mon, 24 Sep 2012 21:40:22 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4A918FC16; Mon, 24 Sep 2012 21:40:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8OLeMGm005382; Mon, 24 Sep 2012 21:40:22 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8OLeM8j005379; Mon, 24 Sep 2012 21:40:22 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201209242140.q8OLeM8j005379@svn.freebsd.org> From: Jim Harris Date: Mon, 24 Sep 2012 21:40:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240900 - head/sys/dev/tws X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 21:40:23 -0000 Author: jimharris Date: Mon Sep 24 21:40:22 2012 New Revision: 240900 URL: http://svn.freebsd.org/changeset/base/240900 Log: Specify MTX_RECURSE for the controller's io_lock. Without it, tws(4) immediately panics on boot with INVARIANTS enabled. The driver already clearly expects to be able to recurse on this mutex - the main I/O is always recursing on this lock. Reported and tested by: Mike Tancsa MFC after: 1 week Modified: head/sys/dev/tws/tws.c Modified: head/sys/dev/tws/tws.c ============================================================================== --- head/sys/dev/tws/tws.c Mon Sep 24 20:35:56 2012 (r240899) +++ head/sys/dev/tws/tws.c Mon Sep 24 21:40:22 2012 (r240900) @@ -197,7 +197,7 @@ tws_attach(device_t dev) mtx_init( &sc->q_lock, "tws_q_lock", NULL, MTX_DEF); mtx_init( &sc->sim_lock, "tws_sim_lock", NULL, MTX_DEF); mtx_init( &sc->gen_lock, "tws_gen_lock", NULL, MTX_DEF); - mtx_init( &sc->io_lock, "tws_io_lock", NULL, MTX_DEF); + mtx_init( &sc->io_lock, "tws_io_lock", NULL, MTX_DEF | MTX_RECURSE); if ( tws_init_trace_q(sc) == FAILURE ) printf("trace init failure\n"); From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 21:45:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B7C6106564A; Mon, 24 Sep 2012 21:45:42 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26D378FC16; Mon, 24 Sep 2012 21:45:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8OLjgHk006129; Mon, 24 Sep 2012 21:45:42 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8OLjffi006127; Mon, 24 Sep 2012 21:45:41 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201209242145.q8OLjffi006127@svn.freebsd.org> From: Jim Harris Date: Mon, 24 Sep 2012 21:45:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240901 - head/sys/dev/tws X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 21:45:42 -0000 Author: jimharris Date: Mon Sep 24 21:45:41 2012 New Revision: 240901 URL: http://svn.freebsd.org/changeset/base/240901 Log: Use CAM_SEL_TIMEOUT and CAM_DEV_NOT_THERE to report missing targets or LUNs respectively. This removes a huge number of error messages from CAM during bus scans. Copied almost verbatim from mav's commit r237460. Submitted by: Mike Tancsa MFC after: 3 days Modified: head/sys/dev/tws/tws_cam.c Modified: head/sys/dev/tws/tws_cam.c ============================================================================== --- head/sys/dev/tws/tws_cam.c Mon Sep 24 21:40:22 2012 (r240900) +++ head/sys/dev/tws/tws_cam.c Mon Sep 24 21:45:41 2012 (r240901) @@ -529,10 +529,10 @@ tws_scsi_err_complete(struct tws_request if ( ccb->ccb_h.target_lun ) { TWS_TRACE_DEBUG(sc, "invalid lun error",0,0); - ccb->ccb_h.status |= CAM_LUN_INVALID; + ccb->ccb_h.status |= CAM_DEV_NOT_THERE; } else { TWS_TRACE_DEBUG(sc, "invalid target error",0,0); - ccb->ccb_h.status |= CAM_TID_INVALID; + ccb->ccb_h.status |= CAM_SEL_TIMEOUT; } } else { From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 23:57:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31A08106564A; Mon, 24 Sep 2012 23:57:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C74C8FC0A; Mon, 24 Sep 2012 23:57:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8ONvGB3025305; Mon, 24 Sep 2012 23:57:16 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8ONvGbs025303; Mon, 24 Sep 2012 23:57:16 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201209242357.q8ONvGbs025303@svn.freebsd.org> From: Rick Macklem Date: Mon, 24 Sep 2012 23:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240902 - head/usr.sbin/mountd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 23:57:17 -0000 Author: rmacklem Date: Mon Sep 24 23:57:16 2012 New Revision: 240902 URL: http://svn.freebsd.org/changeset/base/240902 Log: Attila Bogar reported a bug in mountd when multiple export entries with different security flavors are in the exports(5) file. For that case, mountd replies with the security flavors of the last entry and not the correct one for the client host. This patch fixes that by storing separate copies of the flavors for each host/net case, plus a default one for the case where no hosts/nets are specified on an entry in the exports(5) file. Unlike the patch in the PR, it replies with the security flavors for the entry instead of merging the security flavors for all the entries and replying with that. Tested by: attila.bogar at linguamatics.com PR: kern/164933 MFC after: 2 weeks Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Mon Sep 24 21:45:41 2012 (r240901) +++ head/usr.sbin/mountd/mountd.c Mon Sep 24 23:57:16 2012 (r240902) @@ -117,6 +117,8 @@ struct exportlist { char *ex_indexfile; int ex_numsecflavors; int ex_secflavors[MAXSECFLAVORS]; + int ex_defnumsecflavors; + int ex_defsecflavors[MAXSECFLAVORS]; }; /* ex_flag bits */ #define EX_LINKED 0x1 @@ -136,6 +138,8 @@ struct grouplist { int gr_type; union grouptypes gr_ptr; struct grouplist *gr_next; + int gr_numsecflavors; + int gr_secflavors[MAXSECFLAVORS]; }; /* Group types */ #define GT_NULL 0x0 @@ -163,12 +167,13 @@ struct fhreturn { /* Global defs */ char *add_expdir(struct dirlist **, char *, int); void add_dlist(struct dirlist **, struct dirlist *, - struct grouplist *, int); + struct grouplist *, int, struct exportlist *); void add_mlist(char *, char *); int check_dirpath(char *); int check_options(struct dirlist *); int checkmask(struct sockaddr *sa); -int chk_host(struct dirlist *, struct sockaddr *, int *, int *); +int chk_host(struct dirlist *, struct sockaddr *, int *, int *, int *, + int **); static int create_service(struct netconfig *nconf); static void complete_service(struct netconfig *nconf, char *port_str); static void clearout_service(void); @@ -938,6 +943,7 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t char rpcpath[MNTPATHLEN + 1], dirpath[MAXPATHLEN]; int bad = 0, defset, hostset; sigset_t sighup_mask; + int numsecflavors, *secflavorsp; sigemptyset(&sighup_mask); sigaddset(&sighup_mask, SIGHUP); @@ -1000,9 +1006,11 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t sigprocmask(SIG_BLOCK, &sighup_mask, NULL); ep = ex_search(&fsb.f_fsid); hostset = defset = 0; - if (ep && (chk_host(ep->ex_defdir, saddr, &defset, &hostset) || + if (ep && (chk_host(ep->ex_defdir, saddr, &defset, &hostset, + &numsecflavors, &secflavorsp) || ((dp = dirp_search(ep->ex_dirl, dirpath)) && - chk_host(dp, saddr, &defset, &hostset)) || + chk_host(dp, saddr, &defset, &hostset, &numsecflavors, + &secflavorsp)) || (defset && scan_tree(ep->ex_defdir, saddr) == 0 && scan_tree(ep->ex_dirl, saddr) == 0))) { if (bad) { @@ -1012,10 +1020,15 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL); return; } - if (hostset & DP_HOSTSET) + if (hostset & DP_HOSTSET) { fhr.fhr_flag = hostset; - else + fhr.fhr_numsecflavors = numsecflavors; + fhr.fhr_secflavors = secflavorsp; + } else { fhr.fhr_flag = defset; + fhr.fhr_numsecflavors = ep->ex_defnumsecflavors; + fhr.fhr_secflavors = ep->ex_defsecflavors; + } fhr.fhr_vers = rqstp->rq_vers; /* Get the file handle */ memset(&fhr.fhr_fh, 0, sizeof(nfsfh_t)); @@ -1028,8 +1041,6 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL); return; } - fhr.fhr_numsecflavors = ep->ex_numsecflavors; - fhr.fhr_secflavors = ep->ex_secflavors; if (!svc_sendreply(transp, (xdrproc_t)xdr_fhs, (caddr_t)&fhr)) syslog(LOG_ERR, "can't send reply"); @@ -1881,11 +1892,21 @@ hang_dirp(struct dirlist *dp, struct gro ep->ex_defdir = dp; if (grp == (struct grouplist *)NULL) { ep->ex_defdir->dp_flag |= DP_DEFSET; + /* Save the default security flavors list. */ + ep->ex_defnumsecflavors = ep->ex_numsecflavors; + if (ep->ex_numsecflavors > 0) + memcpy(ep->ex_defsecflavors, ep->ex_secflavors, + sizeof(ep->ex_secflavors)); } else while (grp) { hp = get_ht(); hp->ht_grp = grp; hp->ht_next = ep->ex_defdir->dp_hosts; ep->ex_defdir->dp_hosts = hp; + /* Save the security flavors list for this host set. */ + grp->gr_numsecflavors = ep->ex_numsecflavors; + if (ep->ex_numsecflavors > 0) + memcpy(grp->gr_secflavors, ep->ex_secflavors, + sizeof(ep->ex_secflavors)); grp = grp->gr_next; } } else { @@ -1895,7 +1916,7 @@ hang_dirp(struct dirlist *dp, struct gro */ while (dp) { dp2 = dp->dp_left; - add_dlist(&ep->ex_dirl, dp, grp, flags); + add_dlist(&ep->ex_dirl, dp, grp, flags, ep); dp = dp2; } } @@ -1907,7 +1928,7 @@ hang_dirp(struct dirlist *dp, struct gro */ void add_dlist(struct dirlist **dpp, struct dirlist *newdp, struct grouplist *grp, - int flags) + int flags, struct exportlist *ep) { struct dirlist *dp; struct hostlist *hp; @@ -1917,10 +1938,10 @@ add_dlist(struct dirlist **dpp, struct d if (dp) { cmp = strcmp(dp->dp_dirp, newdp->dp_dirp); if (cmp > 0) { - add_dlist(&dp->dp_left, newdp, grp, flags); + add_dlist(&dp->dp_left, newdp, grp, flags, ep); return; } else if (cmp < 0) { - add_dlist(&dp->dp_right, newdp, grp, flags); + add_dlist(&dp->dp_right, newdp, grp, flags, ep); return; } else free((caddr_t)newdp); @@ -1939,10 +1960,20 @@ add_dlist(struct dirlist **dpp, struct d hp->ht_grp = grp; hp->ht_next = dp->dp_hosts; dp->dp_hosts = hp; + /* Save the security flavors list for this host set. */ + grp->gr_numsecflavors = ep->ex_numsecflavors; + if (ep->ex_numsecflavors > 0) + memcpy(grp->gr_secflavors, ep->ex_secflavors, + sizeof(ep->ex_secflavors)); grp = grp->gr_next; } while (grp); } else { dp->dp_flag |= DP_DEFSET; + /* Save the default security flavors list. */ + ep->ex_defnumsecflavors = ep->ex_numsecflavors; + if (ep->ex_numsecflavors > 0) + memcpy(ep->ex_defsecflavors, ep->ex_secflavors, + sizeof(ep->ex_secflavors)); } } @@ -1971,7 +2002,7 @@ dirp_search(struct dirlist *dp, char *di */ int chk_host(struct dirlist *dp, struct sockaddr *saddr, int *defsetp, - int *hostsetp) + int *hostsetp, int *numsecflavors, int **secflavorsp) { struct hostlist *hp; struct grouplist *grp; @@ -1990,6 +2021,12 @@ chk_host(struct dirlist *dp, struct sock if (!sacmp(ai->ai_addr, saddr, NULL)) { *hostsetp = (hp->ht_flag | DP_HOSTSET); + if (numsecflavors != NULL) { + *numsecflavors = + grp->gr_numsecflavors; + *secflavorsp = + grp->gr_secflavors; + } return (1); } } @@ -2000,6 +2037,12 @@ chk_host(struct dirlist *dp, struct sock (struct sockaddr *) &grp->gr_ptr.gt_net.nt_mask)) { *hostsetp = (hp->ht_flag | DP_HOSTSET); + if (numsecflavors != NULL) { + *numsecflavors = + grp->gr_numsecflavors; + *secflavorsp = + grp->gr_secflavors; + } return (1); } break; @@ -2021,7 +2064,7 @@ scan_tree(struct dirlist *dp, struct soc if (dp) { if (scan_tree(dp->dp_left, saddr)) return (1); - if (chk_host(dp, saddr, &defset, &hostset)) + if (chk_host(dp, saddr, &defset, &hostset, NULL, NULL)) return (1); if (scan_tree(dp->dp_right, saddr)) return (1); From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 01:28:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3FAB8106566C; Tue, 25 Sep 2012 01:28:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A27D8FC0C; Tue, 25 Sep 2012 01:28:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8P1SE8q036198; Tue, 25 Sep 2012 01:28:14 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8P1SDfG036196; Tue, 25 Sep 2012 01:28:13 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201209250128.q8P1SDfG036196@svn.freebsd.org> From: Eitan Adler Date: Tue, 25 Sep 2012 01:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240903 - stable/8/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 01:28:14 -0000 Author: eadler Date: Tue Sep 25 01:28:13 2012 New Revision: 240903 URL: http://svn.freebsd.org/changeset/base/240903 Log: MFC r240466: Define missing DEBUGOUT# macros. DEBUGOUT[45] are not yet used but are being defined pre-emptively to avoid future build breakage PR: kern/168967 Approved by: cperciva (implicit) Modified: stable/8/sys/dev/ixgbe/ixgbe_osdep.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/ixgbe/ (props changed) Modified: stable/8/sys/dev/ixgbe/ixgbe_osdep.h ============================================================================== --- stable/8/sys/dev/ixgbe/ixgbe_osdep.h Mon Sep 24 23:57:16 2012 (r240902) +++ stable/8/sys/dev/ixgbe/ixgbe_osdep.h Tue Sep 25 01:28:13 2012 (r240903) @@ -68,12 +68,17 @@ #define DEBUGOUT1(S,A) printf(S "\n",A) #define DEBUGOUT2(S,A,B) printf(S "\n",A,B) #define DEBUGOUT3(S,A,B,C) printf(S "\n",A,B,C) + #define DEBUGOUT4(S,A,B,C,D) printf(S "\n",A,B,C,D) + #define DEBUGOUT5(S,A,B,C,D,E) printf(S "\n",A,B,C,D,E) + #define DEBUGOUT6(S,A,B,C,D,E,F) printf(S "\n",A,B,C,D,E,F) #define DEBUGOUT7(S,A,B,C,D,E,F,G) printf(S "\n",A,B,C,D,E,F,G) #else #define DEBUGOUT(S) #define DEBUGOUT1(S,A) #define DEBUGOUT2(S,A,B) #define DEBUGOUT3(S,A,B,C) + #define DEBUGOUT4(S,A,B,C,D) + #define DEBUGOUT5(S,A,B,C,D,E) #define DEBUGOUT6(S,A,B,C,D,E,F) #define DEBUGOUT7(S,A,B,C,D,E,F,G) #endif From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 01:28:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2A3BA1065670; Tue, 25 Sep 2012 01:28:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15B3D8FC12; Tue, 25 Sep 2012 01:28:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8P1SEeg036225; Tue, 25 Sep 2012 01:28:14 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8P1SECL036222; Tue, 25 Sep 2012 01:28:14 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201209250128.q8P1SECL036222@svn.freebsd.org> From: Eitan Adler Date: Tue, 25 Sep 2012 01:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240904 - stable/9/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 01:28:15 -0000 Author: eadler Date: Tue Sep 25 01:28:14 2012 New Revision: 240904 URL: http://svn.freebsd.org/changeset/base/240904 Log: MFC r240466: Define missing DEBUGOUT# macros. DEBUGOUT[45] are not yet used but are being defined pre-emptively to avoid future build breakage PR: kern/168967 Approved by: cperciva (implicit) Modified: stable/9/sys/dev/ixgbe/ixgbe_osdep.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) Modified: stable/9/sys/dev/ixgbe/ixgbe_osdep.h ============================================================================== --- stable/9/sys/dev/ixgbe/ixgbe_osdep.h Tue Sep 25 01:28:13 2012 (r240903) +++ stable/9/sys/dev/ixgbe/ixgbe_osdep.h Tue Sep 25 01:28:14 2012 (r240904) @@ -69,12 +69,17 @@ #define DEBUGOUT1(S,A) printf(S "\n",A) #define DEBUGOUT2(S,A,B) printf(S "\n",A,B) #define DEBUGOUT3(S,A,B,C) printf(S "\n",A,B,C) + #define DEBUGOUT4(S,A,B,C,D) printf(S "\n",A,B,C,D) + #define DEBUGOUT5(S,A,B,C,D,E) printf(S "\n",A,B,C,D,E) + #define DEBUGOUT6(S,A,B,C,D,E,F) printf(S "\n",A,B,C,D,E,F) #define DEBUGOUT7(S,A,B,C,D,E,F,G) printf(S "\n",A,B,C,D,E,F,G) #else #define DEBUGOUT(S) #define DEBUGOUT1(S,A) #define DEBUGOUT2(S,A,B) #define DEBUGOUT3(S,A,B,C) + #define DEBUGOUT4(S,A,B,C,D) + #define DEBUGOUT5(S,A,B,C,D,E) #define DEBUGOUT6(S,A,B,C,D,E,F) #define DEBUGOUT7(S,A,B,C,D,E,F,G) #endif From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 01:28:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8B15D106564A; Tue, 25 Sep 2012 01:28:16 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30C298FC14; Tue, 25 Sep 2012 01:28:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8P1SGLb036254; Tue, 25 Sep 2012 01:28:16 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8P1SFWU036252; Tue, 25 Sep 2012 01:28:15 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201209250128.q8P1SFWU036252@svn.freebsd.org> From: Eitan Adler Date: Tue, 25 Sep 2012 01:28:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240905 - stable/7/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 01:28:16 -0000 Author: eadler Date: Tue Sep 25 01:28:15 2012 New Revision: 240905 URL: http://svn.freebsd.org/changeset/base/240905 Log: MFC r240466: Define missing DEBUGOUT# macros. DEBUGOUT[45] are not yet used but are being defined pre-emptively to avoid future build breakage PR: kern/168967 Approved by: cperciva (implicit) Modified: stable/7/sys/dev/ixgbe/ixgbe_osdep.h Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/ixgbe/ixgbe_osdep.h ============================================================================== --- stable/7/sys/dev/ixgbe/ixgbe_osdep.h Tue Sep 25 01:28:14 2012 (r240904) +++ stable/7/sys/dev/ixgbe/ixgbe_osdep.h Tue Sep 25 01:28:15 2012 (r240905) @@ -67,12 +67,17 @@ #define DEBUGOUT1(S,A) printf(S "\n",A) #define DEBUGOUT2(S,A,B) printf(S "\n",A,B) #define DEBUGOUT3(S,A,B,C) printf(S "\n",A,B,C) + #define DEBUGOUT4(S,A,B,C,D) printf(S "\n",A,B,C,D) + #define DEBUGOUT5(S,A,B,C,D,E) printf(S "\n",A,B,C,D,E) + #define DEBUGOUT6(S,A,B,C,D,E,F) printf(S "\n",A,B,C,D,E,F) #define DEBUGOUT7(S,A,B,C,D,E,F,G) printf(S "\n",A,B,C,D,E,F,G) #else #define DEBUGOUT(S) #define DEBUGOUT1(S,A) #define DEBUGOUT2(S,A,B) #define DEBUGOUT3(S,A,B,C) + #define DEBUGOUT4(S,A,B,C,D) + #define DEBUGOUT5(S,A,B,C,D,E) #define DEBUGOUT6(S,A,B,C,D,E,F) #define DEBUGOUT7(S,A,B,C,D,E,F,G) #endif From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 01:31:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B29B1065670; Tue, 25 Sep 2012 01:31:24 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B7358FC19; Tue, 25 Sep 2012 01:31:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8P1VOw8036731; Tue, 25 Sep 2012 01:31:24 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8P1VOia036727; Tue, 25 Sep 2012 01:31:24 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201209250131.q8P1VOia036727@svn.freebsd.org> From: Eitan Adler Date: Tue, 25 Sep 2012 01:31:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240906 - in stable/8/tools: diag diag/ac tools tools/backout_commit tools/mfc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 01:31:24 -0000 Author: eadler Date: Tue Sep 25 01:31:23 2012 New Revision: 240906 URL: http://svn.freebsd.org/changeset/base/240906 Log: MFC r240470: Remove scripts and tools which only functioned when src was using CVS Approved by: cperciva (implicit) Deleted: stable/8/tools/diag/ac/ stable/8/tools/tools/backout_commit/ stable/8/tools/tools/mfc/ Modified: stable/8/tools/diag/README stable/8/tools/tools/README Directory Properties: stable/8/tools/diag/ (props changed) stable/8/tools/tools/ (props changed) Modified: stable/8/tools/diag/README ============================================================================== --- stable/8/tools/diag/README Tue Sep 25 01:28:15 2012 (r240905) +++ stable/8/tools/diag/README Tue Sep 25 01:31:23 2012 (r240906) @@ -8,8 +8,6 @@ the integrity. Please make a subdir per program, and add a brief description to this file. -ac Various scripts that checks of style/content correctness of - committers lists in doc/ area. dumpvfscache program that can be used to examine the contents of the vfs name cache. httpd-error check for Web files which does not exists on your host Modified: stable/8/tools/tools/README ============================================================================== --- stable/8/tools/tools/README Tue Sep 25 01:28:15 2012 (r240905) +++ stable/8/tools/tools/README Tue Sep 25 01:31:23 2012 (r240906) @@ -10,8 +10,6 @@ file. ansify Convert K&R-style function definitions to ANSI style ath Tools specific to the Atheros 802.11 support -backout_commit A tool for reading in a commit message and generating - a script that will backout the commit. cfi Common Flash Interface (CFI) tool commitsdb A tool for reconstructing commit history using md5 checksums of the commit logs. @@ -45,8 +43,6 @@ kerninclude Shellscript to find unused # kernxref Shellscript to cross reference symbols in the LINT kernel. kttcp An in-kernel version of the ttcp network performance tool mctest A multicast test program -mfc Merge a directory from HEAD to a branch where it does not - already exist and other MFC related script(s). mid Create a Message-ID database for mailing lists. mwl Tools specific to the Marvell 88W8363 support ncpus Count the number of processors From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 01:31:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5E4281065674; Tue, 25 Sep 2012 01:31:25 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2CCDD8FC0C; Tue, 25 Sep 2012 01:31:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8P1VP2Z036754; Tue, 25 Sep 2012 01:31:25 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8P1VOAg036751; Tue, 25 Sep 2012 01:31:24 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201209250131.q8P1VOAg036751@svn.freebsd.org> From: Eitan Adler Date: Tue, 25 Sep 2012 01:31:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240907 - in stable/9/tools: diag diag/ac tools tools/backout_commit tools/mfc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 01:31:25 -0000 Author: eadler Date: Tue Sep 25 01:31:24 2012 New Revision: 240907 URL: http://svn.freebsd.org/changeset/base/240907 Log: MFC r240470: Remove scripts and tools which only functioned when src was using CVS Approved by: cperciva (implicit) Deleted: stable/9/tools/diag/ac/ stable/9/tools/tools/backout_commit/ stable/9/tools/tools/mfc/ Modified: stable/9/tools/diag/README stable/9/tools/tools/README Directory Properties: stable/9/tools/diag/ (props changed) stable/9/tools/tools/ (props changed) Modified: stable/9/tools/diag/README ============================================================================== --- stable/9/tools/diag/README Tue Sep 25 01:31:23 2012 (r240906) +++ stable/9/tools/diag/README Tue Sep 25 01:31:24 2012 (r240907) @@ -8,8 +8,6 @@ the integrity. Please make a subdir per program, and add a brief description to this file. -ac Various scripts that checks of style/content correctness of - committers lists in doc/ area. dumpvfscache program that can be used to examine the contents of the vfs name cache. httpd-error check for Web files which does not exists on your host Modified: stable/9/tools/tools/README ============================================================================== --- stable/9/tools/tools/README Tue Sep 25 01:31:23 2012 (r240906) +++ stable/9/tools/tools/README Tue Sep 25 01:31:24 2012 (r240907) @@ -10,8 +10,6 @@ file. ansify Convert K&R-style function definitions to ANSI style ath Tools specific to the Atheros 802.11 support -backout_commit A tool for reading in a commit message and generating - a script that will backout the commit. cfi Common Flash Interface (CFI) tool commitsdb A tool for reconstructing commit history using md5 checksums of the commit logs. @@ -45,8 +43,6 @@ kerninclude Shellscript to find unused # kernxref Shellscript to cross reference symbols in the LINT kernel. kttcp An in-kernel version of the ttcp network performance tool mctest A multicast test program -mfc Merge a directory from HEAD to a branch where it does not - already exist and other MFC related script(s). mid Create a Message-ID database for mailing lists. mwl Tools specific to the Marvell 88W8363 support ncpus Count the number of processors From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 01:31:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 457FD1065740; Tue, 25 Sep 2012 01:31:31 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 624088FC1B; Tue, 25 Sep 2012 01:31:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8P1VVPH036799; Tue, 25 Sep 2012 01:31:31 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8P1VVcV036796; Tue, 25 Sep 2012 01:31:31 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201209250131.q8P1VVcV036796@svn.freebsd.org> From: Eitan Adler Date: Tue, 25 Sep 2012 01:31:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240908 - in stable/7/tools: diag diag/ac tools tools/backout_commit tools/mfc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 01:31:33 -0000 Author: eadler Date: Tue Sep 25 01:31:30 2012 New Revision: 240908 URL: http://svn.freebsd.org/changeset/base/240908 Log: MFC r240470: Remove scripts and tools which only functioned when src was using CVS Approved by: cperciva (implicit) Deleted: stable/7/tools/diag/ac/ stable/7/tools/tools/backout_commit/ stable/7/tools/tools/mfc/ Modified: stable/7/tools/diag/README stable/7/tools/tools/README Directory Properties: stable/7/tools/diag/ (props changed) stable/7/tools/tools/ (props changed) Modified: stable/7/tools/diag/README ============================================================================== --- stable/7/tools/diag/README Tue Sep 25 01:31:24 2012 (r240907) +++ stable/7/tools/diag/README Tue Sep 25 01:31:30 2012 (r240908) @@ -8,8 +8,6 @@ the integrity. Please make a subdir per program, and add a brief description to this file. -ac Various scripts that checks of style/content correctness of - committers lists in doc/ area. dumpvfscache program that can be used to examine the contents of the vfs name cache. httpd-error check for Web files which does not exists on your host Modified: stable/7/tools/tools/README ============================================================================== --- stable/7/tools/tools/README Tue Sep 25 01:31:24 2012 (r240907) +++ stable/7/tools/tools/README Tue Sep 25 01:31:30 2012 (r240908) @@ -10,8 +10,6 @@ file. ansify Convert K&R-style function definitions to ANSI style ath Tools specific to the Atheros 802.11 support -backout_commit A tool for reading in a commit message and generating - a script that will backout the commit. commitsdb A tool for reconstructing commit history using md5 checksums of the commit logs. crypto Test and exercise tools related to the crypto framework @@ -38,8 +36,6 @@ kernelcruft Shellscript to find orphaned kerninclude Shellscript to find unused #includes in the kernel. kernxref Shellscript to cross reference symbols in the LINT kernel. kttcp An in-kernel version of the ttcp network performance tool -mfc Merge a directory from HEAD to a branch where it does not - already exist and other MFC related script(s). mid Create a Message-ID database for mailing lists. ncpus Count the number of processors nxge A diagnostic tool for the nxge(4) driver From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 01:33:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19BA61065670; Tue, 25 Sep 2012 01:33:23 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 025748FC0A; Tue, 25 Sep 2012 01:33:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8P1XM9Z037125; Tue, 25 Sep 2012 01:33:22 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8P1XM8R037114; Tue, 25 Sep 2012 01:33:22 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201209250133.q8P1XM8R037114@svn.freebsd.org> From: Eitan Adler Date: Tue, 25 Sep 2012 01:33:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240909 - stable/9/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 01:33:23 -0000 Author: eadler Date: Tue Sep 25 01:33:22 2012 New Revision: 240909 URL: http://svn.freebsd.org/changeset/base/240909 Log: MFC r240480: Belatedly add myself Approved by: cperciva (implicit) Modified: stable/9/share/misc/committers-src.dot Directory Properties: stable/9/share/misc/ (props changed) Modified: stable/9/share/misc/committers-src.dot ============================================================================== --- stable/9/share/misc/committers-src.dot Tue Sep 25 01:31:30 2012 (r240908) +++ stable/9/share/misc/committers-src.dot Tue Sep 25 01:33:22 2012 (r240909) @@ -131,6 +131,7 @@ dg [label="David Greenman\ndg@FreeBSD.or dim [label="Dimitry Andric\ndim@FreeBSD.org\n2010/08/30"] dougb [label="Doug Barton\ndougb@FreeBSD.org\n2000/10/26"] dwmalone [label="David Malone\ndwmalone@FreeBSD.org\n2000/07/11"] +eadler [label="Eitan Adler\neadler@FreeBSD.org\n2012/01/18"] ed [label="Ed Schouten\ned@FreeBSD.org\n2008/05/22"] edwin [label="Edwin Groothuis\nedwin@FreeBSD.org\n2007/06/25"] eivind [label="Eivind Eklund\neivind@FreeBSD.org\n????/??/??"] @@ -307,6 +308,7 @@ bz -> syrinx cognet -> kevlo +cperciva -> eadler cperciva -> flz cperciva -> randi cperciva -> simon From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 01:33:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 419411065673; Tue, 25 Sep 2012 01:33:23 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C9B28FC12; Tue, 25 Sep 2012 01:33:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8P1XN0C037139; Tue, 25 Sep 2012 01:33:23 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8P1XMhU037135; Tue, 25 Sep 2012 01:33:22 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201209250133.q8P1XMhU037135@svn.freebsd.org> From: Eitan Adler Date: Tue, 25 Sep 2012 01:33:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240910 - stable/8/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 01:33:23 -0000 Author: eadler Date: Tue Sep 25 01:33:22 2012 New Revision: 240910 URL: http://svn.freebsd.org/changeset/base/240910 Log: MFC r240480: Belatedly add myself Approved by: cperciva (implicit) Modified: stable/8/share/misc/committers-src.dot Directory Properties: stable/8/share/misc/ (props changed) Modified: stable/8/share/misc/committers-src.dot ============================================================================== --- stable/8/share/misc/committers-src.dot Tue Sep 25 01:33:22 2012 (r240909) +++ stable/8/share/misc/committers-src.dot Tue Sep 25 01:33:22 2012 (r240910) @@ -83,6 +83,7 @@ dg [label="David Greenman\ndg@FreeBSD.or dhartmei [label="Daniel Hartmeier\ndhartmei@FreeBSD.org\n2004/04/06"] dmlb [label="Duncan Barclay\ndmlb@FreeBSD.org\n2001/12/14"] dwmalone [label="David Malone\ndwmalone@FreeBSD.org\n2000/07/11"] +eadler [label="Eitan Adler\neadler@FreeBSD.org\n2012/01/18"] ed [label="Ed Schouten\ned@FreeBSD.org\n2008/05/22"] edwin [label="Edwin Groothuis\nedwin@FreeBSD.org\n2007/06/25"] eik [label="Oliver Eikemeier\neik@FreeBSD.org\n2004/05/20"] @@ -234,6 +235,7 @@ brooks -> jamie bz -> jamie bz -> syrinx +cperciva -> eadler cperciva -> flz cperciva -> simon From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 01:33:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AE1A1065672; Tue, 25 Sep 2012 01:33:24 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E04DF8FC16; Tue, 25 Sep 2012 01:33:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8P1XNgU037160; Tue, 25 Sep 2012 01:33:23 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8P1XN1Z037159; Tue, 25 Sep 2012 01:33:23 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201209250133.q8P1XN1Z037159@svn.freebsd.org> From: Eitan Adler Date: Tue, 25 Sep 2012 01:33:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240911 - stable/7/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 01:33:24 -0000 Author: eadler Date: Tue Sep 25 01:33:23 2012 New Revision: 240911 URL: http://svn.freebsd.org/changeset/base/240911 Log: MFC r240480: Belatedly add myself Approved by: cperciva (implicit) Modified: Directory Properties: stable/7/share/misc/ (props changed) From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 03:59:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3780C1065670; Tue, 25 Sep 2012 03:59:11 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 223788FC08; Tue, 25 Sep 2012 03:59:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8P3xAV4056012; Tue, 25 Sep 2012 03:59:10 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8P3xAKj056009; Tue, 25 Sep 2012 03:59:10 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201209250359.q8P3xAKj056009@svn.freebsd.org> From: Alan Cox Date: Tue, 25 Sep 2012 03:59:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240913 - head/sys/arm/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 03:59:11 -0000 Author: alc Date: Tue Sep 25 03:59:10 2012 New Revision: 240913 URL: http://svn.freebsd.org/changeset/base/240913 Log: Eliminate an unused declaration. Modified: head/sys/arm/arm/pmap-v6.c head/sys/arm/arm/pmap.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Tue Sep 25 02:33:25 2012 (r240912) +++ head/sys/arm/arm/pmap-v6.c Tue Sep 25 03:59:10 2012 (r240913) @@ -219,7 +219,6 @@ vm_offset_t virtual_end; /* VA of last a vm_offset_t pmap_curmaxkvaddr; vm_paddr_t kernel_l1pa; -extern void *end; vm_offset_t kernel_vm_end = 0; struct pmap kernel_pmap_store; Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Tue Sep 25 02:33:25 2012 (r240912) +++ head/sys/arm/arm/pmap.c Tue Sep 25 03:59:10 2012 (r240913) @@ -215,7 +215,6 @@ vm_offset_t virtual_end; /* VA of last a vm_offset_t pmap_curmaxkvaddr; vm_paddr_t kernel_l1pa; -extern void *end; vm_offset_t kernel_vm_end = 0; struct pmap kernel_pmap_store; From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 05:57:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0FE7D106566B; Tue, 25 Sep 2012 05:57:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF3AF8FC08; Tue, 25 Sep 2012 05:56:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8P5uxA3072833; Tue, 25 Sep 2012 05:56:59 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8P5uxae072831; Tue, 25 Sep 2012 05:56:59 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201209250556.q8P5uxae072831@svn.freebsd.org> From: Adrian Chadd Date: Tue, 25 Sep 2012 05:56:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240914 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 05:57:00 -0000 Author: adrian Date: Tue Sep 25 05:56:59 2012 New Revision: 240914 URL: http://svn.freebsd.org/changeset/base/240914 Log: Call ath_tx_tid_unsched() after the node has been flushed, so the state can be printed correctly. 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 Sep 25 03:59:10 2012 (r240913) +++ head/sys/dev/ath/if_ath_tx.c Tue Sep 25 05:56:59 2012 (r240914) @@ -3468,12 +3468,11 @@ ath_tx_node_flush(struct ath_softc *sc, struct ath_tid *atid = &an->an_tid[tid]; struct ath_txq *txq = sc->sc_ac2q[atid->ac]; - /* Remove this tid from the list of active tids */ ATH_TXQ_LOCK(txq); - ath_tx_tid_unsched(sc, atid); - /* Free packets */ ath_tx_tid_drain(sc, an, atid, &bf_cq); + /* Remove this tid from the list of active tids */ + ath_tx_tid_unsched(sc, atid); ATH_TXQ_UNLOCK(txq); } From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 10:41:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 02435106566B; Tue, 25 Sep 2012 10:41:31 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE3A48FC08; Tue, 25 Sep 2012 10:41:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PAfUJn014979; Tue, 25 Sep 2012 10:41:30 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PAfUW6014969; Tue, 25 Sep 2012 10:41:30 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201209251041.q8PAfUW6014969@svn.freebsd.org> From: Ed Schouten Date: Tue, 25 Sep 2012 10:41:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240915 - in vendor/NetBSD/libedit/dist: . TEST readline X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 10:41:31 -0000 Author: ed Date: Tue Sep 25 10:41:30 2012 New Revision: 240915 URL: http://svn.freebsd.org/changeset/base/240915 Log: Vendor import NetBSD's libedit of "2012/09/25 10:41:11 UTC". Obtained from: NetBSD Added: vendor/NetBSD/libedit/dist/TEST/rl1.c vendor/NetBSD/libedit/dist/keymacro.c vendor/NetBSD/libedit/dist/keymacro.h vendor/NetBSD/libedit/dist/terminal.c vendor/NetBSD/libedit/dist/terminal.h Deleted: vendor/NetBSD/libedit/dist/key.c vendor/NetBSD/libedit/dist/key.h vendor/NetBSD/libedit/dist/term.c vendor/NetBSD/libedit/dist/term.h Modified: vendor/NetBSD/libedit/dist/Makefile vendor/NetBSD/libedit/dist/TEST/wtc1.c vendor/NetBSD/libedit/dist/chared.c vendor/NetBSD/libedit/dist/chared.h vendor/NetBSD/libedit/dist/chartype.c vendor/NetBSD/libedit/dist/chartype.h vendor/NetBSD/libedit/dist/common.c vendor/NetBSD/libedit/dist/config.h vendor/NetBSD/libedit/dist/editline.3 vendor/NetBSD/libedit/dist/editrc.5 vendor/NetBSD/libedit/dist/el.c vendor/NetBSD/libedit/dist/el.h vendor/NetBSD/libedit/dist/eln.c vendor/NetBSD/libedit/dist/emacs.c vendor/NetBSD/libedit/dist/filecomplete.c vendor/NetBSD/libedit/dist/hist.c vendor/NetBSD/libedit/dist/hist.h vendor/NetBSD/libedit/dist/histedit.h vendor/NetBSD/libedit/dist/history.c vendor/NetBSD/libedit/dist/makelist vendor/NetBSD/libedit/dist/map.c vendor/NetBSD/libedit/dist/parse.c vendor/NetBSD/libedit/dist/prompt.c vendor/NetBSD/libedit/dist/read.c vendor/NetBSD/libedit/dist/readline.c vendor/NetBSD/libedit/dist/readline/readline.h vendor/NetBSD/libedit/dist/refresh.c vendor/NetBSD/libedit/dist/search.c vendor/NetBSD/libedit/dist/sig.c vendor/NetBSD/libedit/dist/sys.h vendor/NetBSD/libedit/dist/tokenizer.c vendor/NetBSD/libedit/dist/tty.c vendor/NetBSD/libedit/dist/tty.h vendor/NetBSD/libedit/dist/vi.c Modified: vendor/NetBSD/libedit/dist/Makefile ============================================================================== --- vendor/NetBSD/libedit/dist/Makefile Tue Sep 25 05:56:59 2012 (r240914) +++ vendor/NetBSD/libedit/dist/Makefile Tue Sep 25 10:41:30 2012 (r240915) @@ -1,17 +1,22 @@ -# $NetBSD: Makefile,v 1.41 2010/02/03 15:34:43 roy Exp $ +# $NetBSD: Makefile,v 1.51 2012/08/10 12:20:10 joerg Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 USE_SHLIBDIR= yes WIDECHAR ?= yes -WARNS= 4 +WARNS?= 5 LIB= edit LIBDPLIBS+= terminfo ${.CURDIR}/../libterminfo +.include "bsd.own.mk" + +COPTS+= -Wunused-parameter +CWARNFLAGS.gcc+= -Wconversion + OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \ - hist.c key.c map.c chartype.c \ - parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c + hist.c keymacro.c map.c chartype.c \ + parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c MAN= editline.3 editrc.5 @@ -113,10 +118,17 @@ historyn.c: makelist Makefile mv ${.TARGET}.tmp ${.TARGET} tc1.o: ${LIBEDITDIR}/TEST/tc1.c - + tc1: libedit.a tc1.o ${_MKTARGET_LINK} ${CC} ${LDFLAGS} ${.ALLSRC} -o ${.TARGET} libedit.a ${LDADD} -ltermlib .include .include + +# XXX +.if defined(HAVE_GCC) && ${HAVE_GCC} >= 45 +COPTS.editline.c+= -Wno-cast-qual +COPTS.tokenizer.c+= -Wno-cast-qual +COPTS.tokenizern.c+= -Wno-cast-qual +.endif Added: vendor/NetBSD/libedit/dist/TEST/rl1.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/libedit/dist/TEST/rl1.c Tue Sep 25 10:41:30 2012 (r240915) @@ -0,0 +1,59 @@ +/* $NetBSD: rl1.c,v 1.1 2010/09/16 20:08:51 christos Exp $ */ + +/*- + * Copyright (c) 2010 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +#if !defined(lint) +__RCSID("$NetBSD: rl1.c,v 1.1 2010/09/16 20:08:51 christos Exp $"); +#endif /* not lint */ + +/* + * test.c: A little test program + */ +#include +#include + +int +main(int argc, char *argv[]) +{ + char *p; + while ((p = readline("hi$")) != NULL) { + add_history(p); + printf("%d %s\n", history_length, p); + } + return 0; +} Modified: vendor/NetBSD/libedit/dist/TEST/wtc1.c ============================================================================== --- vendor/NetBSD/libedit/dist/TEST/wtc1.c Tue Sep 25 05:56:59 2012 (r240914) +++ vendor/NetBSD/libedit/dist/TEST/wtc1.c Tue Sep 25 10:41:30 2012 (r240915) @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -14,6 +15,7 @@ static int continuation; volatile sig_atomic_t gotsig; +static const char hfile[] = ".whistory"; static wchar_t * prompt(EditLine *el) @@ -60,7 +62,8 @@ complete(EditLine *el, int ch) char *buf, *bptr; const LineInfoW *lf = el_wline(el); int len, mblen, i; - unsigned char res; + unsigned char res = 0; + wchar_t dir[1024]; /* Find the last word */ for (ptr = lf->cursor -1; !iswspace(*ptr) && ptr > lf->buffer; --ptr) @@ -70,7 +73,9 @@ complete(EditLine *el, int ch) /* Convert last word to multibyte encoding, so we can compare to it */ wctomb(NULL, 0); /* Reset shift state */ mblen = MB_LEN_MAX * len + 1; - buf = bptr =(char *)malloc(mblen); + buf = bptr = malloc(mblen); + if (buf == NULL) + err(1, "malloc"); for (i = 0; i < len; ++i) { /* Note: really should test for -1 return from wctomb */ bptr += wctomb(bptr, ptr[i]); @@ -83,7 +88,9 @@ complete(EditLine *el, int ch) if (mblen > strlen(dp->d_name)) continue; if (strncmp(dp->d_name, buf, mblen) == 0) { - if (el_insertstr(el, &dp->d_name[mblen]) == -1) + mbstowcs(dir, &dp->d_name[mblen], + sizeof(dir) / sizeof(*dir)); + if (el_winsertstr(el, dir) == -1) res = CC_ERROR; else res = CC_REFRESH; @@ -119,6 +126,7 @@ main(int argc, char *argv[]) hist = history_winit(); /* Init built-in history */ history_w(hist, &ev, H_SETSIZE, 100); /* Remember 100 events */ + history_w(hist, &ev, H_LOAD, hfile); tok = tok_winit(NULL); /* Init the tokenizer */ @@ -260,6 +268,7 @@ main(int argc, char *argv[]) el_end(el); tok_wend(tok); + history_w(hist, &ev, H_SAVE, hfile); history_wend(hist); fprintf(stdout, "\n"); Modified: vendor/NetBSD/libedit/dist/chared.c ============================================================================== --- vendor/NetBSD/libedit/dist/chared.c Tue Sep 25 05:56:59 2012 (r240914) +++ vendor/NetBSD/libedit/dist/chared.c Tue Sep 25 10:41:30 2012 (r240915) @@ -1,4 +1,4 @@ -/* $NetBSD: chared.c,v 1.28 2009/12/30 22:37:40 christos Exp $ */ +/* $NetBSD: chared.c,v 1.37 2012/07/18 17:12:39 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: chared.c,v 1.28 2009/12/30 22:37:40 christos Exp $"); +__RCSID("$NetBSD: chared.c,v 1.37 2012/07/18 17:12:39 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -63,8 +63,8 @@ cv_undo(EditLine *el) size_t size; /* Save entire line for undo */ - size = el->el_line.lastchar - el->el_line.buffer; - vu->len = size; + size = (size_t)(el->el_line.lastchar - el->el_line.buffer); + vu->len = (ssize_t)size; vu->cursor = (int)(el->el_line.cursor - el->el_line.buffer); (void)memcpy(vu->buf, el->el_line.buffer, size * sizeof(*vu->buf)); @@ -84,7 +84,7 @@ cv_yank(EditLine *el, const Char *ptr, i { c_kill_t *k = &el->el_chared.c_kill; - (void)memcpy(k->buf, ptr, size * sizeof(*k->buf)); + (void)memcpy(k->buf, ptr, (size_t)size * sizeof(*k->buf)); k->last = k->buf + size; } @@ -201,7 +201,7 @@ c_delbefore1(EditLine *el) protected int ce__isword(Int p) { - return (Isalnum(p) || Strchr(STR("*?_-.[]~="), p) != NULL); + return Isalnum(p) || Strchr(STR("*?_-.[]~="), p) != NULL; } @@ -225,7 +225,7 @@ cv__isword(Int p) protected int cv__isWord(Int p) { - return (!Isspace(p)); + return !Isspace(p); } @@ -249,7 +249,7 @@ c__prev_word(Char *p, Char *low, int n, if (p < low) p = low; /* cp now points where we want it */ - return (p); + return p; } @@ -268,7 +268,7 @@ c__next_word(Char *p, Char *high, int n, if (p > high) p = high; /* p now points where we want it */ - return (p); + return p; } /* cv_next_word(): @@ -294,9 +294,9 @@ cv_next_word(EditLine *el, Char *p, Char /* p now points where we want it */ if (p > high) - return (high); + return high; else - return (p); + return p; } @@ -320,47 +320,12 @@ cv_prev_word(Char *p, Char *low, int n, /* p now points where we want it */ if (p < low) - return (low); + return low; else - return (p); + return p; } -#ifdef notdef -/* c__number(): - * Ignore character p points to, return number appearing after that. - * A '$' by itself means a big number; "$-" is for negative; '^' means 1. - * Return p pointing to last char used. - */ -protected Char * -c__number( - Char *p, /* character position */ - int *num, /* Return value */ - int dval) /* dval is the number to subtract from like $-3 */ -{ - int i; - int sign = 1; - - if (*++p == '^') { - *num = 1; - return (p); - } - if (*p == '$') { - if (*++p != '-') { - *num = 0x7fffffff; /* Handle $ */ - return (--p); - } - sign = -1; /* Handle $- */ - ++p; - } - /* XXX: this assumes ASCII compatible digits */ - for (i = 0; Isdigit(*p); i = 10 * i + *p++ - '0') - continue; - *num = (sign < 0 ? dval - i : i); - return (--p); -} -#endif - /* cv_delfini(): * Finish vi delete action */ @@ -399,28 +364,6 @@ cv_delfini(EditLine *el) } -#ifdef notdef -/* ce__endword(): - * Go to the end of this word according to emacs - */ -protected Char * -ce__endword(Char *p, Char *high, int n) -{ - p++; - - while (n--) { - while ((p < high) && Isspace(*p)) - p++; - while ((p < high) && !Isspace(*p)) - p++; - } - - p--; - return (p); -} -#endif - - /* cv__endword(): * Go to the end of this word according to vi */ @@ -440,7 +383,7 @@ cv__endword(Char *p, Char *high, int n, p++; } p--; - return (p); + return p; } /* ch_init(): @@ -454,7 +397,7 @@ ch_init(EditLine *el) el->el_line.buffer = el_malloc(EL_BUFSIZ * sizeof(*el->el_line.buffer)); if (el->el_line.buffer == NULL) - return (-1); + return -1; (void) memset(el->el_line.buffer, 0, EL_BUFSIZ * sizeof(*el->el_line.buffer)); @@ -465,7 +408,7 @@ ch_init(EditLine *el) el->el_chared.c_undo.buf = el_malloc(EL_BUFSIZ * sizeof(*el->el_chared.c_undo.buf)); if (el->el_chared.c_undo.buf == NULL) - return (-1); + return -1; (void) memset(el->el_chared.c_undo.buf, 0, EL_BUFSIZ * sizeof(*el->el_chared.c_undo.buf)); el->el_chared.c_undo.len = -1; @@ -473,7 +416,7 @@ ch_init(EditLine *el) el->el_chared.c_redo.buf = el_malloc(EL_BUFSIZ * sizeof(*el->el_chared.c_redo.buf)); if (el->el_chared.c_redo.buf == NULL) - return (-1); + return -1; el->el_chared.c_redo.pos = el->el_chared.c_redo.buf; el->el_chared.c_redo.lim = el->el_chared.c_redo.buf + EL_BUFSIZ; el->el_chared.c_redo.cmd = ED_UNASSIGNED; @@ -484,11 +427,13 @@ ch_init(EditLine *el) el->el_chared.c_kill.buf = el_malloc(EL_BUFSIZ * sizeof(*el->el_chared.c_kill.buf)); if (el->el_chared.c_kill.buf == NULL) - return (-1); + return -1; (void) memset(el->el_chared.c_kill.buf, 0, EL_BUFSIZ * sizeof(*el->el_chared.c_kill.buf)); el->el_chared.c_kill.mark = el->el_line.buffer; el->el_chared.c_kill.last = el->el_chared.c_kill.buf; + el->el_chared.c_resizefun = NULL; + el->el_chared.c_resizearg = NULL; el->el_map.current = el->el_map.key; @@ -502,8 +447,8 @@ ch_init(EditLine *el) ma->offset = 0; ma->macro = el_malloc(EL_MAXMACRO * sizeof(*ma->macro)); if (ma->macro == NULL) - return (-1); - return (0); + return -1; + return 0; } /* ch_reset(): @@ -542,7 +487,7 @@ ch__clearmacro(EditLine *el) { c_macro_t *ma = &el->el_chared.c_macro; while (ma->level >= 0) - el_free((ptr_t)ma->macro[ma->level--]); + el_free(ma->macro[ma->level--]); } /* ch_enlargebufs(): @@ -555,7 +500,7 @@ ch_enlargebufs(EditLine *el, size_t addl size_t sz, newsz; Char *newbuffer, *oldbuf, *oldkbuf; - sz = el->el_line.limit - el->el_line.buffer + EL_LEAVE; + sz = (size_t)(el->el_line.limit - el->el_line.buffer + EL_LEAVE); newsz = sz * 2; /* * If newly required length is longer than current buffer, we need @@ -587,7 +532,8 @@ ch_enlargebufs(EditLine *el, size_t addl /* * Reallocate kill buffer. */ - newbuffer = el_realloc(el->el_chared.c_kill.buf, newsz * sizeof(*newbuffer)); + newbuffer = el_realloc(el->el_chared.c_kill.buf, newsz * + sizeof(*newbuffer)); if (!newbuffer) return 0; @@ -629,6 +575,8 @@ ch_enlargebufs(EditLine *el, size_t addl /* Safe to set enlarged buffer size */ el->el_line.limit = &el->el_line.buffer[newsz - EL_LEAVE]; + if (el->el_chared.c_resizefun) + (*el->el_chared.c_resizefun)(el, el->el_chared.c_resizearg); return 1; } @@ -638,20 +586,20 @@ ch_enlargebufs(EditLine *el, size_t addl protected void ch_end(EditLine *el) { - el_free((ptr_t) el->el_line.buffer); + el_free(el->el_line.buffer); el->el_line.buffer = NULL; el->el_line.limit = NULL; - el_free((ptr_t) el->el_chared.c_undo.buf); + el_free(el->el_chared.c_undo.buf); el->el_chared.c_undo.buf = NULL; - el_free((ptr_t) el->el_chared.c_redo.buf); + el_free(el->el_chared.c_redo.buf); el->el_chared.c_redo.buf = NULL; el->el_chared.c_redo.pos = NULL; el->el_chared.c_redo.lim = NULL; el->el_chared.c_redo.cmd = ED_UNASSIGNED; - el_free((ptr_t) el->el_chared.c_kill.buf); + el_free(el->el_chared.c_kill.buf); el->el_chared.c_kill.buf = NULL; ch_reset(el, 1); - el_free((ptr_t) el->el_chared.c_macro.macro); + el_free(el->el_chared.c_macro.macro); el->el_chared.c_macro.macro = NULL; } @@ -664,17 +612,17 @@ FUN(el,insertstr)(EditLine *el, const Ch { size_t len; - if ((len = Strlen(s)) == 0) - return (-1); + if (s == NULL || (len = Strlen(s)) == 0) + return -1; if (el->el_line.lastchar + len >= el->el_line.limit) { if (!ch_enlargebufs(el, len)) - return (-1); + return -1; } c_insert(el, (int)len); while (*s) *el->el_line.cursor++ = *s++; - return (0); + return 0; } @@ -707,8 +655,8 @@ c_gets(EditLine *el, Char *buf, const Ch Char *cp = el->el_line.buffer; if (prompt) { - len = Strlen(prompt); - (void)memcpy(cp, prompt, len * sizeof(*cp)); + len = (ssize_t)Strlen(prompt); + (void)memcpy(cp, prompt, (size_t)len * sizeof(*cp)); cp += len; } len = 0; @@ -743,8 +691,8 @@ c_gets(EditLine *el, Char *buf, const Ch break; default: - if (len >= EL_BUFSIZ - 16) - term_beep(el); + if (len >= (ssize_t)(EL_BUFSIZ - 16)) + terminal_beep(el); else { buf[len++] = ch; *cp++ = ch; @@ -773,7 +721,7 @@ c_hpos(EditLine *el) * Find how many characters till the beginning of this line. */ if (el->el_line.cursor == el->el_line.buffer) - return (0); + return 0; else { for (ptr = el->el_line.cursor - 1; ptr >= el->el_line.buffer && *ptr != '\n'; @@ -782,3 +730,11 @@ c_hpos(EditLine *el) return (int)(el->el_line.cursor - ptr - 1); } } + +protected int +ch_resizefun(EditLine *el, el_zfunc_t f, void *a) +{ + el->el_chared.c_resizefun = f; + el->el_chared.c_resizearg = a; + return 0; +} Modified: vendor/NetBSD/libedit/dist/chared.h ============================================================================== --- vendor/NetBSD/libedit/dist/chared.h Tue Sep 25 05:56:59 2012 (r240914) +++ vendor/NetBSD/libedit/dist/chared.h Tue Sep 25 10:41:30 2012 (r240915) @@ -1,4 +1,4 @@ -/* $NetBSD: chared.h,v 1.20 2010/04/15 00:57:33 christos Exp $ */ +/* $NetBSD: chared.h,v 1.21 2010/08/28 15:44:59 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -103,6 +103,8 @@ typedef struct c_kill_t { Char *mark; } c_kill_t; +typedef void (*el_zfunc_t)(EditLine *, void *); + /* * Note that we use both data structures because the user can bind * commands from both editors! @@ -113,6 +115,8 @@ typedef struct el_chared_t { c_redo_t c_redo; c_vcmd_t c_vcmd; c_macro_t c_macro; + el_zfunc_t c_resizefun; + void * c_resizearg; } el_chared_t; @@ -160,6 +164,7 @@ protected int c_hpos(EditLine *); protected int ch_init(EditLine *); protected void ch_reset(EditLine *, int); +protected int ch_resizefun(EditLine *, el_zfunc_t, void *); protected int ch_enlargebufs(EditLine *, size_t); protected void ch_end(EditLine *); Modified: vendor/NetBSD/libedit/dist/chartype.c ============================================================================== --- vendor/NetBSD/libedit/dist/chartype.c Tue Sep 25 05:56:59 2012 (r240914) +++ vendor/NetBSD/libedit/dist/chartype.c Tue Sep 25 10:41:30 2012 (r240915) @@ -1,4 +1,4 @@ -/* $NetBSD: chartype.c,v 1.4 2010/04/15 00:55:57 christos Exp $ */ +/* $NetBSD: chartype.c,v 1.10 2011/08/16 16:25:15 christos Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -38,12 +38,12 @@ */ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: chartype.c,v 1.4 2010/04/15 00:55:57 christos Exp $"); +__RCSID("$NetBSD: chartype.c,v 1.10 2011/08/16 16:25:15 christos Exp $"); #endif /* not lint && not SCCSID */ #include "el.h" #include -#define CT_BUFSIZ 1024 +#define CT_BUFSIZ ((size_t)1024) #ifdef WIDECHAR protected void @@ -52,7 +52,7 @@ ct_conv_buff_resize(ct_buffer_t *conv, s void *p; if (mincsize > conv->csize) { conv->csize = mincsize; - p = el_realloc(conv->cbuff, conv->csize); + p = el_realloc(conv->cbuff, conv->csize * sizeof(*conv->cbuff)); if (p == NULL) { conv->csize = 0; el_free(conv->cbuff); @@ -63,7 +63,7 @@ ct_conv_buff_resize(ct_buffer_t *conv, s if (minwsize > conv->wsize) { conv->wsize = minwsize; - p = el_realloc(conv->wbuff, conv->wsize); + p = el_realloc(conv->wbuff, conv->wsize * sizeof(*conv->wbuff)); if (p == NULL) { conv->wsize = 0; el_free(conv->wbuff); @@ -83,33 +83,27 @@ ct_encode_string(const Char *s, ct_buffe if (!s) return NULL; if (!conv->cbuff) - ct_conv_buff_resize(conv, CT_BUFSIZ, 0); + ct_conv_buff_resize(conv, CT_BUFSIZ, (size_t)0); if (!conv->cbuff) return NULL; dst = conv->cbuff; while (*s) { - used = ct_encode_char(dst, (int)(conv->csize - - (dst - conv->cbuff)), *s); - if (used == -1) { /* failed to encode, need more buffer space */ + used = (ssize_t)(conv->csize - (size_t)(dst - conv->cbuff)); + if (used < 5) { used = dst - conv->cbuff; - ct_conv_buff_resize(conv, conv->csize + CT_BUFSIZ, 0); + ct_conv_buff_resize(conv, conv->csize + CT_BUFSIZ, + (size_t)0); if (!conv->cbuff) return NULL; dst = conv->cbuff + used; - /* don't increment s here - we want to retry it! */ } - else - ++s; + used = ct_encode_char(dst, (size_t)5, *s); + if (used == -1) /* failed to encode, need more buffer space */ + abort(); + ++s; dst += used; } - if (dst >= (conv->cbuff + conv->csize)) { - used = dst - conv->cbuff; - ct_conv_buff_resize(conv, conv->csize + 1, 0); - if (!conv->cbuff) - return NULL; - dst = conv->cbuff + used; - } *dst = '\0'; return conv->cbuff; } @@ -122,13 +116,15 @@ ct_decode_string(const char *s, ct_buffe if (!s) return NULL; if (!conv->wbuff) - ct_conv_buff_resize(conv, 0, CT_BUFSIZ); + ct_conv_buff_resize(conv, (size_t)0, CT_BUFSIZ); if (!conv->wbuff) return NULL; - len = ct_mbstowcs(0, s, 0); + len = ct_mbstowcs(NULL, s, (size_t)0); + if (len == (size_t)-1) + return NULL; if (len > conv->wsize) - ct_conv_buff_resize(conv, 0, len + 1); + ct_conv_buff_resize(conv, (size_t)0, len + 1); if (!conv->wbuff) return NULL; ct_mbstowcs(conv->wbuff, s, conv->wsize); @@ -149,11 +145,11 @@ ct_decode_argv(int argc, const char *arg * the argv strings. */ for (i = 0, bufspace = 0; i < argc; ++i) bufspace += argv[i] ? strlen(argv[i]) + 1 : 0; - ct_conv_buff_resize(conv, 0, bufspace); + ct_conv_buff_resize(conv, (size_t)0, bufspace); if (!conv->wsize) return NULL; - wargv = el_malloc(argc * sizeof(*wargv)); + wargv = el_malloc((size_t)argc * sizeof(*wargv)); for (i = 0, p = conv->wbuff; i < argc; ++i) { if (!argv[i]) { /* don't pass null pointers to mbstowcs */ @@ -161,14 +157,14 @@ ct_decode_argv(int argc, const char *arg continue; } else { wargv[i] = p; - bytes = mbstowcs(p, argv[i], bufspace); + bytes = (ssize_t)mbstowcs(p, argv[i], bufspace); } if (bytes == -1) { el_free(wargv); return NULL; } else bytes++; /* include '\0' in the count */ - bufspace -= bytes; + bufspace -= (size_t)bytes; p += bytes; } @@ -225,7 +221,7 @@ ct_visual_string(const Char *s) } dst = buff; while (*s) { - used = ct_visual_char(dst, buffsize - (dst - buff), *s); + used = ct_visual_char(dst, buffsize - (size_t)(dst - buff), *s); if (used == -1) { /* failed to encode, need more buffer space */ used = dst - buff; buffsize += CT_BUFSIZ; @@ -326,7 +322,7 @@ ct_visual_char(Char *dst, size_t len, Ch *dst++ = tohexdigit(((unsigned int) c >> 8) & 0xf); *dst++ = tohexdigit(((unsigned int) c >> 4) & 0xf); *dst = tohexdigit(((unsigned int) c ) & 0xf); - return (c > 0xffff) ? 8 : 7; + return c > 0xffff ? 8 : 7; #else *dst++ = '\\'; #define tooctaldigit(v) ((v) + '0') Modified: vendor/NetBSD/libedit/dist/chartype.h ============================================================================== --- vendor/NetBSD/libedit/dist/chartype.h Tue Sep 25 05:56:59 2012 (r240914) +++ vendor/NetBSD/libedit/dist/chartype.h Tue Sep 25 10:41:30 2012 (r240915) @@ -1,4 +1,4 @@ -/* $NetBSD: chartype.h,v 1.6 2010/04/20 02:01:13 christos Exp $ */ +/* $NetBSD: chartype.h,v 1.10 2011/11/16 01:45:10 christos Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ #endif #define ct_mbtowc mbtowc -#define ct_mbtowc_reset mbtowc(0,0,0) +#define ct_mbtowc_reset mbtowc(0,0,(size_t)0) #define ct_wctomb wctomb #define ct_wctomb_reset wctomb(0,0) #define ct_wcstombs wcstombs @@ -105,7 +105,12 @@ #define Strtol(p,e,b) wcstol(p,e,b) -#define Width(c) wcwidth(c) +static inline int +Width(wchar_t c) +{ + int w = wcwidth(c); + return w < 0 ? 0 : w; +} #else /* NARROW */ @@ -172,11 +177,11 @@ typedef struct ct_buffer_t { } ct_buffer_t; #define ct_encode_string __ct_encode_string -/* Encode a wide character string and return the UTF-8 encoded result. */ +/* Encode a wide-character string and return the UTF-8 encoded result. */ public char *ct_encode_string(const Char *, ct_buffer_t *); #define ct_decode_string __ct_decode_string -/* Decode a (multi)?byte string and return the wide character string result. */ +/* Decode a (multi)?byte string and return the wide-character string result. */ public Char *ct_decode_string(const char *, ct_buffer_t *); /* Decode a (multi)?byte argv string array. @@ -206,7 +211,7 @@ protected size_t ct_enc_width(Char); /* The maximum buffer size to hold the most unwieldly visual representation, * in this case \U+nnnnn. */ -#define VISUAL_WIDTH_MAX 8 +#define VISUAL_WIDTH_MAX ((size_t)8) /* The terminal is thought of in terms of X columns by Y lines. In the cases * where a wide character takes up more than one column, the adjacent Modified: vendor/NetBSD/libedit/dist/common.c ============================================================================== --- vendor/NetBSD/libedit/dist/common.c Tue Sep 25 05:56:59 2012 (r240914) +++ vendor/NetBSD/libedit/dist/common.c Tue Sep 25 10:41:30 2012 (r240915) @@ -1,4 +1,4 @@ -/* $NetBSD: common.c,v 1.24 2009/12/30 22:37:40 christos Exp $ */ +/* $NetBSD: common.c,v 1.29 2012/03/24 20:08:43 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: common.c,v 1.24 2009/12/30 22:37:40 christos Exp $"); +__RCSID("$NetBSD: common.c,v 1.29 2012/03/24 20:08:43 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -57,7 +57,7 @@ ed_end_of_file(EditLine *el, Int c __att re_goto_bottom(el); *el->el_line.lastchar = '\0'; - return (CC_EOF); + return CC_EOF; } @@ -71,7 +71,7 @@ ed_insert(EditLine *el, Int c) int count = el->el_state.argument; if (c == '\0') - return (CC_ERROR); + return CC_ERROR; if (el->el_line.lastchar + el->el_state.argument >= el->el_line.limit) { @@ -99,7 +99,7 @@ ed_insert(EditLine *el, Int c) if (el->el_state.inputmode == MODE_REPLACE_1) return vi_command_mode(el, 0); - return (CC_NORM); + return CC_NORM; } @@ -114,7 +114,7 @@ ed_delete_prev_word(EditLine *el, Int c Char *cp, *p, *kp; if (el->el_line.cursor == el->el_line.buffer) - return (CC_ERROR); + return CC_ERROR; cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, el->el_state.argument, ce__isword); @@ -127,7 +127,7 @@ ed_delete_prev_word(EditLine *el, Int c el->el_line.cursor = cp; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; /* bounds check */ - return (CC_REFRESH); + return CC_REFRESH; } @@ -137,9 +137,9 @@ ed_delete_prev_word(EditLine *el, Int c */ protected el_action_t /*ARGSUSED*/ -ed_delete_next_char(EditLine *el, Int c) +ed_delete_next_char(EditLine *el, Int c __attribute__((__unused__))) { -#ifdef notdef /* XXX */ +#ifdef DEBUG_EDIT #define EL el->el_line (void) fprintf(el->el_errlfile, "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", @@ -152,32 +152,29 @@ ed_delete_next_char(EditLine *el, Int c) if (el->el_line.cursor == el->el_line.buffer) { /* if I'm also at the beginning */ #ifdef KSHVI - return (CC_ERROR); + return CC_ERROR; #else /* then do an EOF */ - term_writec(el, c); - return (CC_EOF); + terminal_writec(el, c); + return CC_EOF; #endif } else { #ifdef KSHVI el->el_line.cursor--; #else - return (CC_ERROR); + return CC_ERROR; #endif } - } else { - if (el->el_line.cursor != el->el_line.buffer) - el->el_line.cursor--; - else - return (CC_ERROR); - } + } else + return CC_ERROR; } c_delafter(el, el->el_state.argument); /* delete after dot */ - if (el->el_line.cursor >= el->el_line.lastchar && + if (el->el_map.type == MAP_VI && + el->el_line.cursor >= el->el_line.lastchar && el->el_line.cursor > el->el_line.buffer) /* bounds check */ el->el_line.cursor = el->el_line.lastchar - 1; - return (CC_REFRESH); + return CC_REFRESH; } @@ -198,7 +195,7 @@ ed_kill_line(EditLine *el, Int c __attri el->el_chared.c_kill.last = kp; /* zap! -- delete to end */ el->el_line.lastchar = el->el_line.cursor; - return (CC_REFRESH); + return CC_REFRESH; } @@ -215,13 +212,13 @@ ed_move_to_end(EditLine *el, Int c __att if (el->el_map.type == MAP_VI) { if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); - return (CC_REFRESH); + return CC_REFRESH; } #ifdef VI_MOVE el->el_line.cursor--; #endif } - return (CC_CURSOR); + return CC_CURSOR; } @@ -242,10 +239,10 @@ ed_move_to_beg(EditLine *el, Int c __att el->el_line.cursor++; if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); - return (CC_REFRESH); + return CC_REFRESH; } } - return (CC_CURSOR); + return CC_CURSOR; } @@ -259,7 +256,7 @@ ed_transpose_chars(EditLine *el, Int c) if (el->el_line.cursor < el->el_line.lastchar) { if (el->el_line.lastchar <= &el->el_line.buffer[1]) - return (CC_ERROR); + return CC_ERROR; else el->el_line.cursor++; } @@ -268,9 +265,9 @@ ed_transpose_chars(EditLine *el, Int c) c = el->el_line.cursor[-2]; el->el_line.cursor[-2] = el->el_line.cursor[-1]; el->el_line.cursor[-1] = c; - return (CC_REFRESH); + return CC_REFRESH; } else - return (CC_ERROR); + return CC_ERROR; } @@ -288,7 +285,7 @@ ed_next_char(EditLine *el, Int c __attri (el->el_line.cursor == lim - 1 && el->el_map.type == MAP_VI && el->el_chared.c_vcmd.action == NOP)) - return (CC_ERROR); + return CC_ERROR; el->el_line.cursor += el->el_state.argument; if (el->el_line.cursor > lim) @@ -297,9 +294,9 @@ ed_next_char(EditLine *el, Int c __attri if (el->el_map.type == MAP_VI) if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); - return (CC_REFRESH); + return CC_REFRESH; } - return (CC_CURSOR); + return CC_CURSOR; } @@ -313,7 +310,7 @@ ed_prev_word(EditLine *el, Int c __attri { if (el->el_line.cursor == el->el_line.buffer) - return (CC_ERROR); + return CC_ERROR; el->el_line.cursor = c__prev_word(el->el_line.cursor, el->el_line.buffer, @@ -323,9 +320,9 @@ ed_prev_word(EditLine *el, Int c __attri if (el->el_map.type == MAP_VI) if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); - return (CC_REFRESH); + return CC_REFRESH; } - return (CC_CURSOR); + return CC_CURSOR; } @@ -346,11 +343,11 @@ ed_prev_char(EditLine *el, Int c __attri if (el->el_map.type == MAP_VI) if (el->el_chared.c_vcmd.action != NOP) { cv_delfini(el); - return (CC_REFRESH); + return CC_REFRESH; } - return (CC_CURSOR); + return CC_CURSOR; } else - return (CC_ERROR); + return CC_ERROR; } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 10:42:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 385B31065673; Tue, 25 Sep 2012 10:42:14 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B0408FC16; Tue, 25 Sep 2012 10:42:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PAgD9N015097; Tue, 25 Sep 2012 10:42:13 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PAgDdB015096; Tue, 25 Sep 2012 10:42:13 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201209251042.q8PAgDdB015096@svn.freebsd.org> From: Ed Schouten Date: Tue, 25 Sep 2012 10:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240916 - vendor/NetBSD/libedit/2012-09-25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 10:42:14 -0000 Author: ed Date: Tue Sep 25 10:42:13 2012 New Revision: 240916 URL: http://svn.freebsd.org/changeset/base/240916 Log: "Tag" the "2012/09/25 10:41:11 UTC" import. Added: vendor/NetBSD/libedit/2012-09-25/ - copied from r240915, vendor/NetBSD/libedit/dist/ From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 10:52:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8FF01065672; Tue, 25 Sep 2012 10:52:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 951828FC0A; Tue, 25 Sep 2012 10:52:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PAqnFU017002; Tue, 25 Sep 2012 10:52:49 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PAqnZP017000; Tue, 25 Sep 2012 10:52:49 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201209251052.q8PAqnZP017000@svn.freebsd.org> From: Alexander Motin Date: Tue, 25 Sep 2012 10:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240917 - head/sys/dev/drm2/i915 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 10:52:49 -0000 Author: mav Date: Tue Sep 25 10:52:49 2012 New Revision: 240917 URL: http://svn.freebsd.org/changeset/base/240917 Log: Reduce delays in several wait loops from 10ms to 10us, same is it is done in Linux. This substantially increases graphics performance on Ivy Bridge. Submitted by: avg@ Reviewed by: kib@ Modified: head/sys/dev/drm2/i915/i915_drv.c Modified: head/sys/dev/drm2/i915/i915_drv.c ============================================================================== --- head/sys/dev/drm2/i915/i915_drv.c Tue Sep 25 10:42:13 2012 (r240916) +++ head/sys/dev/drm2/i915/i915_drv.c Tue Sep 25 10:52:49 2012 (r240917) @@ -486,14 +486,14 @@ __gen6_gt_force_wake_get(struct drm_i915 count = 0; while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_ACK) & 1)) - DELAY(10000); + DELAY(10); I915_WRITE_NOTRACE(FORCEWAKE, 1); POSTING_READ(FORCEWAKE); count = 0; while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_ACK) & 1) == 0) - DELAY(10000); + DELAY(10); } void @@ -503,14 +503,14 @@ __gen6_gt_force_wake_mt_get(struct drm_i count = 0; while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_MT_ACK) & 1)) - DELAY(10000); + DELAY(10); I915_WRITE_NOTRACE(FORCEWAKE_MT, (1<<16) | 1); POSTING_READ(FORCEWAKE_MT); count = 0; while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_MT_ACK) & 1) == 0) - DELAY(10000); + DELAY(10); } void @@ -572,7 +572,7 @@ __gen6_gt_wait_for_fifo(struct drm_i915_ int loop = 500; u32 fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES); while (fifo <= GT_FIFO_NUM_RESERVED_ENTRIES && loop--) { - DELAY(10000); + DELAY(10); fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES); } if (loop < 0 && fifo <= GT_FIFO_NUM_RESERVED_ENTRIES) { From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 12:45:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15E761065674; Tue, 25 Sep 2012 12:45:42 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 005338FC0C; Tue, 25 Sep 2012 12:45:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PCjfQv031368; Tue, 25 Sep 2012 12:45:41 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PCjfe8031366; Tue, 25 Sep 2012 12:45:41 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201209251245.q8PCjfe8031366@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 25 Sep 2012 12:45:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240918 - head/sys/contrib/altq/altq X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 12:45:42 -0000 Author: glebius Date: Tue Sep 25 12:45:41 2012 New Revision: 240918 URL: http://svn.freebsd.org/changeset/base/240918 Log: Fix panic introduced by me in r240835, when zero weight was passed to wtab_alloc(). Reported by: Kim Culhan Modified: head/sys/contrib/altq/altq/altq_red.c Modified: head/sys/contrib/altq/altq/altq_red.c ============================================================================== --- head/sys/contrib/altq/altq/altq_red.c Tue Sep 25 10:52:49 2012 (r240917) +++ head/sys/contrib/altq/altq/altq_red.c Tue Sep 25 12:45:41 2012 (r240918) @@ -235,6 +235,11 @@ red_alloc(int weight, int inv_pmax, int if (rp == NULL) return (NULL); + if (weight == 0) + rp->red_weight = W_WEIGHT; + else + rp->red_weight = weight; + /* allocate weight table */ rp->red_wtab = wtab_alloc(rp->red_weight); if (rp->red_wtab == NULL) { @@ -245,10 +250,6 @@ red_alloc(int weight, int inv_pmax, int rp->red_avg = 0; rp->red_idle = 1; - if (weight == 0) - rp->red_weight = W_WEIGHT; - else - rp->red_weight = weight; if (inv_pmax == 0) rp->red_inv_pmax = default_inv_pmax; else From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 13:32:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06396106564A; Tue, 25 Sep 2012 13:32:06 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E484D8FC0A; Tue, 25 Sep 2012 13:32:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PDW5X0037505; Tue, 25 Sep 2012 13:32:05 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PDW57L037503; Tue, 25 Sep 2012 13:32:05 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201209251332.q8PDW57L037503@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 25 Sep 2012 13:32:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240919 - stable/9/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 13:32:06 -0000 Author: tijl Date: Tue Sep 25 13:32:05 2012 New Revision: 240919 URL: http://svn.freebsd.org/changeset/base/240919 Log: MFC r240701: Fix a panic when trying to play invalid audio tracks. PR: kern/167340 Reported by: Michael L. Semon Modified: stable/9/sys/cam/scsi/scsi_cd.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_cd.c Tue Sep 25 12:45:41 2012 (r240918) +++ stable/9/sys/cam/scsi/scsi_cd.c Tue Sep 25 13:32:05 2012 (r240919) @@ -1990,6 +1990,7 @@ cdioctl(struct disk *dp, u_long cmd, voi || (st > (softc->toc.header.ending_track - softc->toc.header.starting_track))) { error = EINVAL; + cam_periph_unlock(periph); break; } sentry = &softc->toc.entries[st].addr; From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 13:34:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68D661065674; Tue, 25 Sep 2012 13:34:10 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 535DF8FC24; Tue, 25 Sep 2012 13:34:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PDYAIN037832; Tue, 25 Sep 2012 13:34:10 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PDYA3J037830; Tue, 25 Sep 2012 13:34:10 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201209251334.q8PDYA3J037830@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 25 Sep 2012 13:34:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240920 - stable/8/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 13:34:10 -0000 Author: tijl Date: Tue Sep 25 13:34:09 2012 New Revision: 240920 URL: http://svn.freebsd.org/changeset/base/240920 Log: MFC r240701: Fix a panic when trying to play invalid audio tracks. PR: kern/167340 Reported by: Michael L. Semon Modified: stable/8/sys/cam/scsi/scsi_cd.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_cd.c Tue Sep 25 13:32:05 2012 (r240919) +++ stable/8/sys/cam/scsi/scsi_cd.c Tue Sep 25 13:34:09 2012 (r240920) @@ -1962,6 +1962,7 @@ cdioctl(struct disk *dp, u_long cmd, voi || (st > (softc->toc.header.ending_track - softc->toc.header.starting_track))) { error = EINVAL; + cam_periph_unlock(periph); break; } sentry = &softc->toc.entries[st].addr; From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 14:55:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5152C106564A; Tue, 25 Sep 2012 14:55:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C7068FC15; Tue, 25 Sep 2012 14:55:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PEtlxA047967; Tue, 25 Sep 2012 14:55:47 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PEtlE0047965; Tue, 25 Sep 2012 14:55:47 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201209251455.q8PEtlE0047965@svn.freebsd.org> From: John Baldwin Date: Tue, 25 Sep 2012 14:55:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240921 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 14:55:47 -0000 Author: jhb Date: Tue Sep 25 14:55:46 2012 New Revision: 240921 URL: http://svn.freebsd.org/changeset/base/240921 Log: Add optional entropy harvesting for software interrupts in swi_sched() as controlled by kern.random.sys.harvest.swi. SWI harvesting feeds into the interrupt FIFO and each event is estimated as providing a single bit of entropy. Reviewed by: markm, obrien MFC after: 2 weeks Modified: head/sys/kern/kern_intr.c Modified: head/sys/kern/kern_intr.c ============================================================================== --- head/sys/kern/kern_intr.c Tue Sep 25 13:34:09 2012 (r240920) +++ head/sys/kern/kern_intr.c Tue Sep 25 14:55:46 2012 (r240921) @@ -1144,11 +1144,21 @@ swi_sched(void *cookie, int flags) { struct intr_handler *ih = (struct intr_handler *)cookie; struct intr_event *ie = ih->ih_event; + struct intr_entropy entropy; int error; CTR3(KTR_INTR, "swi_sched: %s %s need=%d", ie->ie_name, ih->ih_name, ih->ih_need); + if (harvest.swi) { + CTR2(KTR_INTR, "swi_sched: pid %d (%s) gathering entropy", + curproc->p_pid, curthread->td_name); + entropy.event = (uintptr_t)ih; + entropy.td = curthread; + random_harvest(&entropy, sizeof(entropy), 1, 0, + RANDOM_INTERRUPT); + } + /* * Set ih_need for this handler so that if the ithread is already * running it will execute this handler on the next pass. Otherwise, From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 15:17:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3973E106566C; Tue, 25 Sep 2012 15:17:09 +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 0521F8FC0C; Tue, 25 Sep 2012 15:17:09 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 450A0B944; Tue, 25 Sep 2012 11:17:08 -0400 (EDT) From: John Baldwin To: Dimitry Andric Date: Tue, 25 Sep 2012 08:07:46 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201209211031.q8LAVKVC014601@svn.freebsd.org> In-Reply-To: <201209211031.q8LAVKVC014601@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201209250807.46163.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 25 Sep 2012 11:17:08 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240773 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 15:17:09 -0000 On Friday, September 21, 2012 6:31:20 am Dimitry Andric wrote: > Author: dim > Date: Fri Sep 21 10:31:19 2012 > New Revision: 240773 > URL: http://svn.freebsd.org/changeset/base/240773 > > Log: > After r205013, amd64 and i386 CPU family and model IDs were printed out > in hexadecimal, but without any 0x prefix, which can be very misleading. > > MFC after: 3 days This overflows 80 columns now where it did not before. Intel manuals tend to use a trailing 'h' suffix rather than an '0x' prefix. (It is common to see text like '06_2Ah'.) The prefix was previously left off on purpose due to the 80 colummns overflow. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 15:17:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 88A2F1065673; Tue, 25 Sep 2012 15:17:09 +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 5D6438FC15; Tue, 25 Sep 2012 15:17:09 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A6109B949; Tue, 25 Sep 2012 11:17:08 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Date: Tue, 25 Sep 2012 08:11:10 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201209221217.q8MCH9Ip064471@svn.freebsd.org> In-Reply-To: <201209221217.q8MCH9Ip064471@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201209250811.10887.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 25 Sep 2012 11:17:08 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240813 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 15:17:09 -0000 On Saturday, September 22, 2012 8:17:09 am Konstantin Belousov wrote: > Author: kib > Date: Sat Sep 22 12:17:09 2012 > New Revision: 240813 > URL: http://svn.freebsd.org/changeset/base/240813 > > Log: > Do not skip two elements of the tid_buffer when reusing the buffer > slot. This eventually results in exhaustion of the tid space, causing > new threads get tid -1 as identifier. > > The bad effect of having the thread id equal to -1 is that > UMTX_OP_UMUTEX_WAIT returns EFAULT for a lock owned by such thread, > because casuword cannot distinguish between literal value -1 read from > the address and -1 returned as an indication of faulted > access. _thr_umutex_lock() helper from libthr does not check for > errors from _umtx_op_err(2), causing an infinite loop in > mutex_lock_sleep(). > > We observed the JVM processes hanging and consuming enormous amount of > system time on machines with approximately 100 days uptime. > > Reported by: Mykola Dzham > MFC after: 1 week > > Modified: > head/sys/kern/kern_thread.c > > Modified: head/sys/kern/kern_thread.c > ============================================================================== > --- head/sys/kern/kern_thread.c Sat Sep 22 12:12:39 2012 (r240812) > +++ head/sys/kern/kern_thread.c Sat Sep 22 12:17:09 2012 (r240813) > @@ -116,7 +116,7 @@ tid_free(lwpid_t tid) > mtx_lock(&tid_lock); > if ((tid_tail + 1) % TID_BUFFER_SIZE == tid_head) { > tmp_tid = tid_buffer[tid_head++]; > - tid_head = (tid_head + 1) % TID_BUFFER_SIZE; > + tid_head %= TID_BUFFER_SIZE; I actually think it would be clearer (to the reader) to remove the ++ side effect in the tmp_tid assignment so that the update to tid_head is self contained in one statement. Of course, the update to tid_tail below suffers from the same obfuscation. > } > tid_buffer[tid_tail++] = tid; > tid_tail %= TID_BUFFER_SIZE; > -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 16:14:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABA3B1065700; Tue, 25 Sep 2012 16:14:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) by mx1.freebsd.org (Postfix) with ESMTP id 6104F8FC16; Tue, 25 Sep 2012 16:14:14 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:2c64:e0f1:ab25:e270] (unknown [IPv6:2001:7b8:3a7:0:2c64:e0f1:ab25:e270]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 6A2235C59; Tue, 25 Sep 2012 18:14:07 +0200 (CEST) Message-ID: <5061D84D.4020400@FreeBSD.org> Date: Tue, 25 Sep 2012 18:14:05 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20120905 Thunderbird/16.0 MIME-Version: 1.0 To: John Baldwin References: <201209211031.q8LAVKVC014601@svn.freebsd.org> <201209250807.46163.jhb@freebsd.org> In-Reply-To: <201209250807.46163.jhb@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 Subject: Re: svn commit: r240773 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 16:14:14 -0000 On 2012-09-25 14:07, John Baldwin wrote: > On Friday, September 21, 2012 6:31:20 am Dimitry Andric wrote: >> Author: dim >> Date: Fri Sep 21 10:31:19 2012 >> New Revision: 240773 >> URL: http://svn.freebsd.org/changeset/base/240773 >> >> Log: >> After r205013, amd64 and i386 CPU family and model IDs were printed out >> in hexadecimal, but without any 0x prefix, which can be very misleading. >> >> MFC after: 3 days > > This overflows 80 columns now where it did not before. Ehm, most of dmesg lines overflow 80 columns; in fact, the lines just below this print the CPU feature bits, which are easily a few wrapped lines long. So I don't really see the point in obfuscating those numbers. Are we interested more in "beautifying", than giving unambiguous information? > Intel manuals tend > to use a trailing 'h' suffix rather than an '0x' prefix. (It is common to > see text like '06_2Ah'.) The prefix was previously left off on purpose due to > the 80 colummns overflow. I think that was a mistake, if something is hexadecimal, it should be clearly indicated, otherwise it is extremely confusing. Intel assembly is basically the only variant still out there using the 'h' suffix, the rest of the (C) world uses 0x. :) From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 17:22:48 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE6061065672; Tue, 25 Sep 2012 17:22:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 292CD8FC18; Tue, 25 Sep 2012 17:22:46 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id UAA10020; Tue, 25 Sep 2012 20:22:45 +0300 (EEST) (envelope-from avg@FreeBSD.org) Message-ID: <5061E864.8090200@FreeBSD.org> Date: Tue, 25 Sep 2012 20:22:44 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: Dimitry Andric References: <201209211031.q8LAVKVC014601@svn.freebsd.org> <201209250807.46163.jhb@freebsd.org> <5061D84D.4020400@FreeBSD.org> In-Reply-To: <5061D84D.4020400@FreeBSD.org> X-Enigmail-Version: 1.4.3 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, John Baldwin Subject: Re: svn commit: r240773 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 17:22:48 -0000 on 09/25/12 19:14 Dimitry Andric said the following: > Are we interested more in "beautifying", than giving > unambiguous information? OTOH, I have never seen CPUID numbers in decimal. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 19:12:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F37091065678; Tue, 25 Sep 2012 19:12:12 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DECEB8FC0A; Tue, 25 Sep 2012 19:12:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PJCC8w080585; Tue, 25 Sep 2012 19:12:12 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PJCCrj080583; Tue, 25 Sep 2012 19:12:12 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201209251912.q8PJCCrj080583@svn.freebsd.org> From: Ryan Stone Date: Tue, 25 Sep 2012 19:12:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240923 - head/sys/dev/aac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 19:12:13 -0000 Author: rstone Date: Tue Sep 25 19:12:12 2012 New Revision: 240923 URL: http://svn.freebsd.org/changeset/base/240923 Log: Some aac(4) adapters will always report that a direct access device is offline in response to a INQUIRY command that does not retreive vital product data(I personally have observed the behaviour on an Adaptec 2405 and a 5805). Force the peripheral qualifier to "connected" so that upper layers correctly recognize that a disk is present. This bug was uncovered by r216236. Prior to that fix, aac(4) was accidentally clearing the peripheral qualifier for all inquiry commands. This fixes an issue where passthrough devices were not created for disks behind aac(4) controllers suffering from the bug. I have verified that if a disk is not present that we still properly detect that and not create the passthrough device. Sponsored by: Sandvine Incorporated MFC after: 1 week Modified: head/sys/dev/aac/aac_cam.c Modified: head/sys/dev/aac/aac_cam.c ============================================================================== --- head/sys/dev/aac/aac_cam.c Tue Sep 25 19:08:51 2012 (r240922) +++ head/sys/dev/aac/aac_cam.c Tue Sep 25 19:12:12 2012 (r240923) @@ -527,6 +527,53 @@ aac_cam_poll(struct cam_sim *sim) } static void +aac_cam_fix_inquiry(struct aac_softc *sc, union ccb *ccb) +{ + struct scsi_inquiry_data *inq; + uint8_t *data; + uint8_t device, qual; + + /* If this is an inquiry command, fake things out */ + if (ccb->ccb_h.flags & CAM_CDB_POINTER) + data = ccb->csio.cdb_io.cdb_ptr; + else + data = ccb->csio.cdb_io.cdb_bytes; + + if (data[0] != INQUIRY) + return; + + if (ccb->ccb_h.status == CAM_REQ_CMP) { + inq = (struct scsi_inquiry_data *)ccb->csio.data_ptr; + device = SID_TYPE(inq); + qual = SID_QUAL(inq); + + /* + * We want DASD and PROC devices to only be + * visible through the pass device. + */ + if (((device == T_DIRECT) || + (device == T_PROCESSOR) || + (sc->flags & AAC_FLAGS_CAM_PASSONLY))) { + /* + * Some aac(4) adapters will always report that a direct + * access device is offline in response to a INQUIRY + * command that does not retreive vital product data. + * Force the qualifier to connected so that upper layers + * correctly recognize that a disk is present. + */ + if ((data[1] & SI_EVPD) == 0 && device == T_DIRECT && + qual == SID_QUAL_LU_OFFLINE) + qual = SID_QUAL_LU_CONNECTED; + ccb->csio.data_ptr[0] = (qual << 5) | T_NODEVICE; + } + } else if (ccb->ccb_h.status == CAM_SEL_TIMEOUT && + ccb->ccb_h.target_lun != 0) { + /* fix for INQUIRYs on Lun>0 */ + ccb->ccb_h.status = CAM_DEV_NOT_THERE; + } +} + +static void aac_cam_complete(struct aac_command *cm) { union ccb *ccb; @@ -551,8 +598,6 @@ aac_cam_complete(struct aac_command *cm) /* Take care of SCSI_IO ops. */ if (ccb->ccb_h.func_code == XPT_SCSI_IO) { - u_int8_t command, device; - ccb->csio.scsi_status = srbr->scsi_status; /* Take care of autosense */ @@ -572,31 +617,7 @@ aac_cam_complete(struct aac_command *cm) // scsi_sense_print(&ccb->csio); } - /* If this is an inquiry command, fake things out */ - if (ccb->ccb_h.flags & CAM_CDB_POINTER) - command = ccb->csio.cdb_io.cdb_ptr[0]; - else - command = ccb->csio.cdb_io.cdb_bytes[0]; - - if (command == INQUIRY) { - if (ccb->ccb_h.status == CAM_REQ_CMP) { - device = ccb->csio.data_ptr[0] & 0x1f; - /* - * We want DASD and PROC devices to only be - * visible through the pass device. - */ - if ((device == T_DIRECT) || - (device == T_PROCESSOR) || - (sc->flags & AAC_FLAGS_CAM_PASSONLY)) - ccb->csio.data_ptr[0] = - ((ccb->csio.data_ptr[0] & 0xe0) | - T_NODEVICE); - } else if (ccb->ccb_h.status == CAM_SEL_TIMEOUT && - ccb->ccb_h.target_lun != 0) { - /* fix for INQUIRYs on Lun>0 */ - ccb->ccb_h.status = CAM_DEV_NOT_THERE; - } - } + aac_cam_fix_inquiry(sc, ccb); } } From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 19:16:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AED77106564A; Tue, 25 Sep 2012 19:16:29 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 80D898FC16; Tue, 25 Sep 2012 19:16:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PJGTmG081180; Tue, 25 Sep 2012 19:16:29 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PJGTR4081178; Tue, 25 Sep 2012 19:16:29 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201209251916.q8PJGTR4081178@svn.freebsd.org> From: "George V. Neville-Neil" Date: Tue, 25 Sep 2012 19:16:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240924 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 19:16:29 -0000 Author: gnn Date: Tue Sep 25 19:16:28 2012 New Revision: 240924 URL: http://svn.freebsd.org/changeset/base/240924 Log: Change the module name for the I/O provider to "kernel" from "genunix" This will requires us to modify externally created DTrace scripts but makes logical sense for FreeBSD. Requested by: rpaulo MFC after: 2 weeks Modified: head/sys/kern/dtio_kdtrace.c Modified: head/sys/kern/dtio_kdtrace.c ============================================================================== --- head/sys/kern/dtio_kdtrace.c Tue Sep 25 19:12:12 2012 (r240923) +++ head/sys/kern/dtio_kdtrace.c Tue Sep 25 19:16:28 2012 (r240924) @@ -56,7 +56,7 @@ static dtrace_pattr_t dtio_attr = { { DTRACE_STABILITY_STABLE, DTRACE_STABILITY_STABLE, DTRACE_CLASS_COMMON }, }; -static char *genunix = "genunix"; +static char *kernel = "kernel"; /* * Name strings. @@ -113,25 +113,25 @@ dtio_provide(void *arg, dtrace_probedesc if (desc != NULL) return; - if (dtrace_probe_lookup(dtio_id, genunix, NULL, + if (dtrace_probe_lookup(dtio_id, kernel, NULL, dtio_start_str) == 0) { - dtio_start_id = dtrace_probe_create(dtio_id, genunix, NULL, + dtio_start_id = dtrace_probe_create(dtio_id, kernel, NULL, dtio_start_str, 0, NULL); } - if (dtrace_probe_lookup(dtio_id, genunix, NULL, dtio_done_str) == 0) { - dtio_done_id = dtrace_probe_create(dtio_id, genunix, NULL, + if (dtrace_probe_lookup(dtio_id, kernel, NULL, dtio_done_str) == 0) { + dtio_done_id = dtrace_probe_create(dtio_id, kernel, NULL, dtio_done_str, 0, NULL); } - if (dtrace_probe_lookup(dtio_id, genunix, NULL, + if (dtrace_probe_lookup(dtio_id, kernel, NULL, dtio_wait_start_str) == 0) { - dtio_wait_start_id = dtrace_probe_create(dtio_id, genunix, + dtio_wait_start_id = dtrace_probe_create(dtio_id, kernel, NULL, dtio_wait_start_str, 0, NULL); } - if (dtrace_probe_lookup(dtio_id, genunix, NULL, + if (dtrace_probe_lookup(dtio_id, kernel, NULL, dtio_wait_done_str) == 0) { - dtio_wait_done_id = dtrace_probe_create(dtio_id, genunix, NULL, + dtio_wait_done_id = dtrace_probe_create(dtio_id, kernel, NULL, dtio_wait_done_str, 0, NULL); } From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 19:37:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4C8431065672; Tue, 25 Sep 2012 19:37:26 +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 1FB328FC1B; Tue, 25 Sep 2012 19:37:26 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 30D01B911; Tue, 25 Sep 2012 15:37:25 -0400 (EDT) From: John Baldwin To: Andriy Gapon Date: Tue, 25 Sep 2012 13:39:08 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201209211031.q8LAVKVC014601@svn.freebsd.org> <5061D84D.4020400@FreeBSD.org> <5061E864.8090200@FreeBSD.org> In-Reply-To: <5061E864.8090200@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201209251339.08573.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 25 Sep 2012 15:37:25 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric Subject: Re: svn commit: r240773 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 19:37:26 -0000 On Tuesday, September 25, 2012 1:22:44 pm Andriy Gapon wrote: > on 09/25/12 19:14 Dimitry Andric said the following: > > Are we interested more in "beautifying", than giving > > unambiguous information? > > OTOH, I have never seen CPUID numbers in decimal. And the place you typically will use these is in looking at Intel's manuals in which case they have the _h layout. If you want to gratuitously change the format, I'd vote for outputting the string as '06_2Ah'. Note that the full ID is already printed out earlier on the same line with a trailing 0x, so it's not clear to me that it was confusing before. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 20:41:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA7031065672; Tue, 25 Sep 2012 20:41:43 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E2668FC18; Tue, 25 Sep 2012 20:41:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PKfhka092065; Tue, 25 Sep 2012 20:41:43 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PKfh7H092063; Tue, 25 Sep 2012 20:41:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201209252041.q8PKfh7H092063@svn.freebsd.org> From: Adrian Chadd Date: Tue, 25 Sep 2012 20:41:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240926 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 20:41:43 -0000 Author: adrian Date: Tue Sep 25 20:41:43 2012 New Revision: 240926 URL: http://svn.freebsd.org/changeset/base/240926 Log: Oops - don't do the clrdmask check in ath_tx_xmit_normal() - the wrong lock may be held. Kim reported that the TID lock wasn't held when ath_tx_update_clrdmask() was called. Well, the underlying hardware TXQ for that TID. I'm betting it's the cabq stuff. ath_tx_xmit_normal() can be called for both real and software cabq. For software cabq, the real destination txq is different to the txq. So, the lock check will fail. Reported by: Kim Culhan 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 Sep 25 20:27:42 2012 (r240925) +++ head/sys/dev/ath/if_ath_tx.c Tue Sep 25 20:41:43 2012 (r240926) @@ -1356,9 +1356,6 @@ ath_tx_xmit_normal(struct ath_softc *sc, */ bf->bf_state.bfs_txflags |= HAL_TXDESC_CLRDMASK; - /* See if clrdmask needs to be set */ - ath_tx_update_clrdmask(sc, tid, bf); - /* Setup the descriptor before handoff */ ath_tx_do_ratelookup(sc, bf); ath_tx_calc_duration(sc, bf); @@ -2820,6 +2817,8 @@ ath_tx_swq(struct ath_softc *sc, struct } else if (txq->axq_depth < sc->sc_hwq_limit) { /* AMPDU not running, attempt direct dispatch */ DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: xmit_normal\n", __func__); + /* See if clrdmask needs to be set */ + ath_tx_update_clrdmask(sc, atid, bf); ath_tx_xmit_normal(sc, txq, bf); } else { /* Busy; queue */ From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 20:48:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4CC84106566C; Tue, 25 Sep 2012 20:48:50 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 390428FC0A; Tue, 25 Sep 2012 20:48:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PKmoWp092944; Tue, 25 Sep 2012 20:48:50 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PKmoUP092942; Tue, 25 Sep 2012 20:48:50 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201209252048.q8PKmoUP092942@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 25 Sep 2012 20:48:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240927 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 20:48:50 -0000 Author: pjd Date: Tue Sep 25 20:48:49 2012 New Revision: 240927 URL: http://svn.freebsd.org/changeset/base/240927 Log: O_EXEC flag is not part of the O_ACCMODE mask, check it separately. If O_EXEC is provided don't require CAP_READ/CAP_WRITE, as O_EXEC is mutually exclusive to O_RDONLY/O_WRONLY/O_RDWR. Without this change CAP_FEXECVE capability right is not enforced. Sponsored by: FreeBSD Foundation MFC after: 3 days Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Tue Sep 25 20:41:43 2012 (r240926) +++ head/sys/kern/vfs_syscalls.c Tue Sep 25 20:48:49 2012 (r240927) @@ -1006,22 +1006,20 @@ flags_to_rights(int flags) { cap_rights_t rights = 0; - switch ((flags & O_ACCMODE)) { - case O_RDONLY: - rights |= CAP_READ; - break; - - case O_RDWR: - rights |= CAP_READ; - /* fall through */ - - case O_WRONLY: - rights |= CAP_WRITE; - break; - - case O_EXEC: + if (flags & O_EXEC) { rights |= CAP_FEXECVE; - break; + } else { + switch ((flags & O_ACCMODE)) { + case O_RDONLY: + rights |= CAP_READ; + break; + case O_RDWR: + rights |= CAP_READ; + /* FALLTHROUGH */ + case O_WRONLY: + rights |= CAP_WRITE; + break; + } } if (flags & O_CREAT) From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 20:58:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BB88D106564A; Tue, 25 Sep 2012 20:58:15 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A64078FC0A; Tue, 25 Sep 2012 20:58:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PKwFHh094579; Tue, 25 Sep 2012 20:58:15 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PKwFOa094577; Tue, 25 Sep 2012 20:58:15 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201209252058.q8PKwFOa094577@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 25 Sep 2012 20:58:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240928 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 20:58:15 -0000 Author: pjd Date: Tue Sep 25 20:58:15 2012 New Revision: 240928 URL: http://svn.freebsd.org/changeset/base/240928 Log: Require CAP_CREATE on directory descriptor for linkat(2). Sponsored by: FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Tue Sep 25 20:48:49 2012 (r240927) +++ head/sys/kern/vfs_syscalls.c Tue Sep 25 20:58:15 2012 (r240928) @@ -1622,8 +1622,8 @@ kern_linkat(struct thread *td, int fd1, VFS_UNLOCK_GIANT(vfslocked); return (error); } - NDINIT_AT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE2, - segflg, path2, fd2, td); + NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE | + AUDITVNODE2, segflg, path2, fd2, CAP_CREATE, td); if ((error = namei(&nd)) == 0) { lvfslocked = NDHASGIANT(&nd); if (nd.ni_vp != NULL) { From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 20:59:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F3C51065670; Tue, 25 Sep 2012 20:59:13 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7AF398FC17; Tue, 25 Sep 2012 20:59:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PKxDHr094713; Tue, 25 Sep 2012 20:59:13 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PKxDpn094711; Tue, 25 Sep 2012 20:59:13 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201209252059.q8PKxDpn094711@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 25 Sep 2012 20:59:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240929 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 20:59:13 -0000 Author: pjd Date: Tue Sep 25 20:59:12 2012 New Revision: 240929 URL: http://svn.freebsd.org/changeset/base/240929 Log: Require CAP_CREATE on directory descriptor for symlinkat(2). Sponsored by: FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Tue Sep 25 20:58:15 2012 (r240928) +++ head/sys/kern/vfs_syscalls.c Tue Sep 25 20:59:12 2012 (r240929) @@ -1719,8 +1719,8 @@ kern_symlinkat(struct thread *td, char * AUDIT_ARG_TEXT(syspath); restart: bwillwrite(); - NDINIT_AT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1, - segflg, path2, fd, td); + NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE | + AUDITVNODE1, segflg, path2, fd, CAP_CREATE, td); if ((error = namei(&nd)) != 0) goto out; vfslocked = NDHASGIANT(&nd); From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 21:00:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 434AB106566C; Tue, 25 Sep 2012 21:00:37 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2EC458FC0A; Tue, 25 Sep 2012 21:00:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PL0bRs094889; Tue, 25 Sep 2012 21:00:37 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PL0aFS094887; Tue, 25 Sep 2012 21:00:37 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201209252100.q8PL0aFS094887@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 25 Sep 2012 21:00:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240930 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 21:00:37 -0000 Author: pjd Date: Tue Sep 25 21:00:36 2012 New Revision: 240930 URL: http://svn.freebsd.org/changeset/base/240930 Log: Require CAP_DELETE on directory descriptor for unlinkat(2). Sponsored by: FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Tue Sep 25 20:59:12 2012 (r240929) +++ head/sys/kern/vfs_syscalls.c Tue Sep 25 21:00:36 2012 (r240930) @@ -1881,8 +1881,8 @@ kern_unlinkat(struct thread *td, int fd, restart: bwillwrite(); - NDINIT_AT(&nd, DELETE, LOCKPARENT | LOCKLEAF | MPSAFE | AUDITVNODE1, - pathseg, path, fd, td); + NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | MPSAFE | + AUDITVNODE1, pathseg, path, fd, CAP_DELETE, td); if ((error = namei(&nd)) != 0) return (error == EINVAL ? EPERM : error); vfslocked = NDHASGIANT(&nd); From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 21:11:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CBC7106564A; Tue, 25 Sep 2012 21:11:41 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 684118FC0A; Tue, 25 Sep 2012 21:11:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PLBfHn096281; Tue, 25 Sep 2012 21:11:41 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PLBfmc096279; Tue, 25 Sep 2012 21:11:41 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201209252111.q8PLBfmc096279@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 25 Sep 2012 21:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240931 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 21:11:41 -0000 Author: pjd Date: Tue Sep 25 21:11:40 2012 New Revision: 240931 URL: http://svn.freebsd.org/changeset/base/240931 Log: We cannot open file for reading and executing (O_RDONLY | O_EXEC). Well, in theory we can pass those two flags, because O_RDONLY is 0, but we won't be able to read from a descriptor opened with O_EXEC. Update the comment. Sponsored by: FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/kern_exec.c Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Tue Sep 25 21:00:36 2012 (r240930) +++ head/sys/kern/kern_exec.c Tue Sep 25 21:11:40 2012 (r240931) @@ -441,10 +441,10 @@ interpret: } else { AUDIT_ARG_FD(args->fd); /* - * Some might argue that CAP_READ and/or CAP_MMAP should also - * be required here; such arguments will be entertained. + * Some might argue that CAP_MMAP should also be required here; + * such arguments will be entertained. * - * Descriptors opened only with O_EXEC or O_RDONLY are allowed. + * Descriptors opened only with O_EXEC are allowed. */ error = fgetvp_exec(td, args->fd, CAP_FEXECVE, &binvp); if (error) From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 21:19:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B959A106566B; Tue, 25 Sep 2012 21:19:18 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8AD958FC12; Tue, 25 Sep 2012 21:19:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PLJIdL097393; Tue, 25 Sep 2012 21:19:18 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PLJI0n097390; Tue, 25 Sep 2012 21:19:18 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201209252119.q8PLJI0n097390@svn.freebsd.org> From: Ed Maste Date: Tue, 25 Sep 2012 21:19:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240932 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 21:19:18 -0000 Author: emaste Date: Tue Sep 25 21:19:17 2012 New Revision: 240932 URL: http://svn.freebsd.org/changeset/base/240932 Log: Remove an incorrect comment Modified: head/sys/net/if_tun.c Modified: head/sys/net/if_tun.c ============================================================================== --- head/sys/net/if_tun.c Tue Sep 25 21:11:40 2012 (r240931) +++ head/sys/net/if_tun.c Tue Sep 25 21:19:17 2012 (r240932) @@ -246,7 +246,6 @@ tun_destroy(struct tun_softc *tp) { struct cdev *dev; - /* Unlocked read. */ mtx_lock(&tp->tun_mtx); if ((tp->tun_flags & TUN_OPEN) != 0) cv_wait_unlock(&tp->tun_cv, &tp->tun_mtx); From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 21:31:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2101D106564A; Tue, 25 Sep 2012 21:31:18 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D6DB8FC08; Tue, 25 Sep 2012 21:31:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PLVHN2098987; Tue, 25 Sep 2012 21:31:17 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PLVHba098985; Tue, 25 Sep 2012 21:31:17 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201209252131.q8PLVHba098985@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 25 Sep 2012 21:31:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240936 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 21:31:18 -0000 Author: pjd Date: Tue Sep 25 21:31:17 2012 New Revision: 240936 URL: http://svn.freebsd.org/changeset/base/240936 Log: vn_write() always expects FOF_OFFSET flag, which is asserted at the begining, so there is no need to check for it. Sponsored by: FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Tue Sep 25 21:27:37 2012 (r240935) +++ head/sys/kern/vfs_vnops.c Tue Sep 25 21:31:17 2012 (r240936) @@ -806,10 +806,9 @@ vn_write(fp, uio, active_cred, flags, td goto unlock; advice = get_advice(fp, uio); - - if ((MNT_SHARED_WRITES(mp) || - ((mp == NULL) && MNT_SHARED_WRITES(vp->v_mount))) && - (flags & FOF_OFFSET) != 0) { + + if (MNT_SHARED_WRITES(mp) || + (mp == NULL && MNT_SHARED_WRITES(vp->v_mount))) { lock_flags = LK_SHARED; } else { lock_flags = LK_EXCLUSIVE; From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 22:10:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 404BE1065670; Tue, 25 Sep 2012 22:10:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2CB5F8FC14; Tue, 25 Sep 2012 22:10:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PMAFTS003953; Tue, 25 Sep 2012 22:10:15 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PMAEx5003950; Tue, 25 Sep 2012 22:10:14 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201209252210.q8PMAEx5003950@svn.freebsd.org> From: Ed Maste Date: Tue, 25 Sep 2012 22:10:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240938 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 22:10:15 -0000 Author: emaste Date: Tue Sep 25 22:10:14 2012 New Revision: 240938 URL: http://svn.freebsd.org/changeset/base/240938 Log: Avoid INVARIANTS panic destroying an in-use tap(4) The requirement (implied by the KASSERT in tap_destroy) that the tap is closed isn't valid; destroy_dev will block in devdrn while other threads are in d_* functions. Note: if_tun had the same issue, addressed in SVN revisions r186391, r186483 and r186497. The use of the condvar there appears to be redundant with the functionality provided by destroy_dev. Sponsored by: ADARA Networks Reviewed by: dwhite MFC after: 2 weeks Modified: head/sys/net/if_tap.c head/sys/net/if_tapvar.h Modified: head/sys/net/if_tap.c ============================================================================== --- head/sys/net/if_tap.c Tue Sep 25 21:33:36 2012 (r240937) +++ head/sys/net/if_tap.c Tue Sep 25 22:10:14 2012 (r240938) @@ -213,14 +213,10 @@ tap_destroy(struct tap_softc *tp) { struct ifnet *ifp = tp->tap_ifp; - /* Unlocked read. */ - KASSERT(!(tp->tap_flags & TAP_OPEN), - ("%s flags is out of sync", ifp->if_xname)); - CURVNET_SET(ifp->if_vnet); + destroy_dev(tp->tap_dev); seldrain(&tp->tap_rsel); knlist_destroy(&tp->tap_rsel.si_note); - destroy_dev(tp->tap_dev); ether_ifdetach(ifp); if_free(ifp); Modified: head/sys/net/if_tapvar.h ============================================================================== --- head/sys/net/if_tapvar.h Tue Sep 25 21:33:36 2012 (r240937) +++ head/sys/net/if_tapvar.h Tue Sep 25 22:10:14 2012 (r240938) @@ -64,6 +64,7 @@ struct tap_softc { SLIST_ENTRY(tap_softc) tap_next; /* next device in chain */ struct cdev *tap_dev; struct mtx tap_mtx; /* per-softc mutex */ + struct cv tap_cv; /* protect ref'd dev destroy */ }; #endif /* !_NET_IF_TAPVAR_H_ */ From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 22:12:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BAF44106566B; Tue, 25 Sep 2012 22:12:08 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C3758FC0C; Tue, 25 Sep 2012 22:12:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PMC8Oi004229; Tue, 25 Sep 2012 22:12:08 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PMC811004227; Tue, 25 Sep 2012 22:12:08 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201209252212.q8PMC811004227@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 25 Sep 2012 22:12:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240939 - head/sys/dev/flash X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 22:12:08 -0000 Author: ray Date: Tue Sep 25 22:12:07 2012 New Revision: 240939 URL: http://svn.freebsd.org/changeset/base/240939 Log: Add more SPI flash IDs. Submitted by: Luiz Otavio O Souza. Submitted by: ZRouter.org project. Approved by: adrian (menthor) Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Tue Sep 25 22:10:14 2012 (r240938) +++ head/sys/dev/flash/mx25l.c Tue Sep 25 22:12:07 2012 (r240939) @@ -96,15 +96,22 @@ static void mx25l_strategy(struct bio *b static void mx25l_task(void *arg); struct mx25l_flash_ident flash_devices[] = { - { "mx25ll32", 0xc2, 0x2016, 64 * 1024, 64, FL_NONE }, - { "m25p64", 0x20, 0x2017, 64 * 1024, 128, FL_NONE }, - { "mx25ll64", 0xc2, 0x2017, 64 * 1024, 128, FL_NONE }, - { "mx25ll128", 0xc2, 0x2018, 64 * 1024, 256, FL_ERASE_4K | FL_ERASE_32K }, - { "s25fl128", 0x01, 0x2018, 64 * 1024, 256, FL_NONE }, - { "s25s1032", 0x01, 0x0215, 64 * 1024, 64, FL_NONE }, - { "s25sl064a", 0x01, 0x0216, 64 * 1024, 128, FL_NONE }, - { "w25q64bv", 0xef, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, - { "w25x32", 0xef, 0x3016, 64 * 1024, 64, FL_ERASE_4K }, + { "en25f32", 0x1c, 0x3116, 64 * 1024, 64, FL_NONE }, + { "en25p32", 0x1c, 0x2016, 64 * 1024, 64, FL_NONE }, + { "en25p64", 0x1c, 0x2017, 64 * 1024, 128, FL_NONE }, + { "en25q64", 0x1c, 0x3017, 64 * 1024, 128, FL_ERASE_4K }, + { "m25p64", 0x20, 0x2017, 64 * 1024, 128, FL_NONE }, + { "mx25ll32", 0xc2, 0x2016, 64 * 1024, 64, FL_NONE }, + { "mx25ll64", 0xc2, 0x2017, 64 * 1024, 128, FL_NONE }, + { "mx25ll128", 0xc2, 0x2018, 64 * 1024, 256, FL_ERASE_4K | FL_ERASE_32K }, + { "s25fl128", 0x01, 0x2018, 64 * 1024, 256, FL_NONE }, + { "s25s1032", 0x01, 0x0215, 64 * 1024, 64, FL_NONE }, + { "s25sl064a", 0x01, 0x0216, 64 * 1024, 128, FL_NONE }, + { "SST25VF032B", 0xbf, 0x254a, 64 * 1024, 64, FL_ERASE_4K | FL_ERASE_32K }, + { "w25q32", 0xef, 0x4016, 64 * 1024, 64, FL_ERASE_4K }, + { "w25q64", 0xef, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, + { "w25q64bv", 0xef, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, + { "w25x32", 0xef, 0x3016, 64 * 1024, 64, FL_ERASE_4K }, }; static uint8_t From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 22:16:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 33B07106566B; Tue, 25 Sep 2012 22:16:00 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1FAD28FC0A; Tue, 25 Sep 2012 22:16:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PMFxSD004735; Tue, 25 Sep 2012 22:15:59 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PMFxJQ004733; Tue, 25 Sep 2012 22:15:59 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201209252215.q8PMFxJQ004733@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 25 Sep 2012 22:15:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240940 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 22:16:00 -0000 Author: pjd Date: Tue Sep 25 22:15:59 2012 New Revision: 240940 URL: http://svn.freebsd.org/changeset/base/240940 Log: Fix freebsd32_kmq_timedreceive() and freebsd32_kmq_timedsend() to use getmq_read() and getmq_write() respectively, just like sys_kmq_timedreceive() and sys_kmq_timedsend(). Sponsored by: FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/uipc_mqueue.c Modified: head/sys/kern/uipc_mqueue.c ============================================================================== --- head/sys/kern/uipc_mqueue.c Tue Sep 25 22:12:07 2012 (r240939) +++ head/sys/kern/uipc_mqueue.c Tue Sep 25 22:15:59 2012 (r240940) @@ -2717,7 +2717,7 @@ freebsd32_kmq_timedsend(struct thread *t int error; int waitok; - error = getmq_read(td, uap->mqd, &fp, NULL, &mq); + error = getmq_write(td, uap->mqd, &fp, NULL, &mq); if (error) return (error); if (uap->abs_timeout != NULL) { @@ -2746,7 +2746,7 @@ freebsd32_kmq_timedreceive(struct thread struct timespec *abs_timeout, ets; int error, waitok; - error = getmq_write(td, uap->mqd, &fp, NULL, &mq); + error = getmq_read(td, uap->mqd, &fp, NULL, &mq); if (error) return (error); if (uap->abs_timeout != NULL) { From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 23:37:13 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 727B6106564A; Tue, 25 Sep 2012 23:37:13 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id 2856B8FC0C; Tue, 25 Sep 2012 23:37:12 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id q8PNbCUQ026970; Tue, 25 Sep 2012 17:37:12 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id q8PNbCLa026969; Tue, 25 Sep 2012 17:37:12 -0600 (MDT) (envelope-from ken) Date: Tue, 25 Sep 2012 17:37:12 -0600 From: "Kenneth D. Merry" To: Pawel Jakub Dawidek Message-ID: <20120925233712.GA26920@nargothrond.kdm.org> References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201209221241.q8MCfnhJ067937@svn.freebsd.org> User-Agent: Mutt/1.4.2i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 23:37:13 -0000 On Sat, Sep 22, 2012 at 12:41:49 +0000, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Sat Sep 22 12:41:49 2012 > New Revision: 240822 > URL: http://svn.freebsd.org/changeset/base/240822 > > Log: > Use the topology lock to protect list of providers while withering them. > It is possible that provider is destroyed while we are iterating over the > list. > > Reported by: Brian Parkison > Discussed with: phk > MFC after: 1 week > > Modified: > head/sys/geom/geom_disk.c > > Modified: head/sys/geom/geom_disk.c > ============================================================================== > --- head/sys/geom/geom_disk.c Sat Sep 22 12:40:52 2012 (r240821) > +++ head/sys/geom/geom_disk.c Sat Sep 22 12:41:49 2012 (r240822) > @@ -635,10 +635,13 @@ disk_gone(struct disk *dp) > struct g_geom *gp; > struct g_provider *pp; > > + g_topology_lock(); > gp = dp->d_geom; > - if (gp != NULL) > + if (gp != NULL) { > LIST_FOREACH(pp, &gp->provider, provider) > g_wither_provider(pp, ENXIO); > + } > + g_topology_unlock(); > } > > void This breaks devices going away in CAM. When the da(4) driver calls disk_gone(), it is necessarily holding the SIM lock, which is a regular MTX_DEF mutex. The GEOM topology lock is an sx lock, and of WITNESS blows up because of that: (noperiph:lock order reversal: (sleepable after non-sleepable) isp0:0: 1st 0xffffffff81330c48 ctl2cam (ctl2cam) @ /usr/home/kenm/perforce5/vendor/FreeBSD/head/sys/cam/cam_periph.h:190 -1: 2nd 0xffffffff8136e720 GEOM topology (GEOM topology) @ /usr/home/kenm/perforce5/vendor/FreeBSD/head/sys/geom/geom_disk.c:638 -1): KDB: stack backtrace: changing role on from 1 to 0 dctlfeasync: WWPN 0x21000024ff32658d port 0x0000e8 path 3 target 0 left b_trace_self_wrapper() at db_trace_self_wrapper+0x2a kdb_backtrace() at kdb_backtrace+0x37 _witness_debugger() at _witness_debugger+0x2c witness_checkorder() at witness_checkorder+0x875 _sx_xlock() at _sx_xlock+0x64 disk_gone() at disk_gone+0x40 daoninvalidate() at daoninvalidate+0x52 cam_periph_invalidate() at cam_periph_invalidate+0x57 daasync() at daasync+0x77 xpt_async_bcast() at xpt_async_bcast+0x42 xpt_async() at xpt_async+0x12a cam_periph_error() at cam_periph_error+0x503 probedone() at probedone+0x1e1 camisr_runqueue() at camisr_runqueue+0x54 camisr() at camisr+0xcf intr_event_execute_handlers() at intr_event_execute_handlers+0x6a ithread_loop() at ithread_loop+0xab fork_exit() at fork_exit+0x135 fork_trampoline() at fork_trampoline+0xe --- trap 0, rip = 0, rsp = 0xffffff80002bfcb0, rbp = 0 --- (da5:ctl2cam0:0:1:0): lost device - 0 outstanding, 1 refs (pass7:Sleeping thread (tid 100027, pid 12) owns a non-sleepable lock ctl2cam0:0:KDB: stack backtrace of thread 100027: 1:0): passdevgonecb: devfs entry is gone sched_switch() at sched_switch+0x19a mi_switch() at mi_switch+0x208 sleepq_switch() at sleepq_switch+0xfc sleepq_wait() at sleepq_wait+0x4d _sx_xlock_hard() at _sx_xlock_hard+0x350 _sx_xlock() at _sx_xlock+0xf1 disk_gone() at disk_gone+0x40 daoninvalidate() at daoninvalidate+0x52 cam_periph_invalidate() at cam_periph_invalidate+0x57 daasync() at daasync+0x77 xpt_async_bcast() at xpt_async_bcast+0x42 xpt_async() at xpt_async+0x12a cam_periph_error() at cam_periph_error+0x503 probedone() at probedone+0x2dd camisr_runqueue() at camisr_runqueue+0x54 camisr() at camisr+0xcf intr_event_execute_handlers() at intr_event_execute_handlers+0x6a ithread_loop() at ithread_loop+0xab fork_exit() at fork_exit+0x135 fork_trampoline() at fork_trampoline+0xe --- trap 0, rip = 0, rsp = 0xffffff80002bfcb0, rbp = 0 --- panic: sleeping thread cpuid = 4 KDB: enter: panic [ thread pid 13 tid 100020 ] Stopped at kdb_enter+0x3b: movq $0,0xaac5d2(%rip) db> bt Tracing pid 13 tid 100020 td 0xfffffe00029a5900 kdb_enter() at kdb_enter+0x3b panic() at panic+0x1d1 propagate_priority() at propagate_priority+0x223 turnstile_wait() at turnstile_wait+0x252 _mtx_lock_sleep() at _mtx_lock_sleep+0xa1 _mtx_lock_flags() at _mtx_lock_flags+0x116 cam_periph_release() at cam_periph_release+0x4b g_destroy_provider() at g_destroy_provider+0xae g_run_events() at g_run_events+0x330 fork_exit() at fork_exit+0x135 fork_trampoline() at fork_trampoline+0xe --- trap 0, rip = 0, rsp = 0xffffff800029bcb0, rbp = 0 --- db> bt 100027 Tracing pid 12 tid 100027 td 0xfffffe0002a8d480 sched_switch() at sched_switch+0x19a mi_switch() at mi_switch+0x208 sleepq_switch() at sleepq_switch+0xfc sleepq_wait() at sleepq_wait+0x4d _sx_xlock_hard() at _sx_xlock_hard+0x350 _sx_xlock() at _sx_xlock+0xf1 disk_gone() at disk_gone+0x40 daoninvalidate() at daoninvalidate+0x52 cam_periph_invalidate() at cam_periph_invalidate+0x57 daasync() at daasync+0x77 xpt_async_bcast() at xpt_async_bcast+0x42 xpt_async() at xpt_async+0x12a cam_periph_error() at cam_periph_error+0x503 probedone() at probedone+0x2dd camisr_runqueue() at camisr_runqueue+0x54 camisr() at camisr+0xcf intr_event_execute_handlers() at intr_event_execute_handlers+0x6a ithread_loop() at ithread_loop+0xab fork_exit() at fork_exit+0x135 fork_trampoline() at fork_trampoline+0xe --- trap 0, rip = 0, rsp = 0xffffff80002bfcb0, rbp = 0 --- disk_gone() needs to be callable from an interrupt context. So it cannot acquire the topology lock. Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-all@FreeBSD.ORG Tue Sep 25 23:41:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6BECD1065670; Tue, 25 Sep 2012 23:41:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5788C8FC0A; Tue, 25 Sep 2012 23:41:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8PNfk6U015394; Tue, 25 Sep 2012 23:41:46 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8PNfkKl015392; Tue, 25 Sep 2012 23:41:46 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201209252341.q8PNfkKl015392@svn.freebsd.org> From: Ed Maste Date: Tue, 25 Sep 2012 23:41:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240942 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2012 23:41:46 -0000 Author: emaste Date: Tue Sep 25 23:41:45 2012 New Revision: 240942 URL: http://svn.freebsd.org/changeset/base/240942 Log: Revert part of an earlier patch attempt that snuck in with r240938. Modified: head/sys/net/if_tapvar.h Modified: head/sys/net/if_tapvar.h ============================================================================== --- head/sys/net/if_tapvar.h Tue Sep 25 22:31:35 2012 (r240941) +++ head/sys/net/if_tapvar.h Tue Sep 25 23:41:45 2012 (r240942) @@ -64,7 +64,6 @@ struct tap_softc { SLIST_ENTRY(tap_softc) tap_next; /* next device in chain */ struct cdev *tap_dev; struct mtx tap_mtx; /* per-softc mutex */ - struct cv tap_cv; /* protect ref'd dev destroy */ }; #endif /* !_NET_IF_TAPVAR_H_ */ From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 00:25:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8B4A21065673; Wed, 26 Sep 2012 00:25:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DF6A8FC25; Wed, 26 Sep 2012 00:25:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8Q0PAwR021187; Wed, 26 Sep 2012 00:25:10 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q0PAp0021186; Wed, 26 Sep 2012 00:25:10 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201209260025.q8Q0PAp0021186@svn.freebsd.org> From: Ed Maste Date: Wed, 26 Sep 2012 00:25:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240944 - in head/tools/regression/net: . if_tap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 00:25:10 -0000 Author: emaste Date: Wed Sep 26 00:25:09 2012 New Revision: 240944 URL: http://svn.freebsd.org/changeset/base/240944 Log: Add regression test for kern/172075. Sponsored by: ADARA Networks PR: kern/172075 Added: head/tools/regression/net/ head/tools/regression/net/if_tap/ head/tools/regression/net/if_tap/test-tap.sh (contents, props changed) Added: head/tools/regression/net/if_tap/test-tap.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/net/if_tap/test-tap.sh Wed Sep 26 00:25:09 2012 (r240944) @@ -0,0 +1,59 @@ +#!/bin/sh + +# Copyright (C) 2012 ADARA Networks. 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$ + +tap_exists() +{ + ls -1 /dev | grep -q "$1" +} + +if [ $(id -u) -ne 0 ]; then + echo "Must be root" >&2 + exit 1 +fi + +set -e + +# Base case create & destroy +tap=$(ifconfig tap create) +tap_exists $tap +ifconfig $tap destroy +! tap_exists $tap + +# kern/172075: INVARIANTS kernel panicked when destroying an in-use tap(4) +# Fixed in HEAD r240938. +tap=$(ifconfig tap create) +tap_exists $tap +cat /dev/$tap > /dev/null & +catpid=$! +sleep 0.1 +ifconfig $tap destroy & +sleep 0.1 +kill $catpid +! tap_exists $tap + +echo PASS +exit 0 From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 01:09:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 048C51065674; Wed, 26 Sep 2012 01:09:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3CC08FC14; Wed, 26 Sep 2012 01:09:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8Q19JNl026775; Wed, 26 Sep 2012 01:09:19 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q19JVK026773; Wed, 26 Sep 2012 01:09:19 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201209260109.q8Q19JVK026773@svn.freebsd.org> From: Ed Maste Date: Wed, 26 Sep 2012 01:09:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240945 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 01:09:20 -0000 Author: emaste Date: Wed Sep 26 01:09:19 2012 New Revision: 240945 URL: http://svn.freebsd.org/changeset/base/240945 Log: Correct misspelling in debug output. Modified: head/sys/net/if_tap.c Modified: head/sys/net/if_tap.c ============================================================================== --- head/sys/net/if_tap.c Wed Sep 26 00:25:09 2012 (r240944) +++ head/sys/net/if_tap.c Wed Sep 26 01:09:19 2012 (r240945) @@ -929,7 +929,7 @@ tapwrite(struct cdev *dev, struct uio *u struct ifnet *ifp = tp->tap_ifp; struct mbuf *m; - TAPDEBUG("%s writting, minor = %#x\n", + TAPDEBUG("%s writing, minor = %#x\n", ifp->if_xname, dev2unit(dev)); if (uio->uio_resid == 0) From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 01:11:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5DF14106564A; Wed, 26 Sep 2012 01:11:30 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id DCBF08FC0C; Wed, 26 Sep 2012 01:11:28 +0000 (UTC) Received: by obcwo10 with SMTP id wo10so73211obc.13 for ; Tue, 25 Sep 2012 18:11:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=U+Vd+rgX5XSEyi6PeMHDTWzAyf0d2hLUoqNcoP6/JLU=; b=gwk5Znb7ZLL7Cwe1vkJL3R/Z2sUJXkFOQZ2cp+kECa7fWDJhx1bA8Ba5AAL6YpYAGg xfoTLCEpd1fJh8iIasF4zS7WrMkgmiQbyDsgEHHXz5YPGuTsxM6WZh3o/nGMrQYdfia2 C2/tb8UZQAUTRaCQ+XuoHY2S8CAUBvGSDDHhXWenmpGsXcJVJVk9tPa9pP6079HieTH5 qILFhOgpIZpgERtxcXRjsljwGmuNBg4nOrikJQFhN3HNQy8o6eAZSKlZiERqeaiZm8BK 7NnsoPGuq1FKlXsHy5Q2ERkXj04+qrUGJWBlrpe8mv/ZOTS81/DO54MGUNQcXf/DvGPA i3BQ== MIME-Version: 1.0 Received: by 10.182.218.37 with SMTP id pd5mr13937943obc.24.1348621887677; Tue, 25 Sep 2012 18:11:27 -0700 (PDT) Received: by 10.76.142.201 with HTTP; Tue, 25 Sep 2012 18:11:27 -0700 (PDT) In-Reply-To: <201209260025.q8Q0PAp0021186@svn.freebsd.org> References: <201209260025.q8Q0PAp0021186@svn.freebsd.org> Date: Tue, 25 Sep 2012 18:11:27 -0700 Message-ID: From: Garrett Cooper To: Ed Maste Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240944 - in head/tools/regression/net: . if_tap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 01:11:30 -0000 On Tue, Sep 25, 2012 at 5:25 PM, Ed Maste wrote: > Author: emaste > Date: Wed Sep 26 00:25:09 2012 > New Revision: 240944 > URL: http://svn.freebsd.org/changeset/base/240944 > > Log: > Add regression test for kern/172075. > > Sponsored by: ADARA Networks > PR: kern/172075 > > Added: > head/tools/regression/net/ > head/tools/regression/net/if_tap/ > head/tools/regression/net/if_tap/test-tap.sh (contents, props changed) > > Added: head/tools/regression/net/if_tap/test-tap.sh > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/tools/regression/net/if_tap/test-tap.sh Wed Sep 26 00:25:09 2012 (r240944) > @@ -0,0 +1,59 @@ > +#!/bin/sh > + > +# Copyright (C) 2012 ADARA Networks. 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$ > + > +tap_exists() > +{ > + ls -1 /dev | grep -q "$1" > +} > + > +if [ $(id -u) -ne 0 ]; then > + echo "Must be root" >&2 > + exit 1 > +fi > + > +set -e > + > +# Base case create & destroy > +tap=$(ifconfig tap create) > +tap_exists $tap > +ifconfig $tap destroy > +! tap_exists $tap > + > +# kern/172075: INVARIANTS kernel panicked when destroying an in-use tap(4) > +# Fixed in HEAD r240938. > +tap=$(ifconfig tap create) > +tap_exists $tap > +cat /dev/$tap > /dev/null & > +catpid=$! > +sleep 0.1 > +ifconfig $tap destroy & > +sleep 0.1 > +kill $catpid > +! tap_exists $tap > + > +echo PASS > +exit 0 This test is technically only valid if sysctl kern.features.invariant_support == 1, right? Thanks! -Garrett From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 01:40:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5442D1065674; Wed, 26 Sep 2012 01:40:05 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182]) by mx1.freebsd.org (Postfix) with ESMTP id EBD948FC17; Wed, 26 Sep 2012 01:40:04 +0000 (UTC) Received: by ieak10 with SMTP id k10so264584iea.13 for ; Tue, 25 Sep 2012 18:40:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=jkcTIW+fEZXuEzzZDi92Qytm68yGiXp4SXH9zOd9sjI=; b=RvzSfOfyK0oUPWBC8Wo3uq547hK5jXPMIn0ctCjfq+Y+3zRu3v+0efsdRedwjpc6/P 5U7wSV9f5zpKtdsNS6MVoatGWg64Y7CgQEWyGrMTe8hyUYQHgd11vXRJlHz0WTpLEU9l htQp1Yoo8DPFYnK0tSIYlyR6DOP3FJyR5CMP+Q/zpJOezpaWZxEFg9+GPZE72K+FTEfo InuHkEeEQqONJA5QUriQqSEl9Zb6N16iOEqyMznTbqR41fsrdwULnglTt+QAXQfZlU5T U5bjSzsiiUQgF0XgP6xn2TkN2U+0dvXBfakIwJBtzdkG8C2dnczhu5rpy2krCpewUeNN d1pA== MIME-Version: 1.0 Received: by 10.50.47.234 with SMTP id g10mr9801232ign.16.1348623603531; Tue, 25 Sep 2012 18:40:03 -0700 (PDT) Sender: carpeddiem@gmail.com Received: by 10.50.57.163 with HTTP; Tue, 25 Sep 2012 18:40:03 -0700 (PDT) In-Reply-To: References: <201209260025.q8Q0PAp0021186@svn.freebsd.org> Date: Tue, 25 Sep 2012 21:40:03 -0400 X-Google-Sender-Auth: 95LW8nrDqus_jIIyotfvW6UYE5o Message-ID: From: Ed Maste To: Garrett Cooper Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240944 - in head/tools/regression/net: . if_tap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 01:40:05 -0000 On 25 September 2012 21:11, Garrett Cooper wrote: > On Tue, Sep 25, 2012 at 5:25 PM, Ed Maste wrote: >> Author: emaste >> Date: Wed Sep 26 00:25:09 2012 >> New Revision: 240944 >> URL: http://svn.freebsd.org/changeset/base/240944 ... > This test is technically only valid if sysctl > kern.features.invariant_support == 1, right? It's only possible to prove that the bug described in kern/172075 is fixed if kern.features.invariant_support == 1, yes. Without invariants though the test still verifies that a tap(4) device can be properly destroyed when open and not. I have another change coming that will cause cat(1) to terminate immediately when the device is destroyed, and this script will become a valid test of that behaviour with or without INVARIANTS. Ideally the script would report pass or fail for the individual tap(4) create and destroy invocations, and separately pass or unsupported for kern/172075 based on kern.features.invariant_support. I'd like to figure out how to implement that once our test framework is in place. -Ed From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 02:11:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61D971065670; Wed, 26 Sep 2012 02:11:10 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-oa0-f54.google.com (mail-oa0-f54.google.com [209.85.219.54]) by mx1.freebsd.org (Postfix) with ESMTP id DF5418FC16; Wed, 26 Sep 2012 02:11:09 +0000 (UTC) Received: by oagm1 with SMTP id m1so120209oag.13 for ; Tue, 25 Sep 2012 19:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=QEmO540Ur8oAmH2NZRTRz/YIyMWzfmf2aBXzTFTHu/4=; b=xdOSHDr+YN9NVx+UNvCFvrU0EqQIPwd6Bxi7kp7nS/EMziZ6mOzHjnIQQMxE9NSf91 wxAcx2u3Sa/T4fwOI9g8nZJY48RJrVKZf7+rzrHy+j0JX03t15KXQg0FiC/AIMJXzLZ4 tVXlGCEuZOflvvLI/y/hffhGcnD8BSer5tSB5AGEBYp+Fk4E8mkzF28ZSWArmz3D4S1E 3CV6/t9e2v9wFfFtMSHflVSlQlvVsFyLp8jIReZ+ehUjI3HrHikNWf6AT7Rve4eDZrYa Q3aveZPe0BoAqluNR2+EpAmf55IYszMsisTMoNDjA57q1mqGLBfLFHdNt6E2k06YkWdn 2LgQ== MIME-Version: 1.0 Received: by 10.60.171.69 with SMTP id as5mr14260180oec.100.1348625468199; Tue, 25 Sep 2012 19:11:08 -0700 (PDT) Received: by 10.76.142.201 with HTTP; Tue, 25 Sep 2012 19:11:08 -0700 (PDT) In-Reply-To: References: <201209260025.q8Q0PAp0021186@svn.freebsd.org> Date: Tue, 25 Sep 2012 19:11:08 -0700 Message-ID: From: Garrett Cooper To: Ed Maste Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240944 - in head/tools/regression/net: . if_tap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 02:11:10 -0000 On Tue, Sep 25, 2012 at 6:40 PM, Ed Maste wrote: > On 25 September 2012 21:11, Garrett Cooper wrote: >> On Tue, Sep 25, 2012 at 5:25 PM, Ed Maste wrote: >>> Author: emaste >>> Date: Wed Sep 26 00:25:09 2012 >>> New Revision: 240944 >>> URL: http://svn.freebsd.org/changeset/base/240944 > ... >> This test is technically only valid if sysctl >> kern.features.invariant_support == 1, right? > > It's only possible to prove that the bug described in kern/172075 is > fixed if kern.features.invariant_support == 1, yes. Without > invariants though the test still verifies that a tap(4) device can be > properly destroyed when open and not. > > I have another change coming that will cause cat(1) to terminate > immediately when the device is destroyed, and this script will become > a valid test of that behaviour with or without INVARIANTS. > > Ideally the script would report pass or fail for the individual tap(4) > create and destroy invocations, and separately pass or unsupported for > kern/172075 based on kern.features.invariant_support. I'd like to > figure out how to implement that once our test framework is in place. Here's a basic /bin/sh based example for how to use ATF: http://p4db.freebsd.org/fileViewer.cgi?FSPC=//depot/user/gcooper/atf-head/src/tests/examples/sh_test/sh_test.sh&REV=2 . Please note that using a function like that won't work though unless it's in a separate script as ATF forks a separate shell, and thus all definitions not inlined in the atf_check `test` are lost (it's a caveat that annoys me a small bit). If you want me to CC you on the thread where gnn@ and marcel@ are helping review the FreeBSD ATF porting work, please let me know! Thanks! -Garrett From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 03:45:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A8112106564A; Wed, 26 Sep 2012 03:45:43 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 927EE8FC0C; Wed, 26 Sep 2012 03:45:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8Q3jhj7046880; Wed, 26 Sep 2012 03:45:43 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q3jhVP046878; Wed, 26 Sep 2012 03:45:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201209260345.q8Q3jhVP046878@svn.freebsd.org> From: Adrian Chadd Date: Wed, 26 Sep 2012 03:45:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240946 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 03:45:43 -0000 Author: adrian Date: Wed Sep 26 03:45:42 2012 New Revision: 240946 URL: http://svn.freebsd.org/changeset/base/240946 Log: Map the non-QoS TID to the voice queue, in order to ensure important things like EAPOL frames make it out. After a whole bunch of hacking/testing, I discovered that they weren't being early-dropped by the stack (but I should look at ensuring that later..) but were even making to the hardware transmit queue. They were mostly even being received by the remote end. However, the remote end was completely ignoring them. This didn't happen under 150-170MBit TCP tests as I'm guessing the TX queue stayed very busy and the STA didn't do any scanning. However, when doing 100Mbit/s of TCP traffic, the STA would do background scanning - which involves it coming in and out of powersave mode with the AP. Now, this is a total and utter hack around the real problems, which are: * I need to implement proper power save handling and integrate it into the filtered frames support, so the driver/stack doesn't send frames whilst the station is actually in sleep; * .. but frames were actually making it to the STA (macbook pro) and the AP did receive an ACK; but a tcpdump on the receiving side showed the EAPOL frame never made it. So the stack was dropping it for some reason; * Importantly - the EAPOL frames are currently going into the non-QoS TID, which maps to the BE queue and is susceptible to that queue being busy doing other things, but; * There's other traffic going on in the non-QoS TID from other contexts when scanning is going on and it's possible there's some races causing sequence number/IV issues, but; * Importantly importantlly, I think the interaction with TID 16 multicast traffic in power save mode is causing issues - since I -believe- the sequence number space being used by the EAPOL frames on TID 16 overlaps with the multicast frames that have sequence numbers allocated and are then stuffed on the cabq. Since with EAPOL frames being in TID 16 and queued to the BE queue, it's going to be waiting to be serviced with all of the aggregate traffic going on - and if the CABQ gets emptied beforehand, those TID 16 multicast frames with sequence numbers will go out beforehand. Now, there's quite likely a bunch of "stuff happening slightly out of sequence" going on due to the nature of the TX path (read: lots of overlapping and concurrent ath_start() and ath_raw_xmit() calls going on, sigh) but I thought I had caught them all and stuffed each TID TX behind a lock (that lasted as long as it needed to in order to get the frame onto the relevant destination queue - thus keeping things in order.) Unfortunately the last problem is the big one and I'm going to stare at it some more. If it _is_ So this is a work around for now to ensure that EAPOL frames actually make it out before any other stuff in the non-QoS TID and HOPEFULLY before the CABQ gets active. I'm now going to spend a little time in the TX path figuring out exactly why the sender is rejecting things. There's two (well, three if you count EAPOL contents invalid) possibilities: * The sequence number is out of order (ie, something else like the multicast traffic on CABQ) is going out first on TID 16; * The CCMP IV is out of order (similar to above - but less likely, as the TX key for multicast traffic is different to unicast traffic); * EAPOL contents strangely invalid. AP: Ubiquiti RSPRO, AR9160/AR9220 NICs STA: Macbook Pro, Broadcom 11n NIC 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 Wed Sep 26 01:09:19 2012 (r240945) +++ head/sys/dev/ath/if_ath_tx.c Wed Sep 26 03:45:42 2012 (r240946) @@ -106,6 +106,11 @@ __FBSDID("$FreeBSD$"); */ #define SWMAX_RETRIES 10 +/* + * What queue to throw the non-QoS TID traffic into + */ +#define ATH_NONQOS_TID_AC WME_AC_VO + static int ath_tx_ampdu_pending(struct ath_softc *sc, struct ath_node *an, int tid); static int ath_tx_ampdu_running(struct ath_softc *sc, struct ath_node *an, @@ -191,7 +196,7 @@ ath_tx_getac(struct ath_softc *sc, const if (IEEE80211_QOS_HAS_SEQ(wh)) return pri; - return WME_AC_BE; + return ATH_NONQOS_TID_AC; } void @@ -2861,7 +2866,7 @@ ath_tx_tid_init(struct ath_softc *sc, st atid->cleanup_inprogress = 0; atid->clrdmask = 1; /* Always start by setting this bit */ if (i == IEEE80211_NONQOS_TID) - atid->ac = WME_AC_BE; + atid->ac = ATH_NONQOS_TID_AC; else atid->ac = TID_TO_WME_AC(i); } From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 03:54:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D4EE6106566B; Wed, 26 Sep 2012 03:54:55 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF42A8FC0A; Wed, 26 Sep 2012 03:54:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8Q3stxT048144; Wed, 26 Sep 2012 03:54:55 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q3stwH048142; Wed, 26 Sep 2012 03:54:55 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201209260354.q8Q3stwH048142@svn.freebsd.org> From: Alan Cox Date: Wed, 26 Sep 2012 03:54:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240947 - stable/9/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 03:54:56 -0000 Author: alc Date: Wed Sep 26 03:54:55 2012 New Revision: 240947 URL: http://svn.freebsd.org/changeset/base/240947 Log: MFC r240862 Address a race condition that was introduced in r238212. Unless the page queues lock is acquired before the page lock is released, there is no guarantee that the page will still be in that same page queue when vm_page_requeue() is called. Modified: stable/9/sys/vm/vm_pageout.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_pageout.c ============================================================================== --- stable/9/sys/vm/vm_pageout.c Wed Sep 26 03:45:42 2012 (r240946) +++ stable/9/sys/vm/vm_pageout.c Wed Sep 26 03:54:55 2012 (r240947) @@ -999,9 +999,9 @@ vm_pageout_scan(int pass) * Those objects are in a "rundown" state. */ if (!swap_pageouts_ok || (object->flags & OBJ_DEAD)) { + vm_page_lock_queues(); vm_page_unlock(m); VM_OBJECT_UNLOCK(object); - vm_page_lock_queues(); queues_locked = TRUE; vm_page_requeue(m); goto relock_queues; From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 04:52:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC9611065670; Wed, 26 Sep 2012 04:52:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 551098FC0A; Wed, 26 Sep 2012 04:52:18 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q8Q4qGrj047130; Wed, 26 Sep 2012 07:52:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q8Q4q4ux014736; Wed, 26 Sep 2012 07:52:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q8Q4q4KX014735; Wed, 26 Sep 2012 07:52:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 26 Sep 2012 07:52:04 +0300 From: Konstantin Belousov To: Ed Maste Message-ID: <20120926045204.GG35915@deviant.kiev.zoral.com.ua> References: <201209252210.q8PMAEx5003950@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Y+xroYBkGM9OatJL" Content-Disposition: inline In-Reply-To: <201209252210.q8PMAEx5003950@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240938 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 04:52:19 -0000 --Y+xroYBkGM9OatJL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 25, 2012 at 10:10:14PM +0000, Ed Maste wrote: > Author: emaste > Date: Tue Sep 25 22:10:14 2012 > New Revision: 240938 > URL: http://svn.freebsd.org/changeset/base/240938 >=20 > Log: > Avoid INVARIANTS panic destroying an in-use tap(4) > =20 > The requirement (implied by the KASSERT in tap_destroy) that the tap is > closed isn't valid; destroy_dev will block in devdrn while other threads > are in d_* functions. Are you sure ? The device may be opened, but no threads could be in any cdevsw methods. destroy_dev(9) only waits for threads to leave cdevsw methods, and not for the close to happen. This is normal situation, but driver shall be aware of it and handle it properly. > =20 > Note: if_tun had the same issue, addressed in SVN revisions r186391, > r186483 and r186497. The use of the condvar there appears to be > redundant with the functionality provided by destroy_dev. > =20 > Sponsored by: ADARA Networks > Reviewed by: dwhite > MFC after: 2 weeks >=20 > Modified: > head/sys/net/if_tap.c > head/sys/net/if_tapvar.h >=20 > Modified: head/sys/net/if_tap.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/net/if_tap.c Tue Sep 25 21:33:36 2012 (r240937) > +++ head/sys/net/if_tap.c Tue Sep 25 22:10:14 2012 (r240938) > @@ -213,14 +213,10 @@ tap_destroy(struct tap_softc *tp) > { > struct ifnet *ifp =3D tp->tap_ifp; > =20 > - /* Unlocked read. */ > - KASSERT(!(tp->tap_flags & TAP_OPEN), > - ("%s flags is out of sync", ifp->if_xname)); > - > CURVNET_SET(ifp->if_vnet); > + destroy_dev(tp->tap_dev); > seldrain(&tp->tap_rsel); > knlist_destroy(&tp->tap_rsel.si_note); > - destroy_dev(tp->tap_dev); > ether_ifdetach(ifp); > if_free(ifp); > =20 >=20 > Modified: head/sys/net/if_tapvar.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/net/if_tapvar.h Tue Sep 25 21:33:36 2012 (r240937) > +++ head/sys/net/if_tapvar.h Tue Sep 25 22:10:14 2012 (r240938) > @@ -64,6 +64,7 @@ struct tap_softc { > SLIST_ENTRY(tap_softc) tap_next; /* next device in chain */ > struct cdev *tap_dev; > struct mtx tap_mtx; /* per-softc mutex */ > + struct cv tap_cv; /* protect ref'd dev destroy */=20 > }; > =20 > #endif /* !_NET_IF_TAPVAR_H_ */ --Y+xroYBkGM9OatJL Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlBiifQACgkQC3+MBN1Mb4h2vQCfRZkdCRvUiAtluuB+UzbYfZgv 1h8An0bkf+q1VEsLaKDgaIHa7MbygL4A =Vbpb -----END PGP SIGNATURE----- --Y+xroYBkGM9OatJL-- From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 06:42:44 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B511106564A; Wed, 26 Sep 2012 06:42:44 +0000 (UTC) (envelope-from ache@vniz.net) Received: from vniz.net (vniz.net [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id C698A8FC15; Wed, 26 Sep 2012 06:42:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q8Q6Y7pF044843; Wed, 26 Sep 2012 10:34:08 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q8Q6Y7Cr044842; Wed, 26 Sep 2012 10:34:07 +0400 (MSK) (envelope-from ache) Date: Wed, 26 Sep 2012 10:34:07 +0400 From: Andrey Chernov To: "Kenneth D. Merry" Message-ID: <20120926063407.GA44807@vniz.net> Mail-Followup-To: Andrey Chernov , "Kenneth D. Merry" , Pawel Jakub Dawidek , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120925233712.GA26920@nargothrond.kdm.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, Pawel Jakub Dawidek Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 06:42:44 -0000 On Tue, Sep 25, 2012 at 05:37:12PM -0600, Kenneth D. Merry wrote: > > Use the topology lock to protect list of providers while withering them. > > It is possible that provider is destroyed while we are iterating over the > > list. > > This breaks devices going away in CAM. > > When the da(4) driver calls disk_gone(), it is necessarily holding the SIM > lock, which is a regular MTX_DEF mutex. The GEOM topology lock is an sx > lock, and of WITNESS blows up because of that: I don't know is it related, but in recent -current I got stable panic at the very last stage of reboot (after buffers syncing): reboot after panic: mutex Giant owned at ../../../geom/geom_disk.c:638 using just plain AHCI disks perhaps attached to CAM. -- http://ache.vniz.net/ From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 06:56:22 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 943DC106564A; Wed, 26 Sep 2012 06:56:22 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 0CB368FC12; Wed, 26 Sep 2012 06:56:21 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q8Q6uF31085658; Wed, 26 Sep 2012 10:56:15 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q8Q6uFmU085657; Wed, 26 Sep 2012 10:56: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: Wed, 26 Sep 2012 10:56:15 +0400 From: Gleb Smirnoff To: Ed Maste Message-ID: <20120926065615.GZ50433@FreeBSD.org> References: <201209252210.q8PMAEx5003950@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201209252210.q8PMAEx5003950@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 Subject: Re: svn commit: r240938 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 06:56:22 -0000 Ed, On Tue, Sep 25, 2012 at 10:10:14PM +0000, Ed Maste wrote: E> Author: emaste E> Date: Tue Sep 25 22:10:14 2012 E> New Revision: 240938 E> URL: http://svn.freebsd.org/changeset/base/240938 E> E> Log: E> Avoid INVARIANTS panic destroying an in-use tap(4) E> E> The requirement (implied by the KASSERT in tap_destroy) that the tap is E> closed isn't valid; destroy_dev will block in devdrn while other threads E> are in d_* functions. E> E> Note: if_tun had the same issue, addressed in SVN revisions r186391, E> r186483 and r186497. The use of the condvar there appears to be E> redundant with the functionality provided by destroy_dev. So why did you add condvar to the softc? See it in diff below. E> Sponsored by: ADARA Networks E> Reviewed by: dwhite E> MFC after: 2 weeks E> E> Modified: E> head/sys/net/if_tap.c E> head/sys/net/if_tapvar.h E> E> Modified: head/sys/net/if_tap.c E> ============================================================================== E> --- head/sys/net/if_tap.c Tue Sep 25 21:33:36 2012 (r240937) E> +++ head/sys/net/if_tap.c Tue Sep 25 22:10:14 2012 (r240938) E> @@ -213,14 +213,10 @@ tap_destroy(struct tap_softc *tp) E> { E> struct ifnet *ifp = tp->tap_ifp; E> E> - /* Unlocked read. */ E> - KASSERT(!(tp->tap_flags & TAP_OPEN), E> - ("%s flags is out of sync", ifp->if_xname)); E> - E> CURVNET_SET(ifp->if_vnet); E> + destroy_dev(tp->tap_dev); E> seldrain(&tp->tap_rsel); E> knlist_destroy(&tp->tap_rsel.si_note); E> - destroy_dev(tp->tap_dev); E> ether_ifdetach(ifp); E> if_free(ifp); E> E> E> Modified: head/sys/net/if_tapvar.h E> ============================================================================== E> --- head/sys/net/if_tapvar.h Tue Sep 25 21:33:36 2012 (r240937) E> +++ head/sys/net/if_tapvar.h Tue Sep 25 22:10:14 2012 (r240938) E> @@ -64,6 +64,7 @@ struct tap_softc { E> SLIST_ENTRY(tap_softc) tap_next; /* next device in chain */ E> struct cdev *tap_dev; E> struct mtx tap_mtx; /* per-softc mutex */ E> + struct cv tap_cv; /* protect ref'd dev destroy */ E> }; E> E> #endif /* !_NET_IF_TAPVAR_H_ */ -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 06:58:26 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 324CC106566B; Wed, 26 Sep 2012 06:58:26 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id A22398FC18; Wed, 26 Sep 2012 06:58:25 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q8Q6wOJX085684; Wed, 26 Sep 2012 10:58:24 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q8Q6wOeh085683; Wed, 26 Sep 2012 10:58:24 +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, 26 Sep 2012 10:58:24 +0400 From: Gleb Smirnoff To: Ed Maste Message-ID: <20120926065824.GA50433@FreeBSD.org> References: <201209252210.q8PMAEx5003950@svn.freebsd.org> <20120926065615.GZ50433@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20120926065615.GZ50433@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 Subject: Re: svn commit: r240938 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 06:58:26 -0000 On Wed, Sep 26, 2012 at 10:56:15AM +0400, Gleb Smirnoff wrote: T> Ed, T> T> On Tue, Sep 25, 2012 at 10:10:14PM +0000, Ed Maste wrote: T> E> Author: emaste T> E> Date: Tue Sep 25 22:10:14 2012 T> E> New Revision: 240938 T> E> URL: http://svn.freebsd.org/changeset/base/240938 T> E> T> E> Log: T> E> Avoid INVARIANTS panic destroying an in-use tap(4) T> E> T> E> The requirement (implied by the KASSERT in tap_destroy) that the tap is T> E> closed isn't valid; destroy_dev will block in devdrn while other threads T> E> are in d_* functions. T> E> T> E> Note: if_tun had the same issue, addressed in SVN revisions r186391, T> E> r186483 and r186497. The use of the condvar there appears to be T> E> redundant with the functionality provided by destroy_dev. T> T> So why did you add condvar to the softc? See it in diff below. Noticed later commit, sorry for noise. -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 07:09:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52668106564A; Wed, 26 Sep 2012 07:09:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D9228FC0C; Wed, 26 Sep 2012 07:09:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8Q79Ge2077763; Wed, 26 Sep 2012 07:09:16 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q79FUf077761; Wed, 26 Sep 2012 07:09:16 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201209260709.q8Q79FUf077761@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 26 Sep 2012 07:09:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240948 - head/sys/cam/ctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 07:09:16 -0000 Author: trasz Date: Wed Sep 26 07:09:15 2012 New Revision: 240948 URL: http://svn.freebsd.org/changeset/base/240948 Log: Fix panic in CTL caused by trying to free invalid pointers passed by the userland process via the IOCTL interface. Reviewed by: ken@ Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Wed Sep 26 03:54:55 2012 (r240947) +++ head/sys/cam/ctl/ctl.c Wed Sep 26 07:09:15 2012 (r240948) @@ -2075,6 +2075,11 @@ ctl_copyin_args(int num_be_args, struct goto bailout; for (i = 0; i < num_be_args; i++) { + args[i].kname = NULL; + args[i].kvalue = NULL; + } + + for (i = 0; i < num_be_args; i++) { uint8_t *tmpptr; args[i].kname = ctl_copyin_alloc(args[i].name, From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 07:19:44 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 837CE106564A; Wed, 26 Sep 2012 07:19:44 +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 74B118FC0A; Wed, 26 Sep 2012 07:19:43 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 7E2F27C3; Wed, 26 Sep 2012 09:18:42 +0200 (CEST) Date: Wed, 26 Sep 2012 09:20:06 +0200 From: Pawel Jakub Dawidek To: "Kenneth D. Merry" Message-ID: <20120926072005.GH1391@garage.freebsd.pl> References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RwGu8mu1E+uYXPWP" Content-Disposition: inline In-Reply-To: <20120925233712.GA26920@nargothrond.kdm.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, jdp@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, phk@FreeBSD.org Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 07:19:44 -0000 --RwGu8mu1E+uYXPWP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 25, 2012 at 05:37:12PM -0600, Kenneth D. Merry wrote: > On Sat, Sep 22, 2012 at 12:41:49 +0000, Pawel Jakub Dawidek wrote: > > Log: > > Use the topology lock to protect list of providers while withering th= em. > > It is possible that provider is destroyed while we are iterating over= the > > list. [...] > > --- head/sys/geom/geom_disk.c Sat Sep 22 12:40:52 2012 (r240821) > > +++ head/sys/geom/geom_disk.c Sat Sep 22 12:41:49 2012 (r240822) > > @@ -635,10 +635,13 @@ disk_gone(struct disk *dp) > > struct g_geom *gp; > > struct g_provider *pp; > > =20 > > + g_topology_lock(); > > gp =3D dp->d_geom; > > - if (gp !=3D NULL) > > + if (gp !=3D NULL) { > > LIST_FOREACH(pp, &gp->provider, provider) > > g_wither_provider(pp, ENXIO); > > + } > > + g_topology_unlock(); > > } [...] > This breaks devices going away in CAM. >=20 > When the da(4) driver calls disk_gone(), it is necessarily holding the SIM > lock, which is a regular MTX_DEF mutex. The GEOM topology lock is an sx > lock, and of WITNESS blows up because of that: [...] > disk_gone() needs to be callable from an interrupt context. So it cannot > acquire the topology lock. I can reword what you said above a bit: disk_gone() modifies GEOM topology, so it has to hold the topology lock, thus it cannot be called =66rom an interrupt context. We might be able to change the topology lock to LIST_FOREACH_SAFE(), as g_wither_provider() can only destroy current provider. This is because CAM own the geom and nobody should be able to mess with its provider's list, apart from CAM itself. So I'd need to know how CAM ensures that two disk_gone() cannot be called for one geom. The answer might be that those geoms have always only one provider, but then I cannot explain why we have loop there. Maybe jdp@ will remember why. I also read original commit message and I don't fully understand. It was 7 years ago so I'll quote entire commit message: Fix a bug that caused some /dev entries to continue to exist after the underlying drive had been hot-unplugged from the system. Here is a specific example. Filesystem code had opened /dev/da1s1e. Subsequently, the drive was hot-unplugged. This (correctly) caused all of the associated /dev/da1* entries to be deleted. When the filesystem later realized that the drive was gone it closed the device, reducing the write-access counts to 0 on the geom providers for da1s1e, da1s1, and da1. This caused geom to re-taste the providers, resulting in the devices being created again. When the drive was hot-plugged back in, it resulted in duplicate /dev entries for da1s1e, da1s1, and da1. This fix adds a new disk_gone() function which is called by CAM when a drive goes away. It orphans all of the providers associated with the drive, setting an error condition of ENXIO in each one. In addition, we prevent a re-taste on last close for writing if an error condition has been set in the provider. If disk is gone it should orphan its provider. This should cause orphaning depended providers, including da1s1 and then da1s1e. Orphaning sets provider's error and providers with the error set are not retasted. This is from g_access(): else if (pp->acw !=3D 0 && pp->acw =3D=3D -dcw && pp->error =3D=3D 0 && !(pp->geom->flags & G_GEOM_WITHER)) g_post_event(g_new_provider_event, pp, M_WAITOK, pp, NULL); My question is: is disk_geom() really needed? Maybe there is some small bug somewhere, but I think GEOM should handle all this without disk_gone(). --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --RwGu8mu1E+uYXPWP Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlBirKUACgkQForvXbEpPzS1hQCg0AwfF+cYiOLIEjd/ehDSxsNS Ge4AoJHk7+zvjZZkZ7uByTFQqcd4kAHx =zXue -----END PGP SIGNATURE----- --RwGu8mu1E+uYXPWP-- From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 07:25:13 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD9F2106564A; Wed, 26 Sep 2012 07:25:13 +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 6E7838FC1B; Wed, 26 Sep 2012 07:25:13 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id F11DC7C6; Wed, 26 Sep 2012 09:24:12 +0200 (CEST) Date: Wed, 26 Sep 2012 09:25:36 +0200 From: Pawel Jakub Dawidek To: Andrey Chernov , "Kenneth D. Merry" , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG Message-ID: <20120926072536.GI1391@garage.freebsd.pl> References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> <20120926063407.GA44807@vniz.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="boAH8PqvUi1v1f55" Content-Disposition: inline In-Reply-To: <20120926063407.GA44807@vniz.net> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 07:25:13 -0000 --boAH8PqvUi1v1f55 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 26, 2012 at 10:34:07AM +0400, Andrey Chernov wrote: > On Tue, Sep 25, 2012 at 05:37:12PM -0600, Kenneth D. Merry wrote: > > > Use the topology lock to protect list of providers while withering = them. > > > It is possible that provider is destroyed while we are iterating ov= er the > > > list. > >=20 > > This breaks devices going away in CAM. > >=20 > > When the da(4) driver calls disk_gone(), it is necessarily holding the = SIM > > lock, which is a regular MTX_DEF mutex. The GEOM topology lock is an sx > > lock, and of WITNESS blows up because of that: >=20 > I don't know is it related, but in recent -current I got stable panic at= =20 > the very last stage of reboot (after buffers syncing): > reboot after panic: mutex Giant owned at ../../../geom/geom_disk.c:638 > using just plain AHCI disks perhaps attached to CAM. Yes, that looks very related. Stay tuned. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --boAH8PqvUi1v1f55 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlBirfAACgkQForvXbEpPzSiYgCeK0yU/SlEFTk25JZ6HNaIaJ9T xFoAoNkTjgRcN4qFENJVro5dl9XvB22v =MFjd -----END PGP SIGNATURE----- --boAH8PqvUi1v1f55-- From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 07:54:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AA4CC106566B; Wed, 26 Sep 2012 07:54:20 +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 6D9528FC12; Wed, 26 Sep 2012 07:54:20 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id CC4BF7D5; Wed, 26 Sep 2012 09:53:19 +0200 (CEST) Date: Wed, 26 Sep 2012 09:54:43 +0200 From: Pawel Jakub Dawidek To: Ed Maste Message-ID: <20120926075442.GJ1391@garage.freebsd.pl> References: <201209252210.q8PMAEx5003950@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="W/D3X8sky0X3AmG5" Content-Disposition: inline In-Reply-To: <201209252210.q8PMAEx5003950@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 Subject: Re: svn commit: r240938 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 07:54:20 -0000 --W/D3X8sky0X3AmG5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 25, 2012 at 10:10:14PM +0000, Ed Maste wrote: [...] > Note: if_tun had the same issue, addressed in SVN revisions r186391, > r186483 and r186497. The use of the condvar there appears to be > redundant with the functionality provided by destroy_dev. [...] > --- head/sys/net/if_tapvar.h Tue Sep 25 21:33:36 2012 (r240937) > +++ head/sys/net/if_tapvar.h Tue Sep 25 22:10:14 2012 (r240938) > @@ -64,6 +64,7 @@ struct tap_softc { > SLIST_ENTRY(tap_softc) tap_next; /* next device in chain */ > struct cdev *tap_dev; > struct mtx tap_mtx; /* per-softc mutex */ > + struct cv tap_cv; /* protect ref'd dev destroy */=20 > }; So maybe there is no need to add it?:) --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --W/D3X8sky0X3AmG5 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlBitMIACgkQForvXbEpPzSicgCfXXbEWkwNzgNpI1xM7p79rrN2 PAQAoKDweilbN+DVRdG7e4fuWk7fh0cC =mi4X -----END PGP SIGNATURE----- --W/D3X8sky0X3AmG5-- From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 07:55:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 661901065679; Wed, 26 Sep 2012 07:55:40 +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 285B78FC14; Wed, 26 Sep 2012 07:55:39 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id B1C667D7; Wed, 26 Sep 2012 09:54:39 +0200 (CEST) Date: Wed, 26 Sep 2012 09:56:03 +0200 From: Pawel Jakub Dawidek To: Ed Maste Message-ID: <20120926075603.GK1391@garage.freebsd.pl> References: <201209252210.q8PMAEx5003950@svn.freebsd.org> <20120926075442.GJ1391@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lZZ4ablUVnt2XgAh" Content-Disposition: inline In-Reply-To: <20120926075442.GJ1391@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 Subject: Re: svn commit: r240938 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 07:55:40 -0000 --lZZ4ablUVnt2XgAh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 26, 2012 at 09:54:43AM +0200, Pawel Jakub Dawidek wrote: > On Tue, Sep 25, 2012 at 10:10:14PM +0000, Ed Maste wrote: > [...] > > Note: if_tun had the same issue, addressed in SVN revisions r186391, > > r186483 and r186497. The use of the condvar there appears to be > > redundant with the functionality provided by destroy_dev. > [...] > > --- head/sys/net/if_tapvar.h Tue Sep 25 21:33:36 2012 (r240937) > > +++ head/sys/net/if_tapvar.h Tue Sep 25 22:10:14 2012 (r240938) > > @@ -64,6 +64,7 @@ struct tap_softc { > > SLIST_ENTRY(tap_softc) tap_next; /* next device in chain */ > > struct cdev *tap_dev; > > struct mtx tap_mtx; /* per-softc mutex */ > > + struct cv tap_cv; /* protect ref'd dev destroy */=20 > > }; >=20 > So maybe there is no need to add it?:) I'm sooo late, sorry. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --lZZ4ablUVnt2XgAh Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlBitRIACgkQForvXbEpPzSo0wCdHWAdrwD3X47CuUqHYksdobMo yVkAnRyXcdrPnSBLgiPownREMTOQtCxb =jLtE -----END PGP SIGNATURE----- --lZZ4ablUVnt2XgAh-- From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 08:57:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A8F90106564A; Wed, 26 Sep 2012 08:57:13 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91A2B8FC14; Wed, 26 Sep 2012 08:57:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8Q8vDuP094859; Wed, 26 Sep 2012 08:57:13 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q8vDUj094854; Wed, 26 Sep 2012 08:57:13 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201209260857.q8Q8vDUj094854@svn.freebsd.org> From: Martin Matuska Date: Wed, 26 Sep 2012 08:57:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240949 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zfs vendor/illumos/dist/man/man1m X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 08:57:13 -0000 Author: mm Date: Wed Sep 26 08:57:12 2012 New Revision: 240949 URL: http://svn.freebsd.org/changeset/base/240949 Log: Update vendor/illumos/dist and vendor-sys/illumos/dist to illumos-gate 13836:37bf491c434c (illumos ZFS issues #2678, #2811, #3139, #3189, #3208) Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/sa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_znode.c Changes in other areas also in this revision: Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c vendor/illumos/dist/man/man1m/zfs.1m Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c Wed Sep 26 07:09:15 2012 (r240948) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c Wed Sep 26 08:57:12 2012 (r240949) @@ -572,7 +572,7 @@ dmu_tx_count_free(dmu_tx_hold_t *txh, ui (dn->dn_indblkshift - SPA_BLKPTRSHIFT); while (level++ < maxlevel) { - txh->txh_memory_tohold += MIN(blkcnt, (nl1blks >> epbs)) + txh->txh_memory_tohold += MAX(MIN(blkcnt, nl1blks), 1) << dn->dn_indblkshift; blkcnt = 1 + (blkcnt >> epbs); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/sa_impl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/sa_impl.h Wed Sep 26 07:09:15 2012 (r240948) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/sa_impl.h Wed Sep 26 08:57:12 2012 (r240949) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #ifndef _SYS_SA_IMPL_H @@ -181,7 +182,7 @@ typedef struct sa_hdr_phys { */ #define SA_HDR_LAYOUT_NUM(hdr) BF32_GET(hdr->sa_layout_info, 0, 10) -#define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 16, 3, 0) +#define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 6, 3, 0) #define SA_HDR_LAYOUT_INFO_ENCODE(x, num, size) \ { \ BF32_SET_SB(x, 10, 6, 3, 0, size); \ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c Wed Sep 26 07:09:15 2012 (r240948) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c Wed Sep 26 08:57:12 2012 (r240949) @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -63,7 +64,6 @@ #include #include #include -#include #include "zfs_comutil.h" int zfsfstype; @@ -577,7 +577,6 @@ static int zfs_space_delta_cb(dmu_object_type_t bonustype, void *data, uint64_t *userp, uint64_t *groupp) { - znode_phys_t *znp = data; int error = 0; /* @@ -596,20 +595,18 @@ zfs_space_delta_cb(dmu_object_type_t bon return (EEXIST); if (bonustype == DMU_OT_ZNODE) { + znode_phys_t *znp = data; *userp = znp->zp_uid; *groupp = znp->zp_gid; } else { int hdrsize; + sa_hdr_phys_t *sap = data; + sa_hdr_phys_t sa = *sap; + boolean_t swap = B_FALSE; ASSERT(bonustype == DMU_OT_SA); - hdrsize = sa_hdrsize(data); - if (hdrsize != 0) { - *userp = *((uint64_t *)((uintptr_t)data + hdrsize + - SA_UID_OFFSET)); - *groupp = *((uint64_t *)((uintptr_t)data + hdrsize + - SA_GID_OFFSET)); - } else { + if (sa.sa_magic == 0) { /* * This should only happen for newly created * files that haven't had the znode data filled @@ -617,6 +614,25 @@ zfs_space_delta_cb(dmu_object_type_t bon */ *userp = 0; *groupp = 0; + return (0); + } + if (sa.sa_magic == BSWAP_32(SA_MAGIC)) { + sa.sa_magic = SA_MAGIC; + sa.sa_layout_info = BSWAP_16(sa.sa_layout_info); + swap = B_TRUE; + } else { + VERIFY3U(sa.sa_magic, ==, SA_MAGIC); + } + + hdrsize = sa_hdrsize(&sa); + VERIFY3U(hdrsize, >=, sizeof (sa_hdr_phys_t)); + *userp = *((uint64_t *)((uintptr_t)data + hdrsize + + SA_UID_OFFSET)); + *groupp = *((uint64_t *)((uintptr_t)data + hdrsize + + SA_GID_OFFSET)); + if (swap) { + *userp = BSWAP_64(*userp); + *groupp = BSWAP_64(*groupp); } } return (error); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_znode.c Wed Sep 26 07:09:15 2012 (r240948) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_znode.c Wed Sep 26 08:57:12 2012 (r240949) @@ -1947,13 +1947,16 @@ zfs_release_sa_handle(sa_handle_t *hdl, * or not the object is an extended attribute directory. */ static int -zfs_obj_to_pobj(sa_handle_t *hdl, sa_attr_type_t *sa_table, uint64_t *pobjp, - int *is_xattrdir) +zfs_obj_to_pobj(objset_t *osp, sa_handle_t *hdl, sa_attr_type_t *sa_table, + uint64_t *pobjp, int *is_xattrdir) { uint64_t parent; uint64_t pflags; uint64_t mode; + uint64_t parent_mode; sa_bulk_attr_t bulk[3]; + sa_handle_t *sa_hdl; + dmu_buf_t *sa_db; int count = 0; int error; @@ -1967,9 +1970,32 @@ zfs_obj_to_pobj(sa_handle_t *hdl, sa_att if ((error = sa_bulk_lookup(hdl, bulk, count)) != 0) return (error); - *pobjp = parent; + /* + * When a link is removed its parent pointer is not changed and will + * be invalid. There are two cases where a link is removed but the + * file stays around, when it goes to the delete queue and when there + * are additional links. + */ + error = zfs_grab_sa_handle(osp, parent, &sa_hdl, &sa_db, FTAG); + if (error != 0) + return (error); + + error = sa_lookup(sa_hdl, ZPL_MODE, &parent_mode, sizeof (parent_mode)); + zfs_release_sa_handle(sa_hdl, sa_db, FTAG); + if (error != 0) + return (error); + *is_xattrdir = ((pflags & ZFS_XATTR) != 0) && S_ISDIR(mode); + /* + * Extended attributes can be applied to files, directories, etc. + * Otherwise the parent must be a directory. + */ + if (!*is_xattrdir && !S_ISDIR(parent_mode)) + return (EINVAL); + + *pobjp = parent; + return (0); } @@ -2018,7 +2044,7 @@ zfs_obj_to_path_impl(objset_t *osp, uint if (prevdb) zfs_release_sa_handle(prevhdl, prevdb, FTAG); - if ((error = zfs_obj_to_pobj(sa_hdl, sa_table, &pobj, + if ((error = zfs_obj_to_pobj(osp, sa_hdl, sa_table, &pobj, &is_xattrdir)) != 0) break; From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 08:57:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E763B106566B; Wed, 26 Sep 2012 08:57:13 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C92A48FC15; Wed, 26 Sep 2012 08:57:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8Q8vDmx094866; Wed, 26 Sep 2012 08:57:13 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q8vDUW094863; Wed, 26 Sep 2012 08:57:13 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201209260857.q8Q8vDUW094863@svn.freebsd.org> From: Martin Matuska Date: Wed, 26 Sep 2012 08:57:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240949 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor/illumos/dist/cmd/zfs vendor/illumos/dist/man/man1m X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 08:57:14 -0000 Author: mm Date: Wed Sep 26 08:57:12 2012 New Revision: 240949 URL: http://svn.freebsd.org/changeset/base/240949 Log: Update vendor/illumos/dist and vendor-sys/illumos/dist to illumos-gate 13836:37bf491c434c (illumos ZFS issues #2678, #2811, #3139, #3189, #3208) Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c vendor/illumos/dist/man/man1m/zfs.1m Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_tx.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/sa_impl.h vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_znode.c Modified: vendor/illumos/dist/cmd/zfs/zfs_main.c ============================================================================== --- vendor/illumos/dist/cmd/zfs/zfs_main.c Wed Sep 26 07:09:15 2012 (r240948) +++ vendor/illumos/dist/cmd/zfs/zfs_main.c Wed Sep 26 08:57:12 2012 (r240949) @@ -252,7 +252,7 @@ get_usage(zfs_help_t idx) case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: - return (gettext("\tsend [-DnPpRrv] [-[iI] snapshot] " + return (gettext("\tsend [-DnPpRv] [-[iI] snapshot] " "\n")); case HELP_SET: return (gettext("\tset " Modified: vendor/illumos/dist/man/man1m/zfs.1m ============================================================================== --- vendor/illumos/dist/man/man1m/zfs.1m Wed Sep 26 07:09:15 2012 (r240948) +++ vendor/illumos/dist/man/man1m/zfs.1m Wed Sep 26 08:57:12 2012 (r240949) @@ -26,7 +26,7 @@ .\" Copyright (c) 2012, Joyent, Inc. All rights reserved. .\" Copyright 2012 Nexenta Systems, Inc. All Rights Reserved. .\" -.TH ZFS 1M "Aug 16, 2012" +.TH ZFS 1M "Sep 16, 2012" .SH NAME zfs \- configures ZFS file systems .SH SYNOPSIS @@ -886,14 +886,14 @@ This property is not inherited. .sp .ne 2 .na -\fB\fBchecksum\fR=\fBon\fR | \fBoff\fR | \fBfletcher2,\fR| \fBfletcher4\fR | +\fB\fBchecksum\fR=\fBon\fR | \fBoff\fR | \fBfletcher2\fR | \fBfletcher4\fR | \fBsha256\fR\fR .ad .sp .6 .RS 4n Controls the checksum used to verify data integrity. The default value is \fBon\fR, which automatically selects an appropriate algorithm (currently, -\fBfletcher2\fR, but this may change in future releases). The value \fBoff\fR +\fBfletcher4\fR, but this may change in future releases). The value \fBoff\fR disables integrity checking on user data. Disabling checksums is \fBNOT\fR a recommended practice. .sp @@ -2733,7 +2733,7 @@ Unshare the specified filesystem. The co .sp .ne 2 .na -\fBzfs send\fR [\fB-DnPpRrv\fR] [\fB-\fR[\fBiI\fR] \fIsnapshot\fR] \fIsnapshot\fR +\fBzfs send\fR [\fB-DnPpRv\fR] [\fB-\fR[\fBiI\fR] \fIsnapshot\fR] \fIsnapshot\fR .ad .sp .6 .RS 4n @@ -2809,18 +2809,6 @@ will be much better if the filesystem us .sp .ne 2 .na -\fB\fB-r\fR\fR -.ad -.sp .6 -.RS 4n -Recursively send all descendant snapshots. This is similar to the \fB-R\fR -flag, but information about deleted and renamed datasets is not included, and -property information is only included if the \fB-p\fR flag is specified. -.RE - -.sp -.ne 2 -.na \fB\fB-p\fR\fR .ad .sp .6 From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 09:09:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5707A106564A; Wed, 26 Sep 2012 09:09:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) by mx1.freebsd.org (Postfix) with ESMTP id CB0928FC12; Wed, 26 Sep 2012 09:09:23 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:1d51:4889:7997:c8cd] (unknown [IPv6:2001:7b8:3a7:0:1d51:4889:7997:c8cd]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id AF54C5C59; Wed, 26 Sep 2012 11:09:21 +0200 (CEST) Message-ID: <5062C643.4060808@FreeBSD.org> Date: Wed, 26 Sep 2012 11:09:23 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20120905 Thunderbird/16.0 MIME-Version: 1.0 To: John Baldwin References: <201209211031.q8LAVKVC014601@svn.freebsd.org> <5061D84D.4020400@FreeBSD.org> <5061E864.8090200@FreeBSD.org> <201209251339.08573.jhb@freebsd.org> In-Reply-To: <201209251339.08573.jhb@freebsd.org> Content-Type: multipart/mixed; boundary="------------040906030801090000070803" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r240773 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 09:09:24 -0000 This is a multi-part message in MIME format. --------------040906030801090000070803 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012-09-25 19:39, John Baldwin wrote: > On Tuesday, September 25, 2012 1:22:44 pm Andriy Gapon wrote: >> on 09/25/12 19:14 Dimitry Andric said the following: >>> Are we interested more in "beautifying", than giving >>> unambiguous information? >> >> OTOH, I have never seen CPUID numbers in decimal. The point is, that in this specific dmesg line, we first print a hexadecimal ID with 0x, then follow it by IDs which are still hexadecimal, but NOT prefixed with 0x. That is inconsistent, and thus confusing; either print them all without prefix, or print them all with prefix (or a suffix). The latter is most unambiguous, in my opinion. > And the place you typically will use these is in looking at Intel's manuals in > which case they have the _h layout. If you want to gratuitously > change the format, I'd vote for outputting the string as '06_2Ah'. That's also fine with me, as long as *all* IDs get identified in the same manner. :) Are you OK with the attached patch, which suffixes all the ID information with 'h'? > Note that the full ID is already printed out earlier on the same line with a > trailing 0x, so it's not clear to me that it was confusing before. On some machines, the full ID is very clearly related to the family, model and such, for example on Gavin's Nocona test machine: CPU: Intel(R) Xeon(TM) CPU 2.80GHz (2793.24-MHz K8-class CPU) Origin = "GenuineIntel" Id = 0xf41 Family = f Model = 4 Stepping = 1 Here the family, model and stepping are just the individual hex digits of the full ID. However, on a more recent machine, such as this one, dmesg has: CPU: Intel(R) Core(TM) i5 CPU 650 @ 3.20GHz (3192.07-MHz K8-class CPU) Origin = "GenuineIntel" Id = 0x20652 Family = 6 Model = 25 Stepping = 2 The family, model and stepping are now not so easily recognized from the full ID, at least not at first glance. --------------040906030801090000070803 Content-Type: text/x-diff; name="cpuid-hex-1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cpuid-hex-1.diff" Index: sys/i386/i386/identcpu.c =================================================================== --- sys/i386/i386/identcpu.c (revision 240948) +++ sys/i386/i386/identcpu.c (working copy) @@ -678,7 +678,7 @@ printcpuinfo(void) if(*cpu_vendor) printf(" Origin = \"%s\"",cpu_vendor); if(cpu_id) - printf(" Id = 0x%x", cpu_id); + printf(" Id = %xh", cpu_id); if (cpu_vendor_id == CPU_VENDOR_INTEL || cpu_vendor_id == CPU_VENDOR_AMD || @@ -688,8 +688,8 @@ printcpuinfo(void) cpu_vendor_id == CPU_VENDOR_NSC || (cpu_vendor_id == CPU_VENDOR_CYRIX && ((cpu_id & 0xf00) > 0x500))) { - printf(" Family = 0x%x", CPUID_TO_FAMILY(cpu_id)); - printf(" Model = 0x%x", CPUID_TO_MODEL(cpu_id)); + printf(" Family = %xh", CPUID_TO_FAMILY(cpu_id)); + printf(" Model = %xh", CPUID_TO_MODEL(cpu_id)); printf(" Stepping = %u", cpu_id & CPUID_STEPPING); if (cpu_vendor_id == CPU_VENDOR_CYRIX) printf("\n DIR=0x%04x", cyrix_did); Index: sys/amd64/amd64/identcpu.c =================================================================== --- sys/amd64/amd64/identcpu.c (revision 240948) +++ sys/amd64/amd64/identcpu.c (working copy) @@ -208,13 +208,13 @@ printcpuinfo(void) if (*cpu_vendor) printf(" Origin = \"%s\"", cpu_vendor); if (cpu_id) - printf(" Id = 0x%x", cpu_id); + printf(" Id = %xh", cpu_id); if (cpu_vendor_id == CPU_VENDOR_INTEL || cpu_vendor_id == CPU_VENDOR_AMD || cpu_vendor_id == CPU_VENDOR_CENTAUR) { - printf(" Family = 0x%x", CPUID_TO_FAMILY(cpu_id)); - printf(" Model = 0x%x", CPUID_TO_MODEL(cpu_id)); + printf(" Family = %xh", CPUID_TO_FAMILY(cpu_id)); + printf(" Model = %xh", CPUID_TO_MODEL(cpu_id)); printf(" Stepping = %u", cpu_id & CPUID_STEPPING); /* --------------040906030801090000070803-- From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 09:22:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7127B106566B; Wed, 26 Sep 2012 09:22:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01C0C8FC0A; Wed, 26 Sep 2012 09:22:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8Q9MSuN098605; Wed, 26 Sep 2012 09:22:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q9MSCM098594; Wed, 26 Sep 2012 09:22:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209260922.q8Q9MSCM098594@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 26 Sep 2012 09:22:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240950 - in stable/9/sys: amd64/conf conf dev/random i386/conf modules/random X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 09:22:29 -0000 Author: kib Date: Wed Sep 26 09:22:28 2012 New Revision: 240950 URL: http://svn.freebsd.org/changeset/base/240950 Log: MFC r240135: Add support for new Intel on-CPU Bull Mountain random number generator. MFC r240455: Rename the IVY_RNG option to RDRAND_RNG. Added: stable/9/sys/dev/random/ivy.c - copied, changed from r240135, head/sys/dev/random/ivy.c Deleted: stable/9/sys/dev/random/nehemiah.h Modified: stable/9/sys/amd64/conf/GENERIC stable/9/sys/conf/files.amd64 stable/9/sys/conf/files.i386 stable/9/sys/conf/options.amd64 stable/9/sys/conf/options.i386 stable/9/sys/dev/random/nehemiah.c stable/9/sys/dev/random/probe.c stable/9/sys/i386/conf/GENERIC stable/9/sys/modules/random/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/amd64/conf/GENERIC ============================================================================== --- stable/9/sys/amd64/conf/GENERIC Wed Sep 26 08:57:12 2012 (r240949) +++ stable/9/sys/amd64/conf/GENERIC Wed Sep 26 09:22:28 2012 (r240950) @@ -272,6 +272,8 @@ device wpi # Intel 3945ABG wireless NI # Pseudo devices. device loop # Network loopback device random # Entropy device +options PADLOCK_RNG # VIA Padlock RNG +options RDRAND_RNG # Intel Bull Mountain RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. Modified: stable/9/sys/conf/files.amd64 ============================================================================== --- stable/9/sys/conf/files.amd64 Wed Sep 26 08:57:12 2012 (r240949) +++ stable/9/sys/conf/files.amd64 Wed Sep 26 09:22:28 2012 (r240950) @@ -216,7 +216,8 @@ dev/lindev/lindev.c optional lindev dev/nfe/if_nfe.c optional nfe pci dev/nve/if_nve.c optional nve pci dev/nvram/nvram.c optional nvram isa -dev/random/nehemiah.c optional random +dev/random/ivy.c optional random rdrand_rng +dev/random/nehemiah.c optional random padlock_rng dev/qlxgb/qla_dbg.c optional qlxgb pci dev/qlxgb/qla_hw.c optional qlxgb pci dev/qlxgb/qla_ioctl.c optional qlxgb pci Modified: stable/9/sys/conf/files.i386 ============================================================================== --- stable/9/sys/conf/files.i386 Wed Sep 26 08:57:12 2012 (r240949) +++ stable/9/sys/conf/files.i386 Wed Sep 26 09:22:28 2012 (r240950) @@ -226,7 +226,8 @@ dev/nfe/if_nfe.c optional nfe pci dev/nve/if_nve.c optional nve pci dev/nvram/nvram.c optional nvram isa dev/pcf/pcf_isa.c optional pcf -dev/random/nehemiah.c optional random +dev/random/ivy.c optional random rdrand_rng +dev/random/nehemiah.c optional random padlock_rng dev/sbni/if_sbni.c optional sbni dev/sbni/if_sbni_isa.c optional sbni isa dev/sbni/if_sbni_pci.c optional sbni pci Modified: stable/9/sys/conf/options.amd64 ============================================================================== --- stable/9/sys/conf/options.amd64 Wed Sep 26 08:57:12 2012 (r240949) +++ stable/9/sys/conf/options.amd64 Wed Sep 26 09:22:28 2012 (r240950) @@ -68,3 +68,7 @@ XENHVM opt_global.h # options for the Intel C600 SAS driver (isci) ISCI_LOGGING opt_isci.h + +# hw random number generators for random(4) +PADLOCK_RNG opt_cpu.h +RDRAND_RNG opt_cpu.h Modified: stable/9/sys/conf/options.i386 ============================================================================== --- stable/9/sys/conf/options.i386 Wed Sep 26 08:57:12 2012 (r240949) +++ stable/9/sys/conf/options.i386 Wed Sep 26 09:22:28 2012 (r240950) @@ -123,3 +123,7 @@ XENHVM opt_global.h # options for the Intel C600 SAS driver (isci) ISCI_LOGGING opt_isci.h + +# hw random number generators for random(4) +PADLOCK_RNG opt_cpu.h +RDRAND_RNG opt_cpu.h Copied and modified: stable/9/sys/dev/random/ivy.c (from r240135, head/sys/dev/random/ivy.c) ============================================================================== --- head/sys/dev/random/ivy.c Wed Sep 5 13:18:51 2012 (r240135, copy source) +++ stable/9/sys/dev/random/ivy.c Wed Sep 26 09:22:28 2012 (r240950) @@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$"); #include "opt_cpu.h" -#ifdef IVY_RNG +#ifdef RDRAND_RNG #include #include Modified: stable/9/sys/dev/random/nehemiah.c ============================================================================== --- stable/9/sys/dev/random/nehemiah.c Wed Sep 26 08:57:12 2012 (r240949) +++ stable/9/sys/dev/random/nehemiah.c Wed Sep 26 09:22:28 2012 (r240950) @@ -28,6 +28,10 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_cpu.h" + +#ifdef PADLOCK_RNG + #include #include #include @@ -203,3 +207,5 @@ random_nehemiah_read(void *buf, int c) mtx_unlock(&random_nehemiah_mtx); return (c); } + +#endif Modified: stable/9/sys/dev/random/probe.c ============================================================================== --- stable/9/sys/dev/random/probe.c Wed Sep 26 08:57:12 2012 (r240949) +++ stable/9/sys/dev/random/probe.c Wed Sep 26 09:22:28 2012 (r240950) @@ -28,12 +28,17 @@ #include __FBSDID("$FreeBSD$"); +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#include "opt_cpu.h" +#endif + #include #include +#include +#include #include #include #include -#include #include #if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) @@ -45,7 +50,15 @@ __FBSDID("$FreeBSD$"); #include #include -#include + +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#ifdef PADLOCK_RNG +extern struct random_systat random_nehemiah; +#endif +#ifdef RDRAND_RNG +extern struct random_systat random_ivy; +#endif +#endif void random_ident_hardware(struct random_systat *systat) @@ -56,8 +69,25 @@ random_ident_hardware(struct random_syst /* Then go looking for hardware */ #if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#ifdef PADLOCK_RNG if (via_feature_rng & VIA_HAS_RNG) { - *systat = random_nehemiah; + int enable; + + enable = 1; + TUNABLE_INT_FETCH("hw.nehemiah_rng_enable", &enable); + if (enable) + *systat = random_nehemiah; } #endif +#ifdef RDRAND_RNG + if (cpu_feature2 & CPUID2_RDRAND) { + int enable; + + enable = 1; + TUNABLE_INT_FETCH("hw.ivy_rng_enable", &enable); + if (enable) + *systat = random_ivy; + } +#endif +#endif } Modified: stable/9/sys/i386/conf/GENERIC ============================================================================== --- stable/9/sys/i386/conf/GENERIC Wed Sep 26 08:57:12 2012 (r240949) +++ stable/9/sys/i386/conf/GENERIC Wed Sep 26 09:22:28 2012 (r240950) @@ -285,6 +285,8 @@ device wpi # Intel 3945ABG wireless NI # Pseudo devices. device loop # Network loopback device random # Entropy device +options PADLOCK_RNG # VIA Padlock RNG +options RDRAND_RNG # Intel Bull Mountain RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. Modified: stable/9/sys/modules/random/Makefile ============================================================================== --- stable/9/sys/modules/random/Makefile Wed Sep 26 08:57:12 2012 (r240949) +++ stable/9/sys/modules/random/Makefile Wed Sep 26 09:22:28 2012 (r240950) @@ -8,10 +8,11 @@ KMOD= random SRCS= randomdev.c probe.c .if ${MACHINE} == "amd64" || ${MACHINE} == "i386" SRCS+= nehemiah.c +SRCS+= ivy.c .endif SRCS+= randomdev_soft.c yarrow.c hash.c SRCS+= rijndael-alg-fst.c rijndael-api-fst.c sha2.c -SRCS+= bus_if.h device_if.h vnode_if.h +SRCS+= bus_if.h device_if.h vnode_if.h opt_cpu.h CFLAGS+= -I${.CURDIR}/../.. From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 09:25:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99E4F1065672; Wed, 26 Sep 2012 09:25:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85E8E8FC23; Wed, 26 Sep 2012 09:25:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8Q9PCmP099045; Wed, 26 Sep 2012 09:25:12 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q9PCSs099043; Wed, 26 Sep 2012 09:25:12 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209260925.q8Q9PCSs099043@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 26 Sep 2012 09:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240951 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 09:25:12 -0000 Author: kib Date: Wed Sep 26 09:25:11 2012 New Revision: 240951 URL: http://svn.freebsd.org/changeset/base/240951 Log: Make the updates of the tid ring buffer' head and tail pointers explicit by moving them into separate statements from the buffer element accesses. Requested by: jhb MFC after: 3 days Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Wed Sep 26 09:22:28 2012 (r240950) +++ head/sys/kern/kern_thread.c Wed Sep 26 09:25:11 2012 (r240951) @@ -102,8 +102,8 @@ tid_alloc(void) mtx_unlock(&tid_lock); return (-1); } - tid = tid_buffer[tid_head++]; - tid_head %= TID_BUFFER_SIZE; + tid = tid_buffer[tid_head]; + tid_head = (tid_head + 1) % TID_BUFFER_SIZE; mtx_unlock(&tid_lock); return (tid); } @@ -115,11 +115,11 @@ tid_free(lwpid_t tid) mtx_lock(&tid_lock); if ((tid_tail + 1) % TID_BUFFER_SIZE == tid_head) { - tmp_tid = tid_buffer[tid_head++]; - tid_head %= TID_BUFFER_SIZE; + tmp_tid = tid_buffer[tid_head]; + tid_head = (tid_head + 1) % TID_BUFFER_SIZE; } - tid_buffer[tid_tail++] = tid; - tid_tail %= TID_BUFFER_SIZE; + tid_buffer[tid_tail] = tid; + tid_tail = (tid_tail + 1) % TID_BUFFER_SIZE; mtx_unlock(&tid_lock); if (tmp_tid != -1) free_unr(tid_unrhdr, tmp_tid); From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 09:25:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A41C01065744; Wed, 26 Sep 2012 09:25:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 853AB8FC14; Wed, 26 Sep 2012 09:25:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8Q9PVqf099126; Wed, 26 Sep 2012 09:25:31 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q9PV8P099124; Wed, 26 Sep 2012 09:25:31 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201209260925.q8Q9PV8P099124@svn.freebsd.org> From: Andrew Turner Date: Wed, 26 Sep 2012 09:25:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240952 - head/sys/arm/lpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 09:25:31 -0000 Author: andrew Date: Wed Sep 26 09:25:31 2012 New Revision: 240952 URL: http://svn.freebsd.org/changeset/base/240952 Log: Start to clean up the lpc initarm as it also uses FDT. Modified: head/sys/arm/lpc/lpc_machdep.c Modified: head/sys/arm/lpc/lpc_machdep.c ============================================================================== --- head/sys/arm/lpc/lpc_machdep.c Wed Sep 26 09:25:11 2012 (r240951) +++ head/sys/arm/lpc/lpc_machdep.c Wed Sep 26 09:25:31 2012 (r240952) @@ -129,11 +129,11 @@ extern int *end; struct pv_addr kernel_pt_table[KERNEL_PT_MAX]; /* Physical and virtual addresses for some global pages */ - vm_paddr_t phys_avail[10]; vm_paddr_t dump_avail[4]; vm_offset_t physical_pages; vm_offset_t pmap_bootstrap_lastaddr; +vm_paddr_t pmap_pa; const struct pmap_devmap *pmap_devmap_bootstrap_table; struct pv_addr systempage; @@ -309,12 +309,15 @@ initarm(struct arm_boot_params *abp) uint32_t memsize, l2size; void *kmdp; u_int l1pagetable; - int i = 0, j = 0; + int i = 0, j = 0, err_devmap = 0; lastaddr = parse_boot_param(abp); memsize = 0; set_cpufuncs(); + /* + * Find the dtb passed in by the boot loader. + */ kmdp = preload_search_by_type("elf kernel"); if (kmdp != NULL) dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t); @@ -347,8 +350,7 @@ initarm(struct arm_boot_params *abp) /* Platform-specific initialisation */ pmap_bootstrap_lastaddr = fdt_immr_va - ARM_NOCACHE_KVA_SIZE; - pcpu_init(pcpup, 0, sizeof(struct pcpu)); - PCPU_SET(curthread, &thread0); + pcpu0_init(); /* Calculate number of L2 tables needed for mapping vm_page_array */ l2size = (memsize / PAGE_SIZE) * sizeof(struct vm_page); @@ -406,10 +408,10 @@ initarm(struct arm_boot_params *abp) dpcpu_init((void *)dpcpu.pv_va, 0); /* Allocate stacks for all modes */ - valloc_pages(irqstack, IRQ_STACK_SIZE); - valloc_pages(abtstack, ABT_STACK_SIZE); - valloc_pages(undstack, UND_STACK_SIZE); - valloc_pages(kernelstack, KSTACK_PAGES); + valloc_pages(irqstack, (IRQ_STACK_SIZE * MAXCPU)); + valloc_pages(abtstack, (ABT_STACK_SIZE * MAXCPU)); + valloc_pages(undstack, (UND_STACK_SIZE * MAXCPU)); + valloc_pages(kernelstack, (KSTACK_PAGES * MAXCPU)); init_param1(); @@ -464,12 +466,12 @@ initarm(struct arm_boot_params *abp) VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); /* Map pmap_devmap[] entries */ - if (platform_devmap_init() != 0) - while (1); + err_devmap = platform_devmap_init(); pmap_devmap_bootstrap(l1pagetable, pmap_devmap_bootstrap_table); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) | DOMAIN_CLIENT); + pmap_pa = kernel_l1pt.pv_pa; setttb(kernel_l1pt.pv_pa); cpu_tlb_flushID(); cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)); @@ -493,12 +495,16 @@ initarm(struct arm_boot_params *abp) physmem = memsize / PAGE_SIZE; debugf("initarm: console initialized\n"); - debugf(" arg1 mdp = 0x%08x\n", (uint32_t)mdp); + debugf(" arg1 kmdp = 0x%08x\n", (uint32_t)kmdp); debugf(" boothowto = 0x%08x\n", boothowto); - printf(" dtbp = 0x%08x\n", (uint32_t)dtbp); + debugf(" dtbp = 0x%08x\n", (uint32_t)dtbp); print_kernel_section_addr(); print_kenv(); + if (err_devmap != 0) + printf("WARNING: could not fully configure devmap, error=%d\n", + err_devmap); + /* * Pages were allocated during the secondary bootstrap for the * stacks for different CPU modes. From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 09:27:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCABA1065670; Wed, 26 Sep 2012 09:27:38 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A769A8FC19; Wed, 26 Sep 2012 09:27:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8Q9RcAb099452; Wed, 26 Sep 2012 09:27:38 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q9RcbU099450; Wed, 26 Sep 2012 09:27:38 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201209260927.q8Q9RcbU099450@svn.freebsd.org> From: Andrew Turner Date: Wed, 26 Sep 2012 09:27:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240953 - head/sys/arm/lpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 09:27:38 -0000 Author: andrew Date: Wed Sep 26 09:27:38 2012 New Revision: 240953 URL: http://svn.freebsd.org/changeset/base/240953 Log: Use arm_dump_avail_init to build the dump_avail array Modified: head/sys/arm/lpc/lpc_machdep.c Modified: head/sys/arm/lpc/lpc_machdep.c ============================================================================== --- head/sys/arm/lpc/lpc_machdep.c Wed Sep 26 09:25:31 2012 (r240952) +++ head/sys/arm/lpc/lpc_machdep.c Wed Sep 26 09:27:38 2012 (r240953) @@ -538,12 +538,7 @@ initarm(struct arm_boot_params *abp) init_proc0(kernelstack.pv_va); arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); - - dump_avail[0] = 0; - dump_avail[1] = memsize; - dump_avail[2] = 0; - dump_avail[3] = 0; - + arm_dump_avail_init(memsize, sizeof(dump_avail) / sizeof(dump_avail[0])); pmap_bootstrap(freemempos, pmap_bootstrap_lastaddr, &kernel_l1pt); msgbufp = (void *)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 09:29:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 54AB51065672; Wed, 26 Sep 2012 09:29:49 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 403A98FC12; Wed, 26 Sep 2012 09:29:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8Q9Tn8J099781; Wed, 26 Sep 2012 09:29:49 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q9Tn2m099779; Wed, 26 Sep 2012 09:29:49 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201209260929.q8Q9Tn2m099779@svn.freebsd.org> From: Kevin Lo Date: Wed, 26 Sep 2012 09:29:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240954 - head/usr.bin/getent X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 09:29:49 -0000 Author: kevlo Date: Wed Sep 26 09:29:48 2012 New Revision: 240954 URL: http://svn.freebsd.org/changeset/base/240954 Log: Teach getent(1) to look up a hostname and find IPv6 addresses. PR: bin/161548 Submitted by: matthew Modified: head/usr.bin/getent/getent.c Modified: head/usr.bin/getent/getent.c ============================================================================== --- head/usr.bin/getent/getent.c Wed Sep 26 09:27:38 2012 (r240953) +++ head/usr.bin/getent/getent.c Wed Sep 26 09:29:48 2012 (r240954) @@ -277,7 +277,7 @@ hostsprint(const struct hostent *he) static int hosts(int argc, char *argv[]) { - struct hostent *he; + struct hostent *he4, *he6; char addr[IN6ADDRSZ]; int i, rv; @@ -285,21 +285,31 @@ hosts(int argc, char *argv[]) assert(argv != NULL); sethostent(1); + he4 = he6 = NULL; rv = RV_OK; if (argc == 2) { - while ((he = gethostent()) != NULL) - hostsprint(he); + while ((he4 = gethostent()) != NULL) + hostsprint(he4); } else { for (i = 2; i < argc; i++) { - if (inet_pton(AF_INET6, argv[i], (void *)addr) > 0) - he = gethostbyaddr(addr, IN6ADDRSZ, AF_INET6); - else if (inet_pton(AF_INET, argv[i], (void *)addr) > 0) - he = gethostbyaddr(addr, INADDRSZ, AF_INET); - else - he = gethostbyname(argv[i]); - if (he != NULL) - hostsprint(he); - else { + if (inet_pton(AF_INET6, argv[i], (void *)addr) > 0) { + he6 = gethostbyaddr(addr, IN6ADDRSZ, AF_INET6); + if (he6 != NULL) + hostsprint(he6); + } else if (inet_pton(AF_INET, argv[i], + (void *)addr) > 0) { + he4 = gethostbyaddr(addr, INADDRSZ, AF_INET); + if (he4 != NULL) + hostsprint(he4); + } else { + he6 = gethostbyname2(argv[i], AF_INET6); + if (he6 != NULL) + hostsprint(he6); + he4 = gethostbyname(argv[i]); + if (he4 != NULL) + hostsprint(he4); + } + if ( he4 == NULL && he6 == NULL ) { rv = RV_NOTFOUND; break; } From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 09:37:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1276E106564A; Wed, 26 Sep 2012 09:37:59 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF0078FC08; Wed, 26 Sep 2012 09:37:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8Q9bwff001098; Wed, 26 Sep 2012 09:37:58 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8Q9bw8a001091; Wed, 26 Sep 2012 09:37:58 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201209260937.q8Q9bw8a001091@svn.freebsd.org> From: Martin Matuska Date: Wed, 26 Sep 2012 09:37:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240955 - in head: cddl/contrib/opensolaris/cmd/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 09:37:59 -0000 Author: mm Date: Wed Sep 26 09:37:58 2012 New Revision: 240955 URL: http://svn.freebsd.org/changeset/base/240955 Log: Merge recent vendor changes in ZFS. Illumos issued covered: 2811 missing implementation: zfs send -r 3139 zdb dies when it tries to determine path of unlinked file 3189 kernel panic in ZFS test suite during hotspare_onoffline_004_neg 3208 moving zpool cross-endian results in incorrect user/group accounting References: https://www.illumos.org/issues/ + [issue_id] Obtained from: illumos (vendor/illumos, vendor/illumos-sys) MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Sep 26 09:29:48 2012 (r240954) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Sep 26 09:37:58 2012 (r240955) @@ -174,7 +174,7 @@ .Fl a | Ar filesystem Ns | Ns Ar mountpoint .Nm .Cm send -.Op Fl DnPpRrv +.Op Fl DnPpRv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Nm @@ -2196,7 +2196,7 @@ file system shared on the system. .It Xo .Nm .Cm send -.Op Fl DnPpRrv +.Op Fl DnPpRv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Xc @@ -2269,13 +2269,6 @@ be used regardless of the dataset's property, but performance will be much better if the filesystem uses a dedup-capable checksum (eg. .Sy sha256 ) . -.It Fl r -Recursively send all descendant snapshots. This is similar to the -.Fl R -flag, but information about deleted and renamed datasets is not included, and -property information is only included if the -.Fl p -flag is specified. .It Fl p Include the dataset's properties in the stream. This flag is implicit when .Fl R Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Sep 26 09:29:48 2012 (r240954) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Sep 26 09:37:58 2012 (r240955) @@ -267,7 +267,7 @@ get_usage(zfs_help_t idx) case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: - return (gettext("\tsend [-DnPpRrv] " + return (gettext("\tsend [-DnPpRv] " "[-i snapshot | -I snapshot] \n")); case HELP_SET: return (gettext("\tset " Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Wed Sep 26 09:29:48 2012 (r240954) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Wed Sep 26 09:37:58 2012 (r240955) @@ -572,7 +572,7 @@ dmu_tx_count_free(dmu_tx_hold_t *txh, ui (dn->dn_indblkshift - SPA_BLKPTRSHIFT); while (level++ < maxlevel) { - txh->txh_memory_tohold += MIN(blkcnt, (nl1blks >> epbs)) + txh->txh_memory_tohold += MAX(MIN(blkcnt, nl1blks), 1) << dn->dn_indblkshift; blkcnt = 1 + (blkcnt >> epbs); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h Wed Sep 26 09:29:48 2012 (r240954) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h Wed Sep 26 09:37:58 2012 (r240955) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #ifndef _SYS_SA_IMPL_H @@ -181,7 +182,7 @@ typedef struct sa_hdr_phys { */ #define SA_HDR_LAYOUT_NUM(hdr) BF32_GET(hdr->sa_layout_info, 0, 10) -#define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 16, 3, 0) +#define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 6, 3, 0) #define SA_HDR_LAYOUT_INFO_ENCODE(x, num, size) \ { \ BF32_SET_SB(x, 10, 6, 3, 0, size); \ 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 Wed Sep 26 09:29:48 2012 (r240954) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Wed Sep 26 09:37:58 2012 (r240955) @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -59,7 +60,6 @@ #include #include #include -#include #include #include "zfs_comutil.h" @@ -550,7 +550,6 @@ static int zfs_space_delta_cb(dmu_object_type_t bonustype, void *data, uint64_t *userp, uint64_t *groupp) { - znode_phys_t *znp = data; int error = 0; /* @@ -569,20 +568,18 @@ zfs_space_delta_cb(dmu_object_type_t bon return (EEXIST); if (bonustype == DMU_OT_ZNODE) { + znode_phys_t *znp = data; *userp = znp->zp_uid; *groupp = znp->zp_gid; } else { int hdrsize; + sa_hdr_phys_t *sap = data; + sa_hdr_phys_t sa = *sap; + boolean_t swap = B_FALSE; ASSERT(bonustype == DMU_OT_SA); - hdrsize = sa_hdrsize(data); - if (hdrsize != 0) { - *userp = *((uint64_t *)((uintptr_t)data + hdrsize + - SA_UID_OFFSET)); - *groupp = *((uint64_t *)((uintptr_t)data + hdrsize + - SA_GID_OFFSET)); - } else { + if (sa.sa_magic == 0) { /* * This should only happen for newly created * files that haven't had the znode data filled @@ -590,6 +587,25 @@ zfs_space_delta_cb(dmu_object_type_t bon */ *userp = 0; *groupp = 0; + return (0); + } + if (sa.sa_magic == BSWAP_32(SA_MAGIC)) { + sa.sa_magic = SA_MAGIC; + sa.sa_layout_info = BSWAP_16(sa.sa_layout_info); + swap = B_TRUE; + } else { + VERIFY3U(sa.sa_magic, ==, SA_MAGIC); + } + + hdrsize = sa_hdrsize(&sa); + VERIFY3U(hdrsize, >=, sizeof (sa_hdr_phys_t)); + *userp = *((uint64_t *)((uintptr_t)data + hdrsize + + SA_UID_OFFSET)); + *groupp = *((uint64_t *)((uintptr_t)data + hdrsize + + SA_GID_OFFSET)); + if (swap) { + *userp = BSWAP_64(*userp); + *groupp = BSWAP_64(*groupp); } } return (error); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Wed Sep 26 09:29:48 2012 (r240954) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Wed Sep 26 09:37:58 2012 (r240955) @@ -2050,13 +2050,16 @@ zfs_release_sa_handle(sa_handle_t *hdl, * or not the object is an extended attribute directory. */ static int -zfs_obj_to_pobj(sa_handle_t *hdl, sa_attr_type_t *sa_table, uint64_t *pobjp, - int *is_xattrdir) +zfs_obj_to_pobj(objset_t *osp, sa_handle_t *hdl, sa_attr_type_t *sa_table, + uint64_t *pobjp, int *is_xattrdir) { uint64_t parent; uint64_t pflags; uint64_t mode; + uint64_t parent_mode; sa_bulk_attr_t bulk[3]; + sa_handle_t *sa_hdl; + dmu_buf_t *sa_db; int count = 0; int error; @@ -2070,9 +2073,32 @@ zfs_obj_to_pobj(sa_handle_t *hdl, sa_att if ((error = sa_bulk_lookup(hdl, bulk, count)) != 0) return (error); - *pobjp = parent; + /* + * When a link is removed its parent pointer is not changed and will + * be invalid. There are two cases where a link is removed but the + * file stays around, when it goes to the delete queue and when there + * are additional links. + */ + error = zfs_grab_sa_handle(osp, parent, &sa_hdl, &sa_db, FTAG); + if (error != 0) + return (error); + + error = sa_lookup(sa_hdl, ZPL_MODE, &parent_mode, sizeof (parent_mode)); + zfs_release_sa_handle(sa_hdl, sa_db, FTAG); + if (error != 0) + return (error); + *is_xattrdir = ((pflags & ZFS_XATTR) != 0) && S_ISDIR(mode); + /* + * Extended attributes can be applied to files, directories, etc. + * Otherwise the parent must be a directory. + */ + if (!*is_xattrdir && !S_ISDIR(parent_mode)) + return (EINVAL); + + *pobjp = parent; + return (0); } @@ -2121,7 +2147,7 @@ zfs_obj_to_path_impl(objset_t *osp, uint if (prevdb) zfs_release_sa_handle(prevhdl, prevdb, FTAG); - if ((error = zfs_obj_to_pobj(sa_hdl, sa_table, &pobj, + if ((error = zfs_obj_to_pobj(osp, sa_hdl, sa_table, &pobj, &is_xattrdir)) != 0) break; From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 10:07:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C84911065686; Wed, 26 Sep 2012 10:07:53 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4D778FC15; Wed, 26 Sep 2012 10:07:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QA7rGM005109; Wed, 26 Sep 2012 10:07:53 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QA7rXu005107; Wed, 26 Sep 2012 10:07:53 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201209261007.q8QA7rXu005107@svn.freebsd.org> From: Andrew Turner Date: Wed, 26 Sep 2012 10:07:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240956 - head/sys/arm/lpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 10:07:53 -0000 Author: andrew Date: Wed Sep 26 10:07:53 2012 New Revision: 240956 URL: http://svn.freebsd.org/changeset/base/240956 Log: Create the new initarm_ functions to reduce the diff to the other FDT versions of initarm Modified: head/sys/arm/lpc/lpc_machdep.c Modified: head/sys/arm/lpc/lpc_machdep.c ============================================================================== --- head/sys/arm/lpc/lpc_machdep.c Wed Sep 26 09:37:58 2012 (r240955) +++ head/sys/arm/lpc/lpc_machdep.c Wed Sep 26 10:07:53 2012 (r240956) @@ -344,11 +344,8 @@ initarm(struct arm_boot_params *abp) &memsize) != 0) while(1); - if (fdt_immr_addr(LPC_DEV_BASE) != 0) - while (1); - /* Platform-specific initialisation */ - pmap_bootstrap_lastaddr = fdt_immr_va - ARM_NOCACHE_KVA_SIZE; + pmap_bootstrap_lastaddr = initarm_lastaddr(); pcpu0_init(); @@ -482,13 +479,7 @@ initarm(struct arm_boot_params *abp) */ OF_interpret("perform-fixup", 0); -#if 0 - /* - * Initialize GPIO as early as possible. - */ - if (platform_gpio_init() != 0) - while (1); -#endif + initarm_gpio_init(); cninit(); @@ -505,6 +496,8 @@ initarm(struct arm_boot_params *abp) printf("WARNING: could not fully configure devmap, error=%d\n", err_devmap); + initarm_late_init(); + /* * Pages were allocated during the secondary bootstrap for the * stacks for different CPU modes. @@ -562,6 +555,27 @@ initarm(struct arm_boot_params *abp) sizeof(struct pcb))); } +vm_offset_t +initarm_lastaddr(void) +{ + + if (fdt_immr_addr(LPC_DEV_BASE) != 0) + while (1); + + /* Platform-specific initialisation */ + return (fdt_immr_va - ARM_NOCACHE_KVA_SIZE); +} + +void +initarm_gpio_init(void) +{ +} + +void +initarm_late_init(void) +{ +} + #define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { { 0, 0, 0, 0, 0, } From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 10:58:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 14D501065672; Wed, 26 Sep 2012 10:58:16 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D9F6D8FC08; Wed, 26 Sep 2012 10:58:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QAwFAR013992; Wed, 26 Sep 2012 10:58:15 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QAwFxQ013989; Wed, 26 Sep 2012 10:58:15 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201209261058.q8QAwFxQ013989@svn.freebsd.org> From: Martin Matuska Date: Wed, 26 Sep 2012 10:58:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240957 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 10:58:16 -0000 Author: mm Date: Wed Sep 26 10:58:15 2012 New Revision: 240957 URL: http://svn.freebsd.org/changeset/base/240957 Log: MFC r236248-r236250: MFC r236248 (pjd): Remove unused variable. MFC r236249 (pjd): Eliminate 'where' argument, we don't use it. MFC r236250 (pjd): Tighten up the assertion: because size can't be 0 and even if sm_space is equal to sm_size, any 'sm_space - size' will be less than sm_size. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Sep 26 10:07:53 2012 (r240956) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Sep 26 10:58:15 2012 (r240957) @@ -67,7 +67,6 @@ int zfs_resilver_min_time_ms = 3000; /* boolean_t zfs_no_scrub_io = B_FALSE; /* set to disable scrub i/o */ boolean_t zfs_no_scrub_prefetch = B_FALSE; /* set to disable srub prefetching */ enum ddt_class zfs_scrub_ddt_class_max = DDT_CLASS_DUPLICATE; -int dsl_scan_delay_completion = B_FALSE; /* set to delay scan completion */ #define DSL_SCAN_IS_SCRUB_RESILVER(scn) \ ((scn)->scn_phys.scn_func == POOL_SCAN_SCRUB || \ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Wed Sep 26 10:07:53 2012 (r240956) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Wed Sep 26 10:58:15 2012 (r240957) @@ -149,7 +149,6 @@ space_map_add(space_map_t *sm, uint64_t void space_map_remove(space_map_t *sm, uint64_t start, uint64_t size) { - avl_index_t where; space_seg_t ssearch, *ss, *newseg; uint64_t end = start + size; int left_over, right_over; @@ -161,7 +160,7 @@ space_map_remove(space_map_t *sm, uint64 ssearch.ss_start = start; ssearch.ss_end = end; - ss = avl_find(&sm->sm_root, &ssearch, &where); + ss = avl_find(&sm->sm_root, &ssearch, NULL); /* Make sure we completely overlap with someone */ if (ss == NULL) { @@ -172,7 +171,7 @@ space_map_remove(space_map_t *sm, uint64 } VERIFY3U(ss->ss_start, <=, start); VERIFY3U(ss->ss_end, >=, end); - VERIFY(sm->sm_space - size <= sm->sm_size); + VERIFY(sm->sm_space - size < sm->sm_size); left_over = (ss->ss_start != start); right_over = (ss->ss_end != end); From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 11:12:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11CB5106564A; Wed, 26 Sep 2012 11:12:10 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D680B8FC08; Wed, 26 Sep 2012 11:12:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QBC9Pt015948; Wed, 26 Sep 2012 11:12:09 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QBC9EC015945; Wed, 26 Sep 2012 11:12:09 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201209261112.q8QBC9EC015945@svn.freebsd.org> From: Martin Matuska Date: Wed, 26 Sep 2012 11:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240958 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 11:12:10 -0000 Author: mm Date: Wed Sep 26 11:12:09 2012 New Revision: 240958 URL: http://svn.freebsd.org/changeset/base/240958 Log: MFC r236248-r236250: MFC r236248 (pjd): Remove unused variable. MFC r236249 (pjd): Eliminate 'where' argument, we don't use it. MFC r236250 (pjd): Tighten up the assertion: because size can't be 0 and even if sm_space is equal to sm_size, any 'sm_space - size' will be less than sm_size. Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Sep 26 10:58:15 2012 (r240957) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Sep 26 11:12:09 2012 (r240958) @@ -67,7 +67,6 @@ int zfs_resilver_min_time_ms = 3000; /* boolean_t zfs_no_scrub_io = B_FALSE; /* set to disable scrub i/o */ boolean_t zfs_no_scrub_prefetch = B_FALSE; /* set to disable srub prefetching */ enum ddt_class zfs_scrub_ddt_class_max = DDT_CLASS_DUPLICATE; -int dsl_scan_delay_completion = B_FALSE; /* set to delay scan completion */ #define DSL_SCAN_IS_SCRUB_RESILVER(scn) \ ((scn)->scn_phys.scn_func == POOL_SCAN_SCRUB || \ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Wed Sep 26 10:58:15 2012 (r240957) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Wed Sep 26 11:12:09 2012 (r240958) @@ -149,7 +149,6 @@ space_map_add(space_map_t *sm, uint64_t void space_map_remove(space_map_t *sm, uint64_t start, uint64_t size) { - avl_index_t where; space_seg_t ssearch, *ss, *newseg; uint64_t end = start + size; int left_over, right_over; @@ -161,7 +160,7 @@ space_map_remove(space_map_t *sm, uint64 ssearch.ss_start = start; ssearch.ss_end = end; - ss = avl_find(&sm->sm_root, &ssearch, &where); + ss = avl_find(&sm->sm_root, &ssearch, NULL); /* Make sure we completely overlap with someone */ if (ss == NULL) { @@ -172,7 +171,7 @@ space_map_remove(space_map_t *sm, uint64 } VERIFY3U(ss->ss_start, <=, start); VERIFY3U(ss->ss_end, >=, end); - VERIFY(sm->sm_space - size <= sm->sm_size); + VERIFY(sm->sm_space - size < sm->sm_size); left_over = (ss->ss_start != start); right_over = (ss->ss_end != end); From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 11:45:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 115EA106564A; Wed, 26 Sep 2012 11:45:44 +0000 (UTC) (envelope-from Benjamin.Close@clearchain.com) Received: from mail.clearchain.com (leo.clearchain.com [199.73.29.74]) by mx1.freebsd.org (Postfix) with ESMTP id BC0BC8FC19; Wed, 26 Sep 2012 11:45:43 +0000 (UTC) Received: from Lynx.local ([101.113.33.231]) (authenticated bits=0) by mail.clearchain.com (8.14.5/8.14.5) with ESMTP id q8QBWQAx005470 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 26 Sep 2012 21:02:37 +0930 (CST) (envelope-from Benjamin.Close@clearchain.com) Message-ID: <5062E806.8000707@clearchain.com> Date: Wed, 26 Sep 2012 21:03:26 +0930 From: Benjamin Close User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> <20120926072005.GH1391@garage.freebsd.pl> In-Reply-To: <20120926072005.GH1391@garage.freebsd.pl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (mail.clearchain.com [199.73.29.74]); Wed, 26 Sep 2012 21:02:41 +0930 (CST) Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, "Kenneth D. Merry" , jdp@freebsd.org, phk@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 11:45:44 -0000 On 26/09/12 4:50 PM, Pawel Jakub Dawidek wrote: > On Tue, Sep 25, 2012 at 05:37:12PM -0600, Kenneth D. Merry wrote: >> On Sat, Sep 22, 2012 at 12:41:49 +0000, Pawel Jakub Dawidek wrote: >>> Log: >>> Use the topology lock to protect list of providers while withering them. >>> It is possible that provider is destroyed while we are iterating over the >>> list. > [...] >>> --- head/sys/geom/geom_disk.c Sat Sep 22 12:40:52 2012 (r240821) >>> +++ head/sys/geom/geom_disk.c Sat Sep 22 12:41:49 2012 (r240822) >>> @@ -635,10 +635,13 @@ disk_gone(struct disk *dp) >>> struct g_geom *gp; >>> struct g_provider *pp; >>> >>> + g_topology_lock(); >>> gp = dp->d_geom; >>> - if (gp != NULL) >>> + if (gp != NULL) { >>> LIST_FOREACH(pp, &gp->provider, provider) >>> g_wither_provider(pp, ENXIO); >>> + } >>> + g_topology_unlock(); >>> } > [...] >> This breaks devices going away in CAM. >> >> When the da(4) driver calls disk_gone(), it is necessarily holding the SIM >> lock, which is a regular MTX_DEF mutex. The GEOM topology lock is an sx >> lock, and of WITNESS blows up because of that: > [...] >> disk_gone() needs to be callable from an interrupt context. So it cannot >> acquire the topology lock. > I can reword what you said above a bit: disk_gone() modifies GEOM > topology, so it has to hold the topology lock, thus it cannot be called > from an interrupt context. > > We might be able to change the topology lock to LIST_FOREACH_SAFE(), as > g_wither_provider() can only destroy current provider. This is because > CAM own the geom and nobody should be able to mess with its provider's > list, apart from CAM itself. So I'd need to know how CAM ensures that > two disk_gone() cannot be called for one geom. The answer might be that > those geoms have always only one provider, but then I cannot explain why > we have loop there. Maybe jdp@ will remember why. > > I also read original commit message and I don't fully understand. > > It was 7 years ago so I'll quote entire commit message: > > Fix a bug that caused some /dev entries to continue to exist after > the underlying drive had been hot-unplugged from the system. Here > is a specific example. Filesystem code had opened /dev/da1s1e. > Subsequently, the drive was hot-unplugged. This (correctly) caused > all of the associated /dev/da1* entries to be deleted. When the > filesystem later realized that the drive was gone it closed the > device, reducing the write-access counts to 0 on the geom providers > for da1s1e, da1s1, and da1. This caused geom to re-taste the > providers, resulting in the devices being created again. When the > drive was hot-plugged back in, it resulted in duplicate /dev entries > for da1s1e, da1s1, and da1. > > This fix adds a new disk_gone() function which is called by CAM when a > drive goes away. It orphans all of the providers associated with the > drive, setting an error condition of ENXIO in each one. In addition, > we prevent a re-taste on last close for writing if an error condition > has been set in the provider. > > If disk is gone it should orphan its provider. This should cause > orphaning depended providers, including da1s1 and then da1s1e. > Orphaning sets provider's error and providers with the error set are not > retasted. This is from g_access(): > > else if (pp->acw != 0 && pp->acw == -dcw && pp->error == 0 && > !(pp->geom->flags & G_GEOM_WITHER)) > g_post_event(g_new_provider_event, pp, M_WAITOK, > pp, NULL); > > My question is: is disk_geom() really needed? Maybe there is some small > bug somewhere, but I think GEOM should handle all this without disk_gone(). > I suspect the issue is with CAM/SIM and the geom commit has just exposed the problem. I've been hitting hangs with device removal which appear very related to this: http://lists.freebsd.org/pipermail/freebsd-usb/2012-September/011489.html From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 12:36:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 60944106564A; Wed, 26 Sep 2012 12:36:10 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 41EC48FC08; Wed, 26 Sep 2012 12:36:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QCaAjv027046; Wed, 26 Sep 2012 12:36:10 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QCaAgQ027039; Wed, 26 Sep 2012 12:36:10 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201209261236.q8QCaAgQ027039@svn.freebsd.org> From: Martin Matuska Date: Wed, 26 Sep 2012 12:36:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240959 - in stable/9/cddl: lib/libzfs sbin/zfs sbin/zpool usr.bin/zinject usr.bin/ztest usr.sbin/zdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 12:36:10 -0000 Author: mm Date: Wed Sep 26 12:36:09 2012 New Revision: 240959 URL: http://svn.freebsd.org/changeset/base/240959 Log: MFC r226940 (rmh): Fix a few gratuitous library dependencies. Some of the ZFS utilities are linked with libraries they don't use: - zinject doesn't use libavl - ztest doesn't use libz - zdb uses neither libavl nor libz - zfs uses neither libbsdxml nor libm, nor libsbuf - zpool uses neither libbsdxml nor libm, nor libsbuf In addition, libzfs needs libm because it uses pow(), however it isn't linked with -lm. This went unnoticed because all its users had -lm before. Modified: stable/9/cddl/lib/libzfs/Makefile stable/9/cddl/sbin/zfs/Makefile stable/9/cddl/sbin/zpool/Makefile stable/9/cddl/usr.bin/zinject/Makefile stable/9/cddl/usr.bin/ztest/Makefile stable/9/cddl/usr.sbin/zdb/Makefile Directory Properties: stable/9/cddl/ (props changed) stable/9/cddl/lib/ (props changed) Modified: stable/9/cddl/lib/libzfs/Makefile ============================================================================== --- stable/9/cddl/lib/libzfs/Makefile Wed Sep 26 11:12:09 2012 (r240958) +++ stable/9/cddl/lib/libzfs/Makefile Wed Sep 26 12:36:09 2012 (r240959) @@ -6,8 +6,8 @@ .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common LIB= zfs -DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} -LDADD= -lmd -lpthread -lumem -lutil +DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM} +LDADD= -lmd -lpthread -lumem -lutil -lm SRCS= deviceid.c \ fsshare.c \ Modified: stable/9/cddl/sbin/zfs/Makefile ============================================================================== --- stable/9/cddl/sbin/zfs/Makefile Wed Sep 26 11:12:09 2012 (r240958) +++ stable/9/cddl/sbin/zfs/Makefile Wed Sep 26 12:36:09 2012 (r240959) @@ -21,8 +21,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs -DPADD= ${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} ${LIBUMEM} \ +DPADD= ${LIBGEOM} ${LIBNVPAIR} ${LIBUMEM} \ ${LIBUTIL} ${LIBUUTIL} ${LIBZFS} -LDADD= -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs +LDADD= -lgeom -lnvpair -lumem -lutil -luutil -lzfs .include Modified: stable/9/cddl/sbin/zpool/Makefile ============================================================================== --- stable/9/cddl/sbin/zpool/Makefile Wed Sep 26 11:12:09 2012 (r240958) +++ stable/9/cddl/sbin/zpool/Makefile Wed Sep 26 12:36:09 2012 (r240959) @@ -26,8 +26,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common -DPADD= ${LIBAVL} ${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} \ +DPADD= ${LIBAVL} ${LIBGEOM} ${LIBNVPAIR} \ ${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS} -LDADD= -lavl -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs +LDADD= -lavl -lgeom -lnvpair -lumem -lutil -luutil -lzfs .include Modified: stable/9/cddl/usr.bin/zinject/Makefile ============================================================================== --- stable/9/cddl/usr.bin/zinject/Makefile Wed Sep 26 11:12:09 2012 (r240958) +++ stable/9/cddl/usr.bin/zinject/Makefile Wed Sep 26 12:36:09 2012 (r240959) @@ -19,8 +19,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head CFLAGS+= -I${.CURDIR}/../../lib/libumem -DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \ +DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \ ${LIBZFS} ${LIBZPOOL} -LDADD= -lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool +LDADD= -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool .include Modified: stable/9/cddl/usr.bin/ztest/Makefile ============================================================================== --- stable/9/cddl/usr.bin/ztest/Makefile Wed Sep 26 11:12:09 2012 (r240958) +++ stable/9/cddl/usr.bin/ztest/Makefile Wed Sep 26 12:36:09 2012 (r240959) @@ -18,8 +18,8 @@ CFLAGS+= -I${.CURDIR}/../../contrib/open CFLAGS+= -I${.CURDIR}/../../lib/libumem DPADD= ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \ - ${LIBPTHREAD} ${LIBZ} ${LIBAVL} -LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lz -lavl + ${LIBPTHREAD} ${LIBAVL} +LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lavl CSTD= c99 Modified: stable/9/cddl/usr.sbin/zdb/Makefile ============================================================================== --- stable/9/cddl/usr.sbin/zdb/Makefile Wed Sep 26 11:12:09 2012 (r240958) +++ stable/9/cddl/usr.sbin/zdb/Makefile Wed Sep 26 12:36:09 2012 (r240959) @@ -23,9 +23,9 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head CFLAGS+= -I${.CURDIR}/../../lib/libumem -DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \ - ${LIBUUTIL} ${LIBZ} ${LIBZFS} ${LIBZPOOL} -LDADD= -lavl -lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool +DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \ + ${LIBUUTIL} ${LIBZFS} ${LIBZPOOL} +LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs -lzpool .include From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 12:36:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5ADC510656A9; Wed, 26 Sep 2012 12:36:23 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B8B08FC17; Wed, 26 Sep 2012 12:36:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QCaNho027114; Wed, 26 Sep 2012 12:36:23 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QCaM6w027107; Wed, 26 Sep 2012 12:36:22 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201209261236.q8QCaM6w027107@svn.freebsd.org> From: Martin Matuska Date: Wed, 26 Sep 2012 12:36:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240960 - in stable/8/cddl: lib/libzfs sbin/zfs sbin/zpool usr.bin/zinject usr.bin/ztest usr.sbin/zdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 12:36:23 -0000 Author: mm Date: Wed Sep 26 12:36:22 2012 New Revision: 240960 URL: http://svn.freebsd.org/changeset/base/240960 Log: MFC r226940 (rmh): Fix a few gratuitous library dependencies. Some of the ZFS utilities are linked with libraries they don't use: - zinject doesn't use libavl - ztest doesn't use libz - zdb uses neither libavl nor libz - zfs uses neither libbsdxml nor libm, nor libsbuf - zpool uses neither libbsdxml nor libm, nor libsbuf In addition, libzfs needs libm because it uses pow(), however it isn't linked with -lm. This went unnoticed because all its users had -lm before. Modified: stable/8/cddl/lib/libzfs/Makefile stable/8/cddl/sbin/zfs/Makefile stable/8/cddl/sbin/zpool/Makefile stable/8/cddl/usr.bin/zinject/Makefile stable/8/cddl/usr.bin/ztest/Makefile stable/8/cddl/usr.sbin/zdb/Makefile Directory Properties: stable/8/cddl/ (props changed) stable/8/cddl/lib/ (props changed) stable/8/cddl/sbin/ (props changed) stable/8/cddl/usr.bin/ (props changed) stable/8/cddl/usr.sbin/ (props changed) Modified: stable/8/cddl/lib/libzfs/Makefile ============================================================================== --- stable/8/cddl/lib/libzfs/Makefile Wed Sep 26 12:36:09 2012 (r240959) +++ stable/8/cddl/lib/libzfs/Makefile Wed Sep 26 12:36:22 2012 (r240960) @@ -6,8 +6,8 @@ .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common LIB= zfs -DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} -LDADD= -lmd -lpthread -lumem -lutil +DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM} +LDADD= -lmd -lpthread -lumem -lutil -lm SRCS= deviceid.c \ fsshare.c \ Modified: stable/8/cddl/sbin/zfs/Makefile ============================================================================== --- stable/8/cddl/sbin/zfs/Makefile Wed Sep 26 12:36:09 2012 (r240959) +++ stable/8/cddl/sbin/zfs/Makefile Wed Sep 26 12:36:22 2012 (r240960) @@ -20,8 +20,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs -DPADD= ${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} ${LIBUMEM} \ +DPADD= ${LIBGEOM} ${LIBNVPAIR} ${LIBUMEM} \ ${LIBUTIL} ${LIBUUTIL} ${LIBZFS} -LDADD= -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs +LDADD= -lgeom -lnvpair -lumem -lutil -luutil -lzfs .include Modified: stable/8/cddl/sbin/zpool/Makefile ============================================================================== --- stable/8/cddl/sbin/zpool/Makefile Wed Sep 26 12:36:09 2012 (r240959) +++ stable/8/cddl/sbin/zpool/Makefile Wed Sep 26 12:36:22 2012 (r240960) @@ -25,8 +25,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common -DPADD= ${LIBAVL} ${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} \ +DPADD= ${LIBAVL} ${LIBGEOM} ${LIBNVPAIR} \ ${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS} -LDADD= -lavl -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs +LDADD= -lavl -lgeom -lnvpair -lumem -lutil -luutil -lzfs .include Modified: stable/8/cddl/usr.bin/zinject/Makefile ============================================================================== --- stable/8/cddl/usr.bin/zinject/Makefile Wed Sep 26 12:36:09 2012 (r240959) +++ stable/8/cddl/usr.bin/zinject/Makefile Wed Sep 26 12:36:22 2012 (r240960) @@ -18,8 +18,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head CFLAGS+= -I${.CURDIR}/../../lib/libumem -DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \ +DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \ ${LIBZFS} ${LIBZPOOL} ${LIBUUTIL} -LDADD= -lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool +LDADD= -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool .include Modified: stable/8/cddl/usr.bin/ztest/Makefile ============================================================================== --- stable/8/cddl/usr.bin/ztest/Makefile Wed Sep 26 12:36:09 2012 (r240959) +++ stable/8/cddl/usr.bin/ztest/Makefile Wed Sep 26 12:36:22 2012 (r240960) @@ -17,8 +17,8 @@ CFLAGS+= -I${.CURDIR}/../../contrib/open CFLAGS+= -I${.CURDIR}/../../lib/libumem DPADD= ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \ - ${LIBPTHREAD} ${LIBZ} ${LIBAVL} -LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lz -lavl + ${LIBPTHREAD} ${LIBAVL} +LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lavl CSTD= c99 Modified: stable/8/cddl/usr.sbin/zdb/Makefile ============================================================================== --- stable/8/cddl/usr.sbin/zdb/Makefile Wed Sep 26 12:36:09 2012 (r240959) +++ stable/8/cddl/usr.sbin/zdb/Makefile Wed Sep 26 12:36:22 2012 (r240960) @@ -20,9 +20,9 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head CFLAGS+= -I${.CURDIR}/../../lib/libumem -DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \ - ${LIBUUTIL} ${LIBZ} ${LIBZFS} ${LIBZPOOL} -LDADD= -lavl -lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool +DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \ + ${LIBUUTIL} ${LIBZFS} ${LIBZPOOL} +LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs -lzpool CSTD= c99 From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 12:48:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 86FC8106564A; Wed, 26 Sep 2012 12:48:04 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182]) by mx1.freebsd.org (Postfix) with ESMTP id 31C028FC15; Wed, 26 Sep 2012 12:48:03 +0000 (UTC) Received: by ieak10 with SMTP id k10so1810050iea.13 for ; Wed, 26 Sep 2012 05:48:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=fuNKLbHXP1RkzJKttQJWvcaQAqg6RNzoXsej7xc+C7o=; b=P+ywHHWabipMqzUPMaOtcZvnHQ5nn+8GhHDaRfvNcdCN56IJAfh7KEOzftsk/zxeqd wWlLZ05cruUi/936SNjwJiOwgsDrRClJQn3GRNaq0EbGlKiL2lqE1Vq9mx+4ar4m1W+C OJUMRTRA09e3aB2i4bcLJI48ZK54J+BAxwKjSOi/4aQUtQ3Ewr+P6G6IbPQONmtCfNaI djQ5AwJ64XFnVJ+UUVdWVCPAkzpxPMlfdoHsI5pmqkgt8yKdNjt0C2L0OcdU0ZmRzYWT rzzjh3H5HuE5K4HJAbllhEn3D7tGNM/KhUYQWSc22dTcZG1OuW3gTf4cpQ75BU24FdY5 DdiA== MIME-Version: 1.0 Received: by 10.42.133.201 with SMTP id i9mr289614ict.29.1348663683434; Wed, 26 Sep 2012 05:48:03 -0700 (PDT) Sender: carpeddiem@gmail.com Received: by 10.50.57.163 with HTTP; Wed, 26 Sep 2012 05:48:03 -0700 (PDT) In-Reply-To: <20120926045204.GG35915@deviant.kiev.zoral.com.ua> References: <201209252210.q8PMAEx5003950@svn.freebsd.org> <20120926045204.GG35915@deviant.kiev.zoral.com.ua> Date: Wed, 26 Sep 2012 08:48:03 -0400 X-Google-Sender-Auth: zDJk65vTwPWKPfVztCg7yNu2AA8 Message-ID: From: Ed Maste To: Konstantin Belousov Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240938 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 12:48:04 -0000 On 26 September 2012 00:52, Konstantin Belousov wrote: > On Tue, Sep 25, 2012 at 10:10:14PM +0000, Ed Maste wrote: >> Author: emaste >> Date: Tue Sep 25 22:10:14 2012 >> New Revision: 240938 >> URL: http://svn.freebsd.org/changeset/base/240938 >> >> Log: >> Avoid INVARIANTS panic destroying an in-use tap(4) >> >> The requirement (implied by the KASSERT in tap_destroy) that the tap is >> closed isn't valid; destroy_dev will block in devdrn while other threads >> are in d_* functions. > Are you sure ? > > The device may be opened, but no threads could be in any cdevsw > methods. destroy_dev(9) only waits for threads to leave cdevsw methods, > and not for the close to happen. My first approach mirrored if_tun, but jhb@ pointed out on IRC that any open devices will revert to dead_devsw so that future accesses will fail. -Ed From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 13:52:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42162106566B; Wed, 26 Sep 2012 13:52:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 949FC8FC14; Wed, 26 Sep 2012 13:52:30 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q8QDqZGP099551; Wed, 26 Sep 2012 16:52:35 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q8QDqMTg096643; Wed, 26 Sep 2012 16:52:22 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q8QDqMri096642; Wed, 26 Sep 2012 16:52:22 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 26 Sep 2012 16:52:22 +0300 From: Konstantin Belousov To: Ed Maste Message-ID: <20120926135222.GK35915@deviant.kiev.zoral.com.ua> References: <201209252210.q8PMAEx5003950@svn.freebsd.org> <20120926045204.GG35915@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PEfPc/DjvCj+JzNg" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240938 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 13:52:31 -0000 --PEfPc/DjvCj+JzNg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 26, 2012 at 08:48:03AM -0400, Ed Maste wrote: > On 26 September 2012 00:52, Konstantin Belousov wro= te: > > On Tue, Sep 25, 2012 at 10:10:14PM +0000, Ed Maste wrote: > >> Author: emaste > >> Date: Tue Sep 25 22:10:14 2012 > >> New Revision: 240938 > >> URL: http://svn.freebsd.org/changeset/base/240938 > >> > >> Log: > >> Avoid INVARIANTS panic destroying an in-use tap(4) > >> > >> The requirement (implied by the KASSERT in tap_destroy) that the tap= is > >> closed isn't valid; destroy_dev will block in devdrn while other thr= eads > >> are in d_* functions. > > Are you sure ? > > > > The device may be opened, but no threads could be in any cdevsw > > methods. destroy_dev(9) only waits for threads to leave cdevsw methods, > > and not for the close to happen. >=20 > My first approach mirrored if_tun, but jhb@ pointed out on IRC that > any open devices will revert to dead_devsw so that future accesses > will fail. Yes, I do understand about the devfs part. My question is about the driver readiness for destruction while in the open state. --PEfPc/DjvCj+JzNg Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlBjCJYACgkQC3+MBN1Mb4h5fgCdFwXJRs7tmF6br2UZw7u0rE51 E7sAnjtdoFzpiwGKj/Wk+G3iMfE6viVm =I8By -----END PGP SIGNATURE----- --PEfPc/DjvCj+JzNg-- From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 13:53:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DEF71065678; Wed, 26 Sep 2012 13:53:30 +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 42C8C8FC1B; Wed, 26 Sep 2012 13:53:30 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 99A15B983; Wed, 26 Sep 2012 09:53:29 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Date: Wed, 26 Sep 2012 09:34:32 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p20; KDE/4.5.5; amd64; ; ) References: <201209260925.q8Q9PCSs099043@svn.freebsd.org> In-Reply-To: <201209260925.q8Q9PCSs099043@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201209260934.32271.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 26 Sep 2012 09:53:29 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240951 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 13:53:30 -0000 On Wednesday, September 26, 2012 5:25:12 am Konstantin Belousov wrote: > Author: kib > Date: Wed Sep 26 09:25:11 2012 > New Revision: 240951 > URL: http://svn.freebsd.org/changeset/base/240951 > > Log: > Make the updates of the tid ring buffer' head and tail pointers > explicit by moving them into separate statements from the buffer > element accesses. > > Requested by: jhb > MFC after: 3 days Thanks. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 13:53:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0164B10656A3; Wed, 26 Sep 2012 13:53:31 +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 A98018FC2D; Wed, 26 Sep 2012 13:53:30 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 06D24B9AD; Wed, 26 Sep 2012 09:53:30 -0400 (EDT) From: John Baldwin To: Ed Maste Date: Wed, 26 Sep 2012 09:38:21 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p20; KDE/4.5.5; amd64; ; ) References: <201209252210.q8PMAEx5003950@svn.freebsd.org> <20120926045204.GG35915@deviant.kiev.zoral.com.ua> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201209260938.21301.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 26 Sep 2012 09:53:30 -0400 (EDT) Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240938 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 13:53:31 -0000 On Wednesday, September 26, 2012 8:48:03 am Ed Maste wrote: > On 26 September 2012 00:52, Konstantin Belousov wrote: > > On Tue, Sep 25, 2012 at 10:10:14PM +0000, Ed Maste wrote: > >> Author: emaste > >> Date: Tue Sep 25 22:10:14 2012 > >> New Revision: 240938 > >> URL: http://svn.freebsd.org/changeset/base/240938 > >> > >> Log: > >> Avoid INVARIANTS panic destroying an in-use tap(4) > >> > >> The requirement (implied by the KASSERT in tap_destroy) that the tap is > >> closed isn't valid; destroy_dev will block in devdrn while other threads > >> are in d_* functions. > > Are you sure ? > > > > The device may be opened, but no threads could be in any cdevsw > > methods. destroy_dev(9) only waits for threads to leave cdevsw methods, > > and not for the close to happen. > > My first approach mirrored if_tun, but jhb@ pointed out on IRC that > any open devices will revert to dead_devsw so that future accesses > will fail. You do need to ensure that any resources in use by an open device are cleaned up, but I think devfs will do useful things such as destroy all the cdev_priv objects associated with a device after the "devdrn" sleep finishes, so that the cleanup generally happens "for free". -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 13:57:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F19D106566B; Wed, 26 Sep 2012 13:57:17 +0000 (UTC) (envelope-from zont@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67B7B8FC1F; Wed, 26 Sep 2012 13:57:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QDvHj5037669; Wed, 26 Sep 2012 13:57:17 GMT (envelope-from zont@svn.freebsd.org) Received: (from zont@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QDvHTL037667; Wed, 26 Sep 2012 13:57:17 GMT (envelope-from zont@svn.freebsd.org) Message-Id: <201209261357.q8QDvHTL037667@svn.freebsd.org> From: Andrey Zonov Date: Wed, 26 Sep 2012 13:57:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240961 - stable/9/sbin/fsck_ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 13:57:17 -0000 Author: zont Date: Wed Sep 26 13:57:16 2012 New Revision: 240961 URL: http://svn.freebsd.org/changeset/base/240961 Log: MFC r240463: - Fix a typo in debug message. Modified: stable/9/sbin/fsck_ffs/suj.c Directory Properties: stable/9/sbin/fsck_ffs/ (props changed) Modified: stable/9/sbin/fsck_ffs/suj.c ============================================================================== --- stable/9/sbin/fsck_ffs/suj.c Wed Sep 26 12:36:22 2012 (r240960) +++ stable/9/sbin/fsck_ffs/suj.c Wed Sep 26 13:57:16 2012 (r240961) @@ -882,7 +882,7 @@ ino_isat(ino_t parent, off_t diroff, ino printf("Directory %d has bad mode %o\n", parent, *mode); else - printf("Directory %d zero inode\n", parent); + printf("Directory %d has zero mode\n", parent); } return (0); } From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 14:14:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46618106564A; Wed, 26 Sep 2012 14:14:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 31C8C8FC0A; Wed, 26 Sep 2012 14:14:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QEE7Ma039637; Wed, 26 Sep 2012 14:14:07 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QEE7lF039635; Wed, 26 Sep 2012 14:14:07 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201209261414.q8QEE7lF039635@svn.freebsd.org> From: John Baldwin Date: Wed, 26 Sep 2012 14:14:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240962 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 14:14:07 -0000 Author: jhb Date: Wed Sep 26 14:14:06 2012 New Revision: 240962 URL: http://svn.freebsd.org/changeset/base/240962 Log: Grab the mfi_config_lock while performing a MFI_DCMD_CFG_FOREIGN_IMPORT request on behalf of a user utility. Submitted by: Steven Hartland killing multiplay co uk MFC after: 1 week Modified: head/sys/dev/mfi/mfi.c Modified: head/sys/dev/mfi/mfi.c ============================================================================== --- head/sys/dev/mfi/mfi.c Wed Sep 26 13:57:16 2012 (r240961) +++ head/sys/dev/mfi/mfi.c Wed Sep 26 14:14:06 2012 (r240962) @@ -2550,6 +2550,7 @@ mfi_config_lock(struct mfi_softc *sc, ui case MFI_DCMD_LD_DELETE: case MFI_DCMD_CFG_ADD: case MFI_DCMD_CFG_CLEAR: + case MFI_DCMD_CFG_FOREIGN_IMPORT: sx_xlock(&sc->mfi_config_lock); return (1); default: From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 14:17:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E48A9106566B; Wed, 26 Sep 2012 14:17:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEF758FC1F; Wed, 26 Sep 2012 14:17:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QEHEth040016; Wed, 26 Sep 2012 14:17:14 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QEHEha040011; Wed, 26 Sep 2012 14:17:14 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201209261417.q8QEHEha040011@svn.freebsd.org> From: John Baldwin Date: Wed, 26 Sep 2012 14:17:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240963 - head/sys/dev/mlx X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 14:17:15 -0000 Author: jhb Date: Wed Sep 26 14:17:14 2012 New Revision: 240963 URL: http://svn.freebsd.org/changeset/base/240963 Log: Remove FreeBSD 4.x compat shims. Verified by md5. Deleted: head/sys/dev/mlx/mlx_compat.h Modified: head/sys/dev/mlx/mlx.c head/sys/dev/mlx/mlx_disk.c head/sys/dev/mlx/mlx_pci.c head/sys/dev/mlx/mlxvar.h Modified: head/sys/dev/mlx/mlx.c ============================================================================== --- head/sys/dev/mlx/mlx.c Wed Sep 26 14:14:06 2012 (r240962) +++ head/sys/dev/mlx/mlx.c Wed Sep 26 14:17:14 2012 (r240963) @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -49,7 +50,6 @@ #include -#include #include #include #include @@ -307,7 +307,7 @@ mlx_attach(struct mlx_softc *sc) */ TAILQ_INIT(&sc->mlx_work); TAILQ_INIT(&sc->mlx_freecmds); - MLX_BIO_QINIT(sc->mlx_bioq); + bioq_init(&sc->mlx_bioq); /* * Select accessor methods based on controller interface type. @@ -731,13 +731,13 @@ mlx_intr(void *arg) * disk resource, then poke the disk resource to start as much work as it can. */ int -mlx_submit_buf(struct mlx_softc *sc, mlx_bio *bp) +mlx_submit_buf(struct mlx_softc *sc, struct bio *bp) { debug_called(1); MLX_IO_ASSERT_LOCKED(sc); - MLX_BIO_QINSERT(sc->mlx_bioq, bp); + bioq_insert_tail(&sc->mlx_bioq, bp); sc->mlx_waitbufs++; mlx_startio(sc); return(0); @@ -1838,7 +1838,7 @@ mlx_startio_cb(void *arg, bus_dma_segmen struct mlx_command *mc; struct mlxd_softc *mlxd; struct mlx_softc *sc; - mlx_bio *bp; + struct bio *bp; int blkcount; int driveno; int cmd; @@ -1849,7 +1849,7 @@ mlx_startio_cb(void *arg, bus_dma_segmen sc = mc->mc_sc; bp = mc->mc_private; - if (MLX_BIO_IS_READ(bp)) { + if (bp->bio_cmd == BIO_READ) { mc->mc_flags |= MLX_CMD_DATAIN; cmd = MLX_CMD_READSG; } else { @@ -1858,14 +1858,14 @@ mlx_startio_cb(void *arg, bus_dma_segmen } /* build a suitable I/O command (assumes 512-byte rounded transfers) */ - mlxd = (struct mlxd_softc *)MLX_BIO_SOFTC(bp); + mlxd = bp->bio_disk->d_drv1; driveno = mlxd->mlxd_drive - sc->mlx_sysdrive; - blkcount = (MLX_BIO_LENGTH(bp) + MLX_BLKSIZE - 1) / MLX_BLKSIZE; + blkcount = (bp->bio_bcount + MLX_BLKSIZE - 1) / MLX_BLKSIZE; - if ((MLX_BIO_LBA(bp) + blkcount) > sc->mlx_sysdrive[driveno].ms_size) + if ((bp->bio_pblkno + blkcount) > sc->mlx_sysdrive[driveno].ms_size) device_printf(sc->mlx_dev, "I/O beyond end of unit (%lld,%d > %lu)\n", - (long long)MLX_BIO_LBA(bp), blkcount, + (long long)bp->bio_pblkno, blkcount, (u_long)sc->mlx_sysdrive[driveno].ms_size); /* @@ -1876,7 +1876,7 @@ mlx_startio_cb(void *arg, bus_dma_segmen mlx_make_type1(mc, (cmd == MLX_CMD_WRITESG) ? MLX_CMD_WRITESG_OLD : MLX_CMD_READSG_OLD, blkcount & 0xff, /* xfer length low byte */ - MLX_BIO_LBA(bp), /* physical block number */ + bp->bio_pblkno, /* physical block number */ driveno, /* target drive number */ mc->mc_sgphys, /* location of SG list */ mc->mc_nsgent & 0x3f); /* size of SG list */ @@ -1885,7 +1885,7 @@ mlx_startio_cb(void *arg, bus_dma_segmen blkcount & 0xff, /* xfer length low byte */ (driveno << 3) | ((blkcount >> 8) & 0x07), /* target+length high 3 bits */ - MLX_BIO_LBA(bp), /* physical block number */ + bp->bio_pblkno, /* physical block number */ mc->mc_sgphys, /* location of SG list */ mc->mc_nsgent & 0x3f); /* size of SG list */ } @@ -1908,7 +1908,7 @@ static void mlx_startio(struct mlx_softc *sc) { struct mlx_command *mc; - mlx_bio *bp; + struct bio *bp; int error; MLX_IO_ASSERT_LOCKED(sc); @@ -1919,7 +1919,7 @@ mlx_startio(struct mlx_softc *sc) break; /* see if there's work to be done */ - if ((bp = MLX_BIO_QFIRST(sc->mlx_bioq)) == NULL) + if ((bp = bioq_first(&sc->mlx_bioq)) == NULL) break; /* get a command */ if ((mc = mlx_alloccmd(sc)) == NULL) @@ -1930,14 +1930,14 @@ mlx_startio(struct mlx_softc *sc) break; } /* get the buf containing our work */ - MLX_BIO_QREMOVE(sc->mlx_bioq, bp); + bioq_remove(&sc->mlx_bioq, bp); sc->mlx_waitbufs--; /* connect the buf to the command */ mc->mc_complete = mlx_completeio; mc->mc_private = bp; - mc->mc_data = MLX_BIO_DATA(bp); - mc->mc_length = MLX_BIO_LENGTH(bp); + mc->mc_data = bp->bio_data; + mc->mc_length = bp->bio_bcount; /* map the command so the controller can work with it */ error = bus_dmamap_load(sc->mlx_buffer_dmat, mc->mc_dmamap, mc->mc_data, @@ -1956,12 +1956,13 @@ static void mlx_completeio(struct mlx_command *mc) { struct mlx_softc *sc = mc->mc_sc; - mlx_bio *bp = (mlx_bio *)mc->mc_private; - struct mlxd_softc *mlxd = (struct mlxd_softc *)MLX_BIO_SOFTC(bp); + struct bio *bp = mc->mc_private; + struct mlxd_softc *mlxd = bp->bio_disk->d_drv1; MLX_IO_ASSERT_LOCKED(sc); if (mc->mc_status != MLX_STATUS_OK) { /* could be more verbose here? */ - MLX_BIO_SET_ERROR(bp, EIO); + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; switch(mc->mc_status) { case MLX_STATUS_RDWROFFLINE: /* system drive has gone offline */ @@ -1974,7 +1975,7 @@ mlx_completeio(struct mlx_command *mc) device_printf(sc->mlx_dev, "I/O error - %s\n", mlx_diagnose_command(mc)); #if 0 device_printf(sc->mlx_dev, " b_bcount %ld blkcount %ld b_pblkno %d\n", - MLX_BIO_LENGTH(bp), MLX_BIO_LENGTH(bp) / MLX_BLKSIZE, MLX_BIO_LBA(bp)); + bp->bio_bcount, bp->bio_bcount / MLX_BLKSIZE, bp->bio_pblkno); device_printf(sc->mlx_dev, " %13D\n", mc->mc_mailbox, " "); #endif break; Modified: head/sys/dev/mlx/mlx_disk.c ============================================================================== --- head/sys/dev/mlx/mlx_disk.c Wed Sep 26 14:14:06 2012 (r240962) +++ head/sys/dev/mlx/mlx_disk.c Wed Sep 26 14:17:14 2012 (r240963) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -48,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -142,15 +142,16 @@ mlxd_ioctl(struct disk *dp, u_long cmd, * be a multiple of a sector in length. */ static void -mlxd_strategy(mlx_bio *bp) +mlxd_strategy(struct bio *bp) { - struct mlxd_softc *sc = (struct mlxd_softc *)MLX_BIO_SOFTC(bp); + struct mlxd_softc *sc = bp->bio_disk->d_drv1; debug_called(1); /* bogus disk? */ if (sc == NULL) { - MLX_BIO_SET_ERROR(bp, EINVAL); + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } @@ -158,11 +159,11 @@ mlxd_strategy(mlx_bio *bp) MLX_IO_LOCK(sc->mlxd_controller); if (sc->mlxd_drive->ms_state == MLX_SYSD_OFFLINE) { MLX_IO_UNLOCK(sc->mlxd_controller); - MLX_BIO_SET_ERROR(bp, ENXIO); + bp->bio_error = ENXIO; + bp->bio_flags |= BIO_ERROR; goto bad; } - MLX_BIO_STATS_START(bp); mlx_submit_buf(sc->mlxd_controller, bp); MLX_IO_UNLOCK(sc->mlxd_controller); return; @@ -171,25 +172,23 @@ mlxd_strategy(mlx_bio *bp) /* * Correctly set the bio to indicate a failed tranfer. */ - MLX_BIO_RESID(bp) = MLX_BIO_LENGTH(bp); - MLX_BIO_DONE(bp); + bp->bio_resid = bp->bio_bcount; + biodone(bp); return; } void -mlxd_intr(void *data) +mlxd_intr(struct bio *bp) { - mlx_bio *bp = (mlx_bio *)data; debug_called(1); - if (MLX_BIO_HAS_ERROR(bp)) - MLX_BIO_SET_ERROR(bp, EIO); + if (bp->bio_flags & BIO_ERROR) + bp->bio_error = EIO; else - MLX_BIO_RESID(bp) = 0; + bp->bio_resid = 0; - MLX_BIO_STATS_END(bp); - MLX_BIO_DONE(bp); + biodone(bp); } static int Modified: head/sys/dev/mlx/mlx_pci.c ============================================================================== --- head/sys/dev/mlx/mlx_pci.c Wed Sep 26 14:14:06 2012 (r240962) +++ head/sys/dev/mlx/mlx_pci.c Wed Sep 26 14:17:14 2012 (r240963) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -47,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: head/sys/dev/mlx/mlxvar.h ============================================================================== --- head/sys/dev/mlx/mlxvar.h Wed Sep 26 14:14:06 2012 (r240962) +++ head/sys/dev/mlx/mlxvar.h Wed Sep 26 14:17:14 2012 (r240963) @@ -135,7 +135,7 @@ struct mlx_softc struct mlx_command *mlx_busycmd[MLX_NSLOTS]; /* busy commands */ int mlx_busycmds; /* count of busy commands */ struct mlx_sysdrive mlx_sysdrive[MLX_MAXDRIVES]; /* system drives */ - mlx_bioq mlx_bioq; /* outstanding I/O operations */ + struct bio_queue_head mlx_bioq; /* outstanding I/O operations */ int mlx_waitbufs; /* number of bufs awaiting commands */ /* controller status */ @@ -221,10 +221,10 @@ struct mlxd_softc /* * Interface between driver core and disk driver (should be using a bus?) */ -extern int mlx_submit_buf(struct mlx_softc *sc, mlx_bio *bp); +extern int mlx_submit_buf(struct mlx_softc *sc, struct bio *bp); extern int mlx_submit_ioctl(struct mlx_softc *sc, struct mlx_sysdrive *drive, u_long cmd, caddr_t addr, int32_t flag, struct thread *td); -extern void mlxd_intr(void *data); +extern void mlxd_intr(struct bio *bp); From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 14:29:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A325A106566B; Wed, 26 Sep 2012 14:29:15 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E4548FC08; Wed, 26 Sep 2012 14:29:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QETFlg041352; Wed, 26 Sep 2012 14:29:15 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QETFdU041350; Wed, 26 Sep 2012 14:29:15 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201209261429.q8QETFdU041350@svn.freebsd.org> From: Ken Smith Date: Wed, 26 Sep 2012 14:29:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240964 - releng/9.1/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 14:29:15 -0000 Author: kensmith Date: Wed Sep 26 14:29:15 2012 New Revision: 240964 URL: http://svn.freebsd.org/changeset/base/240964 Log: Ready for 9.1-RC2 builds. Approved by: re (implicit) Modified: releng/9.1/sys/conf/newvers.sh Modified: releng/9.1/sys/conf/newvers.sh ============================================================================== --- releng/9.1/sys/conf/newvers.sh Wed Sep 26 14:17:14 2012 (r240963) +++ releng/9.1/sys/conf/newvers.sh Wed Sep 26 14:29:15 2012 (r240964) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="9.1" -BRANCH="RC1" +BRANCH="RC2" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 16:46:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B8BC7106564A; Wed, 26 Sep 2012 16:46:44 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A39D28FC14; Wed, 26 Sep 2012 16:46:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QGki6J058872; Wed, 26 Sep 2012 16:46:44 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QGkiK2058868; Wed, 26 Sep 2012 16:46:44 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201209261646.q8QGkiK2058868@svn.freebsd.org> From: Jim Harris Date: Wed, 26 Sep 2012 16:46:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240965 - head/sys/dev/isci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 16:46:44 -0000 Author: jimharris Date: Wed Sep 26 16:46:44 2012 New Revision: 240965 URL: http://svn.freebsd.org/changeset/base/240965 Log: Create led(4) device nodes mapped to isci(4) SGPIO locate LEDs. Device nodes are in the format /dev/led/isci.busX.portY.locate. Sponsored by: Intel Requested by: Paul Maulberger MFC after: 1 week Modified: head/sys/dev/isci/isci.c head/sys/dev/isci/isci.h head/sys/dev/isci/isci_controller.c Modified: head/sys/dev/isci/isci.c ============================================================================== --- head/sys/dev/isci/isci.c Wed Sep 26 14:29:15 2012 (r240964) +++ head/sys/dev/isci/isci.c Wed Sep 26 16:46:44 2012 (r240965) @@ -38,11 +38,14 @@ __FBSDID("$FreeBSD$"); #include +#include + #include #include #include #include +#include #include #include @@ -180,7 +183,7 @@ static int isci_detach(device_t device) { struct isci_softc *isci = DEVICE2SOFTC(device); - int i; + int i, phy; for (i = 0; i < isci->controller_count; i++) { struct ISCI_CONTROLLER *controller = &isci->controllers[i]; @@ -220,6 +223,10 @@ isci_detach(device_t device) if (controller->remote_device_memory != NULL) free(controller->remote_device_memory, M_ISCI); + for (phy = 0; phy < SCI_MAX_PHYS; phy++) + if (controller->led[phy].cdev) + led_destroy(controller->led[phy].cdev); + while (1) { sci_pool_get(controller->unmap_buffer_pool, unmap_buffer); if (unmap_buffer == NULL) Modified: head/sys/dev/isci/isci.h ============================================================================== --- head/sys/dev/isci/isci.h Wed Sep 26 14:29:15 2012 (r240964) +++ head/sys/dev/isci/isci.h Wed Sep 26 16:46:44 2012 (r240965) @@ -143,6 +143,13 @@ struct ISCI_INTERRUPT_INFO }; +struct ISCI_LED +{ + struct cdev *cdev; + SCI_CONTROLLER_HANDLE_T handle; + int index; +}; + struct ISCI_CONTROLLER { struct isci_softc *isci; @@ -169,6 +176,7 @@ struct ISCI_CONTROLLER uint32_t queue_depth; uint32_t sim_queue_depth; SCI_FAST_LIST_T pending_device_reset_list; + struct ISCI_LED led[SCI_MAX_PHYS]; SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T mdl; Modified: head/sys/dev/isci/isci_controller.c ============================================================================== --- head/sys/dev/isci/isci_controller.c Wed Sep 26 14:29:15 2012 (r240964) +++ head/sys/dev/isci/isci_controller.c Wed Sep 26 16:46:44 2012 (r240965) @@ -49,6 +49,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include + +#include void isci_action(struct cam_sim *sim, union ccb *ccb); void isci_poll(struct cam_sim *sim); @@ -271,10 +274,19 @@ void isci_controller_construct(struct IS sci_pool_initialize(controller->unmap_buffer_pool); } +static void isci_led_func(void *priv, int onoff) +{ + struct ISCI_LED *led = priv; + + /* map onoff to the locate LED */ + scic_sgpio_update_led_state(led->handle, 1 << led->index, 0, onoff, 0); +} + SCI_STATUS isci_controller_initialize(struct ISCI_CONTROLLER *controller) { SCIC_USER_PARAMETERS_T scic_user_parameters; SCI_CONTROLLER_HANDLE_T scic_controller_handle; + char led_name[64]; unsigned long tunable; int i; @@ -355,6 +367,15 @@ SCI_STATUS isci_controller_initialize(st xpt_freeze_simq(controller->sim, 1); mtx_unlock(&controller->lock); + for (i = 0; i < SCI_MAX_PHYS; i++) { + controller->led[i].handle = scic_controller_handle; + controller->led[i].index = i; + sprintf(led_name, "isci.bus%d.port%d.locate", + controller->index, i); + controller->led[i].cdev = led_create(isci_led_func, + &controller->led[i], led_name); + } + return (scif_controller_initialize(controller->scif_controller_handle)); } From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 17:24:12 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9A202106574B; Wed, 26 Sep 2012 17:24:12 +0000 (UTC) (envelope-from jdp@polstra.com) Received: from rock.polstra.com (rock.polstra.com [64.119.0.113]) by mx1.freebsd.org (Postfix) with ESMTP id 7223D8FC12; Wed, 26 Sep 2012 17:24:12 +0000 (UTC) Received: from amps.polstra.com (adsl-207-32-175-29.rockisland.net [207.32.175.29]) (authenticated bits=0) by rock.polstra.com (8.14.5/8.14.5) with ESMTP id q8QGsI2q016423 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 26 Sep 2012 09:54:18 -0700 (PDT) (envelope-from jdp@polstra.com) Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: John Polstra In-Reply-To: <20120926072005.GH1391@garage.freebsd.pl> Date: Wed, 26 Sep 2012 09:54:18 -0700 Content-Transfer-Encoding: 7bit Message-Id: <0E55091C-5960-4961-BFDA-6484304FAB1D@polstra.com> References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> <20120926072005.GH1391@garage.freebsd.pl> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1085) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (rock.polstra.com [64.119.0.113]); Wed, 26 Sep 2012 09:54:19 -0700 (PDT) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, "Kenneth D. Merry" , phk@FreeBSD.org Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 17:24:12 -0000 On Sep 26, 2012, at 12:20 AM, Pawel Jakub Dawidek wrote: > We might be able to change the topology lock to LIST_FOREACH_SAFE(), as > g_wither_provider() can only destroy current provider. This is because > CAM own the geom and nobody should be able to mess with its provider's > list, apart from CAM itself. So I'd need to know how CAM ensures that > two disk_gone() cannot be called for one geom. The answer might be that > those geoms have always only one provider, but then I cannot explain why > we have loop there. Maybe jdp@ will remember why. No, I'm sorry but I don't remember. It's been a long time! John From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 17:25:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D1CE31065674; Wed, 26 Sep 2012 17:25:15 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A48238FC19; Wed, 26 Sep 2012 17:25:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QHPFA6064386; Wed, 26 Sep 2012 17:25:15 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QHPFWO064383; Wed, 26 Sep 2012 17:25:15 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201209261725.q8QHPFWO064383@svn.freebsd.org> From: Brooks Davis Date: Wed, 26 Sep 2012 17:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240966 - head/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 17:25:15 -0000 Author: brooks Date: Wed Sep 26 17:25:15 2012 New Revision: 240966 URL: http://svn.freebsd.org/changeset/base/240966 Log: Add a COMPILER_FEATURES variable that is set in bsd.compiler.mk. When the compiler is clang add c++11 to COMPILER_FEATURES. When the compiler supports c++11, default to building libc++. This will not impact the compliation of programs, but will make it easier for users with clang compiled systems to test libc++ by passing -stdlib=libc++ to their c++ compliations. Modified: head/share/mk/bsd.compiler.mk head/share/mk/bsd.own.mk Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Wed Sep 26 16:46:44 2012 (r240965) +++ head/share/mk/bsd.compiler.mk Wed Sep 26 17:25:15 2012 (r240966) @@ -19,3 +19,9 @@ COMPILER_TYPE:= clang . undef _COMPILER_VERSION . endif .endif + +.if ${COMPILER_TYPE} == "clang" +COMPILER_FEATURES= c++11 +.else +COMPILER_FEATURES= +.endif Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Wed Sep 26 16:46:44 2012 (r240965) +++ head/share/mk/bsd.own.mk Wed Sep 26 17:25:15 2012 (r240966) @@ -432,7 +432,6 @@ __DEFAULT_NO_OPTIONS = \ ICONV \ IDEA \ INSTALL_AS_USER \ - LIBCPLUSPLUS \ NAND \ OFED \ SHARED_TOOLCHAIN @@ -642,6 +641,33 @@ MK_${vv:H}:= ${MK_${vv:T}} .endif .endfor +# +# MK_* options that default to "yes" if the compiler is a C++11 compiler. +# +.include +.for var in \ + LIBCPLUSPLUS +.if defined(WITH_${var}) && defined(WITHOUT_${var}) +.error WITH_${var} and WITHOUT_${var} can't both be set. +.endif +.if defined(MK_${var}) +.error MK_${var} can't be set by a user. +.endif +.if ${COMPILER_FEATURES:Mc++11} +.if defined(WITHOUT_${var}) +MK_${var}:= no +.else +MK_${var}:= yes +.endif +.else +.if defined(WITH_${var}) +MK_${var}:= yes +.else +MK_${var}:= no +.endif +.endif +.endfor + .if ${MK_CTF} != "no" CTFCONVERT_CMD= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} .elif defined(MAKE_VERSION) && ${MAKE_VERSION} >= 5201111300 From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 17:29:23 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3CBB106566B; Wed, 26 Sep 2012 17:29:23 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id 87D9D8FC20; Wed, 26 Sep 2012 17:29:23 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id q8QHTHm4075844; Wed, 26 Sep 2012 11:29:17 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id q8QHTHEF075843; Wed, 26 Sep 2012 11:29:17 -0600 (MDT) (envelope-from ken) Date: Wed, 26 Sep 2012 11:29:17 -0600 From: "Kenneth D. Merry" To: Pawel Jakub Dawidek Message-ID: <20120926172917.GA71268@nargothrond.kdm.org> References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> <20120926072005.GH1391@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120926072005.GH1391@garage.freebsd.pl> User-Agent: Mutt/1.4.2i Cc: svn-src-head@FreeBSD.org, jdp@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, phk@FreeBSD.org Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 17:29:23 -0000 On Wed, Sep 26, 2012 at 09:20:06 +0200, Pawel Jakub Dawidek wrote: > On Tue, Sep 25, 2012 at 05:37:12PM -0600, Kenneth D. Merry wrote: > > On Sat, Sep 22, 2012 at 12:41:49 +0000, Pawel Jakub Dawidek wrote: > > > Log: > > > Use the topology lock to protect list of providers while withering them. > > > It is possible that provider is destroyed while we are iterating over the > > > list. > [...] > > > --- head/sys/geom/geom_disk.c Sat Sep 22 12:40:52 2012 (r240821) > > > +++ head/sys/geom/geom_disk.c Sat Sep 22 12:41:49 2012 (r240822) > > > @@ -635,10 +635,13 @@ disk_gone(struct disk *dp) > > > struct g_geom *gp; > > > struct g_provider *pp; > > > > > > + g_topology_lock(); > > > gp = dp->d_geom; > > > - if (gp != NULL) > > > + if (gp != NULL) { > > > LIST_FOREACH(pp, &gp->provider, provider) > > > g_wither_provider(pp, ENXIO); > > > + } > > > + g_topology_unlock(); > > > } > [...] > > This breaks devices going away in CAM. > > > > When the da(4) driver calls disk_gone(), it is necessarily holding the SIM > > lock, which is a regular MTX_DEF mutex. The GEOM topology lock is an sx > > lock, and of WITNESS blows up because of that: > [...] > > disk_gone() needs to be callable from an interrupt context. So it cannot > > acquire the topology lock. > > I can reword what you said above a bit: disk_gone() modifies GEOM > topology, so it has to hold the topology lock, thus it cannot be called > from an interrupt context. Okay, but either way we need some way to inform GEOM that the device has gone away. > We might be able to change the topology lock to LIST_FOREACH_SAFE(), as > g_wither_provider() can only destroy current provider. This is because > CAM own the geom and nobody should be able to mess with its provider's > list, apart from CAM itself. So I'd need to know how CAM ensures that > two disk_gone() cannot be called for one geom. The answer might be that > those geoms have always only one provider, but then I cannot explain why > we have loop there. Maybe jdp@ will remember why. Well, disk_gone() will only be called once for each da(4) instance that goes away. There is a check in cam_periph_invalidate() (sys/cam_cam_periph.c) that insures that the peripheral driver's invalidate routine only gets called once. I don't know whether there is more than one provider or not. It may be that LIST_FOREACH_SAFE() is sufficient. g_wither_provider() does set the G_PF_WITHER flag, and that wouldn't be protected by anything other than the CAM SIM lock in this case. > I also read original commit message and I don't fully understand. > > It was 7 years ago so I'll quote entire commit message: > > Fix a bug that caused some /dev entries to continue to exist after > the underlying drive had been hot-unplugged from the system. Here > is a specific example. Filesystem code had opened /dev/da1s1e. > Subsequently, the drive was hot-unplugged. This (correctly) caused > all of the associated /dev/da1* entries to be deleted. When the > filesystem later realized that the drive was gone it closed the > device, reducing the write-access counts to 0 on the geom providers > for da1s1e, da1s1, and da1. This caused geom to re-taste the > providers, resulting in the devices being created again. When the > drive was hot-plugged back in, it resulted in duplicate /dev entries > for da1s1e, da1s1, and da1. > > This fix adds a new disk_gone() function which is called by CAM when a > drive goes away. It orphans all of the providers associated with the > drive, setting an error condition of ENXIO in each one. In addition, > we prevent a re-taste on last close for writing if an error condition > has been set in the provider. > > If disk is gone it should orphan its provider. This should cause > orphaning depended providers, including da1s1 and then da1s1e. > Orphaning sets provider's error and providers with the error set are not > retasted. This is from g_access(): > > else if (pp->acw != 0 && pp->acw == -dcw && pp->error == 0 && > !(pp->geom->flags & G_GEOM_WITHER)) > g_post_event(g_new_provider_event, pp, M_WAITOK, > pp, NULL); > > My question is: is disk_geom() really needed? Maybe there is some small > bug somewhere, but I think GEOM should handle all this without disk_gone(). CAM needs a three step process when a device goes away. It is currently represented with disk_gone(), the d_gone() callback inside the disk class, and disk_destroy(). Here is what CAM needs at each step: 1. When a device goes away, we need a method to call from daoninvalidate() (or any other peripheral driver invalidate routine) with these properties: - It tells GEOM that the device has gone away, and starts the process of shutting down the device. (i.e. withers/orphans the provider) - It is callable from an interrupt context, with the SIM (MTX_DEF) lock held, so it can't sleep. 2. When GEOM has finished cleaning up the device (initiated in step 1), it should call the d_gone() method (dadiskgonecb() in the da(4) driver) to tell the CAM peripheral driver that the following is true: - All I/O to the device has been completed. - No more I/O will be sent to the device (e.g. via the strategy routine) - No more open/close requests will be sent to the device. (The final close should have been sent to the peripheral driver at this point.) CAM will release a reference on the device at that point, and in the typical case (where that is the last reference) go to step 3. 3. When CAM has finished cleaning up all of its state, it will tell GEOM that it is okay to finalize the destruction of the device. So it needs a method to call with these properties: - It is callable from an interrupt context, with the SIM (MTX_DEF) lock held. So it can't sleep. - When it is called, the da(4) driver is indicating that it no longer holds any references to that particular GEOM disk instance. So whether it is disk_gone() or something else, we do need a way to orphan the provider. Otherwise, how does GEOM know that the disk is gone? Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 18:04:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EC421065672; Wed, 26 Sep 2012 18:04:17 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5EEC08FC0C; Wed, 26 Sep 2012 18:04:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QI4Hot069206; Wed, 26 Sep 2012 18:04:17 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QI4H9P069204; Wed, 26 Sep 2012 18:04:17 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201209261804.q8QI4H9P069204@svn.freebsd.org> From: Glen Barber Date: Wed, 26 Sep 2012 18:04:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240967 - head/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 18:04:17 -0000 Author: gjb (doc,ports committer) Date: Wed Sep 26 18:04:16 2012 New Revision: 240967 URL: http://svn.freebsd.org/changeset/base/240967 Log: - Allow cross-architecture builds with 'generate-release.sh', which is set by specifying '-a '. (Only supported for i386 on amd64 and powerpc on powerpc64 currently). - Change how textproc/docproj is installed: o Attempt to install from pkg(8); o Fall back to pkg_add(1) if pkg(8) installation is not successful; o Fall back to installing from ports as last resort. - Ensure the script is run by root[1]. - Get OSVERSION from param.h[1]. Provided by: glebius [1] Reviewed by: nwhitehorn, kensmith Approved by: kensmith MFC After: 2 weeks X-Needs-MFC: r240586, r240587, r240588 Modified: head/release/generate-release.sh Modified: head/release/generate-release.sh ============================================================================== --- head/release/generate-release.sh Wed Sep 26 17:25:15 2012 (r240966) +++ head/release/generate-release.sh Wed Sep 26 18:04:16 2012 (r240967) @@ -17,17 +17,47 @@ # $FreeBSD$ # +unset B_ARCH +unset ARCH +unset MACHINE_ARCH + +HOST_ARCH=`uname -p` + usage() { - echo "Usage: $0 [-r revision] [-d docrevision] [-p portsrevision] svn-branch scratch-dir" + echo "Usage: $0 [-a arch] [-r revision] [-d docrevision] [-p portsrevision] svn-branch scratch-dir" + exit 1 +} + +arch_error () +{ + echo "Architecture ${OPTARG} cannot be built on host architecture ${HOST_ARCH}" exit 1 } REVISION= DOCREVISION= PORTSREVISION= -while getopts d:r:p: opt; do +while getopts a:d:r:p: opt; do case $opt in + a) + case "${OPTARG}" in + i386|amd64) + if [ "${HOST_ARCH}" != "amd64" ]; then + arch_error "${OPTARG}" + fi + ;; + powerpc|powerpc64) + if [ "${HOST_ARCH}" != "powerpc64" ]; then + arch_error "${OPTARG}" + fi + ;; + *) + arch_error "${OPTARG}" + ;; + esac + B_ARCH="$OPTARG" + ;; d) DOCREVISION="-r $OPTARG" ;; @@ -44,10 +74,21 @@ while getopts d:r:p: opt; do done shift $(($OPTIND - 1)) +# If target architecture is not specified, use hw.machine_arch +if [ "x${B_ARCH}" == "x" ]; then + B_ARCH="${HOST_ARCH}" +fi +ARCH_FLAGS="ARCH=${B_ARCH} TARGET_ARCH=${B_ARCH}" + if [ $# -lt 2 ]; then usage fi +if [ $(id -u) -ne 0 ]; then + echo "Needs to be run as root." + exit 1 +fi + set -e # Everything must succeed case $MAKE_FLAGS in @@ -65,23 +106,83 @@ svn co ${SVNROOT:-svn://svn.freebsd.org/ svn co ${SVNROOT:-svn://svn.freebsd.org/ports}/head $2/usr/ports $PORTSREVISION cd $2/usr/src -make $MAKE_FLAGS buildworld -make installworld distribution DESTDIR=$2 +make $MAKE_FLAGS ${ARCH_FLAGS} buildworld +make $ARCH_FLAGS installworld distribution DESTDIR=$2 mount -t devfs devfs $2/dev trap "umount $2/dev" EXIT # Clean up devfs mount on exit +# Most commands below are run in chroot, so fake getosreldate(3) right now +OSVERSION=$(grep '#define __FreeBSD_version' $2/usr/include/sys/param.h | awk '{print $3}') +export OSVERSION +BRANCH=$(grep '^BRANCH=' $2/usr/src/sys/conf/newvers.sh | awk -F\= '{print $2}') +BRANCH=`echo ${BRANCH} | sed -e 's,",,g'` +REVISION=$(grep '^REVISION=' $2/usr/src/sys/conf/newvers.sh | awk -F\= '{print $2}') +REVISION=`echo ${REVISION} | sed -e 's,",,g'` +OSRELEASE="${REVISION}-${BRANCH}" + +pkgng_install_docports () +{ + # Attempt to install docproj port from pkgng package. + chroot ${CHROOTDIR} /bin/sh -c 'env ASSUME_ALWAYS_YES=1 /usr/sbin/pkg install -y docproj-nojadetex' + # Check if docproj was installed, since pkg(8) returns '0' if unable + # to install a package from the repository. If it is not installed, + # fallback to installing using pkg_add(1). + chroot ${CHROOTDIR} /bin/sh -c '/usr/sbin/pkg info -q docproj-nojadetex' || \ + pkgadd_install_docports +} + +build_compat9_port () +{ + chroot ${CHROOTDIR} /bin/sh -c 'make -C /usr/ports/misc/compat9x BATCH=yes install clean' +} + +pkgadd_install_docports () +{ + # Attempt to install docproj package with pkg_add(1). + # If not successful, build the docproj port. + if [ "${REVISION}" == "10.0" ]; then + # Packages for 10-CURRENT are still located in the 9-CURRENT + # directory. Override environment to use correct package + # location if building for 10-CURRENT. + PACKAGESITE="ftp://ftp.freebsd.org/pub/FreeBSD/ports/${B_ARCH}/packages-9-current/Latest/" + export PACKAGESITE + PACKAGEROOT="ftp://ftp.freebsd.org/pub/FreeBSD/ports/${B_ARCH}/packages-9-current/" + export PACKAGEROOT + PKG_PATH="ftp://ftp.freebsd.org/pub/FreeBSD/ports/${B_ARCH}/packages-9-current/All/" + export PKG_PATH + build_compat9_port + fi + chroot ${CHROOTDIR} /bin/sh -c '/usr/sbin/pkg_add -r docproj-nojadetex' || \ + build_docports +} + +build_docports() +{ + # Could not install textproc/docproj from pkg(8) or pkg_add(1). Build + # the port as final fallback. + chroot ${CHROOTDIR} /bin/sh -c 'make -C /usr/ports/textproc/docproj BATCH=yes WITH_JADETEX=no WITHOUT_X11=yes WITHOUT_PYTHON=yes install clean' || \ + { echo "*** Could not build the textproj/docproj port. Exiting."; exit 2; } +} + if [ -d $2/usr/doc ]; then cp /etc/resolv.conf $2/etc/resolv.conf # Install docproj to build release documentation - chroot $2 /bin/sh -c '(export ASSUME_ALWAYS_YES=1 && /usr/sbin/pkg install -y docproj) || (cd /usr/ports/textproc/docproj && make install clean BATCH=yes WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes)' + CHROOTDIR="$2" + set +e + pkgng_install_docports "${CHROOTDIR}" + set -e fi -chroot $2 make -C /usr/src $MAKE_FLAGS buildworld buildkernel -chroot $2 make -C /usr/src/release release +chroot $2 make -C /usr/src $MAKE_FLAGS ${ARCH_FLAGS} buildworld buildkernel +chroot $2 make -C /usr/src/release ${ARCH_FLAGS} release chroot $2 make -C /usr/src/release install DESTDIR=/R -: ${RELSTRING=`chroot $2 uname -s`-`chroot $2 uname -r`-`chroot $2 uname -p`} +if [ "x${OSVERSION}" == "x" ]; then + OSRELEASE=`chroot $2 uname -r` +fi + +: ${RELSTRING=`chroot $2 uname -s`-${OSRELEASE}-${B_ARCH}} cd $2/R for i in release.iso bootonly.iso memstick; do From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 18:11:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84C36106566C; Wed, 26 Sep 2012 18:11:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 704A98FC0C; Wed, 26 Sep 2012 18:11:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QIBieS070158; Wed, 26 Sep 2012 18:11:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QIBiae070154; Wed, 26 Sep 2012 18:11:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201209261811.q8QIBiae070154@svn.freebsd.org> From: John Baldwin Date: Wed, 26 Sep 2012 18:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240968 - in head/sys/dev: e1000 ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 18:11:44 -0000 Author: jhb Date: Wed Sep 26 18:11:43 2012 New Revision: 240968 URL: http://svn.freebsd.org/changeset/base/240968 Log: Merge similar fixes from 223198 from igb to ixgbe: - Use a dedicated task to handle deferred transmits from the if_transmit method instead of reusing the existing per-queue interrupt task. Reusing the per-queue interrupt task could result in both an interrupt thread and the taskqueue thread trying to handle received packets on a single queue resulting in out-of-order packet processing and lock contention. - Don't define ixgbe_start() at all where if_transmit is used. Tested by: Vijay Singh Reviewed by: jfv MFC after: 2 weeks Modified: head/sys/dev/e1000/if_igb.h head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h Modified: head/sys/dev/e1000/if_igb.h ============================================================================== --- head/sys/dev/e1000/if_igb.h Wed Sep 26 18:04:16 2012 (r240967) +++ head/sys/dev/e1000/if_igb.h Wed Sep 26 18:11:43 2012 (r240968) @@ -299,9 +299,9 @@ struct tx_ring { struct igb_tx_buffer *tx_buffers; #if __FreeBSD_version >= 800000 struct buf_ring *br; + struct task txq_task; #endif bus_dma_tag_t txtag; - struct task txq_task; u32 bytes; u32 packets; Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Wed Sep 26 18:04:16 2012 (r240967) +++ head/sys/dev/ixgbe/ixgbe.c Wed Sep 26 18:11:43 2012 (r240968) @@ -104,13 +104,15 @@ static int ixgbe_probe(device_t); static int ixgbe_attach(device_t); static int ixgbe_detach(device_t); static int ixgbe_shutdown(device_t); -static void ixgbe_start(struct ifnet *); -static void ixgbe_start_locked(struct tx_ring *, struct ifnet *); #if __FreeBSD_version >= 800000 static int ixgbe_mq_start(struct ifnet *, struct mbuf *); static int ixgbe_mq_start_locked(struct ifnet *, struct tx_ring *, struct mbuf *); static void ixgbe_qflush(struct ifnet *); +static void ixgbe_deferred_mq_start(void *, int); +#else +static void ixgbe_start(struct ifnet *); +static void ixgbe_start_locked(struct tx_ring *, struct ifnet *); #endif static int ixgbe_ioctl(struct ifnet *, u_long, caddr_t); static void ixgbe_init(void *); @@ -631,6 +633,7 @@ ixgbe_detach(device_t dev) { struct adapter *adapter = device_get_softc(dev); struct ix_queue *que = adapter->queues; + struct tx_ring *txr = adapter->tx_rings; u32 ctrl_ext; INIT_DEBUGOUT("ixgbe_detach: begin"); @@ -645,8 +648,11 @@ ixgbe_detach(device_t dev) ixgbe_stop(adapter); IXGBE_CORE_UNLOCK(adapter); - for (int i = 0; i < adapter->num_queues; i++, que++) { + for (int i = 0; i < adapter->num_queues; i++, que++, txr++) { if (que->tq) { +#if __FreeBSD_version >= 800000 + taskqueue_drain(que->tq, &txr->txq_task); +#endif taskqueue_drain(que->tq, &que->que_task); taskqueue_free(que->tq); } @@ -708,6 +714,7 @@ ixgbe_shutdown(device_t dev) } +#if __FreeBSD_version < 800000 /********************************************************************* * Transmit entry point * @@ -779,7 +786,7 @@ ixgbe_start(struct ifnet *ifp) return; } -#if __FreeBSD_version >= 800000 +#else /* ** Multiqueue Transmit driver ** @@ -807,7 +814,7 @@ ixgbe_mq_start(struct ifnet *ifp, struct IXGBE_TX_UNLOCK(txr); } else { err = drbr_enqueue(ifp, txr->br, m); - taskqueue_enqueue(que->tq, &que->que_task); + taskqueue_enqueue(que->tq, &txr->txq_task); } return (err); @@ -873,6 +880,22 @@ ixgbe_mq_start_locked(struct ifnet *ifp, } /* + * Called from a taskqueue to drain queued transmit packets. + */ +static void +ixgbe_deferred_mq_start(void *arg, int pending) +{ + struct tx_ring *txr = arg; + struct adapter *adapter = txr->adapter; + struct ifnet *ifp = adapter->ifp; + + IXGBE_TX_LOCK(txr); + if (!drbr_empty(ifp, txr->br)) + ixgbe_mq_start_locked(ifp, txr, NULL); + IXGBE_TX_UNLOCK(txr); +} + +/* ** Flush all ring buffers */ static void @@ -2230,6 +2253,9 @@ ixgbe_allocate_legacy(struct adapter *ad { device_t dev = adapter->dev; struct ix_queue *que = adapter->queues; +#if __FreeBSD_version >= 800000 + struct tx_ring *txr = adapter->tx_rings; +#endif int error, rid = 0; /* MSI RID at 1 */ @@ -2249,6 +2275,9 @@ ixgbe_allocate_legacy(struct adapter *ad * Try allocating a fast interrupt and the associated deferred * processing contexts. */ +#if __FreeBSD_version >= 800000 + TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr); +#endif TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que); que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT, taskqueue_thread_enqueue, &que->tq); @@ -2295,9 +2324,10 @@ ixgbe_allocate_msix(struct adapter *adap { device_t dev = adapter->dev; struct ix_queue *que = adapter->queues; + struct tx_ring *txr = adapter->tx_rings; int error, rid, vector = 0; - for (int i = 0; i < adapter->num_queues; i++, vector++, que++) { + for (int i = 0; i < adapter->num_queues; i++, vector++, que++, txr++) { rid = vector + 1; que->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); @@ -2327,6 +2357,9 @@ ixgbe_allocate_msix(struct adapter *adap if (adapter->num_queues > 1) bus_bind_intr(dev, que->res, i); +#if __FreeBSD_version >= 800000 + TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr); +#endif TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que); que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT, taskqueue_thread_enqueue, &que->tq); @@ -2570,12 +2603,13 @@ ixgbe_setup_interface(device_t dev, stru ifp->if_softc = adapter; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = ixgbe_ioctl; - ifp->if_start = ixgbe_start; #if __FreeBSD_version >= 800000 ifp->if_transmit = ixgbe_mq_start; ifp->if_qflush = ixgbe_qflush; +#else + ifp->if_start = ixgbe_start; + IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 2); #endif - ifp->if_snd.ifq_maxlen = adapter->num_tx_desc - 2; ether_ifattach(ifp, adapter->hw.mac.addr); Modified: head/sys/dev/ixgbe/ixgbe.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe.h Wed Sep 26 18:04:16 2012 (r240967) +++ head/sys/dev/ixgbe/ixgbe.h Wed Sep 26 18:11:43 2012 (r240968) @@ -314,6 +314,7 @@ struct tx_ring { char mtx_name[16]; #if __FreeBSD_version >= 800000 struct buf_ring *br; + struct task txq_task; #endif #ifdef IXGBE_FDIR u16 atr_sample; From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 18:44:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 041B3106566B; Wed, 26 Sep 2012 18:44:09 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182]) by mx1.freebsd.org (Postfix) with ESMTP id 99AB38FC0C; Wed, 26 Sep 2012 18:44:08 +0000 (UTC) Received: by ieak10 with SMTP id k10so3215846iea.13 for ; Wed, 26 Sep 2012 11:44:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=aKBgSRe1YX9uis+Xz/kWN7F0i37bKITclxlvX4fh2bM=; b=kvenSlB4+J5zSI7IDaq7cNIPZHQJNCr7TmprvMk/1ZZDLrDPvptut8TlYB5abFAOHF pmUHLfQ25qGkdUbsYoliZ6TvI3WL4ieXvkcn3a026fXmCpKJe0tWvteC9TzCR3RuH0o7 e9gFr5oVsrchGcjrVzhYaRkojUttT1F/X8ooeH1Z804699tWIKxyUSEw7g1xf+Y+euvw 2ewo0niL+nGjoMGWySA5uuIu22frL2o5MXbNR6IsTblTTD7kvzQXYZ2EyCeSIY7oO+Pr 8QAwsc+EhRweSUSSulACufDNlEkNXP56u8AduNEtqwhi/z42ldns9wdlL5B05gr1GlGE hygQ== MIME-Version: 1.0 Received: by 10.50.183.200 with SMTP id eo8mr12157568igc.54.1348685047863; Wed, 26 Sep 2012 11:44:07 -0700 (PDT) Received: by 10.64.51.39 with HTTP; Wed, 26 Sep 2012 11:44:07 -0700 (PDT) In-Reply-To: <201209261804.q8QI4H9P069204@svn.freebsd.org> References: <201209261804.q8QI4H9P069204@svn.freebsd.org> Date: Wed, 26 Sep 2012 11:44:07 -0700 Message-ID: From: Garrett Cooper To: Glen Barber Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240967 - head/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 18:44:09 -0000 On Wed, Sep 26, 2012 at 11:04 AM, Glen Barber wrote: > Author: gjb (doc,ports committer) > Date: Wed Sep 26 18:04:16 2012 > New Revision: 240967 > URL: http://svn.freebsd.org/changeset/base/240967 > > Log: > - Allow cross-architecture builds with 'generate-release.sh', which > is set by specifying '-a '. (Only supported for i386 on amd64 > and powerpc on powerpc64 currently). > - Change how textproc/docproj is installed: > o Attempt to install from pkg(8); > o Fall back to pkg_add(1) if pkg(8) installation is not > successful; > o Fall back to installing from ports as last resort. > - Ensure the script is run by root[1]. > - Get OSVERSION from param.h[1]. More magic is required to fake a target system; see: http://freenas.svn.sourceforge.net/viewvc/freenas?view=revision&revision=8193 (and the corresponding post made by ambrisko@). More magic was required to deal with $PATH, etc... but you should be able to grok all you need from that function (it hasn't been modified too much since I left iX). ... > +# If target architecture is not specified, use hw.machine_arch > +if [ "x${B_ARCH}" == "x" ]; then See comment about == vs = below. ... > -: ${RELSTRING=`chroot $2 uname -s`-`chroot $2 uname -r`-`chroot $2 uname -p`} > +if [ "x${OSVERSION}" == "x" ]; then This should be `=` in order to be backwards compatible with older (pre-9.1) copies of /bin/sh > + OSRELEASE=`chroot $2 uname -r` > +fi > + > +: ${RELSTRING=`chroot $2 uname -s`-${OSRELEASE}-${B_ARCH}} Thanks! -Garrett From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 18:46:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E5B5C106566B; Wed, 26 Sep 2012 18:46:45 +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 BC1468FC18; Wed, 26 Sep 2012 18:46:45 +0000 (UTC) Received: from glenbarber.us (75-146-225-65-Philadelphia.hfc.comcastbusiness.net [75.146.225.65]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: gjb) by onyx.glenbarber.us (Postfix) with ESMTPSA id 092CE23F6D9; Wed, 26 Sep 2012 14:46:44 -0400 (EDT) Date: Wed, 26 Sep 2012 14:46:43 -0400 From: Glen Barber To: Garrett Cooper Message-ID: <20120926184643.GD1309@glenbarber.us> References: <201209261804.q8QI4H9P069204@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ADZbWkCsHQ7r3kzd" Content-Disposition: inline In-Reply-To: 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 Subject: Re: svn commit: r240967 - head/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 18:46:46 -0000 --ADZbWkCsHQ7r3kzd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 26, 2012 at 11:44:07AM -0700, Garrett Cooper wrote: > > -: ${RELSTRING=3D`chroot $2 uname -s`-`chroot $2 uname -r`-`chroot $2 u= name -p`} > > +if [ "x${OSVERSION}" =3D=3D "x" ]; then >=20 > This should be `=3D` in order to be backwards compatible with older > (pre-9.1) copies of /bin/sh >=20 This won't be going into pre-9.1 versions of FreeBSD. Glen --ADZbWkCsHQ7r3kzd Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBCAAGBQJQY02TAAoJEFJPDDeguUaj5loIALHR9UNmyCibjvVeWQVxc9jy dyX2I4t7HBZdKIU/VrWuhTPDEqQSb3hyjPoT5eFgwS8D3SaaEowK2s5a+PuXjUya 9p0PCToWR6HFNi+r1pFkCOhT4Iq+Uvv8/wmy09tHb6UU0HZQSt/w7szQr+lKfk2d MacRIr+QznaI1gW8D+2wQQbjplu5smbJVZbGSQQHemMlRhTjRPWkesl3AL/rL0tS /qxYZsf0VLTudSKJmkoy2QhS+BCTjsbffm2SZ9uqtiv8rgJQvJVE04bBCs48RwYo eA2TTTVWu1VeD/w1locQNmuAxtee7lyOQrjFZKyhsw/W5KeCBc8ts+GCPy74BHc= =Fl4M -----END PGP SIGNATURE----- --ADZbWkCsHQ7r3kzd-- From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 18:53:20 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7F1E1065678; Wed, 26 Sep 2012 18:53:20 +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 17AE78FC0C; Wed, 26 Sep 2012 18:53:19 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 8C085A26; Wed, 26 Sep 2012 20:52:13 +0200 (CEST) Date: Wed, 26 Sep 2012 20:53:39 +0200 From: Pawel Jakub Dawidek To: "Kenneth D. Merry" Message-ID: <20120926185339.GA1402@garage.freebsd.pl> References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> <20120926072005.GH1391@garage.freebsd.pl> <20120926172917.GA71268@nargothrond.kdm.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline In-Reply-To: <20120926172917.GA71268@nargothrond.kdm.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, jdp@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, phk@FreeBSD.org Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 18:53:20 -0000 --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 26, 2012 at 11:29:17AM -0600, Kenneth D. Merry wrote: > On Wed, Sep 26, 2012 at 09:20:06 +0200, Pawel Jakub Dawidek wrote: > > On Tue, Sep 25, 2012 at 05:37:12PM -0600, Kenneth D. Merry wrote: > > > On Sat, Sep 22, 2012 at 12:41:49 +0000, Pawel Jakub Dawidek wrote: > > > > Log: > > > > Use the topology lock to protect list of providers while witherin= g them. > > > > It is possible that provider is destroyed while we are iterating = over the > > > > list. > > [...] > > > > --- head/sys/geom/geom_disk.c Sat Sep 22 12:40:52 2012 (r240821) > > > > +++ head/sys/geom/geom_disk.c Sat Sep 22 12:41:49 2012 (r240822) > > > > @@ -635,10 +635,13 @@ disk_gone(struct disk *dp) > > > > struct g_geom *gp; > > > > struct g_provider *pp; > > > > =20 > > > > + g_topology_lock(); > > > > gp =3D dp->d_geom; > > > > - if (gp !=3D NULL) > > > > + if (gp !=3D NULL) { > > > > LIST_FOREACH(pp, &gp->provider, provider) > > > > g_wither_provider(pp, ENXIO); > > > > + } > > > > + g_topology_unlock(); > > > > } > > [...] > > > This breaks devices going away in CAM. > > >=20 > > > When the da(4) driver calls disk_gone(), it is necessarily holding th= e SIM > > > lock, which is a regular MTX_DEF mutex. The GEOM topology lock is an= sx > > > lock, and of WITNESS blows up because of that: > > [...] > > > disk_gone() needs to be callable from an interrupt context. So it ca= nnot > > > acquire the topology lock. > >=20 > > I can reword what you said above a bit: disk_gone() modifies GEOM > > topology, so it has to hold the topology lock, thus it cannot be called > > from an interrupt context. >=20 > Okay, but either way we need some way to inform GEOM that the device has > gone away. >=20 > > We might be able to change the topology lock to LIST_FOREACH_SAFE(), as > > g_wither_provider() can only destroy current provider. This is because > > CAM own the geom and nobody should be able to mess with its provider's > > list, apart from CAM itself. So I'd need to know how CAM ensures that > > two disk_gone() cannot be called for one geom. The answer might be that > > those geoms have always only one provider, but then I cannot explain why > > we have loop there. Maybe jdp@ will remember why. >=20 > Well, disk_gone() will only be called once for each da(4) instance that > goes away. There is a check in cam_periph_invalidate() > (sys/cam_cam_periph.c) that insures that the peripheral driver's > invalidate routine only gets called once. >=20 > I don't know whether there is more than one provider or not. It may be > that LIST_FOREACH_SAFE() is sufficient. g_wither_provider() does set the > G_PF_WITHER flag, and that wouldn't be protected by anything other than t= he > CAM SIM lock in this case. >=20 > > I also read original commit message and I don't fully understand. > >=20 > > It was 7 years ago so I'll quote entire commit message: > >=20 > > Fix a bug that caused some /dev entries to continue to exist after > > the underlying drive had been hot-unplugged from the system. Here > > is a specific example. Filesystem code had opened /dev/da1s1e. > > Subsequently, the drive was hot-unplugged. This (correctly) caused > > all of the associated /dev/da1* entries to be deleted. When the > > filesystem later realized that the drive was gone it closed the > > device, reducing the write-access counts to 0 on the geom providers > > for da1s1e, da1s1, and da1. This caused geom to re-taste the > > providers, resulting in the devices being created again. When the > > drive was hot-plugged back in, it resulted in duplicate /dev entries > > for da1s1e, da1s1, and da1. > >=20 > > This fix adds a new disk_gone() function which is called by CAM when a > > drive goes away. It orphans all of the providers associated with the > > drive, setting an error condition of ENXIO in each one. In addition, > > we prevent a re-taste on last close for writing if an error condition > > has been set in the provider. > >=20 > > If disk is gone it should orphan its provider. This should cause > > orphaning depended providers, including da1s1 and then da1s1e. > > Orphaning sets provider's error and providers with the error set are not > > retasted. This is from g_access(): > >=20 > > else if (pp->acw !=3D 0 && pp->acw =3D=3D -dcw && pp->error =3D=3D 0 = && > > !(pp->geom->flags & G_GEOM_WITHER)) > > g_post_event(g_new_provider_event, pp, M_WAITOK, > > pp, NULL); > >=20 > > My question is: is disk_geom() really needed? Maybe there is some small > > bug somewhere, but I think GEOM should handle all this without disk_gon= e(). >=20 > CAM needs a three step process when a device goes away. It is currently > represented with disk_gone(), the d_gone() callback inside the disk class, > and disk_destroy(). >=20 > Here is what CAM needs at each step: >=20 > 1. When a device goes away, we need a method to call from daoninvalidate= () > (or any other peripheral driver invalidate routine) with these > properties: > - It tells GEOM that the device has gone away, and starts the process > of shutting down the device. (i.e. withers/orphans the provider) > - It is callable from an interrupt context, with the SIM (MTX_DEF) lo= ck > held, so it can't sleep. Neither g_wither_provider() nor g_orphan_provider() require the topology lock. They only acquire the event lock, but it is regular mutex, so this is fine. Traversing geom's providers list looks like something that does need the topology lock, but maybe traversing is not needed at all. The reason for this change was a panic in iSCSI initiator where disk_gone() was called and provider was destroyed before g_wither_geom() returned. > 2. When GEOM has finished cleaning up the device (initiated in step 1), > it should call the d_gone() method (dadiskgonecb() in the da(4) > driver) to tell the CAM peripheral driver that the following is true: > - All I/O to the device has been completed. > - No more I/O will be sent to the device (e.g. via the strategy routi= ne) > - No more open/close requests will be sent to the device. (The final > close should have been sent to the peripheral driver at this point.) >=20 > CAM will release a reference on the device at that point, and in the > typical case (where that is the last reference) go to step 3. >=20 > 3. When CAM has finished cleaning up all of its state, it will tell GEOM > that it is okay to finalize the destruction of the device. So it nee= ds > a method to call with these properties: >=20 > - It is callable from an interrupt context, with the SIM (MTX_DEF) lo= ck > held. So it can't sleep. > - When it is called, the da(4) driver is indicating that it no longer > holds any references to that particular GEOM disk instance. >=20 > So whether it is disk_gone() or something else, we do need a way to orphan > the provider. Otherwise, how does GEOM know that the disk is gone? So maybe disk_destroy() should first orphan provider, which in turn will set its error. If provider's error is set, all I/O requests will be denied by GEOM by returning provider's error, so strategy method within a driver won't be called. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --PEIAKu/WMn1b1Hv9 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlBjTzMACgkQForvXbEpPzQ/rgCeL+BtP4vEpYJVOPDm4wBv+x79 lugAniapLHRZM7sK30CpeMv9kq2Q9YfZ =0CZs -----END PGP SIGNATURE----- --PEIAKu/WMn1b1Hv9-- From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 18:59:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 45127106566B; Wed, 26 Sep 2012 18:59:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16B778FC16; Wed, 26 Sep 2012 18:59:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QIxK3V076680; Wed, 26 Sep 2012 18:59:20 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QIxKRq076677; Wed, 26 Sep 2012 18:59:20 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201209261859.q8QIxKRq076677@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 26 Sep 2012 18:59:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240969 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 18:59:21 -0000 Author: hselasky Date: Wed Sep 26 18:59:20 2012 New Revision: 240969 URL: http://svn.freebsd.org/changeset/base/240969 Log: Make sure the DWC OTG host mode channels are given enough time to disable. Modified: head/sys/dev/usb/controller/dwc_otg.c head/sys/dev/usb/controller/dwc_otg.h Modified: head/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.c Wed Sep 26 18:11:43 2012 (r240968) +++ head/sys/dev/usb/controller/dwc_otg.c Wed Sep 26 18:59:20 2012 (r240969) @@ -507,6 +507,7 @@ static uint8_t dwc_otg_host_channel_wait(struct dwc_otg_td *td) { struct dwc_otg_softc *sc; + uint16_t frame; uint8_t x; x = td->channel; @@ -524,6 +525,8 @@ dwc_otg_host_channel_wait(struct dwc_otg if (x == 0) return (0); /* wait */ + frame = DWC_OTG_READ_4(sc, DOTG_HFNUM) & HFNUM_FRNUM_MASK; + /* find new disabled channel */ for (x = 1; x != sc->sc_host_ch_max; x++) { @@ -539,6 +542,9 @@ dwc_otg_host_channel_wait(struct dwc_otg continue; } + if (sc->sc_chan_state[x].last_frame == frame) + continue; + sc->sc_chan_state[td->channel].allocated = 0; sc->sc_chan_state[x].allocated = 1; @@ -577,6 +583,7 @@ static uint8_t dwc_otg_host_channel_alloc(struct dwc_otg_td *td) { struct dwc_otg_softc *sc; + uint16_t frame; uint8_t x; uint8_t max_channel; @@ -594,6 +601,8 @@ dwc_otg_host_channel_alloc(struct dwc_ot x = 1; } + frame = DWC_OTG_READ_4(sc, DOTG_HFNUM) & HFNUM_FRNUM_MASK; + for (; x != max_channel; x++) { uint32_t hcchar; @@ -608,6 +617,9 @@ dwc_otg_host_channel_alloc(struct dwc_ot continue; } + if (sc->sc_chan_state[x].last_frame == frame) + continue; + sc->sc_chan_state[x].allocated = 1; /* clear interrupts */ @@ -633,8 +645,12 @@ dwc_otg_host_channel_disable(struct dwc_ { uint32_t hcchar; hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(x)); - if (hcchar & (HCCHAR_CHENA | HCCHAR_CHDIS)) + if (hcchar & (HCCHAR_CHENA | HCCHAR_CHDIS)) { + /* don't re-use channel until next SOF is transmitted */ + sc->sc_chan_state[x].last_frame = + DWC_OTG_READ_4(sc, DOTG_HFNUM) & HFNUM_FRNUM_MASK; DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(x), HCCHAR_CHENA | HCCHAR_CHDIS); + } } static void Modified: head/sys/dev/usb/controller/dwc_otg.h ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.h Wed Sep 26 18:11:43 2012 (r240968) +++ head/sys/dev/usb/controller/dwc_otg.h Wed Sep 26 18:59:20 2012 (r240969) @@ -140,6 +140,7 @@ struct dwc_otg_profile { struct dwc_otg_chan_state { uint32_t hcint; + uint16_t last_frame; uint8_t allocated; uint8_t suspended; }; From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 19:04:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 1707A1065670; Wed, 26 Sep 2012 19:04:52 +0000 (UTC) Date: Wed, 26 Sep 2012 19:04:52 +0000 From: Alexey Dokuchaev To: Glen Barber Message-ID: <20120926190451.GA92155@FreeBSD.org> References: <201209261804.q8QI4H9P069204@svn.freebsd.org> <20120926184643.GD1309@glenbarber.us> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20120926184643.GD1309@glenbarber.us> User-Agent: Mutt/1.4.2.1i Cc: Garrett Cooper , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240967 - head/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 19:04:52 -0000 On Wed, Sep 26, 2012 at 02:46:43PM -0400, Glen Barber wrote: > On Wed, Sep 26, 2012 at 11:44:07AM -0700, Garrett Cooper wrote: > > > -: ${RELSTRING=`chroot $2 uname -s`-`chroot $2 uname -r`-`chroot $2 uname -p`} > > > +if [ "x${OSVERSION}" == "x" ]; then > > > > This should be `=` in order to be backwards compatible with older > > (pre-9.1) copies of /bin/sh > > This won't be going into pre-9.1 versions of FreeBSD. Still, there is no need to spread this bogus syntax which we had erroneously adoped. ./danfe From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 19:06:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52FBA106564A; Wed, 26 Sep 2012 19:06:36 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 0CCA78FC0C; Wed, 26 Sep 2012 19:06:35 +0000 (UTC) Received: by pbbrp8 with SMTP id rp8so2813313pbb.13 for ; Wed, 26 Sep 2012 12:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:in-reply-to:mime-version:content-transfer-encoding :content-type:message-id:cc:x-mailer:from:subject:date:to; bh=WJBn2BkSB/sqrXD3Ye476nsnwQpOT7rSAWY/lVB3IdY=; b=UZ/lxP/MQy/u1tkuqasqeAnl4z3cUH+Vi0gVVvR/1qXvPeGphLMWytOXwBv7+l5Ocr b6LDTKzG+LsvH3JWY8/rQawSOAdQ29Aqw0j5QjVkQ4zr3hZEgZVHQwYqBMdKV17ooEXH kgWFRcIUfE99dHTIH8rL4LovdsAY5SWhmnbfzgsGA97C48KEMQjT4RaPBL21K9wZhnR6 tLgygu9RrereIInii/GT7La8vkaoIhcIYfpRd6Q1RRMCo7cHInLa9kUPy6F4jIJhhtjE 90TW6R7gS1aqoPLR7DHVNadJibUQm5T0JlD/RyvjN2Fz4g4E3Box3NqF6gLviZbikxXM KLJA== Received: by 10.68.239.5 with SMTP id vo5mr5082611pbc.102.1348686395642; Wed, 26 Sep 2012 12:06:35 -0700 (PDT) Received: from [10.74.194.115] (mobile-166-147-094-118.mycingular.net. [166.147.94.118]) by mx.google.com with ESMTPS id st6sm2467935pbc.58.2012.09.26.12.06.32 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 26 Sep 2012 12:06:34 -0700 (PDT) References: <201209261804.q8QI4H9P069204@svn.freebsd.org> <20120926184643.GD1309@glenbarber.us> In-Reply-To: <20120926184643.GD1309@glenbarber.us> Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: X-Mailer: iPhone Mail (9B206) From: Garrett Cooper Date: Wed, 26 Sep 2012 12:06:27 -0700 To: Glen Barber Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r240967 - head/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 19:06:36 -0000 On Sep 26, 2012, at 11:46 AM, Glen Barber wrote: > On Wed, Sep 26, 2012 at 11:44:07AM -0700, Garrett Cooper wrote: >>> -: ${RELSTRING=3D`chroot $2 uname -s`-`chroot $2 uname -r`-`chroot $2 un= ame -p`} >>> +if [ "x${OSVERSION}" =3D=3D "x" ]; then >>=20 >> This should be `=3D` in order to be backwards compatible with older >> (pre-9.1) copies of /bin/sh >>=20 >=20 > This won't be going into pre-9.1 versions of FreeBSD. Perhaps, but there's nothing preventing me from building on 9.0. 8.x might a= lso work, but that'd be purely based on the fact that userland abis didn't c= hange all that much between 8 and 9. Thanks! -Garrett= From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 19:21:18 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F815106564A; Wed, 26 Sep 2012 19:21:18 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id 2F3098FC0C; Wed, 26 Sep 2012 19:21:17 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id q8QJLHN2092505; Wed, 26 Sep 2012 13:21:17 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id q8QJLH1g092504; Wed, 26 Sep 2012 13:21:17 -0600 (MDT) (envelope-from ken) Date: Wed, 26 Sep 2012 13:21:17 -0600 From: "Kenneth D. Merry" To: Pawel Jakub Dawidek Message-ID: <20120926192117.GA89741@nargothrond.kdm.org> References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> <20120926072005.GH1391@garage.freebsd.pl> <20120926172917.GA71268@nargothrond.kdm.org> <20120926185339.GA1402@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120926185339.GA1402@garage.freebsd.pl> User-Agent: Mutt/1.4.2i Cc: svn-src-head@FreeBSD.org, jdp@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, phk@FreeBSD.org Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 19:21:18 -0000 On Wed, Sep 26, 2012 at 20:53:39 +0200, Pawel Jakub Dawidek wrote: > On Wed, Sep 26, 2012 at 11:29:17AM -0600, Kenneth D. Merry wrote: > > On Wed, Sep 26, 2012 at 09:20:06 +0200, Pawel Jakub Dawidek wrote: > > > On Tue, Sep 25, 2012 at 05:37:12PM -0600, Kenneth D. Merry wrote: > > > > On Sat, Sep 22, 2012 at 12:41:49 +0000, Pawel Jakub Dawidek wrote: > > > > > Log: > > > > > Use the topology lock to protect list of providers while withering them. > > > > > It is possible that provider is destroyed while we are iterating over the > > > > > list. > > > [...] > > > > > --- head/sys/geom/geom_disk.c Sat Sep 22 12:40:52 2012 (r240821) > > > > > +++ head/sys/geom/geom_disk.c Sat Sep 22 12:41:49 2012 (r240822) > > > > > @@ -635,10 +635,13 @@ disk_gone(struct disk *dp) > > > > > struct g_geom *gp; > > > > > struct g_provider *pp; > > > > > > > > > > + g_topology_lock(); > > > > > gp = dp->d_geom; > > > > > - if (gp != NULL) > > > > > + if (gp != NULL) { > > > > > LIST_FOREACH(pp, &gp->provider, provider) > > > > > g_wither_provider(pp, ENXIO); > > > > > + } > > > > > + g_topology_unlock(); > > > > > } > > > [...] > > > > This breaks devices going away in CAM. > > > > > > > > When the da(4) driver calls disk_gone(), it is necessarily holding the SIM > > > > lock, which is a regular MTX_DEF mutex. The GEOM topology lock is an sx > > > > lock, and of WITNESS blows up because of that: > > > [...] > > > > disk_gone() needs to be callable from an interrupt context. So it cannot > > > > acquire the topology lock. > > > > > > I can reword what you said above a bit: disk_gone() modifies GEOM > > > topology, so it has to hold the topology lock, thus it cannot be called > > > from an interrupt context. > > > > Okay, but either way we need some way to inform GEOM that the device has > > gone away. > > > > > We might be able to change the topology lock to LIST_FOREACH_SAFE(), as > > > g_wither_provider() can only destroy current provider. This is because > > > CAM own the geom and nobody should be able to mess with its provider's > > > list, apart from CAM itself. So I'd need to know how CAM ensures that > > > two disk_gone() cannot be called for one geom. The answer might be that > > > those geoms have always only one provider, but then I cannot explain why > > > we have loop there. Maybe jdp@ will remember why. > > > > Well, disk_gone() will only be called once for each da(4) instance that > > goes away. There is a check in cam_periph_invalidate() > > (sys/cam_cam_periph.c) that insures that the peripheral driver's > > invalidate routine only gets called once. > > > > I don't know whether there is more than one provider or not. It may be > > that LIST_FOREACH_SAFE() is sufficient. g_wither_provider() does set the > > G_PF_WITHER flag, and that wouldn't be protected by anything other than the > > CAM SIM lock in this case. > > > > > I also read original commit message and I don't fully understand. > > > > > > It was 7 years ago so I'll quote entire commit message: > > > > > > Fix a bug that caused some /dev entries to continue to exist after > > > the underlying drive had been hot-unplugged from the system. Here > > > is a specific example. Filesystem code had opened /dev/da1s1e. > > > Subsequently, the drive was hot-unplugged. This (correctly) caused > > > all of the associated /dev/da1* entries to be deleted. When the > > > filesystem later realized that the drive was gone it closed the > > > device, reducing the write-access counts to 0 on the geom providers > > > for da1s1e, da1s1, and da1. This caused geom to re-taste the > > > providers, resulting in the devices being created again. When the > > > drive was hot-plugged back in, it resulted in duplicate /dev entries > > > for da1s1e, da1s1, and da1. > > > > > > This fix adds a new disk_gone() function which is called by CAM when a > > > drive goes away. It orphans all of the providers associated with the > > > drive, setting an error condition of ENXIO in each one. In addition, > > > we prevent a re-taste on last close for writing if an error condition > > > has been set in the provider. > > > > > > If disk is gone it should orphan its provider. This should cause > > > orphaning depended providers, including da1s1 and then da1s1e. > > > Orphaning sets provider's error and providers with the error set are not > > > retasted. This is from g_access(): > > > > > > else if (pp->acw != 0 && pp->acw == -dcw && pp->error == 0 && > > > !(pp->geom->flags & G_GEOM_WITHER)) > > > g_post_event(g_new_provider_event, pp, M_WAITOK, > > > pp, NULL); > > > > > > My question is: is disk_geom() really needed? Maybe there is some small > > > bug somewhere, but I think GEOM should handle all this without disk_gone(). > > > > CAM needs a three step process when a device goes away. It is currently > > represented with disk_gone(), the d_gone() callback inside the disk class, > > and disk_destroy(). > > > > Here is what CAM needs at each step: > > > > 1. When a device goes away, we need a method to call from daoninvalidate() > > (or any other peripheral driver invalidate routine) with these > > properties: > > - It tells GEOM that the device has gone away, and starts the process > > of shutting down the device. (i.e. withers/orphans the provider) > > - It is callable from an interrupt context, with the SIM (MTX_DEF) lock > > held, so it can't sleep. > > Neither g_wither_provider() nor g_orphan_provider() require the topology > lock. They only acquire the event lock, but it is regular mutex, so this > is fine. Traversing geom's providers list looks like something that does > need the topology lock, but maybe traversing is not needed at all. > The reason for this change was a panic in iSCSI initiator where > disk_gone() was called and provider was destroyed before g_wither_geom() > returned. Ahh. How about using LIST_FOREACH_SAFE? Would that address the problem at hand? Are there any other races in there? > > 2. When GEOM has finished cleaning up the device (initiated in step 1), > > it should call the d_gone() method (dadiskgonecb() in the da(4) > > driver) to tell the CAM peripheral driver that the following is true: > > - All I/O to the device has been completed. > > - No more I/O will be sent to the device (e.g. via the strategy routine) > > - No more open/close requests will be sent to the device. (The final > > close should have been sent to the peripheral driver at this point.) > > > > CAM will release a reference on the device at that point, and in the > > typical case (where that is the last reference) go to step 3. > > > > 3. When CAM has finished cleaning up all of its state, it will tell GEOM > > that it is okay to finalize the destruction of the device. So it needs > > a method to call with these properties: > > > > - It is callable from an interrupt context, with the SIM (MTX_DEF) lock > > held. So it can't sleep. > > - When it is called, the da(4) driver is indicating that it no longer > > holds any references to that particular GEOM disk instance. > > > > So whether it is disk_gone() or something else, we do need a way to orphan > > the provider. Otherwise, how does GEOM know that the disk is gone? > > So maybe disk_destroy() should first orphan provider, which in turn will > set its error. If provider's error is set, all I/O requests will be > denied by GEOM by returning provider's error, so strategy method within > a driver won't be called. The current semantics of disk_destroy() are that the da(4) driver won't use the disk structure after it is called. We can guarantee that if it is called from dacleanup(), but not if it is called from daoninvalidate(). And if we combined the functionality of the current disk_gone() (which orphans the provider) and disk_destroy() routines, we would have to call it from daoninvalidate(). And that won't work, because the da(4) driver may well access elements of the disk structure after daoninvalidate() is called. So we still need a 3 stage cleanup process. Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 19:23:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B883106564A; Wed, 26 Sep 2012 19:23:56 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 1F9ED8FC08; Wed, 26 Sep 2012 19:23:56 +0000 (UTC) Received: by pbbrp8 with SMTP id rp8so2836961pbb.13 for ; Wed, 26 Sep 2012 12:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:in-reply-to:mime-version:content-transfer-encoding :content-type:message-id:cc:x-mailer:from:subject:date:to; bh=JBx9ImHrsUo2ldhptqG6du5pwV4VL0PH8BAkmKAH6us=; b=QWh52ju2eYc961yhoYFCq66deR5DaBMuaSoLF3P50uwW6sATOlo7Y+btNdF8S6e4qZ 5eC6Qdt3ca78rh7ZrSBwGfcTI6FoGsyzQkNXDIREBv5vhein0V2nNpyN8wkAHnsYM0By bO7WGzKoLJegQkgoQycfyFvEwrvvU+3uWkg+o9ghjwBMcf9x/PokWf7ERy34ehPru0Jc L2YaneFhaNIqnxsPjF+P36yW0foT9HtzXVf7XCzkJO8abnTkPdkUO5tdOpc1b8SQVc0H L/knm0ugp/XhzAQ5t6bnR9TsG29FbIWCH4pUN1hfWMrctR2kknUKfJRrHIpgVO42cQtf nv/w== Received: by 10.68.234.36 with SMTP id ub4mr5261505pbc.68.1348687435825; Wed, 26 Sep 2012 12:23:55 -0700 (PDT) Received: from [10.74.194.115] (mobile-166-147-094-118.mycingular.net. [166.147.94.118]) by mx.google.com with ESMTPS id iv7sm2483968pbc.68.2012.09.26.12.23.52 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 26 Sep 2012 12:23:55 -0700 (PDT) References: <201209261804.q8QI4H9P069204@svn.freebsd.org> <20120926184643.GD1309@glenbarber.us> <20120926190451.GA92155@FreeBSD.org> In-Reply-To: <20120926190451.GA92155@FreeBSD.org> Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: X-Mailer: iPhone Mail (9B206) From: Garrett Cooper Date: Wed, 26 Sep 2012 12:23:46 -0700 To: Alexey Dokuchaev Cc: "svn-src-head@freebsd.org" , Glen Barber , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r240967 - head/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 19:23:56 -0000 On Sep 26, 2012, at 12:04 PM, Alexey Dokuchaev wrote: > On Wed, Sep 26, 2012 at 02:46:43PM -0400, Glen Barber wrote: >> On Wed, Sep 26, 2012 at 11:44:07AM -0700, Garrett Cooper wrote: >>>> -: ${RELSTRING=3D`chroot $2 uname -s`-`chroot $2 uname -r`-`chroot $2 u= name -p`} >>>> +if [ "x${OSVERSION}" =3D=3D "x" ]; then >>>=20 >>> This should be `=3D` in order to be backwards compatible with older >>> (pre-9.1) copies of /bin/sh >>=20 >> This won't be going into pre-9.1 versions of FreeBSD. >=20 > Still, there is no need to spread this bogus syntax which we had erroneous= ly adopted. If you aren't leading the pack, you have to follow the herd (linux). This syntax was added to our copy of ash after some discussion on the posix l= ist re: test(1) syntax. Fighting this inconsistency (bash/zsh syntax) causes more unnecessary turmoi= l and churn in Linux centric projects than needed (and there are a number of= bashisms/zshisms we still don't support). I think it's fine to go with the n= ew syntax as long as things that are FreeBSD specific prefer the old syntax a= s long as 8.2/9.0 and their respective versions are still supported and one c= an upgrade from older versions (this is squishy, but rule of thumb the last I= heard was 2-3 major versions). Thanks! -Garrett= From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 19:32:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58255106566B; Wed, 26 Sep 2012 19:32:42 +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 2BF908FC08; Wed, 26 Sep 2012 19:32:42 +0000 (UTC) Received: from glenbarber.us (75-146-225-65-Philadelphia.hfc.comcastbusiness.net [75.146.225.65]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: gjb) by onyx.glenbarber.us (Postfix) with ESMTPSA id 02B4C23F6D9; Wed, 26 Sep 2012 15:32:40 -0400 (EDT) Date: Wed, 26 Sep 2012 15:32:39 -0400 From: Glen Barber To: Garrett Cooper Message-ID: <20120926193239.GE1309@glenbarber.us> References: <201209261804.q8QI4H9P069204@svn.freebsd.org> <20120926184643.GD1309@glenbarber.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="YD3LsXFS42OYHhNZ" Content-Disposition: inline In-Reply-To: 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" Subject: Re: svn commit: r240967 - head/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 19:32:42 -0000 --YD3LsXFS42OYHhNZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 26, 2012 at 12:06:27PM -0700, Garrett Cooper wrote: > > This won't be going into pre-9.1 versions of FreeBSD. >=20 > Perhaps, but there's nothing preventing me from building on 9.0. > 8.x might also work, but that'd be purely based on the fact that > userland abis didn't change all that much between 8 and 9. You're right, there is nothing preventing you from building 9.0. This evaluation is done in the build environment, not within the chroot(8) environment. Glen --YD3LsXFS42OYHhNZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBCAAGBQJQY1hXAAoJEFJPDDeguUajU8oH+gJiLovSBBaW6oHUMqzvZKOG 31fc1R3V6yN2SyKF0QBr+U0ko+Ukct5Gohdbk/qC1z1sTeasBIYvIYrb8UAq4Jzk j8JJX+2V82juuuZawfX95lhnuaJkkKJ6IqR56k9IL63y748UWgiVZjCrRwKq79Nl C6UFAzD2eSXoI6n/Uq1kN7WS0VYjDTX6E0R034BWrxhELEhnrvjOWMdWb0le+LUY JuBFIJrxKesCE+ASqWxWoNx3axrQNH8XzpGFGiC+49ZDXsTUa73SWxTrNm2OQsc5 42lse31MxABWtOdA8mfH8hMBuiaOwfBYnSBUiOCPOrVAvyMJGDWYowVVQZSZ3aE= =LJAc -----END PGP SIGNATURE----- --YD3LsXFS42OYHhNZ-- From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 19:45:17 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3DA411065686; Wed, 26 Sep 2012 19:45:17 +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 C8E668FC0A; Wed, 26 Sep 2012 19:45:16 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id B1A43A6C; Wed, 26 Sep 2012 21:44:15 +0200 (CEST) Date: Wed, 26 Sep 2012 21:45:41 +0200 From: Pawel Jakub Dawidek To: "Kenneth D. Merry" Message-ID: <20120926194541.GB1402@garage.freebsd.pl> References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> <20120926072005.GH1391@garage.freebsd.pl> <20120926172917.GA71268@nargothrond.kdm.org> <20120926185339.GA1402@garage.freebsd.pl> <20120926192117.GA89741@nargothrond.kdm.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FkmkrVfFsRoUs1wW" Content-Disposition: inline In-Reply-To: <20120926192117.GA89741@nargothrond.kdm.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, jdp@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, phk@FreeBSD.org Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 19:45:17 -0000 --FkmkrVfFsRoUs1wW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 26, 2012 at 01:21:17PM -0600, Kenneth D. Merry wrote: > On Wed, Sep 26, 2012 at 20:53:39 +0200, Pawel Jakub Dawidek wrote: > > On Wed, Sep 26, 2012 at 11:29:17AM -0600, Kenneth D. Merry wrote: > > > Here is what CAM needs at each step: > > >=20 > > > 1. When a device goes away, we need a method to call from daoninvali= date() > > > (or any other peripheral driver invalidate routine) with these > > > properties: > > > - It tells GEOM that the device has gone away, and starts the pro= cess > > > of shutting down the device. (i.e. withers/orphans the provide= r) > > > - It is callable from an interrupt context, with the SIM (MTX_DEF= ) lock > > > held, so it can't sleep. > >=20 > > Neither g_wither_provider() nor g_orphan_provider() require the topology > > lock. They only acquire the event lock, but it is regular mutex, so this > > is fine. Traversing geom's providers list looks like something that does > > need the topology lock, but maybe traversing is not needed at all. > > The reason for this change was a panic in iSCSI initiator where > > disk_gone() was called and provider was destroyed before g_wither_geom() > > returned. >=20 > Ahh. How about using LIST_FOREACH_SAFE? Would that address the problem = at > hand? Are there any other races in there? It depends. If one geom can hold more than one provider then it might be racy, but from what I see there is always only one provider - there has to be only one, because disk_destroy() destroys it and struct disk represents always only one disk. If that's true then I see not reason to have a loop in there. I'd change it to: void disk_gone(struct disk *dp) { struct g_geom *gp; struct g_provider *pp; gp =3D dp->d_geom; if (gp !=3D NULL) { pp =3D LIST_FIRST(&gp->provider); if (pp !=3D NULL) g_wither_provider(pp, ENXIO); } } > > So maybe disk_destroy() should first orphan provider, which in turn will > > set its error. If provider's error is set, all I/O requests will be > > denied by GEOM by returning provider's error, so strategy method within > > a driver won't be called. >=20 > The current semantics of disk_destroy() are that the da(4) driver won't u= se > the disk structure after it is called. We can guarantee that if it is > called from dacleanup(), but not if it is called from daoninvalidate(). >=20 > And if we combined the functionality of the current disk_gone() (which > orphans the provider) and disk_destroy() routines, we would have to call = it > from daoninvalidate(). And that won't work, because the da(4) driver may > well access elements of the disk structure after daoninvalidate() is > called. And I assume this is not something that can be fixed/changed? --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --FkmkrVfFsRoUs1wW Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlBjW2QACgkQForvXbEpPzSJzwCaA8fRqFe8CTvwVHbQSaPlYqxl J3MAn3Wcf5ETX6pdg//OPtIU5JwyLTU7 =QgHR -----END PGP SIGNATURE----- --FkmkrVfFsRoUs1wW-- From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 19:49:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96D30106564A; Wed, 26 Sep 2012 19:49:23 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 774598FC0A; Wed, 26 Sep 2012 19:49:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QJnNnr082764; Wed, 26 Sep 2012 19:49:23 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QJnN95082762; Wed, 26 Sep 2012 19:49:23 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201209261949.q8QJnN95082762@svn.freebsd.org> From: Tijl Coosemans Date: Wed, 26 Sep 2012 19:49:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240970 - head/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 19:49:23 -0000 Author: tijl Date: Wed Sep 26 19:49:22 2012 New Revision: 240970 URL: http://svn.freebsd.org/changeset/base/240970 Log: - Make C11 atomic macros usable in expressions: - Replace do-while statements with void expressions. - Wrap __asm statements in statement expressions. - Make the macros function-like: - Evaluate all arguments exactly once. - Make sure there's a sequence point between evaluation of the arguments and the function body. Arguments should be evaluated before any memory barriers. - Fix use of __atomic_is_lock_free built-in. It requires the address of an atomic variable as second argument. Use this built-in on clang as well because clang's __c11_atomic_is_lock_free only takes the size of the variable into account. - In atomic_exchange_explicit put the barrier before instead of after the __sync_lock_test_and_set call. Reviewed by: theraven Modified: head/include/stdatomic.h Modified: head/include/stdatomic.h ============================================================================== --- head/include/stdatomic.h Wed Sep 26 18:59:20 2012 (r240969) +++ head/include/stdatomic.h Wed Sep 26 19:49:22 2012 (r240970) @@ -54,9 +54,7 @@ #define atomic_init(obj, value) __c11_atomic_init(obj, value) #else #define ATOMIC_VAR_INIT(value) { .__val = (value) } -#define atomic_init(obj, value) do { \ - (obj)->__val = (value); \ -} while (0) +#define atomic_init(obj, value) ((void)((obj)->__val = (value))) #endif /* @@ -111,23 +109,24 @@ enum memory_order { #define atomic_thread_fence(order) __atomic_thread_fence(order) #define atomic_signal_fence(order) __atomic_signal_fence(order) #else -#define atomic_thread_fence(order) __sync_synchronize() -#define atomic_signal_fence(order) __asm volatile ("" : : : "memory") +#define atomic_thread_fence(order) ((void)(order), __sync_synchronize()) +#define atomic_signal_fence(order) __extension__ ({ \ + (void)(order); \ + __asm volatile ("" ::: "memory"); \ + (void)0; \ +}) #endif /* * 7.17.5 Lock-free property. */ -#if defined(__CLANG_ATOMICS) -#define atomic_is_lock_free(obj) \ - __c11_atomic_is_lock_free(sizeof(obj)) -#elif defined(__GNUC_ATOMICS) +#if defined(__CLANG_ATOMICS) || defined(__GNUC_ATOMICS) #define atomic_is_lock_free(obj) \ - __atomic_is_lock_free(sizeof((obj)->__val)) + __atomic_is_lock_free(sizeof((obj)->__val), &(obj)->val) #else #define atomic_is_lock_free(obj) \ - (sizeof((obj)->__val) <= sizeof(void *)) + ((void)(obj), sizeof((obj)->__val) <= sizeof(void *)) #endif /* @@ -234,13 +233,17 @@ typedef _Atomic(__uintmax_t) atomic_uin __atomic_store_n(&(object)->__val, desired, order) #else #define atomic_compare_exchange_strong_explicit(object, expected, \ - desired, success, failure) ({ \ + desired, success, failure) __extension__ ({ \ __typeof__((object)->__val) __v; \ + __typeof__(expected) __e; \ _Bool __r; \ + __e = (expected); \ + (void)(success); \ + (void)(failure); \ __v = __sync_val_compare_and_swap(&(object)->__val, \ - *(expected), desired); \ - __r = *(expected) == __v; \ - *(expected) = __v; \ + *__e, (desired)); \ + __r = (*__e == __v); \ + *__e = __v; \ __r; \ }) @@ -250,19 +253,21 @@ typedef _Atomic(__uintmax_t) atomic_uin desired, success, failure) #if __has_builtin(__sync_swap) /* Clang provides a full-barrier atomic exchange - use it if available. */ -#define atomic_exchange_explicit(object, desired, order) \ - __sync_swap(&(object)->__val, desired) +#define atomic_exchange_explicit(object, desired, order) \ + ((void)(order), __sync_swap(&(object)->__val, desired)) #else /* * __sync_lock_test_and_set() is only an acquire barrier in theory (although in - * practice it is usually a full barrier) so we need an explicit barrier after + * practice it is usually a full barrier) so we need an explicit barrier before * it. */ -#define atomic_exchange_explicit(object, desired, order) ({ \ - __typeof__((object)->__val) __v; \ - __v = __sync_lock_test_and_set(&(object)->__val, desired); \ +#define atomic_exchange_explicit(object, desired, order) \ +__extension__ ({ \ + __typeof__(object) __o = (object); \ + __typeof__(desired) __d = (desired); \ + (void)(order); \ __sync_synchronize(); \ - __v; \ + __sync_lock_test_and_set(&(__o)->__val, __d); \ }) #endif #define atomic_fetch_add_explicit(object, operand, order) \ @@ -277,11 +282,14 @@ typedef _Atomic(__uintmax_t) atomic_uin __sync_fetch_and_xor(&(object)->__val, operand) #define atomic_load_explicit(object, order) \ __sync_fetch_and_add(&(object)->__val, 0) -#define atomic_store_explicit(object, desired, order) do { \ +#define atomic_store_explicit(object, desired, order) __extension__ ({ \ + __typeof__(object) __o = (object); \ + __typeof__(desired) __d = (desired); \ + (void)(order); \ __sync_synchronize(); \ - (object)->__val = (desired); \ + __o->__val = __d; \ __sync_synchronize(); \ -} while (0) +}) #endif /* From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 19:58:21 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5AA1B106566B; Wed, 26 Sep 2012 19:58:21 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id 139388FC08; Wed, 26 Sep 2012 19:58:20 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id q8QJwK15096916; Wed, 26 Sep 2012 13:58:20 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id q8QJwKte096915; Wed, 26 Sep 2012 13:58:20 -0600 (MDT) (envelope-from ken) Date: Wed, 26 Sep 2012 13:58:20 -0600 From: "Kenneth D. Merry" To: Pawel Jakub Dawidek Message-ID: <20120926195820.GA96844@nargothrond.kdm.org> References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> <20120926072005.GH1391@garage.freebsd.pl> <20120926172917.GA71268@nargothrond.kdm.org> <20120926185339.GA1402@garage.freebsd.pl> <20120926192117.GA89741@nargothrond.kdm.org> <20120926194541.GB1402@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120926194541.GB1402@garage.freebsd.pl> User-Agent: Mutt/1.4.2i Cc: svn-src-head@FreeBSD.org, jdp@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, phk@FreeBSD.org Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 19:58:21 -0000 On Wed, Sep 26, 2012 at 21:45:41 +0200, Pawel Jakub Dawidek wrote: > On Wed, Sep 26, 2012 at 01:21:17PM -0600, Kenneth D. Merry wrote: > > On Wed, Sep 26, 2012 at 20:53:39 +0200, Pawel Jakub Dawidek wrote: > > > On Wed, Sep 26, 2012 at 11:29:17AM -0600, Kenneth D. Merry wrote: > > > > Here is what CAM needs at each step: > > > > > > > > 1. When a device goes away, we need a method to call from daoninvalidate() > > > > (or any other peripheral driver invalidate routine) with these > > > > properties: > > > > - It tells GEOM that the device has gone away, and starts the process > > > > of shutting down the device. (i.e. withers/orphans the provider) > > > > - It is callable from an interrupt context, with the SIM (MTX_DEF) lock > > > > held, so it can't sleep. > > > > > > Neither g_wither_provider() nor g_orphan_provider() require the topology > > > lock. They only acquire the event lock, but it is regular mutex, so this > > > is fine. Traversing geom's providers list looks like something that does > > > need the topology lock, but maybe traversing is not needed at all. > > > The reason for this change was a panic in iSCSI initiator where > > > disk_gone() was called and provider was destroyed before g_wither_geom() > > > returned. > > > > Ahh. How about using LIST_FOREACH_SAFE? Would that address the problem at > > hand? Are there any other races in there? > > It depends. If one geom can hold more than one provider then it might be > racy, but from what I see there is always only one provider - there has > to be only one, because disk_destroy() destroys it and struct disk > represents always only one disk. If that's true then I see not reason to > have a loop in there. I'd change it to: > > void > disk_gone(struct disk *dp) > { > struct g_geom *gp; > struct g_provider *pp; > > gp = dp->d_geom; > if (gp != NULL) { > pp = LIST_FIRST(&gp->provider); > if (pp != NULL) > g_wither_provider(pp, ENXIO); > } > } I would suggest doing LIST_FOREACH_SAFE() (with a comment explaining why) instead. That way just in case someone adds another provider down the road it will be handled properly. Otherwise we need a comment or KASSERT somewhere to explain that we depend on there only being one provider, and things will break if there is more than one. > > > So maybe disk_destroy() should first orphan provider, which in turn will > > > set its error. If provider's error is set, all I/O requests will be > > > denied by GEOM by returning provider's error, so strategy method within > > > a driver won't be called. > > > > The current semantics of disk_destroy() are that the da(4) driver won't use > > the disk structure after it is called. We can guarantee that if it is > > called from dacleanup(), but not if it is called from daoninvalidate(). > > > > And if we combined the functionality of the current disk_gone() (which > > orphans the provider) and disk_destroy() routines, we would have to call it > > from daoninvalidate(). And that won't work, because the da(4) driver may > > well access elements of the disk structure after daoninvalidate() is > > called. > > And I assume this is not something that can be fixed/changed? No, not really. It would probably take quite a bit of work to go to a two step process, and I'm not sure that it would even work in the end. Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 20:02:07 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16904106566C; Wed, 26 Sep 2012 20:02:07 +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 A052B8FC17; Wed, 26 Sep 2012 20:02:06 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 6C8ACA79; Wed, 26 Sep 2012 22:01:05 +0200 (CEST) Date: Wed, 26 Sep 2012 22:02:31 +0200 From: Pawel Jakub Dawidek To: "Kenneth D. Merry" Message-ID: <20120926200231.GD1402@garage.freebsd.pl> References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> <20120926072005.GH1391@garage.freebsd.pl> <20120926172917.GA71268@nargothrond.kdm.org> <20120926185339.GA1402@garage.freebsd.pl> <20120926192117.GA89741@nargothrond.kdm.org> <20120926194541.GB1402@garage.freebsd.pl> <20120926195820.GA96844@nargothrond.kdm.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cHMo6Wbp1wrKhbfi" Content-Disposition: inline In-Reply-To: <20120926195820.GA96844@nargothrond.kdm.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, jdp@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, phk@FreeBSD.org Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 20:02:07 -0000 --cHMo6Wbp1wrKhbfi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 26, 2012 at 01:58:20PM -0600, Kenneth D. Merry wrote: > On Wed, Sep 26, 2012 at 21:45:41 +0200, Pawel Jakub Dawidek wrote: > > On Wed, Sep 26, 2012 at 01:21:17PM -0600, Kenneth D. Merry wrote: > > > On Wed, Sep 26, 2012 at 20:53:39 +0200, Pawel Jakub Dawidek wrote: > > > > On Wed, Sep 26, 2012 at 11:29:17AM -0600, Kenneth D. Merry wrote: > > > > > Here is what CAM needs at each step: > > > > >=20 > > > > > 1. When a device goes away, we need a method to call from daonin= validate() > > > > > (or any other peripheral driver invalidate routine) with these > > > > > properties: > > > > > - It tells GEOM that the device has gone away, and starts the= process > > > > > of shutting down the device. (i.e. withers/orphans the pro= vider) > > > > > - It is callable from an interrupt context, with the SIM (MTX= _DEF) lock > > > > > held, so it can't sleep. > > > >=20 > > > > Neither g_wither_provider() nor g_orphan_provider() require the top= ology > > > > lock. They only acquire the event lock, but it is regular mutex, so= this > > > > is fine. Traversing geom's providers list looks like something that= does > > > > need the topology lock, but maybe traversing is not needed at all. > > > > The reason for this change was a panic in iSCSI initiator where > > > > disk_gone() was called and provider was destroyed before g_wither_g= eom() > > > > returned. > > >=20 > > > Ahh. How about using LIST_FOREACH_SAFE? Would that address the prob= lem at > > > hand? Are there any other races in there? > >=20 > > It depends. If one geom can hold more than one provider then it might be > > racy, but from what I see there is always only one provider - there has > > to be only one, because disk_destroy() destroys it and struct disk > > represents always only one disk. If that's true then I see not reason to > > have a loop in there. I'd change it to: > >=20 > > void > > disk_gone(struct disk *dp) > > { > > struct g_geom *gp; > > struct g_provider *pp; > >=20 > > gp =3D dp->d_geom; > > if (gp !=3D NULL) { > > pp =3D LIST_FIRST(&gp->provider); > > if (pp !=3D NULL) > > g_wither_provider(pp, ENXIO); > > } > > } >=20 > I would suggest doing LIST_FOREACH_SAFE() (with a comment explaining why) > instead. That way just in case someone adds another provider down the > road it will be handled properly. >=20 > Otherwise we need a comment or KASSERT somewhere to explain that we depend > on there only being one provider, and things will break if there is more > than one. I'm happy with adding KASSERT(), as I don't believe LIST_FOREACH_SAFE() will be safe there, as disk_gone() itself doesn't prevent the function to be called for two different disks, but one geom. LIST_FOREACH_SAFE() make it safe to remove only the current element. If any other elements is removed while we are traversing the list it will most likely panic. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --cHMo6Wbp1wrKhbfi Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlBjX1cACgkQForvXbEpPzSMJgCg73NO/1D9VJ4C/VVuZIaFcYza VRkAoL5oBoteiXlxenpEJK6kio2SmbId =DaJ2 -----END PGP SIGNATURE----- --cHMo6Wbp1wrKhbfi-- From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 20:09:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CD311065670; Wed, 26 Sep 2012 20:09:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 18CD88FC0C; Wed, 26 Sep 2012 20:09:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QK9mfT085064; Wed, 26 Sep 2012 20:09:48 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QK9mDl085062; Wed, 26 Sep 2012 20:09:48 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201209262009.q8QK9mDl085062@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 26 Sep 2012 20:09:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240971 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 20:09:49 -0000 Author: glebius Date: Wed Sep 26 20:09:48 2012 New Revision: 240971 URL: http://svn.freebsd.org/changeset/base/240971 Log: - In the bridge_enqueue() do success/error accounting for each fragment, not only once. - In the GRAB_OUR_PACKETS() macro do increase if_ibytes. Modified: head/sys/net/if_bridge.c Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Wed Sep 26 19:49:22 2012 (r240970) +++ head/sys/net/if_bridge.c Wed Sep 26 20:09:48 2012 (r240971) @@ -1783,13 +1783,12 @@ bridge_enqueue(struct bridge_softc *sc, short mflags; struct mbuf *m0; - len = m->m_pkthdr.len; - mflags = m->m_flags; - /* We may be sending a fragment so traverse the mbuf */ for (; m; m = m0) { m0 = m->m_nextpkt; m->m_nextpkt = NULL; + len = m->m_pkthdr.len; + mflags = m->m_flags; /* * If underlying interface can not do VLAN tag insertion itself @@ -1809,11 +1808,10 @@ bridge_enqueue(struct bridge_softc *sc, if ((err = dst_ifp->if_transmit(dst_ifp, m))) { m_freem(m0); + sc->sc_ifp->if_oerrors++; break; } - } - if (err == 0) { sc->sc_ifp->if_opackets++; sc->sc_ifp->if_obytes += len; if (mflags & M_MCAST) @@ -2303,6 +2301,7 @@ bridge_input(struct ifnet *ifp, struct m if ((iface)->if_type == IFT_BRIDGE) { \ ETHER_BPF_MTAP(iface, m); \ iface->if_ipackets++; \ + iface->if_ibytes += m->m_pkthdr.len; \ /* Filter on the physical interface. */ \ if (pfil_local_phys && \ (PFIL_HOOKED(&V_inet_pfil_hook) \ From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 20:14:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55974106564A; Wed, 26 Sep 2012 20:14:05 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 263B68FC0A; Wed, 26 Sep 2012 20:14:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QKE5se085574; Wed, 26 Sep 2012 20:14:05 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QKE4vK085570; Wed, 26 Sep 2012 20:14:04 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201209262014.q8QKE4vK085570@svn.freebsd.org> From: Devin Teske Date: Wed, 26 Sep 2012 20:14:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240972 - stable/8/usr.sbin/sysinstall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 20:14:05 -0000 Author: dteske Date: Wed Sep 26 20:14:04 2012 New Revision: 240972 URL: http://svn.freebsd.org/changeset/base/240972 Log: Add new DEBUG kernel distribution. Submitted by: Rick Miller Reviewed by: adrian (co-mentor) Approved by: adrian (co-mentor) Modified: stable/8/usr.sbin/sysinstall/dist.c stable/8/usr.sbin/sysinstall/dist.h stable/8/usr.sbin/sysinstall/menus.c Modified: stable/8/usr.sbin/sysinstall/dist.c ============================================================================== --- stable/8/usr.sbin/sysinstall/dist.c Wed Sep 26 20:09:48 2012 (r240971) +++ stable/8/usr.sbin/sysinstall/dist.c Wed Sep 26 20:14:04 2012 (r240972) @@ -102,6 +102,7 @@ static Distribution KernelDistTable[] = #ifdef WITH_SMP DTE_TARBALL("SMP", &KernelDists, KERNEL_SMP, "/boot"), #endif + DTE_TARBALL("DEBUG", &KernelDists, KERNEL_DEBUG, "/boot"), DTE_END, }; Modified: stable/8/usr.sbin/sysinstall/dist.h ============================================================================== --- stable/8/usr.sbin/sysinstall/dist.h Wed Sep 26 20:09:48 2012 (r240971) +++ stable/8/usr.sbin/sysinstall/dist.h Wed Sep 26 20:14:04 2012 (r240972) @@ -73,6 +73,7 @@ /* Subtypes for KERNEL distribution */ #define DIST_KERNEL_GENERIC 0x00001 #define DIST_KERNEL_SMP 0x00002 +#define DIST_KERNEL_DEBUG 0x00004 #define DIST_KERNEL_ALL 0xFFFFF /* Canned distribution sets */ Modified: stable/8/usr.sbin/sysinstall/menus.c ============================================================================== --- stable/8/usr.sbin/sysinstall/menus.c Wed Sep 26 20:09:48 2012 (r240971) +++ stable/8/usr.sbin/sysinstall/menus.c Wed Sep 26 20:14:04 2012 (r240972) @@ -1032,6 +1032,8 @@ DMenu MenuKernelDistributions = { { " SMP", "GENERIC symmetric multiprocessor kernel configuration", dmenuFlagCheck, dmenuSetFlag, NULL, &KernelDists, '[', 'X', ']', DIST_KERNEL_SMP }, #endif + { " DEBUG", "DEBUG kernel configuration", + dmenuFlagCheck, dmenuSetFlag, NULL, &KernelDists, '[', 'X', ']', DIST_KERNEL_DEBUG }, { NULL } }, }; From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 20:16:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3F2A5106566C; Wed, 26 Sep 2012 20:16:16 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A3B18FC08; Wed, 26 Sep 2012 20:16:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QKGG8Z085867; Wed, 26 Sep 2012 20:16:16 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QKGFAF085865; Wed, 26 Sep 2012 20:16:15 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201209262016.q8QKGFAF085865@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 26 Sep 2012 20:16:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240973 - head/usr.bin/find X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 20:16:16 -0000 Author: jilles Date: Wed Sep 26 20:16:15 2012 New Revision: 240973 URL: http://svn.freebsd.org/changeset/base/240973 Log: find: Do not pass fd to save current directory to child processes. This removes one of the two wrongly passed file descriptors. The other one appears to be from fts(3). MFC after: 1 week Modified: head/usr.bin/find/main.c Modified: head/usr.bin/find/main.c ============================================================================== --- head/usr.bin/find/main.c Wed Sep 26 20:14:04 2012 (r240972) +++ head/usr.bin/find/main.c Wed Sep 26 20:16:15 2012 (r240973) @@ -151,7 +151,7 @@ main(int argc, char *argv[]) usage(); *p = NULL; - if ((dotfd = open(".", O_RDONLY, 0)) < 0) + if ((dotfd = open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) err(1, "."); exit(find_execute(find_formplan(argv), start)); From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 20:33:54 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E0DE5106564A; Wed, 26 Sep 2012 20:33:53 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id 99D0C8FC08; Wed, 26 Sep 2012 20:33:53 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id q8QKXqph002706; Wed, 26 Sep 2012 14:33:52 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id q8QKXqGV002705; Wed, 26 Sep 2012 14:33:52 -0600 (MDT) (envelope-from ken) Date: Wed, 26 Sep 2012 14:33:52 -0600 From: "Kenneth D. Merry" To: Pawel Jakub Dawidek Message-ID: <20120926203352.GA2687@nargothrond.kdm.org> References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> <20120926072005.GH1391@garage.freebsd.pl> <20120926172917.GA71268@nargothrond.kdm.org> <20120926185339.GA1402@garage.freebsd.pl> <20120926192117.GA89741@nargothrond.kdm.org> <20120926194541.GB1402@garage.freebsd.pl> <20120926195820.GA96844@nargothrond.kdm.org> <20120926200231.GD1402@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120926200231.GD1402@garage.freebsd.pl> User-Agent: Mutt/1.4.2i Cc: svn-src-head@FreeBSD.org, jdp@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, phk@FreeBSD.org Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 20:33:54 -0000 On Wed, Sep 26, 2012 at 22:02:31 +0200, Pawel Jakub Dawidek wrote: > On Wed, Sep 26, 2012 at 01:58:20PM -0600, Kenneth D. Merry wrote: > > On Wed, Sep 26, 2012 at 21:45:41 +0200, Pawel Jakub Dawidek wrote: > > > On Wed, Sep 26, 2012 at 01:21:17PM -0600, Kenneth D. Merry wrote: > > > > On Wed, Sep 26, 2012 at 20:53:39 +0200, Pawel Jakub Dawidek wrote: > > > > > On Wed, Sep 26, 2012 at 11:29:17AM -0600, Kenneth D. Merry wrote: > > > > > > Here is what CAM needs at each step: > > > > > > > > > > > > 1. When a device goes away, we need a method to call from daoninvalidate() > > > > > > (or any other peripheral driver invalidate routine) with these > > > > > > properties: > > > > > > - It tells GEOM that the device has gone away, and starts the process > > > > > > of shutting down the device. (i.e. withers/orphans the provider) > > > > > > - It is callable from an interrupt context, with the SIM (MTX_DEF) lock > > > > > > held, so it can't sleep. > > > > > > > > > > Neither g_wither_provider() nor g_orphan_provider() require the topology > > > > > lock. They only acquire the event lock, but it is regular mutex, so this > > > > > is fine. Traversing geom's providers list looks like something that does > > > > > need the topology lock, but maybe traversing is not needed at all. > > > > > The reason for this change was a panic in iSCSI initiator where > > > > > disk_gone() was called and provider was destroyed before g_wither_geom() > > > > > returned. > > > > > > > > Ahh. How about using LIST_FOREACH_SAFE? Would that address the problem at > > > > hand? Are there any other races in there? > > > > > > It depends. If one geom can hold more than one provider then it might be > > > racy, but from what I see there is always only one provider - there has > > > to be only one, because disk_destroy() destroys it and struct disk > > > represents always only one disk. If that's true then I see not reason to > > > have a loop in there. I'd change it to: > > > > > > void > > > disk_gone(struct disk *dp) > > > { > > > struct g_geom *gp; > > > struct g_provider *pp; > > > > > > gp = dp->d_geom; > > > if (gp != NULL) { > > > pp = LIST_FIRST(&gp->provider); > > > if (pp != NULL) > > > g_wither_provider(pp, ENXIO); > > > } > > > } > > > > I would suggest doing LIST_FOREACH_SAFE() (with a comment explaining why) > > instead. That way just in case someone adds another provider down the > > road it will be handled properly. > > > > Otherwise we need a comment or KASSERT somewhere to explain that we depend > > on there only being one provider, and things will break if there is more > > than one. > > I'm happy with adding KASSERT(), as I don't believe LIST_FOREACH_SAFE() > will be safe there, as disk_gone() itself doesn't prevent the function > to be called for two different disks, but one geom. LIST_FOREACH_SAFE() > make it safe to remove only the current element. If any other elements > is removed while we are traversing the list it will most likely panic. Ahh, okay. A KASSERT is fine then. Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 20:47:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 204E8106564A; Wed, 26 Sep 2012 20:47:40 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AFC98FC15; Wed, 26 Sep 2012 20:47:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QKldRS089945; Wed, 26 Sep 2012 20:47:39 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QKldIk089943; Wed, 26 Sep 2012 20:47:39 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201209262047.q8QKldIk089943@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 26 Sep 2012 20:47:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240974 - head/libexec/atrun X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 20:47:40 -0000 Author: jilles Date: Wed Sep 26 20:47:39 2012 New Revision: 240974 URL: http://svn.freebsd.org/changeset/base/240974 Log: atrun: Do not assume that MAXLOGNAME <= 100. The reserved space for fmt was exactly sufficient for a two-digit value of MAXLOGNAME - 1. PR: bin/171815 Submitted by: Jeremy Huddleston Sequoia MFC after: 1 week Modified: head/libexec/atrun/atrun.c Modified: head/libexec/atrun/atrun.c ============================================================================== --- head/libexec/atrun/atrun.c Wed Sep 26 20:16:15 2012 (r240973) +++ head/libexec/atrun/atrun.c Wed Sep 26 20:47:39 2012 (r240974) @@ -123,7 +123,7 @@ run_file(const char *filename, uid_t uid pid_t pid; int fd_out, fd_in; int queue; - char mailbuf[MAXLOGNAME], fmt[49]; + char mailbuf[MAXLOGNAME], fmt[64]; char *mailname = NULL; FILE *stream; int send_mail = 0; From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 21:55:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 625DC106566C; Wed, 26 Sep 2012 21:55:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D9688FC14; Wed, 26 Sep 2012 21:55:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QLtE7k099307; Wed, 26 Sep 2012 21:55:14 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QLtEIk099305; Wed, 26 Sep 2012 21:55:14 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201209262155.q8QLtEIk099305@svn.freebsd.org> From: Ed Maste Date: Wed, 26 Sep 2012 21:55:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240975 - stable/9/sys/dev/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 21:55:14 -0000 Author: emaste Date: Wed Sep 26 21:55:13 2012 New Revision: 240975 URL: http://svn.freebsd.org/changeset/base/240975 Log: Add missing mtx_destroy This is a direct commit to stable/9 as the locking is somewhat different in HEAD due to the VALE bridge work (r238812). Modified: stable/9/sys/dev/netmap/netmap.c Modified: stable/9/sys/dev/netmap/netmap.c ============================================================================== --- stable/9/sys/dev/netmap/netmap.c Wed Sep 26 20:47:39 2012 (r240974) +++ stable/9/sys/dev/netmap/netmap.c Wed Sep 26 21:55:13 2012 (r240975) @@ -1040,6 +1040,7 @@ netmap_detach(struct ifnet *ifp) knlist_destroy(&na->rx_rings[i].si.si_note); mtx_destroy(&na->rx_rings[i].q_lock); } + mtx_destroy(&na->core_lock); knlist_destroy(&na->tx_si.si_note); knlist_destroy(&na->rx_si.si_note); bzero(na, sizeof(*na)); From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 22:13:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 062501065672; Wed, 26 Sep 2012 22:13:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E4E918FC25; Wed, 26 Sep 2012 22:13:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QMD3KN001712; Wed, 26 Sep 2012 22:13:03 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QMD3WI001710; Wed, 26 Sep 2012 22:13:03 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201209262213.q8QMD3WI001710@svn.freebsd.org> From: Ed Maste Date: Wed, 26 Sep 2012 22:13:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240976 - stable/9/sys/dev/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 22:13:04 -0000 Author: emaste Date: Wed Sep 26 22:13:03 2012 New Revision: 240976 URL: http://svn.freebsd.org/changeset/base/240976 Log: MFC part of r239149: Comment out the knlist_destroy for now as there is currently no knlist_init. Modified: stable/9/sys/dev/netmap/netmap.c Modified: stable/9/sys/dev/netmap/netmap.c ============================================================================== --- stable/9/sys/dev/netmap/netmap.c Wed Sep 26 21:55:13 2012 (r240975) +++ stable/9/sys/dev/netmap/netmap.c Wed Sep 26 22:13:03 2012 (r240976) @@ -1033,16 +1033,17 @@ netmap_detach(struct ifnet *ifp) return; for (i = 0; i < na->num_tx_rings + 1; i++) { - knlist_destroy(&na->tx_rings[i].si.si_note); + /* knlist_destroy(&na->tx_rings[i].si.si_note); */ mtx_destroy(&na->tx_rings[i].q_lock); } for (i = 0; i < na->num_rx_rings + 1; i++) { - knlist_destroy(&na->rx_rings[i].si.si_note); + /* knlist_destroy(&na->rx_rings[i].si.si_note); */ mtx_destroy(&na->rx_rings[i].q_lock); } mtx_destroy(&na->core_lock); - knlist_destroy(&na->tx_si.si_note); - knlist_destroy(&na->rx_si.si_note); + /* XXX kqueue(9) needed; these will mirror knlist_init. */ + /* knlist_destroy(&na->tx_si.si_note); */ + /* knlist_destroy(&na->rx_si.si_note); */ bzero(na, sizeof(*na)); WNA(ifp) = NULL; free(na, M_DEVBUF); From owner-svn-src-all@FreeBSD.ORG Wed Sep 26 23:07:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7A514106566B; Wed, 26 Sep 2012 23:07:01 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63CCE8FC0C; Wed, 26 Sep 2012 23:07:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8QN71HN009012; Wed, 26 Sep 2012 23:07:01 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8QN71in009007; Wed, 26 Sep 2012 23:07:01 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201209262307.q8QN71in009007@svn.freebsd.org> From: Rick Macklem Date: Wed, 26 Sep 2012 23:07:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240977 - in stable/9/sys/fs: nfs nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 23:07:01 -0000 Author: rmacklem Date: Wed Sep 26 23:07:00 2012 New Revision: 240977 URL: http://svn.freebsd.org/changeset/base/240977 Log: MFC: r240289 Add a simple printf() based debug facility to the new nfs client. Use it for a printf() that can be harmlessly generated for mmap()'d files. It will be used extensively for the NFSv4.1 client. Debugging printf()s are enabled by setting vfs.nfs.debuglevel to a non-zero value. The higher the value, the more debugging printf()s. Modified: stable/9/sys/fs/nfs/nfs_commonport.c stable/9/sys/fs/nfs/nfscl.h stable/9/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/dev/puc/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/fs/nfs/nfs_commonport.c ============================================================================== --- stable/9/sys/fs/nfs/nfs_commonport.c Wed Sep 26 22:13:03 2012 (r240976) +++ stable/9/sys/fs/nfs/nfs_commonport.c Wed Sep 26 23:07:00 2012 (r240977) @@ -60,6 +60,7 @@ struct mount nfsv4root_mnt; int newnfs_numnfsd = 0; struct nfsstats newnfsstats; int nfs_numnfscbd = 0; +int nfscl_debuglevel = 0; char nfsv4_callbackaddr[INET6_ADDRSTRLEN]; struct callout newnfsd_callout; void (*nfsd_call_servertimer)(void) = NULL; @@ -76,6 +77,8 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_c SYSCTL_STRING(_vfs_nfs, OID_AUTO, callback_addr, CTLFLAG_RW, nfsv4_callbackaddr, sizeof(nfsv4_callbackaddr), "NFSv4 callback addr for server to use"); +SYSCTL_INT(_vfs_nfs, OID_AUTO, debuglevel, CTLFLAG_RW, &nfscl_debuglevel, + 0, "Debug level for new nfs client"); /* * Defines for malloc Modified: stable/9/sys/fs/nfs/nfscl.h ============================================================================== --- stable/9/sys/fs/nfs/nfscl.h Wed Sep 26 22:13:03 2012 (r240976) +++ stable/9/sys/fs/nfs/nfscl.h Wed Sep 26 23:07:00 2012 (r240977) @@ -68,4 +68,10 @@ struct nfsv4node { #define NFSSATTR_SIZENEG1 0x4 #define NFSSATTR_SIZERDEV 0x8 +/* Use this macro for debug printfs. */ +#define NFSCL_DEBUG(level, ...) do { \ + if (nfscl_debuglevel >= (level)) \ + printf(__VA_ARGS__); \ + } while (0) + #endif /* _NFS_NFSCL_H */ Modified: stable/9/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clrpcops.c Wed Sep 26 22:13:03 2012 (r240976) +++ stable/9/sys/fs/nfsclient/nfs_clrpcops.c Wed Sep 26 23:07:00 2012 (r240977) @@ -56,6 +56,7 @@ extern u_int32_t newnfs_false, newnfs_tr extern nfstype nfsv34_type[9]; extern int nfsrv_useacl; extern char nfsv4_callbackaddr[INET6_ADDRSTRLEN]; +extern int nfscl_debuglevel; NFSCLSTATEMUTEX; int nfstest_outofseq = 0; int nfscl_assumeposixlocks = 1; @@ -1398,7 +1399,7 @@ nfsrpc_write(vnode_t vp, struct uio *uio if (stateid.other[0] == 0 && stateid.other[1] == 0 && stateid.other[2] == 0) { nostateid = 1; - printf("stateid0 in write\n"); + NFSCL_DEBUG(1, "stateid0 in write\n"); } } From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 04:05:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 62CCD1065670; Thu, 27 Sep 2012 04:05:40 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D9398FC0A; Thu, 27 Sep 2012 04:05:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8R45eWd048179; Thu, 27 Sep 2012 04:05:40 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8R45eBc048176; Thu, 27 Sep 2012 04:05:40 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201209270405.q8R45eBc048176@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 27 Sep 2012 04:05:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240979 - in stable/9: lib/libc/rpc sys/rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 04:05:40 -0000 Author: pfg Date: Thu Sep 27 04:05:39 2012 New Revision: 240979 URL: http://svn.freebsd.org/changeset/base/240979 Log: MFC 240880: Revert a change from Bull's NFSv4 libtirpc implementation: libtirpc: be sure to free cl_netid and cl_tp This change is causing rpc.lockd to exit after startup. Reported by: David Wolfskill Modified: stable/9/lib/libc/rpc/clnt_vc.c stable/9/sys/rpc/clnt_vc.c Modified: stable/9/lib/libc/rpc/clnt_vc.c ============================================================================== --- stable/9/lib/libc/rpc/clnt_vc.c Thu Sep 27 00:27:58 2012 (r240978) +++ stable/9/lib/libc/rpc/clnt_vc.c Thu Sep 27 04:05:39 2012 (r240979) @@ -672,10 +672,6 @@ clnt_vc_destroy(cl) if (ct->ct_addr.buf) free(ct->ct_addr.buf); mem_free(ct, sizeof(struct ct_data)); - if (cl->cl_netid && cl->cl_netid[0]) - mem_free(cl->cl_netid, strlen(cl->cl_netid) +1); - if (cl->cl_tp && cl->cl_tp[0]) - mem_free(cl->cl_tp, strlen(cl->cl_tp) +1); mem_free(cl, sizeof(CLIENT)); mutex_unlock(&clnt_fd_lock); thr_sigsetmask(SIG_SETMASK, &(mask), NULL); Modified: stable/9/sys/rpc/clnt_vc.c ============================================================================== --- stable/9/sys/rpc/clnt_vc.c Thu Sep 27 00:27:58 2012 (r240978) +++ stable/9/sys/rpc/clnt_vc.c Thu Sep 27 04:05:39 2012 (r240979) @@ -836,10 +836,6 @@ clnt_vc_destroy(CLIENT *cl) soclose(so); } mem_free(ct, sizeof(struct ct_data)); - if (cl->cl_netid && cl->cl_netid[0]) - mem_free(cl->cl_netid, strlen(cl->cl_netid) +1); - if (cl->cl_tp && cl->cl_tp[0]) - mem_free(cl->cl_tp, strlen(cl->cl_tp) +1); mem_free(cl, sizeof(CLIENT)); } From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 04:06:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6F87B106566B; Thu, 27 Sep 2012 04:06:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 598218FC0A; Thu, 27 Sep 2012 04:06:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8R46LBB048316; Thu, 27 Sep 2012 04:06:21 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8R46LPE048313; Thu, 27 Sep 2012 04:06:21 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201209270406.q8R46LPE048313@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 27 Sep 2012 04:06:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240980 - in stable/8: lib/libc/rpc sys/rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 04:06:21 -0000 Author: pfg Date: Thu Sep 27 04:06:20 2012 New Revision: 240980 URL: http://svn.freebsd.org/changeset/base/240980 Log: MFC 240880: Revert a change from Bull's NFSv4 libtirpc implementation: libtirpc: be sure to free cl_netid and cl_tp This change is causing rpc.lockd to exit after startup. Reported by: David Wolfskill Modified: stable/8/lib/libc/rpc/clnt_vc.c stable/8/sys/rpc/clnt_vc.c Directory Properties: stable/8/lib/libc/rpc/ (props changed) stable/8/sys/rpc/ (props changed) Modified: stable/8/lib/libc/rpc/clnt_vc.c ============================================================================== --- stable/8/lib/libc/rpc/clnt_vc.c Thu Sep 27 04:05:39 2012 (r240979) +++ stable/8/lib/libc/rpc/clnt_vc.c Thu Sep 27 04:06:20 2012 (r240980) @@ -672,10 +672,6 @@ clnt_vc_destroy(cl) if (ct->ct_addr.buf) free(ct->ct_addr.buf); mem_free(ct, sizeof(struct ct_data)); - if (cl->cl_netid && cl->cl_netid[0]) - mem_free(cl->cl_netid, strlen(cl->cl_netid) +1); - if (cl->cl_tp && cl->cl_tp[0]) - mem_free(cl->cl_tp, strlen(cl->cl_tp) +1); mem_free(cl, sizeof(CLIENT)); mutex_unlock(&clnt_fd_lock); thr_sigsetmask(SIG_SETMASK, &(mask), NULL); Modified: stable/8/sys/rpc/clnt_vc.c ============================================================================== --- stable/8/sys/rpc/clnt_vc.c Thu Sep 27 04:05:39 2012 (r240979) +++ stable/8/sys/rpc/clnt_vc.c Thu Sep 27 04:06:20 2012 (r240980) @@ -836,10 +836,6 @@ clnt_vc_destroy(CLIENT *cl) soclose(so); } mem_free(ct, sizeof(struct ct_data)); - if (cl->cl_netid && cl->cl_netid[0]) - mem_free(cl->cl_netid, strlen(cl->cl_netid) +1); - if (cl->cl_tp && cl->cl_tp[0]) - mem_free(cl->cl_tp, strlen(cl->cl_tp) +1); mem_free(cl, sizeof(CLIENT)); } From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 04:28:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4DA97106564A; Thu, 27 Sep 2012 04:28:56 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E1628FC08; Thu, 27 Sep 2012 04:28:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8R4Su0r051038; Thu, 27 Sep 2012 04:28:56 GMT (envelope-from sobomax@svn.freebsd.org) Received: (from sobomax@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8R4Suqa051036; Thu, 27 Sep 2012 04:28:56 GMT (envelope-from sobomax@svn.freebsd.org) Message-Id: <201209270428.q8R4Suqa051036@svn.freebsd.org> From: Maxim Sobolev Date: Thu, 27 Sep 2012 04:28:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240981 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 04:28:56 -0000 Author: sobomax Date: Thu Sep 27 04:28:55 2012 New Revision: 240981 URL: http://svn.freebsd.org/changeset/base/240981 Log: Add 32-bit ABI compat shims. Those are necessary for i386 binary-only tools like sysutils/hpacucli (HP P4xx RAID controller management suite) working on amd64 systems. PR: 139271 Submitted by: Kazumi MORINAGA, Eugene Grosbein MFC after: 1 week Modified: head/sys/dev/pci/pci_user.c Modified: head/sys/dev/pci/pci_user.c ============================================================================== --- head/sys/dev/pci/pci_user.c Thu Sep 27 04:06:20 2012 (r240980) +++ head/sys/dev/pci/pci_user.c Thu Sep 27 04:28:55 2012 (r240981) @@ -225,6 +225,49 @@ struct pci_io_old { u_int32_t pi_data; /* data to write or result of read */ }; +#ifdef COMPAT_FREEBSD32 +struct pci_conf_old32 { + struct pcisel_old pc_sel; /* bus+slot+function */ + u_int8_t pc_hdr; /* PCI header type */ + u_int16_t pc_subvendor; /* card vendor ID */ + u_int16_t pc_subdevice; /* card device ID, assigned by + card vendor */ + u_int16_t pc_vendor; /* chip vendor ID */ + u_int16_t pc_device; /* chip device ID, assigned by + chip vendor */ + u_int8_t pc_class; /* chip PCI class */ + u_int8_t pc_subclass; /* chip PCI subclass */ + u_int8_t pc_progif; /* chip PCI programming interface */ + u_int8_t pc_revid; /* chip revision ID */ + char pd_name[PCI_MAXNAMELEN + 1]; /* device name */ + u_int32_t pd_unit; /* device unit number (u_long) */ +}; + +struct pci_match_conf_old32 { + struct pcisel_old pc_sel; /* bus+slot+function */ + char pd_name[PCI_MAXNAMELEN + 1]; /* device name */ + u_int32_t pd_unit; /* Unit number (u_long) */ + u_int16_t pc_vendor; /* PCI Vendor ID */ + u_int16_t pc_device; /* PCI Device ID */ + u_int8_t pc_class; /* PCI class */ + pci_getconf_flags_old flags; /* Matching expression */ +}; + +struct pci_conf_io32 { + u_int32_t pat_buf_len; /* pattern buffer length */ + u_int32_t num_patterns; /* number of patterns */ + u_int32_t patterns; /* pattern buffer (struct pci_match_conf_old32 *) */ + u_int32_t match_buf_len; /* match buffer length */ + u_int32_t num_matches; /* number of matches returned */ + u_int32_t matches; /* match buffer (struct pci_conf_old32 *) */ + u_int32_t offset; /* offset into device list */ + u_int32_t generation; /* device list generation */ + pci_getconf_status status; /* request status */ +}; + +#define PCIOCGETCONF_OLD32 _IOWR('p', 1, struct pci_conf_io32) +#endif + #define PCIOCGETCONF_OLD _IOWR('p', 1, struct pci_conf_io) #define PCIOCREAD_OLD _IOWR('p', 2, struct pci_io_old) #define PCIOCWRITE_OLD _IOWR('p', 3, struct pci_io_old) @@ -295,6 +338,69 @@ pci_conf_match_old(struct pci_match_conf return(1); } +static int +pci_conf_match_old32(struct pci_match_conf_old32 *matches, int num_matches, + struct pci_conf *match_buf) +{ + int i; + + if ((matches == NULL) || (match_buf == NULL) || (num_matches <= 0)) + return(1); + + for (i = 0; i < num_matches; i++) { + if (match_buf->pc_sel.pc_domain != 0) + continue; + + /* + * I'm not sure why someone would do this...but... + */ + if (matches[i].flags == PCI_GETCONF_NO_MATCH_OLD) + continue; + + /* + * Look at each of the match flags. If it's set, do the + * comparison. If the comparison fails, we don't have a + * match, go on to the next item if there is one. + */ + if (((matches[i].flags & PCI_GETCONF_MATCH_BUS_OLD) != 0) + && (match_buf->pc_sel.pc_bus != matches[i].pc_sel.pc_bus)) + continue; + + if (((matches[i].flags & PCI_GETCONF_MATCH_DEV_OLD) != 0) + && (match_buf->pc_sel.pc_dev != matches[i].pc_sel.pc_dev)) + continue; + + if (((matches[i].flags & PCI_GETCONF_MATCH_FUNC_OLD) != 0) + && (match_buf->pc_sel.pc_func != matches[i].pc_sel.pc_func)) + continue; + + if (((matches[i].flags & PCI_GETCONF_MATCH_VENDOR_OLD) != 0) + && (match_buf->pc_vendor != matches[i].pc_vendor)) + continue; + + if (((matches[i].flags & PCI_GETCONF_MATCH_DEVICE_OLD) != 0) + && (match_buf->pc_device != matches[i].pc_device)) + continue; + + if (((matches[i].flags & PCI_GETCONF_MATCH_CLASS_OLD) != 0) + && (match_buf->pc_class != matches[i].pc_class)) + continue; + + if (((matches[i].flags & PCI_GETCONF_MATCH_UNIT_OLD) != 0) + && ((u_int32_t)match_buf->pd_unit != matches[i].pd_unit)) + continue; + + if (((matches[i].flags & PCI_GETCONF_MATCH_NAME_OLD) != 0) + && (strncmp(matches[i].pd_name, match_buf->pd_name, + sizeof(match_buf->pd_name)) != 0)) + continue; + + return(0); + } + + return(1); +} + #endif static int @@ -313,13 +419,21 @@ pci_ioctl(struct cdev *dev, u_long cmd, size_t confsz, iolen, pbufsz; int error, ionum, i, num_patterns; #ifdef PRE7_COMPAT +#ifdef COMPAT_FREEBSD32 + struct pci_conf_io32 *cio32; +#endif struct pci_conf_old conf_old; + struct pci_conf_old32 conf_old32; struct pci_io iodata; struct pci_io_old *io_old; struct pci_match_conf_old *pattern_buf_old; + struct pci_match_conf_old32 *pattern_buf_old32; + cio = NULL; + cio32 = NULL; io_old = NULL; pattern_buf_old = NULL; + pattern_buf_old32 = NULL; if (!(flag & FWRITE) && cmd != PCIOCGETBAR && cmd != PCIOCGETCONF && cmd != PCIOCGETCONF_OLD) @@ -331,11 +445,27 @@ pci_ioctl(struct cdev *dev, u_long cmd, switch(cmd) { #ifdef PRE7_COMPAT + case PCIOCGETCONF_OLD32: + cio32 = (struct pci_conf_io32 *)data; + cio = malloc(sizeof(struct pci_conf_io), M_TEMP, M_WAITOK); + cio->pat_buf_len = cio32->pat_buf_len; + cio->num_patterns = cio32->num_patterns; + cio->patterns = (void *)(uintptr_t)cio32->patterns; + cio->match_buf_len = cio32->match_buf_len; + cio->num_matches = cio32->num_matches; + cio->matches = (void *)(uintptr_t)cio32->matches; + cio->offset = cio32->offset; + cio->generation = cio32->generation; + cio->status = cio32->status; + cio32->num_matches = 0; + /* FALLTHROUGH */ + case PCIOCGETCONF_OLD: /* FALLTHROUGH */ #endif case PCIOCGETCONF: - cio = (struct pci_conf_io *)data; + if (cio == NULL) + cio = (struct pci_conf_io *)data; pattern_buf = NULL; num_patterns = 0; @@ -353,7 +483,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, && (cio->generation != pci_generation)){ cio->status = PCI_GETCONF_LIST_CHANGED; error = 0; - break; + goto getconfexit; } /* @@ -363,7 +493,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, if (cio->offset >= pci_numdevs) { cio->status = PCI_GETCONF_LAST_DEVICE; error = 0; - break; + goto getconfexit; } /* get the head of the device queue */ @@ -376,6 +506,11 @@ pci_ioctl(struct cdev *dev, u_long cmd, * didn't specify a multiple of that size. */ #ifdef PRE7_COMPAT +#ifdef COMPAT_FREEBSD32 + if (cmd == PCIOCGETCONF_OLD32) + confsz = sizeof(struct pci_conf_old32); + else +#endif if (cmd == PCIOCGETCONF_OLD) confsz = sizeof(struct pci_conf_old); else @@ -410,6 +545,11 @@ pci_ioctl(struct cdev *dev, u_long cmd, * updated their kernel but not their userland. */ #ifdef PRE7_COMPAT +#ifdef COMPAT_FREEBSD32 + if (cmd == PCIOCGETCONF_OLD32) + pbufsz = sizeof(struct pci_match_conf_old32); + else +#endif if (cmd == PCIOCGETCONF_OLD) pbufsz = sizeof(struct pci_match_conf_old); else @@ -419,13 +559,19 @@ pci_ioctl(struct cdev *dev, u_long cmd, /* The user made a mistake, return an error. */ cio->status = PCI_GETCONF_ERROR; error = EINVAL; - break; + goto getconfexit; } /* * Allocate a buffer to hold the patterns. */ #ifdef PRE7_COMPAT + if (cmd == PCIOCGETCONF_OLD32) { + pattern_buf_old32 = malloc(cio->pat_buf_len, + M_TEMP, M_WAITOK); + error = copyin(cio->patterns, + pattern_buf_old32, cio->pat_buf_len); + } else if (cmd == PCIOCGETCONF_OLD) { pattern_buf_old = malloc(cio->pat_buf_len, M_TEMP, M_WAITOK); @@ -451,7 +597,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, */ cio->status = PCI_GETCONF_ERROR; error = EINVAL; - break; + goto getconfexit; } /* @@ -483,7 +629,11 @@ pci_ioctl(struct cdev *dev, u_long cmd, } #ifdef PRE7_COMPAT - if ((cmd == PCIOCGETCONF_OLD && + if ((cmd == PCIOCGETCONF_OLD32 && + (pattern_buf_old32 == NULL || + pci_conf_match_old32(pattern_buf_old32, + num_patterns, &dinfo->conf) == 0)) || + (cmd == PCIOCGETCONF_OLD && (pattern_buf_old == NULL || pci_conf_match_old(pattern_buf_old, num_patterns, &dinfo->conf) == 0)) || @@ -508,6 +658,38 @@ pci_ioctl(struct cdev *dev, u_long cmd, break; #ifdef PRE7_COMPAT + if (cmd == PCIOCGETCONF_OLD32) { + conf_old32.pc_sel.pc_bus = + dinfo->conf.pc_sel.pc_bus; + conf_old32.pc_sel.pc_dev = + dinfo->conf.pc_sel.pc_dev; + conf_old32.pc_sel.pc_func = + dinfo->conf.pc_sel.pc_func; + conf_old32.pc_hdr = dinfo->conf.pc_hdr; + conf_old32.pc_subvendor = + dinfo->conf.pc_subvendor; + conf_old32.pc_subdevice = + dinfo->conf.pc_subdevice; + conf_old32.pc_vendor = + dinfo->conf.pc_vendor; + conf_old32.pc_device = + dinfo->conf.pc_device; + conf_old32.pc_class = + dinfo->conf.pc_class; + conf_old32.pc_subclass = + dinfo->conf.pc_subclass; + conf_old32.pc_progif = + dinfo->conf.pc_progif; + conf_old32.pc_revid = + dinfo->conf.pc_revid; + strncpy(conf_old32.pd_name, + dinfo->conf.pd_name, + sizeof(conf_old32.pd_name)); + conf_old32.pd_name[PCI_MAXNAMELEN] = 0; + conf_old32.pd_unit = + (u_int32_t)dinfo->conf.pd_unit; + confdata = &conf_old32; + } else if (cmd == PCIOCGETCONF_OLD) { conf_old.pc_sel.pc_bus = dinfo->conf.pc_sel.pc_bus; @@ -574,9 +756,22 @@ pci_ioctl(struct cdev *dev, u_long cmd, cio->status = PCI_GETCONF_MORE_DEVS; getconfexit: +#ifdef COMPAT_FREEBSD32 + if (cmd == PCIOCGETCONF_OLD32) { + cio32->status = cio->status; + cio32->generation = cio->generation; + cio32->offset = cio->offset; + cio32->num_matches = cio->num_matches; + if (cio != NULL) + free(cio, M_TEMP); + } +#endif + if (pattern_buf != NULL) free(pattern_buf, M_TEMP); #ifdef PRE7_COMPAT + if (pattern_buf_old32 != NULL) + free(pattern_buf_old32, M_TEMP); if (pattern_buf_old != NULL) free(pattern_buf_old, M_TEMP); #endif From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 05:26:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 74081106564A; Thu, 27 Sep 2012 05:26:30 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F4F98FC0C; Thu, 27 Sep 2012 05:26:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8R5QUjx058397; Thu, 27 Sep 2012 05:26:30 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8R5QU20058394; Thu, 27 Sep 2012 05:26:30 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201209270526.q8R5QU20058394@svn.freebsd.org> From: Kevin Lo Date: Thu, 27 Sep 2012 05:26:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240982 - head/lib/libedit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 05:26:30 -0000 Author: kevlo Date: Thu Sep 27 05:26:29 2012 New Revision: 240982 URL: http://svn.freebsd.org/changeset/base/240982 Log: Initialize the num variable to avoid uninitialized data. This fixes the bug introduced by r238378. Reviewed by: pfg Modified: head/lib/libedit/read.c Modified: head/lib/libedit/read.c ============================================================================== --- head/lib/libedit/read.c Thu Sep 27 04:28:55 2012 (r240981) +++ head/lib/libedit/read.c Thu Sep 27 05:26:29 2012 (r240982) @@ -426,7 +426,7 @@ el_gets(EditLine *el, int *nread) char *cp = el->el_line.buffer; size_t idx; - while ((*el->el_read.read_char)(el, cp) == 1) { + while ((num = (*el->el_read.read_char)(el, cp)) == 1) { /* make sure there is space for next character */ if (cp + 1 >= el->el_line.limit) { idx = (cp - el->el_line.buffer); @@ -479,7 +479,7 @@ el_gets(EditLine *el, int *nread) term__flush(el); - while ((*el->el_read.read_char)(el, cp) == 1) { + while ((num = (*el->el_read.read_char)(el, cp)) == 1) { /* make sure there is space next character */ if (cp + 1 >= el->el_line.limit) { idx = (cp - el->el_line.buffer); From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 05:39:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CA3E8106566C; Thu, 27 Sep 2012 05:39:42 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B52938FC1B; Thu, 27 Sep 2012 05:39:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8R5dgo7060169; Thu, 27 Sep 2012 05:39:42 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8R5dg6S060164; Thu, 27 Sep 2012 05:39:42 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201209270539.q8R5dg6S060164@svn.freebsd.org> From: Alan Cox Date: Thu, 27 Sep 2012 05:39:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240983 - in head/sys/arm: arm include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 05:39:42 -0000 Author: alc Date: Thu Sep 27 05:39:42 2012 New Revision: 240983 URL: http://svn.freebsd.org/changeset/base/240983 Log: Implementing pmap_kextract(va) as pmap_extract(kernel_pmap, va) is problematic because some callers to pmap_kextract() expect its implementation to be lock-less. In particular, uma_dbg_alloc() implicitly requires this. Otherwise, lock-order reversals occur between pmap locks and UMA zone locks. So, this change introduces a lock-less implementation of pmap_kextract(). Disable recursion on the pvh global lock in the new armv6 pmap. While recursion on this locks occurs in the old arm pmap, it thankfully doesn't occur in the armv6 pmap. Tested by: jmg Modified: head/sys/arm/arm/pmap-v6.c head/sys/arm/arm/pmap.c head/sys/arm/include/pmap.h Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Thu Sep 27 05:26:29 2012 (r240982) +++ head/sys/arm/arm/pmap-v6.c Thu Sep 27 05:39:42 2012 (r240983) @@ -148,9 +148,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include #include @@ -167,8 +169,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include + #include #include #include @@ -202,6 +203,7 @@ static pv_entry_t pmap_get_pv_entry(void static void pmap_enter_locked(pmap_t, vm_offset_t, vm_page_t, vm_prot_t, boolean_t, int); +static vm_paddr_t pmap_extract_locked(pmap_t pmap, vm_offset_t va); static void pmap_alloc_l1(pmap_t); static void pmap_free_l1(pmap_t); @@ -1659,7 +1661,7 @@ pmap_bootstrap(vm_offset_t firstaddr, vm /* * Initialize the global pv list lock. */ - rw_init_flags(&pvh_global_lock, "pmap pv global", RW_RECURSE); + rw_init(&pvh_global_lock, "pmap pv global"); /* * Reserve some special page table entries/VA space for temporary @@ -2100,6 +2102,13 @@ pmap_kenter_user(vm_offset_t va, vm_padd pmap_fault_fixup(pmap_kernel(), va, VM_PROT_READ|VM_PROT_WRITE, 1); } +vm_paddr_t +pmap_kextract(vm_offset_t va) +{ + + return (pmap_extract_locked(kernel_pmap, va)); +} + /* * remove a page from the kernel pagetables */ @@ -2850,22 +2859,34 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm * with the given map/virtual_address pair. */ vm_paddr_t -pmap_extract(pmap_t pm, vm_offset_t va) +pmap_extract(pmap_t pmap, vm_offset_t va) +{ + vm_paddr_t pa; + + PMAP_LOCK(pmap); + pa = pmap_extract_locked(pmap, va); + PMAP_UNLOCK(pmap); + return (pa); +} + +static vm_paddr_t +pmap_extract_locked(pmap_t pmap, vm_offset_t va) { struct l2_dtable *l2; pd_entry_t l1pd; pt_entry_t *ptep, pte; vm_paddr_t pa; u_int l1idx; - l1idx = L1_IDX(va); - PMAP_LOCK(pm); - l1pd = pm->pm_l1->l1_kva[l1idx]; + if (pmap != kernel_pmap) + PMAP_ASSERT_LOCKED(pmap); + l1idx = L1_IDX(va); + l1pd = pmap->pm_l1->l1_kva[l1idx]; if (l1pte_section_p(l1pd)) { /* - * These should only happen for pmap_kernel() + * These should only happen for the kernel pmap. */ - KASSERT(pm == pmap_kernel(), ("huh")); + KASSERT(pmap == kernel_pmap, ("unexpected section")); /* XXX: what to do about the bits > 32 ? */ if (l1pd & L1_S_SUPERSEC) pa = (l1pd & L1_SUP_FRAME) | (va & L1_SUP_OFFSET); @@ -2877,34 +2898,22 @@ pmap_extract(pmap_t pm, vm_offset_t va) * descriptor as an indication that a mapping exists. * We have to look it up in the L2 dtable. */ - l2 = pm->pm_l2[L2_IDX(l1idx)]; - + l2 = pmap->pm_l2[L2_IDX(l1idx)]; if (l2 == NULL || - (ptep = l2->l2_bucket[L2_BUCKET(l1idx)].l2b_kva) == NULL) { - PMAP_UNLOCK(pm); + (ptep = l2->l2_bucket[L2_BUCKET(l1idx)].l2b_kva) == NULL) return (0); - } - - ptep = &ptep[l2pte_index(va)]; - pte = *ptep; - - if (pte == 0) { - PMAP_UNLOCK(pm); + pte = ptep[l2pte_index(va)]; + if (pte == 0) return (0); - } - switch (pte & L2_TYPE_MASK) { case L2_TYPE_L: pa = (pte & L2_L_FRAME) | (va & L2_L_OFFSET); break; - default: pa = (pte & L2_S_FRAME) | (va & L2_S_OFFSET); break; } } - - PMAP_UNLOCK(pm); return (pa); } Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Thu Sep 27 05:26:29 2012 (r240982) +++ head/sys/arm/arm/pmap.c Thu Sep 27 05:39:42 2012 (r240983) @@ -145,9 +145,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include #include @@ -164,8 +166,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include + #include #include #include @@ -197,6 +198,7 @@ static pv_entry_t pmap_get_pv_entry(void static void pmap_enter_locked(pmap_t, vm_offset_t, vm_page_t, vm_prot_t, boolean_t, int); +static vm_paddr_t pmap_extract_locked(pmap_t pmap, vm_offset_t va); static void pmap_fix_cache(struct vm_page *, pmap_t, vm_offset_t); static void pmap_alloc_l1(pmap_t); static void pmap_free_l1(pmap_t); @@ -2840,6 +2842,13 @@ pmap_kenter_user(vm_offset_t va, vm_padd pmap_fault_fixup(pmap_kernel(), va, VM_PROT_READ|VM_PROT_WRITE, 1); } +vm_paddr_t +pmap_kextract(vm_offset_t va) +{ + + return (pmap_extract_locked(kernel_pmap, va)); +} + /* * remove a page from the kernel pagetables */ @@ -3644,22 +3653,34 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm * with the given map/virtual_address pair. */ vm_paddr_t -pmap_extract(pmap_t pm, vm_offset_t va) +pmap_extract(pmap_t pmap, vm_offset_t va) +{ + vm_paddr_t pa; + + PMAP_LOCK(pmap); + pa = pmap_extract_locked(pmap, va); + PMAP_UNLOCK(pmap); + return (pa); +} + +static vm_paddr_t +pmap_extract_locked(pmap_t pmap, vm_offset_t va) { struct l2_dtable *l2; pd_entry_t l1pd; pt_entry_t *ptep, pte; vm_paddr_t pa; u_int l1idx; - l1idx = L1_IDX(va); - PMAP_LOCK(pm); - l1pd = pm->pm_l1->l1_kva[l1idx]; + if (pmap != kernel_pmap) + PMAP_ASSERT_LOCKED(pmap); + l1idx = L1_IDX(va); + l1pd = pmap->pm_l1->l1_kva[l1idx]; if (l1pte_section_p(l1pd)) { /* - * These should only happen for pmap_kernel() + * These should only happen for the kernel pmap. */ - KASSERT(pm == pmap_kernel(), ("huh")); + KASSERT(pmap == kernel_pmap, ("unexpected section")); /* XXX: what to do about the bits > 32 ? */ if (l1pd & L1_S_SUPERSEC) pa = (l1pd & L1_SUP_FRAME) | (va & L1_SUP_OFFSET); @@ -3671,34 +3692,22 @@ pmap_extract(pmap_t pm, vm_offset_t va) * descriptor as an indication that a mapping exists. * We have to look it up in the L2 dtable. */ - l2 = pm->pm_l2[L2_IDX(l1idx)]; - + l2 = pmap->pm_l2[L2_IDX(l1idx)]; if (l2 == NULL || - (ptep = l2->l2_bucket[L2_BUCKET(l1idx)].l2b_kva) == NULL) { - PMAP_UNLOCK(pm); + (ptep = l2->l2_bucket[L2_BUCKET(l1idx)].l2b_kva) == NULL) return (0); - } - - ptep = &ptep[l2pte_index(va)]; - pte = *ptep; - - if (pte == 0) { - PMAP_UNLOCK(pm); + pte = ptep[l2pte_index(va)]; + if (pte == 0) return (0); - } - switch (pte & L2_TYPE_MASK) { case L2_TYPE_L: pa = (pte & L2_L_FRAME) | (va & L2_L_OFFSET); break; - default: pa = (pte & L2_S_FRAME) | (va & L2_S_OFFSET); break; } } - - PMAP_UNLOCK(pm); return (pa); } Modified: head/sys/arm/include/pmap.h ============================================================================== --- head/sys/arm/include/pmap.h Thu Sep 27 05:26:29 2012 (r240982) +++ head/sys/arm/include/pmap.h Thu Sep 27 05:39:42 2012 (r240983) @@ -92,8 +92,7 @@ enum mem_type { #ifdef _KERNEL -#define vtophys(va) pmap_extract(pmap_kernel(), (vm_offset_t)(va)) -#define pmap_kextract(va) pmap_extract(pmap_kernel(), (vm_offset_t)(va)) +#define vtophys(va) pmap_kextract((vm_offset_t)(va)) #endif @@ -228,6 +227,7 @@ void pmap_kenter(vm_offset_t va, vm_padd void pmap_kenter_nocache(vm_offset_t va, vm_paddr_t pa); void *pmap_kenter_temp(vm_paddr_t pa, int i); void pmap_kenter_user(vm_offset_t va, vm_paddr_t pa); +vm_paddr_t pmap_kextract(vm_offset_t va); void pmap_kremove(vm_offset_t); void *pmap_mapdev(vm_offset_t, vm_size_t); void pmap_unmapdev(vm_offset_t, vm_size_t); From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 06:05:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 719AD1065670; Thu, 27 Sep 2012 06:05:55 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5CF628FC0A; Thu, 27 Sep 2012 06:05:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8R65t8R063763; Thu, 27 Sep 2012 06:05:55 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8R65trH063761; Thu, 27 Sep 2012 06:05:55 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201209270605.q8R65trH063761@svn.freebsd.org> From: Adrian Chadd Date: Thu, 27 Sep 2012 06:05:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240984 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 06:05:55 -0000 Author: adrian Date: Thu Sep 27 06:05:54 2012 New Revision: 240984 URL: http://svn.freebsd.org/changeset/base/240984 Log: Track the last ANI TX/RX sample correctly. This doesn't specifically fix the issue(s) i'm seeing in this 2GHz environment (where setting/increasing spur immunity causes OFDM restart errors to skyrocket through the roof; but leaving it at 0 would leave the environment cleaner..) Pointy-hat-to: me, for committing this broken code in the first place. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c Thu Sep 27 05:39:42 2012 (r240983) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c Thu Sep 27 06:05:54 2012 (r240984) @@ -874,8 +874,8 @@ ar5416AniGetListenTime(struct ath_hal *a */ if (ANI_ENA(ah)) { aniState->cycleCount = AH5416(ah)->ah_cycleCount; - aniState->txFrameCount = AH5416(ah)->ah_rxBusy; - aniState->rxFrameCount = AH5416(ah)->ah_txBusy; + aniState->rxFrameCount = AH5416(ah)->ah_rxBusy; + aniState->txFrameCount = AH5416(ah)->ah_txBusy; } return listenTime; From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 07:13:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27DFF106566C; Thu, 27 Sep 2012 07:13:22 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13F9F8FC14; Thu, 27 Sep 2012 07:13:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8R7DLGj072719; Thu, 27 Sep 2012 07:13:21 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8R7DLA8072717; Thu, 27 Sep 2012 07:13:21 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201209270713.q8R7DLA8072717@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 27 Sep 2012 07:13:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240985 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 07:13:22 -0000 Author: glebius Date: Thu Sep 27 07:13:21 2012 New Revision: 240985 URL: http://svn.freebsd.org/changeset/base/240985 Log: Fix bug in TCP_KEEPCNT setting, which slipped in in the last round of reviewing of r231025. Unlike other options from this family TCP_KEEPCNT doesn't specify time interval, but a count, thus parameter supplied doesn't need to be multiplied by hz. Reported & tested by: amdmi3 Modified: head/sys/netinet/tcp_usrreq.c Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Thu Sep 27 06:05:54 2012 (r240984) +++ head/sys/netinet/tcp_usrreq.c Thu Sep 27 07:13:21 2012 (r240985) @@ -1473,7 +1473,6 @@ unlock_and_done: case TCP_KEEPIDLE: case TCP_KEEPINTVL: - case TCP_KEEPCNT: case TCP_KEEPINIT: INP_WUNLOCK(inp); error = sooptcopyin(sopt, &ui, sizeof(ui), sizeof(ui)); @@ -1506,13 +1505,6 @@ unlock_and_done: tcp_timer_activate(tp, TT_2MSL, TP_MAXIDLE(tp)); break; - case TCP_KEEPCNT: - tp->t_keepcnt = ui; - if ((tp->t_state == TCPS_FIN_WAIT_2) && - (TP_MAXIDLE(tp) > 0)) - tcp_timer_activate(tp, TT_2MSL, - TP_MAXIDLE(tp)); - break; case TCP_KEEPINIT: tp->t_keepinit = ui; if (tp->t_state == TCPS_SYN_RECEIVED || @@ -1523,6 +1515,20 @@ unlock_and_done: } goto unlock_and_done; + case TCP_KEEPCNT: + INP_WUNLOCK(inp); + error = sooptcopyin(sopt, &ui, sizeof(ui), sizeof(ui)); + if (error) + return (error); + + INP_WLOCK_RECHECK(inp); + tp->t_keepcnt = ui; + if ((tp->t_state == TCPS_FIN_WAIT_2) && + (TP_MAXIDLE(tp) > 0)) + tcp_timer_activate(tp, TT_2MSL, + TP_MAXIDLE(tp)); + goto unlock_and_done; + default: INP_WUNLOCK(inp); error = ENOPROTOOPT; From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 08:05:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5267C106564A; Thu, 27 Sep 2012 08:05:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3BF508FC12; Thu, 27 Sep 2012 08:05:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8R850fM079384; Thu, 27 Sep 2012 08:05:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8R850DB079382; Thu, 27 Sep 2012 08:05:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201209270805.q8R850DB079382@svn.freebsd.org> From: Alexander Motin Date: Thu, 27 Sep 2012 08:05:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240986 - stable/9/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 08:05:00 -0000 Author: mav Date: Thu Sep 27 08:04:59 2012 New Revision: 240986 URL: http://svn.freebsd.org/changeset/base/240986 Log: MFC r240884: Fix panic caused by wrong pointer dereference, left after pin sense rewrite at r230551. Also while there, make sense polling use reported for each node separately instead of reporting accumulated total status. Modified: stable/9/sys/dev/sound/pci/hda/hdaa.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- stable/9/sys/dev/sound/pci/hda/hdaa.c Thu Sep 27 07:13:21 2012 (r240985) +++ stable/9/sys/dev/sound/pci/hda/hdaa.c Thu Sep 27 08:04:59 2012 (r240986) @@ -627,7 +627,7 @@ hdaa_sense_init(struct hdaa_devinfo *dev (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) { device_printf(devinfo->dev, "No presence detection support at nid %d\n", - as[i].pins[15]); + w->nid); } else { if (w->unsol < 0) poll = 1; @@ -636,7 +636,7 @@ hdaa_sense_init(struct hdaa_devinfo *dev "Headphones redirection for " "association %d nid=%d using %s.\n", w->bindas, w->nid, - (poll != 0) ? "polling" : + (w->unsol < 0) ? "polling" : "unsolicited responses"); ); }; From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 08:06:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DA6471065678; Thu, 27 Sep 2012 08:06:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5BC78FC17; Thu, 27 Sep 2012 08:06:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8R863RL079557; Thu, 27 Sep 2012 08:06:03 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8R863TO079555; Thu, 27 Sep 2012 08:06:03 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201209270806.q8R863TO079555@svn.freebsd.org> From: Alexander Motin Date: Thu, 27 Sep 2012 08:06:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240987 - stable/8/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 08:06:04 -0000 Author: mav Date: Thu Sep 27 08:06:03 2012 New Revision: 240987 URL: http://svn.freebsd.org/changeset/base/240987 Log: MFC r240884: Fix panic caused by wrong pointer dereference, left after pin sense rewrite at r230551. Also while there, make sense polling use reported for each node separately instead of reporting accumulated total status. Modified: stable/8/sys/dev/sound/pci/hda/hdaa.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/sound/ (props changed) stable/8/sys/dev/sound/pci/ (props changed) Modified: stable/8/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- stable/8/sys/dev/sound/pci/hda/hdaa.c Thu Sep 27 08:04:59 2012 (r240986) +++ stable/8/sys/dev/sound/pci/hda/hdaa.c Thu Sep 27 08:06:03 2012 (r240987) @@ -627,7 +627,7 @@ hdaa_sense_init(struct hdaa_devinfo *dev (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) { device_printf(devinfo->dev, "No presence detection support at nid %d\n", - as[i].pins[15]); + w->nid); } else { if (w->unsol < 0) poll = 1; @@ -636,7 +636,7 @@ hdaa_sense_init(struct hdaa_devinfo *dev "Headphones redirection for " "association %d nid=%d using %s.\n", w->bindas, w->nid, - (poll != 0) ? "polling" : + (w->unsol < 0) ? "polling" : "unsolicited responses"); ); }; From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 08:24:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC32010657AD; Thu, 27 Sep 2012 08:24:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C81878FC14; Thu, 27 Sep 2012 08:24:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8R8OYli081979; Thu, 27 Sep 2012 08:24:34 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8R8OYci081976; Thu, 27 Sep 2012 08:24:34 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201209270824.q8R8OYci081976@svn.freebsd.org> From: Alexander Motin Date: Thu, 27 Sep 2012 08:24:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240988 - releng/9.1/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 08:24:35 -0000 Author: mav Date: Thu Sep 27 08:24:34 2012 New Revision: 240988 URL: http://svn.freebsd.org/changeset/base/240988 Log: MFC r240884: Fix panic caused by wrong pointer dereference, left after pin sense rewrite at r230551. Also while there, make sense polling use reported for each node separately instead of reporting accumulated total status. Approved by: re (kib) Modified: releng/9.1/sys/dev/sound/pci/hda/hdaa.c Directory Properties: releng/9.1/sys/ (props changed) releng/9.1/sys/dev/ (props changed) Modified: releng/9.1/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- releng/9.1/sys/dev/sound/pci/hda/hdaa.c Thu Sep 27 08:06:03 2012 (r240987) +++ releng/9.1/sys/dev/sound/pci/hda/hdaa.c Thu Sep 27 08:24:34 2012 (r240988) @@ -627,7 +627,7 @@ hdaa_sense_init(struct hdaa_devinfo *dev (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) { device_printf(devinfo->dev, "No presence detection support at nid %d\n", - as[i].pins[15]); + w->nid); } else { if (w->unsol < 0) poll = 1; @@ -636,7 +636,7 @@ hdaa_sense_init(struct hdaa_devinfo *dev "Headphones redirection for " "association %d nid=%d using %s.\n", w->bindas, w->nid, - (poll != 0) ? "polling" : + (w->unsol < 0) ? "polling" : "unsolicited responses"); ); }; From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 09:00:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36A7B106564A; Thu, 27 Sep 2012 09:00:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 213468FC0C; Thu, 27 Sep 2012 09:00:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8R90Mml086436; Thu, 27 Sep 2012 09:00:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8R90MJr086434; Thu, 27 Sep 2012 09:00:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209270900.q8R90MJr086434@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 27 Sep 2012 09:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240989 - stable/9/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 09:00:23 -0000 Author: kib Date: Thu Sep 27 09:00:22 2012 New Revision: 240989 URL: http://svn.freebsd.org/changeset/base/240989 Log: MFC r240741: Plug the accounting leak for the wired pages when msync(MS_INVALIDATE) is performed on the vnode mapping which is wired in other address space. Modified: stable/9/sys/vm/vm_object.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_object.c ============================================================================== --- stable/9/sys/vm/vm_object.c Thu Sep 27 08:24:34 2012 (r240988) +++ stable/9/sys/vm/vm_object.c Thu Sep 27 09:00:22 2012 (r240989) @@ -1893,8 +1893,13 @@ again: if ((options & OBJPR_NOTMAPPED) == 0) { pmap_remove_all(p); /* Account for removal of wired mappings. */ - if (wirings != 0) - p->wire_count -= wirings; + if (wirings != 0) { + KASSERT(p->wire_count == wirings, + ("inconsistent wire count %d %d %p", + p->wire_count, wirings, p)); + p->wire_count = 0; + atomic_subtract_int(&cnt.v_wire_count, 1); + } } vm_page_free(p); vm_page_unlock(p); From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 10:30:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85D27106564A; Thu, 27 Sep 2012 10:30:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70BD78FC0C; Thu, 27 Sep 2012 10:30:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RAUC78098105; Thu, 27 Sep 2012 10:30:12 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RAUC6s098102; Thu, 27 Sep 2012 10:30:12 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201209271030.q8RAUC6s098102@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 27 Sep 2012 10:30:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240990 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 10:30:12 -0000 Author: glebius Date: Thu Sep 27 10:30:11 2012 New Revision: 240990 URL: http://svn.freebsd.org/changeset/base/240990 Log: Fix several build failures for !COMPAT_FREEBSD32 and !COMPAT_FREEBSD* kernels introduced by r240981. Pointy hat to: sobomax Modified: head/sys/dev/pci/pci_user.c Modified: head/sys/dev/pci/pci_user.c ============================================================================== --- head/sys/dev/pci/pci_user.c Thu Sep 27 09:00:22 2012 (r240989) +++ head/sys/dev/pci/pci_user.c Thu Sep 27 10:30:11 2012 (r240990) @@ -266,7 +266,7 @@ struct pci_conf_io32 { }; #define PCIOCGETCONF_OLD32 _IOWR('p', 1, struct pci_conf_io32) -#endif +#endif /* COMPAT_FREEBSD32 */ #define PCIOCGETCONF_OLD _IOWR('p', 1, struct pci_conf_io) #define PCIOCREAD_OLD _IOWR('p', 2, struct pci_io_old) @@ -338,6 +338,7 @@ pci_conf_match_old(struct pci_match_conf return(1); } +#ifdef COMPAT_FREEBSD32 static int pci_conf_match_old32(struct pci_match_conf_old32 *matches, int num_matches, struct pci_conf *match_buf) @@ -400,8 +401,8 @@ pci_conf_match_old32(struct pci_match_co return(1); } - -#endif +#endif /* COMPAT_FREEBSD32 */ +#endif /* PRE7_COMPAT */ static int pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) @@ -410,7 +411,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, void *confdata; const char *name; struct devlist *devlist_head; - struct pci_conf_io *cio; + struct pci_conf_io *cio = NULL; struct pci_devinfo *dinfo; struct pci_io *io; struct pci_bar_io *bio; @@ -420,20 +421,16 @@ pci_ioctl(struct cdev *dev, u_long cmd, int error, ionum, i, num_patterns; #ifdef PRE7_COMPAT #ifdef COMPAT_FREEBSD32 - struct pci_conf_io32 *cio32; + struct pci_conf_io32 *cio32 = NULL; + struct pci_conf_old32 conf_old32; + struct pci_match_conf_old32 *pattern_buf_old32; #endif struct pci_conf_old conf_old; - struct pci_conf_old32 conf_old32; struct pci_io iodata; struct pci_io_old *io_old; struct pci_match_conf_old *pattern_buf_old; - struct pci_match_conf_old32 *pattern_buf_old32; - cio = NULL; - cio32 = NULL; io_old = NULL; - pattern_buf_old = NULL; - pattern_buf_old32 = NULL; if (!(flag & FWRITE) && cmd != PCIOCGETBAR && cmd != PCIOCGETCONF && cmd != PCIOCGETCONF_OLD) @@ -445,6 +442,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, switch(cmd) { #ifdef PRE7_COMPAT +#ifdef COMPAT_FREEBSD32 case PCIOCGETCONF_OLD32: cio32 = (struct pci_conf_io32 *)data; cio = malloc(sizeof(struct pci_conf_io), M_TEMP, M_WAITOK); @@ -458,14 +456,24 @@ pci_ioctl(struct cdev *dev, u_long cmd, cio->generation = cio32->generation; cio->status = cio32->status; cio32->num_matches = 0; - /* FALLTHROUGH */ + break; +#endif + case PCIOCGETCONF_OLD: +#endif + case PCIOCGETCONF: + cio = (struct pci_conf_io *)data; + } + switch(cmd) { +#ifdef PRE7_COMPAT +#ifdef COMPAT_FREEBSD32 + case PCIOCGETCONF_OLD32: + pattern_buf_old32 = NULL; +#endif case PCIOCGETCONF_OLD: - /* FALLTHROUGH */ + pattern_buf_old = NULL; #endif case PCIOCGETCONF: - if (cio == NULL) - cio = (struct pci_conf_io *)data; pattern_buf = NULL; num_patterns = 0; @@ -566,19 +574,21 @@ pci_ioctl(struct cdev *dev, u_long cmd, * Allocate a buffer to hold the patterns. */ #ifdef PRE7_COMPAT +#ifdef COMPAT_FREEBSD32 if (cmd == PCIOCGETCONF_OLD32) { pattern_buf_old32 = malloc(cio->pat_buf_len, M_TEMP, M_WAITOK); error = copyin(cio->patterns, pattern_buf_old32, cio->pat_buf_len); } else +#endif /* COMPAT_FREEBSD32 */ if (cmd == PCIOCGETCONF_OLD) { pattern_buf_old = malloc(cio->pat_buf_len, M_TEMP, M_WAITOK); error = copyin(cio->patterns, pattern_buf_old, cio->pat_buf_len); } else -#endif +#endif /* PRE7_COMPAT */ { pattern_buf = malloc(cio->pat_buf_len, M_TEMP, M_WAITOK); @@ -629,11 +639,14 @@ pci_ioctl(struct cdev *dev, u_long cmd, } #ifdef PRE7_COMPAT - if ((cmd == PCIOCGETCONF_OLD32 && - (pattern_buf_old32 == NULL || - pci_conf_match_old32(pattern_buf_old32, - num_patterns, &dinfo->conf) == 0)) || - (cmd == PCIOCGETCONF_OLD && + if ( +#ifdef COMPAT_FREEBSD32 + (cmd == PCIOCGETCONF_OLD32 && + (pattern_buf_old32 == NULL || + pci_conf_match_old32(pattern_buf_old32, + num_patterns, &dinfo->conf) == 0)) || +#endif + (cmd == PCIOCGETCONF_OLD && (pattern_buf_old == NULL || pci_conf_match_old(pattern_buf_old, num_patterns, &dinfo->conf) == 0)) || @@ -658,6 +671,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, break; #ifdef PRE7_COMPAT +#ifdef COMPAT_FREEBSD32 if (cmd == PCIOCGETCONF_OLD32) { conf_old32.pc_sel.pc_bus = dinfo->conf.pc_sel.pc_bus; @@ -690,6 +704,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, (u_int32_t)dinfo->conf.pd_unit; confdata = &conf_old32; } else +#endif /* COMPAT_FREEBSD32 */ if (cmd == PCIOCGETCONF_OLD) { conf_old.pc_sel.pc_bus = dinfo->conf.pc_sel.pc_bus; @@ -722,7 +737,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, dinfo->conf.pd_unit; confdata = &conf_old; } else -#endif +#endif /* PRE7_COMPAT */ confdata = &dinfo->conf; /* Only if we can copy it out do we count it. */ if (!(error = copyout(confdata, @@ -756,25 +771,23 @@ pci_ioctl(struct cdev *dev, u_long cmd, cio->status = PCI_GETCONF_MORE_DEVS; getconfexit: +#ifdef PRE7_COMPAT #ifdef COMPAT_FREEBSD32 if (cmd == PCIOCGETCONF_OLD32) { cio32->status = cio->status; cio32->generation = cio->generation; cio32->offset = cio->offset; cio32->num_matches = cio->num_matches; - if (cio != NULL) - free(cio, M_TEMP); - } + free(cio, M_TEMP); + } + if (pattern_buf_old32 != NULL) + free(pattern_buf_old32, M_TEMP); #endif - - if (pattern_buf != NULL) - free(pattern_buf, M_TEMP); -#ifdef PRE7_COMPAT - if (pattern_buf_old32 != NULL) - free(pattern_buf_old32, M_TEMP); if (pattern_buf_old != NULL) free(pattern_buf_old, M_TEMP); #endif + if (pattern_buf != NULL) + free(pattern_buf, M_TEMP); break; From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 10:41:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FE10106564A; Thu, 27 Sep 2012 10:41:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E48298FC15; Thu, 27 Sep 2012 10:41:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RAfYQA099566; Thu, 27 Sep 2012 10:41:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RAfYJ6099561; Thu, 27 Sep 2012 10:41:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209271041.q8RAfYJ6099561@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 27 Sep 2012 10:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240991 - in stable/8/sys: conf dev/random modules/random X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 10:41:35 -0000 Author: kib Date: Thu Sep 27 10:41:34 2012 New Revision: 240991 URL: http://svn.freebsd.org/changeset/base/240991 Log: MFC r229887 (by jkim): Enable hardware RNG for VIA Nano processors. Modified: stable/8/sys/conf/files.amd64 stable/8/sys/dev/random/probe.c stable/8/sys/modules/random/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/random/ (props changed) stable/8/sys/modules/ (props changed) Modified: stable/8/sys/conf/files.amd64 ============================================================================== --- stable/8/sys/conf/files.amd64 Thu Sep 27 10:30:11 2012 (r240990) +++ stable/8/sys/conf/files.amd64 Thu Sep 27 10:41:34 2012 (r240991) @@ -223,6 +223,7 @@ dev/lindev/lindev.c optional lindev dev/nfe/if_nfe.c optional nfe pci dev/nve/if_nve.c optional nve pci dev/nvram/nvram.c optional nvram isa +dev/random/nehemiah.c optional random dev/sio/sio.c optional sio dev/sio/sio_isa.c optional sio isa dev/sio/sio_pccard.c optional sio pccard Modified: stable/8/sys/dev/random/probe.c ============================================================================== --- stable/8/sys/dev/random/probe.c Thu Sep 27 10:30:11 2012 (r240990) +++ stable/8/sys/dev/random/probe.c Thu Sep 27 10:41:34 2012 (r240991) @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__i386__) && !defined(PC98) +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) #include #include #include @@ -55,7 +55,7 @@ random_ident_hardware(struct random_syst *systat = random_yarrow; /* Then go looking for hardware */ -#if defined(__i386__) && !defined(PC98) +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) if (via_feature_rng & VIA_HAS_RNG) { *systat = random_nehemiah; } Modified: stable/8/sys/modules/random/Makefile ============================================================================== --- stable/8/sys/modules/random/Makefile Thu Sep 27 10:30:11 2012 (r240990) +++ stable/8/sys/modules/random/Makefile Thu Sep 27 10:41:34 2012 (r240991) @@ -6,7 +6,7 @@ KMOD= random SRCS= randomdev.c probe.c -.if ${MACHINE} == "i386" +.if ${MACHINE} == "amd64" || ${MACHINE} == "i386" SRCS+= nehemiah.c .endif SRCS+= randomdev_soft.c yarrow.c hash.c From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 10:46:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B94B106566C; Thu, 27 Sep 2012 10:46:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64C168FC08; Thu, 27 Sep 2012 10:46:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RAkNgT000387; Thu, 27 Sep 2012 10:46:23 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RAkNsf000385; Thu, 27 Sep 2012 10:46:23 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201209271046.q8RAkNsf000385@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 27 Sep 2012 10:46:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240992 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 10:46:23 -0000 Author: glebius Date: Thu Sep 27 10:46:22 2012 New Revision: 240992 URL: http://svn.freebsd.org/changeset/base/240992 Log: Fix zillions of style(9) and spacing bugs introduced by r240981. Pointy hat to: sobomax Modified: head/sys/dev/pci/pci_user.c Modified: head/sys/dev/pci/pci_user.c ============================================================================== --- head/sys/dev/pci/pci_user.c Thu Sep 27 10:41:34 2012 (r240991) +++ head/sys/dev/pci/pci_user.c Thu Sep 27 10:46:22 2012 (r240992) @@ -227,45 +227,47 @@ struct pci_io_old { #ifdef COMPAT_FREEBSD32 struct pci_conf_old32 { - struct pcisel_old pc_sel; /* bus+slot+function */ - u_int8_t pc_hdr; /* PCI header type */ - u_int16_t pc_subvendor; /* card vendor ID */ - u_int16_t pc_subdevice; /* card device ID, assigned by - card vendor */ - u_int16_t pc_vendor; /* chip vendor ID */ - u_int16_t pc_device; /* chip device ID, assigned by - chip vendor */ - u_int8_t pc_class; /* chip PCI class */ - u_int8_t pc_subclass; /* chip PCI subclass */ - u_int8_t pc_progif; /* chip PCI programming interface */ - u_int8_t pc_revid; /* chip revision ID */ - char pd_name[PCI_MAXNAMELEN + 1]; /* device name */ - u_int32_t pd_unit; /* device unit number (u_long) */ + struct pcisel_old pc_sel; /* bus+slot+function */ + uint8_t pc_hdr; /* PCI header type */ + uint16_t pc_subvendor; /* card vendor ID */ + uint16_t pc_subdevice; /* card device ID, assigned by + card vendor */ + uint16_t pc_vendor; /* chip vendor ID */ + uint16_t pc_device; /* chip device ID, assigned by + chip vendor */ + uint8_t pc_class; /* chip PCI class */ + uint8_t pc_subclass; /* chip PCI subclass */ + uint8_t pc_progif; /* chip PCI programming interface */ + uint8_t pc_revid; /* chip revision ID */ + char pd_name[PCI_MAXNAMELEN + 1]; /* device name */ + uint32_t pd_unit; /* device unit number (u_long) */ }; struct pci_match_conf_old32 { - struct pcisel_old pc_sel; /* bus+slot+function */ - char pd_name[PCI_MAXNAMELEN + 1]; /* device name */ - u_int32_t pd_unit; /* Unit number (u_long) */ - u_int16_t pc_vendor; /* PCI Vendor ID */ - u_int16_t pc_device; /* PCI Device ID */ - u_int8_t pc_class; /* PCI class */ - pci_getconf_flags_old flags; /* Matching expression */ + struct pcisel_old pc_sel; /* bus+slot+function */ + char pd_name[PCI_MAXNAMELEN + 1]; /* device name */ + uint32_t pd_unit; /* Unit number (u_long) */ + uint16_t pc_vendor; /* PCI Vendor ID */ + uint16_t pc_device; /* PCI Device ID */ + uint8_t pc_class; /* PCI class */ + pci_getconf_flags_old flags; /* Matching expression */ }; struct pci_conf_io32 { - u_int32_t pat_buf_len; /* pattern buffer length */ - u_int32_t num_patterns; /* number of patterns */ - u_int32_t patterns; /* pattern buffer (struct pci_match_conf_old32 *) */ - u_int32_t match_buf_len; /* match buffer length */ - u_int32_t num_matches; /* number of matches returned */ - u_int32_t matches; /* match buffer (struct pci_conf_old32 *) */ - u_int32_t offset; /* offset into device list */ - u_int32_t generation; /* device list generation */ - pci_getconf_status status; /* request status */ + uint32_t pat_buf_len; /* pattern buffer length */ + uint32_t num_patterns; /* number of patterns */ + uint32_t patterns; /* pattern buffer + (struct pci_match_conf_old32 *) */ + uint32_t match_buf_len; /* match buffer length */ + uint32_t num_matches; /* number of matches returned */ + uint32_t matches; /* match buffer + (struct pci_conf_old32 *) */ + uint32_t offset; /* offset into device list */ + uint32_t generation; /* device list generation */ + pci_getconf_status status; /* request status */ }; -#define PCIOCGETCONF_OLD32 _IOWR('p', 1, struct pci_conf_io32) +#define PCIOCGETCONF_OLD32 _IOWR('p', 1, struct pci_conf_io32) #endif /* COMPAT_FREEBSD32 */ #define PCIOCGETCONF_OLD _IOWR('p', 1, struct pci_conf_io) @@ -343,63 +345,63 @@ static int pci_conf_match_old32(struct pci_match_conf_old32 *matches, int num_matches, struct pci_conf *match_buf) { - int i; + int i; + + if ((matches == NULL) || (match_buf == NULL) || (num_matches <= 0)) + return(1); + + for (i = 0; i < num_matches; i++) { + if (match_buf->pc_sel.pc_domain != 0) + continue; + + /* + * I'm not sure why someone would do this...but... + */ + if (matches[i].flags == PCI_GETCONF_NO_MATCH_OLD) + continue; - if ((matches == NULL) || (match_buf == NULL) || (num_matches <= 0)) - return(1); + /* + * Look at each of the match flags. If it's set, do the + * comparison. If the comparison fails, we don't have a + * match, go on to the next item if there is one. + */ + if (((matches[i].flags & PCI_GETCONF_MATCH_BUS_OLD) != 0) && + (match_buf->pc_sel.pc_bus != matches[i].pc_sel.pc_bus)) + continue; + + if (((matches[i].flags & PCI_GETCONF_MATCH_DEV_OLD) != 0) && + (match_buf->pc_sel.pc_dev != matches[i].pc_sel.pc_dev)) + continue; + + if (((matches[i].flags & PCI_GETCONF_MATCH_FUNC_OLD) != 0) && + (match_buf->pc_sel.pc_func != matches[i].pc_sel.pc_func)) + continue; - for (i = 0; i < num_matches; i++) { - if (match_buf->pc_sel.pc_domain != 0) - continue; - - /* - * I'm not sure why someone would do this...but... - */ - if (matches[i].flags == PCI_GETCONF_NO_MATCH_OLD) - continue; - - /* - * Look at each of the match flags. If it's set, do the - * comparison. If the comparison fails, we don't have a - * match, go on to the next item if there is one. - */ - if (((matches[i].flags & PCI_GETCONF_MATCH_BUS_OLD) != 0) - && (match_buf->pc_sel.pc_bus != matches[i].pc_sel.pc_bus)) - continue; - - if (((matches[i].flags & PCI_GETCONF_MATCH_DEV_OLD) != 0) - && (match_buf->pc_sel.pc_dev != matches[i].pc_sel.pc_dev)) - continue; - - if (((matches[i].flags & PCI_GETCONF_MATCH_FUNC_OLD) != 0) - && (match_buf->pc_sel.pc_func != matches[i].pc_sel.pc_func)) - continue; - - if (((matches[i].flags & PCI_GETCONF_MATCH_VENDOR_OLD) != 0) - && (match_buf->pc_vendor != matches[i].pc_vendor)) - continue; - - if (((matches[i].flags & PCI_GETCONF_MATCH_DEVICE_OLD) != 0) - && (match_buf->pc_device != matches[i].pc_device)) - continue; - - if (((matches[i].flags & PCI_GETCONF_MATCH_CLASS_OLD) != 0) - && (match_buf->pc_class != matches[i].pc_class)) - continue; - - if (((matches[i].flags & PCI_GETCONF_MATCH_UNIT_OLD) != 0) - && ((u_int32_t)match_buf->pd_unit != matches[i].pd_unit)) - continue; - - if (((matches[i].flags & PCI_GETCONF_MATCH_NAME_OLD) != 0) - && (strncmp(matches[i].pd_name, match_buf->pd_name, - sizeof(match_buf->pd_name)) != 0)) - continue; + if (((matches[i].flags & PCI_GETCONF_MATCH_VENDOR_OLD) != 0) && + (match_buf->pc_vendor != matches[i].pc_vendor)) + continue; - return(0); - } + if (((matches[i].flags & PCI_GETCONF_MATCH_DEVICE_OLD) != 0) && + (match_buf->pc_device != matches[i].pc_device)) + continue; + + if (((matches[i].flags & PCI_GETCONF_MATCH_CLASS_OLD) != 0) && + (match_buf->pc_class != matches[i].pc_class)) + continue; - return(1); + if (((matches[i].flags & PCI_GETCONF_MATCH_UNIT_OLD) != 0) && + ((u_int32_t)match_buf->pd_unit != matches[i].pd_unit)) + continue; + + if (((matches[i].flags & PCI_GETCONF_MATCH_NAME_OLD) != 0) && + (strncmp(matches[i].pd_name, match_buf->pd_name, + sizeof(match_buf->pd_name)) != 0)) + continue; + + return (0); + } + + return (1); } #endif /* COMPAT_FREEBSD32 */ #endif /* PRE7_COMPAT */ @@ -491,7 +493,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, && (cio->generation != pci_generation)){ cio->status = PCI_GETCONF_LIST_CHANGED; error = 0; - goto getconfexit; + goto getconfexit; } /* @@ -501,7 +503,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, if (cio->offset >= pci_numdevs) { cio->status = PCI_GETCONF_LAST_DEVICE; error = 0; - goto getconfexit; + goto getconfexit; } /* get the head of the device queue */ @@ -515,9 +517,9 @@ pci_ioctl(struct cdev *dev, u_long cmd, */ #ifdef PRE7_COMPAT #ifdef COMPAT_FREEBSD32 - if (cmd == PCIOCGETCONF_OLD32) - confsz = sizeof(struct pci_conf_old32); - else + if (cmd == PCIOCGETCONF_OLD32) + confsz = sizeof(struct pci_conf_old32); + else #endif if (cmd == PCIOCGETCONF_OLD) confsz = sizeof(struct pci_conf_old); @@ -554,9 +556,9 @@ pci_ioctl(struct cdev *dev, u_long cmd, */ #ifdef PRE7_COMPAT #ifdef COMPAT_FREEBSD32 - if (cmd == PCIOCGETCONF_OLD32) - pbufsz = sizeof(struct pci_match_conf_old32); - else + if (cmd == PCIOCGETCONF_OLD32) + pbufsz = sizeof(struct pci_match_conf_old32); + else #endif if (cmd == PCIOCGETCONF_OLD) pbufsz = sizeof(struct pci_match_conf_old); @@ -567,7 +569,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, /* The user made a mistake, return an error. */ cio->status = PCI_GETCONF_ERROR; error = EINVAL; - goto getconfexit; + goto getconfexit; } /* @@ -575,12 +577,12 @@ pci_ioctl(struct cdev *dev, u_long cmd, */ #ifdef PRE7_COMPAT #ifdef COMPAT_FREEBSD32 - if (cmd == PCIOCGETCONF_OLD32) { - pattern_buf_old32 = malloc(cio->pat_buf_len, - M_TEMP, M_WAITOK); - error = copyin(cio->patterns, - pattern_buf_old32, cio->pat_buf_len); - } else + if (cmd == PCIOCGETCONF_OLD32) { + pattern_buf_old32 = malloc(cio->pat_buf_len, + M_TEMP, M_WAITOK); + error = copyin(cio->patterns, + pattern_buf_old32, cio->pat_buf_len); + } else #endif /* COMPAT_FREEBSD32 */ if (cmd == PCIOCGETCONF_OLD) { pattern_buf_old = malloc(cio->pat_buf_len, @@ -672,38 +674,38 @@ pci_ioctl(struct cdev *dev, u_long cmd, #ifdef PRE7_COMPAT #ifdef COMPAT_FREEBSD32 - if (cmd == PCIOCGETCONF_OLD32) { - conf_old32.pc_sel.pc_bus = - dinfo->conf.pc_sel.pc_bus; - conf_old32.pc_sel.pc_dev = - dinfo->conf.pc_sel.pc_dev; - conf_old32.pc_sel.pc_func = - dinfo->conf.pc_sel.pc_func; - conf_old32.pc_hdr = dinfo->conf.pc_hdr; - conf_old32.pc_subvendor = - dinfo->conf.pc_subvendor; - conf_old32.pc_subdevice = - dinfo->conf.pc_subdevice; - conf_old32.pc_vendor = - dinfo->conf.pc_vendor; - conf_old32.pc_device = - dinfo->conf.pc_device; - conf_old32.pc_class = - dinfo->conf.pc_class; - conf_old32.pc_subclass = - dinfo->conf.pc_subclass; - conf_old32.pc_progif = - dinfo->conf.pc_progif; - conf_old32.pc_revid = - dinfo->conf.pc_revid; - strncpy(conf_old32.pd_name, - dinfo->conf.pd_name, - sizeof(conf_old32.pd_name)); - conf_old32.pd_name[PCI_MAXNAMELEN] = 0; - conf_old32.pd_unit = - (u_int32_t)dinfo->conf.pd_unit; - confdata = &conf_old32; - } else + if (cmd == PCIOCGETCONF_OLD32) { + conf_old32.pc_sel.pc_bus = + dinfo->conf.pc_sel.pc_bus; + conf_old32.pc_sel.pc_dev = + dinfo->conf.pc_sel.pc_dev; + conf_old32.pc_sel.pc_func = + dinfo->conf.pc_sel.pc_func; + conf_old32.pc_hdr = dinfo->conf.pc_hdr; + conf_old32.pc_subvendor = + dinfo->conf.pc_subvendor; + conf_old32.pc_subdevice = + dinfo->conf.pc_subdevice; + conf_old32.pc_vendor = + dinfo->conf.pc_vendor; + conf_old32.pc_device = + dinfo->conf.pc_device; + conf_old32.pc_class = + dinfo->conf.pc_class; + conf_old32.pc_subclass = + dinfo->conf.pc_subclass; + conf_old32.pc_progif = + dinfo->conf.pc_progif; + conf_old32.pc_revid = + dinfo->conf.pc_revid; + strncpy(conf_old32.pd_name, + dinfo->conf.pd_name, + sizeof(conf_old32.pd_name)); + conf_old32.pd_name[PCI_MAXNAMELEN] = 0; + conf_old32.pd_unit = + (uint32_t)dinfo->conf.pd_unit; + confdata = &conf_old32; + } else #endif /* COMPAT_FREEBSD32 */ if (cmd == PCIOCGETCONF_OLD) { conf_old.pc_sel.pc_bus = @@ -773,11 +775,11 @@ pci_ioctl(struct cdev *dev, u_long cmd, getconfexit: #ifdef PRE7_COMPAT #ifdef COMPAT_FREEBSD32 - if (cmd == PCIOCGETCONF_OLD32) { - cio32->status = cio->status; - cio32->generation = cio->generation; - cio32->offset = cio->offset; - cio32->num_matches = cio->num_matches; + if (cmd == PCIOCGETCONF_OLD32) { + cio32->status = cio->status; + cio32->generation = cio->generation; + cio32->offset = cio->offset; + cio32->num_matches = cio->num_matches; free(cio, M_TEMP); } if (pattern_buf_old32 != NULL) From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 10:51:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E96B0106564A; Thu, 27 Sep 2012 10:51:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D323F8FC14; Thu, 27 Sep 2012 10:51:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RApcxg002955; Thu, 27 Sep 2012 10:51:38 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RApcmq002950; Thu, 27 Sep 2012 10:51:38 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201209271051.q8RApcmq002950@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 27 Sep 2012 10:51:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240993 - head/sys/cam/ctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 10:51:39 -0000 Author: trasz Date: Thu Sep 27 10:51:38 2012 New Revision: 240993 URL: http://svn.freebsd.org/changeset/base/240993 Log: Remove useless NULL checks after M_WAITOK allocations. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Sep 27 10:46:22 2012 (r240992) +++ head/sys/cam/ctl/ctl.c Thu Sep 27 10:51:38 2012 (r240993) @@ -1520,12 +1520,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio ext_sglist = (struct ctl_sg_entry *)malloc(ext_sglen, M_CTL, M_WAITOK); - if (ext_sglist == NULL) { - ctl_set_internal_failure(ctsio, - /*sks_valid*/ 0, - /*retry_count*/ 0); - return (CTL_RETVAL_COMPLETE); - } ext_sglist_malloced = 1; if (copyin(ctsio->ext_data_ptr, ext_sglist, ext_sglen) != 0) { @@ -2028,11 +2022,6 @@ ctl_copyin_alloc(void *user_addr, int le void *kptr; kptr = malloc(len, M_CTL, M_WAITOK | M_ZERO); - if (kptr == NULL) { - snprintf(error_str, error_str_len, "Cannot allocate %d bytes", - len); - return (NULL); - } if (copyin(user_addr, kptr, len) != 0) { snprintf(error_str, error_str_len, "Error copying %d bytes " @@ -2764,12 +2753,6 @@ ctl_ioctl(struct cdev *dev, u_long cmd, new_err_desc = malloc(sizeof(*new_err_desc), M_CTL, M_WAITOK | M_ZERO); - if (new_err_desc == NULL) { - printf("%s: CTL_ERROR_INJECT: error allocating %zu " - "bytes\n", __func__, sizeof(*new_err_desc)); - retval = ENOMEM; - break; - } bcopy(err_desc, new_err_desc, sizeof(*new_err_desc)); mtx_lock(&softc->ctl_lock); @@ -4203,11 +4186,6 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft } if (ctl_lun == NULL) { lun = malloc(sizeof(*lun), M_CTL, M_WAITOK); - if (lun == NULL) { - be_lun->lun_config_status(lun->be_lun->be_lun, - CTL_LUN_CONFIG_FAILURE); - return (-ENOMEM); - } lun->flags = CTL_LUN_MALLOCED; } else lun = ctl_lun; @@ -5061,12 +5039,6 @@ ctl_scsi_release(struct ctl_scsiio *ctsi if (((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) && (length > 0)) { ctsio->kern_data_ptr = malloc(length, M_CTL, M_WAITOK); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->io_hdr.status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } ctsio->kern_data_len = length; ctsio->kern_total_len = length; ctsio->kern_data_resid = 0; @@ -5202,12 +5174,6 @@ ctl_scsi_reserve(struct ctl_scsiio *ctsi if (((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) && (length > 0)) { ctsio->kern_data_ptr = malloc(length, M_CTL, M_WAITOK); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->io_hdr.status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } ctsio->kern_data_len = length; ctsio->kern_total_len = length; ctsio->kern_data_resid = 0; @@ -5573,12 +5539,6 @@ ctl_format(struct ctl_scsiio *ctsio) if (((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) && (length > 0)) { ctsio->kern_data_ptr = malloc(length, M_CTL, M_WAITOK); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->io_hdr.status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } ctsio->kern_data_len = length; ctsio->kern_total_len = length; ctsio->kern_data_resid = 0; @@ -6368,11 +6328,6 @@ ctl_mode_select(struct ctl_scsiio *ctsio */ if ((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) { ctsio->kern_data_ptr = malloc(param_len, M_CTL, M_WAITOK); - if (ctsio->kern_data_ptr == NULL) { - ctl_set_busy(ctsio); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } ctsio->kern_data_len = param_len; ctsio->kern_total_len = param_len; ctsio->kern_data_resid = 0; @@ -6607,12 +6562,6 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) #endif ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->scsi_status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } ctsio->kern_sg_entries = 0; ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; @@ -6794,12 +6743,6 @@ ctl_read_capacity(struct ctl_scsiio *cts lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->scsi_status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } data = (struct scsi_read_capacity_data *)ctsio->kern_data_ptr; ctsio->residual = 0; ctsio->kern_data_len = sizeof(*data); @@ -6864,12 +6807,6 @@ ctl_read_capacity_16(struct ctl_scsiio * lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->scsi_status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } data = (struct scsi_read_capacity_data_long *)ctsio->kern_data_ptr; if (sizeof(*data) < alloc_len) { @@ -6977,12 +6914,6 @@ ctl_maintenance_in(struct ctl_scsiio *ct alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->scsi_status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } memset(ctsio->kern_data_ptr, 0, total_len); ctsio->kern_sg_entries = 0; @@ -7138,12 +7069,6 @@ retry: mtx_unlock(&softc->ctl_lock); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->scsi_status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } if (total_len < alloc_len) { ctsio->residual = alloc_len - total_len; @@ -7876,11 +7801,6 @@ ctl_persistent_reserve_out(struct ctl_sc if ((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) { ctsio->kern_data_ptr = malloc(param_len, M_CTL, M_WAITOK); - if (ctsio->kern_data_ptr == NULL) { - ctl_set_busy(ctsio); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } ctsio->kern_data_len = param_len; ctsio->kern_total_len = param_len; ctsio->kern_data_resid = 0; @@ -8692,13 +8612,6 @@ ctl_report_luns(struct ctl_scsiio *ctsio (num_luns * sizeof(struct scsi_report_luns_lundata)); ctsio->kern_data_ptr = malloc(lun_datalen, M_CTL, M_WAITOK); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->scsi_status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - lun_data = (struct scsi_report_luns_data *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -8821,12 +8734,6 @@ ctl_request_sense(struct ctl_scsiio *cts sense_format = SSD_TYPE_FIXED; ctsio->kern_data_ptr = malloc(sizeof(*sense_ptr), M_CTL, M_WAITOK); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->scsi_status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } sense_ptr = (struct scsi_sense_data *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Thu Sep 27 10:46:22 2012 (r240992) +++ head/sys/cam/ctl/ctl_backend_block.c Thu Sep 27 10:51:38 2012 (r240993) @@ -376,9 +376,6 @@ ctl_grow_beio(struct ctl_be_block_softc beio = (struct ctl_be_block_io *)malloc(sizeof(*beio), M_CTLBLK, M_WAITOK | M_ZERO); - if (beio == NULL) - break; - bzero(beio, sizeof(*beio)); beio->softc = softc; mtx_lock(&softc->lock); @@ -1092,15 +1089,6 @@ ctl_be_block_dispatch(struct ctl_be_bloc */ beio->sg_segs[i].len = min(MAXPHYS, len_left); beio->sg_segs[i].addr = uma_zalloc(be_lun->lun_zone, M_WAITOK); - /* - * uma_zalloc() can in theory return NULL even with M_WAITOK - * if it can't pull more memory into the zone. - */ - if (beio->sg_segs[i].addr == NULL) { - ctl_set_busy(&io->scsiio); - ctl_complete_beio(beio); - return; - } DPRINTF("segment %d addr %p len %zd\n", i, beio->sg_segs[i].addr, beio->sg_segs[i].len); @@ -1660,13 +1648,6 @@ ctl_be_block_create(struct ctl_be_block_ be_lun = malloc(sizeof(*be_lun), M_CTLBLK, M_ZERO | M_WAITOK); - if (be_lun == NULL) { - snprintf(req->error_str, sizeof(req->error_str), - "%s: error allocating %zd bytes", __func__, - sizeof(*be_lun)); - goto bailout_error; - } - be_lun->softc = softc; STAILQ_INIT(&be_lun->input_queue); STAILQ_INIT(&be_lun->config_write_queue); @@ -1705,12 +1686,6 @@ ctl_be_block_create(struct ctl_be_block_ be_lun->dev_path = malloc(file_arg->vallen, M_CTLBLK, M_WAITOK | M_ZERO); - if (be_lun->dev_path == NULL) { - snprintf(req->error_str, sizeof(req->error_str), - "%s: error allocating %d bytes", __func__, - file_arg->vallen); - goto bailout_error; - } strlcpy(be_lun->dev_path, (char *)file_arg->value, file_arg->vallen); Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Thu Sep 27 10:46:22 2012 (r240992) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Thu Sep 27 10:51:38 2012 (r240993) @@ -134,7 +134,7 @@ ctl_backend_ramdisk_init(void) { struct ctl_be_ramdisk_softc *softc; #ifdef CTL_RAMDISK_PAGES - int i, j; + int i; #endif @@ -151,17 +151,8 @@ ctl_backend_ramdisk_init(void) softc->ramdisk_pages = (uint8_t **)malloc(sizeof(uint8_t *) * softc->num_pages, M_RAMDISK, M_WAITOK); - for (i = 0; i < softc->num_pages; i++) { + for (i = 0; i < softc->num_pages; i++) softc->ramdisk_pages[i] = malloc(PAGE_SIZE, M_RAMDISK,M_WAITOK); - if (softc->ramdisk_pages[i] == NULL) { - for (j = 0; j < i; j++) { - free(softc->ramdisk_pages[j], M_RAMDISK); - } - free(softc->ramdisk_pages, M_RAMDISK); - panic("RAMDisk initialization failed\n"); - return (1); /* NOTREACHED */ - } - } #else softc->ramdisk_buffer = (uint8_t *)malloc(softc->rd_size, M_RAMDISK, M_WAITOK); @@ -313,13 +304,6 @@ ctl_backend_ramdisk_submit(union ctl_io io->scsiio.kern_data_ptr = malloc(sizeof(struct ctl_sg_entry) * num_sg_entries, M_RAMDISK, M_WAITOK); - if (io->scsiio.kern_data_ptr == NULL) { - ctl_set_internal_failure(&io->scsiio, - /*sks_valid*/ 0, - /*retry_count*/ 0); - ctl_done(io); - return (CTL_RETVAL_COMPLETE); - } sg_entries = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr; for (i = 0, len_filled = 0; i < num_sg_entries; i++, len_filled += PAGE_SIZE) { Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Thu Sep 27 10:46:22 2012 (r240992) +++ head/sys/cam/ctl/scsi_ctl.c Thu Sep 27 10:51:38 2012 (r240993) @@ -1694,11 +1694,6 @@ ctlfe_onoffline(void *arg, int online) return; } ccb = (union ccb *)malloc(sizeof(*ccb), M_TEMP, M_WAITOK | M_ZERO); - if (ccb == NULL) { - printf("%s: unable to malloc CCB!\n", __func__); - xpt_free_path(path); - return; - } xpt_setup_ccb(&ccb->ccb_h, path, /*priority*/ 1); sim = xpt_path_sim(path); @@ -1900,12 +1895,6 @@ ctlfe_lun_enable(void *arg, struct ctl_i } softc = malloc(sizeof(*softc), M_CTLFE, M_WAITOK | M_ZERO); - if (softc == NULL) { - printf("%s: could not allocate %zd bytes for softc\n", - __func__, sizeof(*softc)); - xpt_free_path(path); - return (1); - } sim = xpt_path_sim(path); mtx_lock(sim->mtx); periph = cam_periph_find(path, "ctl"); From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 10:56:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB931106564A; Thu, 27 Sep 2012 10:56:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 943918FC0C; Thu, 27 Sep 2012 10:56:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RAuQc6003623; Thu, 27 Sep 2012 10:56:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RAuQt1003611; Thu, 27 Sep 2012 10:56:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209271056.q8RAuQt1003611@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 27 Sep 2012 10:56:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240994 - in stable/8/sys: amd64/conf conf dev/random i386/conf modules/random X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 10:56:26 -0000 Author: kib Date: Thu Sep 27 10:56:25 2012 New Revision: 240994 URL: http://svn.freebsd.org/changeset/base/240994 Log: MFC r240135: Add support for new Intel on-CPU Bull Mountain random number generator. MFC r240455: Rename the IVY_RNG option to RDRAND_RNG. Added: stable/8/sys/dev/random/ivy.c - copied, changed from r240135, head/sys/dev/random/ivy.c Deleted: stable/8/sys/dev/random/nehemiah.h Modified: stable/8/sys/amd64/conf/GENERIC stable/8/sys/conf/files.amd64 stable/8/sys/conf/files.i386 stable/8/sys/conf/options.amd64 stable/8/sys/conf/options.i386 stable/8/sys/dev/random/nehemiah.c stable/8/sys/dev/random/probe.c stable/8/sys/i386/conf/GENERIC stable/8/sys/modules/random/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/ (props changed) stable/8/sys/conf/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/random/ (props changed) stable/8/sys/i386/ (props changed) stable/8/sys/modules/ (props changed) Modified: stable/8/sys/amd64/conf/GENERIC ============================================================================== --- stable/8/sys/amd64/conf/GENERIC Thu Sep 27 10:51:38 2012 (r240993) +++ stable/8/sys/amd64/conf/GENERIC Thu Sep 27 10:56:25 2012 (r240994) @@ -271,6 +271,8 @@ device wi # WaveLAN/Intersil/Symbol 80 # Pseudo devices. device loop # Network loopback device random # Entropy device +options PADLOCK_RNG # VIA Padlock RNG +options RDRAND_RNG # Intel Bull Mountain RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. Modified: stable/8/sys/conf/files.amd64 ============================================================================== --- stable/8/sys/conf/files.amd64 Thu Sep 27 10:51:38 2012 (r240993) +++ stable/8/sys/conf/files.amd64 Thu Sep 27 10:56:25 2012 (r240994) @@ -223,7 +223,8 @@ dev/lindev/lindev.c optional lindev dev/nfe/if_nfe.c optional nfe pci dev/nve/if_nve.c optional nve pci dev/nvram/nvram.c optional nvram isa -dev/random/nehemiah.c optional random +dev/random/ivy.c optional random rdrand_rng +dev/random/nehemiah.c optional random padlock_rng dev/sio/sio.c optional sio dev/sio/sio_isa.c optional sio isa dev/sio/sio_pccard.c optional sio pccard Modified: stable/8/sys/conf/files.i386 ============================================================================== --- stable/8/sys/conf/files.i386 Thu Sep 27 10:51:38 2012 (r240993) +++ stable/8/sys/conf/files.i386 Thu Sep 27 10:56:25 2012 (r240994) @@ -223,7 +223,8 @@ dev/nfe/if_nfe.c optional nfe pci dev/nve/if_nve.c optional nve pci dev/nvram/nvram.c optional nvram isa dev/pcf/pcf_isa.c optional pcf -dev/random/nehemiah.c optional random +dev/random/ivy.c optional random rdrand_rng +dev/random/nehemiah.c optional random padlock_rng dev/sbni/if_sbni.c optional sbni dev/sbni/if_sbni_isa.c optional sbni isa dev/sbni/if_sbni_pci.c optional sbni pci Modified: stable/8/sys/conf/options.amd64 ============================================================================== --- stable/8/sys/conf/options.amd64 Thu Sep 27 10:51:38 2012 (r240993) +++ stable/8/sys/conf/options.amd64 Thu Sep 27 10:56:25 2012 (r240994) @@ -67,3 +67,7 @@ XENHVM opt_global.h # options for the Intel C600 SAS driver (isci) ISCI_LOGGING opt_isci.h + +# hw random number generators for random(4) +PADLOCK_RNG opt_cpu.h +RDRAND_RNG opt_cpu.h Modified: stable/8/sys/conf/options.i386 ============================================================================== --- stable/8/sys/conf/options.i386 Thu Sep 27 10:51:38 2012 (r240993) +++ stable/8/sys/conf/options.i386 Thu Sep 27 10:56:25 2012 (r240994) @@ -124,3 +124,7 @@ XENHVM opt_global.h # options for the Intel C600 SAS driver (isci) ISCI_LOGGING opt_isci.h + +# hw random number generators for random(4) +PADLOCK_RNG opt_cpu.h +RDRAND_RNG opt_cpu.h Copied and modified: stable/8/sys/dev/random/ivy.c (from r240135, head/sys/dev/random/ivy.c) ============================================================================== --- head/sys/dev/random/ivy.c Wed Sep 5 13:18:51 2012 (r240135, copy source) +++ stable/8/sys/dev/random/ivy.c Thu Sep 27 10:56:25 2012 (r240994) @@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$"); #include "opt_cpu.h" -#ifdef IVY_RNG +#ifdef RDRAND_RNG #include #include Modified: stable/8/sys/dev/random/nehemiah.c ============================================================================== --- stable/8/sys/dev/random/nehemiah.c Thu Sep 27 10:51:38 2012 (r240993) +++ stable/8/sys/dev/random/nehemiah.c Thu Sep 27 10:56:25 2012 (r240994) @@ -28,6 +28,10 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_cpu.h" + +#ifdef PADLOCK_RNG + #include #include #include @@ -203,3 +207,5 @@ random_nehemiah_read(void *buf, int c) mtx_unlock(&random_nehemiah_mtx); return (c); } + +#endif Modified: stable/8/sys/dev/random/probe.c ============================================================================== --- stable/8/sys/dev/random/probe.c Thu Sep 27 10:51:38 2012 (r240993) +++ stable/8/sys/dev/random/probe.c Thu Sep 27 10:56:25 2012 (r240994) @@ -28,12 +28,17 @@ #include __FBSDID("$FreeBSD$"); +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#include "opt_cpu.h" +#endif + #include #include +#include +#include #include #include #include -#include #include #if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) @@ -45,7 +50,15 @@ __FBSDID("$FreeBSD$"); #include #include -#include + +#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#ifdef PADLOCK_RNG +extern struct random_systat random_nehemiah; +#endif +#ifdef RDRAND_RNG +extern struct random_systat random_ivy; +#endif +#endif void random_ident_hardware(struct random_systat *systat) @@ -56,8 +69,25 @@ random_ident_hardware(struct random_syst /* Then go looking for hardware */ #if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#ifdef PADLOCK_RNG if (via_feature_rng & VIA_HAS_RNG) { - *systat = random_nehemiah; + int enable; + + enable = 1; + TUNABLE_INT_FETCH("hw.nehemiah_rng_enable", &enable); + if (enable) + *systat = random_nehemiah; } #endif +#ifdef RDRAND_RNG + if (cpu_feature2 & CPUID2_RDRAND) { + int enable; + + enable = 1; + TUNABLE_INT_FETCH("hw.ivy_rng_enable", &enable); + if (enable) + *systat = random_ivy; + } +#endif +#endif } Modified: stable/8/sys/i386/conf/GENERIC ============================================================================== --- stable/8/sys/i386/conf/GENERIC Thu Sep 27 10:51:38 2012 (r240993) +++ stable/8/sys/i386/conf/GENERIC Thu Sep 27 10:56:25 2012 (r240994) @@ -284,6 +284,8 @@ device wi # WaveLAN/Intersil/Symbol 80 # Pseudo devices. device loop # Network loopback device random # Entropy device +options PADLOCK_RNG # VIA Padlock RNG +options RDRAND_RNG # Intel Bull Mountain RNG device ether # Ethernet support device vlan # 802.1Q VLAN support device tun # Packet tunnel. Modified: stable/8/sys/modules/random/Makefile ============================================================================== --- stable/8/sys/modules/random/Makefile Thu Sep 27 10:51:38 2012 (r240993) +++ stable/8/sys/modules/random/Makefile Thu Sep 27 10:56:25 2012 (r240994) @@ -8,10 +8,11 @@ KMOD= random SRCS= randomdev.c probe.c .if ${MACHINE} == "amd64" || ${MACHINE} == "i386" SRCS+= nehemiah.c +SRCS+= ivy.c .endif SRCS+= randomdev_soft.c yarrow.c hash.c SRCS+= rijndael-alg-fst.c rijndael-api-fst.c sha2.c -SRCS+= bus_if.h device_if.h vnode_if.h +SRCS+= bus_if.h device_if.h vnode_if.h opt_cpu.h CFLAGS+= -I${.CURDIR}/../.. From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 13:18:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 7EFBA106566B; Thu, 27 Sep 2012 13:18:10 +0000 (UTC) Date: Thu, 27 Sep 2012 13:18:10 +0000 From: Alexey Dokuchaev To: Edward Tomasz Napierala Message-ID: <20120927131810.GA54552@FreeBSD.org> References: <201209271051.q8RApcmq002950@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201209271051.q8RApcmq002950@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240993 - head/sys/cam/ctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 13:18:10 -0000 On Thu, Sep 27, 2012 at 10:51:38AM +0000, Edward Tomasz Napierala wrote: > New Revision: 240993 > URL: http://svn.freebsd.org/changeset/base/240993 > > Log: > Remove useless NULL checks after M_WAITOK allocations. > > @@ -1520,12 +1520,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio > > ext_sglist = (struct ctl_sg_entry *)malloc(ext_sglen, M_CTL, M_WAITOK); You could have also removed bogus casting of void * returned by malloc(). Perhaps it makes sense to clean up more than just this file thought. ./danfe From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 13:37:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A5F66106564A; Thu, 27 Sep 2012 13:37:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F3408FC0C; Thu, 27 Sep 2012 13:37:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RDbVkr026642; Thu, 27 Sep 2012 13:37:31 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RDbVoC026640; Thu, 27 Sep 2012 13:37:31 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201209271337.q8RDbVoC026640@svn.freebsd.org> From: Ed Maste Date: Thu, 27 Sep 2012 13:37:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240995 - stable/9/sys/dev/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 13:37:31 -0000 Author: emaste Date: Thu Sep 27 13:37:30 2012 New Revision: 240995 URL: http://svn.freebsd.org/changeset/base/240995 Log: MFC part of r238812 and remainder of r239149 From r238812, move mtx_init of per-ring locks into NIOCREGIF ioctl handler. (Otherwise they're overwritten with zeros in netmap_if_new.) From r239149: Improve lock and unlock symmetry - Move destruction of per-ring locks to netmap_dtor_locked to mirror the initialization that happens in NIOCREGIF. Otherwise unloading a netmap- capable interface that was never put into netmap mode would try to mtx_destroy an uninitialized mutex, and panic. Modified: stable/9/sys/dev/netmap/netmap.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/netmap/netmap.c ============================================================================== --- stable/9/sys/dev/netmap/netmap.c Thu Sep 27 10:56:25 2012 (r240994) +++ stable/9/sys/dev/netmap/netmap.c Thu Sep 27 13:37:30 2012 (r240995) @@ -186,13 +186,20 @@ netmap_dtor_locked(void *data) lim = na->tx_rings[i].nkr_num_slots; for (j = 0; j < lim; j++) netmap_free_buf(nifp, ring->slot[j].buf_idx); + /* knlist_destroy(&na->tx_rings[i].si.si_note); */ + mtx_destroy(&na->tx_rings[i].q_lock); } for (i = 0; i < na->num_rx_rings + 1; i++) { struct netmap_ring *ring = na->rx_rings[i].ring; lim = na->rx_rings[i].nkr_num_slots; for (j = 0; j < lim; j++) netmap_free_buf(nifp, ring->slot[j].buf_idx); + /* knlist_destroy(&na->rx_rings[i].si.si_note); */ + mtx_destroy(&na->rx_rings[i].q_lock); } + /* XXX kqueue(9) needed; these will mirror knlist_init. */ + /* knlist_destroy(&na->tx_si.si_note); */ + /* knlist_destroy(&na->rx_si.si_note); */ NMA_UNLOCK(); netmap_free_rings(na); wakeup(na); @@ -593,6 +600,10 @@ netmap_ioctl(__unused struct cdev *dev, /* Otherwise set the card in netmap mode * and make it use the shared buffers. */ + for (i = 0 ; i < na->num_tx_rings + 1; i++) + mtx_init(&na->tx_rings[i].q_lock, "nm_txq_lock", NULL, MTX_DEF); + for (i = 0 ; i < na->num_rx_rings + 1; i++) + mtx_init(&na->rx_rings[i].q_lock, "nm_rxq_lock", NULL, MTX_DEF); error = na->nm_register(ifp, 1); /* mode on */ if (error) netmap_dtor_locked(priv); @@ -970,7 +981,7 @@ netmap_lock_wrapper(struct ifnet *dev, i int netmap_attach(struct netmap_adapter *na, int num_queues) { - int i, n, size; + int n, size; void *buf; struct ifnet *ifp = na->ifp; @@ -999,13 +1010,14 @@ netmap_attach(struct netmap_adapter *na, ifp->if_capabilities |= IFCAP_NETMAP; na = buf; - if (na->nm_lock == NULL) - na->nm_lock = netmap_lock_wrapper; + /* Core lock initialized here. Others are initialized after + * netmap_if_new. + */ mtx_init(&na->core_lock, "netmap core lock", NULL, MTX_DEF); - for (i = 0 ; i < na->num_tx_rings + 1; i++) - mtx_init(&na->tx_rings[i].q_lock, "netmap txq lock", NULL, MTX_DEF); - for (i = 0 ; i < na->num_rx_rings + 1; i++) - mtx_init(&na->rx_rings[i].q_lock, "netmap rxq lock", NULL, MTX_DEF); + if (na->nm_lock == NULL) { + ND("using default locks for %s", ifp->if_xname); + na->nm_lock = netmap_lock_wrapper; + } } #ifdef linux D("netdev_ops %p", ifp->netdev_ops); @@ -1026,24 +1038,13 @@ netmap_attach(struct netmap_adapter *na, void netmap_detach(struct ifnet *ifp) { - u_int i; struct netmap_adapter *na = NA(ifp); if (!na) return; - for (i = 0; i < na->num_tx_rings + 1; i++) { - /* knlist_destroy(&na->tx_rings[i].si.si_note); */ - mtx_destroy(&na->tx_rings[i].q_lock); - } - for (i = 0; i < na->num_rx_rings + 1; i++) { - /* knlist_destroy(&na->rx_rings[i].si.si_note); */ - mtx_destroy(&na->rx_rings[i].q_lock); - } mtx_destroy(&na->core_lock); - /* XXX kqueue(9) needed; these will mirror knlist_init. */ - /* knlist_destroy(&na->tx_si.si_note); */ - /* knlist_destroy(&na->rx_si.si_note); */ + bzero(na, sizeof(*na)); WNA(ifp) = NULL; free(na, M_DEVBUF); From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 14:55:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B3963106566B; Thu, 27 Sep 2012 14:55:15 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93E0B8FC0C; Thu, 27 Sep 2012 14:55:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8REtFAf038541; Thu, 27 Sep 2012 14:55:15 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8REtF0E038539; Thu, 27 Sep 2012 14:55:15 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201209271455.q8REtF0E038539@svn.freebsd.org> From: Mikolaj Golub Date: Thu, 27 Sep 2012 14:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240997 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 14:55:15 -0000 Author: trociny Date: Thu Sep 27 14:55:15 2012 New Revision: 240997 URL: http://svn.freebsd.org/changeset/base/240997 Log: Kernel and modules have "set_vnet" linker set, where virtualized global variables are placed. When a module is loaded by link_elf linker its variables from "set_vnet" linker set are copied to the kernel "set_vnet" ("modspace") and all references to these variables inside the module are relocated accordingly. The issue is when a module is loaded that has references to global variables from another, previously loaded module: these references are not relocated so an invalid address is used when the module tries to access the variable. The example is V_layer3_chain, defined in ipfw module and accessed from ipfw_nat. The same issue is with DPCPU variables, which use "set_pcpu" linker set. Fix this making the link_elf linker on a module load recognize "external" DPCPU/VNET variables defined in the previously loaded modules and relocate them accordingly. For this set_pcpu_list and set_vnet_list are used, where the addresses of modules' "set_pcpu" and "set_vnet" linker sets are stored. Note, archs that use link_elf_obj (amd64) were not affected by this issue. Reviewed by: jhb, julian, zec (initial version) MFC after: 1 month Modified: head/sys/kern/link_elf.c Modified: head/sys/kern/link_elf.c ============================================================================== --- head/sys/kern/link_elf.c Thu Sep 27 14:29:18 2012 (r240996) +++ head/sys/kern/link_elf.c Thu Sep 27 14:55:15 2012 (r240997) @@ -123,6 +123,15 @@ typedef struct elf_file { #endif } *elf_file_t; +struct elf_set { + Elf_Addr es_start; + Elf_Addr es_stop; + Elf_Addr es_base; + TAILQ_ENTRY(elf_set) es_link; +}; + +TAILQ_HEAD(elf_set_head, elf_set); + #include static int link_elf_link_common_finish(linker_file_t); @@ -181,6 +190,75 @@ static int parse_dynamic(elf_file_t); static int relocate_file(elf_file_t); static int link_elf_preload_parse_symbols(elf_file_t); +static struct elf_set_head set_pcpu_list; +#ifdef VIMAGE +static struct elf_set_head set_vnet_list; +#endif + +static void +elf_set_add(struct elf_set_head *list, Elf_Addr start, Elf_Addr stop, Elf_Addr base) +{ + struct elf_set *set, *iter; + + set = malloc(sizeof(*set), M_LINKER, M_WAITOK); + set->es_start = start; + set->es_stop = stop; + set->es_base = base; + + TAILQ_FOREACH(iter, list, es_link) { + + KASSERT((set->es_start < iter->es_start && set->es_stop < iter->es_stop) || + (set->es_start > iter->es_start && set->es_stop > iter->es_stop), + ("linker sets intersection: to insert: 0x%jx-0x%jx; inserted: 0x%jx-0x%jx", + (uintmax_t)set->es_start, (uintmax_t)set->es_stop, + (uintmax_t)iter->es_start, (uintmax_t)iter->es_stop)); + + if (iter->es_start > set->es_start) { + TAILQ_INSERT_BEFORE(iter, set, es_link); + break; + } + } + + if (iter == NULL) + TAILQ_INSERT_TAIL(list, set, es_link); +} + +static int +elf_set_find(struct elf_set_head *list, Elf_Addr addr, Elf_Addr *start, Elf_Addr *base) +{ + struct elf_set *set; + + TAILQ_FOREACH(set, list, es_link) { + if (addr < set->es_start) + return (0); + if (addr < set->es_stop) { + *start = set->es_start; + *base = set->es_base; + return (1); + } + } + + return (0); +} + +static void +elf_set_delete(struct elf_set_head *list, Elf_Addr start) +{ + struct elf_set *set; + + TAILQ_FOREACH(set, list, es_link) { + if (start < set->es_start) + break; + if (start == set->es_start) { + TAILQ_REMOVE(list, set, es_link); + free(set, M_LINKER); + return; + } + } + KASSERT(0, ("deleting unknown linker set (start = 0x%jx)", + (uintmax_t)start)); +} + #ifdef GDB static void r_debug_state(struct r_debug *, struct link_map *); @@ -345,6 +423,10 @@ link_elf_init(void* arg) (void)link_elf_link_common_finish(linker_kernel_file); linker_kernel_file->flags |= LINKER_FILE_LINKED; + TAILQ_INIT(&set_pcpu_list); +#ifdef VIMAGE + TAILQ_INIT(&set_vnet_list); +#endif } SYSINIT(link_elf, SI_SUB_KLD, SI_ORDER_THIRD, link_elf_init, 0); @@ -515,6 +597,8 @@ parse_dpcpu(elf_file_t ef) return (ENOSPC); memcpy((void *)ef->pcpu_base, (void *)ef->pcpu_start, count); dpcpu_copy((void *)ef->pcpu_base, count); + elf_set_add(&set_pcpu_list, ef->pcpu_start, ef->pcpu_stop, + ef->pcpu_base); return (0); } @@ -544,6 +628,8 @@ parse_vnet(elf_file_t ef) return (ENOSPC); memcpy((void *)ef->vnet_base, (void *)ef->vnet_start, count); vnet_data_copy((void *)ef->vnet_base, count); + elf_set_add(&set_vnet_list, ef->vnet_start, ef->vnet_stop, + ef->vnet_base); return (0); } @@ -996,11 +1082,13 @@ link_elf_unload_file(linker_file_t file) if (ef->pcpu_base != 0) { dpcpu_free((void *)ef->pcpu_base, ef->pcpu_stop - ef->pcpu_start); + elf_set_delete(&set_pcpu_list, ef->pcpu_start); } #ifdef VIMAGE if (ef->vnet_base != 0) { vnet_data_free((void *)ef->vnet_base, ef->vnet_stop - ef->vnet_start); + elf_set_delete(&set_vnet_list, ef->vnet_start); } #endif #ifdef GDB @@ -1439,6 +1527,7 @@ elf_lookup(linker_file_t lf, Elf_Size sy elf_file_t ef = (elf_file_t)lf; const Elf_Sym *sym; const char *symbol; + Elf_Addr addr, start, base; /* Don't even try to lookup the symbol if the index is bogus. */ if (symidx >= ef->nchains) @@ -1470,7 +1559,15 @@ elf_lookup(linker_file_t lf, Elf_Size sy if (*symbol == 0) return (0); - return ((Elf_Addr)linker_file_lookup_symbol(lf, symbol, deps)); + addr = ((Elf_Addr)linker_file_lookup_symbol(lf, symbol, deps)); + + if (elf_set_find(&set_pcpu_list, addr, &start, &base)) + addr = addr - start + base; +#ifdef VIMAGE + else if (elf_set_find(&set_vnet_list, addr, &start, &base)) + addr = addr - start + base; +#endif + return addr; } static void From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 15:23:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7DDB8106567A; Thu, 27 Sep 2012 15:23:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 685648FC18; Thu, 27 Sep 2012 15:23:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RFNd7D042763; Thu, 27 Sep 2012 15:23:39 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RFNdds042759; Thu, 27 Sep 2012 15:23:39 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201209271523.q8RFNdds042759@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 27 Sep 2012 15:23:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240998 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 15:23:39 -0000 Author: hselasky Date: Thu Sep 27 15:23:38 2012 New Revision: 240998 URL: http://svn.freebsd.org/changeset/base/240998 Log: Make sure we record NAK tokens in the TD structure for IN direction. Improve host channel disabling. Wait two times 125us for channel to be disabled. The DWC OTG doesn't like when channels are re-used too early. Modified: head/sys/dev/usb/controller/dwc_otg.c head/sys/dev/usb/controller/dwc_otg.h head/sys/dev/usb/controller/dwc_otgreg.h Modified: head/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.c Thu Sep 27 14:55:15 2012 (r240997) +++ head/sys/dev/usb/controller/dwc_otg.c Thu Sep 27 15:23:38 2012 (r240998) @@ -507,7 +507,6 @@ static uint8_t dwc_otg_host_channel_wait(struct dwc_otg_td *td) { struct dwc_otg_softc *sc; - uint16_t frame; uint8_t x; x = td->channel; @@ -517,32 +516,20 @@ dwc_otg_host_channel_wait(struct dwc_otg /* get pointer to softc */ sc = DWC_OTG_PC2SC(td->pc); - if (sc->sc_chan_state[x].hcint & HCINT_HALTED_ONLY) { + if (sc->sc_chan_state[x].wait_sof == 0) { dwc_otg_clear_hcint(sc, x); - return (1); + return (1); /* done */ } if (x == 0) return (0); /* wait */ - frame = DWC_OTG_READ_4(sc, DOTG_HFNUM) & HFNUM_FRNUM_MASK; - /* find new disabled channel */ for (x = 1; x != sc->sc_host_ch_max; x++) { - uint32_t hcchar; - if (sc->sc_chan_state[x].allocated) continue; - - /* check if channel is enabled */ - hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(x)); - if (hcchar & (HCCHAR_CHENA | HCCHAR_CHDIS)) { - DPRINTF("CH=%d is BUSY\n", x); - continue; - } - - if (sc->sc_chan_state[x].last_frame == frame) + if (sc->sc_chan_state[x].wait_sof != 0) continue; sc->sc_chan_state[td->channel].allocated = 0; @@ -556,9 +543,8 @@ dwc_otg_host_channel_wait(struct dwc_otg /* clear interrupts */ dwc_otg_clear_hcint(sc, x); - DPRINTF("CH=%d HCCHAR=0x%08x(0x%08x) " - "HCSPLT=0x%08x\n", x, td->hcchar, - hcchar, td->hcsplt); + DPRINTF("CH=%d HCCHAR=0x%08x " + "HCSPLT=0x%08x\n", x, td->hcchar, td->hcsplt); /* ack any pending messages */ if (sc->sc_last_rx_status != 0 && @@ -583,7 +569,6 @@ static uint8_t dwc_otg_host_channel_alloc(struct dwc_otg_td *td) { struct dwc_otg_softc *sc; - uint16_t frame; uint8_t x; uint8_t max_channel; @@ -601,23 +586,11 @@ dwc_otg_host_channel_alloc(struct dwc_ot x = 1; } - frame = DWC_OTG_READ_4(sc, DOTG_HFNUM) & HFNUM_FRNUM_MASK; - for (; x != max_channel; x++) { - uint32_t hcchar; - if (sc->sc_chan_state[x].allocated) continue; - - /* check if channel is enabled */ - hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(x)); - if (hcchar & (HCCHAR_CHENA | HCCHAR_CHDIS)) { - DPRINTF("CH=%d is BUSY\n", x); - continue; - } - - if (sc->sc_chan_state[x].last_frame == frame) + if (sc->sc_chan_state[x].wait_sof != 0) continue; sc->sc_chan_state[x].allocated = 1; @@ -625,9 +598,8 @@ dwc_otg_host_channel_alloc(struct dwc_ot /* clear interrupts */ dwc_otg_clear_hcint(sc, x); - DPRINTF("CH=%d HCCHAR=0x%08x(0x%08x) " - "HCSPLT=0x%08x\n", x, td->hcchar, - hcchar, td->hcsplt); + DPRINTF("CH=%d HCCHAR=0x%08x " + "HCSPLT=0x%08x\n", x, td->hcchar, td->hcsplt); /* set active channel */ sc->sc_active_rx_ep |= (1 << x); @@ -644,12 +616,18 @@ static void dwc_otg_host_channel_disable(struct dwc_otg_softc *sc, uint8_t x) { uint32_t hcchar; + if (sc->sc_chan_state[x].wait_sof != 0) + return; hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(x)); if (hcchar & (HCCHAR_CHENA | HCCHAR_CHDIS)) { + /* disable channel */ + DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(x), + HCCHAR_CHENA | HCCHAR_CHDIS); /* don't re-use channel until next SOF is transmitted */ - sc->sc_chan_state[x].last_frame = - DWC_OTG_READ_4(sc, DOTG_HFNUM) & HFNUM_FRNUM_MASK; - DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(x), HCCHAR_CHENA | HCCHAR_CHDIS); + sc->sc_chan_state[x].wait_sof = 2; + /* enable SOF interrupt */ + sc->sc_irq_mask |= GINTMSK_SOFMSK; + DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask); } } @@ -736,16 +714,9 @@ dwc_otg_host_setup_tx(struct dwc_otg_td if (hcint & (HCINT_ERRORS | HCINT_RETRY | HCINT_ACK | HCINT_NYET)) { - uint32_t hcchar; dwc_otg_host_channel_disable(sc, td->channel); - hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel)); - - if (!(hcchar & HCCHAR_CHENA)) { - hcint |= HCINT_HALTED_ONLY; - sc->sc_chan_state[td->channel].hcint = hcint; - } if (!(hcint & HCINT_ERRORS)) td->errcnt = 0; } @@ -1020,7 +991,7 @@ dwc_otg_host_rate_check(struct dwc_otg_t td->tmr_val += td->tmr_res; } else if (td->did_nak != 0) { goto busy; - } + } if (ep_type == UE_ISOCHRONOUS) { td->toggle = 0; @@ -1088,12 +1059,6 @@ dwc_otg_host_data_rx(struct dwc_otg_td * dwc_otg_host_channel_disable(sc, td->channel); - hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel)); - - if (!(hcchar & HCCHAR_CHENA)) { - hcint |= HCINT_HALTED_ONLY; - sc->sc_chan_state[td->channel].hcint = hcint; - } if (!(hcint & HCINT_ERRORS)) td->errcnt = 0; } @@ -1170,6 +1135,8 @@ check_state: if (!dwc_otg_host_channel_wait(td)) break; + td->did_nak = 1; + if (td->hcsplt != 0) goto receive_spkt; else @@ -1202,6 +1169,9 @@ check_state: if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { if (!dwc_otg_host_channel_wait(td)) break; + + td->did_nak = 1; + goto receive_spkt; } if (hcint & (HCINT_ACK | HCINT_NYET)) { @@ -1447,12 +1417,6 @@ dwc_otg_host_data_tx(struct dwc_otg_td * dwc_otg_host_channel_disable(sc, td->channel); - hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel)); - - if (!(hcchar & HCCHAR_CHENA)) { - hcint |= HCINT_HALTED_ONLY; - sc->sc_chan_state[td->channel].hcint = hcint; - } if (!(hcint & HCINT_ERRORS)) td->errcnt = 0; } @@ -1989,8 +1953,7 @@ repeat: temp = DWC_OTG_READ_4(sc, DOTG_HCINT(x)); if (temp != 0) { DWC_OTG_WRITE_4(sc, DOTG_HCINT(x), temp); - temp &= ~(HCINT_SOFTWARE_ONLY | - HCINT_HALTED_ONLY); + temp &= ~HCINT_SOFTWARE_ONLY; sc->sc_chan_state[x].hcint |= temp; } } @@ -2286,6 +2249,24 @@ dwc_otg_interrupt(struct dwc_otg_softc * } } + /* check for SOF interrupt */ + if (status & GINTSTS_SOF) { + if (sc->sc_irq_mask & GINTMSK_SOFMSK) { + uint8_t x; + uint8_t y; + for (x = y = 0; x != sc->sc_host_ch_max; x++) { + if (sc->sc_chan_state[x].wait_sof != 0) { + if (--(sc->sc_chan_state[x].wait_sof) != 0) + y = 1; + } + } + if (y == 0) { + sc->sc_irq_mask &= ~GINTMSK_SOFMSK; + DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask); + } + } + } + /* poll FIFO(s) */ dwc_otg_interrupt_poll(sc); Modified: head/sys/dev/usb/controller/dwc_otg.h ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.h Thu Sep 27 14:55:15 2012 (r240997) +++ head/sys/dev/usb/controller/dwc_otg.h Thu Sep 27 15:23:38 2012 (r240998) @@ -140,7 +140,7 @@ struct dwc_otg_profile { struct dwc_otg_chan_state { uint32_t hcint; - uint16_t last_frame; + uint8_t wait_sof; uint8_t allocated; uint8_t suspended; }; Modified: head/sys/dev/usb/controller/dwc_otgreg.h ============================================================================== --- head/sys/dev/usb/controller/dwc_otgreg.h Thu Sep 27 14:55:15 2012 (r240997) +++ head/sys/dev/usb/controller/dwc_otgreg.h Thu Sep 27 15:23:38 2012 (r240998) @@ -546,7 +546,6 @@ #define HCINT_RETRY \ (HCINT_DATATGLERR | HCINT_FRMOVRUN | HCINT_NAK) -#define HCINT_HALTED_ONLY (1<<21) /* BSD only */ #define HCINT_SOFTWARE_ONLY (1<<20) /* BSD only */ #define HCINT_DATATGLERR (1<<10) #define HCINT_FRMOVRUN (1<<9) From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 15:45:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B0C2D106566C; Thu, 27 Sep 2012 15:45:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B39D8FC14; Thu, 27 Sep 2012 15:45:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RFjOf7046065; Thu, 27 Sep 2012 15:45:24 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RFjOED046063; Thu, 27 Sep 2012 15:45:24 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201209271545.q8RFjOED046063@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 27 Sep 2012 15:45:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240999 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 15:45:24 -0000 Author: hselasky Date: Thu Sep 27 15:45:24 2012 New Revision: 240999 URL: http://svn.freebsd.org/changeset/base/240999 Log: Make sure the "wMaxPacketSize" limitations are respected. Modified: head/sys/dev/usb/controller/dwc_otg.c Modified: head/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.c Thu Sep 27 15:23:38 2012 (r240998) +++ head/sys/dev/usb/controller/dwc_otg.c Thu Sep 27 15:45:24 2012 (r240999) @@ -3974,9 +3974,34 @@ dwc_otg_ep_init(struct usb_device *udev, return; } } else { - if (udev->speed != USB_SPEED_LOW && - udev->speed != USB_SPEED_FULL && - udev->speed != USB_SPEED_HIGH) { + uint16_t mps; + + mps = UGETW(edesc->wMaxPacketSize); + + /* Apply limitations of our USB host driver */ + + switch (udev->speed) { + case USB_SPEED_HIGH: + if (mps > 512) { + DPRINTF("wMaxPacketSize=0x%04x" + "is not supported\n", (int)mps); + /* not supported */ + return; + } + break; + + case USB_SPEED_FULL: + case USB_SPEED_LOW: + if (mps > 188) { + DPRINTF("wMaxPacketSize=0x%04x" + "is not supported\n", (int)mps); + /* not supported */ + return; + } + break; + + default: + DPRINTF("Invalid device speed\n"); /* not supported */ return; } From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 15:50:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1A0AB106566B; Thu, 27 Sep 2012 15:50:14 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9D3B28FC14; Thu, 27 Sep 2012 15:50:13 +0000 (UTC) Received: by padbi1 with SMTP id bi1so1622017pad.13 for ; Thu, 27 Sep 2012 08:50:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=tpC0fnLhNEZkI3SGH6uKBMRmT/TGW6I4X/5nbK4QNug=; b=bMnGTilIjUzbW6B7acqU1r0BIEVone4957+bKTDYbya1sOZIbfrWqpav+ZTvoYj20f X/Ahm74B+oe8l0D0dBoJFgkr9SnqTnx4WhBJcw25GJGg5XWBj5P5S+2UGaSItQ6WqO7z nIqxIiyh2MZZIiywaiFHSFSZ6TO4S/ts8BDDHLscLai36WBbgXlUtdCAODjhZylfVPwy Ht+WxEHvsyZa79gMj8hxbJ2dJDg00xbDYIgyw3WvvEBCZpGyFohNz1cfsEKlHtkEOoLG W3ndm8lqNEctQfhlG9zoWV/acABiHlo2xpvlkJu4QZ+7Qc0e4TN50A+tbbgafiKNCv/I xP3w== MIME-Version: 1.0 Received: by 10.66.85.4 with SMTP id d4mr10460131paz.11.1348761013164; Thu, 27 Sep 2012 08:50:13 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.16.40 with HTTP; Thu, 27 Sep 2012 08:50:13 -0700 (PDT) In-Reply-To: <20120927131810.GA54552@FreeBSD.org> References: <201209271051.q8RApcmq002950@svn.freebsd.org> <20120927131810.GA54552@FreeBSD.org> Date: Thu, 27 Sep 2012 08:50:13 -0700 X-Google-Sender-Auth: z4ZZKvjL0yR-HnDMrtRaQGHmYWU Message-ID: From: Adrian Chadd To: Alexey Dokuchaev Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Edward Tomasz Napierala Subject: Re: svn commit: r240993 - head/sys/cam/ctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 15:50:14 -0000 .. I thought that malloc(.. , M_WAITOK) can return NULL. Wasn't there a discussion about this on IRC? Adrian From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 16:19:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3F98106566B; Thu, 27 Sep 2012 16:19:13 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3B05D8FC0A; Thu, 27 Sep 2012 16:19:13 +0000 (UTC) Received: by obbwc20 with SMTP id wc20so1295776obb.13 for ; Thu, 27 Sep 2012 09:19:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=PjphAvBYE3at/8/iMDMLQ78wej+dVYUdD9CO/1fZOTA=; b=UL6gdLK/Q00FZwKFN2j/rGmxBHtAK7Cw8ZDVdC5nl4YpJBJfKoRNn3onpAPCKMUTT2 FwSB4XV2FHW6keahyGoDhr7VqZ/yRdwTYMjA/djCYCMNoyDeOsMhAp80uUOBlDPchdyc ISGZ6o+k0VO8nqIHrzc1oOvLU3+EIDxAz5FzrTddTSnsrqJEPrKBrI43g9eng2jBg7gq oCx44ywf8rK9a+dywzNfgRKN4bd1NoiAcwQIxzy/KjkBWg2iA5R/wsBJRcLkOd35sW2D ZpGr40SWPRLpqDvPjvXWF1uIzJycqr+AUcs2y1QwGC07hfvwsWg4+9S1EaJY1vp2gaBm BSiw== MIME-Version: 1.0 Received: by 10.60.171.134 with SMTP id au6mr3533608oec.69.1348762752732; Thu, 27 Sep 2012 09:19:12 -0700 (PDT) Received: by 10.76.142.201 with HTTP; Thu, 27 Sep 2012 09:19:12 -0700 (PDT) In-Reply-To: References: <201209271051.q8RApcmq002950@svn.freebsd.org> <20120927131810.GA54552@FreeBSD.org> Date: Thu, 27 Sep 2012 09:19:12 -0700 Message-ID: From: Garrett Cooper To: Adrian Chadd Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, Alexey Dokuchaev , src-committers@freebsd.org, Edward Tomasz Napierala , svn-src-all@freebsd.org Subject: Re: svn commit: r240993 - head/sys/cam/ctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 16:19:14 -0000 On Thu, Sep 27, 2012 at 8:50 AM, Adrian Chadd wrote: > .. I thought that malloc(.. , M_WAITOK) can return NULL. Wasn't there > a discussion about this on IRC? Shouldn't -- else it would break the API contract: M_WAITOK Indicates that it is OK to wait for resources. If the request cannot be immediately fulfilled, the current process is put to sleep to wait for resources to be released by other processes. The malloc(), realloc(), and reallocf() functions cannot return NULL if M_WAITOK is specified. There was some discussion a little while ago IIRC about there being a bug where it could return NULL, but that bug should really be quashed, not disguised. Thanks, -Garrett From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 16:43:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B365106564A; Thu, 27 Sep 2012 16:43:24 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D0708FC0A; Thu, 27 Sep 2012 16:43:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RGhOL5055029; Thu, 27 Sep 2012 16:43:24 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RGhOAP055026; Thu, 27 Sep 2012 16:43:24 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201209271643.q8RGhOAP055026@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 27 Sep 2012 16:43:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241000 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 16:43:24 -0000 Author: pjd Date: Thu Sep 27 16:43:23 2012 New Revision: 241000 URL: http://svn.freebsd.org/changeset/base/241000 Log: Revert r240931, as the previous comment was actually in sync with POSIX. I have to note that POSIX is simply stupid in how it describes O_EXEC/fexecve and friends. Yes, not only inconsistent, but stupid. In the open(2) description, O_RDONLY flag is described as: O_RDONLY Open for reading only. Taken from: http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html Note "for reading only". Not "for reading or executing"! In the fexecve(2) description you can find: The fexecve() function shall fail if: [EBADF] The fd argument is not a valid file descriptor open for executing. Taken from: http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html As you can see the function shall fail if the file was not open with O_EXEC! And yet, if you look closer you can find this mess in the exec.html: Since execute permission is checked by fexecve(), the file description fd need not have been opened with the O_EXEC flag. Yes, O_EXEC flag doesn't have to be specified after all. You can open a file with O_RDONLY and you still be able to fexecve(2) it. Modified: head/sys/kern/kern_exec.c Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Thu Sep 27 15:45:24 2012 (r240999) +++ head/sys/kern/kern_exec.c Thu Sep 27 16:43:23 2012 (r241000) @@ -441,10 +441,10 @@ interpret: } else { AUDIT_ARG_FD(args->fd); /* - * Some might argue that CAP_MMAP should also be required here; - * such arguments will be entertained. + * Some might argue that CAP_READ and/or CAP_MMAP should also + * be required here; such arguments will be entertained. * - * Descriptors opened only with O_EXEC are allowed. + * Descriptors opened only with O_EXEC or O_RDONLY are allowed. */ error = fgetvp_exec(td, args->fd, CAP_FEXECVE, &binvp); if (error) From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 17:48:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EA1FB106564A; Thu, 27 Sep 2012 17:48:04 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB3B08FC14; Thu, 27 Sep 2012 17:48:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RHm4xo065604; Thu, 27 Sep 2012 17:48:04 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RHm4Xf065600; Thu, 27 Sep 2012 17:48:04 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201209271748.q8RHm4Xf065600@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 27 Sep 2012 17:48:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241001 - head/lib/libc/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 17:48:05 -0000 Author: jilles Date: Thu Sep 27 17:48:04 2012 New Revision: 241001 URL: http://svn.freebsd.org/changeset/base/241001 Log: sigaction(2),sigwait(2),sigwaitinfo(2): Remove [EFAULT] error condition. Passing an invalid pointer results in undefined behaviour. The wrappers in libthr access some of the data pointed to by the arguments in userland, so that an invalid pointer will cause a signal and not an [EFAULT] error return. Furthermore, if the [EFAULT] error occurs when the kernel is writing, it is not a proper error in the sense that the call still commits (changing the signal disposition or accepting the signal). MFC after: 1 week Modified: head/lib/libc/sys/sigaction.2 head/lib/libc/sys/sigwait.2 head/lib/libc/sys/sigwaitinfo.2 Modified: head/lib/libc/sys/sigaction.2 ============================================================================== --- head/lib/libc/sys/sigaction.2 Thu Sep 27 16:43:23 2012 (r241000) +++ head/lib/libc/sys/sigaction.2 Thu Sep 27 17:48:04 2012 (r241001) @@ -28,7 +28,7 @@ .\" From: @(#)sigaction.2 8.2 (Berkeley) 4/3/94 .\" $FreeBSD$ .\" -.Dd April 18, 2010 +.Dd September 27, 2012 .Dt SIGACTION 2 .Os .Sh NAME @@ -586,13 +586,6 @@ system call will fail and no new signal handler will be installed if one of the following occurs: .Bl -tag -width Er -.It Bq Er EFAULT -Either -.Fa act -or -.Fa oact -points to memory that is not a valid part of the process -address space. .It Bq Er EINVAL The .Fa sig Modified: head/lib/libc/sys/sigwait.2 ============================================================================== --- head/lib/libc/sys/sigwait.2 Thu Sep 27 16:43:23 2012 (r241000) +++ head/lib/libc/sys/sigwait.2 Thu Sep 27 17:48:04 2012 (r241001) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 24, 2011 +.Dd September 27, 2012 .Dt SIGWAIT 2 .Os .Sh NAME @@ -107,9 +107,6 @@ The .Fa set argument specifies one or more invalid signal numbers. -.It Bq Er EFAULT -Any arguments point outside the allocated address space or there is a -memory protection fault. .El .Sh SEE ALSO .Xr sigaction 2 , Modified: head/lib/libc/sys/sigwaitinfo.2 ============================================================================== --- head/lib/libc/sys/sigwaitinfo.2 Thu Sep 27 16:43:23 2012 (r241000) +++ head/lib/libc/sys/sigwaitinfo.2 Thu Sep 27 17:48:04 2012 (r241001) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 24, 2011 +.Dd September 27, 2012 .Dt SIGTIMEDWAIT 2 .Os .Sh NAME @@ -172,9 +172,6 @@ system calls fail if: .Bl -tag -width Er .It Bq Er EINTR The wait was interrupted by an unblocked, caught signal. -.It Bq Er EFAULT -Any arguments point outside the allocated address space or there is a -memory protection fault. .Pp .El The From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 18:15:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 82A8E1065686; Thu, 27 Sep 2012 18:15:02 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A2098FC12; Thu, 27 Sep 2012 18:15:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RIF2jW070055; Thu, 27 Sep 2012 18:15:02 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RIF2vT070051; Thu, 27 Sep 2012 18:15:02 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201209271815.q8RIF2vT070051@svn.freebsd.org> From: Max Khon Date: Thu, 27 Sep 2012 18:15:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241002 - head/sys/contrib/ipfilter/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 18:15:02 -0000 Author: fjoe Date: Thu Sep 27 18:15:01 2012 New Revision: 241002 URL: http://svn.freebsd.org/changeset/base/241002 Log: Fix pseudo checksum calculation. This fixes ipfilter w/ network controllers that implement only partial rx csum offloading. PR: 106438 Obtained from: upstream MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Sep 27 17:48:04 2012 (r241001) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Sep 27 18:15:01 2012 (r241002) @@ -1357,7 +1357,9 @@ fr_info_t *fin; else sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htonl(m->m_pkthdr.csum_data + - fin->fin_ip->ip_len + fin->fin_p)); + fin->fin_ip->ip_len - + (fin->fin_ip->ip_hl << 2) + + fin->fin_p)); sum ^= 0xffff; if (sum != 0) { fin->fin_flx |= FI_BAD; From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 18:16:02 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8CD801065673; Thu, 27 Sep 2012 18:16:02 +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 491018FC1C; Thu, 27 Sep 2012 18:16:01 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 1D39ED4F; Thu, 27 Sep 2012 20:15:00 +0200 (CEST) Date: Thu, 27 Sep 2012 20:16:25 +0200 From: Pawel Jakub Dawidek To: "Kenneth D. Merry" Message-ID: <20120927181624.GX1402@garage.freebsd.pl> References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> <20120926072005.GH1391@garage.freebsd.pl> <20120926172917.GA71268@nargothrond.kdm.org> <20120926185339.GA1402@garage.freebsd.pl> <20120926192117.GA89741@nargothrond.kdm.org> <20120926194541.GB1402@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vkJ987n7uXEPtlXE" Content-Disposition: inline In-Reply-To: <20120926194541.GB1402@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, jdp@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, phk@FreeBSD.org Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 18:16:02 -0000 --vkJ987n7uXEPtlXE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 26, 2012 at 09:45:41PM +0200, Pawel Jakub Dawidek wrote: > On Wed, Sep 26, 2012 at 01:21:17PM -0600, Kenneth D. Merry wrote: > > Ahh. How about using LIST_FOREACH_SAFE? Would that address the proble= m at > > hand? Are there any other races in there? >=20 > It depends. If one geom can hold more than one provider then it might be > racy, but from what I see there is always only one provider - there has > to be only one, because disk_destroy() destroys it and struct disk > represents always only one disk. If that's true then I see not reason to > have a loop in there. I'd change it to: >=20 > void > disk_gone(struct disk *dp) > { > struct g_geom *gp; > struct g_provider *pp; >=20 > gp =3D dp->d_geom; > if (gp !=3D NULL) { > pp =3D LIST_FIRST(&gp->provider); > if (pp !=3D NULL) > g_wither_provider(pp, ENXIO); > } > } Final patch for review: http://people.freebsd.org/~pjd/patches/geom_disk.c.3.patch --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --vkJ987n7uXEPtlXE Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlBkl/gACgkQForvXbEpPzRfSQCfbgfGEZuHkyWZpWlzZwz+7A7M pZ4AnjpQ8TFfjaLRvGGJJXT0qGEiEm/O =z+cR -----END PGP SIGNATURE----- --vkJ987n7uXEPtlXE-- From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 18:48:42 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7E951065670; Thu, 27 Sep 2012 18:48:42 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id 6A24C8FC19; Thu, 27 Sep 2012 18:48:42 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id q8RImaN9087405; Thu, 27 Sep 2012 12:48:36 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id q8RIma0Q087404; Thu, 27 Sep 2012 12:48:36 -0600 (MDT) (envelope-from ken) Date: Thu, 27 Sep 2012 12:48:36 -0600 From: "Kenneth D. Merry" To: Pawel Jakub Dawidek Message-ID: <20120927184836.GA87386@nargothrond.kdm.org> References: <201209221241.q8MCfnhJ067937@svn.freebsd.org> <20120925233712.GA26920@nargothrond.kdm.org> <20120926072005.GH1391@garage.freebsd.pl> <20120926172917.GA71268@nargothrond.kdm.org> <20120926185339.GA1402@garage.freebsd.pl> <20120926192117.GA89741@nargothrond.kdm.org> <20120926194541.GB1402@garage.freebsd.pl> <20120927181624.GX1402@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120927181624.GX1402@garage.freebsd.pl> User-Agent: Mutt/1.4.2i Cc: svn-src-head@FreeBSD.org, jdp@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, phk@FreeBSD.org Subject: Re: svn commit: r240822 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 18:48:42 -0000 On Thu, Sep 27, 2012 at 20:16:25 +0200, Pawel Jakub Dawidek wrote: > On Wed, Sep 26, 2012 at 09:45:41PM +0200, Pawel Jakub Dawidek wrote: > > On Wed, Sep 26, 2012 at 01:21:17PM -0600, Kenneth D. Merry wrote: > > > Ahh. How about using LIST_FOREACH_SAFE? Would that address the problem at > > > hand? Are there any other races in there? > > > > It depends. If one geom can hold more than one provider then it might be > > racy, but from what I see there is always only one provider - there has > > to be only one, because disk_destroy() destroys it and struct disk > > represents always only one disk. If that's true then I see not reason to > > have a loop in there. I'd change it to: > > > > void > > disk_gone(struct disk *dp) > > { > > struct g_geom *gp; > > struct g_provider *pp; > > > > gp = dp->d_geom; > > if (gp != NULL) { > > pp = LIST_FIRST(&gp->provider); > > if (pp != NULL) > > g_wither_provider(pp, ENXIO); > > } > > } > > Final patch for review: > > http://people.freebsd.org/~pjd/patches/geom_disk.c.3.patch Looks good, thanks! Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 18:51:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6DE291065670; Thu, 27 Sep 2012 18:51:04 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E9528FC08; Thu, 27 Sep 2012 18:51:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RIp4DE076140; Thu, 27 Sep 2012 18:51:04 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RIp41D076138; Thu, 27 Sep 2012 18:51:04 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201209271851.q8RIp41D076138@svn.freebsd.org> From: Mikolaj Golub Date: Thu, 27 Sep 2012 18:51:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241003 - stable/9/usr.sbin/bsnmpd/modules/snmp_hostres X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 18:51:04 -0000 Author: trociny Date: Thu Sep 27 18:51:03 2012 New Revision: 241003 URL: http://svn.freebsd.org/changeset/base/241003 Log: MFC r240595: In snmp_hostres, device_map table is used for consistent device table indexing. When a device has gone it is not removed from device_map table but just its entry_p field is set to NULL. So when traversing device_map in disk_OS_get_ATA_disks() and disk_OS_get_MD_disks() check for entry_p being NULL, otherwise the bsnmpd crash is possible when a removed map entry is dereferenced. Before the fix, for disk_OS_get_ATA_disks() the crash could be easily reproduced running: atacontrol detach ata1 The crash was not observed in disk_OS_get_MD_disks() because currently snmp_hostres does no see md(4) disks: to get the device list it uses devinfo(3), which does not return md devices. Reported by: Miroslav Lachman 000.fbsd quip.cz Modified: stable/9/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c Directory Properties: stable/9/usr.sbin/bsnmpd/ (props changed) Modified: stable/9/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c ============================================================================== --- stable/9/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c Thu Sep 27 18:15:01 2012 (r241002) +++ stable/9/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c Thu Sep 27 18:51:03 2012 (r241003) @@ -287,6 +287,9 @@ disk_OS_get_ATA_disks(void) /* Walk over the device table looking for ata disks */ STAILQ_FOREACH(map, &device_map, link) { + /* Skip deleted entries. */ + if (map->entry_p == NULL) + continue; for (found = lookup; found->media != DSM_UNKNOWN; found++) { if (strncmp(map->name_key, found->dev_name, strlen(found->dev_name)) != 0) @@ -345,6 +348,9 @@ disk_OS_get_MD_disks(void) /* Look for md devices */ STAILQ_FOREACH(map, &device_map, link) { + /* Skip deleted entries. */ + if (map->entry_p == NULL) + continue; if (sscanf(map->name_key, "md%d", &unit) != 1) continue; From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 18:52:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CAF0E1065680; Thu, 27 Sep 2012 18:52:04 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B52C8FC16; Thu, 27 Sep 2012 18:52:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RIq4vG076386; Thu, 27 Sep 2012 18:52:04 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RIq4bx076384; Thu, 27 Sep 2012 18:52:04 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201209271852.q8RIq4bx076384@svn.freebsd.org> From: Mikolaj Golub Date: Thu, 27 Sep 2012 18:52:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241004 - stable/8/usr.sbin/bsnmpd/modules/snmp_hostres X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 18:52:04 -0000 Author: trociny Date: Thu Sep 27 18:52:04 2012 New Revision: 241004 URL: http://svn.freebsd.org/changeset/base/241004 Log: MFC r240595: In snmp_hostres, device_map table is used for consistent device table indexing. When a device has gone it is not removed from device_map table but just its entry_p field is set to NULL. So when traversing device_map in disk_OS_get_ATA_disks() and disk_OS_get_MD_disks() check for entry_p being NULL, otherwise the bsnmpd crash is possible when a removed map entry is dereferenced. Before the fix, for disk_OS_get_ATA_disks() the crash could be easily reproduced running: atacontrol detach ata1 The crash was not observed in disk_OS_get_MD_disks() because currently snmp_hostres does no see md(4) disks: to get the device list it uses devinfo(3), which does not return md devices. Reported by: Miroslav Lachman 000.fbsd quip.cz Modified: stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c Directory Properties: stable/8/usr.sbin/bsnmpd/ (props changed) Modified: stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c ============================================================================== --- stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c Thu Sep 27 18:51:03 2012 (r241003) +++ stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c Thu Sep 27 18:52:04 2012 (r241004) @@ -287,6 +287,9 @@ disk_OS_get_ATA_disks(void) /* Walk over the device table looking for ata disks */ STAILQ_FOREACH(map, &device_map, link) { + /* Skip deleted entries. */ + if (map->entry_p == NULL) + continue; for (found = lookup; found->media != DSM_UNKNOWN; found++) { if (strncmp(map->name_key, found->dev_name, strlen(found->dev_name)) != 0) @@ -342,6 +345,9 @@ disk_OS_get_MD_disks(void) /* Look for md devices */ STAILQ_FOREACH(map, &device_map, link) { + /* Skip deleted entries. */ + if (map->entry_p == NULL) + continue; if (sscanf(map->name_key, "md%d", &unit) != 1) continue; From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 18:53:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B2F90106566C; Thu, 27 Sep 2012 18:53:59 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83CC08FC1C; Thu, 27 Sep 2012 18:53:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RIrxvp076868; Thu, 27 Sep 2012 18:53:59 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RIrxkL076865; Thu, 27 Sep 2012 18:53:59 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201209271853.q8RIrxkL076865@svn.freebsd.org> From: Mikolaj Golub Date: Thu, 27 Sep 2012 18:53:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241006 - stable/7/usr.sbin/bsnmpd/modules/snmp_hostres X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 18:53:59 -0000 Author: trociny Date: Thu Sep 27 18:53:59 2012 New Revision: 241006 URL: http://svn.freebsd.org/changeset/base/241006 Log: MFC r240595: In snmp_hostres, device_map table is used for consistent device table indexing. When a device has gone it is not removed from device_map table but just its entry_p field is set to NULL. So when traversing device_map in disk_OS_get_ATA_disks() and disk_OS_get_MD_disks() check for entry_p being NULL, otherwise the bsnmpd crash is possible when a removed map entry is dereferenced. Before the fix, for disk_OS_get_ATA_disks() the crash could be easily reproduced running: atacontrol detach ata1 The crash was not observed in disk_OS_get_MD_disks() because currently snmp_hostres does no see md(4) disks: to get the device list it uses devinfo(3), which does not return md devices. Reported by: Miroslav Lachman 000.fbsd quip.cz Modified: stable/7/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c Directory Properties: stable/7/usr.sbin/bsnmpd/ (props changed) Modified: stable/7/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c ============================================================================== --- stable/7/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c Thu Sep 27 18:52:15 2012 (r241005) +++ stable/7/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c Thu Sep 27 18:53:59 2012 (r241006) @@ -287,6 +287,9 @@ disk_OS_get_ATA_disks(void) /* Walk over the device table looking for ata disks */ STAILQ_FOREACH(map, &device_map, link) { + /* Skip deleted entries. */ + if (map->entry_p == NULL) + continue; for (found = lookup; found->media != DSM_UNKNOWN; found++) { if (strncmp(map->name_key, found->dev_name, strlen(found->dev_name)) != 0) @@ -342,6 +345,9 @@ disk_OS_get_MD_disks(void) /* Look for md devices */ STAILQ_FOREACH(map, &device_map, link) { + /* Skip deleted entries. */ + if (map->entry_p == NULL) + continue; if (sscanf(map->name_key, "md%d", &unit) != 1) continue; From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 19:10:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B55B11065674; Thu, 27 Sep 2012 19:10:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F8958FC0A; Thu, 27 Sep 2012 19:10:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RJAQ5Y079657; Thu, 27 Sep 2012 19:10:26 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RJAQs2079645; Thu, 27 Sep 2012 19:10:26 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201209271910.q8RJAQs2079645@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 27 Sep 2012 19:10:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241007 - in head: lib/libc/rpc sys/rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 19:10:26 -0000 Author: pfg Date: Thu Sep 27 19:10:25 2012 New Revision: 241007 URL: http://svn.freebsd.org/changeset/base/241007 Log: Complete revert of r239963: The attempt to merge changes from the linux libtirpc caused rpc.lockd to exit after startup under unclear conditions. After many hours of selective experiments and inconsistent results the conclusion is that it's better to just revert everything and restart in a future time with a much smaller subset of the changes. ____ MFC after: 3 days Reported by: David Wolfskill Tested by: David Wolfskill Modified: head/lib/libc/rpc/auth_unix.c head/lib/libc/rpc/authunix_prot.c head/lib/libc/rpc/clnt_perror.c head/lib/libc/rpc/rpc_generic.c head/lib/libc/rpc/rpc_soc.3 head/lib/libc/rpc/rpcb_clnt.c head/lib/libc/rpc/svc_auth_unix.c head/lib/libc/rpc/svc_run.c head/sys/rpc/auth.h head/sys/rpc/rpcb_clnt.c Modified: head/lib/libc/rpc/auth_unix.c ============================================================================== --- head/lib/libc/rpc/auth_unix.c Thu Sep 27 18:53:59 2012 (r241006) +++ head/lib/libc/rpc/auth_unix.c Thu Sep 27 19:10:25 2012 (r241007) @@ -94,10 +94,10 @@ struct audata { AUTH * authunix_create(machname, uid, gid, len, aup_gids) char *machname; - uid_t uid; - gid_t gid; + int uid; + int gid; int len; - gid_t *aup_gids; + int *aup_gids; { struct authunix_parms aup; char mymem[MAX_AUTH_BYTES]; @@ -207,7 +207,9 @@ authunix_create_default() abort(); if (ngids > NGRPS) ngids = NGRPS; - auth = authunix_create(machname, uid, gid, ngids, gids); + /* XXX: interface problem; those should all have been unsigned */ + auth = authunix_create(machname, (int)uid, (int)gid, ngids, + (int *)gids); free(gids); return (auth); } Modified: head/lib/libc/rpc/authunix_prot.c ============================================================================== --- head/lib/libc/rpc/authunix_prot.c Thu Sep 27 18:53:59 2012 (r241006) +++ head/lib/libc/rpc/authunix_prot.c Thu Sep 27 19:10:25 2012 (r241007) @@ -60,7 +60,7 @@ xdr_authunix_parms(xdrs, p) XDR *xdrs; struct authunix_parms *p; { - gid_t **paup_gids; + int **paup_gids; assert(xdrs != NULL); assert(p != NULL); @@ -69,8 +69,8 @@ xdr_authunix_parms(xdrs, p) if (xdr_u_long(xdrs, &(p->aup_time)) && xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME) - && xdr_u_int(xdrs, &(p->aup_uid)) - && xdr_u_int(xdrs, &(p->aup_gid)) + && xdr_int(xdrs, &(p->aup_uid)) + && xdr_int(xdrs, &(p->aup_gid)) && xdr_array(xdrs, (char **) paup_gids, &(p->aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int) ) { return (TRUE); Modified: head/lib/libc/rpc/clnt_perror.c ============================================================================== --- head/lib/libc/rpc/clnt_perror.c Thu Sep 27 18:53:59 2012 (r241006) +++ head/lib/libc/rpc/clnt_perror.c Thu Sep 27 19:10:25 2012 (r241007) @@ -242,7 +242,7 @@ char * clnt_spcreateerror(s) const char *s; { - char *str, *err; + char *str; size_t len, i; assert(s != NULL); @@ -258,21 +258,8 @@ clnt_spcreateerror(s) switch (rpc_createerr.cf_stat) { case RPC_PMAPFAILURE: (void) strncat(str, " - ", len - 1); - err = clnt_sperrno(rpc_createerr.cf_error.re_status); - if (err) - (void) strncat(str, err+5, len-5); - switch(rpc_createerr.cf_error.re_status) { - case RPC_CANTSEND: - case RPC_CANTRECV: - i = strlen(str); - len -= i; - snprintf(str+i, len, ": errno %d (%s)", - rpc_createerr.cf_error.re_errno, - strerror(rpc_createerr.cf_error.re_errno)); - break; - default: - break; - } + (void) strncat(str, + clnt_sperrno(rpc_createerr.cf_error.re_status), len - 4); break; case RPC_SYSTEMERROR: Modified: head/lib/libc/rpc/rpc_generic.c ============================================================================== --- head/lib/libc/rpc/rpc_generic.c Thu Sep 27 18:53:59 2012 (r241006) +++ head/lib/libc/rpc/rpc_generic.c Thu Sep 27 19:10:25 2012 (r241007) @@ -269,8 +269,7 @@ __rpc_getconfip(nettype) } while ((nconf = getnetconfig(confighandle)) != NULL) { if (strcmp(nconf->nc_protofmly, NC_INET) == 0) { - if (strcmp(nconf->nc_proto, NC_TCP) == 0 && - netid_tcp == NULL) { + if (strcmp(nconf->nc_proto, NC_TCP) == 0) { netid_tcp = strdup(nconf->nc_netid); if (main_thread) netid_tcp_main = netid_tcp; @@ -278,8 +277,7 @@ __rpc_getconfip(nettype) thr_setspecific(tcp_key, (void *) netid_tcp); } else - if (strcmp(nconf->nc_proto, NC_UDP) == 0 && - netid_udp == NULL) { + if (strcmp(nconf->nc_proto, NC_UDP) == 0) { netid_udp = strdup(nconf->nc_netid); if (main_thread) netid_udp_main = netid_udp; @@ -618,9 +616,6 @@ __rpc_taddr2uaddr_af(int af, const struc #endif u_int16_t port; - if (nbuf->len <= 0) - return NULL; - switch (af) { case AF_INET: sin = nbuf->buf; Modified: head/lib/libc/rpc/rpc_soc.3 ============================================================================== --- head/lib/libc/rpc/rpc_soc.3 Thu Sep 27 18:53:59 2012 (r241006) +++ head/lib/libc/rpc/rpc_soc.3 Thu Sep 27 19:10:25 2012 (r241007) @@ -148,7 +148,7 @@ default authentication used by .Ft "AUTH *" .Xc .It Xo -.Fn authunix_create "char *host" "uid_t uid" "gid_t gid" "int len" "gid_t *aup_gids" +.Fn authunix_create "char *host" "int uid" "int gid" "int len" "int *aup_gids" .Xc .Pp Create and return an Modified: head/lib/libc/rpc/rpcb_clnt.c ============================================================================== --- head/lib/libc/rpc/rpcb_clnt.c Thu Sep 27 18:53:59 2012 (r241006) +++ head/lib/libc/rpc/rpcb_clnt.c Thu Sep 27 19:10:25 2012 (r241007) @@ -770,13 +770,6 @@ __rpcb_findaddr_timed(program, version, } parms.r_addr = NULL; - parms.r_netid = nconf->nc_netid; - - /* - * According to wire captures, the reference implementation - * (OpenSolaris) sends a blank string here too. - */ - parms.r_owner = ""; /* * Use default total timeout if no timeout is specified. Modified: head/lib/libc/rpc/svc_auth_unix.c ============================================================================== --- head/lib/libc/rpc/svc_auth_unix.c Thu Sep 27 18:53:59 2012 (r241006) +++ head/lib/libc/rpc/svc_auth_unix.c Thu Sep 27 19:10:25 2012 (r241007) @@ -68,7 +68,7 @@ _svcauth_unix(rqst, msg) struct area { struct authunix_parms area_aup; char area_machname[MAX_MACHINE_NAME+1]; - gid_t area_gids[NGRPS]; + int area_gids[NGRPS]; } *area; u_int auth_len; size_t str_len, gid_len; Modified: head/lib/libc/rpc/svc_run.c ============================================================================== --- head/lib/libc/rpc/svc_run.c Thu Sep 27 18:53:59 2012 (r241006) +++ head/lib/libc/rpc/svc_run.c Thu Sep 27 19:10:25 2012 (r241007) @@ -60,13 +60,14 @@ svc_run() fd_set readfds, cleanfds; struct timeval timeout; + timeout.tv_sec = 30; + timeout.tv_usec = 0; + for (;;) { rwlock_rdlock(&svc_fd_lock); readfds = svc_fdset; cleanfds = svc_fdset; rwlock_unlock(&svc_fd_lock); - timeout.tv_sec = 30; - timeout.tv_usec = 0; switch (_select(svc_maxfd+1, &readfds, NULL, NULL, &timeout)) { case -1: FD_ZERO(&readfds); Modified: head/sys/rpc/auth.h ============================================================================== --- head/sys/rpc/auth.h Thu Sep 27 18:53:59 2012 (r241006) +++ head/sys/rpc/auth.h Thu Sep 27 19:10:25 2012 (r241007) @@ -234,17 +234,18 @@ __END_DECLS * System style authentication * AUTH *authunix_create(machname, uid, gid, len, aup_gids) * char *machname; - * uid_t uid; - * gid_t gid; + * int uid; + * int gid; * int len; - * gid_t *aup_gids; + * int *aup_gids; */ __BEGIN_DECLS #ifdef _KERNEL struct ucred; extern AUTH *authunix_create(struct ucred *); #else -extern AUTH *authunix_create(char *, uid_t, gid_t, int, gid_t *); +extern AUTH *authunix_create(char *, int, int, int, + int *); extern AUTH *authunix_create_default(void); /* takes no parameters */ #endif extern AUTH *authnone_create(void); /* takes no parameters */ Modified: head/sys/rpc/rpcb_clnt.c ============================================================================== --- head/sys/rpc/rpcb_clnt.c Thu Sep 27 18:53:59 2012 (r241006) +++ head/sys/rpc/rpcb_clnt.c Thu Sep 27 19:10:25 2012 (r241007) @@ -780,13 +780,6 @@ __rpcb_findaddr_timed(program, version, } parms.r_addr = NULL; - parms.r_netid = nconf->nc_netid; - - /* - * According to wire captures, the reference implementation - * (OpenSolaris) sends a blank string here too. - */ - parms.r_owner = ""; /* * Use default total timeout if no timeout is specified. From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 20:06:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E36A3106564A; Thu, 27 Sep 2012 20:06:37 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEF918FC0A; Thu, 27 Sep 2012 20:06:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RK6bVk089144; Thu, 27 Sep 2012 20:06:37 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RK6bXG089141; Thu, 27 Sep 2012 20:06:37 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201209272006.q8RK6bXG089141@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 27 Sep 2012 20:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241008 - head/include/rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 20:06:38 -0000 Author: pfg Date: Thu Sep 27 20:06:37 2012 New Revision: 241008 URL: http://svn.freebsd.org/changeset/base/241008 Log: Complete revert of r239963: The attempt to merge changes from the linux libtirpc caused rpc.lockd to exit after startup under unclear conditions. After many hours of selective experiments and inconsistent results the conclusion is that it's better to just revert everything and restart in a future time with a much smaller subset of the changes. ____ MFC after: 3 days Reported by: David Wolfskill Tested by: David Wolfskill Modified: head/include/rpc/auth.h head/include/rpc/auth_unix.h Modified: head/include/rpc/auth.h ============================================================================== --- head/include/rpc/auth.h Thu Sep 27 19:10:25 2012 (r241007) +++ head/include/rpc/auth.h Thu Sep 27 20:06:37 2012 (r241008) @@ -243,13 +243,14 @@ __END_DECLS * System style authentication * AUTH *authunix_create(machname, uid, gid, len, aup_gids) * char *machname; - * uid_t uid; - * gid_t gid; + * int uid; + * int gid; * int len; - * gid_t *aup_gids; + * int *aup_gids; */ __BEGIN_DECLS -extern AUTH *authunix_create(char *, uid_t, gid_t, int, gid_t *); +extern AUTH *authunix_create(char *, int, int, int, + int *); extern AUTH *authunix_create_default(void); /* takes no parameters */ extern AUTH *authnone_create(void); /* takes no parameters */ __END_DECLS Modified: head/include/rpc/auth_unix.h ============================================================================== --- head/include/rpc/auth_unix.h Thu Sep 27 19:10:25 2012 (r241007) +++ head/include/rpc/auth_unix.h Thu Sep 27 20:06:37 2012 (r241008) @@ -60,10 +60,10 @@ struct authunix_parms { u_long aup_time; char *aup_machname; - uid_t aup_uid; - gid_t aup_gid; + int aup_uid; + int aup_gid; u_int aup_len; - gid_t *aup_gids; + int *aup_gids; }; #define authsys_parms authunix_parms From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 20:12:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C405106564A; Thu, 27 Sep 2012 20:12:52 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 082798FC0A; Thu, 27 Sep 2012 20:12:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RKCpBC090275; Thu, 27 Sep 2012 20:12:51 GMT (envelope-from rstone@svn.freebsd.org) Received: (from rstone@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RKCp68090272; Thu, 27 Sep 2012 20:12:51 GMT (envelope-from rstone@svn.freebsd.org) Message-Id: <201209272012.q8RKCp68090272@svn.freebsd.org> From: Ryan Stone Date: Thu, 27 Sep 2012 20:12:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241009 - head/sys/netgraph X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 20:12:52 -0000 Author: rstone Date: Thu Sep 27 20:12:51 2012 New Revision: 241009 URL: http://svn.freebsd.org/changeset/base/241009 Log: Ensure that all cases that enqueue a netgraph item for delivery by a ngthread properly set the item's depth to 1. In particular, prior to this change if ng_snd_item failed to acquire a lock on a node, the item's depth would not be set at all. This fix ensures that the error code from rcvmsg/ rcvdata is properly passed back to the apply callback. For example, this fixes a bug where an error from rcvmsg/rcvdata would not previously propagate back to a libnetgraph consumer when the message was queued. Reviewed by: mav MFC after: 1 month Sponsored by: Sandvine Incorporated Modified: head/sys/netgraph/ng_base.c Modified: head/sys/netgraph/ng_base.c ============================================================================== --- head/sys/netgraph/ng_base.c Thu Sep 27 20:06:37 2012 (r241008) +++ head/sys/netgraph/ng_base.c Thu Sep 27 20:12:51 2012 (r241009) @@ -2008,6 +2008,7 @@ ng_queue_rw(node_p node, item_p item, i NGI_SET_WRITER(item); else NGI_SET_READER(item); + item->depth = 1; NG_QUEUE_LOCK(ngq); /* Set OP_PENDING flag and enqueue the item. */ @@ -2286,7 +2287,6 @@ ng_snd_item(item_p item, int flags) } if (queue) { - item->depth = 1; /* Put it on the queue for that node*/ ng_queue_rw(node, item, rw); return ((flags & NG_PROGRESS) ? EINPROGRESS : 0); From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 22:05:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F29E1065673; Thu, 27 Sep 2012 22:05:55 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A4EA8FC1E; Thu, 27 Sep 2012 22:05:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RM5shT009320; Thu, 27 Sep 2012 22:05:54 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RM5sQn009317; Thu, 27 Sep 2012 22:05:54 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201209272205.q8RM5sQn009317@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 27 Sep 2012 22:05:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241010 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 22:05:55 -0000 Author: jilles Date: Thu Sep 27 22:05:54 2012 New Revision: 241010 URL: http://svn.freebsd.org/changeset/base/241010 Log: libc/fts: Use O_CLOEXEC for internal file descriptors. Because fts keeps internal file descriptors open across calls, making such descriptors close-on-exec helps not only multi-threaded applications but also single-threaded applications. In particular, this prevents passing a temporary file descriptor for saving the current directory to processes created via find -exec. Modified: head/lib/libc/gen/fts-compat.c head/lib/libc/gen/fts.c Modified: head/lib/libc/gen/fts-compat.c ============================================================================== --- head/lib/libc/gen/fts-compat.c Thu Sep 27 20:12:51 2012 (r241009) +++ head/lib/libc/gen/fts-compat.c Thu Sep 27 22:05:54 2012 (r241010) @@ -220,7 +220,8 @@ __fts_open_44bsd(argv, options, compar) * and ".." are all fairly nasty problems. Note, if we can't get the * descriptor we run anyway, just more slowly. */ - if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = _open(".", O_RDONLY, 0)) < 0) + if (!ISSET(FTS_NOCHDIR) && + (sp->fts_rfd = _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) SET(FTS_NOCHDIR); return (sp); @@ -349,7 +350,8 @@ __fts_read_44bsd(sp) (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) { p->fts_info = fts_stat(sp, p, 1); if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { - if ((p->fts_symfd = _open(".", O_RDONLY, 0)) < 0) { + if ((p->fts_symfd = _open(".", O_RDONLY | O_CLOEXEC, + 0)) < 0) { p->fts_errno = errno; p->fts_info = FTS_ERR; } else @@ -440,7 +442,7 @@ next: tmp = p; p->fts_info = fts_stat(sp, p, 1); if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { if ((p->fts_symfd = - _open(".", O_RDONLY, 0)) < 0) { + _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) { p->fts_errno = errno; p->fts_info = FTS_ERR; } else @@ -581,7 +583,7 @@ __fts_children_44bsd(sp, instr) ISSET(FTS_NOCHDIR)) return (sp->fts_child = fts_build(sp, instr)); - if ((fd = _open(".", O_RDONLY, 0)) < 0) + if ((fd = _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) return (NULL); sp->fts_child = fts_build(sp, instr); if (fchdir(fd)) @@ -1180,7 +1182,7 @@ fts_safe_changedir(sp, p, fd, path) newfd = fd; if (ISSET(FTS_NOCHDIR)) return (0); - if (fd < 0 && (newfd = _open(path, O_RDONLY, 0)) < 0) + if (fd < 0 && (newfd = _open(path, O_RDONLY | O_CLOEXEC, 0)) < 0) return (-1); if (_fstat(newfd, &sb)) { ret = -1; Modified: head/lib/libc/gen/fts.c ============================================================================== --- head/lib/libc/gen/fts.c Thu Sep 27 20:12:51 2012 (r241009) +++ head/lib/libc/gen/fts.c Thu Sep 27 22:05:54 2012 (r241010) @@ -214,7 +214,8 @@ fts_open(argv, options, compar) * and ".." are all fairly nasty problems. Note, if we can't get the * descriptor we run anyway, just more slowly. */ - if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = _open(".", O_RDONLY, 0)) < 0) + if (!ISSET(FTS_NOCHDIR) && + (sp->fts_rfd = _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) SET(FTS_NOCHDIR); return (sp); @@ -339,7 +340,8 @@ fts_read(FTS *sp) (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) { p->fts_info = fts_stat(sp, p, 1); if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { - if ((p->fts_symfd = _open(".", O_RDONLY, 0)) < 0) { + if ((p->fts_symfd = _open(".", O_RDONLY | O_CLOEXEC, + 0)) < 0) { p->fts_errno = errno; p->fts_info = FTS_ERR; } else @@ -430,7 +432,7 @@ next: tmp = p; p->fts_info = fts_stat(sp, p, 1); if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { if ((p->fts_symfd = - _open(".", O_RDONLY, 0)) < 0) { + _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) { p->fts_errno = errno; p->fts_info = FTS_ERR; } else @@ -566,7 +568,7 @@ fts_children(FTS *sp, int instr) ISSET(FTS_NOCHDIR)) return (sp->fts_child = fts_build(sp, instr)); - if ((fd = _open(".", O_RDONLY, 0)) < 0) + if ((fd = _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) return (NULL); sp->fts_child = fts_build(sp, instr); if (fchdir(fd)) { @@ -1117,7 +1119,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, i newfd = fd; if (ISSET(FTS_NOCHDIR)) return (0); - if (fd < 0 && (newfd = _open(path, O_RDONLY, 0)) < 0) + if (fd < 0 && (newfd = _open(path, O_RDONLY | O_CLOEXEC, 0)) < 0) return (-1); if (_fstat(newfd, &sb)) { ret = -1; From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 23:30:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCA77106567C; Thu, 27 Sep 2012 23:30:50 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C570E8FC26; Thu, 27 Sep 2012 23:30:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RNUow8023785; Thu, 27 Sep 2012 23:30:50 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RNUo6C023767; Thu, 27 Sep 2012 23:30:50 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201209272330.q8RNUo6C023767@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 27 Sep 2012 23:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241011 - in head/sys: fs/ext2fs fs/hpfs fs/ntfs fs/tmpfs kern ufs/ffs ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 23:30:51 -0000 Author: mdf Date: Thu Sep 27 23:30:49 2012 New Revision: 241011 URL: http://svn.freebsd.org/changeset/base/241011 Log: Fix up kernel sources to be ready for a 64-bit ino_t. Original code by: Gleb Kurtsou Modified: head/sys/fs/ext2fs/ext2_alloc.c head/sys/fs/ext2fs/ext2_inode_cnv.c head/sys/fs/hpfs/hpfs_vfsops.c head/sys/fs/ntfs/ntfs_subr.c head/sys/fs/ntfs/ntfs_vfsops.c head/sys/fs/ntfs/ntfs_vnops.c head/sys/fs/tmpfs/tmpfs_vfsops.c head/sys/kern/uipc_usrreq.c head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_snapshot.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ufs/inode.h head/sys/ufs/ufs/ufs_acl.c head/sys/ufs/ufs/ufs_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/fs/ext2fs/ext2_alloc.c Thu Sep 27 23:30:49 2012 (r241011) @@ -1026,8 +1026,8 @@ ext2_vfree(pvp, ino, mode) fs = pip->i_e2fs; ump = pip->i_ump; if ((u_int)ino > fs->e2fs_ipg * fs->e2fs_gcount) - panic("ext2_vfree: range: devvp = %p, ino = %d, fs = %s", - pip->i_devvp, ino, fs->e2fs_fsmnt); + panic("ext2_vfree: range: devvp = %p, ino = %ju, fs = %s", + pip->i_devvp, (uintmax_t)ino, fs->e2fs_fsmnt); cg = ino_to_cg(fs, ino); error = bread(pip->i_devvp, Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode_cnv.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/fs/ext2fs/ext2_inode_cnv.c Thu Sep 27 23:30:49 2012 (r241011) @@ -45,7 +45,7 @@ ext2_print_inode( in ) { int i; - printf( "Inode: %5d", in->i_number); + printf( "Inode: %5ju", (uintmax_t)in->i_number); printf( /* "Inode: %5d" */ " Type: %10s Mode: 0x%o Flags: 0x%x Version: %d\n", "n/a", in->i_mode, in->i_flags, in->i_gen); Modified: head/sys/fs/hpfs/hpfs_vfsops.c ============================================================================== --- head/sys/fs/hpfs/hpfs_vfsops.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/fs/hpfs/hpfs_vfsops.c Thu Sep 27 23:30:49 2012 (r241011) @@ -512,7 +512,7 @@ hpfs_vget( error = bread(hpmp->hpm_devvp, ino, FNODESIZE, NOCRED, &bp); if (error) { - printf("hpfs_vget: can't read ino %d\n",ino); + printf("hpfs_vget: can't read ino %ju\n", (uintmax_t)ino); vput(vp); return (error); } Modified: head/sys/fs/ntfs/ntfs_subr.c ============================================================================== --- head/sys/fs/ntfs/ntfs_subr.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/fs/ntfs/ntfs_subr.c Thu Sep 27 23:30:49 2012 (r241011) @@ -84,8 +84,8 @@ int ntfs_ntvattrrele(vap) struct ntvattr * vap; { - dprintf(("ntfs_ntvattrrele: ino: %d, type: 0x%x\n", - vap->va_ip->i_number, vap->va_type)); + dprintf(("ntfs_ntvattrrele: ino: %ju, type: 0x%x\n", + (uintmax_t)vap->va_ip->i_number, vap->va_type)); ntfs_ntrele(vap->va_ip); @@ -109,12 +109,12 @@ ntfs_findvattr(ntmp, ip, lvapp, vapp, ty struct ntvattr *vap; if((ip->i_flag & IN_LOADED) == 0) { - dprintf(("ntfs_findvattr: node not loaded, ino: %d\n", - ip->i_number)); + dprintf(("ntfs_findvattr: node not loaded, ino: %ju\n", + (uintmax_t)ip->i_number)); error = ntfs_loadntnode(ntmp,ip); if (error) { - printf("ntfs_findvattr: FAILED TO LOAD INO: %d\n", - ip->i_number); + printf("ntfs_findvattr: FAILED TO LOAD INO: %ju\n", + (uintmax_t)ip->i_number); return (error); } } @@ -169,13 +169,13 @@ ntfs_ntvattrget( if (name) { dprintf(("ntfs_ntvattrget: " \ - "ino: %d, type: 0x%x, name: %s, vcn: %d\n", \ - ip->i_number, type, name, (u_int32_t) vcn)); + "ino: %ju, type: 0x%x, name: %s, vcn: %d\n", \ + (uintmax_t)ip->i_number, type, name, (uint32_t)vcn)); namelen = strlen(name); } else { dprintf(("ntfs_ntvattrget: " \ - "ino: %d, type: 0x%x, vcn: %d\n", \ - ip->i_number, type, (u_int32_t) vcn)); + "ino: %ju, type: 0x%x, vcn: %d\n", \ + (uintmax_t)ip->i_number, type, (uint32_t)vcn)); name = ""; namelen = 0; } @@ -186,8 +186,8 @@ ntfs_ntvattrget( if (!lvap) { dprintf(("ntfs_ntvattrget: UNEXISTED ATTRIBUTE: " \ - "ino: %d, type: 0x%x, name: %s, vcn: %d\n", \ - ip->i_number, type, name, (u_int32_t) vcn)); + "ino: %ju, type: 0x%x, name: %s, vcn: %d\n", \ + (uintmax_t)ip->i_number, type, name, (uint32_t)vcn)); return (ENOENT); } /* Scan $ATTRIBUTE_LIST for requested attribute */ @@ -203,9 +203,9 @@ ntfs_ntvattrget( for(; len > 0; aalp = nextaalp) { dprintf(("ntfs_ntvattrget: " \ - "attrlist: ino: %d, attr: 0x%x, vcn: %d\n", \ - aalp->al_inumber, aalp->al_type, \ - (u_int32_t) aalp->al_vcnstart)); + "attrlist: ino: %ju, attr: 0x%x, vcn: %d\n", \ + (uintmax_t)aalp->al_inumber, aalp->al_type, \ + (uint32_t)aalp->al_vcnstart)); if (len > aalp->reclen) { nextaalp = NTFS_NEXTREC(aalp, struct attr_attrlist *); @@ -219,8 +219,8 @@ ntfs_ntvattrget( NTFS_AALPCMP(nextaalp, type, name, namelen))) continue; - dprintf(("ntfs_ntvattrget: attribute in ino: %d\n", - aalp->al_inumber)); + dprintf(("ntfs_ntvattrget: attribute in ino: %ju\n", + (uintmax_t)aalp->al_inumber)); /* this is not a main record, so we can't use just plain vget() */ @@ -228,8 +228,8 @@ ntfs_ntvattrget( NTFS_A_DATA, NULL, LK_EXCLUSIVE, VG_EXT, curthread, &newvp); if (error) { - printf("ntfs_ntvattrget: CAN'T VGET INO: %d\n", - aalp->al_inumber); + printf("ntfs_ntvattrget: CAN'T VGET INO: %ju\n", + (uintmax_t)aalp->al_inumber); goto out; } newip = VTONT(newvp); @@ -245,8 +245,8 @@ ntfs_ntvattrget( error = ENOENT; dprintf(("ntfs_ntvattrget: UNEXISTED ATTRIBUTE: " \ - "ino: %d, type: 0x%x, name: %.*s, vcn: %d\n", \ - ip->i_number, type, (int) namelen, name, (u_int32_t) vcn)); + "ino: %ju, type: 0x%x, name: %.*s, vcn: %d\n", \ + (uintmax_t)ip->i_number, type, (int)namelen, name, (uint32_t)vcn)); out: free(alpool, M_TEMP); return (error); @@ -268,7 +268,8 @@ ntfs_loadntnode( struct attr *ap; struct ntvattr *nvap; - dprintf(("ntfs_loadntnode: loading ino: %d\n",ip->i_number)); + dprintf(("ntfs_loadntnode: loading ino: %ju\n", + (uintmax_t)ip->i_number)); mfrp = malloc(ntfs_bntob(ntmp->ntm_bpmftrec), M_TEMP, M_WAITOK); @@ -309,12 +310,13 @@ ntfs_loadntnode( error = ntfs_procfixups(ntmp, NTFS_FILEMAGIC, (caddr_t)mfrp, ntfs_bntob(ntmp->ntm_bpmftrec)); if (error) { - printf("ntfs_loadntnode: BAD MFT RECORD %d\n", - (u_int32_t) ip->i_number); + printf("ntfs_loadntnode: BAD MFT RECORD %ju\n", + (uintmax_t)ip->i_number); goto out; } - dprintf(("ntfs_loadntnode: load attrs for ino: %d\n",ip->i_number)); + dprintf(("ntfs_loadntnode: load attrs for ino: %ju\n", + (uintmax_t)ip->i_number)); off = mfrp->fr_attroff; ap = (struct attr *) ((caddr_t)mfrp + off); @@ -332,8 +334,8 @@ ntfs_loadntnode( ap = (struct attr *) ((caddr_t)mfrp + off); } if (error) { - printf("ntfs_loadntnode: failed to load attr ino: %d\n", - ip->i_number); + printf("ntfs_loadntnode: failed to load attr ino: %ju\n", + (uintmax_t)ip->i_number); goto out; } @@ -356,8 +358,8 @@ int ntfs_ntget(ip) struct ntnode *ip; { - dprintf(("ntfs_ntget: get ntnode %d: %p, usecount: %d\n", - ip->i_number, ip, ip->i_usecount)); + dprintf(("ntfs_ntget: get ntnode %ju: %p, usecount: %d\n", + (uintmax_t)ip->i_number, ip, ip->i_usecount)); mtx_lock(&ip->i_interlock); ip->i_usecount++; @@ -436,16 +438,16 @@ ntfs_ntput(ip) { struct ntvattr *vap; - dprintf(("ntfs_ntput: rele ntnode %d: %p, usecount: %d\n", - ip->i_number, ip, ip->i_usecount)); + dprintf(("ntfs_ntput: rele ntnode %ju: %p, usecount: %d\n", + (uintmax_t)ip->i_number, ip, ip->i_usecount)); mtx_lock(&ip->i_interlock); ip->i_usecount--; #ifdef DIAGNOSTIC if (ip->i_usecount < 0) { - panic("ntfs_ntput: ino: %d usecount: %d \n", - ip->i_number,ip->i_usecount); + panic("ntfs_ntput: ino: %ju usecount: %d \n", + (uintmax_t)ip->i_number, ip->i_usecount); } #endif @@ -454,7 +456,8 @@ ntfs_ntput(ip) return; } - dprintf(("ntfs_ntput: deallocating ntnode: %d\n", ip->i_number)); + dprintf(("ntfs_ntput: deallocating ntnode: %ju\n", + (uintmax_t)ip->i_number)); if (LIST_FIRST(&ip->i_fnlist)) panic("ntfs_ntput: ntnode has fnodes\n"); @@ -483,9 +486,8 @@ ntfs_ntref(ip) ip->i_usecount++; mtx_unlock(&ip->i_interlock); - dprintf(("ntfs_ntref: ino %d, usecount: %d\n", - ip->i_number, ip->i_usecount)); - + dprintf(("ntfs_ntref: ino %ju, usecount: %d\n", + (uintmax_t)ip->i_number, ip->i_usecount)); } /* @@ -495,15 +497,15 @@ void ntfs_ntrele(ip) struct ntnode *ip; { - dprintf(("ntfs_ntrele: rele ntnode %d: %p, usecount: %d\n", - ip->i_number, ip, ip->i_usecount)); + dprintf(("ntfs_ntrele: rele ntnode %ju: %p, usecount: %d\n", + (uintmax_t)ip->i_number, ip, ip->i_usecount)); mtx_lock(&ip->i_interlock); ip->i_usecount--; if (ip->i_usecount < 0) - panic("ntfs_ntrele: ino: %d usecount: %d \n", - ip->i_number,ip->i_usecount); + panic("ntfs_ntrele: ino: %ju usecount: %d \n", + (uintmax_t)ip->i_number, ip->i_usecount); mtx_unlock(&ip->i_interlock); } @@ -744,8 +746,8 @@ ntfs_fget( { struct fnode *fp; - dprintf(("ntfs_fget: ino: %d, attrtype: 0x%x, attrname: %s\n", - ip->i_number,attrtype, attrname?attrname:"")); + dprintf(("ntfs_fget: ino: %ju, attrtype: 0x%x, attrname: %s\n", + (uintmax_t)ip->i_number, attrtype, attrname ? attrname : "")); *fpp = NULL; LIST_FOREACH(fp, &ip->i_fnlist, f_fnlist){ dprintf(("ntfs_fget: fnode: attrtype: %d, attrname: %s\n", @@ -796,7 +798,8 @@ ntfs_frele( { struct ntnode *ip = FTONT(fp); - dprintf(("ntfs_frele: fnode: %p for %d: %p\n", fp, ip->i_number, ip)); + dprintf(("ntfs_frele: fnode: %p for %ju: %p\n", + fp, (uintmax_t)ip->i_number, ip)); dprintf(("ntfs_frele: deallocating fnode\n")); LIST_REMOVE(fp,f_fnlist); @@ -1126,7 +1129,8 @@ ntfs_ntreaddir( int error = ENOENT; u_int32_t aoff, cnum; - dprintf(("ntfs_ntreaddir: read ino: %d, num: %d\n", ip->i_number, num)); + dprintf(("ntfs_ntreaddir: read ino: %ju, num: %d\n", + (uintmax_t)ip->i_number, num)); error = ntfs_ntget(ip); if (error) return (error); @@ -1294,7 +1298,7 @@ ntfs_times( struct ntvattr *vap; int error; - dprintf(("ntfs_times: ino: %d...\n", ip->i_number)); + dprintf(("ntfs_times: ino: %ju...\n", (uintmax_t)ip->i_number)); error = ntfs_ntget(ip); if (error) @@ -1329,7 +1333,7 @@ ntfs_filesize( u_int64_t sz, bn; int error; - dprintf(("ntfs_filesize: ino: %d\n", ip->i_number)); + dprintf(("ntfs_filesize: ino: %ju\n", (uintmax_t)ip->i_number)); error = ntfs_ntvattrget(ntmp, ip, fp->f_attrtype, fp->f_attrname, 0, &vap); @@ -1562,8 +1566,8 @@ ntfs_readattr( struct ntvattr *vap; size_t init; - ddprintf(("ntfs_readattr: reading %d: 0x%x, from %d size %d bytes\n", - ip->i_number, attrnum, (u_int32_t) roff, (u_int32_t) rsize)); + ddprintf(("ntfs_readattr: reading %ju: 0x%x, from %jd size %zu bytes\n", + (uintmax_t)ip->i_number, attrnum, (intmax_t)roff, rsize)); error = ntfs_ntvattrget(ntmp, ip, attrnum, attrname, 0, &vap); if (error) Modified: head/sys/fs/ntfs/ntfs_vfsops.c ============================================================================== --- head/sys/fs/ntfs/ntfs_vfsops.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/fs/ntfs/ntfs_vfsops.c Thu Sep 27 23:30:49 2012 (r241011) @@ -639,9 +639,9 @@ ntfs_vgetex( struct vnode *vp; enum vtype f_type; - dprintf(("ntfs_vgetex: ino: %d, attr: 0x%x:%s, lkf: 0x%lx, f: 0x%lx\n", - ino, attrtype, attrname?attrname:"", (u_long)lkflags, - (u_long)flags)); + dprintf(("ntfs_vgetex: ino: %ju, attr: 0x%x:%s, lkf: 0x%lx, f: 0x%lx\n", + (uintmax_t)ino, attrtype, attrname ? attrname : "", lkflags, + (u_long)flags)); ntmp = VFSTONTFS(mp); *vpp = NULL; @@ -657,8 +657,8 @@ ntfs_vgetex( if (!(flags & VG_DONTLOADIN) && !(ip->i_flag & IN_LOADED)) { error = ntfs_loadntnode(ntmp, ip); if(error) { - printf("ntfs_vget: CAN'T LOAD ATTRIBUTES FOR INO: %d\n", - ip->i_number); + printf("ntfs_vget: CAN'T LOAD ATTRIBUTES FOR INO: %ju\n", + (uintmax_t)ip->i_number); ntfs_ntput(ip); return (error); } @@ -713,7 +713,7 @@ ntfs_vgetex( ntfs_ntput(ip); return (error); } - dprintf(("ntfs_vget: vnode: %p for ntnode: %d\n", vp,ino)); + dprintf(("ntfs_vget: vnode: %p for ntnode: %ju\n", vp, (uintmax_t)ino)); fp->f_vp = vp; vp->v_data = fp; Modified: head/sys/fs/ntfs/ntfs_vnops.c ============================================================================== --- head/sys/fs/ntfs/ntfs_vnops.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/fs/ntfs/ntfs_vnops.c Thu Sep 27 23:30:49 2012 (r241011) @@ -127,7 +127,9 @@ ntfs_read(ap) int resid, off, toread; int error; - dprintf(("ntfs_read: ino: %d, off: %d resid: %d, segflg: %d\n",ip->i_number,(u_int32_t)uio->uio_offset,uio->uio_resid,uio->uio_segflg)); + dprintf(("ntfs_read: ino: %ju, off: %jd resid: %d, segflg: %d\n", + (uintmax_t)ip->i_number, (intmax_t)uio->uio_offset, + uio->uio_resid, uio->uio_segflg)); dprintf(("ntfs_read: filesize: %d",(u_int32_t)fp->f_size)); @@ -179,7 +181,8 @@ ntfs_getattr(ap) register struct ntnode *ip = FTONT(fp); register struct vattr *vap = ap->a_vap; - dprintf(("ntfs_getattr: %d, flags: %d\n",ip->i_number,ip->i_flag)); + dprintf(("ntfs_getattr: %ju, flags: %d\n", + (uintmax_t)ip->i_number, ip->i_flag)); vap->va_fsid = dev2udev(ip->i_dev); vap->va_fileid = ip->i_number; @@ -214,8 +217,8 @@ ntfs_inactive(ap) register struct ntnode *ip = VTONT(ap->a_vp); #endif - dprintf(("ntfs_inactive: vnode: %p, ntnode: %d\n", ap->a_vp, - ip->i_number)); + dprintf(("ntfs_inactive: vnode: %p, ntnode: %ju\n", ap->a_vp, + (uintmax_t)ip->i_number)); /* XXX since we don't support any filesystem changes * right now, nothing more needs to be done @@ -237,7 +240,8 @@ ntfs_reclaim(ap) register struct ntnode *ip = FTONT(fp); int error; - dprintf(("ntfs_reclaim: vnode: %p, ntnode: %d\n", vp, ip->i_number)); + dprintf(("ntfs_reclaim: vnode: %p, ntnode: %ju\n", + vp, (uintmax_t)ip->i_number)); /* * Destroy the vm object and flush associated pages. @@ -600,8 +604,8 @@ ntfs_lookup(ap) return (error); } - dprintf(("ntfs_lookup: found ino: %d\n", - VTONT(*ap->a_vpp)->i_number)); + dprintf(("ntfs_lookup: found ino: %ju\n", + (uintmax_t)VTONT(*ap->a_vpp)->i_number)); } if (cnp->cn_flags & MAKEENTRY) Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Thu Sep 27 23:30:49 2012 (r241011) @@ -247,7 +247,8 @@ tmpfs_mount(struct mount *mp) free(tmp, M_TMPFSMNT); return error; } - KASSERT(root->tn_id == 2, ("tmpfs root with invalid ino: %d", root->tn_id)); + KASSERT(root->tn_id == 2, + ("tmpfs root with invalid ino: %ju", (uintmax_t)root->tn_id)); tmp->tm_root = root; MNT_ILOCK(mp); Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/kern/uipc_usrreq.c Thu Sep 27 23:30:49 2012 (r241011) @@ -2430,7 +2430,7 @@ DB_SHOW_COMMAND(unpcb, db_show_unpcb) db_printf("unp_socket: %p unp_vnode: %p\n", unp->unp_socket, unp->unp_vnode); - db_printf("unp_ino: %d unp_conn: %p\n", unp->unp_ino, + db_printf("unp_ino: %ju unp_conn: %p\n", (uintmax_t)unp->unp_ino, unp->unp_conn); db_printf("unp_refs:\n"); Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/ufs/ffs/ffs_alloc.c Thu Sep 27 23:30:49 2012 (r241011) @@ -598,7 +598,8 @@ ffs_reallocblks_ufs1(ap) */ #ifdef DEBUG if (prtrealloc) - printf("realloc: ino %d, lbns %jd-%jd\n\told:", ip->i_number, + printf("realloc: ino %ju, lbns %jd-%jd\n\told:", + (uintmax_t)ip->i_number, (intmax_t)start_lbn, (intmax_t)end_lbn); #endif blkno = newblk; @@ -2176,8 +2177,8 @@ ffs_freefile(ump, fs, devvp, ino, mode, cgbno = fsbtodb(fs, cgtod(fs, cg)); } if (ino >= fs->fs_ipg * fs->fs_ncg) - panic("ffs_freefile: range: dev = %s, ino = %lu, fs = %s", - devtoname(dev), (u_long)ino, fs->fs_fsmnt); + panic("ffs_freefile: range: dev = %s, ino = %ju, fs = %s", + devtoname(dev), (uintmax_t)ino, fs->fs_fsmnt); if ((error = bread(devvp, cgbno, (int)fs->fs_cgsize, NOCRED, &bp))) { brelse(bp); return (error); @@ -2192,8 +2193,8 @@ ffs_freefile(ump, fs, devvp, ino, mode, inosused = cg_inosused(cgp); ino %= fs->fs_ipg; if (isclr(inosused, ino)) { - printf("dev = %s, ino = %u, fs = %s\n", devtoname(dev), - ino + cg * fs->fs_ipg, fs->fs_fsmnt); + printf("dev = %s, ino = %ju, fs = %s\n", devtoname(dev), + (uintmax_t)(ino + cg * fs->fs_ipg), fs->fs_fsmnt); if (fs->fs_ronly == 0) panic("ffs_freefile: freeing free inode"); } @@ -2343,8 +2344,9 @@ ffs_fserr(fs, inum, cp) struct thread *td = curthread; /* XXX */ struct proc *p = td->td_proc; - log(LOG_ERR, "pid %d (%s), uid %d inumber %d on %s: %s\n", - p->p_pid, p->p_comm, td->td_ucred->cr_uid, inum, fs->fs_fsmnt, cp); + log(LOG_ERR, "pid %d (%s), uid %d inumber %ju on %s: %s\n", + p->p_pid, p->p_comm, td->td_ucred->cr_uid, (uintmax_t)inum, + fs->fs_fsmnt, cp); } /* @@ -2556,16 +2558,16 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS) #ifdef DEBUG if (fsckcmds) { if (cmd.size == 1) - printf("%s: free %s inode %d\n", + printf("%s: free %s inode %ju\n", mp->mnt_stat.f_mntonname, filetype == IFDIR ? "directory" : "file", - (ino_t)cmd.value); + (uintmax_t)cmd.value); else - printf("%s: free %s inodes %d-%d\n", + printf("%s: free %s inodes %ju-%ju\n", mp->mnt_stat.f_mntonname, filetype == IFDIR ? "directory" : "file", - (ino_t)cmd.value, - (ino_t)(cmd.value + cmd.size - 1)); + (uintmax_t)cmd.value, + (uintmax_t)(cmd.value + cmd.size - 1)); } #endif /* DEBUG */ while (cmd.size > 0) { Modified: head/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- head/sys/ufs/ffs/ffs_snapshot.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/ufs/ffs/ffs_snapshot.c Thu Sep 27 23:30:49 2012 (r241011) @@ -674,7 +674,8 @@ loop: VI_LOCK(devvp); fs->fs_snapinum[snaploc] = ip->i_number; if (ip->i_nextsnap.tqe_prev != 0) - panic("ffs_snapshot: %d already on list", ip->i_number); + panic("ffs_snapshot: %ju already on list", + (uintmax_t)ip->i_number); TAILQ_INSERT_TAIL(&sn->sn_head, ip, i_nextsnap); devvp->v_vflag |= VV_COPYONWRITE; VI_UNLOCK(devvp); @@ -1571,8 +1572,8 @@ ffs_snapgone(ip) if (xp != NULL) vrele(ITOV(ip)); else if (snapdebug) - printf("ffs_snapgone: lost snapshot vnode %d\n", - ip->i_number); + printf("ffs_snapgone: lost snapshot vnode %ju\n", + (uintmax_t)ip->i_number); /* * Delete snapshot inode from superblock. Keep list dense. */ @@ -1834,9 +1835,10 @@ retry: if (size == fs->fs_bsize) { #ifdef DEBUG if (snapdebug) - printf("%s %d lbn %jd from inum %d\n", - "Grabonremove: snapino", ip->i_number, - (intmax_t)lbn, inum); + printf("%s %ju lbn %jd from inum %ju\n", + "Grabonremove: snapino", + (uintmax_t)ip->i_number, + (intmax_t)lbn, (uintmax_t)inum); #endif /* * If journaling is tracking this write we must add @@ -1878,9 +1880,9 @@ retry: break; #ifdef DEBUG if (snapdebug) - printf("%s%d lbn %jd %s %d size %ld to blkno %jd\n", - "Copyonremove: snapino ", ip->i_number, - (intmax_t)lbn, "for inum", inum, size, + printf("%s%ju lbn %jd %s %ju size %ld to blkno %jd\n", + "Copyonremove: snapino ", (uintmax_t)ip->i_number, + (intmax_t)lbn, "for inum", (uintmax_t)inum, size, (intmax_t)cbp->b_blkno); #endif /* @@ -2021,8 +2023,8 @@ ffs_snapshot_mount(mp) */ VI_LOCK(devvp); if (ip->i_nextsnap.tqe_prev != 0) - panic("ffs_snapshot_mount: %d already on list", - ip->i_number); + panic("ffs_snapshot_mount: %ju already on list", + (uintmax_t)ip->i_number); else TAILQ_INSERT_TAIL(&sn->sn_head, ip, i_nextsnap); vp->v_vflag |= VV_SYSTEM; @@ -2366,12 +2368,13 @@ ffs_copyonwrite(devvp, bp) break; #ifdef DEBUG if (snapdebug) { - printf("Copyonwrite: snapino %d lbn %jd for ", - ip->i_number, (intmax_t)lbn); + printf("Copyonwrite: snapino %ju lbn %jd for ", + (uintmax_t)ip->i_number, (intmax_t)lbn); if (bp->b_vp == devvp) printf("fs metadata"); else - printf("inum %d", VTOI(bp->b_vp)->i_number); + printf("inum %ju", + (uintmax_t)VTOI(bp->b_vp)->i_number); printf(" lblkno %jd to blkno %jd\n", (intmax_t)bp->b_lblkno, (intmax_t)cbp->b_blkno); } Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/ufs/ffs/ffs_softdep.c Thu Sep 27 23:30:49 2012 (r241011) @@ -4456,8 +4456,8 @@ softdep_setup_mkdir(dp, ip) KASSERT(jaddref != NULL, ("softdep_setup_mkdir: No addref structure present.")); KASSERT(jaddref->ja_parent == dp->i_number, - ("softdep_setup_mkdir: bad parent %d", - jaddref->ja_parent)); + ("softdep_setup_mkdir: bad parent %ju", + (uintmax_t)jaddref->ja_parent)); TAILQ_INSERT_BEFORE(&jaddref->ja_ref, &dotaddref->ja_ref, if_deps); } @@ -8761,8 +8761,8 @@ newdirrem(bp, dp, ip, isrmdir, prevdirre if ((dap->da_state & ATTACHED) == 0) panic("newdirrem: not ATTACHED"); if (dap->da_newinum != ip->i_number) - panic("newdirrem: inum %d should be %d", - ip->i_number, dap->da_newinum); + panic("newdirrem: inum %ju should be %ju", + (uintmax_t)ip->i_number, (uintmax_t)dap->da_newinum); /* * If we are deleting a changed name that never made it to disk, * then return the dirrem describing the previous inode (which @@ -9635,9 +9635,10 @@ initiate_write_filepage(pagedep, bp) ep = (struct direct *) ((char *)bp->b_data + dap->da_offset); if (ep->d_ino != dap->da_newinum) - panic("%s: dir inum %d != new %d", + panic("%s: dir inum %ju != new %ju", "initiate_write_filepage", - ep->d_ino, dap->da_newinum); + (uintmax_t)ep->d_ino, + (uintmax_t)dap->da_newinum); if (dap->da_state & DIRCHG) ep->d_ino = dap->da_previous->dm_oldinum; else @@ -10194,10 +10195,11 @@ softdep_setup_inofree(mp, bp, ino, wkhd) cgp = (struct cg *)bp->b_data; inosused = cg_inosused(cgp); if (isset(inosused, ino % fs->fs_ipg)) - panic("softdep_setup_inofree: inode %d not freed.", ino); + panic("softdep_setup_inofree: inode %ju not freed.", + (uintmax_t)ino); if (inodedep_lookup(mp, ino, 0, &inodedep)) - panic("softdep_setup_inofree: ino %d has existing inodedep %p", - ino, inodedep); + panic("softdep_setup_inofree: ino %ju has existing inodedep %p", + (uintmax_t)ino, inodedep); if (wkhd) { LIST_FOREACH_SAFE(wk, wkhd, wk_list, wkn) { if (wk->wk_type != D_JADDREF) @@ -10423,8 +10425,8 @@ initiate_write_bmsafemap(bmsafemap, bp) jaddref->ja_state |= UNDONE; stat_jaddref++; } else if ((bp->b_xflags & BX_BKGRDMARKER) == 0) - panic("initiate_write_bmsafemap: inode %d " - "marked free", jaddref->ja_ino); + panic("initiate_write_bmsafemap: inode %ju " + "marked free", (uintmax_t)jaddref->ja_ino); } } /* @@ -12498,7 +12500,8 @@ retry: if (dap == LIST_FIRST(diraddhdp)) { inodedep_lookup(UFSTOVFS(ump), inum, 0, &inodedep); panic("flush_pagedep_deps: failed to flush " - "inodedep %p ino %d dap %p", inodedep, inum, dap); + "inodedep %p ino %ju dap %p", + inodedep, (uintmax_t)inum, dap); } } if (error) Modified: head/sys/ufs/ufs/inode.h ============================================================================== --- head/sys/ufs/ufs/inode.h Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/ufs/ufs/inode.h Thu Sep 27 23:30:49 2012 (r241011) @@ -183,7 +183,7 @@ struct indir { struct ufid { u_int16_t ufid_len; /* Length of structure. */ u_int16_t ufid_pad; /* Force 32-bit alignment. */ - ino_t ufid_ino; /* File number (ino). */ + uint32_t ufid_ino; /* File number (ino). */ int32_t ufid_gen; /* Generation number. */ }; #endif /* _KERNEL */ Modified: head/sys/ufs/ufs/ufs_acl.c ============================================================================== --- head/sys/ufs/ufs/ufs_acl.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/ufs/ufs/ufs_acl.c Thu Sep 27 23:30:49 2012 (r241011) @@ -182,8 +182,8 @@ ufs_getacl_nfs4_internal(struct vnode *v * are unsafe. */ printf("ufs_getacl_nfs4(): Loaded invalid ACL (" - "%d bytes), inumber %d on %s\n", len, - ip->i_number, ip->i_fs->fs_fsmnt); + "%d bytes), inumber %ju on %s\n", len, + (uintmax_t)ip->i_number, ip->i_fs->fs_fsmnt); return (EPERM); } @@ -191,8 +191,8 @@ ufs_getacl_nfs4_internal(struct vnode *v error = acl_nfs4_check(aclp, vp->v_type == VDIR); if (error) { printf("ufs_getacl_nfs4(): Loaded invalid ACL " - "(failed acl_nfs4_check), inumber %d on %s\n", - ip->i_number, ip->i_fs->fs_fsmnt); + "(failed acl_nfs4_check), inumber %ju on %s\n", + (uintmax_t)ip->i_number, ip->i_fs->fs_fsmnt); return (EPERM); } @@ -259,8 +259,8 @@ ufs_get_oldacl(acl_type_t type, struct o * DAC protections are unsafe. */ printf("ufs_get_oldacl(): Loaded invalid ACL " - "(len = %d), inumber %d on %s\n", len, - ip->i_number, ip->i_fs->fs_fsmnt); + "(len = %d), inumber %ju on %s\n", len, + (uintmax_t)ip->i_number, ip->i_fs->fs_fsmnt); return (EPERM); } Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/ufs/ufs/ufs_lookup.c Thu Sep 27 23:30:49 2012 (r241011) @@ -770,11 +770,13 @@ ufs_dirbad(ip, offset, how) mp = ITOV(ip)->v_mount; if ((mp->mnt_flag & MNT_RDONLY) == 0) - panic("ufs_dirbad: %s: bad dir ino %lu at offset %ld: %s", - mp->mnt_stat.f_mntonname, (u_long)ip->i_number, (long)offset, how); + panic("ufs_dirbad: %s: bad dir ino %ju at offset %ld: %s", + mp->mnt_stat.f_mntonname, (uintmax_t)ip->i_number, + (long)offset, how); else - (void)printf("%s: bad dir ino %lu at offset %ld: %s\n", - mp->mnt_stat.f_mntonname, (u_long)ip->i_number, (long)offset, how); + (void)printf("%s: bad dir ino %ju at offset %ld: %s\n", + mp->mnt_stat.f_mntonname, (uintmax_t)ip->i_number, + (long)offset, how); } /* @@ -1209,8 +1211,8 @@ ufs_dirremove(dvp, ip, flags, isrmdir) ufsdirhash_remove(dp, rep, dp->i_offset); #endif if (ip && rep->d_ino != ip->i_number) - panic("ufs_dirremove: ip %d does not match dirent ino %d\n", - ip->i_number, rep->d_ino); + panic("ufs_dirremove: ip %ju does not match dirent ino %ju\n", + (uintmax_t)ip->i_number, (uintmax_t)rep->d_ino); if (dp->i_count == 0) { /* * First entry in block: set d_ino to zero. Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/ufs/ufs/ufs_vnops.c Thu Sep 27 23:30:49 2012 (r241011) @@ -1504,8 +1504,8 @@ relock: if (error) panic("ufs_rename: from entry went away!"); if (ino != fip->i_number) - panic("ufs_rename: ino mismatch %d != %d\n", ino, - fip->i_number); + panic("ufs_rename: ino mismatch %ju != %ju\n", + (uintmax_t)ino, (uintmax_t)fip->i_number); } /* * If the source is a directory with a From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 23:30:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F3D7910657A7; Thu, 27 Sep 2012 23:30:58 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7E608FC12; Thu, 27 Sep 2012 23:30:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RNUwoh023858; Thu, 27 Sep 2012 23:30:58 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RNUwTi023849; Thu, 27 Sep 2012 23:30:58 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201209272330.q8RNUwTi023849@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 27 Sep 2012 23:30:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241012 - head/sbin/fsck_ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 23:30:59 -0000 Author: mdf Date: Thu Sep 27 23:30:58 2012 New Revision: 241012 URL: http://svn.freebsd.org/changeset/base/241012 Log: Fix fsck_ffs build with a 64-bit ino_t. Original code by: Gleb Kurtsou Modified: head/sbin/fsck_ffs/fsutil.c head/sbin/fsck_ffs/gjournal.c head/sbin/fsck_ffs/inode.c head/sbin/fsck_ffs/main.c head/sbin/fsck_ffs/pass1.c head/sbin/fsck_ffs/pass2.c head/sbin/fsck_ffs/pass4.c head/sbin/fsck_ffs/suj.c Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Thu Sep 27 23:30:49 2012 (r241011) +++ head/sbin/fsck_ffs/fsutil.c Thu Sep 27 23:30:58 2012 (r241012) @@ -137,7 +137,8 @@ inoinfo(ino_t inum) int iloff; if (inum > maxino) - errx(EEXIT, "inoinfo: inumber %d out of range", inum); + errx(EEXIT, "inoinfo: inumber %ju out of range", + (uintmax_t)inum); ilp = &inostathead[inum / sblock.fs_ipg]; iloff = inum % sblock.fs_ipg; if (iloff >= ilp->il_numalloced) Modified: head/sbin/fsck_ffs/gjournal.c ============================================================================== --- head/sbin/fsck_ffs/gjournal.c Thu Sep 27 23:30:49 2012 (r241011) +++ head/sbin/fsck_ffs/gjournal.c Thu Sep 27 23:30:58 2012 (r241012) @@ -448,7 +448,8 @@ gjournal_check(const char *filesys) if (isclr(inosused, cino)) continue; if (getino(disk, &p, ino, &mode) == -1) - err(1, "getino(cg=%d ino=%d)", cg, ino); + err(1, "getino(cg=%d ino=%ju)", + cg, (uintmax_t)ino); dino = p; /* Not a regular file nor directory? Skip it. */ if (!S_ISREG(dino->di_mode) && !S_ISDIR(dino->di_mode)) @@ -480,7 +481,8 @@ gjournal_check(const char *filesys) *dino = ufs2_zino; /* Write the inode back. */ if (putino(disk) == -1) - err(1, "putino(cg=%d ino=%d)", cg, ino); + err(1, "putino(cg=%d ino=%ju)", + cg, (uintmax_t)ino); if (cgp->cg_unrefs == 0) { //printf("No more unreferenced inodes in cg=%d.\n", cg); break; Modified: head/sbin/fsck_ffs/inode.c ============================================================================== --- head/sbin/fsck_ffs/inode.c Thu Sep 27 23:30:49 2012 (r241011) +++ head/sbin/fsck_ffs/inode.c Thu Sep 27 23:30:58 2012 (r241012) @@ -285,7 +285,8 @@ ginode(ino_t inumber) ufs2_daddr_t iblk; if (inumber < ROOTINO || inumber > maxino) - errx(EEXIT, "bad inode number %d to ginode", inumber); + errx(EEXIT, "bad inode number %ju to ginode", + (uintmax_t)inumber); if (startinum == 0 || inumber < startinum || inumber >= startinum + INOPB(&sblock)) { iblk = ino_to_fsba(&sblock, inumber); @@ -319,7 +320,8 @@ getnextinode(ino_t inumber, int rebuildc static caddr_t nextinop; if (inumber != nextino++ || inumber > lastvalidinum) - errx(EEXIT, "bad inode number %d to nextinode", inumber); + errx(EEXIT, "bad inode number %ju to nextinode", + (uintmax_t)inumber); if (inumber >= lastinum) { readcnt++; dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum)); @@ -398,7 +400,8 @@ setinodebuf(ino_t inum) { if (inum % sblock.fs_ipg != 0) - errx(EEXIT, "bad inode number %d to setinodebuf", inum); + errx(EEXIT, "bad inode number %ju to setinodebuf", + (uintmax_t)inum); lastvalidinum = inum + sblock.fs_ipg - 1; startinum = 0; nextino = inum; @@ -489,7 +492,7 @@ getinoinfo(ino_t inumber) continue; return (inp); } - errx(EEXIT, "cannot find inode %d", inumber); + errx(EEXIT, "cannot find inode %ju", (uintmax_t)inumber); return ((struct inoinfo *)0); } Modified: head/sbin/fsck_ffs/main.c ============================================================================== --- head/sbin/fsck_ffs/main.c Thu Sep 27 23:30:49 2012 (r241011) +++ head/sbin/fsck_ffs/main.c Thu Sep 27 23:30:58 2012 (r241012) @@ -492,7 +492,7 @@ checkfilesys(char *filesys) n_ffree * 100.0 / sblock.fs_dsize); if (debug) { if (files < 0) - printf("%d inodes missing\n", -files); + printf("%jd inodes missing\n", (intmax_t)-files); if (blks < 0) printf("%lld blocks missing\n", -(long long)blks); if (duplist != NULL) { Modified: head/sbin/fsck_ffs/pass1.c ============================================================================== --- head/sbin/fsck_ffs/pass1.c Thu Sep 27 23:30:49 2012 (r241011) +++ head/sbin/fsck_ffs/pass1.c Thu Sep 27 23:30:58 2012 (r241012) @@ -99,8 +99,9 @@ pass1(void) if (!rebuildcg && sblock.fs_magic == FS_UFS2_MAGIC) { inosused = cgrp.cg_initediblk; if (inosused > sblock.fs_ipg) { - pfatal("%s (%d > %d) %s %d\nReset to %d\n", - "Too many initialized inodes", inosused, + pfatal("%s (%ju > %d) %s %d\nReset to %d\n", + "Too many initialized inodes", + (uintmax_t)inosused, sblock.fs_ipg, "in cylinder group", c, sblock.fs_ipg); inosused = sblock.fs_ipg; Modified: head/sbin/fsck_ffs/pass2.c ============================================================================== --- head/sbin/fsck_ffs/pass2.c Thu Sep 27 23:30:49 2012 (r241011) +++ head/sbin/fsck_ffs/pass2.c Thu Sep 27 23:30:58 2012 (r241012) @@ -223,13 +223,14 @@ pass2(void) * inp->i_parent is directory to which ".." should point. */ getpathname(pathbuf, inp->i_parent, inp->i_number); - printf("BAD INODE NUMBER FOR '..' in DIR I=%d (%s)\n", - inp->i_number, pathbuf); + printf("BAD INODE NUMBER FOR '..' in DIR I=%ju (%s)\n", + (uintmax_t)inp->i_number, pathbuf); getpathname(pathbuf, inp->i_dotdot, inp->i_dotdot); - printf("CURRENTLY POINTS TO I=%d (%s), ", inp->i_dotdot, - pathbuf); + printf("CURRENTLY POINTS TO I=%ju (%s), ", + (uintmax_t)inp->i_dotdot, pathbuf); getpathname(pathbuf, inp->i_parent, inp->i_parent); - printf("SHOULD POINT TO I=%d (%s)", inp->i_parent, pathbuf); + printf("SHOULD POINT TO I=%ju (%s)", + (uintmax_t)inp->i_parent, pathbuf); if (cursnapshot != 0) { /* * We need to: @@ -443,8 +444,8 @@ again: } else { getpathname(dirname, idesc->id_number, dirp->d_ino); - pwarn("ZERO LENGTH DIRECTORY %s I=%d", - dirname, dirp->d_ino); + pwarn("ZERO LENGTH DIRECTORY %s I=%ju", + dirname, (uintmax_t)dirp->d_ino); /* * We need to: * setcwd(idesc->id_parent); @@ -507,8 +508,9 @@ again: break; default: - errx(EEXIT, "BAD STATE %d FOR INODE I=%d", - inoinfo(dirp->d_ino)->ino_state, dirp->d_ino); + errx(EEXIT, "BAD STATE %d FOR INODE I=%ju", + inoinfo(dirp->d_ino)->ino_state, + (uintmax_t)dirp->d_ino); } } if (n == 0) Modified: head/sbin/fsck_ffs/pass4.c ============================================================================== --- head/sbin/fsck_ffs/pass4.c Thu Sep 27 23:30:49 2012 (r241011) +++ head/sbin/fsck_ffs/pass4.c Thu Sep 27 23:30:58 2012 (r241012) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "fsck.h" @@ -114,8 +115,9 @@ pass4(void) break; default: - errx(EEXIT, "BAD STATE %d FOR INODE I=%d", - inoinfo(inumber)->ino_state, inumber); + errx(EEXIT, "BAD STATE %d FOR INODE I=%ju", + inoinfo(inumber)->ino_state, + (uintmax_t)inumber); } } } Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Thu Sep 27 23:30:49 2012 (r241011) +++ head/sbin/fsck_ffs/suj.c Thu Sep 27 23:30:58 2012 (r241012) @@ -831,8 +831,8 @@ ino_clrat(ino_t parent, off_t diroff, in int doff; if (debug) - printf("Clearing inode %d from parent %d at offset %jd\n", - child, parent, diroff); + printf("Clearing inode %ju from parent %ju at offset %jd\n", + (uintmax_t)child, (uintmax_t)parent, diroff); lbn = lblkno(fs, diroff); doff = blkoff(fs, diroff); @@ -842,8 +842,8 @@ ino_clrat(ino_t parent, off_t diroff, in block = dblk_read(blk, blksize); dp = (struct direct *)&block[doff]; if (dp->d_ino != child) - errx(1, "Inode %d does not exist in %d at %jd", - child, parent, diroff); + errx(1, "Inode %ju does not exist in %ju at %jd", + (uintmax_t)child, (uintmax_t)parent, diroff); dp->d_ino = 0; dblk_dirty(blk); /* @@ -879,10 +879,11 @@ ino_isat(ino_t parent, off_t diroff, ino * was reallocated. */ if (*mode != 0) - printf("Directory %d has bad mode %o\n", - parent, *mode); + printf("Directory %ju has bad mode %o\n", + (uintmax_t)parent, *mode); else - printf("Directory %d has zero mode\n", parent); + printf("Directory %ju has zero mode\n", + (uintmax_t)parent); } return (0); } @@ -891,15 +892,16 @@ ino_isat(ino_t parent, off_t diroff, ino blksize = sblksize(fs, DIP(dip, di_size), lbn); if (diroff + DIRECTSIZ(1) > DIP(dip, di_size) || doff >= blksize) { if (debug) - printf("ino %d absent from %d due to offset %jd" + printf("ino %ju absent from %ju due to offset %jd" " exceeding size %jd\n", - child, parent, diroff, DIP(dip, di_size)); + (uintmax_t)child, (uintmax_t)parent, diroff, + DIP(dip, di_size)); return (0); } blk = ino_blkatoff(dip, parent, lbn, &frags); if (blk <= 0) { if (debug) - printf("Sparse directory %d", parent); + printf("Sparse directory %ju", (uintmax_t)parent); return (0); } block = dblk_read(blk, blksize); @@ -918,12 +920,13 @@ ino_isat(ino_t parent, off_t diroff, ino dpoff += dp->d_reclen; } while (dpoff <= doff); if (dpoff > fs->fs_bsize) - err_suj("Corrupt directory block in dir ino %d\n", parent); + err_suj("Corrupt directory block in dir ino %ju\n", + (uintmax_t)parent); /* Not found. */ if (dpoff != doff) { if (debug) - printf("ino %d not found in %d, lbn %jd, dpoff %d\n", - child, parent, lbn, dpoff); + printf("ino %ju not found in %ju, lbn %jd, dpoff %d\n", + (uintmax_t)child, (uintmax_t)parent, lbn, dpoff); return (0); } /* @@ -940,8 +943,8 @@ ino_isat(ino_t parent, off_t diroff, ino return (1); } if (debug) - printf("ino %d doesn't match dirent ino %d in parent %d\n", - child, dp->d_ino, parent); + printf("ino %ju doesn't match dirent ino %ju in parent %ju\n", + (uintmax_t)child, (uintmax_t)dp->d_ino, (uintmax_t)parent); return (0); } @@ -977,8 +980,8 @@ indir_visit(ino_t ino, ufs_lbn_t lbn, uf err_suj("Invalid level for lbn %jd\n", lbn); if ((flags & VISIT_ROOT) == 0 && blk_isindir(blk, ino, lbn) == 0) { if (debug) - printf("blk %jd ino %d lbn %jd(%d) is not indir.\n", - blk, ino, lbn, level); + printf("blk %jd ino %ju lbn %jd(%d) is not indir.\n", + blk, (uintmax_t)ino, lbn, level); goto out; } lbnadd = 1; @@ -1131,8 +1134,8 @@ ino_adjblks(struct suj_ino *sino) if (blocks == DIP(ip, di_blocks)) return; if (debug) - printf("ino %d adjusting block count from %jd to %jd\n", - ino, DIP(ip, di_blocks), blocks); + printf("ino %ju adjusting block count from %jd to %jd\n", + (uintmax_t)ino, DIP(ip, di_blocks), blocks); DIP_SET(ip, di_blocks, blocks); ino_dirty(ino); } @@ -1264,8 +1267,8 @@ ino_free_children(ino_t ino, ufs_lbn_t l if (isdotdot && skipparent == 1) continue; if (debug) - printf("Directory %d removing ino %d name %s\n", - ino, dp->d_ino, dp->d_name); + printf("Directory %ju removing ino %ju name %s\n", + (uintmax_t)ino, (uintmax_t)dp->d_ino, dp->d_name); diroff = lblktosize(fs, lbn) + dpoff; ino_remref(ino, dp->d_ino, diroff, isdotdot); } @@ -1283,8 +1286,8 @@ ino_reclaim(union dinode *ip, ino_t ino, if (ino == ROOTINO) err_suj("Attempting to free ROOTINO\n"); if (debug) - printf("Truncating and freeing ino %d, nlink %d, mode %o\n", - ino, DIP(ip, di_nlink), DIP(ip, di_mode)); + printf("Truncating and freeing ino %ju, nlink %d, mode %o\n", + (uintmax_t)ino, DIP(ip, di_nlink), DIP(ip, di_mode)); /* We are freeing an inode or directory. */ if ((DIP(ip, di_mode) & IFMT) == IFDIR) @@ -1328,8 +1331,8 @@ ino_decr(ino_t ino) reqlink = 1; if (nlink < reqlink) { if (debug) - printf("ino %d not enough links to live %d < %d\n", - ino, nlink, reqlink); + printf("ino %ju not enough links to live %d < %d\n", + (uintmax_t)ino, nlink, reqlink); ino_reclaim(ip, ino, mode); return; } @@ -1374,7 +1377,7 @@ ino_adjust(struct suj_ino *sino) break; } if (srec == NULL) - errx(1, "Directory %d name not found", ino); + errx(1, "Directory %ju name not found", (uintmax_t)ino); } /* * If it's a directory with no real names pointing to it go ahead @@ -1398,21 +1401,23 @@ ino_adjust(struct suj_ino *sino) ip = ino_read(ino); mode = DIP(ip, di_mode) & IFMT; if (nlink > LINK_MAX) - err_suj( - "ino %d nlink manipulation error, new link %d, old link %d\n", - ino, nlink, DIP(ip, di_nlink)); + err_suj("ino %ju %s, new link %d, old link %d\n", + (uintmax_t)ino, "nlink manipulation error", nlink, + DIP(ip, di_nlink)); if (debug) - printf("Adjusting ino %d, nlink %d, old link %d lastmode %o\n", - ino, nlink, DIP(ip, di_nlink), sino->si_mode); + printf("Adjusting ino %ju, nlink %d, old link %d lastmode %o\n", + (uintmax_t)ino, nlink, DIP(ip, di_nlink), sino->si_mode); if (mode == 0) { if (debug) - printf("ino %d, zero inode freeing bitmap\n", ino); + printf("ino %ju, zero inode freeing bitmap\n", + (uintmax_t)ino); ino_free(ino, sino->si_mode); return; } /* XXX Should be an assert? */ if (mode != sino->si_mode && debug) - printf("ino %d, mode %o != %o\n", ino, mode, sino->si_mode); + printf("ino %ju, mode %o != %o\n", + (uintmax_t)ino, mode, sino->si_mode); if ((mode & IFMT) == IFDIR) reqlink = 2; else @@ -1420,15 +1425,16 @@ ino_adjust(struct suj_ino *sino) /* If the inode doesn't have enough links to live, free it. */ if (nlink < reqlink) { if (debug) - printf("ino %d not enough links to live %d < %d\n", - ino, nlink, reqlink); + printf("ino %ju not enough links to live %d < %d\n", + (uintmax_t)ino, nlink, reqlink); ino_reclaim(ip, ino, mode); return; } /* If required write the updated link count. */ if (DIP(ip, di_nlink) == nlink) { if (debug) - printf("ino %d, link matches, skipping.\n", ino); + printf("ino %ju, link matches, skipping.\n", + (uintmax_t)ino); return; } DIP_SET(ip, di_nlink, nlink); @@ -1527,8 +1533,8 @@ ino_trunc(ino_t ino, off_t size) mode = DIP(ip, di_mode) & IFMT; cursize = DIP(ip, di_size); if (debug) - printf("Truncating ino %d, mode %o to size %jd from size %jd\n", - ino, mode, size, cursize); + printf("Truncating ino %ju, mode %o to size %jd from size %jd\n", + (uintmax_t)ino, mode, size, cursize); /* Skip datablocks for short links and devices. */ if (mode == 0 || mode == IFBLK || mode == IFCHR || @@ -1586,7 +1592,8 @@ ino_trunc(ino_t ino, off_t size) bn = DIP(ip, di_db[visitlbn]); if (bn == 0) - err_suj("Bad blk at ino %d lbn %jd\n", ino, visitlbn); + err_suj("Bad blk at ino %ju lbn %jd\n", + (uintmax_t)ino, visitlbn); oldspace = sblksize(fs, cursize, visitlbn); newspace = sblksize(fs, size, visitlbn); if (oldspace != newspace) { @@ -1610,8 +1617,8 @@ ino_trunc(ino_t ino, off_t size) bn = ino_blkatoff(ip, ino, visitlbn, &frags); if (bn == 0) - err_suj("Block missing from ino %d at lbn %jd\n", - ino, visitlbn); + err_suj("Block missing from ino %ju at lbn %jd\n", + (uintmax_t)ino, visitlbn); clrsize = frags * fs->fs_fsize; buf = dblk_read(bn, clrsize); clrsize -= off; @@ -1656,11 +1663,11 @@ ino_check(struct suj_ino *sino) err_suj("Inode mode/directory type mismatch %o != %o\n", mode, rrec->jr_mode); if (debug) - printf("jrefrec: op %d ino %d, nlink %d, parent %d, " + printf("jrefrec: op %d ino %ju, nlink %d, parent %d, " "diroff %jd, mode %o, isat %d, isdot %d\n", - rrec->jr_op, rrec->jr_ino, rrec->jr_nlink, - rrec->jr_parent, rrec->jr_diroff, rrec->jr_mode, - isat, isdot); + rrec->jr_op, (uintmax_t)rrec->jr_ino, + rrec->jr_nlink, rrec->jr_parent, rrec->jr_diroff, + rrec->jr_mode, isat, isdot); mode = rrec->jr_mode & IFMT; if (rrec->jr_op == JOP_REMREF) removes++; @@ -1676,8 +1683,8 @@ ino_check(struct suj_ino *sino) * by one. */ if (debug) - printf("ino %d nlink %d newlinks %d removes %d dotlinks %d\n", - ino, nlink, newlinks, removes, dotlinks); + printf("ino %ju nlink %d newlinks %d removes %d dotlinks %d\n", + (uintmax_t)ino, nlink, newlinks, removes, dotlinks); nlink += newlinks; nlink -= removes; sino->si_linkadj = 1; @@ -1718,9 +1725,9 @@ blk_check(struct suj_blk *sblk) sino->si_blkadj = 1; } if (debug) - printf("op %d blk %jd ino %d lbn %jd frags %d isat %d (%d)\n", - brec->jb_op, blk, brec->jb_ino, brec->jb_lbn, - brec->jb_frags, isat, frags); + printf("op %d blk %jd ino %ju lbn %jd frags %d isat %d (%d)\n", + brec->jb_op, blk, (uintmax_t)brec->jb_ino, + brec->jb_lbn, brec->jb_frags, isat, frags); /* * If we found the block at this address we still have to * determine if we need to free the tail end that was @@ -1937,12 +1944,12 @@ ino_unlinked(void) */ if (DIP(ip, di_nlink) == 0) { if (debug) - printf("Freeing unlinked ino %d mode %o\n", + printf("Freeing unlinked ino %ju mode %o\n", ino, mode); ino_reclaim(ip, ino, mode); } else if (debug) - printf("Skipping ino %d mode %o with link %d\n", - ino, mode, DIP(ip, di_nlink)); + printf("Skipping ino %ju mode %o with link %d\n", + (uintmax_t)ino, mode, DIP(ip, di_nlink)); ino = inon; } } @@ -2365,27 +2372,27 @@ suj_verifyino(union dinode *ip) { if (DIP(ip, di_nlink) != 1) { - printf("Invalid link count %d for journal inode %d\n", - DIP(ip, di_nlink), sujino); + printf("Invalid link count %d for journal inode %ju\n", + DIP(ip, di_nlink), (uintmax_t)sujino); return (-1); } if ((DIP(ip, di_flags) & (SF_IMMUTABLE | SF_NOUNLINK)) != (SF_IMMUTABLE | SF_NOUNLINK)) { - printf("Invalid flags 0x%X for journal inode %d\n", - DIP(ip, di_flags), sujino); + printf("Invalid flags 0x%X for journal inode %ju\n", + DIP(ip, di_flags), (uintmax_t)sujino); return (-1); } if (DIP(ip, di_mode) != (IFREG | IREAD)) { - printf("Invalid mode %o for journal inode %d\n", - DIP(ip, di_mode), sujino); + printf("Invalid mode %o for journal inode %ju\n", + DIP(ip, di_mode), (uintmax_t)sujino); return (-1); } if (DIP(ip, di_size) < SUJ_MIN) { - printf("Invalid size %jd for journal inode %d\n", - DIP(ip, di_size), sujino); + printf("Invalid size %jd for journal inode %ju\n", + DIP(ip, di_size), (uintmax_t)sujino); return (-1); } @@ -2713,12 +2720,12 @@ suj_check(const char *filesys) * Build a list of journal blocks in jblocks before parsing the * available journal blocks in with suj_read(). */ - printf("** Reading %jd byte journal from inode %d.\n", - DIP(jip, di_size), sujino); + printf("** Reading %jd byte journal from inode %ju.\n", + DIP(jip, di_size), (uintmax_t)sujino); suj_jblocks = jblocks_create(); blocks = ino_visit(jip, sujino, suj_add_block, 0); if (blocks != numfrags(fs, DIP(jip, di_size))) { - printf("Sparse journal inode %d.\n", sujino); + printf("Sparse journal inode %ju.\n", (uintmax_t)sujino); return (-1); } suj_read(); From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 23:31:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0BF510658CF; Thu, 27 Sep 2012 23:31:06 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA3F28FC12; Thu, 27 Sep 2012 23:31:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RNV666023945; Thu, 27 Sep 2012 23:31:06 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RNV6kQ023929; Thu, 27 Sep 2012 23:31:06 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201209272331.q8RNV6kQ023929@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 27 Sep 2012 23:31:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241013 - in head/sbin: dump fsck_ffs fsdb fsirand growfs newfs quotacheck restore tunefs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 23:31:06 -0000 Author: mdf Date: Thu Sep 27 23:31:06 2012 New Revision: 241013 URL: http://svn.freebsd.org/changeset/base/241013 Log: Fix sbin/ build with a 64-bit ino_t. Original code by: Gleb Kurtsou Modified: head/sbin/dump/traverse.c head/sbin/fsck_ffs/suj.c head/sbin/fsdb/fsdb.c head/sbin/fsdb/fsdbutil.c head/sbin/fsirand/fsirand.c head/sbin/growfs/growfs.c head/sbin/newfs/mkfs.c head/sbin/quotacheck/quotacheck.c head/sbin/restore/dirs.c head/sbin/restore/interactive.c head/sbin/restore/restore.c head/sbin/restore/symtab.c head/sbin/restore/tape.c head/sbin/tunefs/tunefs.c Modified: head/sbin/dump/traverse.c ============================================================================== --- head/sbin/dump/traverse.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/dump/traverse.c Thu Sep 27 23:31:06 2012 (r241013) @@ -197,8 +197,8 @@ mapfiles(ino_t maxino, long *tapesize) (mode & IFMT) == 0) continue; if (ino >= maxino) { - msg("Skipping inode %d >= maxino %d\n", - ino, maxino); + msg("Skipping inode %ju >= maxino %ju\n", + (uintmax_t)ino, (uintmax_t)maxino); continue; } /* @@ -400,15 +400,16 @@ searchdir( for (loc = 0; loc < size; ) { dp = (struct direct *)(dblk + loc); if (dp->d_reclen == 0) { - msg("corrupted directory, inumber %d\n", ino); + msg("corrupted directory, inumber %ju\n", + (uintmax_t)ino); break; } loc += dp->d_reclen; if (dp->d_ino == 0) continue; if (dp->d_ino >= maxino) { - msg("corrupted directory entry, d_ino %d >= %d\n", - dp->d_ino, maxino); + msg("corrupted directory entry, d_ino %ju >= %ju\n", + (uintmax_t)dp->d_ino, (uintmax_t)maxino); break; } if (dp->d_name[0] == '.') { Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/fsck_ffs/suj.c Thu Sep 27 23:31:06 2012 (r241013) @@ -1945,7 +1945,7 @@ ino_unlinked(void) if (DIP(ip, di_nlink) == 0) { if (debug) printf("Freeing unlinked ino %ju mode %o\n", - ino, mode); + (uintmax_t)ino, mode); ino_reclaim(ip, ino, mode); } else if (debug) printf("Skipping ino %ju mode %o with link %d\n", Modified: head/sbin/fsdb/fsdb.c ============================================================================== --- head/sbin/fsdb/fsdb.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/fsdb/fsdb.c Thu Sep 27 23:31:06 2012 (r241013) @@ -39,6 +39,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -211,7 +212,8 @@ char * prompt(EditLine *el) { static char pstring[64]; - snprintf(pstring, sizeof(pstring), "fsdb (inum: %d)> ", curinum); + snprintf(pstring, sizeof(pstring), "fsdb (inum: %ju)> ", + (uintmax_t)curinum); return pstring; } @@ -298,8 +300,8 @@ ino_t curinum, ocurrent; #define GETINUM(ac,inum) inum = strtoul(argv[ac], &cp, 0); \ if (inum < ROOTINO || inum > maxino || cp == argv[ac] || *cp != '\0' ) { \ - printf("inode %d out of range; range is [%d,%d]\n", \ - inum, ROOTINO, maxino); \ + printf("inode %ju out of range; range is [%ju,%ju]\n", \ + (uintmax_t)inum, (uintmax_t)ROOTINO, (uintmax_t)maxino); \ return 1; \ } @@ -364,7 +366,8 @@ CMDFUNCSTART(uplink) if (!checkactive()) return 1; DIP_SET(curinode, di_nlink, DIP(curinode, di_nlink) + 1); - printf("inode %d link count now %d\n", curinum, DIP(curinode, di_nlink)); + printf("inode %ju link count now %d\n", + (uintmax_t)curinum, DIP(curinode, di_nlink)); inodirty(); return 0; } @@ -374,7 +377,8 @@ CMDFUNCSTART(downlink) if (!checkactive()) return 1; DIP_SET(curinode, di_nlink, DIP(curinode, di_nlink) - 1); - printf("inode %d link count now %d\n", curinum, DIP(curinode, di_nlink)); + printf("inode %ju link count now %d\n", + (uintmax_t)curinum, DIP(curinode, di_nlink)); inodirty(); return 0; } @@ -493,11 +497,11 @@ CMDFUNCSTART(findblk) if (is_ufs2 ? compare_blk64(wantedblk64, ino_to_fsba(&sblock, inum)) : compare_blk32(wantedblk32, ino_to_fsba(&sblock, inum))) { - printf("block %llu: inode block (%d-%d)\n", + printf("block %llu: inode block (%ju-%ju)\n", (unsigned long long)fsbtodb(&sblock, ino_to_fsba(&sblock, inum)), - (inum / INOPB(&sblock)) * INOPB(&sblock), - (inum / INOPB(&sblock) + 1) * INOPB(&sblock)); + (uintmax_t)(inum / INOPB(&sblock)) * INOPB(&sblock), + (uintmax_t)(inum / INOPB(&sblock) + 1) * INOPB(&sblock)); findblk_numtofind--; if (findblk_numtofind == 0) goto end; @@ -593,8 +597,8 @@ static int founddatablk(uint64_t blk) { - printf("%llu: data block of inode %d\n", - (unsigned long long)fsbtodb(&sblock, blk), curinum); + printf("%llu: data block of inode %ju\n", + (unsigned long long)fsbtodb(&sblock, blk), (uintmax_t)curinum); findblk_numtofind--; if (findblk_numtofind == 0) return 1; @@ -753,7 +757,7 @@ CMDFUNCSTART(ln) return 1; rval = makeentry(curinum, inum, argv[2]); if (rval) - printf("Ino %d entered as `%s'\n", inum, argv[2]); + printf("Ino %ju entered as `%s'\n", (uintmax_t)inum, argv[2]); else printf("could not enter name? weird.\n"); curinode = ginode(curinum); Modified: head/sbin/fsdb/fsdbutil.c ============================================================================== --- head/sbin/fsdb/fsdbutil.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/fsdb/fsdbutil.c Thu Sep 27 23:31:06 2012 (r241013) @@ -152,7 +152,7 @@ printstat(const char *cp, ino_t inum, un puts("fifo"); break; } - printf("I=%lu MODE=%o SIZE=%ju", (u_long)inum, DIP(dp, di_mode), + printf("I=%ju MODE=%o SIZE=%ju", (uintmax_t)inum, DIP(dp, di_mode), (uintmax_t)DIP(dp, di_size)); if (sblock.fs_magic != FS_UFS1_MAGIC) { t = _time64_to_time(dp->dp2.di_birthtime); @@ -290,7 +290,7 @@ printblocks(ino_t inum, union dinode *dp long ndb, offset; ufs2_daddr_t blkno; - printf("Blocks for inode %d:\n", inum); + printf("Blocks for inode %ju:\n", (uintmax_t)inum); printf("Direct blocks:\n"); ndb = howmany(DIP(dp, di_size), sblock.fs_bsize); for (i = 0; i < NDADDR && i < ndb; i++) { @@ -338,7 +338,7 @@ checkactivedir(void) return 0; } if ((DIP(curinode, di_mode) & IFMT) != IFDIR) { - warnx("inode %d not a directory", curinum); + warnx("inode %ju not a directory", (uintmax_t)curinum); return 0; } return 1; @@ -363,11 +363,12 @@ printactive(int doblocks) printstat("current inode", curinum, curinode); break; case 0: - printf("current inode %d: unallocated inode\n", curinum); + printf("current inode %ju: unallocated inode\n", (uintmax_t)curinum); break; default: - printf("current inode %d: screwy itype 0%o (mode 0%o)?\n", - curinum, DIP(curinode, di_mode) & IFMT, DIP(curinode, di_mode)); + printf("current inode %ju: screwy itype 0%o (mode 0%o)?\n", + (uintmax_t)curinum, DIP(curinode, di_mode) & IFMT, + DIP(curinode, di_mode)); break; } return 0; Modified: head/sbin/fsirand/fsirand.c ============================================================================== --- head/sbin/fsirand/fsirand.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/fsirand/fsirand.c Thu Sep 27 23:31:06 2012 (r241013) @@ -274,8 +274,8 @@ fsirand(char *device) dp2 = &((struct ufs2_dinode *)inodebuf)[n]; if (inumber >= ROOTINO) { if (printonly) - (void)printf("ino %d gen %08x\n", - inumber, + (void)printf("ino %ju gen %08x\n", + (uintmax_t)inumber, sblock->fs_magic == FS_UFS1_MAGIC ? dp1->di_gen : dp2->di_gen); else if (sblock->fs_magic == FS_UFS1_MAGIC) Modified: head/sbin/growfs/growfs.c ============================================================================== --- head/sbin/growfs/growfs.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/growfs/growfs.c Thu Sep 27 23:31:06 2012 (r241013) @@ -324,6 +324,7 @@ initcg(int cylno, time_t modtime, int fs DBG_FUNC("initcg") static caddr_t iobuf; long blkno, start; + ino_t ino; ufs2_daddr_t i, cbase, dmax; struct ufs1_dinode *dp1; struct csum *cs; @@ -392,8 +393,8 @@ initcg(int cylno, time_t modtime, int fs } acg.cg_cs.cs_nifree += sblock.fs_ipg; if (cylno == 0) - for (i = 0; i < ROOTINO; i++) { - setbit(cg_inosused(&acg), i); + for (ino = 0; ino < ROOTINO; ino++) { + setbit(cg_inosused(&acg), ino); acg.cg_cs.cs_nifree--; } /* Modified: head/sbin/newfs/mkfs.c ============================================================================== --- head/sbin/newfs/mkfs.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/newfs/mkfs.c Thu Sep 27 23:31:06 2012 (r241013) @@ -1003,7 +1003,8 @@ iput(union dinode *ip, ino_t ino) sblock.fs_cstotal.cs_nifree--; fscs[0].cs_nifree--; if (ino >= (unsigned long)sblock.fs_ipg * sblock.fs_ncg) { - printf("fsinit: inode value out of range (%d).\n", ino); + printf("fsinit: inode value out of range (%ju).\n", + (uintmax_t)ino); exit(32); } d = fsbtodb(&sblock, ino_to_fsba(&sblock, ino)); Modified: head/sbin/quotacheck/quotacheck.c ============================================================================== --- head/sbin/quotacheck/quotacheck.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/quotacheck/quotacheck.c Thu Sep 27 23:31:06 2012 (r241013) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -383,9 +384,9 @@ chkquota(char *specname, struct quotafil if (vflag) { if (aflag) (void)printf("%s: ", mntpt); - (void)printf("out of range UID/GID (%u/%u) ino=%u\n", + (void)printf("out of range UID/GID (%u/%u) ino=%ju\n", DIP(dp, di_uid), DIP(dp,di_gid), - ino); + (uintmax_t)ino); } continue; } @@ -601,7 +602,8 @@ getnextinode(ino_t inumber) static caddr_t nextinop; if (inumber != nextino++ || inumber > lastvalidinum) - errx(1, "bad inode number %d to nextinode", inumber); + errx(1, "bad inode number %ju to nextinode", + (uintmax_t)inumber); if (inumber >= lastinum) { readcnt++; dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum)); @@ -635,7 +637,7 @@ setinodebuf(ino_t inum) { if (inum % sblock.fs_ipg != 0) - errx(1, "bad inode number %d to setinodebuf", inum); + errx(1, "bad inode number %ju to setinodebuf", (uintmax_t)inum); lastvalidinum = inum + sblock.fs_ipg - 1; nextino = inum; lastinum = inum; Modified: head/sbin/restore/dirs.c ============================================================================== --- head/sbin/restore/dirs.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/restore/dirs.c Thu Sep 27 23:31:06 2012 (r241013) @@ -637,7 +637,8 @@ setdirmodes(int flags) continue; } if (ep == NULL) { - panic("cannot find directory inode %d\n", node.ino); + panic("cannot find directory inode %ju\n", + (uintmax_t)node.ino); continue; } cp = myname(ep); @@ -678,7 +679,8 @@ genliteraldir(char *name, ino_t ino) itp = inotablookup(ino); if (itp == NULL) - panic("Cannot find directory inode %d named %s\n", ino, name); + panic("Cannot find directory inode %ju named %s\n", + (uintmax_t)ino, name); if ((ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) { fprintf(stderr, "%s: ", name); (void) fflush(stderr); @@ -691,15 +693,15 @@ genliteraldir(char *name, ino_t ino) size = i < BUFSIZ ? i : BUFSIZ; if (read(dp, buf, (int) size) == -1) { fprintf(stderr, - "write error extracting inode %d, name %s\n", - curfile.ino, curfile.name); + "write error extracting inode %ju, name %s\n", + (uintmax_t)curfile.ino, curfile.name); fprintf(stderr, "read: %s\n", strerror(errno)); done(1); } if (!Nflag && write(ofile, buf, (int) size) == -1) { fprintf(stderr, - "write error extracting inode %d, name %s\n", - curfile.ino, curfile.name); + "write error extracting inode %ju, name %s\n", + (uintmax_t)curfile.ino, curfile.name); fprintf(stderr, "write: %s\n", strerror(errno)); done(1); } Modified: head/sbin/restore/interactive.c ============================================================================== --- head/sbin/restore/interactive.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/restore/interactive.c Thu Sep 27 23:31:06 2012 (r241013) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -675,7 +676,8 @@ formatf(struct afile *list, int nentry) for (j = 0; j < columns; j++) { fp = &list[j * lines + i]; if (vflag) { - fprintf(stderr, "%*d ", precision, fp->fnum); + fprintf(stderr, "%*ju ", + precision, (uintmax_t)fp->fnum); fp->len += precision + 1; } if (haveprefix) { Modified: head/sbin/restore/restore.c ============================================================================== --- head/sbin/restore/restore.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/restore/restore.c Thu Sep 27 23:31:06 2012 (r241013) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -61,7 +62,7 @@ listfile(char *name, ino_t ino, int type if (TSTINO(ino, dumpmap) == 0) return (descend); vprintf(stdout, "%s", type == LEAF ? "leaf" : "dir "); - fprintf(stdout, "%10d\t%s\n", ino, name); + fprintf(stdout, "%10ju\t%s\n", (uintmax_t)ino, name); return (descend); } @@ -83,7 +84,7 @@ addfile(char *name, ino_t ino, int type) if (ino == WINO && command == 'i' && !vflag) return (descend); if (!mflag) { - (void) sprintf(buf, "./%u", ino); + (void) sprintf(buf, "./%ju", (uintmax_t)ino); name = buf; if (type == NODE) { (void) genliteraldir(name, ino); @@ -457,8 +458,8 @@ nodeupdates(char *name, ino_t ino, int t * next incremental tape. */ case 0: - fprintf(stderr, "%s: (inode %d) not found on tape\n", - name, ino); + fprintf(stderr, "%s: (inode %ju) not found on tape\n", + name, (uintmax_t)ino); break; /* @@ -612,7 +613,7 @@ createleaves(char *symtabfile) while (first < curfile.ino) { ep = lookupino(first); if (ep == NULL) - panic("%d: bad first\n", first); + panic("%ju: bad first\n", (uintmax_t)first); fprintf(stderr, "%s: not found on tape\n", myname(ep)); ep->e_flags &= ~(NEW|EXTRACT); first = lowerbnd(first); @@ -625,8 +626,8 @@ createleaves(char *symtabfile) * on the next incremental tape. */ if (first != curfile.ino) { - fprintf(stderr, "expected next file %d, got %d\n", - first, curfile.ino); + fprintf(stderr, "expected next file %ju, got %ju\n", + (uintmax_t)first, (uintmax_t)curfile.ino); skipfile(); goto next; } @@ -852,7 +853,7 @@ verifyfile(char *name, ino_t ino, int ty if (np == ep) break; if (np == NULL) - panic("missing inumber %d\n", ino); + panic("missing inumber %ju\n", (uintmax_t)ino); if (ep->e_type == LEAF && type != LEAF) badentry(ep, "type should be LEAF"); return (descend); Modified: head/sbin/restore/symtab.c ============================================================================== --- head/sbin/restore/symtab.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/restore/symtab.c Thu Sep 27 23:31:06 2012 (r241013) @@ -52,6 +52,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -100,7 +101,7 @@ addino(ino_t inum, struct entry *np) struct entry **epp; if (inum < WINO || inum >= maxino) - panic("addino: out of range %d\n", inum); + panic("addino: out of range %ju\n", (uintmax_t)inum); epp = &entry[inum % entrytblsize]; np->e_ino = inum; np->e_next = *epp; @@ -121,7 +122,7 @@ deleteino(ino_t inum) struct entry **prev; if (inum < WINO || inum >= maxino) - panic("deleteino: out of range %d\n", inum); + panic("deleteino: out of range %ju\n", (uintmax_t)inum); prev = &entry[inum % entrytblsize]; for (next = *prev; next != NULL; next = next->e_next) { if (next->e_ino == inum) { @@ -131,7 +132,7 @@ deleteino(ino_t inum) } prev = &next->e_next; } - panic("deleteino: %d not found\n", inum); + panic("deleteino: %ju not found\n", (uintmax_t)inum); } /* Modified: head/sbin/restore/tape.c ============================================================================== --- head/sbin/restore/tape.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/restore/tape.c Thu Sep 27 23:31:06 2012 (r241013) @@ -274,7 +274,7 @@ setup(void) done(1); } maxino = (spcl.c_count * TP_BSIZE * NBBY) + 1; - dprintf(stdout, "maxino = %d\n", maxino); + dprintf(stdout, "maxino = %ju\n", (uintmax_t)maxino); map = calloc((unsigned)1, (unsigned)howmany(maxino, NBBY)); if (map == NULL) panic("no memory for active inode map\n"); @@ -1050,8 +1050,9 @@ setupextattr(int extsize) } extbufsize = 0; extbuf = NULL; - fprintf(stderr, "Cannot extract %d bytes %s for inode %d, name %s\n", - extsize, "of extended attributes", curfile.ino, curfile.name); + fprintf(stderr, "Cannot extract %d bytes %s for inode %ju, name %s\n", + extsize, "of extended attributes", (uintmax_t)curfile.ino, + curfile.name); return (NULL); } @@ -1079,8 +1080,8 @@ xtrfile(char *buf, long size) return; if (write(ofile, buf, (int) size) == -1) { fprintf(stderr, - "write error extracting inode %d, name %s\nwrite: %s\n", - curfile.ino, curfile.name, strerror(errno)); + "write error extracting inode %ju, name %s\nwrite: %s\n", + (uintmax_t)curfile.ino, curfile.name, strerror(errno)); } } @@ -1094,8 +1095,8 @@ xtrskip(char *buf, long size) if (lseek(ofile, size, SEEK_CUR) == -1) { fprintf(stderr, - "seek error extracting inode %d, name %s\nlseek: %s\n", - curfile.ino, curfile.name, strerror(errno)); + "seek error extracting inode %ju, name %s\nlseek: %s\n", + (uintmax_t)curfile.ino, curfile.name, strerror(errno)); done(1); } } @@ -1243,8 +1244,8 @@ getmore: fprintf(stderr, "restoring %s\n", curfile.name); break; case SKIP: - fprintf(stderr, "skipping over inode %d\n", - curfile.ino); + fprintf(stderr, "skipping over inode %ju\n", + (uintmax_t)curfile.ino); break; } if (!yflag && !reply("continue")) @@ -1477,10 +1478,11 @@ accthdr(struct s_spcl *header) fprintf(stderr, "Used inodes map header"); break; case TS_INODE: - fprintf(stderr, "File header, ino %d", previno); + fprintf(stderr, "File header, ino %ju", (uintmax_t)previno); break; case TS_ADDR: - fprintf(stderr, "File continuation header, ino %d", previno); + fprintf(stderr, "File continuation header, ino %ju", + (uintmax_t)previno); break; case TS_END: fprintf(stderr, "End of tape header"); @@ -1631,8 +1633,8 @@ checksum(int *buf) } if (i != CHECKSUM) { - fprintf(stderr, "Checksum error %o, inode %d file %s\n", i, - curfile.ino, curfile.name); + fprintf(stderr, "Checksum error %o, inode %ju file %s\n", i, + (uintmax_t)curfile.ino, curfile.name); return(FAIL); } return(GOOD); Modified: head/sbin/tunefs/tunefs.c ============================================================================== --- head/sbin/tunefs/tunefs.c Thu Sep 27 23:30:58 2012 (r241012) +++ head/sbin/tunefs/tunefs.c Thu Sep 27 23:31:06 2012 (r241013) @@ -894,7 +894,7 @@ journal_clear(void) warnx("Journal file does not exist"); return; } - printf("Clearing journal flags from inode %d\n", ino); + printf("Clearing journal flags from inode %ju\n", (uintmax_t)ino); if (getino(&disk, &ip, ino, &mode) != 0) { warn("Failed to get journal inode"); return; @@ -970,8 +970,8 @@ journal_alloc(int64_t size) ino = cgialloc(&disk); if (ino <= 0) break; - printf("Using inode %d in cg %d for %jd byte journal\n", - ino, cgp->cg_cgx, size); + printf("Using inode %ju in cg %d for %jd byte journal\n", + (uintmax_t)ino, cgp->cg_cgx, size); if (getino(&disk, &ip, ino, &mode) != 0) { warn("Failed to get allocated inode"); sbdirty(); From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 23:31:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9ECB21065A57; Thu, 27 Sep 2012 23:31:13 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 893E88FC12; Thu, 27 Sep 2012 23:31:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RNVDJD024006; Thu, 27 Sep 2012 23:31:13 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RNVDeT024002; Thu, 27 Sep 2012 23:31:13 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201209272331.q8RNVDeT024002@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 27 Sep 2012 23:31:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241014 - in head/bin: ls rm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 23:31:13 -0000 Author: mdf Date: Thu Sep 27 23:31:12 2012 New Revision: 241014 URL: http://svn.freebsd.org/changeset/base/241014 Log: Fix bin/ build with a 64-bit ino_t. Original code by: Gleb Kurtsou Modified: head/bin/ls/ls.c head/bin/ls/print.c head/bin/rm/rm.c Modified: head/bin/ls/ls.c ============================================================================== --- head/bin/ls/ls.c Thu Sep 27 23:31:06 2012 (r241013) +++ head/bin/ls/ls.c Thu Sep 27 23:31:12 2012 (r241014) @@ -561,7 +561,8 @@ display(const FTSENT *p, FTSENT *list, i NAMES *np; off_t maxsize; long maxblock; - u_long btotal, labelstrlen, maxinode, maxlen, maxnlink; + uintmax_t maxinode; + u_long btotal, labelstrlen, maxlen, maxnlink; u_long maxlabelstr; u_int sizelen; int maxflags; @@ -580,8 +581,9 @@ display(const FTSENT *p, FTSENT *list, i btotal = 0; initmax = getenv("LS_COLWIDTHS"); /* Fields match -lios order. New ones should be added at the end. */ - maxlabelstr = maxblock = maxinode = maxlen = maxnlink = - maxuser = maxgroup = maxflags = maxsize = 0; + maxlabelstr = maxblock = maxlen = maxnlink = 0; + maxuser = maxgroup = maxflags = maxsize = 0; + maxinode = 0; if (initmax != NULL && *initmax != '\0') { char *initmax2, *jinitmax; int ninitmax; @@ -609,7 +611,7 @@ display(const FTSENT *p, FTSENT *list, i strcpy(initmax2, "0"); ninitmax = sscanf(jinitmax, - " %lu : %ld : %lu : %u : %u : %i : %jd : %lu : %lu ", + " %ju : %ld : %lu : %u : %u : %i : %jd : %lu : %lu ", &maxinode, &maxblock, &maxnlink, &maxuser, &maxgroup, &maxflags, &maxsize, &maxlen, &maxlabelstr); f_notabs = 1; @@ -839,7 +841,7 @@ label_out: d.s_flags = maxflags; d.s_label = maxlabelstr; d.s_group = maxgroup; - d.s_inode = snprintf(NULL, 0, "%lu", maxinode); + d.s_inode = snprintf(NULL, 0, "%ju", maxinode); d.s_nlink = snprintf(NULL, 0, "%lu", maxnlink); sizelen = f_humanval ? HUMANVALSTR_LEN : snprintf(NULL, 0, "%ju", maxsize); Modified: head/bin/ls/print.c ============================================================================== --- head/bin/ls/print.c Thu Sep 27 23:31:06 2012 (r241013) +++ head/bin/ls/print.c Thu Sep 27 23:31:12 2012 (r241014) @@ -152,7 +152,8 @@ printlong(const DISPLAY *dp) continue; sp = p->fts_statp; if (f_inode) - (void)printf("%*lu ", dp->s_inode, (u_long)sp->st_ino); + (void)printf("%*ju ", + dp->s_inode, (uintmax_t)sp->st_ino); if (f_size) (void)printf("%*jd ", dp->s_block, howmany(sp->st_blocks, blocksize)); @@ -328,7 +329,8 @@ printaname(const FTSENT *p, u_long inode sp = p->fts_statp; chcnt = 0; if (f_inode) - chcnt += printf("%*lu ", (int)inodefield, (u_long)sp->st_ino); + chcnt += printf("%*ju ", + (int)inodefield, (uintmax_t)sp->st_ino); if (f_size) chcnt += printf("%*jd ", (int)sizefield, howmany(sp->st_blocks, blocksize)); Modified: head/bin/rm/rm.c ============================================================================== --- head/bin/rm/rm.c Thu Sep 27 23:31:06 2012 (r241013) +++ head/bin/rm/rm.c Thu Sep 27 23:31:12 2012 (r241014) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -429,8 +430,8 @@ rm_overwrite(char *file, struct stat *sb if (!S_ISREG(sbp->st_mode)) return (1); if (sbp->st_nlink > 1 && !fflag) { - warnx("%s (inode %u): not overwritten due to multiple links", - file, sbp->st_ino); + warnx("%s (inode %ju): not overwritten due to multiple links", + file, (uintmax_t)sbp->st_ino); return (0); } if ((fd = open(file, O_WRONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1) From owner-svn-src-all@FreeBSD.ORG Thu Sep 27 23:31:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1619D1065B4C; Thu, 27 Sep 2012 23:31:20 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF1518FC08; Thu, 27 Sep 2012 23:31:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8RNVJPg024066; Thu, 27 Sep 2012 23:31:19 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8RNVJfA024060; Thu, 27 Sep 2012 23:31:19 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201209272331.q8RNVJfA024060@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 27 Sep 2012 23:31:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241015 - in head: usr.bin/find usr.sbin/lpr/lpr usr.sbin/makefs/ffs usr.sbin/quot usr.sbin/snapinfo X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2012 23:31:20 -0000 Author: mdf Date: Thu Sep 27 23:31:19 2012 New Revision: 241015 URL: http://svn.freebsd.org/changeset/base/241015 Log: Fix usr.bin/ and usr.sbin/ build with a 64-bit ino_t. Original code by: Gleb Kurtsou Modified: head/usr.bin/find/ls.c head/usr.sbin/lpr/lpr/lpr.c head/usr.sbin/makefs/ffs/ffs_alloc.c head/usr.sbin/quot/quot.c head/usr.sbin/snapinfo/snapinfo.c Modified: head/usr.bin/find/ls.c ============================================================================== --- head/usr.bin/find/ls.c Thu Sep 27 23:31:12 2012 (r241014) +++ head/usr.bin/find/ls.c Thu Sep 27 23:31:19 2012 (r241015) @@ -63,7 +63,7 @@ printlong(char *name, char *accpath, str { char modep[15]; - (void)printf("%6lu %8"PRId64" ", (u_long) sb->st_ino, sb->st_blocks); + (void)printf("%6ju %8"PRId64" ", (uintmax_t)sb->st_ino, sb->st_blocks); (void)strmode(sb->st_mode, modep); (void)printf("%s %3u %-*s %-*s ", modep, sb->st_nlink, MAXLOGNAME - 1, user_from_uid(sb->st_uid, 0), MAXLOGNAME - 1, Modified: head/usr.sbin/lpr/lpr/lpr.c ============================================================================== --- head/usr.sbin/lpr/lpr/lpr.c Thu Sep 27 23:31:12 2012 (r241014) +++ head/usr.sbin/lpr/lpr/lpr.c Thu Sep 27 23:31:19 2012 (r241015) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -386,8 +387,8 @@ main(int argc, char *argv[]) continue; /* file unreasonable */ if (sflag && (cp = linked(arg)) != NULL) { - (void) snprintf(buf, sizeof(buf), "%u %u", statb.st_dev, - statb.st_ino); + (void)snprintf(buf, sizeof(buf), "%u %ju", + statb.st_dev, (uintmax_t)statb.st_ino); card('S', buf); if (format == 'p') card('T', title ? title : arg); Modified: head/usr.sbin/makefs/ffs/ffs_alloc.c ============================================================================== --- head/usr.sbin/makefs/ffs/ffs_alloc.c Thu Sep 27 23:31:12 2012 (r241014) +++ head/usr.sbin/makefs/ffs/ffs_alloc.c Thu Sep 27 23:31:19 2012 (r241015) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "makefs.h" @@ -439,8 +440,8 @@ ffs_blkfree(struct inode *ip, daddr_t bn } cg = dtog(fs, bno); if (bno >= fs->fs_size) { - warnx("bad block %lld, ino %llu", (long long)bno, - (unsigned long long)ip->i_number); + warnx("bad block %lld, ino %ju", (long long)bno, + (uintmax_t)ip->i_number); return; } error = bread(ip->i_fd, ip->i_fs, fsbtodb(fs, cgtod(fs, cg)), Modified: head/usr.sbin/quot/quot.c ============================================================================== --- head/usr.sbin/quot/quot.c Thu Sep 27 23:31:12 2012 (r241014) +++ head/usr.sbin/quot/quot.c Thu Sep 27 23:31:19 2012 (r241015) @@ -484,8 +484,8 @@ static void donames(int fd, struct fs *super, char *name) { int c; - ino_t inode; ino_t maxino; + uintmax_t inode; union dinode *dp; maxino = super->fs_ncg * super->fs_ipg - 1; @@ -493,9 +493,9 @@ donames(int fd, struct fs *super, char * while ((c = getchar()) != EOF && (c < '0' || c > '9')) while ((c = getchar()) != EOF && c != '\n'); ungetc(c,stdin); - while (scanf("%u",&inode) == 1) { + while (scanf("%ju", &inode) == 1) { if (inode > maxino) { - warnx("illegal inode %d",inode); + warnx("illegal inode %ju", inode); return; } errno = 0; Modified: head/usr.sbin/snapinfo/snapinfo.c ============================================================================== --- head/usr.sbin/snapinfo/snapinfo.c Thu Sep 27 23:31:12 2012 (r241014) +++ head/usr.sbin/snapinfo/snapinfo.c Thu Sep 27 23:31:19 2012 (r241015) @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -149,7 +150,7 @@ compare_function(const char *path, const printf("\tsnapshot "); printf("%s", path); if (verbose) - printf(" (inode %d)", st->st_ino); + printf(" (inode %ju)", (uintmax_t)st->st_ino); printf("\n"); if (!cont_search) return (EEXIST); From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 01:04:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A5CB1065672; Fri, 28 Sep 2012 01:04:10 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A1A18FC08; Fri, 28 Sep 2012 01:04:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8S149ap039546; Fri, 28 Sep 2012 01:04:09 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8S149DB039543; Fri, 28 Sep 2012 01:04:09 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201209280104.q8S149DB039543@svn.freebsd.org> From: Eitan Adler Date: Fri, 28 Sep 2012 01:04:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241016 - stable/9/lib/libfetch X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 01:04:10 -0000 Author: eadler Date: Fri Sep 28 01:04:09 2012 New Revision: 241016 URL: http://svn.freebsd.org/changeset/base/241016 Log: MFC r240495: Adding missing return statements during error conditions. PR: kern/171187 Approved by: cperciva (implicit) Modified: stable/9/lib/libfetch/file.c Directory Properties: stable/9/lib/libfetch/ (props changed) Modified: stable/9/lib/libfetch/file.c ============================================================================== --- stable/9/lib/libfetch/file.c Thu Sep 27 23:31:19 2012 (r241015) +++ stable/9/lib/libfetch/file.c Fri Sep 28 01:04:09 2012 (r241016) @@ -50,12 +50,15 @@ fetchXGetFile(struct url *u, struct url_ f = fopen(u->doc, "r"); - if (f == NULL) + if (f == NULL) { fetch_syserr(); + return (NULL); + } if (u->offset && fseeko(f, u->offset, SEEK_SET) == -1) { fclose(f); fetch_syserr(); + return (NULL); } fcntl(fileno(f), F_SETFD, FD_CLOEXEC); @@ -78,12 +81,15 @@ fetchPutFile(struct url *u, const char * else f = fopen(u->doc, "w+"); - if (f == NULL) + if (f == NULL) { fetch_syserr(); + return (NULL); + } if (u->offset && fseeko(f, u->offset, SEEK_SET) == -1) { fclose(f); fetch_syserr(); + return (NULL); } fcntl(fileno(f), F_SETFD, FD_CLOEXEC); From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 01:04:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89FCD1065677; Fri, 28 Sep 2012 01:04:10 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 742D28FC0A; Fri, 28 Sep 2012 01:04:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8S14A3g039561; Fri, 28 Sep 2012 01:04:10 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8S14Are039559; Fri, 28 Sep 2012 01:04:10 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201209280104.q8S14Are039559@svn.freebsd.org> From: Eitan Adler Date: Fri, 28 Sep 2012 01:04:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241017 - stable/8/lib/libfetch X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 01:04:10 -0000 Author: eadler Date: Fri Sep 28 01:04:09 2012 New Revision: 241017 URL: http://svn.freebsd.org/changeset/base/241017 Log: MFC r240495: Adding missing return statements during error conditions. PR: kern/171187 Approved by: cperciva (implicit) Modified: stable/8/lib/libfetch/file.c Directory Properties: stable/8/lib/libfetch/ (props changed) Modified: stable/8/lib/libfetch/file.c ============================================================================== --- stable/8/lib/libfetch/file.c Fri Sep 28 01:04:09 2012 (r241016) +++ stable/8/lib/libfetch/file.c Fri Sep 28 01:04:09 2012 (r241017) @@ -50,12 +50,15 @@ fetchXGetFile(struct url *u, struct url_ f = fopen(u->doc, "r"); - if (f == NULL) + if (f == NULL) { fetch_syserr(); + return (NULL); + } if (u->offset && fseeko(f, u->offset, SEEK_SET) == -1) { fclose(f); fetch_syserr(); + return (NULL); } fcntl(fileno(f), F_SETFD, FD_CLOEXEC); @@ -78,12 +81,15 @@ fetchPutFile(struct url *u, const char * else f = fopen(u->doc, "w+"); - if (f == NULL) + if (f == NULL) { fetch_syserr(); + return (NULL); + } if (u->offset && fseeko(f, u->offset, SEEK_SET) == -1) { fclose(f); fetch_syserr(); + return (NULL); } fcntl(fileno(f), F_SETFD, FD_CLOEXEC); From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 01:04:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 04282106564A; Fri, 28 Sep 2012 01:04:11 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E29C58FC0C; Fri, 28 Sep 2012 01:04:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8S14AOL039577; Fri, 28 Sep 2012 01:04:10 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8S14A5d039575; Fri, 28 Sep 2012 01:04:10 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201209280104.q8S14A5d039575@svn.freebsd.org> From: Eitan Adler Date: Fri, 28 Sep 2012 01:04:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241018 - stable/7/lib/libfetch X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 01:04:11 -0000 Author: eadler Date: Fri Sep 28 01:04:10 2012 New Revision: 241018 URL: http://svn.freebsd.org/changeset/base/241018 Log: MFC r240495: Adding missing return statements during error conditions. PR: kern/171187 Approved by: cperciva (implicit) Modified: stable/7/lib/libfetch/file.c Directory Properties: stable/7/lib/libfetch/ (props changed) Modified: stable/7/lib/libfetch/file.c ============================================================================== --- stable/7/lib/libfetch/file.c Fri Sep 28 01:04:09 2012 (r241017) +++ stable/7/lib/libfetch/file.c Fri Sep 28 01:04:10 2012 (r241018) @@ -49,12 +49,15 @@ fetchXGetFile(struct url *u, struct url_ f = fopen(u->doc, "r"); - if (f == NULL) + if (f == NULL) { fetch_syserr(); + return (NULL); + } if (u->offset && fseeko(f, u->offset, SEEK_SET) == -1) { fclose(f); fetch_syserr(); + return (NULL); } return (f); @@ -76,12 +79,15 @@ fetchPutFile(struct url *u, const char * else f = fopen(u->doc, "w+"); - if (f == NULL) + if (f == NULL) { fetch_syserr(); + return (NULL); + } if (u->offset && fseeko(f, u->offset, SEEK_SET) == -1) { fclose(f); fetch_syserr(); + return (NULL); } return (f); From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 01:39:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8E5341065670; Fri, 28 Sep 2012 01:39:26 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 795FE8FC0A; Fri, 28 Sep 2012 01:39:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8S1dQaf045374; Fri, 28 Sep 2012 01:39:26 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8S1dQ7h045371; Fri, 28 Sep 2012 01:39:26 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201209280139.q8S1dQ7h045371@svn.freebsd.org> From: Devin Teske Date: Fri, 28 Sep 2012 01:39:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241019 - head/usr.sbin/bsdconfig/share X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 01:39:26 -0000 Author: dteske Date: Fri Sep 28 01:39:25 2012 New Revision: 241019 URL: http://svn.freebsd.org/changeset/base/241019 Log: Sanitize varname argument in f_sysrc_find. This is as much for security as it is for sanity. Reviewed by: jilles Approved by: adrian (co-mentor) Modified: head/usr.sbin/bsdconfig/share/sysrc.subr Modified: head/usr.sbin/bsdconfig/share/sysrc.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/sysrc.subr Fri Sep 28 01:04:10 2012 (r241018) +++ head/usr.sbin/bsdconfig/share/sysrc.subr Fri Sep 28 01:39:25 2012 (r241019) @@ -49,6 +49,17 @@ f_include_lang $BSDCFG_LIBE/include/mess SUCCESS=0 FAILURE=1 +# +# Valid characters that can appear in an sh(1) variable name +# +# Please note that the character ranges A-Z and a-z should be avoided because +# these can include accent characters (which are not valid in a variable name). +# For example, A-Z matches any character that sorts after A but before Z, +# including A and Z. Although ASCII order would make more sense, that is not +# how it works. +# +VALID_VARNAME_CHARS="0-9ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_" + ############################################################ FUNCTIONS # f_clean_env [ --except $varname ... ] @@ -243,14 +254,16 @@ f_sysrc_get_default() # f_sysrc_find() { - local varname="$1" + local varname="${1%%[!$VALID_VARNAME_CHARS]*}" local regex="^[[:space:]]*$varname=" local rc_conf_files="$( f_sysrc_get rc_conf_files )" local conf_files= local file # Check parameters - [ "$varname" ] || return $FAILURE + case "$varname" in + ""|[0-9]*) return $FAILURE + esac # # If RC_CONFS is defined, set $rc_conf_files to an explicit From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 05:31:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E47C1065670; Fri, 28 Sep 2012 05:31:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6149C8FC08; Fri, 28 Sep 2012 05:31:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8S5V0vq081941; Fri, 28 Sep 2012 05:31:00 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8S5V0xJ081932; Fri, 28 Sep 2012 05:31:00 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201209280531.q8S5V0xJ081932@svn.freebsd.org> From: Alan Cox Date: Fri, 28 Sep 2012 05:31:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241020 - in head/sys: amd64/amd64 i386/i386 i386/xen ia64/ia64 mips/mips powerpc/aim sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 05:31:01 -0000 Author: alc Date: Fri Sep 28 05:30:59 2012 New Revision: 241020 URL: http://svn.freebsd.org/changeset/base/241020 Log: Eliminate a stale comment. It describes another use case for the pmap in Mach that doesn't exist in FreeBSD. Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c head/sys/ia64/ia64/pmap.c head/sys/mips/mips/pmap.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/sparc64/sparc64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri Sep 28 01:39:25 2012 (r241019) +++ head/sys/amd64/amd64/pmap.c Fri Sep 28 05:30:59 2012 (r241020) @@ -82,13 +82,6 @@ __FBSDID("$FreeBSD$"); /* * Manages physical address maps. * - * In addition to hardware address maps, this - * module is called upon to provide software-use-only - * maps which may or may not be stored in the same - * form as hardware maps. These pseudo-maps are - * used to store intermediate results from copy - * operations to and from address spaces. - * * Since the information managed by this module is * also stored by the logical address mapping module, * this module may throw away valid virtual-to-physical Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Fri Sep 28 01:39:25 2012 (r241019) +++ head/sys/i386/i386/pmap.c Fri Sep 28 05:30:59 2012 (r241020) @@ -80,13 +80,6 @@ __FBSDID("$FreeBSD$"); /* * Manages physical address maps. * - * In addition to hardware address maps, this - * module is called upon to provide software-use-only - * maps which may or may not be stored in the same - * form as hardware maps. These pseudo-maps are - * used to store intermediate results from copy - * operations to and from address spaces. - * * Since the information managed by this module is * also stored by the logical address mapping module, * this module may throw away valid virtual-to-physical Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Fri Sep 28 01:39:25 2012 (r241019) +++ head/sys/i386/xen/pmap.c Fri Sep 28 05:30:59 2012 (r241020) @@ -80,13 +80,6 @@ __FBSDID("$FreeBSD$"); /* * Manages physical address maps. * - * In addition to hardware address maps, this - * module is called upon to provide software-use-only - * maps which may or may not be stored in the same - * form as hardware maps. These pseudo-maps are - * used to store intermediate results from copy - * operations to and from address spaces. - * * Since the information managed by this module is * also stored by the logical address mapping module, * this module may throw away valid virtual-to-physical Modified: head/sys/ia64/ia64/pmap.c ============================================================================== --- head/sys/ia64/ia64/pmap.c Fri Sep 28 01:39:25 2012 (r241019) +++ head/sys/ia64/ia64/pmap.c Fri Sep 28 05:30:59 2012 (r241020) @@ -74,13 +74,6 @@ __FBSDID("$FreeBSD$"); /* * Manages physical address maps. * - * In addition to hardware address maps, this - * module is called upon to provide software-use-only - * maps which may or may not be stored in the same - * form as hardware maps. These pseudo-maps are - * used to store intermediate results from copy - * operations to and from address spaces. - * * Since the information managed by this module is * also stored by the logical address mapping module, * this module may throw away valid virtual-to-physical Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Fri Sep 28 01:39:25 2012 (r241019) +++ head/sys/mips/mips/pmap.c Fri Sep 28 05:30:59 2012 (r241020) @@ -42,13 +42,6 @@ /* * Manages physical address maps. * - * In addition to hardware address maps, this - * module is called upon to provide software-use-only - * maps which may or may not be stored in the same - * form as hardware maps. These pseudo-maps are - * used to store intermediate results from copy - * operations to and from address spaces. - * * Since the information managed by this module is * also stored by the logical address mapping module, * this module may throw away valid virtual-to-physical Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Fri Sep 28 01:39:25 2012 (r241019) +++ head/sys/powerpc/aim/mmu_oea.c Fri Sep 28 05:30:59 2012 (r241020) @@ -96,11 +96,6 @@ __FBSDID("$FreeBSD$"); /* * Manages physical address maps. * - * In addition to hardware address maps, this module is called upon to - * provide software-use-only maps which may or may not be stored in the - * same form as hardware maps. These pseudo-maps are used to store - * intermediate results from copy operations to and from address spaces. - * * Since the information managed by this module is also stored by the * logical address mapping module, this module may throw away valid virtual * to physical mappings at almost any time. However, invalidations of Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Fri Sep 28 01:39:25 2012 (r241019) +++ head/sys/powerpc/aim/mmu_oea64.c Fri Sep 28 05:30:59 2012 (r241020) @@ -96,11 +96,6 @@ __FBSDID("$FreeBSD$"); /* * Manages physical address maps. * - * In addition to hardware address maps, this module is called upon to - * provide software-use-only maps which may or may not be stored in the - * same form as hardware maps. These pseudo-maps are used to store - * intermediate results from copy operations to and from address spaces. - * * Since the information managed by this module is also stored by the * logical address mapping module, this module may throw away valid virtual * to physical mappings at almost any time. However, invalidations of Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Fri Sep 28 01:39:25 2012 (r241019) +++ head/sys/sparc64/sparc64/pmap.c Fri Sep 28 05:30:59 2012 (r241020) @@ -43,11 +43,6 @@ __FBSDID("$FreeBSD$"); /* * Manages physical address maps. * - * In addition to hardware address maps, this module is called upon to - * provide software-use-only maps which may or may not be stored in the - * same form as hardware maps. These pseudo-maps are used to store - * intermediate results from copy operations to and from address spaces. - * * Since the information managed by this module is also stored by the * logical address mapping module, this module may throw away valid virtual * to physical mappings at almost any time. However, invalidations of From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 07:51:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D629F1065672; Fri, 28 Sep 2012 07:51:30 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF1308FC1A; Fri, 28 Sep 2012 07:51:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8S7pUnI099357; Fri, 28 Sep 2012 07:51:30 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8S7pUQ5099349; Fri, 28 Sep 2012 07:51:30 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201209280751.q8S7pUQ5099349@svn.freebsd.org> From: Kevin Lo Date: Fri, 28 Sep 2012 07:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241021 - in head: cddl/contrib/opensolaris/lib/libdtrace/common cddl/contrib/opensolaris/lib/libzfs/common contrib/telnet/telnetd usr.bin/csup usr.sbin/pkg_install/lib usr.sbin/pw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 07:51:31 -0000 Author: kevlo Date: Fri Sep 28 07:51:30 2012 New Revision: 241021 URL: http://svn.freebsd.org/changeset/base/241021 Log: Make sure that each va_start has one and only one matching va_end, especially in error cases. Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c head/contrib/telnet/telnetd/state.c head/usr.bin/csup/proto.c head/usr.sbin/pkg_install/lib/exec.c head/usr.sbin/pw/pwupd.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c Fri Sep 28 05:30:59 2012 (r241020) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c Fri Sep 28 07:51:30 2012 (r241021) @@ -678,6 +678,7 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c dtp->dt_buffered_offs += needed; assert(dtp->dt_buffered_buf[dtp->dt_buffered_offs] == '\0'); + va_end(ap); return (0); } Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Fri Sep 28 05:30:59 2012 (r241020) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Fri Sep 28 07:51:30 2012 (r241021) @@ -368,6 +368,7 @@ zfs_standard_error_fmt(libzfs_handle_t * case ENOSPC: case EDQUOT: zfs_verror(hdl, EZFS_NOSPC, fmt, ap); + va_end(ap); return (-1); case EEXIST: @@ -467,6 +468,7 @@ zpool_standard_error_fmt(libzfs_handle_t case ENOSPC: case EDQUOT: zfs_verror(hdl, EZFS_NOSPC, fmt, ap); + va_end(ap); return (-1); case EAGAIN: Modified: head/contrib/telnet/telnetd/state.c ============================================================================== --- head/contrib/telnet/telnetd/state.c Fri Sep 28 05:30:59 2012 (r241020) +++ head/contrib/telnet/telnetd/state.c Fri Sep 28 07:51:30 2012 (r241021) @@ -1600,8 +1600,10 @@ output_data(const char *format, ...) char *buf; va_start(args, format); - if ((len = vasprintf(&buf, format, args)) == -1) + if ((len = vasprintf(&buf, format, args)) == -1) { + va_end(args); return -1; + } output_datalen(buf, len); va_end(args); free(buf); Modified: head/usr.bin/csup/proto.c ============================================================================== --- head/usr.bin/csup/proto.c Fri Sep 28 05:30:59 2012 (r241020) +++ head/usr.bin/csup/proto.c Fri Sep 28 07:51:30 2012 (r241021) @@ -789,18 +789,24 @@ proto_printf(struct stream *wr, const ch case '%': n = stream_write(wr, "%", 1); - if (n == -1) + if (n == -1) { + va_end(ap); return (-1); + } break; } - if (rv == -1) + if (rv == -1) { + va_end(ap); return (-1); + } fmt = cp + 1; } if (*fmt != '\0') { rv = stream_printf(wr, "%s", fmt); - if (rv == -1) + if (rv == -1) { + va_end(ap); return (-1); + } } done: va_end(ap); Modified: head/usr.sbin/pkg_install/lib/exec.c ============================================================================== --- head/usr.sbin/pkg_install/lib/exec.c Fri Sep 28 05:30:59 2012 (r241020) +++ head/usr.sbin/pkg_install/lib/exec.c Fri Sep 28 07:51:30 2012 (r241021) @@ -93,6 +93,7 @@ vpipe(const char *fmt, ...) fp = popen(cmd, "r"); if (fp == NULL) { warnx("popen() failed"); + va_end(args); return NULL; } get_string(rp, MAXPATHLEN, fp); Modified: head/usr.sbin/pw/pwupd.c ============================================================================== --- head/usr.sbin/pw/pwupd.c Fri Sep 28 05:30:59 2012 (r241020) +++ head/usr.sbin/pw/pwupd.c Fri Sep 28 07:51:30 2012 (r241021) @@ -102,6 +102,7 @@ pwdb(char *arg,...) if (WEXITSTATUS(i)) i = EIO; } + va_end(ap); return i; } From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 08:22:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9A55106566B; Fri, 28 Sep 2012 08:22:51 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 920FF8FC15; Fri, 28 Sep 2012 08:22:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8S8Mpar003295; Fri, 28 Sep 2012 08:22:51 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8S8Mp5G003292; Fri, 28 Sep 2012 08:22:51 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201209280822.q8S8Mp5G003292@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 28 Sep 2012 08:22:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241022 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 08:22:51 -0000 Author: pjd Date: Fri Sep 28 08:22:51 2012 New Revision: 241022 URL: http://svn.freebsd.org/changeset/base/241022 Log: Remove the topology lock from disk_gone(), it might be called with regular mutexes held and the topology lock is an sx lock. The topology lock was there to protect traversing through the list of providers of disk's geom, but it seems that disk's geom has always exactly one provider. Change the code to call g_wither_provider() for this one provider, which is safe to do without holding the topology lock and assert that there is indeed only one provider. Discussed with: ken MFC after: 1 week Modified: head/sys/geom/geom_disk.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Fri Sep 28 07:51:30 2012 (r241021) +++ head/sys/geom/geom_disk.c Fri Sep 28 08:22:51 2012 (r241022) @@ -635,13 +635,15 @@ disk_gone(struct disk *dp) struct g_geom *gp; struct g_provider *pp; - g_topology_lock(); gp = dp->d_geom; if (gp != NULL) { - LIST_FOREACH(pp, &gp->provider, provider) + pp = LIST_FIRST(&gp->provider); + if (pp != NULL) { + KASSERT(LIST_NEXT(pp, provider) == NULL, + ("geom %p has more than one provider", gp)); g_wither_provider(pp, ENXIO); + } } - g_topology_unlock(); } void From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 10:49:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 809E41065673; Fri, 28 Sep 2012 10:49:42 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B2948FC08; Fri, 28 Sep 2012 10:49:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SAngRc023377; Fri, 28 Sep 2012 10:49:42 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SAngC2023375; Fri, 28 Sep 2012 10:49:42 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201209281049.q8SAngC2023375@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 28 Sep 2012 10:49:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241023 - head/sys/boot/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 10:49:42 -0000 Author: ae Date: Fri Sep 28 10:49:41 2012 New Revision: 241023 URL: http://svn.freebsd.org/changeset/base/241023 Log: Make the loader a bit smarter, when it tries to open disk and the slice number is not exactly specified. When the disk has MBR, also try to read BSD label after ptable_getpart() call. When the disk has GPT, also set d_partition to 255. Mostly, this is how it worked before. Modified: head/sys/boot/common/disk.c Modified: head/sys/boot/common/disk.c ============================================================================== --- head/sys/boot/common/disk.c Fri Sep 28 08:22:51 2012 (r241022) +++ head/sys/boot/common/disk.c Fri Sep 28 10:49:41 2012 (r241023) @@ -179,12 +179,21 @@ disk_open(struct disk_devdesc *dev, off_ rc = ptable_getpart(od->table, &part, dev->d_partition); if (rc == 0) dev->d_offset = part.start; - } else if (dev->d_slice > 0) { + } else if (dev->d_slice >= 0) { /* Try to get information about partition */ - rc = ptable_getpart(od->table, &part, dev->d_slice); + if (dev->d_slice == 0) + rc = ptable_getbestpart(od->table, &part); + else + rc = ptable_getpart(od->table, &part, dev->d_slice); if (rc != 0) /* Partition doesn't exist */ goto out; dev->d_offset = part.start; + if (dev->d_slice == 0) { + /* Save the slice number of best partition to dev */ + dev->d_slice = part.index; + if (ptable_gettype(od->table) == PTABLE_GPT) + dev->d_partition = 255; + } if (dev->d_partition == 255) goto out; /* Nothing more to do */ /* @@ -217,13 +226,6 @@ disk_open(struct disk_devdesc *dev, off_ if (rc != 0) goto out; dev->d_offset += part.start; - } else if (dev->d_slice == 0) { - rc = ptable_getbestpart(od->table, &part); - if (rc != 0) - goto out; - /* Save the slice number of best partition to dev */ - dev->d_slice = part.index; - dev->d_offset = part.start; } out: if (table != NULL) From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 11:11:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EAF93106564A; Fri, 28 Sep 2012 11:11:42 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5DB88FC08; Fri, 28 Sep 2012 11:11:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SBBgOh026756; Fri, 28 Sep 2012 11:11:42 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SBBgjZ026754; Fri, 28 Sep 2012 11:11:42 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201209281111.q8SBBgjZ026754@svn.freebsd.org> From: Isabell Long Date: Fri, 28 Sep 2012 11:11:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241024 - head/usr.sbin/portsnap/portsnap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 11:11:43 -0000 Author: issyl0 (doc committer) Date: Fri Sep 28 11:11:42 2012 New Revision: 241024 URL: http://svn.freebsd.org/changeset/base/241024 Log: Add a note to portsnap(8) about the behaviour of the example cron command. PR: docs/171759 Submitted by: Paul Hoffman (phoffman at proper dot com) Approved by: cperciva, gabor (mentor) MFC after: 3 days Modified: head/usr.sbin/portsnap/portsnap/portsnap.8 Modified: head/usr.sbin/portsnap/portsnap/portsnap.8 ============================================================================== --- head/usr.sbin/portsnap/portsnap/portsnap.8 Fri Sep 28 10:49:41 2012 (r241023) +++ head/usr.sbin/portsnap/portsnap/portsnap.8 Fri Sep 28 11:11:42 2012 (r241024) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 5, 2012 +.Dd September 28, 2012 .Dt PORTSNAP 8 .Os FreeBSD .Sh NAME @@ -180,6 +180,23 @@ can quickly be extracted into If your clock is set to UTC, please pick a random time other than 3AM, to avoid overly imposing an uneven load on the server(s) hosting the snapshots. +.Pp +Note that running +.Nm +.Cm cron +or +.Nm +.Cm fetch +does not apply the changes that were received: they only only download +them. +To apply the changes, you must follow these commands with +.Nm +.Cm update . +The +.Nm +.Cm update +command is normally run by hand at a time when you are sure that +no one is manually working in the ports tree. .It Running .Nm From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 11:25:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DD45A106566C; Fri, 28 Sep 2012 11:25:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C35E68FC08; Fri, 28 Sep 2012 11:25:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SBP2Hq028716; Fri, 28 Sep 2012 11:25:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SBP2Xw028703; Fri, 28 Sep 2012 11:25:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209281125.q8SBP2Xw028703@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 28 Sep 2012 11:25:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241025 - in head/sys: compat/linux fs/coda fs/nfsserver kern nfsserver vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 11:25:03 -0000 Author: kib Date: Fri Sep 28 11:25:02 2012 New Revision: 241025 URL: http://svn.freebsd.org/changeset/base/241025 Log: Fix the mis-handling of the VV_TEXT on the nullfs vnodes. If you have a binary on a filesystem which is also mounted over by nullfs, you could execute the binary from the lower filesystem, or from the nullfs mount. When executed from lower filesystem, the lower vnode gets VV_TEXT flag set, and the file cannot be modified while the binary is active. But, if executed as the nullfs alias, only the nullfs vnode gets VV_TEXT set, and you still can open the lower vnode for write. Add a set of VOPs for the VV_TEXT query, set and clear operations, which are correctly bypassed to lower vnode. Tested by: pho (previous version) MFC after: 2 weeks Modified: head/sys/compat/linux/linux_misc.c head/sys/fs/coda/coda_subr.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/kern/imgact_elf.c head/sys/kern/kern_exec.c head/sys/kern/vfs_default.c head/sys/kern/vfs_vnops.c head/sys/kern/vnode_if.src head/sys/nfsserver/nfs_serv.c head/sys/vm/vm_object.c head/sys/vm/vnode_pager.c Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Fri Sep 28 11:11:42 2012 (r241024) +++ head/sys/compat/linux/linux_misc.c Fri Sep 28 11:25:02 2012 (r241025) @@ -386,7 +386,7 @@ linux_uselib(struct thread *td, struct l * XXX: Note that if any of the VM operations fail below we don't * clear this flag. */ - vp->v_vflag |= VV_TEXT; + VOP_SET_TEXT(vp); /* * Lock no longer needed Modified: head/sys/fs/coda/coda_subr.c ============================================================================== --- head/sys/fs/coda/coda_subr.c Fri Sep 28 11:11:42 2012 (r241024) +++ head/sys/fs/coda/coda_subr.c Fri Sep 28 11:25:02 2012 (r241025) @@ -486,7 +486,7 @@ handleDownCall(struct coda_mntinfo *mnt, cache_purge(CTOV(cp)); cp->c_flags &= ~(C_VATTR | C_ACCCACHE); ASSERT_VOP_LOCKED(CTOV(cp), "coda HandleDownCall"); - if (CTOV(cp)->v_vflag & VV_TEXT) + if (VOP_IS_TEXT(CTOV(cp))) error = coda_vmflush(cp); CODADEBUG(CODA_ZAPFILE, myprintf(("zapfile: fid = %s, refcnt = %d, error = " @@ -532,7 +532,7 @@ handleDownCall(struct coda_mntinfo *mnt, cp->c_flags &= ~(C_VATTR | C_ACCCACHE); ASSERT_VOP_LOCKED(CTOV(cp), "coda HandleDownCall"); if (!(IS_DIR(out->coda_purgefid.Fid)) - && (CTOV(cp)->v_vflag & VV_TEXT)) + && VOP_IS_TEXT(CTOV(cp))) error = coda_vmflush(cp); CODADEBUG(CODA_PURGEFID, myprintf(("purgefid: fid " "= %s, refcnt = %d, error = %d\n", Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Fri Sep 28 11:11:42 2012 (r241024) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Fri Sep 28 11:25:02 2012 (r241025) @@ -252,7 +252,7 @@ nfsvno_accchk(struct vnode *vp, accmode_ * the inode, try to free it up once. If * we fail, we can't allow writing. */ - if ((vp->v_vflag & VV_TEXT) != 0 && error == 0) + if (VOP_IS_TEXT(vp) && error == 0) error = ETXTBSY; } if (error != 0) { Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Fri Sep 28 11:11:42 2012 (r241024) +++ head/sys/kern/imgact_elf.c Fri Sep 28 11:25:02 2012 (r241025) @@ -647,7 +647,7 @@ __elfN(load_file)(struct proc *p, const * Also make certain that the interpreter stays the same, so set * its VV_TEXT flag, too. */ - nd->ni_vp->v_vflag |= VV_TEXT; + VOP_SET_TEXT(nd->ni_vp); imgp->object = nd->ni_vp->v_object; Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Fri Sep 28 11:11:42 2012 (r241024) +++ head/sys/kern/kern_exec.c Fri Sep 28 11:25:02 2012 (r241025) @@ -473,9 +473,8 @@ interpret: * Remember if this was set before and unset it in case this is not * actually an executable image. */ - textset = imgp->vp->v_vflag & VV_TEXT; - ASSERT_VOP_ELOCKED(imgp->vp, "vv_text"); - imgp->vp->v_vflag |= VV_TEXT; + textset = VOP_IS_TEXT(imgp->vp); + VOP_SET_TEXT(imgp->vp); error = exec_map_first_page(imgp); if (error) @@ -506,10 +505,8 @@ interpret: if (error) { if (error == -1) { - if (textset == 0) { - ASSERT_VOP_ELOCKED(imgp->vp, "vv_text"); - imgp->vp->v_vflag &= ~VV_TEXT; - } + if (textset == 0) + VOP_UNSET_TEXT(imgp->vp); error = ENOEXEC; } goto exec_fail_dealloc; @@ -527,7 +524,7 @@ interpret: * VV_TEXT will be set. The vnode lock is held over this * entire period so nothing should illegitimately be blocked. */ - imgp->vp->v_vflag &= ~VV_TEXT; + VOP_UNSET_TEXT(imgp->vp); /* free name buffer and old vnode */ if (args->fname != NULL) NDFREE(&nd, NDF_ONLY_PNBUF); Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Fri Sep 28 11:11:42 2012 (r241024) +++ head/sys/kern/vfs_default.c Fri Sep 28 11:25:02 2012 (r241025) @@ -78,6 +78,10 @@ static int dirent_exists(struct vnode *v #define DIRENT_MINSIZE (sizeof(struct dirent) - (MAXNAMLEN+1) + 4) +static int vop_stdis_text(struct vop_is_text_args *ap); +static int vop_stdset_text(struct vop_set_text_args *ap); +static int vop_stdunset_text(struct vop_unset_text_args *ap); + /* * This vnode table stores what we want to do if the filesystem doesn't * implement a particular VOP. @@ -126,6 +130,9 @@ struct vop_vector default_vnodeops = { .vop_unp_bind = vop_stdunp_bind, .vop_unp_connect = vop_stdunp_connect, .vop_unp_detach = vop_stdunp_detach, + .vop_is_text = vop_stdis_text, + .vop_set_text = vop_stdset_text, + .vop_unset_text = vop_stdunset_text, }; /* @@ -1073,6 +1080,29 @@ vop_stdunp_detach(struct vop_unp_detach_ return (0); } +static int +vop_stdis_text(struct vop_is_text_args *ap) +{ + + return ((ap->a_vp->v_vflag & VV_TEXT) != 0); +} + +static int +vop_stdset_text(struct vop_set_text_args *ap) +{ + + ap->a_vp->v_vflag |= VV_TEXT; + return (0); +} + +static int +vop_stdunset_text(struct vop_unset_text_args *ap) +{ + + ap->a_vp->v_vflag &= ~VV_TEXT; + return (0); +} + /* * vfs default ops * used to fill the vfs function table to get reasonable default return values. Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Fri Sep 28 11:11:42 2012 (r241024) +++ head/sys/kern/vfs_vnops.c Fri Sep 28 11:25:02 2012 (r241025) @@ -342,7 +342,7 @@ vn_writechk(vp) * the vnode, try to free it up once. If * we fail, we can't allow writing. */ - if (vp->v_vflag & VV_TEXT) + if (VOP_IS_TEXT(vp)) return (ETXTBSY); return (0); Modified: head/sys/kern/vnode_if.src ============================================================================== --- head/sys/kern/vnode_if.src Fri Sep 28 11:11:42 2012 (r241024) +++ head/sys/kern/vnode_if.src Fri Sep 28 11:25:02 2012 (r241025) @@ -660,6 +660,24 @@ vop_unp_detach { IN struct vnode *vp; }; +%% is_text vp L L L + +vop_is_text { + IN struct vnode *vp; +}; + +%% set_text vp E E E + +vop_set_text { + IN struct vnode *vp; +}; + +%% vop_unset_text vp E E E + +vop_unset_text { + IN struct vnode *vp; +}; + # The VOPs below are spares at the end of the table to allow new VOPs to be # added in stable branches without breaking the KBI. New VOPs in HEAD should # be added above these spares. When merging a new VOP to a stable branch, Modified: head/sys/nfsserver/nfs_serv.c ============================================================================== --- head/sys/nfsserver/nfs_serv.c Fri Sep 28 11:11:42 2012 (r241024) +++ head/sys/nfsserver/nfs_serv.c Fri Sep 28 11:25:02 2012 (r241025) @@ -3896,7 +3896,7 @@ nfsrv_access(struct vnode *vp, accmode_t * If there's shared text associated with * the inode, we can't allow writing. */ - if (vp->v_vflag & VV_TEXT) + if (VOP_IS_TEXT(vp)) return (ETXTBSY); } Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Fri Sep 28 11:11:42 2012 (r241024) +++ head/sys/vm/vm_object.c Fri Sep 28 11:25:02 2012 (r241025) @@ -456,7 +456,7 @@ vm_object_vndeallocate(vm_object_t objec VOP_UNLOCK(vp, 0); } else { if (object->ref_count == 0) - vp->v_vflag &= ~VV_TEXT; + VOP_UNSET_TEXT(vp); VM_OBJECT_UNLOCK(object); vput(vp); } Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Fri Sep 28 11:11:42 2012 (r241024) +++ head/sys/vm/vnode_pager.c Fri Sep 28 11:25:02 2012 (r241025) @@ -277,7 +277,7 @@ vnode_pager_dealloc(object) __func__, vp, vp->v_writecount); } vp->v_object = NULL; - vp->v_vflag &= ~VV_TEXT; + VOP_UNSET_TEXT(vp); VM_OBJECT_UNLOCK(object); while (refs-- > 0) vunref(vp); From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 11:32:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24792106566C; Fri, 28 Sep 2012 11:32:29 +0000 (UTC) (envelope-from cvs-src@yandex.ru) Received: from forward1h.mail.yandex.net (forward1h.mail.yandex.net [IPv6:2a02:6b8:0:f05::10]) by mx1.freebsd.org (Postfix) with ESMTP id 8EE858FC0A; Fri, 28 Sep 2012 11:32:28 +0000 (UTC) Received: from smtp1h.mail.yandex.net (smtp1h.mail.yandex.net [84.201.187.144]) by forward1h.mail.yandex.net (Yandex) with ESMTP id E2C9A9E30A1; Fri, 28 Sep 2012 15:32:26 +0400 (MSK) Received: from smtp1h.mail.yandex.net (localhost [127.0.0.1]) by smtp1h.mail.yandex.net (Yandex) with ESMTP id 7BC8B134014F; Fri, 28 Sep 2012 15:32:26 +0400 (MSK) Received: from unknown (unknown [77.66.155.61]) by smtp1h.mail.yandex.net (nwsmtp/Yandex) with ESMTP id VsUWtLS8-VtU879Sr; Fri, 28 Sep 2012 15:31:55 +0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1348831946; bh=zOtmbH6TIOYfieLV7WEkFHK/TFjwNjw4mVAEYFp25Y8=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=mTsLEsFxdGz/s1cB10oXk6IzymdxLNkgSZjRnMIVijW2wP4hVqtk6Yba3+lH89A90 o3aPTJt1MLFW9PcRXd0TTbh5LVUOIKcLMYY9C7njSaKJVL7wOG+fFrAoDZkvSwN9gw hLJrSvW4ICundC3gt2k881bQ2Pd5cGg6pmLgmC5Y= Message-ID: <50658A91.7040603@yandex.ru> Date: Fri, 28 Sep 2012 15:31:29 +0400 From: Ruslan Mahmatkhanov User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 To: Isabell Long References: <201209281111.q8SBBgjZ026754@svn.freebsd.org> In-Reply-To: <201209281111.q8SBBgjZ026754@svn.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r241024 - head/usr.sbin/portsnap/portsnap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 11:32:29 -0000 Isabell Long wrote on 28.09.2012 15:11: > Author: issyl0 (doc committer) > Date: Fri Sep 28 11:11:42 2012 > New Revision: 241024 > URL: http://svn.freebsd.org/changeset/base/241024 > > Log: > Add a note to portsnap(8) about the behaviour of the example cron command. [ ...] > +.Pp > +Note that running > +.Nm > +.Cm cron > +or > +.Nm > +.Cm fetch > +does not apply the changes that were received: they only only download double 'only' > +them. > +To apply the changes, you must follow these commands with > +.Nm > +.Cm update . > +The > +.Nm > +.Cm update > +command is normally run by hand at a time when you are sure that > +no one is manually working in the ports tree. > .It > Running > .Nm -- Regards, Ruslan Tinderboxing kills... the drives. From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 11:41:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 709A9106564A; Fri, 28 Sep 2012 11:41:00 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B7128FC15; Fri, 28 Sep 2012 11:41:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SBf03v031042; Fri, 28 Sep 2012 11:41:00 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SBf0G2031040; Fri, 28 Sep 2012 11:41:00 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201209281141.q8SBf0G2031040@svn.freebsd.org> From: Isabell Long Date: Fri, 28 Sep 2012 11:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241026 - head/usr.sbin/portsnap/portsnap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 11:41:00 -0000 Author: issyl0 (doc committer) Date: Fri Sep 28 11:40:59 2012 New Revision: 241026 URL: http://svn.freebsd.org/changeset/base/241026 Log: Change "only only" to "only" in portsnap(8). Spotted by: Ruslan Mahmatkhanov Approved by: gabor (mentor, implicit) Modified: head/usr.sbin/portsnap/portsnap/portsnap.8 Modified: head/usr.sbin/portsnap/portsnap/portsnap.8 ============================================================================== --- head/usr.sbin/portsnap/portsnap/portsnap.8 Fri Sep 28 11:25:02 2012 (r241025) +++ head/usr.sbin/portsnap/portsnap/portsnap.8 Fri Sep 28 11:40:59 2012 (r241026) @@ -187,7 +187,7 @@ Note that running or .Nm .Cm fetch -does not apply the changes that were received: they only only download +does not apply the changes that were received: they only download them. To apply the changes, you must follow these commands with .Nm From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 11:59:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19051106564A; Fri, 28 Sep 2012 11:59:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0216E8FC15; Fri, 28 Sep 2012 11:59:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SBxWZY033647; Fri, 28 Sep 2012 11:59:32 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SBxW3h033642; Fri, 28 Sep 2012 11:59:32 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201209281159.q8SBxW3h033642@svn.freebsd.org> From: John Baldwin Date: Fri, 28 Sep 2012 11:59:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241027 - in head/sys: amd64/include/pc dev/ipmi i386/include/pc x86/bios X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 11:59:33 -0000 Author: jhb Date: Fri Sep 28 11:59:32 2012 New Revision: 241027 URL: http://svn.freebsd.org/changeset/base/241027 Log: - Re-shuffle the headers to move all kernel-specific bits under #ifdef _KERNEL but leave definitions for various structures defined by standards ($PIR table, SMAP entries, etc.) available to userland. - Consolidate duplicate SMBIOS table structure definitions in ipmi(4) and smbios(4) in and make them available to userland. MFC after: 2 weeks Modified: head/sys/amd64/include/pc/bios.h head/sys/dev/ipmi/ipmi_smbios.c head/sys/i386/include/pc/bios.h head/sys/x86/bios/smbios.c Modified: head/sys/amd64/include/pc/bios.h ============================================================================== --- head/sys/amd64/include/pc/bios.h Fri Sep 28 11:40:59 2012 (r241026) +++ head/sys/amd64/include/pc/bios.h Fri Sep 28 11:59:32 2012 (r241027) @@ -30,16 +30,9 @@ #ifndef _MACHINE_PC_BIOS_H_ #define _MACHINE_PC_BIOS_H_ -extern u_int32_t bios_sigsearch(u_int32_t start, u_char *sig, int siglen, - int paralen, int sigofs); - -#define BIOS_PADDRTOVADDR(x) ((x) + KERNBASE) -#define BIOS_VADDRTOPADDR(x) ((x) - KERNBASE) - /* * Int 15:E820 'SMAP' structure */ - #define SMAP_SIG 0x534D4150 /* 'SMAP' */ #define SMAP_TYPE_MEMORY 1 @@ -58,22 +51,61 @@ struct bios_smap { u_int32_t type; } __packed; +/* + * System Management BIOS + */ +#define SMBIOS_START 0xf0000 +#define SMBIOS_STEP 0x10 +#define SMBIOS_OFF 0 +#define SMBIOS_LEN 4 +#define SMBIOS_SIG "_SM_" + +struct smbios_eps { + uint8_t anchor_string[4]; /* '_SM_' */ + uint8_t checksum; + uint8_t length; + uint8_t major_version; + uint8_t minor_version; + uint16_t maximum_structure_size; + uint8_t entry_point_revision; + uint8_t formatted_area[5]; + uint8_t intermediate_anchor_string[5]; /* '_DMI_' */ + uint8_t intermediate_checksum; + uint16_t structure_table_length; + uint32_t structure_table_address; + uint16_t number_structures; + uint8_t BCD_revision; +}; + +struct smbios_structure_header { + uint8_t type; + uint8_t length; + uint16_t handle; +}; + +#ifdef _KERNEL +#define BIOS_PADDRTOVADDR(x) ((x) + KERNBASE) +#define BIOS_VADDRTOPADDR(x) ((x) - KERNBASE) + struct bios_oem_signature { char * anchor; /* search anchor string in BIOS memory */ size_t offset; /* offset from anchor (may be negative) */ size_t totlen; /* total length of BIOS string to copy */ } __packed; + struct bios_oem_range { u_int from; /* shouldn't be below 0xe0000 */ u_int to; /* shouldn't be above 0xfffff */ } __packed; + struct bios_oem { struct bios_oem_range range; struct bios_oem_signature signature[]; } __packed; -extern int -bios_oem_strings(struct bios_oem *oem, u_char *buffer, size_t maxlen); - +int bios_oem_strings(struct bios_oem *oem, u_char *buffer, size_t maxlen); +uint32_t bios_sigsearch(uint32_t start, u_char *sig, int siglen, int paralen, + int sigofs); +#endif #endif /* _MACHINE_PC_BIOS_H_ */ Modified: head/sys/dev/ipmi/ipmi_smbios.c ============================================================================== --- head/sys/dev/ipmi/ipmi_smbios.c Fri Sep 28 11:40:59 2012 (r241026) +++ head/sys/dev/ipmi/ipmi_smbios.c Fri Sep 28 11:59:32 2012 (r241027) @@ -52,29 +52,6 @@ __FBSDID("$FreeBSD$"); #define pmap_unmapbios pmap_unmapdev #endif -struct smbios_table { - uint8_t anchor_string[4]; - uint8_t checksum; - uint8_t length; - uint8_t major_version; - uint8_t minor_version; - uint16_t maximum_structure_size; - uint8_t entry_point_revision; - uint8_t formatted_area[5]; - uint8_t DMI_anchor_string[5]; - uint8_t intermediate_checksum; - uint16_t structure_table_length; - uint32_t structure_table_address; - uint16_t number_structures; - uint8_t BCD_revision; -}; - -struct structure_header { - uint8_t type; - uint8_t length; - uint16_t handle; -}; - struct ipmi_entry { uint8_t type; uint8_t length; @@ -102,13 +79,7 @@ struct ipmi_entry { #define SPACING_32 0x1 #define SPACING_16 0x2 -#define SMBIOS_START 0xf0000 -#define SMBIOS_STEP 0x10 -#define SMBIOS_OFF 0 -#define SMBIOS_LEN 4 -#define SMBIOS_SIG "_SM_" - -typedef void (*smbios_callback_t)(struct structure_header *, void *); +typedef void (*smbios_callback_t)(struct smbios_structure_header *, void *); static struct ipmi_get_info ipmi_info; static int ipmi_probed; @@ -116,13 +87,13 @@ static struct mtx ipmi_info_mtx; MTX_SYSINIT(ipmi_info, &ipmi_info_mtx, "ipmi info", MTX_DEF); static void ipmi_smbios_probe(struct ipmi_get_info *); -static int smbios_cksum(struct smbios_table *); +static int smbios_cksum(struct smbios_eps *); static void smbios_walk_table(uint8_t *, int, smbios_callback_t, void *); -static void smbios_ipmi_info(struct structure_header *, void *); +static void smbios_ipmi_info(struct smbios_structure_header *, void *); static void -smbios_ipmi_info(struct structure_header *h, void *arg) +smbios_ipmi_info(struct smbios_structure_header *h, void *arg) { struct ipmi_get_info *info; struct ipmi_entry *s; @@ -178,10 +149,10 @@ smbios_ipmi_info(struct structure_header static void smbios_walk_table(uint8_t *p, int entries, smbios_callback_t cb, void *arg) { - struct structure_header *s; + struct smbios_structure_header *s; while (entries--) { - s = (struct structure_header *)p; + s = (struct smbios_structure_header *)p; cb(s, arg); /* @@ -208,7 +179,7 @@ smbios_walk_table(uint8_t *p, int entrie static void ipmi_smbios_probe(struct ipmi_get_info *info) { - struct smbios_table *header; + struct smbios_eps *header; void *table; u_int32_t addr; @@ -225,9 +196,9 @@ ipmi_smbios_probe(struct ipmi_get_info * * length and then map it a second time with the actual length so * we can verify the checksum. */ - header = pmap_mapbios(addr, sizeof(struct smbios_table)); + header = pmap_mapbios(addr, sizeof(struct smbios_eps)); table = pmap_mapbios(addr, header->length); - pmap_unmapbios((vm_offset_t)header, sizeof(struct smbios_table)); + pmap_unmapbios((vm_offset_t)header, sizeof(struct smbios_eps)); header = table; if (smbios_cksum(header) != 0) { pmap_unmapbios((vm_offset_t)header, header->length); @@ -282,7 +253,7 @@ ipmi_smbios_identify(struct ipmi_get_inf } static int -smbios_cksum(struct smbios_table *e) +smbios_cksum(struct smbios_eps *e) { u_int8_t *ptr; u_int8_t cksum; Modified: head/sys/i386/include/pc/bios.h ============================================================================== --- head/sys/i386/include/pc/bios.h Fri Sep 28 11:40:59 2012 (r241026) +++ head/sys/i386/include/pc/bios.h Fri Sep 28 11:59:32 2012 (r241027) @@ -44,31 +44,6 @@ struct bios32_SDheader }; /* - * BIOS32 Service Directory entry. Caller supplies name, bios32_SDlookup - * fills in the rest of the details. - */ -struct bios32_SDentry -{ - union - { - u_int8_t name[4]; /* service identifier */ - u_int32_t id; /* as a 32-bit value */ - } ident; - u_int32_t base; /* base of service */ - u_int32_t len; /* service length */ - u_int32_t entry; /* entrypoint offset from base */ - vm_offset_t ventry; /* entrypoint in kernel virtual segment */ -}; - -extern int bios32_SDlookup(struct bios32_SDentry *ent); -extern u_int32_t bios_sigsearch(u_int32_t start, u_char *sig, int siglen, - int paralen, int sigofs); - -#define BIOS_PADDRTOVADDR(x) ((x) + KERNBASE) -#define BIOS_VADDRTOPADDR(x) ((x) - KERNBASE) - - -/* * PnP BIOS presence structure */ struct PnPBIOS_table @@ -88,52 +63,13 @@ struct PnPBIOS_table u_int32_t pmdataseg; /* protected-mode data segment */ } __packed; - -/* - * Exported lookup results - */ -extern struct bios32_SDentry PCIbios; - -struct segment_info { - u_int base; - u_int limit; -}; - -#define BIOSCODE_FLAG 0x01 -#define BIOSDATA_FLAG 0x02 -#define BIOSUTIL_FLAG 0x04 -#define BIOSARGS_FLAG 0x08 - -struct bios_segments { - struct segment_info code32; /* 32-bit code (mandatory) */ - struct segment_info code16; /* 16-bit code */ - struct segment_info data; /* 16-bit data */ - struct segment_info util; /* 16-bit utility */ - struct segment_info args; /* 16-bit args */ -}; - -struct bios_regs { - u_int eax; - u_int ebx; - u_int ecx; - u_int edx; - u_int esi; - u_int edi; -}; - -struct bios_args { - u_int entry; /* entry point of routine */ - struct bios_regs r; - struct bios_segments seg; -}; - /* * PnP BIOS return codes */ #define PNP_SUCCESS 0x00 #define PNP_NOT_SET_STATICALLY 0x7f #define PNP_UNKNOWN_FUNCTION 0x81 -#define PNP_FUNTION_NOT_SUPPORTED 0x82 +#define PNP_FUNCTION_NOT_SUPPORTED 0x82 #define PNP_INVALID_HANDLE 0x83 #define PNP_BAD_PARAMETER 0x84 #define PNP_SET_FAILED 0x85 @@ -219,11 +155,6 @@ struct bios_args { #define PCIBIOS_GET_IRQ_ROUTING 0xb10e #define PCIBIOS_ROUTE_INTERRUPT 0xb10f -extern int bios16(struct bios_args *, char *, ...); -extern int bios16_call(struct bios_regs *, char *); -extern int bios32(struct bios_regs *, u_int, u_short); -extern void set_bios_selectors(struct bios_segments *, int); - /* * PCI interrupt routing table. * @@ -272,7 +203,6 @@ struct PIR_table /* * Int 15:E820 'SMAP' structure */ - #define SMAP_SIG 0x534D4150 /* 'SMAP' */ #define SMAP_TYPE_MEMORY 1 @@ -291,22 +221,122 @@ struct bios_smap { u_int32_t type; } __packed; +/* + * System Management BIOS + */ +#define SMBIOS_START 0xf0000 +#define SMBIOS_STEP 0x10 +#define SMBIOS_OFF 0 +#define SMBIOS_LEN 4 +#define SMBIOS_SIG "_SM_" + +struct smbios_eps { + uint8_t anchor_string[4]; /* '_SM_' */ + uint8_t checksum; + uint8_t length; + uint8_t major_version; + uint8_t minor_version; + uint16_t maximum_structure_size; + uint8_t entry_point_revision; + uint8_t formatted_area[5]; + uint8_t intermediate_anchor_string[5]; /* '_DMI_' */ + uint8_t intermediate_checksum; + uint16_t structure_table_length; + uint32_t structure_table_address; + uint16_t number_structures; + uint8_t BCD_revision; +}; + +struct smbios_structure_header { + uint8_t type; + uint8_t length; + uint16_t handle; +}; + +#ifdef _KERNEL +#define BIOS_PADDRTOVADDR(x) ((x) + KERNBASE) +#define BIOS_VADDRTOPADDR(x) ((x) - KERNBASE) + struct bios_oem_signature { char * anchor; /* search anchor string in BIOS memory */ size_t offset; /* offset from anchor (may be negative) */ size_t totlen; /* total length of BIOS string to copy */ } __packed; + struct bios_oem_range { u_int from; /* shouldn't be below 0xe0000 */ u_int to; /* shouldn't be above 0xfffff */ } __packed; + struct bios_oem { struct bios_oem_range range; struct bios_oem_signature signature[]; } __packed; -extern int -bios_oem_strings(struct bios_oem *oem, u_char *buffer, size_t maxlen); +struct segment_info { + u_int base; + u_int limit; +}; + +#define BIOSCODE_FLAG 0x01 +#define BIOSDATA_FLAG 0x02 +#define BIOSUTIL_FLAG 0x04 +#define BIOSARGS_FLAG 0x08 + +struct bios_segments { + struct segment_info code32; /* 32-bit code (mandatory) */ + struct segment_info code16; /* 16-bit code */ + struct segment_info data; /* 16-bit data */ + struct segment_info util; /* 16-bit utility */ + struct segment_info args; /* 16-bit args */ +}; + +struct bios_regs { + u_int eax; + u_int ebx; + u_int ecx; + u_int edx; + u_int esi; + u_int edi; +}; + +struct bios_args { + u_int entry; /* entry point of routine */ + struct bios_regs r; + struct bios_segments seg; +}; + +/* + * BIOS32 Service Directory entry. Caller supplies name, bios32_SDlookup + * fills in the rest of the details. + */ +struct bios32_SDentry +{ + union + { + u_int8_t name[4]; /* service identifier */ + u_int32_t id; /* as a 32-bit value */ + } ident; + u_int32_t base; /* base of service */ + u_int32_t len; /* service length */ + u_int32_t entry; /* entrypoint offset from base */ + vm_offset_t ventry; /* entrypoint in kernel virtual segment */ +}; + +/* + * Exported lookup results + */ +extern struct bios32_SDentry PCIbios; + +int bios_oem_strings(struct bios_oem *oem, u_char *buffer, size_t maxlen); +uint32_t bios_sigsearch(uint32_t start, u_char *sig, int siglen, int paralen, + int sigofs); +int bios16(struct bios_args *, char *, ...); +int bios16_call(struct bios_regs *, char *); +int bios32(struct bios_regs *, u_int, u_short); +int bios32_SDlookup(struct bios32_SDentry *ent); +void set_bios_selectors(struct bios_segments *, int); +#endif #endif /* _MACHINE_PC_BIOS_H_ */ Modified: head/sys/x86/bios/smbios.c ============================================================================== --- head/sys/x86/bios/smbios.c Fri Sep 28 11:40:59 2012 (r241026) +++ head/sys/x86/bios/smbios.c Fri Sep 28 11:59:32 2012 (r241027) @@ -50,30 +50,6 @@ __FBSDID("$FreeBSD$"); * http://www.dmtf.org/standards/published_documents/DSP0134.pdf */ -/* - * SMBIOS Entry Point Structure - */ -struct smbios_eps { - u_int8_t Anchor[4]; /* '_SM_' */ - u_int8_t Checksum; - u_int8_t Length; - - u_int8_t SMBIOS_Major; - u_int8_t SMBIOS_Minor; - u_int16_t Max_Size; - u_int8_t Revision; - u_int8_t Formatted_Area[5]; - - u_int8_t Intermediate_Anchor[5]; /* '_DMI_' */ - u_int8_t Intermediate_Checksum; - - u_int16_t Structure_Table_Length; - u_int32_t Structure_Table_Address; - u_int16_t Structure_Count; - - u_int8_t SMBIOS_BCD_Revision; -} __packed; - struct smbios_softc { device_t dev; struct resource * res; @@ -82,12 +58,6 @@ struct smbios_softc { struct smbios_eps * eps; }; -#define SMBIOS_START 0xf0000 -#define SMBIOS_STEP 0x10 -#define SMBIOS_OFF 0 -#define SMBIOS_LEN 4 -#define SMBIOS_SIG "_SM_" - #define RES2EPS(res) ((struct smbios_eps *)rman_get_virtual(res)) #define ADDR2EPS(addr) ((struct smbios_eps *)BIOS_PADDRTOVADDR(addr)) @@ -116,13 +86,13 @@ smbios_identify (driver_t *driver, devic SMBIOS_STEP, SMBIOS_OFF); if (addr != 0) { rid = 0; - length = ADDR2EPS(addr)->Length; + length = ADDR2EPS(addr)->length; if (length != 0x1f) { u_int8_t major, minor; - major = ADDR2EPS(addr)->SMBIOS_Major; - minor = ADDR2EPS(addr)->SMBIOS_Minor; + major = ADDR2EPS(addr)->major_version; + minor = ADDR2EPS(addr)->minor_version; /* SMBIOS v2.1 implementation might use 0x1e. */ if (length == 0x1e && major == 2 && minor == 1) @@ -189,11 +159,11 @@ smbios_attach (device_t dev) sc->eps = RES2EPS(sc->res); device_printf(dev, "Version: %u.%u", - sc->eps->SMBIOS_Major, sc->eps->SMBIOS_Minor); - if (bcd2bin(sc->eps->SMBIOS_BCD_Revision)) + sc->eps->major_version, sc->eps->minor_version); + if (bcd2bin(sc->eps->BCD_revision)) printf(", BCD Revision: %u.%u", - bcd2bin(sc->eps->SMBIOS_BCD_Revision >> 4), - bcd2bin(sc->eps->SMBIOS_BCD_Revision & 0x0f)); + bcd2bin(sc->eps->BCD_revision >> 4), + bcd2bin(sc->eps->BCD_revision & 0x0f)); printf("\n"); return (0); @@ -269,7 +239,7 @@ smbios_cksum (struct smbios_eps *e) ptr = (u_int8_t *)e; cksum = 0; - for (i = 0; i < e->Length; i++) { + for (i = 0; i < e->length; i++) { cksum += ptr[i]; } From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 12:13:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5215C1065680; Fri, 28 Sep 2012 12:13:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D4EC8FC0C; Fri, 28 Sep 2012 12:13:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SCDZG1035733; Fri, 28 Sep 2012 12:13:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SCDZo6035731; Fri, 28 Sep 2012 12:13:35 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201209281213.q8SCDZo6035731@svn.freebsd.org> From: Alexander Motin Date: Fri, 28 Sep 2012 12:13:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241028 - head/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 12:13:35 -0000 Author: mav Date: Fri Sep 28 12:13:34 2012 New Revision: 241028 URL: http://svn.freebsd.org/changeset/base/241028 Log: Change queue overflow checks from DIAGNOSTIC+panic() to KASSERT() to make them enabled on HEAD by default. It is probably better to do single compare then hunt for unexpected memory corruption. Modified: head/sys/cam/cam_queue.c Modified: head/sys/cam/cam_queue.c ============================================================================== --- head/sys/cam/cam_queue.c Fri Sep 28 11:59:32 2012 (r241027) +++ head/sys/cam/cam_queue.c Fri Sep 28 12:13:34 2012 (r241028) @@ -121,11 +121,9 @@ camq_resize(struct camq *queue, int new_ { cam_pinfo **new_array; -#ifdef DIAGNOSTIC - if (new_size < queue->entries) - panic("camq_resize: New queue size can't accomodate " - "queued entries."); -#endif + KASSERT(new_size >= queue->entries, ("camq_resize: " + "New queue size can't accomodate queued entries (%d < %d).", + new_size, queue->entries)); new_array = (cam_pinfo **)malloc(new_size * sizeof(cam_pinfo *), M_CAMQ, M_NOWAIT); if (new_array == NULL) { @@ -156,10 +154,10 @@ camq_resize(struct camq *queue, int new_ void camq_insert(struct camq *queue, cam_pinfo *new_entry) { -#ifdef DIAGNOSTIC - if (queue->entries >= queue->array_size) - panic("camq_insert: Attempt to insert into a full queue"); -#endif + + KASSERT(queue->entries < queue->array_size, + ("camq_insert: Attempt to insert into a full queue (%d >= %d)", + queue->entries, queue->array_size)); queue->entries++; queue->queue_array[queue->entries] = new_entry; new_entry->index = queue->entries; From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 12:29:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E642106566B; Fri, 28 Sep 2012 12:29:26 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 797218FC0C; Fri, 28 Sep 2012 12:29:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SCTQfe038214; Fri, 28 Sep 2012 12:29:26 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SCTQPb038212; Fri, 28 Sep 2012 12:29:26 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201209281229.q8SCTQPb038212@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Fri, 28 Sep 2012 12:29:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241029 - head/lib/libpam/modules/pam_radius X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 12:29:26 -0000 Author: des Date: Fri Sep 28 12:29:25 2012 New Revision: 241029 URL: http://svn.freebsd.org/changeset/base/241029 Log: Remove unnecessary #include. Modified: head/lib/libpam/modules/pam_radius/pam_radius.c Modified: head/lib/libpam/modules/pam_radius/pam_radius.c ============================================================================== --- head/lib/libpam/modules/pam_radius/pam_radius.c Fri Sep 28 12:13:34 2012 (r241028) +++ head/lib/libpam/modules/pam_radius/pam_radius.c Fri Sep 28 12:29:25 2012 (r241029) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 13:43:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F55F106564A; Fri, 28 Sep 2012 13:43:43 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A3B58FC17; Fri, 28 Sep 2012 13:43:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SDhhKV050338; Fri, 28 Sep 2012 13:43:43 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SDhhjr050336; Fri, 28 Sep 2012 13:43:43 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201209281343.q8SDhhjr050336@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 28 Sep 2012 13:43:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241030 - stable/9/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 13:43:43 -0000 Author: jilles Date: Fri Sep 28 13:43:42 2012 New Revision: 241030 URL: http://svn.freebsd.org/changeset/base/241030 Log: MFC r240505: sh: Reduce code duplication: use setinputfile instead of open/setinputfd combination. Modified: stable/9/bin/sh/main.c Directory Properties: stable/9/bin/sh/ (props changed) Modified: stable/9/bin/sh/main.c ============================================================================== --- stable/9/bin/sh/main.c Fri Sep 28 12:29:25 2012 (r241029) +++ stable/9/bin/sh/main.c Fri Sep 28 13:43:42 2012 (r241030) @@ -266,14 +266,7 @@ read_profile(char *name) void readcmdfile(const char *name) { - int fd; - - INTOFF; - if ((fd = open(name, O_RDONLY)) >= 0) - setinputfd(fd, 1); - else - error("cannot open %s: %s", name, strerror(errno)); - INTON; + setinputfile(name, 1); cmdloop(0); popfile(); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 13:50:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 72EF21065673; Fri, 28 Sep 2012 13:50:38 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44B258FC1F; Fri, 28 Sep 2012 13:50:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SDocbY051451; Fri, 28 Sep 2012 13:50:38 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SDoc5c051449; Fri, 28 Sep 2012 13:50:38 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201209281350.q8SDoc5c051449@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Fri, 28 Sep 2012 13:50:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241031 - head/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 13:50:38 -0000 Author: des Date: Fri Sep 28 13:50:37 2012 New Revision: 241031 URL: http://svn.freebsd.org/changeset/base/241031 Log: Slight stylification. Modified: head/lib/libc/stdlib/random.c Modified: head/lib/libc/stdlib/random.c ============================================================================== --- head/lib/libc/stdlib/random.c Fri Sep 28 13:43:42 2012 (r241030) +++ head/lib/libc/stdlib/random.c Fri Sep 28 13:50:37 2012 (r241031) @@ -216,10 +216,8 @@ static int rand_deg = DEG_3; static int rand_sep = SEP_3; static uint32_t *end_ptr = &randtbl[DEG_3 + 1]; -static inline uint32_t good_rand(int32_t); - -static inline uint32_t good_rand (x) - int32_t x; +static inline uint32_t +good_rand(int32_t x) { #ifdef USE_WEAK_SEEDING /* @@ -264,8 +262,7 @@ static inline uint32_t good_rand (x) * for default usage relies on values produced by this routine. */ void -srandom(x) - unsigned long x; +srandom(unsigned long x) { int i, lim; @@ -295,7 +292,7 @@ srandom(x) * a fixed seed. */ void -srandomdev() +srandomdev(void) { int fd, done; size_t len; @@ -352,10 +349,7 @@ srandomdev() * complain about mis-alignment, but you should disregard these messages. */ char * -initstate(seed, arg_state, n) - unsigned long seed; /* seed for R.N.G. */ - char *arg_state; /* pointer to state array */ - long n; /* # bytes of state info */ +initstate(unsigned long seed, char *arg_state, long n) { char *ostate = (char *)(&state[-1]); uint32_t *int_arg_state = (uint32_t *)arg_state; @@ -367,7 +361,7 @@ initstate(seed, arg_state, n) if (n < BREAK_0) { (void)fprintf(stderr, "random: not enough state (%ld bytes); ignored.\n", n); - return(0); + return (0); } if (n < BREAK_1) { rand_type = TYPE_0; @@ -397,7 +391,7 @@ initstate(seed, arg_state, n) int_arg_state[0] = rand_type; else int_arg_state[0] = MAX_TYPES * (rptr - state) + rand_type; - return(ostate); + return (ostate); } /* @@ -420,8 +414,7 @@ initstate(seed, arg_state, n) * complain about mis-alignment, but you should disregard these messages. */ char * -setstate(arg_state) - char *arg_state; /* pointer to state array */ +setstate(char *arg_state) { uint32_t *new_state = (uint32_t *)arg_state; uint32_t type = new_state[0] % MAX_TYPES; @@ -452,7 +445,7 @@ setstate(arg_state) fptr = &state[(rear + rand_sep) % rand_deg]; } end_ptr = &state[rand_deg]; /* set end_ptr too */ - return(ostate); + return (ostate); } /* @@ -473,7 +466,7 @@ setstate(arg_state) * Returns a 31-bit random number. */ long -random() +random(void) { uint32_t i; uint32_t *f, *r; @@ -498,5 +491,5 @@ random() fptr = f; rptr = r; } - return((long)i); + return ((long)i); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 15:24:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA8111065670; Fri, 28 Sep 2012 15:24:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D59038FC0A; Fri, 28 Sep 2012 15:24:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SFOElf063231; Fri, 28 Sep 2012 15:24:14 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SFOECM063229; Fri, 28 Sep 2012 15:24:14 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201209281524.q8SFOECM063229@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 28 Sep 2012 15:24:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241032 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 15:24:15 -0000 Author: hselasky Date: Fri Sep 28 15:24:14 2012 New Revision: 241032 URL: http://svn.freebsd.org/changeset/base/241032 Log: Correct NYET handling. Remove superfluous transfer complete interrupt mask. Modified: head/sys/dev/usb/controller/dwc_otg.c Modified: head/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.c Fri Sep 28 13:50:37 2012 (r241031) +++ head/sys/dev/usb/controller/dwc_otg.c Fri Sep 28 15:24:14 2012 (r241032) @@ -222,7 +222,7 @@ dwc_otg_init_fifo(struct dwc_otg_softc * /* enable interrupts */ DWC_OTG_WRITE_4(sc, DOTG_HCINTMSK(x), HCINT_STALL | HCINT_BBLERR | - HCINT_XACTERR | HCINT_XFERCOMPL | + HCINT_XACTERR | HCINT_NAK | HCINT_ACK | HCINT_NYET | HCINT_CHHLTD | HCINT_FRMOVRUN | HCINT_DATATGLERR); @@ -524,6 +524,10 @@ dwc_otg_host_channel_wait(struct dwc_otg if (x == 0) return (0); /* wait */ + /* assume NAK-ing is next */ + if (sc->sc_chan_state[x].hcint & HCINT_NYET) + return (0); /* wait */ + /* find new disabled channel */ for (x = 1; x != sc->sc_host_ch_max; x++) { @@ -701,15 +705,6 @@ dwc_otg_host_setup_tx(struct dwc_otg_td } } - /* treat NYET like NAK, if SPLIT transactions are used */ - if (hcint & HCINT_NYET) { - if (td->hcsplt != 0) { - DPRINTF("CH=%d NYET+SPLIT\n", td->channel); - hcint &= ~HCINT_NYET; - hcint |= HCINT_NAK; - } - } - /* channel must be disabled before we can complete the transfer */ if (hcint & (HCINT_ERRORS | HCINT_RETRY | @@ -755,13 +750,18 @@ dwc_otg_host_setup_tx(struct dwc_otg_td } break; case DWC_CHAN_ST_WAIT_C_ANE: + if (hcint & HCINT_NYET) { + if (!dwc_otg_host_channel_wait(td)) + break; + goto send_cpkt; + } if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { if (!dwc_otg_host_channel_wait(td)) break; td->did_nak = 1; - goto send_cpkt; + goto send_pkt; } - if (hcint & (HCINT_ACK | HCINT_NYET)) { + if (hcint & HCINT_ACK) { if (!dwc_otg_host_channel_wait(td)) break; td->offset += td->tx_bytes; @@ -1043,15 +1043,6 @@ dwc_otg_host_data_rx(struct dwc_otg_td * } } - /* treat NYET like NAK, if SPLIT transactions are used */ - if (hcint & HCINT_NYET) { - if (td->hcsplt != 0) { - DPRINTF("CH=%d NYET+SPLIT\n", td->channel); - hcint &= ~HCINT_NYET; - hcint |= HCINT_NAK; - } - } - /* channel must be disabled before we can complete the transfer */ if (hcint & (HCINT_ERRORS | HCINT_RETRY | @@ -1136,12 +1127,15 @@ check_state: break; td->did_nak = 1; - if (td->hcsplt != 0) goto receive_spkt; else goto receive_pkt; } + if (hcint & HCINT_NYET) { + if (td->hcsplt != 0) + goto receive_pkt; + } if (!(hcint & HCINT_SOFTWARE_ONLY)) break; if (hcint & (HCINT_ACK | HCINT_NYET)) { @@ -1171,7 +1165,6 @@ check_state: break; td->did_nak = 1; - goto receive_spkt; } if (hcint & (HCINT_ACK | HCINT_NYET)) { @@ -1401,15 +1394,6 @@ dwc_otg_host_data_tx(struct dwc_otg_td * } } - /* treat NYET like NAK, if SPLIT transactions are used */ - if (hcint & HCINT_NYET) { - if (td->hcsplt != 0) { - DPRINTF("CH=%d NYET+SPLIT\n", td->channel); - hcint &= ~HCINT_NYET; - hcint |= HCINT_NAK; - } - } - /* channel must be disabled before we can complete the transfer */ if (hcint & (HCINT_ERRORS | HCINT_RETRY | @@ -1467,13 +1451,18 @@ dwc_otg_host_data_tx(struct dwc_otg_td * } break; case DWC_CHAN_ST_WAIT_C_ANE: + if (hcint & HCINT_NYET) { + if (!dwc_otg_host_channel_wait(td)) + break; + goto send_cpkt; + } if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { if (!dwc_otg_host_channel_wait(td)) break; td->did_nak = 1; - goto send_cpkt; + goto send_pkt; } - if (hcint & (HCINT_ACK | HCINT_NYET)) { + if (hcint & HCINT_ACK) { if (!dwc_otg_host_channel_wait(td)) break; td->offset += td->tx_bytes; From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 15:33:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4ABB106566C; Fri, 28 Sep 2012 15:33:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF8508FC0A; Fri, 28 Sep 2012 15:33:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SFXDYT064354; Fri, 28 Sep 2012 15:33:13 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SFXDSa064351; Fri, 28 Sep 2012 15:33:13 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201209281533.q8SFXDSa064351@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 28 Sep 2012 15:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241033 - head/sys/dev/usb/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 15:33:14 -0000 Author: hselasky Date: Fri Sep 28 15:33:13 2012 New Revision: 241033 URL: http://svn.freebsd.org/changeset/base/241033 Log: Remove some trailing bytes which are not part of the ethernet packet. Discussed with: bgray @ Modified: head/sys/dev/usb/net/if_smsc.c Modified: head/sys/dev/usb/net/if_smsc.c ============================================================================== --- head/sys/dev/usb/net/if_smsc.c Fri Sep 28 15:24:14 2012 (r241032) +++ head/sys/dev/usb/net/if_smsc.c Fri Sep 28 15:33:13 2012 (r241033) @@ -1042,7 +1042,9 @@ smsc_bulk_read_callback(struct usb_xfer } /* Finally enqueue the mbuf on the receive queue */ - uether_rxmbuf(ue, m, pktlen); + /* Remove 4 trailing bytes */ + if (pktlen >= (4 + ETHER_HDR_LEN)) + uether_rxmbuf(ue, m, pktlen - 4); } /* Update the offset to move to the next potential packet */ From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 16:23:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BEB37106566B; Fri, 28 Sep 2012 16:23:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A8C7D8FC17; Fri, 28 Sep 2012 16:23:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SGN1at070426; Fri, 28 Sep 2012 16:23:01 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SGN1dN070424; Fri, 28 Sep 2012 16:23:01 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201209281623.q8SGN1dN070424@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 28 Sep 2012 16:23:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241034 - head/sys/dev/usb/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 16:23:01 -0000 Author: hselasky Date: Fri Sep 28 16:23:01 2012 New Revision: 241034 URL: http://svn.freebsd.org/changeset/base/241034 Log: Make sure we don't leak a mbuf in a fail case. Modified: head/sys/dev/usb/net/if_smsc.c Modified: head/sys/dev/usb/net/if_smsc.c ============================================================================== --- head/sys/dev/usb/net/if_smsc.c Fri Sep 28 15:33:13 2012 (r241033) +++ head/sys/dev/usb/net/if_smsc.c Fri Sep 28 16:23:01 2012 (r241034) @@ -1043,8 +1043,11 @@ smsc_bulk_read_callback(struct usb_xfer /* Finally enqueue the mbuf on the receive queue */ /* Remove 4 trailing bytes */ - if (pktlen >= (4 + ETHER_HDR_LEN)) - uether_rxmbuf(ue, m, pktlen - 4); + if (pktlen < (4 + ETHER_HDR_LEN)) { + m_freem(m); + goto tr_setup; + } + uether_rxmbuf(ue, m, pktlen - 4); } /* Update the offset to move to the next potential packet */ From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 17:34:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92770106566B; Fri, 28 Sep 2012 17:34:35 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CE338FC12; Fri, 28 Sep 2012 17:34:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SHYZ1H079740; Fri, 28 Sep 2012 17:34:35 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SHYZmv079736; Fri, 28 Sep 2012 17:34:35 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201209281734.q8SHYZmv079736@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 28 Sep 2012 17:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241035 - head/sbin/fsck_ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 17:34:35 -0000 Author: mdf Date: Fri Sep 28 17:34:34 2012 New Revision: 241035 URL: http://svn.freebsd.org/changeset/base/241035 Log: Fix some nearby type and style errors. Pointed out by: bde Modified: head/sbin/fsck_ffs/main.c head/sbin/fsck_ffs/pass1.c head/sbin/fsck_ffs/suj.c Modified: head/sbin/fsck_ffs/main.c ============================================================================== --- head/sbin/fsck_ffs/main.c Fri Sep 28 16:23:01 2012 (r241034) +++ head/sbin/fsck_ffs/main.c Fri Sep 28 17:34:34 2012 (r241035) @@ -210,12 +210,11 @@ checkfilesys(char *filesys) struct statfs *mntp; struct stat snapdir; struct group *grp; - ufs2_daddr_t blks; struct iovec *iov; char errmsg[255]; int iovlen; int cylno; - ino_t files; + intmax_t blks, files; size_t size; iov = NULL; @@ -382,9 +381,9 @@ checkfilesys(char *filesys) clean: pwarn("clean, %ld free ", (long)(sblock.fs_cstotal.cs_nffree + sblock.fs_frag * sblock.fs_cstotal.cs_nbfree)); - printf("(%lld frags, %lld blocks, %.1f%% fragmentation)\n", - (long long)sblock.fs_cstotal.cs_nffree, - (long long)sblock.fs_cstotal.cs_nbfree, + printf("(%jd frags, %jd blocks, %.1f%% fragmentation)\n", + (intmax_t)sblock.fs_cstotal.cs_nffree, + (intmax_t)sblock.fs_cstotal.cs_nbfree, sblock.fs_cstotal.cs_nffree * 100.0 / sblock.fs_dsize); return (0); } @@ -481,8 +480,8 @@ checkfilesys(char *filesys) blks = maxfsblock - (n_ffree + sblock.fs_frag * n_bfree) - blks; if (bkgrdflag && (files > 0 || blks > 0)) { countdirs = sblock.fs_cstotal.cs_ndir - countdirs; - pwarn("Reclaimed: %ld directories, %ld files, %lld fragments\n", - countdirs, (long)files - countdirs, (long long)blks); + pwarn("Reclaimed: %ld directories, %jd files, %jd fragments\n", + countdirs, files - countdirs, blks); } pwarn("%ld files, %jd used, %ju free ", (long)n_files, (intmax_t)n_blks, @@ -492,13 +491,13 @@ checkfilesys(char *filesys) n_ffree * 100.0 / sblock.fs_dsize); if (debug) { if (files < 0) - printf("%jd inodes missing\n", (intmax_t)-files); + printf("%jd inodes missing\n", -files); if (blks < 0) - printf("%lld blocks missing\n", -(long long)blks); + printf("%jd blocks missing\n", -blks); if (duplist != NULL) { printf("The following duplicate blocks remain:"); for (dp = duplist; dp; dp = dp->next) - printf(" %lld,", (long long)dp->dup); + printf(" %jd,", (intmax_t)dp->dup); printf("\n"); } } Modified: head/sbin/fsck_ffs/pass1.c ============================================================================== --- head/sbin/fsck_ffs/pass1.c Fri Sep 28 16:23:01 2012 (r241034) +++ head/sbin/fsck_ffs/pass1.c Fri Sep 28 17:34:34 2012 (r241035) @@ -99,11 +99,10 @@ pass1(void) if (!rebuildcg && sblock.fs_magic == FS_UFS2_MAGIC) { inosused = cgrp.cg_initediblk; if (inosused > sblock.fs_ipg) { - pfatal("%s (%ju > %d) %s %d\nReset to %d\n", - "Too many initialized inodes", + pfatal( +"Too many initialized inodes (%ju > %d) in cylinder group %d\nReset to %d\n", (uintmax_t)inosused, - sblock.fs_ipg, "in cylinder group", c, - sblock.fs_ipg); + sblock.fs_ipg, c, sblock.fs_ipg); inosused = sblock.fs_ipg; } } else { Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Fri Sep 28 16:23:01 2012 (r241034) +++ head/sbin/fsck_ffs/suj.c Fri Sep 28 17:34:34 2012 (r241035) @@ -1401,9 +1401,8 @@ ino_adjust(struct suj_ino *sino) ip = ino_read(ino); mode = DIP(ip, di_mode) & IFMT; if (nlink > LINK_MAX) - err_suj("ino %ju %s, new link %d, old link %d\n", - (uintmax_t)ino, "nlink manipulation error", nlink, - DIP(ip, di_nlink)); + err_suj("ino %ju nlink manipulation error, new %d, old %d\n", + (uintmax_t)ino, nlink, DIP(ip, di_nlink)); if (debug) printf("Adjusting ino %ju, nlink %d, old link %d lastmode %o\n", (uintmax_t)ino, nlink, DIP(ip, di_nlink), sino->si_mode); From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 17:36:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59A19106567C; Fri, 28 Sep 2012 17:36:01 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 43E738FC25; Fri, 28 Sep 2012 17:36:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SHa16s079958; Fri, 28 Sep 2012 17:36:01 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SHa1dv079956; Fri, 28 Sep 2012 17:36:01 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201209281736.q8SHa1dv079956@svn.freebsd.org> From: Andreas Tobler Date: Fri, 28 Sep 2012 17:36:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241036 - stable/9/sys/boot/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 17:36:01 -0000 Author: andreast Date: Fri Sep 28 17:36:00 2012 New Revision: 241036 URL: http://svn.freebsd.org/changeset/base/241036 Log: MFC r240782: Implement elfN(reloc) for powerpc. With this change the kernel is now able to resolve dependencies of modules at boot time and load additional modules when needed. Modified: stable/9/sys/boot/common/reloc_elf.c Modified: stable/9/sys/boot/common/reloc_elf.c ============================================================================== --- stable/9/sys/boot/common/reloc_elf.c Fri Sep 28 17:34:34 2012 (r241035) +++ stable/9/sys/boot/common/reloc_elf.c Fri Sep 28 17:36:00 2012 (r241036) @@ -193,6 +193,31 @@ __elfN(reloc)(struct elf_file *ef, symad } return (0); +#elif defined(__powerpc__) + Elf_Size w; + const Elf_Rela *rela; + + switch (reltype) { + case ELF_RELOC_RELA: + rela = reldata; + if (relbase + rela->r_offset >= dataaddr && + relbase + rela->r_offset < dataaddr + len) { + switch (ELF_R_TYPE(rela->r_info)) { + case R_PPC_RELATIVE: + w = relbase + rela->r_addend; + bcopy(&w, (u_char *)data + (relbase + + rela->r_offset - dataaddr), sizeof(w)); + break; + default: + printf("\nunhandled relocation type %u\n", + (u_int)ELF_R_TYPE(rela->r_info)); + return (EFTYPE); + } + } + break; + } + + return (0); #else return (EOPNOTSUPP); #endif From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 18:28:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95887106564A; Fri, 28 Sep 2012 18:28:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C9008FC14; Fri, 28 Sep 2012 18:28:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SISS7b086396; Fri, 28 Sep 2012 18:28:28 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SISS90086382; Fri, 28 Sep 2012 18:28:28 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201209281828.q8SISS90086382@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 28 Sep 2012 18:28:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241037 - in head: share/man/man9 sys/dev/bxe sys/dev/e1000 sys/dev/ixgbe sys/dev/mxge sys/dev/oce sys/dev/vxge sys/net sys/ofed/drivers/net/mlx4 sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 18:28:28 -0000 Author: glebius Date: Fri Sep 28 18:28:27 2012 New Revision: 241037 URL: http://svn.freebsd.org/changeset/base/241037 Log: The drbr(9) API appeared to be so unclear, that most drivers in tree used it incorrectly, which lead to inaccurate overrated if_obytes accounting. The drbr(9) used to update ifnet stats on drbr_enqueue(), which is not accurate since enqueuing doesn't imply successful processing by driver. Dequeuing neither mean that. Most drivers also called drbr_stats_update() which did accounting again, leading to doubled if_obytes statistics. And in case of severe transmitting, when a packet could be several times enqueued and dequeued it could have been accounted several times. o Thus, make drbr(9) API thinner. Now drbr(9) merely chooses between ALTQ queueing or buf_ring(9) queueing. - It doesn't touch the buf_ring stats any more. - It doesn't touch ifnet stats anymore. - drbr_stats_update() no longer exists. o buf_ring(9) handles its stats itself: - It handles br_drops itself. - br_prod_bytes stats are dropped. Rationale: no one ever reads them but update of a common counter on every packet negatively affects performance due to excessive cache invalidation. - buf_ring_enqueue_bytes() reduced to buf_ring_enqueue(), since we no longer account bytes. o Drivers handle their stats theirselves: if_obytes, if_omcasts. o mlx4(4), igb(4), em(4), vxge(4), oce(4) and ixv(4) no longer use drbr_stats_update(), and update ifnet stats theirselves. o bxe(4) was the most correct driver, it didn't call drbr_stats_update(), thus it was the only driver accurate under moderate load. Now it also maintains stats itself. o ixgbe(4) had already taken stats from hardware, so just - drop software stats updating. - take multicast packet count from hardware as well. o mxge(4) just no longer needs NO_SLOW_STATS define. o cxgb(4), cxgbe(4) need no change, since they obtain stats from hardware. Reviewed by: jfv, gnn Modified: head/share/man/man9/buf_ring.9 head/share/man/man9/drbr.9 head/sys/dev/bxe/if_bxe.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixv.c head/sys/dev/mxge/if_mxge.c head/sys/dev/oce/oce_if.c head/sys/dev/vxge/vxge.c head/sys/net/if_var.h head/sys/ofed/drivers/net/mlx4/en_tx.c head/sys/sys/buf_ring.h Modified: head/share/man/man9/buf_ring.9 ============================================================================== --- head/share/man/man9/buf_ring.9 Fri Sep 28 17:36:00 2012 (r241036) +++ head/share/man/man9/buf_ring.9 Fri Sep 28 18:28:27 2012 (r241037) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 30, 2012 +.Dd September 27, 2012 .Dt BUF_RING 9 .Os .Sh NAME @@ -33,7 +33,6 @@ .Nm buf_ring_alloc , .Nm buf_ring_free , .Nm buf_ring_enqueue , -.Nm buf_ring_enqueue_bytes , .Nm buf_ring_dequeue_mc , .Nm buf_ring_dequeue_sc , .Nm buf_ring_count , @@ -50,8 +49,6 @@ .Fn buf_ring_free "struct buf_ring *br" "struct malloc_type *type" .Ft int .Fn buf_ring_enqueue "struct buf_ring *br" "void *buf" -.Ft int -.Fn buf_ring_enqueue_bytes "struct buf_ring *br" "void *buf" "int bytes" .Ft void * .Fn buf_ring_dequeue_mc "struct buf_ring *br" .Ft void * @@ -91,12 +88,6 @@ The function is used to enqueue a buffer to a buf_ring. .Pp The -.Fn buf_ring_enqueue_bytes -function is used to enqueue a buffer to a buf_ring and increment the -number of bytes enqueued by -.Fa bytes . -.Pp -The .Fn buf_ring_dequeue_mc function is a multi-consumer safe way of dequeueing elements from a buf_ring. .Pp @@ -134,9 +125,7 @@ otherwise. .Sh RETURN VALUES The .Fn buf_ring_enqueue -and -.Fn buf_ring_enqueue_bytes -functions return +function return .Er ENOBUFS if there are no available slots in the buf_ring. .Sh HISTORY Modified: head/share/man/man9/drbr.9 ============================================================================== --- head/share/man/man9/drbr.9 Fri Sep 28 17:36:00 2012 (r241036) +++ head/share/man/man9/drbr.9 Fri Sep 28 18:28:27 2012 (r241037) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 30, 2012 +.Dd September 27, 2012 .Dt DRBR 9 .Os .Sh NAME @@ -37,7 +37,6 @@ .Nm drbr_flush , .Nm drbr_empty , .Nm drbr_inuse , -.Nm drbr_stats_update , .Nd network driver interface to buf_ring .Sh SYNOPSIS .In sys/param.h @@ -57,8 +56,6 @@ .Fn drbr_empty "struct ifnet *ifp" "struct buf_ring *br" .Ft int .Fn drbr_inuse "struct ifnet *ifp" "struct buf_ring *br" -.Ft void -.Fn drbr_stats_update "struct ifnet *ifp" "int len" "int mflags" .Sh DESCRIPTION The .Nm @@ -123,9 +120,6 @@ there will not be more mbufs when is actually called. Provided the tx queue lock is held there will not be less. .Pp -The -.Fn drbr_stats_update -function updates the number of bytes and the number of multicast packets sent. .Sh RETURN VALUES The .Fn drbr_enqueue Modified: head/sys/dev/bxe/if_bxe.c ============================================================================== --- head/sys/dev/bxe/if_bxe.c Fri Sep 28 17:36:00 2012 (r241036) +++ head/sys/dev/bxe/if_bxe.c Fri Sep 28 18:28:27 2012 (r241037) @@ -9557,6 +9557,11 @@ bxe_tx_mq_start_locked(struct ifnet *ifp /* The transmit frame was enqueued successfully. */ tx_count++; + /* Update stats */ + ifp->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + ifp->if_omcasts++; + /* Send a copy of the frame to any BPF listeners. */ BPF_MTAP(ifp, next); Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Fri Sep 28 17:36:00 2012 (r241036) +++ head/sys/dev/e1000/if_em.c Fri Sep 28 18:28:27 2012 (r241037) @@ -922,7 +922,9 @@ em_mq_start_locked(struct ifnet *ifp, st break; } enq++; - drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); + ifp->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + ifp->if_omcasts++; ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) break; Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Fri Sep 28 17:36:00 2012 (r241036) +++ head/sys/dev/e1000/if_igb.c Fri Sep 28 18:28:27 2012 (r241037) @@ -1014,7 +1014,9 @@ igb_mq_start_locked(struct ifnet *ifp, s break; } enq++; - drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); + ifp->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + ifp->if_omcasts++; ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) break; Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Sep 28 17:36:00 2012 (r241036) +++ head/sys/dev/ixgbe/ixgbe.c Fri Sep 28 18:28:27 2012 (r241037) @@ -853,7 +853,6 @@ ixgbe_mq_start_locked(struct ifnet *ifp, break; } enqueued++; - drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) @@ -5335,6 +5334,7 @@ ixgbe_update_stats_counters(struct adapt ifp->if_ibytes = adapter->stats.gorc; ifp->if_obytes = adapter->stats.gotc; ifp->if_imcasts = adapter->stats.mprc; + ifp->if_omcasts = adapter->stats.mptc; ifp->if_collisions = 0; /* Rx Errors */ Modified: head/sys/dev/ixgbe/ixv.c ============================================================================== --- head/sys/dev/ixgbe/ixv.c Fri Sep 28 17:36:00 2012 (r241036) +++ head/sys/dev/ixgbe/ixv.c Fri Sep 28 18:28:27 2012 (r241037) @@ -641,7 +641,9 @@ ixv_mq_start_locked(struct ifnet *ifp, s break; } enqueued++; - drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); + ifp->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + ifp->if_omcasts++; /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Fri Sep 28 17:36:00 2012 (r241036) +++ head/sys/dev/mxge/if_mxge.c Fri Sep 28 18:28:27 2012 (r241037) @@ -47,8 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include -/* count xmits ourselves, rather than via drbr */ -#define NO_SLOW_STATS #include #include #include Modified: head/sys/dev/oce/oce_if.c ============================================================================== --- head/sys/dev/oce/oce_if.c Fri Sep 28 17:36:00 2012 (r241036) +++ head/sys/dev/oce/oce_if.c Fri Sep 28 18:28:27 2012 (r241037) @@ -1183,7 +1183,9 @@ oce_multiq_transmit(struct ifnet *ifp, s } break; } - drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); + ifp->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + ifp->if_omcasts++; ETHER_BPF_MTAP(ifp, next); next = drbr_dequeue(ifp, br); } Modified: head/sys/dev/vxge/vxge.c ============================================================================== --- head/sys/dev/vxge/vxge.c Fri Sep 28 17:36:00 2012 (r241036) +++ head/sys/dev/vxge/vxge.c Fri Sep 28 18:28:27 2012 (r241037) @@ -709,7 +709,9 @@ vxge_mq_send_locked(ifnet_t ifp, vxge_vp VXGE_DRV_STATS(vpath, tx_again); break; } - drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); + ifp->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + ifp->if_omcasts++; /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, next); Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Fri Sep 28 17:36:00 2012 (r241036) +++ head/sys/net/if_var.h Fri Sep 28 18:28:27 2012 (r241037) @@ -590,22 +590,10 @@ do { \ } while (0) #ifdef _KERNEL -static __inline void -drbr_stats_update(struct ifnet *ifp, int len, int mflags) -{ -#ifndef NO_SLOW_STATS - ifp->if_obytes += len; - if (mflags & M_MCAST) - ifp->if_omcasts++; -#endif -} - static __inline int drbr_enqueue(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m) { int error = 0; - int len = m->m_pkthdr.len; - int mflags = m->m_flags; #ifdef ALTQ if (ALTQ_IS_ENABLED(&ifp->if_snd)) { @@ -613,12 +601,10 @@ drbr_enqueue(struct ifnet *ifp, struct b return (error); } #endif - if ((error = buf_ring_enqueue_bytes(br, m, len)) == ENOBUFS) { - br->br_drops++; + error = buf_ring_enqueue(br, m); + if (error) m_freem(m); - } else - drbr_stats_update(ifp, len, mflags); - + return (error); } Modified: head/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/en_tx.c Fri Sep 28 17:36:00 2012 (r241036) +++ head/sys/ofed/drivers/net/mlx4/en_tx.c Fri Sep 28 18:28:27 2012 (r241037) @@ -948,7 +948,9 @@ mlx4_en_transmit_locked(struct ifnet *de break; } enqueued++; - drbr_stats_update(dev, next->m_pkthdr.len, next->m_flags); + dev->if_obytes += next->m_pkthdr.len; + if (next->m_flags & M_MCAST) + dev->if_omcasts++; /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(dev, next); if ((dev->if_drv_flags & IFF_DRV_RUNNING) == 0) Modified: head/sys/sys/buf_ring.h ============================================================================== --- head/sys/sys/buf_ring.h Fri Sep 28 17:36:00 2012 (r241036) +++ head/sys/sys/buf_ring.h Fri Sep 28 18:28:27 2012 (r241037) @@ -48,7 +48,6 @@ struct buf_ring { int br_prod_mask; uint64_t br_drops; uint64_t br_prod_bufs; - uint64_t br_prod_bytes; /* * Pad out to next L2 cache line */ @@ -74,7 +73,7 @@ struct buf_ring { * */ static __inline int -buf_ring_enqueue_bytes(struct buf_ring *br, void *buf, int nbytes) +buf_ring_enqueue(struct buf_ring *br, void *buf) { uint32_t prod_head, prod_next; uint32_t cons_tail; @@ -95,6 +94,7 @@ buf_ring_enqueue_bytes(struct buf_ring * prod_next = (prod_head + 1) & br->br_prod_mask; if (prod_next == cons_tail) { + br->br_drops++; critical_exit(); return (ENOBUFS); } @@ -117,19 +117,11 @@ buf_ring_enqueue_bytes(struct buf_ring * while (br->br_prod_tail != prod_head) cpu_spinwait(); br->br_prod_bufs++; - br->br_prod_bytes += nbytes; br->br_prod_tail = prod_next; critical_exit(); return (0); } -static __inline int -buf_ring_enqueue(struct buf_ring *br, void *buf) -{ - - return (buf_ring_enqueue_bytes(br, buf, 0)); -} - /* * multi-consumer safe dequeue * From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 20:29:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D02E2106568D; Fri, 28 Sep 2012 20:29:06 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B68CD8FC15; Fri, 28 Sep 2012 20:29:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SKT6N7001997; Fri, 28 Sep 2012 20:29:06 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SKT6wD001995; Fri, 28 Sep 2012 20:29:06 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201209282029.q8SKT6wD001995@svn.freebsd.org> From: Xin LI Date: Fri, 28 Sep 2012 20:29:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241038 - stable/9/usr.sbin/mountd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 20:29:07 -0000 Author: delphij Date: Fri Sep 28 20:29:06 2012 New Revision: 241038 URL: http://svn.freebsd.org/changeset/base/241038 Log: MFC r239744: Show error messages if nmount() failed. Modified: stable/9/usr.sbin/mountd/mountd.c Directory Properties: stable/9/usr.sbin/mountd/ (props changed) Modified: stable/9/usr.sbin/mountd/mountd.c ============================================================================== --- stable/9/usr.sbin/mountd/mountd.c Fri Sep 28 18:28:27 2012 (r241037) +++ stable/9/usr.sbin/mountd/mountd.c Fri Sep 28 20:29:06 2012 (r241038) @@ -2464,11 +2464,11 @@ do_mount(struct exportlist *ep, struct g } if (errno == EPERM) { if (debug) - warnx("can't change attributes for %s", - dirp); + warnx("can't change attributes for %s: %s", + dirp, errmsg); syslog(LOG_ERR, - "can't change attributes for %s", - dirp); + "can't change attributes for %s: %s", + dirp, errmsg); ret = 1; goto error_exit; } From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 20:43:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0BBCA106564A; Fri, 28 Sep 2012 20:43:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E22D08FC15; Fri, 28 Sep 2012 20:43:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SKh3Rm003642; Fri, 28 Sep 2012 20:43:03 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SKh3ls003640; Fri, 28 Sep 2012 20:43:03 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201209282043.q8SKh3ls003640@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 28 Sep 2012 20:43:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241039 - head/sys/netpfil/pf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 20:43:04 -0000 Author: glebius Date: Fri Sep 28 20:43:03 2012 New Revision: 241039 URL: http://svn.freebsd.org/changeset/base/241039 Log: Simplify and somewhat redesign interaction between pf_purge_thread() and pf_purge_expired_states(). Now pf purging daemon stores the current hash table index on stack in pf_purge_thread(), and supplies it to next iteration of pf_purge_expired_states(). The latter returns new index back. The important change is that whenever pf_purge_expired_states() wraps around the array it returns immediately. This makes our knowledge about status of states expiry run more consistent. Prior to this change it could happen that n-th run stopped on i-th entry, and returned (1) as full run complete, then next (n+1) full run stopped on j-th entry, where j < i, and that broke the mark-and-sweep algorythm that saves references rules. A referenced rule was freed, and this later lead to a crash. Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Fri Sep 28 20:29:06 2012 (r241038) +++ head/sys/netpfil/pf/pf.c Fri Sep 28 20:43:03 2012 (r241039) @@ -282,7 +282,7 @@ static int pf_src_connlimit(struct pf_ static void pf_overload_task(void *c, int pending); static int pf_insert_src_node(struct pf_src_node **, struct pf_rule *, struct pf_addr *, sa_family_t); -static int pf_purge_expired_states(int); +static u_int pf_purge_expired_states(u_int, int); static void pf_purge_unlinked_rules(void); static int pf_mtag_init(void *, int, int); static void pf_mtag_free(struct m_tag *); @@ -1307,7 +1307,7 @@ pf_intr(void *v) void pf_purge_thread(void *v) { - int fullrun; + u_int idx = 0; CURVNET_SET((struct vnet *)v); @@ -1329,7 +1329,7 @@ pf_purge_thread(void *v) /* * Now purge everything. */ - pf_purge_expired_states(V_pf_hashmask + 1); + pf_purge_expired_states(0, V_pf_hashmask); pf_purge_expired_fragments(); pf_purge_expired_src_nodes(); @@ -1352,11 +1352,11 @@ pf_purge_thread(void *v) PF_RULES_RUNLOCK(); /* Process 1/interval fraction of the state table every run. */ - fullrun = pf_purge_expired_states(V_pf_hashmask / + idx = pf_purge_expired_states(idx, V_pf_hashmask / (V_pf_default_rule.timeout[PFTM_INTERVAL] * 10)); /* Purge other expired types every PFTM_INTERVAL seconds. */ - if (fullrun) { + if (idx == 0) { /* * Order is important: * - states and src nodes reference rules @@ -1533,14 +1533,11 @@ pf_free_state(struct pf_state *cur) /* * Called only from pf_purge_thread(), thus serialized. */ -static int -pf_purge_expired_states(int maxcheck) +static u_int +pf_purge_expired_states(u_int i, int maxcheck) { - static u_int i = 0; - struct pf_idhash *ih; struct pf_state *s; - int rv = 0; V_pf_status.states = uma_zone_get_cur(V_pf_state_z); @@ -1549,12 +1546,6 @@ pf_purge_expired_states(int maxcheck) */ while (maxcheck > 0) { - /* Wrap to start of hash when we hit the end. */ - if (i > V_pf_hashmask) { - i = 0; - rv = 1; - } - ih = &V_pf_idhash[i]; relock: PF_HASHROW_LOCK(ih); @@ -1574,13 +1565,19 @@ relock: s->rt_kif->pfik_flags |= PFI_IFLAG_REFS; } PF_HASHROW_UNLOCK(ih); - i++; + + /* Return when we hit end of hash. */ + if (++i > V_pf_hashmask) { + V_pf_status.states = uma_zone_get_cur(V_pf_state_z); + return (0); + } + maxcheck--; } V_pf_status.states = uma_zone_get_cur(V_pf_state_z); - return (rv); + return (i); } static void From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 22:26:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FA9B106564A; Fri, 28 Sep 2012 22:26:45 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 398358FC15; Fri, 28 Sep 2012 22:26:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SMQjPt016006; Fri, 28 Sep 2012 22:26:45 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SMQjl9016004; Fri, 28 Sep 2012 22:26:45 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201209282226.q8SMQjl9016004@svn.freebsd.org> From: Xin LI Date: Fri, 28 Sep 2012 22:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241040 - stable/8/usr.sbin/mountd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 22:26:45 -0000 Author: delphij Date: Fri Sep 28 22:26:44 2012 New Revision: 241040 URL: http://svn.freebsd.org/changeset/base/241040 Log: MFC r239744: Show error messages if nmount() failed. Modified: stable/8/usr.sbin/mountd/mountd.c Directory Properties: stable/8/usr.sbin/mountd/ (props changed) Modified: stable/8/usr.sbin/mountd/mountd.c ============================================================================== --- stable/8/usr.sbin/mountd/mountd.c Fri Sep 28 20:43:03 2012 (r241039) +++ stable/8/usr.sbin/mountd/mountd.c Fri Sep 28 22:26:44 2012 (r241040) @@ -2464,11 +2464,11 @@ do_mount(struct exportlist *ep, struct g } if (errno == EPERM) { if (debug) - warnx("can't change attributes for %s", - dirp); + warnx("can't change attributes for %s: %s", + dirp, errmsg); syslog(LOG_ERR, - "can't change attributes for %s", - dirp); + "can't change attributes for %s: %s", + dirp, errmsg); ret = 1; goto error_exit; } From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 03:41:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E708106564A; Sat, 29 Sep 2012 03:41:22 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 897018FC0A; Sat, 29 Sep 2012 03:41:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8T3fMeh055819; Sat, 29 Sep 2012 03:41:22 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8T3fM7v055817; Sat, 29 Sep 2012 03:41:22 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201209290341.q8T3fM7v055817@svn.freebsd.org> From: Devin Teske Date: Sat, 29 Sep 2012 03:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241042 - head/usr.sbin/bsdconfig/share X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 03:41:22 -0000 Author: dteske Date: Sat Sep 29 03:41:21 2012 New Revision: 241042 URL: http://svn.freebsd.org/changeset/base/241042 Log: Allow deferred word-splitting via f_sysrc_get() by allowing $IFS in the "clean-room" environment used to query rc.conf(5) parameters. This brings bsdconfig(8)'s sysrc.subr in-line with both the sysrc(8) manual [provided by sysutils/sysrc] and sysrc(8)'s own sysrc.subr (now identical to bsdconfig(8)'s sysrc.subr as of this patch). Finally, this will allow a clean import of sysutils/sysrc (sans sysrc.subr, already provided here). Reviewed by: jilles Approved by: adrian (co-mentor) Modified: head/usr.sbin/bsdconfig/share/sysrc.subr Modified: head/usr.sbin/bsdconfig/share/sysrc.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/sysrc.subr Sat Sep 29 01:15:45 2012 (r241041) +++ head/usr.sbin/bsdconfig/share/sysrc.subr Sat Sep 29 03:41:21 2012 (r241042) @@ -143,7 +143,7 @@ f_sysrc_get() # Clear the environment of all variables, preventing the # expansion of normals such as `PS1', `TERM', etc. # - f_clean_env --except RC_CONFS RC_DEFAULTS + f_clean_env --except IFS RC_CONFS RC_DEFAULTS . "$RC_DEFAULTS" > /dev/null 2>&1 @@ -451,8 +451,7 @@ f_sysrc_set() if [ "${RC_CONFS+set}" ]; then file="${RC_CONFS%%[$IFS]*}" else - file=$( f_sysrc_get rc_conf_files ) - file="${file%%[$IFS]*}" + file=$( f_sysrc_get 'rc_conf_files%%[$IFS]*' ) fi fi From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 05:52:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D100E106564A; Sat, 29 Sep 2012 05:52:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C3AD8FC08; Sat, 29 Sep 2012 05:52:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8T5qKGV072702; Sat, 29 Sep 2012 05:52:20 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8T5qJor072700; Sat, 29 Sep 2012 05:52:19 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201209290552.q8T5qJor072700@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 29 Sep 2012 05:52:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241043 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 05:52:20 -0000 Author: glebius Date: Sat Sep 29 05:52:19 2012 New Revision: 241043 URL: http://svn.freebsd.org/changeset/base/241043 Log: carp_send_ad() should never return without rescheduling next run. Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Sat Sep 29 03:41:21 2012 (r241042) +++ head/sys/netinet/ip_carp.c Sat Sep 29 05:52:19 2012 (r241043) @@ -771,10 +771,7 @@ carp_send_ad_locked(struct carp_softc *s MGETHDR(m, M_NOWAIT, MT_HEADER); if (m == NULL) { CARPSTATS_INC(carps_onomem); - /* XXX maybe less ? */ - callout_reset(&sc->sc_ad_tmo, tvtohz(&tv), - carp_send_ad, sc); - return; + goto resched; } len = sizeof(*ip) + sizeof(ch); m->m_pkthdr.len = len; @@ -807,7 +804,7 @@ carp_send_ad_locked(struct carp_softc *s ch_ptr = (struct carp_header *)(&ip[1]); bcopy(&ch, ch_ptr, sizeof(ch)); if (carp_prepare_ad(m, sc, ch_ptr)) - return; + goto resched; m->m_data += sizeof(*ip); ch_ptr->carp_cksum = carp_cksum(m, len - sizeof(*ip)); @@ -842,10 +839,7 @@ carp_send_ad_locked(struct carp_softc *s MGETHDR(m, M_NOWAIT, MT_HEADER); if (m == NULL) { CARPSTATS_INC(carps_onomem); - /* XXX maybe less ? */ - callout_reset(&sc->sc_ad_tmo, tvtohz(&tv), - carp_send_ad, sc); - return; + goto resched; } len = sizeof(*ip6) + sizeof(ch); m->m_pkthdr.len = len; @@ -877,13 +871,13 @@ carp_send_ad_locked(struct carp_softc *s if (in6_setscope(&ip6->ip6_dst, sc->sc_carpdev, NULL) != 0) { m_freem(m); CARP_DEBUG("%s: in6_setscope failed\n", __func__); - return; + goto resched; } ch_ptr = (struct carp_header *)(&ip6[1]); bcopy(&ch, ch_ptr, sizeof(ch)); if (carp_prepare_ad(m, sc, ch_ptr)) - return; + goto resched; m->m_data += sizeof(*ip6); ch_ptr->carp_cksum = carp_cksum(m, len - sizeof(*ip6)); @@ -913,6 +907,7 @@ carp_send_ad_locked(struct carp_softc *s } #endif /* INET6 */ +resched: callout_reset(&sc->sc_ad_tmo, tvtohz(&tv), carp_send_ad, sc); } From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 08:11:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2698A106566B; Sat, 29 Sep 2012 08:11:13 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 125DF8FC1D; Sat, 29 Sep 2012 08:11:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8T8BCCC090184; Sat, 29 Sep 2012 08:11:12 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8T8BCdo090182; Sat, 29 Sep 2012 08:11:12 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201209290811.q8T8BCdo090182@svn.freebsd.org> From: Alan Cox Date: Sat, 29 Sep 2012 08:11:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241044 - head/sys/arm/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 08:11:13 -0000 Author: alc Date: Sat Sep 29 08:11:12 2012 New Revision: 241044 URL: http://svn.freebsd.org/changeset/base/241044 Log: Update a comment to reflect recent locking changes. Modified: head/sys/arm/arm/pmap.c Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Sat Sep 29 05:52:19 2012 (r241043) +++ head/sys/arm/arm/pmap.c Sat Sep 29 08:11:12 2012 (r241044) @@ -4562,13 +4562,13 @@ retry: managed = true; if (managed) { /* - * the ARM pmap tries to maintain a per-mapping + * The ARM pmap tries to maintain a per-mapping * reference bit. The trouble is that it's kept in * the PV entry, not the PTE, so it's costly to access - * here. You would need to acquire the page queues + * here. You would need to acquire the pvh global * lock, call pmap_find_pv(), and introduce a custom * version of vm_page_pa_tryrelock() that releases and - * reacquires the page queues lock. In the end, I + * reacquires the pvh global lock. In the end, I * doubt it's worthwhile. This may falsely report * the given address as referenced. */ From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 10:49:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C55F6106564A; Sat, 29 Sep 2012 10:49:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B13B38FC0A; Sat, 29 Sep 2012 10:49:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8TAn2wR011577; Sat, 29 Sep 2012 10:49:02 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8TAn2g1011575; Sat, 29 Sep 2012 10:49:02 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201209291049.q8TAn2g1011575@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 29 Sep 2012 10:49:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241045 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 10:49:02 -0000 Author: glebius Date: Sat Sep 29 10:49:02 2012 New Revision: 241045 URL: http://svn.freebsd.org/changeset/base/241045 Log: Give a clue how to force tcpdump(8) to interpret correctly CARP packets. Modified: head/share/man/man4/carp.4 Modified: head/share/man/man4/carp.4 ============================================================================== --- head/share/man/man4/carp.4 Sat Sep 29 08:11:12 2012 (r241044) +++ head/share/man/man4/carp.4 Sat Sep 29 10:49:02 2012 (r241045) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 30, 2012 +.Dd September 29, 2012 .Dt CARP 4 .Os .Sh NAME @@ -287,6 +287,19 @@ notify 0 { action "/root/carpcontrol.sh $subsystem $type"; }; .Ed +.Pp +To see +.Nm +packets decoded in +.Xr tcpdump 8 +output, one needs to specify +.Fl T Ar carp +option, otherwise +.Xr tcpdump 8 +tries to interpret them as VRRP packets: +.Bd -literal -offset indent +tcpdump -npi vlan0 -T carp +.Ed .Sh SEE ALSO .Xr inet 4 , .Xr pfsync 4 , @@ -294,6 +307,7 @@ notify 0 { .Xr devd.conf 5 , .Xr ifconfig 8 , .Xr sysctl 8 +.Xr tcpdump 8 .Sh HISTORY The .Nm From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 11:54:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 89122106566B; Sat, 29 Sep 2012 11:54:35 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72A638FC15; Sat, 29 Sep 2012 11:54:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8TBsZhr019705; Sat, 29 Sep 2012 11:54:35 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8TBsZPF019690; Sat, 29 Sep 2012 11:54:35 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201209291154.q8TBsZPF019690@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 29 Sep 2012 11:54:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241046 - in head/lib/libc: gen locale nls stdlib yp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 11:54:35 -0000 Author: jilles Date: Sat Sep 29 11:54:34 2012 New Revision: 241046 URL: http://svn.freebsd.org/changeset/base/241046 Log: libc: Use O_CLOEXEC for various internal file descriptors. This fixes a race condition where another thread may fork() before CLOEXEC is set, unintentionally passing the descriptor to the child process. This commit only adds O_CLOEXEC flags to open() or openat() calls where no fcntl(fd, F_SETFD, FD_CLOEXEC) follows. The separate fcntl() call still leaves a race window so it should be fixed later. Modified: head/lib/libc/gen/arc4random.c head/lib/libc/gen/getcap.c head/lib/libc/gen/getcwd.c head/lib/libc/gen/nlist.c head/lib/libc/gen/opendir.c head/lib/libc/gen/pututxline.c head/lib/libc/gen/readpassphrase.c head/lib/libc/gen/sem_new.c head/lib/libc/gen/syslog.c head/lib/libc/locale/ldpart.c head/lib/libc/nls/msgcat.c head/lib/libc/stdlib/rand.c head/lib/libc/stdlib/random.c head/lib/libc/yp/yplib.c Modified: head/lib/libc/gen/arc4random.c ============================================================================== --- head/lib/libc/gen/arc4random.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/gen/arc4random.c Sat Sep 29 11:54:34 2012 (r241046) @@ -153,7 +153,7 @@ arc4_stir(void) if (arc4_sysctl((u_char *)&rdat, KEYSIZE) == KEYSIZE) done = 1; if (!done) { - fd = _open(RANDOMDEV, O_RDONLY, 0); + fd = _open(RANDOMDEV, O_RDONLY | O_CLOEXEC, 0); if (fd >= 0) { if (_read(fd, &rdat, KEYSIZE) == KEYSIZE) done = 1; Modified: head/lib/libc/gen/getcap.c ============================================================================== --- head/lib/libc/gen/getcap.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/gen/getcap.c Sat Sep 29 11:54:34 2012 (r241046) @@ -264,7 +264,7 @@ getent(char **cap, u_int *len, char **db *cap = cbuf; return (retval); } else { - fd = _open(*db_p, O_RDONLY, 0); + fd = _open(*db_p, O_RDONLY | O_CLOEXEC, 0); if (fd < 0) continue; myfd = 1; Modified: head/lib/libc/gen/getcwd.c ============================================================================== --- head/lib/libc/gen/getcwd.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/gen/getcwd.c Sat Sep 29 11:54:34 2012 (r241046) @@ -142,7 +142,7 @@ getcwd(pt, size) /* Open and stat parent directory. */ fd = _openat(dir != NULL ? _dirfd(dir) : AT_FDCWD, - "..", O_RDONLY); + "..", O_RDONLY | O_CLOEXEC); if (fd == -1) goto err; if (dir) Modified: head/lib/libc/gen/nlist.c ============================================================================== --- head/lib/libc/gen/nlist.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/gen/nlist.c Sat Sep 29 11:54:34 2012 (r241046) @@ -66,7 +66,7 @@ nlist(name, list) { int fd, n; - fd = _open(name, O_RDONLY, 0); + fd = _open(name, O_RDONLY | O_CLOEXEC, 0); if (fd < 0) return (-1); n = __fdnlist(fd, list); Modified: head/lib/libc/gen/opendir.c ============================================================================== --- head/lib/libc/gen/opendir.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/gen/opendir.c Sat Sep 29 11:54:34 2012 (r241046) @@ -199,7 +199,8 @@ __opendir_common(int fd, const char *nam * which has also been read -- see fts.c. */ if (flags & DTF_REWIND) { - if ((fd2 = _open(name, O_RDONLY | O_DIRECTORY)) == -1) { + if ((fd2 = _open(name, O_RDONLY | O_DIRECTORY | + O_CLOEXEC)) == -1) { saved_errno = errno; free(buf); free(dirp); Modified: head/lib/libc/gen/pututxline.c ============================================================================== --- head/lib/libc/gen/pututxline.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/gen/pututxline.c Sat Sep 29 11:54:34 2012 (r241046) @@ -47,7 +47,7 @@ futx_open(const char *file) struct stat sb; int fd; - fd = _open(file, O_CREAT|O_RDWR|O_EXLOCK, 0644); + fd = _open(file, O_CREAT|O_RDWR|O_EXLOCK|O_CLOEXEC, 0644); if (fd < 0) return (NULL); @@ -235,7 +235,7 @@ utx_lastlogin_upgrade(void) struct stat sb; int fd; - fd = _open(_PATH_UTX_LASTLOGIN, O_RDWR, 0644); + fd = _open(_PATH_UTX_LASTLOGIN, O_RDWR|O_CLOEXEC, 0644); if (fd < 0) return; @@ -269,7 +269,7 @@ utx_log_add(const struct futx *fu) vec[1].iov_len = l; l = htobe16(l); - fd = _open(_PATH_UTX_LOG, O_CREAT|O_WRONLY|O_APPEND, 0644); + fd = _open(_PATH_UTX_LOG, O_CREAT|O_WRONLY|O_APPEND|O_CLOEXEC, 0644); if (fd < 0) return (-1); if (_writev(fd, vec, 2) == -1) Modified: head/lib/libc/gen/readpassphrase.c ============================================================================== --- head/lib/libc/gen/readpassphrase.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/gen/readpassphrase.c Sat Sep 29 11:54:34 2012 (r241046) @@ -68,7 +68,7 @@ restart: * stdin and write to stderr unless a tty is required. */ if ((flags & RPP_STDIN) || - (input = output = _open(_PATH_TTY, O_RDWR)) == -1) { + (input = output = _open(_PATH_TTY, O_RDWR | O_CLOEXEC)) == -1) { if (flags & RPP_REQUIRE_TTY) { errno = ENOTTY; return(NULL); Modified: head/lib/libc/gen/sem_new.c ============================================================================== --- head/lib/libc/gen/sem_new.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/gen/sem_new.c Sat Sep 29 11:54:34 2012 (r241046) @@ -198,7 +198,7 @@ _sem_open(const char *name, int flags, . goto error; } - fd = _open(path, flags|O_RDWR, mode); + fd = _open(path, flags|O_RDWR|O_CLOEXEC, mode); if (fd == -1) goto error; if (flock(fd, LOCK_EX) == -1) Modified: head/lib/libc/gen/syslog.c ============================================================================== --- head/lib/libc/gen/syslog.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/gen/syslog.c Sat Sep 29 11:54:34 2012 (r241046) @@ -300,7 +300,8 @@ vsyslog(int pri, const char *fmt, va_lis * Make sure the error reported is the one from the syslogd failure. */ if (LogStat & LOG_CONS && - (fd = _open(_PATH_CONSOLE, O_WRONLY|O_NONBLOCK, 0)) >= 0) { + (fd = _open(_PATH_CONSOLE, O_WRONLY|O_NONBLOCK|O_CLOEXEC, 0)) >= + 0) { struct iovec iov[2]; struct iovec *v = iov; Modified: head/lib/libc/locale/ldpart.c ============================================================================== --- head/lib/libc/locale/ldpart.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/locale/ldpart.c Sat Sep 29 11:54:34 2012 (r241046) @@ -87,7 +87,7 @@ __part_load_locale(const char *name, strcat(filename, name); strcat(filename, "/"); strcat(filename, category_filename); - if ((fd = _open(filename, O_RDONLY)) < 0) + if ((fd = _open(filename, O_RDONLY | O_CLOEXEC)) < 0) return (_LDP_ERROR); if (_fstat(fd, &st) != 0) goto bad_locale; Modified: head/lib/libc/nls/msgcat.c ============================================================================== --- head/lib/libc/nls/msgcat.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/nls/msgcat.c Sat Sep 29 11:54:34 2012 (r241046) @@ -384,7 +384,7 @@ load_msgcat(const char *path, const char } UNLOCK; - if ((fd = _open(path, O_RDONLY)) == -1) { + if ((fd = _open(path, O_RDONLY | O_CLOEXEC)) == -1) { SAVEFAIL(name, lang, errno); NLRETERR(errno); } Modified: head/lib/libc/stdlib/rand.c ============================================================================== --- head/lib/libc/stdlib/rand.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/stdlib/rand.c Sat Sep 29 11:54:34 2012 (r241046) @@ -121,7 +121,7 @@ sranddev() int fd, done; done = 0; - fd = _open("/dev/random", O_RDONLY, 0); + fd = _open("/dev/random", O_RDONLY | O_CLOEXEC, 0); if (fd >= 0) { if (_read(fd, (void *) &next, sizeof(next)) == sizeof(next)) done = 1; Modified: head/lib/libc/stdlib/random.c ============================================================================== --- head/lib/libc/stdlib/random.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/stdlib/random.c Sat Sep 29 11:54:34 2012 (r241046) @@ -303,7 +303,7 @@ srandomdev(void) len = rand_deg * sizeof state[0]; done = 0; - fd = _open("/dev/random", O_RDONLY, 0); + fd = _open("/dev/random", O_RDONLY | O_CLOEXEC, 0); if (fd >= 0) { if (_read(fd, (void *) state, len) == (ssize_t) len) done = 1; Modified: head/lib/libc/yp/yplib.c ============================================================================== --- head/lib/libc/yp/yplib.c Sat Sep 29 10:49:02 2012 (r241045) +++ head/lib/libc/yp/yplib.c Sat Sep 29 11:54:34 2012 (r241046) @@ -375,7 +375,7 @@ again: ysd->dom_socket = -1; } snprintf(path, sizeof(path), "%s/%s.%d", BINDINGDIR, dom, 2); - if ((fd = _open(path, O_RDONLY)) == -1) { + if ((fd = _open(path, O_RDONLY | O_CLOEXEC)) == -1) { /* no binding file, YP is dead. */ /* Try to bring it back to life. */ _close(fd); From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 15:08:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26948106566C; Sat, 29 Sep 2012 15:08:56 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 117358FC0A; Sat, 29 Sep 2012 15:08:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8TF8t7Y045095; Sat, 29 Sep 2012 15:08:55 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8TF8tLs045093; Sat, 29 Sep 2012 15:08:55 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201209291508.q8TF8tLs045093@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sat, 29 Sep 2012 15:08:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241047 - head/sys/boot/i386/loader X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 15:08:56 -0000 Author: ae Date: Sat Sep 29 15:08:55 2012 New Revision: 241047 URL: http://svn.freebsd.org/changeset/base/241047 Log: Disable splitfs support, since we aren't support floppies for a long time. This slightly reduces an overhead, when loader tries to open file that doesn't exist. Modified: head/sys/boot/i386/loader/conf.c Modified: head/sys/boot/i386/loader/conf.c ============================================================================== --- head/sys/boot/i386/loader/conf.c Sat Sep 29 11:54:34 2012 (r241046) +++ head/sys/boot/i386/loader/conf.c Sat Sep 29 15:08:55 2012 (r241047) @@ -80,7 +80,9 @@ struct fs_ops *file_system[] = { #if defined(LOADER_NANDFS_SUPPORT) &nandfs_fsops, #endif +#ifdef LOADER_SPLIT_SUPPORT &splitfs_fsops, +#endif #ifdef LOADER_GZIP_SUPPORT &gzipfs_fsops, #endif From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 16:15:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4BAC3106564A; Sat, 29 Sep 2012 16:15:28 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 36F828FC0A; Sat, 29 Sep 2012 16:15:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8TGFS2l054531; Sat, 29 Sep 2012 16:15:28 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8TGFRf9054529; Sat, 29 Sep 2012 16:15:27 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201209291615.q8TGFRf9054529@svn.freebsd.org> From: Kevin Lo Date: Sat, 29 Sep 2012 16:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241048 - head/sys/dev/iicbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 16:15:28 -0000 Author: kevlo Date: Sat Sep 29 16:15:27 2012 New Revision: 241048 URL: http://svn.freebsd.org/changeset/base/241048 Log: Remove unused variables. Modified: head/sys/dev/iicbus/s35390a.c Modified: head/sys/dev/iicbus/s35390a.c ============================================================================== --- head/sys/dev/iicbus/s35390a.c Sat Sep 29 15:08:55 2012 (r241047) +++ head/sys/dev/iicbus/s35390a.c Sat Sep 29 16:15:27 2012 (r241048) @@ -260,10 +260,8 @@ s390rtc_gettime(device_t dev, struct tim { uint8_t bcd[S390_RT1_NBYTES]; struct clocktime ct; - struct s390rtc_softc *sc; int error; - sc = device_get_softc(dev); error = s390rtc_read(dev, S390_REALTIME1, bcd, S390_RT1_NBYTES); if (error) { device_printf(dev, "%s: cannot read realtime1 register\n", @@ -291,9 +289,7 @@ s390rtc_settime(device_t dev, struct tim { uint8_t bcd[S390_RT1_NBYTES]; struct clocktime ct; - struct s390rtc_softc *sc; - sc = device_get_softc(dev); clock_ts_to_ct(ts, &ct); /* From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 16:19:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 535671065672; Sat, 29 Sep 2012 16:19:02 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EA158FC08; Sat, 29 Sep 2012 16:19:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8TGJ2Sb055029; Sat, 29 Sep 2012 16:19:02 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8TGJ216055027; Sat, 29 Sep 2012 16:19:02 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201209291619.q8TGJ216055027@svn.freebsd.org> From: Kevin Lo Date: Sat, 29 Sep 2012 16:19:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241049 - head/usr.bin/csup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 16:19:02 -0000 Author: kevlo Date: Sat Sep 29 16:19:01 2012 New Revision: 241049 URL: http://svn.freebsd.org/changeset/base/241049 Log: Add missing va_end. Modified: head/usr.bin/csup/proto.c Modified: head/usr.bin/csup/proto.c ============================================================================== --- head/usr.bin/csup/proto.c Sat Sep 29 16:15:27 2012 (r241048) +++ head/usr.bin/csup/proto.c Sat Sep 29 16:19:01 2012 (r241049) @@ -727,8 +727,10 @@ proto_printf(struct stream *wr, const ch while ((cp = strchr(fmt, '%')) != NULL) { if (cp > fmt) { n = stream_write(wr, fmt, cp - fmt); - if (n == -1) + if (n == -1) { + va_end(ap); return (-1); + } } if (*++cp == '\0') goto done; From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 16:27:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E0FAC106564A; Sat, 29 Sep 2012 16:27:13 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCEF48FC08; Sat, 29 Sep 2012 16:27:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8TGRDOD056122; Sat, 29 Sep 2012 16:27:13 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8TGRDsT056120; Sat, 29 Sep 2012 16:27:13 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201209291627.q8TGRDsT056120@svn.freebsd.org> From: Kevin Lo Date: Sat, 29 Sep 2012 16:27:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241050 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 16:27:14 -0000 Author: kevlo Date: Sat Sep 29 16:27:13 2012 New Revision: 241050 URL: http://svn.freebsd.org/changeset/base/241050 Log: If devclass_get_devices(9) returns success but a count of 0, free the pointer. Modified: head/sys/dev/usb/usb_pf.c Modified: head/sys/dev/usb/usb_pf.c ============================================================================== --- head/sys/dev/usb/usb_pf.c Sat Sep 29 16:19:01 2012 (r241049) +++ head/sys/dev/usb/usb_pf.c Sat Sep 29 16:27:13 2012 (r241050) @@ -111,6 +111,7 @@ usbpf_uninit(void) if (ubus != NULL && ubus->ifp != NULL) usbpf_clone_destroy(&usbpf_cloner, ubus->ifp); } + free(devlp, M_TEMP); } static int From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 16:40:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14B91106564A; Sat, 29 Sep 2012 16:40:13 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB7A88FC0A; Sat, 29 Sep 2012 16:40:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8TGeCGZ057791; Sat, 29 Sep 2012 16:40:12 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8TGeCVS057788; Sat, 29 Sep 2012 16:40:12 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201209291640.q8TGeCVS057788@svn.freebsd.org> From: Steve Kargl Date: Sat, 29 Sep 2012 16:40:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241051 - in head/lib/msun: ld80 src X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 16:40:13 -0000 Author: kargl Date: Sat Sep 29 16:40:12 2012 New Revision: 241051 URL: http://svn.freebsd.org/changeset/base/241051 Log: * src/math_private.h: . Change the API for the LD80C by removing the explicit passing of the sign bit. The sign can be determined from the last parameter of the macro. . On i386, load long double by bit manipulations to work around at least a gcc compiler issue. On non-i386 ld80 architectures, use a simple assignment. * ld80/s_expl.c: . Update the only consumer of LD80C. Submitted by: bde Approved by: das (mentor) Modified: head/lib/msun/ld80/s_expl.c head/lib/msun/src/math_private.h Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Sat Sep 29 16:27:13 2012 (r241050) +++ head/lib/msun/ld80/s_expl.c Sat Sep 29 16:40:12 2012 (r241051) @@ -60,9 +60,9 @@ static volatile const long double tiny = static const union IEEEl2bits /* log(2**16384 - 0.5) rounded towards zero: */ -o_threshold = LD80C(0xb17217f7d1cf79ab, 13, 0, 11356.5234062941439488L), +o_threshold = LD80C(0xb17217f7d1cf79ab, 13, 11356.5234062941439488L), /* log(2**(-16381-64-1)) rounded towards zero: */ -u_threshold = LD80C(0xb21dfe7f09e2baa9, 13, 1, -11399.4985314888605581L); +u_threshold = LD80C(0xb21dfe7f09e2baa9, 13, -11399.4985314888605581L); static const double __aligned(64) /* Modified: head/lib/msun/src/math_private.h ============================================================================== --- head/lib/msun/src/math_private.h Sat Sep 29 16:27:13 2012 (r241050) +++ head/lib/msun/src/math_private.h Sat Sep 29 16:40:12 2012 (r241051) @@ -207,12 +207,16 @@ do { \ (d) = se_u.e; \ } while (0) -/* Long double constants are broken on i386. This workaround is OK always. */ -#define LD80C(m, ex, s, v) { \ - /* .e = v, */ /* overwritten */ \ - .xbits.man = __CONCAT(m, ULL), \ - .xbits.expsign = (0x3fff + (ex)) | ((s) ? 0x8000 : 0), \ +#ifdef __i386__ +/* Long double constants are broken on i386. */ +#define LD80C(m, ex, v) { \ + .xbits.man = __CONCAT(m, ULL), \ + .xbits.expsign = (0x3fff + (ex)) | ((v) < 0 ? 0x8000 : 0), \ } +#else +/* The above works on non-i386 too, but we use this to check v. */ +#define LD80C(m, ex, v) { .e = (v), } +#endif #ifdef FLT_EVAL_METHOD /* From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 16:42:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1B76A106564A; Sat, 29 Sep 2012 16:42:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E20828FC0C; Sat, 29 Sep 2012 16:42:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8TGg1f6058056; Sat, 29 Sep 2012 16:42:01 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8TGg1VF058054; Sat, 29 Sep 2012 16:42:01 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201209291642.q8TGg1VF058054@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 29 Sep 2012 16:42:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241052 - head/sbin/pfctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 16:42:02 -0000 Author: glebius Date: Sat Sep 29 16:42:01 2012 New Revision: 241052 URL: http://svn.freebsd.org/changeset/base/241052 Log: - Get rid of #ifdef __FreeBSD__. - Use correct format when printing uint64_t. Modified: head/sbin/pfctl/pf_print_state.c Modified: head/sbin/pfctl/pf_print_state.c ============================================================================== --- head/sbin/pfctl/pf_print_state.c Sat Sep 29 16:40:12 2012 (r241051) +++ head/sbin/pfctl/pf_print_state.c Sat Sep 29 16:42:01 2012 (r241052) @@ -35,10 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef __FreeBSD__ #include -#define betoh64 be64toh -#endif #include #define TCPSTATES #include @@ -46,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -318,18 +316,11 @@ print_state(struct pfsync_state *s, int bcopy(s->packets[1], &packets[1], sizeof(u_int64_t)); bcopy(s->bytes[0], &bytes[0], sizeof(u_int64_t)); bcopy(s->bytes[1], &bytes[1], sizeof(u_int64_t)); - printf(", %llu:%llu pkts, %llu:%llu bytes", -#ifdef __FreeBSD__ - (unsigned long long)betoh64(packets[0]), - (unsigned long long)betoh64(packets[1]), - (unsigned long long)betoh64(bytes[0]), - (unsigned long long)betoh64(bytes[1])); -#else - betoh64(packets[0]), - betoh64(packets[1]), - betoh64(bytes[0]), - betoh64(bytes[1])); -#endif + printf(", %ju:%ju pkts, %ju:%ju bytes", + (uintmax_t )be64toh(packets[0]), + (uintmax_t )be64toh(packets[1]), + (uintmax_t )be64toh(bytes[0]), + (uintmax_t )be64toh(bytes[1])); if (ntohl(s->anchor) != -1) printf(", anchor %u", ntohl(s->anchor)); if (ntohl(s->rule) != -1) @@ -346,12 +337,8 @@ print_state(struct pfsync_state *s, int u_int64_t id; bcopy(&s->id, &id, sizeof(u_int64_t)); - printf(" id: %016llx creatorid: %08x", -#ifdef __FreeBSD__ - (unsigned long long)betoh64(id), ntohl(s->creatorid)); -#else - betoh64(id), ntohl(s->creatorid)); -#endif + printf(" id: %016jx creatorid: %08x", + (uintmax_t )be64toh(id), ntohl(s->creatorid)); printf("\n"); } } From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 16:47:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A4DE71065670; Sat, 29 Sep 2012 16:47:57 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5EA538FC12; Sat, 29 Sep 2012 16:47:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8TGlvom058843; Sat, 29 Sep 2012 16:47:57 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8TGlvbr058837; Sat, 29 Sep 2012 16:47:57 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201209291647.q8TGlvbr058837@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sat, 29 Sep 2012 16:47:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241053 - in head/sys/boot: common i386/libi386 uboot/lib userboot/userboot X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 16:47:57 -0000 Author: ae Date: Sat Sep 29 16:47:56 2012 New Revision: 241053 URL: http://svn.freebsd.org/changeset/base/241053 Log: Almost each time when loader opens a file, this leads to calling disk_open(). Very often this is called several times for one file. This leads to reading partition table metadata for each call. To reduce the number of disk I/O we have a simple block cache, but it is very dumb and more than half of I/O operations related to reading metadata, misses this cache. Introduce new cache layer to resolve this problem. It is independent and doesn't need initialization like bcache, and will work by default for all loaders which use the new DISK API. A successful disk_open() call to each new disk or partition produces new entry in the cache. Even more, when disk was already open, now opening of any nested partitions does not require reading top level partition table. So, if without this cache, partition table metadata was read around 20-50 times during boot, now it reads only once. This affects the booting from GPT and MBR from the UFS. Modified: head/sys/boot/common/disk.c head/sys/boot/common/disk.h head/sys/boot/i386/libi386/biosdisk.c head/sys/boot/uboot/lib/disk.c head/sys/boot/userboot/userboot/userboot_disk.c Modified: head/sys/boot/common/disk.c ============================================================================== --- head/sys/boot/common/disk.c Sat Sep 29 16:42:01 2012 (r241052) +++ head/sys/boot/common/disk.c Sat Sep 29 16:47:56 2012 (r241053) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -46,6 +47,7 @@ struct open_disk { struct ptable *table; off_t mediasize; u_int sectorsize; + int rcnt; }; struct print_args { @@ -54,6 +56,96 @@ struct print_args { int verbose; }; +struct dentry { + const struct devsw *d_dev; + int d_unit; + int d_slice; + int d_partition; + + struct open_disk *od; + off_t d_offset; + STAILQ_ENTRY(dentry) entry; +#ifdef DISK_DEBUG + uint32_t count; +#endif +}; + +static STAILQ_HEAD(, dentry) opened_disks = + STAILQ_HEAD_INITIALIZER(opened_disks); + +static int +disk_lookup(struct disk_devdesc *dev) +{ + struct dentry *entry; + int rc; + + rc = ENOENT; + STAILQ_FOREACH(entry, &opened_disks, entry) { + if (entry->d_dev != dev->d_dev || + entry->d_unit != dev->d_unit) + continue; + dev->d_opendata = entry->od; + if (entry->d_slice == dev->d_slice && + entry->d_partition == dev->d_partition) { + dev->d_offset = entry->d_offset; + DEBUG("%s offset %lld", disk_fmtdev(dev), + dev->d_offset); +#ifdef DISK_DEBUG + entry->count++; +#endif + return (0); + } + rc = EAGAIN; + } + return (rc); +} + +static void +disk_insert(struct disk_devdesc *dev) +{ + struct dentry *entry; + + entry = (struct dentry *)malloc(sizeof(struct dentry)); + if (entry == NULL) { + DEBUG("no memory"); + return; + } + entry->d_dev = dev->d_dev; + entry->d_unit = dev->d_unit; + entry->d_slice = dev->d_slice; + entry->d_partition = dev->d_partition; + entry->od = (struct open_disk *)dev->d_opendata; + entry->od->rcnt++; + entry->d_offset = dev->d_offset; +#ifdef DISK_DEBUG + entry->count = 1; +#endif + STAILQ_INSERT_TAIL(&opened_disks, entry, entry); + DEBUG("%s cached", disk_fmtdev(dev)); +} + +#ifdef DISK_DEBUG +COMMAND_SET(dcachestat, "dcachestat", "get disk cache stats", + command_dcachestat); + +static int +command_dcachestat(int argc, char *argv[]) +{ + struct disk_devdesc dev; + struct dentry *entry; + + STAILQ_FOREACH(entry, &opened_disks, entry) { + dev.d_dev = (struct devsw *)entry->d_dev; + dev.d_unit = entry->d_unit; + dev.d_slice = entry->d_slice; + dev.d_partition = entry->d_partition; + printf("%s %d => %p [%d]\n", disk_fmtdev(&dev), entry->count, + entry->od, entry->od->rcnt); + } + return (CMD_OK); +} +#endif /* DISK_DEBUG */ + /* Convert size to a human-readable number. */ static char * display_size(uint64_t size, u_int sectorsize) @@ -145,25 +237,43 @@ disk_open(struct disk_devdesc *dev, off_ struct open_disk *od; struct ptable *table; struct ptable_entry part; - int rc; + int rc, slice, partition; - od = (struct open_disk *)malloc(sizeof(struct open_disk)); - if (od == NULL) { - DEBUG("no memory"); - return (ENOMEM); - } + rc = disk_lookup(dev); + if (rc == 0) + return (0); /* * While we are reading disk metadata, make sure we do it relative * to the start of the disk */ - rc = 0; - table = NULL; dev->d_offset = 0; + table = NULL; + slice = dev->d_slice; + partition = dev->d_partition; + if (rc == EAGAIN) { + /* + * This entire disk was already opened and there is no + * need to allocate new open_disk structure and open the + * main partition table. + */ + od = (struct open_disk *)dev->d_opendata; + DEBUG("%s unit %d, slice %d, partition %d => %p (cached)", + disk_fmtdev(dev), dev->d_unit, dev->d_slice, + dev->d_partition, od); + goto opened; + } else { + od = (struct open_disk *)malloc(sizeof(struct open_disk)); + if (od == NULL) { + DEBUG("no memory"); + return (ENOMEM); + } + } dev->d_opendata = od; od->mediasize = mediasize; od->sectorsize = sectorsize; - DEBUG("%s unit %d, slice %d, partition %d", - disk_fmtdev(dev), dev->d_unit, dev->d_slice, dev->d_partition); + od->rcnt = 0; + DEBUG("%s unit %d, slice %d, partition %d => %p", + disk_fmtdev(dev), dev->d_unit, dev->d_slice, dev->d_partition, od); /* Determine disk layout. */ od->table = ptable_open(dev, mediasize / sectorsize, sectorsize, @@ -173,35 +283,34 @@ disk_open(struct disk_devdesc *dev, off_ rc = ENXIO; goto out; } +opened: + rc = 0; if (ptable_gettype(od->table) == PTABLE_BSD && - dev->d_partition >= 0) { + partition >= 0) { /* It doesn't matter what value has d_slice */ - rc = ptable_getpart(od->table, &part, dev->d_partition); + rc = ptable_getpart(od->table, &part, partition); if (rc == 0) dev->d_offset = part.start; - } else if (dev->d_slice >= 0) { + } else if (slice >= 0) { /* Try to get information about partition */ - if (dev->d_slice == 0) + if (slice == 0) rc = ptable_getbestpart(od->table, &part); else - rc = ptable_getpart(od->table, &part, dev->d_slice); + rc = ptable_getpart(od->table, &part, slice); if (rc != 0) /* Partition doesn't exist */ goto out; dev->d_offset = part.start; - if (dev->d_slice == 0) { - /* Save the slice number of best partition to dev */ - dev->d_slice = part.index; - if (ptable_gettype(od->table) == PTABLE_GPT) - dev->d_partition = 255; - } - if (dev->d_partition == 255) + slice = part.index; + if (ptable_gettype(od->table) == PTABLE_GPT) { + partition = 255; goto out; /* Nothing more to do */ + } /* * If d_partition < 0 and we are looking at a BSD slice, * then try to read BSD label, otherwise return the * whole MBR slice. */ - if (dev->d_partition == -1 && + if (partition == -1 && part.type != PART_FREEBSD) goto out; /* Try to read BSD label */ @@ -217,12 +326,12 @@ disk_open(struct disk_devdesc *dev, off_ * assume the 'a' partition. Otherwise just return the * whole MBR slice, because it can contain ZFS. */ - if (dev->d_partition < 0) { + if (partition < 0) { if (ptable_gettype(table) != PTABLE_BSD) goto out; - dev->d_partition = 0; + partition = 0; } - rc = ptable_getpart(table, &part, dev->d_partition); + rc = ptable_getpart(table, &part, partition); if (rc != 0) goto out; dev->d_offset += part.start; @@ -232,12 +341,19 @@ out: ptable_close(table); if (rc != 0) { - if (od->table != NULL) - ptable_close(od->table); - free(od); + if (od->rcnt < 1) { + if (od->table != NULL) + ptable_close(od->table); + free(od); + } DEBUG("%s could not open", disk_fmtdev(dev)); } else { - DEBUG("%s offset %lld", disk_fmtdev(dev), dev->d_offset); + disk_insert(dev); + /* Save the slice and partition number to the dev */ + dev->d_slice = slice; + dev->d_partition = partition; + DEBUG("%s offset %lld => %p", disk_fmtdev(dev), + dev->d_offset, od); } return (rc); } @@ -245,15 +361,43 @@ out: int disk_close(struct disk_devdesc *dev) { +#if DISK_DEBUG struct open_disk *od; od = (struct open_disk *)dev->d_opendata; - DEBUG("%s closed", disk_fmtdev(dev)); - ptable_close(od->table); - free(od); + DEBUG("%s closed => %p [%d]", disk_fmtdev(dev), od, od->rcnt); +#endif return (0); } +void +disk_cleanup(const struct devsw *d_dev) +{ + struct disk_devdesc dev; + struct dentry *entry, *tmp; + + STAILQ_FOREACH_SAFE(entry, &opened_disks, entry, tmp) { + if (entry->d_dev != d_dev) + continue; + entry->od->rcnt--; +#ifdef DISK_DEBUG + dev.d_dev = (struct devsw *)entry->d_dev; + dev.d_unit = entry->d_unit; + dev.d_slice = entry->d_slice; + dev.d_partition = entry->d_partition; + STAILQ_REMOVE(&opened_disks, entry, dentry, entry); + DEBUG("%s was freed => %p [%d]", disk_fmtdev(&dev), + entry->od, entry->od->rcnt); +#endif + if (entry->od->rcnt < 1) { + if (entry->od->table != NULL) + ptable_close(entry->od->table); + free(entry->od); + } + free(entry); + } +} + char* disk_fmtdev(struct disk_devdesc *dev) { @@ -261,7 +405,7 @@ disk_fmtdev(struct disk_devdesc *dev) char *cp; cp = buf + sprintf(buf, "%s%d", dev->d_dev->dv_name, dev->d_unit); - if (dev->d_slice > 0) { + if (dev->d_slice >= 0) { #ifdef LOADER_GPT_SUPPORT if (dev->d_partition == 255) { sprintf(cp, "p%d:", dev->d_slice); Modified: head/sys/boot/common/disk.h ============================================================================== --- head/sys/boot/common/disk.h Sat Sep 29 16:42:01 2012 (r241052) +++ head/sys/boot/common/disk.h Sat Sep 29 16:47:56 2012 (r241053) @@ -95,6 +95,7 @@ struct disk_devdesc extern int disk_open(struct disk_devdesc *dev, off_t mediasize, u_int sectorsize); extern int disk_close(struct disk_devdesc *dev); +extern void disk_cleanup(const struct devsw *d_dev); /* * Print information about slices on a disk. Modified: head/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- head/sys/boot/i386/libi386/biosdisk.c Sat Sep 29 16:42:01 2012 (r241052) +++ head/sys/boot/i386/libi386/biosdisk.c Sat Sep 29 16:47:56 2012 (r241053) @@ -106,6 +106,7 @@ static int bd_open(struct open_file *f, static int bd_close(struct open_file *f); static int bd_ioctl(struct open_file *f, u_long cmd, void *data); static void bd_print(int verbose); +static void bd_cleanup(void); struct devsw biosdisk = { "disk", @@ -116,7 +117,7 @@ struct devsw biosdisk = { bd_close, bd_ioctl, bd_print, - NULL + bd_cleanup }; /* @@ -181,6 +182,13 @@ bd_init(void) return(0); } +static void +bd_cleanup(void) +{ + + disk_cleanup(&biosdisk); +} + /* * Try to detect a device supported by the legacy int13 BIOS */ Modified: head/sys/boot/uboot/lib/disk.c ============================================================================== --- head/sys/boot/uboot/lib/disk.c Sat Sep 29 16:42:01 2012 (r241052) +++ head/sys/boot/uboot/lib/disk.c Sat Sep 29 16:47:56 2012 (r241053) @@ -142,6 +142,7 @@ stor_cleanup(void) for (i = 0; i < stor_info_no; i++) if (stor_info[i].opened > 0) ub_dev_close(stor_info[i].handle); + disk_cleanup(&uboot_storage); } static int Modified: head/sys/boot/userboot/userboot/userboot_disk.c ============================================================================== --- head/sys/boot/userboot/userboot/userboot_disk.c Sat Sep 29 16:42:01 2012 (r241052) +++ head/sys/boot/userboot/userboot/userboot_disk.c Sat Sep 29 16:47:56 2012 (r241053) @@ -104,6 +104,7 @@ userdisk_cleanup(void) if (userdisk_maxunit > 0) free(ud_info); + disk_cleanup(&userboot_disk); } /* From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 17:20:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 94ECC106564A; Sat, 29 Sep 2012 17:20:17 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 662E48FC0C; Sat, 29 Sep 2012 17:20:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8THKHgx063060; Sat, 29 Sep 2012 17:20:17 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8THKHbq063058; Sat, 29 Sep 2012 17:20:17 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201209291720.q8THKHbq063058@svn.freebsd.org> From: Alan Cox Date: Sat, 29 Sep 2012 17:20:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241054 - head/sys/arm/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 17:20:17 -0000 Author: alc Date: Sat Sep 29 17:20:16 2012 New Revision: 241054 URL: http://svn.freebsd.org/changeset/base/241054 Log: Add support for mincore(). Specifically, this is an adaptation of the pmap_mincore() implementation that was added to the original arm pmap in r235717. Modified: head/sys/arm/arm/pmap-v6.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Sat Sep 29 16:47:56 2012 (r241053) +++ head/sys/arm/arm/pmap-v6.c Sat Sep 29 17:20:16 2012 (r241054) @@ -3462,9 +3462,59 @@ pmap_remove_write(vm_page_t m) int pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) { - printf("pmap_mincore()\n"); - - return (0); + struct l2_bucket *l2b; + pt_entry_t *ptep, pte; + vm_paddr_t pa; + vm_page_t m; + int val; + boolean_t managed; + + PMAP_LOCK(pmap); +retry: + l2b = pmap_get_l2_bucket(pmap, addr); + if (l2b == NULL) { + val = 0; + goto out; + } + ptep = &l2b->l2b_kva[l2pte_index(addr)]; + pte = *ptep; + if (!l2pte_valid(pte)) { + val = 0; + goto out; + } + val = MINCORE_INCORE; + if (L2_S_WRITABLE(pte)) + val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; + managed = FALSE; + pa = l2pte_pa(pte); + m = PHYS_TO_VM_PAGE(pa); + if (m != NULL && (m->oflags & VPO_UNMANAGED) == 0) + managed = TRUE; + if (managed) { + /* + * The ARM pmap tries to maintain a per-mapping + * reference bit. The trouble is that it's kept in + * the PV entry, not the PTE, so it's costly to access + * here. You would need to acquire the pvh global + * lock, call pmap_find_pv(), and introduce a custom + * version of vm_page_pa_tryrelock() that releases and + * reacquires the pvh global lock. In the end, I + * doubt it's worthwhile. This may falsely report + * the given address as referenced. + */ + if ((m->md.pvh_attrs & PVF_REF) != 0) + val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; + } + if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != + (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER) && managed) { + /* Ensure that "PHYS_TO_VM_PAGE(pa)->object" doesn't change. */ + if (vm_page_pa_tryrelock(pmap, pa, locked_pa)) + goto retry; + } else +out: + PA_UNLOCK_COND(*locked_pa); + PMAP_UNLOCK(pmap); + return (val); } void From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 19:09:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D8366106564A; Sat, 29 Sep 2012 19:09:11 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3D338FC0A; Sat, 29 Sep 2012 19:09:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8TJ9BLc078221; Sat, 29 Sep 2012 19:09:11 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8TJ9BQF078218; Sat, 29 Sep 2012 19:09:11 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201209291909.q8TJ9BQF078218@svn.freebsd.org> From: Alan Cox Date: Sat, 29 Sep 2012 19:09:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241055 - head/sys/arm/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 19:09:12 -0000 Author: alc Date: Sat Sep 29 19:09:11 2012 New Revision: 241055 URL: http://svn.freebsd.org/changeset/base/241055 Log: Eliminate unused variables. Modified: head/sys/arm/arm/pmap-v6.c head/sys/arm/arm/pmap.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Sat Sep 29 17:20:16 2012 (r241054) +++ head/sys/arm/arm/pmap-v6.c Sat Sep 29 19:09:11 2012 (r241055) @@ -247,13 +247,6 @@ pt_entry_t pte_l2_l_cache_mode_pt; pt_entry_t pte_l2_s_cache_mode; pt_entry_t pte_l2_s_cache_mode_pt; -/* - * Which pmap is currently 'live' in the cache - * - * XXXSCW: Fix for SMP ... - */ -union pmap_cache_state *pmap_cache_state; - struct msgbuf *msgbufp = 0; /* @@ -264,8 +257,6 @@ static caddr_t crashdumpmap; extern void bcopy_page(vm_offset_t, vm_offset_t); extern void bzero_page(vm_offset_t); -extern vm_offset_t alloc_firstaddr; - char *_tmppt; /* Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Sat Sep 29 17:20:16 2012 (r241054) +++ head/sys/arm/arm/pmap.c Sat Sep 29 19:09:11 2012 (r241055) @@ -256,12 +256,6 @@ pt_entry_t pte_l2_s_proto; void (*pmap_copy_page_func)(vm_paddr_t, vm_paddr_t); void (*pmap_zero_page_func)(vm_paddr_t, int, int); -/* - * Which pmap is currently 'live' in the cache - * - * XXXSCW: Fix for SMP ... - */ -union pmap_cache_state *pmap_cache_state; struct msgbuf *msgbufp = 0; From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 20:02:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A19D5106566B; Sat, 29 Sep 2012 20:02:26 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B17E8FC0A; Sat, 29 Sep 2012 20:02:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8TK2Q40085158; Sat, 29 Sep 2012 20:02:26 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8TK2QE8085156; Sat, 29 Sep 2012 20:02:26 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201209292002.q8TK2QE8085156@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 29 Sep 2012 20:02:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241056 - head/sys/netpfil/pf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 20:02:26 -0000 Author: glebius Date: Sat Sep 29 20:02:26 2012 New Revision: 241056 URL: http://svn.freebsd.org/changeset/base/241056 Log: Simplify send out queue code: - Write method of a queue now is void,length of item is taken as queue property. - Write methods don't need to know about mbud, supply just buf to them. - No need for safe queue iterator in pfsync_sendout(). Obtained from: OpenBSD Modified: head/sys/netpfil/pf/if_pfsync.c Modified: head/sys/netpfil/pf/if_pfsync.c ============================================================================== --- head/sys/netpfil/pf/if_pfsync.c Sat Sep 29 19:09:11 2012 (r241055) +++ head/sys/netpfil/pf/if_pfsync.c Sat Sep 29 20:02:26 2012 (r241056) @@ -137,16 +137,16 @@ static int (*pfsync_acts[])(struct pfsyn }; struct pfsync_q { - int (*write)(struct pf_state *, struct mbuf *, int); + void (*write)(struct pf_state *, void *); size_t len; u_int8_t action; }; /* we have one of these for every PFSYNC_S_ */ -static int pfsync_out_state(struct pf_state *, struct mbuf *, int); -static int pfsync_out_iack(struct pf_state *, struct mbuf *, int); -static int pfsync_out_upd_c(struct pf_state *, struct mbuf *, int); -static int pfsync_out_del(struct pf_state *, struct mbuf *, int); +static void pfsync_out_state(struct pf_state *, void *); +static void pfsync_out_iack(struct pf_state *, void *); +static void pfsync_out_upd_c(struct pf_state *, void *); +static void pfsync_out_del(struct pf_state *, void *); static struct pfsync_q pfsync_qs[] = { { pfsync_out_state, sizeof(struct pfsync_state), PFSYNC_ACT_INS }, @@ -1408,32 +1408,27 @@ pfsyncioctl(struct ifnet *ifp, u_long cm return (0); } -static int -pfsync_out_state(struct pf_state *st, struct mbuf *m, int offset) +static void +pfsync_out_state(struct pf_state *st, void *buf) { - struct pfsync_state *sp = (struct pfsync_state *)(m->m_data + offset); + struct pfsync_state *sp = buf; pfsync_state_export(sp, st); - - return (sizeof(*sp)); } -static int -pfsync_out_iack(struct pf_state *st, struct mbuf *m, int offset) +static void +pfsync_out_iack(struct pf_state *st, void *buf) { - struct pfsync_ins_ack *iack = - (struct pfsync_ins_ack *)(m->m_data + offset); + struct pfsync_ins_ack *iack = buf; iack->id = st->id; iack->creatorid = st->creatorid; - - return (sizeof(*iack)); } -static int -pfsync_out_upd_c(struct pf_state *st, struct mbuf *m, int offset) +static void +pfsync_out_upd_c(struct pf_state *st, void *buf) { - struct pfsync_upd_c *up = (struct pfsync_upd_c *)(m->m_data + offset); + struct pfsync_upd_c *up = buf; bzero(up, sizeof(*up)); up->id = st->id; @@ -1441,21 +1436,16 @@ pfsync_out_upd_c(struct pf_state *st, st pf_state_peer_hton(&st->dst, &up->dst); up->creatorid = st->creatorid; up->timeout = st->timeout; - - return (sizeof(*up)); } -static int -pfsync_out_del(struct pf_state *st, struct mbuf *m, int offset) +static void +pfsync_out_del(struct pf_state *st, void *buf) { - struct pfsync_del_c *dp = (struct pfsync_del_c *)(m->m_data + offset); + struct pfsync_del_c *dp = buf; dp->id = st->id; dp->creatorid = st->creatorid; - st->state_flags |= PFSTATE_NOSYNC; - - return (sizeof(*dp)); } static void @@ -1497,7 +1487,7 @@ pfsync_sendout(int schedswi) struct ip *ip; struct pfsync_header *ph; struct pfsync_subheader *subh; - struct pf_state *st, *next; + struct pf_state *st; struct pfsync_upd_req_item *ur; int offset; int q, count = 0; @@ -1547,7 +1537,7 @@ pfsync_sendout(int schedswi) offset += sizeof(*subh); count = 0; - TAILQ_FOREACH_SAFE(st, &sc->sc_qs[q], sync_list, next) { + TAILQ_FOREACH(st, &sc->sc_qs[q], sync_list) { KASSERT(st->sync_state == q, ("%s: st->sync_state == q", __func__)); @@ -1555,7 +1545,8 @@ pfsync_sendout(int schedswi) * XXXGL: some of write methods do unlocked reads * of state data :( */ - offset += pfsync_qs[q].write(st, m, offset); + pfsync_qs[q].write(st, m->m_data + offset); + offset += pfsync_qs[q].len; st->sync_state = PFSYNC_S_NONE; pf_release_state(st); count++; From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 20:11:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C98BE1065670; Sat, 29 Sep 2012 20:11:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 143328FC14; Sat, 29 Sep 2012 20:11:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8TKB0qU086413; Sat, 29 Sep 2012 20:11:00 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8TKB0up086411; Sat, 29 Sep 2012 20:11:00 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201209292011.q8TKB0up086411@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 29 Sep 2012 20:11:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241057 - head/sys/netpfil/pf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 20:11:03 -0000 Author: glebius Date: Sat Sep 29 20:11:00 2012 New Revision: 241057 URL: http://svn.freebsd.org/changeset/base/241057 Log: Clear and re-setup all function pointers that glue pf(4) and pfsync(4) together whenever the pfsync0 is brought down or up respectively. Modified: head/sys/netpfil/pf/if_pfsync.c Modified: head/sys/netpfil/pf/if_pfsync.c ============================================================================== --- head/sys/netpfil/pf/if_pfsync.c Sat Sep 29 20:02:26 2012 (r241056) +++ head/sys/netpfil/pf/if_pfsync.c Sat Sep 29 20:11:00 2012 (r241057) @@ -236,6 +236,8 @@ static void pfsyncintr(void *); static int pfsync_multicast_setup(struct pfsync_softc *, struct ifnet *, void *); static void pfsync_multicast_cleanup(struct pfsync_softc *); +static void pfsync_pointers_init(void); +static void pfsync_pointers_uninit(void); static int pfsync_init(void); static void pfsync_uninit(void); @@ -1267,11 +1269,15 @@ pfsyncioctl(struct ifnet *ifp, u_long cm switch (cmd) { case SIOCSIFFLAGS: PFSYNC_LOCK(sc); - if (ifp->if_flags & IFF_UP) + if (ifp->if_flags & IFF_UP) { ifp->if_drv_flags |= IFF_DRV_RUNNING; - else + PFSYNC_UNLOCK(sc); + pfsync_pointers_init(); + } else { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - PFSYNC_UNLOCK(sc); + PFSYNC_UNLOCK(sc); + pfsync_pointers_uninit(); + } break; case SIOCSIFMTU: if (!sc->sc_sync_if || @@ -2266,6 +2272,34 @@ static struct protosw in_pfsync_protosw }; #endif +static void +pfsync_pointers_init() +{ + + PF_RULES_WLOCK(); + pfsync_state_import_ptr = pfsync_state_import; + pfsync_insert_state_ptr = pfsync_insert_state; + pfsync_update_state_ptr = pfsync_update_state; + pfsync_delete_state_ptr = pfsync_delete_state; + pfsync_clear_states_ptr = pfsync_clear_states; + pfsync_defer_ptr = pfsync_defer; + PF_RULES_WUNLOCK(); +} + +static void +pfsync_pointers_uninit() +{ + + PF_RULES_WLOCK(); + pfsync_state_import_ptr = NULL; + pfsync_insert_state_ptr = NULL; + pfsync_update_state_ptr = NULL; + pfsync_delete_state_ptr = NULL; + pfsync_clear_states_ptr = NULL; + pfsync_defer_ptr = NULL; + PF_RULES_WUNLOCK(); +} + static int pfsync_init() { @@ -2296,14 +2330,7 @@ pfsync_init() goto fail; } #endif - PF_RULES_WLOCK(); - pfsync_state_import_ptr = pfsync_state_import; - pfsync_insert_state_ptr = pfsync_insert_state; - pfsync_update_state_ptr = pfsync_update_state; - pfsync_delete_state_ptr = pfsync_delete_state; - pfsync_clear_states_ptr = pfsync_clear_states; - pfsync_defer_ptr = pfsync_defer; - PF_RULES_WUNLOCK(); + pfsync_pointers_init(); return (0); @@ -2328,14 +2355,7 @@ pfsync_uninit() { VNET_ITERATOR_DECL(vnet_iter); - PF_RULES_WLOCK(); - pfsync_state_import_ptr = NULL; - pfsync_insert_state_ptr = NULL; - pfsync_update_state_ptr = NULL; - pfsync_delete_state_ptr = NULL; - pfsync_clear_states_ptr = NULL; - pfsync_defer_ptr = NULL; - PF_RULES_WUNLOCK(); + pfsync_pointers_uninit(); ipproto_unregister(IPPROTO_PFSYNC); pf_proto_unregister(PF_INET, IPPROTO_PFSYNC, SOCK_RAW); From owner-svn-src-all@FreeBSD.ORG Sat Sep 29 22:28:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BBD95106566C; Sat, 29 Sep 2012 22:28:00 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A75418FC0C; Sat, 29 Sep 2012 22:28:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8TMS0po006540; Sat, 29 Sep 2012 22:28:00 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8TMS0jn006536; Sat, 29 Sep 2012 22:28:00 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201209292228.q8TMS0jn006536@svn.freebsd.org> From: Alan Cox Date: Sat, 29 Sep 2012 22:28:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241058 - head/sys/arm/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 22:28:00 -0000 Author: alc Date: Sat Sep 29 22:28:00 2012 New Revision: 241058 URL: http://svn.freebsd.org/changeset/base/241058 Log: Eliminate an unused declaration. Modified: head/sys/arm/include/pmap.h Modified: head/sys/arm/include/pmap.h ============================================================================== --- head/sys/arm/include/pmap.h Sat Sep 29 20:11:00 2012 (r241057) +++ head/sys/arm/include/pmap.h Sat Sep 29 22:28:00 2012 (r241058) @@ -616,8 +616,6 @@ void pmap_use_minicache(vm_offset_t, vm_ void vector_page_setprot(int); -void pmap_update(pmap_t); - /* * This structure is used by machine-dependent code to describe * static mappings of devices, created at bootstrap time.