From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 00:01:08 2010 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 9FF831065670; Sun, 8 Aug 2010 00:01:08 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DE8B8FC1C; Sun, 8 Aug 2010 00:01:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78018pZ096202; Sun, 8 Aug 2010 00:01:08 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78018Fx096197; Sun, 8 Aug 2010 00:01:08 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201008080001.o78018Fx096197@svn.freebsd.org> From: Marius Strobl Date: Sun, 8 Aug 2010 00:01: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: r211049 - in head/sys/sparc64: include 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: Sun, 08 Aug 2010 00:01:08 -0000 Author: marius Date: Sun Aug 8 00:01:08 2010 New Revision: 211049 URL: http://svn.freebsd.org/changeset/base/211049 Log: For CPUs which ignore TD_CV and support hardware unaliasing don't bother doing page coloring. This results in a small but measurable performance improvement in buildworld times. Modified: head/sys/sparc64/include/cache.h head/sys/sparc64/sparc64/cache.c head/sys/sparc64/sparc64/mem.c head/sys/sparc64/sparc64/pmap.c head/sys/sparc64/sparc64/uio_machdep.c head/sys/sparc64/sparc64/vm_machdep.c Modified: head/sys/sparc64/include/cache.h ============================================================================== --- head/sys/sparc64/include/cache.h Sat Aug 7 23:41:46 2010 (r211048) +++ head/sys/sparc64/include/cache.h Sun Aug 8 00:01:08 2010 (r211049) @@ -49,7 +49,7 @@ #define DCACHE_COLORS (1 << DCACHE_COLOR_BITS) #define DCACHE_COLOR_MASK (DCACHE_COLORS - 1) #define DCACHE_COLOR(va) (((va) >> PAGE_SHIFT) & DCACHE_COLOR_MASK) -#define DCACHE_OTHER_COLOR(color) \ +#define DCACHE_OTHER_COLOR(color) \ ((color) ^ DCACHE_COLOR_BITS) #define DC_TAG_SHIFT 2 @@ -89,6 +89,8 @@ struct cacheinfo { #ifdef _KERNEL +extern u_int dcache_color_ignore; + struct pcpu; typedef void cache_enable_t(u_int cpu_impl); Modified: head/sys/sparc64/sparc64/cache.c ============================================================================== --- head/sys/sparc64/sparc64/cache.c Sat Aug 7 23:41:46 2010 (r211048) +++ head/sys/sparc64/sparc64/cache.c Sun Aug 8 00:01:08 2010 (r211049) @@ -88,6 +88,8 @@ cache_flush_t *cache_flush; dcache_page_inval_t *dcache_page_inval; icache_page_inval_t *icache_page_inval; +u_int dcache_color_ignore; + #define OF_GET(h, n, v) OF_getprop((h), (n), &(v), sizeof(v)) static u_int cache_new_prop(u_int cpu_impl); @@ -114,6 +116,13 @@ cache_init(struct pcpu *pcpu) u_long set; u_int use_new_prop; + /* + * For CPUs which ignore TD_CV and support hardware unaliasing don't + * bother doing page coloring. This is equal across all CPUs. + */ + if (pcpu->pc_cpuid == 0 && pcpu->pc_impl == CPU_IMPL_SPARC64V) + dcache_color_ignore = 1; + use_new_prop = cache_new_prop(pcpu->pc_impl); if (OF_GET(pcpu->pc_node, !use_new_prop ? "icache-size" : "l1-icache-size", pcpu->pc_cache.ic_size) == -1 || @@ -145,9 +154,8 @@ cache_init(struct pcpu *pcpu) * For CPUs which don't support unaliasing in hardware ensure that * the data cache doesn't have too many virtual colors. */ - if (pcpu->pc_impl != CPU_IMPL_SPARC64V && - ((pcpu->pc_cache.dc_size / pcpu->pc_cache.dc_assoc) / - PAGE_SIZE) != DCACHE_COLORS) + if (dcache_color_ignore == 0 && ((pcpu->pc_cache.dc_size / + pcpu->pc_cache.dc_assoc) / PAGE_SIZE) != DCACHE_COLORS) panic("cache_init: too many D$ colors"); set = pcpu->pc_cache.ec_size / pcpu->pc_cache.ec_assoc; if ((set & ~(1UL << (ffs(set) - 1))) != 0) Modified: head/sys/sparc64/sparc64/mem.c ============================================================================== --- head/sys/sparc64/sparc64/mem.c Sat Aug 7 23:41:46 2010 (r211048) +++ head/sys/sparc64/sparc64/mem.c Sun Aug 8 00:01:08 2010 (r211049) @@ -95,8 +95,10 @@ memrw(struct cdev *dev, struct uio *uio, vm_page_t m; int error; int i; + uint32_t colors; cnt = 0; + colors = 1; error = 0; ova = 0; @@ -134,20 +136,20 @@ memrw(struct cdev *dev, struct uio *uio, } if (m != NULL) { + if (ova == 0) { #ifndef SUN4V - if (ova == 0) + if (dcache_color_ignore == 0) + colors = DCACHE_COLORS; +#endif ova = kmem_alloc_wait(kernel_map, - PAGE_SIZE * DCACHE_COLORS); - if (m->md.color != -1) + PAGE_SIZE * colors); + } +#ifndef SUN4V + if (colors != 1 && m->md.color != -1) va = ova + m->md.color * PAGE_SIZE; else - va = ova; -#else - if (ova == 0) - ova = kmem_alloc_wait(kernel_map, - PAGE_SIZE); - va = ova; #endif + va = ova; pmap_qenter(va, &m, 1); error = uiomove((void *)(va + off), cnt, uio); @@ -158,8 +160,7 @@ memrw(struct cdev *dev, struct uio *uio, uio); } break; - } - else if (dev2unit(dev) == CDEV_MINOR_KMEM) { + } else if (dev2unit(dev) == CDEV_MINOR_KMEM) { va = trunc_page(uio->uio_offset); eva = round_page(uio->uio_offset + iov->iov_len); @@ -184,15 +185,12 @@ memrw(struct cdev *dev, struct uio *uio, /* else panic! */ } if (ova != 0) -#ifndef SUN4V - kmem_free_wakeup(kernel_map, ova, PAGE_SIZE * DCACHE_COLORS); -#else - kmem_free_wakeup(kernel_map, ova, PAGE_SIZE); -#endif + kmem_free_wakeup(kernel_map, ova, PAGE_SIZE * colors); return (error); } void dev_mem_md_init(void) { + } Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Sat Aug 7 23:41:46 2010 (r211048) +++ head/sys/sparc64/sparc64/pmap.c Sun Aug 8 00:01:08 2010 (r211049) @@ -154,7 +154,7 @@ struct pmap kernel_pmap_store; /* * Allocate physical memory for use in pmap_bootstrap. */ -static vm_paddr_t pmap_bootstrap_alloc(vm_size_t size); +static vm_paddr_t pmap_bootstrap_alloc(vm_size_t size, uint32_t colors); /* * Map the given physical page at the specified virtual address in the @@ -308,6 +308,9 @@ pmap_bootstrap(u_int cpu_impl) int i; int j; int sz; + uint32_t colors; + + colors = dcache_color_ignore != 0 ? 1 : DCACHE_COLORS; /* * Find out what physical memory is available from the PROM and @@ -379,7 +382,7 @@ pmap_bootstrap(u_int cpu_impl) /* * Allocate the kernel TSB and lock it in the TLB. */ - pa = pmap_bootstrap_alloc(tsb_kernel_size); + pa = pmap_bootstrap_alloc(tsb_kernel_size, colors); if (pa & PAGE_MASK_4M) panic("pmap_bootstrap: tsb unaligned\n"); tsb_kernel_phys = pa; @@ -390,13 +393,13 @@ pmap_bootstrap(u_int cpu_impl) /* * Allocate and map the dynamic per-CPU area for the BSP. */ - pa = pmap_bootstrap_alloc(DPCPU_SIZE); + pa = pmap_bootstrap_alloc(DPCPU_SIZE, colors); dpcpu0 = (void *)TLB_PHYS_TO_DIRECT(pa); /* * Allocate and map the message buffer. */ - pa = pmap_bootstrap_alloc(MSGBUF_SIZE); + pa = pmap_bootstrap_alloc(MSGBUF_SIZE, colors); msgbufp = (struct msgbuf *)TLB_PHYS_TO_DIRECT(pa); /* @@ -458,26 +461,26 @@ pmap_bootstrap(u_int cpu_impl) * Allocate kva space for temporary mappings. */ pmap_idle_map = virtual_avail; - virtual_avail += PAGE_SIZE * DCACHE_COLORS; + virtual_avail += PAGE_SIZE * colors; pmap_temp_map_1 = virtual_avail; - virtual_avail += PAGE_SIZE * DCACHE_COLORS; + virtual_avail += PAGE_SIZE * colors; pmap_temp_map_2 = virtual_avail; - virtual_avail += PAGE_SIZE * DCACHE_COLORS; + virtual_avail += PAGE_SIZE * colors; /* * Allocate a kernel stack with guard page for thread0 and map it * into the kernel TSB. We must ensure that the virtual address is - * coloured properly, since we're allocating from phys_avail so the - * memory won't have an associated vm_page_t. + * colored properly for corresponding CPUs, since we're allocating + * from phys_avail so the memory won't have an associated vm_page_t. */ - pa = pmap_bootstrap_alloc(KSTACK_PAGES * PAGE_SIZE); + pa = pmap_bootstrap_alloc(KSTACK_PAGES * PAGE_SIZE, colors); kstack0_phys = pa; - virtual_avail += roundup(KSTACK_GUARD_PAGES, DCACHE_COLORS) * - PAGE_SIZE; + virtual_avail += roundup(KSTACK_GUARD_PAGES, colors) * PAGE_SIZE; kstack0 = virtual_avail; - virtual_avail += roundup(KSTACK_PAGES, DCACHE_COLORS) * PAGE_SIZE; - KASSERT(DCACHE_COLOR(kstack0) == DCACHE_COLOR(kstack0_phys), - ("pmap_bootstrap: kstack0 miscoloured")); + virtual_avail += roundup(KSTACK_PAGES, colors) * PAGE_SIZE; + if (dcache_color_ignore == 0) + KASSERT(DCACHE_COLOR(kstack0) == DCACHE_COLOR(kstack0_phys), + ("pmap_bootstrap: kstack0 miscolored")); for (i = 0; i < KSTACK_PAGES; i++) { pa = kstack0_phys + i * PAGE_SIZE; va = kstack0 + i * PAGE_SIZE; @@ -609,12 +612,12 @@ pmap_map_tsb(void) * calculated. */ static vm_paddr_t -pmap_bootstrap_alloc(vm_size_t size) +pmap_bootstrap_alloc(vm_size_t size, uint32_t colors) { vm_paddr_t pa; int i; - size = roundup(size, PAGE_SIZE * DCACHE_COLORS); + size = roundup(size, PAGE_SIZE * colors); for (i = 0; phys_avail[i + 1] != 0; i += 2) { if (phys_avail[i + 1] - phys_avail[i] < size) continue; @@ -755,6 +758,9 @@ pmap_cache_enter(vm_page_t m, vm_offset_ ("pmap_cache_enter: fake page")); PMAP_STATS_INC(pmap_ncache_enter); + if (dcache_color_ignore != 0) + return (1); + /* * Find the color for this virtual address and note the added mapping. */ @@ -832,6 +838,9 @@ pmap_cache_remove(vm_page_t m, vm_offset m->md.colors[DCACHE_COLOR(va)])); PMAP_STATS_INC(pmap_ncache_remove); + if (dcache_color_ignore != 0) + return; + /* * Find the color for this virtual address and note the removal of * the mapping. @@ -900,7 +909,7 @@ pmap_kenter(vm_offset_t va, vm_page_t m) va, VM_PAGE_TO_PHYS(m), tp, tp->tte_data); if (DCACHE_COLOR(VM_PAGE_TO_PHYS(m)) != DCACHE_COLOR(va)) { CTR5(KTR_SPARE2, - "pmap_kenter: off colour va=%#lx pa=%#lx o=%p ot=%d pi=%#lx", + "pmap_kenter: off color va=%#lx pa=%#lx o=%p ot=%d pi=%#lx", va, VM_PAGE_TO_PHYS(m), m->object, m->object ? m->object->type : -1, m->pindex); @@ -1614,13 +1623,13 @@ pmap_zero_page(vm_page_t m) ("pmap_zero_page: fake page")); PMAP_STATS_INC(pmap_nzero_page); pa = VM_PAGE_TO_PHYS(m); - if (m->md.color == -1) { - PMAP_STATS_INC(pmap_nzero_page_nc); - aszero(ASI_PHYS_USE_EC, pa, PAGE_SIZE); - } else if (m->md.color == DCACHE_COLOR(pa)) { + if (dcache_color_ignore != 0 || m->md.color == DCACHE_COLOR(pa)) { PMAP_STATS_INC(pmap_nzero_page_c); va = TLB_PHYS_TO_DIRECT(pa); cpu_block_zero((void *)va, PAGE_SIZE); + } else if (m->md.color == -1) { + PMAP_STATS_INC(pmap_nzero_page_nc); + aszero(ASI_PHYS_USE_EC, pa, PAGE_SIZE); } else { PMAP_STATS_INC(pmap_nzero_page_oc); PMAP_LOCK(kernel_pmap); @@ -1646,13 +1655,13 @@ pmap_zero_page_area(vm_page_t m, int off KASSERT(off + size <= PAGE_SIZE, ("pmap_zero_page_area: bad off/size")); PMAP_STATS_INC(pmap_nzero_page_area); pa = VM_PAGE_TO_PHYS(m); - if (m->md.color == -1) { - PMAP_STATS_INC(pmap_nzero_page_area_nc); - aszero(ASI_PHYS_USE_EC, pa + off, size); - } else if (m->md.color == DCACHE_COLOR(pa)) { + if (dcache_color_ignore != 0 || m->md.color == DCACHE_COLOR(pa)) { PMAP_STATS_INC(pmap_nzero_page_area_c); va = TLB_PHYS_TO_DIRECT(pa); bzero((void *)(va + off), size); + } else if (m->md.color == -1) { + PMAP_STATS_INC(pmap_nzero_page_area_nc); + aszero(ASI_PHYS_USE_EC, pa + off, size); } else { PMAP_STATS_INC(pmap_nzero_page_area_oc); PMAP_LOCK(kernel_pmap); @@ -1677,13 +1686,13 @@ pmap_zero_page_idle(vm_page_t m) ("pmap_zero_page_idle: fake page")); PMAP_STATS_INC(pmap_nzero_page_idle); pa = VM_PAGE_TO_PHYS(m); - if (m->md.color == -1) { - PMAP_STATS_INC(pmap_nzero_page_idle_nc); - aszero(ASI_PHYS_USE_EC, pa, PAGE_SIZE); - } else if (m->md.color == DCACHE_COLOR(pa)) { + if (dcache_color_ignore != 0 || m->md.color == DCACHE_COLOR(pa)) { PMAP_STATS_INC(pmap_nzero_page_idle_c); va = TLB_PHYS_TO_DIRECT(pa); cpu_block_zero((void *)va, PAGE_SIZE); + } else if (m->md.color == -1) { + PMAP_STATS_INC(pmap_nzero_page_idle_nc); + aszero(ASI_PHYS_USE_EC, pa, PAGE_SIZE); } else { PMAP_STATS_INC(pmap_nzero_page_idle_oc); va = pmap_idle_map + (m->md.color * PAGE_SIZE); @@ -1711,15 +1720,16 @@ pmap_copy_page(vm_page_t msrc, vm_page_t PMAP_STATS_INC(pmap_ncopy_page); pdst = VM_PAGE_TO_PHYS(mdst); psrc = VM_PAGE_TO_PHYS(msrc); - if (msrc->md.color == -1 && mdst->md.color == -1) { - PMAP_STATS_INC(pmap_ncopy_page_nc); - ascopy(ASI_PHYS_USE_EC, psrc, pdst, PAGE_SIZE); - } else if (msrc->md.color == DCACHE_COLOR(psrc) && - mdst->md.color == DCACHE_COLOR(pdst)) { + if (dcache_color_ignore != 0 || + (msrc->md.color == DCACHE_COLOR(psrc) && + mdst->md.color == DCACHE_COLOR(pdst))) { PMAP_STATS_INC(pmap_ncopy_page_c); vdst = TLB_PHYS_TO_DIRECT(pdst); vsrc = TLB_PHYS_TO_DIRECT(psrc); cpu_block_copy((void *)vsrc, (void *)vdst, PAGE_SIZE); + } else if (msrc->md.color == -1 && mdst->md.color == -1) { + PMAP_STATS_INC(pmap_ncopy_page_nc); + ascopy(ASI_PHYS_USE_EC, psrc, pdst, PAGE_SIZE); } else if (msrc->md.color == -1) { if (mdst->md.color == DCACHE_COLOR(pdst)) { PMAP_STATS_INC(pmap_ncopy_page_dc); Modified: head/sys/sparc64/sparc64/uio_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/uio_machdep.c Sat Aug 7 23:41:46 2010 (r211048) +++ head/sys/sparc64/sparc64/uio_machdep.c Sun Aug 8 00:01:08 2010 (r211049) @@ -51,12 +51,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include /* * Implement uiomove(9) from physical memory using a combination * of the direct mapping and sf_bufs to reduce the creation and - * destruction of ephemeral mappings. + * destruction of ephemeral mappings. */ int uiomove_fromphys(vm_page_t ma[], vm_offset_t offset, int n, struct uio *uio) @@ -92,7 +93,8 @@ uiomove_fromphys(vm_page_t ma[], vm_offs cnt = ulmin(cnt, PAGE_SIZE - page_offset); m = ma[offset >> PAGE_SHIFT]; pa = VM_PAGE_TO_PHYS(m); - if (m->md.color != DCACHE_COLOR(pa)) { + if (dcache_color_ignore == 0 && + m->md.color != DCACHE_COLOR(pa)) { sf = sf_buf_alloc(m, 0); cp = (char *)sf_buf_kva(sf) + page_offset; } else { Modified: head/sys/sparc64/sparc64/vm_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/vm_machdep.c Sat Aug 7 23:41:46 2010 (r211048) +++ head/sys/sparc64/sparc64/vm_machdep.c Sun Aug 8 00:01:08 2010 (r211049) @@ -227,7 +227,7 @@ cpu_set_upcall(struct thread *td, struct void cpu_set_upcall_kse(struct thread *td, void (*entry)(void *), void *arg, - stack_t *stack) + stack_t *stack) { struct trapframe *tf; uint64_t sp; @@ -251,7 +251,7 @@ cpu_set_user_tls(struct thread *td, void if (td == curthread) flushw(); - td->td_frame->tf_global[7] = (uint64_t) tls_base; + td->td_frame->tf_global[7] = (uint64_t)tls_base; return (0); } @@ -531,7 +531,7 @@ uma_small_alloc(uma_zone_t zone, int byt } pa = VM_PAGE_TO_PHYS(m); - if (m->md.color != DCACHE_COLOR(pa)) { + if (dcache_color_ignore == 0 && m->md.color != DCACHE_COLOR(pa)) { KASSERT(m->md.colors[0] == 0 && m->md.colors[1] == 0, ("uma_small_alloc: free page still has mappings!")); PMAP_STATS_INC(uma_nsmall_alloc_oc); From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 00:09:23 2010 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 245A21065673; Sun, 8 Aug 2010 00:09:23 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 122358FC19; Sun, 8 Aug 2010 00:09:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7809M4I098031; Sun, 8 Aug 2010 00:09:22 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7809McW098028; Sun, 8 Aug 2010 00:09:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201008080009.o7809McW098028@svn.freebsd.org> From: Marius Strobl Date: Sun, 8 Aug 2010 00:09: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: r211050 - in head/sys/sparc64: include 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: Sun, 08 Aug 2010 00:09:23 -0000 Author: marius Date: Sun Aug 8 00:09:22 2010 New Revision: 211050 URL: http://svn.freebsd.org/changeset/base/211050 Log: - Introduce a cpu_ipi_single() function pointer in order to send IPIs to single CPUs more efficiently with Cheetah(-class) and Jalapeno CPUs. Besides being used to implement the ipi_cpu() introduced in r210939, cpu_ipi_single() will also be used internally by the sparc64 MD code. - Factor out the Jalapeno support from the Cheetah IPI send functions in order to be able to more easily and efficiently implement support for more than 32 target CPUs as well as a workaround for Cheetah+ erratum 25 for the latter. Modified: head/sys/sparc64/include/smp.h head/sys/sparc64/sparc64/mp_machdep.c Modified: head/sys/sparc64/include/smp.h ============================================================================== --- head/sys/sparc64/include/smp.h Sun Aug 8 00:01:08 2010 (r211049) +++ head/sys/sparc64/include/smp.h Sun Aug 8 00:09:22 2010 (r211050) @@ -98,6 +98,8 @@ void cpu_mp_shutdown(void); typedef void cpu_ipi_selected_t(u_int, u_long, u_long, u_long); extern cpu_ipi_selected_t *cpu_ipi_selected; +typedef void cpu_ipi_single_t(u_int, u_long, u_long, u_long); +extern cpu_ipi_single_t *cpu_ipi_single; void mp_init(u_int cpu_impl); @@ -139,11 +141,7 @@ static __inline void ipi_cpu(int cpu, u_int ipi) { - /* - * XXX: Not ideal, but would require more work to add a cpu_ipi_cpu - * function pointer. - */ - cpu_ipi_selected(1 << cpu, 0, (u_long)tl_ipi_level, ipi); + cpu_ipi_single(cpu, 0, (u_long)tl_ipi_level, ipi); } #if defined(_MACHINE_PMAP_H_) && defined(_SYS_MUTEX_H_) @@ -243,7 +241,8 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ ita->ita_pmap = pm; ita->ita_start = start; ita->ita_end = end; - cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_range_demap, (u_long)ita); + cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_range_demap, + (u_long)ita); return (&ita->ita_mask); } Modified: head/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/mp_machdep.c Sun Aug 8 00:01:08 2010 (r211049) +++ head/sys/sparc64/sparc64/mp_machdep.c Sun Aug 8 00:09:22 2010 (r211050) @@ -29,7 +29,7 @@ */ /*- * Copyright (c) 2002 Jake Burkholder. - * Copyright (c) 2007 Marius Strobl + * Copyright (c) 2007 - 2010 Marius Strobl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -115,6 +115,7 @@ struct pcb stoppcbs[MAXCPU]; struct mtx ipi_mtx; cpu_ipi_selected_t *cpu_ipi_selected; +cpu_ipi_single_t *cpu_ipi_single; static vm_offset_t mp_tramp; static u_int cpuid_to_mid[MAXCPU]; @@ -126,11 +127,14 @@ static void ap_start(phandle_t node, u_i static void cpu_mp_unleash(void *v); static void foreach_ap(phandle_t node, void (*func)(phandle_t node, u_int mid, u_int cpu_impl)); -static void spitfire_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2); static void sun4u_startcpu(phandle_t cpu, void *func, u_long arg); static cpu_ipi_selected_t cheetah_ipi_selected; +static cpu_ipi_single_t cheetah_ipi_single; +static cpu_ipi_selected_t jalapeno_ipi_selected; +static cpu_ipi_single_t jalapeno_ipi_single; static cpu_ipi_selected_t spitfire_ipi_selected; +static cpu_ipi_single_t spitfire_ipi_single; SYSINIT(cpu_mp_unleash, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL); @@ -164,13 +168,18 @@ mp_init(u_int cpu_impl) * cpu_mp_start() wasn't so initialize these here. */ if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi || - cpu_impl == CPU_IMPL_ULTRASPARCIIIip) + cpu_impl == CPU_IMPL_ULTRASPARCIIIip) { isjbus = 1; - if (cpu_impl == CPU_IMPL_SPARC64V || - cpu_impl >= CPU_IMPL_ULTRASPARCIII) + cpu_ipi_selected = jalapeno_ipi_selected; + cpu_ipi_single = jalapeno_ipi_single; + } else if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) { cpu_ipi_selected = cheetah_ipi_selected; - else + cpu_ipi_single = cheetah_ipi_single; + } else { cpu_ipi_selected = spitfire_ipi_selected; + cpu_ipi_single = spitfire_ipi_single; + } } static void @@ -181,7 +190,7 @@ foreach_ap(phandle_t node, void (*func)( phandle_t child; u_int cpuid; uint32_t cpu_impl; - + /* There's no need to traverse the whole OFW tree twice. */ if (mp_maxid > 0 && mp_ncpus >= mp_maxid + 1) return; @@ -201,7 +210,7 @@ foreach_ap(phandle_t node, void (*func)( panic("%s: couldn't determine CPU " "implementation", __func__); if (OF_getprop(node, cpu_cpuid_prop(cpu_impl), &cpuid, - sizeof(cpuid)) <= 0) + sizeof(cpuid)) <= 0) panic("%s: couldn't determine CPU module ID", __func__); if (cpuid == PCPU_GET(mid)) @@ -530,24 +539,25 @@ spitfire_ipi_selected(u_int cpus, u_long { u_int cpu; - KASSERT((cpus & (1 << curcpu)) == 0, - ("%s: CPU can't IPI itself", __func__)); while (cpus) { cpu = ffs(cpus) - 1; cpus &= ~(1 << cpu); - spitfire_ipi_send(cpuid_to_mid[cpu], d0, d1, d2); + spitfire_ipi_single(cpu, d0, d1, d2); } } static void -spitfire_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2) +spitfire_ipi_single(u_int cpu, u_long d0, u_long d1, u_long d2) { register_t s; u_long ids; + u_int mid; int i; + KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; for (i = 0; i < IPI_RETRIES; i++) { s = intr_disable(); stxa(AA_SDB_INTR_D0, ASI_SDB_INTR_W, d0); @@ -588,6 +598,49 @@ spitfire_ipi_send(u_int mid, u_long d0, } static void +cheetah_ipi_single(u_int cpu, u_long d0, u_long d1, u_long d2) +{ + register_t s; + u_long ids; + u_int mid; + int i; + + KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); + KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & + IDR_CHEETAH_ALL_BUSY) == 0, + ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; + for (i = 0; i < IPI_RETRIES; i++) { + s = intr_disable(); + stxa(AA_SDB_INTR_D0, ASI_SDB_INTR_W, d0); + stxa(AA_SDB_INTR_D1, ASI_SDB_INTR_W, d1); + stxa(AA_SDB_INTR_D2, ASI_SDB_INTR_W, d2); + membar(Sync); + stxa(AA_INTR_SEND | (mid << IDC_ITID_SHIFT), + ASI_SDB_INTR_W, 0); + membar(Sync); + while (((ids = ldxa(0, ASI_INTR_DISPATCH_STATUS)) & + IDR_BUSY) != 0) + ; + intr_restore(s); + if ((ids & (IDR_BUSY | IDR_NACK)) == 0) + return; + /* + * Leave interrupts enabled for a bit before retrying + * in order to avoid deadlocks if the other CPU is also + * trying to send an IPI. + */ + DELAY(2); + } + if (kdb_active != 0 || panicstr != NULL) + printf("%s: couldn't send IPI to module 0x%u\n", + __func__, mid); + else + panic("%s: couldn't send IPI to module 0x%u", + __func__, mid); +} + +static void cheetah_ipi_selected(u_int cpus, u_long d0, u_long d1, u_long d2) { register_t s; @@ -613,9 +666,8 @@ cheetah_ipi_selected(u_int cpus, u_long bnp = 0; for (cpu = 0; cpu < mp_ncpus; cpu++) { if ((cpus & (1 << cpu)) != 0) { - stxa(AA_INTR_SEND | - (cpuid_to_mid[cpu] << IDC_ITID_SHIFT) | - (isjbus ? 0 : bnp << IDC_BN_SHIFT), + stxa(AA_INTR_SEND | (cpuid_to_mid[cpu] << + IDC_ITID_SHIFT) | bnp << IDC_BN_SHIFT, ASI_SDB_INTR_W, 0); membar(Sync); bnp++; @@ -625,14 +677,13 @@ cheetah_ipi_selected(u_int cpus, u_long IDR_CHEETAH_ALL_BUSY) != 0) ; intr_restore(s); - if ((ids & (IDR_CHEETAH_ALL_BUSY | IDR_CHEETAH_ALL_NACK)) == 0) + if ((ids & + (IDR_CHEETAH_ALL_BUSY | IDR_CHEETAH_ALL_NACK)) == 0) return; bnp = 0; for (cpu = 0; cpu < mp_ncpus; cpu++) { if ((cpus & (1 << cpu)) != 0) { - if ((ids & (IDR_NACK << (isjbus ? - (2 * cpuid_to_mid[cpu]) : - (2 * bnp)))) == 0) + if ((ids & (IDR_NACK << (2 * bnp))) == 0) cpus &= ~(1 << cpu); bnp++; } @@ -658,3 +709,104 @@ cheetah_ipi_selected(u_int cpus, u_long panic("%s: couldn't send IPI (cpus=0x%u ids=0x%lu)", __func__, cpus, ids); } + +static void +jalapeno_ipi_single(u_int cpu, u_long d0, u_long d1, u_long d2) +{ + register_t s; + u_long ids; + u_int busy, busynack, mid; + int i; + + KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); + KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & + IDR_CHEETAH_ALL_BUSY) == 0, + ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; + busy = IDR_BUSY << (2 * mid); + busynack = (IDR_BUSY | IDR_NACK) << (2 * mid); + for (i = 0; i < IPI_RETRIES; i++) { + s = intr_disable(); + stxa(AA_SDB_INTR_D0, ASI_SDB_INTR_W, d0); + stxa(AA_SDB_INTR_D1, ASI_SDB_INTR_W, d1); + stxa(AA_SDB_INTR_D2, ASI_SDB_INTR_W, d2); + membar(Sync); + stxa(AA_INTR_SEND | (mid << IDC_ITID_SHIFT), + ASI_SDB_INTR_W, 0); + membar(Sync); + while (((ids = ldxa(0, ASI_INTR_DISPATCH_STATUS)) & + busy) != 0) + ; + intr_restore(s); + if ((ids & busynack) == 0) + return; + /* + * Leave interrupts enabled for a bit before retrying + * in order to avoid deadlocks if the other CPU is also + * trying to send an IPI. + */ + DELAY(2); + } + if (kdb_active != 0 || panicstr != NULL) + printf("%s: couldn't send IPI to module 0x%u\n", + __func__, mid); + else + panic("%s: couldn't send IPI to module 0x%u", + __func__, mid); +} + +static void +jalapeno_ipi_selected(u_int cpus, u_long d0, u_long d1, u_long d2) +{ + register_t s; + u_long ids; + u_int cpu; + int i; + + KASSERT((cpus & (1 << curcpu)) == 0, + ("%s: CPU can't IPI itself", __func__)); + KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & + IDR_CHEETAH_ALL_BUSY) == 0, + ("%s: outstanding dispatch", __func__)); + if (cpus == 0) + return; + ids = 0; + for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) { + s = intr_disable(); + stxa(AA_SDB_INTR_D0, ASI_SDB_INTR_W, d0); + stxa(AA_SDB_INTR_D1, ASI_SDB_INTR_W, d1); + stxa(AA_SDB_INTR_D2, ASI_SDB_INTR_W, d2); + membar(Sync); + for (cpu = 0; cpu < mp_ncpus; cpu++) { + if ((cpus & (1 << cpu)) != 0) { + stxa(AA_INTR_SEND | (cpuid_to_mid[cpu] << + IDC_ITID_SHIFT), ASI_SDB_INTR_W, 0); + membar(Sync); + } + } + while (((ids = ldxa(0, ASI_INTR_DISPATCH_STATUS)) & + IDR_CHEETAH_ALL_BUSY) != 0) + ; + intr_restore(s); + if ((ids & + (IDR_CHEETAH_ALL_BUSY | IDR_CHEETAH_ALL_NACK)) == 0) + return; + for (cpu = 0; cpu < mp_ncpus; cpu++) + if ((cpus & (1 << cpu)) != 0) + if ((ids & (IDR_NACK << + (2 * cpuid_to_mid[cpu]))) == 0) + cpus &= ~(1 << cpu); + /* + * Leave interrupts enabled for a bit before retrying + * in order to avoid deadlocks if the other CPUs are + * also trying to send IPIs. + */ + DELAY(2 * mp_ncpus); + } + if (kdb_active != 0 || panicstr != NULL) + printf("%s: couldn't send IPI (cpus=0x%u ids=0x%lu)\n", + __func__, cpus, ids); + else + panic("%s: couldn't send IPI (cpus=0x%u ids=0x%lu)", + __func__, cpus, ids); +} From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 00:12:31 2010 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 DA614106566B; Sun, 8 Aug 2010 00:12:31 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF2D88FC0A; Sun, 8 Aug 2010 00:12:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o780CVS1098840; Sun, 8 Aug 2010 00:12:31 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o780CVqv098838; Sun, 8 Aug 2010 00:12:31 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008080012.o780CVqv098838@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 8 Aug 2010 00:12: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: r211051 - head/sys/dev/alc 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, 08 Aug 2010 00:12:32 -0000 Author: yongari Date: Sun Aug 8 00:12:31 2010 New Revision: 211051 URL: http://svn.freebsd.org/changeset/base/211051 Log: Always disable ASPM L0s and enable L1 before entering into WOL suspend state. Also disable master clock after PHY power down, this is supposed to save more power. The master clock should be enabled if WOL is active. Modified: head/sys/dev/alc/if_alc.c Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Sun Aug 8 00:09:22 2010 (r211050) +++ head/sys/dev/alc/if_alc.c Sun Aug 8 00:12:31 2010 (r211051) @@ -1673,19 +1673,14 @@ static void alc_setwol(struct alc_softc *sc) { struct ifnet *ifp; - uint32_t cap, reg, pmcs; + uint32_t reg, pmcs; uint16_t pmstat; - int base, pmc; + int pmc; ALC_LOCK_ASSERT(sc); - if (pci_find_extcap(sc->alc_dev, PCIY_EXPRESS, &base) == 0) { - cap = CSR_READ_2(sc, base + PCIR_EXPRESS_LINK_CAP); - if ((cap & PCIM_LINK_CAP_ASPM) != 0) { - cap = CSR_READ_2(sc, base + PCIR_EXPRESS_LINK_CTL); - alc_disable_l0s_l1(sc); - } - } + alc_disable_l0s_l1(sc); + ifp = sc->alc_ifp; if (pci_find_extcap(sc->alc_dev, PCIY_PMG, &pmc) != 0) { /* Disable WOL. */ CSR_WRITE_4(sc, ALC_WOL_CFG, 0); @@ -1694,6 +1689,8 @@ alc_setwol(struct alc_softc *sc) CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, reg); /* Force PHY power down. */ alc_phy_down(sc); + CSR_WRITE_4(sc, ALC_MASTER_CFG, + CSR_READ_4(sc, ALC_MASTER_CFG) | MASTER_CLK_SEL_DIS); return; } @@ -1701,9 +1698,8 @@ alc_setwol(struct alc_softc *sc) if ((ifp->if_capenable & IFCAP_WOL) != 0) { if ((sc->alc_flags & ALC_FLAG_FASTETHER) == 0) alc_setlinkspeed(sc); - reg = CSR_READ_4(sc, ALC_MASTER_CFG); - reg &= ~MASTER_CLK_SEL_DIS; - CSR_WRITE_4(sc, ALC_MASTER_CFG, reg); + CSR_WRITE_4(sc, ALC_MASTER_CFG, + CSR_READ_4(sc, ALC_MASTER_CFG) & ~MASTER_CLK_SEL_DIS); } pmcs = 0; @@ -1725,6 +1721,8 @@ alc_setwol(struct alc_softc *sc) if ((ifp->if_capenable & IFCAP_WOL) == 0) { /* WOL disabled, PHY power down. */ alc_phy_down(sc); + CSR_WRITE_4(sc, ALC_MASTER_CFG, + CSR_READ_4(sc, ALC_MASTER_CFG) | MASTER_CLK_SEL_DIS); } /* Request PME. */ pmstat = pci_read_config(sc->alc_dev, pmc + PCIR_POWER_STATUS, 2); From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 00:23:36 2010 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 8FC621065676; Sun, 8 Aug 2010 00:23:36 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F06D8FC0C; Sun, 8 Aug 2010 00:23:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o780Naxj001442; Sun, 8 Aug 2010 00:23:36 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o780NaAE001440; Sun, 8 Aug 2010 00:23:36 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008080023.o780NaAE001440@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 8 Aug 2010 00:23: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: r211052 - head/sys/dev/alc 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, 08 Aug 2010 00:23:36 -0000 Author: yongari Date: Sun Aug 8 00:23:36 2010 New Revision: 211052 URL: http://svn.freebsd.org/changeset/base/211052 Log: Remove unnecessary assignment. Modified: head/sys/dev/alc/if_alc.c Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Sun Aug 8 00:12:31 2010 (r211051) +++ head/sys/dev/alc/if_alc.c Sun Aug 8 00:23:36 2010 (r211052) @@ -1694,7 +1694,6 @@ alc_setwol(struct alc_softc *sc) return; } - ifp = sc->alc_ifp; if ((ifp->if_capenable & IFCAP_WOL) != 0) { if ((sc->alc_flags & ALC_FLAG_FASTETHER) == 0) alc_setlinkspeed(sc); From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 00:43:42 2010 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 3EAD41065676; Sun, 8 Aug 2010 00:43:42 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D77E8FC13; Sun, 8 Aug 2010 00:43:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o780hgU1005854; Sun, 8 Aug 2010 00:43:42 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o780hgWQ005851; Sun, 8 Aug 2010 00:43:42 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008080043.o780hgWQ005851@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 8 Aug 2010 00:43: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: r211053 - head/sys/dev/alc 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, 08 Aug 2010 00:43:42 -0000 Author: yongari Date: Sun Aug 8 00:43:41 2010 New Revision: 211053 URL: http://svn.freebsd.org/changeset/base/211053 Log: Cache PCIY_PMG and PCIY_EXPRESS capability pointer to softc and use it instead of calling pci_find_extcap(). Modified: head/sys/dev/alc/if_alc.c head/sys/dev/alc/if_alcvar.h Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Sun Aug 8 00:23:36 2010 (r211052) +++ head/sys/dev/alc/if_alc.c Sun Aug 8 00:43:41 2010 (r211053) @@ -569,7 +569,7 @@ alc_attach(device_t dev) struct ifnet *ifp; char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/l1" }; uint16_t burst; - int base, error, i, msic, msixc, pmc, state; + int base, error, i, msic, msixc, state; uint32_t cap, ctl, val; error = 0; @@ -600,6 +600,7 @@ alc_attach(device_t dev) sc->alc_rcb = DMA_CFG_RCB_64; if (pci_find_extcap(dev, PCIY_EXPRESS, &base) == 0) { sc->alc_flags |= ALC_FLAG_PCIE; + sc->alc_expcap = base; burst = CSR_READ_2(sc, base + PCIR_EXPRESS_DEVICE_CTL); sc->alc_dma_rd_burst = (burst & PCIM_EXP_CTL_MAX_READ_REQUEST) >> 12; @@ -743,8 +744,11 @@ alc_attach(device_t dev) IFQ_SET_READY(&ifp->if_snd); ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_TSO4; ifp->if_hwassist = ALC_CSUM_FEATURES | CSUM_TSO; - if (pci_find_extcap(dev, PCIY_PMG, &pmc) == 0) + if (pci_find_extcap(dev, PCIY_PMG, &base) == 0) { ifp->if_capabilities |= IFCAP_WOL_MAGIC | IFCAP_WOL_MCAST; + sc->alc_flags |= ALC_FLAG_PM; + sc->alc_pmcap = base; + } ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ @@ -1675,13 +1679,12 @@ alc_setwol(struct alc_softc *sc) struct ifnet *ifp; uint32_t reg, pmcs; uint16_t pmstat; - int pmc; ALC_LOCK_ASSERT(sc); alc_disable_l0s_l1(sc); ifp = sc->alc_ifp; - if (pci_find_extcap(sc->alc_dev, PCIY_PMG, &pmc) != 0) { + if ((sc->alc_flags & ALC_FLAG_PM) == 0) { /* Disable WOL. */ CSR_WRITE_4(sc, ALC_WOL_CFG, 0); reg = CSR_READ_4(sc, ALC_PCIE_PHYMISC); @@ -1724,11 +1727,13 @@ alc_setwol(struct alc_softc *sc) CSR_READ_4(sc, ALC_MASTER_CFG) | MASTER_CLK_SEL_DIS); } /* Request PME. */ - pmstat = pci_read_config(sc->alc_dev, pmc + PCIR_POWER_STATUS, 2); + pmstat = pci_read_config(sc->alc_dev, + sc->alc_pmcap + PCIR_POWER_STATUS, 2); pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); if ((ifp->if_capenable & IFCAP_WOL) != 0) pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; - pci_write_config(sc->alc_dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + pci_write_config(sc->alc_dev, + sc->alc_pmcap + PCIR_POWER_STATUS, pmstat, 2); } static int @@ -1751,20 +1756,19 @@ alc_resume(device_t dev) { struct alc_softc *sc; struct ifnet *ifp; - int pmc; uint16_t pmstat; sc = device_get_softc(dev); ALC_LOCK(sc); - if (pci_find_extcap(sc->alc_dev, PCIY_PMG, &pmc) == 0) { + if ((sc->alc_flags & ALC_FLAG_PM) != 0) { /* Disable PME and clear PME status. */ pmstat = pci_read_config(sc->alc_dev, - pmc + PCIR_POWER_STATUS, 2); + sc->alc_pmcap + PCIR_POWER_STATUS, 2); if ((pmstat & PCIM_PSTAT_PMEENABLE) != 0) { pmstat &= ~PCIM_PSTAT_PMEENABLE; pci_write_config(sc->alc_dev, - pmc + PCIR_POWER_STATUS, pmstat, 2); + sc->alc_pmcap + PCIR_POWER_STATUS, pmstat, 2); } } /* Reset PHY. */ Modified: head/sys/dev/alc/if_alcvar.h ============================================================================== --- head/sys/dev/alc/if_alcvar.h Sun Aug 8 00:23:36 2010 (r211052) +++ head/sys/dev/alc/if_alcvar.h Sun Aug 8 00:43:41 2010 (r211053) @@ -211,11 +211,14 @@ struct alc_softc { uint32_t alc_dma_rd_burst; uint32_t alc_dma_wr_burst; uint32_t alc_rcb; + int alc_expcap; + int alc_pmcap; int alc_flags; #define ALC_FLAG_PCIE 0x0001 #define ALC_FLAG_PCIX 0x0002 #define ALC_FLAG_MSI 0x0004 #define ALC_FLAG_MSIX 0x0008 +#define ALC_FLAG_PM 0x0010 #define ALC_FLAG_FASTETHER 0x0020 #define ALC_FLAG_JUMBO 0x0040 #define ALC_FLAG_ASPM_MON 0x0080 From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 01:25:33 2010 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 BB8991065670; Sun, 8 Aug 2010 01:25:33 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FAA38FC08; Sun, 8 Aug 2010 01:25:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o781PX58015119; Sun, 8 Aug 2010 01:25:33 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o781PXkL015115; Sun, 8 Aug 2010 01:25:33 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201008080125.o781PXkL015115@svn.freebsd.org> From: Tim Kientzle Date: Sun, 8 Aug 2010 01:25:33 +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: r211054 - head/usr.bin/cpio 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, 08 Aug 2010 01:25:33 -0000 Author: kientzle Date: Sun Aug 8 01:25:33 2010 New Revision: 211054 URL: http://svn.freebsd.org/changeset/base/211054 Log: Fix -R when used with -p. Previously, the uname and gname weren't overwritten, so the disk restore would use those to lookup the original uid/gid again. Clearing the uname and gname prevents this. Reported by: swell.k MFC after: 7 days Modified: head/usr.bin/cpio/cmdline.c head/usr.bin/cpio/cpio.c head/usr.bin/cpio/cpio.h Modified: head/usr.bin/cpio/cmdline.c ============================================================================== --- head/usr.bin/cpio/cmdline.c Sun Aug 8 00:43:41 2010 (r211053) +++ head/usr.bin/cpio/cmdline.c Sun Aug 8 01:25:33 2010 (r211054) @@ -285,6 +285,8 @@ cpio_getopt(struct cpio *cpio) * A period can be used instead of the colon. * * Sets uid/gid return as appropriate, -1 indicates uid/gid not specified. + * TODO: If the spec uses uname/gname, then return those to the caller + * as well. If the spec provides uid/gid, just return names as NULL. * * Returns NULL if no error, otherwise returns error string for display. * Modified: head/usr.bin/cpio/cpio.c ============================================================================== --- head/usr.bin/cpio/cpio.c Sun Aug 8 00:43:41 2010 (r211053) +++ head/usr.bin/cpio/cpio.c Sun Aug 8 01:25:33 2010 (r211054) @@ -273,15 +273,21 @@ main(int argc, char *argv[]) cpio->quiet = 1; break; case 'R': /* GNU cpio, also --owner */ + /* TODO: owner_parse should return uname/gname + * also; use that to set [ug]name_override. */ errmsg = owner_parse(cpio->optarg, &uid, &gid); if (errmsg) { warnc(-1, "%s", errmsg); usage(); } - if (uid != -1) + if (uid != -1) { cpio->uid_override = uid; - if (gid != -1) + cpio->uname_override = NULL; + } + if (gid != -1) { cpio->gid_override = gid; + cpio->gname_override = NULL; + } break; case 'r': /* POSIX 1997 */ cpio->option_rename = 1; @@ -575,10 +581,14 @@ file_to_archive(struct cpio *cpio, const return (r); } - if (cpio->uid_override >= 0) + if (cpio->uid_override >= 0) { archive_entry_set_uid(entry, cpio->uid_override); - if (cpio->gid_override >= 0) + archive_entry_set_uname(entry, cpio->uname_override); + } + if (cpio->gid_override >= 0) { archive_entry_set_gid(entry, cpio->gid_override); + archive_entry_set_gname(entry, cpio->gname_override); + } /* * Generate a destination path for this entry. Modified: head/usr.bin/cpio/cpio.h ============================================================================== --- head/usr.bin/cpio/cpio.h Sun Aug 8 00:43:41 2010 (r211053) +++ head/usr.bin/cpio/cpio.h Sun Aug 8 01:25:33 2010 (r211054) @@ -68,7 +68,9 @@ struct cpio { size_t pass_destpath_alloc; char *pass_destpath; int uid_override; + char *uname_override; int gid_override; + char *gname_override; int day_first; /* true if locale prefers day/mon */ /* If >= 0, then close this when done. */ From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 02:45:15 2010 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 1B806106566C; Sun, 8 Aug 2010 02:45:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A8438FC18; Sun, 8 Aug 2010 02:45:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o782jEAs032774; Sun, 8 Aug 2010 02:45:14 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o782jEpP032772; Sun, 8 Aug 2010 02:45:14 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201008080245.o782jEpP032772@svn.freebsd.org> From: Warner Losh Date: Sun, 8 Aug 2010 02:45: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: r211055 - head/usr.sbin/syslogd 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, 08 Aug 2010 02:45:15 -0000 Author: imp Date: Sun Aug 8 02:45:14 2010 New Revision: 211055 URL: http://svn.freebsd.org/changeset/base/211055 Log: This isn't WARNS=6 safe. It fails to build on mips. Retore old WARNS?=3 until that's resolved. Modified: head/usr.sbin/syslogd/Makefile Modified: head/usr.sbin/syslogd/Makefile ============================================================================== --- head/usr.sbin/syslogd/Makefile Sun Aug 8 01:25:33 2010 (r211054) +++ head/usr.sbin/syslogd/Makefile Sun Aug 8 02:45:14 2010 (r211055) @@ -12,6 +12,8 @@ SRCS= syslogd.c ttymsg.c DPADD= ${LIBUTIL} LDADD= -lutil +WARNS?= 3 + .if ${MK_INET6_SUPPORT} != "no" CFLAGS+= -DINET6 .endif From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 02:45:49 2010 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 620C71065672; Sun, 8 Aug 2010 02:45:49 +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 368158FC08; Sun, 8 Aug 2010 02:45:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o782jnP3032939; Sun, 8 Aug 2010 02:45:49 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o782jnFe032936; Sun, 8 Aug 2010 02:45:49 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201008080245.o782jnFe032936@svn.freebsd.org> From: Ed Schouten Date: Sun, 8 Aug 2010 02:45: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: r211056 - head/libexec/talkd 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, 08 Aug 2010 02:45:49 -0000 Author: ed Date: Sun Aug 8 02:45:48 2010 New Revision: 211056 URL: http://svn.freebsd.org/changeset/base/211056 Log: Remove unneeded use of struct timezone. We can safely call gettimeofday() without passing a struct timezone. We're not using it at all. Modified: head/libexec/talkd/announce.c head/libexec/talkd/table.c Modified: head/libexec/talkd/announce.c ============================================================================== --- head/libexec/talkd/announce.c Sun Aug 8 02:45:14 2010 (r211055) +++ head/libexec/talkd/announce.c Sun Aug 8 02:45:48 2010 (r211056) @@ -99,7 +99,6 @@ print_mesg(const char *tty, CTL_MSG *req { struct timeval now; time_t clock_sec; - struct timezone zone; struct tm *localclock; struct iovec iovec; char line_buf[N_LINES][N_CHARS]; @@ -110,7 +109,7 @@ print_mesg(const char *tty, CTL_MSG *req i = 0; max_size = 0; - gettimeofday(&now, &zone); + gettimeofday(&now, NULL); clock_sec = now.tv_sec; localclock = localtime(&clock_sec); (void)snprintf(line_buf[i], N_CHARS, " "); Modified: head/libexec/talkd/table.c ============================================================================== --- head/libexec/talkd/table.c Sun Aug 8 02:45:14 2010 (r211055) +++ head/libexec/talkd/table.c Sun Aug 8 02:45:48 2010 (r211056) @@ -66,7 +66,6 @@ static const char rcsid[] = extern int debug; struct timeval tp; -struct timezone txp; typedef struct table_entry TABLE_ENTRY; @@ -91,7 +90,7 @@ find_match(CTL_MSG *request) TABLE_ENTRY *ptr; time_t current_time; - gettimeofday(&tp, &txp); + gettimeofday(&tp, NULL); current_time = tp.tv_sec; if (debug) print_request("find_match", request); @@ -124,7 +123,7 @@ find_request(CTL_MSG *request) TABLE_ENTRY *ptr; time_t current_time; - gettimeofday(&tp, &txp); + gettimeofday(&tp, NULL); current_time = tp.tv_sec; /* * See if this is a repeated message, and check for @@ -161,7 +160,7 @@ insert_table(CTL_MSG *request, CTL_RESPO TABLE_ENTRY *ptr; time_t current_time; - gettimeofday(&tp, &txp); + gettimeofday(&tp, NULL); current_time = tp.tv_sec; request->id_num = new_id(); response->id_num = htonl(request->id_num); From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 02:51:33 2010 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 3E1BE1065670; Sun, 8 Aug 2010 02:51:33 +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 2D0C88FC15; Sun, 8 Aug 2010 02:51:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o782pXdn034233; Sun, 8 Aug 2010 02:51:33 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o782pXTf034231; Sun, 8 Aug 2010 02:51:33 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201008080251.o782pXTf034231@svn.freebsd.org> From: Ed Schouten Date: Sun, 8 Aug 2010 02:51:33 +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: r211057 - head/sys/netinet/libalias 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, 08 Aug 2010 02:51:33 -0000 Author: ed Date: Sun Aug 8 02:51:32 2010 New Revision: 211057 URL: http://svn.freebsd.org/changeset/base/211057 Log: Don't use struct timezone. The timezone structure acquired by gettimeofday() is not used at all. Just remove it. Modified: head/sys/netinet/libalias/alias_db.c Modified: head/sys/netinet/libalias/alias_db.c ============================================================================== --- head/sys/netinet/libalias/alias_db.c Sun Aug 8 02:45:48 2010 (r211056) +++ head/sys/netinet/libalias/alias_db.c Sun Aug 8 02:51:32 2010 (r211057) @@ -2181,7 +2181,6 @@ HouseKeeping(struct libalias *la) int i, n; #ifndef _KERNEL struct timeval tv; - struct timezone tz; #endif LIBALIAS_LOCK_ASSERT(la); @@ -2193,7 +2192,7 @@ HouseKeeping(struct libalias *la) #ifdef _KERNEL la->timeStamp = time_uptime; #else - gettimeofday(&tv, &tz); + gettimeofday(&tv, NULL); la->timeStamp = tv.tv_sec; #endif @@ -2488,7 +2487,6 @@ LibAliasInit(struct libalias *la) int i; #ifndef _KERNEL struct timeval tv; - struct timezone tz; #endif if (la == NULL) { @@ -2506,7 +2504,7 @@ LibAliasInit(struct libalias *la) la->timeStamp = time_uptime; la->lastCleanupTime = time_uptime; #else - gettimeofday(&tv, &tz); + gettimeofday(&tv, NULL); la->timeStamp = tv.tv_sec; la->lastCleanupTime = tv.tv_sec; #endif From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 02:53:40 2010 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 E35C01065673; Sun, 8 Aug 2010 02:53:40 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 8CF168FC1B; Sun, 8 Aug 2010 02:53:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o782nEGq035888; Sat, 7 Aug 2010 20:49:14 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sat, 07 Aug 2010 20:49:46 -0600 (MDT) Message-Id: <20100807.204946.244264502672924047.imp@bsdimp.com> To: gavin@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <201008071608.o77G8bNN088653@svn.freebsd.org> References: <201008071608.o77G8bNN088653@svn.freebsd.org> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 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 Subject: Re: svn commit: r211021 - 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: Sun, 08 Aug 2010 02:53:41 -0000 In message: <201008071608.o77G8bNN088653@svn.freebsd.org> Gavin Atkinson writes: : Author: gavin : Date: Sat Aug 7 16:08:37 2010 : New Revision: 211021 : URL: http://svn.freebsd.org/changeset/base/211021 : : Log: : Sort this file a little better: the vendors are supposed to be sorted by : vendor ID in the vendor section, and by symbolic name in the product : section. Products are sorted by product ID. While here, get rid of a : duplicate Microsoft Mouse entry, revealed by sorting. I thought products were sorted by the ID number, not the ID name. Warner From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 02:53:41 2010 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 6C8EA1065676; Sun, 8 Aug 2010 02:53:41 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 2D62A8FC08; Sun, 8 Aug 2010 02:53:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o782oQJh035893; Sat, 7 Aug 2010 20:50:26 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sat, 07 Aug 2010 20:50:58 -0600 (MDT) Message-Id: <20100807.205058.260300877050427878.imp@bsdimp.com> To: olli@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <201008071620.o77GKDBb091327@svn.freebsd.org> References: <201008071620.o77GKDBb091327@svn.freebsd.org> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 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 Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 08 Aug 2010 02:53:41 -0000 In message: <201008071620.o77GKDBb091327@svn.freebsd.org> Oliver Fromme writes: : Author: olli : Date: Sat Aug 7 16:20:12 2010 : New Revision: 211023 : URL: http://svn.freebsd.org/changeset/base/211023 : Modified: head/usr.sbin/syslogd/Makefile : ============================================================================== : --- head/usr.sbin/syslogd/Makefile Sat Aug 7 16:14:40 2010 (r211022) : +++ head/usr.sbin/syslogd/Makefile Sat Aug 7 16:20:12 2010 (r211023) : @@ -12,7 +12,7 @@ SRCS= syslogd.c ttymsg.c : DPADD= ${LIBUTIL} : LDADD= -lutil : : -WARNS?= 3 : +WARNS?= 6 : : .if ${MK_INET6_SUPPORT} != "no" : CFLAGS+= -DINET6 This breaks MIPS, so I've reverted it. Please make sure that all architectures work when bumping up WARNS. Thanks! Warner From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 06:18:06 2010 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 29AD21065673; Sun, 8 Aug 2010 06:18:06 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A33EE8FC1C; Sun, 8 Aug 2010 06:18:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o786I5Um080002; Sun, 8 Aug 2010 06:18:05 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o786I51D079999; Sun, 8 Aug 2010 06:18:05 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008080618.o786I51D079999@svn.freebsd.org> From: Jung-uk Kim Date: Sun, 8 Aug 2010 06:18:05 +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: r211058 - in head/sys: conf modules/x86bios 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, 08 Aug 2010 06:18:06 -0000 Author: jkim Date: Sun Aug 8 06:18:05 2010 New Revision: 211058 URL: http://svn.freebsd.org/changeset/base/211058 Log: Do not build real mode emulator for i386. We use VM86 again since r210877. Modified: head/sys/conf/files.i386 head/sys/modules/x86bios/Makefile Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Sun Aug 8 02:51:32 2010 (r211057) +++ head/sys/conf/files.i386 Sun Aug 8 06:18:05 2010 (r211058) @@ -369,10 +369,9 @@ i386/xbox/xboxfb.c optional xboxfb dev/fb/boot_font.c optional xboxfb i386/xbox/pic16l.s optional xbox # -# x86 real mode BIOS emulator, required by atkbdc/dpms/vesa +# x86 real mode BIOS support, required by atkbdc/dpms/vesa # compat/x86bios/x86bios.c optional x86bios | atkbd | dpms | vesa -contrib/x86emu/x86emu.c optional x86bios | atkbd | dpms | vesa # # x86 shared code between IA32, AMD64 and PC98 architectures # Modified: head/sys/modules/x86bios/Makefile ============================================================================== --- head/sys/modules/x86bios/Makefile Sun Aug 8 02:51:32 2010 (r211057) +++ head/sys/modules/x86bios/Makefile Sun Aug 8 06:18:05 2010 (r211058) @@ -6,6 +6,9 @@ SRCS+= bus_if.h device_if.h pci_if.h .PATH: ${.CURDIR}/../../contrib/x86emu .PATH: ${.CURDIR}/../../compat/x86bios -SRCS+= x86bios.c x86emu.c +SRCS+= x86bios.c +.if ${MACHINE_ARCH} != "i386" +SRCS+= x86emu.c +.endif .include From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 07:04:27 2010 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 DF8BB106566B; Sun, 8 Aug 2010 07:04:27 +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 B463C8FC0A; Sun, 8 Aug 2010 07:04:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7874RiC090262; Sun, 8 Aug 2010 07:04:27 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7874RFS090260; Sun, 8 Aug 2010 07:04:27 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201008080704.o7874RFS090260@svn.freebsd.org> From: Xin LI Date: Sun, 8 Aug 2010 07:04: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: r211059 - 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, 08 Aug 2010 07:04:28 -0000 Author: delphij Date: Sun Aug 8 07:04:27 2010 New Revision: 211059 URL: http://svn.freebsd.org/changeset/base/211059 Log: Address an edge condition that we found at work, where the carp(4) interface goes to issue LINK_UP, then LINK_DOWN, then LINK_UP at cold boot. This behavior is not observed when carp(4) interface is created slightly later, when the underlying interface is fully up. Before this change what happen at boot is roughly: - ifconfig creates em0 interface; - ifconfig clones a carp device using em0; (em0's link state is DOWN at this point) - carp state: INIT -> BACKUP [*] - carp state: BACKUP -> MASTER - [Some negotiate between em0 and switch] - em0 kicks up link state change event (em0's link state is now up DOWN at this point) - do_link_state_change() -> carp_carpdev_state() - carp state: MASTER -> INIT (via carp_set_state(sc, INIT)) [+] - carp state: INIT -> BACKUP - carp state: BACKUP -> MASTER At the [*] stage, em0 did not received any broadcast message from other node, and assume our node is the master, thus carp(4) sets the link state to "UP" after becoming a master. At [+], the master status is forcely set to "INIT", then an election is casted, after which our node would actually become a master. We believe that at the [*] stage, the master status should remain as "INIT" since the underlying parent interface's link state is not up. Obtained from: iXsystems, Inc. Reported by: jpaetzel MFC after: 2 months Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Sun Aug 8 06:18:05 2010 (r211058) +++ head/sys/netinet/ip_carp.c Sun Aug 8 07:04:27 2010 (r211059) @@ -1369,7 +1369,8 @@ carp_setrun(struct carp_softc *sc, sa_fa CARP_SCLOCK_ASSERT(sc); if (SC2IFP(sc)->if_flags & IFF_UP && - sc->sc_vhid > 0 && (sc->sc_naddrs || sc->sc_naddrs6)) + sc->sc_vhid > 0 && (sc->sc_naddrs || sc->sc_naddrs6) && + sc->sc_carpdev->if_link_state == LINK_STATE_UP) SC2IFP(sc)->if_drv_flags |= IFF_DRV_RUNNING; else { SC2IFP(sc)->if_drv_flags &= ~IFF_DRV_RUNNING; From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 07:34:38 2010 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 05EC21065673; Sun, 8 Aug 2010 07:34:38 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E83E88FC20; Sun, 8 Aug 2010 07:34:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o787YbTn097005; Sun, 8 Aug 2010 07:34:37 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o787YbnZ097002; Sun, 8 Aug 2010 07:34:37 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201008080734.o787YbnZ097002@svn.freebsd.org> From: Jaakko Heinonen Date: Sun, 8 Aug 2010 07:34:37 +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: r211060 - stable/8/contrib/nvi/vi 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, 08 Aug 2010 07:34:38 -0000 Author: jh Date: Sun Aug 8 07:34:37 2010 New Revision: 211060 URL: http://svn.freebsd.org/changeset/base/211060 Log: MFC r208612: Fixes from NetBSD for nvi visual mode PR: bin/21089, bin/136393 Modified: stable/8/contrib/nvi/vi/v_ex.c stable/8/contrib/nvi/vi/v_txt.c Directory Properties: stable/8/contrib/nvi/ (props changed) Modified: stable/8/contrib/nvi/vi/v_ex.c ============================================================================== --- stable/8/contrib/nvi/vi/v_ex.c Sun Aug 8 07:04:27 2010 (r211059) +++ stable/8/contrib/nvi/vi/v_ex.c Sun Aug 8 07:34:37 2010 (r211060) @@ -428,6 +428,10 @@ v_ex(sp, vp) if (tp->term == TERM_BS) break; + /* If the user changed their mind, return. */ + if (tp->term != TERM_OK) + break; + /* Log the command. */ if (O_STR(sp, O_CEDIT) != NULL && v_ecl_log(sp, tp)) return (1); Modified: stable/8/contrib/nvi/vi/v_txt.c ============================================================================== --- stable/8/contrib/nvi/vi/v_txt.c Sun Aug 8 07:04:27 2010 (r211059) +++ stable/8/contrib/nvi/vi/v_txt.c Sun Aug 8 07:34:37 2010 (r211060) @@ -510,15 +510,6 @@ next: if (v_event_get(sp, evp, 0, ec_fla case E_EOF: F_SET(sp, SC_EXIT_FORCE); return (1); - case E_INTERRUPT: - /* - * !!! - * Historically, exited the user from text input - * mode or cancelled a colon command, and returned to command - * mode. It also beeped the terminal, but that seems a bit - * excessive. - */ - goto k_escape; case E_REPAINT: if (vs_repaint(sp, &ev)) return (1); @@ -526,10 +517,37 @@ next: if (v_event_get(sp, evp, 0, ec_fla case E_WRESIZE: /* interrupts the input mode. */ v_emsg(sp, NULL, VIM_WRESIZE); - goto k_escape; + /* FALLTHROUGH */ default: - v_event_err(sp, evp); - goto k_escape; + if (evp->e_event != E_INTERRUPT && evp->e_event != E_WRESIZE) + v_event_err(sp, evp); + /* + * !!! + * Historically, exited the user from text input + * mode or cancelled a colon command, and returned to command + * mode. It also beeped the terminal, but that seems a bit + * excessive. + */ + /* + * If we are recording, morph into key so that + * we can repeat the command safely: there is no way to + * invalidate the repetition of an instance of a command, + * which would be the alternative possibility. + * If we are not recording (most likely on the command line), + * simply discard the input and return to command mode + * so that an INTERRUPT doesn't become for example a file + * completion request. -aymeric + */ + if (LF_ISSET(TXT_RECORD)) { + evp->e_event = E_CHARACTER; + evp->e_c = 033; + evp->e_flags = 0; + evp->e_value = K_ESCAPE; + break; + } else { + tp->term = TERM_ESC; + goto k_escape; + } } /* @@ -539,7 +557,7 @@ next: if (v_event_get(sp, evp, 0, ec_fla * This was not documented as far as I know, and is a great test of vi * clones. */ - if (rcol == 0 && !LF_ISSET(TXT_REPLAY) && evp->e_c == '\0') { + if (LF_ISSET(TXT_RECORD) && rcol == 0 && evp->e_c == '\0') { if (vip->rep == NULL) goto done; @@ -1456,6 +1474,7 @@ done: /* Leave input mode. */ err: alloc_err: + F_CLR(sp, SC_TINPUT); txt_err(sp, &sp->tiq); return (1); } @@ -2216,8 +2235,8 @@ txt_fc_col(sp, argc, argv) /* If the largest file name is too large, just print them. */ if (colwidth > sp->cols) { - p = msg_print(sp, av[0]->bp + prefix, &nf); for (ac = argc, av = argv; ac > 0; --ac, ++av) { + p = msg_print(sp, av[0]->bp + prefix, &nf); (void)ex_printf(sp, "%s\n", p); if (F_ISSET(gp, G_INTERRUPTED)) break; From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 08:19:23 2010 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 E10D8106564A; Sun, 8 Aug 2010 08:19:23 +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 D088B8FC08; Sun, 8 Aug 2010 08:19:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o788JNc2007093; Sun, 8 Aug 2010 08:19:23 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o788JNHN007091; Sun, 8 Aug 2010 08:19:23 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201008080819.o788JNHN007091@svn.freebsd.org> From: Ed Schouten Date: Sun, 8 Aug 2010 08:19: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: r211061 - head/lib/libcompat/4.1 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, 08 Aug 2010 08:19:24 -0000 Author: ed Date: Sun Aug 8 08:19:23 2010 New Revision: 211061 URL: http://svn.freebsd.org/changeset/base/211061 Log: Small style(9) fix: use tabs instead of spaces. Modified: head/lib/libcompat/4.1/ftime.c Modified: head/lib/libcompat/4.1/ftime.c ============================================================================== --- head/lib/libcompat/4.1/ftime.c Sun Aug 8 07:34:37 2010 (r211060) +++ head/lib/libcompat/4.1/ftime.c Sun Aug 8 08:19:23 2010 (r211061) @@ -39,15 +39,15 @@ static char rcsid[] = "$FreeBSD$"; int ftime(struct timeb *tbp) { - struct timezone tz; - struct timeval t; + struct timezone tz; + struct timeval t; - if (gettimeofday(&t, &tz) < 0) - return (-1); - tbp->millitm = t.tv_usec / 1000; - tbp->time = t.tv_sec; - tbp->timezone = tz.tz_minuteswest; - tbp->dstflag = tz.tz_dsttime; + if (gettimeofday(&t, &tz) < 0) + return (-1); + tbp->millitm = t.tv_usec / 1000; + tbp->time = t.tv_sec; + tbp->timezone = tz.tz_minuteswest; + tbp->dstflag = tz.tz_dsttime; return (0); } From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 08:22:54 2010 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 2695C1065673; Sun, 8 Aug 2010 08:22:54 +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 D623B8FC0C; Sun, 8 Aug 2010 08:22:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o788Mrew007937; Sun, 8 Aug 2010 08:22:53 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o788Mr2N007935; Sun, 8 Aug 2010 08:22:53 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201008080822.o788Mr2N007935@svn.freebsd.org> From: Ed Schouten Date: Sun, 8 Aug 2010 08:22: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: r211062 - head/contrib/traceroute 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, 08 Aug 2010 08:22:54 -0000 Author: ed Date: Sun Aug 8 08:22:53 2010 New Revision: 211062 URL: http://svn.freebsd.org/changeset/base/211062 Log: Remove unneeded struct timezone passed to gettimeofday(). Modified: head/contrib/traceroute/traceroute.c Modified: head/contrib/traceroute/traceroute.c ============================================================================== --- head/contrib/traceroute/traceroute.c Sun Aug 8 08:19:23 2010 (r211061) +++ head/contrib/traceroute/traceroute.c Sun Aug 8 08:22:53 2010 (r211062) @@ -962,7 +962,6 @@ main(int argc, char **argv) for (probe = 0, loss = 0; probe < nprobes; ++probe) { register int cc; struct timeval t1, t2; - struct timezone tz; register struct ip *ip; struct outdata outdata; @@ -973,7 +972,7 @@ main(int argc, char **argv) outdata.ttl = ttl; /* Avoid alignment problems by copying bytewise: */ - (void)gettimeofday(&t1, &tz); + (void)gettimeofday(&t1, NULL); memcpy(&outdata.tv, &t1, sizeof(outdata.tv)); /* Finalize and send packet */ @@ -986,7 +985,7 @@ main(int argc, char **argv) double T; int precis; - (void)gettimeofday(&t2, &tz); + (void)gettimeofday(&t2, NULL); i = packet_ok(packet, cc, from, seq); /* Skip short packet */ if (i == 0) @@ -1152,7 +1151,6 @@ wait_for_reply(register int sock, regist fd_set *fdsp; size_t nfds; struct timeval now, wait; - struct timezone tz; register int cc = 0; register int error; int fromlen = sizeof(*fromp); @@ -1165,7 +1163,7 @@ wait_for_reply(register int sock, regist wait.tv_sec = tp->tv_sec + waittime; wait.tv_usec = tp->tv_usec; - (void)gettimeofday(&now, &tz); + (void)gettimeofday(&now, NULL); tvsub(&wait, &now); if (wait.tv_sec < 0) { wait.tv_sec = 0; From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 08:43:02 2010 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 136C5106566B; Sun, 8 Aug 2010 08:43:02 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 02DD98FC15; Sun, 8 Aug 2010 08:43:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o788h1Wa012378; Sun, 8 Aug 2010 08:43:01 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o788h1PG012376; Sun, 8 Aug 2010 08:43:01 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201008080843.o788h1PG012376@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 8 Aug 2010 08:43: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: r211063 - head/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: Sun, 08 Aug 2010 08:43:02 -0000 Author: bschmidt Date: Sun Aug 8 08:43:01 2010 New Revision: 211063 URL: http://svn.freebsd.org/changeset/base/211063 Log: License ACK is not required for the wpifw module nor when building it into the kernel. PR: conf/148758 Submitted by: Joe Talbott MFC after: 3 days Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Aug 8 08:22:53 2010 (r211062) +++ head/sys/conf/files Sun Aug 8 08:43:01 2010 (r211063) @@ -1859,7 +1859,7 @@ dev/wi/if_wi_pccard.c optional wi pccar dev/wi/if_wi_pci.c optional wi pci dev/wl/if_wl.c optional wl isa wpifw.c optional wpifw \ - compile-with "${AWK} -f $S/tools/fw_stub.awk wpi.fw:wpifw:2144 -lintel_wpi -mwpi -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk wpi.fw:wpifw:2144 -mwpi -c${.TARGET}" \ no-implicit-rule before-depend local \ clean "wpifw.c" wpifw.fwo optional wpifw \ From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 09:06:59 2010 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 E7ED01065676; Sun, 8 Aug 2010 09:06:59 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D6E388FC22; Sun, 8 Aug 2010 09:06:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7896xUq017801; Sun, 8 Aug 2010 09:06:59 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7896xOv017799; Sun, 8 Aug 2010 09:06:59 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201008080906.o7896xOv017799@svn.freebsd.org> From: Jaakko Heinonen Date: Sun, 8 Aug 2010 09:06:59 +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: r211064 - stable/8/sys/geom/zero 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, 08 Aug 2010 09:07:00 -0000 Author: jh Date: Sun Aug 8 09:06:59 2010 New Revision: 211064 URL: http://svn.freebsd.org/changeset/base/211064 Log: MFC r207877: In g_zero_destroy_geom(), return 0 instead of EBUSY in the success case. EBUSY was probably used as a workaround for the deadlock fixed in r207671. Modified: stable/8/sys/geom/zero/g_zero.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/geom/zero/g_zero.c ============================================================================== --- stable/8/sys/geom/zero/g_zero.c Sun Aug 8 08:43:01 2010 (r211063) +++ stable/8/sys/geom/zero/g_zero.c Sun Aug 8 09:06:59 2010 (r211064) @@ -104,7 +104,7 @@ g_zero_destroy_geom(struct gctl_req *req if (pp->acr > 0 || pp->acw > 0 || pp->ace > 0) return (EBUSY); g_wither_geom(gp, ENXIO); - return (EBUSY); + return (0); } static struct g_class g_zero_class = { From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 09:12:30 2010 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 7E7781065670; Sun, 8 Aug 2010 09:12:30 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C8E58FC1D; Sun, 8 Aug 2010 09:12:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o789CUBv019058; Sun, 8 Aug 2010 09:12:30 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o789CUpd019053; Sun, 8 Aug 2010 09:12:30 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201008080912.o789CUpd019053@svn.freebsd.org> From: Jaakko Heinonen Date: Sun, 8 Aug 2010 09:12:30 +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: r211065 - stable/8/sys/geom/vinum 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, 08 Aug 2010 09:12:30 -0000 Author: jh Date: Sun Aug 8 09:12:30 2010 New Revision: 211065 URL: http://svn.freebsd.org/changeset/base/211065 Log: MFC r207878: - Don't return EAGAIN from gv_unload(). It was used to work around the deadlock fixed in r207671. - Wait for worker process to exit at class unload. The worker process was not guaranteed to exit before the linker unloaded the module. - Use 0 as the worker process exit status instead of ENXIO and style the NOTREACHED comment. Modified: stable/8/sys/geom/vinum/geom_vinum.c stable/8/sys/geom/vinum/geom_vinum.h stable/8/sys/geom/vinum/geom_vinum_events.c stable/8/sys/geom/vinum/geom_vinum_var.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/geom/vinum/geom_vinum.c ============================================================================== --- stable/8/sys/geom/vinum/geom_vinum.c Sun Aug 8 09:06:59 2010 (r211064) +++ stable/8/sys/geom/vinum/geom_vinum.c Sun Aug 8 09:12:30 2010 (r211065) @@ -187,7 +187,7 @@ gv_init(struct g_class *mp) mtx_init(&sc->config_mtx, "gv_config", NULL, MTX_DEF); mtx_init(&sc->equeue_mtx, "gv_equeue", NULL, MTX_DEF); mtx_init(&sc->bqueue_mtx, "gv_bqueue", NULL, MTX_DEF); - kproc_create(gv_worker, sc, NULL, 0, 0, "gv_worker"); + kproc_create(gv_worker, sc, &sc->worker, 0, 0, "gv_worker"); } static int @@ -201,10 +201,9 @@ gv_unload(struct gctl_req *req, struct g sc = gp->softc; if (sc != NULL) { - gv_post_event(sc, GV_EVENT_THREAD_EXIT, NULL, NULL, 0, 0); + gv_worker_exit(sc); gp->softc = NULL; g_wither_geom(gp, ENXIO); - return (EAGAIN); } return (0); @@ -970,8 +969,8 @@ gv_worker(void *arg) g_free(sc->bqueue_down); g_free(sc->bqueue_up); g_free(sc); - kproc_exit(ENXIO); - break; /* not reached */ + kproc_exit(0); + /* NOTREACHED */ default: G_VINUM_DEBUG(1, "unknown event %d", ev->type); Modified: stable/8/sys/geom/vinum/geom_vinum.h ============================================================================== --- stable/8/sys/geom/vinum/geom_vinum.h Sun Aug 8 09:06:59 2010 (r211064) +++ stable/8/sys/geom/vinum/geom_vinum.h Sun Aug 8 09:12:30 2010 (r211065) @@ -122,6 +122,7 @@ int gv_detach_sd(struct gv_sd *, int) void gv_worker(void *); void gv_post_event(struct gv_softc *, int, void *, void *, intmax_t, intmax_t); +void gv_worker_exit(struct gv_softc *); struct gv_event *gv_get_event(struct gv_softc *); void gv_remove_event(struct gv_softc *, struct gv_event *); void gv_drive_tasted(struct gv_softc *, struct g_provider *); Modified: stable/8/sys/geom/vinum/geom_vinum_events.c ============================================================================== --- stable/8/sys/geom/vinum/geom_vinum_events.c Sun Aug 8 09:06:59 2010 (r211064) +++ stable/8/sys/geom/vinum/geom_vinum_events.c Sun Aug 8 09:12:30 2010 (r211065) @@ -58,6 +58,20 @@ gv_post_event(struct gv_softc *sc, int e mtx_unlock(&sc->equeue_mtx); } +void +gv_worker_exit(struct gv_softc *sc) +{ + struct gv_event *ev; + + ev = g_malloc(sizeof(*ev), M_WAITOK | M_ZERO); + ev->type = GV_EVENT_THREAD_EXIT; + + mtx_lock(&sc->equeue_mtx); + TAILQ_INSERT_TAIL(&sc->equeue, ev, events); + wakeup(sc); + msleep(sc->worker, &sc->equeue_mtx, PDROP, "gv_wor", 0); +} + struct gv_event * gv_get_event(struct gv_softc *sc) { Modified: stable/8/sys/geom/vinum/geom_vinum_var.h ============================================================================== --- stable/8/sys/geom/vinum/geom_vinum_var.h Sun Aug 8 09:06:59 2010 (r211064) +++ stable/8/sys/geom/vinum/geom_vinum_var.h Sun Aug 8 09:12:30 2010 (r211065) @@ -238,6 +238,7 @@ struct gv_softc { struct bio_queue_head *bqueue_up; /* BIO queue for completed requests. */ struct g_geom *geom; /* Pointer to our VINUM geom. */ + struct proc *worker; /* Worker process. */ }; #endif From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 09:40:09 2010 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 F055B106566B; Sun, 8 Aug 2010 09:40:09 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFDB58FC08; Sun, 8 Aug 2010 09:40:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o789e9tQ025204; Sun, 8 Aug 2010 09:40:09 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o789e95m025202; Sun, 8 Aug 2010 09:40:09 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201008080940.o789e95m025202@svn.freebsd.org> From: Gavin Atkinson Date: Sun, 8 Aug 2010 09:40:09 +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: r211066 - head/share/termcap 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, 08 Aug 2010 09:40:10 -0000 Author: gavin Date: Sun Aug 8 09:40:09 2010 New Revision: 211066 URL: http://svn.freebsd.org/changeset/base/211066 Log: Add a termcap entry for rxvt-256color. PR: conf/147726 Submitted by: Sterling (Chip) Camden MFC after: 2 weeks Modified: head/share/termcap/termcap.src Modified: head/share/termcap/termcap.src ============================================================================== --- head/share/termcap/termcap.src Sun Aug 8 09:12:30 2010 (r211065) +++ head/share/termcap/termcap.src Sun Aug 8 09:40:09 2010 (r211066) @@ -4631,6 +4631,9 @@ rxvt-unicode|rxvt-unicode terminal (X Wi rxvt|rxvt terminal emulator (X Window System):\ :pa#64:Co#8:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:tc=rxvt-mono: +rxvt-256color|rxvt terminal emulator with 256 colors:\ + :Co#256:AF=\E[38;5;%dm:AB=\E[48;5;%dm:tc=rxvt-unicode: + # Termcap entry for Eterm, taken from the sources of Eterm-0.9.2 Eterm|Eterm Terminal Emulator (X11 Window System):\ :am:bw:eo:km:mi:ms:xn:xo:\ From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 12:19:50 2010 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 74CD7106566B; Sun, 8 Aug 2010 12:19:50 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 636A48FC28; Sun, 8 Aug 2010 12:19:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78CJoCc061930; Sun, 8 Aug 2010 12:19:50 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78CJojS061929; Sun, 8 Aug 2010 12:19:50 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201008081219.o78CJojS061929@svn.freebsd.org> From: Jaakko Heinonen Date: Sun, 8 Aug 2010 12:19:50 +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: r211067 - stable/8/sys/fs/devfs 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, 08 Aug 2010 12:19:50 -0000 Author: jh Date: Sun Aug 8 12:19:49 2010 New Revision: 211067 URL: http://svn.freebsd.org/changeset/base/211067 Log: MFC r208717: Don't try to call cdevsw d_close() method when devfs_close() is called because of insmntque1() failure. Modified: stable/8/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vnops.c Sun Aug 8 09:40:09 2010 (r211066) +++ stable/8/sys/fs/devfs/devfs_vnops.c Sun Aug 8 12:19:49 2010 (r211067) @@ -459,6 +459,13 @@ devfs_close(struct vop_close_args *ap) int vp_locked, error; /* + * XXX: Don't call d_close() if we were called because of + * XXX: insmntque1() failure. + */ + if (vp->v_data == NULL) + return (0); + + /* * Hack: a tty device that is a controlling terminal * has a reference from the session structure. * We cannot easily tell that a character device is From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 12:23:02 2010 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 7F27D1065673; Sun, 8 Aug 2010 12:23:02 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E10E8FC15; Sun, 8 Aug 2010 12:23:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78CN2Au062685; Sun, 8 Aug 2010 12:23:02 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78CN2td062683; Sun, 8 Aug 2010 12:23:02 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201008081223.o78CN2td062683@svn.freebsd.org> From: "Jayachandran C." Date: Sun, 8 Aug 2010 12:23: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: r211068 - head/sys/mips/mips 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, 08 Aug 2010 12:23:02 -0000 Author: jchandra Date: Sun Aug 8 12:23:02 2010 New Revision: 211068 URL: http://svn.freebsd.org/changeset/base/211068 Log: loadandclear() for PTEs are not needed on MIPS. The PTEs are software managed and we already take pmap lock for PTE operations(see r210922) Reviewed by: alc Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Sun Aug 8 12:19:49 2010 (r211067) +++ head/sys/mips/mips/pmap.c Sun Aug 8 12:23:02 2010 (r211068) @@ -1352,9 +1352,11 @@ retry: pmap->pm_stats.resident_count--; pte = pmap_pte(pmap, va); KASSERT(pte != NULL, ("pte")); - oldpte = loadandclear((u_int *)pte); + oldpte = *pte; if (is_kernel_pmap(pmap)) *pte = PTE_G; + else + *pte = 0; KASSERT(!pte_test(&oldpte, PTE_W), ("wired pte for unwired page")); if (m->md.pv_flags & PV_TABLE_REF) @@ -1494,9 +1496,11 @@ pmap_remove_pte(struct pmap *pmap, pt_en mtx_assert(&vm_page_queue_mtx, MA_OWNED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - oldpte = loadandclear((u_int *)ptq); + oldpte = *ptq; if (is_kernel_pmap(pmap)) *ptq = PTE_G; + else + *ptq = 0; if (pte_test(&oldpte, PTE_W)) pmap->pm_stats.wired_count -= 1; @@ -1657,9 +1661,11 @@ pmap_remove_all(vm_page_t m) pte = pmap_pte(pv->pv_pmap, pv->pv_va); - tpte = loadandclear((u_int *)pte); + tpte = *pte; if (is_kernel_pmap(pv->pv_pmap)) *pte = PTE_G; + else + *pte = 0; if (pte_test(&tpte, PTE_W)) pv->pv_pmap->pm_stats.wired_count--; From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 13:43:21 2010 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 319961065676; Sun, 8 Aug 2010 13:43:21 +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 200E28FC1A; Sun, 8 Aug 2010 13:43:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78DhLdA080942; Sun, 8 Aug 2010 13:43:21 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78DhLVn080940; Sun, 8 Aug 2010 13:43:21 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201008081343.o78DhLVn080940@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 8 Aug 2010 13:43: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: r211069 - stable/8/etc/rc.d 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, 08 Aug 2010 13:43:21 -0000 Author: jilles Date: Sun Aug 8 13:43:20 2010 New Revision: 211069 URL: http://svn.freebsd.org/changeset/base/211069 Log: MFC r210734: Allow starting ipmon if ipnat is enabled but ipfilter is not (in /etc/rc.conf). This fixes an apparent confusion between test(1) and sh(1) syntax for AND/OR. PR: conf/149036 Submitted by: pluknet Modified: stable/8/etc/rc.d/ipmon Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/rc.d/ipmon ============================================================================== --- stable/8/etc/rc.d/ipmon Sun Aug 8 12:23:02 2010 (r211068) +++ stable/8/etc/rc.d/ipmon Sun Aug 8 13:43:20 2010 (r211069) @@ -20,7 +20,7 @@ ipmon_precmd() # Continue only if ipfilter or ipnat is enabled and the # ipfilter module is loaded. # - if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then + if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable ; then err 1 "${name} requires either ipfilter or ipnat enabled" fi if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 13:45:47 2010 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 6A0F01065672; Sun, 8 Aug 2010 13:45:47 +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 58A818FC1E; Sun, 8 Aug 2010 13:45:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78Djleo081548; Sun, 8 Aug 2010 13:45:47 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78Djl5s081546; Sun, 8 Aug 2010 13:45:47 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201008081345.o78Djl5s081546@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 8 Aug 2010 13:45:47 +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: r211070 - stable/7/etc/rc.d 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, 08 Aug 2010 13:45:47 -0000 Author: jilles Date: Sun Aug 8 13:45:47 2010 New Revision: 211070 URL: http://svn.freebsd.org/changeset/base/211070 Log: MFC r210734: Allow starting ipmon if ipnat is enabled but ipfilter is not (in /etc/rc.conf). This fixes an apparent confusion between test(1) and sh(1) syntax for AND/OR. PR: conf/149036 Submitted by: pluknet Modified: stable/7/etc/rc.d/ipmon Directory Properties: stable/7/etc/ (props changed) Modified: stable/7/etc/rc.d/ipmon ============================================================================== --- stable/7/etc/rc.d/ipmon Sun Aug 8 13:43:20 2010 (r211069) +++ stable/7/etc/rc.d/ipmon Sun Aug 8 13:45:47 2010 (r211070) @@ -20,7 +20,7 @@ ipmon_precmd() # Continue only if ipfilter or ipnat is enabled and the # ipfilter module is loaded. # - if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then + if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable ; then err 1 "${name} requires either ipfilter or ipnat enabled" fi if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 14:00:21 2010 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 F29B5106567B; Sun, 8 Aug 2010 14:00:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E02BC8FC1C; Sun, 8 Aug 2010 14:00:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78E0LC4084870; Sun, 8 Aug 2010 14:00:21 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78E0LoL084864; Sun, 8 Aug 2010 14:00:21 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201008081400.o78E0LoL084864@svn.freebsd.org> From: Marius Strobl Date: Sun, 8 Aug 2010 14:00: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: r211071 - in head/sys/sparc64: include 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: Sun, 08 Aug 2010 14:00:22 -0000 Author: marius Date: Sun Aug 8 14:00:21 2010 New Revision: 211071 URL: http://svn.freebsd.org/changeset/base/211071 Log: - As it is not possible for sched_bind(9) to context switch with td_critnest > 1 when not already running on the desired CPU read the TICK counter of the BSP via a direct cross trap request in that case instead. - Treat the STICK based timecounter the same way as the TICK based one regarding its quality and obtaining the counter value from the BSP. Like the TICK timers the STICK ones also are only synchronized during their startup (which might not result in good synchronicity in the first place) but not afterwards and might drift over time, causing problems when the time is read from different CPUs (see r135972). Modified: head/sys/sparc64/include/smp.h head/sys/sparc64/sparc64/genassym.c head/sys/sparc64/sparc64/mp_exception.S head/sys/sparc64/sparc64/mp_machdep.c head/sys/sparc64/sparc64/tick.c Modified: head/sys/sparc64/include/smp.h ============================================================================== --- head/sys/sparc64/include/smp.h Sun Aug 8 13:45:47 2010 (r211070) +++ head/sys/sparc64/include/smp.h Sun Aug 8 14:00:21 2010 (r211071) @@ -81,6 +81,11 @@ struct ipi_cache_args { vm_paddr_t ica_pa; }; +struct ipi_rd_args { + u_int ira_mask; + register_t *ira_val; +}; + struct ipi_tlb_args { u_int ita_mask; struct pmap *ita_pmap; @@ -105,6 +110,7 @@ void mp_init(u_int cpu_impl); extern struct mtx ipi_mtx; extern struct ipi_cache_args ipi_cache_args; +extern struct ipi_rd_args ipi_rd_args; extern struct ipi_tlb_args ipi_tlb_args; extern char *mp_tramp_code; @@ -119,6 +125,10 @@ extern char tl_ipi_spitfire_dcache_page_ extern char tl_ipi_spitfire_icache_page_inval[]; extern char tl_ipi_level[]; + +extern char tl_ipi_stick_rd[]; +extern char tl_ipi_tick_rd[]; + extern char tl_ipi_tlb_context_demap[]; extern char tl_ipi_tlb_page_demap[]; extern char tl_ipi_tlb_range_demap[]; @@ -179,6 +189,22 @@ ipi_icache_page_inval(void *func, vm_pad } static __inline void * +ipi_rd(u_int cpu, void *func, u_long *val) +{ + struct ipi_rd_args *ira; + + if (smp_cpus == 1) + return (NULL); + sched_pin(); + ira = &ipi_rd_args; + mtx_lock_spin(&ipi_mtx); + ira->ira_mask = 1 << cpu | PCPU_GET(cpumask); + ira->ira_val = val; + cpu_ipi_single(cpu, 0, (u_long)func, (u_long)ira); + return (&ira->ira_mask); +} + +static __inline void * ipi_tlb_context_demap(struct pmap *pm) { struct ipi_tlb_args *ita; @@ -283,6 +309,13 @@ ipi_icache_page_inval(void *func __unuse } static __inline void * +ipi_rd(u_int cpu __unused, void *func __unused, u_long *val __unused) +{ + + return (NULL); +} + +static __inline void * ipi_tlb_context_demap(struct pmap *pm __unused) { Modified: head/sys/sparc64/sparc64/genassym.c ============================================================================== --- head/sys/sparc64/sparc64/genassym.c Sun Aug 8 13:45:47 2010 (r211070) +++ head/sys/sparc64/sparc64/genassym.c Sun Aug 8 14:00:21 2010 (r211071) @@ -216,6 +216,9 @@ ASSYM(IR_PRI, offsetof(struct intr_reque ASSYM(IR_VEC, offsetof(struct intr_request, ir_vec)); #ifdef SMP +ASSYM(IRA_MASK, offsetof(struct ipi_rd_args, ira_mask)); +ASSYM(IRA_VAL, offsetof(struct ipi_rd_args, ira_val)); + ASSYM(ITA_MASK, offsetof(struct ipi_tlb_args, ita_mask)); ASSYM(ITA_PMAP, offsetof(struct ipi_tlb_args, ita_pmap)); ASSYM(ITA_START, offsetof(struct ipi_tlb_args, ita_start)); Modified: head/sys/sparc64/sparc64/mp_exception.S ============================================================================== --- head/sys/sparc64/sparc64/mp_exception.S Sun Aug 8 13:45:47 2010 (r211070) +++ head/sys/sparc64/sparc64/mp_exception.S Sun Aug 8 14:00:21 2010 (r211071) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); */ ENTRY(tl_ipi_spitfire_dcache_page_inval) #if KTR_COMPILE & KTR_SMP - CATR(KTR_SMP, "ipi_dcache_page_inval: pa=%#lx" + CATR(KTR_SMP, "tl_ipi_spitfire_dcache_page_inval: pa=%#lx" , %g1, %g2, %g3, 7, 8, 9) ldx [%g5 + ICA_PA], %g2 stx %g2, [%g1 + KTR_PARM1] @@ -87,7 +87,7 @@ END(tl_ipi_spitfire_dcache_page_inval) */ ENTRY(tl_ipi_spitfire_icache_page_inval) #if KTR_COMPILE & KTR_SMP - CATR(KTR_SMP, "ipi_icache_page_inval: pa=%#lx" + CATR(KTR_SMP, "tl_ipi_spitfire_icache_page_inval: pa=%#lx" , %g1, %g2, %g3, 7, 8, 9) ldx [%g5 + ICA_PA], %g2 stx %g2, [%g1 + KTR_PARM1] @@ -126,7 +126,7 @@ END(tl_ipi_spitfire_icache_page_inval) */ ENTRY(tl_ipi_cheetah_dcache_page_inval) #if KTR_COMPILE & KTR_SMP - CATR(KTR_SMP, "ipi_dcache_page_inval: pa=%#lx" + CATR(KTR_SMP, "tl_ipi_cheetah_dcache_page_inval: pa=%#lx" , %g1, %g2, %g3, 7, 8, 9) ldx [%g5 + ICA_PA], %g2 stx %g2, [%g1 + KTR_PARM1] @@ -256,7 +256,7 @@ END(tl_ipi_tlb_range_demap) */ ENTRY(tl_ipi_tlb_context_demap) #if KTR_COMPILE & KTR_SMP - CATR(KTR_SMP, "ipi_tlb_page_demap: pm=%p va=%#lx" + CATR(KTR_SMP, "tl_ipi_tlb_context_demap: pm=%p va=%#lx" , %g1, %g2, %g3, 7, 8, 9) ldx [%g5 + ITA_PMAP], %g2 stx %g2, [%g1 + KTR_PARM1] @@ -274,3 +274,27 @@ ENTRY(tl_ipi_tlb_context_demap) IPI_DONE(%g5, %g1, %g2, %g3) retry END(tl_ipi_tlb_context_demap) + +/* + * Read %stick. + */ +ENTRY(tl_ipi_stick_rd) + ldx [%g5 + IRA_VAL], %g1 + rd %asr24, %g2 + stx %g2, [%g1] + + IPI_DONE(%g5, %g1, %g2, %g3) + retry +END(tl_ipi_stick_rd) + +/* + * Read %tick. + */ +ENTRY(tl_ipi_tick_rd) + ldx [%g5 + IRA_VAL], %g1 + rd %tick, %g2 + stx %g2, [%g1] + + IPI_DONE(%g5, %g1, %g2, %g3) + retry +END(tl_ipi_tick_rd) Modified: head/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/mp_machdep.c Sun Aug 8 13:45:47 2010 (r211070) +++ head/sys/sparc64/sparc64/mp_machdep.c Sun Aug 8 14:00:21 2010 (r211071) @@ -109,6 +109,7 @@ static ih_func_t cpu_ipi_stop; */ struct cpu_start_args cpu_start_args = { 0, -1, -1, 0, 0, 0 }; struct ipi_cache_args ipi_cache_args; +struct ipi_rd_args ipi_rd_args; struct ipi_tlb_args ipi_tlb_args; struct pcb stoppcbs[MAXCPU]; Modified: head/sys/sparc64/sparc64/tick.c ============================================================================== --- head/sys/sparc64/sparc64/tick.c Sun Aug 8 13:45:47 2010 (r211070) +++ head/sys/sparc64/sparc64/tick.c Sun Aug 8 14:00:21 2010 (r211071) @@ -43,13 +43,16 @@ __FBSDID("$FreeBSD$"); #include +#include +#include + #include #include #include +#include #include #include -#define STICK_QUALITY -500 #define TICK_QUALITY_MP 10 #define TICK_QUALITY_UP 1000 @@ -80,7 +83,10 @@ static struct timecounter tick_tc; static struct eventtimer tick_et; static uint64_t tick_cputicks(void); -static timecounter_get_t stick_get_timecount; +static timecounter_get_t stick_get_timecount_up; +#ifdef SMP +static timecounter_get_t stick_get_timecount_mp; +#endif static timecounter_get_t tick_get_timecount_up; #ifdef SMP static timecounter_get_t tick_get_timecount_mp; @@ -135,8 +141,14 @@ cpu_initclocks(void) } /* - * Initialize the TICK-based timecounter. This must not happen - * before SI_SUB_INTRINSIC for tick_get_timecount_mp() to work. + * Initialize the (S)TICK-based timecounter(s). + * Note that we (try to) sync the (S)TICK timers of APs with the BSP + * during their startup but not afterwards. The resulting drift can + * cause problems when the time is calculated based on (S)TICK values + * read on different CPUs. Thus we always read the register on the + * BSP (if necessary via an IPI as sched_bind(9) isn't available in + * all circumstances) and use a low quality for the otherwise high + * quality (S)TICK timers in the MP case. */ tick_tc.tc_get_timecount = tick_get_timecount_up; tick_tc.tc_poll_pps = NULL; @@ -146,14 +158,6 @@ cpu_initclocks(void) tick_tc.tc_quality = TICK_QUALITY_UP; tick_tc.tc_priv = NULL; #ifdef SMP - /* - * We (try to) sync the (S)TICK timers of APs with the BSP during - * their startup but not afterwards. The resulting drift can - * cause problems when the time is calculated based on (S)TICK - * values read on different CPUs. Thus we bind to the BSP for - * reading the register and use a low quality for the otherwise - * high quality (S)TICK timers in the MP case. - */ if (cpu_mp_probe()) { tick_tc.tc_get_timecount = tick_get_timecount_mp; tick_tc.tc_quality = TICK_QUALITY_MP; @@ -161,17 +165,23 @@ cpu_initclocks(void) #endif tc_init(&tick_tc); if (sclock != 0) { - stick_tc.tc_get_timecount = stick_get_timecount; + stick_tc.tc_get_timecount = stick_get_timecount_up; stick_tc.tc_poll_pps = NULL; stick_tc.tc_counter_mask = ~0u; stick_tc.tc_frequency = sclock; stick_tc.tc_name = "stick"; - stick_tc.tc_quality = STICK_QUALITY; + stick_tc.tc_quality = TICK_QUALITY_UP; stick_tc.tc_priv = NULL; +#ifdef SMP + if (cpu_mp_probe()) { + stick_tc.tc_get_timecount = stick_get_timecount_mp; + stick_tc.tc_quality = TICK_QUALITY_MP; + } +#endif tc_init(&stick_tc); } tick_et.et_name = hardclock_use_stick ? "stick" : "tick"; - tick_et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT | + tick_et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU; tick_et.et_quality = 1000; tick_et.et_frequency = hardclock_use_stick ? sclock : clock; @@ -183,7 +193,7 @@ cpu_initclocks(void) tick_et.et_stop = tick_et_stop; tick_et.et_priv = NULL; et_register(&tick_et); - + cpu_initclocks_bsp(); } @@ -307,7 +317,7 @@ tick_hardclock_common(struct trapframe * } static u_int -stick_get_timecount(struct timecounter *tc) +stick_get_timecount_up(struct timecounter *tc) { return ((u_int)rdstick()); @@ -322,22 +332,30 @@ tick_get_timecount_up(struct timecounter #ifdef SMP static u_int -tick_get_timecount_mp(struct timecounter *tc) +stick_get_timecount_mp(struct timecounter *tc) { - struct thread *td; - u_int tick; + u_long stick; - td = curthread; - thread_lock(td); - sched_bind(td, 0); - thread_unlock(td); - - tick = tick_get_timecount_up(tc); - - thread_lock(td); - sched_unbind(td); - thread_unlock(td); + sched_pin(); + if (curcpu == 0) + stick = rdstick(); + else + ipi_wait(ipi_rd(0, tl_ipi_stick_rd, &stick)); + sched_unpin(); + return (stick); +} +static u_int +tick_get_timecount_mp(struct timecounter *tc) +{ + u_long tick; + + sched_pin(); + if (curcpu == 0) + tick = rd(tick); + else + ipi_wait(ipi_rd(0, tl_ipi_tick_rd, &tick)); + sched_unpin(); return (tick); } #endif @@ -360,7 +378,7 @@ tick_et_start(struct eventtimer *et, fdiv = (tick_et.et_frequency * (first->frac >> 32)) >> 32; if (first->sec != 0) fdiv += tick_et.et_frequency * first->sec; - } else + } else fdiv = div; PCPU_SET(tickincrement, div); From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 14:13:11 2010 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 040DA106568B; Sun, 8 Aug 2010 14:13:11 +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 E6A978FC1B; Sun, 8 Aug 2010 14:13:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78EDAOl087893; Sun, 8 Aug 2010 14:13:10 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78EDAmp087891; Sun, 8 Aug 2010 14:13:10 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201008081413.o78EDAmp087891@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 8 Aug 2010 14:13:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211072 - stable/6/etc/rc.d 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, 08 Aug 2010 14:13:11 -0000 Author: jilles Date: Sun Aug 8 14:13:10 2010 New Revision: 211072 URL: http://svn.freebsd.org/changeset/base/211072 Log: MFC r210734: Allow starting ipmon if ipnat is enabled but ipfilter is not (in /etc/rc.conf). This fixes an apparent confusion between test(1) and sh(1) syntax for AND/OR. PR: conf/149036 Submitted by: pluknet Modified: stable/6/etc/rc.d/ipmon Directory Properties: stable/6/etc/ (props changed) Modified: stable/6/etc/rc.d/ipmon ============================================================================== --- stable/6/etc/rc.d/ipmon Sun Aug 8 14:00:21 2010 (r211071) +++ stable/6/etc/rc.d/ipmon Sun Aug 8 14:13:10 2010 (r211072) @@ -20,7 +20,7 @@ ipmon_precmd() # Continue only if ipfilter or ipnat is enabled and the # ipfilter module is loaded. # - if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then + if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable ; then err 1 "${name} requires either ipfilter or ipnat enabled" fi if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 14:37:16 2010 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 66881106566C; Sun, 8 Aug 2010 14:37:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 558348FC16; Sun, 8 Aug 2010 14:37:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78EbG24093284; Sun, 8 Aug 2010 14:37:16 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78EbG4S093282; Sun, 8 Aug 2010 14:37:16 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201008081437.o78EbG4S093282@svn.freebsd.org> From: Marius Strobl Date: Sun, 8 Aug 2010 14:37: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: r211073 - head/sys/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: Sun, 08 Aug 2010 14:37:16 -0000 Author: marius Date: Sun Aug 8 14:37:16 2010 New Revision: 211073 URL: http://svn.freebsd.org/changeset/base/211073 Log: Wrap some sun4u-only symbols. Modified: head/sys/sparc64/sparc64/genassym.c Modified: head/sys/sparc64/sparc64/genassym.c ============================================================================== --- head/sys/sparc64/sparc64/genassym.c Sun Aug 8 14:13:10 2010 (r211072) +++ head/sys/sparc64/sparc64/genassym.c Sun Aug 8 14:37:16 2010 (r211073) @@ -105,10 +105,6 @@ ASSYM(IC_SIZE, offsetof(struct cacheinfo ASSYM(IC_LINESIZE, offsetof(struct cacheinfo, ic_linesize)); #endif -#ifdef SMP -ASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa)); -#endif - ASSYM(KTR_SIZEOF, sizeof(struct ktr_entry)); ASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line)); ASSYM(KTR_FILE, offsetof(struct ktr_entry, ktr_file)); @@ -215,7 +211,9 @@ ASSYM(IR_ARG, offsetof(struct intr_reque ASSYM(IR_PRI, offsetof(struct intr_request, ir_pri)); ASSYM(IR_VEC, offsetof(struct intr_request, ir_vec)); -#ifdef SMP +#if defined(SUN4U) && defined(SMP) +ASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa)); + ASSYM(IRA_MASK, offsetof(struct ipi_rd_args, ira_mask)); ASSYM(IRA_VAL, offsetof(struct ipi_rd_args, ira_val)); From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 15:29:28 2010 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 0F04E1065676; Sun, 8 Aug 2010 15:29:28 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F204A8FC1F; Sun, 8 Aug 2010 15:29:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78FTRD6004919; Sun, 8 Aug 2010 15:29:27 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78FTRM0004917; Sun, 8 Aug 2010 15:29:27 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201008081529.o78FTRM0004917@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sun, 8 Aug 2010 15:29:27 +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: r211074 - stable/8/etc 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, 08 Aug 2010 15:29:28 -0000 Author: ume Date: Sun Aug 8 15:29:27 2010 New Revision: 211074 URL: http://svn.freebsd.org/changeset/base/211074 Log: MFC r210861: /etc/rc.d/ip6fw was deprecated. Modified: stable/8/etc/netstart Modified: stable/8/etc/netstart ============================================================================== --- stable/8/etc/netstart Sun Aug 8 14:37:16 2010 (r211073) +++ stable/8/etc/netstart Sun Aug 8 15:29:27 2010 (r211074) @@ -55,7 +55,6 @@ _start=quietstart /etc/rc.d/dhclient ${_start} /etc/rc.d/ppp ${_start} /etc/rc.d/ipfw ${_start} -/etc/rc.d/ip6fw ${_start} /etc/rc.d/network_ipv6 ${_start} /etc/rc.d/routing ${_start} /etc/rc.d/mroute6d ${_start} From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 16:20:32 2010 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 7817C1065677; Sun, 8 Aug 2010 16:20:32 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 673118FC1B; Sun, 8 Aug 2010 16:20:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78GKW4f016272; Sun, 8 Aug 2010 16:20:32 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78GKWlQ016270; Sun, 8 Aug 2010 16:20:32 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201008081620.o78GKWlQ016270@svn.freebsd.org> From: Gavin Atkinson Date: Sun, 8 Aug 2010 16:20: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: r211077 - head/release/picobsd/tinyware/login 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, 08 Aug 2010 16:20:32 -0000 Author: gavin Date: Sun Aug 8 16:20:32 2010 New Revision: 211077 URL: http://svn.freebsd.org/changeset/base/211077 Log: Correct two error messages to match the failure they are reporting. MFC after: 1 week Modified: head/release/picobsd/tinyware/login/pico-login.c Modified: head/release/picobsd/tinyware/login/pico-login.c ============================================================================== --- head/release/picobsd/tinyware/login/pico-login.c Sun Aug 8 15:44:43 2010 (r211076) +++ head/release/picobsd/tinyware/login/pico-login.c Sun Aug 8 16:20:32 2010 (r211077) @@ -538,10 +538,10 @@ main(argc, argv) * devices, we just clear them. */ if (chflags(ttyn, 0) && errno != EOPNOTSUPP) - syslog(LOG_ERR, "chmod(%s): %m", ttyn); + syslog(LOG_ERR, "chflags(%s): %m", ttyn); if (chown(ttyn, pwd->pw_uid, (gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid)) - syslog(LOG_ERR, "chmod(%s): %m", ttyn); + syslog(LOG_ERR, "chown(%s): %m", ttyn); /* From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 16:55:28 2010 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 24FB81065674; Sun, 8 Aug 2010 16:55:28 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 140508FC08; Sun, 8 Aug 2010 16:55:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78GtRqf024066; Sun, 8 Aug 2010 16:55:27 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78GtR4D024064; Sun, 8 Aug 2010 16:55:27 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201008081655.o78GtR4D024064@svn.freebsd.org> From: Gavin Atkinson Date: Sun, 8 Aug 2010 16:55: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: r211079 - head/release/picobsd/tinyware/login 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, 08 Aug 2010 16:55:28 -0000 Author: gavin Date: Sun Aug 8 16:55:27 2010 New Revision: 211079 URL: http://svn.freebsd.org/changeset/base/211079 Log: Merge r114010 of head/usr.bin/login/login.c into PicoBSD's login.c: Correct the login.conf variable name used for obtaining the login prompt. PR: conf/44717 (indirectly) Spotted by: gcooper MFC after: 1 week Modified: head/release/picobsd/tinyware/login/pico-login.c Modified: head/release/picobsd/tinyware/login/pico-login.c ============================================================================== --- head/release/picobsd/tinyware/login/pico-login.c Sun Aug 8 16:52:47 2010 (r211078) +++ head/release/picobsd/tinyware/login/pico-login.c Sun Aug 8 16:55:27 2010 (r211079) @@ -279,7 +279,8 @@ main(argc, argv) * Get "login-retries" & "login-backoff" from default class */ lc = login_getclass(NULL); - prompt = login_getcapstr(lc, "prompt", DEFAULT_PROMPT, DEFAULT_PROMPT); + prompt = login_getcapstr(lc, "login_prompt", + DEFAULT_PROMPT, DEFAULT_PROMPT); passwd_prompt = login_getcapstr(lc, "passwd_prompt", DEFAULT_PASSWD_PROMPT, DEFAULT_PASSWD_PROMPT); retries = login_getcapnum(lc, "login-retries", DEFAULT_RETRIES, From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 17:03:23 2010 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 A621C1065676; Sun, 8 Aug 2010 17:03:23 +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 950018FC1E; Sun, 8 Aug 2010 17:03:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78H3N4Q025838; Sun, 8 Aug 2010 17:03:23 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78H3NP5025836; Sun, 8 Aug 2010 17:03:23 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201008081703.o78H3NP5025836@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 8 Aug 2010 17:03: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: r211080 - head/tools/regression/bin/sh/expansion 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, 08 Aug 2010 17:03:23 -0000 Author: jilles Date: Sun Aug 8 17:03:23 2010 New Revision: 211080 URL: http://svn.freebsd.org/changeset/base/211080 Log: sh: Add more testcases for ${var:-word}. Whether POSIX requires these is unclear. They pass with 8-stable sh as well. Added: head/tools/regression/bin/sh/expansion/plus-minus4.0 (contents, props changed) Added: head/tools/regression/bin/sh/expansion/plus-minus4.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/plus-minus4.0 Sun Aug 8 17:03:23 2010 (r211080) @@ -0,0 +1,38 @@ +# $FreeBSD$ + +# These may be a bit unclear in the POSIX spec or the proposed revisions, +# and conflict with bash's interpretation, but I think ksh93's interpretation +# makes most sense. In particular, it makes no sense to me that single-quotes +# must match but are not removed. + +e= q='?' a='*' t=texttext s='ast*que?non' p='/et[c]/' w='a b c' b='{{(#)}}' +h='##' +failures='' +ok='' + +testcase() { + code="$1" + expected="$2" + oIFS="$IFS" + eval "$code" + IFS='|' + result="$#|$*" + IFS="$oIFS" + if [ "x$result" = "x$expected" ]; then + ok=x$ok + else + failures=x$failures + echo "For $code, expected $expected actual $result" + fi +} + +testcase 'set -- ${e:-'"'"'}'"'"'}' '1|}' +testcase "set -- \${e:-\\'}" "1|'" +testcase "set -- \${e:-\\'\\'}" "1|''" +testcase "set -- \"\${e:-'}\"" "1|'" +testcase "set -- \"\${e:-'}'}\"" "1|''}" +testcase "set -- \"\${e:-''}\"" "1|''" +testcase 'set -- ${e:-\a}' '1|a' +testcase 'set -- "${e:-\a}"' '1|\a' + +test "x$failures" = x From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 19:08:00 2010 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 67748106566B; Sun, 8 Aug 2010 19:08:00 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5611D8FC16; Sun, 8 Aug 2010 19:08:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78J80av052651; Sun, 8 Aug 2010 19:08:00 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78J80QE052650; Sun, 8 Aug 2010 19:08:00 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201008081908.o78J80QE052650@svn.freebsd.org> From: Gavin Atkinson Date: Sun, 8 Aug 2010 19:08:00 +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: r211081 - stable/7/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: Sun, 08 Aug 2010 19:08:00 -0000 Author: gavin Date: Sun Aug 8 19:07:59 2010 New Revision: 211081 URL: http://svn.freebsd.org/changeset/base/211081 Log: Fix mismerge in r211035. Pointy hat: me Modified: stable/7/sys/dev/usb/u3g.c Modified: stable/7/sys/dev/usb/u3g.c ============================================================================== --- stable/7/sys/dev/usb/u3g.c Sun Aug 8 17:03:23 2010 (r211080) +++ stable/7/sys/dev/usb/u3g.c Sun Aug 8 19:07:59 2010 (r211081) @@ -194,7 +194,7 @@ static const struct u3g_dev_type_s u3g_d {{ USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CGU628 }, U3GSP_HSDPA, U3GINIT_CMOTECH }, {{ USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_DISK }, U3GSP_HSDPA, U3GINIT_NONE }, /* OEM: Longcheer */ - { USB_VENDOR_LONGCHEER, USB_PRODUCT_LONGCHEER_WM66 }, U3GSP_HSDPA, U3GINIT_HUAWEI }, + {{ USB_VENDOR_LONGCHEER, USB_PRODUCT_LONGCHEER_WM66 }, U3GSP_HSDPA, U3GINIT_HUAWEI }, }; #define u3g_lookup(v, p) ((const struct u3g_dev_type_s *)usb_lookup(u3g_devs, v, p)) From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 20:34:53 2010 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 B4A9F106566B; Sun, 8 Aug 2010 20:34:53 +0000 (UTC) (envelope-from dwmalone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A368A8FC0C; Sun, 8 Aug 2010 20:34:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78KYrhg070960; Sun, 8 Aug 2010 20:34:53 GMT (envelope-from dwmalone@svn.freebsd.org) Received: (from dwmalone@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78KYrOd070957; Sun, 8 Aug 2010 20:34:53 GMT (envelope-from dwmalone@svn.freebsd.org) Message-Id: <201008082034.o78KYrOd070957@svn.freebsd.org> From: David Malone Date: Sun, 8 Aug 2010 20:34: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: r211082 - 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: Sun, 08 Aug 2010 20:34:53 -0000 Author: dwmalone Date: Sun Aug 8 20:34:53 2010 New Revision: 211082 URL: http://svn.freebsd.org/changeset/base/211082 Log: Don't pass sizeof(u_int) to an argument of SYSCLT_PROC that ends up not being used. Modified: head/sys/amd64/amd64/tsc.c head/sys/i386/i386/tsc.c Modified: head/sys/amd64/amd64/tsc.c ============================================================================== --- head/sys/amd64/amd64/tsc.c Sun Aug 8 19:07:59 2010 (r211081) +++ head/sys/amd64/amd64/tsc.c Sun Aug 8 20:34:53 2010 (r211082) @@ -222,7 +222,7 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_A } SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_QUAD | CTLFLAG_RW, - 0, sizeof(u_int), sysctl_machdep_tsc_freq, "QU", ""); + 0, 0, sysctl_machdep_tsc_freq, "QU", ""); static unsigned tsc_get_timecount(struct timecounter *tc) Modified: head/sys/i386/i386/tsc.c ============================================================================== --- head/sys/i386/i386/tsc.c Sun Aug 8 19:07:59 2010 (r211081) +++ head/sys/i386/i386/tsc.c Sun Aug 8 20:34:53 2010 (r211082) @@ -250,7 +250,7 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_A } SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_QUAD | CTLFLAG_RW, - 0, sizeof(u_int), sysctl_machdep_tsc_freq, "QU", ""); + 0, 0, sysctl_machdep_tsc_freq, "QU", ""); static unsigned tsc_get_timecount(struct timecounter *tc) From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 20:53:01 2010 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 04163106564A; Sun, 8 Aug 2010 20:53:01 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E76E18FC15; Sun, 8 Aug 2010 20:53:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78Kr01C074949; Sun, 8 Aug 2010 20:53:00 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78Kr0oW074947; Sun, 8 Aug 2010 20:53:00 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201008082053.o78Kr0oW074947@svn.freebsd.org> From: Gavin Atkinson Date: Sun, 8 Aug 2010 20:53: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: r211083 - 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, 08 Aug 2010 20:53:01 -0000 Author: gavin Date: Sun Aug 8 20:53:00 2010 New Revision: 211083 URL: http://svn.freebsd.org/changeset/base/211083 Log: The PL2302X can support any baud rate <= 6Mbps, allow any rate to be set. PR: usb/128324 Submitted by: Mike Durian (original patch) MFC after: 2 weeks Modified: head/sys/dev/usb/serial/uplcom.c Modified: head/sys/dev/usb/serial/uplcom.c ============================================================================== --- head/sys/dev/usb/serial/uplcom.c Sun Aug 8 20:34:53 2010 (r211082) +++ head/sys/dev/usb/serial/uplcom.c Sun Aug 8 20:53:00 2010 (r211083) @@ -599,25 +599,33 @@ static const int32_t uplcom_rates[] = { static int uplcom_pre_param(struct ucom_softc *ucom, struct termios *t) { + struct uplcom_softc *sc = ucom->sc_parent; uint8_t i; DPRINTF("\n"); - /* check requested baud rate */ - - for (i = 0;; i++) { - - if (i != N_UPLCOM_RATES) { - if (uplcom_rates[i] == t->c_ospeed) { - break; - } - } else { - DPRINTF("invalid baud rate (%d)\n", t->c_ospeed); - return (EIO); + /** + * Check requested baud rate. + * + * The PL2303 can only set specific baud rates, up to 1228800 baud. + * The PL2303X can set any baud rate up to 6Mb. + * The PL2303HX rev. D can set any baud rate up to 12Mb. + * + * XXX: We currently cannot identify the PL2303HX rev. D, so treat + * it the same as the PL2303X. + */ + if (sc->sc_chiptype == TYPE_PL2303) { + for (i = 0; i < N_UPLCOM_RATES; i++) { + if (uplcom_rates[i] == t->c_ospeed) + return (0); } + } else { + if (t->c_ospeed <= 6000000) + return (0); } - return (0); + DPRINTF("uplcom_param: bad baud rate (%d)\n", t->c_ospeed); + return (EIO); } static void From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 21:04:28 2010 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 14911106564A; Sun, 8 Aug 2010 21:04:28 +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 03CE78FC0A; Sun, 8 Aug 2010 21:04:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78L4R20077545; Sun, 8 Aug 2010 21:04:27 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78L4Rdw077543; Sun, 8 Aug 2010 21:04:27 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201008082104.o78L4Rdw077543@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 8 Aug 2010 21:04: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: r211084 - head/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: Sun, 08 Aug 2010 21:04:28 -0000 Author: jilles Date: Sun Aug 8 21:04:27 2010 New Revision: 211084 URL: http://svn.freebsd.org/changeset/base/211084 Log: Remove unnecessary duplicate letters in mksyntax.c, the table elements would just be overwritten twice. Modified: head/bin/sh/mksyntax.c Modified: head/bin/sh/mksyntax.c ============================================================================== --- head/bin/sh/mksyntax.c Sun Aug 8 20:53:00 2010 (r211083) +++ head/bin/sh/mksyntax.c Sun Aug 8 21:04:27 2010 (r211084) @@ -241,8 +241,8 @@ main(int argc __unused, char **argv __un filltable("0"); fputs("\n/* character classification table */\n", cfile); add("0123456789", "ISDIGIT"); - add("abcdefghijklmnopqrstucvwxyz", "ISLOWER"); - add("ABCDEFGHIJKLMNOPQRSTUCVWXYZ", "ISUPPER"); + add("abcdefghijklmnopqrstuvwxyz", "ISLOWER"); + add("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ISUPPER"); add("_", "ISUNDER"); add("#?$!-*@", "ISSPECL"); print("is_type"); From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 21:07:19 2010 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 6A9F5106566B; Sun, 8 Aug 2010 21:07:19 +0000 (UTC) (envelope-from olli@fromme.com) Received: from haluter.fromme.com (haluter.fromme.com [212.17.241.231]) by mx1.freebsd.org (Postfix) with ESMTP id E4EC18FC0C; Sun, 8 Aug 2010 21:07:18 +0000 (UTC) Received: from haluter.fromme.com (irc_sucks@localhost [127.0.0.1]) by haluter.fromme.com (8.14.3/8.14.3) with ESMTP id o78KbLdP022323; Sun, 8 Aug 2010 22:37:28 +0200 (CEST) (envelope-from olli@fromme.com) Received: (from olli@localhost) by haluter.fromme.com (8.14.3/8.14.3/Submit) id o78KbLDt022321; Sun, 8 Aug 2010 22:37:21 +0200 (CEST) (envelope-from olli) From: Oliver Fromme Message-Id: <201008082037.o78KbLDt022321@haluter.fromme.com> To: imp@bsdimp.com (M. Warner Losh) Date: Sun, 8 Aug 2010 22:37:20 +0200 (CEST) In-Reply-To: <20100807.205058.260300877050427878.imp@bsdimp.com> X-Mailer: ELM [version 2.5 PL8] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (haluter.fromme.com [127.0.0.1]); Sun, 08 Aug 2010 22:37:28 +0200 (CEST) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, olli@FreeBSD.org Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 08 Aug 2010 21:07:19 -0000 M. Warner Losh wrote: > In message: <201008071620.o77GKDBb091327@svn.freebsd.org> > Oliver Fromme writes: > : Author: olli > : Date: Sat Aug 7 16:20:12 2010 > : New Revision: 211023 > : URL: http://svn.freebsd.org/changeset/base/211023 > : Modified: head/usr.sbin/syslogd/Makefile > : ============================================================================== > : --- head/usr.sbin/syslogd/Makefile Sat Aug 7 16:14:40 2010 (r211022) > : +++ head/usr.sbin/syslogd/Makefile Sat Aug 7 16:20:12 2010 (r211023) > : @@ -12,7 +12,7 @@ SRCS= syslogd.c ttymsg.c > : DPADD= ${LIBUTIL} > : LDADD= -lutil > : > : -WARNS?= 3 > : +WARNS?= 6 > : > : .if ${MK_INET6_SUPPORT} != "no" > : CFLAGS+= -DINET6 > > This breaks MIPS, so I've reverted it. Please make sure that all > architectures work when bumping up WARNS. Thanks for fixing it for me. I did make the universe check, but apparently I did something wrong, so I didn't notice the problem. I'm sorry for that. Best regards Oliver -- ``We are all but compressed light'' (Albert Einstein) From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 21:19:39 2010 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 68C4E1065675 for ; Sun, 8 Aug 2010 21:19:39 +0000 (UTC) (envelope-from cperciva@freebsd.org) Received: from xps.daemonology.net (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx2.freebsd.org (Postfix) with SMTP id E0A7C201C47 for ; Sun, 8 Aug 2010 21:19:38 +0000 (UTC) Received: (qmail 1426 invoked from network); 8 Aug 2010 21:19:38 -0000 Received: from unknown (HELO xps.daemonology.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2010 21:19:38 -0000 Message-ID: <4C5F1F69.9020108@freebsd.org> Date: Sun, 08 Aug 2010 14:19:37 -0700 From: Colin Percival User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.11) Gecko/20100803 Thunderbird/3.0.6 MIME-Version: 1.0 To: Jilles Tjoelker References: <201008082104.o78L4Rdw077543@svn.freebsd.org> In-Reply-To: <201008082104.o78L4Rdw077543@svn.freebsd.org> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211084 - head/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: Sun, 08 Aug 2010 21:19:39 -0000 On 08/08/10 14:04, Jilles Tjoelker wrote: > Log: > Remove unnecessary duplicate letters in mksyntax.c, > the table elements would just be overwritten twice. > - add("abcdefghijklmnopqrstucvwxyz", "ISLOWER"); > - add("ABCDEFGHIJKLMNOPQRSTUCVWXYZ", "ISUPPER"); > + add("abcdefghijklmnopqrstuvwxyz", "ISLOWER"); > + add("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ISUPPER"); Ok, I have to wonder: Why was there ever the extra 'C' between 'U' and 'V'? It seems that it has been there ever since 4.4-Lite, but I don't have access to historical sources beyond that point. -- Colin Percival Security Officer, FreeBSD | freebsd.org | The power to serve Founder / author, Tarsnap | tarsnap.com | Online backups for the truly paranoid From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 21:25:55 2010 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 058791065675; Sun, 8 Aug 2010 21:25:55 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id B97688FC1E; Sun, 8 Aug 2010 21:25:54 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:5929:492e:541:20eb] (unknown [IPv6:2001:7b8:3a7:0:5929:492e:541:20eb]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 0C8605C43; Sun, 8 Aug 2010 23:25:53 +0200 (CEST) Message-ID: <4C5F20E6.9050809@andric.com> Date: Sun, 08 Aug 2010 23:25:58 +0200 From: Dimitry Andric User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.9pre) Gecko/20100803 Lanikai/3.1.3pre MIME-Version: 1.0 To: Colin Percival References: <201008082104.o78L4Rdw077543@svn.freebsd.org> <4C5F1F69.9020108@freebsd.org> In-Reply-To: <4C5F1F69.9020108@freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Jilles Tjoelker , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211084 - head/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: Sun, 08 Aug 2010 21:25:55 -0000 On 2010-08-08 23:19, Colin Percival wrote: > On 08/08/10 14:04, Jilles Tjoelker wrote: >> Log: >> Remove unnecessary duplicate letters in mksyntax.c, >> the table elements would just be overwritten twice. >> - add("abcdefghijklmnopqrstucvwxyz", "ISLOWER"); >> - add("ABCDEFGHIJKLMNOPQRSTUCVWXYZ", "ISUPPER"); >> + add("abcdefghijklmnopqrstuvwxyz", "ISLOWER"); >> + add("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ISUPPER"); > > Ok, I have to wonder: Why was there ever the extra 'C' between 'U' and 'V'? > It seems that it has been there ever since 4.4-Lite, but I don't have access > to historical sources beyond that point. My first guess would be a typo, since C is next to V on most keyboard layouts... :) From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 21:26:22 2010 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 C4EC8106566C; Sun, 8 Aug 2010 21:26:22 +0000 (UTC) (envelope-from gavin@ury.york.ac.uk) Received: from gse-mta-27.emailfiltering.com (gse-mta-27-tx.emailfiltering.com [194.116.198.158]) by mx1.freebsd.org (Postfix) with ESMTP id DE1D48FC1C; Sun, 8 Aug 2010 21:26:21 +0000 (UTC) Received: from mail-gw12.york.ac.uk ([144.32.129.162]) by gse-mta-27.emailfiltering.com with emfmta (version 4.5.0.261) by TLS id 702852408 for imp@bsdimp.com;bb1c50db213b9153; Sun, 08 Aug 2010 22:26:08 +0100 Received: from ury.york.ac.uk ([144.32.108.81]:58304) by mail-gw12.york.ac.uk with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1OiDNf-0001r9-JA; Sun, 08 Aug 2010 22:26:07 +0100 Received: from gavin (helo=localhost) by ury.york.ac.uk with local-esmtp (Exim 4.72) (envelope-from ) id 1OiDNf-0006YI-CT; Sun, 08 Aug 2010 22:26:07 +0100 Date: Sun, 8 Aug 2010 22:26:07 +0100 (BST) From: Gavin Atkinson X-X-Sender: gavin@ury.york.ac.uk To: "M. Warner Losh" In-Reply-To: <20100807.204946.244264502672924047.imp@bsdimp.com> Message-ID: References: <201008071608.o77G8bNN088653@svn.freebsd.org> <20100807.204946.244264502672924047.imp@bsdimp.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r211021 - 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: Sun, 08 Aug 2010 21:26:22 -0000 On Sat, 7 Aug 2010, M. Warner Losh wrote: > In message: <201008071608.o77G8bNN088653@svn.freebsd.org> > Gavin Atkinson writes: > : Author: gavin > : Date: Sat Aug 7 16:08:37 2010 > : New Revision: 211021 > : URL: http://svn.freebsd.org/changeset/base/211021 > : > : Log: > : Sort this file a little better: the vendors are supposed to be sorted by > : vendor ID in the vendor section, and by symbolic name in the product > : section. Products are sorted by product ID. While here, get rid of a > : duplicate Microsoft Mouse entry, revealed by sorting. > > I thought products were sorted by the ID number, not the ID name. Yes, within a manufacturer, products should be sorted by ID. Each manufacturer section is sorted by the symbolic manufacturer name, though. I'm not which one of us is misunderstanding the other - do you think my change is somehow wrong? Thanks, Gavin From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 21:36:26 2010 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 A6B771065677 for ; Sun, 8 Aug 2010 21:36:26 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 315318FC17 for ; Sun, 8 Aug 2010 21:36:25 +0000 (UTC) Received: (qmail 1283 invoked by uid 399); 8 Aug 2010 21:36:25 -0000 Received: from localhost (HELO lap.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 8 Aug 2010 21:36:25 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4C5F2358.1060902@FreeBSD.org> Date: Sun, 08 Aug 2010 14:36:24 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.8) Gecko/20100807 Thunderbird/3.1.2 MIME-Version: 1.0 To: Colin Percival References: <201008082104.o78L4Rdw077543@svn.freebsd.org> <4C5F1F69.9020108@freebsd.org> In-Reply-To: <4C5F1F69.9020108@freebsd.org> X-Enigmail-Version: 1.1.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Jilles Tjoelker , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211084 - head/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: Sun, 08 Aug 2010 21:36:26 -0000 On 08/08/2010 14:19, Colin Percival wrote: > On 08/08/10 14:04, Jilles Tjoelker wrote: >> Log: >> Remove unnecessary duplicate letters in mksyntax.c, Boo! >> the table elements would just be overwritten twice. >> - add("abcdefghijklmnopqrstucvwxyz", "ISLOWER"); >> - add("ABCDEFGHIJKLMNOPQRSTUCVWXYZ", "ISUPPER"); >> + add("abcdefghijklmnopqrstuvwxyz", "ISLOWER"); >> + add("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ISUPPER"); > > Ok, I have to wonder: Why was there ever the extra 'C' between 'U' and 'V'? > It seems that it has been there ever since 4.4-Lite, but I don't have access > to historical sources beyond that point. I think y'all are forgetting where the B in BSD comes from. Doug -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ Computers are useless. They can only give you answers. -- Pablo Picasso From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 21:41:59 2010 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 30E1D106567A; Sun, 8 Aug 2010 21:41:59 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id DECCA8FC29; Sun, 8 Aug 2010 21:41:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o78LceRq046532; Sun, 8 Aug 2010 15:38:40 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 08 Aug 2010 15:39:14 -0600 (MDT) Message-Id: <20100808.153914.769051483995699249.imp@bsdimp.com> To: gavin@FreeBSD.org From: "M. Warner Losh" In-Reply-To: References: <201008071608.o77G8bNN088653@svn.freebsd.org> <20100807.204946.244264502672924047.imp@bsdimp.com> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 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 Subject: Re: svn commit: r211021 - 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: Sun, 08 Aug 2010 21:41:59 -0000 In message: Gavin Atkinson writes: : On Sat, 7 Aug 2010, M. Warner Losh wrote: : > In message: <201008071608.o77G8bNN088653@svn.freebsd.org> : > Gavin Atkinson writes: : > : Author: gavin : > : Date: Sat Aug 7 16:08:37 2010 : > : New Revision: 211021 : > : URL: http://svn.freebsd.org/changeset/base/211021 : > : : > : Log: : > : Sort this file a little better: the vendors are supposed to be sorted by : > : vendor ID in the vendor section, and by symbolic name in the product : > : section. Products are sorted by product ID. While here, get rid of a : > : duplicate Microsoft Mouse entry, revealed by sorting. : > : > I thought products were sorted by the ID number, not the ID name. : : Yes, within a manufacturer, products should be sorted by ID. Each : manufacturer section is sorted by the symbolic manufacturer name, though. Within each product section, the products are sorted by numeric id, not symbolic id. That's how it was when I was maintaining this file, and is how pccarddevs also works. eg: product ALCOR SDCR_6335 0x6335 SD/MMC Card Reader product ALCOR SDCR_6362 0x6362 SD/MMC Card Reader product ALCOR TRANSCEND 0x6387 Transcend JetFlash Drive product ALCOR MA_KBD_HUB 0x9213 MacAlly Kbd Hub product ALCOR AU9814 0x9215 AU9814 Hub product ALCOR UMCR_9361 0x9361 USB Multimedia Card Reader product ALCOR SM_KBD 0x9410 MicroConnectors/StrongMan Keyboard product ALCOR NEC_KBD_HUB 0x9472 NEC Kbd Hub product ALCOR AU6390 0x6390 AU6390 USB-IDE converter has the last one out of order only (it should be sorted 4th in this list). : I'm not which one of us is misunderstanding the other - do you think my : change is somehow wrong? I think your change misorders things, unless I'm misreading it. It sorts based on symbolic ID rather than numeric ID. Warner From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 21:41:59 2010 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 B38271065673; Sun, 8 Aug 2010 21:41:59 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 71CAA8FC1D; Sun, 8 Aug 2010 21:41:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o78LZYZX046519; Sun, 8 Aug 2010 15:35:34 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 08 Aug 2010 15:36:08 -0600 (MDT) Message-Id: <20100808.153608.1142818667055052395.imp@bsdimp.com> To: olli@fromme.com From: "M. Warner Losh" In-Reply-To: <201008082037.o78KbLDt022321@haluter.fromme.com> References: <20100807.205058.260300877050427878.imp@bsdimp.com> <201008082037.o78KbLDt022321@haluter.fromme.com> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 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, olli@FreeBSD.org Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 08 Aug 2010 21:41:59 -0000 In message: <201008082037.o78KbLDt022321@haluter.fromme.com> Oliver Fromme writes: : : M. Warner Losh wrote: : > In message: <201008071620.o77GKDBb091327@svn.freebsd.org> : > Oliver Fromme writes: : > : Author: olli : > : Date: Sat Aug 7 16:20:12 2010 : > : New Revision: 211023 : > : URL: http://svn.freebsd.org/changeset/base/211023 : > : Modified: head/usr.sbin/syslogd/Makefile : > : ============================================================================== : > : --- head/usr.sbin/syslogd/Makefile Sat Aug 7 16:14:40 2010 (r211022) : > : +++ head/usr.sbin/syslogd/Makefile Sat Aug 7 16:20:12 2010 (r211023) : > : @@ -12,7 +12,7 @@ SRCS= syslogd.c ttymsg.c : > : DPADD= ${LIBUTIL} : > : LDADD= -lutil : > : : > : -WARNS?= 3 : > : +WARNS?= 6 : > : : > : .if ${MK_INET6_SUPPORT} != "no" : > : CFLAGS+= -DINET6 : > : > This breaks MIPS, so I've reverted it. Please make sure that all : > architectures work when bumping up WARNS. : : Thanks for fixing it for me. : : I did make the universe check, but apparently I did something : wrong, so I didn't notice the problem. I'm sorry for that. The casting that syslogd does with struct sockaddrFOO is what triggers it. I'm not sure how to fix it, so there's about 6 or 8 programs in the tree that have WARNS lowered to 3 because of it. Warner From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 22:06:34 2010 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 057041065678; Sun, 8 Aug 2010 22:06:34 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id BEC6E8FC1D; Sun, 8 Aug 2010 22:06:33 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 012571DD656; Mon, 9 Aug 2010 00:06:31 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id DE374172C1; Mon, 9 Aug 2010 00:06:31 +0200 (CEST) Date: Mon, 9 Aug 2010 00:06:31 +0200 From: Jilles Tjoelker To: "M. Warner Losh" Message-ID: <20100808220631.GA86477@stack.nl> References: <20100807.205058.260300877050427878.imp@bsdimp.com> <201008082037.o78KbLDt022321@haluter.fromme.com> <20100808.153608.1142818667055052395.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100808.153608.1142818667055052395.imp@bsdimp.com> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, olli@fromme.com Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 08 Aug 2010 22:06:34 -0000 On Sun, Aug 08, 2010 at 03:36:08PM -0600, M. Warner Losh wrote: > In message: <201008082037.o78KbLDt022321@haluter.fromme.com> > Oliver Fromme writes: > : M. Warner Losh wrote: > : > In message: <201008071620.o77GKDBb091327@svn.freebsd.org> > : > Oliver Fromme writes: > : > : Author: olli > : > : Date: Sat Aug 7 16:20:12 2010 > : > : New Revision: 211023 > : > : URL: http://svn.freebsd.org/changeset/base/211023 > : > : Modified: head/usr.sbin/syslogd/Makefile > : > : ============================================================================== > : > : --- head/usr.sbin/syslogd/Makefile Sat Aug 7 16:14:40 2010 (r211022) > : > : +++ head/usr.sbin/syslogd/Makefile Sat Aug 7 16:20:12 2010 (r211023) > : > : @@ -12,7 +12,7 @@ SRCS= syslogd.c ttymsg.c > : > : DPADD= ${LIBUTIL} > : > : LDADD= -lutil > : > : -WARNS?= 3 > : > : +WARNS?= 6 > : > : .if ${MK_INET6_SUPPORT} != "no" > : > : CFLAGS+= -DINET6 > : > This breaks MIPS, so I've reverted it. Please make sure that all > : > architectures work when bumping up WARNS. > : Thanks for fixing it for me. > : I did make the universe check, but apparently I did something > : wrong, so I didn't notice the problem. I'm sorry for that. > The casting that syslogd does with struct sockaddrFOO is what triggers > it. I'm not sure how to fix it, so there's about 6 or 8 programs in > the tree that have WARNS lowered to 3 because of it. This problem is common with programs that use getaddrinfo() and then look into the address family specific parts of the address (it was probably not the intention of the getaddrinfo() API to do this very often). Obviously, when ai_family is the corresponding value, the ai_addr really points to that particular kind of sockaddr, but gcc only knows that struct sockaddr_in and struct sockaddr_in6 have a higher alignment requirement than struct sockaddr. In some cases, the address may already be copied, and making the destination the family-based type or struct sockaddr_storage (which has a high alignment requirement) will avoid problems. In other cases, I propose adding a cast to void * in between, like (struct sockaddr_in *)(void *)ai->ai_addr Note that this workaround must not be applied mindlessly to avoid -Wcast-align, but only when it is known from other information that the object really has that type. If you don't like this workaround, perhaps copy the data to a variable of the correct type. Addresses are not particularly big so the performance hit should not be bad. It is unfortunate to have to miss other warnings because of this. -- Jilles Tjoelker From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 22:19:29 2010 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 D8A76106564A; Sun, 8 Aug 2010 22:19:29 +0000 (UTC) (envelope-from r.c.ladan@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id DBE188FC23; Sun, 8 Aug 2010 22:19:28 +0000 (UTC) Received: by eyh6 with SMTP id 6so3779672eyh.13 for ; Sun, 08 Aug 2010 15:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :organization:user-agent:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=6OsmNcE2zqPxQkCOV1vavA0gI/cPst9l96OdCQOg3YE=; b=SHmZ1gsr6jZ86n6b2uTjZGdkJw99wCMA6gF68hhv3lrkEY0JODr9K/ipLhdV9UqK1a rxPfWb+N8Ld16iXR+vIyl0VCIUKhyoJjRuIKPGrmgycMHdkE3UT9gGg4LStIEEIWR2zI 8iQrC7MufmNYaB35+ahk9Se2GqV2wWBrTjqaI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:organization:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; b=Bnvrp1Di6PYSRm1aAQYaL7jmyY2dx/FM9VlWHfmoCMHz1o0hXpZVdy9qa8ZUL08Y5k nxeADk95Ehz7HEa30vfqm2/UoYJrJ658F7E7K3JhdQZRdf3ZuJOMGXmd8dUePUQukXtd 2y0ETRmPPuxfiIc41b5BOxZAGH9xOav5FaxsQ= Received: by 10.213.15.135 with SMTP id k7mr2099053eba.39.1281304404923; Sun, 08 Aug 2010 14:53:24 -0700 (PDT) Received: from [192.168.1.70] (ip4da3ae31.direct-adsl.nl [77.163.174.49]) by mx.google.com with ESMTPS id u9sm6654007eeh.23.2010.08.08.14.53.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 08 Aug 2010 14:53:23 -0700 (PDT) Sender: =?UTF-8?Q?Ren=C3=A9_Ladan?= Message-ID: <4C5F2752.6070008@freebsd.org> Date: Sun, 08 Aug 2010 23:53:22 +0200 From: Rene Ladan Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; nl-NL; rv:1.9.2.8) Gecko/20100806 Thunderbird/3.1.2 MIME-Version: 1.0 To: Doug Barton References: <201008082104.o78L4Rdw077543@svn.freebsd.org> <4C5F1F69.9020108@freebsd.org> <4C5F2358.1060902@FreeBSD.org> In-Reply-To: <4C5F2358.1060902@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Jilles Tjoelker , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Colin Percival Subject: Re: svn commit: r211084 - head/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: Sun, 08 Aug 2010 22:19:29 -0000 On 08-08-2010 23:36, Doug Barton wrote: > On 08/08/2010 14:19, Colin Percival wrote: >> On 08/08/10 14:04, Jilles Tjoelker wrote: >>> Log: >>> Remove unnecessary duplicate letters in mksyntax.c, > > Boo! > >>> the table elements would just be overwritten twice. >>> - add("abcdefghijklmnopqrstucvwxyz", "ISLOWER"); >>> - add("ABCDEFGHIJKLMNOPQRSTUCVWXYZ", "ISUPPER"); >>> + add("abcdefghijklmnopqrstuvwxyz", "ISLOWER"); >>> + add("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ISUPPER"); >> >> Ok, I have to wonder: Why was there ever the extra 'C' between 'U' and 'V'? >> It seems that it has been there ever since 4.4-Lite, but I don't have access >> to historical sources beyond that point. > > I think y'all are forgetting where the B in BSD comes from. > So the extra C was to form UC as in University of California. Otherwise the extra C wouldn't be in there twice. Rene From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 23:22:55 2010 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 9B40C106566C; Sun, 8 Aug 2010 23:22:55 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A8DD8FC15; Sun, 8 Aug 2010 23:22:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78NMtNV008081; Sun, 8 Aug 2010 23:22:55 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78NMtIG008080; Sun, 8 Aug 2010 23:22:55 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201008082322.o78NMtIG008080@svn.freebsd.org> From: Jamie Gritton Date: Sun, 8 Aug 2010 23:22: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: r211085 - 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: Sun, 08 Aug 2010 23:22:55 -0000 Author: jamie Date: Sun Aug 8 23:22:55 2010 New Revision: 211085 URL: http://svn.freebsd.org/changeset/base/211085 Log: Back out r210974. Any convenience of not typing "persist" is outweighed by the possibility of unintended partially-formed jails. Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Sun Aug 8 21:04:27 2010 (r211084) +++ head/sys/kern/kern_jail.c Sun Aug 8 23:22:55 2010 (r211085) @@ -599,8 +599,6 @@ kern_jail_set(struct thread *td, struct vfs_flagopt(opts, pr_flag_names[fi], &pr_flags, 1 << fi); vfs_flagopt(opts, pr_flag_nonames[fi], &ch_flags, 1 << fi); } - if ((flags & (JAIL_CREATE | JAIL_UPDATE | JAIL_ATTACH)) == JAIL_CREATE) - pr_flags |= PR_PERSIST; ch_flags |= pr_flags; for (fi = 0; fi < sizeof(pr_flag_jailsys) / sizeof(pr_flag_jailsys[0]); fi++) { @@ -630,6 +628,12 @@ kern_jail_set(struct thread *td, struct ch_flags |= pr_flag_jailsys[fi].new | pr_flag_jailsys[fi].disable; } + if ((flags & (JAIL_CREATE | JAIL_UPDATE | JAIL_ATTACH)) == JAIL_CREATE + && !(pr_flags & PR_PERSIST)) { + error = EINVAL; + vfs_opterror(opts, "new jail must persist or attach"); + goto done_errmsg; + } #ifdef VIMAGE if ((flags & JAIL_UPDATE) && (ch_flags & PR_VNET)) { error = EINVAL; From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 23:24:24 2010 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 191F01065673; Sun, 8 Aug 2010 23:24:24 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 088228FC16; Sun, 8 Aug 2010 23:24:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78NONR1008464; Sun, 8 Aug 2010 23:24:23 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78NONoW008462; Sun, 8 Aug 2010 23:24:23 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201008082324.o78NONoW008462@svn.freebsd.org> From: Jamie Gritton Date: Sun, 8 Aug 2010 23:24: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: r211086 - head/usr.sbin/jail 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, 08 Aug 2010 23:24:24 -0000 Author: jamie Date: Sun Aug 8 23:24:23 2010 New Revision: 211086 URL: http://svn.freebsd.org/changeset/base/211086 Log: Back out r210975, which changed documentation to match the now backed-out r210974. Modified: head/usr.sbin/jail/jail.8 Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Sun Aug 8 23:22:55 2010 (r211085) +++ head/usr.sbin/jail/jail.8 Sun Aug 8 23:24:23 2010 (r211086) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 6, 2010 +.Dd January 17, 2010 .Dt JAIL 8 .Os .Sh NAME @@ -333,11 +333,11 @@ where the jail's chroot directory is loc Setting this boolean parameter allows a jail to exist without any processes. Normally, a jail is destroyed as its last process exits. -A new jail created without processes (i.e. the -.Va command -pseudo-parameter) will automatically have +A new jail must have either the .Va persist -set. +parameter or +.Va command +pseudo-parameter set. .It Va cpuset.id The ID of the cpuset associated with this jail (read-only). .It Va dying From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 00:23:58 2010 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 250A7106564A; Mon, 9 Aug 2010 00:23:58 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 147F68FC08; Mon, 9 Aug 2010 00:23:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o790NvSn021658; Mon, 9 Aug 2010 00:23:57 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o790NvVn021656; Mon, 9 Aug 2010 00:23:57 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008090023.o790NvVn021656@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 Aug 2010 00:23: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: r211087 - 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: Mon, 09 Aug 2010 00:23:58 -0000 Author: attilio Date: Mon Aug 9 00:23:57 2010 New Revision: 211087 URL: http://svn.freebsd.org/changeset/base/211087 Log: The r208165 fixed a bug related to unsigned integer overflowing for the number of CPUs detection. However, that was not mention at all, the problem was not reported, the patch has not been MFCed and the fix is mostly improper. Fix the original overflow (caused when 32 CPUs must be detected) by just using a different mathematical computation (it also makes more explicit the size of operands involved, which is good in the moment waiting for a more complete support for a large number of CPUs). PR: kern/148698 Submitted by: Joe Landers Tested by: gianni MFC after: 10 days Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Sun Aug 8 23:24:23 2010 (r211086) +++ head/sys/kern/subr_smp.c Mon Aug 9 00:23:57 2010 (r211087) @@ -504,10 +504,7 @@ smp_topo_none(void) top = &group[0]; top->cg_parent = NULL; top->cg_child = NULL; - if (mp_ncpus == sizeof(top->cg_mask) * 8) - top->cg_mask = -1; - else - top->cg_mask = (1 << mp_ncpus) - 1; + top->cg_mask = ~0U >> (32 - mp_ncpus); top->cg_count = mp_ncpus; top->cg_children = 0; top->cg_level = CG_SHARE_NONE; From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 00:26:08 2010 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 DBCA1106566B; Mon, 9 Aug 2010 00:26:07 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 409138FC0A; Mon, 9 Aug 2010 00:26:06 +0000 (UTC) Received: by qwg5 with SMTP id 5so5667370qwg.13 for ; Sun, 08 Aug 2010 17:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=XuSMSxdA8ElXCwQLdjXWxXVPkXS1su0j/lMFuIo4r4o=; b=Gz3f2e1I+V0hwWZmZH5z41W9Jg6SfVwhBfjODsZhrgQr4tW5e0MWWK03+MFfwJFSos 2orA1jkns2jvdRYXZ3C31quPPV2nPoTf1Aqs3bzZdyW/8sCpPJwpOiZpsUZsp4vxdtzr hOOgzurOqYWTeHlXuVaxx+5IG4YBQz3LigKwg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=N4amAYP+olhaXQ85Nf0T0gQkQmR9GAqisdtbiaPwb12VYxZ2Uw3bW/jekzTpUgJVlP PmST1DdHUZXAkQq1/E08x4KE/DWynYIfXAZ2sJRMVEHd/oeCgqb5DXJiQ7UK0zHo41cS Y+jrsYo6rI+MH+AJVsVizNrEv6lmnQeAKStc8= MIME-Version: 1.0 Received: by 10.229.191.71 with SMTP id dl7mr6735250qcb.184.1281312112404; Sun, 08 Aug 2010 17:01:52 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.251.6 with HTTP; Sun, 8 Aug 2010 17:01:52 -0700 (PDT) In-Reply-To: <201005161943.o4GJhnTo096839@svn.freebsd.org> References: <201005161943.o4GJhnTo096839@svn.freebsd.org> Date: Mon, 9 Aug 2010 02:01:52 +0200 X-Google-Sender-Auth: PQ85tywercMHlUk9f6Vo6UmT5aQ Message-ID: From: Attilio Rao To: Randall Stewart Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, John Baldwin , "Jayachandran C." , svn-src-all@freebsd.org, Joe Landers , sbruno@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r208165 - in head/sys: kern mips/conf mips/include mips/mips mips/rmi mips/rmi/dev/xlr 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, 09 Aug 2010 00:26:08 -0000 2010/5/16 Randall Stewart : > Author: rrs > Date: Sun May 16 19:43:48 2010 > New Revision: 208165 > URL: http://svn.freebsd.org/changeset/base/208165 > > Log: > =C2=A0This pushes all of JC's patches that I have in place. I > =C2=A0am now able to run 32 cores ok.. but I still will hang > =C2=A0on buildworld with a NFS problem. I suspect I am missing > =C2=A0a patch for the netlogic rge driver. > > =C2=A0JC check and see if I am missing anything except your > =C2=A0core-mask changes > Modified: head/sys/kern/subr_smp.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/subr_smp.c =C2=A0 =C2=A0Sun May 16 19:25:56 2010 =C2=A0= =C2=A0 =C2=A0 =C2=A0(r208164) > +++ head/sys/kern/subr_smp.c =C2=A0 =C2=A0Sun May 16 19:43:48 2010 =C2=A0= =C2=A0 =C2=A0 =C2=A0(r208165) > @@ -503,7 +503,10 @@ smp_topo_none(void) > =C2=A0 =C2=A0 =C2=A0 =C2=A0top =3D &group[0]; > =C2=A0 =C2=A0 =C2=A0 =C2=A0top->cg_parent =3D NULL; > =C2=A0 =C2=A0 =C2=A0 =C2=A0top->cg_child =3D NULL; > - =C2=A0 =C2=A0 =C2=A0 top->cg_mask =3D (1 << mp_ncpus) - 1; > + =C2=A0 =C2=A0 =C2=A0 if (mp_ncpus =3D=3D sizeof(top->cg_mask) * 8) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 top->cg_mask =3D -1; > + =C2=A0 =C2=A0 =C2=A0 else > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 top->cg_mask =3D (1 <<= mp_ncpus) - 1; > =C2=A0 =C2=A0 =C2=A0 =C2=A0top->cg_count =3D mp_ncpus; > =C2=A0 =C2=A0 =C2=A0 =C2=A0top->cg_children =3D 0; > =C2=A0 =C2=A0 =C2=A0 =C2=A0top->cg_level =3D CG_SHARE_NONE; > ... and this is why I particulary hate big commits with complete lack of technical details. This particulary chunk was supposed to fix a nasty and completely MI bug that some users have already met (kern/148698). The complete lack of details didn't help in identify the issue neither that it was a valuable fix. The fix is, however, improper (there is no clear relationship between the multiplication and why that happens) thus I would rather use what Joe has reported in the PR. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 00:36:23 2010 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 25778106564A; Mon, 9 Aug 2010 00:36:23 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 137938FC1F; Mon, 9 Aug 2010 00:36:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o790aNsJ024466; Mon, 9 Aug 2010 00:36:23 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o790aN48024462; Mon, 9 Aug 2010 00:36:23 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201008090036.o790aN48024462@svn.freebsd.org> From: Matt Jacob Date: Mon, 9 Aug 2010 00:36: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: r211088 - in head/tools/tools/vhba: . mptest 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, 09 Aug 2010 00:36:23 -0000 Author: mjacob Date: Mon Aug 9 00:36:22 2010 New Revision: 211088 URL: http://svn.freebsd.org/changeset/base/211088 Log: Add a multipath oriented test. Added: head/tools/tools/vhba/mptest/ head/tools/tools/vhba/mptest/Makefile (contents, props changed) head/tools/tools/vhba/mptest/vhba_mptest.c (contents, props changed) Modified: head/tools/tools/vhba/Makefile Modified: head/tools/tools/vhba/Makefile ============================================================================== --- head/tools/tools/vhba/Makefile Mon Aug 9 00:23:57 2010 (r211087) +++ head/tools/tools/vhba/Makefile Mon Aug 9 00:36:22 2010 (r211088) @@ -24,6 +24,6 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -SUBDIR= simple medium lots faulty rptluns +SUBDIR= simple medium lots faulty rptluns mptest .include Added: head/tools/tools/vhba/mptest/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/vhba/mptest/Makefile Mon Aug 9 00:36:22 2010 (r211088) @@ -0,0 +1,31 @@ +# $FreeBSD$ +# +# Copyright (c) 2010 by Panasas Inc +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice immediately at the beginning of the file, without modification, +# this list of conditions, and the following disclaimer. +# 2. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# 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. +KMOD= vmptest +SRCS= vhba_mptest.c vhba.c +CFLAGS += -I${.CURDIR}/.. -DVHBA_MOD=\"vmptest\" +VPATH= ${.CURDIR}/.. + +.include Added: head/tools/tools/vhba/mptest/vhba_mptest.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/vhba/mptest/vhba_mptest.c Mon Aug 9 00:36:22 2010 (r211088) @@ -0,0 +1,404 @@ +/*- + * Copyright (c) 2010 by Panasas, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice immediately at the beginning of the file, without modification, + * this list of conditions, and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 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$ */ +/* + * "Faulty" Multipath Device. Creates to devices to be set up as multipath, + * makes one or both of them non existent (or re existent) on demand. + */ +#include "vhba.h" +#include + +#define MAX_TGT 1 +#define MAX_LUN 2 +#define VMP_TIME hz + +#define DISK_SIZE 32 +#define DISK_SHIFT 9 +#define DISK_NBLKS ((DISK_SIZE << 20) >> DISK_SHIFT) +#define PSEUDO_SPT 64 +#define PSEUDO_HDS 64 +#define PSEUDO_SPC (PSEUDO_SPT * PSEUDO_HDS) + +typedef struct { + vhba_softc_t * vhba; + uint8_t * disk; + size_t disk_size; + int luns[2]; + struct callout tick; + struct task qt; +} mptest_t; + +static timeout_t vhba_timer; +static void vhba_task(void *, int); +static void mptest_act(mptest_t *, struct ccb_scsiio *); + +void +vhba_init(vhba_softc_t *vhba) +{ + static mptest_t vhbastatic; + vhbastatic.vhba = vhba; + vhbastatic.disk_size = DISK_SIZE << 20; + vhbastatic.disk = malloc(vhbastatic.disk_size, M_DEVBUF, M_WAITOK|M_ZERO); + vhba->private = &vhbastatic; + callout_init_mtx(&vhbastatic.tick, &vhba->lock, 0); + callout_reset(&vhbastatic.tick, VMP_TIME, vhba_timer, vhba); + TASK_INIT(&vhbastatic.qt, 0, vhba_task, &vhbastatic); +} + +void +vhba_fini(vhba_softc_t *vhba) +{ + mptest_t *vhbas = vhba->private; + callout_stop(&vhbas->tick); + vhba->private = NULL; + free(vhbas->disk, M_DEVBUF); +} + +void +vhba_kick(vhba_softc_t *vhba) +{ + mptest_t *vhbas = vhba->private; + taskqueue_enqueue(taskqueue_swi, &vhbas->qt); +} + +static void +vhba_task(void *arg, int pending) +{ + mptest_t *vhbas = arg; + struct ccb_hdr *ccbh; + + mtx_lock(&vhbas->vhba->lock); + while ((ccbh = TAILQ_FIRST(&vhbas->vhba->actv)) != NULL) { + TAILQ_REMOVE(&vhbas->vhba->actv, ccbh, sim_links.tqe); + mptest_act(vhbas, (struct ccb_scsiio *)ccbh); + } + while ((ccbh = TAILQ_FIRST(&vhbas->vhba->done)) != NULL) { + TAILQ_REMOVE(&vhbas->vhba->done, ccbh, sim_links.tqe); + xpt_done((union ccb *)ccbh); + } + mtx_unlock(&vhbas->vhba->lock); +} + +static void +mptest_act(mptest_t *vhbas, struct ccb_scsiio *csio) +{ + char junk[128]; + cam_status camstatus; + uint8_t *cdb, *ptr, status; + uint32_t data_len; + uint64_t off; + + data_len = 0; + status = SCSI_STATUS_OK; + + memset(&csio->sense_data, 0, sizeof (csio->sense_data)); + cdb = csio->cdb_io.cdb_bytes; + + if (csio->ccb_h.target_id >= MAX_TGT) { + vhba_set_status(&csio->ccb_h, CAM_SEL_TIMEOUT); + TAILQ_INSERT_TAIL(&vhbas->vhba->done, &csio->ccb_h, sim_links.tqe); + return; + } + if ((csio->ccb_h.target_lun >= MAX_LUN || vhbas->luns[csio->ccb_h.target_lun] == 0) && cdb[0] != INQUIRY && cdb[0] != REPORT_LUNS && cdb[0] != REQUEST_SENSE) { + vhba_fill_sense(csio, SSD_KEY_ILLEGAL_REQUEST, 0x25, 0x0); + TAILQ_INSERT_TAIL(&vhbas->vhba->done, &csio->ccb_h, sim_links.tqe); + return; + } + + switch (cdb[0]) { + case MODE_SENSE: + case MODE_SENSE_10: + { + unsigned int nbyte; + uint8_t page = cdb[2] & SMS_PAGE_CODE; + uint8_t pgctl = cdb[2] & SMS_PAGE_CTRL_MASK; + + switch (page) { + case SMS_FORMAT_DEVICE_PAGE: + case SMS_GEOMETRY_PAGE: + case SMS_CACHE_PAGE: + case SMS_CONTROL_MODE_PAGE: + case SMS_ALL_PAGES_PAGE: + break; + default: + vhba_fill_sense(csio, SSD_KEY_ILLEGAL_REQUEST, 0x24, 0x0); + TAILQ_INSERT_TAIL(&vhbas->vhba->done, &csio->ccb_h, sim_links.tqe); + return; + } + memset(junk, 0, sizeof (junk)); + if (cdb[1] & SMS_DBD) { + ptr = &junk[4]; + } else { + ptr = junk; + ptr[3] = 8; + ptr[4] = ((1 << DISK_SHIFT) >> 24) & 0xff; + ptr[5] = ((1 << DISK_SHIFT) >> 16) & 0xff; + ptr[6] = ((1 << DISK_SHIFT) >> 8) & 0xff; + ptr[7] = ((1 << DISK_SHIFT)) & 0xff; + + ptr[8] = (DISK_NBLKS >> 24) & 0xff; + ptr[9] = (DISK_NBLKS >> 16) & 0xff; + ptr[10] = (DISK_NBLKS >> 8) & 0xff; + ptr[11] = DISK_NBLKS & 0xff; + ptr += 12; + } + + if (page == SMS_ALL_PAGES_PAGE || page == SMS_FORMAT_DEVICE_PAGE) { + ptr[0] = SMS_FORMAT_DEVICE_PAGE; + ptr[1] = 24; + if (pgctl != SMS_PAGE_CTRL_CHANGEABLE) { + /* tracks per zone */ + /* ptr[2] = 0; */ + /* ptr[3] = 0; */ + /* alternate sectors per zone */ + /* ptr[4] = 0; */ + /* ptr[5] = 0; */ + /* alternate tracks per zone */ + /* ptr[6] = 0; */ + /* ptr[7] = 0; */ + /* alternate tracks per logical unit */ + /* ptr[8] = 0; */ + /* ptr[9] = 0; */ + /* sectors per track */ + ptr[10] = (PSEUDO_SPT >> 8) & 0xff; + ptr[11] = PSEUDO_SPT & 0xff; + /* data bytes per physical sector */ + ptr[12] = ((1 << DISK_SHIFT) >> 8) & 0xff; + ptr[13] = (1 << DISK_SHIFT) & 0xff; + /* interleave */ + /* ptr[14] = 0; */ + /* ptr[15] = 1; */ + /* track skew factor */ + /* ptr[16] = 0; */ + /* ptr[17] = 0; */ + /* cylinder skew factor */ + /* ptr[18] = 0; */ + /* ptr[19] = 0; */ + /* SSRC, HSEC, RMB, SURF */ + } + ptr += 26; + } + + if (page == SMS_ALL_PAGES_PAGE || page == SMS_GEOMETRY_PAGE) { + ptr[0] = SMS_GEOMETRY_PAGE; + ptr[1] = 24; + if (pgctl != SMS_PAGE_CTRL_CHANGEABLE) { + uint32_t cyl = (DISK_NBLKS + ((PSEUDO_SPC - 1))) / PSEUDO_SPC; + /* number of cylinders */ + ptr[2] = (cyl >> 24) & 0xff; + ptr[3] = (cyl >> 16) & 0xff; + ptr[4] = cyl & 0xff; + /* number of heads */ + ptr[5] = PSEUDO_HDS; + /* starting cylinder- write precompensation */ + /* ptr[6] = 0; */ + /* ptr[7] = 0; */ + /* ptr[8] = 0; */ + /* starting cylinder- reduced write current */ + /* ptr[9] = 0; */ + /* ptr[10] = 0; */ + /* ptr[11] = 0; */ + /* drive step rate */ + /* ptr[12] = 0; */ + /* ptr[13] = 0; */ + /* landing zone cylinder */ + /* ptr[14] = 0; */ + /* ptr[15] = 0; */ + /* ptr[16] = 0; */ + /* RPL */ + /* ptr[17] = 0; */ + /* rotational offset */ + /* ptr[18] = 0; */ + /* medium rotation rate - 7200 RPM */ + ptr[20] = 0x1c; + ptr[21] = 0x20; + } + ptr += 26; + } + + if (page == SMS_ALL_PAGES_PAGE || page == SMS_CACHE_PAGE) { + ptr[0] = SMS_CACHE_PAGE; + ptr[1] = 18; + ptr[2] = 1 << 2; + ptr += 20; + } + + if (page == SMS_ALL_PAGES_PAGE || page == SMS_CONTROL_MODE_PAGE) { + ptr[0] = SMS_CONTROL_MODE_PAGE; + ptr[1] = 10; + if (pgctl != SMS_PAGE_CTRL_CHANGEABLE) { + ptr[3] = 1 << 4; /* unrestricted reordering allowed */ + ptr[8] = 0x75; /* 30000 ms */ + ptr[9] = 0x30; + } + ptr += 12; + } + nbyte = (char *)ptr - &junk[0]; + ptr[0] = nbyte - 4; + + if (cdb[0] == MODE_SENSE) { + data_len = min(cdb[4], csio->dxfer_len); + } else { + uint16_t tw = (cdb[7] << 8) | cdb[8]; + data_len = min(tw, csio->dxfer_len); + } + data_len = min(data_len, nbyte); + if (data_len) { + memcpy(csio->data_ptr, junk, data_len); + } + csio->resid = csio->dxfer_len - data_len; + break; + } + case READ_6: + case READ_10: + case READ_12: + case READ_16: + case WRITE_6: + case WRITE_10: + case WRITE_12: + case WRITE_16: + if (vhba_rwparm(cdb, &off, &data_len, DISK_NBLKS, DISK_SHIFT)) { + vhba_fill_sense(csio, SSD_KEY_ILLEGAL_REQUEST, 0x24, 0x0); + break; + } + if (data_len) { + if ((cdb[0] & 0xf) == 8) { + memcpy(csio->data_ptr, &vhbas->disk[off], data_len); + } else { + memcpy(&vhbas->disk[off], csio->data_ptr, data_len); + } + csio->resid = csio->dxfer_len - data_len; + } else { + csio->resid = csio->dxfer_len; + } + break; + + case READ_CAPACITY: + if (cdb[2] || cdb[3] || cdb[4] || cdb[5]) { + vhba_fill_sense(csio, SSD_KEY_UNIT_ATTENTION, 0x24, 0x0); + break; + } + if (cdb[8] & 0x1) { /* PMI */ + csio->data_ptr[0] = 0xff; + csio->data_ptr[1] = 0xff; + csio->data_ptr[2] = 0xff; + csio->data_ptr[3] = 0xff; + } else { + uint64_t last_blk = DISK_NBLKS - 1; + if (last_blk < 0xffffffffULL) { + csio->data_ptr[0] = (last_blk >> 24) & 0xff; + csio->data_ptr[1] = (last_blk >> 16) & 0xff; + csio->data_ptr[2] = (last_blk >> 8) & 0xff; + csio->data_ptr[3] = (last_blk) & 0xff; + } else { + csio->data_ptr[0] = 0xff; + csio->data_ptr[1] = 0xff; + csio->data_ptr[2] = 0xff; + csio->data_ptr[3] = 0xff; + } + } + csio->data_ptr[4] = ((1 << DISK_SHIFT) >> 24) & 0xff; + csio->data_ptr[5] = ((1 << DISK_SHIFT) >> 16) & 0xff; + csio->data_ptr[6] = ((1 << DISK_SHIFT) >> 8) & 0xff; + csio->data_ptr[7] = ((1 << DISK_SHIFT)) & 0xff; + break; + default: + vhba_default_cmd(csio, MAX_LUN, NULL); + break; + } + if (csio->scsi_status != SCSI_STATUS_OK) { + camstatus = CAM_SCSI_STATUS_ERROR; + if (csio->scsi_status == SCSI_STATUS_CHECK_COND) { + camstatus |= CAM_AUTOSNS_VALID; + } + } else { + csio->scsi_status = SCSI_STATUS_OK; + camstatus = CAM_REQ_CMP; + } + vhba_set_status(&csio->ccb_h, camstatus); + TAILQ_INSERT_TAIL(&vhbas->vhba->done, &csio->ccb_h, sim_links.tqe); +} + +static int vhba_stop_lun; +SYSCTL_INT(_debug, OID_AUTO, vhba_stop_lun, CTLFLAG_RW, &vhba_stop_lun, 0, "stop this lun"); +static int vhba_start_lun = 3; +SYSCTL_INT(_debug, OID_AUTO, vhba_start_lun, CTLFLAG_RW, &vhba_start_lun, 3, "start this lun"); +static int vhba_notify_stop = 1; +SYSCTL_INT(_debug, OID_AUTO, vhba_notify_stop, CTLFLAG_RW, &vhba_notify_stop, 1, "notify when luns go away"); +static int vhba_notify_start = 1; +SYSCTL_INT(_debug, OID_AUTO, vhba_notify_start, CTLFLAG_RW, &vhba_notify_start, 1, "notify when luns arrive"); + +static void +vhba_timer(void *arg) +{ + int lun; + vhba_softc_t *vhba = arg; + mptest_t *vhbas = vhba->private; + if (vhba_stop_lun) { + lun = (vhba_stop_lun & 1)? 0 : 1; + if (lun == 0 || lun == 1) { + if (vhbas->luns[lun]) { + struct cam_path *tp; + if (vhba_notify_stop) { + if (xpt_create_path(&tp, xpt_periph, cam_sim_path(vhba->sim), 0, lun) != CAM_REQ_CMP) { + goto out; + } + vhbas->luns[lun] = 0; + xpt_async(AC_LOST_DEVICE, tp, NULL); + xpt_free_path(tp); + } else { + vhbas->luns[lun] = 0; + } + } + } + vhba_stop_lun &= ~(1 << lun); + } else if (vhba_start_lun) { + lun = (vhba_start_lun & 1)? 0 : 1; + if (lun == 0 || lun == 1) { + if (vhbas->luns[lun] == 0) { + if (vhba_notify_start) { + union ccb *ccb; + ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + goto out; + } + if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(vhba->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + xpt_free_ccb(ccb); + goto out; + } + vhbas->luns[lun] = 1; + xpt_rescan(ccb); + } else { + vhbas->luns[lun] = 1; + } + } + } + vhba_start_lun &= ~(1 << lun); + } +out: + callout_reset(&vhbas->tick, VMP_TIME, vhba_timer, vhba); +} +DEV_MODULE(vhba_mptest, vhba_modprobe, NULL); From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 01:47:09 2010 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 CC4591065679; Mon, 9 Aug 2010 01:47:09 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A170F8FC1D; Mon, 9 Aug 2010 01:47:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o791l9v5040083; Mon, 9 Aug 2010 01:47:09 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o791l9FM040081; Mon, 9 Aug 2010 01:47:09 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008090147.o791l9FM040081@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 9 Aug 2010 01:47:09 +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: r211089 - head/sys/dev/ste 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, 09 Aug 2010 01:47:09 -0000 Author: yongari Date: Mon Aug 9 01:47:09 2010 New Revision: 211089 URL: http://svn.freebsd.org/changeset/base/211089 Log: It seems some old Sundace(now IC Plus Corp.) controllers do not like memory mapped register access. Typical problem from the issue was MII access returned unreliable values. I'm not sure this comes from lack of register flushing in MII access after accessing STE_PHYCTL register though. To address the issue, read hints data that controls which type of memory mapping should be used in driver. ste(4) still prefers memory mapping to io mapping but honor hints entered by user except for controllers that have problems with memory mapping. The hint to use iomapping could be given by adding the following line to /boot/device.hints file. hint.ste.0.prefer_iomap="1" PR: kern/149285 MFC after: 5 days Modified: head/sys/dev/ste/if_ste.c Modified: head/sys/dev/ste/if_ste.c ============================================================================== --- head/sys/dev/ste/if_ste.c Mon Aug 9 00:36:22 2010 (r211088) +++ head/sys/dev/ste/if_ste.c Mon Aug 9 01:47:09 2010 (r211089) @@ -1059,7 +1059,7 @@ ste_attach(device_t dev) struct ste_softc *sc; struct ifnet *ifp; uint16_t eaddr[ETHER_ADDR_LEN / 2]; - int error = 0, pmc, rid; + int error = 0, pmc, prefer_iomap, rid; sc = device_get_softc(dev); sc->ste_dev = dev; @@ -1081,12 +1081,25 @@ ste_attach(device_t dev) */ pci_enable_busmaster(dev); - /* Prefer memory space register mapping over IO space. */ - sc->ste_res_id = PCIR_BAR(1); - sc->ste_res_type = SYS_RES_MEMORY; - sc->ste_res = bus_alloc_resource_any(dev, sc->ste_res_type, - &sc->ste_res_id, RF_ACTIVE); - if (sc->ste_res == NULL) { + /* + * Prefer memory space register mapping over IO space but use + * IO space for a device that is known to have issues on memory + * mapping. + */ + prefer_iomap = 0; + if (pci_get_device(dev) == ST_DEVICEID_ST201_1) + prefer_iomap = 1; + else + resource_int_value(device_get_name(sc->ste_dev), + device_get_unit(sc->ste_dev), "prefer_iomap", + &prefer_iomap); + if (prefer_iomap == 0) { + sc->ste_res_id = PCIR_BAR(1); + sc->ste_res_type = SYS_RES_MEMORY; + sc->ste_res = bus_alloc_resource_any(dev, sc->ste_res_type, + &sc->ste_res_id, RF_ACTIVE); + } + if (prefer_iomap || sc->ste_res == NULL) { sc->ste_res_id = PCIR_BAR(0); sc->ste_res_type = SYS_RES_IOPORT; sc->ste_res = bus_alloc_resource_any(dev, sc->ste_res_type, From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 06:03:58 2010 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 3E8AD1065670; Mon, 9 Aug 2010 06:03:58 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id AB7148FC20; Mon, 9 Aug 2010 06:03:56 +0000 (UTC) Received: by wyj26 with SMTP id 26so12098425wyj.13 for ; Sun, 08 Aug 2010 23:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=4Fc5TmgyNHFsV/h7gCk9zjOk92MrISjV8mZtKfy+iw0=; b=IvEsp4Xp8kAqf2yZijUlTfitM4EBGzjRWHRNzqzthb4TMa5aui0yZUWD95p4Vlpytm rYwrvXSiympSGF805uzzbV2FA1DURzQTTWnv1F77oOsyt7yFmV9B+azPkHtP2umx0YsZ R7HifP/qkcR/plx4aDINfjVVYd5X3fLxY31v4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=jOK4geI22OfvdkdGTY6QbA7QX6dKsddNeH/TS2+gGfYg0gI+myWDjumQrqY5K4LsA9 P+rtgJyvSJAwT5cTtyNVNEV394FXxaWvgKqbzw1A2hIbcygyBmVFNWMLoagp6FUhVFts OBIpupBnokJZOWTeM2oXuWPEe0TISLi32N9OU= MIME-Version: 1.0 Received: by 10.216.203.71 with SMTP id e49mr13418244weo.60.1281333358320; Sun, 08 Aug 2010 22:55:58 -0700 (PDT) Received: by 10.216.160.10 with HTTP; Sun, 8 Aug 2010 22:55:58 -0700 (PDT) In-Reply-To: References: <201005161943.o4GJhnTo096839@svn.freebsd.org> Date: Mon, 9 Aug 2010 11:25:58 +0530 Message-ID: From: "Jayachandran C." To: Attilio Rao Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, John Baldwin , "Jayachandran C." , svn-src-all@freebsd.org, Joe Landers , Randall Stewart , sbruno@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r208165 - in head/sys: kern mips/conf mips/include mips/mips mips/rmi mips/rmi/dev/xlr 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, 09 Aug 2010 06:03:58 -0000 On Mon, Aug 9, 2010 at 5:31 AM, Attilio Rao wrote: > 2010/5/16 Randall Stewart : >> Author: rrs >> Date: Sun May 16 19:43:48 2010 >> New Revision: 208165 >> URL: http://svn.freebsd.org/changeset/base/208165 >> >> Log: >> =A0This pushes all of JC's patches that I have in place. I >> =A0am now able to run 32 cores ok.. but I still will hang >> =A0on buildworld with a NFS problem. I suspect I am missing >> =A0a patch for the netlogic rge driver. >> >> =A0JC check and see if I am missing anything except your >> =A0core-mask changes > > >> Modified: head/sys/kern/subr_smp.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/kern/subr_smp.c =A0 =A0Sun May 16 19:25:56 2010 =A0 =A0 =A0= =A0(r208164) >> +++ head/sys/kern/subr_smp.c =A0 =A0Sun May 16 19:43:48 2010 =A0 =A0 =A0= =A0(r208165) >> @@ -503,7 +503,10 @@ smp_topo_none(void) >> =A0 =A0 =A0 =A0top =3D &group[0]; >> =A0 =A0 =A0 =A0top->cg_parent =3D NULL; >> =A0 =A0 =A0 =A0top->cg_child =3D NULL; >> - =A0 =A0 =A0 top->cg_mask =3D (1 << mp_ncpus) - 1; >> + =A0 =A0 =A0 if (mp_ncpus =3D=3D sizeof(top->cg_mask) * 8) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 top->cg_mask =3D -1; >> + =A0 =A0 =A0 else >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 top->cg_mask =3D (1 << mp_ncpus) - 1; >> =A0 =A0 =A0 =A0top->cg_count =3D mp_ncpus; >> =A0 =A0 =A0 =A0top->cg_children =3D 0; >> =A0 =A0 =A0 =A0top->cg_level =3D CG_SHARE_NONE; >> > > ... and this is why I particulary hate big commits with complete lack > of technical details. > > This particulary chunk was supposed to fix a nasty and completely MI > bug that some users have already met (kern/148698). The complete lack > of details didn't help in identify the issue neither that it was a > valuable fix. > > The fix is, however, improper (there is no clear relationship between > the multiplication and why that happens) thus I would rather use what > Joe has reported in the PR. I was not aware of the PR when I sent this changes to rrs@, and this went as a part of MIPS SMP support for XLR which has 32 CPUs But I'm not sure that the current change is correct, cg_mask is of type cpumask_t and I don't think it is guaranteed to be 32 bit (as it is a machine dependent type). JC. From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 06:12:31 2010 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 BF46B106564A; Mon, 9 Aug 2010 06:12:31 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 44CB68FC19; Mon, 9 Aug 2010 06:12:30 +0000 (UTC) Received: by wwc33 with SMTP id 33so269794wwc.31 for ; Sun, 08 Aug 2010 23:12:29 -0700 (PDT) Received: by 10.227.146.76 with SMTP id g12mr13527246wbv.82.1281334349235; Sun, 08 Aug 2010 23:12:29 -0700 (PDT) MIME-Version: 1.0 Sender: juli@clockworksquid.com Received: by 10.216.5.5 with HTTP; Sun, 8 Aug 2010 23:12:09 -0700 (PDT) In-Reply-To: References: <201005161943.o4GJhnTo096839@svn.freebsd.org> From: Juli Mallett Date: Sun, 8 Aug 2010 23:12:09 -0700 X-Google-Sender-Auth: F6y2SILQQvLiuH_z4b_3rMeVS04 Message-ID: To: Attilio Rao Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, John Baldwin , "Jayachandran C." , svn-src-all@freebsd.org, Joe Landers , Randall Stewart , sbruno@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r208165 - in head/sys: kern mips/conf mips/include mips/mips mips/rmi mips/rmi/dev/xlr 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, 09 Aug 2010 06:12:31 -0000 On Sun, Aug 8, 2010 at 17:01, Attilio Rao wrote: >> Modified: head/sys/kern/subr_smp.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/kern/subr_smp.c =A0 =A0Sun May 16 19:25:56 2010 =A0 =A0 =A0= =A0(r208164) >> +++ head/sys/kern/subr_smp.c =A0 =A0Sun May 16 19:43:48 2010 =A0 =A0 =A0= =A0(r208165) >> @@ -503,7 +503,10 @@ smp_topo_none(void) >> =A0 =A0 =A0 =A0top =3D &group[0]; >> =A0 =A0 =A0 =A0top->cg_parent =3D NULL; >> =A0 =A0 =A0 =A0top->cg_child =3D NULL; >> - =A0 =A0 =A0 top->cg_mask =3D (1 << mp_ncpus) - 1; >> + =A0 =A0 =A0 if (mp_ncpus =3D=3D sizeof(top->cg_mask) * 8) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 top->cg_mask =3D -1; >> + =A0 =A0 =A0 else >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 top->cg_mask =3D (1 << mp_ncpus) - 1; >> =A0 =A0 =A0 =A0top->cg_count =3D mp_ncpus; >> =A0 =A0 =A0 =A0top->cg_children =3D 0; >> =A0 =A0 =A0 =A0top->cg_level =3D CG_SHARE_NONE; >> > > The fix is, however, improper (there is no clear relationship between > the multiplication and why that happens) thus I would rather use what > Joe has reported in the PR. I don't understand how you can say there is no clear relationship between the multiplication and the problem. If you have the same number of CPUs as there are bits in cg_mask, since 1 is an int the result of the shift and the subtraction will be wrong unless int has more bits than cg_mask. Both fixes fail to handle the case of more CPUs than there are bits in cg_mask, but that's expected. I agree with you about the nature of the commit message and the commit, but my complaints (and those of others) back in May went unacknowledged and I don't expect comments about that this long after the fact to make an impact. Juli. From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 06:36:11 2010 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 588E9106566B; Mon, 9 Aug 2010 06:36:11 +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 480828FC19; Mon, 9 Aug 2010 06:36:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o796aBH6004393; Mon, 9 Aug 2010 06:36:11 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o796aBw8004391; Mon, 9 Aug 2010 06:36:11 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201008090636.o796aBw8004391@svn.freebsd.org> From: Martin Matuska Date: Mon, 9 Aug 2010 06:36: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: r211091 - head/sys/boot/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, 09 Aug 2010 06:36:11 -0000 Author: mm Date: Mon Aug 9 06:36:11 2010 New Revision: 211091 URL: http://svn.freebsd.org/changeset/base/211091 Log: Return EIO if vdev->v_phys_read is NULL. This fixes booting from a ZFS mirror with a unavailable primary device. PR: kern/148655 Reviewed by: avg Approved by: delphij (mentor) MFC after: 3 days Modified: head/sys/boot/zfs/zfsimpl.c Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Mon Aug 9 06:02:23 2010 (r211090) +++ head/sys/boot/zfs/zfsimpl.c Mon Aug 9 06:36:11 2010 (r211091) @@ -328,6 +328,9 @@ vdev_read_phys(vdev_t *vdev, const blkpt size_t psize; int rc; + if (!vdev->v_phys_read) + return (EIO); + if (bp) { psize = BP_GET_PSIZE(bp); } else { From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 07:58:33 2010 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 396871065674; Mon, 9 Aug 2010 07:58:33 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E0078FC16; Mon, 9 Aug 2010 07:58:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o797wXYw022630; Mon, 9 Aug 2010 07:58:33 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o797wXKP022628; Mon, 9 Aug 2010 07:58:33 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201008090758.o797wXKP022628@svn.freebsd.org> From: Ulrich Spoerlein Date: Mon, 9 Aug 2010 07:58:32 +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: r211092 - stable/8/usr.sbin/fifolog/lib 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, 09 Aug 2010 07:58:33 -0000 Author: uqs Date: Mon Aug 9 07:58:32 2010 New Revision: 211092 URL: http://svn.freebsd.org/changeset/base/211092 Log: MFC r210930: Typo fixes PR: docs/149314 Submitted by: olgeni ------------------------------------------------------------------------ Modified: stable/8/usr.sbin/fifolog/lib/fifolog.h Directory Properties: stable/8/usr.sbin/fifolog/ (props changed) Modified: stable/8/usr.sbin/fifolog/lib/fifolog.h ============================================================================== --- stable/8/usr.sbin/fifolog/lib/fifolog.h Mon Aug 9 06:36:11 2010 (r211091) +++ stable/8/usr.sbin/fifolog/lib/fifolog.h Mon Aug 9 07:58:32 2010 (r211092) @@ -33,15 +33,15 @@ * Definitions for fifolog "protocol": the on-media layout. * * The fifolog on-media record has three layers: - * The outher timestamping and synchronization layer. - * The zlib implemented data compression + * The outer timestamping and synchronization layer. + * The zlib implemented data compression. * The inner sequencing and identification layer. * - * All three layers are synchronized at a subset of the outher layer + * All three layers are synchronized at a subset of the outer layer * record boundaries, from where reading can be initiated. * * - * The outher layer: + * The outer layer: * ----------------- * The first record in a fifolog contains a magic string and version * information along with a 32be encoded recordsize for all records @@ -55,7 +55,7 @@ * 0 32be sequence_number * The sequence number is randomly chosen for the * fifolog and increments once for each record written. - * It's precense allow quick identification of the next + * It's presence allow quick identification of the next * record to be written using a binary search for the * first place where a discontinuity in the sequence * numbers occur. @@ -89,14 +89,14 @@ * In most cases, the timer will expire before zlib has filled an entire * record in which case Z_SYNC_FLUSH will be used to force as much as * possible into the buffer before it is written. This is not marked - * in outher layer (apart from a natural correlation with padding) since + * in outer layer (apart from a natural correlation with padding) since * zlibs data stream handles this without help. * * * The inner layer: * ---------------- - * The inner layer contains data indentification and to the second - * timestamping (the timestamp in the outherlayer only marks the + * The inner layer contains data identification and to the second + * timestamping (the timestamp in the outer layer only marks the * first possible timestamp for content in the SYNC record). * * offset type contents @@ -113,7 +113,7 @@ * 4 32be time_t containing POSIX's understanding of UTC. * * Then follows the content, either as a NUL terminated string or as - * a lenght encoded binary sequence: + * a length encoded binary sequence: * * If (ident & FIFOLOG_LENGTH) the record is prefixed by: * {0|4} 8 length of binary data From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 08:42:35 2010 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 668E0106566B; Mon, 9 Aug 2010 08:42:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id F2CB98FC13; Mon, 9 Aug 2010 08:42:34 +0000 (UTC) Received: from c122-106-147-41.carlnfd1.nsw.optusnet.com.au (c122-106-147-41.carlnfd1.nsw.optusnet.com.au [122.106.147.41]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o798gPOK016616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 9 Aug 2010 18:42:26 +1000 Date: Mon, 9 Aug 2010 18:42:25 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Jilles Tjoelker In-Reply-To: <20100808220631.GA86477@stack.nl> Message-ID: <20100809181106.U9102@delplex.bde.org> References: <20100807.205058.260300877050427878.imp@bsdimp.com> <201008082037.o78KbLDt022321@haluter.fromme.com> <20100808.153608.1142818667055052395.imp@bsdimp.com> <20100808220631.GA86477@stack.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, olli@fromme.com, "M. Warner Losh" Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 09 Aug 2010 08:42:35 -0000 On Mon, 9 Aug 2010, Jilles Tjoelker wrote: > On Sun, Aug 08, 2010 at 03:36:08PM -0600, M. Warner Losh wrote: >> The casting that syslogd does with struct sockaddrFOO is what triggers >> it. I'm not sure how to fix it, so there's about 6 or 8 programs in >> the tree that have WARNS lowered to 3 because of it. > > This problem is common with programs that use getaddrinfo() and then > look into the address family specific parts of the address (it was > probably not the intention of the getaddrinfo() API to do this very > often). Obviously, when ai_family is the corresponding value, the > ai_addr really points to that particular kind of sockaddr, but gcc only > knows that struct sockaddr_in and struct sockaddr_in6 have a higher > alignment requirement than struct sockaddr. POSIX even standardized this broken (unimplementable in C) API. AT least in the old 2001 draft 7, it says that sockaddr_un shall include much the same members that FreeBSD's version has, and that applications shall access these in an even more broken way than by casting the pointer: it says that the struct type sockaddr_un shall be cast to struct access for use with the socket functions. I don't even remember seeing code so broken as to expect casting whole structs to an incompatible type to work. However, this is not completely unimplementable -- it just requires the struct types to be compatible, i.e., the same. But the reason for existence of sockaddr_un is to have the struct types not the same. They are not the same in FreeBSD. The pointers can probably made compatible enough in practice by implementing them in non-C using sufficient alignment and/or packing directives. Without these, the alignment and packing for the structs could easily end up incompatible due to gcc wanting to align the larger array of char more than the smaller array of char, like it does for global arrays of char. ABIs may already prevent such extra alignment in practice. > In some cases, the address may already be copied, and making the > destination the family-based type or struct sockaddr_storage (which has > a high alignment requirement) will avoid problems. > > In other cases, I propose adding a cast to void * in between, like > (struct sockaddr_in *)(void *)ai->ai_addr > > Note that this workaround must not be applied mindlessly to avoid > -Wcast-align, but only when it is known from other information that the > object really has that type. Of course it just breaks the warning. > If you don't like this workaround, perhaps copy the data to a variable > of the correct type. Addresses are not particularly big so the > performance hit should not be bad. > > It is unfortunate to have to miss other warnings because of this. Copying is just a fancier way of breaking the warning in this case. I was thinking of packing and aligning everything in the struct to ensure that the struct layouts are identical in their common part, but to just break the warning in a way that is easy to undo, it might be enough to declare the whole structs as __aligned(1). The structs consist of u_chars (sometimes spelled uint8_t and sometimes spelled char), so their natural alignment is 1. But I just remember that arm uses unnattural alignment. __aligned(4) might need to be used for it to preserve the ABI. What is the struct layout for arm? Bruce From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 08:43:56 2010 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 C436C1065689; Mon, 9 Aug 2010 08:43:56 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 8248A8FC0A; Mon, 9 Aug 2010 08:43:56 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 95CB71FFC33; Mon, 9 Aug 2010 08:43:55 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 6A8FD84528; Mon, 9 Aug 2010 10:43:55 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Jilles Tjoelker References: <20100807.205058.260300877050427878.imp@bsdimp.com> <201008082037.o78KbLDt022321@haluter.fromme.com> <20100808.153608.1142818667055052395.imp@bsdimp.com> <20100808220631.GA86477@stack.nl> Date: Mon, 09 Aug 2010 10:43:55 +0200 In-Reply-To: <20100808220631.GA86477@stack.nl> (Jilles Tjoelker's message of "Mon, 9 Aug 2010 00:06:31 +0200") Message-ID: <86tyn4tbuc.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, olli@fromme.com, "M. Warner Losh" Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 09 Aug 2010 08:43:56 -0000 Jilles Tjoelker writes: > In other cases, I propose adding a cast to void * in between, like > (struct sockaddr_in *)(void *)ai->ai_addr Better to cast through uintptr_t. Perhaps we should have a __DECONST-like macro for this? #define __ALIGNED_CAST(t, v) ((t)(uintptr_t)(v)) DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 09:26:18 2010 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 399101065670; Mon, 9 Aug 2010 09:26:18 +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 290248FC1D; Mon, 9 Aug 2010 09:26:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o799QICW042291; Mon, 9 Aug 2010 09:26:18 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o799QIsL042289; Mon, 9 Aug 2010 09:26:18 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201008090926.o799QIsL042289@svn.freebsd.org> From: Max Khon Date: Mon, 9 Aug 2010 09:26: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: r211094 - head/games/fortune/datfiles 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, 09 Aug 2010 09:26:18 -0000 Author: fjoe Date: Mon Aug 9 09:26:17 2010 New Revision: 211094 URL: http://svn.freebsd.org/changeset/base/211094 Log: "whereis netscape" gives empty output for quite a long time already. Suggest to use "whereis firefox" instead. Modified: head/games/fortune/datfiles/freebsd-tips Modified: head/games/fortune/datfiles/freebsd-tips ============================================================================== --- head/games/fortune/datfiles/freebsd-tips Mon Aug 9 08:41:29 2010 (r211093) +++ head/games/fortune/datfiles/freebsd-tips Mon Aug 9 09:26:17 2010 (r211094) @@ -476,6 +476,6 @@ You can use "whereis" to search standard directories for the specified programs. This can be particularly handy when you are trying to find where in the ports tree an application is. -Try "whereis netscape" and "whereis whereis". +Try "whereis firefox" and "whereis whereis". -- Konstantinos Konstantinidis % From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 12:05:07 2010 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 A8A57106567B; Mon, 9 Aug 2010 12:05:07 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id B49998FC24; Mon, 9 Aug 2010 12:05:06 +0000 (UTC) Received: by qwg5 with SMTP id 5so6145436qwg.13 for ; Mon, 09 Aug 2010 05:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=XizLhOzUK3Y3KIYzNFU9yPfhXvjpJuZwR1t2pB09Yls=; b=DPGl5F1Afd9aZ83FyEkm9fLvl4UnZUl/5GHyO76g/0gpeb2m6q4CA0BXTh7Kl972BV wWqtIAW4DFclc9/P3lCmMWNd36yDwX8fU29qnf5sj/6NkFvsIKVPcd6jbSJz8G0Y8DMQ nDaEvcRHJHMRzoDfwH+Z56OHHNOOpcyvfK8U4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=thkysdbMvCXhO/XOEa7RP4mhpBCPDuQhppsdg8lPvlMOM5yL/9CGrvxo0InZYFCOOr FytHLpyAa3r5cgUjkFT4OuUfjAGBqvblrJYYiUncvMepAnyRuGI1AdS0uP4kscofVObV ddbrDuiF7/ez7FQxzBEu5rqXZSzQfjVit+LGA= MIME-Version: 1.0 Received: by 10.229.239.3 with SMTP id ku3mr6031071qcb.129.1281355505558; Mon, 09 Aug 2010 05:05:05 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.251.6 with HTTP; Mon, 9 Aug 2010 05:05:05 -0700 (PDT) In-Reply-To: References: <201005161943.o4GJhnTo096839@svn.freebsd.org> Date: Mon, 9 Aug 2010 14:05:05 +0200 X-Google-Sender-Auth: GPSocT4b9_mtIBpkWSTfGbtH3a8 Message-ID: From: Attilio Rao To: "Jayachandran C." Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, John Baldwin , "Jayachandran C." , svn-src-all@freebsd.org, Joe Landers , Randall Stewart , sbruno@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r208165 - in head/sys: kern mips/conf mips/include mips/mips mips/rmi mips/rmi/dev/xlr 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, 09 Aug 2010 12:05:07 -0000 2010/8/9 Jayachandran C. : > On Mon, Aug 9, 2010 at 5:31 AM, Attilio Rao wrote: >> 2010/5/16 Randall Stewart : >>> Author: rrs >>> Date: Sun May 16 19:43:48 2010 >>> New Revision: 208165 >>> URL: http://svn.freebsd.org/changeset/base/208165 >>> >>> Log: >>> =C2=A0This pushes all of JC's patches that I have in place. I >>> =C2=A0am now able to run 32 cores ok.. but I still will hang >>> =C2=A0on buildworld with a NFS problem. I suspect I am missing >>> =C2=A0a patch for the netlogic rge driver. >>> >>> =C2=A0JC check and see if I am missing anything except your >>> =C2=A0core-mask changes >> >> >>> Modified: head/sys/kern/subr_smp.c >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/kern/subr_smp.c =C2=A0 =C2=A0Sun May 16 19:25:56 2010 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r208164) >>> +++ head/sys/kern/subr_smp.c =C2=A0 =C2=A0Sun May 16 19:43:48 2010 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r208165) >>> @@ -503,7 +503,10 @@ smp_topo_none(void) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0top =3D &group[0]; >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0top->cg_parent =3D NULL; >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0top->cg_child =3D NULL; >>> - =C2=A0 =C2=A0 =C2=A0 top->cg_mask =3D (1 << mp_ncpus) - 1; >>> + =C2=A0 =C2=A0 =C2=A0 if (mp_ncpus =3D=3D sizeof(top->cg_mask) * 8) >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 top->cg_mask =3D -1; >>> + =C2=A0 =C2=A0 =C2=A0 else >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 top->cg_mask =3D (1 = << mp_ncpus) - 1; >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0top->cg_count =3D mp_ncpus; >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0top->cg_children =3D 0; >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0top->cg_level =3D CG_SHARE_NONE; >>> >> >> ... and this is why I particulary hate big commits with complete lack >> of technical details. >> >> This particulary chunk was supposed to fix a nasty and completely MI >> bug that some users have already met (kern/148698). The complete lack >> of details didn't help in identify the issue neither that it was a >> valuable fix. >> >> The fix is, however, improper (there is no clear relationship between >> the multiplication and why that happens) thus I would rather use what >> Joe has reported in the PR. > > > I was not aware of the PR when I sent this changes to rrs@, and this > went as a part of MIPS SMP support for XLR which has 32 CPUs > > But I'm not sure that the current change is correct, cg_mask is of > type cpumask_t and I don't think it is guaranteed to be 32 bit (as it > is a machine dependent type). Actually the 32 bits limit is well aware and acknowledged in cpumask_t. While it is true that it should be an 'opaque' type, in reality it is not. The maximum limit of 32 CPUs is a reality due to cpumask_t on all our architectures. That is why we are going to use cpuset_t for dealing with CPUs numbers (which is really opaque, at same extent, and is not bound to any size). Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 12:22:10 2010 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 8B4531065678; Mon, 9 Aug 2010 12:22:10 +0000 (UTC) (envelope-from gavin@ury.york.ac.uk) Received: from ixe-mta-27.emailfiltering.com (ixe-mta-27-tx.emailfiltering.com [194.116.199.158]) by mx1.freebsd.org (Postfix) with ESMTP id 7AB768FC1D; Mon, 9 Aug 2010 12:22:08 +0000 (UTC) Received: from mail-gw14.york.ac.uk ([144.32.129.164]) by ixe-mta-27.emailfiltering.com with emfmta (version 4.5.0.261) by TLS id 708632374 for imp@bsdimp.com;c78515a9d8f7972; Mon, 09 Aug 2010 13:21:54 +0100 Received: from ury.york.ac.uk ([144.32.108.81]:48376) by mail-gw14.york.ac.uk with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1OiRMY-0004K1-CT; Mon, 09 Aug 2010 13:21:54 +0100 Received: from gavin (helo=localhost) by ury.york.ac.uk with local-esmtp (Exim 4.72) (envelope-from ) id 1OiRMY-0007PS-47; Mon, 09 Aug 2010 13:21:54 +0100 Date: Mon, 9 Aug 2010 13:21:54 +0100 (BST) From: Gavin Atkinson X-X-Sender: gavin@ury.york.ac.uk To: "M. Warner Losh" In-Reply-To: <20100808.153914.769051483995699249.imp@bsdimp.com> Message-ID: References: <201008071608.o77G8bNN088653@svn.freebsd.org> <20100807.204946.244264502672924047.imp@bsdimp.com> <20100808.153914.769051483995699249.imp@bsdimp.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r211021 - 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: Mon, 09 Aug 2010 12:22:10 -0000 On Sun, 8 Aug 2010, M. Warner Losh wrote: > In message: > Gavin Atkinson writes: > : On Sat, 7 Aug 2010, M. Warner Losh wrote: > : > In message: <201008071608.o77G8bNN088653@svn.freebsd.org> > : > Gavin Atkinson writes: > : > : Author: gavin > : > : Date: Sat Aug 7 16:08:37 2010 > : > : New Revision: 211021 > : > : URL: http://svn.freebsd.org/changeset/base/211021 > : > : > : > : Log: > : > : Sort this file a little better: the vendors are supposed to be sorted by > : > : vendor ID in the vendor section, and by symbolic name in the product > : > : section. Products are sorted by product ID. While here, get rid of a > : > : duplicate Microsoft Mouse entry, revealed by sorting. > : > > : > I thought products were sorted by the ID number, not the ID name. > : > : Yes, within a manufacturer, products should be sorted by ID. Each > : manufacturer section is sorted by the symbolic manufacturer name, though. > > Within each product section, the products are sorted by numeric id, > not symbolic id. That's how it was when I was maintaining this file, > and is how pccarddevs also works. > > eg: > > product ALCOR SDCR_6335 0x6335 SD/MMC Card Reader > product ALCOR SDCR_6362 0x6362 SD/MMC Card Reader > product ALCOR TRANSCEND 0x6387 Transcend JetFlash Drive > product ALCOR MA_KBD_HUB 0x9213 MacAlly Kbd Hub > product ALCOR AU9814 0x9215 AU9814 Hub > product ALCOR UMCR_9361 0x9361 USB Multimedia Card Reader > product ALCOR SM_KBD 0x9410 MicroConnectors/StrongMan Keyboard > product ALCOR NEC_KBD_HUB 0x9472 NEC Kbd Hub > product ALCOR AU6390 0x6390 AU6390 USB-IDE converter Indeed, that is wrong. That's not a section that I have touched, though. > : I'm not which one of us is misunderstanding the other - do you think my > : change is somehow wrong? > > I think your change misorders things, unless I'm misreading it. It > sorts based on symbolic ID rather than numeric ID. The only section I touched with this commit was the MICROSOFT one, and here is the ordering after my commit: product MICROSOFT SIDEPREC 0x0008 SideWinder Precision Pro product MICROSOFT INTELLIMOUSE 0x0009 IntelliMouse product MICROSOFT NATURALKBD 0x000b Natural Keyboard Elite product MICROSOFT DDS80 0x0014 Digital Sound System 80 product MICROSOFT SIDEWINDER 0x001a Sidewinder Precision Racing Wheel product MICROSOFT INETPRO 0x001c Internet Keyboard Pro product MICROSOFT TBEXPLORER 0x0024 Trackball Explorer product MICROSOFT INTELLIEYE 0x0025 IntelliEye mouse product MICROSOFT INETPRO2 0x002b Internet Keyboard Pro product MICROSOFT MN510 0x006e MN510 Wireless product MICROSOFT MN110 0x007a 10/100 USB NIC product MICROSOFT WLINTELLIMOUSE 0x008c Wireless Optical IntelliMouse product MICROSOFT WLNOTEBOOK 0x00b9 Wireless Optical Mouse (Model 1023) product MICROSOFT COMFORT3000 0x00d1 Comfort Optical Mouse 3000 (Model 1043) product MICROSOFT WLNOTEBOOK3 0x00d2 Wireless Optical Mouse 3000 (Model 1049) product MICROSOFT NATURAL4000 0x00db Natural Ergonomic Keyboard 4000 product MICROSOFT WLNOTEBOOK2 0x00e1 Wireless Optical Mouse 3000 (Model 1056) product MICROSOFT XBOX360 0x0292 XBOX 360 WLAN I can't see any which are misordered, can you? Thanks, Gavin From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 12:36:36 2010 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 F25601065678; Mon, 9 Aug 2010 12:36:36 +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 DFBC48FC25; Mon, 9 Aug 2010 12:36:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79CaamW090853; Mon, 9 Aug 2010 12:36:36 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79CaaXc090832; Mon, 9 Aug 2010 12:36:36 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201008091236.o79CaaXc090832@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 9 Aug 2010 12:36: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: r211095 - in head: sbin/iscontrol sys/dev/iscsi/initiator 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, 09 Aug 2010 12:36:37 -0000 Author: des Date: Mon Aug 9 12:36:36 2010 New Revision: 211095 URL: http://svn.freebsd.org/changeset/base/211095 Log: - Add full support for header / data digests. - Increase target limit from 4 to 64; this limit will be removed entirely at a later time. - Improve recovery from lost network connections. - Fix some potential deadlocks and a serious memory leak. - Fix incorrect use of MH_ALIGN (instead of M_ALIGN), which makes no practical difference, but triggers a KASSERT with INVARIANTS. - Fix some warnings in iscontrol(8) and improve the man page somewhat. Submitted by: Daniel Braniss Sponsored by: Dansk Scanning A/S, Data Robotics Inc. Deleted: head/sbin/iscontrol/pdu.h Modified: head/sbin/iscontrol/Makefile head/sbin/iscontrol/auth_subr.c head/sbin/iscontrol/config.c head/sbin/iscontrol/fsm.c head/sbin/iscontrol/iscontrol.8 head/sbin/iscontrol/iscontrol.c head/sbin/iscontrol/iscontrol.h head/sbin/iscontrol/iscsi.conf.5 head/sbin/iscontrol/login.c head/sbin/iscontrol/misc.c head/sbin/iscontrol/pdu.c head/sys/dev/iscsi/initiator/isc_cam.c head/sys/dev/iscsi/initiator/isc_sm.c head/sys/dev/iscsi/initiator/isc_soc.c head/sys/dev/iscsi/initiator/isc_subr.c head/sys/dev/iscsi/initiator/iscsi.c head/sys/dev/iscsi/initiator/iscsi.h head/sys/dev/iscsi/initiator/iscsi_subr.c head/sys/dev/iscsi/initiator/iscsivar.h Modified: head/sbin/iscontrol/Makefile ============================================================================== --- head/sbin/iscontrol/Makefile Mon Aug 9 09:26:17 2010 (r211094) +++ head/sbin/iscontrol/Makefile Mon Aug 9 12:36:36 2010 (r211095) @@ -4,9 +4,10 @@ SRCS= iscontrol.c pdu.c fsm.c config.c l PROG= iscontrol DPADD= ${LIBCAM} ${LIBMD} LDADD= -lcam -lmd +S= ${.CURDIR}/../../sys -WARNS?= 2 -CFLAGS += -I${.CURDIR}/../../sys/dev/iscsi/initiator +WARNS?= 3 +CFLAGS += -I$S #CFLAGS += -g -DDEBUG MAN= iscsi.conf.5 iscontrol.8 Modified: head/sbin/iscontrol/auth_subr.c ============================================================================== --- head/sbin/iscontrol/auth_subr.c Mon Aug 9 09:26:17 2010 (r211094) +++ head/sbin/iscontrol/auth_subr.c Mon Aug 9 12:36:36 2010 (r211095) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2008 Daniel Braniss + * Copyright (c) 2005-2010 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "iscsi.h" +#include #include "iscontrol.h" static int @@ -152,7 +152,7 @@ chapDigest(char *ap, char id, char *cp, } char * -genChapChallenge(char *encoding, int len) +genChapChallenge(char *encoding, uint len) { int fd; unsigned char tmp[1024]; Modified: head/sbin/iscontrol/config.c ============================================================================== --- head/sbin/iscontrol/config.c Mon Aug 9 09:26:17 2010 (r211094) +++ head/sbin/iscontrol/config.c Mon Aug 9 12:36:36 2010 (r211095) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2008 Daniel Braniss + * Copyright (c) 2005-2009 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "iscsi.h" +#include #include "iscontrol.h" /* @@ -94,6 +94,11 @@ __FBSDID("$FreeBSD$"); #define OPT_iqn 34 #define OPT_sockbufsize 35 +/* + | sentinel + */ +#define OPT_end 0 + #define _OFF(v) ((int)&((isc_opt_t *)NULL)->v) #define _E(u, s, v) {.usage=u, .scope=s, .name=#v, .tokenID=OPT_##v} @@ -145,7 +150,7 @@ textkey_t keyMap[] = { _E(U_LO, S_SW, sessionType), - {0} + _E(0, 0, end) }; #define _OPT_INT(w) strtol((char *)w, NULL, 0) @@ -154,7 +159,7 @@ textkey_t keyMap[] = { static __inline int _OPT_BOOL(char *w) { - if(isalpha(*w)) + if(isalpha((unsigned char)*w)) return strcasecmp(w, "TRUE") == 0; else return _OPT_INT(w); @@ -244,12 +249,12 @@ getConfig(FILE *fd, char *key, char **Ar len = 0; state = 0; while((lp = getline(fd)) != NULL) { - for(; isspace(*lp); lp++) + for(; isspace((unsigned char)*lp); lp++) ; switch(state) { case 0: if((p = strchr(lp, '{')) != NULL) { - while((--p > lp) && *p && isspace(*p)); + while((--p > lp) && *p && isspace((unsigned char)*p)); n = p - lp; if(len && strncmp(lp, key, MAX(n, len)) == 0) state = 2; @@ -272,7 +277,7 @@ getConfig(FILE *fd, char *key, char **Ar } - for(p = &lp[strlen(lp)-1]; isspace(*p); p--) + for(p = &lp[strlen(lp)-1]; isspace((unsigned char)*p); p--) *p = 0; if((*nargs)-- > 0) *ar++ = strdup(lp); @@ -351,9 +356,9 @@ parseArgs(int nargs, char **args, isc_op continue; *p = 0; v = p + 1; - while(isspace(*--p)) + while(isspace((unsigned char)*--p)) *p = 0; - while(isspace(*v)) + while(isspace((unsigned char)*v)) v++; if((tk = keyLookup(*ar)) == NULL) continue; Modified: head/sbin/iscontrol/fsm.c ============================================================================== --- head/sbin/iscontrol/fsm.c Mon Aug 9 09:26:17 2010 (r211094) +++ head/sbin/iscontrol/fsm.c Mon Aug 9 12:36:36 2010 (r211095) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2008 Daniel Braniss + * Copyright (c) 2005-2010 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "iscsi.h" +#include #include "iscontrol.h" typedef enum { @@ -99,26 +99,26 @@ tcpConnect(isess_t *sess) #ifdef notyet { time_t sec; - // make sure we are not in a loop - // XXX: this code has to be tested - sec = time(0) - sess->reconnect_time; - if(sec > (5*60)) { - // if we've been connected for more that 5 minutes - // then just reconnect - sess->reconnect_time = sec; - sess->reconnect_cnt1 = 0; - } - else { - // - sess->reconnect_cnt1++; - if((sec / sess->reconnect_cnt1) < 2) { - // if less that 2 seconds from the last reconnect - // we are most probably looping - syslog(LOG_CRIT, "too many reconnects %d", sess->reconnect_cnt1); - return 0; + // make sure we are not in a loop + // XXX: this code has to be tested + sec = time(0) - sess->reconnect_time; + if(sec > (5*60)) { + // if we've been connected for more that 5 minutes + // then just reconnect + sess->reconnect_time = sec; + sess->reconnect_cnt1 = 0; + } + else { + // + sess->reconnect_cnt1++; + if((sec / sess->reconnect_cnt1) < 2) { + // if less that 2 seconds from the last reconnect + // we are most probably looping + syslog(LOG_CRIT, "too many reconnects %d", sess->reconnect_cnt1); + return 0; + } } } - } #endif sess->reconnect_cnt++; } @@ -140,13 +140,13 @@ tcpConnect(isess_t *sess) if (soc == -1) continue; - // from Patrick.Guelat@imp.ch: - // iscontrol can be called without waiting for the socket entry to time out - val = 1; + // from Patrick.Guelat@imp.ch: + // iscontrol can be called without waiting for the socket entry to time out + val = 1; if(setsockopt(soc, SOL_SOCKET, SO_REUSEADDR, &val, (socklen_t)sizeof(val)) < 0) { - fprintf(stderr, "Cannot set socket SO_REUSEADDR %d: %s\n\n", - errno, strerror(errno)); - } + fprintf(stderr, "Cannot set socket SO_REUSEADDR %d: %s\n\n", + errno, strerror(errno)); + } if(connect(soc, res->ai_addr, res->ai_addrlen) == 0) break; @@ -196,7 +196,7 @@ tcpConnect(isess_t *sess) } sess->flags |= SESS_CONNECTED; return T1; - } + } fprintf(stderr, "errno=%d\n", sv_errno); perror("connect"); @@ -289,7 +289,7 @@ startSession(isess_t *sess) // XXX: this has to go size_t n; n = sizeof(sess->isid); - if(sysctlbyname("net.iscsi.isid", (void *)sess->isid, (size_t *)&n, 0, 0) != 0) + if(sysctlbyname("net.iscsi_initiator.isid", (void *)sess->isid, (size_t *)&n, 0, 0) != 0) perror("sysctlbyname"); } if(ioctl(fd, ISCSISETSES, &n)) { @@ -343,29 +343,29 @@ trap(int sig) } } -static void +static int doCAM(isess_t *sess) { char pathstr[1024]; union ccb *ccb; - int i; + int i, n; if(ioctl(sess->fd, ISCSIGETCAM, &sess->cam) != 0) { syslog(LOG_WARNING, "ISCSIGETCAM failed: %d", errno); - return; + return 0; } - debug(2, "nluns=%d", sess->cam.target_nluns); + debug(1, "nluns=%d", sess->cam.target_nluns); /* | for now will do this for each lun ... */ - for(i = 0; i < sess->cam.target_nluns; i++) { + for(n = i = 0; i < sess->cam.target_nluns; i++) { debug(2, "CAM path_id=%d target_id=%d target_lun=%d", sess->cam.path_id, sess->cam.target_id, sess->cam.target_lun[i]); sess->camdev = cam_open_btl(sess->cam.path_id, sess->cam.target_id, - sess->cam.target_lun[i], O_RDWR, NULL); + i, O_RDWR, NULL); if(sess->camdev == NULL) { - syslog(LOG_WARNING, "%s", cam_errbuf); + //syslog(LOG_WARNING, "%s", cam_errbuf); debug(3, "%s", cam_errbuf); continue; } @@ -378,20 +378,21 @@ doCAM(isess_t *sess) ccb->ccb_h.func_code = XPT_REL_SIMQ; ccb->crs.release_flags = RELSIM_ADJUST_OPENINGS; ccb->crs.openings = sess->op->tags; - if(cam_send_ccb(sess->camdev, ccb) < 0) - syslog(LOG_WARNING, "%s", cam_errbuf); + debug(2, "%s", cam_errbuf); else if((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { syslog(LOG_WARNING, "XPT_REL_SIMQ CCB failed"); // cam_error_print(sess->camdev, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); } - else + else { + n++; syslog(LOG_INFO, "%s tagged openings now %d\n", pathstr, ccb->crs.openings); - + } cam_freeccb(ccb); cam_close_device(sess->camdev); } + return n; } static trans_t @@ -417,7 +418,15 @@ supervise(isess_t *sess) perror("daemon"); exit(1); } + if(sess->op->pidfile != NULL) { + FILE *pidf; + pidf = fopen(sess->op->pidfile, "w"); + if(pidf != NULL) { + fprintf(pidf, "%d\n", getpid()); + fclose(pidf); + } + } openlog("iscontrol", LOG_CONS|LOG_PERROR|LOG_PID|LOG_NDELAY, LOG_KERN); syslog(LOG_INFO, "running"); @@ -426,7 +435,11 @@ supervise(isess_t *sess) perror("ISCSISTART"); return -1; } - doCAM(sess); + if(doCAM(sess) == 0) { + syslog(LOG_WARNING, "no device found"); + ioctl(sess->fd, ISCSISTOP); + return T15; + } } else { @@ -449,7 +462,8 @@ supervise(isess_t *sess) sess->flags |= SESS_FULLFEATURE; sess->flags &= ~(SESS_REDIRECT | SESS_RECONNECT); - printf("iscontrol: supervise starting main loop\n"); + if(vflag) + printf("iscontrol: supervise starting main loop\n"); /* | the main loop - actually do nothing | all the work is done inside the kernel @@ -468,14 +482,14 @@ supervise(isess_t *sess) } if(sess->flags & SESS_DISCONNECT) { - val = 0; - if(ioctl(sess->fd, ISCSISTOP, &val)) { - perror("ISCSISTOP"); - } sess->flags &= ~SESS_FULLFEATURE; return T9; } else { + val = 0; + if(ioctl(sess->fd, ISCSISTOP, &val)) { + perror("ISCSISTOP"); + } sess->flags |= SESS_INITIALLOGIN1; } return T8; @@ -490,7 +504,7 @@ handledDiscoveryResp(isess_t *sess, pdu_ debug_called(3); len = pp->ds_len; - ptr = pp->ds; + ptr = pp->ds_addr; while(len > 0) { if(*ptr != 0) printf("%s\n", ptr); @@ -579,8 +593,13 @@ doLogin(isess_t *sess) static int handleLogoutResp(isess_t *sess, pdu_t *pp) { - if(sess->flags & SESS_DISCONNECT) + if(sess->flags & SESS_DISCONNECT) { + int val = 0; + if(ioctl(sess->fd, ISCSISTOP, &val)) { + perror("ISCSISTOP"); + } return 0; + } return T13; } @@ -610,7 +629,7 @@ typedef enum { S1, S2, /*S3,*/ S4, S5, S6, S7, S8 } state_t; -#if 0 +/** S1: FREE S2: XPT_WAIT S4: IN_LOGIN @@ -652,7 +671,7 @@ typedef enum { | +-----\ /--->\ / T14 | | ------- --+----+------+T17 +---------------------------+ -#endif +*/ int fsm(isc_opt_t *op) Modified: head/sbin/iscontrol/iscontrol.8 ============================================================================== --- head/sbin/iscontrol/iscontrol.8 Mon Aug 9 09:26:17 2010 (r211094) +++ head/sbin/iscontrol/iscontrol.8 Mon Aug 9 12:36:36 2010 (r211095) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2007-2008 Daniel Braniss +.\" Copyright (c) 2007-2010 Daniel Braniss .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -32,11 +32,12 @@ .Nd login/negotiator/control for an iSCSI initiator session .Sh SYNOPSIS .Nm -.Op Fl vd +.Op Fl dv .Oo -.Op Fl c Ar file +.Fl c Ar file .Op Fl n Ar nickname .Oc +.Op Fl p Ar pidfile .Op Fl t Ar target .Op Ar variable Ns = Ns Ar value .Sh DESCRIPTION @@ -57,26 +58,29 @@ It will terminate/logout the session when a SIGHUP signal is received. The flags are as follows: .Bl -tag -width variable=value -.It Fl v -verbose mode. -.It Fl d -do a -.Em discovery session -and exit. .It Fl c Ar file a file containing configuration .Em key-options , see -.Xr iscsi.conf 5 +.Xr iscsi.conf 5 . +.It Fl d +do a +.Em discovery session +and exit. .It Fl n Ar nickname if .Sy -c file is specified, then search for the block named .Em nickname in that file, see -.Xr iscsi.conf 5 +.Xr iscsi.conf 5 . +.It Fl p Ar pidfile +will write the process ID of the session to the specified +.Em pidfile .It Fl t Ar target -is the target's IP address or name +the target's IP address or name. +.It Fl v +verbose mode. .It Ar variable Ns = Ns Ar value see .Xr iscsi.conf 5 @@ -86,13 +90,13 @@ possible values. .Sh EXAMPLES .Dl iscontrol -dt myiscsitarget .Pp -will start a +will start a .Em discovery session with the target and print to stdout the list of available targetnames/targetadresses. Note: this listing does not necessarily mean availability, since depending on the target configuration, a discovery session might -not need login/access permission, but a +not need login/access permission, but a .Em full session certainly does. .sp Modified: head/sbin/iscontrol/iscontrol.c ============================================================================== --- head/sbin/iscontrol/iscontrol.c Mon Aug 9 09:26:17 2010 (r211094) +++ head/sbin/iscontrol/iscontrol.c Mon Aug 9 12:36:36 2010 (r211095) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2008 Daniel Braniss + * Copyright (c) 2005-2010 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,15 +53,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include "iscsi.h" +#include #include "iscontrol.h" -#define USAGE "[-v] [-d] [-c config] [-n name] [-t target] " -#define OPTIONS "vdc:t:n:" - -#ifndef DEBUG -//int vflag; -#endif +#define USAGE "[-v] [-d] [-c config] [-n name] [-t target] [-p pidfile]" +#define OPTIONS "vdc:t:n:p:" token_t AuthMethods[] = { {"None", NONE}, @@ -70,14 +66,14 @@ token_t AuthMethods[] = { {"SPKM2", SPKM2}, {"SRP", SRP}, {"CHAP", CHAP}, - {0} + {0, 0} }; token_t DigestMethods[] = { {"None", 0}, {"CRC32", 1}, {"CRC32C", 1}, - {0} + {0, 0} }; u_char isid[6 + 6]; @@ -128,7 +124,7 @@ int main(int cc, char **vv) { int ch, disco; - char *pname, *p, *q, *ta, *kw; + char *pname, *pidfile, *p, *q, *ta, *kw; isc_opt_t *op; FILE *fd; @@ -141,6 +137,7 @@ main(int cc, char **vv) kw = ta = 0; disco = 0; + pidfile = NULL; while((ch = getopt(cc, vv, OPTIONS)) != -1) { switch(ch) { @@ -163,6 +160,9 @@ main(int cc, char **vv) case 'n': kw = optarg; break; + case 'p': + pidfile = optarg; + break; default: badu: fprintf(stderr, "Usage: %s %s\n", pname, USAGE); @@ -225,7 +225,7 @@ main(int cc, char **vv) op->sessionType = "Discovery"; op->targetName = 0; } - + op->pidfile = pidfile; fsm(op); exit(0); Modified: head/sbin/iscontrol/iscontrol.h ============================================================================== --- head/sbin/iscontrol/iscontrol.h Mon Aug 9 09:26:17 2010 (r211094) +++ head/sbin/iscontrol/iscontrol.h Mon Aug 9 12:36:36 2010 (r211095) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2008 Daniel Braniss + * Copyright (c) 2005-2010 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -154,7 +154,7 @@ void parseArgs(int nargs, char **args, i void parseConfig(FILE *fd, char *key, isc_opt_t *op); char *chapDigest(char *ap, char id, char *cp, char *chapSecret); -char *genChapChallenge(char *encoding, int len); +char *genChapChallenge(char *encoding, uint len); int str2bin(char *str, char **rsp); char *bin2str(char *fmt, unsigned char *md, int blen); Modified: head/sbin/iscontrol/iscsi.conf.5 ============================================================================== --- head/sbin/iscontrol/iscsi.conf.5 Mon Aug 9 09:26:17 2010 (r211094) +++ head/sbin/iscontrol/iscsi.conf.5 Mon Aug 9 12:36:36 2010 (r211095) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2007-2008 Daniel Braniss +.\" Copyright (c) 2007-2010 Daniel Braniss .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -68,6 +68,7 @@ Only CRC32C is implemented. Default is none. .It Cm DataDigest same as for HeaderDigest, but on the data part of the iSCSI PDU. +(not yet tested) .It Cm MaxConnections is the number of simultaneous connections per session, currently only 1. Modified: head/sbin/iscontrol/login.c ============================================================================== --- head/sbin/iscontrol/login.c Mon Aug 9 09:26:17 2010 (r211094) +++ head/sbin/iscontrol/login.c Mon Aug 9 12:36:36 2010 (r211095) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2008 Daniel Braniss + * Copyright (c) 2005-2010 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "iscsi.h" +#include #include "iscontrol.h" static char *status_class1[] = { @@ -107,7 +107,7 @@ getkeyval(char *key, pdu_t *pp) debug_called(3); len = pp->ds_len; - ptr = (char *)pp->ds; + ptr = (char *)pp->ds_addr; klen = strlen(key); while(len > klen) { if(strncmp(key, ptr, klen) == 0) @@ -163,7 +163,7 @@ processParams(isess_t *sess, pdu_t *pp) debug_called(3); len = pp->ds_len; - ptr = (char *)pp->ds; + ptr = (char *)pp->ds_addr; while(len > 0) { if(vflag > 1) printf("got: len=%d %s\n", len, ptr); @@ -233,7 +233,7 @@ handleLoginResp(isess_t *sess, pdu_t *pp st_class = status >> 8; if(status) { - int st_detail = status & 0xff; + uint st_detail = status & 0xff; switch(st_class) { case 1: // Redirect Modified: head/sbin/iscontrol/misc.c ============================================================================== --- head/sbin/iscontrol/misc.c Mon Aug 9 09:26:17 2010 (r211094) +++ head/sbin/iscontrol/misc.c Mon Aug 9 12:36:36 2010 (r211095) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2008 Daniel Braniss + * Copyright (c) 2005-2010 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,6 +47,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include "iscontrol.h" + static inline char c2b(unsigned char c) { Modified: head/sbin/iscontrol/pdu.c ============================================================================== --- head/sbin/iscontrol/pdu.c Mon Aug 9 09:26:17 2010 (r211094) +++ head/sbin/iscontrol/pdu.c Mon Aug 9 12:36:36 2010 (r211095) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2008 Daniel Braniss + * Copyright (c) 2005-2010 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "iscsi.h" +#include #include "iscontrol.h" static void pukeText(char *it, pdu_t *pp); @@ -85,7 +85,7 @@ sendPDU(isess_t *sess, pdu_t *pp, handle int res; pp->ahs_size = 8 * 1024; - if((pp->ahs = malloc(pp->ahs_size)) == NULL) { + if((pp->ahs_addr = malloc(pp->ahs_size)) == NULL) { fprintf(stderr, "out of mem!"); return -1; } @@ -126,16 +126,16 @@ addText(pdu_t *pp, char *fmt, ...) if((pp->ds_len + len) > pp->ds_size) { u_char *np; - np = realloc(pp->ds, pp->ds_size + len + FUDGE); + np = realloc(pp->ds_addr, pp->ds_size + len + FUDGE); if(np == NULL) { free(str); //XXX: out of memory! return -1; } - pp->ds = np; + pp->ds_addr = np; pp->ds_size += len + FUDGE; } - memcpy(pp->ds + pp->ds_len, str, len); + memcpy(pp->ds_addr + pp->ds_len, str, len); pp->ds_len += len; free(str); return len; @@ -145,12 +145,12 @@ void freePDU(pdu_t *pp) { if(pp->ahs_size) - free(pp->ahs); + free(pp->ahs_addr); if(pp->ds_size) - free(pp->ds); + free(pp->ds_addr); bzero(&pp->ipdu, sizeof(union ipdu_u)); - pp->ahs = NULL; - pp->ds = NULL; + pp->ahs_addr = NULL; + pp->ds_addr = NULL; pp->ahs_size = 0; pp->ds_size = pp->ds_len = 0; } @@ -163,7 +163,7 @@ pukeText(char *it, pdu_t *pp) size_t len, n; len = pp->ds_len; - ptr = (char *)pp->ds; + ptr = (char *)pp->ds_addr; cmd = pp->ipdu.bhs.opcode; printf("%s: cmd=0x%x len=%d\n", it, cmd, (int)len); Modified: head/sys/dev/iscsi/initiator/isc_cam.c ============================================================================== --- head/sys/dev/iscsi/initiator/isc_cam.c Mon Aug 9 09:26:17 2010 (r211094) +++ head/sys/dev/iscsi/initiator/isc_cam.c Mon Aug 9 12:36:36 2010 (r211095) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2008 Daniel Braniss + * Copyright (c) 2005-2010 Daniel Braniss * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,7 +24,9 @@ * SUCH DAMAGE. * */ - +/* + | $Id: isc_cam.c 998 2009-12-20 10:32:45Z danny $ + */ #include __FBSDID("$FreeBSD$"); @@ -43,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -53,52 +56,70 @@ __FBSDID("$FreeBSD$"); #include #include -// XXX: untested/incomplete -void -ic_freeze(isc_session_t *sp) +static void +_inq(struct cam_sim *sim, union ccb *ccb) { + struct ccb_pathinq *cpi = &ccb->cpi; + isc_session_t *sp = cam_sim_softc(sim); + debug_called(8); -#if 0 - sdebug(2, "freezing path=%p", sp->cam_path == NULL? 0: sp->cam_path); - if((sp->cam_path != NULL) && !(sp->flags & ISC_FROZEN)) { - xpt_freeze_devq(sp->cam_path, 1); - } + debug(3, "sid=%d target=%d lun=%d", sp->sid, ccb->ccb_h.target_id, ccb->ccb_h.target_lun); + + cpi->version_num = 1; /* XXX??? */ + cpi->hba_inquiry = PI_SDTR_ABLE | PI_TAG_ABLE | PI_WIDE_32; + cpi->target_sprt = 0; + cpi->hba_misc = 0; + cpi->hba_eng_cnt = 0; + cpi->max_target = 0; //ISCSI_MAX_TARGETS - 1; + cpi->initiator_id = ISCSI_MAX_TARGETS; + cpi->max_lun = sp->opt.maxluns - 1; + cpi->bus_id = cam_sim_bus(sim); + cpi->base_transfer_speed = 3300; // 40000; // XXX: + strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); + strncpy(cpi->hba_vid, "iSCSI", HBA_IDLEN); + strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); + cpi->unit_number = cam_sim_unit(sim); + cpi->ccb_h.status = CAM_REQ_CMP; +#if defined(KNOB_VALID_ADDRESS) + cpi->transport = XPORT_ISCSI; + cpi->transport_version = 0; #endif - sp->flags |= ISC_FROZEN; } -// XXX: untested/incomplete -void -ic_release(isc_session_t *sp) +static __inline int +_scsi_encap(struct cam_sim *sim, union ccb *ccb) { - debug_called(8); -#if 0 - sdebug(2, "release path=%p", sp->cam_path == NULL? 0: sp->cam_path); - if((sp->cam_path != NULL) && (sp->flags & ISC_FROZEN)) { - xpt_release_devq(sp->cam_path, 1, TRUE); - } + int ret; + +#if __FreeBSD_version < 700000 + ret = scsi_encap(sim, ccb); +#else + isc_session_t *sp = cam_sim_softc(sim); + + mtx_unlock(&sp->cam_mtx); + ret = scsi_encap(sim, ccb); + mtx_lock(&sp->cam_mtx); #endif - sp->flags &= ~ISC_FROZEN; + return ret; } void ic_lost_target(isc_session_t *sp, int target) { - struct isc_softc *isp = sp->isc; - debug_called(8); - sdebug(2, "target=%d", target); + sdebug(2, "lost target=%d", target); + if(sp->cam_path != NULL) { - mtx_lock(&isp->cam_mtx); + mtx_lock(&sp->cam_mtx); xpt_async(AC_LOST_DEVICE, sp->cam_path, NULL); xpt_free_path(sp->cam_path); - mtx_unlock(&isp->cam_mtx); + mtx_unlock(&sp->cam_mtx); sp->cam_path = 0; // XXX } } static void -_scan_callback(struct cam_periph *periph, union ccb *ccb) +scan_callback(struct cam_periph *periph, union ccb *ccb) { isc_session_t *sp = (isc_session_t *)ccb->ccb_h.spriv_ptr0; @@ -106,63 +127,52 @@ _scan_callback(struct cam_periph *periph free(ccb, M_TEMP); - if(sp->flags & ISC_FFPWAIT) { - sp->flags &= ~ISC_FFPWAIT; + if(sp->flags & ISC_SCANWAIT) { + sp->flags &= ~ISC_SCANWAIT; wakeup(sp); } } -static void -_scan_target(isc_session_t *sp, int target) +static int +ic_scan(isc_session_t *sp) { - union ccb *ccb; + union ccb *ccb; debug_called(8); - sdebug(2, "target=%d", target); + sdebug(2, "scanning sid=%d", sp->sid); if((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK | M_ZERO)) == NULL) { xdebug("scan failed (can't allocate CCB)"); - return; + return ENOMEM; // XXX } - CAM_LOCK(sp->isc); - xpt_setup_ccb(&ccb->ccb_h, sp->cam_path, 5/*priority (low)*/); - ccb->ccb_h.func_code = XPT_SCAN_BUS; - ccb->ccb_h.cbfcnp = _scan_callback; - ccb->crcn.flags = CAM_FLAG_NONE; - ccb->ccb_h.spriv_ptr0 = sp; - xpt_action(ccb); - CAM_UNLOCK(sp->isc); -} - -int -ic_fullfeature(struct cdev *dev) -{ - struct isc_softc *isp = dev->si_drv1; - isc_session_t *sp = (isc_session_t *)dev->si_drv2; + sp->flags &= ~ISC_CAMDEVS; + sp->flags |= ISC_SCANWAIT; - debug_called(8); - sdebug(3, "dev=%d sc=%p", dev2unit(dev), isp); - - sp->flags &= ~ISC_FFPHASE; - sp->flags |= ISC_FFPWAIT; - - CAM_LOCK(isp); - if(xpt_create_path(&sp->cam_path, xpt_periph, cam_sim_path(sp->isc->cam_sim), - sp->sid, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + CAM_LOCK(sp); + if(xpt_create_path(&sp->cam_path, xpt_periph, cam_sim_path(sp->cam_sim), + 0, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xdebug("can't create cam path"); - CAM_UNLOCK(isp); + CAM_UNLOCK(sp); + free(ccb, M_TEMP); return ENODEV; // XXX } - CAM_UNLOCK(isp); + xpt_setup_ccb(&ccb->ccb_h, sp->cam_path, 5/*priority (low)*/); + ccb->ccb_h.func_code = XPT_SCAN_BUS; + ccb->ccb_h.cbfcnp = scan_callback; + ccb->crcn.flags = CAM_FLAG_NONE; + ccb->ccb_h.spriv_ptr0 = sp; - _scan_target(sp, sp->sid); + xpt_action(ccb); + CAM_UNLOCK(sp); - while(sp->flags & ISC_FFPWAIT) + while(sp->flags & ISC_SCANWAIT) tsleep(sp, PRIBIO, "ffp", 5*hz); // the timeout time should // be configurable + sdebug(2, "# of luns=%d", sp->target_nluns); + if(sp->target_nluns > 0) { - sp->flags |= ISC_FFPHASE; + sp->flags |= ISC_CAMDEVS; return 0; } @@ -170,110 +180,25 @@ ic_fullfeature(struct cdev *dev) } static void -_inq(struct cam_sim *sim, union ccb *ccb, int maxluns) -{ - struct ccb_pathinq *cpi = &ccb->cpi; - - debug_called(4); - - cpi->version_num = 1; /* XXX??? */ - cpi->hba_inquiry = PI_SDTR_ABLE | PI_TAG_ABLE | PI_WIDE_32; - cpi->target_sprt = 0; - cpi->hba_misc = 0; - cpi->hba_eng_cnt = 0; - cpi->max_target = ISCSI_MAX_TARGETS - 1; - cpi->initiator_id = ISCSI_MAX_TARGETS; - cpi->max_lun = maxluns; - cpi->bus_id = cam_sim_bus(sim); - cpi->base_transfer_speed = 3300; - strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); - strncpy(cpi->hba_vid, "iSCSI", HBA_IDLEN); - strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); - cpi->unit_number = cam_sim_unit(sim); - cpi->transport = XPORT_ISCSI; - cpi->transport_version = 0; - cpi->ccb_h.status = CAM_REQ_CMP; -} - -static __inline int -_scsi_encap(struct cam_sim *sim, union ccb *ccb) -{ - int ret; - -#if __FreeBSD_version < 700000 - ret = scsi_encap(sim, ccb); -#else - struct isc_softc *isp = (struct isc_softc *)cam_sim_softc(sim); - - mtx_unlock(&isp->cam_mtx); - ret = scsi_encap(sim, ccb); - mtx_lock(&isp->cam_mtx); -#endif - return ret; -} - -static void ic_action(struct cam_sim *sim, union ccb *ccb) { + isc_session_t *sp = cam_sim_softc(sim); struct ccb_hdr *ccb_h = &ccb->ccb_h; - struct isc_softc *isp = (struct isc_softc *)cam_sim_softc(sim); - isc_session_t *sp; debug_called(8); - if((ccb_h->target_id != CAM_TARGET_WILDCARD) && (ccb_h->target_id < MAX_SESSIONS)) - sp = isp->sessions[ccb_h->target_id]; - else - sp = NULL; - ccb_h->spriv_ptr0 = sp; - - debug(4, "func_code=0x%x flags=0x%x status=0x%x target=%d lun=%d retry_count=%d timeout=%d", + sdebug(4, "func_code=0x%x flags=0x%x status=0x%x target=%d lun=%d retry_count=%d timeout=%d", ccb_h->func_code, ccb->ccb_h.flags, ccb->ccb_h.status, ccb->ccb_h.target_id, ccb->ccb_h.target_lun, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 14:25:58 2010 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 9D478106567B; Mon, 9 Aug 2010 14:25:58 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B9E28FC14; Mon, 9 Aug 2010 14:25:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79EPw9K015191; Mon, 9 Aug 2010 14:25:58 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79EPwx3015189; Mon, 9 Aug 2010 14:25:58 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201008091425.o79EPwx3015189@svn.freebsd.org> From: Fabien Thomas Date: Mon, 9 Aug 2010 14:25:58 +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: r211096 - stable/8/usr.sbin/pmcstat 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, 09 Aug 2010 14:25:58 -0000 Author: fabient Date: Mon Aug 9 14:25:58 2010 New Revision: 211096 URL: http://svn.freebsd.org/changeset/base/211096 Log: MFC r210766: Fix the calltree top view that incorrectly filter out some nodes. Modified: stable/8/usr.sbin/pmcstat/pmcpl_calltree.c Directory Properties: stable/8/usr.sbin/pmcstat/ (props changed) Modified: stable/8/usr.sbin/pmcstat/pmcpl_calltree.c ============================================================================== --- stable/8/usr.sbin/pmcstat/pmcpl_calltree.c Mon Aug 9 12:36:36 2010 (r211095) +++ stable/8/usr.sbin/pmcstat/pmcpl_calltree.c Mon Aug 9 14:25:58 2010 (r211096) @@ -354,6 +354,7 @@ pmcpl_ct_node_dumptop(int pmcin, struct struct pmcpl_ct_sample *rsamples, int x, int *y) { int i, terminal; + struct pmcpl_ct_arc *arc; if (ct->pct_flags & PMCPL_PCT_TAG) return 0; @@ -372,12 +373,17 @@ pmcpl_ct_node_dumptop(int pmcin, struct * for at least one arc for that PMC. */ terminal = 1; - for (i = 0; i < ct->pct_narc; i++) + for (i = 0; i < ct->pct_narc; i++) { + arc = &ct->pct_arc[i]; if (PMCPL_CT_SAMPLE(pmcin, - &ct->pct_arc[i].pcta_samples) != 0) { + &arc->pcta_samples) != 0 && + PMCPL_CT_SAMPLEP(pmcin, + &arc->pcta_samples) > pmcstat_threshold && + (arc->pcta_child->pct_flags & PMCPL_PCT_TAG) == 0) { terminal = 0; break; } + } if (ct->pct_narc == 0 || terminal) { pmcpl_ct_topscreen[x+1][*y] = NULL; From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 14:26:52 2010 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 C7A261065670; Mon, 9 Aug 2010 14:26:52 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5EBC8FC14; Mon, 9 Aug 2010 14:26:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79EQq3a015438; Mon, 9 Aug 2010 14:26:52 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79EQqQp015436; Mon, 9 Aug 2010 14:26:52 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201008091426.o79EQqQp015436@svn.freebsd.org> From: Fabien Thomas Date: Mon, 9 Aug 2010 14:26: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: r211097 - stable/7/usr.sbin/pmcstat 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, 09 Aug 2010 14:26:52 -0000 Author: fabient Date: Mon Aug 9 14:26:52 2010 New Revision: 211097 URL: http://svn.freebsd.org/changeset/base/211097 Log: MFC r210766: Fix the calltree top view that incorrectly filter out some nodes. Modified: stable/7/usr.sbin/pmcstat/pmcpl_calltree.c Directory Properties: stable/7/usr.sbin/pmcstat/ (props changed) Modified: stable/7/usr.sbin/pmcstat/pmcpl_calltree.c ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcpl_calltree.c Mon Aug 9 14:25:58 2010 (r211096) +++ stable/7/usr.sbin/pmcstat/pmcpl_calltree.c Mon Aug 9 14:26:52 2010 (r211097) @@ -354,6 +354,7 @@ pmcpl_ct_node_dumptop(int pmcin, struct struct pmcpl_ct_sample *rsamples, int x, int *y) { int i, terminal; + struct pmcpl_ct_arc *arc; if (ct->pct_flags & PMCPL_PCT_TAG) return 0; @@ -372,12 +373,17 @@ pmcpl_ct_node_dumptop(int pmcin, struct * for at least one arc for that PMC. */ terminal = 1; - for (i = 0; i < ct->pct_narc; i++) + for (i = 0; i < ct->pct_narc; i++) { + arc = &ct->pct_arc[i]; if (PMCPL_CT_SAMPLE(pmcin, - &ct->pct_arc[i].pcta_samples) != 0) { + &arc->pcta_samples) != 0 && + PMCPL_CT_SAMPLEP(pmcin, + &arc->pcta_samples) > pmcstat_threshold && + (arc->pcta_child->pct_flags & PMCPL_PCT_TAG) == 0) { terminal = 0; break; } + } if (ct->pct_narc == 0 || terminal) { pmcpl_ct_topscreen[x+1][*y] = NULL; From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 14:26:52 2010 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 F07471065672; Mon, 9 Aug 2010 14:26:52 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6916A8FC0C; Mon, 9 Aug 2010 14:26:51 +0000 (UTC) Received: by wyj26 with SMTP id 26so12557199wyj.13 for ; Mon, 09 Aug 2010 07:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=U5f5SO+QDvgrHg7ORM2iO+IszjwrwLglWId/WBfXvYg=; b=aWnJ9p4vFqyrCLpeMT3MC7kX+N2bETy9Y7lled8tsXf6jj8pb1Gm9SCDqnxRXWSlUH zJ5vGFOGvWUJwcpmHtVHDvcV5zqRP5gLil9Q0Q2s4o/duHx8j/YQ8xwRPLq2o3Ont95w VjJMNJgE6fuW48aPgq9NKW8TEYqqsJ0TVpr5Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=f2D7CDU5kkQuRm9NKax/xtUZOun/cT2f6FQWRgVI1eEjdsVvGMfs3rsF2EgbWoaMwQ j8zwTzMvzmeWSqSwo1QbyJ1k7cQfbE5t3/LgHGjCXw5bbupc0elHe+C5AIhh9fgXa6ht hGGP5qnTxKc+1Xpo/a3UHHsS/p4iPARd/fnfM= MIME-Version: 1.0 Received: by 10.227.145.20 with SMTP id b20mr13993879wbv.28.1281364010084; Mon, 09 Aug 2010 07:26:50 -0700 (PDT) Received: by 10.216.160.10 with HTTP; Mon, 9 Aug 2010 07:26:49 -0700 (PDT) In-Reply-To: References: <201005161943.o4GJhnTo096839@svn.freebsd.org> Date: Mon, 9 Aug 2010 19:56:49 +0530 Message-ID: From: "Jayachandran C." To: Attilio Rao Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, John Baldwin , "Jayachandran C." , svn-src-all@freebsd.org, Joe Landers , Randall Stewart , sbruno@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r208165 - in head/sys: kern mips/conf mips/include mips/mips mips/rmi mips/rmi/dev/xlr 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, 09 Aug 2010 14:26:53 -0000 On Mon, Aug 9, 2010 at 5:35 PM, Attilio Rao wrote: > 2010/8/9 Jayachandran C. : >> On Mon, Aug 9, 2010 at 5:31 AM, Attilio Rao wrote: >>> 2010/5/16 Randall Stewart : >>>> Author: rrs >>>> Date: Sun May 16 19:43:48 2010 >>>> New Revision: 208165 >>>> URL: http://svn.freebsd.org/changeset/base/208165 >>>> >>>> Log: >>>> =A0This pushes all of JC's patches that I have in place. I >>>> =A0am now able to run 32 cores ok.. but I still will hang >>>> =A0on buildworld with a NFS problem. I suspect I am missing >>>> =A0a patch for the netlogic rge driver. >>>> >>>> =A0JC check and see if I am missing anything except your >>>> =A0core-mask changes >>> >>> >>>> Modified: head/sys/kern/subr_smp.c >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/kern/subr_smp.c =A0 =A0Sun May 16 19:25:56 2010 =A0 =A0 = =A0 =A0(r208164) >>>> +++ head/sys/kern/subr_smp.c =A0 =A0Sun May 16 19:43:48 2010 =A0 =A0 = =A0 =A0(r208165) >>>> @@ -503,7 +503,10 @@ smp_topo_none(void) >>>> =A0 =A0 =A0 =A0top =3D &group[0]; >>>> =A0 =A0 =A0 =A0top->cg_parent =3D NULL; >>>> =A0 =A0 =A0 =A0top->cg_child =3D NULL; >>>> - =A0 =A0 =A0 top->cg_mask =3D (1 << mp_ncpus) - 1; >>>> + =A0 =A0 =A0 if (mp_ncpus =3D=3D sizeof(top->cg_mask) * 8) >>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 top->cg_mask =3D -1; >>>> + =A0 =A0 =A0 else >>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 top->cg_mask =3D (1 << mp_ncpus) - 1; >>>> =A0 =A0 =A0 =A0top->cg_count =3D mp_ncpus; >>>> =A0 =A0 =A0 =A0top->cg_children =3D 0; >>>> =A0 =A0 =A0 =A0top->cg_level =3D CG_SHARE_NONE; >>>> >>> >>> ... and this is why I particulary hate big commits with complete lack >>> of technical details. >>> >>> This particulary chunk was supposed to fix a nasty and completely MI >>> bug that some users have already met (kern/148698). The complete lack >>> of details didn't help in identify the issue neither that it was a >>> valuable fix. >>> >>> The fix is, however, improper (there is no clear relationship between >>> the multiplication and why that happens) thus I would rather use what >>> Joe has reported in the PR. >> >> >> I was not aware of the PR when I sent this changes to rrs@, and this >> went as a part of MIPS SMP support for XLR which has 32 CPUs >> >> But I'm not sure that the current change is correct, cg_mask is of >> type cpumask_t and I don't think it is guaranteed to be 32 bit (as it >> is a machine dependent type). > > Actually the 32 bits limit is well aware and acknowledged in cpumask_t. > While it is true that it should be an 'opaque' type, in reality it is > not. The maximum limit of 32 CPUs is a reality due to cpumask_t on all > our architectures. > That is why we are going to use cpuset_t for dealing with CPUs numbers > (which is really opaque, at same extent, and is not bound to any > size). In my opinion, your changes added another pitfall for the person who tries to make the cpumask_t 64 bit to support more cpus, which really could have been avoided. But if cpumask_t is going to be changed to cpuset_t soon, I guess we are fine :) JC. From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 14:29:23 2010 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 4CD53106566C; Mon, 9 Aug 2010 14:29:23 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A0128FC16; Mon, 9 Aug 2010 14:29:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79ETNFE016056; Mon, 9 Aug 2010 14:29:23 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79ETNuj016053; Mon, 9 Aug 2010 14:29:23 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201008091429.o79ETNuj016053@svn.freebsd.org> From: Fabien Thomas Date: Mon, 9 Aug 2010 14:29:23 +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: r211098 - stable/8/usr.sbin/pmcstat 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, 09 Aug 2010 14:29:23 -0000 Author: fabient Date: Mon Aug 9 14:29:23 2010 New Revision: 211098 URL: http://svn.freebsd.org/changeset/base/211098 Log: MFC r210794: Allow file as a top source, it works with socket now. This will allow top monitoring using socket/ssh tunnelling of system without local symbols. client: pmcstat -R : -T -r monitored device: pmcstat -Sinstructions -O : - Move the file read in the event loop - Initialize and clean log in all cases - Preserve global stats value during top refresh - Fix the rtld/line resolver that ignore '-r' prefix - Support socket for '-R' (server mode) - Display the statistics when exiting top mode Modified: stable/8/usr.sbin/pmcstat/pmcstat.c stable/8/usr.sbin/pmcstat/pmcstat_log.c Directory Properties: stable/8/usr.sbin/pmcstat/ (props changed) Modified: stable/8/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- stable/8/usr.sbin/pmcstat/pmcstat.c Mon Aug 9 14:26:52 2010 (r211097) +++ stable/8/usr.sbin/pmcstat/pmcstat.c Mon Aug 9 14:29:23 2010 (r211098) @@ -169,8 +169,7 @@ pmcstat_cleanup(void) args.pa_logparser = NULL; } - if (args.pa_flags & (FLAG_HAS_PIPE | FLAG_HAS_OUTPUT_LOGFILE)) - pmcstat_shutdown_logging(); + pmcstat_shutdown_logging(); } void @@ -559,7 +558,7 @@ main(int argc, char **argv) int do_print; size_t dummy; int graphdepth; - int pipefd[2]; + int pipefd[2], rfd; int use_cumulative_counts; short cf, cb; uint32_t cpumask; @@ -1001,11 +1000,6 @@ main(int argc, char **argv) (args.pa_flags & FLAG_READ_LOGFILE) == 0) errx(EX_USAGE, "ERROR: option -M is only used with -g/-R."); - /* -T is incompatible with -R (replay logfile is a TODO) */ - if ((args.pa_flags & FLAG_DO_TOP) && - (args.pa_flags & FLAG_READ_LOGFILE)) - errx(EX_USAGE, "ERROR: option -T is incompatible with -R."); - /* * Disallow textual output of sampling PMCs if counting PMCs * have also been asked for, mostly because the combined output @@ -1066,7 +1060,22 @@ main(int argc, char **argv) graphfilename); } - /* if we've been asked to process a log file, do that and exit */ + /* if we've been asked to process a log file, skip init */ + if ((args.pa_flags & FLAG_READ_LOGFILE) == 0) { + if (pmc_init() < 0) + err(EX_UNAVAILABLE, + "ERROR: Initialization of the pmc(3) library failed"); + + if ((npmc = pmc_npmc(0)) < 0) /* assume all CPUs are identical */ + err(EX_OSERR, "ERROR: Cannot determine the number of PMCs " + "on CPU %d", 0); + } + + /* Allocate a kqueue */ + if ((pmcstat_kq = kqueue()) < 0) + err(EX_OSERR, "ERROR: Cannot allocate kqueue"); + + /* Setup the logfile as the source. */ if (args.pa_flags & FLAG_READ_LOGFILE) { /* * Print the log in textual form if we haven't been @@ -1076,28 +1085,17 @@ main(int argc, char **argv) args.pa_flags |= FLAG_DO_PRINT; pmcstat_initialize_logging(); - args.pa_logfd = pmcstat_open_log(args.pa_inputpath, + rfd = pmcstat_open_log(args.pa_inputpath, PMCSTAT_OPEN_FOR_READ); - if ((args.pa_logparser = pmclog_open(args.pa_logfd)) == NULL) + if ((args.pa_logparser = pmclog_open(rfd)) == NULL) err(EX_OSERR, "ERROR: Cannot create parser"); - pmcstat_process_log(); - pmcstat_shutdown_logging(); - exit(EX_OK); + if (fcntl(rfd, F_SETFL, O_NONBLOCK) < 0) + err(EX_OSERR, "ERROR: fcntl(2) failed"); + EV_SET(&kev, rfd, EVFILT_READ, EV_ADD, + 0, 0, NULL); + if (kevent(pmcstat_kq, &kev, 1, NULL, 0, NULL) < 0) + err(EX_OSERR, "ERROR: Cannot register kevent"); } - - /* otherwise, we've been asked to collect data */ - if (pmc_init() < 0) - err(EX_UNAVAILABLE, - "ERROR: Initialization of the pmc(3) library failed"); - - if ((npmc = pmc_npmc(0)) < 0) /* assume all CPUs are identical */ - err(EX_OSERR, "ERROR: Cannot determine the number of PMCs " - "on CPU %d", 0); - - /* Allocate a kqueue */ - if ((pmcstat_kq = kqueue()) < 0) - err(EX_OSERR, "ERROR: Cannot allocate kqueue"); - /* * Configure the specified log file or setup a default log * consumer via a pipe. @@ -1140,6 +1138,7 @@ main(int argc, char **argv) (args.pa_flags & FLAG_HAS_OUTPUT_LOGFILE); /* + if (args.pa_flags & FLAG_READ_LOGFILE) { * Allocate PMCs. */ @@ -1272,10 +1271,8 @@ main(int argc, char **argv) if (args.pa_flags & FLAG_HAS_COMMANDLINE) pmcstat_start_process(); - /* initialize logging if printing the configured log */ - if ((args.pa_flags & (FLAG_DO_PRINT | FLAG_DO_TOP)) && - (args.pa_flags & (FLAG_HAS_PIPE | FLAG_HAS_OUTPUT_LOGFILE))) - pmcstat_initialize_logging(); + /* initialize logging */ + pmcstat_initialize_logging(); /* Handle SIGINT using the kqueue loop */ sa.sa_handler = SIG_IGN; @@ -1338,16 +1335,13 @@ main(int argc, char **argv) switch (kev.filter) { case EVFILT_PROC: /* target has exited */ - if (args.pa_flags & (FLAG_HAS_OUTPUT_LOGFILE | - FLAG_HAS_PIPE)) - runstate = pmcstat_close_log(); - else - runstate = PMCSTAT_FINISHED; + runstate = pmcstat_close_log(); do_print = 1; break; case EVFILT_READ: /* log file data is present */ - if (kev.ident == (unsigned)fileno(stdin)) { + if (kev.ident == (unsigned)fileno(stdin) && + (args.pa_flags & FLAG_DO_TOP)) { if (pmcstat_keypress_log()) runstate = pmcstat_close_log(); } else @@ -1370,15 +1364,8 @@ main(int argc, char **argv) * of its targets, or if logfile * writes encounter an error. */ - if (args.pa_flags & (FLAG_HAS_OUTPUT_LOGFILE | - FLAG_HAS_PIPE)) { - runstate = pmcstat_close_log(); - if (args.pa_flags & - (FLAG_DO_PRINT|FLAG_DO_ANALYSIS)) - pmcstat_process_log(); - } + runstate = pmcstat_close_log(); do_print = 1; /* print PMCs at exit */ - runstate = PMCSTAT_FINISHED; } else if (kev.ident == SIGINT) { /* Kill the child process if we started it */ if (args.pa_flags & FLAG_HAS_COMMANDLINE) @@ -1386,7 +1373,7 @@ main(int argc, char **argv) /* Close the pipe to self, if present. */ if (args.pa_flags & FLAG_HAS_PIPE) (void) close(pipefd[READPIPEFD]); - runstate = PMCSTAT_FINISHED; + runstate = pmcstat_close_log(); } else if (kev.ident == SIGWINCH) { if (ioctl(fileno(args.pa_printfile), TIOCGWINSZ, &ws) < 0) Modified: stable/8/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- stable/8/usr.sbin/pmcstat/pmcstat_log.c Mon Aug 9 14:26:52 2010 (r211097) +++ stable/8/usr.sbin/pmcstat/pmcstat_log.c Mon Aug 9 14:29:23 2010 (r211098) @@ -141,6 +141,7 @@ struct pmcstat_image_hash_list pmcstat_i struct pmcstat_process_hash_list pmcstat_process_hash[PMCSTAT_NHASH]; struct pmcstat_stats pmcstat_stats; /* statistics */ +int ps_samples_period; /* samples count between top refresh. */ struct pmcstat_process *pmcstat_kernproc; /* kernel 'process' */ @@ -247,7 +248,7 @@ static int pmcstat_string_compute_hash(c static void pmcstat_string_initialize(void); static int pmcstat_string_lookup_hash(pmcstat_interned_string _is); static void pmcstat_string_shutdown(void); -static void pmcstat_stats_reset(void); +static void pmcstat_stats_reset(int _reset_global); /* * A simple implementation of interned strings. Each interned string @@ -276,7 +277,7 @@ int pmcstat_npmcs; int pmcstat_pause; static void -pmcstat_stats_reset(void) +pmcstat_stats_reset(int reset_global) { struct pmcstat_pmcrecord *pr; @@ -285,9 +286,11 @@ pmcstat_stats_reset(void) pr->pr_samples = 0; pr->pr_dubious_frames = 0; } + ps_samples_period = 0; /* Flush global stats. */ - bzero(&pmcstat_stats, sizeof(struct pmcstat_stats)); + if (reset_global) + bzero(&pmcstat_stats, sizeof(struct pmcstat_stats)); } /* @@ -606,7 +609,7 @@ pmcstat_image_get_elf_params(struct pmcs GElf_Phdr ph; GElf_Shdr sh; enum pmcstat_image_type image_type; - char buffer[PATH_MAX]; + char buffer[PATH_MAX], rtldpath[PATH_MAX]; assert(image->pi_type == PMCSTAT_IMAGE_UNKNOWN); @@ -686,9 +689,10 @@ pmcstat_image_get_elf_params(struct pmcs buffer, elf_errmsg(-1)); goto done; } + snprintf(rtldpath, sizeof(rtldpath), "%s%s", + args.pa_fsroot, elfbase + ph.p_offset); image->pi_dynlinkerpath = - pmcstat_string_intern(elfbase + - ph.p_offset); + pmcstat_string_intern(rtldpath); break; case PT_LOAD: if (ph.p_offset == 0) @@ -944,11 +948,13 @@ pmcstat_image_addr2line(struct pmcstat_i int fd; if (image->pi_addr2line == NULL) { - snprintf(imagepath, sizeof(imagepath), "%s.symbols", + snprintf(imagepath, sizeof(imagepath), "%s%s.symbols", + args.pa_fsroot, pmcstat_string_unintern(image->pi_fullpath)); fd = open(imagepath, O_RDONLY); if (fd < 0) { - snprintf(imagepath, sizeof(imagepath), "%s", + snprintf(imagepath, sizeof(imagepath), "%s%s", + args.pa_fsroot, pmcstat_string_unintern(image->pi_fullpath)); } else close(fd); @@ -1399,6 +1405,7 @@ pmcstat_analyze_log(void) * bin inside this. */ pmcstat_stats.ps_samples_total++; + ps_samples_period++; pc = ev.pl_u.pl_s.pl_pc; pp = pmcstat_process_lookup(ev.pl_u.pl_s.pl_pid, @@ -1425,6 +1432,7 @@ pmcstat_analyze_log(void) case PMCLOG_TYPE_CALLCHAIN: pmcstat_stats.ps_samples_total++; + ps_samples_period++; cpuflags = ev.pl_u.pl_cc.pl_cpuflags; cpu = PMC_CALLCHAIN_CPUFLAGS_TO_CPU(cpuflags); @@ -1691,8 +1699,15 @@ pmcstat_print_log(void) int pmcstat_close_log(void) { - if (pmc_flush_logfile() < 0) - err(EX_OSERR, "ERROR: logging failed"); + /* If a local logfile is configured ask the kernel to stop + * and flush data. Kernel will close the file when data is flushed + * so keep the status to EXITING. + */ + if (args.pa_logfd != -1) { + if (pmc_flush_logfile() < 0) + err(EX_OSERR, "ERROR: logging failed"); + } + return (args.pa_flags & FLAG_HAS_PIPE ? PMCSTAT_EXITING : PMCSTAT_FINISHED); } @@ -1709,7 +1724,7 @@ pmcstat_close_log(void) int pmcstat_open_log(const char *path, int mode) { - int error, fd; + int error, fd, cfd; size_t hlen; const char *p, *errstr; struct addrinfo hints, *res, *res0; @@ -1730,7 +1745,7 @@ pmcstat_open_log(const char *path, int m */ if (path[0] == '-' && path[1] == '\0') fd = (mode == PMCSTAT_OPEN_FOR_READ) ? 0 : 1; - else if (mode == PMCSTAT_OPEN_FOR_WRITE && path[0] != '/' && + else if (path[0] != '/' && path[0] != '.' && strchr(path, ':') != NULL) { p = strrchr(path, ':'); @@ -1759,11 +1774,29 @@ pmcstat_open_log(const char *path, int m errstr = strerror(errno); continue; } - if (connect(fd, res->ai_addr, res->ai_addrlen) < 0) { - errstr = strerror(errno); + if (mode == PMCSTAT_OPEN_FOR_READ) { + if (bind(fd, res->ai_addr, res->ai_addrlen) < 0) { + errstr = strerror(errno); + (void) close(fd); + fd = -1; + continue; + } + listen(fd, 1); + cfd = accept(fd, NULL, NULL); (void) close(fd); - fd = -1; - continue; + if (cfd < 0) { + errstr = strerror(errno); + fd = -1; + break; + } + fd = cfd; + } else { + if (connect(fd, res->ai_addr, res->ai_addrlen) < 0) { + errstr = strerror(errno); + (void) close(fd); + fd = -1; + continue; + } } errstr = NULL; break; @@ -1833,9 +1866,8 @@ pmcstat_refresh_top(void) pmcstat_pmcinfilter); /* Format samples count. */ - if (pmcstat_stats.ps_samples_total > 0) - v = (pmcpr->pr_samples * 100.0) / - pmcstat_stats.ps_samples_total; + if (ps_samples_period > 0) + v = (pmcpr->pr_samples * 100.0) / ps_samples_period; else v = 0.; v_attrs = PMCSTAT_ATTRPERCENT(v); @@ -1872,7 +1904,7 @@ pmcstat_changefilter(void) do { pmcr = pmcstat_pmcindex_to_pmcr(pmcstat_pmcinfilter); - if (pmcr == pmcr->pr_merge) + if (pmcr == NULL || pmcr == pmcr->pr_merge) break; pmcstat_pmcinfilter++; @@ -1915,7 +1947,7 @@ pmcstat_keypress_log(void) */ if (plugins[args.pa_plugin].pl_shutdown != NULL) plugins[args.pa_plugin].pl_shutdown(NULL); - pmcstat_stats_reset(); + pmcstat_stats_reset(0); if (plugins[args.pa_plugin].pl_init != NULL) plugins[args.pa_plugin].pl_init(); @@ -1936,7 +1968,7 @@ pmcstat_keypress_log(void) } while (plugins[args.pa_plugin].pl_topdisplay == NULL); /* Open new plugin. */ - pmcstat_stats_reset(); + pmcstat_stats_reset(0); if (plugins[args.pa_plugin].pl_init != NULL) plugins[args.pa_plugin].pl_init(); wprintw(w, "switching to plugin %s", @@ -1986,7 +2018,7 @@ pmcstat_display_log(void) if (args.pa_topmode == PMCSTAT_TOP_DELTA) { if (plugins[args.pa_plugin].pl_shutdown != NULL) plugins[args.pa_plugin].pl_shutdown(NULL); - pmcstat_stats_reset(); + pmcstat_stats_reset(0); if (plugins[args.pa_plugin].pl_init != NULL) plugins[args.pa_plugin].pl_init(); } @@ -2130,8 +2162,7 @@ pmcstat_shutdown_logging(void) N, pmcstat_stats.ps_##V); \ } while (0) - if (args.pa_verbosity >= 1 && (args.pa_flags & FLAG_DO_ANALYSIS) && - (args.pa_flags & FLAG_DO_TOP) == 0) { + if (args.pa_verbosity >= 1 && (args.pa_flags & FLAG_DO_ANALYSIS)) { (void) fprintf(args.pa_printfile, "CONVERSION STATISTICS:\n"); PRINT("#exec/a.out", exec_aout); PRINT("#exec/elf", exec_elf); From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 14:30:45 2010 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 B7646106567D; Mon, 9 Aug 2010 14:30:45 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A46668FC14; Mon, 9 Aug 2010 14:30:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79EUjLP016410; Mon, 9 Aug 2010 14:30:45 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79EUjuq016407; Mon, 9 Aug 2010 14:30:45 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201008091430.o79EUjuq016407@svn.freebsd.org> From: Fabien Thomas Date: Mon, 9 Aug 2010 14:30: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: r211099 - stable/7/usr.sbin/pmcstat 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, 09 Aug 2010 14:30:45 -0000 Author: fabient Date: Mon Aug 9 14:30:45 2010 New Revision: 211099 URL: http://svn.freebsd.org/changeset/base/211099 Log: MFC r210794: Allow file as a top source, it works with socket now. This will allow top monitoring using socket/ssh tunnelling of system without local symbols. client: pmcstat -R : -T -r monitored device: pmcstat -Sinstructions -O : - Move the file read in the event loop - Initialize and clean log in all cases - Preserve global stats value during top refresh - Fix the rtld/line resolver that ignore '-r' prefix - Support socket for '-R' (server mode) - Display the statistics when exiting top mode Modified: stable/7/usr.sbin/pmcstat/pmcstat.c stable/7/usr.sbin/pmcstat/pmcstat_log.c Directory Properties: stable/7/usr.sbin/pmcstat/ (props changed) Modified: stable/7/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcstat.c Mon Aug 9 14:29:23 2010 (r211098) +++ stable/7/usr.sbin/pmcstat/pmcstat.c Mon Aug 9 14:30:45 2010 (r211099) @@ -169,8 +169,7 @@ pmcstat_cleanup(void) args.pa_logparser = NULL; } - if (args.pa_flags & (FLAG_HAS_PIPE | FLAG_HAS_OUTPUT_LOGFILE)) - pmcstat_shutdown_logging(); + pmcstat_shutdown_logging(); } void @@ -559,7 +558,7 @@ main(int argc, char **argv) int do_print; size_t dummy; int graphdepth; - int pipefd[2]; + int pipefd[2], rfd; int use_cumulative_counts; short cf, cb; uint32_t cpumask; @@ -1001,11 +1000,6 @@ main(int argc, char **argv) (args.pa_flags & FLAG_READ_LOGFILE) == 0) errx(EX_USAGE, "ERROR: option -M is only used with -g/-R."); - /* -T is incompatible with -R (replay logfile is a TODO) */ - if ((args.pa_flags & FLAG_DO_TOP) && - (args.pa_flags & FLAG_READ_LOGFILE)) - errx(EX_USAGE, "ERROR: option -T is incompatible with -R."); - /* * Disallow textual output of sampling PMCs if counting PMCs * have also been asked for, mostly because the combined output @@ -1066,7 +1060,22 @@ main(int argc, char **argv) graphfilename); } - /* if we've been asked to process a log file, do that and exit */ + /* if we've been asked to process a log file, skip init */ + if ((args.pa_flags & FLAG_READ_LOGFILE) == 0) { + if (pmc_init() < 0) + err(EX_UNAVAILABLE, + "ERROR: Initialization of the pmc(3) library failed"); + + if ((npmc = pmc_npmc(0)) < 0) /* assume all CPUs are identical */ + err(EX_OSERR, "ERROR: Cannot determine the number of PMCs " + "on CPU %d", 0); + } + + /* Allocate a kqueue */ + if ((pmcstat_kq = kqueue()) < 0) + err(EX_OSERR, "ERROR: Cannot allocate kqueue"); + + /* Setup the logfile as the source. */ if (args.pa_flags & FLAG_READ_LOGFILE) { /* * Print the log in textual form if we haven't been @@ -1076,28 +1085,17 @@ main(int argc, char **argv) args.pa_flags |= FLAG_DO_PRINT; pmcstat_initialize_logging(); - args.pa_logfd = pmcstat_open_log(args.pa_inputpath, + rfd = pmcstat_open_log(args.pa_inputpath, PMCSTAT_OPEN_FOR_READ); - if ((args.pa_logparser = pmclog_open(args.pa_logfd)) == NULL) + if ((args.pa_logparser = pmclog_open(rfd)) == NULL) err(EX_OSERR, "ERROR: Cannot create parser"); - pmcstat_process_log(); - pmcstat_shutdown_logging(); - exit(EX_OK); + if (fcntl(rfd, F_SETFL, O_NONBLOCK) < 0) + err(EX_OSERR, "ERROR: fcntl(2) failed"); + EV_SET(&kev, rfd, EVFILT_READ, EV_ADD, + 0, 0, NULL); + if (kevent(pmcstat_kq, &kev, 1, NULL, 0, NULL) < 0) + err(EX_OSERR, "ERROR: Cannot register kevent"); } - - /* otherwise, we've been asked to collect data */ - if (pmc_init() < 0) - err(EX_UNAVAILABLE, - "ERROR: Initialization of the pmc(3) library failed"); - - if ((npmc = pmc_npmc(0)) < 0) /* assume all CPUs are identical */ - err(EX_OSERR, "ERROR: Cannot determine the number of PMCs " - "on CPU %d", 0); - - /* Allocate a kqueue */ - if ((pmcstat_kq = kqueue()) < 0) - err(EX_OSERR, "ERROR: Cannot allocate kqueue"); - /* * Configure the specified log file or setup a default log * consumer via a pipe. @@ -1140,6 +1138,7 @@ main(int argc, char **argv) (args.pa_flags & FLAG_HAS_OUTPUT_LOGFILE); /* + if (args.pa_flags & FLAG_READ_LOGFILE) { * Allocate PMCs. */ @@ -1272,10 +1271,8 @@ main(int argc, char **argv) if (args.pa_flags & FLAG_HAS_COMMANDLINE) pmcstat_start_process(); - /* initialize logging if printing the configured log */ - if ((args.pa_flags & (FLAG_DO_PRINT | FLAG_DO_TOP)) && - (args.pa_flags & (FLAG_HAS_PIPE | FLAG_HAS_OUTPUT_LOGFILE))) - pmcstat_initialize_logging(); + /* initialize logging */ + pmcstat_initialize_logging(); /* Handle SIGINT using the kqueue loop */ sa.sa_handler = SIG_IGN; @@ -1338,16 +1335,13 @@ main(int argc, char **argv) switch (kev.filter) { case EVFILT_PROC: /* target has exited */ - if (args.pa_flags & (FLAG_HAS_OUTPUT_LOGFILE | - FLAG_HAS_PIPE)) - runstate = pmcstat_close_log(); - else - runstate = PMCSTAT_FINISHED; + runstate = pmcstat_close_log(); do_print = 1; break; case EVFILT_READ: /* log file data is present */ - if (kev.ident == (unsigned)fileno(stdin)) { + if (kev.ident == (unsigned)fileno(stdin) && + (args.pa_flags & FLAG_DO_TOP)) { if (pmcstat_keypress_log()) runstate = pmcstat_close_log(); } else @@ -1370,15 +1364,8 @@ main(int argc, char **argv) * of its targets, or if logfile * writes encounter an error. */ - if (args.pa_flags & (FLAG_HAS_OUTPUT_LOGFILE | - FLAG_HAS_PIPE)) { - runstate = pmcstat_close_log(); - if (args.pa_flags & - (FLAG_DO_PRINT|FLAG_DO_ANALYSIS)) - pmcstat_process_log(); - } + runstate = pmcstat_close_log(); do_print = 1; /* print PMCs at exit */ - runstate = PMCSTAT_FINISHED; } else if (kev.ident == SIGINT) { /* Kill the child process if we started it */ if (args.pa_flags & FLAG_HAS_COMMANDLINE) @@ -1386,7 +1373,7 @@ main(int argc, char **argv) /* Close the pipe to self, if present. */ if (args.pa_flags & FLAG_HAS_PIPE) (void) close(pipefd[READPIPEFD]); - runstate = PMCSTAT_FINISHED; + runstate = pmcstat_close_log(); } else if (kev.ident == SIGWINCH) { if (ioctl(fileno(args.pa_printfile), TIOCGWINSZ, &ws) < 0) Modified: stable/7/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcstat_log.c Mon Aug 9 14:29:23 2010 (r211098) +++ stable/7/usr.sbin/pmcstat/pmcstat_log.c Mon Aug 9 14:30:45 2010 (r211099) @@ -141,6 +141,7 @@ struct pmcstat_image_hash_list pmcstat_i struct pmcstat_process_hash_list pmcstat_process_hash[PMCSTAT_NHASH]; struct pmcstat_stats pmcstat_stats; /* statistics */ +int ps_samples_period; /* samples count between top refresh. */ struct pmcstat_process *pmcstat_kernproc; /* kernel 'process' */ @@ -247,7 +248,7 @@ static int pmcstat_string_compute_hash(c static void pmcstat_string_initialize(void); static int pmcstat_string_lookup_hash(pmcstat_interned_string _is); static void pmcstat_string_shutdown(void); -static void pmcstat_stats_reset(void); +static void pmcstat_stats_reset(int _reset_global); /* * A simple implementation of interned strings. Each interned string @@ -276,7 +277,7 @@ int pmcstat_npmcs; int pmcstat_pause; static void -pmcstat_stats_reset(void) +pmcstat_stats_reset(int reset_global) { struct pmcstat_pmcrecord *pr; @@ -285,9 +286,11 @@ pmcstat_stats_reset(void) pr->pr_samples = 0; pr->pr_dubious_frames = 0; } + ps_samples_period = 0; /* Flush global stats. */ - bzero(&pmcstat_stats, sizeof(struct pmcstat_stats)); + if (reset_global) + bzero(&pmcstat_stats, sizeof(struct pmcstat_stats)); } /* @@ -606,7 +609,7 @@ pmcstat_image_get_elf_params(struct pmcs GElf_Phdr ph; GElf_Shdr sh; enum pmcstat_image_type image_type; - char buffer[PATH_MAX]; + char buffer[PATH_MAX], rtldpath[PATH_MAX]; assert(image->pi_type == PMCSTAT_IMAGE_UNKNOWN); @@ -686,9 +689,10 @@ pmcstat_image_get_elf_params(struct pmcs buffer, elf_errmsg(-1)); goto done; } + snprintf(rtldpath, sizeof(rtldpath), "%s%s", + args.pa_fsroot, elfbase + ph.p_offset); image->pi_dynlinkerpath = - pmcstat_string_intern(elfbase + - ph.p_offset); + pmcstat_string_intern(rtldpath); break; case PT_LOAD: if (ph.p_offset == 0) @@ -944,11 +948,13 @@ pmcstat_image_addr2line(struct pmcstat_i int fd; if (image->pi_addr2line == NULL) { - snprintf(imagepath, sizeof(imagepath), "%s.symbols", + snprintf(imagepath, sizeof(imagepath), "%s%s.symbols", + args.pa_fsroot, pmcstat_string_unintern(image->pi_fullpath)); fd = open(imagepath, O_RDONLY); if (fd < 0) { - snprintf(imagepath, sizeof(imagepath), "%s", + snprintf(imagepath, sizeof(imagepath), "%s%s", + args.pa_fsroot, pmcstat_string_unintern(image->pi_fullpath)); } else close(fd); @@ -1399,6 +1405,7 @@ pmcstat_analyze_log(void) * bin inside this. */ pmcstat_stats.ps_samples_total++; + ps_samples_period++; pc = ev.pl_u.pl_s.pl_pc; pp = pmcstat_process_lookup(ev.pl_u.pl_s.pl_pid, @@ -1425,6 +1432,7 @@ pmcstat_analyze_log(void) case PMCLOG_TYPE_CALLCHAIN: pmcstat_stats.ps_samples_total++; + ps_samples_period++; cpuflags = ev.pl_u.pl_cc.pl_cpuflags; cpu = PMC_CALLCHAIN_CPUFLAGS_TO_CPU(cpuflags); @@ -1691,8 +1699,15 @@ pmcstat_print_log(void) int pmcstat_close_log(void) { - if (pmc_flush_logfile() < 0) - err(EX_OSERR, "ERROR: logging failed"); + /* If a local logfile is configured ask the kernel to stop + * and flush data. Kernel will close the file when data is flushed + * so keep the status to EXITING. + */ + if (args.pa_logfd != -1) { + if (pmc_flush_logfile() < 0) + err(EX_OSERR, "ERROR: logging failed"); + } + return (args.pa_flags & FLAG_HAS_PIPE ? PMCSTAT_EXITING : PMCSTAT_FINISHED); } @@ -1709,7 +1724,7 @@ pmcstat_close_log(void) int pmcstat_open_log(const char *path, int mode) { - int error, fd; + int error, fd, cfd; size_t hlen; const char *p, *errstr; struct addrinfo hints, *res, *res0; @@ -1730,7 +1745,7 @@ pmcstat_open_log(const char *path, int m */ if (path[0] == '-' && path[1] == '\0') fd = (mode == PMCSTAT_OPEN_FOR_READ) ? 0 : 1; - else if (mode == PMCSTAT_OPEN_FOR_WRITE && path[0] != '/' && + else if (path[0] != '/' && path[0] != '.' && strchr(path, ':') != NULL) { p = strrchr(path, ':'); @@ -1759,11 +1774,29 @@ pmcstat_open_log(const char *path, int m errstr = strerror(errno); continue; } - if (connect(fd, res->ai_addr, res->ai_addrlen) < 0) { - errstr = strerror(errno); + if (mode == PMCSTAT_OPEN_FOR_READ) { + if (bind(fd, res->ai_addr, res->ai_addrlen) < 0) { + errstr = strerror(errno); + (void) close(fd); + fd = -1; + continue; + } + listen(fd, 1); + cfd = accept(fd, NULL, NULL); (void) close(fd); - fd = -1; - continue; + if (cfd < 0) { + errstr = strerror(errno); + fd = -1; + break; + } + fd = cfd; + } else { + if (connect(fd, res->ai_addr, res->ai_addrlen) < 0) { + errstr = strerror(errno); + (void) close(fd); + fd = -1; + continue; + } } errstr = NULL; break; @@ -1833,9 +1866,8 @@ pmcstat_refresh_top(void) pmcstat_pmcinfilter); /* Format samples count. */ - if (pmcstat_stats.ps_samples_total > 0) - v = (pmcpr->pr_samples * 100.0) / - pmcstat_stats.ps_samples_total; + if (ps_samples_period > 0) + v = (pmcpr->pr_samples * 100.0) / ps_samples_period; else v = 0.; v_attrs = PMCSTAT_ATTRPERCENT(v); @@ -1872,7 +1904,7 @@ pmcstat_changefilter(void) do { pmcr = pmcstat_pmcindex_to_pmcr(pmcstat_pmcinfilter); - if (pmcr == pmcr->pr_merge) + if (pmcr == NULL || pmcr == pmcr->pr_merge) break; pmcstat_pmcinfilter++; @@ -1915,7 +1947,7 @@ pmcstat_keypress_log(void) */ if (plugins[args.pa_plugin].pl_shutdown != NULL) plugins[args.pa_plugin].pl_shutdown(NULL); - pmcstat_stats_reset(); + pmcstat_stats_reset(0); if (plugins[args.pa_plugin].pl_init != NULL) plugins[args.pa_plugin].pl_init(); @@ -1936,7 +1968,7 @@ pmcstat_keypress_log(void) } while (plugins[args.pa_plugin].pl_topdisplay == NULL); /* Open new plugin. */ - pmcstat_stats_reset(); + pmcstat_stats_reset(0); if (plugins[args.pa_plugin].pl_init != NULL) plugins[args.pa_plugin].pl_init(); wprintw(w, "switching to plugin %s", @@ -1986,7 +2018,7 @@ pmcstat_display_log(void) if (args.pa_topmode == PMCSTAT_TOP_DELTA) { if (plugins[args.pa_plugin].pl_shutdown != NULL) plugins[args.pa_plugin].pl_shutdown(NULL); - pmcstat_stats_reset(); + pmcstat_stats_reset(0); if (plugins[args.pa_plugin].pl_init != NULL) plugins[args.pa_plugin].pl_init(); } @@ -2130,8 +2162,7 @@ pmcstat_shutdown_logging(void) N, pmcstat_stats.ps_##V); \ } while (0) - if (args.pa_verbosity >= 1 && (args.pa_flags & FLAG_DO_ANALYSIS) && - (args.pa_flags & FLAG_DO_TOP) == 0) { + if (args.pa_verbosity >= 1 && (args.pa_flags & FLAG_DO_ANALYSIS)) { (void) fprintf(args.pa_printfile, "CONVERSION STATISTICS:\n"); PRINT("#exec/a.out", exec_aout); PRINT("#exec/elf", exec_elf); From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 14:32:45 2010 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 CA4791065672; Mon, 9 Aug 2010 14:32:45 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E5418FC1E; Mon, 9 Aug 2010 14:32:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79EWjEF016888; Mon, 9 Aug 2010 14:32:45 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79EWjAR016884; Mon, 9 Aug 2010 14:32:45 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201008091432.o79EWjAR016884@svn.freebsd.org> From: Fabien Thomas Date: Mon, 9 Aug 2010 14:32: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: r211100 - stable/8/usr.sbin/pmcstat 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, 09 Aug 2010 14:32:45 -0000 Author: fabient Date: Mon Aug 9 14:32:45 2010 New Revision: 211100 URL: http://svn.freebsd.org/changeset/base/211100 Log: MFC r210797: - Do not use the runtime mask when logfile is specified. - Revert the fix on rtld path that is not necessary. Modified: stable/8/usr.sbin/pmcstat/pmcstat.c stable/8/usr.sbin/pmcstat/pmcstat.h stable/8/usr.sbin/pmcstat/pmcstat_log.c Directory Properties: stable/8/usr.sbin/pmcstat/ (props changed) Modified: stable/8/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- stable/8/usr.sbin/pmcstat/pmcstat.c Mon Aug 9 14:30:45 2010 (r211099) +++ stable/8/usr.sbin/pmcstat/pmcstat.c Mon Aug 9 14:32:45 2010 (r211100) @@ -641,6 +641,7 @@ main(int argc, char **argv) else cpumask = pmcstat_get_cpumask(optarg); + args.pa_flags |= FLAGS_HAS_CPUMASK; args.pa_required |= FLAG_HAS_SYSTEM_PMCS; break; @@ -884,6 +885,13 @@ main(int argc, char **argv) args.pa_argc = (argc -= optind); args.pa_argv = (argv += optind); + /* If we read from logfile and no specified CPU mask use + * the maximum CPU count. + */ + if ((args.pa_flags & FLAG_READ_LOGFILE) && + (args.pa_flags & FLAGS_HAS_CPUMASK) == 0) + cpumask = 0xffffffff; + args.pa_cpumask = cpumask; /* For selecting CPUs using -R. */ if (argc) /* command line present */ Modified: stable/8/usr.sbin/pmcstat/pmcstat.h ============================================================================== --- stable/8/usr.sbin/pmcstat/pmcstat.h Mon Aug 9 14:30:45 2010 (r211099) +++ stable/8/usr.sbin/pmcstat/pmcstat.h Mon Aug 9 14:32:45 2010 (r211100) @@ -51,6 +51,7 @@ #define FLAG_DO_ANNOTATE 0x00008000 /* -m */ #define FLAG_DO_TOP 0x00010000 /* -T */ #define FLAG_DO_ANALYSIS 0x00020000 /* -g or -G or -m or -T */ +#define FLAGS_HAS_CPUMASK 0x00040000 /* -c */ #define DEFAULT_SAMPLE_COUNT 65536 #define DEFAULT_WAIT_INTERVAL 5.0 Modified: stable/8/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- stable/8/usr.sbin/pmcstat/pmcstat_log.c Mon Aug 9 14:30:45 2010 (r211099) +++ stable/8/usr.sbin/pmcstat/pmcstat_log.c Mon Aug 9 14:32:45 2010 (r211100) @@ -609,7 +609,7 @@ pmcstat_image_get_elf_params(struct pmcs GElf_Phdr ph; GElf_Shdr sh; enum pmcstat_image_type image_type; - char buffer[PATH_MAX], rtldpath[PATH_MAX]; + char buffer[PATH_MAX]; assert(image->pi_type == PMCSTAT_IMAGE_UNKNOWN); @@ -689,10 +689,9 @@ pmcstat_image_get_elf_params(struct pmcs buffer, elf_errmsg(-1)); goto done; } - snprintf(rtldpath, sizeof(rtldpath), "%s%s", - args.pa_fsroot, elfbase + ph.p_offset); image->pi_dynlinkerpath = - pmcstat_string_intern(rtldpath); + pmcstat_string_intern(elfbase + + ph.p_offset); break; case PT_LOAD: if (ph.p_offset == 0) From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 14:33:25 2010 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 85F801065679; Mon, 9 Aug 2010 14:33:25 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A0618FC1B; Mon, 9 Aug 2010 14:33:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79EXP3A017116; Mon, 9 Aug 2010 14:33:25 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79EXPD5017112; Mon, 9 Aug 2010 14:33:25 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201008091433.o79EXPD5017112@svn.freebsd.org> From: Fabien Thomas Date: Mon, 9 Aug 2010 14:33: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: r211101 - stable/7/usr.sbin/pmcstat 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, 09 Aug 2010 14:33:25 -0000 Author: fabient Date: Mon Aug 9 14:33:25 2010 New Revision: 211101 URL: http://svn.freebsd.org/changeset/base/211101 Log: MFC r210797: - Do not use the runtime mask when logfile is specified. - Revert the fix on rtld path that is not necessary. Modified: stable/7/usr.sbin/pmcstat/pmcstat.c stable/7/usr.sbin/pmcstat/pmcstat.h stable/7/usr.sbin/pmcstat/pmcstat_log.c Directory Properties: stable/7/usr.sbin/pmcstat/ (props changed) Modified: stable/7/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcstat.c Mon Aug 9 14:32:45 2010 (r211100) +++ stable/7/usr.sbin/pmcstat/pmcstat.c Mon Aug 9 14:33:25 2010 (r211101) @@ -641,6 +641,7 @@ main(int argc, char **argv) else cpumask = pmcstat_get_cpumask(optarg); + args.pa_flags |= FLAGS_HAS_CPUMASK; args.pa_required |= FLAG_HAS_SYSTEM_PMCS; break; @@ -884,6 +885,13 @@ main(int argc, char **argv) args.pa_argc = (argc -= optind); args.pa_argv = (argv += optind); + /* If we read from logfile and no specified CPU mask use + * the maximum CPU count. + */ + if ((args.pa_flags & FLAG_READ_LOGFILE) && + (args.pa_flags & FLAGS_HAS_CPUMASK) == 0) + cpumask = 0xffffffff; + args.pa_cpumask = cpumask; /* For selecting CPUs using -R. */ if (argc) /* command line present */ Modified: stable/7/usr.sbin/pmcstat/pmcstat.h ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcstat.h Mon Aug 9 14:32:45 2010 (r211100) +++ stable/7/usr.sbin/pmcstat/pmcstat.h Mon Aug 9 14:33:25 2010 (r211101) @@ -51,6 +51,7 @@ #define FLAG_DO_ANNOTATE 0x00008000 /* -m */ #define FLAG_DO_TOP 0x00010000 /* -T */ #define FLAG_DO_ANALYSIS 0x00020000 /* -g or -G or -m or -T */ +#define FLAGS_HAS_CPUMASK 0x00040000 /* -c */ #define DEFAULT_SAMPLE_COUNT 65536 #define DEFAULT_WAIT_INTERVAL 5.0 Modified: stable/7/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcstat_log.c Mon Aug 9 14:32:45 2010 (r211100) +++ stable/7/usr.sbin/pmcstat/pmcstat_log.c Mon Aug 9 14:33:25 2010 (r211101) @@ -609,7 +609,7 @@ pmcstat_image_get_elf_params(struct pmcs GElf_Phdr ph; GElf_Shdr sh; enum pmcstat_image_type image_type; - char buffer[PATH_MAX], rtldpath[PATH_MAX]; + char buffer[PATH_MAX]; assert(image->pi_type == PMCSTAT_IMAGE_UNKNOWN); @@ -689,10 +689,9 @@ pmcstat_image_get_elf_params(struct pmcs buffer, elf_errmsg(-1)); goto done; } - snprintf(rtldpath, sizeof(rtldpath), "%s%s", - args.pa_fsroot, elfbase + ph.p_offset); image->pi_dynlinkerpath = - pmcstat_string_intern(rtldpath); + pmcstat_string_intern(elfbase + + ph.p_offset); break; case PT_LOAD: if (ph.p_offset == 0) From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 14:48:33 2010 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 F1EE5106566C; Mon, 9 Aug 2010 14:48:31 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E0B7C8FC19; Mon, 9 Aug 2010 14:48:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79EmVYV020697; Mon, 9 Aug 2010 14:48:31 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79EmVPr020693; Mon, 9 Aug 2010 14:48:31 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201008091448.o79EmVPr020693@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 9 Aug 2010 14:48: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: r211102 - 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: Mon, 09 Aug 2010 14:48:33 -0000 Author: gavin Date: Mon Aug 9 14:48:31 2010 New Revision: 211102 URL: http://svn.freebsd.org/changeset/base/211102 Log: Add descriptions to a handful of sysctl nodes. PR: kern/148580 Submitted by: Galimov Albert MFC after: 1 week Modified: head/sys/kern/init_main.c head/sys/kern/kern_cons.c head/sys/kern/kern_ktrace.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Mon Aug 9 14:33:25 2010 (r211101) +++ head/sys/kern/init_main.c Mon Aug 9 14:48:31 2010 (r211102) @@ -100,9 +100,11 @@ struct vmspace vmspace0; struct proc *initproc; int boothowto = 0; /* initialized so that it can be patched */ -SYSCTL_INT(_debug, OID_AUTO, boothowto, CTLFLAG_RD, &boothowto, 0, ""); +SYSCTL_INT(_debug, OID_AUTO, boothowto, CTLFLAG_RD, &boothowto, 0, + "Boot control flags, passed from loader"); int bootverbose; -SYSCTL_INT(_debug, OID_AUTO, bootverbose, CTLFLAG_RW, &bootverbose, 0, ""); +SYSCTL_INT(_debug, OID_AUTO, bootverbose, CTLFLAG_RW, &bootverbose, 0, + "Control the output of verbose kernel messages"); /* * This ensures that there is at least one entry so that the sysinit_set @@ -647,7 +649,8 @@ SYSCTL_STRING(_kern, OID_AUTO, init_path #endif static int init_shutdown_timeout = INIT_SHUTDOWN_TIMEOUT; SYSCTL_INT(_kern, OID_AUTO, init_shutdown_timeout, - CTLFLAG_RW, &init_shutdown_timeout, 0, ""); + CTLFLAG_RW, &init_shutdown_timeout, 0, "Shutdown timeout of init(8). " + "Unused within kernel, but used to control init(8)"); /* * Start the initial user process; try exec'ing each pathname in init_path. Modified: head/sys/kern/kern_cons.c ============================================================================== --- head/sys/kern/kern_cons.c Mon Aug 9 14:33:25 2010 (r211101) +++ head/sys/kern/kern_cons.c Mon Aug 9 14:48:31 2010 (r211102) @@ -341,7 +341,8 @@ sysctl_kern_consmute(SYSCTL_HANDLER_ARGS } SYSCTL_PROC(_kern, OID_AUTO, consmute, CTLTYPE_INT|CTLFLAG_RW, - 0, sizeof(cn_mute), sysctl_kern_consmute, "I", ""); + 0, sizeof(cn_mute), sysctl_kern_consmute, "I", + "State of the console muting"); /* * Low level console routines. @@ -429,7 +430,7 @@ cnputs(char *p) static int consmsgbuf_size = 8192; SYSCTL_INT(_kern, OID_AUTO, consmsgbuf_size, CTLFLAG_RW, &consmsgbuf_size, 0, - ""); + "Console tty buffer size"); /* * Redirect console output to a tty. @@ -471,7 +472,8 @@ constty_clear(void) /* Times per second to check for pending console tty messages. */ static int constty_wakeups_per_second = 5; SYSCTL_INT(_kern, OID_AUTO, constty_wakeups_per_second, CTLFLAG_RW, - &constty_wakeups_per_second, 0, ""); + &constty_wakeups_per_second, 0, + "Times per second to check for pending console tty messages"); static void constty_timeout(void *arg) Modified: head/sys/kern/kern_ktrace.c ============================================================================== --- head/sys/kern/kern_ktrace.c Mon Aug 9 14:33:25 2010 (r211101) +++ head/sys/kern/kern_ktrace.c Mon Aug 9 14:48:31 2010 (r211102) @@ -218,7 +218,8 @@ sysctl_kern_ktrace_request_pool(SYSCTL_H return (0); } SYSCTL_PROC(_kern_ktrace, OID_AUTO, request_pool, CTLTYPE_UINT|CTLFLAG_RW, - &ktr_requestpool, 0, sysctl_kern_ktrace_request_pool, "IU", ""); + &ktr_requestpool, 0, sysctl_kern_ktrace_request_pool, "IU", + "Pool buffer size for ktrace(1)"); static u_int ktrace_resize_pool(u_int newsize) From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 15:54:07 2010 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 532E41065672; Mon, 9 Aug 2010 15:54:07 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id EBAB08FC15; Mon, 9 Aug 2010 15:54:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o79FnbRY057939; Mon, 9 Aug 2010 09:49:37 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 09 Aug 2010 09:50:07 -0600 (MDT) Message-Id: <20100809.095007.4959786895405928.imp@bsdimp.com> To: des@des.no From: "M. Warner Losh" In-Reply-To: <86tyn4tbuc.fsf@ds4.des.no> References: <20100808.153608.1142818667055052395.imp@bsdimp.com> <20100808220631.GA86477@stack.nl> <86tyn4tbuc.fsf@ds4.des.no> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, olli@fromme.com, jilles@stack.nl Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 09 Aug 2010 15:54:07 -0000 In message: <86tyn4tbuc.fsf@ds4.des.no> Dag-Erling Sm=F8rgrav writes: : Jilles Tjoelker writes: : > In other cases, I propose adding a cast to void * in between, like : > (struct sockaddr_in *)(void *)ai->ai_addr : = : Better to cast through uintptr_t. Perhaps we should have a : __DECONST-like macro for this? : = : #define __ALIGNED_CAST(t, v) ((t)(uintptr_t)(v)) I like the idea of a macro. Why is a cast through uintptr_t better? Warner From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 17:13:59 2010 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 49CF81065673; Mon, 9 Aug 2010 17:13:59 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id E8B358FC19; Mon, 9 Aug 2010 17:13:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o79HBTZe058913; Mon, 9 Aug 2010 11:11:29 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 09 Aug 2010 11:12:00 -0600 (MDT) Message-Id: <20100809.111200.645538350783126124.imp@bsdimp.com> To: gavin@freebsd.org From: "M. Warner Losh" In-Reply-To: References: <20100808.153914.769051483995699249.imp@bsdimp.com> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 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 Subject: Re: svn commit: r211021 - 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: Mon, 09 Aug 2010 17:13:59 -0000 In message: Gavin Atkinson writes: : On Sun, 8 Aug 2010, M. Warner Losh wrote: : > In message: : > Gavin Atkinson writes: : > : On Sat, 7 Aug 2010, M. Warner Losh wrote: : > : > In message: <201008071608.o77G8bNN088653@svn.freebsd.org> : > : > Gavin Atkinson writes: : > : > : Author: gavin : > : > : Date: Sat Aug 7 16:08:37 2010 : > : > : New Revision: 211021 : > : > : URL: http://svn.freebsd.org/changeset/base/211021 : > : > : : > : > : Log: : > : > : Sort this file a little better: the vendors are supposed to be sorted by : > : > : vendor ID in the vendor section, and by symbolic name in the product : > : > : section. Products are sorted by product ID. While here, get rid of a : > : > : duplicate Microsoft Mouse entry, revealed by sorting. : > : > : > : > I thought products were sorted by the ID number, not the ID name. : > : : > : Yes, within a manufacturer, products should be sorted by ID. Each : > : manufacturer section is sorted by the symbolic manufacturer name, though. : > : > Within each product section, the products are sorted by numeric id, : > not symbolic id. That's how it was when I was maintaining this file, : > and is how pccarddevs also works. : > : > eg: : > : > product ALCOR SDCR_6335 0x6335 SD/MMC Card Reader : > product ALCOR SDCR_6362 0x6362 SD/MMC Card Reader : > product ALCOR TRANSCEND 0x6387 Transcend JetFlash Drive : > product ALCOR MA_KBD_HUB 0x9213 MacAlly Kbd Hub : > product ALCOR AU9814 0x9215 AU9814 Hub : > product ALCOR UMCR_9361 0x9361 USB Multimedia Card Reader : > product ALCOR SM_KBD 0x9410 MicroConnectors/StrongMan Keyboard : > product ALCOR NEC_KBD_HUB 0x9472 NEC Kbd Hub : > product ALCOR AU6390 0x6390 AU6390 USB-IDE converter : : Indeed, that is wrong. That's not a section that I have touched, though. : : > : I'm not which one of us is misunderstanding the other - do you think my : > : change is somehow wrong? : > : > I think your change misorders things, unless I'm misreading it. It : > sorts based on symbolic ID rather than numeric ID. : : The only section I touched with this commit was the MICROSOFT one, and : here is the ordering after my commit: : : product MICROSOFT SIDEPREC 0x0008 SideWinder Precision Pro : product MICROSOFT INTELLIMOUSE 0x0009 IntelliMouse : product MICROSOFT NATURALKBD 0x000b Natural Keyboard Elite : product MICROSOFT DDS80 0x0014 Digital Sound System 80 : product MICROSOFT SIDEWINDER 0x001a Sidewinder Precision Racing Wheel : product MICROSOFT INETPRO 0x001c Internet Keyboard Pro : product MICROSOFT TBEXPLORER 0x0024 Trackball Explorer : product MICROSOFT INTELLIEYE 0x0025 IntelliEye mouse : product MICROSOFT INETPRO2 0x002b Internet Keyboard Pro : product MICROSOFT MN510 0x006e MN510 Wireless : product MICROSOFT MN110 0x007a 10/100 USB NIC : product MICROSOFT WLINTELLIMOUSE 0x008c Wireless Optical IntelliMouse : product MICROSOFT WLNOTEBOOK 0x00b9 Wireless Optical Mouse (Model 1023) : product MICROSOFT COMFORT3000 0x00d1 Comfort Optical Mouse 3000 (Model 1043) : product MICROSOFT WLNOTEBOOK3 0x00d2 Wireless Optical Mouse 3000 (Model 1049) : product MICROSOFT NATURAL4000 0x00db Natural Ergonomic Keyboard 4000 : product MICROSOFT WLNOTEBOOK2 0x00e1 Wireless Optical Mouse 3000 (Model 1056) : product MICROSOFT XBOX360 0x0292 XBOX 360 WLAN : : I can't see any which are misordered, can you? I must have I misread the diff then. My mistake. Sorry for the noise. I thought you were sorting based on the third column rather than the 4th. Warner From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 17:22:15 2010 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 2C2381065674; Mon, 9 Aug 2010 17:22:15 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B1B18FC14; Mon, 9 Aug 2010 17:22:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79HMEGr055183; Mon, 9 Aug 2010 17:22:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79HME2m055181; Mon, 9 Aug 2010 17:22:14 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008091722.o79HME2m055181@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 9 Aug 2010 17:22: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: r211103 - 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: Mon, 09 Aug 2010 17:22:15 -0000 Author: yongari Date: Mon Aug 9 17:22:14 2010 New Revision: 211103 URL: http://svn.freebsd.org/changeset/base/211103 Log: Add F1 PHY found on Atheros AR8151 v2.0 PCIe gigabit ethernet controller. Modified: head/sys/dev/mii/atphy.c head/sys/dev/mii/miidevs Modified: head/sys/dev/mii/atphy.c ============================================================================== --- head/sys/dev/mii/atphy.c Mon Aug 9 14:48:31 2010 (r211102) +++ head/sys/dev/mii/atphy.c Mon Aug 9 17:22:14 2010 (r211103) @@ -86,6 +86,7 @@ static int atphy_auto(struct mii_softc * static const struct mii_phydesc atphys[] = { MII_PHY_DESC(ATHEROS, F1), + MII_PHY_DESC(ATHEROS, F1_7), MII_PHY_DESC(ATHEROS, F2), MII_PHY_END }; Modified: head/sys/dev/mii/miidevs ============================================================================== --- head/sys/dev/mii/miidevs Mon Aug 9 14:48:31 2010 (r211102) +++ head/sys/dev/mii/miidevs Mon Aug 9 17:22:14 2010 (r211103) @@ -121,6 +121,7 @@ model ASIX AX88X9X 0x0031 Ax88x9x inter /* Atheros Communications/Attansic PHYs. */ model ATHEROS F1 0x0001 Atheros F1 10/100/1000 PHY model ATHEROS F2 0x0002 Atheros F2 10/100 PHY +model ATHEROS F1_7 0x0007 Atheros F1 10/100/1000 PHY /* Broadcom Corp. PHYs. */ model BROADCOM 3C905B 0x0012 3c905B 10/100 internal PHY From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 17:27:27 2010 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 9D376106567E; Mon, 9 Aug 2010 17:27:27 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C48F8FC08; Mon, 9 Aug 2010 17:27:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79HRRRo056339; Mon, 9 Aug 2010 17:27:27 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79HRRQJ056337; Mon, 9 Aug 2010 17:27:27 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201008091727.o79HRRQJ056337@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 9 Aug 2010 17:27: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: r211104 - 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: Mon, 09 Aug 2010 17:27:27 -0000 Author: gavin Date: Mon Aug 9 17:27:27 2010 New Revision: 211104 URL: http://svn.freebsd.org/changeset/base/211104 Log: Add entries for some devices I have locally. Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Mon Aug 9 17:22:14 2010 (r211103) +++ head/sys/dev/usb/usbdevs Mon Aug 9 17:27:27 2010 (r211104) @@ -666,6 +666,7 @@ vendor ALINK 0x1e0e Alink vendor AIRTIES 0x1eda AirTies vendor DLINK 0x2001 D-Link vendor PLANEX2 0x2019 Planex Communications +vendor HAUPPAUGE2 0x2040 Hauppauge Computer Works vendor TLAYTECH 0x20b9 Tlay Tech vendor ENCORE 0x203d Encore vendor PARA 0x20b8 PARA Industrial @@ -971,6 +972,8 @@ product AOX USB101 0x0008 Ethernet product APC UPS 0x0002 Uninterruptible Power Supply /* Apple Computer products */ +product APPLE IMAC_KBD 0x0201 USB iMac Keyboard +product APPLE KBD 0x0202 USB Keyboard M2452 product APPLE EXT_KBD 0x020c Apple Extended USB Keyboard product APPLE KBD_TP_ANSI 0x0223 Apple Internal Keyboard/Trackpad (Wellspring/ANSI) product APPLE KBD_TP_ISO 0x0224 Apple Internal Keyboard/Trackpad (Wellspring/ISO) @@ -978,8 +981,10 @@ product APPLE KBD_TP_JIS 0x0225 Apple In product APPLE KBD_TP_ANSI2 0x0230 Apple Internal Keyboard/Trackpad (Wellspring2/ANSI) product APPLE KBD_TP_ISO2 0x0231 Apple Internal Keyboard/Trackpad (Wellspring2/ISO) product APPLE KBD_TP_JIS2 0x0232 Apple Internal Keyboard/Trackpad (Wellspring2/JIS) +product APPLE MOUSE 0x0301 Mouse M4848 product APPLE OPTMOUSE 0x0302 Optical mouse product APPLE MIGHTYMOUSE 0x0304 Mighty Mouse +product APPLE KBD_HUB 0x1001 Hub in Apple USB Keyboard product APPLE EXT_KBD_HUB 0x1003 Hub in Apple Extended USB Keyboard product APPLE SPEAKERS 0x1101 Speakers product APPLE IPOD 0x1201 iPod @@ -993,7 +998,11 @@ product APPLE IPOD_08 0x1208 iPod '08' product APPLE IPODVIDEO 0x1209 iPod Video product APPLE IPODNANO 0x120a iPod Nano product APPLE IPHONE 0x1290 iPhone +product APPLE IPOD_TOUCH 0x1291 iPod Touch product APPLE IPHONE_3G 0x1292 iPhone 3G +product APPLE IPHONE_3GS 0x1294 iPhone 3GS +product APPLE IPHONE_4 0x1297 iPhone 4 +product APPLE IPAD 0x129a iPad product APPLE ETHERNET 0x1402 Ethernet A1277 /* Arkmicro Technologies */ @@ -1059,6 +1068,9 @@ product ATMEL BW002 0x7605 BW002 Wirele product ATMEL WL1130USB 0x7613 WL-1130 USB product ATMEL AT76C505A 0x7614 AT76c505a Wireless Adapter +/* AuthenTec products */ +product AUTHENTEC AES1610 0x1600 AES1610 Fingerprint Sensor + /* Avision products */ product AVISION 1200U 0x0268 1200U scanner @@ -1125,6 +1137,7 @@ product BROTHER HL1050 0x0002 HL-1050 l product BROTHER MFC8600_9650 0x0100 MFC8600/9650 multifunction device /* Behavior Technology Computer products */ +product BTC BTC6100 0x5550 6100C Keyboard product BTC BTC7932 0x6782 Keyboard with mouse port /* Canon, Inc. products */ @@ -1169,6 +1182,7 @@ product CHIC CYPRESS 0x0003 Cypress USB /* Chicony products */ product CHICONY KB8933 0x0001 KB-8933 keyboard +product CHICONY KU0325 0x0116 KU-0325 keyboard product CHICONY CNF7129 0xb071 Notebook Web Camera product CHICONY2 TWINKLECAM 0x600d TwinkleCam USB camera @@ -1668,6 +1682,7 @@ product HANDSPRING TREO600 0x0300 Handsp /* Hauppauge Computer Works */ product HAUPPAUGE WINTV_USB_FM 0x4d12 WinTV USB FM +product HAUPPAUGE2 NOVAT500 0x9580 NovaT 500Stick /* Hawking Technologies products */ product HAWKING RT2870_1 0x0001 RT2870 @@ -1739,6 +1754,9 @@ product HTC WINMOBILE 0x00ce HTC USB Sy product HTC PPC6700MODEM 0x00cf PPC6700 Modem product HTC SMARTPHONE 0x0a51 SmartPhone USB Sync product HTC WIZARD 0x0bce HTC Wizard USB Sync +product HTC LEGENDSYNC 0x0c97 HTC Legend USB Sync +product HTC LEGEND 0x0ff9 HTC Legend +product HTC LEGENDINTERNET 0x0ffe HTC Legend Internet Sharing /* HUAWEI products */ product HUAWEI MOBILE 0x1001 Huawei Mobile @@ -2123,6 +2141,8 @@ product MICROSOFT INETPRO 0x001c Interne product MICROSOFT TBEXPLORER 0x0024 Trackball Explorer product MICROSOFT INTELLIEYE 0x0025 IntelliEye mouse product MICROSOFT INETPRO2 0x002b Internet Keyboard Pro +product MICROSOFT INTELLIMOUSE5 0x0039 IntelliMouse 1.1 5-Button Mouse +product MICROSOFT WHEELMOUSE 0x0040 Wheel Mouse Optical product MICROSOFT MN510 0x006e MN510 Wireless product MICROSOFT MN110 0x007a 10/100 USB NIC product MICROSOFT WLINTELLIMOUSE 0x008c Wireless Optical IntelliMouse @@ -2301,6 +2321,10 @@ product NOVATEL2 FLEXPACKGPS 0x0100 NovA /* Merlin products */ product MERLIN V620 0x1110 Merlin V620 +/* O2Micro products */ +product O2MICRO OZ776_HUB 0x7761 OZ776 hub +product O2MICRO OZ776_CCID_SC 0x7772 OZ776 CCID SC Reader + /* Olympus products */ product OLYMPUS C1 0x0102 C-1 Digital Camera product OLYMPUS C700 0x0105 C-700 Ultra Zoom @@ -2488,6 +2512,7 @@ product PRIMAX G2E600 0x0383 G2E-600 sc product PRIMAX COMFORT 0x4d01 Comfort product PRIMAX MOUSEINABOX 0x4d02 Mouse-in-a-Box product PRIMAX PCGAUMS1 0x4d04 Sony PCGA-UMS1 +product PRIMAX HP_RH304AA 0x4d17 HP RH304AA mouse /* Prolific products */ product PROLIFIC PL2301 0x0000 PL2301 Host-Host interface From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 17:28:08 2010 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 BAF7D106567E; Mon, 9 Aug 2010 17:28:08 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A88BD8FC22; Mon, 9 Aug 2010 17:28:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79HS8dC056541; Mon, 9 Aug 2010 17:28:08 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79HS8bs056537; Mon, 9 Aug 2010 17:28:08 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008091728.o79HS8bs056537@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 9 Aug 2010 17:28: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: r211105 - head/sys/dev/alc 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, 09 Aug 2010 17:28:08 -0000 Author: yongari Date: Mon Aug 9 17:28:08 2010 New Revision: 211105 URL: http://svn.freebsd.org/changeset/base/211105 Log: Add support for Atheros AR8151/AR8152 PCIe gigabit/fast ethernet controller. These controllers are known as L1D(AR8151) and L2CB/B2(AR8152). This change adds supports for the following controllers. o AR8151 v1.0(L1D) gigabit ethernet controller o AR8151 v2.0(L1D) gigabit ethernet controller o AR8152 v1.1(L2CB) fast ethernet controller o AR8152 v2.0(L2CB2) fast ethernet controller These controllers have the same feature of AR8131/AR8132 and support improved power saving control. The user visible change at this moment is reduced jumbo frame size from 9KB to 6KB. Many thanks to Atheros for continuing to support FreeBSD. HW donated by: Atheros Communications, Inc. Modified: head/sys/dev/alc/if_alc.c head/sys/dev/alc/if_alcreg.h head/sys/dev/alc/if_alcvar.h Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Mon Aug 9 17:27:27 2010 (r211104) +++ head/sys/dev/alc/if_alc.c Mon Aug 9 17:28:08 2010 (r211105) @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ -/* Driver for Atheros AR8131/AR8132 PCIe Ethernet. */ +/* Driver for Atheros AR813x/AR815x PCIe Ethernet. */ #include __FBSDID("$FreeBSD$"); @@ -98,18 +98,23 @@ TUNABLE_INT("hw.alc.msix_disable", &msix /* * Devices supported by this driver. */ -static struct alc_dev { - uint16_t alc_vendorid; - uint16_t alc_deviceid; - const char *alc_name; -} alc_devs[] = { - { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8131, +static struct alc_ident alc_ident_table[] = { + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8131, 9 * 1024, "Atheros AR8131 PCIe Gigabit Ethernet" }, - { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8132, - "Atheros AR8132 PCIe Fast Ethernet" } + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8132, 9 * 1024, + "Atheros AR8132 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8151, 6 * 1024, + "Atheros AR8151 v1.0 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8151_V2, 6 * 1024, + "Atheros AR8151 v2.0 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B, 6 * 1024, + "Atheros AR8152 v1.1 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B2, 6 * 1024, + "Atheros AR8152 v2.0 PCIe Fast Ethernet" }, + { 0, 0, 0, NULL} }; -static void alc_aspm(struct alc_softc *); +static void alc_aspm(struct alc_softc *, int); static int alc_attach(device_t); static int alc_check_boundary(struct alc_softc *); static int alc_detach(device_t); @@ -118,6 +123,8 @@ static int alc_dma_alloc(struct alc_soft static void alc_dma_free(struct alc_softc *); static void alc_dmamap_cb(void *, bus_dma_segment_t *, int, int); static int alc_encap(struct alc_softc *, struct mbuf **); +static struct alc_ident * + alc_find_ident(device_t); #ifndef __NO_STRICT_ALIGNMENT static struct mbuf * alc_fixup_rx(struct ifnet *, struct mbuf *); @@ -331,7 +338,7 @@ alc_miibus_statchg(device_t dev) reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); } - alc_aspm(sc); + alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); } static void @@ -375,23 +382,31 @@ alc_mediachange(struct ifnet *ifp) return (error); } -static int -alc_probe(device_t dev) +static struct alc_ident * +alc_find_ident(device_t dev) { - struct alc_dev *sp; - int i; + struct alc_ident *ident; uint16_t vendor, devid; vendor = pci_get_vendor(dev); devid = pci_get_device(dev); - sp = alc_devs; - for (i = 0; i < sizeof(alc_devs) / sizeof(alc_devs[0]); i++) { - if (vendor == sp->alc_vendorid && - devid == sp->alc_deviceid) { - device_set_desc(dev, sp->alc_name); - return (BUS_PROBE_DEFAULT); - } - sp++; + for (ident = alc_ident_table; ident->name != NULL; ident++) { + if (vendor == ident->vendorid && devid == ident->deviceid) + return (ident); + } + + return (NULL); +} + +static int +alc_probe(device_t dev) +{ + struct alc_ident *ident; + + ident = alc_find_ident(dev); + if (ident != NULL) { + device_set_desc(dev, ident->name); + return (BUS_PROBE_DEFAULT); } return (ENXIO); @@ -401,20 +416,53 @@ static void alc_get_macaddr(struct alc_softc *sc) { uint32_t ea[2], opt; - int i; + uint16_t val; + int eeprom, i; + eeprom = 0; opt = CSR_READ_4(sc, ALC_OPT_CFG); - if ((CSR_READ_4(sc, ALC_TWSI_DEBUG) & TWSI_DEBUG_DEV_EXIST) != 0) { + if ((CSR_READ_4(sc, ALC_MASTER_CFG) & MASTER_OTP_SEL) != 0 && + (CSR_READ_4(sc, ALC_TWSI_DEBUG) & TWSI_DEBUG_DEV_EXIST) != 0) { /* * EEPROM found, let TWSI reload EEPROM configuration. * This will set ethernet address of controller. */ - if ((opt & OPT_CFG_CLK_ENB) == 0) { - opt |= OPT_CFG_CLK_ENB; - CSR_WRITE_4(sc, ALC_OPT_CFG, opt); - CSR_READ_4(sc, ALC_OPT_CFG); - DELAY(1000); + eeprom++; + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8131: + case DEVICEID_ATHEROS_AR8132: + if ((opt & OPT_CFG_CLK_ENB) == 0) { + opt |= OPT_CFG_CLK_ENB; + CSR_WRITE_4(sc, ALC_OPT_CFG, opt); + CSR_READ_4(sc, ALC_OPT_CFG); + DELAY(1000); + } + break; + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x00); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val & 0xFF7F); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x3B); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val | 0x0008); + DELAY(20); + break; } + + CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, + CSR_READ_4(sc, ALC_LTSSM_ID_CFG) & ~LTSSM_ID_WRO_ENB); + CSR_WRITE_4(sc, ALC_WOL_CFG, 0); + CSR_READ_4(sc, ALC_WOL_CFG); + CSR_WRITE_4(sc, ALC_TWSI_CFG, CSR_READ_4(sc, ALC_TWSI_CFG) | TWSI_CFG_SW_LD_START); for (i = 100; i > 0; i--) { @@ -430,11 +478,36 @@ alc_get_macaddr(struct alc_softc *sc) if (bootverbose) device_printf(sc->alc_dev, "EEPROM not found!\n"); } - if ((opt & OPT_CFG_CLK_ENB) != 0) { - opt &= ~OPT_CFG_CLK_ENB; - CSR_WRITE_4(sc, ALC_OPT_CFG, opt); - CSR_READ_4(sc, ALC_OPT_CFG); - DELAY(1000); + if (eeprom != 0) { + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8131: + case DEVICEID_ATHEROS_AR8132: + if ((opt & OPT_CFG_CLK_ENB) != 0) { + opt &= ~OPT_CFG_CLK_ENB; + CSR_WRITE_4(sc, ALC_OPT_CFG, opt); + CSR_READ_4(sc, ALC_OPT_CFG); + DELAY(1000); + } + break; + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x00); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val | 0x0080); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x3B); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val & 0xFFF7); + DELAY(20); + break; + } } ea[0] = CSR_READ_4(sc, ALC_PAR0); @@ -479,6 +552,43 @@ alc_phy_reset(struct alc_softc *sc) CSR_READ_2(sc, ALC_GPHY_CFG); DELAY(10 * 1000); + /* DSP fixup, Vendor magic. */ + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x000A); + data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, data & 0xDFFF); + } + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x003B); + data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, data & 0xFFF7); + DELAY(20 * 1000); + } + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x0029); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, 0x929D); + } + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8131 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8132 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x0029); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, 0xB6DD); + } + /* Load DSP codes, vendor magic. */ data = ANA_LOOP_SEL_10BT | ANA_EN_MASK_TB | ANA_EN_10BT_IDLE | ((1 << ANA_INTERVAL_SEL_TIMER_SHIFT) & ANA_INTERVAL_SEL_TIMER_MASK); @@ -528,36 +638,117 @@ static void alc_phy_down(struct alc_softc *sc) { - /* Force PHY down. */ - CSR_WRITE_2(sc, ALC_GPHY_CFG, - GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | - GPHY_CFG_SEL_ANA_RESET | GPHY_CFG_PHY_IDDQ | GPHY_CFG_PWDOWN_HW); - DELAY(1000); + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + /* + * GPHY power down caused more problems on AR8151 v2.0. + * When driver is reloaded after GPHY power down, + * accesses to PHY/MAC registers hung the system. Only + * cold boot recovered from it. I'm not sure whether + * AR8151 v1.0 also requires this one though. I don't + * have AR8151 v1.0 controller in hand. + * The only option left is to isolate the PHY and + * initiates power down the PHY which in turn saves + * more power when driver is unloaded. + */ + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + MII_BMCR, BMCR_ISO | BMCR_PDOWN); + break; + default: + /* Force PHY down. */ + CSR_WRITE_2(sc, ALC_GPHY_CFG, + GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | + GPHY_CFG_SEL_ANA_RESET | GPHY_CFG_PHY_IDDQ | + GPHY_CFG_PWDOWN_HW); + DELAY(1000); + break; + } } static void -alc_aspm(struct alc_softc *sc) +alc_aspm(struct alc_softc *sc, int media) { uint32_t pmcfg; + uint16_t linkcfg; ALC_LOCK_ASSERT(sc); pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + if ((sc->alc_flags & (ALC_FLAG_APS | ALC_FLAG_PCIE)) == + (ALC_FLAG_APS | ALC_FLAG_PCIE)) + linkcfg = CSR_READ_2(sc, sc->alc_expcap + + PCIR_EXPRESS_LINK_CTL); + else + linkcfg = 0; pmcfg &= ~PM_CFG_SERDES_PD_EX_L1; - pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB; - pmcfg |= PM_CFG_SERDES_L1_ENB; - pmcfg &= ~PM_CFG_L1_ENTRY_TIMER_MASK; + pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_LCKDET_TIMER_MASK); pmcfg |= PM_CFG_MAC_ASPM_CHK; + pmcfg |= PM_CFG_SERDES_ENB | PM_CFG_RBER_ENB; + pmcfg &= ~(PM_CFG_ASPM_L1_ENB | PM_CFG_ASPM_L0S_ENB); + + if ((sc->alc_flags & ALC_FLAG_APS) != 0) { + /* Disable extended sync except AR8152 B v1.0 */ + linkcfg &= ~0x80; + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && + sc->alc_rev == ATHEROS_AR8152_B_V10) + linkcfg |= 0x80; + CSR_WRITE_2(sc, sc->alc_expcap + PCIR_EXPRESS_LINK_CTL, + linkcfg); + pmcfg &= ~(PM_CFG_EN_BUFS_RX_L0S | PM_CFG_SA_DLY_ENB | + PM_CFG_HOTRST); + pmcfg |= (PM_CFG_L1_ENTRY_TIMER_DEFAULT << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + pmcfg &= ~PM_CFG_PM_REQ_TIMER_MASK; + pmcfg |= (PM_CFG_PM_REQ_TIMER_DEFAULT << + PM_CFG_PM_REQ_TIMER_SHIFT); + pmcfg |= PM_CFG_SERDES_PD_EX_L1 | PM_CFG_PCIE_RECV; + } + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { - pmcfg |= PM_CFG_SERDES_PLL_L1_ENB; - pmcfg &= ~PM_CFG_CLK_SWH_L1; - pmcfg &= ~PM_CFG_ASPM_L1_ENB; - pmcfg &= ~PM_CFG_ASPM_L0S_ENB; + if ((sc->alc_flags & ALC_FLAG_L0S) != 0) + pmcfg |= PM_CFG_ASPM_L0S_ENB; + if ((sc->alc_flags & ALC_FLAG_L1S) != 0) + pmcfg |= PM_CFG_ASPM_L1_ENB; + if ((sc->alc_flags & ALC_FLAG_APS) != 0) { + if (sc->alc_ident->deviceid == + DEVICEID_ATHEROS_AR8152_B) + pmcfg &= ~PM_CFG_ASPM_L0S_ENB; + pmcfg &= ~(PM_CFG_SERDES_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB | + PM_CFG_SERDES_BUDS_RX_L1_ENB); + pmcfg |= PM_CFG_CLK_SWH_L1; + if (media == IFM_100_TX || media == IFM_1000_T) { + pmcfg &= ~PM_CFG_L1_ENTRY_TIMER_MASK; + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8152_B: + pmcfg |= (7 << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + break; + case DEVICEID_ATHEROS_AR8152_B2: + case DEVICEID_ATHEROS_AR8151_V2: + pmcfg |= (4 << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + break; + default: + pmcfg |= (15 << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + break; + } + } + } else { + pmcfg |= PM_CFG_SERDES_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB | + PM_CFG_SERDES_BUDS_RX_L1_ENB; + pmcfg &= ~(PM_CFG_CLK_SWH_L1 | + PM_CFG_ASPM_L1_ENB | PM_CFG_ASPM_L0S_ENB); + } } else { - pmcfg &= ~PM_CFG_SERDES_PLL_L1_ENB; + pmcfg &= ~(PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SERDES_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB); pmcfg |= PM_CFG_CLK_SWH_L1; - pmcfg &= ~PM_CFG_ASPM_L1_ENB; - pmcfg &= ~PM_CFG_ASPM_L0S_ENB; + if ((sc->alc_flags & ALC_FLAG_L1S) != 0) + pmcfg |= PM_CFG_ASPM_L1_ENB; } CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); } @@ -567,7 +758,7 @@ alc_attach(device_t dev) { struct alc_softc *sc; struct ifnet *ifp; - char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/l1" }; + char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; uint16_t burst; int base, error, i, msic, msixc, state; uint32_t cap, ctl, val; @@ -580,6 +771,7 @@ alc_attach(device_t dev) MTX_DEF); callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); + sc->alc_ident = alc_find_ident(dev); /* Map the device. */ pci_enable_busmaster(dev); @@ -619,6 +811,20 @@ alc_attach(device_t dev) val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, + CSR_READ_4(sc, ALC_LTSSM_ID_CFG) & ~LTSSM_ID_WRO_ENB); + CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, + CSR_READ_4(sc, ALC_PCIE_PHYMISC) | + PCIE_PHYMISC_FORCE_RCV_DET); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && + sc->alc_rev == ATHEROS_AR8152_B_V10) { + val = CSR_READ_4(sc, ALC_PCIE_PHYMISC2); + val &= ~(PCIE_PHYMISC2_SERDES_CDR_MASK | + PCIE_PHYMISC2_SERDES_TH_MASK); + val |= 3 << PCIE_PHYMISC2_SERDES_CDR_SHIFT; + val |= 3 << PCIE_PHYMISC2_SERDES_TH_SHIFT; + CSR_WRITE_4(sc, ALC_PCIE_PHYMISC2, val); + } /* Disable ASPM L0S and L1. */ cap = CSR_READ_2(sc, base + PCIR_EXPRESS_LINK_CAP); if ((cap & PCIM_LINK_CAP_ASPM) != 0) { @@ -629,12 +835,19 @@ alc_attach(device_t dev) device_printf(dev, "RCB %u bytes\n", sc->alc_rcb == DMA_CFG_RCB_64 ? 64 : 128); state = ctl & 0x03; + if (state & 0x01) + sc->alc_flags |= ALC_FLAG_L0S; + if (state & 0x02) + sc->alc_flags |= ALC_FLAG_L1S; if (bootverbose) device_printf(sc->alc_dev, "ASPM %s %s\n", aspm_state[state], state == 0 ? "disabled" : "enabled"); - if (state != 0) - alc_disable_l0s_l1(sc); + alc_disable_l0s_l1(sc); + } else { + if (bootverbose) + device_printf(sc->alc_dev, + "no ASPM support\n"); } } @@ -651,12 +864,25 @@ alc_attach(device_t dev) * used in AR8132 can't establish gigabit link even if it * shows the same PHY model/revision number of AR8131. */ - if (pci_get_device(dev) == DEVICEID_ATHEROS_AR8132) - sc->alc_flags |= ALC_FLAG_FASTETHER | ALC_FLAG_JUMBO; - else - sc->alc_flags |= ALC_FLAG_JUMBO | ALC_FLAG_ASPM_MON; + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: + sc->alc_flags |= ALC_FLAG_APS; + /* FALLTHROUGH */ + case DEVICEID_ATHEROS_AR8132: + sc->alc_flags |= ALC_FLAG_FASTETHER; + break; + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + sc->alc_flags |= ALC_FLAG_APS; + /* FALLTHROUGH */ + default: + break; + } + sc->alc_flags |= ALC_FLAG_ASPM_MON | ALC_FLAG_JUMBO; + /* - * It seems that AR8131/AR8132 has silicon bug for SMB. In + * It seems that AR813x/AR815x has silicon bug for SMB. In * addition, Atheros said that enabling SMB wouldn't improve * performance. However I think it's bad to access lots of * registers to extract MAC statistics. @@ -1369,7 +1595,7 @@ again: /* * Create Tx buffer parent tag. - * AR8131/AR8132 allows 64bit DMA addressing of Tx/Rx buffers + * AR813x/AR815x allows 64bit DMA addressing of Tx/Rx buffers * so it needs separate parent DMA tag as parent DMA address * space could be restricted to be within 32bit address space * by 4GB boundary crossing. @@ -1806,7 +2032,7 @@ alc_encap(struct alc_softc *sc, struct m poff = 0; if ((m->m_pkthdr.csum_flags & (ALC_CSUM_FEATURES | CSUM_TSO)) != 0) { /* - * AR8131/AR8132 requires offset of TCP/UDP header in its + * AR813x/AR815x requires offset of TCP/UDP header in its * Tx descriptor to perform Tx checksum offloading. TSO * also requires TCP header offset and modification of * IP/TCP header. This kind of operation takes many CPU @@ -1826,12 +2052,14 @@ alc_encap(struct alc_softc *sc, struct m *m_head = m; } - m = m_pullup(m, sizeof(struct ether_header) + sizeof(struct ip)); + m = m_pullup(m, sizeof(struct ether_header) + + sizeof(struct ip)); if (m == NULL) { *m_head = NULL; return (ENOBUFS); } - ip = (struct ip *)(mtod(m, char *) + sizeof(struct ether_header)); + ip = (struct ip *)(mtod(m, char *) + + sizeof(struct ether_header)); poff = sizeof(struct ether_header) + (ip->ip_hl << 2); if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { m = m_pullup(m, poff + sizeof(struct tcphdr)); @@ -1922,7 +2150,7 @@ alc_encap(struct alc_softc *sc, struct m cflags |= (poff << TD_TCPHDR_OFFSET_SHIFT) & TD_TCPHDR_OFFSET_MASK; /* - * AR8131/AR8132 requires the first buffer should + * AR813x/AR815x requires the first buffer should * only hold IP/TCP header data. Payload should * be handled in other descriptors. */ @@ -2103,14 +2331,16 @@ alc_ioctl(struct ifnet *ifp, u_long cmd, error = 0; switch (cmd) { case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ALC_JUMBO_MTU || + if (ifr->ifr_mtu < ETHERMIN || + ifr->ifr_mtu > (sc->alc_ident->max_framelen - + sizeof(struct ether_vlan_header) - ETHER_CRC_LEN) || ((sc->alc_flags & ALC_FLAG_JUMBO) == 0 && ifr->ifr_mtu > ETHERMTU)) error = EINVAL; else if (ifp->if_mtu != ifr->ifr_mtu) { ALC_LOCK(sc); ifp->if_mtu = ifr->ifr_mtu; - /* AR8131/AR8132 has 13 bits MSS field. */ + /* AR813x/AR815x has 13 bits MSS field. */ if (ifp->if_mtu > ALC_TSO_MTU && (ifp->if_capenable & IFCAP_TSO4) != 0) { ifp->if_capenable &= ~IFCAP_TSO4; @@ -2161,7 +2391,7 @@ alc_ioctl(struct ifnet *ifp, u_long cmd, (ifp->if_capabilities & IFCAP_TSO4) != 0) { ifp->if_capenable ^= IFCAP_TSO4; if ((ifp->if_capenable & IFCAP_TSO4) != 0) { - /* AR8131/AR8132 has 13 bits MSS field. */ + /* AR813x/AR815x has 13 bits MSS field. */ if (ifp->if_mtu > ALC_TSO_MTU) { ifp->if_capenable &= ~IFCAP_TSO4; ifp->if_hwassist &= ~CSUM_TSO; @@ -2213,6 +2443,10 @@ alc_mac_config(struct alc_softc *sc) reg = CSR_READ_4(sc, ALC_MAC_CFG); reg &= ~(MAC_CFG_FULL_DUPLEX | MAC_CFG_TX_FC | MAC_CFG_RX_FC | MAC_CFG_SPEED_MASK); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) + reg |= MAC_CFG_HASH_ALG_CRC32 | MAC_CFG_SPEED_MODE_SW; /* Reprogram MAC with resolved speed/duplex. */ switch (IFM_SUBTYPE(mii->mii_media_active)) { case IFM_10_T: @@ -2834,7 +3068,9 @@ alc_reset(struct alc_softc *sc) uint32_t reg; int i; - CSR_WRITE_4(sc, ALC_MASTER_CFG, MASTER_RESET); + reg = CSR_READ_4(sc, ALC_MASTER_CFG) & 0xFFFF; + reg |= MASTER_OOB_DIS_OFF | MASTER_RESET; + CSR_WRITE_4(sc, ALC_MASTER_CFG, reg); for (i = ALC_RESET_TIMEOUT; i > 0; i--) { DELAY(10); if ((CSR_READ_4(sc, ALC_MASTER_CFG) & MASTER_RESET) == 0) @@ -2965,6 +3201,18 @@ alc_init_locked(struct alc_softc *sc) CSR_WRITE_4(sc, ALC_SMB_BASE_ADDR_HI, ALC_ADDR_HI(paddr)); CSR_WRITE_4(sc, ALC_SMB_BASE_ADDR_LO, ALC_ADDR_LO(paddr)); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B) { + /* Reconfigure SRAM - Vendor magic. */ + CSR_WRITE_4(sc, ALC_SRAM_RX_FIFO_LEN, 0x000002A0); + CSR_WRITE_4(sc, ALC_SRAM_TX_FIFO_LEN, 0x00000100); + CSR_WRITE_4(sc, ALC_SRAM_RX_FIFO_ADDR, 0x029F0000); + CSR_WRITE_4(sc, ALC_SRAM_RD0_ADDR, 0x02BF02A0); + CSR_WRITE_4(sc, ALC_SRAM_TX_FIFO_ADDR, 0x03BF02C0); + CSR_WRITE_4(sc, ALC_SRAM_TD_ADDR, 0x03DF03C0); + CSR_WRITE_4(sc, ALC_TXF_WATER_MARK, 0x00000000); + CSR_WRITE_4(sc, ALC_RD_DMA_CFG, 0x00000000); + } + /* Tell hardware that we're ready to load DMA blocks. */ CSR_WRITE_4(sc, ALC_DMA_BLOCK, DMA_BLOCK_LOAD); @@ -2972,14 +3220,11 @@ alc_init_locked(struct alc_softc *sc) reg = ALC_USECS(sc->alc_int_rx_mod) << IM_TIMER_RX_SHIFT; reg |= ALC_USECS(sc->alc_int_tx_mod) << IM_TIMER_TX_SHIFT; CSR_WRITE_4(sc, ALC_IM_TIMER, reg); - reg = CSR_READ_4(sc, ALC_MASTER_CFG); - reg &= ~(MASTER_CHIP_REV_MASK | MASTER_CHIP_ID_MASK); /* * We don't want to automatic interrupt clear as task queue * for the interrupt should know interrupt status. */ - reg &= ~MASTER_INTR_RD_CLR; - reg &= ~(MASTER_IM_RX_TIMER_ENB | MASTER_IM_TX_TIMER_ENB); + reg = MASTER_SA_TIMER_ENB; if (ALC_USECS(sc->alc_int_rx_mod) != 0) reg |= MASTER_IM_RX_TIMER_ENB; if (ALC_USECS(sc->alc_int_tx_mod) != 0) @@ -3020,7 +3265,7 @@ alc_init_locked(struct alc_softc *sc) * Be conservative in what you do, be liberal in what you * accept from others - RFC 793. */ - CSR_WRITE_4(sc, ALC_FRAME_SIZE, ALC_JUMBO_FRAMELEN); + CSR_WRITE_4(sc, ALC_FRAME_SIZE, sc->alc_ident->max_framelen); /* Disable header split(?) */ CSR_WRITE_4(sc, ALC_HDS_CFG, 0); @@ -3047,11 +3292,14 @@ alc_init_locked(struct alc_softc *sc) * TSO/checksum offloading. */ CSR_WRITE_4(sc, ALC_TSO_OFFLOAD_THRESH, - (ALC_JUMBO_FRAMELEN >> TSO_OFFLOAD_THRESH_UNIT_SHIFT) & + (sc->alc_ident->max_framelen >> TSO_OFFLOAD_THRESH_UNIT_SHIFT) & TSO_OFFLOAD_THRESH_MASK); /* Configure TxQ. */ reg = (alc_dma_burst[sc->alc_dma_rd_burst] << TXQ_CFG_TX_FIFO_BURST_SHIFT) & TXQ_CFG_TX_FIFO_BURST_MASK; + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) + reg >>= 1; reg |= (TXQ_CFG_TD_BURST_DEFAULT << TXQ_CFG_TD_BURST_SHIFT) & TXQ_CFG_TD_BURST_MASK; CSR_WRITE_4(sc, ALC_TXQ_CFG, reg | TXQ_CFG_ENHANCED_MODE); @@ -3068,14 +3316,23 @@ alc_init_locked(struct alc_softc *sc) * XON : 80% of Rx FIFO * XOFF : 30% of Rx FIFO */ - reg = CSR_READ_4(sc, ALC_SRAM_RX_FIFO_LEN); - rxf_hi = (reg * 8) / 10; - rxf_lo = (reg * 3)/ 10; - CSR_WRITE_4(sc, ALC_RX_FIFO_PAUSE_THRESH, - ((rxf_lo << RX_FIFO_PAUSE_THRESH_LO_SHIFT) & - RX_FIFO_PAUSE_THRESH_LO_MASK) | - ((rxf_hi << RX_FIFO_PAUSE_THRESH_HI_SHIFT) & - RX_FIFO_PAUSE_THRESH_HI_MASK)); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8131 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8132) { + reg = CSR_READ_4(sc, ALC_SRAM_RX_FIFO_LEN); + rxf_hi = (reg * 8) / 10; + rxf_lo = (reg * 3) / 10; + CSR_WRITE_4(sc, ALC_RX_FIFO_PAUSE_THRESH, + ((rxf_lo << RX_FIFO_PAUSE_THRESH_LO_SHIFT) & + RX_FIFO_PAUSE_THRESH_LO_MASK) | + ((rxf_hi << RX_FIFO_PAUSE_THRESH_HI_SHIFT) & + RX_FIFO_PAUSE_THRESH_HI_MASK)); + } + + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2) + CSR_WRITE_4(sc, ALC_SERDES_LOCK, + CSR_READ_4(sc, ALC_SERDES_LOCK) | SERDES_MAC_CLK_SLOWDOWN | + SERDES_PHY_CLK_SLOWDOWN); /* Disable RSS until I understand L1C/L2C's RSS logic. */ CSR_WRITE_4(sc, ALC_RSS_IDT_TABLE0, 0); @@ -3086,15 +3343,9 @@ alc_init_locked(struct alc_softc *sc) RXQ_CFG_RD_BURST_MASK; reg |= RXQ_CFG_RSS_MODE_DIS; if ((sc->alc_flags & ALC_FLAG_ASPM_MON) != 0) - reg |= RXQ_CFG_ASPM_THROUGHPUT_LIMIT_100M; + reg |= RXQ_CFG_ASPM_THROUGHPUT_LIMIT_1M; CSR_WRITE_4(sc, ALC_RXQ_CFG, reg); - /* Configure Rx DMAW request thresold. */ - CSR_WRITE_4(sc, ALC_RD_DMA_CFG, - ((RD_DMA_CFG_THRESH_DEFAULT << RD_DMA_CFG_THRESH_SHIFT) & - RD_DMA_CFG_THRESH_MASK) | - ((ALC_RD_DMA_CFG_USECS(0) << RD_DMA_CFG_TIMER_SHIFT) & - RD_DMA_CFG_TIMER_MASK)); /* Configure DMA parameters. */ reg = DMA_CFG_OUT_ORDER | DMA_CFG_RD_REQ_PRI; reg |= sc->alc_rcb; @@ -3120,7 +3371,7 @@ alc_init_locked(struct alc_softc *sc) * - Enable CRC generation. * Actual reconfiguration of MAC for resolved speed/duplex * is followed after detection of link establishment. - * AR8131/AR8132 always does checksum computation regardless + * AR813x/AR815x always does checksum computation regardless * of MAC_CFG_RXCSUM_ENB bit. Also the controller is known to * have bug in protocol field in Rx return structure so * these controllers can't handle fragmented frames. Disable @@ -3130,6 +3381,10 @@ alc_init_locked(struct alc_softc *sc) reg = MAC_CFG_TX_CRC_ENB | MAC_CFG_TX_AUTO_PAD | MAC_CFG_FULL_DUPLEX | ((MAC_CFG_PREAMBLE_DEFAULT << MAC_CFG_PREAMBLE_SHIFT) & MAC_CFG_PREAMBLE_MASK); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) + reg |= MAC_CFG_HASH_ALG_CRC32 | MAC_CFG_SPEED_MODE_SW; if ((sc->alc_flags & ALC_FLAG_FASTETHER) != 0) reg |= MAC_CFG_SPEED_10_100; else Modified: head/sys/dev/alc/if_alcreg.h ============================================================================== --- head/sys/dev/alc/if_alcreg.h Mon Aug 9 17:27:27 2010 (r211104) +++ head/sys/dev/alc/if_alcreg.h Mon Aug 9 17:28:08 2010 (r211105) @@ -36,10 +36,17 @@ #define VENDORID_ATHEROS 0x1969 /* - * Atheros AR8131/AR8132 device ID + * Atheros AR813x/AR815x device ID */ #define DEVICEID_ATHEROS_AR8131 0x1063 /* L1C */ #define DEVICEID_ATHEROS_AR8132 0x1062 /* L2C */ +#define DEVICEID_ATHEROS_AR8151 0x1073 /* L1D V1.0 */ +#define DEVICEID_ATHEROS_AR8151_V2 0x1083 /* L1D V2.0 */ +#define DEVICEID_ATHEROS_AR8152_B 0x2060 /* L2C V1.1 */ +#define DEVICEID_ATHEROS_AR8152_B2 0x2062 /* L2C V2.0 */ + +#define ATHEROS_AR8152_B_V10 0xC0 +#define ATHEROS_AR8152_B_V11 0xC1 /* 0x0000 - 0x02FF : PCIe configuration space */ @@ -64,6 +71,12 @@ #define ALC_PCIE_PHYMISC 0x1000 #define PCIE_PHYMISC_FORCE_RCV_DET 0x00000004 +#define ALC_PCIE_PHYMISC2 0x1004 +#define PCIE_PHYMISC2_SERDES_CDR_MASK 0x00030000 +#define PCIE_PHYMISC2_SERDES_TH_MASK 0x000C0000 +#define PCIE_PHYMISC2_SERDES_CDR_SHIFT 16 +#define PCIE_PHYMISC2_SERDES_TH_SHIFT 18 + #define ALC_TWSI_DEBUG 0x1108 #define TWSI_DEBUG_DEV_EXIST 0x20000000 @@ -97,6 +110,8 @@ #define PM_CFG_L1_ENTRY_TIMER_MASK 0x000F0000 #define PM_CFG_PM_REQ_TIMER_MASK 0x00F00000 #define PM_CFG_LCKDET_TIMER_MASK 0x3F000000 +#define PM_CFG_EN_BUFS_RX_L0S 0x10000000 +#define PM_CFG_SA_DLY_ENB 0x20000000 #define PM_CFG_MAC_ASPM_CHK 0x40000000 #define PM_CFG_HOTRST 0x80000000 #define PM_CFG_L0S_ENTRY_TIMER_SHIFT 8 @@ -104,10 +119,19 @@ #define PM_CFG_PM_REQ_TIMER_SHIFT 20 #define PM_CFG_LCKDET_TIMER_SHIFT 24 +#define PM_CFG_L0S_ENTRY_TIMER_DEFAULT 6 +#define PM_CFG_L1_ENTRY_TIMER_DEFAULT 12 +#define PM_CFG_PM_REQ_TIMER_DEFAULT 1 + +#define ALC_LTSSM_ID_CFG 0x12FC +#define LTSSM_ID_WRO_ENB 0x00001000 + #define ALC_MASTER_CFG 0x1400 #define MASTER_RESET 0x00000001 #define MASTER_TEST_MODE_MASK 0x0000000C #define MASTER_BERT_START 0x00000010 +#define MASTER_OOB_DIS_OFF 0x00000040 +#define MASTER_SA_TIMER_ENB 0x00000080 #define MASTER_MTIMER_ENB 0x00000100 #define MASTER_MANUAL_INTR_ENB 0x00000200 #define MASTER_IM_TX_TIMER_ENB 0x00000400 @@ -122,7 +146,7 @@ #define MASTER_CHIP_REV_SHIFT 16 #define MASTER_CHIP_ID_SHIFT 24 -/* Number of ticks per usec for AR8131/AR8132. */ +/* Number of ticks per usec for AR813x/AR815x. */ #define ALC_TICK_USECS 2 #define ALC_USECS(x) ((x) / ALC_TICK_USECS) @@ -220,6 +244,8 @@ #define ALC_SERDES_LOCK 0x1424 #define SERDES_LOCK_DET 0x00000001 #define SERDES_LOCK_DET_ENB 0x00000002 +#define SERDES_MAC_CLK_SLOWDOWN 0x00020000 +#define SERDES_PHY_CLK_SLOWDOWN 0x00040000 #define ALC_MAC_CFG 0x1480 #define MAC_CFG_TX_ENB 0x00000001 @@ -249,6 +275,8 @@ #define MAC_CFG_BCAST 0x04000000 #define MAC_CFG_DBG 0x08000000 #define MAC_CFG_SINGLE_PAUSE_ENB 0x10000000 +#define MAC_CFG_HASH_ALG_CRC32 0x20000000 +#define MAC_CFG_SPEED_MODE_SW 0x40000000 #define MAC_CFG_PREAMBLE_SHIFT 10 #define MAC_CFG_PREAMBLE_DEFAULT 7 @@ -691,7 +719,7 @@ #define HDS_CFG_BACKFILLSIZE_SHIFT 8 #define HDS_CFG_MAX_HDRSIZE_SHIFT 20 -/* AR8131/AR8132 registers for MAC statistics */ +/* AR813x/AR815x registers for MAC statistics */ #define ALC_RX_MIB_BASE 0x1700 #define ALC_TX_MIB_BASE 0x1760 Modified: head/sys/dev/alc/if_alcvar.h ============================================================================== --- head/sys/dev/alc/if_alcvar.h Mon Aug 9 17:27:27 2010 (r211104) +++ head/sys/dev/alc/if_alcvar.h Mon Aug 9 17:28:08 2010 (r211105) @@ -68,13 +68,8 @@ #define ALC_PROC_MAX (ALC_RX_RING_CNT - 1) #define ALC_PROC_DEFAULT (ALC_RX_RING_CNT / 4) -#define ALC_JUMBO_FRAMELEN (9 * 1024) -#define ALC_JUMBO_MTU \ - (ALC_JUMBO_FRAMELEN - sizeof(struct ether_vlan_header) - ETHER_CRC_LEN) -#define ALC_MAX_FRAMELEN (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) - /* - * The number of bits reserved for MSS in AR8121/AR8132 controllers + * The number of bits reserved for MSS in AR813x/AR815x controllers * are 13 bits. This limits the maximum interface MTU size in TSO * case(8191 + sizeof(struct ip) + sizeof(struct tcphdr)) as upper * stack should not generate TCP segments with MSS greater than the @@ -192,6 +187,13 @@ struct alc_hw_stats { uint64_t tx_mcast_bytes; }; +struct alc_ident { + uint16_t vendorid; + uint16_t deviceid; + uint32_t max_framelen; + const char *name; +}; + /* * Software state per device. */ @@ -204,6 +206,7 @@ struct alc_softc { struct resource *alc_irq[ALC_MSI_MESSAGES]; struct resource_spec *alc_irq_spec; void *alc_intrhand[ALC_MSI_MESSAGES]; + struct alc_ident *alc_ident; int alc_rev; int alc_chip_rev; int alc_phyaddr; @@ -224,6 +227,9 @@ struct alc_softc { #define ALC_FLAG_ASPM_MON 0x0080 #define ALC_FLAG_CMB_BUG 0x0100 #define ALC_FLAG_SMB_BUG 0x0200 +#define ALC_FLAG_L0S 0x0400 +#define ALC_FLAG_L1S 0x0800 +#define ALC_FLAG_APS 0x1000 #define ALC_FLAG_DETACH 0x4000 #define ALC_FLAG_LINK 0x8000 From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 17:33:03 2010 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 BE9A71065673; Mon, 9 Aug 2010 17:33:03 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9314E8FC12; Mon, 9 Aug 2010 17:33:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79HX3Nn057702; Mon, 9 Aug 2010 17:33:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79HX3s6057700; Mon, 9 Aug 2010 17:33:03 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008091733.o79HX3s6057700@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 9 Aug 2010 17:33: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: r211106 - 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, 09 Aug 2010 17:33:03 -0000 Author: yongari Date: Mon Aug 9 17:33:03 2010 New Revision: 211106 URL: http://svn.freebsd.org/changeset/base/211106 Log: Document newly added controller AR8151 and AR8152. Modified: head/share/man/man4/alc.4 Modified: head/share/man/man4/alc.4 ============================================================================== --- head/share/man/man4/alc.4 Mon Aug 9 17:28:08 2010 (r211105) +++ head/share/man/man4/alc.4 Mon Aug 9 17:33:03 2010 (r211106) @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd June 10, 2009 +.Dd August 9, 2010 .Dt ALC 4 .Os .Sh NAME .Nm alc -.Nd Atheros AR8131/AR8132 Gigabit/Fast Ethernet driver +.Nd Atheros AR813x/AR815x Gigabit/Fast Ethernet driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -48,9 +48,8 @@ if_alc_load="YES" .Sh DESCRIPTION The .Nm -device driver provides support for Atheros AR8131 PCI Express -Gigabit Ethernet controllers and Atheros AR8132 PCI Express -Fast Ethernet controllers. +device driver provides support for Atheros AR813x and AR815x PCI +Express Gigabit/Fast Ethernet controllers. .Pp All LOMs supported by the .Nm @@ -59,8 +58,9 @@ segmentation offload (TSO), hardware VLA features, Wake On Lan (WOL) and an interrupt moderation mechanism as well as a 64-bit multicast hash filter. .Pp -The AR8131/AR8132 supports Jumbo Frames (up to 9216 bytes), which can -be configured via the interface MTU setting. +The AR813x and AR815x supports Jumbo Frames (up to 9216 and 6144 +bytes, respectively), which can be configured via the interface +MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit Jumbo Frames. @@ -104,6 +104,14 @@ device driver provides support for the f Atheros AR8131 PCI Express Gigabit Ethernet controller .It Atheros AR8132 PCI Express Fast Ethernet controller +.It +Atheros AR8151 v1.0 PCI Express Gigabit Ethernet controller +.It +Atheros AR8151 v2.0 PCI Express Gigabit Ethernet controller +.It +Atheros AR8152 v1.1 PCI Express Fast Ethernet controller +.It +Atheros AR8152 v2.0 PCI Express Fast Ethernet controller .El .Sh LOADER TUNABLES Tunables can be set at the From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 17:34:57 2010 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 A8D94106564A; Mon, 9 Aug 2010 17:34:57 +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 97AED8FC17; Mon, 9 Aug 2010 17:34:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79HYvKW058161; Mon, 9 Aug 2010 17:34:57 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79HYv8W058159; Mon, 9 Aug 2010 17:34:57 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008091734.o79HYv8W058159@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 9 Aug 2010 17:34: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: r211107 - head/tools/regression/fstest/tests 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, 09 Aug 2010 17:34:57 -0000 Author: pjd Date: Mon Aug 9 17:34:57 2010 New Revision: 211107 URL: http://svn.freebsd.org/changeset/base/211107 Log: No need to use grep to check if path start with /. Suggested by: ed Modified: head/tools/regression/fstest/tests/misc.sh Modified: head/tools/regression/fstest/tests/misc.sh ============================================================================== --- head/tools/regression/fstest/tests/misc.sh Mon Aug 9 17:33:03 2010 (r211106) +++ head/tools/regression/fstest/tests/misc.sh Mon Aug 9 17:34:57 2010 (r211107) @@ -9,12 +9,14 @@ path1021="${name255}/${name255}/${name25 path1023="${path1021}/x" path1024="${path1023}x" -echo ${dir} | grep '^/' >/dev/null 2>&1 -if [ $? -eq 0 ]; then +case "${dir}" in +/*) maindir="${dir}/../.." -else + ;; +*) maindir="`pwd`/${dir}/../.." -fi + ;; +esac fstest="${maindir}/fstest" . ${maindir}/tests/conf From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 17:37:30 2010 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 22B0A106566B; Mon, 9 Aug 2010 17:37:30 +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 EB3C78FC0A; Mon, 9 Aug 2010 17:37:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79HbTTU058784; Mon, 9 Aug 2010 17:37:29 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79HbTY5058781; Mon, 9 Aug 2010 17:37:29 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008091737.o79HbTY5058781@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 9 Aug 2010 17:37: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: r211108 - head/tools/regression/fstest/tests 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, 09 Aug 2010 17:37:30 -0000 Author: pjd Date: Mon Aug 9 17:37:29 2010 New Revision: 211108 URL: http://svn.freebsd.org/changeset/base/211108 Log: Small tweaks. Modified: head/tools/regression/fstest/tests/conf head/tools/regression/fstest/tests/misc.sh Modified: head/tools/regression/fstest/tests/conf ============================================================================== --- head/tools/regression/fstest/tests/conf Mon Aug 9 17:34:57 2010 (r211107) +++ head/tools/regression/fstest/tests/conf Mon Aug 9 17:37:29 2010 (r211108) @@ -1,7 +1,7 @@ # $FreeBSD$ # fstest configuration file -# Known operating systems: FreeBSD, SunOS, Linux +# Supported operating systems: FreeBSD, Darwin, SunOS, Linux os=`uname` case "${os}" in @@ -9,12 +9,12 @@ FreeBSD|Darwin) GREP=grep #fs=`df -T . | tail -1 | awk '{print $2}'` pattern="`df . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'`" - fs=`mount | egrep "^${pattern}" | awk -F '[(,]' '{print toupper($2)}'` + fs=`mount | ${GREP} -E "^${pattern}" | awk -F '[(,]' '{print toupper($2)}'` ;; Solaris|SunOS) GREP=ggrep pattern=`df -k . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'` - fs=`mount -v | egrep "^${pattern}" | awk '{print $5}' | \ + fs=`mount -v | ${GREP} -E "^${pattern}" | awk '{print $5}' | \ tr -s '[:lower:]' '[:upper:]'` ;; Linux) Modified: head/tools/regression/fstest/tests/misc.sh ============================================================================== --- head/tools/regression/fstest/tests/misc.sh Mon Aug 9 17:34:57 2010 (r211107) +++ head/tools/regression/fstest/tests/misc.sh Mon Aug 9 17:37:29 2010 (r211108) @@ -25,7 +25,7 @@ expect() e="${1}" shift r=`${fstest} $* 2>/dev/null | tail -1` - echo "${r}" | ${GREP} -E '^'${e}'$' >/dev/null 2>&1 + echo "${r}" | ${GREP} -Eq '^'${e}'$' if [ $? -eq 0 ]; then if [ -z "${todomsg}" ]; then echo "ok ${ntest}" @@ -40,7 +40,7 @@ expect() fi fi todomsg="" - ntest=`expr $ntest + 1` + ntest=$((ntest+1)) } jexpect() @@ -50,7 +50,7 @@ jexpect() e="${3}" shift 3 r=`jail -s ${s} / fstest 127.0.0.1 /bin/sh -c "cd ${d} && ${fstest} $* 2>/dev/null" | tail -1` - echo "${r}" | ${GREP} -E '^'${e}'$' >/dev/null 2>&1 + echo "${r}" | ${GREP} -Eq '^'${e}'$' if [ $? -eq 0 ]; then if [ -z "${todomsg}" ]; then echo "ok ${ntest}" @@ -65,7 +65,7 @@ jexpect() fi fi todomsg="" - ntest=`expr $ntest + 1` + ntest=$((ntest+1)) } test_check() @@ -84,7 +84,7 @@ test_check() fi fi todomsg="" - ntest=`expr $ntest + 1` + ntest=$((ntest+1)) } todo() From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 17:21:14 2010 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 11B1C106567A; Mon, 9 Aug 2010 17:21:14 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id A0F408FC1E; Mon, 9 Aug 2010 17:21:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o79HIpDZ058995; Mon, 9 Aug 2010 11:18:52 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 09 Aug 2010 11:19:22 -0600 (MDT) Message-Id: <20100809.111922.276219111637867136.imp@bsdimp.com> To: c.jayachandran@gmail.com From: "M. Warner Losh" In-Reply-To: References: X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Mon, 09 Aug 2010 17:38:50 +0000 Cc: src-committers@freebsd.org, jhb@freebsd.org, jchandra@freebsd.org, svn-src-all@freebsd.org, jlanders@vmware.com, attilio@freebsd.org, rrs@freebsd.org, sbruno@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r208165 - in head/sys: kern mips/conf mips/include mips/mips mips/rmi mips/rmi/dev/xlr 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, 09 Aug 2010 17:21:14 -0000 In message: "Jayachandran C." writes: : >>>> =A0 =A0 =A0 =A0top->cg_level =3D CG_SHARE_NONE; : >>>> : >>> : >>> ... and this is why I particulary hate big commits with complete = lack : >>> of technical details. : >>> : >>> This particulary chunk was supposed to fix a nasty and completely= MI : >>> bug that some users have already met (kern/148698). The complete = lack : >>> of details didn't help in identify the issue neither that it was = a : >>> valuable fix. : >>> : >>> The fix is, however, improper (there is no clear relationship bet= ween : >>> the multiplication and why that happens) thus I would rather use = what : >>> Joe has reported in the PR. : >> : >> : >> I was not aware of the PR when I sent this changes to rrs@, and th= is : >> went as a part of MIPS SMP support for XLR which has 32 CPUs : >> : >> But I'm not sure that the current change is correct, cg_mask is of= : >> type cpumask_t and I don't think it is guaranteed to be 32 bit (as= it : >> is a machine dependent type). : > : > Actually the 32 bits limit is well aware and acknowledged in cpumas= k_t. : > While it is true that it should be an 'opaque' type, in reality it = is : > not. The maximum limit of 32 CPUs is a reality due to cpumask_t on = all : > our architectures. : > That is why we are going to use cpuset_t for dealing with CPUs numb= ers : > (which is really opaque, at same extent, and is not bound to any : > size). : = : In my opinion, your changes added another pitfall for the person who : tries to make the cpumask_t 64 bit to support more cpus, which really= : could have been avoided. : = : But if cpumask_t is going to be changed to cpuset_t soon, I guess we : are fine :) : = : JC. Yes, the correct fix, short of cpuset_t, is not: >>>> - =A0 =A0 =A0 top->cg_mask =3D (1 << mp_ncpus) - 1; >>>> + =A0 =A0 =A0 if (mp_ncpus =3D=3D sizeof(top->cg_mask) * 8) >>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 top->cg_mask =3D -1; >>>> + =A0 =A0 =A0 else >>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 top->cg_mask =3D (1 << mp_ncpus) - 1= ; but rather if (mp_ncpus > sizeof(top->cg_mask) * NBBY) mp_ncpus =3D sizeof(top->cg_mask) * NBBY; /* Or panic */ if (mp_ncpus > sizeof(top->cg_mask) * NBBY) top->cg_mask =3D ~0; /* which avoids the signed error */ else top->cg_mask =3D (1 << mp_ncpus) - 1; I'm not sure why the expression would fail (1 << 32 =3D=3D 0 -1 =3D=3D = all bits set), but I've not looked at the old thread to see why the compiler is generating bogus code. Warner From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 17:40:59 2010 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 84955106567E; Mon, 9 Aug 2010 17: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 737B38FC13; Mon, 9 Aug 2010 17:40:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79Hexkc059614; Mon, 9 Aug 2010 17:40:59 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79HexiL059612; Mon, 9 Aug 2010 17:40:59 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008091740.o79HexiL059612@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 9 Aug 2010 17:40: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: r211109 - head/tools/regression/fstest/tests 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, 09 Aug 2010 17:40:59 -0000 Author: pjd Date: Mon Aug 9 17:40:59 2010 New Revision: 211109 URL: http://svn.freebsd.org/changeset/base/211109 Log: Fix file system type detection on Solaris. Modified: head/tools/regression/fstest/tests/conf Modified: head/tools/regression/fstest/tests/conf ============================================================================== --- head/tools/regression/fstest/tests/conf Mon Aug 9 17:37:29 2010 (r211108) +++ head/tools/regression/fstest/tests/conf Mon Aug 9 17:40:59 2010 (r211109) @@ -13,7 +13,7 @@ FreeBSD|Darwin) ;; Solaris|SunOS) GREP=ggrep - pattern=`df -k . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'` + pattern=`df -Pk . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'` fs=`mount -v | ${GREP} -E "^${pattern}" | awk '{print $5}' | \ tr -s '[:lower:]' '[:upper:]'` ;; From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 17:42:05 2010 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 DFB75106566B; Mon, 9 Aug 2010 17:42:04 +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 CEC8B8FC1B; Mon, 9 Aug 2010 17:42:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79Hg4o6059899; Mon, 9 Aug 2010 17:42:04 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79Hg4gT059894; Mon, 9 Aug 2010 17:42:04 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008091742.o79Hg4gT059894@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 9 Aug 2010 17:42: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: r211110 - head/tools/regression/fstest 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, 09 Aug 2010 17:42:05 -0000 Author: pjd Date: Mon Aug 9 17:42:04 2010 New Revision: 211110 URL: http://svn.freebsd.org/changeset/base/211110 Log: Fix bind(2) and connect(2) support on Solaris. Modified: head/tools/regression/fstest/fstest.c Modified: head/tools/regression/fstest/fstest.c ============================================================================== --- head/tools/regression/fstest/fstest.c Mon Aug 9 17:40:59 2010 (r211109) +++ head/tools/regression/fstest/fstest.c Mon Aug 9 17:42:04 2010 (r211110) @@ -538,28 +538,26 @@ call_syscall(struct syscall_desc *scall, } case ACTION_BIND: { - struct sockaddr_un sun; + struct sockaddr_un sunx; - sun.sun_family = AF_UNIX; - strlcpy(sun.sun_path, STR(0), sizeof(sun.sun_path)); - sun.sun_len = SUN_LEN(&sun); + sunx.sun_family = AF_UNIX; + strlcpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path)); rval = socket(AF_UNIX, SOCK_STREAM, 0); if (rval < 0) break; - rval = bind(rval, (struct sockaddr *)&sun, sizeof(sun)); + rval = bind(rval, (struct sockaddr *)&sunx, sizeof(sunx)); break; } case ACTION_CONNECT: { - struct sockaddr_un sun; + struct sockaddr_un sunx; - sun.sun_family = AF_UNIX; - strlcpy(sun.sun_path, STR(0), sizeof(sun.sun_path)); - sun.sun_len = SUN_LEN(&sun); + sunx.sun_family = AF_UNIX; + strlcpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path)); rval = socket(AF_UNIX, SOCK_STREAM, 0); if (rval < 0) break; - rval = connect(rval, (struct sockaddr *)&sun, sizeof(sun)); + rval = connect(rval, (struct sockaddr *)&sunx, sizeof(sunx)); break; } case ACTION_CHMOD: From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 17:42:05 2010 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 A66F91065674; Mon, 9 Aug 2010 17:42:05 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 938D68FC17; Mon, 9 Aug 2010 17:42:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79Hg5Ug059929; Mon, 9 Aug 2010 17:42:05 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79Hg5bW059927; Mon, 9 Aug 2010 17:42:05 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201008091742.o79Hg5bW059927@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 9 Aug 2010 17:42:05 +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: r211111 - 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: Mon, 09 Aug 2010 17:42:05 -0000 Author: gavin Date: Mon Aug 9 17:42:05 2010 New Revision: 211111 URL: http://svn.freebsd.org/changeset/base/211111 Log: Attempt to autodetect the cype of chipset, rather than storing this within the device table. This code uses the same algorithm as used in the Linux, NetBSD and DragonflyBSD driver. While investigating this, it became apparent that the Linux driver always initialises the device, and not just in the PL2303HX case. Change uplcom(4) to do the same. This change allows us to synchronize our device ID list with Linux and NetBSD, without requiring knowledge of the chipset in use. Reviewed by: hselasky MFC after: 6 weeks Modified: head/sys/dev/usb/serial/uplcom.c Modified: head/sys/dev/usb/serial/uplcom.c ============================================================================== --- head/sys/dev/usb/serial/uplcom.c Mon Aug 9 17:42:04 2010 (r211110) +++ head/sys/dev/usb/serial/uplcom.c Mon Aug 9 17:42:05 2010 (r211111) @@ -144,7 +144,7 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, deb #define RSAQ_STATUS_DCD 0x01 #define TYPE_PL2303 0 -#define TYPE_PL2303X 1 +#define TYPE_PL2303HX 1 enum { UPLCOM_BULK_DT_WR, @@ -174,7 +174,9 @@ struct uplcom_softc { /* prototypes */ static usb_error_t uplcom_reset(struct uplcom_softc *, struct usb_device *); -static int uplcom_pl2303x_init(struct usb_device *); +static usb_error_t uplcom_pl2303_do(struct usb_device *, int8_t, uint8_t, + uint16_t, uint16_t, uint16_t); +static int uplcom_pl2303_init(struct usb_device *, uint8_t); static void uplcom_cfg_set_dtr(struct ucom_softc *, uint8_t); static void uplcom_cfg_set_rts(struct ucom_softc *, uint8_t); static void uplcom_cfg_set_break(struct ucom_softc *, uint8_t); @@ -243,59 +245,33 @@ static struct ucom_callback uplcom_callb .ucom_poll = &uplcom_poll, }; -#define UPLCOM_DEV(v,p,rl,rh,t) \ - { USB_VENDOR(USB_VENDOR_##v), USB_PRODUCT(USB_PRODUCT_##v##_##p), \ - USB_DEV_BCD_GTEQ(rl), USB_DEV_BCD_LTEQ(rh), USB_DRIVER_INFO(TYPE_##t) } +#define UPLCOM_DEV(v,p) \ + { USB_VENDOR(USB_VENDOR_##v), USB_PRODUCT(USB_PRODUCT_##v##_##p) } static const struct usb_device_id uplcom_devs[] = { - /* Belkin F5U257 */ - UPLCOM_DEV(BELKIN, F5U257, 0, 0xFFFF, PL2303X), - /* I/O DATA USB-RSAQ */ - UPLCOM_DEV(IODATA, USBRSAQ, 0, 0xFFFF, PL2303), - /* I/O DATA USB-RSAQ2 */ - UPLCOM_DEV(PROLIFIC, RSAQ2, 0, 0xFFFF, PL2303), - /* I/O DATA USB-RSAQ3 */ - UPLCOM_DEV(PROLIFIC, RSAQ3, 0, 0xFFFF, PL2303X), - /* I/O DATA USB-RSAQ5 */ - UPLCOM_DEV(IODATA, USBRSAQ5, 0, 0xFFFF, PL2303X), - /* PLANEX USB-RS232 URS-03 */ - UPLCOM_DEV(ATEN, UC232A, 0, 0xFFFF, PL2303), - /* TrendNet TU-S9 */ - UPLCOM_DEV(PROLIFIC, PL2303, 0x0400, 0xFFFF, PL2303X), - /* ST Lab USB-SERIAL-4 */ - UPLCOM_DEV(PROLIFIC, PL2303, 0x0300, 0x03FF, PL2303X), - /* IOGEAR/ATEN UC-232A (also ST Lab USB-SERIAL-1) */ - UPLCOM_DEV(PROLIFIC, PL2303, 0, 0x02FF, PL2303), - /* TDK USB-PHS Adapter UHA6400 */ - UPLCOM_DEV(TDK, UHA6400, 0, 0xFFFF, PL2303), - /* RATOC REX-USB60 */ - UPLCOM_DEV(RATOC, REXUSB60, 0, 0xFFFF, PL2303), - /* ELECOM UC-SGT */ - UPLCOM_DEV(ELECOM, UCSGT, 0, 0xFFFF, PL2303), - UPLCOM_DEV(ELECOM, UCSGT0, 0, 0xFFFF, PL2303), - /* Sagem USB-Serial Controller */ - UPLCOM_DEV(SAGEM, USBSERIAL, 0, 0xFFFF, PL2303X), - /* Sony Ericsson USB Cable */ - UPLCOM_DEV(SONYERICSSON, DCU10, 0, 0xFFFF, PL2303), - /* SOURCENEXT KeikaiDenwa 8 */ - UPLCOM_DEV(SOURCENEXT, KEIKAI8, 0, 0xFFFF, PL2303), - /* SOURCENEXT KeikaiDenwa 8 with charger */ - UPLCOM_DEV(SOURCENEXT, KEIKAI8_CHG, 0, 0, PL2303), - /* HAL Corporation Crossam2+USB */ - UPLCOM_DEV(HAL, IMR001, 0, 0xFFFF, PL2303), - /* Sitecom USB to Serial */ - UPLCOM_DEV(SITECOM, SERIAL, 0, 0xFFFF, PL2303), - /* Tripp-Lite U209-000-R */ - UPLCOM_DEV(TRIPPLITE, U209, 0, 0xFFFF, PL2303X), - UPLCOM_DEV(RADIOSHACK, USBCABLE, 0, 0xFFFF, PL2303), - /* Prolific Pharos */ - UPLCOM_DEV(PROLIFIC, PHAROS, 0, 0xFFFF, PL2303), - /* Willcom W-SIM */ - UPLCOM_DEV(PROLIFIC2, WSIM, 0, 0xFFFF, PL2303X), - /* Mobile Action MA-620 Infrared Adapter */ - UPLCOM_DEV(MOBILEACTION, MA620, 0, 0xFFFF, PL2303X), - /* Corega CG-USBRS232R */ - UPLCOM_DEV(COREGA, CGUSBRS232R, 0, 0xFFFF, PL2303X), + UPLCOM_DEV(ATEN, UC232A), /* PLANEX USB-RS232 URS-03 */ + UPLCOM_DEV(BELKIN, F5U257), /* Belkin F5U257 */ + UPLCOM_DEV(COREGA, CGUSBRS232R), /* Corega CG-USBRS232R */ + UPLCOM_DEV(ELECOM, UCSGT), /* ELECOM UC-SGT */ + UPLCOM_DEV(ELECOM, UCSGT0), /* ELECOM UC-SGT */ + UPLCOM_DEV(HAL, IMR001), /* HAL Corporation Crossam2+USB */ + UPLCOM_DEV(IODATA, USBRSAQ), /* I/O DATA USB-RSAQ */ + UPLCOM_DEV(IODATA, USBRSAQ5), /* I/O DATA USB-RSAQ5 */ + UPLCOM_DEV(MOBILEACTION, MA620), /* Mobile Action MA-620 Infrared Adapter */ + UPLCOM_DEV(PROLIFIC, PHAROS), /* Prolific Pharos */ + UPLCOM_DEV(PROLIFIC, PL2303), /* Generic */ + UPLCOM_DEV(PROLIFIC, RSAQ2), /* I/O DATA USB-RSAQ2 */ + UPLCOM_DEV(PROLIFIC, RSAQ3), /* I/O DATA USB-RSAQ3 */ + UPLCOM_DEV(PROLIFIC2, WSIM), /* Willcom W-SIM */ + UPLCOM_DEV(RADIOSHACK, USBCABLE), + UPLCOM_DEV(RATOC, REXUSB60), /* RATOC REX-USB60 */ + UPLCOM_DEV(SAGEM, USBSERIAL), /* Sagem USB-Serial Controller */ + UPLCOM_DEV(SITECOM, SERIAL), /* Sitecom USB to Serial */ + UPLCOM_DEV(SONYERICSSON, DCU10), /* Sony Ericsson USB Cable */ + UPLCOM_DEV(SOURCENEXT, KEIKAI8), /* SOURCENEXT KeikaiDenwa 8 */ + UPLCOM_DEV(SOURCENEXT, KEIKAI8_CHG), /* SOURCENEXT KeikaiDenwa 8 with charger */ + UPLCOM_DEV(TDK, UHA6400), /* TDK USB-PHS Adapter UHA6400 */ + UPLCOM_DEV(TRIPPLITE, U209), /* Tripp-Lite U209-000-R */ }; #undef UPLCOM_DEV @@ -345,6 +321,7 @@ uplcom_attach(device_t dev) struct uplcom_softc *sc = device_get_softc(dev); struct usb_interface *iface; struct usb_interface_descriptor *id; + struct usb_device_descriptor *dd; int error; DPRINTFN(11, "\n"); @@ -354,11 +331,19 @@ uplcom_attach(device_t dev) DPRINTF("sc = %p\n", sc); - sc->sc_chiptype = USB_GET_DRIVER_INFO(uaa); sc->sc_udev = uaa->device; + /* Determine the chip type. This algorithm is taken from Linux. */ + dd = usbd_get_device_descriptor(sc->sc_udev); + if (dd->bDeviceClass == 0x02) + sc->sc_chiptype = TYPE_PL2303; + else if (dd->bMaxPacketSize == 0x40) + sc->sc_chiptype = TYPE_PL2303HX; + else + sc->sc_chiptype = TYPE_PL2303; + DPRINTF("chiptype: %s\n", - (sc->sc_chiptype == TYPE_PL2303X) ? + (sc->sc_chiptype == TYPE_PL2303HX) ? "2303X" : "2303"); /* @@ -422,11 +407,9 @@ uplcom_attach(device_t dev) * do the initialization during attach so that the system does not * sleep during open: */ - if (sc->sc_chiptype == TYPE_PL2303X) { - if (uplcom_pl2303x_init(uaa->device)) { - device_printf(dev, "init failed\n"); - goto detach; - } + if (uplcom_pl2303_init(uaa->device, sc->sc_chiptype)) { + device_printf(dev, "init failed\n"); + goto detach; } return (0); @@ -464,56 +447,58 @@ uplcom_reset(struct uplcom_softc *sc, st return (usbd_do_request(udev, NULL, &req, NULL)); } -struct pl2303x_init { - uint8_t req_type; - uint8_t request; - uint16_t value; - uint16_t index; - uint16_t length; -}; - -static const struct pl2303x_init pl2303x[] = { - {UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404, 0, 0}, - {UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1}, - {UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8383, 0, 1}, - {UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404, 1, 0}, - {UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1}, - {UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8383, 0, 1}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0, 1, 0}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 1, 0, 0}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x44, 0}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 8, 0, 0}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 9, 0, 0}, -}; - -#define N_PL2302X_INIT (sizeof(pl2303x)/sizeof(pl2303x[0])) - -static int -uplcom_pl2303x_init(struct usb_device *udev) +static usb_error_t +uplcom_pl2303_do(struct usb_device *udev, int8_t req_type, uint8_t request, + uint16_t value, uint16_t index, uint16_t length) { struct usb_device_request req; usb_error_t err; uint8_t buf[4]; - uint8_t i; - for (i = 0; i != N_PL2302X_INIT; i++) { - req.bmRequestType = pl2303x[i].req_type; - req.bRequest = pl2303x[i].request; - USETW(req.wValue, pl2303x[i].value); - USETW(req.wIndex, pl2303x[i].index); - USETW(req.wLength, pl2303x[i].length); - - err = usbd_do_request(udev, NULL, &req, buf); - if (err) { - DPRINTF("error=%s\n", usbd_errstr(err)); - return (EIO); - } + req.bmRequestType = req_type; + req.bRequest = request; + USETW(req.wValue, value); + USETW(req.wIndex, index); + USETW(req.wLength, length); + + err = usbd_do_request(udev, NULL, &req, buf); + if (err) { + DPRINTF("error=%s\n", usbd_errstr(err)); + return (1); } return (0); } +static int +uplcom_pl2303_init(struct usb_device *udev, uint8_t chiptype) +{ + int err; + + if (uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) + || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404, 0, 0) + || uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) + || uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8383, 0, 1) + || uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) + || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404, 1, 0) + || uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) + || uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8383, 0, 1) + || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0, 1, 0) + || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 1, 0, 0)) + return (EIO); + + if (chiptype == TYPE_PL2303HX) + err = uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x44, 0); + else + err = uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x24, 0); + if (err) + return (EIO); + + if (uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 8, 0, 0) + || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 9, 0, 0)) + return (EIO); + return (0); +} + static void uplcom_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff) { @@ -614,7 +599,7 @@ uplcom_pre_param(struct ucom_softc *ucom * XXX: We currently cannot identify the PL2303HX rev. D, so treat * it the same as the PL2303X. */ - if (sc->sc_chiptype == TYPE_PL2303) { + if (sc->sc_chiptype != TYPE_PL2303HX) { for (i = 0; i < N_UPLCOM_RATES; i++) { if (uplcom_rates[i] == t->c_ospeed) return (0); @@ -693,7 +678,7 @@ uplcom_cfg_param(struct ucom_softc *ucom req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UPLCOM_SET_REQUEST; USETW(req.wValue, 0); - if (sc->sc_chiptype == TYPE_PL2303X) + if (sc->sc_chiptype == TYPE_PL2303HX) USETW(req.wIndex, UPLCOM_SET_CRTSCTS_PL2303X); else USETW(req.wIndex, UPLCOM_SET_CRTSCTS); From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 17:54:26 2010 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 8A9F8106567B; Mon, 9 Aug 2010 17:54:26 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 798AB8FC14; Mon, 9 Aug 2010 17:54:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79HsQmc062723; Mon, 9 Aug 2010 17:54:26 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79HsQOP062721; Mon, 9 Aug 2010 17:54:26 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008091754.o79HsQOP062721@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 9 Aug 2010 17:54: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: r211112 - head/sys/compat/x86bios 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, 09 Aug 2010 17:54:26 -0000 Author: jkim Date: Mon Aug 9 17:54:26 2010 New Revision: 211112 URL: http://svn.freebsd.org/changeset/base/211112 Log: Reduce diffs between VM86 and X86EMU wrappers for x86bios_alloc() and x86bios_free(). Add strict sanity checks for VM86 wrapper and add strict page table locking for X86EMU wrapper. Modified: head/sys/compat/x86bios/x86bios.c Modified: head/sys/compat/x86bios/x86bios.c ============================================================================== --- head/sys/compat/x86bios/x86bios.c Mon Aug 9 17:42:05 2010 (r211111) +++ head/sys/compat/x86bios/x86bios.c Mon Aug 9 17:54:26 2010 (r211112) @@ -112,44 +112,49 @@ x86bios_vmf2emu(struct vm86frame *vmf, s void * x86bios_alloc(uint32_t *offset, size_t size, int flags) { - vm_offset_t addr; + void *vaddr; int i; - addr = (vm_offset_t)contigmalloc(size, M_DEVBUF, flags, 0, - X86BIOS_MEM_SIZE, PAGE_SIZE, 0); - if (addr != 0) { - *offset = vtophys(addr); + if (offset == NULL || size == 0) + return (NULL); + vaddr = contigmalloc(size, M_DEVBUF, flags, 0, X86BIOS_MEM_SIZE, + PAGE_SIZE, 0); + if (vaddr != NULL) { + *offset = vtophys(vaddr); mtx_lock(&x86bios_lock); for (i = 0; i < atop(round_page(size)); i++) vm86_addpage(&x86bios_vmc, atop(*offset) + i, - addr + ptoa(i)); + (vm_offset_t)vaddr + ptoa(i)); mtx_unlock(&x86bios_lock); } - return ((void *)addr); + return (vaddr); } void x86bios_free(void *addr, size_t size) { - int i, last; + vm_paddr_t paddr; + int i, nfree; + if (addr == NULL || size == 0) + return; + paddr = vtophys(addr); + if (paddr >= X86BIOS_MEM_SIZE || (paddr & PAGE_MASK) != 0) + return; + nfree = atop(round_page(size)); mtx_lock(&x86bios_lock); - for (i = 0, last = -1; i < x86bios_vmc.npages; i++) - if (x86bios_vmc.pmap[i].kva >= (vm_offset_t)addr && - x86bios_vmc.pmap[i].kva < (vm_offset_t)addr + size) { - bzero(&x86bios_vmc.pmap[i], - sizeof(x86bios_vmc.pmap[i])); - last = i; - } - if (last < 0) { + for (i = 0; i < x86bios_vmc.npages; i++) + if (x86bios_vmc.pmap[i].kva == (vm_offset_t)addr) + break; + if (i >= x86bios_vmc.npages) { mtx_unlock(&x86bios_lock); return; } - if (last == x86bios_vmc.npages - 1) { - x86bios_vmc.npages -= atop(round_page(size)); - for (i = x86bios_vmc.npages - 1; - i >= 0 && x86bios_vmc.pmap[i].kva == 0; i--) + bzero(x86bios_vmc.pmap + i, sizeof(*x86bios_vmc.pmap) * nfree); + if (i + nfree == x86bios_vmc.npages) { + x86bios_vmc.npages -= nfree; + while (--i >= 0 && x86bios_vmc.pmap[i].kva == 0) x86bios_vmc.npages--; } mtx_unlock(&x86bios_lock); @@ -552,12 +557,13 @@ x86bios_alloc(uint32_t *offset, size_t s if (offset == NULL || size == 0) return (NULL); - vaddr = contigmalloc(size, M_DEVBUF, flags, X86BIOS_RAM_BASE, x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0); if (vaddr != NULL) { *offset = vtophys(vaddr); + mtx_lock_spin(&x86bios_lock); x86bios_set_pages((vm_offset_t)vaddr, *offset, size); + mtx_unlock_spin(&x86bios_lock); } return (vaddr); @@ -570,14 +576,14 @@ x86bios_free(void *addr, size_t size) if (addr == NULL || size == 0) return; - paddr = vtophys(addr); if (paddr < X86BIOS_RAM_BASE || paddr >= x86bios_rom_phys || paddr % X86BIOS_PAGE_SIZE != 0) return; - + mtx_lock_spin(&x86bios_lock); bzero(x86bios_map + paddr / X86BIOS_PAGE_SIZE, sizeof(*x86bios_map) * howmany(size, X86BIOS_PAGE_SIZE)); + mtx_unlock_spin(&x86bios_lock); contigfree(addr, size, M_DEVBUF); } From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 18:07:16 2010 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 1AE0D1065678; Mon, 9 Aug 2010 18:07:16 +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 0A60E8FC1D; Mon, 9 Aug 2010 18:07:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79I7FDb065650; Mon, 9 Aug 2010 18:07:15 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79I7FZI065648; Mon, 9 Aug 2010 18:07:15 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201008091807.o79I7FZI065648@svn.freebsd.org> From: Ed Schouten Date: Mon, 9 Aug 2010 18:07: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: r211113 - head/sys/teken 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, 09 Aug 2010 18:07:16 -0000 Author: ed Date: Mon Aug 9 18:07:15 2010 New Revision: 211113 URL: http://svn.freebsd.org/changeset/base/211113 Log: Make ^L with cons25 and origin mode bit more sane. Even though cons25 normally doesn't support origin regions, this emulator does allow you to do it. It makes more sense to blank only the origin region when emitting ^L instead of blanking the entire screen. Apart from that, we should always place the cursor inside the origin region, which doesn't happen right now. Modified: head/sys/teken/teken_subr.h Modified: head/sys/teken/teken_subr.h ============================================================================== --- head/sys/teken/teken_subr.h Mon Aug 9 17:54:26 2010 (r211112) +++ head/sys/teken/teken_subr.h Mon Aug 9 18:07:15 2010 (r211113) @@ -725,11 +725,17 @@ teken_subr_newpage(teken_t *t) if (t->t_stateflags & TS_CONS25) { teken_rect_t tr; - tr.tr_begin.tp_row = tr.tr_begin.tp_col = 0; - tr.tr_end = t->t_winsize; + /* Clear screen. */ + tr.tr_begin.tp_row = t->t_originreg.ts_begin; + tr.tr_begin.tp_col = 0; + tr.tr_end.tp_row = t->t_originreg.ts_end; + tr.tr_end.tp_col = t->t_winsize.tp_col; teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); - t->t_cursor.tp_row = t->t_cursor.tp_col = 0; + /* Cursor at top left. */ + t->t_cursor.tp_row = t->t_originreg.ts_begin; + t->t_cursor.tp_col = 0; + t->t_stateflags &= ~TS_WRAPPED; teken_funcs_cursor(t); } else { teken_subr_newline(t); From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 18:10:32 2010 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 CC26F106567B; Mon, 9 Aug 2010 18:10:32 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB3DD8FC1B; Mon, 9 Aug 2010 18:10:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79IAWha066427; Mon, 9 Aug 2010 18:10:32 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79IAWEL066425; Mon, 9 Aug 2010 18:10:32 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008091810.o79IAWEL066425@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 9 Aug 2010 18:10: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: r211114 - head/sys/compat/x86bios 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, 09 Aug 2010 18:10:32 -0000 Author: jkim Date: Mon Aug 9 18:10:32 2010 New Revision: 211114 URL: http://svn.freebsd.org/changeset/base/211114 Log: Initialize a variable just before its use. Modified: head/sys/compat/x86bios/x86bios.c Modified: head/sys/compat/x86bios/x86bios.c ============================================================================== --- head/sys/compat/x86bios/x86bios.c Mon Aug 9 18:07:15 2010 (r211113) +++ head/sys/compat/x86bios/x86bios.c Mon Aug 9 18:10:32 2010 (r211114) @@ -142,7 +142,6 @@ x86bios_free(void *addr, size_t size) paddr = vtophys(addr); if (paddr >= X86BIOS_MEM_SIZE || (paddr & PAGE_MASK) != 0) return; - nfree = atop(round_page(size)); mtx_lock(&x86bios_lock); for (i = 0; i < x86bios_vmc.npages; i++) if (x86bios_vmc.pmap[i].kva == (vm_offset_t)addr) @@ -151,6 +150,7 @@ x86bios_free(void *addr, size_t size) mtx_unlock(&x86bios_lock); return; } + nfree = atop(round_page(size)); bzero(x86bios_vmc.pmap + i, sizeof(*x86bios_vmc.pmap) * nfree); if (i + nfree == x86bios_vmc.npages) { x86bios_vmc.npages -= nfree; From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 19:53:25 2010 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 398181065673; Mon, 9 Aug 2010 19:53:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 290638FC1B; Mon, 9 Aug 2010 19:53:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79JrP3J089933; Mon, 9 Aug 2010 19:53:25 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79JrPto089931; Mon, 9 Aug 2010 19:53:25 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201008091953.o79JrPto089931@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 9 Aug 2010 19:53:25 +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: r211115 - head/sys/netinet6 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, 09 Aug 2010 19:53:25 -0000 Author: bz Date: Mon Aug 9 19:53:24 2010 New Revision: 211115 URL: http://svn.freebsd.org/changeset/base/211115 Log: MFp4 CH180235: Add proto spacers to inet6sw like we have for legacy IP. This allows us to dynamically pf_proto_register() for INET6 from modules, needed by upcoming CARP changes and SeND. MC and SCTP could make use of it as well in theory in the future after upcoming VIMAGE vnet teardown work. Discussed with: will, anchie MFC after: 10 days Modified: head/sys/netinet6/in6_proto.c Modified: head/sys/netinet6/in6_proto.c ============================================================================== --- head/sys/netinet6/in6_proto.c Mon Aug 9 18:10:32 2010 (r211114) +++ head/sys/netinet6/in6_proto.c Mon Aug 9 19:53:24 2010 (r211115) @@ -145,6 +145,14 @@ static struct pr_usrreqs nousrreqs; #define PR_LISTEN 0 #define PR_ABRTACPTDIS 0 +/* Spacer for loadable protocols. */ +#define IP6PROTOSPACER \ +{ \ + .pr_domain = &inet6domain, \ + .pr_protocol = PROTO_SPACER, \ + .pr_usrreqs = &nousrreqs \ +} + struct ip6protosw inet6sw[] = { { .pr_type = 0, @@ -340,6 +348,15 @@ struct ip6protosw inet6sw[] = { .pr_usrreqs = &rip6_usrreqs }, #endif /* DEV_CARP */ +/* Spacer n-times for loadable protocols. */ +IP6PROTOSPACER, +IP6PROTOSPACER, +IP6PROTOSPACER, +IP6PROTOSPACER, +IP6PROTOSPACER, +IP6PROTOSPACER, +IP6PROTOSPACER, +IP6PROTOSPACER, /* raw wildcard */ { .pr_type = SOCK_RAW, From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 20:16:52 2010 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 EA4AD1065673; Mon, 9 Aug 2010 20:16:52 +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 D9AB48FC1E; Mon, 9 Aug 2010 20:16:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79KGqrn095212; Mon, 9 Aug 2010 20:16:52 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79KGqma095210; Mon, 9 Aug 2010 20:16:52 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008092016.o79KGqma095210@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 9 Aug 2010 20:16: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: r211116 - head/tools/regression/fstest 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, 09 Aug 2010 20:16:53 -0000 Author: pjd Date: Mon Aug 9 20:16:52 2010 New Revision: 211116 URL: http://svn.freebsd.org/changeset/base/211116 Log: Linux has no strlcpy(). Modified: head/tools/regression/fstest/fstest.c Modified: head/tools/regression/fstest/fstest.c ============================================================================== --- head/tools/regression/fstest/fstest.c Mon Aug 9 19:53:24 2010 (r211115) +++ head/tools/regression/fstest/fstest.c Mon Aug 9 20:16:52 2010 (r211116) @@ -541,7 +541,8 @@ call_syscall(struct syscall_desc *scall, struct sockaddr_un sunx; sunx.sun_family = AF_UNIX; - strlcpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path)); + strncpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path) - 1); + sunx.sun_path[sizeof(sunx.sun_path) - 1] = '\0'; rval = socket(AF_UNIX, SOCK_STREAM, 0); if (rval < 0) break; @@ -553,7 +554,8 @@ call_syscall(struct syscall_desc *scall, struct sockaddr_un sunx; sunx.sun_family = AF_UNIX; - strlcpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path)); + strncpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path) - 1); + sunx.sun_path[sizeof(sunx.sun_path) - 1] = '\0'; rval = socket(AF_UNIX, SOCK_STREAM, 0); if (rval < 0) break; From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 20:25:06 2010 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 6F68B1065672; Mon, 9 Aug 2010 20:25:06 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DEFA8FC19; Mon, 9 Aug 2010 20:25:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79KP6ef097117; Mon, 9 Aug 2010 20:25:06 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79KP6kQ097114; Mon, 9 Aug 2010 20:25:06 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008092025.o79KP6kQ097114@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 Aug 2010 20:25: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: r211117 - 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: Mon, 09 Aug 2010 20:25:06 -0000 Author: attilio Date: Mon Aug 9 20:25:06 2010 New Revision: 211117 URL: http://svn.freebsd.org/changeset/base/211117 Log: Simplify the logic for handling ipi_selected() and ipi_cpu() in the amd64/i386 case. Reviewed by: jhb Tested by: gianni MFC after: 1 month X-MFC: 210939 Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/i386/i386/mp_machdep.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Mon Aug 9 20:16:52 2010 (r211116) +++ head/sys/amd64/amd64/mp_machdep.c Mon Aug 9 20:25:06 2010 (r211117) @@ -1087,6 +1087,30 @@ smp_targeted_tlb_shootdown(cpumask_t mas mtx_unlock_spin(&smp_ipi_mtx); } +/* + * Send an IPI to specified CPU handling the bitmap logic. + */ +static void +ipi_send_cpu(int cpu, u_int ipi) +{ + u_int bitmap, old_pending, new_pending; + + KASSERT(cpu_apic_ids[cpu] != -1, ("IPI to non-existent CPU %d", cpu)); + + if (IPI_IS_BITMAPED(ipi)) { + bitmap = 1 << ipi; + ipi = IPI_BITMAP_VECTOR; + do { + old_pending = cpu_ipi_pending[cpu]; + new_pending = old_pending | bitmap; + } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], + old_pending, new_pending)); + if (old_pending) + return; + } + lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]); +} + void smp_cache_flush(void) { @@ -1210,14 +1234,6 @@ void ipi_selected(cpumask_t cpus, u_int ipi) { int cpu; - u_int bitmap = 0; - u_int old_pending; - u_int new_pending; - - if (IPI_IS_BITMAPED(ipi)) { - bitmap = 1 << ipi; - ipi = IPI_BITMAP_VECTOR; - } /* * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit @@ -1231,20 +1247,7 @@ ipi_selected(cpumask_t cpus, u_int ipi) while ((cpu = ffs(cpus)) != 0) { cpu--; cpus &= ~(1 << cpu); - - KASSERT(cpu_apic_ids[cpu] != -1, - ("IPI to non-existent CPU %d", cpu)); - - if (bitmap) { - do { - old_pending = cpu_ipi_pending[cpu]; - new_pending = old_pending | bitmap; - } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], - old_pending, new_pending)); - if (old_pending) - continue; - } - lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]); + ipi_send_cpu(cpu, ipi); } } @@ -1254,14 +1257,6 @@ ipi_selected(cpumask_t cpus, u_int ipi) void ipi_cpu(int cpu, u_int ipi) { - u_int bitmap = 0; - u_int old_pending; - u_int new_pending; - - if (IPI_IS_BITMAPED(ipi)) { - bitmap = 1 << ipi; - ipi = IPI_BITMAP_VECTOR; - } /* * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit @@ -1272,18 +1267,7 @@ ipi_cpu(int cpu, u_int ipi) atomic_set_int(&ipi_nmi_pending, 1 << cpu); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); - KASSERT(cpu_apic_ids[cpu] != -1, ("IPI to non-existent CPU %d", cpu)); - - if (bitmap) { - do { - old_pending = cpu_ipi_pending[cpu]; - new_pending = old_pending | bitmap; - } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], - old_pending, new_pending)); - if (old_pending) - return; - } - lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]); + ipi_send_cpu(cpu, ipi); } /* Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Mon Aug 9 20:16:52 2010 (r211116) +++ head/sys/i386/i386/mp_machdep.c Mon Aug 9 20:25:06 2010 (r211117) @@ -1175,6 +1175,30 @@ smp_targeted_tlb_shootdown(cpumask_t mas mtx_unlock_spin(&smp_ipi_mtx); } +/* + * Send an IPI to specified CPU handling the bitmap logic. + */ +static void +ipi_send_cpu(int cpu, u_int ipi) +{ + u_int bitmap, old_pending, new_pending; + + KASSERT(cpu_apic_ids[cpu] != -1, ("IPI to non-existent CPU %d", cpu)); + + if (IPI_IS_BITMAPED(ipi)) { + bitmap = 1 << ipi; + ipi = IPI_BITMAP_VECTOR; + do { + old_pending = cpu_ipi_pending[cpu]; + new_pending = old_pending | bitmap; + } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], + old_pending, new_pending)); + if (old_pending) + return; + } + lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]); +} + void smp_cache_flush(void) { @@ -1298,14 +1322,6 @@ void ipi_selected(cpumask_t cpus, u_int ipi) { int cpu; - u_int bitmap = 0; - u_int old_pending; - u_int new_pending; - - if (IPI_IS_BITMAPED(ipi)) { - bitmap = 1 << ipi; - ipi = IPI_BITMAP_VECTOR; - } /* * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit @@ -1319,20 +1335,7 @@ ipi_selected(cpumask_t cpus, u_int ipi) while ((cpu = ffs(cpus)) != 0) { cpu--; cpus &= ~(1 << cpu); - - KASSERT(cpu_apic_ids[cpu] != -1, - ("IPI to non-existent CPU %d", cpu)); - - if (bitmap) { - do { - old_pending = cpu_ipi_pending[cpu]; - new_pending = old_pending | bitmap; - } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], - old_pending, new_pending)); - if (old_pending) - continue; - } - lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]); + ipi_send_cpu(cpu, ipi); } } @@ -1342,14 +1345,6 @@ ipi_selected(cpumask_t cpus, u_int ipi) void ipi_cpu(int cpu, u_int ipi) { - u_int bitmap = 0; - u_int old_pending; - u_int new_pending; - - if (IPI_IS_BITMAPED(ipi)) { - bitmap = 1 << ipi; - ipi = IPI_BITMAP_VECTOR; - } /* * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit @@ -1360,18 +1355,7 @@ ipi_cpu(int cpu, u_int ipi) atomic_set_int(&ipi_nmi_pending, 1 << cpu); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); - KASSERT(cpu_apic_ids[cpu] != -1, ("IPI to non-existent CPU %d", cpu)); - - if (bitmap) { - do { - old_pending = cpu_ipi_pending[cpu]; - new_pending = old_pending | bitmap; - } while (!atomic_cmpset_int(&cpu_ipi_pending[cpu], - old_pending, new_pending)); - if (old_pending) - return; - } - lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]); + ipi_send_cpu(cpu, ipi); } /* From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 20:29:53 2010 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 1F5F41065675; Mon, 9 Aug 2010 20:29:53 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id D21A88FC14; Mon, 9 Aug 2010 20:29:52 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id D561E1FFC33; Mon, 9 Aug 2010 20:29:50 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id A396A844B0; Mon, 9 Aug 2010 22:29:50 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "M. Warner Losh" References: <20100808.153608.1142818667055052395.imp@bsdimp.com> <20100808220631.GA86477@stack.nl> <86tyn4tbuc.fsf@ds4.des.no> <20100809.095007.4959786895405928.imp@bsdimp.com> Date: Mon, 09 Aug 2010 22:29:50 +0200 In-Reply-To: <20100809.095007.4959786895405928.imp@bsdimp.com> (M. Warner Losh's message of "Mon, 09 Aug 2010 09:50:07 -0600 (MDT)") Message-ID: <864of3y1fl.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, olli@fromme.com, jilles@stack.nl Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 09 Aug 2010 20:29:53 -0000 "M. Warner Losh" writes: > I like the idea of a macro. Why is a cast through uintptr_t better? Without the uintptr_t cast, you'll get an error, or at least a warning, if the pointer is qualified (const and / or volatile). DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 22:06:09 2010 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 095D8106564A; Mon, 9 Aug 2010 22:06:09 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC41E8FC0C; Mon, 9 Aug 2010 22:06:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79M68Ij020139; Mon, 9 Aug 2010 22:06:08 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79M68OU020137; Mon, 9 Aug 2010 22:06:08 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008092206.o79M68OU020137@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 9 Aug 2010 22:06: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: r211120 - head/sys/compat/x86bios 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, 09 Aug 2010 22:06:09 -0000 Author: jkim Date: Mon Aug 9 22:06:08 2010 New Revision: 211120 URL: http://svn.freebsd.org/changeset/base/211120 Log: Tidy up printf() calls for debugging. Modified: head/sys/compat/x86bios/x86bios.c Modified: head/sys/compat/x86bios/x86bios.c ============================================================================== --- head/sys/compat/x86bios/x86bios.c Mon Aug 9 21:45:05 2010 (r211119) +++ head/sys/compat/x86bios/x86bios.c Mon Aug 9 22:06:08 2010 (r211120) @@ -58,6 +58,13 @@ __FBSDID("$FreeBSD$"); #define X86BIOS_MEM_SIZE 0x00100000 /* 1M */ +#define X86BIOS_TRACE(h, n, r) do { \ + printf(__STRING(h) \ + " (ax=0x%04x bx=0x%04x cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n",\ + (n), (r)->R_AX, (r)->R_BX, (r)->R_CX, (r)->R_DX, \ + (r)->R_ES, (r)->R_DI); \ +} while (0) + static struct mtx x86bios_lock; SYSCTL_NODE(_debug, OID_AUTO, x86bios, CTLFLAG_RD, NULL, "x86bios debugging"); @@ -174,10 +181,7 @@ x86bios_call(struct x86regs *regs, uint1 struct vm86frame vmf; if (x86bios_trace_call) - printf("Calling 0x%05x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - (seg << 4) + off, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Calling 0x%06x, (seg << 4) + off, regs); bzero(&vmf, sizeof(vmf)); x86bios_emu2vmf((struct x86emu_regs *)regs, &vmf); @@ -189,10 +193,7 @@ x86bios_call(struct x86regs *regs, uint1 x86bios_vmf2emu(&vmf, (struct x86emu_regs *)regs); if (x86bios_trace_call) - printf("Exiting 0x%05x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - (seg << 4) + off, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Exiting 0x%06x, (seg << 4) + off, regs); } uint32_t @@ -208,10 +209,7 @@ x86bios_intr(struct x86regs *regs, int i struct vm86frame vmf; if (x86bios_trace_int) - printf("Calling int 0x%x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - intno, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Calling INT 0x%02x, intno, regs); bzero(&vmf, sizeof(vmf)); x86bios_emu2vmf((struct x86emu_regs *)regs, &vmf); @@ -221,10 +219,7 @@ x86bios_intr(struct x86regs *regs, int i x86bios_vmf2emu(&vmf, (struct x86emu_regs *)regs); if (x86bios_trace_int) - printf("Exiting int 0x%x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - intno, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Exiting INT 0x%02x, intno, regs); } void * @@ -271,7 +266,7 @@ x86bios_uninit(void) #define X86BIOS_RAM_BASE 0x00001000 #define X86BIOS_ROM_BASE 0x000a0000 -#define X86BIOS_ROM_SIZE (X86BIOS_MEM_SIZE - (uint32_t)x86bios_rom_phys) +#define X86BIOS_ROM_SIZE (X86BIOS_MEM_SIZE - x86bios_rom_phys) #define X86BIOS_SEG_SIZE X86BIOS_PAGE_SIZE #define X86BIOS_PAGES (X86BIOS_MEM_SIZE / X86BIOS_PAGE_SIZE) @@ -604,10 +599,7 @@ x86bios_call(struct x86regs *regs, uint1 return; if (x86bios_trace_call) - printf("Calling 0x%05x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - (seg << 4) + off, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Calling 0x%06x, (seg << 4) + off, regs); mtx_lock_spin(&x86bios_lock); memcpy(&x86bios_emu.x86, regs, sizeof(*regs)); @@ -617,12 +609,9 @@ x86bios_call(struct x86regs *regs, uint1 mtx_unlock_spin(&x86bios_lock); if (x86bios_trace_call) { - printf("Exiting 0x%05x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - (seg << 4) + off, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Exiting 0x%06x, (seg << 4) + off, regs); if (x86bios_fault) - printf("Page fault at 0x%05x from 0x%04x:0x%04x.\n", + printf("Page fault at 0x%06x from 0x%04x:0x%04x.\n", x86bios_fault_addr, x86bios_fault_cs, x86bios_fault_ip); } @@ -649,10 +638,7 @@ x86bios_intr(struct x86regs *regs, int i return; if (x86bios_trace_int) - printf("Calling int 0x%x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - intno, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Calling INT 0x%02x, intno, regs); mtx_lock_spin(&x86bios_lock); memcpy(&x86bios_emu.x86, regs, sizeof(*regs)); @@ -662,12 +648,9 @@ x86bios_intr(struct x86regs *regs, int i mtx_unlock_spin(&x86bios_lock); if (x86bios_trace_int) { - printf("Exiting int 0x%x (ax=0x%04x bx=0x%04x " - "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n", - intno, regs->R_AX, regs->R_BX, regs->R_CX, - regs->R_DX, regs->R_ES, regs->R_DI); + X86BIOS_TRACE(Exiting INT 0x%02x, intno, regs); if (x86bios_fault) - printf("Page fault at 0x%05x from 0x%04x:0x%04x.\n", + printf("Page fault at 0x%06x from 0x%04x:0x%04x.\n", x86bios_fault_addr, x86bios_fault_cs, x86bios_fault_ip); } @@ -732,21 +715,22 @@ x86bios_map_mem(void) x86bios_seg_phys = vtophys(x86bios_seg); if (bootverbose) { - printf("x86bios: IVT 0x%06x-0x%06x at %p\n", - X86BIOS_IVT_BASE, X86BIOS_IVT_SIZE + X86BIOS_IVT_BASE - 1, + printf("x86bios: IVT 0x%06jx-0x%06jx at %p\n", + (vm_paddr_t)X86BIOS_IVT_BASE, + (vm_paddr_t)X86BIOS_IVT_SIZE + X86BIOS_IVT_BASE - 1, x86bios_ivt); - printf("x86bios: SSEG 0x%06x-0x%06x at %p\n", - (uint32_t)x86bios_seg_phys, - X86BIOS_SEG_SIZE + (uint32_t)x86bios_seg_phys - 1, + printf("x86bios: SSEG 0x%06jx-0x%06jx at %p\n", + x86bios_seg_phys, + (vm_paddr_t)X86BIOS_SEG_SIZE + x86bios_seg_phys - 1, x86bios_seg); if (x86bios_rom_phys < X86BIOS_ROM_BASE) - printf("x86bios: EBDA 0x%06x-0x%06x at %p\n", - (uint32_t)x86bios_rom_phys, X86BIOS_ROM_BASE - 1, + printf("x86bios: EBDA 0x%06jx-0x%06jx at %p\n", + x86bios_rom_phys, (vm_paddr_t)X86BIOS_ROM_BASE - 1, x86bios_rom); - printf("x86bios: ROM 0x%06x-0x%06x at %p\n", - X86BIOS_ROM_BASE, X86BIOS_MEM_SIZE - X86BIOS_SEG_SIZE - 1, - (void *)((vm_offset_t)x86bios_rom + X86BIOS_ROM_BASE - - (vm_offset_t)x86bios_rom_phys)); + printf("x86bios: ROM 0x%06jx-0x%06jx at %p\n", + (vm_paddr_t)X86BIOS_ROM_BASE, + (vm_paddr_t)X86BIOS_MEM_SIZE - X86BIOS_SEG_SIZE - 1, + (caddr_t)x86bios_rom + X86BIOS_ROM_BASE - x86bios_rom_phys); } return (0); From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 22:22:47 2010 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 11D18106567D; Mon, 9 Aug 2010 22:22:47 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 016598FC19; Mon, 9 Aug 2010 22:22:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79MMkeV023930; Mon, 9 Aug 2010 22:22:46 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79MMkpp023928; Mon, 9 Aug 2010 22:22:46 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <201008092222.o79MMkpp023928@svn.freebsd.org> From: Ivan Voras Date: Mon, 9 Aug 2010 22:22: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: r211123 - 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: Mon, 09 Aug 2010 22:22:47 -0000 Author: ivoras Date: Mon Aug 9 22:22:46 2010 New Revision: 211123 URL: http://svn.freebsd.org/changeset/base/211123 Log: Elaborate on how hirunningspace was chosen. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Mon Aug 9 22:22:06 2010 (r211122) +++ head/sys/kern/vfs_bio.c Mon Aug 9 22:22:46 2010 (r211123) @@ -622,8 +622,11 @@ bufinit(void) /* * Note: The 16 MB upper limit for hirunningspace was chosen - * arbitrarily and may need further tuning. The lower 1 MB - * limit is the historical upper limit for hirunningspace. + * arbitrarily and may need further tuning. It corresponds to + * 128 outstanding write IO requests (if IO size is 128 KiB), + * which fits with many RAID controllers' tagged queing limits. + * The lower 1 MB limit is the historical upper limit for + * hirunningspace. */ hirunningspace = lmax(lmin(roundup(hibufspace / 64, MAXBSIZE), 16 * 1024 * 1024), 1024 * 1024); From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 22:56:11 2010 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 2334C106564A; Mon, 9 Aug 2010 22:56:11 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 127348FC17; Mon, 9 Aug 2010 22:56:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79MuAT3031490; Mon, 9 Aug 2010 22:56:10 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79MuAnm031488; Mon, 9 Aug 2010 22:56:10 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <201008092256.o79MuAnm031488@svn.freebsd.org> From: Ivan Voras Date: Mon, 9 Aug 2010 22:56: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: r211126 - 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: Mon, 09 Aug 2010 22:56:11 -0000 Author: ivoras Date: Mon Aug 9 22:56:10 2010 New Revision: 211126 URL: http://svn.freebsd.org/changeset/base/211126 Log: Bumping the read-ahead count once more, to value equivalent to 512 KiB on most system, based on benchmark results on a low-end fibre channel SAN under VMWare: vfs.read_max read performance 8 (historical default) 83 MB/s 16 (recent bump) 131 MB/s 32 (this version) 152 MB/s 64 157 MB/s (results are +/- 3 MB/s) As read-ahead is heuristic, based on past IO requests, it shouldn't be problematic. The new default is still smaller then in other OSes. Modified: head/sys/kern/vfs_cluster.c Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Mon Aug 9 22:30:14 2010 (r211125) +++ head/sys/kern/vfs_cluster.c Mon Aug 9 22:56:10 2010 (r211126) @@ -71,7 +71,7 @@ static int write_behind = 1; SYSCTL_INT(_vfs, OID_AUTO, write_behind, CTLFLAG_RW, &write_behind, 0, "Cluster write-behind; 0: disable, 1: enable, 2: backed off"); -static int read_max = 16; +static int read_max = 32; SYSCTL_INT(_vfs, OID_AUTO, read_max, CTLFLAG_RW, &read_max, 0, "Cluster read-ahead max block count"); From owner-svn-src-all@FreeBSD.ORG Mon Aug 9 23:32:38 2010 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 3839E1065679; Mon, 9 Aug 2010 23:32:38 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2752B8FC15; Mon, 9 Aug 2010 23:32:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79NWcU9039805; Mon, 9 Aug 2010 23:32:38 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79NWcSC039803; Mon, 9 Aug 2010 23:32:38 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <201008092332.o79NWcSC039803@svn.freebsd.org> From: Ivan Voras Date: Mon, 9 Aug 2010 23:32: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: r211129 - 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: Mon, 09 Aug 2010 23:32:38 -0000 Author: ivoras Date: Mon Aug 9 23:32:37 2010 New Revision: 211129 URL: http://svn.freebsd.org/changeset/base/211129 Log: Fix (hopefully) the spelling of "queuing." Submitted by: bf1783 at gmail com Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Mon Aug 9 23:29:37 2010 (r211128) +++ head/sys/kern/vfs_bio.c Mon Aug 9 23:32:37 2010 (r211129) @@ -624,7 +624,7 @@ bufinit(void) * Note: The 16 MB upper limit for hirunningspace was chosen * arbitrarily and may need further tuning. It corresponds to * 128 outstanding write IO requests (if IO size is 128 KiB), - * which fits with many RAID controllers' tagged queing limits. + * which fits with many RAID controllers' tagged queuing limits. * The lower 1 MB limit is the historical upper limit for * hirunningspace. */ From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 05:15:35 2010 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 C3F92106567C; Tue, 10 Aug 2010 05:15:35 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B35688FC1B; Tue, 10 Aug 2010 05:15:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7A5FZXJ017554; Tue, 10 Aug 2010 05:15:35 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7A5FZZF017552; Tue, 10 Aug 2010 05:15:35 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201008100515.o7A5FZZF017552@svn.freebsd.org> From: Neel Natu Date: Tue, 10 Aug 2010 05:15: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: r211130 - head/libexec/rtld-elf/mips 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, 10 Aug 2010 05:15:35 -0000 Author: neel Date: Tue Aug 10 05:15:35 2010 New Revision: 211130 URL: http://svn.freebsd.org/changeset/base/211130 Log: Fix compilation error for 64-bit little endian build: libexec/rtld-elf/mips/reloc.c:196: warning: right shift count >= width of type When the expression '(r_info) >> 32' was passed to bswap32() it was promptly changed to '(uint32_t)(r_info) >> 32' which is not what we intended. Modified: head/libexec/rtld-elf/mips/reloc.c Modified: head/libexec/rtld-elf/mips/reloc.c ============================================================================== --- head/libexec/rtld-elf/mips/reloc.c Mon Aug 9 23:32:37 2010 (r211129) +++ head/libexec/rtld-elf/mips/reloc.c Tue Aug 10 05:15:35 2010 (r211130) @@ -75,7 +75,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn * ELF64 MIPS encodes the relocs uniquely. The first 32-bits of info contain * the symbol index. The top 32-bits contain three relocation types encoded * in big-endian integer with first relocation in LSB. This means for little - * endian we have to byte swap that interger (r_type). + * endian we have to byte swap that integer (r_type). */ #define Elf_Sxword Elf64_Sxword #define ELF_R_NXTTYPE_64_P(r_type) ((((r_type) >> 8) & 0xff) == R_TYPE(64)) @@ -83,7 +83,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn #undef ELF_R_SYM #undef ELF_R_TYPE #define ELF_R_SYM(r_info) ((r_info) & 0xffffffff) -#define ELF_R_TYPE(r_info) bswap32((r_info) >> 32) +#define ELF_R_TYPE(r_info) bswap32(((r_info) >> 32)) #endif #else #define ELF_R_NXTTYPE_64_P(r_type) (0) From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 06:25:08 2010 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 A7EC71065672; Tue, 10 Aug 2010 06:25:08 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96D278FC13; Tue, 10 Aug 2010 06:25:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7A6P8sT033379; Tue, 10 Aug 2010 06:25:08 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7A6P8rX033377; Tue, 10 Aug 2010 06:25:08 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008100625.o7A6P8rX033377@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 10 Aug 2010 06:25: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: r211131 - head/sys/compat/x86bios 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, 10 Aug 2010 06:25:08 -0000 Author: jkim Date: Tue Aug 10 06:25:08 2010 New Revision: 211131 URL: http://svn.freebsd.org/changeset/base/211131 Log: Tidy up locking and memory allocation for the real mode emulator wrapper. Now we use a regular mutex instead of a spin mutex. When we enter and exit the emulator, spinlock_enter() and spinlock_exit() are additionally used. Move some page table related stuff from x86bios_init() and x86bios_uninit() to x86bios_map_mem() and x86bios_unmap_mem(). Modified: head/sys/compat/x86bios/x86bios.c Modified: head/sys/compat/x86bios/x86bios.c ============================================================================== --- head/sys/compat/x86bios/x86bios.c Tue Aug 10 05:15:35 2010 (r211130) +++ head/sys/compat/x86bios/x86bios.c Tue Aug 10 06:25:08 2010 (r211131) @@ -556,9 +556,9 @@ x86bios_alloc(uint32_t *offset, size_t s x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0); if (vaddr != NULL) { *offset = vtophys(vaddr); - mtx_lock_spin(&x86bios_lock); + mtx_lock(&x86bios_lock); x86bios_set_pages((vm_offset_t)vaddr, *offset, size); - mtx_unlock_spin(&x86bios_lock); + mtx_unlock(&x86bios_lock); } return (vaddr); @@ -575,10 +575,10 @@ x86bios_free(void *addr, size_t size) if (paddr < X86BIOS_RAM_BASE || paddr >= x86bios_rom_phys || paddr % X86BIOS_PAGE_SIZE != 0) return; - mtx_lock_spin(&x86bios_lock); + mtx_lock(&x86bios_lock); bzero(x86bios_map + paddr / X86BIOS_PAGE_SIZE, sizeof(*x86bios_map) * howmany(size, X86BIOS_PAGE_SIZE)); - mtx_unlock_spin(&x86bios_lock); + mtx_unlock(&x86bios_lock); contigfree(addr, size, M_DEVBUF); } @@ -595,18 +595,17 @@ void x86bios_call(struct x86regs *regs, uint16_t seg, uint16_t off) { - if (x86bios_map == NULL) - return; - if (x86bios_trace_call) X86BIOS_TRACE(Calling 0x%06x, (seg << 4) + off, regs); - mtx_lock_spin(&x86bios_lock); + mtx_lock(&x86bios_lock); + spinlock_enter(); memcpy(&x86bios_emu.x86, regs, sizeof(*regs)); x86bios_fault = 0; x86emu_exec_call(&x86bios_emu, seg, off); memcpy(regs, &x86bios_emu.x86, sizeof(*regs)); - mtx_unlock_spin(&x86bios_lock); + spinlock_exit(); + mtx_unlock(&x86bios_lock); if (x86bios_trace_call) { X86BIOS_TRACE(Exiting 0x%06x, (seg << 4) + off, regs); @@ -634,18 +633,17 @@ x86bios_intr(struct x86regs *regs, int i if (intno < 0 || intno > 255) return; - if (x86bios_map == NULL) - return; - if (x86bios_trace_int) X86BIOS_TRACE(Calling INT 0x%02x, intno, regs); - mtx_lock_spin(&x86bios_lock); + mtx_lock(&x86bios_lock); + spinlock_enter(); memcpy(&x86bios_emu.x86, regs, sizeof(*regs)); x86bios_fault = 0; x86emu_exec_intr(&x86bios_emu, intno); memcpy(regs, &x86bios_emu.x86, sizeof(*regs)); - mtx_unlock_spin(&x86bios_lock); + spinlock_exit(); + mtx_unlock(&x86bios_lock); if (x86bios_trace_int) { X86BIOS_TRACE(Exiting INT 0x%02x, intno, regs); @@ -667,6 +665,7 @@ static __inline void x86bios_unmap_mem(void) { + free(x86bios_map, M_DEVBUF); if (x86bios_ivt != NULL) #ifdef X86BIOS_NATIVE_ARCH pmap_unmapdev((vm_offset_t)x86bios_ivt, X86BIOS_IVT_SIZE); @@ -683,6 +682,9 @@ static __inline int x86bios_map_mem(void) { + x86bios_map = malloc(sizeof(*x86bios_map) * X86BIOS_PAGES, M_DEVBUF, + M_WAITOK | M_ZERO); + #ifdef X86BIOS_NATIVE_ARCH x86bios_ivt = pmap_mapbios(X86BIOS_IVT_BASE, X86BIOS_IVT_SIZE); @@ -714,6 +716,13 @@ x86bios_map_mem(void) X86BIOS_RAM_BASE, x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0); x86bios_seg_phys = vtophys(x86bios_seg); + x86bios_set_pages((vm_offset_t)x86bios_ivt, X86BIOS_IVT_BASE, + X86BIOS_IVT_SIZE); + x86bios_set_pages((vm_offset_t)x86bios_rom, x86bios_rom_phys, + X86BIOS_ROM_SIZE); + x86bios_set_pages((vm_offset_t)x86bios_seg, x86bios_seg_phys, + X86BIOS_SEG_SIZE); + if (bootverbose) { printf("x86bios: IVT 0x%06jx-0x%06jx at %p\n", (vm_paddr_t)X86BIOS_IVT_BASE, @@ -746,20 +755,11 @@ x86bios_init(void) { int i; + mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_DEF); + if (x86bios_map_mem() != 0) return (ENOMEM); - mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_SPIN); - - x86bios_map = malloc(sizeof(*x86bios_map) * X86BIOS_PAGES, M_DEVBUF, - M_WAITOK | M_ZERO); - x86bios_set_pages((vm_offset_t)x86bios_ivt, X86BIOS_IVT_BASE, - X86BIOS_IVT_SIZE); - x86bios_set_pages((vm_offset_t)x86bios_rom, x86bios_rom_phys, - X86BIOS_ROM_SIZE); - x86bios_set_pages((vm_offset_t)x86bios_seg, x86bios_seg_phys, - X86BIOS_SEG_SIZE); - bzero(&x86bios_emu, sizeof(x86bios_emu)); x86bios_emu.emu_rdb = x86bios_emu_rdb; @@ -785,18 +785,8 @@ x86bios_init(void) static int x86bios_uninit(void) { - vm_offset_t *map = x86bios_map; - - mtx_lock_spin(&x86bios_lock); - if (x86bios_map != NULL) { - free(x86bios_map, M_DEVBUF); - x86bios_map = NULL; - } - mtx_unlock_spin(&x86bios_lock); - - if (map != NULL) - x86bios_unmap_mem(); + x86bios_unmap_mem(); mtx_destroy(&x86bios_lock); return (0); From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 06:28:37 2010 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 726F7106564A; Tue, 10 Aug 2010 06:28:37 +0000 (UTC) (envelope-from stefan@fafoe.narf.at) Received: from fep18.mx.upcmail.net (fep18.mx.upcmail.net [62.179.121.38]) by mx1.freebsd.org (Postfix) with ESMTP id 50A818FC17; Tue, 10 Aug 2010 06:28:35 +0000 (UTC) Received: from edge03.upcmail.net ([192.168.13.238]) by viefep18-int.chello.at (InterMail vM.8.01.02.02 201-2260-120-106-20100312) with ESMTP id <20100810062834.WLIK4042.viefep18-int.chello.at@edge03.upcmail.net>; Tue, 10 Aug 2010 08:28:34 +0200 Received: from mole.fafoe.narf.at ([213.47.85.26]) by edge03.upcmail.net with edge id sWUX1e03L0a5KZh03WUYBP; Tue, 10 Aug 2010 08:28:34 +0200 X-SourceIP: 213.47.85.26 Received: by mole.fafoe.narf.at (Postfix, from userid 1001) id 5E0E66D438; Tue, 10 Aug 2010 08:28:31 +0200 (CEST) Date: Tue, 10 Aug 2010 08:28:31 +0200 From: Stefan Farfeleder To: Neel Natu Message-ID: <20100810062829.GA1737@mole.fafoe.narf.at> References: <201008100515.o7A5FZZF017552@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201008100515.o7A5FZZF017552@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-Cloudmark-Analysis: v=1.1 cv=kR1739jI04gsLPPBAx/k25XPeS1fzQof9TaPDYrpM2k= c=1 sm=0 a=HLCT0tXVX6QA:10 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=8VKu2-S4YUhlNfZXeBEA:9 a=BVc4UUCRujlZn956GWcA:7 a=8d7s1U-nxetXpKDanSHeDjrg9GEA:4 a=CjuIK1q_8ugA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211130 - head/libexec/rtld-elf/mips 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, 10 Aug 2010 06:28:37 -0000 On Tue, Aug 10, 2010 at 05:15:35AM +0000, Neel Natu wrote: > Author: neel > Date: Tue Aug 10 05:15:35 2010 > New Revision: 211130 > URL: http://svn.freebsd.org/changeset/base/211130 > > Log: > Fix compilation error for 64-bit little endian build: > libexec/rtld-elf/mips/reloc.c:196: warning: right shift count >= width of type > > When the expression '(r_info) >> 32' was passed to bswap32() it was promptly > changed to '(uint32_t)(r_info) >> 32' which is not what we intended. Wouldn't it be better to fix the bswap32 macro instead? > Modified: > head/libexec/rtld-elf/mips/reloc.c > > Modified: head/libexec/rtld-elf/mips/reloc.c > ============================================================================== > --- head/libexec/rtld-elf/mips/reloc.c Mon Aug 9 23:32:37 2010 (r211129) > +++ head/libexec/rtld-elf/mips/reloc.c Tue Aug 10 05:15:35 2010 (r211130) > @@ -75,7 +75,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn > * ELF64 MIPS encodes the relocs uniquely. The first 32-bits of info contain > * the symbol index. The top 32-bits contain three relocation types encoded > * in big-endian integer with first relocation in LSB. This means for little > - * endian we have to byte swap that interger (r_type). > + * endian we have to byte swap that integer (r_type). > */ > #define Elf_Sxword Elf64_Sxword > #define ELF_R_NXTTYPE_64_P(r_type) ((((r_type) >> 8) & 0xff) == R_TYPE(64)) > @@ -83,7 +83,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn > #undef ELF_R_SYM > #undef ELF_R_TYPE > #define ELF_R_SYM(r_info) ((r_info) & 0xffffffff) > -#define ELF_R_TYPE(r_info) bswap32((r_info) >> 32) > +#define ELF_R_TYPE(r_info) bswap32(((r_info) >> 32)) > #endif > #else > #define ELF_R_NXTTYPE_64_P(r_type) (0) > From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 06:58:13 2010 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 2425A1065675; Tue, 10 Aug 2010 06:58: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 ECB998FC12; Tue, 10 Aug 2010 06:58:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7A6wCHu040966; Tue, 10 Aug 2010 06:58:12 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7A6wCJV040964; Tue, 10 Aug 2010 06:58:12 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201008100658.o7A6wCJV040964@svn.freebsd.org> From: Kevin Lo Date: Tue, 10 Aug 2010 06:58: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: r211132 - head/usr.bin/indent 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, 10 Aug 2010 06:58:13 -0000 Author: kevlo Date: Tue Aug 10 06:58:12 2010 New Revision: 211132 URL: http://svn.freebsd.org/changeset/base/211132 Log: Use NULL instead of 0 when setting up pointer. Modified: head/usr.bin/indent/indent.c Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Tue Aug 10 06:25:08 2010 (r211131) +++ head/usr.bin/indent/indent.c Tue Aug 10 06:58:12 2010 (r211132) @@ -199,21 +199,21 @@ main(int argc, char **argv) * look thru args (if any) for changes to defaults */ if (argv[i][0] != '-') {/* no flag on parameter */ - if (input == 0) { /* we must have the input file */ + if (input == NULL) { /* we must have the input file */ in_name = argv[i]; /* remember name of input file */ input = fopen(in_name, "r"); - if (input == 0) /* check for open error */ + if (input == NULL) /* check for open error */ err(1, "%s", in_name); continue; } - else if (output == 0) { /* we have the output file */ + else if (output == NULL) { /* we have the output file */ out_name = argv[i]; /* remember name of output file */ if (strcmp(in_name, out_name) == 0) { /* attempt to overwrite * the file */ errx(1, "input and output files must be different"); } output = fopen(out_name, "w"); - if (output == 0) /* check for create error */ + if (output == NULL) /* check for create error */ err(1, "%s", out_name); continue; } @@ -222,9 +222,9 @@ main(int argc, char **argv) else set_option(argv[i]); } /* end of for */ - if (input == 0) + if (input == NULL) input = stdin; - if (output == 0) { + if (output == NULL) { if (troff || input == stdin) output = stdout; else { @@ -1223,11 +1223,11 @@ bakcopy(void) /* re-open backup file as the input file */ input = fopen(bakfile, "r"); - if (input == 0) + if (input == NULL) err(1, "%s", bakfile); /* now the original input file will be the output */ output = fopen(in_name, "w"); - if (output == 0) { + if (output == NULL) { unlink(bakfile); err(1, "%s", in_name); } From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 07:08:16 2010 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 A7F13106564A; Tue, 10 Aug 2010 07:08:16 +0000 (UTC) (envelope-from neelnatu@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id C19548FC08; Tue, 10 Aug 2010 07:08:15 +0000 (UTC) Received: by wyj26 with SMTP id 26so13561570wyj.13 for ; Tue, 10 Aug 2010 00:08:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Ma5J6S2FWrJV1ImJG4YMSCLceGRq3IMJGejMQE08Q0M=; b=LN+j23nZ00WkGGAEkyNZnPywWwVZu45vR90vGqDLnjivHEHbrIKBFQkLgaTCa6/nqZ HKtkD0bqWjD2WnQUSr8eC9922tXZzo7cH4p1PpxdHCrafOPxFrCgsC5mV+LPlrHMHuoJ WYzzz5FEnBrao+/rx31euK4iVrO0z9RYJ3xzo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=lJOmGiq8YEU9PW1e8P5D0Kai9XIYR5GrWHh8FRGN5O51V67IMM5b9fyK8FGEyJ/7B3 MgJ7N/fPNIaFob0sQsqonGVAMAxaQq8JSMil9AGjNnuOWk9AGl8qlj2nWI1WUKtdSHr8 c1cvmg8mrOrOpEkh3xSmPrxfe4Q2EznKvKXzQ= MIME-Version: 1.0 Received: by 10.216.167.205 with SMTP id i55mr3511060wel.17.1281422556429; Mon, 09 Aug 2010 23:42:36 -0700 (PDT) Received: by 10.216.80.8 with HTTP; Mon, 9 Aug 2010 23:42:36 -0700 (PDT) In-Reply-To: <20100810062829.GA1737@mole.fafoe.narf.at> References: <201008100515.o7A5FZZF017552@svn.freebsd.org> <20100810062829.GA1737@mole.fafoe.narf.at> Date: Mon, 9 Aug 2010 23:42:36 -0700 Message-ID: From: Neel Natu To: Stefan Farfeleder Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211130 - head/libexec/rtld-elf/mips 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, 10 Aug 2010 07:08:16 -0000 Hi Stefan, On Mon, Aug 9, 2010 at 11:28 PM, Stefan Farfeleder wr= ote: > On Tue, Aug 10, 2010 at 05:15:35AM +0000, Neel Natu wrote: >> Author: neel >> Date: Tue Aug 10 05:15:35 2010 >> New Revision: 211130 >> URL: http://svn.freebsd.org/changeset/base/211130 >> >> Log: >> =A0 Fix compilation error for 64-bit little endian build: >> =A0 libexec/rtld-elf/mips/reloc.c:196: warning: right shift count >=3D w= idth of type >> >> =A0 When the expression '(r_info) >> 32' was passed to bswap32() it was = promptly >> =A0 changed to '(uint32_t)(r_info) >> 32' which is not what we intended. > > Wouldn't it be better to fix the bswap32 macro instead? > I think you are right. Can you take a look at the following patch instead? If I hear no objections, I will commit it tomorrow. Index: libexec/rtld-elf/mips/reloc.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 --- libexec/rtld-elf/mips/reloc.c (revision 211131) +++ libexec/rtld-elf/mips/reloc.c (working copy) @@ -83,7 +83,7 @@ #undef ELF_R_SYM #undef ELF_R_TYPE #define ELF_R_SYM(r_info) ((r_info) & 0xffffffff) -#define ELF_R_TYPE(r_info) bswap32(((r_info) >> 32)) +#define ELF_R_TYPE(r_info) bswap32((r_info) >> 32) #endif #else #define ELF_R_NXTTYPE_64_P(r_type) (0) Index: sys/sys/endian.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/sys/endian.h (revision 211131) +++ sys/sys/endian.h (working copy) @@ -56,9 +56,9 @@ /* * General byte order swapping functions. */ -#define bswap16(x) __bswap16(x) -#define bswap32(x) __bswap32(x) -#define bswap64(x) __bswap64(x) +#define bswap16(x) __bswap16((x)) +#define bswap32(x) __bswap32((x)) +#define bswap64(x) __bswap64((x)) /* * Host to big endian, host to little endian, big endian to host, and litt= le best Neel >> Modified: >> =A0 head/libexec/rtld-elf/mips/reloc.c >> >> Modified: head/libexec/rtld-elf/mips/reloc.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/libexec/rtld-elf/mips/reloc.c =A0 =A0 =A0 =A0Mon Aug =A09 23:32= :37 2010 =A0 =A0 =A0 =A0(r211129) >> +++ head/libexec/rtld-elf/mips/reloc.c =A0 =A0 =A0 =A0Tue Aug 10 05:15:3= 5 2010 =A0 =A0 =A0 =A0(r211130) >> @@ -75,7 +75,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn >> =A0 * ELF64 MIPS encodes the relocs uniquely. =A0The first 32-bits of in= fo contain >> =A0 * the symbol index. =A0The top 32-bits contain three relocation type= s encoded >> =A0 * in big-endian integer with first relocation in LSB. =A0This means = for little >> - * endian we have to byte swap that interger (r_type). >> + * endian we have to byte swap that integer (r_type). >> =A0 */ >> =A0#define =A0 =A0 =A0Elf_Sxword =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0Elf64_Sxword >> =A0#define =A0 =A0 =A0ELF_R_NXTTYPE_64_P(r_type) =A0 =A0 =A0((((r_type) = >> 8) & 0xff) =3D=3D R_TYPE(64)) >> @@ -83,7 +83,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn >> =A0#undef ELF_R_SYM >> =A0#undef ELF_R_TYPE >> =A0#define ELF_R_SYM(r_info) =A0 =A0 =A0 =A0 =A0 =A0((r_info) & 0xffffff= ff) >> -#define ELF_R_TYPE(r_info) =A0 =A0 =A0 =A0 =A0 bswap32((r_info) >> 32) >> +#define ELF_R_TYPE(r_info) =A0 =A0 =A0 =A0 =A0 bswap32(((r_info) >> 32)= ) >> =A0#endif >> =A0#else >> =A0#define =A0 =A0 =A0ELF_R_NXTTYPE_64_P(r_type) =A0 =A0 =A0(0) >> > From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 07:25:40 2010 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 876C01065686; Tue, 10 Aug 2010 07:25:40 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 992008FC1E; Tue, 10 Aug 2010 07:25:39 +0000 (UTC) Received: by wyj26 with SMTP id 26so13574749wyj.13 for ; Tue, 10 Aug 2010 00:25:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=C9OsgvaGTa9tZd0iFspvFBFfKes4x5PhkacLa1AAitw=; b=M5qwQFYH2m7dCwHp5VgxcLgkgC3smsUFXH8C57sHP+oHTVEPhDjw4IsgZZL4hUygzC 8YlKaZj9jy8djW01vLtM9jvoGoCWX8jSTymBVH0UDPdiqW5aGDin9OeohxM77B8+D4Pr DUjk6kOpyzTXM0arXgrpyRRyBV7XRW0Z8Ix1Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=ak9tOVF14qKhrj7Pdj5mLiAtfGqZlKlE8RDCZWDRbiqwfb+g1Xky0gkkgWibB2RzU1 8QYvvAw14tyUo0sjbQ0Bx6NJWAUg7TshLF89QGq5h3d+FKVu8Y3UJMdNbvFqotoOUYpp LtqNvtVspY9dlb3VMcbNuqUUz6VYq6BmKTLnQ= MIME-Version: 1.0 Received: by 10.216.11.66 with SMTP id 44mr14759413wew.69.1281425138443; Tue, 10 Aug 2010 00:25:38 -0700 (PDT) Received: by 10.216.160.10 with HTTP; Tue, 10 Aug 2010 00:25:38 -0700 (PDT) In-Reply-To: References: <201008100515.o7A5FZZF017552@svn.freebsd.org> <20100810062829.GA1737@mole.fafoe.narf.at> Date: Tue, 10 Aug 2010 12:55:38 +0530 Message-ID: From: "Jayachandran C." To: Neel Natu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Stefan Farfeleder , src-committers@freebsd.org Subject: Re: svn commit: r211130 - head/libexec/rtld-elf/mips 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, 10 Aug 2010 07:25:40 -0000 On Tue, Aug 10, 2010 at 12:12 PM, Neel Natu wrote: > Hi Stefan, > > On Mon, Aug 9, 2010 at 11:28 PM, Stefan Farfeleder = wrote: >> On Tue, Aug 10, 2010 at 05:15:35AM +0000, Neel Natu wrote: >>> Author: neel >>> Date: Tue Aug 10 05:15:35 2010 >>> New Revision: 211130 >>> URL: http://svn.freebsd.org/changeset/base/211130 >>> >>> Log: >>> =A0 Fix compilation error for 64-bit little endian build: >>> =A0 libexec/rtld-elf/mips/reloc.c:196: warning: right shift count >=3D = width of type >>> >>> =A0 When the expression '(r_info) >> 32' was passed to bswap32() it was= promptly >>> =A0 changed to '(uint32_t)(r_info) >> 32' which is not what we intended= . >> >> Wouldn't it be better to fix the bswap32 macro instead? >> > > I think you are right. Can you take a look at the following patch instead= ? > > If I hear no objections, I will commit it tomorrow. > > Index: libexec/rtld-elf/mips/reloc.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 > --- libexec/rtld-elf/mips/reloc.c =A0 =A0 =A0 (revision 211131) > +++ libexec/rtld-elf/mips/reloc.c =A0 =A0 =A0 (working copy) > @@ -83,7 +83,7 @@ > =A0#undef ELF_R_SYM > =A0#undef ELF_R_TYPE > =A0#define ELF_R_SYM(r_info) =A0 =A0 =A0 =A0 =A0 =A0 =A0((r_info) & 0xfff= fffff) > -#define ELF_R_TYPE(r_info) =A0 =A0 =A0 =A0 =A0 =A0 bswap32(((r_info) >> = 32)) > +#define ELF_R_TYPE(r_info) =A0 =A0 =A0 =A0 =A0 =A0 bswap32((r_info) >> 3= 2) > =A0#endif > =A0#else > =A0#define =A0 =A0 =A0 =A0ELF_R_NXTTYPE_64_P(r_type) =A0 =A0 =A0(0) > Index: sys/sys/endian.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/sys/endian.h =A0 =A0(revision 211131) > +++ sys/sys/endian.h =A0 =A0(working copy) > @@ -56,9 +56,9 @@ > =A0/* > =A0* General byte order swapping functions. > =A0*/ > -#define =A0 =A0 =A0 =A0bswap16(x) =A0 =A0 =A0__bswap16(x) > -#define =A0 =A0 =A0 =A0bswap32(x) =A0 =A0 =A0__bswap32(x) > -#define =A0 =A0 =A0 =A0bswap64(x) =A0 =A0 =A0__bswap64(x) > +#define =A0 =A0 =A0 =A0bswap16(x) =A0 =A0 =A0__bswap16((x)) > +#define =A0 =A0 =A0 =A0bswap32(x) =A0 =A0 =A0__bswap32((x)) > +#define =A0 =A0 =A0 =A0bswap64(x) =A0 =A0 =A0__bswap64((x)) > I think there is a problem in sys/mips/include/_endian.h -- #define __bswap16(x) (__uint16_t)(__is_constant(x) ? \ __bswap16_const((__uint16_t)x) : __bswap16_var((__uint16_t)x)) #define __bswap32(x) (__uint32_t)(__is_constant(x) ? \ __bswap32_const((__uint32_t)x) : __bswap32_var((__uint32_t)x)) #define __bswap64(x) (__uint64_t)(__is_constant(x) ? \ __bswap64_const((__uint64_t)x) : __bswap64_var((__uint64_t)x)) -- I'm not sure why the cast is needed, but we should have a braces around x, unless I'm completely mistaken. JC. From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 07:42:15 2010 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 497F61065672; Tue, 10 Aug 2010 07:42:15 +0000 (UTC) (envelope-from stefan@fafoe.narf.at) Received: from fep14.mx.upcmail.net (fep14.mx.upcmail.net [62.179.121.34]) by mx1.freebsd.org (Postfix) with ESMTP id 3D8CD8FC15; Tue, 10 Aug 2010 07:42:13 +0000 (UTC) Received: from edge04.upcmail.net ([192.168.13.239]) by viefep14-int.chello.at (InterMail vM.8.01.02.02 201-2260-120-106-20100312) with ESMTP id <20100810074212.UNOQ8381.viefep14-int.chello.at@edge04.upcmail.net>; Tue, 10 Aug 2010 09:42:12 +0200 Received: from mole.fafoe.narf.at ([213.47.85.26]) by edge04.upcmail.net with edge id sXiA1e05H0a5KZh04XiCfb; Tue, 10 Aug 2010 09:42:12 +0200 X-SourceIP: 213.47.85.26 Received: by mole.fafoe.narf.at (Postfix, from userid 1001) id C9BA26D438; Tue, 10 Aug 2010 09:42:10 +0200 (CEST) Date: Tue, 10 Aug 2010 09:42:10 +0200 From: Stefan Farfeleder To: "Jayachandran C." Message-ID: <20100810074210.GC1737@mole.fafoe.narf.at> References: <201008100515.o7A5FZZF017552@svn.freebsd.org> <20100810062829.GA1737@mole.fafoe.narf.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Cloudmark-Analysis: v=1.1 cv=M71sKKeyFebLYdq5hFNIGMR02ATQkL1qNhm49ttUYSY= c=1 sm=0 a=HLCT0tXVX6QA:10 a=kj9zAlcOel0A:10 a=0ygLJXLVLYis7nSBnPkA:9 a=d9FEsC_lMa7Qp0DW8373jy9HAs8A:4 a=CjuIK1q_8ugA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Neel Natu Subject: Re: svn commit: r211130 - head/libexec/rtld-elf/mips 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, 10 Aug 2010 07:42:15 -0000 On Tue, Aug 10, 2010 at 12:55:38PM +0530, Jayachandran C. wrote: > > I think there is a problem in sys/mips/include/_endian.h > -- > #define __bswap16(x) (__uint16_t)(__is_constant(x) ? \ > __bswap16_const((__uint16_t)x) : __bswap16_var((__uint16_t)x)) > #define __bswap32(x) (__uint32_t)(__is_constant(x) ? \ > __bswap32_const((__uint32_t)x) : __bswap32_var((__uint32_t)x)) > #define __bswap64(x) (__uint64_t)(__is_constant(x) ? \ > __bswap64_const((__uint64_t)x) : __bswap64_var((__uint64_t)x)) > -- > > I'm not sure why the cast is needed, but we should have a braces > around x, unless I'm completely mistaken. I agree. And around the entire expression too. Stefan From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 07:47:44 2010 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 001641065679; Tue, 10 Aug 2010 07:47: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 D832F8FC18; Tue, 10 Aug 2010 07:47:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7A7lhJX052216; Tue, 10 Aug 2010 07:47:43 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7A7lhih052214; Tue, 10 Aug 2010 07:47:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008100747.o7A7lhih052214@svn.freebsd.org> From: Adrian Chadd Date: Tue, 10 Aug 2010 07:47: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: r211134 - 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: Tue, 10 Aug 2010 07:47:44 -0000 Author: adrian Date: Tue Aug 10 07:47:43 2010 New Revision: 211134 URL: http://svn.freebsd.org/changeset/base/211134 Log: Re-format the ar5416 inivals to be consistent with what Linux ath9k uses. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.ini Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.ini ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.ini Tue Aug 10 07:18:17 2010 (r211133) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.ini Tue Aug 10 07:47:43 2010 (r211134) @@ -648,43 +648,43 @@ static const uint32_t ar5416Bank7[][2] = }; static const uint32_t ar5416Addac[][2] = { - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000003 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x0000000c }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000030 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000060 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000058 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x0989c, 0x00000000 }, - {0x098c4, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000003 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x0000000c }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000030 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000060 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000058 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x0000989c, 0x00000000 }, + {0x000098c4, 0x00000000 }, }; /* hand-crafted from code that does explicit register writes */ From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 07:48:13 2010 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 D482C1065686; Tue, 10 Aug 2010 07:48:13 +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 B902D8FC14; Tue, 10 Aug 2010 07:48:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7A7mDRb052362; Tue, 10 Aug 2010 07:48:13 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7A7mDFI052360; Tue, 10 Aug 2010 07:48:13 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008100748.o7A7mDFI052360@svn.freebsd.org> From: Adrian Chadd Date: Tue, 10 Aug 2010 07:48: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: r211135 - 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: Tue, 10 Aug 2010 07:48:14 -0000 Author: adrian Date: Tue Aug 10 07:48:13 2010 New Revision: 211135 URL: http://svn.freebsd.org/changeset/base/211135 Log: Bring over ar5416 inivals from Linux-2.6.34. Reviewed by: rpaulo@ Obtained from: Linux Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.ini Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.ini ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.ini Tue Aug 10 07:47:43 2010 (r211134) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.ini Tue Aug 10 07:48:13 2010 (r211135) @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting - * Copyright (c) 2002-2008 Atheros Communications, Inc. + * Copyright (c) 2008-2009 Atheros Communications Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -24,29 +24,31 @@ static const uint32_t ar5416Modes[][6] = { 0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c, 0x000001e0 }, { 0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38, 0x00001180 }, { 0x000010f0, 0x0000a000, 0x00014000, 0x00016000, 0x0000b000, 0x00014008 }, - { 0x00008014, 0x03e803e8, 0x07d007d0, 0x10801080, 0x08400840, 0x06e006e0 }, + { 0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00, 0x06e006e0 }, { 0x0000801c, 0x128d93a7, 0x128d93cf, 0x12e013d7, 0x12e013ab, 0x098813cf }, + { 0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810, 0x08f04810 }, + { 0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a, 0x0000320a }, { 0x00009804, 0x00000300, 0x000003c4, 0x000003c4, 0x00000300, 0x00000303 }, { 0x00009820, 0x02020200, 0x02020200, 0x02020200, 0x02020200, 0x02020200 }, { 0x00009824, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e }, { 0x00009828, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001 }, { 0x00009834, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e }, { 0x00009838, 0x00000007, 0x00000007, 0x00000007, 0x00000007, 0x00000007 }, - { 0x00009844, 0x1372161e, 0x13721c1e, 0x13721c30, 0x137216a4, 0x13721c25 }, + { 0x00009844, 0x1372161e, 0x1372161e, 0x137216a0, 0x137216a0, 0x137216a0 }, { 0x00009848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68, 0x00197a68 }, { 0x0000a848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68, 0x00197a68 }, { 0x0000b848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68, 0x00197a68 }, - { 0x00009850, 0x6c28b4e0, 0x6c28b4e0, 0x6d68b0de, 0x6d68b0de, 0x6c28b0de }, + { 0x00009850, 0x6c48b4e0, 0x6d48b4e0, 0x6d48b0de, 0x6c48b0de, 0x6c48b0de }, { 0x00009858, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e }, - { 0x0000985c, 0x313a5d5e, 0x313a5d5e, 0x313a605e, 0x313a605e, 0x313a5d5e }, - { 0x00009860, 0x00049d10, 0x00049d10, 0x00049d20, 0x00049d20, 0x00049d10 }, - { 0x0000c864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 }, + { 0x0000985c, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e, 0x31395d5e }, + { 0x00009860, 0x00049d18, 0x00049d18, 0x00049d18, 0x00049d18, 0x00049d18 }, + { 0x00009864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 }, { 0x00009868, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190 }, { 0x0000986c, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 }, - { 0x00009914, 0x000007d0, 0x000007d0, 0x00000898, 0x00000898, 0x000007d0 }, - { 0x00009918, 0x000001b8, 0x00000370, 0x00000268, 0x00000134, 0x00000370 }, - { 0x00009924, 0xd0058a0b, 0xd0058a0b, 0xd0058a19, 0xd0058a13, 0xd0058a0b }, - { 0x00009944, 0xdfb81020, 0xdfb81020, 0xdfb81020, 0xdfb81020, 0xdfb81020 }, + { 0x00009914, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898, 0x000007d0 }, + { 0x00009918, 0x000001b8, 0x00000370, 0x00000268, 0x00000134, 0x00000134 }, + { 0x00009924, 0xd0058a0b, 0xd0058a0b, 0xd0058a0b, 0xd0058a0b, 0xd0058a0b }, + { 0x00009944, 0xffb81020, 0xffb81020, 0xffb81020, 0xffb81020, 0xffb81020 }, #ifdef TB243 { 0x00009960, 0x00000900, 0x00000900, 0x00009b40, 0x00009b40, 0x00012d80 }, { 0x0000a960, 0x00000900, 0x00000900, 0x00009b40, 0x00009b40, 0x00012d80 }, @@ -63,14 +65,16 @@ static const uint32_t ar5416Modes[][6] = #endif #endif { 0x0000c9bc, 0x001a0a00, 0x001a0a00, 0x001a0a00, 0x001a0a00, 0x001a0a00 }, + { 0x00009964, 0x00000000, 0x00000000, 0x00001120, 0x00001120, 0x00001120 }, + { 0x000099bc, 0x001a0a00, 0x001a0a00, 0x001a0a00, 0x001a0a00, 0x001a0a00 }, { 0x000099c0, 0x038919be, 0x038919be, 0x038919be, 0x038919be, 0x038919be }, { 0x000099c4, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77 }, - { 0x000099c8, 0x60f6532c, 0x60f6532c, 0x60f6532c, 0x60f6532c, 0x60f6532c }, + { 0x000099c8, 0x6af6532c, 0x6af6532c, 0x6af6532c, 0x6af6532c, 0x6af6532c }, { 0x000099cc, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0x08f186c8 }, { 0x000099d0, 0x00046384, 0x00046384, 0x00046384, 0x00046384, 0x00046384 }, { 0x000099d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x000099d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, - { 0x0000a204, 0x00000440, 0x00000440, 0x00000440, 0x00000440, 0x00000440 }, + { 0x0000a204, 0x00000880, 0x00000880, 0x00000880, 0x00000880, 0x00000880 }, { 0x0000a208, 0xd6be4788, 0xd6be4788, 0xd03e4788, 0xd03e4788, 0xd03e4788 }, { 0x0000a20c, 0x002ec1e0, 0x002ec1e0, 0x002ac120, 0x002ac120, 0x002ac120 }, { 0x0000b20c, 0x002ec1e0, 0x002ec1e0, 0x002ac120, 0x002ac120, 0x002ac120 }, @@ -219,7 +223,6 @@ static const uint32_t ar5416Common[][2] { 0x00008110, 0x00000168 }, { 0x00008118, 0x000100aa }, { 0x0000811c, 0x00003210 }, - { 0x00008120, 0x08f04800 }, { 0x00008124, 0x00000000 }, { 0x00008128, 0x00000000 }, { 0x0000812c, 0x00000000 }, @@ -227,7 +230,7 @@ static const uint32_t ar5416Common[][2] { 0x00008134, 0x00000000 }, { 0x00008138, 0x00000000 }, { 0x0000813c, 0x00000000 }, - { 0x00008144, 0x00000000 }, + { 0x00008144, 0xffffffff }, { 0x00008168, 0x00000000 }, { 0x0000816c, 0x00000000 }, { 0x00008170, 0x32143320 }, @@ -235,7 +238,6 @@ static const uint32_t ar5416Common[][2] { 0x00008178, 0x00000100 }, { 0x0000817c, 0x00000000 }, { 0x000081c4, 0x00000000 }, - { 0x000081d0, 0x00003210 }, { 0x000081ec, 0x00000000 }, { 0x000081f0, 0x00000000 }, { 0x000081f4, 0x00000000 }, @@ -266,6 +268,7 @@ static const uint32_t ar5416Common[][2] { 0x00008258, 0x00000000 }, { 0x0000825c, 0x400000ff }, { 0x00008260, 0x00080922 }, + { 0x00008264, 0xa8000010 }, { 0x00008270, 0x00000000 }, { 0x00008274, 0x40000000 }, { 0x00008278, 0x003e4180 }, @@ -286,7 +289,7 @@ static const uint32_t ar5416Common[][2] { 0x0000832c, 0x00000007 }, { 0x00008330, 0x00000302 }, { 0x00008334, 0x00000e00 }, - { 0x00008338, 0x00000000 }, + { 0x00008338, 0x00070000 }, { 0x0000833c, 0x00000000 }, { 0x00008340, 0x000107ff }, { 0x00009808, 0x00000000 }, @@ -297,7 +300,7 @@ static const uint32_t ar5416Common[][2] { 0x0000982c, 0x0000a000 }, { 0x00009830, 0x00000000 }, { 0x0000983c, 0x00200400 }, - { 0x00009840, 0x206a016e }, + { 0x00009840, 0x206a002e }, { 0x0000984c, 0x1284233c }, { 0x00009854, 0x00000859 }, { 0x00009900, 0x00000000 }, @@ -319,7 +322,7 @@ static const uint32_t ar5416Common[][2] { 0x00009958, 0x00081fff }, { 0x0000c95c, 0x004b6a8e }, { 0x0000c968, 0x000003ce }, - { 0x00009970, 0x190c0514 }, + { 0x00009970, 0x190fb515 }, { 0x00009974, 0x00000000 }, { 0x00009978, 0x00000001 }, { 0x0000997c, 0x00000000 }, @@ -334,7 +337,7 @@ static const uint32_t ar5416Common[][2] { 0x000099a0, 0x00000000 }, { 0x000099a4, 0x00000001 }, { 0x000099a8, 0x001fff00 }, - { 0x000099ac, 0x000000c4 }, + { 0x000099ac, 0x00000000 }, { 0x000099b0, 0x03051000 }, { 0x000099dc, 0x00000000 }, { 0x000099e0, 0x00000200 }, @@ -426,9 +429,9 @@ static const uint32_t ar5416Common[][2] { 0x0000a25c, 0x0f0f0f01 }, { 0x0000a260, 0xdfa91f01 }, { 0x0000a268, 0x00000000 }, - { 0x0000a26c, 0x0ebae9c6 }, - { 0x0000b26c, 0x0ebae9c6 }, - { 0x0000c26c, 0x0ebae9c6 }, + { 0x0000a26c, 0x0e79e5c6 }, + { 0x0000b26c, 0x0e79e5c6 }, + { 0x0000c26c, 0x0e79e5c6 }, { 0x0000d270, 0x00820820 }, { 0x0000a278, 0x1ce739ce }, { 0x0000a27c, 0x051701ce }, @@ -441,15 +444,15 @@ static const uint32_t ar5416Common[][2] { 0x0000a350, 0x3fffffff }, { 0x0000a354, 0x0003ffff }, { 0x0000a358, 0x79a8aa1f }, - { 0x0000d35c, 0x066c420f }, - { 0x0000d360, 0x0f282207 }, - { 0x0000d364, 0x17601685 }, - { 0x0000d368, 0x1f801104 }, - { 0x0000d36c, 0x37a00c03 }, - { 0x0000d370, 0x3fc40883 }, - { 0x0000d374, 0x57c00803 }, - { 0x0000d378, 0x5fd80682 }, - { 0x0000d37c, 0x7fe00482 }, + { 0x0000d35c, 0x07ffffef }, + { 0x0000d360, 0x0fffffe7 }, + { 0x0000d364, 0x17ffffe5 }, + { 0x0000d368, 0x1fffffe4 }, + { 0x0000d36c, 0x37ffffe3 }, + { 0x0000d370, 0x3fffffe3 }, + { 0x0000d374, 0x57ffffe3 }, + { 0x0000d378, 0x5fffffe2 }, + { 0x0000d37c, 0x7fffffe2 }, { 0x0000d380, 0x7f3c7bba }, { 0x0000d384, 0xf3307ff0 }, { 0x0000a388, 0x08000000 }, @@ -625,8 +628,8 @@ static const uint32_t ar5416Bank6[][3] = { 0x0000989c, 0x00dc0000, 0x00dc0000 }, { 0x0000989c, 0x00110000, 0x00110000 }, { 0x0000989c, 0x006100a8, 0x006100a8 }, - { 0x0000989c, 0x00421022, 0x00421022 }, - { 0x0000989c, 0x001400df, 0x001400df }, + { 0x0000989c, 0x00423022, 0x00423022 }, + { 0x0000989c, 0x201400df, 0x201400df }, { 0x0000989c, 0x00c40002, 0x00c40002 }, { 0x0000989c, 0x003000f2, 0x003000f2 }, { 0x0000989c, 0x00440016, 0x00440016 }, @@ -634,7 +637,7 @@ static const uint32_t ar5416Bank6[][3] = { 0x0000989c, 0x0001805e, 0x0001805e }, { 0x0000989c, 0x0000c0ab, 0x0000c0ab }, { 0x0000989c, 0x000000e1, 0x000000e1 }, - { 0x0000989c, 0x00002081, 0x00002081 }, + { 0x0000989c, 0x00007081, 0x00007081 }, { 0x0000989c, 0x000000d4, 0x000000d4 }, { 0x000098d0, 0x0000000f, 0x0010000f }, }; @@ -684,7 +687,7 @@ static const uint32_t ar5416Addac[][2] = {0x0000989c, 0x00000000 }, {0x0000989c, 0x00000000 }, {0x0000989c, 0x00000000 }, - {0x000098c4, 0x00000000 }, + {0x000098cc, 0x00000000 }, }; /* hand-crafted from code that does explicit register writes */ From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 07:56:56 2010 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 E54B4106566C; Tue, 10 Aug 2010 07:56:56 +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 BA7718FC16; Tue, 10 Aug 2010 07:56:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7A7uu7X054348; Tue, 10 Aug 2010 07:56:56 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7A7uuqS054346; Tue, 10 Aug 2010 07:56:56 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008100756.o7A7uuqS054346@svn.freebsd.org> From: Adrian Chadd Date: Tue, 10 Aug 2010 07:56: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: r211136 - 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, 10 Aug 2010 07:56:57 -0000 Author: adrian Date: Tue Aug 10 07:56:56 2010 New Revision: 211136 URL: http://svn.freebsd.org/changeset/base/211136 Log: Don't delay updating the longcal timer - instead, update the longcal flag immediately so it's only set once per longcal interval. Without this, the current AR5416 code will continuously spam NF calibrations during a periodic calibration if the longcal flag is set. The longcal flag wouldn't be cleared until the calibration method indicates that calibrations are "complete". This drops the rate of NF calibration updates down from "once every shortcal" (ie, every 100ms) during a periodic calibration, to only once per "longcal" interval. Spamming NF calibrations every 100ms caused some potentially horrific issues in noisy environments as NF calibrations can take longer than 100ms and this spamming can cause invalid NF calibration results to be read back - leading to missed beacons, and thus leading to a stuck beacon situation. Stuck beacons cause interface resets, which restart calibrations. This means that the longcal calibration runs every 100ms (shortcal) until all initial calibrations are completed. This spamming can then cause the above issues which leads to stuck beacons, leading to interface resets, etc, etc. Quite annoying. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Tue Aug 10 07:48:13 2010 (r211135) +++ head/sys/dev/ath/if_ath.c Tue Aug 10 07:56:56 2010 (r211136) @@ -5418,6 +5418,7 @@ ath_calibrate(void *arg) longCal = (ticks - sc->sc_lastlongcal >= ath_longcalinterval*hz); if (longCal) { sc->sc_stats.ast_per_cal++; + sc->sc_lastlongcal = ticks; if (ath_hal_getrfgain(ah) == HAL_RFGAIN_NEED_CHANGE) { /* * Rfgain is out of bounds, reset the chip @@ -5466,7 +5467,6 @@ restart: nextcal *= 10; } else { nextcal = ath_longcalinterval*hz; - sc->sc_lastlongcal = ticks; if (sc->sc_lastcalreset == 0) sc->sc_lastcalreset = sc->sc_lastlongcal; else if (ticks - sc->sc_lastcalreset >= ath_resetcalinterval*hz) From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 09:24:20 2010 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 05457106566C; Tue, 10 Aug 2010 09:24: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 DD5698FC25; Tue, 10 Aug 2010 09:24:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7A9OJn3073948; Tue, 10 Aug 2010 09:24:19 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7A9OJjb073946; Tue, 10 Aug 2010 09:24:19 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008100924.o7A9OJjb073946@svn.freebsd.org> From: Adrian Chadd Date: Tue, 10 Aug 2010 09:24: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: r211137 - head/usr.sbin/crunch/crunchide 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, 10 Aug 2010 09:24:20 -0000 Author: adrian Date: Tue Aug 10 09:24:19 2010 New Revision: 211137 URL: http://svn.freebsd.org/changeset/base/211137 Log: Port over changes to the crunch symbol hiding method from NetBSD. The older symbol hiding method breaks for MIPS. This implements symbol hiding through renaming to a symbol name which is highly unlikely to clash. The NetBSD code didn't use byte-swapping macros for endian-awareness; so it didn't work when cross-compiling a MIPS world on i386/amd64. This patch includes those (as best as I could figure what they should be) and has been tested to generate valid MIPS crunch binaries both cross- and native- compiled. Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c ============================================================================== --- head/usr.sbin/crunch/crunchide/exec_elf32.c Tue Aug 10 07:56:56 2010 (r211136) +++ head/usr.sbin/crunch/crunchide/exec_elf32.c Tue Aug 10 09:24:19 2010 (r211137) @@ -130,6 +130,20 @@ xmalloc(size_t size, const char *fn, con return (rv); } +static void * +xrealloc(void *ptr, size_t size, const char *fn, const char *use) +{ + void *rv; + + rv = realloc(ptr, size); + if (rv == NULL) { + free(ptr); + fprintf(stderr, "%s: out of memory (reallocating for %s)\n", + fn, use); + } + return (rv); +} + int ELFNAMEEND(check)(int fd, const char *fn) { @@ -197,6 +211,21 @@ ELFNAMEEND(check)(int fd, const char *fn return 1; } +/* + * This function 'hides' (some of) ELF executable file's symbols. + * It hides them by renaming them to "_$$hide$$ ". + * Symbols in the global keep list, or which are marked as being undefined, + * are left alone. + * + * An old version of this code shuffled various tables around, turning + * global symbols to be hidden into local symbols. That lost on the + * mips, because CALL16 relocs must reference global symbols, and, if + * those symbols were being hidden, they were no longer global. + * + * The new renaming behaviour doesn't take global symbols out of the + * namespace. However, it's ... unlikely that there will ever be + * any collisions in practice because of the new method. + */ int ELFNAMEEND(hide)(int fd, const char *fn) { @@ -204,11 +233,14 @@ ELFNAMEEND(hide)(int fd, const char *fn) Elf_Shdr *shdrp = NULL, *symtabshdr, *strtabshdr; Elf_Sym *symtabp = NULL; char *strtabp = NULL; - Elf_Size *symfwmap = NULL, *symrvmap = NULL, nsyms, nlocalsyms, ewi; - struct listelem *relalist = NULL, *rellist = NULL, *tmpl; + Elf_Size nsyms, nlocalsyms, ewi; ssize_t shdrsize; int rv, i, weird; + size_t nstrtab_size, nstrtab_nextoff, fn_size; + char *nstrtabp = NULL; unsigned char data; + Elf_Off maxoff, stroff; + const char *weirdreason = NULL; rv = 0; if (xreadatoff(fd, &ehdr, 0, sizeof ehdr, fn) != sizeof ehdr) @@ -225,42 +257,38 @@ ELFNAMEEND(hide)(int fd, const char *fn) symtabshdr = strtabshdr = NULL; weird = 0; + maxoff = stroff = 0; for (i = 0; i < xe16toh(ehdr.e_shnum); i++) { + if (xewtoh(shdrp[i].sh_offset) > maxoff) + maxoff = xewtoh(shdrp[i].sh_offset); switch (xe32toh(shdrp[i].sh_type)) { case SHT_SYMTAB: if (symtabshdr != NULL) weird = 1; symtabshdr = &shdrp[i]; strtabshdr = &shdrp[xe32toh(shdrp[i].sh_link)]; - break; - case SHT_RELA: - tmpl = xmalloc(sizeof *tmpl, fn, "rela list element"); - if (tmpl == NULL) - goto bad; - tmpl->mem = NULL; - tmpl->file = xewtoh(shdrp[i].sh_offset); - tmpl->size = xewtoh(shdrp[i].sh_size); - tmpl->next = relalist; - relalist = tmpl; - break; - case SHT_REL: - tmpl = xmalloc(sizeof *tmpl, fn, "rel list element"); - if (tmpl == NULL) - goto bad; - tmpl->mem = NULL; - tmpl->file = xewtoh(shdrp[i].sh_offset); - tmpl->size = xewtoh(shdrp[i].sh_size); - tmpl->next = rellist; - rellist = tmpl; + + /* Check whether the string table is the last section */ + stroff = xewtoh(shdrp[xe32toh(shdrp[i].sh_link)].sh_offset); + if (!weird && xe32toh(shdrp[i].sh_link) != (xe16toh(ehdr.e_shnum) - 1)) { + weird = 1; + weirdreason = "string table not last section"; + } break; } } + if (! weirdreason) + weirdreason = "unsupported"; if (symtabshdr == NULL) goto out; if (strtabshdr == NULL) weird = 1; + if (!weird && stroff != maxoff) { + weird = 1; + weirdreason = "string table section not last in file"; + } if (weird) { - fprintf(stderr, "%s: weird executable (unsupported)\n", fn); + fprintf(stderr, "%s: weird executable (%s)\n", fn, weirdreason); goto bad; } @@ -284,105 +312,53 @@ ELFNAMEEND(hide)(int fd, const char *fn) xewtoh(strtabshdr->sh_size), fn) != xewtoh(strtabshdr->sh_size)) goto bad; - /* any rela tables */ - for (tmpl = relalist; tmpl != NULL; tmpl = tmpl->next) { - if ((tmpl->mem = xmalloc(tmpl->size, fn, "rela table")) - == NULL) - goto bad; - if (xreadatoff(fd, tmpl->mem, tmpl->file, - tmpl->size, fn) != tmpl->size) - goto bad; - } + nstrtab_size = 256; + nstrtabp = xmalloc(nstrtab_size, fn, "new string table"); + if (nstrtabp == NULL) + goto bad; + nstrtab_nextoff = 0; - /* any rel tables */ - for (tmpl = rellist; tmpl != NULL; tmpl = tmpl->next) { - if ((tmpl->mem = xmalloc(tmpl->size, fn, "rel table")) - == NULL) - goto bad; - if (xreadatoff(fd, tmpl->mem, tmpl->file, - tmpl->size, fn) != tmpl->size) - goto bad; - } + fn_size = strlen(fn); /* Prepare data structures for symbol movement. */ nsyms = xewtoh(symtabshdr->sh_size) / xewtoh(symtabshdr->sh_entsize); nlocalsyms = xe32toh(symtabshdr->sh_info); - if ((symfwmap = xmalloc(nsyms * sizeof (Elf_Size), fn, - "symbol forward mapping table")) == NULL) - goto bad; - if ((symrvmap = xmalloc(nsyms * sizeof (Elf_Size), fn, - "symbol reverse mapping table")) == NULL) - goto bad; - - /* init location -> symbol # table */ - for (ewi = 0; ewi < nsyms; ewi++) - symrvmap[ewi] = ewi; /* move symbols, making them local */ - for (ewi = nlocalsyms; ewi < nsyms; ewi++) { - Elf_Sym *sp, symswap; - Elf_Size mapswap; - - sp = &symtabp[ewi]; - - /* if it's on our keep list, don't move it */ - if (in_keep_list(strtabp + xe32toh(sp->st_name))) - continue; - - /* if it's an undefined symbol, keep it */ - if (xe16toh(sp->st_shndx) == SHN_UNDEF) - continue; - - /* adjust the symbol so that it's local */ - sp->st_info = - ELF_ST_INFO(STB_LOCAL, sp->st_info); -/* (STB_LOCAL << 4) | ELF_SYM_TYPE(sp->st_info); *//* XXX */ - + for (ewi = 0; ewi < nsyms; ewi++) { + Elf_Sym *sp = &symtabp[ewi]; + const char *symname = strtabp + xe32toh(sp->st_name); + size_t newent_len; /* - * move the symbol to its new location + * make sure there's size for the next entry, even if it's + * as large as it can be. + * + * "_$$hide$$ " -> + * 9 + 3 + sizes of fn and sym name */ - - /* note that symbols in those locations have been swapped */ - mapswap = symrvmap[ewi]; - symrvmap[ewi] = symrvmap[nlocalsyms]; - symrvmap[nlocalsyms] = mapswap; - - /* and swap the symbols */ - symswap = *sp; - *sp = symtabp[nlocalsyms]; - symtabp[nlocalsyms] = symswap; - - nlocalsyms++; /* note new local sym */ - } - symtabshdr->sh_info = htoxe32(nlocalsyms); - - /* set up symbol # -> location mapping table */ - for (ewi = 0; ewi < nsyms; ewi++) - symfwmap[symrvmap[ewi]] = ewi; - - /* any rela tables */ - for (tmpl = relalist; tmpl != NULL; tmpl = tmpl->next) { - Elf_Rela *relap = tmpl->mem; - - for (ewi = 0; ewi < tmpl->size / sizeof(*relap); ewi++) { - relap[ewi].r_info = htoxew(ELF_R_INFO( - symfwmap[ELF_R_SYM(xewtoh(relap[ewi].r_info))], - ELF_R_TYPE(xewtoh(relap[ewi].r_info)) - )); + while ((nstrtab_size - nstrtab_nextoff) < + strlen(symname) + fn_size + 12) { + nstrtab_size *= 2; + nstrtabp = xrealloc(nstrtabp, nstrtab_size, fn, + "new string table"); + if (nstrtabp == NULL) + goto bad; } - } - /* any rel tables */ - for (tmpl = rellist; tmpl != NULL; tmpl = tmpl->next) { - Elf_Rel *relp = tmpl->mem; - - for (ewi = 0; ewi < tmpl->size / sizeof *relp; ewi++) { - relp[ewi].r_info = htoxew(ELF_R_INFO( - symfwmap[ELF_R_SYM(xewtoh(relp[ewi].r_info))], - ELF_R_TYPE(xewtoh(relp[ewi].r_info)) - )); + sp->st_name = htoxew(nstrtab_nextoff); + + /* if it's a keeper or is undefined, don't rename it. */ + if (in_keep_list(symname) || + (xe16toh(sp->st_shndx) == SHN_UNDEF)) { + newent_len = sprintf(nstrtabp + nstrtab_nextoff, + "%s", symname) + 1; + } else { + newent_len = sprintf(nstrtabp + nstrtab_nextoff, + "_$$hide$$ %s %s", fn, symname) + 1; } + nstrtab_nextoff += newent_len; } + strtabshdr->sh_size = htoxew(nstrtab_nextoff); /* * write new tables to the file @@ -393,16 +369,10 @@ ELFNAMEEND(hide)(int fd, const char *fn) if (xwriteatoff(fd, symtabp, xewtoh(symtabshdr->sh_offset), xewtoh(symtabshdr->sh_size), fn) != xewtoh(symtabshdr->sh_size)) goto bad; - for (tmpl = relalist; tmpl != NULL; tmpl = tmpl->next) { - if (xwriteatoff(fd, tmpl->mem, tmpl->file, - tmpl->size, fn) != tmpl->size) - goto bad; - } - for (tmpl = rellist; tmpl != NULL; tmpl = tmpl->next) { - if (xwriteatoff(fd, tmpl->mem, tmpl->file, - tmpl->size, fn) != tmpl->size) - goto bad; - } + /* write new symbol table strings */ + if ((size_t)xwriteatoff(fd, nstrtabp, xewtoh(strtabshdr->sh_offset), + xewtoh(strtabshdr->sh_size), fn) != xewtoh(strtabshdr->sh_size)) + goto bad; out: if (shdrp != NULL) @@ -411,22 +381,6 @@ out: free(symtabp); if (strtabp != NULL) free(strtabp); - if (symfwmap != NULL) - free(symfwmap); - if (symrvmap != NULL) - free(symrvmap); - while ((tmpl = relalist) != NULL) { - relalist = tmpl->next; - if (tmpl->mem != NULL) - free(tmpl->mem); - free(tmpl); - } - while ((tmpl = rellist) != NULL) { - rellist = tmpl->next; - if (tmpl->mem != NULL) - free(tmpl->mem); - free(tmpl); - } return (rv); bad: From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 10:15:35 2010 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 4CD351065674; Tue, 10 Aug 2010 10:15: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 3C3E08FC19; Tue, 10 Aug 2010 10:15:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7AAFZEF085577; Tue, 10 Aug 2010 10:15:35 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7AAFZtu085575; Tue, 10 Aug 2010 10:15:35 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008101015.o7AAFZtu085575@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 10 Aug 2010 10:15:35 +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: r211138 - stable/8/sys/compat/freebsd32 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, 10 Aug 2010 10:15:35 -0000 Author: kib Date: Tue Aug 10 10:15:34 2010 New Revision: 211138 URL: http://svn.freebsd.org/changeset/base/211138 Log: MFC r210796: When compat32 recvmsg(2) does not need to copy out control messages, set msg_controllen to 0. PR: kern/149227 Modified: stable/8/sys/compat/freebsd32/freebsd32_misc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_misc.c Tue Aug 10 09:24:19 2010 (r211137) +++ stable/8/sys/compat/freebsd32/freebsd32_misc.c Tue Aug 10 10:15:34 2010 (r211138) @@ -1062,6 +1062,8 @@ freebsd32_recvmsg(td, uap) if (control != NULL) error = freebsd32_copy_msg_out(&msg, control); + else + msg.msg_controllen = 0; if (error == 0) error = freebsd32_copyoutmsghdr(&msg, uap->msg); From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 10:17:01 2010 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 9A101106567B; Tue, 10 Aug 2010 10:17:01 +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 899968FC15; Tue, 10 Aug 2010 10:17:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7AAH1vd085954; Tue, 10 Aug 2010 10:17:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7AAH1L2085952; Tue, 10 Aug 2010 10:17:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008101017.o7AAH1L2085952@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 10 Aug 2010 10:17:01 +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: r211139 - stable/8/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, 10 Aug 2010 10:17:01 -0000 Author: kib Date: Tue Aug 10 10:17:01 2010 New Revision: 211139 URL: http://svn.freebsd.org/changeset/base/211139 Log: MFC r210805: Properly set ifi_datalen for compat32 struct if_data32. PR: kern/149240 Modified: stable/8/sys/net/rtsock.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/net/rtsock.c ============================================================================== --- stable/8/sys/net/rtsock.c Tue Aug 10 10:15:34 2010 (r211138) +++ stable/8/sys/net/rtsock.c Tue Aug 10 10:17:01 2010 (r211139) @@ -1439,7 +1439,7 @@ copy_ifdata32(struct if_data *src, struc CP(*src, *dst, ifi_addrlen); CP(*src, *dst, ifi_hdrlen); CP(*src, *dst, ifi_link_state); - CP(*src, *dst, ifi_datalen); + dst->ifi_datalen = sizeof(struct if_data32); CP(*src, *dst, ifi_mtu); CP(*src, *dst, ifi_metric); CP(*src, *dst, ifi_baudrate); From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 11:02:55 2010 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 7859C1065673; Tue, 10 Aug 2010 11:02:55 +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 67CCC8FC16; Tue, 10 Aug 2010 11:02:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7AB2tmj099116; Tue, 10 Aug 2010 11:02:55 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7AB2tko099114; Tue, 10 Aug 2010 11:02:55 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201008101102.o7AB2tko099114@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 10 Aug 2010 11:02:55 +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: r211140 - stable/8/sys/geom/sched 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, 10 Aug 2010 11:02:55 -0000 Author: ae Date: Tue Aug 10 11:02:55 2010 New Revision: 211140 URL: http://svn.freebsd.org/changeset/base/211140 Log: MFC r210795: Check that gsp is not NULL before access. It can be NULL for some cases. Approved by: kib (mentor) Modified: stable/8/sys/geom/sched/g_sched.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/geom/sched/g_sched.c ============================================================================== --- stable/8/sys/geom/sched/g_sched.c Tue Aug 10 10:17:01 2010 (r211139) +++ stable/8/sys/geom/sched/g_sched.c Tue Aug 10 11:02:55 2010 (r211140) @@ -1887,7 +1887,7 @@ g_sched_dumpconf(struct sbuf *sb, const if (indent == NULL) { /* plaintext */ sbuf_printf(sb, " algo %s", gsp ? gsp->gs_name : "--"); } - if (gsp->gs_dumpconf) + if (gsp != NULL && gsp->gs_dumpconf) gsp->gs_dumpconf(sb, indent, gp, cp, pp); } From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 11:15:18 2010 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 461EB10656AC; Tue, 10 Aug 2010 11:15:18 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 360ED8FC1D; Tue, 10 Aug 2010 11:15:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ABFIv9002029; Tue, 10 Aug 2010 11:15:18 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ABFIs0002027; Tue, 10 Aug 2010 11:15:18 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201008101115.o7ABFIs0002027@svn.freebsd.org> From: Gabor Kovesdan Date: Tue, 10 Aug 2010 11:15: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: r211141 - head/etc/periodic/security 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, 10 Aug 2010 11:15:18 -0000 Author: gabor Date: Tue Aug 10 11:15:17 2010 New Revision: 211141 URL: http://svn.freebsd.org/changeset/base/211141 Log: - Fixes to the chkportsum script to handle better some special cases, like spaces in filename Submitted by: Alex Kozlov Approved by: delphij (mentor) Modified: head/etc/periodic/security/460.chkportsum Modified: head/etc/periodic/security/460.chkportsum ============================================================================== --- head/etc/periodic/security/460.chkportsum Tue Aug 10 11:02:55 2010 (r211140) +++ head/etc/periodic/security/460.chkportsum Tue Aug 10 11:15:17 2010 (r211141) @@ -42,20 +42,20 @@ echo 'Checking for ports with mismatched case "${daily_status_security_chkportsum_enable}" in [Yy][Ee][Ss]) + set -f pkg_info -ga 2>/dev/null | \ - while read one two three; do - case ${one} in + while IFS= read -r line; do + set -- $line + case $1 in Information) - case ${two} in - for) name=${three%%:} ;; - *) name='??' ;; + case $2 in + for) name="${3%%:}" ;; + *) name='??' ;; esac ;; Mismatched|'') ;; - *) - if [ -n ${name} ]; then - echo ${name}: ${one} - fi + *) [ -n "${name}" ] && + echo "${name}: ${line%% fails the original MD5 checksum}" ;; esac done From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 11:03:53 2010 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 5178C1065672; Tue, 10 Aug 2010 11:03:53 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id B4DBB8FC17; Tue, 10 Aug 2010 11:03:52 +0000 (UTC) Received: from c122-106-147-41.carlnfd1.nsw.optusnet.com.au (c122-106-147-41.carlnfd1.nsw.optusnet.com.au [122.106.147.41]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7AB3gqP029029 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Aug 2010 21:03:44 +1000 Date: Tue, 10 Aug 2010 21:03:42 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: "M. Warner Losh" In-Reply-To: <20100809.111922.276219111637867136.imp@bsdimp.com> Message-ID: <20100810202538.G10110@delplex.bde.org> References: <20100809.111922.276219111637867136.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1132955669-1281438222=:10110" X-Mailman-Approved-At: Tue, 10 Aug 2010 11:16:26 +0000 Cc: src-committers@FreeBSD.org, jhb@FreeBSD.org, c.jayachandran@gmail.com, jchandra@FreeBSD.org, svn-src-all@FreeBSD.org, jlanders@vmware.com, attilio@FreeBSD.org, rrs@FreeBSD.org, sbruno@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r208165 - in head/sys: kern mips/conf mips/include mips/mips mips/rmi mips/rmi/dev/xlr 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, 10 Aug 2010 11:03:53 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1132955669-1281438222=:10110 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Mon, 9 Aug 2010, M. Warner Losh wrote: > In message: > "Jayachandran C." writes: > : > Actually the 32 bits limit is well aware and acknowledged in cpumask_= t. > : > While it is true that it should be an 'opaque' type, in reality it is > : > not. The maximum limit of 32 CPUs is a reality due to cpumask_t on al= l > : > our architectures. > : > That is why we are going to use cpuset_t for dealing with CPUs number= s > : > (which is really opaque, at same extent, and is not bound to any > : > size). > : > : In my opinion, your changes added another pitfall for the person who > : tries to make the cpumask_t 64 bit to support more cpus, which really > : could have been avoided. To avoid the pitfall, the 32 in the latest should be spelled something like (sizeof(cpu_mask_t) * CHAR_BIT). Perhaps some literal constants also need to be cast to cpu_mask_t. > Yes, the correct fix, short of cpuset_t, is not: > >>>>> - =A0 =A0 =A0 top->cg_mask =3D (1 << mp_ncpus) - 1; >>>>> + =A0 =A0 =A0 if (mp_ncpus =3D=3D sizeof(top->cg_mask) * 8) This spelling of 32 is better than the hard 32. >>>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 top->cg_mask =3D -1; >>>>> + =A0 =A0 =A0 else >>>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 top->cg_mask =3D (1 << mp_ncpus) - 1; > > but rather > > =09if (mp_ncpus > sizeof(top->cg_mask) * NBBY) > =09=09mp_ncpus =3D sizeof(top->cg_mask) * NBBY; /* Or panic */ When fixing the spelling of sizeof(char), please catch up with C90 and spell it CHAR_BIT. > =09if (mp_ncpus > sizeof(top->cg_mask) * NBBY) > =09=09top->cg_mask =3D ~0;=09 /* which avoids the signed error */ > =09else > =09=09top->cg_mask =3D (1 << mp_ncpus) - 1; This is missing a cast of 1. With 16-bit ints, this would overflow even with a 32-bit cpumask_t. > I'm not sure why the expression would fail (1 << 32 =3D=3D 0 -1 =3D=3D al= l > bits set), but I've not looked at the old thread to see why the > compiler is generating bogus code. (1 << 32) gives undefined behaviour unless ints have at least 33 value bits (and 1 sign bit). IIRC, even within the x86 family, some actual behaviours are to give a result of either 0 or 1, depending on whether the shift count is masked with 0x1F before shifting. Even (1 << 31) with normal 32-bit ints gives undefined behaviour. C90 says that it gives the result of shifting, but that is unpredictable and nothing is required for it. C99 fixes this and makes it explicitly undefined (since normal 32-bit ints have 31 value bits and (1 << 31) requires at least 32 value bits to represent in the type of the left operand 1, i.e., int). The actual behaviour for broken expressions like =09=09top->cg_mask =3D (1 << mp_ncpus) - 1; is: - first (1 << 31) overflows benignly to the negative value INT_MIN (with normal 2's complement 32-bit ints) - next, INT_MIN - 1 overflows benignly to the positive value INT_MAX - the signed value INT_MAX is assigned to the unsigned variable cg_mask. Since INT_MAX is positive and has a type smaller than cg_mask, there are no further overflows or other significant conversions - long mails about this are sent by language lawyers - the overflows accidentally resulted in the correct value, so there are no further problems. Bruce --0-1132955669-1281438222=:10110-- From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 11:20:41 2010 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 9A0DB1065680; Tue, 10 Aug 2010 11:20:41 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 2DFC78FC13; Tue, 10 Aug 2010 11:20:40 +0000 (UTC) Received: from c122-106-147-41.carlnfd1.nsw.optusnet.com.au (c122-106-147-41.carlnfd1.nsw.optusnet.com.au [122.106.147.41]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7ABKRKV019893 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Aug 2010 21:20:27 +1000 Date: Tue, 10 Aug 2010 21:20:27 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: "M. Warner Losh" In-Reply-To: <20100809.095007.4959786895405928.imp@bsdimp.com> Message-ID: <20100810210449.H10110@delplex.bde.org> References: <20100808.153608.1142818667055052395.imp@bsdimp.com> <20100808220631.GA86477@stack.nl> <86tyn4tbuc.fsf@ds4.des.no> <20100809.095007.4959786895405928.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-2134441558-1281439227=:10110" Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@fromme.com, svn-src-head@FreeBSD.org, des@des.no Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 11:20:41 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-2134441558-1281439227=:10110 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Mon, 9 Aug 2010, M. Warner Losh wrote: > In message: <86tyn4tbuc.fsf@ds4.des.no> > Dag-Erling Sm=F8rgrav writes: > : Jilles Tjoelker writes: > : > In other cases, I propose adding a cast to void * in between, like > : > (struct sockaddr_in *)(void *)ai->ai_addr > : > : Better to cast through uintptr_t. Perhaps we should have a > : __DECONST-like macro for this? > : > : #define __ALIGNED_CAST(t, v) ((t)(uintptr_t)(v)) __DECONST() shouldn't exist, and this would be another way to break the warning. > I like the idea of a macro. Why is a cast through uintptr_t better? The bugs in __DECONST() are larger than its existence: - first, the (const void *) cast in it fails if that cast would cast away qualifiers (mainly the volatile qualifier). Perhaps (volatile const void *) would work better. - next, the `(type)' cast in it fails unless `type' is precisiely `void *' or perhaps a qualified variant of that (since [u]intptr_t only has defin= ed behaviour if [u]intptr_t exists and is applied to a `void *'). Casting through only uintptr_t is better because it fails in more cases, (as for `(type)' above, but also for converting uintptr_t), and anything that prevents use of bogus casts by making them fail is better :-). Bruce --0-2134441558-1281439227=:10110-- From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 12:00:20 2010 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 27F661065739; Tue, 10 Aug 2010 12:00:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 3C6C68FC17; Tue, 10 Aug 2010 12:00:18 +0000 (UTC) Received: from c122-106-147-41.carlnfd1.nsw.optusnet.com.au (c122-106-147-41.carlnfd1.nsw.optusnet.com.au [122.106.147.41]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7AC08t1019716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Aug 2010 22:00:12 +1000 Date: Tue, 10 Aug 2010 22:00:08 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Stefan Farfeleder In-Reply-To: <20100810074210.GC1737@mole.fafoe.narf.at> Message-ID: <20100810215430.U10154@delplex.bde.org> References: <201008100515.o7A5FZZF017552@svn.freebsd.org> <20100810062829.GA1737@mole.fafoe.narf.at> <20100810074210.GC1737@mole.fafoe.narf.at> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, "Jayachandran C." , Neel Natu Subject: Re: svn commit: r211130 - head/libexec/rtld-elf/mips 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, 10 Aug 2010 12:00:20 -0000 On Tue, 10 Aug 2010, Stefan Farfeleder wrote: > On Tue, Aug 10, 2010 at 12:55:38PM +0530, Jayachandran C. wrote: >> >> I think there is a problem in sys/mips/include/_endian.h >> -- >> #define __bswap16(x) (__uint16_t)(__is_constant(x) ? \ >> __bswap16_const((__uint16_t)x) : __bswap16_var((__uint16_t)x)) >> #define __bswap32(x) (__uint32_t)(__is_constant(x) ? \ >> __bswap32_const((__uint32_t)x) : __bswap32_var((__uint32_t)x)) >> #define __bswap64(x) (__uint64_t)(__is_constant(x) ? \ >> __bswap64_const((__uint64_t)x) : __bswap64_var((__uint64_t)x)) >> -- >> >> I'm not sure why the cast is needed, but we should have a braces >> around x, unless I'm completely mistaken. And not around x in callers. > I agree. And around the entire expression too. I agree. But I've never seen a case where foo(x) needs to be (foo(x)) (where foo is not a macro). '()' has highest precedence for expressions (not sure about for parameter lists) together with `[]' `->' and '.', and it is hard to think of an expression with any of the latter close enough to foo(x) to cause problems. Bruce From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 12:58:44 2010 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 B750A1065672; Tue, 10 Aug 2010 12:58:44 +0000 (UTC) (envelope-from olli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5BBE8FC08; Tue, 10 Aug 2010 12:58:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ACwinE025161; Tue, 10 Aug 2010 12:58:44 GMT (envelope-from olli@svn.freebsd.org) Received: (from olli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ACwiUW025159; Tue, 10 Aug 2010 12:58:44 GMT (envelope-from olli@svn.freebsd.org) Message-Id: <201008101258.o7ACwiUW025159@svn.freebsd.org> From: Oliver Fromme Date: Tue, 10 Aug 2010 12:58: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: r211142 - head/etc/periodic/daily 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, 10 Aug 2010 12:58:44 -0000 Author: olli Date: Tue Aug 10 12:58:44 2010 New Revision: 211142 URL: http://svn.freebsd.org/changeset/base/211142 Log: Connect the new script 490.status-pkg-changes (see r210863) to the build, so it gets actually installed. Approved by: des (mentor) MFC after: 17 days Modified: head/etc/periodic/daily/Makefile Modified: head/etc/periodic/daily/Makefile ============================================================================== --- head/etc/periodic/daily/Makefile Tue Aug 10 11:15:17 2010 (r211141) +++ head/etc/periodic/daily/Makefile Tue Aug 10 12:58:44 2010 (r211142) @@ -39,6 +39,10 @@ FILES+= 130.clean-msgs FILES+= 480.status-ntpd .endif +.if ${MK_PKGTOOLS} != "no" +FILES+= 490.status-pkg-changes +.endif + .if ${MK_RCMDS} != "no" FILES+= 140.clean-rwho \ 430.status-rwho From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 13:14:05 2010 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 1532510656BF; Tue, 10 Aug 2010 13:13:59 +0000 (UTC) (envelope-from olli@fromme.com) Received: from haluter.fromme.com (haluter.fromme.com [212.17.241.231]) by mx1.freebsd.org (Postfix) with ESMTP id AEEBF8FC13; Tue, 10 Aug 2010 13:13:58 +0000 (UTC) Received: from haluter.fromme.com (irc_sucks@localhost [127.0.0.1]) by haluter.fromme.com (8.14.3/8.14.3) with ESMTP id o7ADDhdb040901; Tue, 10 Aug 2010 15:13:50 +0200 (CEST) (envelope-from olli@fromme.com) Received: (from olli@localhost) by haluter.fromme.com (8.14.3/8.14.3/Submit) id o7ADDhYE040900; Tue, 10 Aug 2010 15:13:43 +0200 (CEST) (envelope-from olli) From: Oliver Fromme Message-Id: <201008101313.o7ADDhYE040900@haluter.fromme.com> To: imp@bsdimp.com (M. Warner Losh) Date: Tue, 10 Aug 2010 15:13:43 +0200 (CEST) In-Reply-To: <20100808.153608.1142818667055052395.imp@bsdimp.com> X-Mailer: ELM [version 2.5 PL8] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (haluter.fromme.com [127.0.0.1]); Tue, 10 Aug 2010 15:13:51 +0200 (CEST) Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@FreeBSD.org, svn-src-head@FreeBSD.org, des@des.no Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 13:14:05 -0000 M. Warner Losh wrote: > The casting that syslogd does with struct sockaddrFOO is what triggers > it. I'm not sure how to fix it, so there's about 6 or 8 programs in > the tree that have WARNS lowered to 3 because of it. I've given it try, please see the patch below. This is not really pretty, but it's a start. It builds with WARNS=6 on all archs, including mips. What do you think? Best regards Oliver --- syslogd.c.orig 2010-08-05 21:59:11.000000000 +0200 +++ syslogd.c 2010-08-10 15:02:19.000000000 +0200 @@ -175,7 +175,7 @@ struct { char f_hname[MAXHOSTNAMELEN]; struct addrinfo *f_addr; - + in_port_t f_port; } f_forw; /* forwarding address */ char f_fname[MAXPATHLEN]; struct { @@ -330,8 +330,8 @@ static void readklog(void); static void reapchild(int); static void usage(void); -static int validate(struct sockaddr *, const char *); -static void unmapped(struct sockaddr *); +static int validate(struct sockaddr_storage *, const char *); +static void unmapped(struct sockaddr_storage *); static void wallmsg(struct filed *, struct iovec *, const int iovlen); static int waitdaemon(int, int, int); static void timedout(int); @@ -652,8 +652,8 @@ if (l > 0) { line[l] = '\0'; hname = cvthname((struct sockaddr *)&frominet); - unmapped((struct sockaddr *)&frominet); - if (validate((struct sockaddr *)&frominet, hname)) + unmapped(&frominet); + if (validate(&frominet, hname)) printline(hname, line, RemoteAddDate ? ADDDATE : 0); } else if (l < 0 && errno != EINTR) logerror("recvfrom inet"); @@ -678,17 +678,17 @@ } static void -unmapped(struct sockaddr *sa) +unmapped(struct sockaddr_storage *ss) { struct sockaddr_in6 *sin6; struct sockaddr_in sin4; - if (sa->sa_family != AF_INET6) + if (ss->ss_family != AF_INET6) return; - if (sa->sa_len != sizeof(struct sockaddr_in6) || - sizeof(sin4) > sa->sa_len) + if (ss->ss_len != sizeof(struct sockaddr_in6) || + sizeof(sin4) > ss->ss_len) return; - sin6 = (struct sockaddr_in6 *)sa; + sin6 = (struct sockaddr_in6 *)ss; if (!IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) return; @@ -699,7 +699,7 @@ sizeof(sin4.sin_addr)); sin4.sin_port = sin6->sin6_port; - memcpy(sa, &sin4, sin4.sin_len); + memcpy(ss, &sin4, sin4.sin_len); } static void @@ -1186,8 +1186,7 @@ break; case F_FORW: - port = (int)ntohs(((struct sockaddr_in *) - (f->f_un.f_forw.f_addr->ai_addr))->sin_port); + port = f->f_un.f_forw.f_port; if (port != 514) { dprintf(" %s:%d\n", f->f_un.f_forw.f_hname, port); } else { @@ -1711,8 +1710,7 @@ break; case F_FORW: - port = (int)ntohs(((struct sockaddr_in *) - (f->f_un.f_forw.f_addr->ai_addr))->sin_port); + port = f->f_un.f_forw.f_port; if (port != 514) { printf("%s:%d", f->f_un.f_forw.f_hname, port); @@ -1767,6 +1765,7 @@ cfline(const char *line, struct filed *f, const char *prog, const char *host) { struct addrinfo hints, *res; + struct servent *srvent; int error, i, pri, syncfile; const char *p, *q; char *bp; @@ -1954,6 +1953,12 @@ break; } f->f_un.f_forw.f_addr = res; + srvent = getservbyname(p ? p : "syslog", NULL); + if (srvent != NULL) + f->f_un.f_forw.f_port = srvent->s_port; + else + /* Fallback, shouldn't happen. */ + f->f_un.f_forw.f_port = 514; f->f_type = F_FORW; break; @@ -2340,7 +2345,7 @@ * Validate that the remote peer has permission to log to us. */ static int -validate(struct sockaddr *sa, const char *hname) +validate(struct sockaddr_storage *ss, const char *hname) { int i; size_t l1, l2; @@ -2369,8 +2374,8 @@ strlcat(name, ".", sizeof name); strlcat(name, LocalDomain, sizeof name); } - if (getnameinfo(sa, sa->sa_len, ip, sizeof ip, port, sizeof port, - NI_NUMERICHOST | NI_NUMERICSERV) != 0) + if (getnameinfo((struct sockaddr *)ss, ss->ss_len, ip, sizeof ip, port, + sizeof port, NI_NUMERICHOST | NI_NUMERICSERV) != 0) return (0); /* for safety, should not occur */ dprintf("validate: dgram from IP %s, port %s, name %s;\n", ip, port, name); @@ -2384,12 +2389,12 @@ } if (ap->isnumeric) { - if (ap->a_addr.ss_family != sa->sa_family) { + if (ap->a_addr.ss_family != ss->ss_family) { dprintf("rejected in rule %d due to address family mismatch.\n", i); continue; } if (ap->a_addr.ss_family == AF_INET) { - sin4 = (struct sockaddr_in *)sa; + sin4 = (struct sockaddr_in *)ss; a4p = (struct sockaddr_in *)&ap->a_addr; m4p = (struct sockaddr_in *)&ap->a_mask; if ((sin4->sin_addr.s_addr & m4p->sin_addr.s_addr) @@ -2400,7 +2405,7 @@ } #ifdef INET6 else if (ap->a_addr.ss_family == AF_INET6) { - sin6 = (struct sockaddr_in6 *)sa; + sin6 = (struct sockaddr_in6 *)ss; a6p = (struct sockaddr_in6 *)&ap->a_addr; m6p = (struct sockaddr_in6 *)&ap->a_mask; if (a6p->sin6_scope_id != 0 && @@ -2409,9 +2414,9 @@ continue; } reject = 0; - for (j = 0; j < 16; j += 4) { - if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m6p->sin6_addr.s6_addr[j]) - != *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) { + for (j = 0; j < 16; j++) { + if ((sin6->sin6_addr.s6_addr[j] & m6p->sin6_addr.s6_addr[j]) + != a6p->sin6_addr.s6_addr[j]) { ++reject; break; } From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 14:36:20 2010 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 7A2B91065675; Tue, 10 Aug 2010 14:36: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 4FB0D8FC27; Tue, 10 Aug 2010 14:36:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7AEaKdt047214; Tue, 10 Aug 2010 14:36:20 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7AEaK3l047212; Tue, 10 Aug 2010 14:36:20 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008101436.o7AEaK3l047212@svn.freebsd.org> From: Adrian Chadd Date: Tue, 10 Aug 2010 14:36: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: r211146 - head 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, 10 Aug 2010 14:36:20 -0000 Author: adrian Date: Tue Aug 10 14:36:20 2010 New Revision: 211146 URL: http://svn.freebsd.org/changeset/base/211146 Log: crunchgen now works for mips - so restore building /rescue for it. Modified: head/Makefile.mips Modified: head/Makefile.mips ============================================================================== --- head/Makefile.mips Tue Aug 10 13:36:52 2010 (r211145) +++ head/Makefile.mips Tue Aug 10 14:36:20 2010 (r211146) @@ -1,5 +1,2 @@ # $FreeBSD$ -# A bug in binutils prevents rescue from building, so override the user's -# choice. -MK_RESCUE=no From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 14:59:11 2010 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 8EEF51065672; Tue, 10 Aug 2010 14:59:11 +0000 (UTC) (envelope-from neelnatu@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 9C0618FC15; Tue, 10 Aug 2010 14:59:10 +0000 (UTC) Received: by wwb13 with SMTP id 13so1390395wwb.31 for ; Tue, 10 Aug 2010 07:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=BULCBLm9KRe3M3tWi8wC4n4IYds5jrBn73UMIz9cYNE=; b=tcTMyxukG+8B26HC1zcJpk0LfuPrQJq0uhf/cHmsaVxGYeU1C8EUvjRSGYzdERz+29 Zi+V0M0OmoBpyRSv/cqFnx0klVN+lNEqTC769me9MwxipauNyI7IGABRpK5nWgkjpuH5 bh6dSEaWABkMgUsuJMrvLjhWx3fpKojnXuNd8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=oxPDPMx4dqh/+r9BJr6Rm6y9Cluyiuovu4H8Q2OuXWnJ0ySWkDOBlE8D0qBbgwPxY/ IGsfpa7vlEBQ1ENyAOCWk9Jg6CZo3k3/vP9VH8XmY/Iy3L/j5HQbMC8cuL4I/SB6b+tz gD5nAMTiejvQ7GXAG8SRyXQEmosnb8XTwIJ7g= MIME-Version: 1.0 Received: by 10.216.153.140 with SMTP id f12mr3060275wek.111.1281452348391; Tue, 10 Aug 2010 07:59:08 -0700 (PDT) Received: by 10.216.80.8 with HTTP; Tue, 10 Aug 2010 07:59:08 -0700 (PDT) In-Reply-To: <20100810215430.U10154@delplex.bde.org> References: <201008100515.o7A5FZZF017552@svn.freebsd.org> <20100810062829.GA1737@mole.fafoe.narf.at> <20100810074210.GC1737@mole.fafoe.narf.at> <20100810215430.U10154@delplex.bde.org> Date: Tue, 10 Aug 2010 07:59:08 -0700 Message-ID: From: Neel Natu To: Bruce Evans Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Stefan Farfeleder , src-committers@freebsd.org, "Jayachandran C." Subject: Re: svn commit: r211130 - head/libexec/rtld-elf/mips 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, 10 Aug 2010 14:59:11 -0000 Hi, On Tue, Aug 10, 2010 at 5:00 AM, Bruce Evans wrote: > On Tue, 10 Aug 2010, Stefan Farfeleder wrote: > >> On Tue, Aug 10, 2010 at 12:55:38PM +0530, Jayachandran C. wrote: >>> >>> I think there is a problem in =A0sys/mips/include/_endian.h >>> -- >>> #define __bswap16(x) =A0 =A0(__uint16_t)(__is_constant(x) ? =A0 =A0 =A0= =A0 \ >>> =A0 =A0 =A0 =A0__bswap16_const((__uint16_t)x) : =A0__bswap16_var((__uin= t16_t)x)) >>> #define __bswap32(x) =A0 =A0(__uint32_t)(__is_constant(x) ? =A0 =A0 =A0= =A0 \ >>> =A0 =A0 =A0 =A0__bswap32_const((__uint32_t)x) : =A0__bswap32_var((__uin= t32_t)x)) >>> #define __bswap64(x) =A0 =A0(__uint64_t)(__is_constant(x) ? =A0 =A0 =A0= =A0 \ >>> =A0 =A0 =A0 =A0__bswap64_const((__uint64_t)x) : =A0__bswap64_var((__uin= t64_t)x)) >>> -- >>> >>> I'm not sure why the cast is needed, but we should have a braces >>> around x, unless I'm completely mistaken. > > And not around x in callers. > >> I agree. And around the entire expression too. > > I agree. =A0But I've never seen a case where foo(x) needs to be (foo(x)) > (where foo is not a macro). =A0'()' has highest precedence for expression= s > (not sure about for parameter lists) together with `[]' `->' and '.', and > it is hard to think of an expression with any of the latter close enough > to foo(x) to cause problems. > > Bruce > Ok, thanks to everybody for their input. I'll make the suggested changes to sys/mips/include/_endian.h instead. best Neel From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 15:22:48 2010 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 5FF831065670; Tue, 10 Aug 2010 15:22:48 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F37E8FC16; Tue, 10 Aug 2010 15:22:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7AFMmKP057681; Tue, 10 Aug 2010 15:22:48 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7AFMmJE057679; Tue, 10 Aug 2010 15:22:48 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008101522.o7AFMmJE057679@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 10 Aug 2010 15:22: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: r211148 - head/sys/compat/x86bios 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, 10 Aug 2010 15:22:48 -0000 Author: jkim Date: Tue Aug 10 15:22:48 2010 New Revision: 211148 URL: http://svn.freebsd.org/changeset/base/211148 Log: Place spinlock_enter() and spinlock_exit() just around X86EMU calls. Modified: head/sys/compat/x86bios/x86bios.c Modified: head/sys/compat/x86bios/x86bios.c ============================================================================== --- head/sys/compat/x86bios/x86bios.c Tue Aug 10 14:44:20 2010 (r211147) +++ head/sys/compat/x86bios/x86bios.c Tue Aug 10 15:22:48 2010 (r211148) @@ -599,12 +599,12 @@ x86bios_call(struct x86regs *regs, uint1 X86BIOS_TRACE(Calling 0x%06x, (seg << 4) + off, regs); mtx_lock(&x86bios_lock); - spinlock_enter(); memcpy(&x86bios_emu.x86, regs, sizeof(*regs)); x86bios_fault = 0; + spinlock_enter(); x86emu_exec_call(&x86bios_emu, seg, off); - memcpy(regs, &x86bios_emu.x86, sizeof(*regs)); spinlock_exit(); + memcpy(regs, &x86bios_emu.x86, sizeof(*regs)); mtx_unlock(&x86bios_lock); if (x86bios_trace_call) { @@ -637,12 +637,12 @@ x86bios_intr(struct x86regs *regs, int i X86BIOS_TRACE(Calling INT 0x%02x, intno, regs); mtx_lock(&x86bios_lock); - spinlock_enter(); memcpy(&x86bios_emu.x86, regs, sizeof(*regs)); x86bios_fault = 0; + spinlock_enter(); x86emu_exec_intr(&x86bios_emu, intno); - memcpy(regs, &x86bios_emu.x86, sizeof(*regs)); spinlock_exit(); + memcpy(regs, &x86bios_emu.x86, sizeof(*regs)); mtx_unlock(&x86bios_lock); if (x86bios_trace_int) { From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 15:40:22 2010 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 5D71C106566C; Tue, 10 Aug 2010 15:40:22 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id F29888FC1A; Tue, 10 Aug 2010 15:40:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o7AFaOPp075180; Tue, 10 Aug 2010 09:36:25 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 10 Aug 2010 09:36:56 -0600 (MDT) Message-Id: <20100810.093656.167578749323544001.imp@bsdimp.com> To: olli@fromme.com From: "M. Warner Losh" In-Reply-To: <201008101313.o7ADDhYE040900@haluter.fromme.com> References: <20100808.153608.1142818667055052395.imp@bsdimp.com> <201008101313.o7ADDhYE040900@haluter.fromme.com> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@FreeBSD.org, svn-src-head@FreeBSD.org, des@des.no Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 15:40:22 -0000 In message: <201008101313.o7ADDhYE040900@haluter.fromme.com> Oliver Fromme writes: : M. Warner Losh wrote: : > The casting that syslogd does with struct sockaddrFOO is what triggers : > it. I'm not sure how to fix it, so there's about 6 or 8 programs in : > the tree that have WARNS lowered to 3 because of it. : : I've given it try, please see the patch below. : This is not really pretty, but it's a start. : It builds with WARNS=6 on all archs, including mips. : : What do you think? I have just one comment at the end about the removal of the u_int32_t casts. Otherwise, this looks really good. Thanks for taking the time to do this. : Best regards : Oliver : : --- syslogd.c.orig 2010-08-05 21:59:11.000000000 +0200 : +++ syslogd.c 2010-08-10 15:02:19.000000000 +0200 : @@ -175,7 +175,7 @@ : struct { : char f_hname[MAXHOSTNAMELEN]; : struct addrinfo *f_addr; : - : + in_port_t f_port; : } f_forw; /* forwarding address */ : char f_fname[MAXPATHLEN]; : struct { : @@ -330,8 +330,8 @@ : static void readklog(void); : static void reapchild(int); : static void usage(void); : -static int validate(struct sockaddr *, const char *); : -static void unmapped(struct sockaddr *); : +static int validate(struct sockaddr_storage *, const char *); : +static void unmapped(struct sockaddr_storage *); : static void wallmsg(struct filed *, struct iovec *, const int iovlen); : static int waitdaemon(int, int, int); : static void timedout(int); : @@ -652,8 +652,8 @@ : if (l > 0) { : line[l] = '\0'; : hname = cvthname((struct sockaddr *)&frominet); : - unmapped((struct sockaddr *)&frominet); : - if (validate((struct sockaddr *)&frominet, hname)) : + unmapped(&frominet); : + if (validate(&frominet, hname)) : printline(hname, line, RemoteAddDate ? ADDDATE : 0); : } else if (l < 0 && errno != EINTR) : logerror("recvfrom inet"); : @@ -678,17 +678,17 @@ : } : : static void : -unmapped(struct sockaddr *sa) : +unmapped(struct sockaddr_storage *ss) : { : struct sockaddr_in6 *sin6; : struct sockaddr_in sin4; : : - if (sa->sa_family != AF_INET6) : + if (ss->ss_family != AF_INET6) : return; : - if (sa->sa_len != sizeof(struct sockaddr_in6) || : - sizeof(sin4) > sa->sa_len) : + if (ss->ss_len != sizeof(struct sockaddr_in6) || : + sizeof(sin4) > ss->ss_len) : return; : - sin6 = (struct sockaddr_in6 *)sa; : + sin6 = (struct sockaddr_in6 *)ss; : if (!IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) : return; : : @@ -699,7 +699,7 @@ : sizeof(sin4.sin_addr)); : sin4.sin_port = sin6->sin6_port; : : - memcpy(sa, &sin4, sin4.sin_len); : + memcpy(ss, &sin4, sin4.sin_len); : } : : static void : @@ -1186,8 +1186,7 @@ : break; : : case F_FORW: : - port = (int)ntohs(((struct sockaddr_in *) : - (f->f_un.f_forw.f_addr->ai_addr))->sin_port); : + port = f->f_un.f_forw.f_port; : if (port != 514) { : dprintf(" %s:%d\n", f->f_un.f_forw.f_hname, port); : } else { : @@ -1711,8 +1710,7 @@ : break; : : case F_FORW: : - port = (int)ntohs(((struct sockaddr_in *) : - (f->f_un.f_forw.f_addr->ai_addr))->sin_port); : + port = f->f_un.f_forw.f_port; : if (port != 514) { : printf("%s:%d", : f->f_un.f_forw.f_hname, port); : @@ -1767,6 +1765,7 @@ : cfline(const char *line, struct filed *f, const char *prog, const char *host) : { : struct addrinfo hints, *res; : + struct servent *srvent; : int error, i, pri, syncfile; : const char *p, *q; : char *bp; : @@ -1954,6 +1953,12 @@ : break; : } : f->f_un.f_forw.f_addr = res; : + srvent = getservbyname(p ? p : "syslog", NULL); : + if (srvent != NULL) : + f->f_un.f_forw.f_port = srvent->s_port; : + else : + /* Fallback, shouldn't happen. */ : + f->f_un.f_forw.f_port = 514; : f->f_type = F_FORW; : break; : : @@ -2340,7 +2345,7 @@ : * Validate that the remote peer has permission to log to us. : */ : static int : -validate(struct sockaddr *sa, const char *hname) : +validate(struct sockaddr_storage *ss, const char *hname) : { : int i; : size_t l1, l2; : @@ -2369,8 +2374,8 @@ : strlcat(name, ".", sizeof name); : strlcat(name, LocalDomain, sizeof name); : } : - if (getnameinfo(sa, sa->sa_len, ip, sizeof ip, port, sizeof port, : - NI_NUMERICHOST | NI_NUMERICSERV) != 0) : + if (getnameinfo((struct sockaddr *)ss, ss->ss_len, ip, sizeof ip, port, : + sizeof port, NI_NUMERICHOST | NI_NUMERICSERV) != 0) : return (0); /* for safety, should not occur */ : dprintf("validate: dgram from IP %s, port %s, name %s;\n", : ip, port, name); : @@ -2384,12 +2389,12 @@ : } : : if (ap->isnumeric) { : - if (ap->a_addr.ss_family != sa->sa_family) { : + if (ap->a_addr.ss_family != ss->ss_family) { : dprintf("rejected in rule %d due to address family mismatch.\n", i); : continue; : } : if (ap->a_addr.ss_family == AF_INET) { : - sin4 = (struct sockaddr_in *)sa; : + sin4 = (struct sockaddr_in *)ss; : a4p = (struct sockaddr_in *)&ap->a_addr; : m4p = (struct sockaddr_in *)&ap->a_mask; : if ((sin4->sin_addr.s_addr & m4p->sin_addr.s_addr) : @@ -2400,7 +2405,7 @@ : } : #ifdef INET6 : else if (ap->a_addr.ss_family == AF_INET6) { : - sin6 = (struct sockaddr_in6 *)sa; : + sin6 = (struct sockaddr_in6 *)ss; : a6p = (struct sockaddr_in6 *)&ap->a_addr; : m6p = (struct sockaddr_in6 *)&ap->a_mask; : if (a6p->sin6_scope_id != 0 && : @@ -2409,9 +2414,9 @@ : continue; : } : reject = 0; : - for (j = 0; j < 16; j += 4) { : - if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m6p->sin6_addr.s6_addr[j]) : - != *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) { : + for (j = 0; j < 16; j++) { : + if ((sin6->sin6_addr.s6_addr[j] & m6p->sin6_addr.s6_addr[j]) : + != a6p->sin6_addr.s6_addr[j]) { This code looks better, but why have the casts been removed? I take it they aren't necessary? : ++reject; : break; : } : : Warner From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 16:14:11 2010 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 DA911106575E; Tue, 10 Aug 2010 16:14:11 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C96D48FC15; Tue, 10 Aug 2010 16:14:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7AGEBUh069343; Tue, 10 Aug 2010 16:14:11 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7AGEBSJ069341; Tue, 10 Aug 2010 16:14:11 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008101614.o7AGEBSJ069341@svn.freebsd.org> From: Attilio Rao Date: Tue, 10 Aug 2010 16:14: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: r211149 - 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, 10 Aug 2010 16:14:11 -0000 Author: attilio Date: Tue Aug 10 16:14:10 2010 New Revision: 211149 URL: http://svn.freebsd.org/changeset/base/211149 Log: Fix some places that may use cpumask_t while they still use 'int' types. While there, also fix some places assuming cpu type is 'int' while u_int is really meant. Note: this will also fix some possible races in per-cpu data accessings to be addressed in further commits. In collabouration with: Yahoo! Incorporated (via sbruno and peter) Tested by: gianni MFC after: 1 month Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/pmap.c head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/pmap.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Tue Aug 10 15:22:48 2010 (r211148) +++ head/sys/amd64/amd64/mp_machdep.c Tue Aug 10 16:14:10 2010 (r211149) @@ -127,7 +127,7 @@ extern inthand_t IDTVEC(fast_syscall), I * Local data and functions. */ -static u_int logical_cpus; +static cpumask_t logical_cpus; static volatile cpumask_t ipi_nmi_pending; /* used to hold the AP's until we are ready to release them */ @@ -162,8 +162,8 @@ static int start_all_aps(void); static int start_ap(int apic_id); static void release_aps(void *dummy); -static int hlt_logical_cpus; -static u_int hyperthreading_cpus; +static cpumask_t hlt_logical_cpus; +static cpumask_t hyperthreading_cpus; static cpumask_t hyperthreading_cpus_mask; static int hyperthreading_allowed = 1; static struct sysctl_ctx_list logical_cpu_clist; @@ -1321,8 +1321,11 @@ ipi_nmi_handler() void cpustop_handler(void) { - int cpu = PCPU_GET(cpuid); - int cpumask = PCPU_GET(cpumask); + cpumask_t cpumask; + u_int cpu; + + cpu = PCPU_GET(cpuid); + cpumask = PCPU_GET(cpumask); savectx(&stoppcbs[cpu]); @@ -1349,9 +1352,12 @@ cpustop_handler(void) void cpususpend_handler(void) { + cpumask_t cpumask; register_t cr3, rf; - int cpu = PCPU_GET(cpuid); - int cpumask = PCPU_GET(cpumask); + u_int cpu; + + cpu = PCPU_GET(cpuid); + cpumask = PCPU_GET(cpumask); rf = intr_disable(); cr3 = rcr3(); @@ -1523,13 +1529,15 @@ SYSINIT(cpu_hlt, SI_SUB_SMP, SI_ORDER_AN int mp_grab_cpu_hlt(void) { - u_int mask = PCPU_GET(cpumask); + cpuset_t mask; #ifdef MP_WATCHDOG - u_int cpuid = PCPU_GET(cpuid); + u_int cpuid; #endif int retval; + mask = PCPU_GET(cpumask); #ifdef MP_WATCHDOG + cpuid = PCPU_GET(cpuid); ap_watchdog(cpuid); #endif Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Aug 10 15:22:48 2010 (r211148) +++ head/sys/amd64/amd64/pmap.c Tue Aug 10 16:14:10 2010 (r211149) @@ -926,8 +926,7 @@ pmap_update_pde_invalidate(vm_offset_t v void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; sched_pin(); if (pmap == kernel_pmap || pmap->pm_active == all_cpus) { @@ -947,8 +946,7 @@ pmap_invalidate_page(pmap_t pmap, vm_off void pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; vm_offset_t addr; sched_pin(); @@ -972,8 +970,7 @@ pmap_invalidate_range(pmap_t pmap, vm_of void pmap_invalidate_all(pmap_t pmap) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; sched_pin(); if (pmap == kernel_pmap || pmap->pm_active == all_cpus) { Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Tue Aug 10 15:22:48 2010 (r211148) +++ head/sys/i386/i386/mp_machdep.c Tue Aug 10 16:14:10 2010 (r211149) @@ -174,7 +174,7 @@ static u_long *ipi_statclock_counts[MAXC * Local data and functions. */ -static u_int logical_cpus; +static cpumask_t logical_cpus; static volatile cpumask_t ipi_nmi_pending; /* used to hold the AP's until we are ready to release them */ @@ -210,8 +210,8 @@ static int start_all_aps(void); static int start_ap(int apic_id); static void release_aps(void *dummy); -static int hlt_logical_cpus; -static u_int hyperthreading_cpus; +static cpumask_t hlt_logical_cpus; +static cpumask_t hyperthreading_cpus; static cpumask_t hyperthreading_cpus_mask; static int hyperthreading_allowed = 1; static struct sysctl_ctx_list logical_cpu_clist; @@ -1408,8 +1408,11 @@ ipi_nmi_handler() void cpustop_handler(void) { - int cpu = PCPU_GET(cpuid); - int cpumask = PCPU_GET(cpumask); + cpumask_t cpumask; + u_int cpu; + + cpu = PCPU_GET(cpuid); + cpumask = PCPU_GET(cpumask); savectx(&stoppcbs[cpu]); @@ -1577,13 +1580,15 @@ SYSINIT(cpu_hlt, SI_SUB_SMP, SI_ORDER_AN int mp_grab_cpu_hlt(void) { - u_int mask = PCPU_GET(cpumask); + cpuset_t mask; #ifdef MP_WATCHDOG - u_int cpuid = PCPU_GET(cpuid); + u_int cpuid; #endif int retval; + mask = PCPU_GET(cpumask); #ifdef MP_WATCHDOG + cpuid = PCPU_GET(cpuid); ap_watchdog(cpuid); #endif Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Tue Aug 10 15:22:48 2010 (r211148) +++ head/sys/i386/i386/pmap.c Tue Aug 10 16:14:10 2010 (r211149) @@ -949,8 +949,7 @@ pmap_update_pde_invalidate(vm_offset_t v void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; sched_pin(); if (pmap == kernel_pmap || pmap->pm_active == all_cpus) { @@ -970,8 +969,7 @@ pmap_invalidate_page(pmap_t pmap, vm_off void pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; vm_offset_t addr; sched_pin(); @@ -995,8 +993,7 @@ pmap_invalidate_range(pmap_t pmap, vm_of void pmap_invalidate_all(pmap_t pmap) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; sched_pin(); if (pmap == kernel_pmap || pmap->pm_active == all_cpus) { From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 16:17:01 2010 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 0384F1065673; Tue, 10 Aug 2010 16:17:01 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 789828FC18; Tue, 10 Aug 2010 16:17:00 +0000 (UTC) Received: by qwg5 with SMTP id 5so7522059qwg.13 for ; Tue, 10 Aug 2010 09:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=Cln3EdMF43B9FkWKG6t7wuEXsTQMuLGOQi1nF1UanRU=; b=JACyacgN0qIkbv0fFsQux//+rUXKE/NGUFHtfQFYsSLfYlu2Xai7XfqVL9G/ZvHR7X P5XS+TTSI8jBohwQJROdCYfP+walju+WkHrwSg7i/FZGRS2ZB1wBg3TRRWcQVpeCHOff Lkun9ZkD7ZmiS/yMBt91Kaleu6RTYnyLIJZAo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=AKvwodkCOe2stz5ceD66qxgThCSiRmBkeRuDECHQs/bhDKT8q2hvqLhomTsgdyF9lZ gS7oInQNGgNSN+CiRgJlt+jKfLZKyQxekX42POMT5C1L80FsaGGhn41tpIExnJ4mVjQ/ J0Igm6lDE8vO2sssYf71SiZuhTrbq7Jj6tfYE= MIME-Version: 1.0 Received: by 10.224.67.193 with SMTP id s1mr9911715qai.28.1281457007478; Tue, 10 Aug 2010 09:16:47 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.251.6 with HTTP; Tue, 10 Aug 2010 09:16:47 -0700 (PDT) In-Reply-To: <201008101614.o7AGEBSJ069341@svn.freebsd.org> References: <201008101614.o7AGEBSJ069341@svn.freebsd.org> Date: Tue, 10 Aug 2010 18:16:47 +0200 X-Google-Sender-Auth: sjG3f67hWgQsheX0527dkacOY5k Message-ID: From: Attilio Rao To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r211149 - 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, 10 Aug 2010 16:17:01 -0000 2010/8/10 Attilio Rao : > Author: attilio > Date: Tue Aug 10 16:14:10 2010 > New Revision: 211149 > URL: http://svn.freebsd.org/changeset/base/211149 > > Log: > =C2=A0Fix some places that may use cpumask_t while they still use 'int' t= ypes. > =C2=A0While there, also fix some places assuming cpu type is 'int' while > =C2=A0u_int is really meant. > > =C2=A0Note: this will also fix some possible races in per-cpu data access= ings > =C2=A0to be addressed in further commits. s/fix/help fixing. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 16:24:11 2010 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 58CF9106577A; Tue, 10 Aug 2010 16:24:11 +0000 (UTC) (envelope-from olli@fromme.com) Received: from haluter.fromme.com (haluter.fromme.com [212.17.241.231]) by mx1.freebsd.org (Postfix) with ESMTP id 903008FC1E; Tue, 10 Aug 2010 16:24:10 +0000 (UTC) Received: from haluter.fromme.com (irc_sucks@localhost [127.0.0.1]) by haluter.fromme.com (8.14.3/8.14.3) with ESMTP id o7AGNslM042681; Tue, 10 Aug 2010 18:24:01 +0200 (CEST) (envelope-from olli@fromme.com) Received: (from olli@localhost) by haluter.fromme.com (8.14.3/8.14.3/Submit) id o7AGNs7I042679; Tue, 10 Aug 2010 18:23:54 +0200 (CEST) (envelope-from olli) From: Oliver Fromme Message-Id: <201008101623.o7AGNs7I042679@haluter.fromme.com> To: imp@bsdimp.com (M. Warner Losh) Date: Tue, 10 Aug 2010 18:23:53 +0200 (CEST) In-Reply-To: <20100810.093656.167578749323544001.imp@bsdimp.com> X-Mailer: ELM [version 2.5 PL8] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (haluter.fromme.com [127.0.0.1]); Tue, 10 Aug 2010 18:24:01 +0200 (CEST) Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@FreeBSD.org, svn-src-head@FreeBSD.org, des@des.no Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 16:24:11 -0000 M. Warner Losh wrote: > In message: <201008101313.o7ADDhYE040900@haluter.fromme.com> > Oliver Fromme writes: > : M. Warner Losh wrote: > : > The casting that syslogd does with struct sockaddrFOO is what triggers > : > it. I'm not sure how to fix it, so there's about 6 or 8 programs in > : > the tree that have WARNS lowered to 3 because of it. > : > : I've given it try, please see the patch below. > : This is not really pretty, but it's a start. > : It builds with WARNS=6 on all archs, including mips. > : > : What do you think? Please ignore that patch. It compiles, but has some problems. des pointed out that it makes sense to use a macro for type casts. The new patch below does this for the cases where simply using struct sockaddr_storage doesn't work. > [...] > : @@ -2409,9 +2414,9 @@ > : continue; > : } > : reject = 0; > : - for (j = 0; j < 16; j += 4) { > : - if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m6p->sin6_addr.s6_addr[j]) > : - != *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) { > : + for (j = 0; j < 16; j++) { > : + if ((sin6->sin6_addr.s6_addr[j] & m6p->sin6_addr.s6_addr[j]) > : + != a6p->sin6_addr.s6_addr[j]) { > > This code looks better, but why have the casts been removed? I take > it they aren't necessary? Right. On the other hand, the loop iterations are increased from 4 to 16, making the whole thing less efficient. In the new patch below I introduced a typecast macro for this case, too, so the iterations stay at 4. Again, the new patch passes the universe test. Best regards Oliver --- syslogd.c.orig 2010-08-05 21:59:11.000000000 +0200 +++ syslogd.c 2010-08-10 18:15:46.000000000 +0200 @@ -123,6 +123,15 @@ #define MAXUNAMES 20 /* maximum number of user names */ /* + * Macros to cast a struct sockaddr, or parts thereof. + * These are needed to silence the compiler on architectures + * with strict alignment requirements. + */ + +#define SIN_CAST(sa) ((struct sockaddr_in *)(uintptr_t)(sa)) +#define UINT32_CAST(c) (*(u_int32_t *)(uintptr_t)&(c)) + +/* * Unix sockets. * We have two default sockets, one with 666 permissions, * and one for privileged programs. @@ -330,8 +339,8 @@ static void readklog(void); static void reapchild(int); static void usage(void); -static int validate(struct sockaddr *, const char *); -static void unmapped(struct sockaddr *); +static int validate(struct sockaddr_storage *, const char *); +static void unmapped(struct sockaddr_storage *); static void wallmsg(struct filed *, struct iovec *, const int iovlen); static int waitdaemon(int, int, int); static void timedout(int); @@ -652,8 +661,8 @@ if (l > 0) { line[l] = '\0'; hname = cvthname((struct sockaddr *)&frominet); - unmapped((struct sockaddr *)&frominet); - if (validate((struct sockaddr *)&frominet, hname)) + unmapped(&frominet); + if (validate(&frominet, hname)) printline(hname, line, RemoteAddDate ? ADDDATE : 0); } else if (l < 0 && errno != EINTR) logerror("recvfrom inet"); @@ -678,17 +687,17 @@ } static void -unmapped(struct sockaddr *sa) +unmapped(struct sockaddr_storage *ss) { struct sockaddr_in6 *sin6; struct sockaddr_in sin4; - if (sa->sa_family != AF_INET6) + if (ss->ss_family != AF_INET6) return; - if (sa->sa_len != sizeof(struct sockaddr_in6) || - sizeof(sin4) > sa->sa_len) + if (ss->ss_len != sizeof(struct sockaddr_in6) || + sizeof(sin4) > ss->ss_len) return; - sin6 = (struct sockaddr_in6 *)sa; + sin6 = (struct sockaddr_in6 *)ss; if (!IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) return; @@ -699,7 +708,7 @@ sizeof(sin4.sin_addr)); sin4.sin_port = sin6->sin6_port; - memcpy(sa, &sin4, sin4.sin_len); + memcpy(ss, &sin4, sin4.sin_len); } static void @@ -1186,7 +1195,7 @@ break; case F_FORW: - port = (int)ntohs(((struct sockaddr_in *) + port = (int)ntohs((SIN_CAST (f->f_un.f_forw.f_addr->ai_addr))->sin_port); if (port != 514) { dprintf(" %s:%d\n", f->f_un.f_forw.f_hname, port); @@ -1711,7 +1720,7 @@ break; case F_FORW: - port = (int)ntohs(((struct sockaddr_in *) + port = (int)ntohs((SIN_CAST (f->f_un.f_forw.f_addr->ai_addr))->sin_port); if (port != 514) { printf("%s:%d", @@ -2340,7 +2349,7 @@ * Validate that the remote peer has permission to log to us. */ static int -validate(struct sockaddr *sa, const char *hname) +validate(struct sockaddr_storage *ss, const char *hname) { int i; size_t l1, l2; @@ -2369,8 +2378,8 @@ strlcat(name, ".", sizeof name); strlcat(name, LocalDomain, sizeof name); } - if (getnameinfo(sa, sa->sa_len, ip, sizeof ip, port, sizeof port, - NI_NUMERICHOST | NI_NUMERICSERV) != 0) + if (getnameinfo((struct sockaddr *)ss, ss->ss_len, ip, sizeof ip, port, + sizeof port, NI_NUMERICHOST | NI_NUMERICSERV) != 0) return (0); /* for safety, should not occur */ dprintf("validate: dgram from IP %s, port %s, name %s;\n", ip, port, name); @@ -2384,12 +2393,12 @@ } if (ap->isnumeric) { - if (ap->a_addr.ss_family != sa->sa_family) { + if (ap->a_addr.ss_family != ss->ss_family) { dprintf("rejected in rule %d due to address family mismatch.\n", i); continue; } if (ap->a_addr.ss_family == AF_INET) { - sin4 = (struct sockaddr_in *)sa; + sin4 = (struct sockaddr_in *)ss; a4p = (struct sockaddr_in *)&ap->a_addr; m4p = (struct sockaddr_in *)&ap->a_mask; if ((sin4->sin_addr.s_addr & m4p->sin_addr.s_addr) @@ -2400,7 +2409,7 @@ } #ifdef INET6 else if (ap->a_addr.ss_family == AF_INET6) { - sin6 = (struct sockaddr_in6 *)sa; + sin6 = (struct sockaddr_in6 *)ss; a6p = (struct sockaddr_in6 *)&ap->a_addr; m6p = (struct sockaddr_in6 *)&ap->a_mask; if (a6p->sin6_scope_id != 0 && @@ -2410,8 +2419,8 @@ } reject = 0; for (j = 0; j < 16; j += 4) { - if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m6p->sin6_addr.s6_addr[j]) - != *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) { + if ((UINT32_CAST(sin6->sin6_addr.s6_addr[j]) & UINT32_CAST(m6p->sin6_addr.s6_addr[j])) + != UINT32_CAST(a6p->sin6_addr.s6_addr[j])) { ++reject; break; } From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 16:28:54 2010 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 E3884106566B; Tue, 10 Aug 2010 16:28:54 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 613BA8FC20; Tue, 10 Aug 2010 16:28:54 +0000 (UTC) Received: by qyk11 with SMTP id 11so3642436qyk.13 for ; Tue, 10 Aug 2010 09:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=zQBgrD6pQKrbdEBRzUPQWUl7psGvnxa/jdWTw1oyb68=; b=Lwx1ht+ThFqECpelYaHLS3gQD7/OTptfS5A978yqiS6PLc7+82Ayjn5TCo0oeFirTu fLYHxaPMGQsCdfAd5AsKOSO3TjN+t4piPw9qPRTvLOjexNZpb7YZNBIkEfun5qImTPhp J9boMzu3Ye2RlZHitczCHn7rMuNDcOS4PyMDU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=HHLb+u1yp8W4QUF4PboKp8FPElfodNjrZcrjp1L2qfMbcvGzk4Pig8Y5TtnDaO3Skp 8Hxaisbf1OCY3iLakog2TbUyG0msDggywTG3CClNriO6/V8HYZcB55pKEJgFhuVbWVJJ bwfF641oZwbPZmoj2W8eIHiOn36oF17E6NOBs= MIME-Version: 1.0 Received: by 10.229.35.16 with SMTP id n16mr8403652qcd.172.1281457733503; Tue, 10 Aug 2010 09:28:53 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.251.6 with HTTP; Tue, 10 Aug 2010 09:28:53 -0700 (PDT) In-Reply-To: <201008101614.o7AGEBSJ069341@svn.freebsd.org> References: <201008101614.o7AGEBSJ069341@svn.freebsd.org> Date: Tue, 10 Aug 2010 18:28:53 +0200 X-Google-Sender-Auth: vV0dbiVEK5p9kPflktTtCAnX5Xw Message-ID: From: Attilio Rao To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r211149 - 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, 10 Aug 2010 16:28:55 -0000 2010/8/10 Attilio Rao : > Author: attilio > Date: Tue Aug 10 16:14:10 2010 > New Revision: 211149 > URL: http://svn.freebsd.org/changeset/base/211149 > > Log: > =C2=A0Fix some places that may use cpumask_t while they still use 'int' t= ypes. > =C2=A0While there, also fix some places assuming cpu type is 'int' while > =C2=A0u_int is really meant. Also, sorry for not going depeer with other architectures, similar changes might happen, if necessary, on them as well. I will be glad to help maintainers of various architectures in that, if they need. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 17:33:42 2010 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 CD104106566B; Tue, 10 Aug 2010 17:33:42 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper-int.allbsd.org [IPv6:2001:2f0:104:e002::2]) by mx1.freebsd.org (Postfix) with ESMTP id 2C7688FC0A; Tue, 10 Aug 2010 17:33:41 +0000 (UTC) Received: from alph.d.allbsd.org (p2176-ipbf406funabasi.chiba.ocn.ne.jp [124.86.72.176]) (authenticated bits=128) by mail.allbsd.org (8.14.4/8.14.3) with ESMTP id o7AHX3W9058348; Wed, 11 Aug 2010 02:33:13 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.d.allbsd.org (8.14.4/8.14.4) with ESMTP id o7AHWw9Y061345; Wed, 11 Aug 2010 02:33:01 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Wed, 11 Aug 2010 02:32:35 +0900 (JST) Message-Id: <20100811.023235.13138059.hrs@allbsd.org> To: olli@fromme.com From: Hiroki Sato In-Reply-To: <201008101623.o7AGNs7I042679@haluter.fromme.com> References: <20100810.093656.167578749323544001.imp@bsdimp.com> <201008101623.o7AGNs7I042679@haluter.fromme.com> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.3 on Emacs 23.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Wed_Aug_11_02_32_35_2010_096)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.95.3 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.3 (mail.allbsd.org [133.31.130.32]); Wed, 11 Aug 2010 02:33:17 +0900 (JST) X-Spam-Status: No, score=-99.4 required=13.0 tests=AWL,CONTENT_TYPE_PRESENT, RCVD_IN_CHINA, RCVD_IN_CHINA_KR, RCVD_IN_PBL, RCVD_IN_TAIWAN, SPF_SOFTFAIL, USER_IN_WHITELIST,X_MAILER_PRESENT autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gatekeeper.allbsd.org Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@FreeBSD.org, svn-src-head@FreeBSD.org, des@des.no, imp@bsdimp.com Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 17:33:42 -0000 ----Security_Multipart(Wed_Aug_11_02_32_35_2010_096)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Oliver Fromme wrote in <201008101623.o7AGNs7I042679@haluter.fromme.com>: ol> -static int validate(struct sockaddr *, const char *); ol> -static void unmapped(struct sockaddr *); ol> +static int validate(struct sockaddr_storage *, const char *); ol> +static void unmapped(struct sockaddr_storage *); Why is s/struct sockaddr */struct sockaddr_storage */ needed here? Using (struct sockaddr *) as an argument looks reasonable to me since the struct sockaddr_storage is mostly for memory allocation, not for access via pointer. -- Hiroki ----Security_Multipart(Wed_Aug_11_02_32_35_2010_096)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkxhjTMACgkQTyzT2CeTzy2M+QCgv7jPtA5hpnrVsUKcVaKpDZM0 HvEAoNaLfSgUIXhijNx2jGFy12XlRBzK =kkRv -----END PGP SIGNATURE----- ----Security_Multipart(Wed_Aug_11_02_32_35_2010_096)---- From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 17:38:53 2010 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 615B6106566B; Tue, 10 Aug 2010 17:38:53 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 0AEF98FC12; Tue, 10 Aug 2010 17:38:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o7AHYt2N076558; Tue, 10 Aug 2010 11:34:55 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 10 Aug 2010 11:06:42 -0600 (MDT) Message-Id: <20100810.110642.335141733495090585.imp@bsdimp.com> To: olli@fromme.com From: "M. Warner Losh" In-Reply-To: <201008101623.o7AGNs7I042679@haluter.fromme.com> References: <20100810.093656.167578749323544001.imp@bsdimp.com> <201008101623.o7AGNs7I042679@haluter.fromme.com> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@FreeBSD.org, svn-src-head@FreeBSD.org, des@des.no Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 17:38:53 -0000 In message: <201008101623.o7AGNs7I042679@haluter.fromme.com> Oliver Fromme writes: : : M. Warner Losh wrote: : > In message: <201008101313.o7ADDhYE040900@haluter.fromme.com> : > Oliver Fromme writes: : > : M. Warner Losh wrote: : > : > The casting that syslogd does with struct sockaddrFOO is what triggers : > : > it. I'm not sure how to fix it, so there's about 6 or 8 programs in : > : > the tree that have WARNS lowered to 3 because of it. : > : : > : I've given it try, please see the patch below. : > : This is not really pretty, but it's a start. : > : It builds with WARNS=6 on all archs, including mips. : > : : > : What do you think? : : Please ignore that patch. It compiles, but has some problems. : : des pointed out that it makes sense to use a macro for type : casts. The new patch below does this for the cases where : simply using struct sockaddr_storage doesn't work. : : > [...] : > : @@ -2409,9 +2414,9 @@ : > : continue; : > : } : > : reject = 0; : > : - for (j = 0; j < 16; j += 4) { : > : - if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m6p->sin6_addr.s6_addr[j]) : > : - != *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) { : > : + for (j = 0; j < 16; j++) { : > : + if ((sin6->sin6_addr.s6_addr[j] & m6p->sin6_addr.s6_addr[j]) : > : + != a6p->sin6_addr.s6_addr[j]) { : > : > This code looks better, but why have the casts been removed? I take : > it they aren't necessary? : : Right. On the other hand, the loop iterations are increased : from 4 to 16, making the whole thing less efficient. : In the new patch below I introduced a typecast macro for : this case, too, so the iterations stay at 4. : : Again, the new patch passes the universe test. : : Best regards : Oliver : : --- syslogd.c.orig 2010-08-05 21:59:11.000000000 +0200 : +++ syslogd.c 2010-08-10 18:15:46.000000000 +0200 : @@ -123,6 +123,15 @@ : #define MAXUNAMES 20 /* maximum number of user names */ : : /* : + * Macros to cast a struct sockaddr, or parts thereof. : + * These are needed to silence the compiler on architectures : + * with strict alignment requirements. : + */ : + : +#define SIN_CAST(sa) ((struct sockaddr_in *)(uintptr_t)(sa)) : +#define UINT32_CAST(c) (*(u_int32_t *)(uintptr_t)&(c)) You might want to add an explanation that the ABI guarantees the uint32's will have proper alignment to be accessed in this way. Maybe: /* * Macros to cast a struct sockaddr, or parts thereof. * On architectures with strict alignment requirements, the compiler * can bogusly warn about alignment problems since its static analysis * is insufficient for it to know that with the APIs used, there * really is no alignment issue. */ : +/* : * Unix sockets. : * We have two default sockets, one with 666 permissions, : * and one for privileged programs. : @@ -330,8 +339,8 @@ : static void readklog(void); : static void reapchild(int); : static void usage(void); : -static int validate(struct sockaddr *, const char *); : -static void unmapped(struct sockaddr *); : +static int validate(struct sockaddr_storage *, const char *); : +static void unmapped(struct sockaddr_storage *); : static void wallmsg(struct filed *, struct iovec *, const int iovlen); : static int waitdaemon(int, int, int); : static void timedout(int); : @@ -652,8 +661,8 @@ : if (l > 0) { : line[l] = '\0'; : hname = cvthname((struct sockaddr *)&frominet); : - unmapped((struct sockaddr *)&frominet); : - if (validate((struct sockaddr *)&frominet, hname)) : + unmapped(&frominet); : + if (validate(&frominet, hname)) : printline(hname, line, RemoteAddDate ? ADDDATE : 0); : } else if (l < 0 && errno != EINTR) : logerror("recvfrom inet"); : @@ -678,17 +687,17 @@ : } : : static void : -unmapped(struct sockaddr *sa) : +unmapped(struct sockaddr_storage *ss) : { : struct sockaddr_in6 *sin6; : struct sockaddr_in sin4; : : - if (sa->sa_family != AF_INET6) : + if (ss->ss_family != AF_INET6) : return; : - if (sa->sa_len != sizeof(struct sockaddr_in6) || : - sizeof(sin4) > sa->sa_len) : + if (ss->ss_len != sizeof(struct sockaddr_in6) || : + sizeof(sin4) > ss->ss_len) : return; : - sin6 = (struct sockaddr_in6 *)sa; : + sin6 = (struct sockaddr_in6 *)ss; : if (!IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) : return; : : @@ -699,7 +708,7 @@ : sizeof(sin4.sin_addr)); : sin4.sin_port = sin6->sin6_port; : : - memcpy(sa, &sin4, sin4.sin_len); : + memcpy(ss, &sin4, sin4.sin_len); : } : : static void : @@ -1186,7 +1195,7 @@ : break; : : case F_FORW: : - port = (int)ntohs(((struct sockaddr_in *) : + port = (int)ntohs((SIN_CAST : (f->f_un.f_forw.f_addr->ai_addr))->sin_port); : if (port != 514) { : dprintf(" %s:%d\n", f->f_un.f_forw.f_hname, port); : @@ -1711,7 +1720,7 @@ : break; : : case F_FORW: : - port = (int)ntohs(((struct sockaddr_in *) : + port = (int)ntohs((SIN_CAST : (f->f_un.f_forw.f_addr->ai_addr))->sin_port); : if (port != 514) { : printf("%s:%d", : @@ -2340,7 +2349,7 @@ : * Validate that the remote peer has permission to log to us. : */ : static int : -validate(struct sockaddr *sa, const char *hname) : +validate(struct sockaddr_storage *ss, const char *hname) : { : int i; : size_t l1, l2; : @@ -2369,8 +2378,8 @@ : strlcat(name, ".", sizeof name); : strlcat(name, LocalDomain, sizeof name); : } : - if (getnameinfo(sa, sa->sa_len, ip, sizeof ip, port, sizeof port, : - NI_NUMERICHOST | NI_NUMERICSERV) != 0) : + if (getnameinfo((struct sockaddr *)ss, ss->ss_len, ip, sizeof ip, port, : + sizeof port, NI_NUMERICHOST | NI_NUMERICSERV) != 0) : return (0); /* for safety, should not occur */ : dprintf("validate: dgram from IP %s, port %s, name %s;\n", : ip, port, name); : @@ -2384,12 +2393,12 @@ : } : : if (ap->isnumeric) { : - if (ap->a_addr.ss_family != sa->sa_family) { : + if (ap->a_addr.ss_family != ss->ss_family) { : dprintf("rejected in rule %d due to address family mismatch.\n", i); : continue; : } : if (ap->a_addr.ss_family == AF_INET) { : - sin4 = (struct sockaddr_in *)sa; : + sin4 = (struct sockaddr_in *)ss; : a4p = (struct sockaddr_in *)&ap->a_addr; : m4p = (struct sockaddr_in *)&ap->a_mask; : if ((sin4->sin_addr.s_addr & m4p->sin_addr.s_addr) : @@ -2400,7 +2409,7 @@ : } : #ifdef INET6 : else if (ap->a_addr.ss_family == AF_INET6) { : - sin6 = (struct sockaddr_in6 *)sa; : + sin6 = (struct sockaddr_in6 *)ss; : a6p = (struct sockaddr_in6 *)&ap->a_addr; : m6p = (struct sockaddr_in6 *)&ap->a_mask; : if (a6p->sin6_scope_id != 0 && : @@ -2410,8 +2419,8 @@ : } : reject = 0; : for (j = 0; j < 16; j += 4) { : - if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m6p->sin6_addr.s6_addr[j]) : - != *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) { : + if ((UINT32_CAST(sin6->sin6_addr.s6_addr[j]) & UINT32_CAST(m6p->sin6_addr.s6_addr[j])) : + != UINT32_CAST(a6p->sin6_addr.s6_addr[j])) { : ++reject; : break; : } : : Why 16 and 4 here? What's so magical about them? Warner From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 17:47:25 2010 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 E70711065673; Tue, 10 Aug 2010 17:47:25 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id A3C888FC1B; Tue, 10 Aug 2010 17:47:25 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id AC1711FFC36; Tue, 10 Aug 2010 17:47:24 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 74D7184525; Tue, 10 Aug 2010 19:47:24 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "M. Warner Losh" References: <20100810.093656.167578749323544001.imp@bsdimp.com> <201008101623.o7AGNs7I042679@haluter.fromme.com> <20100810.110642.335141733495090585.imp@bsdimp.com> Date: Tue, 10 Aug 2010 19:47:24 +0200 In-Reply-To: <20100810.110642.335141733495090585.imp@bsdimp.com> (M. Warner Losh's message of "Tue, 10 Aug 2010 11:06:42 -0600 (MDT)") Message-ID: <86sk2m1hsj.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@fromme.com, olli@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 17:47:26 -0000 "M. Warner Losh" writes: > /* > * Macros to cast a struct sockaddr, or parts thereof. > * On architectures with strict alignment requirements, the compiler > * can bogusly warn about alignment problems since its static analysis > * is insufficient for it to know that with the APIs used, there > * really is no alignment issue. > */ That's a bit harsh on the compiler, don't you think? It never pays to hurt the compiler's feelings :) > : @@ -2410,8 +2419,8 @@ > : } > : reject =3D 0; > : for (j =3D 0; j < 16; j +=3D 4) { > : - if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m= 6p->sin6_addr.s6_addr[j]) > : - !=3D *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) { > : + if ((UINT32_CAST(sin6->sin6_addr.s6_addr[j]) & UINT32_CAST(m6p->s= in6_addr.s6_addr[j])) > : + !=3D UINT32_CAST(a6p->sin6_addr.s6_addr[j])) { > : ++reject; > : break; > : } > :=20 > :=20 > > Why 16 and 4 here? What's so magical about them? 4 =3D bytes in a uint32_t, 16 =3D bytes in an ipv6 address. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 17:48:10 2010 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 9BB3C1065673; Tue, 10 Aug 2010 17:48:10 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 59AF28FC0C; Tue, 10 Aug 2010 17:48:10 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 91C5E1FFC37; Tue, 10 Aug 2010 17:48:09 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 699F784525; Tue, 10 Aug 2010 19:48:09 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Hiroki Sato References: <20100810.093656.167578749323544001.imp@bsdimp.com> <201008101623.o7AGNs7I042679@haluter.fromme.com> <20100811.023235.13138059.hrs@allbsd.org> Date: Tue, 10 Aug 2010 19:48:09 +0200 In-Reply-To: <20100811.023235.13138059.hrs@allbsd.org> (Hiroki Sato's message of "Wed, 11 Aug 2010 02:32:35 +0900 (JST)") Message-ID: <86ocda1hra.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@fromme.com, olli@FreeBSD.org, svn-src-head@FreeBSD.org, imp@bsdimp.com Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 17:48:10 -0000 Hiroki Sato writes: > Why is s/struct sockaddr */struct sockaddr_storage */ needed here? Alignment. That's what this entire thread is about. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 18:03:43 2010 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 02E5B1065676; Tue, 10 Aug 2010 18:03:43 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id B696C8FC26; Tue, 10 Aug 2010 18:03:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o7AHsPLi076795; Tue, 10 Aug 2010 11:54:25 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 10 Aug 2010 11:54:57 -0600 (MDT) Message-Id: <20100810.115457.1126759349893144516.imp@bsdimp.com> To: hrs@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20100811.023235.13138059.hrs@allbsd.org> References: <20100810.093656.167578749323544001.imp@bsdimp.com> <201008101623.o7AGNs7I042679@haluter.fromme.com> <20100811.023235.13138059.hrs@allbsd.org> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@fromme.com, olli@FreeBSD.org, svn-src-head@FreeBSD.org, des@des.no Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 18:03:43 -0000 In message: <20100811.023235.13138059.hrs@allbsd.org> Hiroki Sato writes: : Oliver Fromme wrote : in <201008101623.o7AGNs7I042679@haluter.fromme.com>: : : ol> -static int validate(struct sockaddr *, const char *); : ol> -static void unmapped(struct sockaddr *); : ol> +static int validate(struct sockaddr_storage *, const char *); : ol> +static void unmapped(struct sockaddr_storage *); : : Why is s/struct sockaddr */struct sockaddr_storage */ needed here? : Using (struct sockaddr *) as an argument looks reasonable to me since : the struct sockaddr_storage is mostly for memory allocation, not for : access via pointer. Because struct sockaddr * has a too loose alignment requirement for later casting, while sockaddr_storage has the proper alignment. Warner From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 18:10:07 2010 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 A5CF61065673; Tue, 10 Aug 2010 18:10:07 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 46FA78FC14; Tue, 10 Aug 2010 18:10:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o7AI0VND076887; Tue, 10 Aug 2010 12:00:31 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 10 Aug 2010 12:01:03 -0600 (MDT) Message-Id: <20100810.120103.69891821625677670.imp@bsdimp.com> To: des@des.no From: "M. Warner Losh" In-Reply-To: <86sk2m1hsj.fsf@ds4.des.no> References: <201008101623.o7AGNs7I042679@haluter.fromme.com> <20100810.110642.335141733495090585.imp@bsdimp.com> <86sk2m1hsj.fsf@ds4.des.no> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@fromme.com, olli@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 18:10:07 -0000 In message: <86sk2m1hsj.fsf@ds4.des.no> Dag-Erling Sm=F8rgrav writes: : "M. Warner Losh" writes: : > /* : > * Macros to cast a struct sockaddr, or parts thereof. : > * On architectures with strict alignment requirements, the compile= r : > * can bogusly warn about alignment problems since its static analy= sis : > * is insufficient for it to know that with the APIs used, there : > * really is no alignment issue. : > */ : = : That's a bit harsh on the compiler, don't you think? It never pays t= o : hurt the compiler's feelings :) /* * Macros to cast a struct sockaddr, or parts thereof. struct * sockaddr's alginment is loose to later be cast to a sockaddr_in or * sockaddr_in6. On architectures with strict alignment requirements, * this leads to compiler warnings because the compiler doesn't know * the ABI guarantees proper alignment. */ But this leads me to think that the right fix might be: /* * Structure used by kernel to store most * addresses. */ struct sockaddr { unsigned char sa_len; /* total length */ sa_family_t sa_family; /* address family */ char sa_data[14]; /* actually longer; address value */ } __aligned(4); since that's what the ABI defines.... : > : @@ -2410,8 +2419,8 @@ : > : } : > : reject =3D 0; : > : for (j =3D 0; j < 16; j +=3D 4) { : > : - if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_= t *)&m6p->sin6_addr.s6_addr[j]) : > : - !=3D *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) { : > : + if ((UINT32_CAST(sin6->sin6_addr.s6_addr[j]) & UINT32_CAST(= m6p->sin6_addr.s6_addr[j])) : > : + !=3D UINT32_CAST(a6p->sin6_addr.s6_addr[j])) { : > : ++reject; : > : break; : > : } : > : = : > : = : > : > Why 16 and 4 here? What's so magical about them? : = : 4 =3D bytes in a uint32_t, 16 =3D bytes in an ipv6 address. Isn't that better served by 'sizeof(uint32_t)' and 'sizeof(ipv6_addr_t)'? Warner From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 18:29:39 2010 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 72C241065672; Tue, 10 Aug 2010 18:29:39 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 61F208FC18; Tue, 10 Aug 2010 18:29:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7AITd0u099646; Tue, 10 Aug 2010 18:29:39 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7AITd63099643; Tue, 10 Aug 2010 18:29:39 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008101829.o7AITd63099643@svn.freebsd.org> From: Attilio Rao Date: Tue, 10 Aug 2010 18:29: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: r211151 - 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, 10 Aug 2010 18:29:39 -0000 Author: attilio Date: Tue Aug 10 18:29:39 2010 New Revision: 211151 URL: http://svn.freebsd.org/changeset/base/211151 Log: Fix a typo due to a stale version of the patch. Reported by: gianni, rdivacky MFC after: 1 month X-MFC: 211149 Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/i386/i386/mp_machdep.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Tue Aug 10 17:06:38 2010 (r211150) +++ head/sys/amd64/amd64/mp_machdep.c Tue Aug 10 18:29:39 2010 (r211151) @@ -1529,7 +1529,7 @@ SYSINIT(cpu_hlt, SI_SUB_SMP, SI_ORDER_AN int mp_grab_cpu_hlt(void) { - cpuset_t mask; + cpumask_t mask; #ifdef MP_WATCHDOG u_int cpuid; #endif Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Tue Aug 10 17:06:38 2010 (r211150) +++ head/sys/i386/i386/mp_machdep.c Tue Aug 10 18:29:39 2010 (r211151) @@ -1580,7 +1580,7 @@ SYSINIT(cpu_hlt, SI_SUB_SMP, SI_ORDER_AN int mp_grab_cpu_hlt(void) { - cpuset_t mask; + cpumask_t mask; #ifdef MP_WATCHDOG u_int cpuid; #endif From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 18:33:49 2010 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 886731065677; Tue, 10 Aug 2010 18:33:49 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 479A78FC24; Tue, 10 Aug 2010 18:33:48 +0000 (UTC) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id 0317E3F5B3; Tue, 10 Aug 2010 18:15:45 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.4/8.14.4) with ESMTP id o7AIFiTQ011607; Tue, 10 Aug 2010 18:15:45 GMT (envelope-from phk@critter.freebsd.dk) To: "M. Warner Losh" From: "Poul-Henning Kamp" In-Reply-To: Your message of "Tue, 10 Aug 2010 11:54:57 CST." <20100810.115457.1126759349893144516.imp@bsdimp.com> Date: Tue, 10 Aug 2010 18:15:44 +0000 Message-ID: <11606.1281464144@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, hrs@FreeBSD.org, olli@fromme.com, olli@FreeBSD.org, svn-src-head@FreeBSD.org, des@des.no Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 18:33:49 -0000 In message <20100810.115457.1126759349893144516.imp@bsdimp.com>, "M. Warner Los h" writes: >In message: <20100811.023235.13138059.hrs@allbsd.org> > Hiroki Sato writes: >: Oliver Fromme wrote >: in <201008101623.o7AGNs7I042679@haluter.fromme.com>: >: >: ol> -static int validate(struct sockaddr *, const char *); >: ol> -static void unmapped(struct sockaddr *); >: ol> +static int validate(struct sockaddr_storage *, const char *); >: ol> +static void unmapped(struct sockaddr_storage *); >: >: Why is s/struct sockaddr */struct sockaddr_storage */ needed here? >: Using (struct sockaddr *) as an argument looks reasonable to me since >: the struct sockaddr_storage is mostly for memory allocation, not for >: access via pointer. > >Because struct sockaddr * has a too loose alignment requirement for >later casting, while sockaddr_storage has the proper alignment. This is the kind of detail Bruce, Warner and I know, but I bet it was news to most of you. Somebody should add it to the relevant manualpages... -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 18:43:19 2010 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 64804106564A; Tue, 10 Aug 2010 18:43:19 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 2365D8FC28; Tue, 10 Aug 2010 18:43:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o7AIfLEF077340; Tue, 10 Aug 2010 12:41:21 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 10 Aug 2010 12:41:53 -0600 (MDT) Message-Id: <20100810.124153.237540042763325649.imp@bsdimp.com> To: phk@phk.freebsd.dk From: "M. Warner Losh" In-Reply-To: <11606.1281464144@critter.freebsd.dk> References: <20100810.115457.1126759349893144516.imp@bsdimp.com> <11606.1281464144@critter.freebsd.dk> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, hrs@FreeBSD.org, olli@fromme.com, olli@FreeBSD.org, svn-src-head@FreeBSD.org, des@des.no Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 18:43:19 -0000 In message: <11606.1281464144@critter.freebsd.dk> "Poul-Henning Kamp" writes: : In message <20100810.115457.1126759349893144516.imp@bsdimp.com>, "M. Warner Los : h" writes: : >In message: <20100811.023235.13138059.hrs@allbsd.org> : > Hiroki Sato writes: : >: Oliver Fromme wrote : >: in <201008101623.o7AGNs7I042679@haluter.fromme.com>: : >: : >: ol> -static int validate(struct sockaddr *, const char *); : >: ol> -static void unmapped(struct sockaddr *); : >: ol> +static int validate(struct sockaddr_storage *, const char *); : >: ol> +static void unmapped(struct sockaddr_storage *); : >: : >: Why is s/struct sockaddr */struct sockaddr_storage */ needed here? : >: Using (struct sockaddr *) as an argument looks reasonable to me since : >: the struct sockaddr_storage is mostly for memory allocation, not for : >: access via pointer. : > : >Because struct sockaddr * has a too loose alignment requirement for : >later casting, while sockaddr_storage has the proper alignment. : : This is the kind of detail Bruce, Warner and I know, but I bet it : was news to most of you. : : Somebody should add it to the relevant manualpages... It was news to me when I saw it :) But given other posix requirements for this interface, maybe there's a better fix... Warner From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 19:13:19 2010 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 E2E681065670; Tue, 10 Aug 2010 19:13:19 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D11D18FC21; Tue, 10 Aug 2010 19:13:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7AJDJ4v009580; Tue, 10 Aug 2010 19:13:19 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7AJDJYE009568; Tue, 10 Aug 2010 19:13:19 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201008101913.o7AJDJYE009568@svn.freebsd.org> From: Gavin Atkinson Date: Tue, 10 Aug 2010 19:13: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: r211153 - in 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: Tue, 10 Aug 2010 19:13:20 -0000 Author: gavin Date: Tue Aug 10 19:13:11 2010 New Revision: 211153 URL: http://svn.freebsd.org/changeset/base/211153 Log: Now that the uplcom(4) driver can autodetect the chipset type, sync the list of devices supported by uplcom(4) with the following sources: NetBSD src/sys/dev/usb/uplcom.c 1.70 OpenBSD src/sys/dev/usb/uplcom.c 1.52 Linux drivers/usb/serial/pl2303.h from kernel 2.6.35 BeOS usb_serial/driver.c 1.32 Give several devices better descriptions, and rename PROLIFIC2 -> NETINDEX while here to match everybody else. MFC after: 6 weeks (after r211111) Modified: head/sys/dev/usb/serial/uplcom.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/uplcom.c ============================================================================== --- head/sys/dev/usb/serial/uplcom.c Tue Aug 10 18:58:06 2010 (r211152) +++ head/sys/dev/usb/serial/uplcom.c Tue Aug 10 19:13:11 2010 (r211153) @@ -249,29 +249,63 @@ static struct ucom_callback uplcom_callb { USB_VENDOR(USB_VENDOR_##v), USB_PRODUCT(USB_PRODUCT_##v##_##p) } static const struct usb_device_id uplcom_devs[] = { + UPLCOM_DEV(ACERP, S81), /* BenQ S81 phone */ + UPLCOM_DEV(ADLINK, ND6530), /* ADLINK ND-6530 USB-Serial */ + UPLCOM_DEV(ALCATEL, OT535), /* Alcatel One Touch 535/735 */ + UPLCOM_DEV(ALCOR, AU9720), /* Alcor AU9720 USB 2.0-RS232 */ + UPLCOM_DEV(ANCHOR, SERIAL), /* Anchor Serial adapter */ UPLCOM_DEV(ATEN, UC232A), /* PLANEX USB-RS232 URS-03 */ UPLCOM_DEV(BELKIN, F5U257), /* Belkin F5U257 */ UPLCOM_DEV(COREGA, CGUSBRS232R), /* Corega CG-USBRS232R */ + UPLCOM_DEV(EPSON, CRESSI_EDY), /* Cressi Edy diving computer */ UPLCOM_DEV(ELECOM, UCSGT), /* ELECOM UC-SGT */ UPLCOM_DEV(ELECOM, UCSGT0), /* ELECOM UC-SGT */ UPLCOM_DEV(HAL, IMR001), /* HAL Corporation Crossam2+USB */ + UPLCOM_DEV(HP, LD220), /* HP LD220 POS Display */ UPLCOM_DEV(IODATA, USBRSAQ), /* I/O DATA USB-RSAQ */ UPLCOM_DEV(IODATA, USBRSAQ5), /* I/O DATA USB-RSAQ5 */ + UPLCOM_DEV(ITEGNO, WM1080A), /* iTegno WM1080A GSM/GFPRS modem */ + UPLCOM_DEV(ITEGNO, WM2080A), /* iTegno WM2080A CDMA modem */ + UPLCOM_DEV(LEADTEK, 9531), /* Leadtek 9531 GPS */ + UPLCOM_DEV(MICROSOFT, 700WX), /* Microsoft Palm 700WX */ UPLCOM_DEV(MOBILEACTION, MA620), /* Mobile Action MA-620 Infrared Adapter */ + UPLCOM_DEV(NETINDEX, WS002IN), /* Willcom W-S002IN */ + UPLCOM_DEV(NOKIA2, CA42), /* Nokia CA-42 cable */ + UPLCOM_DEV(OTI, DKU5), /* OTI DKU-5 cable */ + UPLCOM_DEV(PANASONIC, TYTP50P6S), /* Panasonic TY-TP50P6-S flat screen */ + UPLCOM_DEV(PLX, CA42), /* PLX CA-42 clone cable */ + UPLCOM_DEV(PROLIFIC, ALLTRONIX_GPRS), /* Alltronix ACM003U00 modem */ + UPLCOM_DEV(PROLIFIC, ALDIGA_AL11U), /* AlDiga AL-11U modem */ + UPLCOM_DEV(PROLIFIC, DCU11), /* DCU-11 Phone Cable */ + UPLCOM_DEV(PROLIFIC, HCR331), /* HCR331 Card Reader */ + UPLCOM_DEV(PROLIFIC, MICROMAX_610U), /* Micromax 610U modem */ UPLCOM_DEV(PROLIFIC, PHAROS), /* Prolific Pharos */ - UPLCOM_DEV(PROLIFIC, PL2303), /* Generic */ + UPLCOM_DEV(PROLIFIC, PL2303), /* Generic adapter */ UPLCOM_DEV(PROLIFIC, RSAQ2), /* I/O DATA USB-RSAQ2 */ UPLCOM_DEV(PROLIFIC, RSAQ3), /* I/O DATA USB-RSAQ3 */ - UPLCOM_DEV(PROLIFIC2, WSIM), /* Willcom W-SIM */ + UPLCOM_DEV(PROLIFIC2, PL2303), /* Prolific adapter */ UPLCOM_DEV(RADIOSHACK, USBCABLE), UPLCOM_DEV(RATOC, REXUSB60), /* RATOC REX-USB60 */ UPLCOM_DEV(SAGEM, USBSERIAL), /* Sagem USB-Serial Controller */ + UPLCOM_DEV(SAMSUNG, I330), /* Samsung I330 phone cradle */ + UPLCOM_DEV(SANWA, KB_USB2), /* Sanwa KB-USB2 Multimeter cable */ + UPLCOM_DEV(SIEMENS3, EF81), /* Seimens EF81 */ + UPLCOM_DEV(SIEMENS3, SX1), /* Seimens SX1 */ + UPLCOM_DEV(SIEMENS3, X65), /* Seimens X65 */ + UPLCOM_DEV(SIEMENS3, X75), /* Seimens X75 */ UPLCOM_DEV(SITECOM, SERIAL), /* Sitecom USB to Serial */ - UPLCOM_DEV(SONYERICSSON, DCU10), /* Sony Ericsson USB Cable */ + UPLCOM_DEV(SMART, PL2303), /* SMART Technologies */ + UPLCOM_DEV(SONY, QN3), /* Sony QN3 phone cable */ + UPLCOM_DEV(SONYERICSSON, DATAPILOT), /* Sony Ericsson Datapilot */ + UPLCOM_DEV(SONYERICSSON, DCU10), /* Sony Ericsson DCU-10 Cable */ UPLCOM_DEV(SOURCENEXT, KEIKAI8), /* SOURCENEXT KeikaiDenwa 8 */ UPLCOM_DEV(SOURCENEXT, KEIKAI8_CHG), /* SOURCENEXT KeikaiDenwa 8 with charger */ + UPLCOM_DEV(SPEEDDRAGON, MS3303H), /* Speed Dragon USB-Serial */ + UPLCOM_DEV(SYNTECH, CPT8001C), /* Syntech CPT-8001C Barcode scanner */ UPLCOM_DEV(TDK, UHA6400), /* TDK USB-PHS Adapter UHA6400 */ + UPLCOM_DEV(TDK, UPA9664), /* TDK USB-PHS Adapter UPA9664 */ UPLCOM_DEV(TRIPPLITE, U209), /* Tripp-Lite U209-000-R */ + UPLCOM_DEV(YCCABLE, PL2303), /* YC Cable USB-Serial */ }; #undef UPLCOM_DEV Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Aug 10 18:58:06 2010 (r211152) +++ head/sys/dev/usb/usbdevs Tue Aug 10 19:13:11 2010 (r211153) @@ -372,6 +372,7 @@ vendor GRIFFIN 0x077d Griffin Technolog vendor SANDISK 0x0781 SanDisk vendor JENOPTIK 0x0784 Jenoptik vendor LOGITEC 0x0789 Logitec +vendor NOKIA2 0x078b Nokia vendor BRIMAX 0x078e Brimax vendor AXIS 0x0792 Axis Communications vendor ABL 0x0794 ABL Electronics @@ -495,9 +496,11 @@ vendor TEKRAM 0x0b3b Tekram Technology vendor HAL 0x0b41 HAL Corporation vendor EMS 0x0b43 EMS Production vendor NEC2 0x0b62 NEC +vendor ADLINK 0x0b63 ADLINK Technoligy, Inc. vendor ATI2 0x0b6f ATI vendor ZEEVO 0x0b7a Zeevo, Inc. vendor KURUSUGAWA 0x0b7e Kurusugawa Electronics, Inc. +vendor SMART 0x0b8c Smart Technologies vendor ASIX 0x0b95 ASIX Electronics vendor O2MICRO 0x0b97 O2 Micro, Inc. vendor USR 0x0baf U.S. Robotics @@ -575,9 +578,10 @@ vendor SERVERWORKS 0x1166 ServerWorks vendor DLINK3 0x1186 Dlink vendor ACERCM 0x1189 Acer Communications & Multimedia vendor SIERRA 0x1199 Sierra Wireless +vendor SANWA 0x11ad Sanwa Electric Instrument Co., Ltd. vendor TOPFIELD 0x11db Topfield Co., Ltd vendor SIEMENS3 0x11f5 Siemens -vendor PROLIFIC2 0x11f6 Prolific +vendor NETINDEX 0x11f6 NetIndex vendor ALCATEL 0x11f7 Alcatel vendor UNKNOWN3 0x1233 Unknown vendor vendor TSUNAMI 0x1241 Tsunami @@ -690,6 +694,7 @@ vendor WCH 0x4348 QinHeng Electronics vendor ACEECA 0x4766 Aceeca vendor AVERATEC 0x50c2 Averatec vendor SWEEX 0x5173 Sweex +vendor PROLIFIC2 0x5372 Prolific Technologies vendor ONSPEC2 0x55aa OnSpec Electronic Inc. vendor ZINWELL 0x5a57 Zinwell vendor SITECOM 0x6189 Sitecom @@ -799,6 +804,7 @@ product ACERP ACERSCAN_620U 0x2060 Acers product ACERP ACERSCAN_4300U 0x20b0 Benq 3300U/4300U product ACERP ACERSCAN_640BT 0x20be Acerscan 640BT product ACERP ACERSCAN_1240U 0x20c0 Acerscan 1240U +product ACERP S81 0x4027 BenQ S81 phone product ACERP H10 0x4068 AWL400 Wireless Adapter product ACERP ATAPI 0x6003 ATA/ATAPI Adapter product ACERP AWL300 0x9000 AWL300 Wireless Adapter @@ -829,6 +835,9 @@ product ADAPTEC AWN8020 0x0020 AWN-8020 /* Addtron products */ product ADDTRON AWU120 0xff31 AWU-120 +/* ADLINK Texhnology products */ +product ADLINK ND6530 0x6530 ND-6530 USB-Serial + /* ADMtek products */ product ADMTEK PEGASUSII_4 0x07c2 AN986A Ethernet product ADMTEK PEGASUS 0x0986 AN986 Ethernet @@ -888,6 +897,9 @@ product AIRTIES RT3070 0x2310 RT3070 /* AKS products */ product AKS USBHASP 0x0001 USB-HASP 0.06 +/* Alcatel products */ +product ALCATEL OT535 0x02df One Touch 535/735 + /* Alcor Micro, Inc. products */ product ALCOR2 KBD_HUB 0x2802 Kbd Hub @@ -899,6 +911,7 @@ product ALCOR AU9814 0x9215 AU9814 Hub product ALCOR UMCR_9361 0x9361 USB Multimedia Card Reader product ALCOR SM_KBD 0x9410 MicroConnectors/StrongMan Keyboard product ALCOR NEC_KBD_HUB 0x9472 NEC Kbd Hub +product ALCOR AU9720 0x9720 USB2 - RS-232 product ALCOR AU6390 0x6390 AU6390 USB-IDE converter /* Alink products */ @@ -957,6 +970,7 @@ product AMIT RT2870_1 0x0012 RT2870 product AMIT2 RT2870 0x0008 RT2870 /* Anchor products */ +product ANCHOR SERIAL 0x2008 Serial product ANCHOR EZUSB 0x2131 EZUSB product ANCHOR EZLINK 0x2720 EZLINK @@ -1507,6 +1521,7 @@ product EPSON 1270 0x0120 Perfection 12 product EPSON 2480 0x0121 Perfection 2480 scanner product EPSON 3590 0x0122 Perfection 3590 scanner product EPSON 4990 0x012a Perfection 4990 Photo scanner +product EPSON CRESSI_EDY 0x0521 Cressi Edy diving computer product EPSON STYLUS_875DC 0x0601 Stylus Photo 875DC Card Reader product EPSON STYLUS_895 0x0602 Stylus Photo 895 Card Reader product EPSON CX5400 0x0808 CX5400 scanner @@ -1743,6 +1758,7 @@ product HP HS2300 0x1e1d HS2300 HSDPA product HP 640C 0x2004 DeskJet 640c product HP 4670V 0x3005 ScanJet 4670v product HP P1100 0x3102 Photosmart P1100 +product HP LD220 0x3524 LD220 POS Display product HP OJ4215 0x3d11 OfficeJet 4215 product HP HN210E 0x811c Ethernet HN210E product HP2 C500 0x6002 PhotoSmart C500 @@ -1884,6 +1900,10 @@ product IODATA2 USB2SC 0x0a09 USB2.0-SC product IOMEGA ZIP100 0x0001 Zip 100 product IOMEGA ZIP250 0x0030 Zip 250 +/* iTegno products */ +product ITEGNO WM1080A 0x1080 WM1080A GSM/GPRS modem +product ITEGNO WM2080A 0x2080 WM2080A CDMA modem + /* Ituner networks products */ product ITUNERNET USBLCD2X20 0x0002 USB-LCD 2x20 product ITUNERNET USBLCD4X20 0xc001 USB-LCD 4x20 @@ -1983,6 +2003,9 @@ product KYOCERA2 KPC680 0x180a Qualcomm product LACIE HD 0xa601 Hard Disk product LACIE CDRW 0xa602 CD R/W +/* Leadtek products */ +product LEADTEK 9531 0x2101 9531 GPS + /* Lexar products */ product LEXAR JUMPSHOT 0x0001 jumpSHOT CompactFlash Reader product LEXAR CF_READER 0xb002 USB CF Reader @@ -2144,6 +2167,7 @@ product MICROSOFT INETPRO2 0x002b Intern product MICROSOFT INTELLIMOUSE5 0x0039 IntelliMouse 1.1 5-Button Mouse product MICROSOFT WHEELMOUSE 0x0040 Wheel Mouse Optical product MICROSOFT MN510 0x006e MN510 Wireless +product MICROSOFT 700WX 0x0079 Palm 700WX product MICROSOFT MN110 0x007a 10/100 USB NIC product MICROSOFT WLINTELLIMOUSE 0x008c Wireless Optical IntelliMouse product MICROSOFT WLNOTEBOOK 0x00b9 Wireless Optical Mouse (Model 1023) @@ -2278,6 +2302,9 @@ product NETGEAR3 WPN111 0x5f00 WPN111 product NETGEAR3 WPN111_NF 0x5f01 WPN111 (no firmware) product NETGEAR3 WPN111_2 0x5f02 WPN111 +/* NetIndex products */ +product NETINDEX WS002IN 0x2001 Willcom WS002IN + /* Nikon products */ product NIKON E990 0x0102 Digital Camera E990 product NIKON LS40 0x4000 CoolScan LS40 ED @@ -2289,6 +2316,7 @@ product NOVATECH RT2573 0x9021 RT2573 /* Nokia products */ product NOKIA N958GB 0x0070 Nokia N95 8GBc +product NOKIA2 CA42 0x1234 CA-42 cable /* Novatel Wireless products */ product NOVATEL V640 0x1100 Merlin V620 @@ -2398,6 +2426,9 @@ product OQO BT01 0x0003 model 01 Blueto product OQO ETHER01PLUS 0x7720 model 01+ Ethernet product OQO ETHER01 0x8150 model 01 Ethernet interface +/* Ours Technology Inc. */ +product OTI DKU5 0x6858 DKU-5 Serial + /* Owen.ru products */ product OWEN AC4 0x0004 AC4 USB-RS485 converter @@ -2421,6 +2452,7 @@ product PANASONIC KXLRW32AN 0x0d09 CD-R product PANASONIC KXLCB20AN 0x0d0a CD-R Drive KXL-CB20AN product PANASONIC KXLCB35AN 0x0d0e DVD-ROM & CD-R/RW product PANASONIC SDCAAE 0x1b00 MultiMediaCard +product PANASONIC TYTP50P6S 0x3900 TY-TP50P6-S 50in Touch Panel /* PARA Industrial products */ product PARA RT3070 0x8888 RT3070 @@ -2518,14 +2550,19 @@ product PRIMAX HP_RH304AA 0x4d17 HP RH30 product PROLIFIC PL2301 0x0000 PL2301 Host-Host interface product PROLIFIC PL2302 0x0001 PL2302 Host-Host interface product PROLIFIC RSAQ2 0x04bb PL2303 Serial (IODATA USB-RSAQ2) +product PROLIFIC ALLTRONIX_GPRS 0x0609 Alltronix ACM003U00 modem +product PROLIFIC ALDIGA_AL11U 0x0611 AlDiga AL-11U modem +product PROLIFIC MICROMAX_610U 0x0612 Micromax 610U +product PROLIFIC DCU11 0x1234 DCU-11 Phone Cable product PROLIFIC PL2303 0x2303 PL2303 Serial (ATEN/IOGEAR UC232A) product PROLIFIC PL2305 0x2305 Parallel printer product PROLIFIC ATAPI4 0x2307 ATAPI-4 Controller product PROLIFIC PL2501 0x2501 PL2501 Host-Host interface product PROLIFIC PL2506 0x2506 PL2506 USB to IDE Bridge +product PROLIFIC HCR331 0x331a HCR331 Hybrid Card Reader product PROLIFIC PHAROS 0xaaa0 Prolific Pharos product PROLIFIC RSAQ3 0xaaa2 PL2303 Serial Adapter (IODATA USB-RSAQ3) -product PROLIFIC2 WSIM 0x2001 Willcom WSIM +product PROLIFIC2 PL2303 0x2303 PL2303 Serial Adapter /* Putercom products */ product PUTERCOM UPA100 0x047e USB-1284 BRIDGE @@ -2661,6 +2698,10 @@ product RALINK RT8070 0x8070 RT8070 product RALINK RT2570_3 0x9020 RT2500USB Wireless Adapter product RALINK RT2573_2 0x9021 RT2501USB Wireless Adapter +/* RATOC Systems products */ +product RATOC REXUSB60 0xb000 USB serial adapter REX-USB60 +product RATOC REXUSB60F 0xb020 USB serial adapter REX-USB60F + /* ReakTek products */ /* Green House and CompUSA OEM this part */ product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet @@ -2701,8 +2742,8 @@ product SAGEM XG76NA 0x0062 XG-76NA product SAMSUNG ML6060 0x3008 ML-6060 laser printer product SAMSUNG YP_U2 0x5050 YP-U2 MP3 Player product SAMSUNG YP_U4 0x5092 YP-U4 MP3 Player - product SAMSUNG I500 0x6601 I500 Palm USB Phone +product SAMSUNG I330 0x8001 I330 phone cradle product SAMSUNG2 RT2870_1 0x2018 RT2870 /* Samsung Techwin products */ @@ -2719,6 +2760,9 @@ product SANDISK SDCZ2_256 0x7104 Cruzer product SANDISK SDCZ4_128 0x7112 Cruzer Micro 128MB product SANDISK SDCZ4_256 0x7113 Cruzer Micro 256MB +/* Sanwa Electric Instrument Co., Ltd. products */ +product SANWA KB_USB2 0x0701 KB-USB2 multimeter cable + /* Sanyo Electric products */ product SANYO SCP4900 0x0701 Sanyo SCP-4900 USB Phone @@ -2780,6 +2824,7 @@ product SIEMENS2 WL54G 0x3c06 54g USB N product SIEMENS3 SX1 0x0001 SX1 product SIEMENS3 X65 0x0003 X65 product SIEMENS3 X75 0x0004 X75 +product SIEMENS3 EF81 0x0005 EF81 /* Sierra Wireless products */ product SIERRA EM5625 0x0017 EM5625 @@ -2954,6 +2999,9 @@ product SITECOMEU WL113R2 0x9712 WL-113 product SKANHEX MD_7425 0x410a MD 7425 Camera product SKANHEX SX_520Z 0x5200 SX 520z Camera +/* Smart Technologies products */ +product SMART PL2303 0x2303 Serial adapter + /* SmartBridges products */ product SMARTBRIDGES SMARTLINK 0x0001 SmartLink USB Ethernet product SMARTBRIDGES SMARTNIC 0x0003 smartNIC 2 PnP Ethernet @@ -2993,9 +3041,11 @@ product SONY CLIE_NX60 0x00da Sony Clie product SONY CLIE_TH55 0x0144 Sony Clie th55 product SONY CLIE_TJ37 0x0169 Sony Clie tj37 product SONY RF_RECEIVER 0x01db Sony RF mouse/kbd Receiver VGP-WRC1 +product SONY QN3 0x0437 Sony QN3 CMD-Jxx phone cable /* Sony Ericsson products */ -product SONYERICSSON DCU10 0x0528 USB Cable +product SONYERICSSON DCU10 0x0528 DCU-10 Phone Data Cable +product SONYERICSSON DATAPILOT 0x2003 Datapilot Phone Cable /* SOURCENEXT products */ product SOURCENEXT KEIKAI8 0x039f KeikaiDenwa 8 @@ -3006,6 +3056,9 @@ product SPARKLAN RT2573 0x0004 RT2573 product SPARKLAN RT2870_1 0x0006 RT2870 product SPARKLAN RT3070 0x0010 RT3070 +/* Speed Dragon Multimedia products */ +product SPEEDDRAGON MS3303H 0x110b MS3303H Serial + /* Sphairon Access Systems GmbH products */ product SPHAIRON UB801R 0x0110 UB801R @@ -3059,6 +3112,7 @@ product SUN KBD_HUB 0x100e Kbd Hub product SUPERTOP IDE 0x6600 USB-IDE /* Syntech products */ +product SYNTECH CPT8001C 0x0001 CPT-8001C Barcode scanner product SYNTECH CYPHERLAB100 0x1000 CipherLab USB Barcode Scanner /* Teclast products */ @@ -3280,6 +3334,9 @@ product YAMAHA RTW65I 0x4002 NetVolante product YANO U640MO 0x0101 U640MO-03 product YANO FW800HD 0x05fc METALWEAR-HDD +/* Y.C. Cable products */ +product YCCABLE PL2303 0x0fba PL2303 Serial + /* Y-E Data products */ product YEDATA FLASHBUSTERU 0x0000 Flashbuster-U From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 19:50:51 2010 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 7F313106568A; Tue, 10 Aug 2010 19:50:51 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E0388FC15; Tue, 10 Aug 2010 19:50:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7AJopTx017831; Tue, 10 Aug 2010 19:50:51 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7AJopH6017829; Tue, 10 Aug 2010 19:50:51 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201008101950.o7AJopH6017829@svn.freebsd.org> From: Gabor Kovesdan Date: Tue, 10 Aug 2010 19:50:51 +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: r211154 - 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: Tue, 10 Aug 2010 19:50:51 -0000 Author: gabor Date: Tue Aug 10 19:50:51 2010 New Revision: 211154 URL: http://svn.freebsd.org/changeset/base/211154 Log: MFC r210255: - Add Latinamerican keymaps to sysinstall's Makefile so that it can find them [1] - While here, also add a missing Spanish entry PR: bin/67365 [1] Submitted by: Pedro F. Giffuni [1] Approved by: delphij (mentor) Modified: stable/8/usr.sbin/sysinstall/Makefile Directory Properties: stable/8/usr.sbin/sysinstall/ (props changed) Modified: stable/8/usr.sbin/sysinstall/Makefile ============================================================================== --- stable/8/usr.sbin/sysinstall/Makefile Tue Aug 10 19:13:11 2010 (r211153) +++ stable/8/usr.sbin/sysinstall/Makefile Tue Aug 10 19:50:51 2010 (r211154) @@ -108,8 +108,9 @@ KEYMAPS= be.iso bg.bds.ctrlcaps bg.phone ce.iso2 cs.latin2.qwertz danish.iso el.iso07 \ estonian.cp850 estonian.iso estonian.iso15 finnish.iso fr.iso \ german.iso gr.elot.acc gr.us101.acc hr.iso hu.iso2.101keys \ - it.iso icelandic.iso jp.106 norwegian.iso pl_PL.ISO8859-2 \ - pt.iso ru.koi8-r si.iso sk.iso2 spanish.iso swedish.iso \ + it.iso icelandic.iso jp.106 latinamerican latinamerican.iso.acc \ + norwegian.iso pl_PL.ISO8859-2 \ + pt.iso ru.koi8-r si.iso sk.iso2 spanish.iso spanish.iso.acc swedish.iso \ swissfrench.iso \ swissgerman.iso ua.koi8-u ua.koi8-u.shift.alt uk.iso us.dvorak \ us.iso us.pc-ctrl us.unix From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 19:56:15 2010 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 BD109106566B for ; Tue, 10 Aug 2010 19:56:15 +0000 (UTC) (envelope-from olli@fromme.com) Received: from haluter.fromme.com (haluter.fromme.com [212.17.241.231]) by mx1.freebsd.org (Postfix) with ESMTP id 26EA18FC0C for ; Tue, 10 Aug 2010 19:56:14 +0000 (UTC) Received: from haluter.fromme.com (irc_sucks@localhost [127.0.0.1]) by haluter.fromme.com (8.14.3/8.14.3) with ESMTP id o7AJu6SH044775; Tue, 10 Aug 2010 21:56:13 +0200 (CEST) (envelope-from olli@fromme.com) Received: (from olli@localhost) by haluter.fromme.com (8.14.3/8.14.3/Submit) id o7AJu5ms044774; Tue, 10 Aug 2010 21:56:05 +0200 (CEST) (envelope-from olli) From: Oliver Fromme Message-Id: <201008101956.o7AJu5ms044774@haluter.fromme.com> To: imp@bsdimp.com (M. Warner Losh) Date: Tue, 10 Aug 2010 21:56:05 +0200 (CEST) In-Reply-To: <20100810.120103.69891821625677670.imp@bsdimp.com> X-Mailer: ELM [version 2.5 PL8] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (haluter.fromme.com [127.0.0.1]); Tue, 10 Aug 2010 21:56:13 +0200 (CEST) Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@FreeBSD.org, svn-src-head@FreeBSD.org, des@des.no Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 19:56:15 -0000 M. Warner Losh wrote: > /* > * Macros to cast a struct sockaddr, or parts thereof. struct > * sockaddr's alginment is loose to later be cast to a sockaddr_in or > * sockaddr_in6. On architectures with strict alignment requirements, > * this leads to compiler warnings because the compiler doesn't know > * the ABI guarantees proper alignment. > */ > > But this leads me to think that the right fix might be: > > /* > * Structure used by kernel to store most > * addresses. > */ > struct sockaddr { > unsigned char sa_len; /* total length */ > sa_family_t sa_family; /* address family */ > char sa_data[14]; /* actually longer; address value */ > } __aligned(4); > > since that's what the ABI defines.... Yes, that would solve most of the problems, at least the ones related to struct sockaddr. Can we make that change to struct sockaddr, or does it cause unwanted side-effects? I could do a full "make universe" to test it, but it would probably take two days on my 9-current machine. > : > : @@ -2410,8 +2419,8 @@ > : > : } > : > : reject = 0; > : > : for (j = 0; j < 16; j += 4) { > : > : - if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m6p->sin6_addr.s6_addr[j]) > : > : - != *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) { > : > : + if ((UINT32_CAST(sin6->sin6_addr.s6_addr[j]) & UINT32_CAST(m6p->sin6_addr.s6_addr[j])) > : > : + != UINT32_CAST(a6p->sin6_addr.s6_addr[j])) { > : > : ++reject; > : > : break; > : > : } > : > : > : > : > : > > : > Why 16 and 4 here? What's so magical about them? > : > : 4 = bytes in a uint32_t, 16 = bytes in an ipv6 address. > > Isn't that better served by 'sizeof(uint32_t)' and > 'sizeof(ipv6_addr_t)'? Yes, probably. Best regards Oliver -- ``We are all but compressed light'' (Albert Einstein) From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 20:28:55 2010 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 56090106566B; Tue, 10 Aug 2010 20:28:55 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 125E08FC0C; Tue, 10 Aug 2010 20:28:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o7AKJQG4078413; Tue, 10 Aug 2010 14:19:26 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 10 Aug 2010 14:19:58 -0600 (MDT) Message-Id: <20100810.141958.923962171922746057.imp@bsdimp.com> To: olli@fromme.com From: "M. Warner Losh" In-Reply-To: <201008101956.o7AJu5ms044774@haluter.fromme.com> References: <20100810.120103.69891821625677670.imp@bsdimp.com> <201008101956.o7AJu5ms044774@haluter.fromme.com> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@FreeBSD.org, svn-src-head@FreeBSD.org, des@des.no Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 20:28:55 -0000 In message: <201008101956.o7AJu5ms044774@haluter.fromme.com> Oliver Fromme writes: : : M. Warner Losh wrote: : > /* : > * Macros to cast a struct sockaddr, or parts thereof. struct : > * sockaddr's alginment is loose to later be cast to a sockaddr_in or : > * sockaddr_in6. On architectures with strict alignment requirements, : > * this leads to compiler warnings because the compiler doesn't know : > * the ABI guarantees proper alignment. : > */ : > : > But this leads me to think that the right fix might be: : > : > /* : > * Structure used by kernel to store most : > * addresses. : > */ : > struct sockaddr { : > unsigned char sa_len; /* total length */ : > sa_family_t sa_family; /* address family */ : > char sa_data[14]; /* actually longer; address value */ : > } __aligned(4); : > : > since that's what the ABI defines.... : : Yes, that would solve most of the problems, at least the ones : related to struct sockaddr. : : Can we make that change to struct sockaddr, or does it cause : unwanted side-effects? : : I could do a full "make universe" to test it, but it would : probably take two days on my 9-current machine. Just do it on MIPS. You'll find that a number of structures are potentially already allocated with less than required alignment. There's about a dozen places in the tree that would start to fail if we did this, or the stronger form of __aligned(8). We could add that to the other structures, but then we're breaking ABI rules, I think. Warner From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 20:41:23 2010 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 19C5F106564A; Tue, 10 Aug 2010 20:41:23 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id CB37F8FC12; Tue, 10 Aug 2010 20:41:22 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 960AB1FFC33; Tue, 10 Aug 2010 20:41:21 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 560568455C; Tue, 10 Aug 2010 22:41:21 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "M. Warner Losh" References: <201008101623.o7AGNs7I042679@haluter.fromme.com> <20100810.110642.335141733495090585.imp@bsdimp.com> <86sk2m1hsj.fsf@ds4.des.no> <20100810.120103.69891821625677670.imp@bsdimp.com> Date: Tue, 10 Aug 2010 22:41:20 +0200 In-Reply-To: <20100810.120103.69891821625677670.imp@bsdimp.com> (M. Warner Losh's message of "Tue, 10 Aug 2010 12:01:03 -0600 (MDT)") Message-ID: <8639ump5e7.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@fromme.com, olli@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 20:41:23 -0000 "M. Warner Losh" writes: > Dag-Erling Sm=C3=B8rgrav writes: > > "M. Warner Losh" writes: > > > /* > > > * Macros to cast a struct sockaddr, or parts thereof. > > > * On architectures with strict alignment requirements, the compiler > > > * can bogusly warn about alignment problems since its static analysis > > > * is insufficient for it to know that with the APIs used, there > > > * really is no alignment issue. > > > */ > > That's a bit harsh on the compiler, don't you think? It never pays to > > hurt the compiler's feelings :) > > /* > * Macros to cast a struct sockaddr, or parts thereof. struct > * sockaddr's alginment is loose to later be cast to a sockaddr_in or > * sockaddr_in6. On architectures with strict alignment requirements, > * this leads to compiler warnings because the compiler doesn't know > * the ABI guarantees proper alignment. > */ That sounds more like what I had in mind (my point being that the compiler is *right* to not make any such assumptions unless we say it's safe to do so) > But this leads me to think that the right fix might be: > > /* > * Structure used by kernel to store most > * addresses. > */ > struct sockaddr { > unsigned char sa_len; /* total length */ > sa_family_t sa_family; /* address family */ > char sa_data[14]; /* actually longer; address value */ > } __aligned(4); > > since that's what the ABI defines.... Yes, unfortunately that's not portable. I like the way it's done in sockaddr_storage, but we can't do that here except possibly using anonymous unions, which aren't portable either. > > > Why 16 and 4 here? What's so magical about them? > > 4 =3D bytes in a uint32_t, 16 =3D bytes in an ipv6 address. > Isn't that better served by 'sizeof(uint32_t)' and > 'sizeof(ipv6_addr_t)'? Probably... DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 21:06:05 2010 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 B71701065687; Tue, 10 Aug 2010 21:06:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4B0D88FC13; Tue, 10 Aug 2010 21:06:04 +0000 (UTC) Received: from c122-106-147-41.carlnfd1.nsw.optusnet.com.au (c122-106-147-41.carlnfd1.nsw.optusnet.com.au [122.106.147.41]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7AL5rx2024604 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 11 Aug 2010 07:05:53 +1000 Date: Wed, 11 Aug 2010 07:05:53 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: "M. Warner Losh" In-Reply-To: <20100810.120103.69891821625677670.imp@bsdimp.com> Message-ID: <20100811064553.G10707@delplex.bde.org> References: <201008101623.o7AGNs7I042679@haluter.fromme.com> <20100810.110642.335141733495090585.imp@bsdimp.com> <86sk2m1hsj.fsf@ds4.des.no> <20100810.120103.69891821625677670.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-108037158-1281474353=:10707" Cc: src-committers@freebsd.org, jilles@stack.nl, svn-src-all@freebsd.org, olli@fromme.com, olli@freebsd.org, svn-src-head@freebsd.org, des@des.no Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 21:06:05 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-108037158-1281474353=:10707 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Tue, 10 Aug 2010, M. Warner Losh wrote: > In message: <86sk2m1hsj.fsf@ds4.des.no> > Dag-Erling Sm=F8rgrav writes: > : "M. Warner Losh" writes: > : > /* > : > * Macros to cast a struct sockaddr, or parts thereof. > : > * On architectures with strict alignment requirements, the compiler > : > * can bogusly warn about alignment problems since its static analysi= s > : > * is insufficient for it to know that with the APIs used, there > : > * really is no alignment issue. > : > */ > : > : That's a bit harsh on the compiler, don't you think? It never pays to > : hurt the compiler's feelings :) > > /* > * Macros to cast a struct sockaddr, or parts thereof. struct > * sockaddr's alginment is loose to later be cast to a sockaddr_in or > * sockaddr_in6. On architectures with strict alignment requirements, > * this leads to compiler warnings because the compiler doesn't know > * the ABI guarantees proper alignment. > */ > > But this leads me to think that the right fix might be: > > /* > * Structure used by kernel to store most > * addresses. > */ > struct sockaddr { > =09unsigned char=09sa_len;=09=09/* total length */ > =09sa_family_t=09sa_family;=09/* address family */ > =09char=09=09sa_data[14];=09/* actually longer; address value */ > } __aligned(4); > > since that's what the ABI defines.... That's almost what I said to do a day or two ago. Not sure if 4 is correct= =2E The amd64 and i386 ABI's only requires 1. arm may (bogusly) require 4. The (POSIX) API requires struct sockaddr_storage to sufficient alignment for various things, including specifically casting of pointers to it into pointers to protocol-specific address structures, but it doesn't require this for struct sockaddr or stuct sockaddr_un. I checked a later version (2007 draft). Its requirement to cast struct sockaddr_un to struct sockaddr (NB: not the pointers) hasn't changed, and makes a little more sense to me now. I don't see how such a cast can succeed (unless the types are the same), but casting the pointers cannot work without any alignment requirements, while casting of whole objects can in some cases. Testing shows that casting a struct sockaddr_un to a struct sockaddr doesn't work at all, as expected: % gcc: % z.c: In function `foo': % z.c:10: error: conversion to non-scalar type requested %=20 % TenDRA (for C90 only) is much more verbose: % "z.c", line 10: Error: % [ISO C90 6.3.4]: Can't cast to the non-scalar type 'struct sockaddr'. % [ISO C90 6.3.4]: Illegal conversion from type 'struct sockaddr_un' to t= ype 'struct sockaddr'. % [ISO C90 6.3.4]: Can't perform this conversion using an explicit cast. This shows that structs cannot be cast even to the same type. Assignment of a struct sockaddr_un to a struct sockaddr would work if these types are the same, but that is not useful. POSIX's requirement is unimplementable. Bruce --0-108037158-1281474353=:10707-- From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 22:13:42 2010 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 17B1E106566C; Tue, 10 Aug 2010 22:13:42 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id B8E368FC08; Tue, 10 Aug 2010 22:13:41 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 5B49335A837; Wed, 11 Aug 2010 00:13:40 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 4863B1728C; Wed, 11 Aug 2010 00:13:40 +0200 (CEST) Date: Wed, 11 Aug 2010 00:13:40 +0200 From: Jilles Tjoelker To: Bruce Evans Message-ID: <20100810221340.GC27483@stack.nl> References: <201008101623.o7AGNs7I042679@haluter.fromme.com> <20100810.110642.335141733495090585.imp@bsdimp.com> <86sk2m1hsj.fsf@ds4.des.no> <20100810.120103.69891821625677670.imp@bsdimp.com> <20100811064553.G10707@delplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20100811064553.G10707@delplex.bde.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, olli@fromme.com, olli@freebsd.org, svn-src-head@freebsd.org, des@des.no, "M. Warner Losh" Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 10 Aug 2010 22:13:42 -0000 On Wed, Aug 11, 2010 at 07:05:53AM +1000, Bruce Evans wrote: > On Tue, 10 Aug 2010, M. Warner Losh wrote: > > > In message: <86sk2m1hsj.fsf@ds4.des.no> > > Dag-Erling Smørgrav writes: > > : "M. Warner Losh" writes: > > : > /* > > : > * Macros to cast a struct sockaddr, or parts thereof. > > : > * On architectures with strict alignment requirements, the compiler > > : > * can bogusly warn about alignment problems since its static analysis > > : > * is insufficient for it to know that with the APIs used, there > > : > * really is no alignment issue. > > : > */ > > : > > : That's a bit harsh on the compiler, don't you think? It never pays to > > : hurt the compiler's feelings :) > > > > /* > > * Macros to cast a struct sockaddr, or parts thereof. struct > > * sockaddr's alginment is loose to later be cast to a sockaddr_in or > > * sockaddr_in6. On architectures with strict alignment requirements, > > * this leads to compiler warnings because the compiler doesn't know > > * the ABI guarantees proper alignment. > > */ > > > > But this leads me to think that the right fix might be: > > > > /* > > * Structure used by kernel to store most > > * addresses. > > */ > > struct sockaddr { > > unsigned char sa_len; /* total length */ > > sa_family_t sa_family; /* address family */ > > char sa_data[14]; /* actually longer; address value */ > > } __aligned(4); > > > > since that's what the ABI defines.... > That's almost what I said to do a day or two ago. Not sure if 4 is correct. > The amd64 and i386 ABI's only requires 1. arm may (bogusly) require 4. > The (POSIX) API requires struct sockaddr_storage to sufficient alignment > for various things, including specifically casting of pointers to it > into pointers to protocol-specific address structures, but it doesn't > require this for struct sockaddr or stuct sockaddr_un. I checked a > later version (2007 draft). Its requirement to cast struct sockaddr_un > to struct sockaddr (NB: not the pointers) hasn't changed, and makes a > little more sense to me now. I don't see how such a cast can succeed > (unless the types are the same), but casting the pointers cannot work > without any alignment requirements, while casting of whole objects can > in some cases. > Testing shows that casting a struct sockaddr_un to a struct sockaddr > doesn't work at all, as expected: > % gcc: > % z.c: In function `foo': > % z.c:10: error: conversion to non-scalar type requested > % > % TenDRA (for C90 only) is much more verbose: > % "z.c", line 10: Error: > % [ISO C90 6.3.4]: Can't cast to the non-scalar type 'struct sockaddr'. > % [ISO C90 6.3.4]: Illegal conversion from type 'struct sockaddr_un' to type 'struct sockaddr'. > % [ISO C90 6.3.4]: Can't perform this conversion using an explicit cast. > This shows that structs cannot be cast even to the same type. Assignment > of a struct sockaddr_un to a struct sockaddr would work if these types are > the same, but that is not useful. POSIX's requirement is unimplementable. I think POSIX intended pointers to be cast, not the structures themselves. (In fact, there is one sentence about struct sockaddr_storage (in XBD 13 Headers ) that gets it right.) Then, POSIX's requirements can be summarized as struct sockaddr_storage * ---> { PS * } ---> struct sockaddr * where PS are protocol-specific sockaddr structures. Casts from left to right must be possible and must preserve the family field. So it seems that adding an alignment requirement to struct sockaddr requires that all other sockaddr structures have at least that alignment requirement. This may also require that the implementation use non-standard tricks to avoid strict-aliasing problems. This leaves casting a struct sockaddr * from getaddrinfo() to the appropriate protocol family's sockaddr as "does not necessarily work". Perhaps it is even sufficient that bind() and connect() accept getaddrinfo()'s pointers, so that the cast may indeed fail (the kernel copyin() imposes no alignment restriction). -- Jilles Tjoelker From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 22:45:59 2010 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 9E040106567C; Tue, 10 Aug 2010 22:45:59 +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 8CB458FC08; Tue, 10 Aug 2010 22:45:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7AMjxWc056809; Tue, 10 Aug 2010 22:45:59 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7AMjxIs056806; Tue, 10 Aug 2010 22:45:59 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201008102245.o7AMjxIs056806@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 10 Aug 2010 22:45: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: r211155 - in head: bin/sh tools/regression/bin/sh/expansion 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, 10 Aug 2010 22:45:59 -0000 Author: jilles Date: Tue Aug 10 22:45:59 2010 New Revision: 211155 URL: http://svn.freebsd.org/changeset/base/211155 Log: sh: Fix heap-based buffer overflow in pathname generation. The buffer for generated pathnames could be too small in some cases. It happened to be always at least PATH_MAX long, so there was never an overflow if the resulting pathnames would be usable. This bug may be abused if a script subjects input from an untrusted source to pathname generation, which a bad idea anyhow. Most shell scripts do not work on untrusted data. secteam@ says no advisory is necessary. PR: bin/148733 Reported by: Changming Sun snnn119 at gmail com MFC after: 10 days Added: head/tools/regression/bin/sh/expansion/pathname3.0 (contents, props changed) Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Tue Aug 10 19:50:51 2010 (r211154) +++ head/bin/sh/expand.c Tue Aug 10 22:45:59 2010 (r211155) @@ -1082,8 +1082,8 @@ ifsbreakup(char *string, struct arglist * should be escapes. The results are stored in the list exparg. */ -STATIC char *expdir; - +STATIC char expdir[PATH_MAX]; +#define expdir_end (expdir + sizeof(expdir)) STATIC void expandmeta(struct strlist *str, int flag __unused) @@ -1106,14 +1106,7 @@ expandmeta(struct strlist *str, int flag } savelastp = exparg.lastp; INTOFF; - if (expdir == NULL) { - int i = strlen(str->text); - expdir = ckmalloc(i < 2048 ? 2048 : i); /* XXX */ - } - expmeta(expdir, str->text); - ckfree(expdir); - expdir = NULL; INTON; if (exparg.lastp == savelastp) { /* @@ -1202,6 +1195,8 @@ expmeta(char *enddir, char *name) *enddir++ = *p; if (*p == '\0') break; + if (enddir == expdir_end) + return; } if (metaflag == 0 || lstat(expdir, &statb) >= 0) addfname(expdir); @@ -1216,6 +1211,8 @@ expmeta(char *enddir, char *name) if (*p == CTLESC) p++; *enddir++ = *p++; + if (enddir == expdir_end) + return; } } if (enddir == expdir) { @@ -1249,15 +1246,17 @@ expmeta(char *enddir, char *name) if (dp->d_name[0] == '.' && ! matchdot) continue; if (patmatch(start, dp->d_name, 0)) { - if (atend) { - scopy(dp->d_name, enddir); + if (enddir + dp->d_namlen + 1 > expdir_end) + continue; + memcpy(enddir, dp->d_name, dp->d_namlen + 1); + if (atend) addfname(expdir); - } else { - for (p = enddir, q = dp->d_name; - (*p++ = *q++) != '\0';) + else { + if (enddir + dp->d_namlen + 2 > expdir_end) continue; - p[-1] = '/'; - expmeta(p, endname); + enddir[dp->d_namlen] = '/'; + enddir[dp->d_namlen + 1] = '\0'; + expmeta(enddir + dp->d_namlen + 1, endname); } } } Added: head/tools/regression/bin/sh/expansion/pathname3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/pathname3.0 Tue Aug 10 22:45:59 2010 (r211155) @@ -0,0 +1,29 @@ +# $FreeBSD$ + +v=12345678 +v=$v$v$v$v +v=$v$v$v$v +v=$v$v$v$v +v=$v$v$v$v +v=$v$v$v$v +# 8192 bytes +v=${v##???} +[ /*/$v = "/*/$v" ] || exit 1 + +s=//// +s=$s$s$s$s +s=$s$s$s$s +s=$s$s$s$s +s=$s$s$s$s +# 1024 bytes +s=${s##??????????} +[ /var/empt[y]/$s/$v = "/var/empt[y]/$s/$v" ] || exit 2 +while [ ${#s} -lt 1034 ]; do + set -- /.${s}et[c] + [ ${#s} -gt 1018 ] || [ "$1" = /.${s}etc ] || exit 3 + set -- /.${s}et[c]/ + [ ${#s} -gt 1017 ] || [ "$1" = /.${s}etc/ ] || exit 4 + set -- /.${s}et[c]/. + [ ${#s} -gt 1016 ] || [ "$1" = /.${s}etc/. ] || exit 5 + s=$s/ +done From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 22:57:44 2010 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 3C6041065686; Tue, 10 Aug 2010 22:57:44 +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 2A2488FC14; Tue, 10 Aug 2010 22:57:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7AMvipi059481; Tue, 10 Aug 2010 22:57:44 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7AMvi9w059468; Tue, 10 Aug 2010 22:57:44 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008102257.o7AMvi9w059468@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 10 Aug 2010 22:57: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: r211156 - in head/tools/regression/fstest/tests: mkdir open rename unlink 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, 10 Aug 2010 22:57:44 -0000 Author: pjd Date: Tue Aug 10 22:57:43 2010 New Revision: 211156 URL: http://svn.freebsd.org/changeset/base/211156 Log: More tests, mostly related to devices and sockets. Modified: head/tools/regression/fstest/tests/mkdir/10.t head/tools/regression/fstest/tests/open/22.t head/tools/regression/fstest/tests/rename/00.t head/tools/regression/fstest/tests/rename/06.t head/tools/regression/fstest/tests/rename/07.t head/tools/regression/fstest/tests/rename/10.t head/tools/regression/fstest/tests/rename/13.t head/tools/regression/fstest/tests/rename/14.t head/tools/regression/fstest/tests/rename/15.t head/tools/regression/fstest/tests/rename/20.t head/tools/regression/fstest/tests/unlink/00.t head/tools/regression/fstest/tests/unlink/11.t Modified: head/tools/regression/fstest/tests/mkdir/10.t ============================================================================== --- head/tools/regression/fstest/tests/mkdir/10.t Tue Aug 10 22:45:59 2010 (r211155) +++ head/tools/regression/fstest/tests/mkdir/10.t Tue Aug 10 22:57:43 2010 (r211156) @@ -6,7 +6,7 @@ desc="mkdir returns EEXIST if the named dir=`dirname $0` . ${dir}/../misc.sh -echo "1..12" +echo "1..21" n0=`namegen` @@ -25,3 +25,15 @@ expect 0 unlink ${n0} expect 0 mkfifo ${n0} 0644 expect EEXIST mkdir ${n0} 0755 expect 0 unlink ${n0} + +expect 0 mknod ${n0} b 0644 1 2 +expect EEXIST mkdir ${n0} 0755 +expect 0 unlink ${n0} + +expect 0 mknod ${n0} c 0644 1 2 +expect EEXIST mkdir ${n0} 0755 +expect 0 unlink ${n0} + +expect 0 bind ${n0} +expect EEXIST mkdir ${n0} 0755 +expect 0 unlink ${n0} Modified: head/tools/regression/fstest/tests/open/22.t ============================================================================== --- head/tools/regression/fstest/tests/open/22.t Tue Aug 10 22:45:59 2010 (r211155) +++ head/tools/regression/fstest/tests/open/22.t Tue Aug 10 22:57:43 2010 (r211156) @@ -6,7 +6,7 @@ desc="open returns EEXIST when O_CREAT a dir=`dirname $0` . ${dir}/../misc.sh -echo "1..12" +echo "1..21" n0=`namegen` @@ -25,3 +25,15 @@ expect 0 unlink ${n0} expect 0 symlink test ${n0} expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 expect 0 unlink ${n0} + +expect 0 mknod ${n0} b 0644 1 2 +expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 +expect 0 unlink ${n0} + +expect 0 mknod ${n0} c 0644 1 2 +expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 +expect 0 unlink ${n0} + +expect 0 bind ${n0} +expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 +expect 0 unlink ${n0} Modified: head/tools/regression/fstest/tests/rename/00.t ============================================================================== --- head/tools/regression/fstest/tests/rename/00.t Tue Aug 10 22:45:59 2010 (r211155) +++ head/tools/regression/fstest/tests/rename/00.t Tue Aug 10 22:57:43 2010 (r211156) @@ -6,7 +6,7 @@ desc="rename changes file name" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..79" +echo "1..145" n0=`namegen` n1=`namegen` @@ -57,6 +57,54 @@ expect fifo,${inode},0644,2 lstat ${n2} expect 0 unlink ${n0} expect 0 unlink ${n2} +expect 0 mknod ${n0} b 0644 1 2 +expect block,0644,1 lstat ${n0} type,mode,nlink +inode=`${fstest} lstat ${n0} inode` +expect 0 rename ${n0} ${n1} +expect ENOENT lstat ${n0} type,mode,nlink +expect block,${inode},0644,1 lstat ${n1} type,inode,mode,nlink +expect 0 link ${n1} ${n0} +expect block,${inode},0644,2 lstat ${n0} type,inode,mode,nlink +expect block,${inode},0644,2 lstat ${n1} type,inode,mode,nlink +expect 0 rename ${n1} ${n2} +expect block,${inode},0644,2 lstat ${n0} type,inode,mode,nlink +expect ENOENT lstat ${n1} type,mode,nlink +expect block,${inode},0644,2 lstat ${n2} type,inode,mode,nlink +expect 0 unlink ${n0} +expect 0 unlink ${n2} + +expect 0 mknod ${n0} c 0644 1 2 +expect char,0644,1 lstat ${n0} type,mode,nlink +inode=`${fstest} lstat ${n0} inode` +expect 0 rename ${n0} ${n1} +expect ENOENT lstat ${n0} type,mode,nlink +expect char,${inode},0644,1 lstat ${n1} type,inode,mode,nlink +expect 0 link ${n1} ${n0} +expect char,${inode},0644,2 lstat ${n0} type,inode,mode,nlink +expect char,${inode},0644,2 lstat ${n1} type,inode,mode,nlink +expect 0 rename ${n1} ${n2} +expect char,${inode},0644,2 lstat ${n0} type,inode,mode,nlink +expect ENOENT lstat ${n1} type,mode,nlink +expect char,${inode},0644,2 lstat ${n2} type,inode,mode,nlink +expect 0 unlink ${n0} +expect 0 unlink ${n2} + +expect 0 -U 0133 bind ${n0} +expect socket,0644,1 lstat ${n0} type,mode,nlink +inode=`${fstest} lstat ${n0} inode` +expect 0 rename ${n0} ${n1} +expect ENOENT lstat ${n0} type,mode,nlink +expect socket,${inode},0644,1 lstat ${n1} type,inode,mode,nlink +expect 0 link ${n1} ${n0} +expect socket,${inode},0644,2 lstat ${n0} type,inode,mode,nlink +expect socket,${inode},0644,2 lstat ${n1} type,inode,mode,nlink +expect 0 rename ${n1} ${n2} +expect socket,${inode},0644,2 lstat ${n0} type,inode,mode,nlink +expect ENOENT lstat ${n1} type,mode,nlink +expect socket,${inode},0644,2 lstat ${n2} type,inode,mode,nlink +expect 0 unlink ${n0} +expect 0 unlink ${n2} + expect 0 create ${n0} 0644 rinode=`${fstest} lstat ${n0} inode` expect regular,0644 lstat ${n0} type,mode @@ -96,6 +144,30 @@ ctime2=`${fstest} stat ${n1} ctime` test_check $ctime1 -lt $ctime2 expect 0 unlink ${n1} +expect 0 mknod ${n0} b 0644 1 2 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 rename ${n0} ${n1} +ctime2=`${fstest} stat ${n1} ctime` +test_check $ctime1 -lt $ctime2 +expect 0 unlink ${n1} + +expect 0 mknod ${n0} c 0644 1 2 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 rename ${n0} ${n1} +ctime2=`${fstest} stat ${n1} ctime` +test_check $ctime1 -lt $ctime2 +expect 0 unlink ${n1} + +expect 0 bind ${n0} +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 rename ${n0} ${n1} +ctime2=`${fstest} stat ${n1} ctime` +test_check $ctime1 -lt $ctime2 +expect 0 unlink ${n1} + expect 0 symlink ${n2} ${n0} ctime1=`${fstest} lstat ${n0} ctime` sleep 1 @@ -129,6 +201,30 @@ ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} +expect 0 mknod ${n0} b 0644 1 2 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect EACCES -u 65534 rename ${n0} ${n1} +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -eq $ctime2 +expect 0 unlink ${n0} + +expect 0 mknod ${n0} c 0644 1 2 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect EACCES -u 65534 rename ${n0} ${n1} +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -eq $ctime2 +expect 0 unlink ${n0} + +expect 0 bind ${n0} +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect EACCES -u 65534 rename ${n0} ${n1} +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -eq $ctime2 +expect 0 unlink ${n0} + expect 0 symlink ${n2} ${n0} ctime1=`${fstest} lstat ${n0} ctime` sleep 1 Modified: head/tools/regression/fstest/tests/rename/06.t ============================================================================== --- head/tools/regression/fstest/tests/rename/06.t Tue Aug 10 22:45:59 2010 (r211155) +++ head/tools/regression/fstest/tests/rename/06.t Tue Aug 10 22:57:43 2010 (r211156) @@ -11,11 +11,11 @@ require chflags case "${os}:${fs}" in FreeBSD:ZFS) flags="SF_IMMUTABLE SF_NOUNLINK SF_APPEND" - echo "1..90" + echo "1..105" ;; FreeBSD:UFS) flags="SF_IMMUTABLE SF_NOUNLINK SF_APPEND UF_IMMUTABLE UF_NOUNLINK UF_APPEND" - echo "1..162" + echo "1..189" ;; *) quick_exit @@ -60,6 +60,18 @@ done expect 0 chflags ${n0} none expect 0 unlink ${n0} +expect 0 mknod ${n0} b 0644 1 2 +for flag in ${flags}; do + expect 0 chflags ${n0} ${flag} + expect ${flag} stat ${n0} flags + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a device protected by SF_APPEND should return EPERM." + expect EPERM rename ${n0} ${n1} + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a device protected by SF_APPEND should return EPERM." + expect ENOENT rename ${n1} ${n0} +done +expect 0 chflags ${n0} none +expect 0 unlink ${n0} + expect 0 mknod ${n0} c 0644 1 2 for flag in ${flags}; do expect 0 chflags ${n0} ${flag} Modified: head/tools/regression/fstest/tests/rename/07.t ============================================================================== --- head/tools/regression/fstest/tests/rename/07.t Tue Aug 10 22:45:59 2010 (r211155) +++ head/tools/regression/fstest/tests/rename/07.t Tue Aug 10 22:57:43 2010 (r211156) @@ -12,12 +12,12 @@ case "${os}:${fs}" in FreeBSD:ZFS) flags1="SF_IMMUTABLE SF_APPEND" flags2="SF_NOUNLINK" - echo "1..110" + echo "1..128" ;; FreeBSD:UFS) flags1="SF_IMMUTABLE SF_APPEND UF_IMMUTABLE UF_APPEND" flags2="SF_NOUNLINK UF_NOUNLINK" - echo "1..182" + echo "1..212" ;; *) quick_exit @@ -65,6 +65,18 @@ done expect 0 chflags ${n0} none expect 0 unlink ${n0}/${n1} +expect 0 mknod ${n0}/${n1} b 0644 1 2 +for flag in ${flags1}; do + expect 0 chflags ${n0} ${flag} + expect ${flag} stat ${n0} flags + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect EPERM rename ${n0}/${n1} ${n2} + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect ENOENT rename ${n2} ${n0}/${n1} +done +expect 0 chflags ${n0} none +expect 0 unlink ${n0}/${n1} + expect 0 mknod ${n0}/${n1} c 0644 1 2 for flag in ${flags1}; do expect 0 chflags ${n0} ${flag} @@ -131,6 +143,16 @@ done expect 0 chflags ${n0} none expect 0 unlink ${n0}/${n1} +expect 0 mknod ${n0}/${n1} b 0644 1 2 +for flag in ${flags2}; do + expect 0 chflags ${n0} ${flag} + expect ${flag} stat ${n0} flags + expect 0 rename ${n0}/${n1} ${n2} + expect 0 rename ${n2} ${n0}/${n1} +done +expect 0 chflags ${n0} none +expect 0 unlink ${n0}/${n1} + expect 0 mknod ${n0}/${n1} c 0644 1 2 for flag in ${flags2}; do expect 0 chflags ${n0} ${flag} Modified: head/tools/regression/fstest/tests/rename/10.t ============================================================================== --- head/tools/regression/fstest/tests/rename/10.t Tue Aug 10 22:45:59 2010 (r211155) +++ head/tools/regression/fstest/tests/rename/10.t Tue Aug 10 22:57:43 2010 (r211156) @@ -6,7 +6,7 @@ desc="rename returns EACCES or EPERM if dir=`dirname $0` . ${dir}/../misc.sh -echo "1..188" +echo "1..1903" n0=`namegen` n1=`namegen` @@ -24,217 +24,305 @@ expect 0 chown ${n0} 65534 65534 expect 0 mkdir ${n1} 0755 expect 0 chmod ${n1} 01777 -# User owns both: the sticky directory and the destination file. -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644 -inode=`${fstest} lstat ${n0}/${n2} inode` -expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} inode -expect ${inode} lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644 -expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} -expect ${inode} lstat ${n0}/${n2} inode -expect ENOENT lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3} -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} inode -expect ${inode} lstat ${n1}/${n3} inode -expect 0 unlink ${n1}/${n3} -# User owns the sticky directory, but doesn't own the destination file. -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644 -inode=`${fstest} lstat ${n0}/${n2} inode` -expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} type -expect ${inode} lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644 -expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} -expect ${inode} lstat ${n0}/${n2} inode -expect ENOENT lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3} -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} inode -expect ${inode} lstat ${n1}/${n3} inode -expect 0 unlink ${n1}/${n3} -# User owns the destination file, but doesn't own the sticky directory. -expect 0 chown ${n1} 65533 65533 -expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644 -inode=`${fstest} lstat ${n0}/${n2} inode` -expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} type -expect ${inode} lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644 -expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} -expect ${inode} lstat ${n0}/${n2} inode -expect ENOENT lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3} -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} inode -expect ${inode} lstat ${n1}/${n3} inode -expect 0 unlink ${n1}/${n3} -# User doesn't own the sticky directory nor the destination file. -expect 0 chown ${n1} 65533 65533 -expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644 -expect 0 -u 65533 -g 65533 create ${n1}/${n3} 0644 -inode=`${fstest} lstat ${n1}/${n3} inode` -expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ${inode} lstat ${n1}/${n3} inode -expect 0 unlink ${n0}/${n2} -expect 0 unlink ${n1}/${n3} +create_file() { + case "${1}" in + regular) + expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644 + ;; + fifo) + expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644 + ;; + block) + expect 0 mknod ${n0}/${n2} b 0644 1 2 + expect 0 chown ${n0}/${n2} 65534 65534 + ;; + char) + expect 0 mknod ${n0}/${n2} c 0644 1 2 + expect 0 chown ${n0}/${n2} 65534 65534 + ;; + socket) + expect 0 -u 65534 -g 65534 bind ${n0}/${n2} + ;; + symlink) + expect 0 -u 65534 -g 65534 symlink test ${n0}/${n2} + ;; + esac +} + +for type in regular fifo block char socket symlink; do + # User owns both: the sticky directory and the destination file. + expect 0 chown ${n1} 65534 65534 + create_file ${type} + inode=`${fstest} lstat ${n0}/${n2} inode` + + expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644 + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644 + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 mknod ${n1}/${n3} b 0644 1 2 + expect 0 chown ${n1}/${n3} 65534 65534 + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 mknod ${n1}/${n3} c 0644 1 2 + expect 0 chown ${n1}/${n3} 65534 65534 + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 -u 65534 -g 65534 bind ${n1}/${n3} + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3} + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 unlink ${n0}/${n2} + + # User owns the sticky directory, but doesn't own the destination file. + for id in 0 65533; do + expect 0 chown ${n1} 65534 65534 + create_file ${type} + inode=`${fstest} lstat ${n0}/${n2} inode` + + expect 0 -u ${id} -g ${id} create ${n1}/${n3} 0644 + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 -u ${id} -g ${id} mkfifo ${n1}/${n3} 0644 + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 mknod ${n1}/${n3} b 0644 1 2 + expect 0 chown ${n1}/${n3} ${id} ${id} + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 mknod ${n1}/${n3} c 0644 1 2 + expect 0 chown ${n1}/${n3} ${id} ${id} + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 -u ${id} -g ${id} bind ${n1}/${n3} + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 -u ${id} -g ${id} symlink test ${n1}/${n3} + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 unlink ${n0}/${n2} + done + + # User owns the destination file, but doesn't own the sticky directory. + for id in 0 65533; do + expect 0 chown ${n1} ${id} ${id} + create_file ${type} + inode=`${fstest} lstat ${n0}/${n2} inode` + + expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644 + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644 + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 mknod ${n1}/${n3} b 0644 1 2 + expect 0 chown ${n1}/${n3} 65534 65534 + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 mknod ${n1}/${n3} c 0644 1 2 + expect 0 chown ${n1}/${n3} 65534 65534 + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 -u 65534 -g 65534 bind ${n1}/${n3} + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3} + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} inode + expect ${inode} lstat ${n1}/${n3} inode + expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} + expect ${inode} lstat ${n0}/${n2} inode + expect ENOENT lstat ${n1}/${n3} inode + + expect 0 unlink ${n0}/${n2} + done + + # User doesn't own the sticky directory nor the destination file. + for id in 0 65533; do + expect 0 chown ${n1} ${id} ${id} + create_file ${type} + inode=`${fstest} lstat ${n0}/${n2} inode` + + expect 0 -u ${id} -g ${id} create ${n1}/${n3} 0644 + expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ${inode} lstat ${n0}/${n2} inode + expect ${id},${id} lstat ${n1}/${n3} uid,gid + expect 0 unlink ${n1}/${n3} + + expect 0 -u ${id} -g ${id} mkfifo ${n1}/${n3} 0644 + expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ${inode} lstat ${n0}/${n2} inode + expect ${id},${id} lstat ${n1}/${n3} uid,gid + expect 0 unlink ${n1}/${n3} + + expect 0 mknod ${n1}/${n3} b 0644 1 2 + expect 0 chown ${n1}/${n3} ${id} ${id} + expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ${inode} lstat ${n0}/${n2} inode + expect ${id},${id} lstat ${n1}/${n3} uid,gid + expect 0 unlink ${n1}/${n3} + + expect 0 mknod ${n1}/${n3} c 0644 1 2 + expect 0 chown ${n1}/${n3} ${id} ${id} + expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ${inode} lstat ${n0}/${n2} inode + expect ${id},${id} lstat ${n1}/${n3} uid,gid + expect 0 unlink ${n1}/${n3} + + expect 0 -u ${id} -g ${id} bind ${n1}/${n3} + expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ${inode} lstat ${n0}/${n2} inode + expect ${id},${id} lstat ${n1}/${n3} uid,gid + expect 0 unlink ${n1}/${n3} + + expect 0 -u ${id} -g ${id} symlink test ${n1}/${n3} + expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ${inode} lstat ${n0}/${n2} inode + expect ${id},${id} lstat ${n1}/${n3} uid,gid + expect 0 unlink ${n1}/${n3} + + expect 0 unlink ${n0}/${n2} + done +done -# User owns both: the sticky directory and the destination file. +# User owns both: the sticky directory and the destination directory. expect 0 chown ${n1} 65534 65534 expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755 -expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} type -expect 0 rmdir ${n1}/${n3} -# User owns the sticky directory, but doesn't own the destination file. -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755 -expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} type -expect 0 rmdir ${n1}/${n3} -# User owns the destination file, but doesn't own the sticky directory. -expect 0 chown ${n1} 65533 65533 -expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755 -expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} type -expect 0 rmdir ${n1}/${n3} -# User doesn't own the sticky directory nor the destination file. -expect 0 chown ${n1} 65533 65533 -expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755 -expect 0 -u 65533 -g 65533 mkdir ${n1}/${n3} 0755 -expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect 0 rmdir ${n0}/${n2} -expect 0 rmdir ${n1}/${n3} - -# User owns both: the sticky directory and the destination file. -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644 inode=`${fstest} lstat ${n0}/${n2} inode` -expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} inode -expect ${inode} lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644 -expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} -expect ${inode} lstat ${n0}/${n2} inode -expect ENOENT lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3} -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} inode -expect ${inode} lstat ${n1}/${n3} inode -expect 0 unlink ${n1}/${n3} -# User owns the sticky directory, but doesn't own the destination file. -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644 -inode=`${fstest} lstat ${n0}/${n2} inode` -expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} type -expect ${inode} lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644 -expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} -expect ${inode} lstat ${n0}/${n2} inode -expect ENOENT lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3} -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} inode -expect ${inode} lstat ${n1}/${n3} inode -expect 0 unlink ${n1}/${n3} -# User owns the destination file, but doesn't own the sticky directory. -expect 0 chown ${n1} 65533 65533 -expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644 -inode=`${fstest} lstat ${n0}/${n2} inode` -expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} type -expect ${inode} lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644 -expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} -expect ${inode} lstat ${n0}/${n2} inode -expect ENOENT lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3} -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} inode -expect ${inode} lstat ${n1}/${n3} inode -expect 0 unlink ${n1}/${n3} -# User doesn't own the sticky directory nor the destination file. -expect 0 chown ${n1} 65533 65533 -expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644 -expect 0 -u 65533 -g 65533 mkfifo ${n1}/${n3} 0644 -inode=`${fstest} lstat ${n1}/${n3} inode` -expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ${inode} lstat ${n1}/${n3} inode -expect 0 unlink ${n0}/${n2} -expect 0 unlink ${n1}/${n3} -# User owns both: the sticky directory and the destination file. -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 symlink test ${n0}/${n2} -inode=`${fstest} lstat ${n0}/${n2} inode` -expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3} -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} inode -expect ${inode} lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644 -expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} -expect ${inode} lstat ${n0}/${n2} inode -expect ENOENT lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} inode -expect ${inode} lstat ${n1}/${n3} inode -expect 0 unlink ${n1}/${n3} -# User owns the sticky directory, but doesn't own the destination file. -expect 0 chown ${n1} 65534 65534 -expect 0 -u 65534 -g 65534 symlink test ${n0}/${n2} -inode=`${fstest} lstat ${n0}/${n2} inode` -expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3} -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} type -expect ${inode} lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644 -expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} -expect ${inode} lstat ${n0}/${n2} inode -expect ENOENT lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} inode -expect ${inode} lstat ${n1}/${n3} inode -expect 0 unlink ${n1}/${n3} -# User owns the destination file, but doesn't own the sticky directory. -expect 0 chown ${n1} 65533 65533 -expect 0 -u 65534 -g 65534 symlink test ${n0}/${n2} -inode=`${fstest} lstat ${n0}/${n2} inode` -expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3} +expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755 expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} expect ENOENT lstat ${n0}/${n2} type expect ${inode} lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644 -expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2} -expect ${inode} lstat ${n0}/${n2} inode -expect ENOENT lstat ${n1}/${n3} inode -expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644 -expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ENOENT lstat ${n0}/${n2} inode -expect ${inode} lstat ${n1}/${n3} inode -expect 0 unlink ${n1}/${n3} -# User doesn't own the sticky directory nor the destination file. -expect 0 chown ${n1} 65533 65533 -expect 0 -u 65534 -g 65534 symlink test ${n0}/${n2} -expect 0 -u 65533 -g 65533 symlink test ${n1}/${n3} -inode=`${fstest} lstat ${n1}/${n3} inode` -expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} -expect ${inode} lstat ${n1}/${n3} inode -expect 0 unlink ${n0}/${n2} -expect 0 unlink ${n1}/${n3} +expect 0 rmdir ${n1}/${n3} + +# User owns the sticky directory, but doesn't own the destination directory. +for id in 0 65533; do + expect 0 chown ${n1} 65534 65534 + expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755 + inode=`${fstest} lstat ${n0}/${n2} inode` + + expect 0 -u ${id} -g ${id} mkdir ${n1}/${n3} 0755 + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} type + expect ${inode} lstat ${n1}/${n3} inode + expect 0 rmdir ${n1}/${n3} +done + +# User owns the destination directory, but doesn't own the sticky directory. +for id in 0 65533; do + expect 0 chown ${n1} ${id} ${id} + expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755 + inode=`${fstest} lstat ${n0}/${n2} inode` + + expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755 + expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ENOENT lstat ${n0}/${n2} type + expect ${inode} lstat ${n1}/${n3} inode + expect 0 rmdir ${n1}/${n3} +done + +# User doesn't own the sticky directory nor the destination directory. +for id in 0 65533; do + expect 0 chown ${n1} ${id} ${id} + expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755 + inode=`${fstest} lstat ${n0}/${n2} inode` + + expect 0 -u ${id} -g ${id} mkdir ${n1}/${n3} 0755 + expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3} + expect ${inode} lstat ${n0}/${n2} inode + expect ${id},${id} lstat ${n1}/${n3} uid,gid + expect 0 rmdir ${n0}/${n2} + expect 0 rmdir ${n1}/${n3} +done expect 0 rmdir ${n1} expect 0 rmdir ${n0} Modified: head/tools/regression/fstest/tests/rename/13.t ============================================================================== --- head/tools/regression/fstest/tests/rename/13.t Tue Aug 10 22:45:59 2010 (r211155) +++ head/tools/regression/fstest/tests/rename/13.t Tue Aug 10 22:57:43 2010 (r211156) @@ -6,7 +6,7 @@ desc="rename returns ENOTDIR when the 'f dir=`dirname $0` . ${dir}/../misc.sh -echo "1..17" +echo "1..32" n0=`namegen` n1=`namegen` @@ -25,6 +25,24 @@ expect dir lstat ${n0} type expect fifo lstat ${n1} type expect 0 unlink ${n1} +expect 0 mknod ${n1} b 0644 1 2 +expect ENOTDIR rename ${n0} ${n1} +expect dir lstat ${n0} type +expect block lstat ${n1} type +expect 0 unlink ${n1} + +expect 0 mknod ${n1} c 0644 1 2 +expect ENOTDIR rename ${n0} ${n1} +expect dir lstat ${n0} type +expect char lstat ${n1} type +expect 0 unlink ${n1} + +expect 0 bind ${n1} +expect ENOTDIR rename ${n0} ${n1} +expect dir lstat ${n0} type +expect socket lstat ${n1} type +expect 0 unlink ${n1} + expect 0 symlink test ${n1} expect ENOTDIR rename ${n0} ${n1} expect dir lstat ${n0} type Modified: head/tools/regression/fstest/tests/rename/14.t ============================================================================== --- head/tools/regression/fstest/tests/rename/14.t Tue Aug 10 22:45:59 2010 (r211155) +++ head/tools/regression/fstest/tests/rename/14.t Tue Aug 10 22:57:43 2010 (r211156) @@ -6,7 +6,7 @@ desc="rename returns EISDIR when the 'to dir=`dirname $0` . ${dir}/../misc.sh -echo "1..17" +echo "1..32" n0=`namegen` n1=`namegen` @@ -25,6 +25,24 @@ expect dir lstat ${n0} type expect fifo lstat ${n1} type expect 0 unlink ${n1} +expect 0 mknod ${n1} b 0644 1 2 +expect EISDIR rename ${n1} ${n0} +expect dir lstat ${n0} type +expect block lstat ${n1} type +expect 0 unlink ${n1} + +expect 0 mknod ${n1} c 0644 1 2 +expect EISDIR rename ${n1} ${n0} +expect dir lstat ${n0} type +expect char lstat ${n1} type +expect 0 unlink ${n1} + +expect 0 bind ${n1} +expect EISDIR rename ${n1} ${n0} +expect dir lstat ${n0} type +expect socket lstat ${n1} type +expect 0 unlink ${n1} + expect 0 symlink test ${n1} expect EISDIR rename ${n1} ${n0} expect dir lstat ${n0} type Modified: head/tools/regression/fstest/tests/rename/15.t ============================================================================== --- head/tools/regression/fstest/tests/rename/15.t Tue Aug 10 22:45:59 2010 (r211155) +++ head/tools/regression/fstest/tests/rename/15.t Tue Aug 10 22:57:43 2010 (r211156) @@ -8,7 +8,7 @@ dir=`dirname $0` [ "${os}" = "FreeBSD" ] || quick_exit -echo "1..14" +echo "1..23" n0=`namegen` n1=`namegen` @@ -31,6 +31,18 @@ expect 0 mkfifo ${n0}/${n1} 0644 expect EXDEV rename ${n0}/${n1} ${n2} expect 0 unlink ${n0}/${n1} +expect 0 mknod ${n0}/${n1} b 0644 1 2 +expect EXDEV rename ${n0}/${n1} ${n2} +expect 0 unlink ${n0}/${n1} + +expect 0 mknod ${n0}/${n1} c 0644 1 2 +expect EXDEV rename ${n0}/${n1} ${n2} +expect 0 unlink ${n0}/${n1} + +expect 0 bind ${n0}/${n1} +expect EXDEV rename ${n0}/${n1} ${n2} +expect 0 unlink ${n0}/${n1} + expect 0 symlink test ${n0}/${n1} expect EXDEV rename ${n0}/${n1} ${n2} expect 0 unlink ${n0}/${n1} Modified: head/tools/regression/fstest/tests/rename/20.t ============================================================================== --- head/tools/regression/fstest/tests/rename/20.t Tue Aug 10 22:45:59 2010 (r211155) +++ head/tools/regression/fstest/tests/rename/20.t Tue Aug 10 22:57:43 2010 (r211156) @@ -6,7 +6,7 @@ desc="rename returns EEXIST or ENOTEMPTY dir=`dirname $0` . ${dir}/../misc.sh -echo "1..16" +echo "1..25" n0=`namegen` n1=`namegen` @@ -27,6 +27,18 @@ expect 0 mkfifo ${n1}/${n2} 0644 expect "EEXIST|ENOTEMPTY" rename ${n0} ${n1} expect 0 unlink ${n1}/${n2} +expect 0 mknod ${n1}/${n2} b 0644 1 2 +expect "EEXIST|ENOTEMPTY" rename ${n0} ${n1} +expect 0 unlink ${n1}/${n2} + +expect 0 mknod ${n1}/${n2} c 0644 1 2 +expect "EEXIST|ENOTEMPTY" rename ${n0} ${n1} +expect 0 unlink ${n1}/${n2} + +expect 0 bind ${n1}/${n2} +expect "EEXIST|ENOTEMPTY" rename ${n0} ${n1} +expect 0 unlink ${n1}/${n2} + expect 0 symlink test ${n1}/${n2} expect "EEXIST|ENOTEMPTY" rename ${n0} ${n1} expect 0 unlink ${n1}/${n2} Modified: head/tools/regression/fstest/tests/unlink/00.t ============================================================================== --- head/tools/regression/fstest/tests/unlink/00.t Tue Aug 10 22:45:59 2010 (r211155) +++ head/tools/regression/fstest/tests/unlink/00.t Tue Aug 10 22:57:43 2010 (r211156) @@ -6,7 +6,7 @@ desc="unlink removes regular files, symb dir=`dirname $0` . ${dir}/../misc.sh -echo "1..55" +echo "1..112" n0=`namegen` n1=`namegen` @@ -31,7 +31,20 @@ expect fifo lstat ${n0} type expect 0 unlink ${n0} expect ENOENT lstat ${n0} type -# TODO: sockets removal +expect 0 mknod ${n0} b 0644 1 2 +expect block lstat ${n0} type +expect 0 unlink ${n0} +expect ENOENT lstat ${n0} type + +expect 0 mknod ${n0} c 0644 1 2 +expect char lstat ${n0} type +expect 0 unlink ${n0} +expect ENOENT lstat ${n0} type + +expect 0 bind ${n0} +expect socket lstat ${n0} type +expect 0 unlink ${n0} +expect ENOENT lstat ${n0} type # successful unlink(2) updates ctime. expect 0 create ${n0} 0644 @@ -52,6 +65,33 @@ ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -lt $ctime2 expect 0 unlink ${n0} +expect 0 mknod ${n0} b 0644 1 2 +expect 0 link ${n0} ${n1} +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 unlink ${n1} +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -lt $ctime2 +expect 0 unlink ${n0} + +expect 0 mknod ${n0} c 0644 1 2 +expect 0 link ${n0} ${n1} +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 unlink ${n1} +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -lt $ctime2 +expect 0 unlink ${n0} + +expect 0 bind ${n0} +expect 0 link ${n0} ${n1} +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 unlink ${n1} +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -lt $ctime2 +expect 0 unlink ${n0} + # unsuccessful unlink(2) does not update ctime. expect 0 create ${n0} 0644 ctime1=`${fstest} stat ${n0} ctime` @@ -69,6 +109,30 @@ ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} +expect 0 mknod ${n0} b 0644 1 2 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect EACCES -u 65534 unlink ${n0} +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -eq $ctime2 +expect 0 unlink ${n0} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 00:51:51 2010 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 730F3106566B; Wed, 11 Aug 2010 00:51:51 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 606E08FC17; Wed, 11 Aug 2010 00:51:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7B0ppk0085010; Wed, 11 Aug 2010 00:51:51 GMT (envelope-from will@svn.freebsd.org) Received: (from will@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7B0pp10084996; Wed, 11 Aug 2010 00:51:51 GMT (envelope-from will@svn.freebsd.org) Message-Id: <201008110051.o7B0pp10084996@svn.freebsd.org> From: Will Andrews Date: Wed, 11 Aug 2010 00:51: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: r211157 - in head/sys: modules modules/if_carp net netinet netinet6 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, 11 Aug 2010 00:51:51 -0000 Author: will Date: Wed Aug 11 00:51:50 2010 New Revision: 211157 URL: http://svn.freebsd.org/changeset/base/211157 Log: Allow carp(4) to be loaded as a kernel module. Follow precedent set by bridge(4), lagg(4) etc. and make use of function pointers and pf_proto_register() to hook carp into the network stack. Currently, because of the uncertainty about whether the unload path is free of race condition panics, unloads are disallowed by default. Compiling with CARPMOD_CAN_UNLOAD in CFLAGS removes this anti foot shooting measure. This commit requires IP6PROTOSPACER, introduced in r211115. Reviewed by: bz, simon Approved by: ken (mentor) MFC after: 2 weeks Added: head/sys/modules/if_carp/ head/sys/modules/if_carp/Makefile (contents, props changed) Modified: head/sys/modules/Makefile head/sys/net/if.c head/sys/net/if_bridge.c head/sys/net/if_ethersubr.c head/sys/netinet/if_ether.c head/sys/netinet/in.c head/sys/netinet/in_proto.c head/sys/netinet/ip_carp.c head/sys/netinet/ip_carp.h head/sys/netinet/ip_input.c head/sys/netinet6/in6_proto.c head/sys/netinet6/nd6_nbr.c Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Tue Aug 10 22:57:43 2010 (r211156) +++ head/sys/modules/Makefile Wed Aug 11 00:51:50 2010 (r211157) @@ -112,6 +112,7 @@ SUBDIR= ${_3dfx} \ ${_ida} \ ${_ie} \ if_bridge \ + if_carp \ if_disc \ if_edsc \ if_ef \ Added: head/sys/modules/if_carp/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/if_carp/Makefile Wed Aug 11 00:51:50 2010 (r211157) @@ -0,0 +1,21 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../netinet + +.include + +KMOD= if_carp +SRCS= ip_carp.c +SRCS+= opt_carp.h opt_bpf.h opt_inet.h opt_inet6.h vnode_if.h + +.if !defined(KERNBUILDDIR) +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} + +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.endif + +.include Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Aug 10 22:57:43 2010 (r211156) +++ head/sys/net/if.c Wed Aug 11 00:51:50 2010 (r211157) @@ -33,7 +33,6 @@ #include "opt_compat.h" #include "opt_inet6.h" #include "opt_inet.h" -#include "opt_carp.h" #include "opt_ddb.h" #include @@ -89,11 +88,6 @@ #ifdef INET #include #endif -#if defined(INET) || defined(INET6) -#ifdef DEV_CARP -#include -#endif -#endif #include @@ -130,6 +124,7 @@ SX_SYSINIT(ifdescr_sx, &ifdescr_sx, "ifn void (*bstp_linkstate_p)(struct ifnet *ifp, int state); void (*ng_ether_link_state_p)(struct ifnet *ifp, int state); void (*lagg_linkstate_p)(struct ifnet *ifp, int state); +void (*carp_linkstate_p)(struct ifnet *ifp); struct mbuf *(*tbr_dequeue_ptr)(struct ifaltq *, int) = NULL; @@ -1813,12 +1808,8 @@ if_unroute(struct ifnet *ifp, int flag, pfctlinput(PRC_IFDOWN, ifa->ifa_addr); ifp->if_qflush(ifp); -#if defined(INET) || defined(INET6) -#ifdef DEV_CARP if (ifp->if_carp) - carp_carpdev_state(ifp->if_carp); -#endif -#endif + (*carp_linkstate_p)(ifp); rt_ifmsg(ifp); } @@ -1839,12 +1830,8 @@ if_route(struct ifnet *ifp, int flag, in TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family)) pfctlinput(PRC_IFUP, ifa->ifa_addr); -#if defined(INET) || defined(INET6) -#ifdef DEV_CARP if (ifp->if_carp) - carp_carpdev_state(ifp->if_carp); -#endif -#endif + (*carp_linkstate_p)(ifp); rt_ifmsg(ifp); #ifdef INET6 in6_if_up(ifp); @@ -1887,12 +1874,8 @@ do_link_state_change(void *arg, int pend if ((ifp->if_type == IFT_ETHER || ifp->if_type == IFT_L2VLAN) && IFP2AC(ifp)->ac_netgraph != NULL) (*ng_ether_link_state_p)(ifp, link_state); -#if defined(INET) || defined(INET6) -#ifdef DEV_CARP if (ifp->if_carp) - carp_carpdev_state(ifp->if_carp); -#endif -#endif + (*carp_linkstate_p)(ifp); if (ifp->if_bridge) { KASSERT(bstp_linkstate_p != NULL,("if_bridge bstp not loaded!")); (*bstp_linkstate_p)(ifp, link_state); Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Tue Aug 10 22:57:43 2010 (r211156) +++ head/sys/net/if_bridge.c Wed Aug 11 00:51:50 2010 (r211157) @@ -79,7 +79,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_carp.h" #include #include @@ -121,10 +120,8 @@ __FBSDID("$FreeBSD$"); #include #endif #if defined(INET) || defined(INET6) -#ifdef DEV_CARP #include #endif -#endif #include #include /* for struct arpcom */ #include @@ -2144,6 +2141,10 @@ drop: m_freem(m); } +#if defined(INET) || defined(INET6) +int (*carp_forus_p)(struct carp_if *, u_char *); +#endif + /* * bridge_input: * @@ -2252,13 +2253,13 @@ bridge_input(struct ifnet *ifp, struct m return (m); } -#if (defined(INET) || defined(INET6)) && defined(DEV_CARP) +#if (defined(INET) || defined(INET6)) # define OR_CARP_CHECK_WE_ARE_DST(iface) \ || ((iface)->if_carp \ - && carp_forus((iface)->if_carp, eh->ether_dhost)) + && (*carp_forus_p)((iface)->if_carp, eh->ether_dhost)) # define OR_CARP_CHECK_WE_ARE_SRC(iface) \ || ((iface)->if_carp \ - && carp_forus((iface)->if_carp, eh->ether_shost)) + && (*carp_forus_p)((iface)->if_carp, eh->ether_shost)) #else # define OR_CARP_CHECK_WE_ARE_DST(iface) # define OR_CARP_CHECK_WE_ARE_SRC(iface) Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Tue Aug 10 22:57:43 2010 (r211156) +++ head/sys/net/if_ethersubr.c Wed Aug 11 00:51:50 2010 (r211157) @@ -35,7 +35,6 @@ #include "opt_inet6.h" #include "opt_ipx.h" #include "opt_netgraph.h" -#include "opt_carp.h" #include "opt_mbuf_profiling.h" #include @@ -70,6 +69,7 @@ #include #include #include +#include #include #include #include @@ -78,12 +78,6 @@ #include #endif -#if defined(INET) || defined(INET6) -#ifdef DEV_CARP -#include -#endif -#endif - #ifdef IPX #include #include @@ -120,6 +114,11 @@ void (*ng_ether_attach_p)(struct ifnet * void (*ng_ether_detach_p)(struct ifnet *ifp); void (*vlan_input_p)(struct ifnet *, struct mbuf *); +#if defined(INET) || defined(INET6) +int (*carp_forus_p)(struct ifnet *, u_char *); +int (*carp_output_p)(struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); +#endif /* if_bridge(4) support */ struct mbuf *(*bridge_input_p)(struct ifnet *, struct mbuf *); @@ -399,12 +398,10 @@ ether_output(struct ifnet *ifp, struct m } #if defined(INET) || defined(INET6) -#ifdef DEV_CARP if (ifp->if_carp && - (error = carp_output(ifp, m, dst, NULL))) + (error = (*carp_output_p)(ifp, m, dst, NULL))) goto bad; #endif -#endif /* Handle ng_ether(4) processing, if any */ if (IFP2AC(ifp)->ac_netgraph != NULL) { @@ -724,7 +721,6 @@ ether_input(struct ifnet *ifp, struct mb } #if defined(INET) || defined(INET6) -#ifdef DEV_CARP /* * Clear M_PROMISC on frame so that carp(4) will see it when the * mbuf flows up to Layer 3. @@ -735,11 +731,10 @@ ether_input(struct ifnet *ifp, struct mb * TODO: Maintain a hash table of ethernet addresses other than * ether_dhost which may be active on this ifp. */ - if (ifp->if_carp && carp_forus(ifp->if_carp, eh->ether_dhost)) { + if (ifp->if_carp && (*carp_forus_p)(ifp, eh->ether_dhost)) { m->m_flags &= ~M_PROMISC; } else #endif -#endif { /* * If the frame received was not for our MAC address, set the Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Tue Aug 10 22:57:43 2010 (r211156) +++ head/sys/netinet/if_ether.c Wed Aug 11 00:51:50 2010 (r211157) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" -#include "opt_carp.h" #include #include @@ -69,10 +68,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef DEV_CARP -#include -#endif - #include #define SIN(s) ((struct sockaddr_in *)s) @@ -123,6 +118,10 @@ static void arptimer(void *); #ifdef INET static void in_arpinput(struct mbuf *); #endif +#if defined(INET) || defined(INET6) +int (*carp_iamatch_p)(struct ifnet *, struct in_ifaddr *, struct in_addr *, + u_int8_t **); +#endif static const struct netisr_handler arp_nh = { .nh_name = "arp", @@ -494,9 +493,7 @@ in_arpinput(struct mbuf *m) int op, flags; int req_len; int bridged = 0, is_bridge = 0; -#ifdef DEV_CARP int carp_match = 0; -#endif struct sockaddr_in sin; sin.sin_len = sizeof(struct sockaddr_in); sin.sin_family = AF_INET; @@ -539,16 +536,14 @@ in_arpinput(struct mbuf *m) IN_IFADDR_RUNLOCK(); goto match; } -#ifdef DEV_CARP if (ifp->if_carp != NULL && - carp_iamatch(ifp->if_carp, ia, &isaddr, &enaddr) && + (*carp_iamatch_p)(ifp, ia, &isaddr, &enaddr) && itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { carp_match = 1; ifa_ref(&ia->ia_ifa); IN_IFADDR_RUNLOCK(); goto match; } -#endif } LIST_FOREACH(ia, INADDR_HASH(isaddr.s_addr), ia_hash) if (((bridged && ia->ia_ifp->if_bridge != NULL) || @@ -648,11 +643,7 @@ match: IF_AFDATA_UNLOCK(ifp); if (la != NULL) { /* the following is not an error when doing bridging */ - if (!bridged && la->lle_tbl->llt_ifp != ifp -#ifdef DEV_CARP - && (ifp->if_type != IFT_CARP || !carp_match) -#endif - ) { + if (!bridged && la->lle_tbl->llt_ifp != ifp && !carp_match) { if (log_arp_wrong_iface) log(LOG_ERR, "arp: %s is on %s " "but got reply from %*D on %s\n", Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Tue Aug 10 22:57:43 2010 (r211156) +++ head/sys/netinet/in.c Wed Aug 11 00:51:50 2010 (r211157) @@ -33,7 +33,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_carp.h" #include "opt_mpath.h" #include @@ -891,13 +890,11 @@ in_ifinit(struct ifnet *ifp, struct in_i ia->ia_net = i & ia->ia_netmask; ia->ia_subnet = i & ia->ia_subnetmask; in_socktrim(&ia->ia_sockmask); -#ifdef DEV_CARP /* * XXX: carp(4) does not have interface route */ if (ifp->if_type == IFT_CARP) return (0); -#endif /* * Add route for the network. */ @@ -1152,12 +1149,12 @@ in_scrubprefix(struct in_ifaddr *target) * the route itself to it. Make sure that routing daemons * get a heads-up. * - * XXX: a special case for carp(4) interface + * XXX: a special case for carp(4) interface - this should + * be more generally specified as an interface that + * doesn't support such action. */ if ((ia->ia_flags & IFA_ROUTE) == 0 -#ifdef DEV_CARP && (ia->ia_ifp->if_type != IFT_CARP) -#endif ) { IN_IFADDR_RUNLOCK(); rtinit(&(target->ia_ifa), (int)RTM_DELETE, Modified: head/sys/netinet/in_proto.c ============================================================================== --- head/sys/netinet/in_proto.c Tue Aug 10 22:57:43 2010 (r211156) +++ head/sys/netinet/in_proto.c Wed Aug 11 00:51:50 2010 (r211157) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ipsec.h" #include "opt_inet6.h" #include "opt_pf.h" -#include "opt_carp.h" #include "opt_sctp.h" #include "opt_mpath.h" @@ -94,10 +93,6 @@ static struct pr_usrreqs nousrreqs; #include #endif -#ifdef DEV_CARP -#include -#endif - extern struct domain inetdomain; /* Spacer for loadable protocols. */ @@ -330,18 +325,6 @@ struct protosw inetsw[] = { .pr_usrreqs = &rip_usrreqs }, #endif /* DEV_PFSYNC */ -#ifdef DEV_CARP -{ - .pr_type = SOCK_RAW, - .pr_domain = &inetdomain, - .pr_protocol = IPPROTO_CARP, - .pr_flags = PR_ATOMIC|PR_ADDR, - .pr_input = carp_input, - .pr_output = (pr_output_t*)rip_output, - .pr_ctloutput = rip_ctloutput, - .pr_usrreqs = &rip_usrreqs -}, -#endif /* DEV_CARP */ /* Spacer n-times for loadable protocols. */ IPPROTOSPACER, IPPROTOSPACER, @@ -413,6 +396,3 @@ SYSCTL_NODE(_net_inet, IPPROTO_RAW, raw, #ifdef DEV_PFSYNC SYSCTL_NODE(_net_inet, IPPROTO_PFSYNC, pfsync, CTLFLAG_RW, 0, "PFSYNC"); #endif -#ifdef DEV_CARP -SYSCTL_NODE(_net_inet, IPPROTO_CARP, carp, CTLFLAG_RW, 0, "CARP"); -#endif Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Tue Aug 10 22:57:43 2010 (r211156) +++ head/sys/netinet/ip_carp.c Wed Aug 11 00:51:50 2010 (r211157) @@ -27,7 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_carp.h" #include "opt_bpf.h" #include "opt_inet.h" #include "opt_inet6.h" @@ -44,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #ifdef INET6 #include #include +#include #include #include #include @@ -134,8 +135,29 @@ struct carp_softc { }; #define SC2IFP(sc) ((sc)->sc_ifp) +/* These are external networking stack hooks for CARP */ +/* net/if.c */ +extern void (*carp_linkstate_p)(struct ifnet *); +/* net/if_bridge.c net/if_ethersubr.c */ +extern struct ifnet *(*carp_forus_p)(struct ifnet *, u_char *); +/* net/if_ethersubr.c */ +extern int (*carp_output_p)(struct ifnet *, struct mbuf *, + struct sockaddr *, struct rtentry *); +#ifdef INET +/* netinet/if_ether.c */ +extern int (*carp_iamatch_p)(struct ifnet *, struct in_ifaddr *, + struct in_addr *, u_int8_t **); +#endif +#ifdef INET6 +/* netinet6/nd6_nbr.c */ +extern struct ifaddr *(*carp_iamatch6_p)(struct ifnet *, struct in6_addr *); +extern caddr_t (*carp_macmatch6_p)(struct ifnet *, struct mbuf *, + const struct in6_addr *); +#endif + int carp_suppress_preempt = 0; int carp_opts[CARPCTL_MAXID] = { 0, 1, 0, 1, 0, 0 }; /* XXX for now */ +SYSCTL_NODE(_net_inet, IPPROTO_CARP, carp, CTLFLAG_RW, 0, "CARP"); SYSCTL_INT(_net_inet_carp, CARPCTL_ALLOW, allow, CTLFLAG_RW, &carp_opts[CARPCTL_ALLOW], 0, "Accept incoming CARP packets"); SYSCTL_INT(_net_inet_carp, CARPCTL_PREEMPT, preempt, CTLFLAG_RW, @@ -160,6 +182,10 @@ struct carp_if { struct mtx vhif_mtx; }; +#define CARP_INET 0 +#define CARP_INET6 1 +static int proto_reg[] = {-1, -1}; + /* Get carp_if from softc. Valid after carp_set_addr{,6}. */ #define SC2CIF(sc) ((struct carp_if *)(sc)->sc_carpdev->if_carp) @@ -1146,14 +1172,15 @@ carp_addrcount(struct carp_if *cif, stru } int -carp_iamatch(void *v, struct in_ifaddr *ia, +carp_iamatch(struct ifnet *ifp, struct in_ifaddr *ia, struct in_addr *isaddr, u_int8_t **enaddr) { - struct carp_if *cif = v; + struct carp_if *cif; struct carp_softc *vh; int index, count = 0; struct ifaddr *ifa; + cif = ifp->if_carp; CARP_LOCK(cif); if (carp_opts[CARPCTL_ARPBALANCE]) { @@ -1222,12 +1249,13 @@ carp_iamatch(void *v, struct in_ifaddr * #ifdef INET6 struct ifaddr * -carp_iamatch6(void *v, struct in6_addr *taddr) +carp_iamatch6(struct ifnet *ifp, struct in6_addr *taddr) { - struct carp_if *cif = v; + struct carp_if *cif; struct carp_softc *vh; struct ifaddr *ifa; + cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) { IF_ADDR_LOCK(SC2IFP(vh)); @@ -1250,14 +1278,15 @@ carp_iamatch6(void *v, struct in6_addr * return (NULL); } -void * -carp_macmatch6(void *v, struct mbuf *m, const struct in6_addr *taddr) +caddr_t +carp_macmatch6(struct ifnet *ifp, struct mbuf *m, const struct in6_addr *taddr) { struct m_tag *mtag; - struct carp_if *cif = v; + struct carp_if *cif; struct carp_softc *sc; struct ifaddr *ifa; + cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(sc, &cif->vhif_vrs, sc_list) { IF_ADDR_LOCK(SC2IFP(sc)); @@ -1293,15 +1322,16 @@ carp_macmatch6(void *v, struct mbuf *m, #endif struct ifnet * -carp_forus(void *v, void *dhost) +carp_forus(struct ifnet *ifp, u_char *dhost) { - struct carp_if *cif = v; + struct carp_if *cif; struct carp_softc *vh; u_int8_t *ena = dhost; if (ena[0] || ena[1] || ena[2] != 0x5e || ena[3] || ena[4] != 1) return (NULL); + cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) if ((SC2IFP(vh)->if_flags & IFF_UP) && @@ -2210,10 +2240,11 @@ carp_set_state(struct carp_softc *sc, in } void -carp_carpdev_state(void *v) +carp_carpdev_state(struct ifnet *ifp) { - struct carp_if *cif = v; + struct carp_if *cif; + cif = ifp->if_carp; CARP_LOCK(cif); carp_carpdev_state_locked(cif); CARP_UNLOCK(cif); @@ -2264,24 +2295,121 @@ carp_sc_state_locked(struct carp_softc * return; } +#ifdef INET +extern struct domain inetdomain; +static struct protosw in_carp_protosw = { + .pr_type = SOCK_RAW, + .pr_domain = &inetdomain, + .pr_protocol = IPPROTO_CARP, + .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_input = carp_input, + .pr_output = (pr_output_t *)rip_output, + .pr_ctloutput = rip_ctloutput, + .pr_usrreqs = &rip_usrreqs +}; +#endif + +#ifdef INET6 +extern struct domain inet6domain; +static struct ip6protosw in6_carp_protosw = { + .pr_type = SOCK_RAW, + .pr_domain = &inet6domain, + .pr_protocol = IPPROTO_CARP, + .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_input = carp6_input, + .pr_output = rip6_output, + .pr_ctloutput = rip6_ctloutput, + .pr_usrreqs = &rip6_usrreqs +}; +#endif + +static void +carp_mod_cleanup(void) +{ + + if (if_detach_event_tag == NULL) + return; + EVENTHANDLER_DEREGISTER(ifnet_departure_event, if_detach_event_tag); + if_clone_detach(&carp_cloner); +#ifdef INET + if (proto_reg[CARP_INET] == 0) { + pf_proto_unregister(PF_INET, IPPROTO_CARP, SOCK_RAW); + proto_reg[CARP_INET] = -1; + } + carp_iamatch_p = NULL; +#endif +#ifdef INET6 + if (proto_reg[CARP_INET6] == 0) { + pf_proto_unregister(PF_INET6, IPPROTO_CARP, SOCK_RAW); + proto_reg[CARP_INET6] = -1; + } + carp_iamatch6_p = NULL; + carp_macmatch6_p = NULL; +#endif + carp_linkstate_p = NULL; + carp_forus_p = NULL; + carp_output_p = NULL; + mtx_destroy(&carp_mtx); +} + +static int +carp_mod_load(void) +{ + + if_detach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event, + carp_ifdetach, NULL, EVENTHANDLER_PRI_ANY); + if (if_detach_event_tag == NULL) + return (ENOMEM); + mtx_init(&carp_mtx, "carp_mtx", NULL, MTX_DEF); + LIST_INIT(&carpif_list); + if_clone_attach(&carp_cloner); + carp_linkstate_p = carp_carpdev_state; + carp_forus_p = carp_forus; + carp_output_p = carp_output; +#ifdef INET6 + carp_iamatch6_p = carp_iamatch6; + carp_macmatch6_p = carp_macmatch6; + proto_reg[CARP_INET6] = pf_proto_register(PF_INET6, + (struct protosw *)&in6_carp_protosw); + if (proto_reg[CARP_INET6] != 0) { + printf("carp: error %d attaching to PF_INET6\n", + proto_reg[CARP_INET6]); + carp_mod_cleanup(); + return (EINVAL); + } +#endif +#ifdef INET + carp_iamatch_p = carp_iamatch; + proto_reg[CARP_INET] = pf_proto_register(PF_INET, &in_carp_protosw); + if (proto_reg[CARP_INET] != 0) { + printf("carp: error %d attaching to PF_INET\n", + proto_reg[CARP_INET]); + carp_mod_cleanup(); + return (EINVAL); + } +#endif + return 0; +} + static int carp_modevent(module_t mod, int type, void *data) { switch (type) { case MOD_LOAD: - if_detach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event, - carp_ifdetach, NULL, EVENTHANDLER_PRI_ANY); - if (if_detach_event_tag == NULL) - return (ENOMEM); - mtx_init(&carp_mtx, "carp_mtx", NULL, MTX_DEF); - LIST_INIT(&carpif_list); - if_clone_attach(&carp_cloner); - break; - + return carp_mod_load(); + /* NOTREACHED */ case MOD_UNLOAD: - EVENTHANDLER_DEREGISTER(ifnet_departure_event, if_detach_event_tag); - if_clone_detach(&carp_cloner); - mtx_destroy(&carp_mtx); + /* + * XXX: For now, disallow module unloading by default due to + * a race condition where a thread may dereference one of the + * function pointer hooks after the module has been + * unloaded, during processing of a packet, causing a panic. + */ +#ifdef CARPMOD_CAN_UNLOAD + carp_mod_cleanup(); +#else + return (EBUSY); +#endif break; default: Modified: head/sys/netinet/ip_carp.h ============================================================================== --- head/sys/netinet/ip_carp.h Tue Aug 10 22:57:43 2010 (r211156) +++ head/sys/netinet/ip_carp.h Wed Aug 11 00:51:50 2010 (r211157) @@ -157,15 +157,15 @@ struct carpreq { } #ifdef _KERNEL -void carp_carpdev_state(void *); +void carp_carpdev_state(struct ifnet *); void carp_input (struct mbuf *, int); int carp6_input (struct mbuf **, int *, int); int carp_output (struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); -int carp_iamatch (void *, struct in_ifaddr *, struct in_addr *, +int carp_iamatch (struct ifnet *, struct in_ifaddr *, struct in_addr *, u_int8_t **); -struct ifaddr *carp_iamatch6(void *, struct in6_addr *); -void *carp_macmatch6(void *, struct mbuf *, const struct in6_addr *); -struct ifnet *carp_forus (void *, void *); +struct ifaddr *carp_iamatch6(struct ifnet *, struct in6_addr *); +caddr_t carp_macmatch6(struct ifnet *, struct mbuf *, const struct in6_addr *); +struct ifnet *carp_forus (struct ifnet *, u_char *); #endif #endif /* _IP_CARP_H */ Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Tue Aug 10 22:57:43 2010 (r211156) +++ head/sys/netinet/ip_input.c Wed Aug 11 00:51:50 2010 (r211157) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ipstealth.h" #include "opt_ipsec.h" #include "opt_route.h" -#include "opt_carp.h" #include #include @@ -74,9 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef DEV_CARP #include -#endif #ifdef IPSEC #include #endif /* IPSEC */ @@ -606,10 +603,7 @@ passin: */ checkif = V_ip_checkinterface && (V_ipforwarding == 0) && ifp != NULL && ((ifp->if_flags & IFF_LOOPBACK) == 0) && -#ifdef DEV_CARP - !ifp->if_carp && -#endif - (dchg == 0); + ifp->if_carp == NULL && (dchg == 0); /* * Check for exact addresses in the hash bucket. Modified: head/sys/netinet6/in6_proto.c ============================================================================== --- head/sys/netinet6/in6_proto.c Tue Aug 10 22:57:43 2010 (r211156) +++ head/sys/netinet6/in6_proto.c Wed Aug 11 00:51:50 2010 (r211157) @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_ipsec.h" #include "opt_ipstealth.h" -#include "opt_carp.h" #include "opt_sctp.h" #include "opt_mpath.h" #include "opt_route.h" @@ -112,10 +111,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef DEV_CARP -#include -#endif - #ifdef SCTP #include #include @@ -336,18 +331,6 @@ struct ip6protosw inet6sw[] = { .pr_ctloutput = rip6_ctloutput, .pr_usrreqs = &rip6_usrreqs }, -#ifdef DEV_CARP -{ - .pr_type = SOCK_RAW, - .pr_domain = &inet6domain, - .pr_protocol = IPPROTO_CARP, - .pr_flags = PR_ATOMIC|PR_ADDR, - .pr_input = carp6_input, - .pr_output = rip6_output, - .pr_ctloutput = rip6_ctloutput, - .pr_usrreqs = &rip6_usrreqs -}, -#endif /* DEV_CARP */ /* Spacer n-times for loadable protocols. */ IP6PROTOSPACER, IP6PROTOSPACER, Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Tue Aug 10 22:57:43 2010 (r211156) +++ head/sys/netinet6/nd6_nbr.c Wed Aug 11 00:51:50 2010 (r211157) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" -#include "opt_carp.h" #include "opt_mpath.h" #include @@ -74,10 +73,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef DEV_CARP -#include -#endif - #define SDL(s) ((struct sockaddr_dl *)s) struct dadq; @@ -89,6 +84,10 @@ static void nd6_dad_ns_output(struct dad static void nd6_dad_ns_input(struct ifaddr *); static void nd6_dad_na_input(struct ifaddr *); +struct ifaddr *(*carp_iamatch6_p)(struct ifnet *, struct in6_addr *); +caddr_t (*carp_macmatch6_p)(struct ifnet *, struct mbuf *, + const struct in6_addr *); + VNET_DEFINE(int, dad_ignore_ns) = 0; /* ignore NS in DAD - specwise incorrect*/ VNET_DEFINE(int, dad_maxtry) = 15; /* max # of *tries* to transmit DAD packet */ #define V_dad_ignore_ns VNET(dad_ignore_ns) @@ -222,14 +221,10 @@ nd6_ns_input(struct mbuf *m, int off, in * (3) "tentative" address on which DAD is being performed. */ /* (1) and (3) check. */ -#ifdef DEV_CARP if (ifp->if_carp) - ifa = carp_iamatch6(ifp->if_carp, &taddr6); + ifa = (*carp_iamatch6_p)(ifp, &taddr6); if (ifa == NULL) ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); -#else - ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); -#endif /* (2) check. */ if (ifa == NULL) { @@ -1029,14 +1024,10 @@ nd6_na_output(struct ifnet *ifp, const s * my address) use lladdr configured for the interface. */ if (sdl0 == NULL) { -#ifdef DEV_CARP if (ifp->if_carp) - mac = carp_macmatch6(ifp->if_carp, m, taddr6); + mac = (*carp_macmatch6_p)(ifp, m, taddr6); if (mac == NULL) mac = nd6_ifptomac(ifp); -#else - mac = nd6_ifptomac(ifp); -#endif } else if (sdl0->sa_family == AF_LINK) { struct sockaddr_dl *sdl; sdl = (struct sockaddr_dl *)sdl0; From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 02:13:51 2010 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 140001065670; Wed, 11 Aug 2010 02:13:51 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 023CD8FC1B; Wed, 11 Aug 2010 02:13:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7B2Doqa003437; Wed, 11 Aug 2010 02:13:50 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7B2DoAD003436; Wed, 11 Aug 2010 02:13:50 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201008110213.o7B2DoAD003436@svn.freebsd.org> From: Neel Natu Date: Wed, 11 Aug 2010 02:13: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: r211158 - head/sys/dev/cfe 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, 11 Aug 2010 02:13:51 -0000 Author: neel Date: Wed Aug 11 02:13:50 2010 New Revision: 211158 URL: http://svn.freebsd.org/changeset/base/211158 Log: Start using the 'init_static_kenv()' API provided by r198561 to initialize CFE environment variables. Modified: head/sys/dev/cfe/cfe_env.c Modified: head/sys/dev/cfe/cfe_env.c ============================================================================== --- head/sys/dev/cfe/cfe_env.c Wed Aug 11 00:51:50 2010 (r211157) +++ head/sys/dev/cfe/cfe_env.c Wed Aug 11 02:13:50 2010 (r211158) @@ -25,8 +25,7 @@ */ #include -#include -#include +#include #include @@ -43,32 +42,20 @@ static char cfe_env_buf[CFE_ENV_SIZE]; void cfe_env_init(void) { - int idx, len; - char name[64], val[128], *cp, *cplim; + int idx; + char name[KENV_MNAMELEN], val[KENV_MVALLEN]; - cp = cfe_env_buf; - cplim = cp + CFE_ENV_SIZE; + init_static_kenv(cfe_env_buf, CFE_ENV_SIZE); idx = 0; while (1) { if (cfe_enumenv(idx, name, sizeof(name), val, sizeof(val)) != 0) break; - if (bootverbose) - printf("Importing CFE env: \"%s=%s\"\n", name, val); - - /* - * name=val\0\0 - */ - len = strlen(name) + 1 + strlen(val) + 1 + 1; - if (cplim - cp < len) + if (setenv(name, val) != 0) { printf("No space to store CFE env: \"%s=%s\"\n", name, val); - else - cp += sprintf(cp, "%s=%s", name, val) + 1; + } ++idx; } - *cp++ = '\0'; - - kern_envp = cfe_env_buf; } From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 02:28:39 2010 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 E6591106566B; Wed, 11 Aug 2010 02:28:39 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB4518FC0A; Wed, 11 Aug 2010 02:28:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7B2Sdql006782; Wed, 11 Aug 2010 02:28:39 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7B2Sdef006779; Wed, 11 Aug 2010 02:28:39 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201008110228.o7B2Sdef006779@svn.freebsd.org> From: Neel Natu Date: Wed, 11 Aug 2010 02:28: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: r211159 - in head: libexec/rtld-elf/mips sys/mips/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, 11 Aug 2010 02:28:40 -0000 Author: neel Date: Wed Aug 11 02:28:39 2010 New Revision: 211159 URL: http://svn.freebsd.org/changeset/base/211159 Log: Add parentheses around the argument 'x' used in the __bswapXX(x) macros. Revert r211130 in favor of this more general fix. This fixes a compilation error for mips 64-bit little endian build. libexec/rtld-elf/mips/reloc.c:196: warning: right shift count >= width of type Suggested by: stefanf, jchandra, bde Modified: head/libexec/rtld-elf/mips/reloc.c head/sys/mips/include/endian.h Modified: head/libexec/rtld-elf/mips/reloc.c ============================================================================== --- head/libexec/rtld-elf/mips/reloc.c Wed Aug 11 02:13:50 2010 (r211158) +++ head/libexec/rtld-elf/mips/reloc.c Wed Aug 11 02:28:39 2010 (r211159) @@ -83,7 +83,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn #undef ELF_R_SYM #undef ELF_R_TYPE #define ELF_R_SYM(r_info) ((r_info) & 0xffffffff) -#define ELF_R_TYPE(r_info) bswap32(((r_info) >> 32)) +#define ELF_R_TYPE(r_info) bswap32((r_info) >> 32) #endif #else #define ELF_R_NXTTYPE_64_P(r_type) (0) Modified: head/sys/mips/include/endian.h ============================================================================== --- head/sys/mips/include/endian.h Wed Aug 11 02:13:50 2010 (r211158) +++ head/sys/mips/include/endian.h Wed Aug 11 02:28:39 2010 (r211159) @@ -108,12 +108,12 @@ __bswap64_var(__uint64_t _x) ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))); } -#define __bswap16(x) (__uint16_t)(__is_constant(x) ? \ - __bswap16_const((__uint16_t)x) : __bswap16_var((__uint16_t)x)) -#define __bswap32(x) (__uint32_t)(__is_constant(x) ? \ - __bswap32_const((__uint32_t)x) : __bswap32_var((__uint32_t)x)) -#define __bswap64(x) (__uint64_t)(__is_constant(x) ? \ - __bswap64_const((__uint64_t)x) : __bswap64_var((__uint64_t)x)) +#define __bswap16(x) ((__uint16_t)(__is_constant((x)) ? \ + __bswap16_const((__uint16_t)(x)) : __bswap16_var((__uint16_t)(x)))) +#define __bswap32(x) ((__uint32_t)(__is_constant((x)) ? \ + __bswap32_const((__uint32_t)(x)) : __bswap32_var((__uint32_t)(x)))) +#define __bswap64(x) ((__uint64_t)(__is_constant((x)) ? \ + __bswap64_const((__uint64_t)(x)) : __bswap64_var((__uint64_t)(x)))) #ifdef __MIPSEB__ #define __htonl(x) ((__uint32_t)(x)) From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 03:08:04 2010 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 834541065674; Wed, 11 Aug 2010 03:08:04 +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 4A4838FC1F; Wed, 11 Aug 2010 03:08:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7B384JJ015795; Wed, 11 Aug 2010 03:08:04 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7B384gd015790; Wed, 11 Aug 2010 03:08:04 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201008110308.o7B384gd015790@svn.freebsd.org> From: Rick Macklem Date: Wed, 11 Aug 2010 03:08: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: r211160 - in stable/8/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, 11 Aug 2010 03:08:04 -0000 Author: rmacklem Date: Wed Aug 11 03:08:03 2010 New Revision: 211160 URL: http://svn.freebsd.org/changeset/base/211160 Log: MFC: r210786 Modify the return value for nfscl_mustflush() from boolean_t, which I mistakenly thought was correct w.r.t. style(9), back to int and add the checks for != 0. This is just a stylistic modification. Modified: stable/8/sys/fs/nfs/nfs_var.h stable/8/sys/fs/nfsclient/nfs_clstate.c stable/8/sys/fs/nfsclient/nfs_clsubs.c stable/8/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/8/sys/fs/nfs/nfs_var.h Wed Aug 11 02:28:39 2010 (r211159) +++ stable/8/sys/fs/nfs/nfs_var.h Wed Aug 11 03:08:03 2010 (r211160) @@ -469,7 +469,7 @@ void nfscl_docb(struct nfsrv_descript *, void nfscl_releasealllocks(struct nfsclclient *, vnode_t, NFSPROC_T *); int nfscl_lockt(vnode_t, struct nfsclclient *, u_int64_t, u_int64_t, struct flock *, NFSPROC_T *); -boolean_t nfscl_mustflush(vnode_t); +int nfscl_mustflush(vnode_t); int nfscl_nodeleg(vnode_t, int); int nfscl_removedeleg(vnode_t, NFSPROC_T *, nfsv4stateid_t *); int nfscl_getref(struct nfsmount *); Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clstate.c Wed Aug 11 02:28:39 2010 (r211159) +++ stable/8/sys/fs/nfsclient/nfs_clstate.c Wed Aug 11 03:08:03 2010 (r211160) @@ -3735,7 +3735,7 @@ nfscl_tryclose(struct nfsclopen *op, str * to the server. This might be a big performance win in some environments. * (Not useful until the client does caching on local stable storage.) */ -APPLESTATIC boolean_t +APPLESTATIC int nfscl_mustflush(vnode_t vp) { struct nfsclclient *clp; @@ -3746,12 +3746,12 @@ nfscl_mustflush(vnode_t vp) np = VTONFS(vp); nmp = VFSTONFS(vnode_mount(vp)); if (!NFSHASNFSV4(nmp)) - return (TRUE); + return (1); NFSLOCKCLSTATE(); clp = nfscl_findcl(nmp); if (clp == NULL) { NFSUNLOCKCLSTATE(); - return (TRUE); + return (1); } dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); if (dp != NULL && (dp->nfsdl_flags & (NFSCLDL_WRITE | NFSCLDL_RECALL)) @@ -3759,10 +3759,10 @@ nfscl_mustflush(vnode_t vp) (dp->nfsdl_sizelimit >= np->n_size || !NFSHASSTRICT3530(nmp))) { NFSUNLOCKCLSTATE(); - return (FALSE); + return (0); } NFSUNLOCKCLSTATE(); - return (TRUE); + return (1); } /* Modified: stable/8/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clsubs.c Wed Aug 11 02:28:39 2010 (r211159) +++ stable/8/sys/fs/nfsclient/nfs_clsubs.c Wed Aug 11 03:08:03 2010 (r211160) @@ -187,8 +187,7 @@ ncl_getattrcache(struct vnode *vp, struc struct nfsnode *np; struct vattr *vap; struct nfsmount *nmp; - int timeo; - boolean_t mustflush; + int timeo, mustflush; np = VTONFS(vp); vap = &np->n_vattr.na_vattr; @@ -230,7 +229,7 @@ ncl_getattrcache(struct vnode *vp, struc #endif if ((time_second - np->n_attrstamp) >= timeo && - (mustflush || np->n_attrstamp == 0)) { + (mustflush != 0 || np->n_attrstamp == 0)) { newnfsstats.attrcache_misses++; mtx_unlock(&np->n_mtx); #ifdef NFS_ACDEBUG Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Wed Aug 11 02:28:39 2010 (r211159) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Wed Aug 11 03:08:03 2010 (r211160) @@ -506,7 +506,8 @@ nfs_open(struct vop_open_args *ap) * Now, if this Open will be doing reading, re-validate/flush the * cache, so that Close/Open coherency is maintained. */ - if ((fmode & FREAD) && (!NFS_ISV4(vp) || nfscl_mustflush(vp))) { + if ((fmode & FREAD) != 0 && + (!NFS_ISV4(vp) || nfscl_mustflush(vp) != 0)) { mtx_lock(&np->n_mtx); if (np->n_flag & NMODIFIED) { mtx_unlock(&np->n_mtx); @@ -678,7 +679,7 @@ nfs_close(struct vop_close_args *ap) error = ncl_flush(vp, MNT_WAIT, cred, ap->a_td, cm, 0); /* np->n_flag &= ~NMODIFIED; */ } else if (NFS_ISV4(vp)) { - if (nfscl_mustflush(vp)) { + if (nfscl_mustflush(vp) != 0) { int cm = newnfs_commit_on_close ? 1 : 0; error = ncl_flush(vp, MNT_WAIT, cred, ap->a_td, cm, 0); @@ -720,7 +721,7 @@ nfs_close(struct vop_close_args *ap) /* * Get attributes so "change" is up to date. */ - if (error == 0 && nfscl_mustflush(vp)) { + if (error == 0 && nfscl_mustflush(vp) != 0) { ret = nfsrpc_getattr(vp, cred, ap->a_td, &nfsva, NULL); if (!ret) { From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 06:29:40 2010 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 C3F87106566B; Wed, 11 Aug 2010 06:29:40 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B33B58FC12; Wed, 11 Aug 2010 06:29:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7B6TeRR064488; Wed, 11 Aug 2010 06:29:40 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7B6TetE064486; Wed, 11 Aug 2010 06:29:40 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201008110629.o7B6TetE064486@svn.freebsd.org> From: Bernhard Schmidt Date: Wed, 11 Aug 2010 06:29:40 +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: r211165 - stable/8/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, 11 Aug 2010 06:29:40 -0000 Author: bschmidt Date: Wed Aug 11 06:29:40 2010 New Revision: 211165 URL: http://svn.freebsd.org/changeset/base/211165 Log: MFC r211063: License ACK is not required for the wpifw module nor when building it into the kernel. PR: conf/148758 Submitted by: Joe Talbott 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 A769A1065674; Wed, 11 Aug 2010 06:43:14 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 973338FC16; Wed, 11 Aug 2010 06:43:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7B6hEBX067782; Wed, 11 Aug 2010 06:43:14 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7B6hEq7067780; Wed, 11 Aug 2010 06:43:14 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201008110643.o7B6hEq7067780@svn.freebsd.org> From: "Jayachandran C." Date: Wed, 11 Aug 2010 06:43: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: r211167 - head/sys/mips/mips 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, 11 Aug 2010 06:43:14 -0000 Author: jchandra Date: Wed Aug 11 06:43:14 2010 New Revision: 211167 URL: http://svn.freebsd.org/changeset/base/211167 Log: Fix compilation when DDB disabled. Adds 'ifdef DDB' around DB_SHOW_COMMAND definitions. Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Wed Aug 11 06:33:38 2010 (r211166) +++ head/sys/mips/mips/pmap.c Wed Aug 11 06:43:14 2010 (r211167) @@ -3052,6 +3052,7 @@ pmap_align_tlb(vm_offset_t *addr) return; } +#ifdef DDB DB_SHOW_COMMAND(ptable, ddb_pid_dump) { pmap_t pmap; @@ -3077,9 +3078,8 @@ DB_SHOW_COMMAND(ptable, ddb_pid_dump) pmap = kernel_pmap; db_printf("pmap:%p segtab:%p asid:%x generation:%x\n", - pmap, pmap->pm_segtab, - pmap->pm_asid[0].asid, - pmap->pm_asid[0].gen); + pmap, pmap->pm_segtab, pmap->pm_asid[0].asid, + pmap->pm_asid[0].gen); for (i = 0; i < NPDEPG; i++) { pd_entry_t *pdpe; pt_entry_t *pde; @@ -3112,7 +3112,7 @@ DB_SHOW_COMMAND(ptable, ddb_pid_dump) } } } - +#endif #if defined(DEBUG) From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 07:02:11 2010 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 F317B106566B; Wed, 11 Aug 2010 07:02:10 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E22F68FC15; Wed, 11 Aug 2010 07:02:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7B72AD5072307; Wed, 11 Aug 2010 07:02:10 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7B729WN072306; Wed, 11 Aug 2010 07:02:09 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201008110702.o7B729WN072306@svn.freebsd.org> From: Bernhard Schmidt Date: Wed, 11 Aug 2010 07:02: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: r211169 - 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: Wed, 11 Aug 2010 07:02:11 -0000 Author: bschmidt Date: Wed Aug 11 07:02:08 2010 New Revision: 211169 URL: http://svn.freebsd.org/changeset/base/211169 Log: MFC r210959: Obviously the option is known as COMPAT_LINUX32 on amd64. PR: docs/149182 Pointed out by: Fernando Modified: stable/8/share/man/man4/linux.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/linux.4 ============================================================================== --- stable/8/share/man/man4/linux.4 Wed Aug 11 06:49:29 2010 (r211168) +++ stable/8/share/man/man4/linux.4 Wed Aug 11 07:02:08 2010 (r211169) @@ -31,13 +31,18 @@ .Nm linux .Nd Linux ABI support .Sh SYNOPSIS -To compile support for this ABI into the kernel, +To compile support for this ABI into an i386 kernel place the following line in your kernel configuration file: .Bd -ragged -offset indent .Cd "options COMPAT_LINUX" .Ed .Pp +for an amd64 kernel use: +.Bd -ragged -offset indent +.Cd "options COMPAT_LINUX32" +.Ed +.Pp Alternatively, to load the ABI as a module at boot time, place the following line in .Xr loader.conf 5 : From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 07:11:20 2010 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 7F2DB106567F; Wed, 11 Aug 2010 07:11:20 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 541DD8FC1F; Wed, 11 Aug 2010 07:11:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7B7BK8B074501; Wed, 11 Aug 2010 07:11:20 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7B7BKOE074498; Wed, 11 Aug 2010 07:11:20 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201008110711.o7B7BKOE074498@svn.freebsd.org> From: Bernhard Schmidt Date: Wed, 11 Aug 2010 07:11:20 +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: r211171 - in stable/8/sys: amd64/conf i386/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, 11 Aug 2010 07:11:20 -0000 Author: bschmidt Date: Wed Aug 11 07:11:20 2010 New Revision: 211171 URL: http://svn.freebsd.org/changeset/base/211171 Log: MFC r210947: Fix whitespace nits. PR: conf/148989 Submitted by: pluknet Modified: stable/8/sys/amd64/conf/GENERIC stable/8/sys/i386/conf/GENERIC Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/conf/GENERIC ============================================================================== --- stable/8/sys/amd64/conf/GENERIC Wed Aug 11 07:05:27 2010 (r211170) +++ stable/8/sys/amd64/conf/GENERIC Wed Aug 11 07:11:20 2010 (r211171) @@ -72,7 +72,7 @@ options KBD_INSTALL_CDEV # install a CD options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options MAC # TrustedBSD MAC Framework -options FLOWTABLE # per-cpu routing cache +options FLOWTABLE # per-cpu routing cache #options KDTRACE_FRAME # Ensure frames are compiled in #options KDTRACE_HOOKS # Kernel DTrace hooks options INCLUDE_CONFIG_FILE # Include this file in kernel Modified: stable/8/sys/i386/conf/GENERIC ============================================================================== --- stable/8/sys/i386/conf/GENERIC Wed Aug 11 07:05:27 2010 (r211170) +++ stable/8/sys/i386/conf/GENERIC Wed Aug 11 07:11:20 2010 (r211171) @@ -73,7 +73,7 @@ options KBD_INSTALL_CDEV # install a CD options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing options MAC # TrustedBSD MAC Framework -options FLOWTABLE # per-cpu routing cache +options FLOWTABLE # per-cpu routing cache #options KDTRACE_HOOKS # Kernel DTrace hooks options INCLUDE_CONFIG_FILE # Include this file in kernel From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 08:26:16 2010 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 A596F1065670; Wed, 11 Aug 2010 08:26:16 +0000 (UTC) (envelope-from olli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9576C8FC15; Wed, 11 Aug 2010 08:26:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7B8QG5A091761; Wed, 11 Aug 2010 08:26:16 GMT (envelope-from olli@svn.freebsd.org) Received: (from olli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7B8QGcG091760; Wed, 11 Aug 2010 08:26:16 GMT (envelope-from olli@svn.freebsd.org) Message-Id: <201008110826.o7B8QGcG091760@svn.freebsd.org> From: Oliver Fromme Date: Wed, 11 Aug 2010 08:26: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: r211172 - head/usr.sbin/kbdcontrol 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, 11 Aug 2010 08:26:16 -0000 Author: olli Date: Wed Aug 11 08:26:15 2010 New Revision: 211172 URL: http://svn.freebsd.org/changeset/base/211172 Log: Fix some typos: flush vs. flash, and some others. Approved by: des (mentor, implicit) MFC after: 1 week Modified: head/usr.sbin/kbdcontrol/kbdcontrol.1 Modified: head/usr.sbin/kbdcontrol/kbdcontrol.1 ============================================================================== --- head/usr.sbin/kbdcontrol/kbdcontrol.1 Wed Aug 11 07:11:20 2010 (r211171) +++ head/usr.sbin/kbdcontrol/kbdcontrol.1 Wed Aug 11 08:26:15 2010 (r211172) @@ -233,15 +233,15 @@ The following command will make the func .Dl kbdcontrol -f 10 \&"telnet myhost\&" .Pp In order to get the visual effect for bell, but prevent the screen -from flushing if the bell is to ring in the background screen, +from flashing if the bell is to ring in the background screen, run the following command. .Pp .Dl kbdcontrol -b quiet.visual .Pp -To change the default console keyboard to the another keyboard, +To change the default console keyboard to another keyboard, for example the first USB keyboard (see .Xr ukbd 4 ) , -use the following commands. +use the following command. .Pp .Dl kbdcontrol -k /dev/ukbd0 < /dev/console .Pp From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 08:58:28 2010 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 17EED1065676; Wed, 11 Aug 2010 08:58:28 +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 05D608FC0C; Wed, 11 Aug 2010 08:58:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7B8wRVO099283; Wed, 11 Aug 2010 08:58:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7B8wRcf099282; Wed, 11 Aug 2010 08:58:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008110858.o7B8wRcf099282@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 11 Aug 2010 08:58:27 +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: r211173 - stable/8/sys/compat/freebsd32 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, 11 Aug 2010 08:58:28 -0000 Author: kib Date: Wed Aug 11 08:58:27 2010 New Revision: 211173 URL: http://svn.freebsd.org/changeset/base/211173 Log: MFC r210847: Fix style. Modified: stable/8/sys/compat/freebsd32/freebsd32_misc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_misc.c Wed Aug 11 08:26:15 2010 (r211172) +++ stable/8/sys/compat/freebsd32/freebsd32_misc.c Wed Aug 11 08:58:27 2010 (r211173) @@ -1619,8 +1619,9 @@ freebsd32_sendfile(struct thread *td, st } static void -copy_stat( struct stat *in, struct stat32 *out) +copy_stat(struct stat *in, struct stat32 *out) { + CP(*in, *out, st_dev); CP(*in, *out, st_ino); CP(*in, *out, st_mode); From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 09:04:38 2010 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 55066106566B; Wed, 11 Aug 2010 09:04:38 +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 4403F8FC15; Wed, 11 Aug 2010 09:04:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7B94bNw000857; Wed, 11 Aug 2010 09:04:38 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7B94b3F000856; Wed, 11 Aug 2010 09:04:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008110904.o7B94b3F000856@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 11 Aug 2010 09:04:37 +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: r211174 - stable/8/sys/compat/freebsd32 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, 11 Aug 2010 09:04:38 -0000 Author: kib Date: Wed Aug 11 09:04:36 2010 New Revision: 211174 URL: http://svn.freebsd.org/changeset/base/211174 Log: MFC r210848: Copy inode birthtime to the struct stat32. Modified: stable/8/sys/compat/freebsd32/freebsd32_misc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_misc.c Wed Aug 11 08:58:27 2010 (r211173) +++ stable/8/sys/compat/freebsd32/freebsd32_misc.c Wed Aug 11 09:04:36 2010 (r211174) @@ -1637,6 +1637,7 @@ copy_stat(struct stat *in, struct stat32 CP(*in, *out, st_blksize); CP(*in, *out, st_flags); CP(*in, *out, st_gen); + TS_CP(*in, *out, st_birthtimespec); } int From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 09:13:12 2010 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 6195D1065670; Wed, 11 Aug 2010 09:13:12 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 1F9568FC13; Wed, 11 Aug 2010 09:13:11 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 13DF11FFC33; Wed, 11 Aug 2010 09:13:10 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 9628584528; Wed, 11 Aug 2010 11:13:10 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "M. Warner Losh" References: <20100810.120103.69891821625677670.imp@bsdimp.com> <201008101956.o7AJu5ms044774@haluter.fromme.com> <20100810.141958.923962171922746057.imp@bsdimp.com> Date: Wed, 11 Aug 2010 11:13:10 +0200 In-Reply-To: <20100810.141958.923962171922746057.imp@bsdimp.com> (M. Warner Losh's message of "Tue, 10 Aug 2010 14:19:58 -0600 (MDT)") Message-ID: <86fwylecm1.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@fromme.com, olli@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 11 Aug 2010 09:13:12 -0000 "M. Warner Losh" writes: > You'll find that a number of structures are potentially already > allocated with less than required alignment. There's about a dozen > places in the tree that would start to fail if we did this, or the > stronger form of __aligned(8). We could add that to the other > structures, but then we're breaking ABI rules, I think. __aligned(4) won't affect struct addrinfo since the sockaddr immediately follows a socklen_t, which is 32 bits wide and has 32-bit alignment. A sockaddr_* allocated with malloc() will already be aligned, and so will a sockaddr_* created on the stack. The only problem is sockaddr_un, because its size is not a multiple of 4, so if you allocate an array of sockaddr_un, every other element will be misaligned. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 09:29:34 2010 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 914581065670; Wed, 11 Aug 2010 09:29:34 +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 816478FC16; Wed, 11 Aug 2010 09:29:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7B9TYUv006501; Wed, 11 Aug 2010 09:29:34 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7B9TYf9006500; Wed, 11 Aug 2010 09:29:34 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201008110929.o7B9TYf9006500@svn.freebsd.org> From: Kevin Lo Date: Wed, 11 Aug 2010 09:29: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: r211175 - 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, 11 Aug 2010 09:29:34 -0000 Author: kevlo Date: Wed Aug 11 09:29:33 2010 New Revision: 211175 URL: http://svn.freebsd.org/changeset/base/211175 Log: Style: tabs after #define Modified: head/include/unistd.h Modified: head/include/unistd.h ============================================================================== --- head/include/unistd.h Wed Aug 11 09:04:36 2010 (r211174) +++ head/include/unistd.h Wed Aug 11 09:29:33 2010 (r211175) @@ -74,7 +74,7 @@ typedef __useconds_t useconds_t; #define _USECONDS_T_DECLARED #endif -#define STDIN_FILENO 0 /* standard input file descriptor */ +#define STDIN_FILENO 0 /* standard input file descriptor */ #define STDOUT_FILENO 1 /* standard output file descriptor */ #define STDERR_FILENO 2 /* standard error file descriptor */ From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 10:51:27 2010 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 F20AD1065673; Wed, 11 Aug 2010 10:51:27 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6F7B8FC1D; Wed, 11 Aug 2010 10:51:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BApRiN028539; Wed, 11 Aug 2010 10:51:27 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BApRp4028538; Wed, 11 Aug 2010 10:51:27 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008111051.o7BApRp4028538@svn.freebsd.org> From: Attilio Rao Date: Wed, 11 Aug 2010 10:51: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: r211176 - 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, 11 Aug 2010 10:51:28 -0000 Author: attilio Date: Wed Aug 11 10:51:27 2010 New Revision: 211176 URL: http://svn.freebsd.org/changeset/base/211176 Log: IPI handlers may run generally with interrupts disabled because they are served via an interrupt gate. However, that doesn't explicitly prevent preemption and thread migration thus scheduler pinning may be necessary in some handlers. Fix that. Tested by: gianni MFC after: 1 month Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/i386/i386/mp_machdep.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Wed Aug 11 09:29:33 2010 (r211175) +++ head/sys/amd64/amd64/mp_machdep.c Wed Aug 11 10:51:27 2010 (r211176) @@ -1324,8 +1324,10 @@ cpustop_handler(void) cpumask_t cpumask; u_int cpu; + sched_pin(); cpu = PCPU_GET(cpuid); cpumask = PCPU_GET(cpumask); + sched_unpin(); savectx(&stoppcbs[cpu]); @@ -1356,8 +1358,10 @@ cpususpend_handler(void) register_t cr3, rf; u_int cpu; + sched_pin(); cpu = PCPU_GET(cpuid); cpumask = PCPU_GET(cpumask); + sched_unpin(); rf = intr_disable(); cr3 = rcr3(); @@ -1535,10 +1539,14 @@ mp_grab_cpu_hlt(void) #endif int retval; - mask = PCPU_GET(cpumask); #ifdef MP_WATCHDOG + sched_pin(); + mask = PCPU_GET(cpumask); cpuid = PCPU_GET(cpuid); + sched_unpin(); ap_watchdog(cpuid); +#else + mask = PCPU_GET(cpumask); #endif retval = mask & hlt_cpus_mask; Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Wed Aug 11 09:29:33 2010 (r211175) +++ head/sys/i386/i386/mp_machdep.c Wed Aug 11 10:51:27 2010 (r211176) @@ -1411,8 +1411,10 @@ cpustop_handler(void) cpumask_t cpumask; u_int cpu; + sched_pin(); cpu = PCPU_GET(cpuid); cpumask = PCPU_GET(cpumask); + sched_unpin(); savectx(&stoppcbs[cpu]); @@ -1586,10 +1588,14 @@ mp_grab_cpu_hlt(void) #endif int retval; - mask = PCPU_GET(cpumask); #ifdef MP_WATCHDOG + sched_pin(); + mask = PCPU_GET(cpumask); cpuid = PCPU_GET(cpuid); + sched_unpin(); ap_watchdog(cpuid); +#else + mask = PCPU_GET(cpumask); #endif retval = mask & hlt_cpus_mask; From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 10:57:43 2010 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 B12491065678; Wed, 11 Aug 2010 10:57:41 +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 2D2BF8FC17; Wed, 11 Aug 2010 10:57:40 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o7BAvdBO097124 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 11 Aug 2010 13:57:39 +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.4/8.14.4) with ESMTP id o7BAvdWa079109; Wed, 11 Aug 2010 13:57:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o7BAvdvJ079108; Wed, 11 Aug 2010 13:57:39 +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, 11 Aug 2010 13:57:39 +0300 From: Kostik Belousov To: Attilio Rao Message-ID: <20100811105739.GJ2396@deviant.kiev.zoral.com.ua> References: <201008111051.o7BApRp4028538@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IbVRjBtIbJdbeK1C" Content-Disposition: inline In-Reply-To: <201008111051.o7BApRp4028538@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211176 - 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, 11 Aug 2010 10:57:43 -0000 --IbVRjBtIbJdbeK1C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 11, 2010 at 10:51:27AM +0000, Attilio Rao wrote: > Author: attilio > Date: Wed Aug 11 10:51:27 2010 > New Revision: 211176 > URL: http://svn.freebsd.org/changeset/base/211176 >=20 > Log: > IPI handlers may run generally with interrupts disabled because they > are served via an interrupt gate. > =20 > However, that doesn't explicitly prevent preemption and thread > migration thus scheduler pinning may be necessary in some handlers. > Fix that. How the preemption is supposed to happen ? Aside from the explicit calls to mi_switch() from e.g. critical_exit(). --IbVRjBtIbJdbeK1C Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkxigiMACgkQC3+MBN1Mb4g8/wCgmcxZXo3fGial3FygYR56cp06 QyoAoI2CrhJs1dV8aZPIM0TK76RbCqcc =KrJU -----END PGP SIGNATURE----- --IbVRjBtIbJdbeK1C-- From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 11:21:48 2010 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 0AF9D106566B; Wed, 11 Aug 2010 11:21:48 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 7D6DC8FC12; Wed, 11 Aug 2010 11:21:47 +0000 (UTC) Received: by qwg5 with SMTP id 5so8708438qwg.13 for ; Wed, 11 Aug 2010 04:21:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=0gTY7Djr6hgMfgYZ87yx/VB9PD7gZRou+KriceR/Meg=; b=vchclsqy1sdm+W0/9/D8XZj7eMqED4On5leZJc4g3tNPLC2ULx77jKPEKgnv/JxxVm NFzFJbqbORm5FdyygSzdszc9oCT9K/mY6xToqs4C9QNnbYn4bc9QAA87wSHjj4cCan/c NgwawsEUZucIlTRi7jVE57ueiHDkiYWDFGixA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=uxh4uaNGHJY01Zl/rBCBXgrqdJ+hTlA0NnVOtaZVhn4gLPKsaf9rwM/uUbHmmYmu25 b/JnxCdyeQBtDQyMS0HCUgCjE3PN5vGBwTb6tOrYchdUBXWWCSPnjzKBty1GcvD/nXgQ A9mg0dLq3fUgu5hTy4rQv4DwP2nHnKGvVpLTo= MIME-Version: 1.0 Received: by 10.224.20.2 with SMTP id d2mr10638084qab.101.1281525706501; Wed, 11 Aug 2010 04:21:46 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.251.6 with HTTP; Wed, 11 Aug 2010 04:21:46 -0700 (PDT) In-Reply-To: <20100811105739.GJ2396@deviant.kiev.zoral.com.ua> References: <201008111051.o7BApRp4028538@svn.freebsd.org> <20100811105739.GJ2396@deviant.kiev.zoral.com.ua> Date: Wed, 11 Aug 2010 13:21:46 +0200 X-Google-Sender-Auth: 5CfGvfgRCupdU_5N1lRa4_I2-CI Message-ID: From: Attilio Rao To: Kostik Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211176 - 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, 11 Aug 2010 11:21:48 -0000 2010/8/11 Kostik Belousov : > On Wed, Aug 11, 2010 at 10:51:27AM +0000, Attilio Rao wrote: >> Author: attilio >> Date: Wed Aug 11 10:51:27 2010 >> New Revision: 211176 >> URL: http://svn.freebsd.org/changeset/base/211176 >> >> Log: >> =C2=A0 IPI handlers may run generally with interrupts disabled because t= hey >> =C2=A0 are served via an interrupt gate. >> >> =C2=A0 However, that doesn't explicitly prevent preemption and thread >> =C2=A0 migration thus scheduler pinning may be necessary in some handler= s. >> =C2=A0 Fix that. > > How the preemption is supposed to happen ? Aside from the explicit > calls to mi_switch() from e.g. critical_exit(). IIRC it should be hardclock() willing to schedule the softclock(). It is the critical_exit() in the thread_unlock() that may trigger it (sorry for not digging more, it was a while back that I hacked this part, but I guess you can verify on your own). We already have other points within the kernel that take care of dealing with preemption/migration like lapic_handle_timer(), for example. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 12:34:33 2010 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 90EC61065674; Wed, 11 Aug 2010 12:34:33 +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 0A9078FC21; Wed, 11 Aug 2010 12:34:32 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o7BCYV6Q005068 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 11 Aug 2010 15:34:31 +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.4/8.14.4) with ESMTP id o7BCYV2U079675; Wed, 11 Aug 2010 15:34:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o7BCYUdq079674; Wed, 11 Aug 2010 15:34:30 +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, 11 Aug 2010 15:34:30 +0300 From: Kostik Belousov To: Attilio Rao Message-ID: <20100811123430.GK2396@deviant.kiev.zoral.com.ua> References: <201008111051.o7BApRp4028538@svn.freebsd.org> <20100811105739.GJ2396@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="STPqjqpCrtky8aYs" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211176 - 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, 11 Aug 2010 12:34:33 -0000 --STPqjqpCrtky8aYs Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote: > 2010/8/11 Kostik Belousov : > > On Wed, Aug 11, 2010 at 10:51:27AM +0000, Attilio Rao wrote: > >> Author: attilio > >> Date: Wed Aug 11 10:51:27 2010 > >> New Revision: 211176 > >> URL: http://svn.freebsd.org/changeset/base/211176 > >> > >> Log: > >> =9A IPI handlers may run generally with interrupts disabled because th= ey > >> =9A are served via an interrupt gate. > >> > >> =9A However, that doesn't explicitly prevent preemption and thread > >> =9A migration thus scheduler pinning may be necessary in some handlers. > >> =9A Fix that. > > > > How the preemption is supposed to happen ? Aside from the explicit > > calls to mi_switch() from e.g. critical_exit(). >=20 > IIRC it should be hardclock() willing to schedule the softclock(). It > is the critical_exit() in the thread_unlock() that may trigger it > (sorry for not digging more, it was a while back that I hacked this > part, but I guess you can verify on your own). > We already have other points within the kernel that take care of > dealing with preemption/migration like lapic_handle_timer(), for > example. Right, and if the interrupts are indeed disabled, I do not see how the preemption may be triggered in the fragments like cpu =3D PCPU_GET(cpuid); cpumask =3D PCPU_GET(cpumask); --STPqjqpCrtky8aYs Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkximNYACgkQC3+MBN1Mb4hokwCfVKvpntMv62suh6fSzcoc3jfY Q9sAoJiLrEVzHRQAc/enXp5bNnNPGlnK =OPog -----END PGP SIGNATURE----- --STPqjqpCrtky8aYs-- From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 13:35:38 2010 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 5C160106566C for ; Wed, 11 Aug 2010 13:35:38 +0000 (UTC) (envelope-from olli@fromme.com) Received: from haluter.fromme.com (haluter.fromme.com [212.17.241.231]) by mx1.freebsd.org (Postfix) with ESMTP id B9BAC8FC0A for ; Wed, 11 Aug 2010 13:35:37 +0000 (UTC) Received: from haluter.fromme.com (irc_sucks@localhost [127.0.0.1]) by haluter.fromme.com (8.14.3/8.14.3) with ESMTP id o7BDZSDG052432; Wed, 11 Aug 2010 15:35:35 +0200 (CEST) (envelope-from olli@fromme.com) Received: (from olli@localhost) by haluter.fromme.com (8.14.3/8.14.3/Submit) id o7BDZSQs052430; Wed, 11 Aug 2010 15:35:28 +0200 (CEST) (envelope-from olli) From: Oliver Fromme Message-Id: <201008111335.o7BDZSQs052430@haluter.fromme.com> To: des@des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Wed, 11 Aug 2010 15:35:28 +0200 (CEST) In-Reply-To: <86fwylecm1.fsf@ds4.des.no> X-Mailer: ELM [version 2.5 PL8] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (haluter.fromme.com [127.0.0.1]); Wed, 11 Aug 2010 15:35:36 +0200 (CEST) Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@FreeBSD.org, svn-src-head@FreeBSD.org, "M. Warner Losh" Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 11 Aug 2010 13:35:38 -0000 Dag-Erling Smørgrav wrote: > "M. Warner Losh" writes: > > You'll find that a number of structures are potentially already > > allocated with less than required alignment. There's about a dozen > > places in the tree that would start to fail if we did this, or the > > stronger form of __aligned(8). We could add that to the other > > structures, but then we're breaking ABI rules, I think. > > __aligned(4) won't affect struct addrinfo since the sockaddr immediately > follows a socklen_t, which is 32 bits wide and has 32-bit alignment. A > sockaddr_* allocated with malloc() will already be aligned, and so will > a sockaddr_* created on the stack. The only problem is sockaddr_un, > because its size is not a multiple of 4, so if you allocate an array of > sockaddr_un, every other element will be misaligned. I did a small survey of all the sockaddr_ variants: struct align size modulo where ------------------------------------------------------------------------- osockaddr 2 16 16 sockaddr 1 16 16 sockaddr_at 2 16 16 sockaddr_dl 2 54 2 sockaddr_hci 1 34 2 sockaddr_in 4 16 16 sockaddr_in6 4 28 4 sockaddr_inarp 4 16 16 sockaddr_ipx 2 16 16 sockaddr_l2cap 2 10 2 sockaddr_natm 2 22 2 sockaddr_nb 4 56 8 sockaddr_ng 1 16 16 sockaddr_rfcomm 1 9 1 sockaddr_sco 1 8 8 sockaddr_storage 8 128 128 sockaddr_un 1 106 2 If we push struct sockaddr to align(4), then we will also have to do the same with all others that are not already aligned to at least 4 bytes. That would be almost all of them. I agree that there will be ABI problems with those structs whose size is not a multiple of 4 (that's the ones with a value < 4 in the "modulo" column above). So we cannot do that, right? Best regards Oliver -- ``We are all but compressed light'' (Albert Einstein) From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 14:01:24 2010 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 7C4E2106567A; Wed, 11 Aug 2010 14:01:24 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 3B3398FC1B; Wed, 11 Aug 2010 14:01:24 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 71DCB1FFC33; Wed, 11 Aug 2010 14:01:22 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 46C4B84528; Wed, 11 Aug 2010 16:01:22 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Oliver Fromme References: <201008111335.o7BDZSQs052430@haluter.fromme.com> Date: Wed, 11 Aug 2010 16:01:22 +0200 In-Reply-To: <201008111335.o7BDZSQs052430@haluter.fromme.com> (Oliver Fromme's message of "Wed, 11 Aug 2010 15:35:28 +0200 (CEST)") Message-ID: <86bp99ckp9.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@FreeBSD.org, svn-src-head@FreeBSD.org, "M. Warner Losh" Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 11 Aug 2010 14:01:24 -0000 Oliver Fromme writes: > I did a small survey of all the sockaddr_ variants: I only did _in, _in6 and _un; who cares about the others? :P DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 14:17:58 2010 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 38A001065676; Wed, 11 Aug 2010 14:17:58 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (unknown [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id C92528FC23; Wed, 11 Aug 2010 14:17:57 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id D61C62A28CCE; Wed, 11 Aug 2010 16:17:55 +0200 (CEST) Date: Wed, 11 Aug 2010 16:17:55 +0200 From: Ed Schouten To: Adrian Chadd Message-ID: <20100811141755.GR76386@hoeg.nl> References: <201008101436.o7AEaK3l047212@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NZtAI5QFBF0GmLcW" Content-Disposition: inline In-Reply-To: <201008101436.o7AEaK3l047212@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211146 - head 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, 11 Aug 2010 14:17:58 -0000 --NZtAI5QFBF0GmLcW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Adrian, * Adrian Chadd wrote: > Modified: > head/Makefile.mips Can't this file be simply removed now? --=20 Ed Schouten WWW: http://80386.nl/ --NZtAI5QFBF0GmLcW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkxisRMACgkQ52SDGA2eCwUlNACfQlq6svgcbZmOgHHM+TlLsJFe Qs0An1E58DdXg4NCwyo7I87PSX+HqYjJ =s4wd -----END PGP SIGNATURE----- --NZtAI5QFBF0GmLcW-- From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 14:19:49 2010 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 379CB1065672; Wed, 11 Aug 2010 14:19:49 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (unknown [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id ED1678FC14; Wed, 11 Aug 2010 14:19:48 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id 5F4142A28CCE; Wed, 11 Aug 2010 16:19:48 +0200 (CEST) Date: Wed, 11 Aug 2010 16:19:48 +0200 From: Ed Schouten To: Oliver Fromme Message-ID: <20100811141948.GS76386@hoeg.nl> References: <86fwylecm1.fsf@ds4.des.no> <201008111335.o7BDZSQs052430@haluter.fromme.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="l3ej7W/Jb2pB3qL2" Content-Disposition: inline In-Reply-To: <201008111335.o7BDZSQs052430@haluter.fromme.com> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: src-committers@FreeBSD.org, Jilles Tjoelker , svn-src-all@FreeBSD.org, olli@FreeBSD.org, svn-src-head@FreeBSD.org, Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= , "M. Warner Losh" Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd 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, 11 Aug 2010 14:19:49 -0000 --l3ej7W/Jb2pB3qL2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Oliver Fromme wrote: > If we push struct sockaddr to align(4), then we will also > have to do the same with all others that are not already > aligned to at least 4 bytes. That would be almost all of > them. Maybe it's better to just use __attribute__((aligned))? That makes it use the worst alignment possible. --=20 Ed Schouten WWW: http://80386.nl/ --l3ej7W/Jb2pB3qL2 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkxisYQACgkQ52SDGA2eCwVxvwCcDrbWoWrsCzTCY6UzfpYM9+UC aUMAnREWcfHWQfS4xvNdxRQ9iy+Fkopj =iKER -----END PGP SIGNATURE----- --l3ej7W/Jb2pB3qL2-- From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 14:29:23 2010 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 3DD891065673; Wed, 11 Aug 2010 14:29:23 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id 97B2C8FC21; Wed, 11 Aug 2010 14:29:22 +0000 (UTC) Received: by gyg4 with SMTP id 4so52651gyg.13 for ; Wed, 11 Aug 2010 07:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=M8l88OOL7BDHVi3Sa5upYQ/zQ/+xJtmYdh8B0ITVI6I=; b=LimvdgklPZ9/l6LADaAEYHmzh5Yt2/fWo1euyotJzBwYLFJ/fzqb1txEd4BKXqaE6a s5mU9+MbvQDMO46YOJt0fYol17x6mlE1kGiS79dI2Sa7feqsOcgV35ZaOCsobEM0s2Xg TAsk9c+Y0ULXrayQ+T3hldJkCwbpT4+NKeMyk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Xt13IXyaHT+wl69cjNHdkYMyKYA/NjOlKe9DZZwx3H5eKGT9W3jRQkfDjVBLMcN+2Q myAhjgm81BJ/ofiVLJvJksqYzHQEBZx9lyijopmoKlFcGdp5JMTkpHsSEkbsVliN6Hqw ALLJ4BTyqSTuH2elCXgBpvuGfAiCJTSl3OBmY= MIME-Version: 1.0 Received: by 10.151.79.13 with SMTP id g13mr4231899ybl.286.1281536961398; Wed, 11 Aug 2010 07:29:21 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.151.116.3 with HTTP; Wed, 11 Aug 2010 07:29:21 -0700 (PDT) In-Reply-To: <20100811123430.GK2396@deviant.kiev.zoral.com.ua> References: <201008111051.o7BApRp4028538@svn.freebsd.org> <20100811105739.GJ2396@deviant.kiev.zoral.com.ua> <20100811123430.GK2396@deviant.kiev.zoral.com.ua> Date: Wed, 11 Aug 2010 16:29:21 +0200 X-Google-Sender-Auth: GHWvjNc5TJ9g0DojmGciWnBPGRA Message-ID: From: Attilio Rao To: Kostik Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Jeff Roberson , John Baldwin Subject: Re: svn commit: r211176 - 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, 11 Aug 2010 14:29:23 -0000 2010/8/11 Kostik Belousov : > On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote: >> 2010/8/11 Kostik Belousov : >> > On Wed, Aug 11, 2010 at 10:51:27AM +0000, Attilio Rao wrote: >> >> Author: attilio >> >> Date: Wed Aug 11 10:51:27 2010 >> >> New Revision: 211176 >> >> URL: http://svn.freebsd.org/changeset/base/211176 >> >> >> >> Log: >> >> =C2=A0 IPI handlers may run generally with interrupts disabled becaus= e they >> >> =C2=A0 are served via an interrupt gate. >> >> >> >> =C2=A0 However, that doesn't explicitly prevent preemption and thread >> >> =C2=A0 migration thus scheduler pinning may be necessary in some hand= lers. >> >> =C2=A0 Fix that. >> > >> > How the preemption is supposed to happen ? Aside from the explicit >> > calls to mi_switch() from e.g. critical_exit(). >> >> IIRC it should be hardclock() willing to schedule the softclock(). It >> is the critical_exit() in the thread_unlock() that may trigger it >> (sorry for not digging more, it was a while back that I hacked this >> part, but I guess you can verify on your own). >> We already have other points within the kernel that take care of >> dealing with preemption/migration like lapic_handle_timer(), for >> example. > > Right, and if the interrupts are indeed disabled, I do not see how > the preemption may be triggered in the fragments like > =C2=A0 =C2=A0 =C2=A0 =C2=A0cpu =3D PCPU_GET(cpuid); > =C2=A0 =C2=A0 =C2=A0 =C2=A0cpumask =3D PCPU_GET(cpumask); I don't recall all the details and I have no time to dig now. However, also spinlock_enter() does disable explicitly preemption via critical_enter() after have disabled the interrupts. Let me CC jhb as he implemented spinlock_enter() and may have a clue about how preemption can happen with interrupts disabled. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 14:34:50 2010 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 831FB10656DB; Wed, 11 Aug 2010 14:34:50 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello089077043238.chello.pl [89.77.43.238]) by mx1.freebsd.org (Postfix) with ESMTP id 853F58FC17; Wed, 11 Aug 2010 14:34:49 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id E53CD45CAC; Wed, 11 Aug 2010 16:34:46 +0200 (CEST) Received: from localhost (pdawidek.wheel.pl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 4263C45684; Wed, 11 Aug 2010 16:34:40 +0200 (CEST) Date: Wed, 11 Aug 2010 16:34:30 +0200 From: Pawel Jakub Dawidek To: Will Andrews Message-ID: <20100811143430.GB1707@garage.freebsd.pl> References: <201008110051.o7B0pp10084996@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gatW/ieO32f1wygP" Content-Disposition: inline In-Reply-To: <201008110051.o7B0pp10084996@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211157 - in head/sys: modules modules/if_carp net netinet netinet6 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, 11 Aug 2010 14:34:50 -0000 --gatW/ieO32f1wygP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 11, 2010 at 12:51:51AM +0000, Will Andrews wrote: > Author: will > Date: Wed Aug 11 00:51:50 2010 > New Revision: 211157 > URL: http://svn.freebsd.org/changeset/base/211157 >=20 > Log: > Allow carp(4) to be loaded as a kernel module. Follow precedent set by > bridge(4), lagg(4) etc. and make use of function pointers and > pf_proto_register() to hook carp into the network stack. > =20 > Currently, because of the uncertainty about whether the unload path is = free > of race condition panics, unloads are disallowed by default. Compiling= with > CARPMOD_CAN_UNLOAD in CFLAGS removes this anti foot shooting measure. Wouldn't it be better to allow unload only if there are no carp(4) interfaces? I'd be glad to destroy my carp interfaces before unloading the module, but recompiling the kernel to unload it? Not so much. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --gatW/ieO32f1wygP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkxitPYACgkQForvXbEpPzRqvQCgxjWVcEpk4G7Pu/peCL5TLmle pA8AoONGNVqKqiZeuuUzSttR5wIrUttB =+ySk -----END PGP SIGNATURE----- --gatW/ieO32f1wygP-- From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 14:46:52 2010 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 13DB9106564A; Wed, 11 Aug 2010 14:46:52 +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 C212E8FC1C; Wed, 11 Aug 2010 14:46:50 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o7BEkkKL017471 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 11 Aug 2010 17:46:46 +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.4/8.14.4) with ESMTP id o7BEkkQe080563; Wed, 11 Aug 2010 17:46:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o7BEkkCR080562; Wed, 11 Aug 2010 17:46:46 +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, 11 Aug 2010 17:46:46 +0300 From: Kostik Belousov To: Attilio Rao Message-ID: <20100811144646.GL2396@deviant.kiev.zoral.com.ua> References: <201008111051.o7BApRp4028538@svn.freebsd.org> <20100811105739.GJ2396@deviant.kiev.zoral.com.ua> <20100811123430.GK2396@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NqSa+Xr3J/G6Hhls" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no 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, Jeff Roberson , John Baldwin Subject: Re: svn commit: r211176 - 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, 11 Aug 2010 14:46:52 -0000 --NqSa+Xr3J/G6Hhls Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 11, 2010 at 04:29:21PM +0200, Attilio Rao wrote: > 2010/8/11 Kostik Belousov : > > On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote: > >> 2010/8/11 Kostik Belousov : > >> > On Wed, Aug 11, 2010 at 10:51:27AM +0000, Attilio Rao wrote: > >> >> Author: attilio > >> >> Date: Wed Aug 11 10:51:27 2010 > >> >> New Revision: 211176 > >> >> URL: http://svn.freebsd.org/changeset/base/211176 > >> >> > >> >> Log: > >> >> =9A IPI handlers may run generally with interrupts disabled because= they > >> >> =9A are served via an interrupt gate. > >> >> > >> >> =9A However, that doesn't explicitly prevent preemption and thread > >> >> =9A migration thus scheduler pinning may be necessary in some handl= ers. > >> >> =9A Fix that. > >> > > >> > How the preemption is supposed to happen ? Aside from the explicit > >> > calls to mi_switch() from e.g. critical_exit(). > >> > >> IIRC it should be hardclock() willing to schedule the softclock(). It > >> is the critical_exit() in the thread_unlock() that may trigger it > >> (sorry for not digging more, it was a while back that I hacked this > >> part, but I guess you can verify on your own). > >> We already have other points within the kernel that take care of > >> dealing with preemption/migration like lapic_handle_timer(), for > >> example. > > > > Right, and if the interrupts are indeed disabled, I do not see how > > the preemption may be triggered in the fragments like > > =9A =9A =9A =9Acpu =3D PCPU_GET(cpuid); > > =9A =9A =9A =9Acpumask =3D PCPU_GET(cpumask); >=20 > I don't recall all the details and I have no time to dig now. However, > also spinlock_enter() does disable explicitly preemption via > critical_enter() after have disabled the interrupts. > Let me CC jhb as he implemented spinlock_enter() and may have a clue > about how preemption can happen with interrupts disabled. spinlock_enter() disables preemption to handle the recursive calls to spinlock_enter/leave, I think, to prevent switch on leave. I do understand the reason for your change. --NqSa+Xr3J/G6Hhls Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkxit9YACgkQC3+MBN1Mb4jZTgCfd0eaDqdWu7zgri1dROT69oxg RusAoIVyU4NSc40DXt/TzkfnkYOqKH10 =Eft4 -----END PGP SIGNATURE----- --NqSa+Xr3J/G6Hhls-- From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 15:05:20 2010 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 AB2EF1065674; Wed, 11 Aug 2010 15:05:20 +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 3F7178FC12; Wed, 11 Aug 2010 15:05:19 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o7BF5GCh019778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 11 Aug 2010 18:05: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.4/8.14.4) with ESMTP id o7BF5GEI080718; Wed, 11 Aug 2010 18:05:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o7BF5Gfc080717; Wed, 11 Aug 2010 18:05:16 +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, 11 Aug 2010 18:05:16 +0300 From: Kostik Belousov To: Attilio Rao Message-ID: <20100811150516.GM2396@deviant.kiev.zoral.com.ua> References: <201008111051.o7BApRp4028538@svn.freebsd.org> <20100811105739.GJ2396@deviant.kiev.zoral.com.ua> <20100811123430.GK2396@deviant.kiev.zoral.com.ua> <20100811144646.GL2396@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cEobB2knsyc5ebfU" Content-Disposition: inline In-Reply-To: <20100811144646.GL2396@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no 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, Jeff Roberson , John Baldwin Subject: Re: svn commit: r211176 - 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, 11 Aug 2010 15:05:20 -0000 --cEobB2knsyc5ebfU Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 11, 2010 at 05:46:46PM +0300, Kostik Belousov wrote: > On Wed, Aug 11, 2010 at 04:29:21PM +0200, Attilio Rao wrote: > > 2010/8/11 Kostik Belousov : > > > On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote: > > >> 2010/8/11 Kostik Belousov : > > >> > On Wed, Aug 11, 2010 at 10:51:27AM +0000, Attilio Rao wrote: > > >> >> Author: attilio > > >> >> Date: Wed Aug 11 10:51:27 2010 > > >> >> New Revision: 211176 > > >> >> URL: http://svn.freebsd.org/changeset/base/211176 > > >> >> > > >> >> Log: > > >> >> =9A IPI handlers may run generally with interrupts disabled becau= se they > > >> >> =9A are served via an interrupt gate. > > >> >> > > >> >> =9A However, that doesn't explicitly prevent preemption and thread > > >> >> =9A migration thus scheduler pinning may be necessary in some han= dlers. > > >> >> =9A Fix that. > > >> > > > >> > How the preemption is supposed to happen ? Aside from the explicit > > >> > calls to mi_switch() from e.g. critical_exit(). > > >> > > >> IIRC it should be hardclock() willing to schedule the softclock(). It > > >> is the critical_exit() in the thread_unlock() that may trigger it > > >> (sorry for not digging more, it was a while back that I hacked this > > >> part, but I guess you can verify on your own). > > >> We already have other points within the kernel that take care of > > >> dealing with preemption/migration like lapic_handle_timer(), for > > >> example. > > > > > > Right, and if the interrupts are indeed disabled, I do not see how > > > the preemption may be triggered in the fragments like > > > =9A =9A =9A =9Acpu =3D PCPU_GET(cpuid); > > > =9A =9A =9A =9Acpumask =3D PCPU_GET(cpumask); > >=20 > > I don't recall all the details and I have no time to dig now. However, > > also spinlock_enter() does disable explicitly preemption via > > critical_enter() after have disabled the interrupts. > > Let me CC jhb as he implemented spinlock_enter() and may have a clue > > about how preemption can happen with interrupts disabled. >=20 > spinlock_enter() disables preemption to handle the recursive > calls to spinlock_enter/leave, I think, to prevent switch on > leave. >=20 > I do understand the reason for your change. do _not_ understand. sorry. --cEobB2knsyc5ebfU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkxivCsACgkQC3+MBN1Mb4icRgCgxR/NthiQ+9cjbpaneO5HvWlA urcAoKBdnAcmts4h2LZd5Sjw75SC5PJj =cDZm -----END PGP SIGNATURE----- --cEobB2knsyc5ebfU-- From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 16:29:13 2010 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 0C63D106567A; Wed, 11 Aug 2010 16:29: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 D4D418FC0A; Wed, 11 Aug 2010 16:29:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BGTClW008660; Wed, 11 Aug 2010 16:29:12 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BGTC0p008659; Wed, 11 Aug 2010 16:29:12 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008111629.o7BGTC0p008659@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 11 Aug 2010 16:29: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: r211177 - head/tools/regression/fstest/tests 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, 11 Aug 2010 16:29:13 -0000 Author: pjd Date: Wed Aug 11 16:29:12 2010 New Revision: 211177 URL: http://svn.freebsd.org/changeset/base/211177 Log: Instead of hardcoding {NAME_MAX} as 255 and {PATH_MAX} as 1024 obtain those from pathconf(2) and properly generate too long file names. This should fix ENAMETOOLONG checks on Linux. Modified: head/tools/regression/fstest/tests/misc.sh Modified: head/tools/regression/fstest/tests/misc.sh ============================================================================== --- head/tools/regression/fstest/tests/misc.sh Wed Aug 11 10:51:27 2010 (r211176) +++ head/tools/regression/fstest/tests/misc.sh Wed Aug 11 16:29:12 2010 (r211177) @@ -2,13 +2,6 @@ ntest=1 -name253="_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_12" -name255="${name253}34" -name256="${name255}5" -path1021="${name255}/${name255}/${name255}/${name253}" -path1023="${path1021}/x" -path1024="${path1023}x" - case "${dir}" in /*) maindir="${dir}/../.." @@ -99,6 +92,52 @@ namegen() echo "fstest_`dd if=/dev/urandom bs=1k count=1 2>/dev/null | openssl md5`" } +namegen_len() +{ + len="${1}" + + name="" + while :; do + namepart="`dd if=/dev/urandom bs=64 count=1 2>/dev/null | openssl md5`" + name="${name}${namepart}" + curlen=`printf "%s" "${name}" | wc -c` + [ ${curlen} -lt ${len} ] || break + done + name=`echo "${name}" | cut -b -${len}` + printf "%s" "${name}" +} + +# POSIX: +# {NAME_MAX} +# Maximum number of bytes in a filename (not including terminating null). +namegen_max() +{ + name_max=`${fstest} pathconf . _PC_NAME_MAX` + namegen_len ${name_max} +} + +# POSIX: +# {PATH_MAX} +# Maximum number of bytes in a pathname, including the terminating null character. +dirgen_max() +{ + name_max=`${fstest} pathconf . _PC_NAME_MAX` + complen=$((name_max/2)) + path_max=`${fstest} pathconf . _PC_PATH_MAX` + # "...including the terminating null character." + path_max=$((path_max-1)) + + name="" + while :; do + name="${name}`namegen_len ${complen}`/" + curlen=`printf "%s" "${name}" | wc -c` + [ ${curlen} -lt ${path_max} ] || break + done + name=`echo "${name}" | cut -b -${path_max}` + name=`echo "${name}" | sed -E 's@/$@x@'` + printf "%s" "${name}" +} + quick_exit() { echo "1..1" From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 16:33:18 2010 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 59DB41065687; Wed, 11 Aug 2010 16:33: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 466868FC26; Wed, 11 Aug 2010 16:33:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BGXIRt009672; Wed, 11 Aug 2010 16:33:18 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BGXIvX009646; Wed, 11 Aug 2010 16:33:18 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008111633.o7BGXIvX009646@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 11 Aug 2010 16:33: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: r211178 - in head/tools/regression/fstest/tests: chflags chmod chown link mkdir mkfifo mknod open rename rmdir symlink truncate unlink 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, 11 Aug 2010 16:33:18 -0000 Author: pjd Date: Wed Aug 11 16:33:17 2010 New Revision: 211178 URL: http://svn.freebsd.org/changeset/base/211178 Log: Make use of recently added dirgen_max() and namegen_max() to implement ENAMETOOLONG checks. Modified: head/tools/regression/fstest/tests/chflags/02.t head/tools/regression/fstest/tests/chflags/03.t head/tools/regression/fstest/tests/chmod/02.t head/tools/regression/fstest/tests/chmod/03.t head/tools/regression/fstest/tests/chown/02.t head/tools/regression/fstest/tests/chown/03.t head/tools/regression/fstest/tests/link/02.t head/tools/regression/fstest/tests/link/03.t head/tools/regression/fstest/tests/mkdir/02.t head/tools/regression/fstest/tests/mkdir/03.t head/tools/regression/fstest/tests/mkfifo/02.t head/tools/regression/fstest/tests/mkfifo/03.t head/tools/regression/fstest/tests/mknod/02.t head/tools/regression/fstest/tests/mknod/03.t head/tools/regression/fstest/tests/open/02.t head/tools/regression/fstest/tests/open/03.t head/tools/regression/fstest/tests/rename/01.t head/tools/regression/fstest/tests/rename/02.t head/tools/regression/fstest/tests/rmdir/02.t head/tools/regression/fstest/tests/rmdir/03.t head/tools/regression/fstest/tests/symlink/02.t head/tools/regression/fstest/tests/symlink/03.t head/tools/regression/fstest/tests/truncate/02.t head/tools/regression/fstest/tests/truncate/03.t head/tools/regression/fstest/tests/unlink/02.t head/tools/regression/fstest/tests/unlink/03.t Modified: head/tools/regression/fstest/tests/chflags/02.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/02.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/chflags/02.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,18 +1,28 @@ #!/bin/sh # $FreeBSD$ -desc="chflags returns ENAMETOOLONG if a component of a pathname exceeded 255 characters" +desc="chflags returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh require chflags -echo "1..6" +echo "1..12" -expect 0 create ${name255} 0644 -expect 0 chflags ${name255} SF_IMMUTABLE -expect SF_IMMUTABLE stat ${name255} flags -expect 0 chflags ${name255} none -expect 0 unlink ${name255} -expect ENAMETOOLONG chflags ${name256} SF_IMMUTABLE +nx=`namegen_max` +nxx="${nx}x" + +expect 0 create ${nx} 0644 +expect 0 chflags ${nx} SF_IMMUTABLE +expect SF_IMMUTABLE stat ${nx} flags +expect 0 chflags ${nx} none +expect 0 unlink ${nx} +expect ENAMETOOLONG chflags ${nxx} SF_IMMUTABLE + +expect 0 create ${nx} 0644 +expect 0 lchflags ${nx} SF_IMMUTABLE +expect SF_IMMUTABLE stat ${nx} flags +expect 0 lchflags ${nx} none +expect 0 unlink ${nx} +expect ENAMETOOLONG lchflags ${nxx} SF_IMMUTABLE Modified: head/tools/regression/fstest/tests/chflags/03.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/03.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/chflags/03.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,25 +1,32 @@ #!/bin/sh # $FreeBSD$ -desc="chflags returns ENAMETOOLONG if an entire path name exceeded 1023 characters" +desc="chflags returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh require chflags -echo "1..13" +echo "1..12" -expect 0 mkdir ${name255} 0755 -expect 0 mkdir ${name255}/${name255} 0755 -expect 0 mkdir ${name255}/${name255}/${name255} 0755 -expect 0 mkdir ${path1021} 0755 -expect 0 create ${path1023} 0644 -expect 0 chflags ${path1023} SF_IMMUTABLE -expect 0 chflags ${path1023} none -expect 0 unlink ${path1023} -expect ENAMETOOLONG chflags ${path1024} SF_IMMUTABLE -expect 0 rmdir ${path1021} -expect 0 rmdir ${name255}/${name255}/${name255} -expect 0 rmdir ${name255}/${name255} -expect 0 rmdir ${name255} +nx=`dirgen_max` +nxx="${nx}x" + +mkdir -p "${nx%/*}" + +expect 0 create ${nx} 0644 +expect 0 chflags ${nx} SF_IMMUTABLE +expect SF_IMMUTABLE stat ${nx} flags +expect 0 chflags ${nx} none +expect 0 unlink ${nx} +expect ENAMETOOLONG chflags ${nxx} SF_IMMUTABLE + +expect 0 create ${nx} 0644 +expect 0 lchflags ${nx} SF_IMMUTABLE +expect SF_IMMUTABLE stat ${nx} flags +expect 0 lchflags ${nx} none +expect 0 unlink ${nx} +expect ENAMETOOLONG lchflags ${nxx} SF_IMMUTABLE + +rm -rf "${nx%%/*}" Modified: head/tools/regression/fstest/tests/chmod/02.t ============================================================================== --- head/tools/regression/fstest/tests/chmod/02.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/chmod/02.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,15 +1,24 @@ #!/bin/sh # $FreeBSD$ -desc="chmod returns ENAMETOOLONG if a component of a pathname exceeded 255 characters" +desc="chmod returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..5" +echo "1..10" -expect 0 create ${name255} 0644 -expect 0 chmod ${name255} 0620 -expect 0620 stat ${name255} mode -expect 0 unlink ${name255} -expect ENAMETOOLONG chmod ${name256} 0620 +nx=`namegen_max` +nxx="${nx}x" + +expect 0 create ${nx} 0644 +expect 0 chmod ${nx} 0620 +expect 0620 stat ${nx} mode +expect 0 unlink ${nx} +expect ENAMETOOLONG chmod ${nxx} 0620 + +expect 0 create ${nx} 0644 +expect 0 lchmod ${nx} 0620 +expect 0620 stat ${nx} mode +expect 0 unlink ${nx} +expect ENAMETOOLONG lchmod ${nxx} 0620 Modified: head/tools/regression/fstest/tests/chmod/03.t ============================================================================== --- head/tools/regression/fstest/tests/chmod/03.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/chmod/03.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,22 +1,28 @@ #!/bin/sh # $FreeBSD$ -desc="chmod returns ENAMETOOLONG if an entire path name exceeded 1023 characters" +desc="chmod returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..12" +echo "1..10" -expect 0 mkdir ${name255} 0755 -expect 0 mkdir ${name255}/${name255} 0755 -expect 0 mkdir ${name255}/${name255}/${name255} 0755 -expect 0 mkdir ${path1021} 0755 -expect 0 create ${path1023} 0644 -expect 0 chmod ${path1023} 0642 -expect 0 unlink ${path1023} -expect ENAMETOOLONG chmod ${path1024} 0642 -expect 0 rmdir ${path1021} -expect 0 rmdir ${name255}/${name255}/${name255} -expect 0 rmdir ${name255}/${name255} -expect 0 rmdir ${name255} +nx=`dirgen_max` +nxx="${nx}x" + +mkdir -p "${nx%/*}" + +expect 0 create ${nx} 0644 +expect 0 chmod ${nx} 0642 +expect 0642 stat ${nx} mode +expect 0 unlink ${nx} +expect ENAMETOOLONG chmod ${nxx} 0642 + +expect 0 create ${nx} 0644 +expect 0 lchmod ${nx} 0642 +expect 0642 stat ${nx} mode +expect 0 unlink ${nx} +expect ENAMETOOLONG lchmod ${nxx} 0642 + +rm -rf "${nx%%/*}" Modified: head/tools/regression/fstest/tests/chown/02.t ============================================================================== --- head/tools/regression/fstest/tests/chown/02.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/chown/02.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,15 +1,24 @@ #!/bin/sh # $FreeBSD$ -desc="chown returns ENAMETOOLONG if a component of a pathname exceeded 255 characters" +desc="chown returns ENAMETOOLONG if a component of a pathname exceeded ${NAME_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..5" +echo "1..10" -expect 0 create ${name255} 0644 -expect 0 chown ${name255} 65534 65534 -expect 65534,65534 stat ${name255} uid,gid -expect 0 unlink ${name255} -expect ENAMETOOLONG chown ${name256} 65533 65533 +nx=`namegen_max` +nxx="${nx}x" + +expect 0 create ${nx} 0644 +expect 0 chown ${nx} 65534 65534 +expect 65534,65534 stat ${nx} uid,gid +expect 0 unlink ${nx} +expect ENAMETOOLONG chown ${nxx} 65534 65534 + +expect 0 create ${nx} 0644 +expect 0 lchown ${nx} 65534 65534 +expect 65534,65534 stat ${nx} uid,gid +expect 0 unlink ${nx} +expect ENAMETOOLONG lchown ${nxx} 65534 65534 Modified: head/tools/regression/fstest/tests/chown/03.t ============================================================================== --- head/tools/regression/fstest/tests/chown/03.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/chown/03.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,22 +1,28 @@ #!/bin/sh # $FreeBSD$ -desc="chown returns ENAMETOOLONG if an entire path name exceeded 1023 characters" +desc="chown returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..12" +echo "1..10" -expect 0 mkdir ${name255} 0755 -expect 0 mkdir ${name255}/${name255} 0755 -expect 0 mkdir ${name255}/${name255}/${name255} 0755 -expect 0 mkdir ${path1021} 0755 -expect 0 create ${path1023} 0644 -expect 0 chown ${path1023} 65534 65534 -expect 0 unlink ${path1023} -expect ENAMETOOLONG chown ${path1024} 65533 65533 -expect 0 rmdir ${path1021} -expect 0 rmdir ${name255}/${name255}/${name255} -expect 0 rmdir ${name255}/${name255} -expect 0 rmdir ${name255} +nx=`dirgen_max` +nxx="${nx}x" + +mkdir -p "${nx%/*}" + +expect 0 create ${nx} 0644 +expect 0 chown ${nx} 65534 65534 +expect 65534,65534 stat ${nx} uid,gid +expect 0 unlink ${nx} +expect ENAMETOOLONG chown ${nxx} 65534 65534 + +expect 0 create ${nx} 0644 +expect 0 lchown ${nx} 65534 65534 +expect 65534,65534 stat ${nx} uid,gid +expect 0 unlink ${nx} +expect ENAMETOOLONG lchown ${nxx} 65534 65534 + +rm -rf "${nx%%/*}" Modified: head/tools/regression/fstest/tests/link/02.t ============================================================================== --- head/tools/regression/fstest/tests/link/02.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/link/02.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,7 +1,7 @@ #!/bin/sh # $FreeBSD$ -desc="link returns ENAMETOOLONG if a component of either pathname exceeded 255 characters" +desc="link returns ENAMETOOLONG if a component of either pathname exceeded {NAME_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh @@ -9,15 +9,17 @@ dir=`dirname $0` echo "1..10" n0=`namegen` +nx=`namegen_max` +nxx="${nx}x" -expect 0 create ${name255} 0644 -expect 0 link ${name255} ${n0} -expect 0 unlink ${name255} -expect 0 link ${n0} ${name255} +expect 0 create ${nx} 0644 +expect 0 link ${nx} ${n0} +expect 0 unlink ${nx} +expect 0 link ${n0} ${nx} expect 0 unlink ${n0} -expect 0 unlink ${name255} +expect 0 unlink ${nx} expect 0 create ${n0} 0644 -expect ENAMETOOLONG link ${n0} ${name256} +expect ENAMETOOLONG link ${n0} ${nxx} expect 0 unlink ${n0} -expect ENAMETOOLONG link ${name256} ${n0} +expect ENAMETOOLONG link ${nxx} ${n0} Modified: head/tools/regression/fstest/tests/link/03.t ============================================================================== --- head/tools/regression/fstest/tests/link/03.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/link/03.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,28 +1,31 @@ #!/bin/sh # $FreeBSD$ -desc="link returns ENAMETOOLONG if an entire length of either path name exceeded 1023 characters" +desc="link returns ENAMETOOLONG if an entire length of either path name exceeded {PATH_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..16" +echo "1..13" n0=`namegen` +nx=`dirgen_max` +nxx="${nx}x" -expect 0 mkdir ${name255} 0755 -expect 0 mkdir ${name255}/${name255} 0755 -expect 0 mkdir ${name255}/${name255}/${name255} 0755 -expect 0 mkdir ${path1021} 0755 -expect 0 create ${path1023} 0644 -expect 0 link ${path1023} ${n0} -expect 0 unlink ${path1023} -expect 0 link ${n0} ${path1023} -expect 0 unlink ${path1023} -expect ENAMETOOLONG link ${n0} ${path1024} +mkdir -p "${nx%/*}" + +expect 0 create ${nx} 0644 +expect 0 link ${nx} ${n0} +expect 2 stat ${n0} nlink +expect 2 stat ${nx} nlink +expect 0 unlink ${nx} +expect 0 link ${n0} ${nx} +expect 2 stat ${n0} nlink +expect 2 stat ${nx} nlink +expect 0 unlink ${nx} +expect ENAMETOOLONG link ${n0} ${nxx} +expect 1 stat ${n0} nlink expect 0 unlink ${n0} -expect ENAMETOOLONG link ${path1024} ${n0} -expect 0 rmdir ${path1021} -expect 0 rmdir ${name255}/${name255}/${name255} -expect 0 rmdir ${name255}/${name255} -expect 0 rmdir ${name255} +expect ENAMETOOLONG link ${nxx} ${n0} + +rm -rf "${nx%%/*}" Modified: head/tools/regression/fstest/tests/mkdir/02.t ============================================================================== --- head/tools/regression/fstest/tests/mkdir/02.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/mkdir/02.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,13 +1,16 @@ #!/bin/sh # $FreeBSD$ -desc="mkdir returns ENAMETOOLONG if a component of a pathname exceeded 255 characters" +desc="mkdir returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh echo "1..3" -expect 0 mkdir ${name255} 0755 -expect 0 rmdir ${name255} -expect ENAMETOOLONG mkdir ${name256} 0755 +nx=`namegen_max` +nxx="${nx}x" + +expect 0 mkdir ${nx} 0755 +expect 0 rmdir ${nx} +expect ENAMETOOLONG mkdir ${nxx} 0755 Modified: head/tools/regression/fstest/tests/mkdir/03.t ============================================================================== --- head/tools/regression/fstest/tests/mkdir/03.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/mkdir/03.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,21 +1,20 @@ #!/bin/sh # $FreeBSD$ -desc="mkdir returns ENAMETOOLONG if an entire path name exceeded 1023 characters" +desc="mkdir returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..11" +echo "1..3" -expect 0 mkdir ${name255} 0755 -expect 0 mkdir ${name255}/${name255} 0755 -expect 0 mkdir ${name255}/${name255}/${name255} 0755 -expect 0 mkdir ${path1021} 0755 -expect 0 mkdir ${path1023} 0755 -expect 0 rmdir ${path1023} -expect ENAMETOOLONG mkdir ${path1024} 0755 -expect 0 rmdir ${path1021} -expect 0 rmdir ${name255}/${name255}/${name255} -expect 0 rmdir ${name255}/${name255} -expect 0 rmdir ${name255} +nx=`dirgen_max` +nxx="${nx}x" + +mkdir -p "${nx%/*}" + +expect 0 mkdir ${nx} 0755 +expect 0 rmdir ${nx} +expect ENAMETOOLONG mkdir ${nxx} 0755 + +rm -rf "${nx%%/*}" Modified: head/tools/regression/fstest/tests/mkfifo/02.t ============================================================================== --- head/tools/regression/fstest/tests/mkfifo/02.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/mkfifo/02.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,13 +1,17 @@ #!/bin/sh # $FreeBSD$ -desc="mkfifo returns ENAMETOOLONG if a component of a pathname exceeded 255 characters" +desc="mkfifo returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..3" +echo "1..4" -expect 0 mkfifo ${name255} 0644 -expect 0 unlink ${name255} -expect ENAMETOOLONG mkfifo ${name256} 0644 +nx=`namegen_max` +nxx="${nx}x" + +expect 0 mkfifo ${nx} 0644 +expect fifo,0644 stat ${nx} type,mode +expect 0 unlink ${nx} +expect ENAMETOOLONG mkfifo ${nxx} 0644 Modified: head/tools/regression/fstest/tests/mkfifo/03.t ============================================================================== --- head/tools/regression/fstest/tests/mkfifo/03.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/mkfifo/03.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,21 +1,21 @@ #!/bin/sh # $FreeBSD$ -desc="mkfifo returns ENAMETOOLONG if an entire path name exceeded 1023 characters" +desc="mkfifo returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..11" +echo "1..4" -expect 0 mkdir ${name255} 0755 -expect 0 mkdir ${name255}/${name255} 0755 -expect 0 mkdir ${name255}/${name255}/${name255} 0755 -expect 0 mkdir ${path1021} 0755 -expect 0 mkfifo ${path1023} 0644 -expect 0 unlink ${path1023} -expect ENAMETOOLONG mkfifo ${path1024} 0644 -expect 0 rmdir ${path1021} -expect 0 rmdir ${name255}/${name255}/${name255} -expect 0 rmdir ${name255}/${name255} -expect 0 rmdir ${name255} +nx=`dirgen_max` +nxx="${nx}x" + +mkdir -p "${nx%/*}" + +expect 0 mkfifo ${nx} 0644 +expect fifo stat ${nx} type +expect 0 unlink ${nx} +expect ENAMETOOLONG mkfifo ${nxx} 0644 + +rm -rf "${nx%%/*}" Modified: head/tools/regression/fstest/tests/mknod/02.t ============================================================================== --- head/tools/regression/fstest/tests/mknod/02.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/mknod/02.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,13 +1,27 @@ #!/bin/sh # $FreeBSD$ -desc="mknod returns ENAMETOOLONG if a component of a pathname exceeded 255 characters" +desc="mknod returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..3" +echo "1..12" -expect 0 mknod ${name255} f 0644 0 0 -expect 0 unlink ${name255} -expect ENAMETOOLONG mknod ${name256} f 0644 0 0 +nx=`namegen_max` +nxx="${nx}x" + +expect 0 mknod ${nx} f 0644 0 0 +expect fifo,0644 stat ${nx} type,mode +expect 0 unlink ${nx} +expect ENAMETOOLONG mknod ${nxx} f 0644 0 0 + +expect 0 mknod ${nx} b 0644 1 2 +expect block,0644 stat ${nx} type,mode +expect 0 unlink ${nx} +expect ENAMETOOLONG mknod ${nxx} b 0644 0 0 + +expect 0 mknod ${nx} c 0644 1 2 +expect char,0644 stat ${nx} type,mode +expect 0 unlink ${nx} +expect ENAMETOOLONG mknod ${nxx} c 0644 0 0 Modified: head/tools/regression/fstest/tests/mknod/03.t ============================================================================== --- head/tools/regression/fstest/tests/mknod/03.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/mknod/03.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,21 +1,31 @@ #!/bin/sh # $FreeBSD$ -desc="mknod returns ENAMETOOLONG if an entire path name exceeded 1023 characters" +desc="mknod returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..11" +echo "1..12" -expect 0 mkdir ${name255} 0755 # 1 -expect 0 mkdir ${name255}/${name255} 0755 # 2 -expect 0 mkdir ${name255}/${name255}/${name255} 0755 # 3 -expect 0 mkdir ${path1021} 0755 # 4 -expect 0 mknod ${path1023} f 0644 0 0 # 5 -expect 0 unlink ${path1023} # 6 -expect ENAMETOOLONG mknod ${path1024} f 0644 0 0 # 7 -expect 0 rmdir ${path1021} # 8 -expect 0 rmdir ${name255}/${name255}/${name255} # 9 -expect 0 rmdir ${name255}/${name255} # 10 -expect 0 rmdir ${name255} # 11 +nx=`dirgen_max` +nxx="${nx}x" + +mkdir -p "${nx%/*}" + +expect 0 mknod ${nx} f 0644 0 0 +expect fifo stat ${nx} type +expect 0 unlink ${nx} +expect ENAMETOOLONG mknod ${nxx} f 0644 0 0 + +expect 0 mknod ${nx} b 0644 1 2 +expect block stat ${nx} type +expect 0 unlink ${nx} +expect ENAMETOOLONG mknod ${nxx} b 0644 1 2 + +expect 0 mknod ${nx} c 0644 1 2 +expect char stat ${nx} type +expect 0 unlink ${nx} +expect ENAMETOOLONG mknod ${nxx} c 0644 1 2 + +rm -rf "${nx%%/*}" Modified: head/tools/regression/fstest/tests/open/02.t ============================================================================== --- head/tools/regression/fstest/tests/open/02.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/open/02.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,14 +1,17 @@ #!/bin/sh # $FreeBSD$ -desc="open returns ENAMETOOLONG if a component of a pathname exceeded 255 characters" +desc="open returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh echo "1..4" -expect 0 open ${name255} O_CREAT 0620 -expect 0620 stat ${name255} mode -expect 0 unlink ${name255} -expect ENAMETOOLONG open ${name256} O_CREAT 0620 +nx=`namegen_max` +nxx="${nx}x" + +expect 0 open ${nx} O_CREAT 0620 +expect regular,0620 stat ${nx} type,mode +expect 0 unlink ${nx} +expect ENAMETOOLONG open ${nxx} O_CREAT 0620 Modified: head/tools/regression/fstest/tests/open/03.t ============================================================================== --- head/tools/regression/fstest/tests/open/03.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/open/03.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,22 +1,21 @@ #!/bin/sh # $FreeBSD$ -desc="open returns ENAMETOOLONG if an entire path name exceeded 1023 characters" +desc="open returns ENAMETOOLONG if an entire path name exceeded ${PATH_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..12" +echo "1..4" -expect 0 mkdir ${name255} 0755 -expect 0 mkdir ${name255}/${name255} 0755 -expect 0 mkdir ${name255}/${name255}/${name255} 0755 -expect 0 mkdir ${path1021} 0755 -expect 0 open ${path1023} O_CREAT 0642 -expect 0642 stat ${path1023} mode -expect 0 unlink ${path1023} -expect ENAMETOOLONG open ${path1024} O_CREAT 0642 -expect 0 rmdir ${path1021} -expect 0 rmdir ${name255}/${name255}/${name255} -expect 0 rmdir ${name255}/${name255} -expect 0 rmdir ${name255} +nx=`dirgen_max` +nxx="${nx}x" + +mkdir -p "${nx%/*}" + +expect 0 open ${nx} O_CREAT 0642 +expect regular,0642 stat ${nx} type,mode +expect 0 unlink ${nx} +expect ENAMETOOLONG open ${nxx} O_CREAT 0642 + +rm -rf "${nx%%/*}" Modified: head/tools/regression/fstest/tests/rename/01.t ============================================================================== --- head/tools/regression/fstest/tests/rename/01.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/rename/01.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,7 +1,7 @@ #!/bin/sh # $FreeBSD$ -desc="rename returns ENAMETOOLONG if a component of either pathname exceeded 255 characters" +desc="rename returns ENAMETOOLONG if a component of either pathname exceeded {NAME_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh @@ -9,13 +9,15 @@ dir=`dirname $0` echo "1..8" n0=`namegen` +nx=`namegen_max` +nxx="${nx}x" -expect 0 create ${name255} 0644 -expect 0 rename ${name255} ${n0} -expect 0 rename ${n0} ${name255} -expect 0 unlink ${name255} +expect 0 create ${nx} 0644 +expect 0 rename ${nx} ${n0} +expect 0 rename ${n0} ${nx} +expect 0 unlink ${nx} expect 0 create ${n0} 0644 -expect ENAMETOOLONG rename ${n0} ${name256} +expect ENAMETOOLONG rename ${n0} ${nxx} expect 0 unlink ${n0} -expect ENAMETOOLONG rename ${name256} ${n0} +expect ENAMETOOLONG rename ${nxx} ${n0} Modified: head/tools/regression/fstest/tests/rename/02.t ============================================================================== --- head/tools/regression/fstest/tests/rename/02.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/rename/02.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,26 +1,24 @@ #!/bin/sh # $FreeBSD$ -desc="rename returns ENAMETOOLONG if an entire length of either path name exceeded 1023 characters" +desc="rename returns ENAMETOOLONG if an entire length of either path name exceeded {PATH_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..14" +echo "1..6" n0=`namegen` +nx=`dirgen_max` +nxx="${nx}x" + +mkdir -p "${nx%/*}" -expect 0 mkdir ${name255} 0755 -expect 0 mkdir ${name255}/${name255} 0755 -expect 0 mkdir ${name255}/${name255}/${name255} 0755 -expect 0 mkdir ${path1021} 0755 expect 0 create ${n0} 0644 -expect 0 rename ${n0} ${path1023} -expect 0 rename ${path1023} ${n0} -expect ENAMETOOLONG rename ${n0} ${path1024} +expect 0 rename ${n0} ${nx} +expect 0 rename ${nx} ${n0} +expect ENAMETOOLONG rename ${n0} ${nxx} expect 0 unlink ${n0} -expect ENAMETOOLONG rename ${path1024} ${n0} -expect 0 rmdir ${path1021} -expect 0 rmdir ${name255}/${name255}/${name255} -expect 0 rmdir ${name255}/${name255} -expect 0 rmdir ${name255} +expect ENAMETOOLONG rename ${nxx} ${n0} + +rm -rf "${nx%%/*}" Modified: head/tools/regression/fstest/tests/rmdir/02.t ============================================================================== --- head/tools/regression/fstest/tests/rmdir/02.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/rmdir/02.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,14 +1,17 @@ #!/bin/sh # $FreeBSD$ -desc="rmdir returns ENAMETOOLONG if a component of a pathname exceeded 255 characters" +desc="rmdir returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh echo "1..4" -expect 0 mkdir ${name255} 0755 -expect 0 rmdir ${name255} -expect ENOENT rmdir ${name255} -expect ENAMETOOLONG rmdir ${name256} +nx=`namegen_max` +nxx="${nx}x" + +expect 0 mkdir ${nx} 0755 +expect 0 rmdir ${nx} +expect ENOENT rmdir ${nx} +expect ENAMETOOLONG rmdir ${nxx} Modified: head/tools/regression/fstest/tests/rmdir/03.t ============================================================================== --- head/tools/regression/fstest/tests/rmdir/03.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/rmdir/03.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,22 +1,22 @@ #!/bin/sh # $FreeBSD$ -desc="rmdir returns ENAMETOOLONG if an entire path name exceeded 1023 characters" +desc="rmdir returns ENAMETOOLONG if an entire path name exceeded ${PATH_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..12" +echo "1..5" -expect 0 mkdir ${name255} 0755 -expect 0 mkdir ${name255}/${name255} 0755 -expect 0 mkdir ${name255}/${name255}/${name255} 0755 -expect 0 mkdir ${path1021} 0755 -expect 0 mkdir ${path1023} 0755 -expect 0 rmdir ${path1023} -expect ENOENT rmdir ${path1023} -expect ENAMETOOLONG rmdir ${path1024} -expect 0 rmdir ${path1021} -expect 0 rmdir ${name255}/${name255}/${name255} -expect 0 rmdir ${name255}/${name255} -expect 0 rmdir ${name255} +nx=`dirgen_max` +nxx="${nx}x" + +mkdir -p "${nx%/*}" + +expect 0 mkdir ${nx} 0755 +expect dir,0755 stat ${nx} type,mode +expect 0 rmdir ${nx} +expect ENOENT rmdir ${nx} +expect ENAMETOOLONG rmdir ${nxx} + +rm -rf "${nx%%/*}" Modified: head/tools/regression/fstest/tests/symlink/02.t ============================================================================== --- head/tools/regression/fstest/tests/symlink/02.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/symlink/02.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,7 +1,7 @@ #!/bin/sh # $FreeBSD$ -desc="symlink returns ENAMETOOLONG if a component of the name2 pathname exceeded 255 characters" +desc="symlink returns ENAMETOOLONG if a component of the name2 pathname exceeded {NAME_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh @@ -9,12 +9,14 @@ dir=`dirname $0` echo "1..7" n0=`namegen` +nx=`namegen_max` +nxx="${nx}x" -expect 0 symlink ${name255} ${n0} +expect 0 symlink ${nx} ${n0} expect 0 unlink ${n0} -expect 0 symlink ${n0} ${name255} -expect 0 unlink ${name255} +expect 0 symlink ${n0} ${nx} +expect 0 unlink ${nx} -expect ENAMETOOLONG symlink ${n0} ${name256} -expect 0 symlink ${name256} ${n0} +expect ENAMETOOLONG symlink ${n0} ${nxx} +expect 0 symlink ${nxx} ${n0} expect 0 unlink ${n0} Modified: head/tools/regression/fstest/tests/symlink/03.t ============================================================================== --- head/tools/regression/fstest/tests/symlink/03.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/symlink/03.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,26 +1,22 @@ #!/bin/sh # $FreeBSD$ -desc="symlink returns ENAMETOOLONG if an entire length of either path name exceeded 1023 characters" +desc="symlink returns ENAMETOOLONG if an entire length of either path name exceeded {PATH_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..14" +echo "1..6" n0=`namegen` +nx=`dirgen_max` +nxx="${nx}x" -expect 0 symlink ${path1023} ${n0} +mkdir -p "${nx%/*}" +expect 0 symlink ${nx} ${n0} expect 0 unlink ${n0} -expect 0 mkdir ${name255} 0755 -expect 0 mkdir ${name255}/${name255} 0755 -expect 0 mkdir ${name255}/${name255}/${name255} 0755 -expect 0 mkdir ${path1021} 0755 -expect 0 symlink ${n0} ${path1023} -expect 0 unlink ${path1023} -expect ENAMETOOLONG symlink ${n0} ${path1024} -expect ENAMETOOLONG symlink ${path1024} ${n0} -expect 0 rmdir ${path1021} -expect 0 rmdir ${name255}/${name255}/${name255} -expect 0 rmdir ${name255}/${name255} -expect 0 rmdir ${name255} +expect 0 symlink ${n0} ${nx} +expect 0 unlink ${nx} +expect ENAMETOOLONG symlink ${n0} ${nxx} +expect ENAMETOOLONG symlink ${nxx} ${n0} +rm -rf "${nx%%/*}" Modified: head/tools/regression/fstest/tests/truncate/02.t ============================================================================== --- head/tools/regression/fstest/tests/truncate/02.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/truncate/02.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,15 +1,18 @@ #!/bin/sh # $FreeBSD$ -desc="truncate returns ENAMETOOLONG if a component of a pathname exceeded 255 characters" +desc="truncate returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh echo "1..5" -expect 0 create ${name255} 0644 -expect 0 truncate ${name255} 123 -expect 123 stat ${name255} size -expect 0 unlink ${name255} -expect ENAMETOOLONG truncate ${name256} 123 +nx=`namegen_max` +nxx="${nx}x" + +expect 0 create ${nx} 0644 +expect 0 truncate ${nx} 123 +expect 123 stat ${nx} size +expect 0 unlink ${nx} +expect ENAMETOOLONG truncate ${nxx} 123 Modified: head/tools/regression/fstest/tests/truncate/03.t ============================================================================== --- head/tools/regression/fstest/tests/truncate/03.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/truncate/03.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,22 +1,22 @@ #!/bin/sh # $FreeBSD$ -desc="truncate returns ENAMETOOLONG if an entire path name exceeded 1023 characters" +desc="truncate returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..12" +echo "1..5" -expect 0 mkdir ${name255} 0755 -expect 0 mkdir ${name255}/${name255} 0755 -expect 0 mkdir ${name255}/${name255}/${name255} 0755 -expect 0 mkdir ${path1021} 0755 -expect 0 create ${path1023} 0644 -expect 0 truncate ${path1023} 123 -expect 0 unlink ${path1023} -expect ENAMETOOLONG truncate ${path1024} 123 -expect 0 rmdir ${path1021} -expect 0 rmdir ${name255}/${name255}/${name255} -expect 0 rmdir ${name255}/${name255} -expect 0 rmdir ${name255} +nx=`dirgen_max` +nxx="${nx}x" + +mkdir -p "${nx%/*}" + +expect 0 create ${nx} 0644 +expect 0 truncate ${nx} 123 +expect regular,123 stat ${nx} type,size +expect 0 unlink ${nx} +expect ENAMETOOLONG truncate ${nxx} 123 + +rm -rf "${nx%%/*}" Modified: head/tools/regression/fstest/tests/unlink/02.t ============================================================================== --- head/tools/regression/fstest/tests/unlink/02.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/unlink/02.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,14 +1,17 @@ #!/bin/sh # $FreeBSD$ -desc="unlink returns ENAMETOOLONG if a component of a pathname exceeded 255 characters" +desc="unlink returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh echo "1..4" -expect 0 create ${name255} 0644 -expect 0 unlink ${name255} -expect ENOENT unlink ${name255} -expect ENAMETOOLONG unlink ${name256} +nx=`namegen_max` +nxx="${nx}x" + +expect 0 create ${nx} 0644 +expect 0 unlink ${nx} +expect ENOENT unlink ${nx} +expect ENAMETOOLONG unlink ${nxx} Modified: head/tools/regression/fstest/tests/unlink/03.t ============================================================================== --- head/tools/regression/fstest/tests/unlink/03.t Wed Aug 11 16:29:12 2010 (r211177) +++ head/tools/regression/fstest/tests/unlink/03.t Wed Aug 11 16:33:17 2010 (r211178) @@ -1,22 +1,21 @@ #!/bin/sh # $FreeBSD$ -desc="unlink returns ENAMETOOLONG if an entire path name exceeded 1023 characters" +desc="unlink returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..12" +echo "1..4" -expect 0 mkdir ${name255} 0755 -expect 0 mkdir ${name255}/${name255} 0755 -expect 0 mkdir ${name255}/${name255}/${name255} 0755 -expect 0 mkdir ${path1021} 0755 -expect 0 create ${path1023} 0644 -expect 0 unlink ${path1023} -expect ENOENT unlink ${path1023} -expect ENAMETOOLONG unlink ${path1024} -expect 0 rmdir ${path1021} -expect 0 rmdir ${name255}/${name255}/${name255} -expect 0 rmdir ${name255}/${name255} -expect 0 rmdir ${name255} +nx=`dirgen_max` +nxx="${nx}x" + +mkdir -p "${nx%/*}" + +expect 0 create ${nx} 0644 +expect 0 unlink ${nx} +expect ENOENT unlink ${nx} +expect ENAMETOOLONG unlink ${nxx} + +rm -rf "${nx%%/*}" From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 16:34:26 2010 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 6593E1065676; Wed, 11 Aug 2010 16:34:26 +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 52ACC8FC0A; Wed, 11 Aug 2010 16:34:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BGYQjJ009938; Wed, 11 Aug 2010 16:34:26 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BGYQoQ009936; Wed, 11 Aug 2010 16:34:26 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008111634.o7BGYQoQ009936@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 11 Aug 2010 16:34: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: r211179 - head/tools/regression/fstest/tests 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, 11 Aug 2010 16:34:26 -0000 Author: pjd Date: Wed Aug 11 16:34:26 2010 New Revision: 211179 URL: http://svn.freebsd.org/changeset/base/211179 Log: Move create_file() to misc.sh, as it is going to be used in more places. Modified: head/tools/regression/fstest/tests/misc.sh Modified: head/tools/regression/fstest/tests/misc.sh ============================================================================== --- head/tools/regression/fstest/tests/misc.sh Wed Aug 11 16:33:17 2010 (r211178) +++ head/tools/regression/fstest/tests/misc.sh Wed Aug 11 16:34:26 2010 (r211179) @@ -174,3 +174,38 @@ require() fi quick_exit } + +create_file() { + type="${1}" + name="${2}" + uid="${3}" + gid="${4}" + + case "${type}" in + none) + return + ;; + regular) + expect 0 create ${name} 0644 + ;; + dir) + expect 0 mkdir ${name} 0755 + ;; + fifo) + expect 0 mkfifo ${name} 0644 + ;; + block) + expect 0 mknod ${name} b 0644 1 2 + ;; + char) + expect 0 mknod ${name} c 0644 1 2 + ;; + socket) + expect 0 bind ${name} + ;; + symlink) + expect 0 symlink test ${name} + ;; + esac + expect 0 lchown ${name} ${uid} ${gid} +} From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 16:34:44 2010 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 76D8710657C3; Wed, 11 Aug 2010 16:34:44 +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 648298FC26; Wed, 11 Aug 2010 16:34:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BGYi7T010044; Wed, 11 Aug 2010 16:34:44 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BGYiic010037; Wed, 11 Aug 2010 16:34:44 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008111634.o7BGYiic010037@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 11 Aug 2010 16:34: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: r211180 - in head/tools/regression/fstest/tests: chflags chown link rename 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, 11 Aug 2010 16:34:44 -0000 Author: pjd Date: Wed Aug 11 16:34:44 2010 New Revision: 211180 URL: http://svn.freebsd.org/changeset/base/211180 Log: More and more tests. Modified: head/tools/regression/fstest/tests/chflags/00.t head/tools/regression/fstest/tests/chflags/10.t head/tools/regression/fstest/tests/chflags/11.t head/tools/regression/fstest/tests/chown/00.t head/tools/regression/fstest/tests/link/00.t head/tools/regression/fstest/tests/rename/09.t head/tools/regression/fstest/tests/rename/10.t head/tools/regression/fstest/tests/rename/21.t Modified: head/tools/regression/fstest/tests/chflags/00.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/00.t Wed Aug 11 16:34:26 2010 (r211179) +++ head/tools/regression/fstest/tests/chflags/00.t Wed Aug 11 16:34:44 2010 (r211180) @@ -14,14 +14,14 @@ FreeBSD:UFS) userflags="UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE" systemflags="SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" - echo "1..247" + echo "1..780" ;; FreeBSD:ZFS) allflags="UF_NODUMP,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" userflags="UF_NODUMP" systemflags="SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" - echo "1..167" + echo "1..520" ;; *) quick_exit @@ -36,41 +36,39 @@ expect 0 mkdir ${n2} 0755 cdir=`pwd` cd ${n2} -expect 0 create ${n0} 0644 -expect none stat ${n0} flags -expect 0 chflags ${n0} ${allflags} -expect ${allflags} stat ${n0} flags -expect 0 chflags ${n0} ${userflags} -expect ${userflags} stat ${n0} flags -expect 0 chflags ${n0} ${systemflags} -expect ${systemflags} stat ${n0} flags -expect 0 chflags ${n0} none -expect none stat ${n0} flags -expect 0 unlink ${n0} - -expect 0 mkdir ${n0} 0644 -expect none stat ${n0} flags -expect 0 chflags ${n0} ${allflags} -expect ${allflags} stat ${n0} flags -expect 0 chflags ${n0} ${userflags} -expect ${userflags} stat ${n0} flags -expect 0 chflags ${n0} ${systemflags} -expect ${systemflags} stat ${n0} flags -expect 0 chflags ${n0} none -expect none stat ${n0} flags -expect 0 rmdir ${n0} - -expect 0 mkfifo ${n0} 0644 -expect none stat ${n0} flags -expect 0 chflags ${n0} ${allflags} -expect ${allflags} stat ${n0} flags -expect 0 chflags ${n0} ${userflags} -expect ${userflags} stat ${n0} flags -expect 0 chflags ${n0} ${systemflags} -expect ${systemflags} stat ${n0} flags -expect 0 chflags ${n0} none -expect none stat ${n0} flags -expect 0 unlink ${n0} +for type in regular dir fifo block char socket; do + create_file ${type} ${n0} 0 0 + expect none stat ${n0} flags + expect 0 chflags ${n0} ${allflags} + expect ${allflags} stat ${n0} flags + expect 0 chflags ${n0} ${userflags} + expect ${userflags} stat ${n0} flags + expect 0 chflags ${n0} ${systemflags} + expect ${systemflags} stat ${n0} flags + expect 0 chflags ${n0} none + expect none stat ${n0} flags + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi + + create_file ${type} ${n0} 0 0 + expect none stat ${n0} flags + expect 0 lchflags ${n0} ${allflags} + expect ${allflags} stat ${n0} flags + expect 0 lchflags ${n0} ${userflags} + expect ${userflags} stat ${n0} flags + expect 0 lchflags ${n0} ${systemflags} + expect ${systemflags} stat ${n0} flags + expect 0 lchflags ${n0} none + expect none stat ${n0} flags + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi +done expect 0 create ${n0} 0644 expect 0 symlink ${n0} ${n1} @@ -111,86 +109,70 @@ expect 0 unlink ${n1} expect 0 unlink ${n0} # successful chflags(2) updates ctime. -expect 0 create ${n0} 0644 -for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect 0 chflags ${n0} ${flag} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -lt $ctime2 +for type in regular dir fifo block char socket symlink; do + if [ "${type}" != "symlink" ]; then + create_file ${type} ${n0} 0 0 + for flag in `echo ${allflags},none | tr ',' ' '`; do + ctime1=`${fstest} stat ${n0} ctime` + sleep 1 + expect 0 chflags ${n0} ${flag} + ctime2=`${fstest} stat ${n0} ctime` + test_check $ctime1 -lt $ctime2 + done + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi + fi + + create_file ${type} ${n0} 0 0 + for flag in `echo ${allflags},none | tr ',' ' '`; do + ctime1=`${fstest} lstat ${n0} ctime` + sleep 1 + expect 0 lchflags ${n0} ${flag} + ctime2=`${fstest} lstat ${n0} ctime` + test_check $ctime1 -lt $ctime2 + done + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi done -expect 0 unlink ${n0} - -expect 0 mkdir ${n0} 0755 -for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect 0 chflags ${n0} ${flag} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -lt $ctime2 -done -expect 0 rmdir ${n0} - -expect 0 mkfifo ${n0} 0644 -for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect 0 chflags ${n0} ${flag} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -lt $ctime2 -done -expect 0 unlink ${n0} - -expect 0 symlink ${n1} ${n0} -for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect 0 lchflags ${n0} ${flag} - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -lt $ctime2 -done -expect 0 unlink ${n0} # unsuccessful chflags(2) does not update ctime. -expect 0 create ${n0} 0644 -for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 chflags ${n0} ${flag} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -eq $ctime2 -done -expect 0 unlink ${n0} - -expect 0 mkdir ${n0} 0755 -for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 chflags ${n0} ${flag} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -eq $ctime2 +for type in regular dir fifo block char socket symlink; do + if [ "${type}" != "symlink" ]; then + create_file ${type} ${n0} 0 0 + for flag in `echo ${allflags},none | tr ',' ' '`; do + ctime1=`${fstest} stat ${n0} ctime` + sleep 1 + expect EPERM -u 65534 chflags ${n0} ${flag} + ctime2=`${fstest} stat ${n0} ctime` + test_check $ctime1 -eq $ctime2 + done + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi + fi + + create_file ${type} ${n0} 0 0 + for flag in `echo ${allflags},none | tr ',' ' '`; do + ctime1=`${fstest} lstat ${n0} ctime` + sleep 1 + expect EPERM -u 65534 lchflags ${n0} ${flag} + ctime2=`${fstest} lstat ${n0} ctime` + test_check $ctime1 -eq $ctime2 + done + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi done -expect 0 rmdir ${n0} - -expect 0 mkfifo ${n0} 0644 -for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} stat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 chflags ${n0} ${flag} - ctime2=`${fstest} stat ${n0} ctime` - test_check $ctime1 -eq $ctime2 -done -expect 0 unlink ${n0} - -expect 0 symlink ${n1} ${n0} -for flag in `echo ${allflags},none | tr ',' ' '`; do - ctime1=`${fstest} lstat ${n0} ctime` - sleep 1 - expect EPERM -u 65534 lchflags ${n0} ${flag} - ctime2=`${fstest} lstat ${n0} ctime` - test_check $ctime1 -eq $ctime2 -done -expect 0 unlink ${n0} cd ${cdir} expect 0 rmdir ${n2} Modified: head/tools/regression/fstest/tests/chflags/10.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/10.t Wed Aug 11 16:34:26 2010 (r211179) +++ head/tools/regression/fstest/tests/chflags/10.t Wed Aug 11 16:34:44 2010 (r211180) @@ -8,7 +8,7 @@ dir=`dirname $0` require chflags -echo "1..62" +echo "1..210" n0=`namegen` n1=`namegen` @@ -18,45 +18,37 @@ expect 0 mkdir ${n0} 0755 cdir=`pwd` cd ${n0} -expect 0 create ${n1} 0644 -expect 0 chown ${n1} 65534 65534 -for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag} - expect none stat ${n1} flags - expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag} - expect none stat ${n1} flags +for type in regular dir fifo block char socket symlink; do + if [ "${type}" != "symlink" ]; then + create_file ${type} ${n1} 0 0 + expect 0 chown ${n1} 65534 65534 + for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do + expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag} + expect none stat ${n1} flags + expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag} + expect none stat ${n1} flags + done + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi + fi + + create_file ${type} ${n1} 0 0 + expect 0 lchown ${n1} 65534 65534 + for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do + expect EPERM -u 65533 -g 65533 lchflags ${n1} ${flag} + expect none lstat ${n1} flags + expect EPERM -u 65534 -g 65534 lchflags ${n1} ${flag} + expect none lstat ${n1} flags + done + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi done -expect 0 unlink ${n1} - -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag} - expect none stat ${n1} flags - expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag} - expect none stat ${n1} flags -done -expect 0 rmdir ${n1} - -expect 0 mkfifo ${n1} 0644 -expect 0 chown ${n1} 65534 65534 -for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag} - expect none stat ${n1} flags - expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag} - expect none stat ${n1} flags -done -expect 0 unlink ${n1} - -expect 0 symlink ${n2} ${n1} -expect 0 lchown ${n1} 65534 65534 -for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect EPERM -u 65533 -g 65533 lchflags ${n1} ${flag} - expect none lstat ${n1} flags - expect EPERM -u 65534 -g 65534 lchflags ${n1} ${flag} - expect none lstat ${n1} flags -done -expect 0 unlink ${n1} cd ${cdir} expect 0 rmdir ${n0} Modified: head/tools/regression/fstest/tests/chflags/11.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/11.t Wed Aug 11 16:34:26 2010 (r211179) +++ head/tools/regression/fstest/tests/chflags/11.t Wed Aug 11 16:34:44 2010 (r211180) @@ -8,7 +8,7 @@ dir=`dirname $0` require chflags_SF_SNAPSHOT -echo "1..46" +echo "1..158" n0=`namegen` n1=`namegen` @@ -18,53 +18,41 @@ expect 0 mkdir ${n0} 0755 cdir=`pwd` cd ${n0} -expect 0 create ${n1} 0644 -expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT -expect none stat ${n1} flags -expect EPERM chflags ${n1} SF_SNAPSHOT -expect none stat ${n1} flags -expect 0 chown ${n1} 65534 65534 -expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT -expect none stat ${n1} flags -expect EPERM chflags ${n1} SF_SNAPSHOT -expect none stat ${n1} flags -expect 0 unlink ${n1} - -expect 0 mkdir ${n1} 0644 -expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT -expect none stat ${n1} flags -expect EPERM chflags ${n1} SF_SNAPSHOT -expect none stat ${n1} flags -expect 0 chown ${n1} 65534 65534 -expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT -expect none stat ${n1} flags -expect EPERM chflags ${n1} SF_SNAPSHOT -expect none stat ${n1} flags -expect 0 rmdir ${n1} - -expect 0 mkfifo ${n1} 0644 -expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT -expect none stat ${n1} flags -expect EPERM chflags ${n1} SF_SNAPSHOT -expect none stat ${n1} flags -expect 0 chown ${n1} 65534 65534 -expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT -expect none stat ${n1} flags -expect EPERM chflags ${n1} SF_SNAPSHOT -expect none stat ${n1} flags -expect 0 unlink ${n1} - -expect 0 symlink ${n2} ${n1} -expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT -expect none lstat ${n1} flags -expect EPERM lchflags ${n1} SF_SNAPSHOT -expect none lstat ${n1} flags -expect 0 lchown ${n1} 65534 65534 -expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT -expect none lstat ${n1} flags -expect EPERM lchflags ${n1} SF_SNAPSHOT -expect none lstat ${n1} flags -expect 0 unlink ${n1} +for type in regular dir fifo block char socket symlink; do + if [ "${type}" != "symlink" ]; then + create_file ${type} ${n1} 0 0 + expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT + expect none stat ${n1} flags + expect EPERM chflags ${n1} SF_SNAPSHOT + expect none stat ${n1} flags + expect 0 chown ${n1} 65534 65534 + expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT + expect none stat ${n1} flags + expect EPERM chflags ${n1} SF_SNAPSHOT + expect none stat ${n1} flags + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi + fi + + create_file ${type} ${n1} 0 0 + expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT + expect none lstat ${n1} flags + expect EPERM lchflags ${n1} SF_SNAPSHOT + expect none lstat ${n1} flags + expect 0 lchown ${n1} 65534 65534 + expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT + expect none lstat ${n1} flags + expect EPERM lchflags ${n1} SF_SNAPSHOT + expect none lstat ${n1} flags + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi +done cd ${cdir} expect 0 rmdir ${n0} Modified: head/tools/regression/fstest/tests/chown/00.t ============================================================================== --- head/tools/regression/fstest/tests/chown/00.t Wed Aug 11 16:34:26 2010 (r211179) +++ head/tools/regression/fstest/tests/chown/00.t Wed Aug 11 16:34:44 2010 (r211180) @@ -7,9 +7,9 @@ dir=`dirname $0` . ${dir}/../misc.sh if supported lchmod; then - echo "1..186" + echo "1..264" else - echo "1..171" + echo "1..249" fi n0=`namegen` @@ -21,28 +21,49 @@ cdir=`pwd` cd ${n2} # super-user can always modify ownership -# 2 + expect 0 create ${n0} 0644 expect 0 chown ${n0} 123 456 expect 123,456 lstat ${n0} uid,gid expect 0 chown ${n0} 0 0 expect 0,0 lstat ${n0} uid,gid expect 0 unlink ${n0} -# 8 + expect 0 mkfifo ${n0} 0644 expect 0 chown ${n0} 123 456 expect 123,456 lstat ${n0} uid,gid expect 0 chown ${n0} 0 0 expect 0,0 lstat ${n0} uid,gid expect 0 unlink ${n0} -# 14 + +expect 0 mknod ${n0} b 0644 1 2 +expect 0 chown ${n0} 123 456 +expect 123,456 lstat ${n0} uid,gid +expect 0 chown ${n0} 0 0 +expect 0,0 lstat ${n0} uid,gid +expect 0 unlink ${n0} + +expect 0 mknod ${n0} c 0644 1 2 +expect 0 chown ${n0} 123 456 +expect 123,456 lstat ${n0} uid,gid +expect 0 chown ${n0} 0 0 +expect 0,0 lstat ${n0} uid,gid +expect 0 unlink ${n0} + +expect 0 bind ${n0} +expect 0 chown ${n0} 123 456 +expect 123,456 lstat ${n0} uid,gid +expect 0 chown ${n0} 0 0 +expect 0,0 lstat ${n0} uid,gid +expect 0 unlink ${n0} + expect 0 mkdir ${n0} 0755 expect 0 chown ${n0} 123 456 expect 123,456 lstat ${n0} uid,gid expect 0 chown ${n0} 0 0 expect 0,0 lstat ${n0} uid,gid expect 0 rmdir ${n0} -# 20 + expect 0 create ${n0} 0644 expect 0 symlink ${n0} ${n1} expect 0 chown ${n1} 123 456 @@ -57,7 +78,7 @@ expect 0 unlink ${n1} # non-super-user can modify file group if he is owner of a file and # gid he is setting is in his groups list. -# 31 + expect 0 create ${n0} 0644 expect 0 chown ${n0} 65534 65533 expect 65534,65533 lstat ${n0} uid,gid @@ -69,14 +90,14 @@ expect 0 unlink ${n0} # chown(2) return 0 if user is not owner of a file, but chown(2) is called # with both uid and gid equal to -1. -# 39 + expect 0 create ${n0} 0644 expect 0 chown ${n0} 65534 65533 expect 0 -u 65532 -g 65531 -- chown ${n0} -1 -1 expect 0 unlink ${n0} # when super-user calls chown(2), set-uid and set-gid bits may be removed. -# 43 + expect 0 create ${n0} 0644 expect 0 chown ${n0} 65534 65533 expect 0 chmod ${n0} 06555 @@ -84,7 +105,7 @@ expect 06555 lstat ${n0} mode expect 0 chown ${n0} 65532 65531 expect "06555|0555" lstat ${n0} mode expect 0 unlink ${n0} -# 50 + expect 0 create ${n0} 0644 expect 0 chown ${n0} 0 0 expect 0 chmod ${n0} 06555 @@ -92,7 +113,7 @@ expect 06555 lstat ${n0} mode expect 0 chown ${n0} 65534 65533 expect "06555|0555" lstat ${n0} mode expect 0 unlink ${n0} -# 57 + expect 0 create ${n0} 0644 expect 0 chown ${n0} 65534 65533 expect 0 chmod ${n0} 06555 @@ -103,7 +124,7 @@ expect 0 unlink ${n0} # when non-super-user calls chown(2) successfully, set-uid and set-gid bits may # be removed, except when both uid and gid are equal to -1. -# 64 + expect 0 create ${n0} 0644 expect 0 chown ${n0} 65534 65533 expect 0 chmod ${n0} 06555 @@ -119,7 +140,7 @@ expect 06555 lstat ${n0} mode expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 -1 expect "06555,65534,65533|0555,65534,65533" lstat ${n0} mode,uid,gid expect 0 unlink ${n0} -# 79 + expect 0 mkdir ${n0} 0755 expect 0 chown ${n0} 65534 65533 expect 0 chmod ${n0} 06555 @@ -135,7 +156,7 @@ expect 06555 lstat ${n0} mode expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 -1 expect 06555,65534,65533 lstat ${n0} mode,uid,gid expect 0 rmdir ${n0} -# 94 + if supported lchmod; then expect 0 symlink ${n1} ${n0} expect 0 lchown ${n0} 65534 65533 @@ -155,7 +176,7 @@ if supported lchmod; then fi # successfull chown(2) call (except uid and gid equal to -1) updates ctime. -# 109 + expect 0 create ${n0} 0644 ctime1=`${fstest} stat ${n0} ctime` sleep 1 @@ -164,7 +185,7 @@ expect 65534,65533 lstat ${n0} uid,gid ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -lt $ctime2 expect 0 unlink ${n0} -# 114 + expect 0 mkdir ${n0} 0755 ctime1=`${fstest} stat ${n0} ctime` sleep 1 @@ -173,7 +194,7 @@ expect 65534,65533 lstat ${n0} uid,gid ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -lt $ctime2 expect 0 rmdir ${n0} -# 119 + expect 0 mkfifo ${n0} 0644 ctime1=`${fstest} stat ${n0} ctime` sleep 1 @@ -182,7 +203,34 @@ expect 65534,65533 lstat ${n0} uid,gid ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -lt $ctime2 expect 0 unlink ${n0} -# 124 + +expect 0 mknod ${n0} b 0644 1 2 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 chown ${n0} 65534 65533 +expect 65534,65533 lstat ${n0} uid,gid +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -lt $ctime2 +expect 0 unlink ${n0} + +expect 0 mknod ${n0} c 0644 1 2 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 chown ${n0} 65534 65533 +expect 65534,65533 lstat ${n0} uid,gid +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -lt $ctime2 +expect 0 unlink ${n0} + +expect 0 bind ${n0} +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 chown ${n0} 65534 65533 +expect 65534,65533 lstat ${n0} uid,gid +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -lt $ctime2 +expect 0 unlink ${n0} + expect 0 symlink ${n1} ${n0} ctime1=`${fstest} lstat ${n0} ctime` sleep 1 @@ -191,7 +239,7 @@ expect 65534,65533 lstat ${n0} uid,gid ctime2=`${fstest} lstat ${n0} ctime` test_check $ctime1 -lt $ctime2 expect 0 unlink ${n0} -# 129 + expect 0 create ${n0} 0644 expect 0 chown ${n0} 65534 65533 ctime1=`${fstest} stat ${n0} ctime` @@ -201,7 +249,7 @@ expect 65534,65532 lstat ${n0} uid,gid ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -lt $ctime2 expect 0 unlink ${n0} -# 135 + expect 0 mkdir ${n0} 0755 expect 0 chown ${n0} 65534 65533 ctime1=`${fstest} stat ${n0} ctime` @@ -211,7 +259,7 @@ expect 65534,65532 lstat ${n0} uid,gid ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -lt $ctime2 expect 0 rmdir ${n0} -# 141 + expect 0 mkfifo ${n0} 0644 expect 0 chown ${n0} 65534 65533 ctime1=`${fstest} stat ${n0} ctime` @@ -222,7 +270,40 @@ expect 65534,65532 lstat ${n0} uid,gid ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -lt $ctime2 expect 0 unlink ${n0} -# 148 + +expect 0 mknod ${n0} b 0644 1 2 +expect 0 chown ${n0} 65534 65533 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 chown ${n0} 65534 65533 +expect 0 -u 65534 -g 65532 chown ${n0} 65534 65532 +expect 65534,65532 lstat ${n0} uid,gid +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -lt $ctime2 +expect 0 unlink ${n0} + +expect 0 mknod ${n0} c 0644 1 2 +expect 0 chown ${n0} 65534 65533 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 chown ${n0} 65534 65533 +expect 0 -u 65534 -g 65532 chown ${n0} 65534 65532 +expect 65534,65532 lstat ${n0} uid,gid +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -lt $ctime2 +expect 0 unlink ${n0} + +expect 0 bind ${n0} +expect 0 chown ${n0} 65534 65533 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 chown ${n0} 65534 65533 +expect 0 -u 65534 -g 65532 chown ${n0} 65534 65532 +expect 65534,65532 lstat ${n0} uid,gid +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -lt $ctime2 +expect 0 unlink ${n0} + expect 0 symlink ${n1} ${n0} expect 0 lchown ${n0} 65534 65533 ctime1=`${fstest} lstat ${n0} ctime` @@ -232,7 +313,7 @@ expect 65534,65532 lstat ${n0} uid,gid ctime2=`${fstest} lstat ${n0} ctime` test_check $ctime1 -lt $ctime2 expect 0 unlink ${n0} -# 154 + expect 0 create ${n0} 0644 ctime1=`${fstest} stat ${n0} ctime` sleep 1 @@ -241,7 +322,7 @@ ctime2=`${fstest} stat ${n0} ctime` todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated." test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} -# 158 + expect 0 mkdir ${n0} 0644 ctime1=`${fstest} stat ${n0} ctime` sleep 1 @@ -250,7 +331,7 @@ ctime2=`${fstest} stat ${n0} ctime` todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated." test_check $ctime1 -eq $ctime2 expect 0 rmdir ${n0} -# 162 + expect 0 mkfifo ${n0} 0644 ctime1=`${fstest} stat ${n0} ctime` sleep 1 @@ -259,7 +340,34 @@ ctime2=`${fstest} stat ${n0} ctime` todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated." test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} -# 166 + +expect 0 mknod ${n0} b 0644 1 2 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 -- chown ${n0} -1 -1 +ctime2=`${fstest} stat ${n0} ctime` +todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated." +test_check $ctime1 -eq $ctime2 +expect 0 unlink ${n0} + +expect 0 mknod ${n0} c 0644 1 2 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 -- chown ${n0} -1 -1 +ctime2=`${fstest} stat ${n0} ctime` +todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated." +test_check $ctime1 -eq $ctime2 +expect 0 unlink ${n0} + +expect 0 bind ${n0} +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 -- chown ${n0} -1 -1 +ctime2=`${fstest} stat ${n0} ctime` +todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated." +test_check $ctime1 -eq $ctime2 +expect 0 unlink ${n0} + expect 0 symlink ${n1} ${n0} ctime1=`${fstest} lstat ${n0} ctime` sleep 1 @@ -270,7 +378,7 @@ test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} # unsuccessful chown(2) does not update ctime. -# 170 + expect 0 create ${n0} 0644 ctime1=`${fstest} stat ${n0} ctime` sleep 1 @@ -278,7 +386,7 @@ expect EPERM -u 65534 -- chown ${n0} 655 ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} -# 174 + expect 0 mkdir ${n0} 0755 ctime1=`${fstest} stat ${n0} ctime` sleep 1 @@ -286,7 +394,7 @@ expect EPERM -u 65534 -g 65534 -- chown ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -eq $ctime2 expect 0 rmdir ${n0} -# 178 + expect 0 mkfifo ${n0} 0644 ctime1=`${fstest} stat ${n0} ctime` sleep 1 @@ -294,7 +402,31 @@ expect EPERM -u 65534 -g 65534 chown ${n ctime2=`${fstest} stat ${n0} ctime` test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} -# 182 + +expect 0 mknod ${n0} b 0644 1 2 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect EPERM -u 65534 -g 65534 chown ${n0} 65534 65534 +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -eq $ctime2 +expect 0 unlink ${n0} + +expect 0 mknod ${n0} c 0644 1 2 +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect EPERM -u 65534 -g 65534 chown ${n0} 65534 65534 +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -eq $ctime2 +expect 0 unlink ${n0} + +expect 0 bind ${n0} +ctime1=`${fstest} stat ${n0} ctime` +sleep 1 +expect EPERM -u 65534 -g 65534 chown ${n0} 65534 65534 +ctime2=`${fstest} stat ${n0} ctime` +test_check $ctime1 -eq $ctime2 +expect 0 unlink ${n0} + expect 0 symlink ${n1} ${n0} ctime1=`${fstest} lstat ${n0} ctime` sleep 1 @@ -303,6 +435,5 @@ ctime2=`${fstest} lstat ${n0} ctime` test_check $ctime1 -eq $ctime2 expect 0 unlink ${n0} -# 186 cd ${cdir} expect 0 rmdir ${n2} Modified: head/tools/regression/fstest/tests/link/00.t ============================================================================== --- head/tools/regression/fstest/tests/link/00.t Wed Aug 11 16:34:26 2010 (r211179) +++ head/tools/regression/fstest/tests/link/00.t Wed Aug 11 16:34:44 2010 (r211180) @@ -6,7 +6,7 @@ desc="link creates hardlinks" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..82" +echo "1..217" n0=`namegen` n1=`namegen` @@ -17,135 +17,77 @@ expect 0 mkdir ${n3} 0755 cdir=`pwd` cd ${n3} -expect 0 create ${n0} 0644 -expect regular,0644,1 lstat ${n0} type,mode,nlink - -expect 0 link ${n0} ${n1} -expect regular,0644,2 lstat ${n0} type,mode,nlink -expect regular,0644,2 lstat ${n1} type,mode,nlink - -expect 0 link ${n1} ${n2} -expect regular,0644,3 lstat ${n0} type,mode,nlink -expect regular,0644,3 lstat ${n1} type,mode,nlink -expect regular,0644,3 lstat ${n2} type,mode,nlink - -expect 0 chmod ${n1} 0201 -expect 0 chown ${n1} 65534 65533 - -expect regular,0201,3,65534,65533 lstat ${n0} type,mode,nlink,uid,gid -expect regular,0201,3,65534,65533 lstat ${n1} type,mode,nlink,uid,gid -expect regular,0201,3,65534,65533 lstat ${n2} type,mode,nlink,uid,gid - -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type,mode,nlink,uid,gid -expect regular,0201,2,65534,65533 lstat ${n1} type,mode,nlink,uid,gid -expect regular,0201,2,65534,65533 lstat ${n2} type,mode,nlink,uid,gid - -expect 0 unlink ${n2} -expect ENOENT lstat ${n0} type,mode,nlink,uid,gid -expect regular,0201,1,65534,65533 lstat ${n1} type,mode,nlink,uid,gid -expect ENOENT lstat ${n2} type,mode,nlink,uid,gid - -expect 0 unlink ${n1} -expect ENOENT lstat ${n0} type,mode,nlink,uid,gid -expect ENOENT lstat ${n1} type,mode,nlink,uid,gid -expect ENOENT lstat ${n2} type,mode,nlink,uid,gid - -expect 0 mkfifo ${n0} 0644 -expect fifo,0644,1 lstat ${n0} type,mode,nlink - -expect 0 link ${n0} ${n1} -expect fifo,0644,2 lstat ${n0} type,mode,nlink -expect fifo,0644,2 lstat ${n1} type,mode,nlink - -expect 0 link ${n1} ${n2} -expect fifo,0644,3 lstat ${n0} type,mode,nlink -expect fifo,0644,3 lstat ${n1} type,mode,nlink -expect fifo,0644,3 lstat ${n2} type,mode,nlink - -expect 0 chmod ${n1} 0201 -expect 0 chown ${n1} 65534 65533 - -expect fifo,0201,3,65534,65533 lstat ${n0} type,mode,nlink,uid,gid -expect fifo,0201,3,65534,65533 lstat ${n1} type,mode,nlink,uid,gid -expect fifo,0201,3,65534,65533 lstat ${n2} type,mode,nlink,uid,gid - -expect 0 unlink ${n0} -expect ENOENT lstat ${n0} type,mode,nlink,uid,gid -expect fifo,0201,2,65534,65533 lstat ${n1} type,mode,nlink,uid,gid -expect fifo,0201,2,65534,65533 lstat ${n2} type,mode,nlink,uid,gid - -expect 0 unlink ${n2} -expect ENOENT lstat ${n0} type,mode,nlink,uid,gid -expect fifo,0201,1,65534,65533 lstat ${n1} type,mode,nlink,uid,gid -expect ENOENT lstat ${n2} type,mode,nlink,uid,gid - -expect 0 unlink ${n1} -expect ENOENT lstat ${n0} type,mode,nlink,uid,gid -expect ENOENT lstat ${n1} type,mode,nlink,uid,gid -expect ENOENT lstat ${n2} type,mode,nlink,uid,gid +for type in regular fifo block char socket; do + create_file ${type} ${n0} 0 0 + expect ${type},1 lstat ${n0} type,nlink + + expect 0 link ${n0} ${n1} + expect ${type},2 lstat ${n0} type,nlink + expect ${type},2 lstat ${n1} type,nlink + + expect 0 link ${n1} ${n2} + expect ${type},3 lstat ${n0} type,nlink + expect ${type},3 lstat ${n1} type,nlink + expect ${type},3 lstat ${n2} type,nlink + + expect 0 chmod ${n1} 0201 + expect 0 chown ${n1} 65534 65533 + + expect ${type},0201,3,65534,65533 lstat ${n0} type,mode,nlink,uid,gid + expect ${type},0201,3,65534,65533 lstat ${n1} type,mode,nlink,uid,gid + expect ${type},0201,3,65534,65533 lstat ${n2} type,mode,nlink,uid,gid + + expect 0 unlink ${n0} + expect ENOENT lstat ${n0} type,mode,nlink,uid,gid + expect ${type},0201,2,65534,65533 lstat ${n1} type,mode,nlink,uid,gid + expect ${type},0201,2,65534,65533 lstat ${n2} type,mode,nlink,uid,gid + + expect 0 unlink ${n2} + expect ENOENT lstat ${n0} type,mode,nlink,uid,gid + expect ${type},0201,1,65534,65533 lstat ${n1} type,mode,nlink,uid,gid + expect ENOENT lstat ${n2} type,mode,nlink,uid,gid + + expect 0 unlink ${n1} + expect ENOENT lstat ${n0} type,mode,nlink,uid,gid + expect ENOENT lstat ${n1} type,mode,nlink,uid,gid + expect ENOENT lstat ${n2} type,mode,nlink,uid,gid +done # successful link(2) updates ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -dctime1=`${fstest} stat . ctime` -dmtime1=`${fstest} stat . mtime` -sleep 1 -expect 0 link ${n0} ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -dctime2=`${fstest} stat . ctime` -test_check $dctime1 -lt $dctime2 -dmtime2=`${fstest} stat . mtime` -test_check $dctime1 -lt $dmtime2 -expect 0 unlink ${n0} -expect 0 unlink ${n1} - -expect 0 mkfifo ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -dctime1=`${fstest} stat . ctime` -dmtime1=`${fstest} stat . mtime` -sleep 1 -expect 0 link ${n0} ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -lt $ctime2 -dctime2=`${fstest} stat . ctime` -test_check $dctime1 -lt $dctime2 -dmtime2=`${fstest} stat . mtime` -test_check $dctime1 -lt $dmtime2 -expect 0 unlink ${n0} -expect 0 unlink ${n1} +for type in regular fifo block char socket; do + create_file ${type} ${n0} 0 0 + ctime1=`${fstest} stat ${n0} ctime` + dctime1=`${fstest} stat . ctime` + dmtime1=`${fstest} stat . mtime` + sleep 1 + expect 0 link ${n0} ${n1} + ctime2=`${fstest} stat ${n0} ctime` + test_check $ctime1 -lt $ctime2 + dctime2=`${fstest} stat . ctime` + test_check $dctime1 -lt $dctime2 + dmtime2=`${fstest} stat . mtime` + test_check $dctime1 -lt $dmtime2 + expect 0 unlink ${n0} + expect 0 unlink ${n1} +done # unsuccessful link(2) does not update ctime. -expect 0 create ${n0} 0644 -expect 0 -- chown ${n0} 65534 -1 -ctime1=`${fstest} stat ${n0} ctime` -dctime1=`${fstest} stat . ctime` -dmtime1=`${fstest} stat . mtime` *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 16:53:45 2010 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 EF7D7106567C; Wed, 11 Aug 2010 16:53:45 +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 DE9E48FC1B; Wed, 11 Aug 2010 16:53:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BGrjWq014302; Wed, 11 Aug 2010 16:53:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BGrj8q014300; Wed, 11 Aug 2010 16:53:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201008111653.o7BGrj8q014300@svn.freebsd.org> From: John Baldwin Date: Wed, 11 Aug 2010 16:53: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: r211181 - head/sys/opencrypto 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, 11 Aug 2010 16:53:46 -0000 Author: jhb Date: Wed Aug 11 16:53:45 2010 New Revision: 211181 URL: http://svn.freebsd.org/changeset/base/211181 Log: Fix typo in comment. Modified: head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Wed Aug 11 16:34:44 2010 (r211180) +++ head/sys/opencrypto/cryptodev.c Wed Aug 11 16:53:45 2010 (r211181) @@ -506,7 +506,7 @@ cryptof_ioctl( } } - /* NB: CIOGSESSION2 has the crid */ + /* NB: CIOCGSESSION2 has the crid */ if (cmd == CIOCGSESSION2 #ifdef COMPAT_FREEBSD32 || cmd == CIOCGSESSION232 From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 16:56:38 2010 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 80B0E1065677; Wed, 11 Aug 2010 16:56:38 +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 6FABA8FC1D; Wed, 11 Aug 2010 16:56:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BGuc1A014991; Wed, 11 Aug 2010 16:56:38 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BGucoj014989; Wed, 11 Aug 2010 16:56:38 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201008111656.o7BGucoj014989@svn.freebsd.org> From: John Baldwin Date: Wed, 11 Aug 2010 16:56: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: r211182 - head/sys/dev/iscsi/initiator 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, 11 Aug 2010 16:56:38 -0000 Author: jhb Date: Wed Aug 11 16:56:38 2010 New Revision: 211182 URL: http://svn.freebsd.org/changeset/base/211182 Log: Do not use %z to print a time_t. Fixes build on architectures where time_t and size_t are different types. Modified: head/sys/dev/iscsi/initiator/iscsi.c Modified: head/sys/dev/iscsi/initiator/iscsi.c ============================================================================== --- head/sys/dev/iscsi/initiator/iscsi.c Wed Aug 11 16:53:45 2010 (r211181) +++ head/sys/dev/iscsi/initiator/iscsi.c Wed Aug 11 16:56:38 2010 (r211182) @@ -306,11 +306,11 @@ iscsi_read(struct cdev *dev, struct uio int i = 0; struct socket *so = sp->soc; #define pukeit(i, pq) do {\ - sprintf(buf, "%03d] %06x %02x %06x %06x %zd\n",\ + sprintf(buf, "%03d] %06x %02x %06x %06x %jd\n",\ i, ntohl(pq->pdu.ipdu.bhs.CmdSN),\ pq->pdu.ipdu.bhs.opcode, ntohl(pq->pdu.ipdu.bhs.itt),\ ntohl(pq->pdu.ipdu.bhs.ExpStSN),\ - pq->ts.sec);\ + (intmax_t)pq->ts.sec);\ } while(0) sprintf(buf, "%d/%d /---- hld -----/\n", sp->stats.nhld, sp->stats.max_hld); From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 17:05:00 2010 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 67324106564A; Wed, 11 Aug 2010 17:05:00 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id B07EA8FC16; Wed, 11 Aug 2010 17:04:59 +0000 (UTC) Received: by qyk32 with SMTP id 32so437256qyk.13 for ; Wed, 11 Aug 2010 10:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=qTkikgXEyKny62tmU5PHzbFAFq1AWeiDimnvwgpUpM0=; b=ksvWrp4JEsoXKzU8qkZmxc/yLE1R0gboJ2Vpg2g/C6EdwZdKU8R0OEUtvfJ5aIjpXW E0FCfe858z7YZ9svut7ri3Whn8UT1H5H+1XUT6Mi9ilsMkfUnFxEfOVuTcj003yzlUA2 d91k+mb6qS4piTpVkfg6MoYSEusQI/OxmsExg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=QsRXbkiWlKzLenPCopYpCuICHJ273NHUQssI5L6MO4sFrQv2bsnQQOb4VNqrO1hKIv W+IMMU8Gg1pMYT3yetKf6WFkRc35JqeTaRPMtbI1cVXQv1uWiweXExH1CXck1AEWZX8B TAq8MuXvBN/VsLcOXUaidp+Kmo9wPuehIlPTE= MIME-Version: 1.0 Received: by 10.224.66.163 with SMTP id n35mr11009304qai.8.1281546298256; Wed, 11 Aug 2010 10:04:58 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.251.6 with HTTP; Wed, 11 Aug 2010 10:04:58 -0700 (PDT) In-Reply-To: <20100811144646.GL2396@deviant.kiev.zoral.com.ua> References: <201008111051.o7BApRp4028538@svn.freebsd.org> <20100811105739.GJ2396@deviant.kiev.zoral.com.ua> <20100811123430.GK2396@deviant.kiev.zoral.com.ua> <20100811144646.GL2396@deviant.kiev.zoral.com.ua> Date: Wed, 11 Aug 2010 19:04:58 +0200 X-Google-Sender-Auth: oLzgYb2084RBRyOX2k7fi-8JCMw Message-ID: From: Attilio Rao To: Kostik Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Jeff Roberson , John Baldwin Subject: Re: svn commit: r211176 - 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, 11 Aug 2010 17:05:00 -0000 2010/8/11 Kostik Belousov : > On Wed, Aug 11, 2010 at 04:29:21PM +0200, Attilio Rao wrote: >> 2010/8/11 Kostik Belousov : >> > On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote: >> >> 2010/8/11 Kostik Belousov : >> >> > On Wed, Aug 11, 2010 at 10:51:27AM +0000, Attilio Rao wrote: >> >> >> Author: attilio >> >> >> Date: Wed Aug 11 10:51:27 2010 >> >> >> New Revision: 211176 >> >> >> URL: http://svn.freebsd.org/changeset/base/211176 >> >> >> >> >> >> Log: >> >> >> =C2=A0 IPI handlers may run generally with interrupts disabled bec= ause they >> >> >> =C2=A0 are served via an interrupt gate. >> >> >> >> >> >> =C2=A0 However, that doesn't explicitly prevent preemption and thr= ead >> >> >> =C2=A0 migration thus scheduler pinning may be necessary in some h= andlers. >> >> >> =C2=A0 Fix that. >> >> > >> >> > How the preemption is supposed to happen ? Aside from the explicit >> >> > calls to mi_switch() from e.g. critical_exit(). >> >> >> >> IIRC it should be hardclock() willing to schedule the softclock(). It >> >> is the critical_exit() in the thread_unlock() that may trigger it >> >> (sorry for not digging more, it was a while back that I hacked this >> >> part, but I guess you can verify on your own). >> >> We already have other points within the kernel that take care of >> >> dealing with preemption/migration like lapic_handle_timer(), for >> >> example. >> > >> > Right, and if the interrupts are indeed disabled, I do not see how >> > the preemption may be triggered in the fragments like >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0cpu =3D PCPU_GET(cpuid); >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0cpumask =3D PCPU_GET(cpumask); >> >> I don't recall all the details and I have no time to dig now. However, >> also spinlock_enter() does disable explicitly preemption via >> critical_enter() after have disabled the interrupts. >> Let me CC jhb as he implemented spinlock_enter() and may have a clue >> about how preemption can happen with interrupts disabled. > > spinlock_enter() disables preemption to handle the recursive > calls to spinlock_enter/leave, I think, to prevent switch on > leave. No. Please look at how spinlock_enter() is implemented in ia32/amd64 in order to see how it does handle recursion. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 17:10:03 2010 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 5B7691065673; Wed, 11 Aug 2010 17:10:03 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 96B678FC20; Wed, 11 Aug 2010 17:10:02 +0000 (UTC) Received: by qyk11 with SMTP id 11so5267305qyk.13 for ; Wed, 11 Aug 2010 10:10:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=/0/B3cHGtp1l6u1b0f0RQjG02ztkJkoStbcSXP9AR6E=; b=iR133J7TyGascRVd+rEWCNJgVFo07p6T1FACJ357Teu7DMyv/azMqkHQgBRb/XqZr8 b0hR5ZIviYtWH9EIv5VBzGRoSUFALRkDiwNiebfvj9T6yR4FOnEVVZBVT0V3SQOQ3EQy RqaH2P0jc1gH92azTrNb2OTIEKnrgwOE339QA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=fTTZleHIE5MQacD9Q3VPNrmS1OCpAzyuuIokDuVZ7UpFoIOmCzApzUPihe/2Or/RoY ejTy6TyjhidjIL/Oa1yBDt7B6jtH+VpnLLi3UDI/1fDXUw90qok7XBLZ5LOfFTXN7lKi uhjPr9yErEIU57ahpy/H4FtfuyXo4hIlGnZII= MIME-Version: 1.0 Received: by 10.224.87.139 with SMTP id w11mr10858685qal.358.1281546601115; Wed, 11 Aug 2010 10:10:01 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.251.6 with HTTP; Wed, 11 Aug 2010 10:10:00 -0700 (PDT) In-Reply-To: References: <201008111051.o7BApRp4028538@svn.freebsd.org> <20100811105739.GJ2396@deviant.kiev.zoral.com.ua> <20100811123430.GK2396@deviant.kiev.zoral.com.ua> <20100811144646.GL2396@deviant.kiev.zoral.com.ua> Date: Wed, 11 Aug 2010 19:10:00 +0200 X-Google-Sender-Auth: rondmOG4NZe9QkwLpgj-ydcEwQ0 Message-ID: From: Attilio Rao To: Kostik Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Jeff Roberson , John Baldwin Subject: Re: svn commit: r211176 - 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, 11 Aug 2010 17:10:03 -0000 2010/8/11 Attilio Rao : > 2010/8/11 Kostik Belousov : >> On Wed, Aug 11, 2010 at 04:29:21PM +0200, Attilio Rao wrote: >>> 2010/8/11 Kostik Belousov : >>> > On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote: >>> >> 2010/8/11 Kostik Belousov : >>> >> > On Wed, Aug 11, 2010 at 10:51:27AM +0000, Attilio Rao wrote: >>> >> >> Author: attilio >>> >> >> Date: Wed Aug 11 10:51:27 2010 >>> >> >> New Revision: 211176 >>> >> >> URL: http://svn.freebsd.org/changeset/base/211176 >>> >> >> >>> >> >> Log: >>> >> >> =C2=A0 IPI handlers may run generally with interrupts disabled be= cause they >>> >> >> =C2=A0 are served via an interrupt gate. >>> >> >> >>> >> >> =C2=A0 However, that doesn't explicitly prevent preemption and th= read >>> >> >> =C2=A0 migration thus scheduler pinning may be necessary in some = handlers. >>> >> >> =C2=A0 Fix that. >>> >> > >>> >> > How the preemption is supposed to happen ? Aside from the explicit >>> >> > calls to mi_switch() from e.g. critical_exit(). >>> >> >>> >> IIRC it should be hardclock() willing to schedule the softclock(). I= t >>> >> is the critical_exit() in the thread_unlock() that may trigger it >>> >> (sorry for not digging more, it was a while back that I hacked this >>> >> part, but I guess you can verify on your own). >>> >> We already have other points within the kernel that take care of >>> >> dealing with preemption/migration like lapic_handle_timer(), for >>> >> example. >>> > >>> > Right, and if the interrupts are indeed disabled, I do not see how >>> > the preemption may be triggered in the fragments like >>> > =C2=A0 =C2=A0 =C2=A0 =C2=A0cpu =3D PCPU_GET(cpuid); >>> > =C2=A0 =C2=A0 =C2=A0 =C2=A0cpumask =3D PCPU_GET(cpumask); >>> >>> I don't recall all the details and I have no time to dig now. However, >>> also spinlock_enter() does disable explicitly preemption via >>> critical_enter() after have disabled the interrupts. >>> Let me CC jhb as he implemented spinlock_enter() and may have a clue >>> about how preemption can happen with interrupts disabled. >> >> spinlock_enter() disables preemption to handle the recursive >> calls to spinlock_enter/leave, I think, to prevent switch on >> leave. > > No. > Please look at how spinlock_enter() is implemented in ia32/amd64 in > order to see how it does handle recursion. And besides we have other patterns running with interrupts disabled taking care of preemption as well (I think I already pointed to one, I think you could find others easilly). Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 17:14:09 2010 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 377DF1065674; Wed, 11 Aug 2010 17:14:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 095118FC19; Wed, 11 Aug 2010 17:14:09 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id B43FB46B32; Wed, 11 Aug 2010 13:14:08 -0400 (EDT) Received: from John-Baldwins-Macbook-Pro.local (75-48-78-116.lightspeed.cncrca.sbcglobal.net [75.48.78.116]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 5E8BF8A03C; Wed, 11 Aug 2010 13:14:07 -0400 (EDT) Message-ID: <4C62DA5E.9080501@FreeBSD.org> Date: Wed, 11 Aug 2010 13:14:06 -0400 From: John Baldwin User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: Attilio Rao References: <201008101614.o7AGEBSJ069341@svn.freebsd.org> In-Reply-To: <201008101614.o7AGEBSJ069341@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 11 Aug 2010 13:14:07 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=BAYES_00,RDNS_DYNAMIC autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211149 - 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, 11 Aug 2010 17:14:09 -0000 Attilio Rao wrote: > Author: attilio > Date: Tue Aug 10 16:14:10 2010 > New Revision: 211149 > URL: http://svn.freebsd.org/changeset/base/211149 > > Log: > Fix some places that may use cpumask_t while they still use 'int' types. > While there, also fix some places assuming cpu type is 'int' while > u_int is really meant. > > Note: this will also fix some possible races in per-cpu data accessings > to be addressed in further commits. > > In collabouration with: Yahoo! Incorporated (via sbruno and peter) > Tested by: gianni > MFC after: 1 month Ugh, I have a much larger patch for all architectures in p4 that I was doing universe builds on yesterday that this conflicts with. I will commit my other patch shortly. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 17:16:17 2010 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 D56DB1065680; Wed, 11 Aug 2010 17:16:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id A7B388FC16; Wed, 11 Aug 2010 17:16:17 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 5A79146B4C; Wed, 11 Aug 2010 13:16:17 -0400 (EDT) Received: from John-Baldwins-Macbook-Pro.local (75-48-78-116.lightspeed.cncrca.sbcglobal.net [75.48.78.116]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E9D588A03C; Wed, 11 Aug 2010 13:16:15 -0400 (EDT) Message-ID: <4C62DADF.1000202@FreeBSD.org> Date: Wed, 11 Aug 2010 13:16:15 -0400 From: John Baldwin User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: Attilio Rao References: <201008111051.o7BApRp4028538@svn.freebsd.org> In-Reply-To: <201008111051.o7BApRp4028538@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 11 Aug 2010 13:16:16 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=BAYES_00,RDNS_DYNAMIC autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211176 - 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, 11 Aug 2010 17:16:17 -0000 Attilio Rao wrote: > Author: attilio > Date: Wed Aug 11 10:51:27 2010 > New Revision: 211176 > URL: http://svn.freebsd.org/changeset/base/211176 > > Log: > IPI handlers may run generally with interrupts disabled because they > are served via an interrupt gate. > > However, that doesn't explicitly prevent preemption and thread > migration thus scheduler pinning may be necessary in some handlers. > Fix that. > > Tested by: gianni > MFC after: 1 month Actually that does prevent preemption if you do not call any code that would schedule a thread. I think this change is all safe to revert. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 17:25:14 2010 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 A979B106564A; Wed, 11 Aug 2010 17:25:14 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CA3F8FC0C; Wed, 11 Aug 2010 17:25:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BHPEe7021299; Wed, 11 Aug 2010 17:25:14 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BHPEmN021296; Wed, 11 Aug 2010 17:25:14 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201008111725.o7BHPEmN021296@svn.freebsd.org> From: Matt Jacob Date: Wed, 11 Aug 2010 17:25: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: r211183 - in head/tools/tools/vhba: . mptest 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, 11 Aug 2010 17:25:14 -0000 Author: mjacob Date: Wed Aug 11 17:25:14 2010 New Revision: 211183 URL: http://svn.freebsd.org/changeset/base/211183 Log: Consistently set us to be SPC3 for our inquiry data. For mptest, add delays to I/O that simulate real disks better. This also allows us to simulate what happens when a device goes away with active transactions. It's pretty spectacular. Sponsored by: Panasas MFC after: 1 month Modified: head/tools/tools/vhba/mptest/vhba_mptest.c head/tools/tools/vhba/vhba.c Modified: head/tools/tools/vhba/mptest/vhba_mptest.c ============================================================================== --- head/tools/tools/vhba/mptest/vhba_mptest.c Wed Aug 11 16:56:38 2010 (r211182) +++ head/tools/tools/vhba/mptest/vhba_mptest.c Wed Aug 11 17:25:14 2010 (r211183) @@ -31,6 +31,17 @@ #include "vhba.h" #include +static int vhba_stop_lun; +static int vhba_start_lun = 0; +static int vhba_notify_stop = 1; +static int vhba_notify_start = 1; +static int vhba_inject_hwerr = 0; +SYSCTL_INT(_debug, OID_AUTO, vhba_stop_lun, CTLFLAG_RW, &vhba_stop_lun, 0, "stop lun bitmap"); +SYSCTL_INT(_debug, OID_AUTO, vhba_start_lun, CTLFLAG_RW, &vhba_start_lun, 0, "start lun bitmap"); +SYSCTL_INT(_debug, OID_AUTO, vhba_notify_stop, CTLFLAG_RW, &vhba_notify_stop, 1, "notify when luns go away"); +SYSCTL_INT(_debug, OID_AUTO, vhba_notify_start, CTLFLAG_RW, &vhba_notify_start, 1, "notify when luns arrive"); +SYSCTL_INT(_debug, OID_AUTO, vhba_inject_hwerr, CTLFLAG_RW, &vhba_inject_hwerr, 0, "inject hardware error on lost luns"); + #define MAX_TGT 1 #define MAX_LUN 2 #define VMP_TIME hz @@ -49,8 +60,11 @@ typedef struct { int luns[2]; struct callout tick; struct task qt; + TAILQ_HEAD(, ccb_hdr) inproc; + int nact, nact_high; } mptest_t; +static timeout_t vhba_iodelay; static timeout_t vhba_timer; static void vhba_task(void *, int); static void mptest_act(mptest_t *, struct ccb_scsiio *); @@ -59,13 +73,17 @@ void vhba_init(vhba_softc_t *vhba) { static mptest_t vhbastatic; + vhbastatic.vhba = vhba; vhbastatic.disk_size = DISK_SIZE << 20; vhbastatic.disk = malloc(vhbastatic.disk_size, M_DEVBUF, M_WAITOK|M_ZERO); vhba->private = &vhbastatic; callout_init_mtx(&vhbastatic.tick, &vhba->lock, 0); callout_reset(&vhbastatic.tick, VMP_TIME, vhba_timer, vhba); + TAILQ_INIT(&vhbastatic.inproc); TASK_INIT(&vhbastatic.qt, 0, vhba_task, &vhbastatic); + vhbastatic.luns[0] = 1; + vhbastatic.luns[1] = 1; } void @@ -89,15 +107,23 @@ vhba_task(void *arg, int pending) { mptest_t *vhbas = arg; struct ccb_hdr *ccbh; + int nadded = 0; mtx_lock(&vhbas->vhba->lock); while ((ccbh = TAILQ_FIRST(&vhbas->vhba->actv)) != NULL) { TAILQ_REMOVE(&vhbas->vhba->actv, ccbh, sim_links.tqe); mptest_act(vhbas, (struct ccb_scsiio *)ccbh); + nadded++; + ccbh->sim_priv.entries[0].ptr = vhbas; + callout_handle_init(&ccbh->timeout_ch); } - while ((ccbh = TAILQ_FIRST(&vhbas->vhba->done)) != NULL) { - TAILQ_REMOVE(&vhbas->vhba->done, ccbh, sim_links.tqe); - xpt_done((union ccb *)ccbh); + if (nadded) { + vhba_kick(vhbas->vhba); + } else { + while ((ccbh = TAILQ_FIRST(&vhbas->vhba->done)) != NULL) { + TAILQ_REMOVE(&vhbas->vhba->done, ccbh, sim_links.tqe); + xpt_done((union ccb *)ccbh); + } } mtx_unlock(&vhbas->vhba->lock); } @@ -108,10 +134,10 @@ mptest_act(mptest_t *vhbas, struct ccb_s char junk[128]; cam_status camstatus; uint8_t *cdb, *ptr, status; - uint32_t data_len; + uint32_t data_len, blkcmd; uint64_t off; - data_len = 0; + blkcmd = data_len = 0; status = SCSI_STATUS_OK; memset(&csio->sense_data, 0, sizeof (csio->sense_data)); @@ -122,6 +148,11 @@ mptest_act(mptest_t *vhbas, struct ccb_s TAILQ_INSERT_TAIL(&vhbas->vhba->done, &csio->ccb_h, sim_links.tqe); return; } + if (vhba_inject_hwerr && csio->ccb_h.target_lun < MAX_LUN && vhbas->luns[csio->ccb_h.target_lun] == 0) { + vhba_fill_sense(csio, SSD_KEY_HARDWARE_ERROR, 0x44, 0x0); + TAILQ_INSERT_TAIL(&vhbas->vhba->done, &csio->ccb_h, sim_links.tqe); + return; + } if ((csio->ccb_h.target_lun >= MAX_LUN || vhbas->luns[csio->ccb_h.target_lun] == 0) && cdb[0] != INQUIRY && cdb[0] != REPORT_LUNS && cdb[0] != REQUEST_SENSE) { vhba_fill_sense(csio, SSD_KEY_ILLEGAL_REQUEST, 0x25, 0x0); TAILQ_INSERT_TAIL(&vhbas->vhba->done, &csio->ccb_h, sim_links.tqe); @@ -284,6 +315,11 @@ mptest_act(mptest_t *vhbas, struct ccb_s vhba_fill_sense(csio, SSD_KEY_ILLEGAL_REQUEST, 0x24, 0x0); break; } + blkcmd++; + if (++vhbas->nact > vhbas->nact_high) { + vhbas->nact_high = vhbas->nact; + printf("%s: high block count now %d\n", __func__, vhbas->nact); + } if (data_len) { if ((cdb[0] & 0xf) == 8) { memcpy(csio->data_ptr, &vhbas->disk[off], data_len); @@ -339,17 +375,36 @@ mptest_act(mptest_t *vhbas, struct ccb_s camstatus = CAM_REQ_CMP; } vhba_set_status(&csio->ccb_h, camstatus); - TAILQ_INSERT_TAIL(&vhbas->vhba->done, &csio->ccb_h, sim_links.tqe); + if (blkcmd) { + int ticks; + struct timeval t; + + TAILQ_INSERT_TAIL(&vhbas->inproc, &csio->ccb_h, sim_links.tqe); + t.tv_sec = 0; + t.tv_usec = (500 + arc4random()); + if (t.tv_usec > 10000) { + t.tv_usec = 10000; + } + ticks = tvtohz(&t); + csio->ccb_h.timeout_ch = timeout(vhba_iodelay, &csio->ccb_h, ticks); + } else { + TAILQ_INSERT_TAIL(&vhbas->vhba->done, &csio->ccb_h, sim_links.tqe); + } } -static int vhba_stop_lun; -SYSCTL_INT(_debug, OID_AUTO, vhba_stop_lun, CTLFLAG_RW, &vhba_stop_lun, 0, "stop this lun"); -static int vhba_start_lun = 3; -SYSCTL_INT(_debug, OID_AUTO, vhba_start_lun, CTLFLAG_RW, &vhba_start_lun, 3, "start this lun"); -static int vhba_notify_stop = 1; -SYSCTL_INT(_debug, OID_AUTO, vhba_notify_stop, CTLFLAG_RW, &vhba_notify_stop, 1, "notify when luns go away"); -static int vhba_notify_start = 1; -SYSCTL_INT(_debug, OID_AUTO, vhba_notify_start, CTLFLAG_RW, &vhba_notify_start, 1, "notify when luns arrive"); +static void +vhba_iodelay(void *arg) +{ + struct ccb_hdr *ccbh = arg; + mptest_t *vhbas = ccbh->sim_priv.entries[0].ptr; + + mtx_lock(&vhbas->vhba->lock); + TAILQ_REMOVE(&vhbas->inproc, ccbh, sim_links.tqe); + TAILQ_INSERT_TAIL(&vhbas->vhba->done, ccbh, sim_links.tqe); + vhbas->nact -= 1; + vhba_kick(vhbas->vhba); + mtx_unlock(&vhbas->vhba->lock); +} static void vhba_timer(void *arg) Modified: head/tools/tools/vhba/vhba.c ============================================================================== --- head/tools/tools/vhba/vhba.c Wed Aug 11 16:56:38 2010 (r211182) +++ head/tools/tools/vhba/vhba.c Wed Aug 11 17:25:14 2010 (r211183) @@ -106,7 +106,7 @@ vhba_action(struct cam_sim *sim, union c case XPT_GET_TRAN_SETTINGS: cts = &ccb->cts; - cts->protocol_version = SCSI_REV_SPC2; + cts->protocol_version = SCSI_REV_SPC3; cts->protocol = PROTO_SCSI; cts->transport_version = 0; cts->transport = XPORT_PPB; @@ -133,7 +133,7 @@ vhba_action(struct cam_sim *sim, union c cpi->transport = XPORT_PPB; cpi->base_transfer_speed = 1000000; cpi->protocol = PROTO_SCSI; - cpi->protocol_version = SCSI_REV_SPC2; + cpi->protocol_version = SCSI_REV_SPC3; strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strlcpy(cpi->hba_vid, "FakeHBA", HBA_IDLEN); strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); @@ -235,14 +235,14 @@ vhba_default_cmd(struct ccb_scsiio *csio { char junk[128]; const uint8_t niliqd[SHORT_INQUIRY_LENGTH] = { - 0x7f, 0x0, 0x5, 0x2, 32, 0, 0, 0x32, + 0x7f, 0x0, SCSI_REV_SPC3, 0x2, 32, 0, 0, 0x32, 'P', 'A', 'N', 'A', 'S', 'A', 'S', ' ', 'N', 'U', 'L', 'L', ' ', 'D', 'E', 'V', 'I', 'C', 'E', ' ', ' ', ' ', ' ', ' ', '0', '0', '0', '1' }; const uint8_t iqd[SHORT_INQUIRY_LENGTH] = { - 0, 0x0, 0x5, 0x2, 32, 0, 0, 0x32, + 0, 0x0, SCSI_REV_SPC3, 0x2, 32, 0, 0, 0x32, 'P', 'A', 'N', 'A', 'S', 'A', 'S', ' ', 'V', 'I', 'R', 'T', ' ', 'M', 'E', 'M', 'O', 'R', 'Y', ' ', 'D', 'I', 'S', 'K', From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 17:25:48 2010 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 308F1106566C; Wed, 11 Aug 2010 17:25:48 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8CBF88FC1A; Wed, 11 Aug 2010 17:25:47 +0000 (UTC) Received: by qyk32 with SMTP id 32so462945qyk.13 for ; Wed, 11 Aug 2010 10:25:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=XZOe4xF3ieimRsuHfLcgCJh6RzR/e48szAQmbSUiIO8=; b=YHPZjRq8UhSCvoqbVcfu+TizNmTjwrj0LAUIy/855eMB+ir2JWWA5D4rkup+KdrVhD dbo7pH2CIutD9ommzYidz32Z8NhJ5NQiZKE3yOxjcpa5GzsN3czOsENot27rI0xERyLH Q6N6hnzO5DulRe9GmBtIgLigvthAYLBza/vs0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=U5ttJNc++y4zCwXBa8A3UoJMAviIyuAKN0VzUuPfFOFfuwOYVuvglyT7ynzIAN8q8S k1Zg9hu5E4dS+aOZPlMeFbzT8XUM35BNdvHq/EWxoBkeBZEXwHkwt+8uvBj7Fm0qPXPL GC1CjVkXR5vlhlTdxkJJBO7pNoP7eIzLf4Nno= MIME-Version: 1.0 Received: by 10.229.186.4 with SMTP id cq4mr7778944qcb.0.1281547546120; Wed, 11 Aug 2010 10:25:46 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.251.6 with HTTP; Wed, 11 Aug 2010 10:25:45 -0700 (PDT) In-Reply-To: <4C62DADF.1000202@FreeBSD.org> References: <201008111051.o7BApRp4028538@svn.freebsd.org> <4C62DADF.1000202@FreeBSD.org> Date: Wed, 11 Aug 2010 19:25:45 +0200 X-Google-Sender-Auth: 3XX7FNKSuk_aV9AprjT4WqSUO8g Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211176 - 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, 11 Aug 2010 17:25:48 -0000 2010/8/11 John Baldwin : > Attilio Rao wrote: >> >> Author: attilio >> Date: Wed Aug 11 10:51:27 2010 >> New Revision: 211176 >> URL: http://svn.freebsd.org/changeset/base/211176 >> >> Log: >> =C2=A0IPI handlers may run generally with interrupts disabled because th= ey >> =C2=A0are served via an interrupt gate. >> =C2=A0 =C2=A0However, that doesn't explicitly prevent preemption and thr= ead >> =C2=A0migration thus scheduler pinning may be necessary in some handlers= . >> =C2=A0Fix that. >> =C2=A0 =C2=A0Tested by: =C2=A0gianni >> =C2=A0MFC after: =C2=A0 =C2=A01 month > > Actually that does prevent preemption if you do not call any code that wo= uld > schedule a thread. =C2=A0I think this change is all safe to revert. Do you recall, then, why lapic_handle_timer() does critical section? It seems to be catered by interrupt gate as well, and I don't see any point re-enabling them explicitly. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 17:27:18 2010 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 BD5391065670; Wed, 11 Aug 2010 17:27:18 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 2AAEB8FC12; Wed, 11 Aug 2010 17:27:17 +0000 (UTC) Received: by qyk11 with SMTP id 11so5288596qyk.13 for ; Wed, 11 Aug 2010 10:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=fIjd0inewlHYWtjwKApTNUAVrBmarGdI+hBzj+6EcR0=; b=OKXe4k/1yjkTCbO3neFDJKOfadrNNT+8E9wq8K0hDzzQ/MhiX+Sc7prmphElT4k8MX sdmSQ4xDumf4QRhdc7tWyIMWUuinwjdiSrT+I5T1wprzN4/78Mpze8Oq4xeN0IHOMwrq s8NlwERxqnMm7GYtpubYgodqRvkQK3WzQ76RU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=nuWsaZ0AR7aUGtpZ5j0kBeFMHj5gHQV8Xm466gWn+VBNuX2w4CMB9Gp1lOJoIPRm1f FnguOTW8Zc2xtgWru9dZCHPNwW3218x3+ol9qza6HjaoSXUA13KsZC8JY1xCncYmSL4u WoYSC3TzNMAqtMW/wOGbLa9pXN1FREoZVKBkk= MIME-Version: 1.0 Received: by 10.229.224.76 with SMTP id in12mr9986450qcb.81.1281547637234; Wed, 11 Aug 2010 10:27:17 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.251.6 with HTTP; Wed, 11 Aug 2010 10:27:17 -0700 (PDT) In-Reply-To: <4C62DA5E.9080501@FreeBSD.org> References: <201008101614.o7AGEBSJ069341@svn.freebsd.org> <4C62DA5E.9080501@FreeBSD.org> Date: Wed, 11 Aug 2010 19:27:17 +0200 X-Google-Sender-Auth: W6iwZXY--e6-QQDYnVHoO1KOoqM Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211149 - 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, 11 Aug 2010 17:27:18 -0000 2010/8/11 John Baldwin : > Attilio Rao wrote: >> >> Author: attilio >> Date: Tue Aug 10 16:14:10 2010 >> New Revision: 211149 >> URL: http://svn.freebsd.org/changeset/base/211149 >> >> Log: >> =C2=A0Fix some places that may use cpumask_t while they still use 'int' = types. >> =C2=A0While there, also fix some places assuming cpu type is 'int' while >> =C2=A0u_int is really meant. >> =C2=A0 =C2=A0Note: this will also fix some possible races in per-cpu dat= a accessings >> =C2=A0to be addressed in further commits. >> =C2=A0 =C2=A0In collabouration with: =C2=A0 =C2=A0 Yahoo! Incorporated (= via sbruno and peter) >> =C2=A0Tested by: =C2=A0 =C2=A0gianni >> =C2=A0MFC after: =C2=A0 =C2=A01 month > > Ugh, I have a much larger patch for all architectures in p4 that I was do= ing > universe builds on yesterday that this conflicts with. =C2=A0I will commi= t my > other patch shortly. Sorry, was unaware of that. Let me know if you need assistance/have questions. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 17:33:27 2010 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 493821065672; Wed, 11 Aug 2010 17:33:27 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37D4B8FC0C; Wed, 11 Aug 2010 17:33:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BHXROb023149; Wed, 11 Aug 2010 17:33:27 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BHXRcf023143; Wed, 11 Aug 2010 17:33:27 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201008111733.o7BHXRcf023143@svn.freebsd.org> From: Rui Paulo Date: Wed, 11 Aug 2010 17:33: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: r211184 - head/lib/libproc 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, 11 Aug 2010 17:33:27 -0000 Author: rpaulo Date: Wed Aug 11 17:33:26 2010 New Revision: 211184 URL: http://svn.freebsd.org/changeset/base/211184 Log: Several fixes for libproc: o return the correct status in proc_wstatus() o proc_read takes a void * o correctly allocate the objs structure array Sponsored by: The FreeBSD Foundation Modified: head/lib/libproc/libproc.h head/lib/libproc/proc_bkpt.c head/lib/libproc/proc_rtld.c head/lib/libproc/proc_sym.c head/lib/libproc/proc_util.c Modified: head/lib/libproc/libproc.h ============================================================================== --- head/lib/libproc/libproc.h Wed Aug 11 17:25:14 2010 (r211183) +++ head/lib/libproc/libproc.h Wed Aug 11 17:33:26 2010 (r211184) @@ -131,7 +131,7 @@ pid_t proc_getpid(struct proc_handle *); int proc_wstatus(struct proc_handle *); int proc_getwstat(struct proc_handle *); char * proc_signame(int, char *, size_t); -int proc_read(struct proc_handle *, char *, size_t, size_t); +int proc_read(struct proc_handle *, void *, size_t, size_t); const lwpstatus_t * proc_getlwpstatus(struct proc_handle *); void proc_free(struct proc_handle *); Modified: head/lib/libproc/proc_bkpt.c ============================================================================== --- head/lib/libproc/proc_bkpt.c Wed Aug 11 17:25:14 2010 (r211183) +++ head/lib/libproc/proc_bkpt.c Wed Aug 11 17:33:26 2010 (r211184) @@ -164,7 +164,8 @@ proc_bkptexec(struct proc_handle *phdl, warn("ERROR: ptrace step failed"); return (-1); } - status = proc_wstatus(phdl); + proc_wstatus(phdl); + status = proc_getwstat(phdl); if (!WIFSTOPPED(status)) { warn("ERROR: don't know why process stopped"); return (-1); Modified: head/lib/libproc/proc_rtld.c ============================================================================== --- head/lib/libproc/proc_rtld.c Wed Aug 11 17:25:14 2010 (r211183) +++ head/lib/libproc/proc_rtld.c Wed Aug 11 17:33:26 2010 (r211184) @@ -42,14 +42,13 @@ map_iter(const rd_loadobj_t *lop, void * { struct proc_handle *phdl = arg; - phdl->nobjs++; if (phdl->nobjs >= phdl->rdobjsz) { phdl->rdobjsz *= 2; phdl->rdobjs = realloc(phdl->rdobjs, phdl->rdobjsz); if (phdl->rdobjs == NULL) return (-1); } - memcpy(&phdl->rdobjs[phdl->nobjs++], lop, sizeof(*phdl->rdobjs)); + memcpy(&phdl->rdobjs[phdl->nobjs++], lop, sizeof(*lop)); return (0); } @@ -61,6 +60,7 @@ proc_rdagent(struct proc_handle *phdl) phdl->status != PS_IDLE) { if ((phdl->rdap = rd_new(phdl)) != NULL) { phdl->rdobjs = malloc(sizeof(*phdl->rdobjs) * 64); + phdl->rdobjsz = 64; if (phdl->rdobjs == NULL) return (phdl->rdap); rd_loadobj_iter(phdl->rdap, map_iter, phdl); @@ -73,7 +73,8 @@ proc_rdagent(struct proc_handle *phdl) void proc_updatesyms(struct proc_handle *phdl) { - memset(&phdl->rdobjs, 0, sizeof(*phdl->rdobjs) * phdl->rdobjsz); + + memset(phdl->rdobjs, 0, sizeof(*phdl->rdobjs) * phdl->rdobjsz); phdl->nobjs = 0; rd_loadobj_iter(phdl->rdap, map_iter, phdl); } Modified: head/lib/libproc/proc_sym.c ============================================================================== --- head/lib/libproc/proc_sym.c Wed Aug 11 17:25:14 2010 (r211183) +++ head/lib/libproc/proc_sym.c Wed Aug 11 17:33:26 2010 (r211184) @@ -110,14 +110,25 @@ proc_iter_objs(struct proc_handle *p, pr rd_loadobj_t *rdl; prmap_t map; char path[MAXPATHLEN]; + char last[MAXPATHLEN]; if (p->nobjs == 0) return (-1); + memset(last, 0, sizeof(last)); for (i = 0; i < p->nobjs; i++) { rdl = &p->rdobjs[i]; proc_rdl2prmap(rdl, &map); basename_r(rdl->rdl_path, path); + /* + * We shouldn't call the callback twice with the same object. + * To do that we are assuming the fact that if there are + * repeated object names (i.e. different mappings for the + * same object) they occur next to each other. + */ + if (strcmp(path, last) == 0) + continue; (*func)(cd, &map, path); + strlcpy(last, path, sizeof(last)); } return (0); Modified: head/lib/libproc/proc_util.c ============================================================================== --- head/lib/libproc/proc_util.c Wed Aug 11 17:25:14 2010 (r211183) +++ head/lib/libproc/proc_util.c Wed Aug 11 17:33:26 2010 (r211184) @@ -144,15 +144,17 @@ proc_wstatus(struct proc_handle *phdl) if (phdl == NULL) return (-1); - if (waitpid(phdl->pid, &status, WUNTRACED) < 0) + if (waitpid(phdl->pid, &status, WUNTRACED) < 0) { + warn("waitpid"); return (-1); + } if (WIFSTOPPED(status)) phdl->status = PS_STOP; if (WIFEXITED(status) || WIFSIGNALED(status)) phdl->status = PS_UNDEAD; phdl->wstat = status; - return (status); + return (phdl->status); } int @@ -175,7 +177,7 @@ proc_signame(int sig, char *name, size_t } int -proc_read(struct proc_handle *phdl, char *buf, size_t size, size_t addr) +proc_read(struct proc_handle *phdl, void *buf, size_t size, size_t addr) { struct ptrace_io_desc piod; @@ -200,7 +202,8 @@ proc_getlwpstatus(struct proc_handle *ph if (phdl == NULL) return (NULL); - if (ptrace(PT_LWPINFO, phdl->pid, (caddr_t)&lwpinfo,sizeof(lwpinfo)) < 0) + if (ptrace(PT_LWPINFO, phdl->pid, (caddr_t)&lwpinfo, + sizeof(lwpinfo)) < 0) return (NULL); siginfo = &lwpinfo.pl_siginfo; if (lwpinfo.pl_event == PL_EVENT_SIGNAL && From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 17:33:34 2010 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 F04A11065769; Wed, 11 Aug 2010 17:33:33 +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 0BB7C8FC15; Wed, 11 Aug 2010 17:33:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BHXWlA023217; Wed, 11 Aug 2010 17:33:32 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BHXWLn023215; Wed, 11 Aug 2010 17:33:32 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008111733.o7BHXWLn023215@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 11 Aug 2010 17:33: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: r211185 - head/tools/regression/fstest/tests 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, 11 Aug 2010 17:33:34 -0000 Author: pjd Date: Wed Aug 11 17:33:32 2010 New Revision: 211185 URL: http://svn.freebsd.org/changeset/base/211185 Log: Allow to specify uid, gid and mode for create_file(). Modified: head/tools/regression/fstest/tests/misc.sh Modified: head/tools/regression/fstest/tests/misc.sh ============================================================================== --- head/tools/regression/fstest/tests/misc.sh Wed Aug 11 17:33:26 2010 (r211184) +++ head/tools/regression/fstest/tests/misc.sh Wed Aug 11 17:33:32 2010 (r211185) @@ -175,11 +175,14 @@ require() quick_exit } +# usage: +# create_file +# create_file +# create_file +# create_file create_file() { type="${1}" name="${2}" - uid="${3}" - gid="${4}" case "${type}" in none) @@ -207,5 +210,12 @@ create_file() { expect 0 symlink test ${name} ;; esac - expect 0 lchown ${name} ${uid} ${gid} + if [ -n "${3}" -a -n "${4}" -a -n "${5}" ]; then + expect 0 lchmod ${name} ${3} + expect 0 lchown ${name} ${4} ${5} + elif [ -n "${3}" -a -n "${4}" ]; then + expect 0 lchown ${name} ${3} ${4} + elif [ -n "${3}" ]; then + expect 0 lchmod ${name} ${3} + fi } From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 17:34:59 2010 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 1078C1065678; Wed, 11 Aug 2010 17:34: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 F205D8FC1D; Wed, 11 Aug 2010 17:34:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BHYwIZ023572; Wed, 11 Aug 2010 17:34:58 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BHYwA0023551; Wed, 11 Aug 2010 17:34:58 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008111734.o7BHYwA0023551@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 11 Aug 2010 17:34: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: r211186 - in head/tools/regression/fstest/tests: chflags link mkdir open rename 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, 11 Aug 2010 17:34:59 -0000 Author: pjd Date: Wed Aug 11 17:34:58 2010 New Revision: 211186 URL: http://svn.freebsd.org/changeset/base/211186 Log: - Use loops where possible to avoid code duplication. - Don't pass uid and gid to create_file() if not needed. - More tests. Modified: head/tools/regression/fstest/tests/chflags/00.t head/tools/regression/fstest/tests/chflags/10.t head/tools/regression/fstest/tests/chflags/11.t head/tools/regression/fstest/tests/link/00.t head/tools/regression/fstest/tests/mkdir/10.t head/tools/regression/fstest/tests/open/22.t head/tools/regression/fstest/tests/rename/00.t head/tools/regression/fstest/tests/rename/06.t head/tools/regression/fstest/tests/rename/07.t head/tools/regression/fstest/tests/rename/08.t head/tools/regression/fstest/tests/rename/13.t head/tools/regression/fstest/tests/rename/14.t head/tools/regression/fstest/tests/rename/15.t head/tools/regression/fstest/tests/rename/20.t Modified: head/tools/regression/fstest/tests/chflags/00.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/00.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/chflags/00.t Wed Aug 11 17:34:58 2010 (r211186) @@ -14,14 +14,14 @@ FreeBSD:UFS) userflags="UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE" systemflags="SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" - echo "1..780" + echo "1..742" ;; FreeBSD:ZFS) allflags="UF_NODUMP,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" userflags="UF_NODUMP" systemflags="SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" - echo "1..520" + echo "1..482" ;; *) quick_exit @@ -37,7 +37,7 @@ cdir=`pwd` cd ${n2} for type in regular dir fifo block char socket; do - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} expect none stat ${n0} flags expect 0 chflags ${n0} ${allflags} expect ${allflags} stat ${n0} flags @@ -53,7 +53,7 @@ for type in regular dir fifo block char expect 0 unlink ${n0} fi - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} expect none stat ${n0} flags expect 0 lchflags ${n0} ${allflags} expect ${allflags} stat ${n0} flags @@ -111,7 +111,7 @@ expect 0 unlink ${n0} # successful chflags(2) updates ctime. for type in regular dir fifo block char socket symlink; do if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} stat ${n0} ctime` sleep 1 @@ -126,7 +126,7 @@ for type in regular dir fifo block char fi fi - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} lstat ${n0} ctime` sleep 1 @@ -144,7 +144,7 @@ done # unsuccessful chflags(2) does not update ctime. for type in regular dir fifo block char socket symlink; do if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} stat ${n0} ctime` sleep 1 @@ -159,7 +159,7 @@ for type in regular dir fifo block char fi fi - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} lstat ${n0} ctime` sleep 1 Modified: head/tools/regression/fstest/tests/chflags/10.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/10.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/chflags/10.t Wed Aug 11 17:34:58 2010 (r211186) @@ -8,7 +8,7 @@ dir=`dirname $0` require chflags -echo "1..210" +echo "1..197" n0=`namegen` n1=`namegen` @@ -20,7 +20,7 @@ cd ${n0} for type in regular dir fifo block char socket symlink; do if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} 0 0 + create_file ${type} ${n1} expect 0 chown ${n1} 65534 65534 for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag} @@ -35,7 +35,7 @@ for type in regular dir fifo block char fi fi - create_file ${type} ${n1} 0 0 + create_file ${type} ${n1} expect 0 lchown ${n1} 65534 65534 for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do expect EPERM -u 65533 -g 65533 lchflags ${n1} ${flag} Modified: head/tools/regression/fstest/tests/chflags/11.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/11.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/chflags/11.t Wed Aug 11 17:34:58 2010 (r211186) @@ -8,7 +8,7 @@ dir=`dirname $0` require chflags_SF_SNAPSHOT -echo "1..158" +echo "1..145" n0=`namegen` n1=`namegen` @@ -20,7 +20,7 @@ cd ${n0} for type in regular dir fifo block char socket symlink; do if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} 0 0 + create_file ${type} ${n1} expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT expect none stat ${n1} flags expect EPERM chflags ${n1} SF_SNAPSHOT @@ -37,7 +37,7 @@ for type in regular dir fifo block char fi fi - create_file ${type} ${n1} 0 0 + create_file ${type} ${n1} expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT expect none lstat ${n1} flags expect EPERM lchflags ${n1} SF_SNAPSHOT Modified: head/tools/regression/fstest/tests/link/00.t ============================================================================== --- head/tools/regression/fstest/tests/link/00.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/link/00.t Wed Aug 11 17:34:58 2010 (r211186) @@ -6,7 +6,7 @@ desc="link creates hardlinks" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..217" +echo "1..202" n0=`namegen` n1=`namegen` @@ -18,7 +18,7 @@ cdir=`pwd` cd ${n3} for type in regular fifo block char socket; do - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} expect ${type},1 lstat ${n0} type,nlink expect 0 link ${n0} ${n1} @@ -55,7 +55,7 @@ done # successful link(2) updates ctime. for type in regular fifo block char socket; do - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} ctime1=`${fstest} stat ${n0} ctime` dctime1=`${fstest} stat . ctime` dmtime1=`${fstest} stat . mtime` @@ -73,7 +73,7 @@ done # unsuccessful link(2) does not update ctime. for type in regular fifo block char socket; do - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} expect 0 -- chown ${n0} 65534 -1 ctime1=`${fstest} stat ${n0} ctime` dctime1=`${fstest} stat . ctime` Modified: head/tools/regression/fstest/tests/mkdir/10.t ============================================================================== --- head/tools/regression/fstest/tests/mkdir/10.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/mkdir/10.t Wed Aug 11 17:34:58 2010 (r211186) @@ -10,30 +10,12 @@ echo "1..21" n0=`namegen` -expect 0 mkdir ${n0} 0755 -expect EEXIST mkdir ${n0} 0755 -expect 0 rmdir ${n0} - -expect 0 create ${n0} 0644 -expect EEXIST mkdir ${n0} 0755 -expect 0 unlink ${n0} - -expect 0 symlink test ${n0} -expect EEXIST mkdir ${n0} 0755 -expect 0 unlink ${n0} - -expect 0 mkfifo ${n0} 0644 -expect EEXIST mkdir ${n0} 0755 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} b 0644 1 2 -expect EEXIST mkdir ${n0} 0755 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} c 0644 1 2 -expect EEXIST mkdir ${n0} 0755 -expect 0 unlink ${n0} - -expect 0 bind ${n0} -expect EEXIST mkdir ${n0} 0755 -expect 0 unlink ${n0} +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n0} + expect EEXIST mkdir ${n0} 0755 + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi +done Modified: head/tools/regression/fstest/tests/open/22.t ============================================================================== --- head/tools/regression/fstest/tests/open/22.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/open/22.t Wed Aug 11 17:34:58 2010 (r211186) @@ -10,30 +10,12 @@ echo "1..21" n0=`namegen` -expect 0 create ${n0} 0644 -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 unlink ${n0} - -expect 0 mkdir ${n0} 0755 -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 rmdir ${n0} - -expect 0 mkfifo ${n0} 0644 -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 unlink ${n0} - -expect 0 symlink test ${n0} -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} b 0644 1 2 -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} c 0644 1 2 -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 unlink ${n0} - -expect 0 bind ${n0} -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 unlink ${n0} +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n0} + expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi +done Modified: head/tools/regression/fstest/tests/rename/00.t ============================================================================== --- head/tools/regression/fstest/tests/rename/00.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/rename/00.t Wed Aug 11 17:34:58 2010 (r211186) @@ -6,7 +6,7 @@ desc="rename changes file name" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..145" +echo "1..150" n0=`namegen` n1=`namegen` @@ -17,21 +17,23 @@ expect 0 mkdir ${n3} 0755 cdir=`pwd` cd ${n3} -expect 0 create ${n0} 0644 -expect regular,0644,1 lstat ${n0} type,mode,nlink -inode=`${fstest} lstat ${n0} inode` -expect 0 rename ${n0} ${n1} -expect ENOENT lstat ${n0} type,mode,nlink -expect regular,${inode},0644,1 lstat ${n1} type,inode,mode,nlink -expect 0 link ${n1} ${n0} -expect regular,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect regular,${inode},0644,2 lstat ${n1} type,inode,mode,nlink -expect 0 rename ${n1} ${n2} -expect regular,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect ENOENT lstat ${n1} type,mode,nlink -expect regular,${inode},0644,2 lstat ${n2} type,inode,mode,nlink -expect 0 unlink ${n0} -expect 0 unlink ${n2} +for type in regular fifo block char socket; do + create_file ${type} ${n0} 0644 + expect ${type},0644,1 lstat ${n0} type,mode,nlink + inode=`${fstest} lstat ${n0} inode` + expect 0 rename ${n0} ${n1} + expect ENOENT lstat ${n0} type,mode,nlink + expect ${type},${inode},0644,1 lstat ${n1} type,inode,mode,nlink + expect 0 link ${n1} ${n0} + expect ${type},${inode},0644,2 lstat ${n0} type,inode,mode,nlink + expect ${type},${inode},0644,2 lstat ${n1} type,inode,mode,nlink + expect 0 rename ${n1} ${n2} + expect ${type},${inode},0644,2 lstat ${n0} type,inode,mode,nlink + expect ENOENT lstat ${n1} type,mode,nlink + expect ${type},${inode},0644,2 lstat ${n2} type,inode,mode,nlink + expect 0 unlink ${n0} + expect 0 unlink ${n2} +done expect 0 mkdir ${n0} 0755 expect dir,0755 lstat ${n0} type,mode @@ -41,70 +43,6 @@ expect ENOENT lstat ${n0} type,mode expect dir,${inode},0755 lstat ${n1} type,inode,mode expect 0 rmdir ${n1} -expect 0 mkfifo ${n0} 0644 -expect fifo,0644,1 lstat ${n0} type,mode,nlink -inode=`${fstest} lstat ${n0} inode` -expect 0 rename ${n0} ${n1} -expect ENOENT lstat ${n0} type,mode,nlink -expect fifo,${inode},0644,1 lstat ${n1} type,inode,mode,nlink -expect 0 link ${n1} ${n0} -expect fifo,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect fifo,${inode},0644,2 lstat ${n1} type,inode,mode,nlink -expect 0 rename ${n1} ${n2} -expect fifo,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect ENOENT lstat ${n1} type,mode,nlink -expect fifo,${inode},0644,2 lstat ${n2} type,inode,mode,nlink -expect 0 unlink ${n0} -expect 0 unlink ${n2} - -expect 0 mknod ${n0} b 0644 1 2 -expect block,0644,1 lstat ${n0} type,mode,nlink -inode=`${fstest} lstat ${n0} inode` -expect 0 rename ${n0} ${n1} -expect ENOENT lstat ${n0} type,mode,nlink -expect block,${inode},0644,1 lstat ${n1} type,inode,mode,nlink -expect 0 link ${n1} ${n0} -expect block,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect block,${inode},0644,2 lstat ${n1} type,inode,mode,nlink -expect 0 rename ${n1} ${n2} -expect block,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect ENOENT lstat ${n1} type,mode,nlink -expect block,${inode},0644,2 lstat ${n2} type,inode,mode,nlink -expect 0 unlink ${n0} -expect 0 unlink ${n2} - -expect 0 mknod ${n0} c 0644 1 2 -expect char,0644,1 lstat ${n0} type,mode,nlink -inode=`${fstest} lstat ${n0} inode` -expect 0 rename ${n0} ${n1} -expect ENOENT lstat ${n0} type,mode,nlink -expect char,${inode},0644,1 lstat ${n1} type,inode,mode,nlink -expect 0 link ${n1} ${n0} -expect char,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect char,${inode},0644,2 lstat ${n1} type,inode,mode,nlink -expect 0 rename ${n1} ${n2} -expect char,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect ENOENT lstat ${n1} type,mode,nlink -expect char,${inode},0644,2 lstat ${n2} type,inode,mode,nlink -expect 0 unlink ${n0} -expect 0 unlink ${n2} - -expect 0 -U 0133 bind ${n0} -expect socket,0644,1 lstat ${n0} type,mode,nlink -inode=`${fstest} lstat ${n0} inode` -expect 0 rename ${n0} ${n1} -expect ENOENT lstat ${n0} type,mode,nlink -expect socket,${inode},0644,1 lstat ${n1} type,inode,mode,nlink -expect 0 link ${n1} ${n0} -expect socket,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect socket,${inode},0644,2 lstat ${n1} type,inode,mode,nlink -expect 0 rename ${n1} ${n2} -expect socket,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect ENOENT lstat ${n1} type,mode,nlink -expect socket,${inode},0644,2 lstat ${n2} type,inode,mode,nlink -expect 0 unlink ${n0} -expect 0 unlink ${n2} - expect 0 create ${n0} 0644 rinode=`${fstest} lstat ${n0} inode` expect regular,0644 lstat ${n0} type,mode @@ -120,118 +58,34 @@ expect 0 unlink ${n0} expect 0 unlink ${n2} # successful rename(2) updates ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n1} - -expect 0 mkdir ${n0} 0755 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 rmdir ${n1} - -expect 0 mkfifo ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n1} - -expect 0 mknod ${n0} b 0644 1 2 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n1} - -expect 0 mknod ${n0} c 0644 1 2 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n1} - -expect 0 bind ${n0} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n1} - -expect 0 symlink ${n2} ${n0} -ctime1=`${fstest} lstat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} lstat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n1} +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n0} + ctime1=`${fstest} lstat ${n0} ctime` + sleep 1 + expect 0 rename ${n0} ${n1} + ctime2=`${fstest} lstat ${n1} ctime` + test_check $ctime1 -lt $ctime2 + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi +done # unsuccessful link(2) does not update ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 mkdir ${n0} 0755 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 rmdir ${n0} - -expect 0 mkfifo ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} b 0644 1 2 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} c 0644 1 2 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 bind ${n0} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 symlink ${n2} ${n0} -ctime1=`${fstest} lstat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 rename ${n0} ${n1} -ctime2=`${fstest} lstat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n0} + ctime1=`${fstest} lstat ${n0} ctime` + sleep 1 + expect EACCES -u 65534 rename ${n0} ${n1} + ctime2=`${fstest} lstat ${n0} ctime` + test_check $ctime1 -eq $ctime2 + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi +done cd ${cdir} expect 0 rmdir ${n3} Modified: head/tools/regression/fstest/tests/rename/06.t ============================================================================== --- head/tools/regression/fstest/tests/rename/06.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/rename/06.t Wed Aug 11 17:34:58 2010 (r211186) @@ -11,11 +11,11 @@ require chflags case "${os}:${fs}" in FreeBSD:ZFS) flags="SF_IMMUTABLE SF_NOUNLINK SF_APPEND" - echo "1..105" + echo "1..195" ;; FreeBSD:UFS) flags="SF_IMMUTABLE SF_NOUNLINK SF_APPEND UF_IMMUTABLE UF_NOUNLINK UF_APPEND" - echo "1..189" + echo "1..351" ;; *) quick_exit @@ -24,86 +24,38 @@ esac n0=`namegen` n1=`namegen` -expect 0 create ${n0} 0644 -for flag in ${flags}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} +for type in regular dir fifo block char socket symlink; do + if [ "${type}" != "symlink" ]; then + create_file ${type} ${n0} + for flag in ${flags}; do + expect 0 chflags ${n0} ${flag} + expect ${flag} stat ${n0} flags + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect EPERM rename ${n0} ${n1} + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect ENOENT rename ${n1} ${n0} + done + expect 0 chflags ${n0} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi + fi + + create_file ${type} ${n0} + for flag in ${flags}; do + expect 0 lchflags ${n0} ${flag} + expect ${flag} lstat ${n0} flags + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect EPERM rename ${n0} ${n1} + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect ENOENT rename ${n1} ${n0} + done + expect 0 lchflags ${n0} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi done -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 mkdir ${n0} 0755 -for flag in ${flags}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a directory protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a directory protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} -done -expect 0 chflags ${n0} none -expect 0 rmdir ${n0} - -expect 0 mkfifo ${n0} 0644 -for flag in ${flags}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a fifo protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a fifo protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 mknod ${n0} b 0644 1 2 -for flag in ${flags}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a device protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a device protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 mknod ${n0} c 0644 1 2 -for flag in ${flags}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a device protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a device protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 bind ${n0} -for flag in ${flags}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a socket protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a socket protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 symlink ${n1} ${n0} -for flag in ${flags}; do - expect 0 lchflags ${n0} ${flag} - expect ${flag} lstat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a symlink protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a symlink protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} -done -expect 0 lchflags ${n0} none -expect 0 unlink ${n0} Modified: head/tools/regression/fstest/tests/rename/07.t ============================================================================== --- head/tools/regression/fstest/tests/rename/07.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/rename/07.t Wed Aug 11 17:34:58 2010 (r211186) @@ -29,158 +29,38 @@ n2=`namegen` expect 0 mkdir ${n0} 0755 -expect 0 create ${n0}/${n1} 0644 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n0}/${n1} + for flag in ${flags1}; do + expect 0 chflags ${n0} ${flag} + expect ${flag} stat ${n0} flags + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect EPERM rename ${n0}/${n1} ${n2} + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect ENOENT rename ${n2} ${n0}/${n1} + done + expect 0 chflags ${n0} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0}/${n1} + else + expect 0 unlink ${n0}/${n1} + fi +done + +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n0}/${n1} + for flag in ${flags2}; do + expect 0 chflags ${n0} ${flag} + expect ${flag} stat ${n0} flags + expect 0 rename ${n0}/${n1} ${n2} + expect 0 rename ${n2} ${n0}/${n1} + done + expect 0 chflags ${n0} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0}/${n1} + else + expect 0 unlink ${n0}/${n1} + fi done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 mkdir ${n0}/${n1} 0755 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 rmdir ${n0}/${n1} - -expect 0 mkfifo ${n0}/${n1} 0644 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 mknod ${n0}/${n1} b 0644 1 2 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 mknod ${n0}/${n1} c 0644 1 2 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 bind ${n0}/${n1} -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 symlink ${n2} ${n0}/${n1} -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 create ${n0}/${n1} 0644 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 mkdir ${n0}/${n1} 0755 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 rmdir ${n0}/${n1} - -expect 0 mkfifo ${n0}/${n1} 0644 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 mknod ${n0}/${n1} b 0644 1 2 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 mknod ${n0}/${n1} c 0644 1 2 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 bind ${n0}/${n1} -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 symlink ${n2} ${n0}/${n1} -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} expect 0 rmdir ${n0} Modified: head/tools/regression/fstest/tests/rename/08.t ============================================================================== --- head/tools/regression/fstest/tests/rename/08.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/rename/08.t Wed Aug 11 17:34:58 2010 (r211186) @@ -12,12 +12,12 @@ case "${os}:${fs}" in FreeBSD:ZFS) flags1="SF_IMMUTABLE" flags2="SF_NOUNLINK SF_APPEND" - echo "1..110" + echo "1..128" ;; FreeBSD:UFS) flags1="SF_IMMUTABLE UF_IMMUTABLE" flags2="SF_NOUNLINK SF_APPEND UF_NOUNLINK UF_APPEND" - echo "1..188" + echo "1..219" ;; *) quick_exit @@ -29,118 +29,35 @@ n2=`namegen` expect 0 mkdir ${n0} 0755 -expect 0 create ${n1} 0644 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect EPERM rename ${n1} ${n0}/${n2} +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n1} + for flag in ${flags1}; do + expect 0 chflags ${n0} ${flag} + expect ${flag} stat ${n0} flags + expect EPERM rename ${n1} ${n0}/${n2} + done + expect 0 chflags ${n0} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi +done + +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n1} + for flag in ${flags2}; do + expect 0 chflags ${n0} ${flag} + expect ${flag} stat ${n0} flags + expect 0 rename ${n1} ${n0}/${n2} + expect 0 chflags ${n0} none + expect 0 rename ${n0}/${n2} ${n1} + done + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi done -expect 0 chflags ${n0} none -expect 0 unlink ${n1} - -expect 0 mkdir ${n1} 0755 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect EPERM rename ${n1} ${n0}/${n2} -done -expect 0 chflags ${n0} none -expect 0 rmdir ${n1} - -expect 0 mkfifo ${n1} 0644 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect EPERM rename ${n1} ${n0}/${n2} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n1} - -expect 0 mknod ${n1} c 0644 1 2 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect EPERM rename ${n1} ${n0}/${n2} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n1} - -expect 0 bind ${n1} -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect EPERM rename ${n1} ${n0}/${n2} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n1} - -expect 0 symlink ${n2} ${n1} -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect EPERM rename ${n1} ${n0}/${n2} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n1} - -expect 0 create ${n1} 0644 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n1} ${n0}/${n2} - expect 0 chflags ${n0} none - expect 0 rename ${n0}/${n2} ${n1} -done -expect 0 unlink ${n1} - -expect 0 mkdir ${n1} 0755 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n1} ${n0}/${n2} - expect 0 chflags ${n0} none - expect 0 rename ${n0}/${n2} ${n1} -done -expect 0 rmdir ${n1} - -expect 0 mkfifo ${n1} 0644 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n1} ${n0}/${n2} - expect 0 chflags ${n0} none - expect 0 rename ${n0}/${n2} ${n1} -done -expect 0 unlink ${n1} - -expect 0 mknod ${n1} c 0644 1 2 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n1} ${n0}/${n2} - expect 0 chflags ${n0} none - expect 0 rename ${n0}/${n2} ${n1} -done -expect 0 unlink ${n1} - -expect 0 bind ${n1} -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n1} ${n0}/${n2} - expect 0 chflags ${n0} none - expect 0 rename ${n0}/${n2} ${n1} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 17:42:45 2010 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 93D71106566B; Wed, 11 Aug 2010 17:42:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 650638FC16; Wed, 11 Aug 2010 17:42:45 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 1C0A646B4C; Wed, 11 Aug 2010 13:42:45 -0400 (EDT) Received: from John-Baldwins-Macbook-Pro.local (75-48-78-116.lightspeed.cncrca.sbcglobal.net [75.48.78.116]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B26398A03C; Wed, 11 Aug 2010 13:42:43 -0400 (EDT) Message-ID: <4C62E112.5090206@FreeBSD.org> Date: Wed, 11 Aug 2010 13:42:42 -0400 From: John Baldwin User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: Attilio Rao References: <201008111051.o7BApRp4028538@svn.freebsd.org> <4C62DADF.1000202@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 11 Aug 2010 13:42:44 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_DYNAMIC autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211176 - 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, 11 Aug 2010 17:42:45 -0000 Attilio Rao wrote: > 2010/8/11 John Baldwin : >> Attilio Rao wrote: >>> Author: attilio >>> Date: Wed Aug 11 10:51:27 2010 >>> New Revision: 211176 >>> URL: http://svn.freebsd.org/changeset/base/211176 >>> >>> Log: >>> IPI handlers may run generally with interrupts disabled because they >>> are served via an interrupt gate. >>> However, that doesn't explicitly prevent preemption and thread >>> migration thus scheduler pinning may be necessary in some handlers. >>> Fix that. >>> Tested by: gianni >>> MFC after: 1 month >> Actually that does prevent preemption if you do not call any code that would >> schedule a thread. I think this change is all safe to revert. > > Do you recall, then, why lapic_handle_timer() does critical section? > It seems to be catered by interrupt gate as well, and I don't see any > point re-enabling them explicitly. Because hardclock() explicitly calls sched_add() via swi_sched() when scheduling the softclock swi. The critical section there is just to ensure that the preemption to softclock happens after all of the clock interrupt handlers have finished. However, PCPU_GET() does not call sched_add(), so it does not need to be protected. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 17:47:11 2010 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 712A6106564A; Wed, 11 Aug 2010 17:47:11 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id C039F8FC23; Wed, 11 Aug 2010 17:47:10 +0000 (UTC) Received: by qwg5 with SMTP id 5so453125qwg.13 for ; Wed, 11 Aug 2010 10:47:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=eUzAz1wFxTgXBV2PQkxVT7OXHsGYR6f28zzwSu8OVY8=; b=Wf19hYGqPXCOxX4CSoE2Kw/z6B3+SwDb31piue+g2ZPzr2SgzXFbDTF2Af4Pa2L76J x7m2ITVVhMUlBBQ3+63oOi0MpQSls/O/nPV20csKLV0AU13b/C834Ro2dZ41B9G7dnhQ tH+GbStkqHxcfq6wfK7mL954C3hq7pRSqqtSY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=qbzwcbCgFDUq0J23OI7E/VtvRH827yAPL1IGVcf5AMK0E4qEMrV6sQOKiWrl8rpllD iZCKzBLEgB7n6jgDOfk2A/HMdFxPDY544nxXKzFnnglXgyZ4Pc3RyFSvjjifbfZe+9Bh FgbOrt1xkQNUkaRS5GYYIm8prz9GdKCWx4ruA= MIME-Version: 1.0 Received: by 10.229.221.203 with SMTP id id11mr5297821qcb.222.1281548829892; Wed, 11 Aug 2010 10:47:09 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.251.6 with HTTP; Wed, 11 Aug 2010 10:47:09 -0700 (PDT) In-Reply-To: <4C62E112.5090206@FreeBSD.org> References: <201008111051.o7BApRp4028538@svn.freebsd.org> <4C62DADF.1000202@FreeBSD.org> <4C62E112.5090206@FreeBSD.org> Date: Wed, 11 Aug 2010 19:47:09 +0200 X-Google-Sender-Auth: 1EQ-CBoL428DPC4UcVSvZVW8uDk Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211176 - 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, 11 Aug 2010 17:47:11 -0000 2010/8/11 John Baldwin : > Attilio Rao wrote: >> >> 2010/8/11 John Baldwin : >>> >>> Attilio Rao wrote: >>>> >>>> Author: attilio >>>> Date: Wed Aug 11 10:51:27 2010 >>>> New Revision: 211176 >>>> URL: http://svn.freebsd.org/changeset/base/211176 >>>> >>>> Log: >>>> =C2=A0IPI handlers may run generally with interrupts disabled because = they >>>> =C2=A0are served via an interrupt gate. >>>> =C2=A0 However, that doesn't explicitly prevent preemption and thread >>>> =C2=A0migration thus scheduler pinning may be necessary in some handle= rs. >>>> =C2=A0Fix that. >>>> =C2=A0 Tested by: =C2=A0gianni >>>> =C2=A0MFC after: =C2=A0 =C2=A01 month >>> >>> Actually that does prevent preemption if you do not call any code that >>> would >>> schedule a thread. =C2=A0I think this change is all safe to revert. >> >> Do you recall, then, why lapic_handle_timer() does critical section? >> It seems to be catered by interrupt gate as well, and I don't see any >> point re-enabling them explicitly. > > Because hardclock() explicitly calls sched_add() via swi_sched() when > scheduling the softclock swi. =C2=A0The critical section there is just to= ensure > that the preemption to softclock happens after all of the clock interrupt > handlers have finished. =C2=A0However, PCPU_GET() does not call sched_add= (), so > it does not need to be protected. Oh, sorry, was looking at the -CURRENT code which had no explicit call to hardclock (it uses the new timer infrastructure, so that was not so obvious). I understand now, so I will rever the change asap. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 18:00:45 2010 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 C13451065673; Wed, 11 Aug 2010 18:00:45 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD7088FC14; Wed, 11 Aug 2010 18:00:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BI0j3G029265; Wed, 11 Aug 2010 18:00:45 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BI0j6B029258; Wed, 11 Aug 2010 18:00:45 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201008111800.o7BI0j6B029258@svn.freebsd.org> From: Rui Paulo Date: Wed, 11 Aug 2010 18:00: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: r211187 - in head/cddl/usr.bin: ctfconvert ctfdump ctfmerge 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, 11 Aug 2010 18:00:45 -0000 Author: rpaulo Date: Wed Aug 11 18:00:45 2010 New Revision: 211187 URL: http://svn.freebsd.org/changeset/base/211187 Log: Add man pages for the CTF tools. Sponsored by: The FreeBSD Foundation Added: head/cddl/usr.bin/ctfconvert/ctfconvert.1 (contents, props changed) head/cddl/usr.bin/ctfdump/ctfdump.1 (contents, props changed) head/cddl/usr.bin/ctfmerge/ctfmerge.1 (contents, props changed) Modified: head/cddl/usr.bin/ctfconvert/Makefile head/cddl/usr.bin/ctfdump/Makefile head/cddl/usr.bin/ctfmerge/Makefile Modified: head/cddl/usr.bin/ctfconvert/Makefile ============================================================================== --- head/cddl/usr.bin/ctfconvert/Makefile Wed Aug 11 17:34:58 2010 (r211186) +++ head/cddl/usr.bin/ctfconvert/Makefile Wed Aug 11 18:00:45 2010 (r211187) @@ -6,7 +6,6 @@ DEBUG_FLAGS= -g PROG= ctfconvert -NO_MAN= SRCS= alist.c \ ctf.c \ ctfconvert.c \ Added: head/cddl/usr.bin/ctfconvert/ctfconvert.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/usr.bin/ctfconvert/ctfconvert.1 Wed Aug 11 18:00:45 2010 (r211187) @@ -0,0 +1,85 @@ +.\" +.\" Copyright (c) 2010 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" This software was developed by Rui Paulo under sponsorship from the +.\" FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 7, 2010 +.Dt CTFCONVERT 1 +.Os +.Sh NAME +.Nm ctfconvert +.Nd convert debug data to CTF data +.Sh SYNOPSIS +.Nm +.Op Fl gis +.Fl l Ar label +.Fl L Ar labelenv +.Op Fl o Ar outfile +object_file +.Sh DESCRIPTION +The +.Nm +utility converts debug information from a binary file to CTF data and replaces +the debug section of that file with a CTF section called SUNW_ctf. +This new section is added to the input file, unless the -o +option is present. +You can also opt to keep the original debugging section with the +-g option. +.Pp +The following options are available: +.Bl -tag -width indent +.It Fl l Ar label +Sets the label as +.Ar label . +.It Fl L Ar labelenv +Instructs +.Nm +to read the label from the environment variable +.Ar labelenv . +.It Fl g +Don't delete the original debugging section. +.It Fl i +Ignore object files built from other languages than C. +.It Fl s +Use the .dynsym ELF section instead of the .symtab ELF section. +.It Fl o Ar outfile +Write the output to file in +.Ar outfile . +.El +.Sh EXIT STATUS +.Ex -std +.Sh SEE ALSO +.Xr ctfmerge 1 , +.Xr ctfdump 1 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 7.0 . +.Sh AUTHORS +The CTF utilities came from OpenSolaris. Modified: head/cddl/usr.bin/ctfdump/Makefile ============================================================================== --- head/cddl/usr.bin/ctfdump/Makefile Wed Aug 11 17:34:58 2010 (r211186) +++ head/cddl/usr.bin/ctfdump/Makefile Wed Aug 11 18:00:45 2010 (r211187) @@ -4,7 +4,6 @@ .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/tools/ctf/dump PROG= ctfdump -NO_MAN= SRCS= dump.c \ symbol.c \ utils.c Added: head/cddl/usr.bin/ctfdump/ctfdump.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/usr.bin/ctfdump/ctfdump.1 Wed Aug 11 18:00:45 2010 (r211187) @@ -0,0 +1,83 @@ +.\" +.\" Copyright (c) 2010 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" This software was developed by Rui Paulo under sponsorship from the +.\" FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 7, 2010 +.Dt CTFDUMP 1 +.Os +.Sh NAME +.Nm ctfdump +.Nd dump the SUNW_ctf section of an ELF file +.Sh SYNOPSIS +.Nm +.Op Fl dfhlsSt +.Fl u Ar file +file +.Sh DESCRIPTION +The +.Nm +utility dumps the contents of the CTF data section (SUNW_ctf) present in +an ELF binary file. +This section was previously created with +.Xr ctfconvert 1 +or +.Xr ctfmerge 1 . +.Pp +The following options are available: +.Bl -tag -width indent +.It Fl d +Show the data object section. +.It Fl f +Show the function section. +.It Fl h +Show the header. +.It Fl l +Show the label section. +.It Fl s +Show the string table. +.It Fl S +Show statistics. +.It Fl t +Show the type section. +.It Fl u Ar ufile +Write the uncompressed CTF data to a raw CTF file called +.Ar ufile . +.El +.Sh EXIT STATUS +.Ex -std +.Sh SEE ALSO +.Xr ctfconvert 1 , +.Xr ctfmerge 1 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 7.0 . +.Sh AUTHORS +The CTF utilities came from OpenSolaris. Modified: head/cddl/usr.bin/ctfmerge/Makefile ============================================================================== --- head/cddl/usr.bin/ctfmerge/Makefile Wed Aug 11 17:34:58 2010 (r211186) +++ head/cddl/usr.bin/ctfmerge/Makefile Wed Aug 11 18:00:45 2010 (r211187) @@ -4,7 +4,6 @@ .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/tools/ctf/cvt PROG= ctfmerge -NO_MAN= SRCS= alist.c \ barrier.c \ ctf.c \ Added: head/cddl/usr.bin/ctfmerge/ctfmerge.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/usr.bin/ctfmerge/ctfmerge.1 Wed Aug 11 18:00:45 2010 (r211187) @@ -0,0 +1,120 @@ +.\" +.\" Copyright (c) 2010 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" This software was developed by Rui Paulo under sponsorship from the +.\" FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 7, 2010 +.Dt CTFMERGE 1 +.Os +.Sh NAME +.Nm ctfmerge +.Nd merge several CTF data sections into one +.Sh SYNOPSIS +.Nm +.Op Fl fgstv +.Fl l Ar label +.Fl L Ar labelenv +.Fl o Ar outfile +file ... +.Nm +.Op Fl fgstv +.Fl l Ar label +.Fl L Ar labelenv +.Fl o Ar outfile +.Fl d Ar uniqfile +.Op Fl g +.Op Fl D Ar uniqlabel +file ... +.Nm +.Op Fl fgstv +.Fl l Ar label +.Fl L Ar labelenv +.Fl o Ar outfile +.Fl w Ar withfile +file ... +.Nm +.Op Fl g +.Fl c Ar srcfile +.Ar destfile +.Sh DESCRIPTION +The +.Nm +utility merges several CTF data sections from several files into one +output file, unifying common data. +.Pp +The following options are available: +.Bl -tag -width indent +.It Fl f +Match global symbols to global CTF data. +.It Fl g +Don't delete the original debugging sections. +.It Fl s +Use the .dynsym ELF section instead of the .symtab ELF section. +.It Fl t +Make sure that all object files have a CTF section. +.It Fl v +Enable verbose mode. +.It Fl l Ar label +Sets the label as +.Ar label . +.It Fl L Ar labelenv +Instructs +.Nm +to read the label from the environment variable +.Ar labelenv . +.It Fl o Ar outfile +Use +.Ar outfile +to store the merged CTF data. +.It Fl d Ar uniqfile +Uniquify against +.Ar uniqfile . +.It Fl d Ar uniqlabel +Uniquify against label +.Ar uniqlabel +.It Fl w Ar withfile +Additive merge with +.Ar withfile . +.It Fl c Ar srcfile Ar destfile +Copy CTF data from +.Ar srcfile +into +.Ar destfile . +.El +.Sh EXIT STATUS +.Ex -std +.Sh SEE ALSO +.Xr ctfconvert 1 , +.Xr ctfdump 1 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 7.0 . +.Sh AUTHORS +The CTF utilities came from OpenSolaris. From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 18:02:48 2010 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 BEBFA1065678; Wed, 11 Aug 2010 18:02:48 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE0FF8FC18; Wed, 11 Aug 2010 18:02:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BI2mqL029736; Wed, 11 Aug 2010 18:02:48 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BI2m6c029734; Wed, 11 Aug 2010 18:02:48 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201008111802.o7BI2m6c029734@svn.freebsd.org> From: Rui Paulo Date: Wed, 11 Aug 2010 18:02: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: r211188 - head/usr.bin/elfdump 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, 11 Aug 2010 18:02:48 -0000 Author: rpaulo Date: Wed Aug 11 18:02:48 2010 New Revision: 211188 URL: http://svn.freebsd.org/changeset/base/211188 Log: Teach elfdump(1) about the SUNW_dof section. Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/elfdump/elfdump.c Modified: head/usr.bin/elfdump/elfdump.c ============================================================================== --- head/usr.bin/elfdump/elfdump.c Wed Aug 11 18:00:45 2010 (r211187) +++ head/usr.bin/elfdump/elfdump.c Wed Aug 11 18:02:48 2010 (r211188) @@ -322,6 +322,7 @@ sh_types(u_int64_t sht) { case 18: return "SHT_SYMTAB_SHNDX"; /* 0x60000000 - 0x6fffffff operating system-specific semantics */ case 0x6ffffff0: return "XXX:VERSYM"; + case 0x6ffffff4: return "SHT_SUNW_dof"; case 0x6ffffff7: return "SHT_GNU_LIBLIST"; case 0x6ffffffc: return "XXX:VERDEF"; case 0x6ffffffd: return "SHT_SUNW(GNU)_verdef"; From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 18:23:26 2010 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 A28E31065670; Wed, 11 Aug 2010 18:23:26 +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 9221C8FC1A; Wed, 11 Aug 2010 18:23:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BINQpX034405; Wed, 11 Aug 2010 18:23:26 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BINQMj034403; Wed, 11 Aug 2010 18:23:26 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201008111823.o7BINQMj034403@svn.freebsd.org> From: Xin LI Date: Wed, 11 Aug 2010 18:23: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: r211189 - head/usr.bin 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, 11 Aug 2010 18:23:26 -0000 Author: delphij Date: Wed Aug 11 18:23:26 2010 New Revision: 211189 URL: http://svn.freebsd.org/changeset/base/211189 Log: Update a stale comment about grep. Modified: head/usr.bin/Makefile Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Wed Aug 11 18:02:48 2010 (r211188) +++ head/usr.bin/Makefile Wed Aug 11 18:23:26 2010 (r211189) @@ -5,7 +5,7 @@ # XXX MISSING: deroff diction graph learn plot # spell spline struct xsend -# XXX Use GNU versions: apropos diff grep ld man patch whatis +# XXX Use GNU versions: apropos diff ld man patch whatis # Moved to secure: bdes # From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 18:36:26 2010 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 E52C1106567D; Wed, 11 Aug 2010 18:36:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B65578FC20; Wed, 11 Aug 2010 18:36:26 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 6B22A46B45; Wed, 11 Aug 2010 14:36:26 -0400 (EDT) Received: from John-Baldwins-Macbook-Pro.local (75-48-78-116.lightspeed.cncrca.sbcglobal.net [75.48.78.116]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 504E08A03C; Wed, 11 Aug 2010 14:36:24 -0400 (EDT) Message-ID: <4C62EDA7.5070001@FreeBSD.org> Date: Wed, 11 Aug 2010 14:36:23 -0400 From: John Baldwin User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: Will Andrews References: <201008110051.o7B0pp10084996@svn.freebsd.org> In-Reply-To: <201008110051.o7B0pp10084996@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 11 Aug 2010 14:36:24 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_DYNAMIC autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211157 - in head/sys: modules modules/if_carp net netinet netinet6 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, 11 Aug 2010 18:36:27 -0000 Will Andrews wrote: > Author: will > Date: Wed Aug 11 00:51:50 2010 > New Revision: 211157 > URL: http://svn.freebsd.org/changeset/base/211157 > > Log: > Allow carp(4) to be loaded as a kernel module. Follow precedent set by > bridge(4), lagg(4) etc. and make use of function pointers and > pf_proto_register() to hook carp into the network stack. > > Currently, because of the uncertainty about whether the unload path is free > of race condition panics, unloads are disallowed by default. Compiling with > CARPMOD_CAN_UNLOAD in CFLAGS removes this anti foot shooting measure. > > This commit requires IP6PROTOSPACER, introduced in r211115. This doesn't compile due to duplicate function pointer definitions (e.g. if_bridge.c and if_ether.c). You should move all the function pointer definitions to net/if.c and add declarations for them to a header instead of a bunch of 'extern' declarations in if_carp.c itself. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 19:11:51 2010 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 101D2106566C; Wed, 11 Aug 2010 19:11:51 +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 998458FC08; Wed, 11 Aug 2010 19:11:50 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o7BJBbcT043136 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 11 Aug 2010 22:11:37 +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.4/8.14.4) with ESMTP id o7BJBb6n097038; Wed, 11 Aug 2010 22:11:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o7BJBbXe097037; Wed, 11 Aug 2010 22:11:37 +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, 11 Aug 2010 22:11:37 +0300 From: Kostik Belousov To: Attilio Rao Message-ID: <20100811191137.GO2396@deviant.kiev.zoral.com.ua> References: <201008111051.o7BApRp4028538@svn.freebsd.org> <20100811105739.GJ2396@deviant.kiev.zoral.com.ua> <20100811123430.GK2396@deviant.kiev.zoral.com.ua> <20100811144646.GL2396@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Jl+DbTnyraiZ/loT" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no 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, Jeff Roberson , John Baldwin Subject: Re: svn commit: r211176 - 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, 11 Aug 2010 19:11:51 -0000 --Jl+DbTnyraiZ/loT Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 11, 2010 at 07:10:00PM +0200, Attilio Rao wrote: > 2010/8/11 Attilio Rao : > > 2010/8/11 Kostik Belousov : > >> On Wed, Aug 11, 2010 at 04:29:21PM +0200, Attilio Rao wrote: > >>> 2010/8/11 Kostik Belousov : > >>> > On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote: > >>> >> 2010/8/11 Kostik Belousov : > >>> >> > On Wed, Aug 11, 2010 at 10:51:27AM +0000, Attilio Rao wrote: > >>> >> >> Author: attilio > >>> >> >> Date: Wed Aug 11 10:51:27 2010 > >>> >> >> New Revision: 211176 > >>> >> >> URL: http://svn.freebsd.org/changeset/base/211176 > >>> >> >> > >>> >> >> Log: > >>> >> >> =9A IPI handlers may run generally with interrupts disabled bec= ause they > >>> >> >> =9A are served via an interrupt gate. > >>> >> >> > >>> >> >> =9A However, that doesn't explicitly prevent preemption and thr= ead > >>> >> >> =9A migration thus scheduler pinning may be necessary in some h= andlers. > >>> >> >> =9A Fix that. > >>> >> > > >>> >> > How the preemption is supposed to happen ? Aside from the explic= it > >>> >> > calls to mi_switch() from e.g. critical_exit(). > >>> >> > >>> >> IIRC it should be hardclock() willing to schedule the softclock().= It > >>> >> is the critical_exit() in the thread_unlock() that may trigger it > >>> >> (sorry for not digging more, it was a while back that I hacked this > >>> >> part, but I guess you can verify on your own). > >>> >> We already have other points within the kernel that take care of > >>> >> dealing with preemption/migration like lapic_handle_timer(), for > >>> >> example. > >>> > > >>> > Right, and if the interrupts are indeed disabled, I do not see how > >>> > the preemption may be triggered in the fragments like > >>> > =9A =9A =9A =9Acpu =3D PCPU_GET(cpuid); > >>> > =9A =9A =9A =9Acpumask =3D PCPU_GET(cpumask); > >>> > >>> I don't recall all the details and I have no time to dig now. However, > >>> also spinlock_enter() does disable explicitly preemption via > >>> critical_enter() after have disabled the interrupts. > >>> Let me CC jhb as he implemented spinlock_enter() and may have a clue > >>> about how preemption can happen with interrupts disabled. > >> > >> spinlock_enter() disables preemption to handle the recursive > >> calls to spinlock_enter/leave, I think, to prevent switch on > >> leave. > > > > No. > > Please look at how spinlock_enter() is implemented in ia32/amd64 in > > order to see how it does handle recursion. >=20 > And besides we have other patterns running with interrupts disabled > taking care of preemption as well (I think I already pointed to one, I > think you could find others easilly). Let me rephrase the original question: how the code of the kind a =3D b; c =3D d; while executed with interrupts disabled, can be a subject to the kernel preemption ? Well, the code are slightly more involved, because evaluation of the right part of the assignment causes rebasing against non-default segment register on x86oids, but the detail is irrelevant. --Jl+DbTnyraiZ/loT Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkxi9egACgkQC3+MBN1Mb4j/OQCfYbQR4NJtJkoUByep52q035p6 6pIAnRtSldYHmMhsMTNKG9cyWLNil+fn =zR30 -----END PGP SIGNATURE----- --Jl+DbTnyraiZ/loT-- From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 19:13:57 2010 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 579F1106566C; Wed, 11 Aug 2010 19:13:57 +0000 (UTC) (envelope-from will@firepipe.net) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 55A488FC16; Wed, 11 Aug 2010 19:13:56 +0000 (UTC) Received: by wwb13 with SMTP id 13so522288wwb.31 for ; Wed, 11 Aug 2010 12:13:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.154.206 with SMTP id h56mr1821376wek.111.1281552430328; Wed, 11 Aug 2010 11:47:10 -0700 (PDT) Received: by 10.216.65.137 with HTTP; Wed, 11 Aug 2010 11:47:10 -0700 (PDT) In-Reply-To: <4C62EDA7.5070001@FreeBSD.org> References: <201008110051.o7B0pp10084996@svn.freebsd.org> <4C62EDA7.5070001@FreeBSD.org> Date: Wed, 11 Aug 2010 12:47:10 -0600 Message-ID: From: Will Andrews To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Will Andrews Subject: Re: svn commit: r211157 - in head/sys: modules modules/if_carp net netinet netinet6 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, 11 Aug 2010 19:13:57 -0000 On Wed, Aug 11, 2010 at 12:36 PM, John Baldwin wrote: > This doesn't compile due to duplicate function pointer definitions (e.g. > =A0if_bridge.c and if_ether.c). =A0You should move all the function point= er > definitions to net/if.c and add declarations for them to a header instead= of > a bunch of 'extern' declarations in if_carp.c itself. Working on it. --Will. From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 19:17:24 2010 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 4A7E21065672; Wed, 11 Aug 2010 19:17:24 +0000 (UTC) (envelope-from will@firepipe.net) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6CDC38FC1F; Wed, 11 Aug 2010 19:17:23 +0000 (UTC) Received: by wyj26 with SMTP id 26so599280wyj.13 for ; Wed, 11 Aug 2010 12:17:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.182.202 with SMTP id o52mr17109902wem.29.1281552399731; Wed, 11 Aug 2010 11:46:39 -0700 (PDT) Received: by 10.216.65.137 with HTTP; Wed, 11 Aug 2010 11:46:39 -0700 (PDT) In-Reply-To: <20100811143430.GB1707@garage.freebsd.pl> References: <201008110051.o7B0pp10084996@svn.freebsd.org> <20100811143430.GB1707@garage.freebsd.pl> Date: Wed, 11 Aug 2010 12:46:39 -0600 Message-ID: From: Will Andrews To: Pawel Jakub Dawidek Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Will Andrews Subject: Re: svn commit: r211157 - in head/sys: modules modules/if_carp net netinet netinet6 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, 11 Aug 2010 19:17:24 -0000 On Wed, Aug 11, 2010 at 8:34 AM, Pawel Jakub Dawidek wrote: > Wouldn't it be better to allow unload only if there are no carp(4) > interfaces? I'd be glad to destroy my carp interfaces before unloading > the module, but recompiling the kernel to unload it? Not so much. Well, in theory, if_clone_detach() is supposed to do that, and it's called during the unload process prior to NULLing the fp's. But I've been unable to verify whether that is enough to prevent races. --Will. From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 19:32:50 2010 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 1DDB91065693; Wed, 11 Aug 2010 19:32:50 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7CA18FC1E; Wed, 11 Aug 2010 19:32:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BJWnxq051287; Wed, 11 Aug 2010 19:32:49 GMT (envelope-from gad@svn.freebsd.org) Received: (from gad@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BJWn6R051286; Wed, 11 Aug 2010 19:32:49 GMT (envelope-from gad@svn.freebsd.org) Message-Id: <201008111932.o7BJWn6R051286@svn.freebsd.org> From: Garance A Drosehn Date: Wed, 11 Aug 2010 19:32: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: r211190 - head/usr.sbin/lpr/lpd 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, 11 Aug 2010 19:32:50 -0000 Author: gad Date: Wed Aug 11 19:32:49 2010 New Revision: 211190 URL: http://svn.freebsd.org/changeset/base/211190 Log: - Improve the wait4data() routine so it behaves better when checking print-jobs which have last-modification times that are in the future. This shouldn't happen, of course, but it can. And when it did happen, the previous check could cause completely-spooled jobs to sit in the queue for 20 minutes per job. The new code waits until the last-modify time is not changing, instead of making decisions based on the specific value of last-modify. MFC after: 2 weeks Modified: head/usr.sbin/lpr/lpd/printjob.c Modified: head/usr.sbin/lpr/lpd/printjob.c ============================================================================== --- head/usr.sbin/lpr/lpd/printjob.c Wed Aug 11 18:23:26 2010 (r211189) +++ head/usr.sbin/lpr/lpd/printjob.c Wed Aug 11 19:32:49 2010 (r211190) @@ -1263,8 +1263,9 @@ wait4data(struct printer *pp, const char { const char *cp; int statres; + u_int sleepreq; size_t dlen, hlen; - time_t amtslept, checktime; + time_t amtslept, cur_time, prev_mtime; struct stat statdf; /* Skip these checks if the print job is from the local host. */ @@ -1297,15 +1298,30 @@ wait4data(struct printer *pp, const char /* * The file exists, so keep waiting until the data file has not - * changed for some reasonable amount of time. + * changed for some reasonable amount of time. Extra care is + * taken when computing wait-times, just in case there are data + * files with a last-modify time in the future. While that is + * very unlikely to happen, it can happen when the system has + * a flakey time-of-day clock. */ - while (statres == 0 && amtslept < MAXWAIT_4DATA) { - checktime = time(NULL) - MINWAIT_4DATA; - if (statdf.st_mtime <= checktime) - break; + prev_mtime = statdf.st_mtime; + cur_time = time(NULL); + if (statdf.st_mtime >= cur_time - MINWAIT_4DATA) { + if (statdf.st_mtime >= cur_time) /* some TOD oddity */ + sleepreq = MINWAIT_4DATA; + else + sleepreq = cur_time - statdf.st_mtime; if (amtslept == 0) pstatus(pp, "Waiting for data file from remote host"); - amtslept += MINWAIT_4DATA - sleep(MINWAIT_4DATA); + amtslept += sleepreq - sleep(sleepreq); + statres = stat(dfile, &statdf); + } + sleepreq = MINWAIT_4DATA; + while (statres == 0 && amtslept < MAXWAIT_4DATA) { + if (statdf.st_mtime == prev_mtime) + break; + prev_mtime = statdf.st_mtime; + amtslept += sleepreq - sleep(sleepreq); statres = stat(dfile, &statdf); } From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 19:50:07 2010 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 8C771106566C; Wed, 11 Aug 2010 19:50:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3]) by mx1.freebsd.org (Postfix) with ESMTP id 188CF8FC14; Wed, 11 Aug 2010 19:50:07 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 147F841C6B4; Wed, 11 Aug 2010 21:50:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([192.168.74.103]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id R1fTgAAFbA6S; Wed, 11 Aug 2010 21:50:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 9849641C6A1; Wed, 11 Aug 2010 21:50:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 08F904449AA; Wed, 11 Aug 2010 19:45:20 +0000 (UTC) Date: Wed, 11 Aug 2010 19:45:20 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Will Andrews In-Reply-To: Message-ID: <20100811192959.S48418@maildrop.int.zabbadoz.net> References: <201008110051.o7B0pp10084996@svn.freebsd.org> <20100811143430.GB1707@garage.freebsd.pl> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek , Will Andrews Subject: Re: svn commit: r211157 - in head/sys: modules modules/if_carp net netinet netinet6 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, 11 Aug 2010 19:50:07 -0000 On Wed, 11 Aug 2010, Will Andrews wrote: > On Wed, Aug 11, 2010 at 8:34 AM, Pawel Jakub Dawidek wrote: >> Wouldn't it be better to allow unload only if there are no carp(4) >> interfaces? I'd be glad to destroy my carp interfaces before unloading >> the module, but recompiling the kernel to unload it? Not so much. > > Well, in theory, if_clone_detach() is supposed to do that, and it's > called during the unload process prior to NULLing the fp's. But I've > been unable to verify whether that is enough to prevent races. In addition only the module, not the kernel needs to be recompiled. Maybe I should add some more blah ... Actually destroying most (cloned) interfaces is not save at the moment. There could be an mbuf in a netisr queue with an ifp to that interface, or just a packet being processed on another PU, so there is more to this entire picture. Assume that the current way and what is under the #ifdef is a temporary thing and that we'll be able to flip the switch in the future. But there's still quite a bit of work into infratructure and details ahead, some of that will come with more VIMAGE/vnet work on network stack teardown, some might be done independently. SeND will have the cleanup/check to allow to unload under #ifdef __noyet__ as well, once it'll hit the tree, but for that the hooks will need proper ND6 locking as well. The point is, it's currently just not 100% save to just unload and we've been very lenient and lazy with that in the past. It's just that times have changed and the races become true more easily so adding new code/features need to be made aware of that or the pile will just grow. Unfortunately adding extra locking for all those things is nothing you'd want either. If you accept the risk for now that's fine but for the majority of our users we'll have to err on the save side, while allowing them to use freebsd-update now if it was only carp they needed (and not say IPSEC as well) and they can just load the module and be happy w/o having to recompile their own kernel. /bz -- Bjoern A. Zeeb This signature is about you not me. From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 19:56:09 2010 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 AD2AA1065675; Wed, 11 Aug 2010 19:56:09 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D0E38FC23; Wed, 11 Aug 2010 19:56:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BJu9wg057011; Wed, 11 Aug 2010 19:56:09 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BJu9ti057009; Wed, 11 Aug 2010 19:56:09 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201008111956.o7BJu9ti057009@svn.freebsd.org> From: "Jayachandran C." Date: Wed, 11 Aug 2010 19:56:09 +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: r211191 - head/sys/mips/rmi 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, 11 Aug 2010 19:56:09 -0000 Author: jchandra Date: Wed Aug 11 19:56:09 2010 New Revision: 211191 URL: http://svn.freebsd.org/changeset/base/211191 Log: Fix for 64 bit compile, with SMP enabled. Modified: head/sys/mips/rmi/xlr_machdep.c Modified: head/sys/mips/rmi/xlr_machdep.c ============================================================================== --- head/sys/mips/rmi/xlr_machdep.c Wed Aug 11 19:32:49 2010 (r211190) +++ head/sys/mips/rmi/xlr_machdep.c Wed Aug 11 19:56:09 2010 (r211191) @@ -428,7 +428,8 @@ platform_start(__register_t a0 __unused, /* Wakeup Other cpus, and put them in bsd park code. */ wakeup = ((void (*) (void *, void *, unsigned int)) (unsigned long)(xlr_boot1_info.wakeup)); - printf("Waking up CPUs 0x%llx.\n", xlr_boot1_info.cpu_online_map & ~(0x1U)); + printf("Waking up CPUs 0x%jx.\n", + (intmax_t)xlr_boot1_info.cpu_online_map & ~(0x1U)); if (xlr_boot1_info.cpu_online_map & ~(0x1U)) wakeup(mpwait, 0, (unsigned int)xlr_boot1_info.cpu_online_map); @@ -516,7 +517,7 @@ platform_init_ap(int cpuid) stat |= MIPS_SR_COP_2_BIT | MIPS_SR_COP_0_BIT; mips_wr_status(stat); - xlr_unmask_hard_irq((void *)platform_ipi_intrnum()); + xlr_unmask_hard_irq((void *)IRQ_IPI); xlr_unmask_hard_irq((void *)IRQ_TIMER); if (xlr_thr_id() == 0) { xlr_msgring_cpu_init(); From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 19:59:31 2010 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 97CE8106566C; Wed, 11 Aug 2010 19:59:31 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88A958FC16; Wed, 11 Aug 2010 19:59:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BJxVi5057803; Wed, 11 Aug 2010 19:59:31 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BJxV2B057802; Wed, 11 Aug 2010 19:59:31 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201008111959.o7BJxV2B057802@svn.freebsd.org> From: Kai Wang Date: Wed, 11 Aug 2010 19:59: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: r211192 - head/lib/libelf 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, 11 Aug 2010 19:59:31 -0000 Author: kaiw Date: Wed Aug 11 19:59:31 2010 New Revision: 211192 URL: http://svn.freebsd.org/changeset/base/211192 Log: Add translation support for section type SHT_SUNW_dof. Submitted by: rpaulo MFC after: 2 weeks Modified: head/lib/libelf/libelf_data.c Modified: head/lib/libelf/libelf_data.c ============================================================================== --- head/lib/libelf/libelf_data.c Wed Aug 11 19:56:09 2010 (r211191) +++ head/lib/libelf/libelf_data.c Wed Aug 11 19:59:31 2010 (r211192) @@ -81,6 +81,8 @@ _libelf_xlate_shtype(uint32_t sht) return (ELF_T_MOVE); case SHT_SUNW_syminfo: return (ELF_T_SYMINFO); + case SHT_SUNW_dof: + return (ELF_T_BYTE); #endif case SHT_AMD64_UNWIND: /* == SHT_IA_64_UNWIND */ return (ELF_T_BYTE); From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 20:18:19 2010 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 AA110106566B; Wed, 11 Aug 2010 20:18:19 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 979CB8FC19; Wed, 11 Aug 2010 20:18:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BKIJ9u061971; Wed, 11 Aug 2010 20:18:19 GMT (envelope-from will@svn.freebsd.org) Received: (from will@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BKIJFO061963; Wed, 11 Aug 2010 20:18:19 GMT (envelope-from will@svn.freebsd.org) Message-Id: <201008112018.o7BKIJFO061963@svn.freebsd.org> From: Will Andrews Date: Wed, 11 Aug 2010 20:18: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: r211193 - in head/sys: net netinet netinet6 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, 11 Aug 2010 20:18:19 -0000 Author: will Date: Wed Aug 11 20:18:19 2010 New Revision: 211193 URL: http://svn.freebsd.org/changeset/base/211193 Log: Unbreak LINT by moving all carp hooks to net/if.c / netinet/ip_carp.h, with the appropriate ifdefs. Reviewed by: bz Approved by: ken (mentor) Modified: head/sys/net/if.c head/sys/net/if_bridge.c head/sys/net/if_ethersubr.c head/sys/netinet/if_ether.c head/sys/netinet/ip_carp.c head/sys/netinet/ip_carp.h head/sys/netinet6/nd6_nbr.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Wed Aug 11 19:59:31 2010 (r211192) +++ head/sys/net/if.c Wed Aug 11 20:18:19 2010 (r211193) @@ -80,6 +80,7 @@ /*XXX*/ #include #include +#include #ifdef INET6 #include #include @@ -124,7 +125,22 @@ SX_SYSINIT(ifdescr_sx, &ifdescr_sx, "ifn void (*bstp_linkstate_p)(struct ifnet *ifp, int state); void (*ng_ether_link_state_p)(struct ifnet *ifp, int state); void (*lagg_linkstate_p)(struct ifnet *ifp, int state); +/* These are external hooks for CARP. */ void (*carp_linkstate_p)(struct ifnet *ifp); +#if defined(INET) || defined(INET6) +struct ifnet *(*carp_forus_p)(struct ifnet *ifp, u_char *dhost); +int (*carp_output_p)(struct ifnet *ifp, struct mbuf *m, + struct sockaddr *sa, struct rtentry *rt); +#endif +#ifdef INET +int (*carp_iamatch_p)(struct ifnet *, struct in_ifaddr *, struct in_addr *, + u_int8_t **); +#endif +#ifdef INET6 +struct ifaddr *(*carp_iamatch6_p)(struct ifnet *ifp, struct in6_addr *taddr6); +caddr_t (*carp_macmatch6_p)(struct ifnet *ifp, struct mbuf *m, + const struct in6_addr *taddr); +#endif struct mbuf *(*tbr_dequeue_ptr)(struct ifaltq *, int) = NULL; Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Wed Aug 11 19:59:31 2010 (r211192) +++ head/sys/net/if_bridge.c Wed Aug 11 20:18:19 2010 (r211193) @@ -2141,10 +2141,6 @@ drop: m_freem(m); } -#if defined(INET) || defined(INET6) -int (*carp_forus_p)(struct carp_if *, u_char *); -#endif - /* * bridge_input: * @@ -2256,10 +2252,10 @@ bridge_input(struct ifnet *ifp, struct m #if (defined(INET) || defined(INET6)) # define OR_CARP_CHECK_WE_ARE_DST(iface) \ || ((iface)->if_carp \ - && (*carp_forus_p)((iface)->if_carp, eh->ether_dhost)) + && (*carp_forus_p)((iface), eh->ether_dhost)) # define OR_CARP_CHECK_WE_ARE_SRC(iface) \ || ((iface)->if_carp \ - && (*carp_forus_p)((iface)->if_carp, eh->ether_shost)) + && (*carp_forus_p)((iface), eh->ether_shost)) #else # define OR_CARP_CHECK_WE_ARE_DST(iface) # define OR_CARP_CHECK_WE_ARE_SRC(iface) Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Wed Aug 11 19:59:31 2010 (r211192) +++ head/sys/net/if_ethersubr.c Wed Aug 11 20:18:19 2010 (r211193) @@ -114,11 +114,6 @@ void (*ng_ether_attach_p)(struct ifnet * void (*ng_ether_detach_p)(struct ifnet *ifp); void (*vlan_input_p)(struct ifnet *, struct mbuf *); -#if defined(INET) || defined(INET6) -int (*carp_forus_p)(struct ifnet *, u_char *); -int (*carp_output_p)(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); -#endif /* if_bridge(4) support */ struct mbuf *(*bridge_input_p)(struct ifnet *, struct mbuf *); Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Wed Aug 11 19:59:31 2010 (r211192) +++ head/sys/netinet/if_ether.c Wed Aug 11 20:18:19 2010 (r211193) @@ -64,6 +64,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#if defined(INET) || defined(INET6) +#include +#endif #include #include @@ -118,10 +121,6 @@ static void arptimer(void *); #ifdef INET static void in_arpinput(struct mbuf *); #endif -#if defined(INET) || defined(INET6) -int (*carp_iamatch_p)(struct ifnet *, struct in_ifaddr *, struct in_addr *, - u_int8_t **); -#endif static const struct netisr_handler arp_nh = { .nh_name = "arp", Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Wed Aug 11 19:59:31 2010 (r211192) +++ head/sys/netinet/ip_carp.c Wed Aug 11 20:18:19 2010 (r211193) @@ -135,26 +135,6 @@ struct carp_softc { }; #define SC2IFP(sc) ((sc)->sc_ifp) -/* These are external networking stack hooks for CARP */ -/* net/if.c */ -extern void (*carp_linkstate_p)(struct ifnet *); -/* net/if_bridge.c net/if_ethersubr.c */ -extern struct ifnet *(*carp_forus_p)(struct ifnet *, u_char *); -/* net/if_ethersubr.c */ -extern int (*carp_output_p)(struct ifnet *, struct mbuf *, - struct sockaddr *, struct rtentry *); -#ifdef INET -/* netinet/if_ether.c */ -extern int (*carp_iamatch_p)(struct ifnet *, struct in_ifaddr *, - struct in_addr *, u_int8_t **); -#endif -#ifdef INET6 -/* netinet6/nd6_nbr.c */ -extern struct ifaddr *(*carp_iamatch6_p)(struct ifnet *, struct in6_addr *); -extern caddr_t (*carp_macmatch6_p)(struct ifnet *, struct mbuf *, - const struct in6_addr *); -#endif - int carp_suppress_preempt = 0; int carp_opts[CARPCTL_MAXID] = { 0, 1, 0, 1, 0, 0 }; /* XXX for now */ SYSCTL_NODE(_net_inet, IPPROTO_CARP, carp, CTLFLAG_RW, 0, "CARP"); Modified: head/sys/netinet/ip_carp.h ============================================================================== --- head/sys/netinet/ip_carp.h Wed Aug 11 19:59:31 2010 (r211192) +++ head/sys/netinet/ip_carp.h Wed Aug 11 20:18:19 2010 (r211193) @@ -167,5 +167,25 @@ int carp_iamatch (struct ifnet *, stru struct ifaddr *carp_iamatch6(struct ifnet *, struct in6_addr *); caddr_t carp_macmatch6(struct ifnet *, struct mbuf *, const struct in6_addr *); struct ifnet *carp_forus (struct ifnet *, u_char *); + +/* These are external networking stack hooks for CARP */ +/* net/if.c */ +extern void (*carp_linkstate_p)(struct ifnet *); +/* net/if_bridge.c net/if_ethersubr.c */ +extern struct ifnet *(*carp_forus_p)(struct ifnet *, u_char *); +/* net/if_ethersubr.c */ +extern int (*carp_output_p)(struct ifnet *, struct mbuf *, + struct sockaddr *, struct rtentry *); +#ifdef INET +/* netinet/if_ether.c */ +extern int (*carp_iamatch_p)(struct ifnet *, struct in_ifaddr *, + struct in_addr *, u_int8_t **); +#endif +#ifdef INET6 +/* netinet6/nd6_nbr.c */ +extern struct ifaddr *(*carp_iamatch6_p)(struct ifnet *, struct in6_addr *); +extern caddr_t (*carp_macmatch6_p)(struct ifnet *, struct mbuf *, + const struct in6_addr *); +#endif #endif #endif /* _IP_CARP_H */ Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Wed Aug 11 19:59:31 2010 (r211192) +++ head/sys/netinet6/nd6_nbr.c Wed Aug 11 20:18:19 2010 (r211193) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define SDL(s) ((struct sockaddr_dl *)s) @@ -84,10 +85,6 @@ static void nd6_dad_ns_output(struct dad static void nd6_dad_ns_input(struct ifaddr *); static void nd6_dad_na_input(struct ifaddr *); -struct ifaddr *(*carp_iamatch6_p)(struct ifnet *, struct in6_addr *); -caddr_t (*carp_macmatch6_p)(struct ifnet *, struct mbuf *, - const struct in6_addr *); - VNET_DEFINE(int, dad_ignore_ns) = 0; /* ignore NS in DAD - specwise incorrect*/ VNET_DEFINE(int, dad_maxtry) = 15; /* max # of *tries* to transmit DAD packet */ #define V_dad_ignore_ns VNET(dad_ignore_ns) From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 22:10:38 2010 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 22604106564A; Wed, 11 Aug 2010 22:10:38 +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 0EBB98FC08; Wed, 11 Aug 2010 22:10:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BMAcCa086727; Wed, 11 Aug 2010 22:10:38 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BMAbDl086720; Wed, 11 Aug 2010 22:10:37 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201008112210.o7BMAbDl086720@svn.freebsd.org> From: Matthew D Fleming Date: Wed, 11 Aug 2010 22:10: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: r211194 - in head: share/man/man9 sys/kern 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, 11 Aug 2010 22:10:38 -0000 Author: mdf Date: Wed Aug 11 22:10:37 2010 New Revision: 211194 URL: http://svn.freebsd.org/changeset/base/211194 Log: Rework memguard(9) to reserve significantly more KVA to detect use-after-free over a longer time. Also release the backing pages of a guarded allocation at free(9) time to reduce the overhead of using memguard(9). Allow setting and varying the malloc type at run-time. Add knobs to allow: - randomly guarding memory - adding un-backed KVA guard pages to detect underflow and overflow - a lower limit on the size of allocations that are guarded Reviewed by: alc Reviewed by: brueffer, Ulrich Spörlein (man page) Silence from: -arch Approved by: zml (mentor) MFC after: 1 month Modified: head/share/man/man9/memguard.9 head/sys/kern/kern_malloc.c head/sys/vm/memguard.c head/sys/vm/memguard.h head/sys/vm/vm_extern.h head/sys/vm/vm_kern.c Modified: head/share/man/man9/memguard.9 ============================================================================== --- head/share/man/man9/memguard.9 Wed Aug 11 20:18:19 2010 (r211193) +++ head/share/man/man9/memguard.9 Wed Aug 11 22:10:37 2010 (r211194) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 31, 2006 +.Dd August 2, 2010 .Dt MEMGUARD 9 .Os .Sh NAME @@ -41,54 +41,107 @@ multithreaded kernels where race conditi .Pp Currently, .Nm -can only take over +can take over .Fn malloc , .Fn realloc and .Fn free -for a particular malloc type. +for a single malloc type. +.Nm +can also guard all allocations larger than +.Dv PAGE_SIZE , +and can guard a random fraction of all allocations. +There is also a knob to prevent allocations smaller than a specified +size from being guarded, to limit memory waste. .Sh EXAMPLES To use .Nm -for memory type compiled into the kernel, one has to add the -following line to the +for a memory type, either add an entry to .Pa /boot/loader.conf : .Bd -literal -offset indent vm.memguard.desc= .Ed .Pp -Where -.Ar memory_type -is a short description of memory type to monitor. -The short description of memory type is the second argument to -.Xr MALLOC_DEFINE 9 , -so one has to find it in the kernel source. -.Pp -To use -.Nm -for memory type defined in a kernel module, one has to set +Or set the .Va vm.memguard.desc .Xr sysctl 8 -variable before loading the module: +variable at run-time: .Bd -literal -offset indent sysctl vm.memguard.desc= .Ed .Pp +Where +.Ar memory_type +is a short description of the memory type to monitor. +Only allocations from that +.Ar memory_type +made after +.Va vm.memguard.desc +is set will potentially be guarded. +If +.Va vm.memguard.desc +is modified at run-time then only allocations of the new +.Ar memory_type +will potentially be guarded once the +.Xr sysctl 8 +is set. +Existing guarded allocations will still be properly released by +.Xr free 9 . +.Pp +The short description of a +.Xr malloc 9 +type is the second argument to +.Xr MALLOC_DEFINE 9 , +so one has to find it in the kernel source. +.Pp The .Va vm.memguard.divisor -boot-time tunable is used to scale how much of -.Va kmem_map -one wants to allocate for -.Nm . -The default is 10, so -.Va kmem_size Ns /10 -bytes will be used. -The -.Va kmem_size -value can be obtained via the -.Va vm.kmem_size -.Xr sysctl 8 -variable. +boot-time tunable is used to scale how much of the system's physical +memory +.Nm +is allowed to consume. +The default is 10, so up to +.Va cnt.v_page_count Ns /10 +pages can be used. +.Nm +will reserve +.Va vm_kmem_max +/ +.Va vm.memguard.divisor +bytes of virtual address space, limited by twice the physical memory +size. +The physical limit is reported as +.Va vm.memguard.phys_limit +and the virtual space reserved for +.Nm +is reported as +.Va vm.memguard.mapsize . +.Pp +.Nm +will not do page promotions for any allocation smaller than +.Va vm.memguard.minsize +bytes. +The default is 0, meaning all allocations can potentially be guarded. +.Nm +can guard sufficiently large allocations randomly, with average +frequency of every one in 100000 / +.Va vm.memguard.frequency +allocations. +The default is 0, meaning no allocations are randomly guarded. +.Pp +.Nm +can optionally add unmapped guard pages around each allocation to +detect overflow and underflow, if +.Va vm.memguard.options +has the 1 bit set. +This option is enabled by default. +.Nm +will optionally guard all allocations of +.Dv PAGE_SIZE +or larger if +.Va vm.memguard.options +has the 2 bit set. +This option is off by default. .Sh SEE ALSO .Xr sysctl 8 , .Xr vmstat 8 , @@ -102,10 +155,13 @@ first appeared in .Sh AUTHORS .An -nosplit .Nm -was written by +was originally written by .An Bosko Milekic Aq bmilekic@FreeBSD.org . -This manual page was written by +This manual page was originally written by .An Christian Brueffer Aq brueffer@FreeBSD.org . +Additions have been made by +.An Matthew Fleming Aq mdf@FreeBSD.org +to both the implementation and the documentation. .Sh BUGS Currently, it is not possible to override UMA .Xr zone 9 Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Wed Aug 11 20:18:19 2010 (r211193) +++ head/sys/kern/kern_malloc.c Wed Aug 11 22:10:37 2010 (r211194) @@ -427,8 +427,12 @@ malloc(unsigned long size, struct malloc ("malloc(M_WAITOK) in interrupt context")); #ifdef DEBUG_MEMGUARD - if (memguard_cmp(mtp)) - return memguard_alloc(size, flags); + if (memguard_cmp(mtp, size)) { + va = memguard_alloc(size, flags); + if (va != NULL) + return (va); + /* This is unfortunate but should not be fatal. */ + } #endif #ifdef DEBUG_REDZONE @@ -493,7 +497,7 @@ free(void *addr, struct malloc_type *mtp return; #ifdef DEBUG_MEMGUARD - if (memguard_cmp(mtp)) { + if (is_memguard_addr(addr)) { memguard_free(addr); return; } @@ -562,10 +566,11 @@ realloc(void *addr, unsigned long size, */ #ifdef DEBUG_MEMGUARD -if (memguard_cmp(mtp)) { - slab = NULL; - alloc = size; -} else { + if (is_memguard_addr(addr)) { + slab = NULL; + alloc = size; + goto remalloc; + } #endif #ifdef DEBUG_REDZONE @@ -591,7 +596,7 @@ if (memguard_cmp(mtp)) { #endif /* !DEBUG_REDZONE */ #ifdef DEBUG_MEMGUARD -} +remalloc: #endif /* Allocate a new, bigger (or smaller) block */ @@ -625,7 +630,7 @@ static void kmeminit(void *dummy) { uint8_t indx; - u_long mem_size; + u_long mem_size, tmp; int i; mtx_init(&malloc_mtx, "malloc", NULL, MTX_DEF); @@ -685,8 +690,13 @@ kmeminit(void *dummy) */ init_param3(vm_kmem_size / PAGE_SIZE); +#ifdef DEBUG_MEMGUARD + tmp = memguard_fudge(vm_kmem_size, vm_kmem_size_max); +#else + tmp = vm_kmem_size; +#endif kmem_map = kmem_suballoc(kernel_map, &kmembase, &kmemlimit, - vm_kmem_size, TRUE); + tmp, TRUE); kmem_map->system_map = 1; #ifdef DEBUG_MEMGUARD @@ -695,14 +705,7 @@ kmeminit(void *dummy) * replacement allocator used for detecting tamper-after-free * scenarios as they occur. It is only used for debugging. */ - vm_memguard_divisor = 10; - TUNABLE_INT_FETCH("vm.memguard.divisor", &vm_memguard_divisor); - - /* Pick a conservative value if provided value sucks. */ - if ((vm_memguard_divisor <= 0) || - ((vm_kmem_size / vm_memguard_divisor) == 0)) - vm_memguard_divisor = 10; - memguard_init(kmem_map, vm_kmem_size / vm_memguard_divisor); + memguard_init(kmem_map); #endif uma_startup2(); Modified: head/sys/vm/memguard.c ============================================================================== --- head/sys/vm/memguard.c Wed Aug 11 20:18:19 2010 (r211193) +++ head/sys/vm/memguard.c Wed Aug 11 22:10:37 2010 (r211194) @@ -1,6 +1,7 @@ /*- - * Copyright (c) 2005, - * Bosko Milekic . All rights reserved. + * Copyright (c) 2005, Bosko Milekic . + * Copyright (c) 2010 Isilon Systems, Inc. (http://www.isilon.com/) + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -47,26 +48,22 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include +#include #include #include -/* - * The maximum number of pages allowed per allocation. If you're using - * MemGuard to override very large items (> MAX_PAGES_PER_ITEM in size), - * you need to increase MAX_PAGES_PER_ITEM. - */ -#define MAX_PAGES_PER_ITEM 64 - SYSCTL_NODE(_vm, OID_AUTO, memguard, CTLFLAG_RW, NULL, "MemGuard data"); /* * The vm_memguard_divisor variable controls how much of kmem_map should be * reserved for MemGuard. */ -u_int vm_memguard_divisor; -SYSCTL_UINT(_vm_memguard, OID_AUTO, divisor, CTLFLAG_RD, &vm_memguard_divisor, +static u_int vm_memguard_divisor; +SYSCTL_UINT(_vm_memguard, OID_AUTO, divisor, CTLFLAG_RDTUN, + &vm_memguard_divisor, 0, "(kmem_size/memguard_divisor) == memguard submap size"); /* @@ -78,233 +75,343 @@ TUNABLE_STR("vm.memguard.desc", vm_memgu static int memguard_sysctl_desc(SYSCTL_HANDLER_ARGS) { - struct malloc_type_internal *mtip; - struct malloc_type_stats *mtsp; - struct malloc_type *mtp; - char desc[128]; - long bytes; - int error, i; + char desc[sizeof(vm_memguard_desc)]; + int error; strlcpy(desc, vm_memguard_desc, sizeof(desc)); error = sysctl_handle_string(oidp, desc, sizeof(desc), req); if (error != 0 || req->newptr == NULL) return (error); + mtx_lock(&malloc_mtx); /* - * We can change memory type when no memory has been allocated for it - * or when there is no such memory type yet (ie. it will be loaded with - * kernel module). + * If mtp is NULL, it will be initialized in memguard_cmp(). */ - bytes = 0; - mtx_lock(&malloc_mtx); - mtp = malloc_desc2type(desc); - if (mtp != NULL) { - mtip = mtp->ks_handle; - for (i = 0; i < MAXCPU; i++) { - mtsp = &mtip->mti_stats[i]; - bytes += mtsp->mts_memalloced; - bytes -= mtsp->mts_memfreed; - } - } - if (bytes > 0) - error = EBUSY; - else { - /* - * If mtp is NULL, it will be initialized in memguard_cmp(). - */ - vm_memguard_mtype = mtp; - strlcpy(vm_memguard_desc, desc, sizeof(vm_memguard_desc)); - } + vm_memguard_mtype = malloc_desc2type(desc); + strlcpy(vm_memguard_desc, desc, sizeof(vm_memguard_desc)); mtx_unlock(&malloc_mtx); return (error); } -SYSCTL_PROC(_vm_memguard, OID_AUTO, desc, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, +SYSCTL_PROC(_vm_memguard, OID_AUTO, desc, + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, memguard_sysctl_desc, "A", "Short description of memory type to monitor"); -/* - * Global MemGuard data. - */ -static vm_map_t memguard_map; -static unsigned long memguard_mapsize; -static unsigned long memguard_mapused; -struct memguard_entry { - STAILQ_ENTRY(memguard_entry) entries; - void *ptr; -}; -static struct memguard_fifo { - struct memguard_entry *stqh_first; - struct memguard_entry **stqh_last; - int index; -} memguard_fifo_pool[MAX_PAGES_PER_ITEM]; +static vm_map_t memguard_map = NULL; +static vm_offset_t memguard_cursor; +static vm_size_t memguard_mapsize; +static vm_size_t memguard_physlimit; +static u_long memguard_wasted; +static u_long memguard_wrap; +static u_long memguard_succ; +static u_long memguard_fail_kva; +static u_long memguard_fail_pgs; + +SYSCTL_ULONG(_vm_memguard, OID_AUTO, cursor, CTLFLAG_RD, + &memguard_cursor, 0, "MemGuard cursor"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, mapsize, CTLFLAG_RD, + &memguard_mapsize, 0, "MemGuard private vm_map size"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, phys_limit, CTLFLAG_RD, + &memguard_physlimit, 0, "Limit on MemGuard memory consumption"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, wasted, CTLFLAG_RD, + &memguard_wasted, 0, "Excess memory used through page promotion"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, wrapcnt, CTLFLAG_RD, + &memguard_wrap, 0, "MemGuard cursor wrap count"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, numalloc, CTLFLAG_RD, + &memguard_succ, 0, "Count of successful MemGuard allocations"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, fail_kva, CTLFLAG_RD, + &memguard_fail_kva, 0, "MemGuard failures due to lack of KVA"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, fail_pgs, CTLFLAG_RD, + &memguard_fail_pgs, 0, "MemGuard failures due to lack of pages"); + +#define MG_GUARD 0x001 +#define MG_ALLLARGE 0x002 +static int memguard_options = MG_GUARD; +TUNABLE_INT("vm.memguard.options", &memguard_options); +SYSCTL_INT(_vm_memguard, OID_AUTO, options, CTLFLAG_RW, + &memguard_options, 0, + "MemGuard options:\n" + "\t0x001 - add guard pages around each allocation\n" + "\t0x002 - always use MemGuard for allocations over a page"); + +static u_int memguard_minsize; +static u_long memguard_minsize_reject; +SYSCTL_UINT(_vm_memguard, OID_AUTO, minsize, CTLFLAG_RW, + &memguard_minsize, 0, "Minimum size for page promotion"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, minsize_reject, CTLFLAG_RD, + &memguard_minsize_reject, 0, "# times rejected for size"); + +static u_int memguard_frequency; +static u_long memguard_frequency_hits; +TUNABLE_INT("vm.memguard.frequency", &memguard_frequency); +SYSCTL_UINT(_vm_memguard, OID_AUTO, frequency, CTLFLAG_RW, + &memguard_frequency, 0, "Times in 100000 that MemGuard will randomly run"); +SYSCTL_ULONG(_vm_memguard, OID_AUTO, frequency_hits, CTLFLAG_RD, + &memguard_frequency_hits, 0, "# times MemGuard randomly chose"); -/* - * Local prototypes. - */ -static void memguard_guard(void *addr, int numpgs); -static void memguard_unguard(void *addr, int numpgs); -static struct memguard_fifo *vtomgfifo(vm_offset_t va); -static void vsetmgfifo(vm_offset_t va, struct memguard_fifo *mgfifo); -static void vclrmgfifo(vm_offset_t va); /* - * Local macros. MemGuard data is global, so replace these with whatever - * your system uses to protect global data (if it is kernel-level - * parallelized). This is for porting among BSDs. + * Return a fudged value to be used for vm_kmem_size for allocating + * the kmem_map. The memguard memory will be a submap. */ -#define MEMGUARD_CRIT_SECTION_DECLARE static struct mtx memguard_mtx -#define MEMGUARD_CRIT_SECTION_INIT \ - mtx_init(&memguard_mtx, "MemGuard mtx", NULL, MTX_DEF) -#define MEMGUARD_CRIT_SECTION_ENTER mtx_lock(&memguard_mtx) -#define MEMGUARD_CRIT_SECTION_EXIT mtx_unlock(&memguard_mtx) -MEMGUARD_CRIT_SECTION_DECLARE; +unsigned long +memguard_fudge(unsigned long km_size, unsigned long km_max) +{ + u_long mem_pgs = cnt.v_page_count; + + vm_memguard_divisor = 10; + TUNABLE_INT_FETCH("vm.memguard.divisor", &vm_memguard_divisor); + + /* Pick a conservative value if provided value sucks. */ + if ((vm_memguard_divisor <= 0) || + ((km_size / vm_memguard_divisor) == 0)) + vm_memguard_divisor = 10; + /* + * Limit consumption of physical pages to + * 1/vm_memguard_divisor of system memory. If the KVA is + * smaller than this then the KVA limit comes into play first. + * This prevents memguard's page promotions from completely + * using up memory, since most malloc(9) calls are sub-page. + */ + memguard_physlimit = (mem_pgs / vm_memguard_divisor) * PAGE_SIZE; + /* + * We want as much KVA as we can take safely. Use at most our + * allotted fraction of kmem_max. Limit this to twice the + * physical memory to avoid using too much memory as pagetable + * pages. + */ + memguard_mapsize = km_max / vm_memguard_divisor; + /* size must be multiple of PAGE_SIZE */ + memguard_mapsize = round_page(memguard_mapsize); + if (memguard_mapsize / (2 * PAGE_SIZE) > mem_pgs) + memguard_mapsize = mem_pgs * 2 * PAGE_SIZE; + if (km_size + memguard_mapsize > km_max) + return (km_max); + return (km_size + memguard_mapsize); +} /* * Initialize the MemGuard mock allocator. All objects from MemGuard come * out of a single VM map (contiguous chunk of address space). */ void -memguard_init(vm_map_t parent_map, unsigned long size) +memguard_init(vm_map_t parent_map) { - char *base, *limit; - int i; - - /* size must be multiple of PAGE_SIZE */ - size /= PAGE_SIZE; - size++; - size *= PAGE_SIZE; + vm_offset_t base, limit; - memguard_map = kmem_suballoc(parent_map, (vm_offset_t *)&base, - (vm_offset_t *)&limit, (vm_size_t)size, FALSE); + memguard_map = kmem_suballoc(parent_map, &base, &limit, + memguard_mapsize, FALSE); memguard_map->system_map = 1; - memguard_mapsize = size; - memguard_mapused = 0; - - MEMGUARD_CRIT_SECTION_INIT; - MEMGUARD_CRIT_SECTION_ENTER; - for (i = 0; i < MAX_PAGES_PER_ITEM; i++) { - STAILQ_INIT(&memguard_fifo_pool[i]); - memguard_fifo_pool[i].index = i; - } - MEMGUARD_CRIT_SECTION_EXIT; + KASSERT(memguard_mapsize == limit - base, + ("Expected %lu, got %lu", (u_long)memguard_mapsize, + (u_long)(limit - base))); + memguard_cursor = base; printf("MEMGUARD DEBUGGING ALLOCATOR INITIALIZED:\n"); - printf("\tMEMGUARD map base: %p\n", base); - printf("\tMEMGUARD map limit: %p\n", limit); - printf("\tMEMGUARD map size: %ld (Bytes)\n", size); + printf("\tMEMGUARD map base: 0x%lx\n", (u_long)base); + printf("\tMEMGUARD map limit: 0x%lx\n", (u_long)limit); + printf("\tMEMGUARD map size: %jd KBytes\n", + (uintmax_t)memguard_mapsize >> 10); +} + +/* + * Run things that can't be done as early as memguard_init(). + */ +static void +memguard_sysinit(void) +{ + struct sysctl_oid_list *parent; + + parent = SYSCTL_STATIC_CHILDREN(_vm_memguard); + + SYSCTL_ADD_ULONG(NULL, parent, OID_AUTO, "mapstart", CTLFLAG_RD, + &memguard_map->min_offset, "MemGuard KVA base"); + SYSCTL_ADD_ULONG(NULL, parent, OID_AUTO, "maplimit", CTLFLAG_RD, + &memguard_map->max_offset, "MemGuard KVA end"); + SYSCTL_ADD_ULONG(NULL, parent, OID_AUTO, "mapused", CTLFLAG_RD, + &memguard_map->size, "MemGuard KVA used"); +} +SYSINIT(memguard, SI_SUB_KLD, SI_ORDER_ANY, memguard_sysinit, NULL); + +/* + * v2sizep() converts a virtual address of the first page allocated for + * an item to a pointer to u_long recording the size of the original + * allocation request. + * + * This routine is very similar to those defined by UMA in uma_int.h. + * The difference is that this routine stores the originally allocated + * size in one of the page's fields that is unused when the page is + * wired rather than the object field, which is used. + */ +static u_long * +v2sizep(vm_offset_t va) +{ + struct vm_page *p; + + p = PHYS_TO_VM_PAGE(pmap_kextract(va)); + KASSERT(p->wire_count != 0 && p->queue == PQ_NONE, + ("MEMGUARD: Expected wired page %p in vtomgfifo!", p)); + return ((u_long *)&p->pageq.tqe_next); } /* - * Allocate a single object of specified size with specified flags (either - * M_WAITOK or M_NOWAIT). + * Allocate a single object of specified size with specified flags + * (either M_WAITOK or M_NOWAIT). */ void * -memguard_alloc(unsigned long size, int flags) +memguard_alloc(unsigned long req_size, int flags) { - void *obj; - struct memguard_entry *e = NULL; - int numpgs; - - numpgs = size / PAGE_SIZE; - if ((size % PAGE_SIZE) != 0) - numpgs++; - if (numpgs > MAX_PAGES_PER_ITEM) - panic("MEMGUARD: You must increase MAX_PAGES_PER_ITEM " \ - "in memguard.c (requested: %d pages)", numpgs); - if (numpgs == 0) - return NULL; + vm_offset_t addr; + u_long size_p, size_v; + int do_guard, rv; + + size_p = round_page(req_size); + if (size_p == 0) + return (NULL); + /* + * To ensure there are holes on both sides of the allocation, + * request 2 extra pages of KVA. We will only actually add a + * vm_map_entry and get pages for the original request. Save + * the value of memguard_options so we have a consistent + * value. + */ + size_v = size_p; + do_guard = (memguard_options & MG_GUARD) != 0; + if (do_guard) + size_v += 2 * PAGE_SIZE; + vm_map_lock(memguard_map); + /* + * When we pass our memory limit, reject sub-page allocations. + * Page-size and larger allocations will use the same amount + * of physical memory whether we allocate or hand off to + * uma_large_alloc(), so keep those. + */ + if (memguard_map->size >= memguard_physlimit && + req_size < PAGE_SIZE) { + addr = (vm_offset_t)NULL; + memguard_fail_pgs++; + goto out; + } /* - * If we haven't exhausted the memguard_map yet, allocate from - * it and grab a new page, even if we have recycled pages in our - * FIFO. This is because we wish to allow recycled pages to live - * guarded in the FIFO for as long as possible in order to catch - * even very late tamper-after-frees, even though it means that - * we end up wasting more memory, this is only a DEBUGGING allocator - * after all. + * Keep a moving cursor so we don't recycle KVA as long as + * possible. It's not perfect, since we don't know in what + * order previous allocations will be free'd, but it's simple + * and fast, and requires O(1) additional storage if guard + * pages are not used. + * + * XXX This scheme will lead to greater fragmentation of the + * map, unless vm_map_findspace() is tweaked. */ - MEMGUARD_CRIT_SECTION_ENTER; - if (memguard_mapused >= memguard_mapsize) { - e = STAILQ_FIRST(&memguard_fifo_pool[numpgs - 1]); - if (e != NULL) { - STAILQ_REMOVE(&memguard_fifo_pool[numpgs - 1], e, - memguard_entry, entries); - MEMGUARD_CRIT_SECTION_EXIT; - obj = e->ptr; - free(e, M_TEMP); - memguard_unguard(obj, numpgs); - if (flags & M_ZERO) - bzero(obj, PAGE_SIZE * numpgs); - return obj; + for (;;) { + rv = vm_map_findspace(memguard_map, memguard_cursor, + size_v, &addr); + if (rv == KERN_SUCCESS) + break; + /* + * The map has no space. This may be due to + * fragmentation, or because the cursor is near the + * end of the map. + */ + if (memguard_cursor == vm_map_min(memguard_map)) { + memguard_fail_kva++; + addr = (vm_offset_t)NULL; + goto out; } - MEMGUARD_CRIT_SECTION_EXIT; - if (flags & M_WAITOK) - panic("MEMGUARD: Failed with M_WAITOK: " \ - "memguard_map too small"); - return NULL; + memguard_wrap++; + memguard_cursor = vm_map_min(memguard_map); } - memguard_mapused += (PAGE_SIZE * numpgs); - MEMGUARD_CRIT_SECTION_EXIT; - - obj = (void *)kmem_malloc(memguard_map, PAGE_SIZE * numpgs, flags); - if (obj != NULL) { - vsetmgfifo((vm_offset_t)obj, &memguard_fifo_pool[numpgs - 1]); - if (flags & M_ZERO) - bzero(obj, PAGE_SIZE * numpgs); - } else { - MEMGUARD_CRIT_SECTION_ENTER; - memguard_mapused -= (PAGE_SIZE * numpgs); - MEMGUARD_CRIT_SECTION_EXIT; + if (do_guard) + addr += PAGE_SIZE; + rv = kmem_back(memguard_map, addr, size_p, flags); + if (rv != KERN_SUCCESS) { + memguard_fail_pgs++; + addr = (vm_offset_t)NULL; + goto out; + } + memguard_cursor = addr + size_p; + *v2sizep(trunc_page(addr)) = req_size; + memguard_succ++; + if (req_size < PAGE_SIZE) { + memguard_wasted += (PAGE_SIZE - req_size); + if (do_guard) { + /* + * Align the request to 16 bytes, and return + * an address near the end of the page, to + * better detect array overrun. + */ + req_size = roundup2(req_size, 16); + addr += (PAGE_SIZE - req_size); + } } - return obj; +out: + vm_map_unlock(memguard_map); + return ((void *)addr); +} + +int +is_memguard_addr(void *addr) +{ + vm_offset_t a = (vm_offset_t)(uintptr_t)addr; + + return (a >= memguard_map->min_offset && a < memguard_map->max_offset); } /* * Free specified single object. */ void -memguard_free(void *addr) +memguard_free(void *ptr) { - struct memguard_entry *e; - struct memguard_fifo *mgfifo; - int idx; - int *temp; + vm_offset_t addr; + u_long req_size, size; + char *temp; + int i; - addr = (void *)trunc_page((unsigned long)addr); + addr = trunc_page((uintptr_t)ptr); + req_size = *v2sizep(addr); + size = round_page(req_size); /* - * Page should not be guarded by now, so force a write. - * The purpose of this is to increase the likelihood of catching a - * double-free, but not necessarily a tamper-after-free (the second - * thread freeing might not write before freeing, so this forces it - * to and, subsequently, trigger a fault). + * Page should not be guarded right now, so force a write. + * The purpose of this is to increase the likelihood of + * catching a double-free, but not necessarily a + * tamper-after-free (the second thread freeing might not + * write before freeing, so this forces it to and, + * subsequently, trigger a fault). */ - temp = (int *)((unsigned long)addr + (PAGE_SIZE/2)); /* in page */ - *temp = 0xd34dc0d3; + temp = ptr; + for (i = 0; i < size; i += PAGE_SIZE) + temp[i] = 'M'; - mgfifo = vtomgfifo((vm_offset_t)addr); - idx = mgfifo->index; - memguard_guard(addr, idx + 1); - e = malloc(sizeof(struct memguard_entry), M_TEMP, M_NOWAIT); - if (e == NULL) { - MEMGUARD_CRIT_SECTION_ENTER; - memguard_mapused -= (PAGE_SIZE * (idx + 1)); - MEMGUARD_CRIT_SECTION_EXIT; - memguard_unguard(addr, idx + 1); /* just in case */ - vclrmgfifo((vm_offset_t)addr); - kmem_free(memguard_map, (vm_offset_t)addr, - PAGE_SIZE * (idx + 1)); - return; - } - e->ptr = addr; - MEMGUARD_CRIT_SECTION_ENTER; - STAILQ_INSERT_TAIL(mgfifo, e, entries); - MEMGUARD_CRIT_SECTION_EXIT; + /* + * This requires carnal knowledge of the implementation of + * kmem_free(), but since we've already replaced kmem_malloc() + * above, it's not really any worse. We want to use the + * vm_map lock to serialize updates to memguard_wasted, since + * we had the lock at increment. + */ + vm_map_lock(memguard_map); + if (req_size < PAGE_SIZE) + memguard_wasted -= (PAGE_SIZE - req_size); + (void)vm_map_delete(memguard_map, addr, addr + size); + vm_map_unlock(memguard_map); } int -memguard_cmp(struct malloc_type *mtp) +memguard_cmp(struct malloc_type *mtp, unsigned long size) { + if (size < memguard_minsize) { + memguard_minsize_reject++; + return (0); + } + if ((memguard_options & MG_ALLLARGE) != 0 && size >= PAGE_SIZE) + return (1); + if (memguard_frequency > 0 && + (random() % 100000) < memguard_frequency) { + memguard_frequency_hits++; + return (1); + } #if 1 /* * The safest way of comparsion is to always compare short description @@ -328,78 +435,3 @@ memguard_cmp(struct malloc_type *mtp) return (0); #endif } - -/* - * Guard a page containing specified object (make it read-only so that - * future writes to it fail). - */ -static void -memguard_guard(void *addr, int numpgs) -{ - void *a = (void *)trunc_page((unsigned long)addr); - if (vm_map_protect(memguard_map, (vm_offset_t)a, - (vm_offset_t)((unsigned long)a + (PAGE_SIZE * numpgs)), - VM_PROT_READ, FALSE) != KERN_SUCCESS) - panic("MEMGUARD: Unable to guard page!"); -} - -/* - * Unguard a page containing specified object (make it read-and-write to - * allow full data access). - */ -static void -memguard_unguard(void *addr, int numpgs) -{ - void *a = (void *)trunc_page((unsigned long)addr); - if (vm_map_protect(memguard_map, (vm_offset_t)a, - (vm_offset_t)((unsigned long)a + (PAGE_SIZE * numpgs)), - VM_PROT_DEFAULT, FALSE) != KERN_SUCCESS) - panic("MEMGUARD: Unable to unguard page!"); -} - -/* - * vtomgfifo() converts a virtual address of the first page allocated for - * an item to a memguard_fifo_pool reference for the corresponding item's - * size. - * - * vsetmgfifo() sets a reference in an underlying page for the specified - * virtual address to an appropriate memguard_fifo_pool. - * - * These routines are very similar to those defined by UMA in uma_int.h. - * The difference is that these routines store the mgfifo in one of the - * page's fields that is unused when the page is wired rather than the - * object field, which is used. - */ -static struct memguard_fifo * -vtomgfifo(vm_offset_t va) -{ - vm_page_t p; - struct memguard_fifo *mgfifo; - - p = PHYS_TO_VM_PAGE(pmap_kextract(va)); - KASSERT(p->wire_count != 0 && p->queue == PQ_NONE, - ("MEMGUARD: Expected wired page in vtomgfifo!")); - mgfifo = (struct memguard_fifo *)p->pageq.tqe_next; - return mgfifo; -} - -static void -vsetmgfifo(vm_offset_t va, struct memguard_fifo *mgfifo) -{ - vm_page_t p; - - p = PHYS_TO_VM_PAGE(pmap_kextract(va)); - KASSERT(p->wire_count != 0 && p->queue == PQ_NONE, - ("MEMGUARD: Expected wired page in vsetmgfifo!")); - p->pageq.tqe_next = (vm_page_t)mgfifo; -} - -static void vclrmgfifo(vm_offset_t va) -{ - vm_page_t p; - - p = PHYS_TO_VM_PAGE(pmap_kextract(va)); - KASSERT(p->wire_count != 0 && p->queue == PQ_NONE, - ("MEMGUARD: Expected wired page in vclrmgfifo!")); - p->pageq.tqe_next = NULL; -} Modified: head/sys/vm/memguard.h ============================================================================== --- head/sys/vm/memguard.h Wed Aug 11 20:18:19 2010 (r211193) +++ head/sys/vm/memguard.h Wed Aug 11 22:10:37 2010 (r211194) @@ -26,9 +26,20 @@ * $FreeBSD$ */ -extern u_int vm_memguard_divisor; +#include "opt_vm.h" -void memguard_init(vm_map_t parent_map, unsigned long size); -void *memguard_alloc(unsigned long size, int flags); -void memguard_free(void *addr); -int memguard_cmp(struct malloc_type *mtp); +#ifdef DEBUG_MEMGUARD +unsigned long memguard_fudge(unsigned long, unsigned long); +void memguard_init(struct vm_map *); +void *memguard_alloc(unsigned long, int); +void memguard_free(void *); +int memguard_cmp(struct malloc_type *, unsigned long); +int is_memguard_addr(void *); +#else +#define memguard_fudge(size, xxx) (size) +#define memguard_init(map) do { } while (0) +#define memguard_alloc(size, flags) NULL +#define memguard_free(addr) do { } while (0) +#define memguard_cmp(mtp, size) 0 +#define is_memguard_addr(addr) 0 +#endif Modified: head/sys/vm/vm_extern.h ============================================================================== --- head/sys/vm/vm_extern.h Wed Aug 11 20:18:19 2010 (r211193) +++ head/sys/vm/vm_extern.h Wed Aug 11 22:10:37 2010 (r211194) @@ -53,6 +53,7 @@ void kmem_free(vm_map_t, vm_offset_t, vm void kmem_free_wakeup(vm_map_t, vm_offset_t, vm_size_t); void kmem_init(vm_offset_t, vm_offset_t); vm_offset_t kmem_malloc(vm_map_t map, vm_size_t size, int flags); +int kmem_back(vm_map_t, vm_offset_t, vm_size_t, int); vm_map_t kmem_suballoc(vm_map_t, vm_offset_t *, vm_offset_t *, vm_size_t, boolean_t); void swapout_procs(int); Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Wed Aug 11 20:18:19 2010 (r211193) +++ head/sys/vm/vm_kern.c Wed Aug 11 22:10:37 2010 (r211194) @@ -301,11 +301,8 @@ kmem_malloc(map, size, flags) vm_size_t size; int flags; { - vm_offset_t offset, i; - vm_map_entry_t entry; vm_offset_t addr; - vm_page_t m; - int pflags; + int i, rv; size = round_page(size); addr = vm_map_min(map); @@ -338,6 +335,30 @@ kmem_malloc(map, size, flags) return (0); } } + + rv = kmem_back(map, addr, size, flags); + vm_map_unlock(map); + return (rv == KERN_SUCCESS ? addr : 0); +} + +/* + * kmem_back: + * + * Allocate physical pages for the specified virtual address range. + */ +int +kmem_back(vm_map_t map, vm_offset_t addr, vm_size_t size, int flags) +{ + vm_offset_t offset, i; + vm_map_entry_t entry; + vm_page_t m; + int pflags; + + /* + * XXX the map must be locked for write on entry, but there's + * no easy way to assert that. + */ + offset = addr - VM_MIN_KERNEL_ADDRESS; vm_object_reference(kmem_object); vm_map_insert(map, kmem_object, offset, addr, addr + size, @@ -385,8 +406,7 @@ retry: } VM_OBJECT_UNLOCK(kmem_object); vm_map_delete(map, addr, addr + size); - vm_map_unlock(map); - return (0); + return (KERN_NO_SPACE); } if (flags & M_ZERO && (m->flags & PG_ZERO) == 0) pmap_zero_page(m); @@ -429,9 +449,8 @@ retry: vm_page_wakeup(m); } VM_OBJECT_UNLOCK(kmem_object); - vm_map_unlock(map); - return (addr); + return (KERN_SUCCESS); } /* From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 23:21:26 2010 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 2AD2C106566C; Wed, 11 Aug 2010 23:21:26 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DCAF8FC14; Wed, 11 Aug 2010 23:21:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BNLPYG002441; Wed, 11 Aug 2010 23:21:25 GMT (envelope-from takawata@svn.freebsd.org) Received: (from takawata@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BNLPCM002438; Wed, 11 Aug 2010 23:21:25 GMT (envelope-from takawata@svn.freebsd.org) Message-Id: <201008112321.o7BNLPCM002438@svn.freebsd.org> From: Takanori Watanabe Date: Wed, 11 Aug 2010 23:21:25 +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: r211196 - head/usr.sbin/acpi/acpidump 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, 11 Aug 2010 23:21:26 -0000 Author: takawata Date: Wed Aug 11 23:21:25 2010 New Revision: 211196 URL: http://svn.freebsd.org/changeset/base/211196 Log: Add TCG ACPI spec table (TCPA) support. Submitted by: Hans-Joerg_Hoexer@genua.de Modified: head/usr.sbin/acpi/acpidump/acpi.c head/usr.sbin/acpi/acpidump/acpidump.h Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Wed Aug 11 22:44:10 2010 (r211195) +++ head/usr.sbin/acpi/acpidump/acpi.c Wed Aug 11 23:21:25 2010 (r211196) @@ -68,6 +68,7 @@ static void acpi_print_srat_cpu(uint32_t static void acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp); static void acpi_print_srat(ACPI_SUBTABLE_HEADER *srat); static void acpi_handle_srat(ACPI_TABLE_HEADER *sdp); +static void acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp); static void acpi_print_sdt(ACPI_TABLE_HEADER *sdp); static void acpi_print_fadt(ACPI_TABLE_HEADER *sdp); static void acpi_print_facs(ACPI_TABLE_FACS *facs); @@ -81,6 +82,46 @@ static void acpi_walk_subtables(ACPI_TAB /* Size of an address. 32-bit for ACPI 1.0, 64-bit for ACPI 2.0 and up. */ static int addr_size; +/* Strings used in the TCPA table */ +static const char *tcpa_event_type_strings[] = { + "PREBOOT Certificate", + "POST Code", + "Unused", + "No Action", + "Separator", + "Action", + "Event Tag", + "S-CRTM Contents", + "S-CRTM Version", + "CPU Microcode", + "Platform Config Flags", + "Table of Devices", + "Compact Hash", + "IPL", + "IPL Partition Data", + "Non-Host Code", + "Non-Host Config", + "Non-Host Info" +}; + +static const char *TCPA_pcclient_strings[] = { + "", + "SMBIOS", + "BIS Certificate", + "POST BIOS ROM Strings", + "ESCD", + "CMOS", + "NVRAM", + "Option ROM Execute", + "Option ROM Configurateion", + "", + "Option ROM Microcode Update ", + "S-CRTM Version String", + "S-CRTM Contents", + "POST Contents", + "Table of Devices", +}; + static void acpi_print_string(char *s, size_t length) { @@ -492,6 +533,165 @@ acpi_print_srat_cpu(uint32_t apic_id, ui printf("\tProximity Domain=%d\n", proximity_domain); } +static char * +acpi_tcpa_evname(struct TCPAevent *event) +{ + struct TCPApc_event *pc_event; + char *eventname = NULL; + + pc_event = (struct TCPApc_event *)(event + 1); + + switch(event->event_type) { + case PREBOOT: + case POST_CODE: + case UNUSED: + case NO_ACTION: + case SEPARATOR: + case SCRTM_CONTENTS: + case SCRTM_VERSION: + case CPU_MICROCODE: + case PLATFORM_CONFIG_FLAGS: + case TABLE_OF_DEVICES: + case COMPACT_HASH: + case IPL: + case IPL_PARTITION_DATA: + case NONHOST_CODE: + case NONHOST_CONFIG: + case NONHOST_INFO: + asprintf(&eventname, "%s", + tcpa_event_type_strings[event->event_type]); + break; + + case ACTION: + eventname = calloc(event->event_size + 1, sizeof(char)); + memcpy(eventname, pc_event, event->event_size); + break; + + case EVENT_TAG: + switch (pc_event->event_id) { + case SMBIOS: + case BIS_CERT: + case CMOS: + case NVRAM: + case OPTION_ROM_EXEC: + case OPTION_ROM_CONFIG: + case S_CRTM_VERSION: + case POST_BIOS_ROM: + case ESCD: + case OPTION_ROM_MICROCODE: + case S_CRTM_CONTENTS: + case POST_CONTENTS: + asprintf(&eventname, "%s", + TCPA_pcclient_strings[pc_event->event_id]); + break; + + default: + asprintf(&eventname, "", + pc_event->event_id); + break; + } + break; + + default: + asprintf(&eventname, "", event->event_type); + break; + } + + return eventname; +} + +static void +acpi_print_tcpa(struct TCPAevent *event) +{ + int i; + char *eventname; + + eventname = acpi_tcpa_evname(event); + + printf("\t%d", event->pcr_index); + printf(" 0x"); + for (i = 0; i < 20; i++) + printf("%02x", event->pcr_value[i]); + printf(" [%s]\n", eventname ? eventname : ""); + + free(eventname); +} + +static void +acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) +{ + struct TCPAbody *tcpa; + struct TCPAevent *event; + u_int64_t len, paddr; + unsigned char *vaddr = NULL; + unsigned char *vend = NULL; + + printf(BEGIN_COMMENT); + acpi_print_sdt(sdp); + tcpa = (struct TCPAbody *) sdp; + + switch (tcpa->platform_class) { + case ACPI_TCPA_BIOS_CLIENT: + len = tcpa->client.log_max_len; + paddr = tcpa->client.log_start_addr; + break; + + case ACPI_TCPA_BIOS_SERVER: + len = tcpa->server.log_max_len; + paddr = tcpa->server.log_start_addr; + break; + + default: + printf("XXX"); + printf(END_COMMENT); + return; + } + printf("\tClass %d Base Address 0x%jx Length %lld\n\n", + tcpa->platform_class, paddr, len); + + if (len == 0) { + printf("\tEmpty TCPA table\n"); + printf(END_COMMENT); + return; + } + + vaddr = (unsigned char *)acpi_map_physical(paddr, len); + vend = vaddr + len; + + while (vaddr != NULL) { + if (vaddr + sizeof(struct TCPAevent) >= vend) + break; + event = (struct TCPAevent *)vaddr; + if (vaddr + event->event_size >= vend) + break; + if (event->event_type == 0 && event->event_size == 0) + break; +#if 0 + { + unsigned int i, j, k; + + printf("\n\tsize %d\n\t\t%p ", event->event_size, vaddr); + for (j = 0, i = 0; i < + sizeof(struct TCPAevent) + event->event_size; i++) { + printf("%02x ", vaddr[i]); + if ((i+1) % 8 == 0) { + for (k = 0; k < 8; k++) + printf("%c", isprint(vaddr[j+k]) ? + vaddr[j+k] : '.'); + printf("\n\t\t%p ", &vaddr[i + 1]); + j = i + 1; + } + } + printf("\n"); } +#endif + acpi_print_tcpa(event); + + vaddr += sizeof(struct TCPAevent) + event->event_size; + } + + printf(END_COMMENT); +} + static void acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp) { @@ -886,6 +1086,8 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp acpi_handle_mcfg(sdp); else if (!memcmp(sdp->Signature, ACPI_SIG_SRAT, 4)) acpi_handle_srat(sdp); + else if (!memcmp(sdp->Signature, ACPI_SIG_TCPA, 4)) + acpi_handle_tcpa(sdp); else { printf(BEGIN_COMMENT); acpi_print_sdt(sdp); Modified: head/usr.sbin/acpi/acpidump/acpidump.h ============================================================================== --- head/usr.sbin/acpi/acpidump/acpidump.h Wed Aug 11 22:44:10 2010 (r211195) +++ head/usr.sbin/acpi/acpidump/acpidump.h Wed Aug 11 23:21:25 2010 (r211196) @@ -55,6 +55,78 @@ /* Find and map the RSD PTR structure and return it for parsing */ ACPI_TABLE_HEADER *sdt_load_devmem(void); +/* TCPA */ +struct TCPAbody { + ACPI_TABLE_HEADER header; + uint16_t platform_class; +#define ACPI_TCPA_BIOS_CLIENT 0x00 +#define ACPI_TCPA_BIOS_SERVER 0x01 + union { + struct client_hdr { + uint32_t log_max_len __packed; + uint64_t log_start_addr __packed; + } client; + struct server_hdr { + uint16_t reserved; + uint64_t log_max_len __packed; + uint64_t log_start_addr __packed; + } server; + }; +} __packed; + +struct TCPAevent { + u_int32_t pcr_index; + u_int32_t event_type; + u_int8_t pcr_value[20]; + u_int32_t event_size; + u_int8_t event_data[0]; +}; + +struct TCPApc_event { + u_int32_t event_id; + u_int32_t event_size; + u_int8_t event_data[0]; +}; + +enum TCPAevent_types { + PREBOOT = 0, + POST_CODE, + UNUSED, + NO_ACTION, + SEPARATOR, + ACTION, + EVENT_TAG, + SCRTM_CONTENTS, + SCRTM_VERSION, + CPU_MICROCODE, + PLATFORM_CONFIG_FLAGS, + TABLE_OF_DEVICES, + COMPACT_HASH, + IPL, + IPL_PARTITION_DATA, + NONHOST_CODE, + NONHOST_CONFIG, + NONHOST_INFO, + EVENT_TYPE_MAX, +}; + +enum TCPApcclient_ids { + SMBIOS = 1, + BIS_CERT, + POST_BIOS_ROM, + ESCD, + CMOS, + NVRAM, + OPTION_ROM_EXEC, + OPTION_ROM_CONFIG, + OPTION_ROM_MICROCODE = 10, + S_CRTM_VERSION, + S_CRTM_CONTENTS, + POST_CONTENTS, + HOST_TABLE_OF_DEVICES, + PCCLIENT_ID_MAX, +}; + /* * Load the DSDT from a previous save file. Note that other tables are * not saved (i.e. FADT) From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 23:22:54 2010 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 4A2CA1065675; Wed, 11 Aug 2010 23:22:54 +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 361468FC12; Wed, 11 Aug 2010 23:22:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BNMsA1002831; Wed, 11 Aug 2010 23:22:54 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BNMr8X002816; Wed, 11 Aug 2010 23:22:53 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201008112322.o7BNMr8X002816@svn.freebsd.org> From: John Baldwin Date: Wed, 11 Aug 2010 23:22: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: r211197 - in head/sys: amd64/amd64 arm/include i386/i386 i386/xen mips/include powerpc/include sparc64/include sparc64/sparc64 sun4v/include sun4v/sun4v 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, 11 Aug 2010 23:22:54 -0000 Author: jhb Date: Wed Aug 11 23:22:53 2010 New Revision: 211197 URL: http://svn.freebsd.org/changeset/base/211197 Log: Update various places that store or manipulate CPU masks to use cpumask_t instead of int or u_int. Since cpumask_t is currently u_int on all platforms this should just be a cosmetic change. Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/vm_machdep.c head/sys/arm/include/pmap.h head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/vm_machdep.c head/sys/i386/xen/pmap.c head/sys/mips/include/pmap.h head/sys/powerpc/include/pmap.h head/sys/sparc64/include/pmap.h head/sys/sparc64/include/smp.h head/sys/sparc64/sparc64/mp_machdep.c head/sys/sun4v/include/smp.h head/sys/sun4v/sun4v/mp_machdep.c head/sys/sun4v/sun4v/pmap.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/amd64/amd64/mp_machdep.c Wed Aug 11 23:22:53 2010 (r211197) @@ -1053,7 +1053,7 @@ smp_targeted_tlb_shootdown(cpumask_t mas int ncpu, othercpus; othercpus = mp_ncpus - 1; - if (mask == (u_int)-1) { + if (mask == (cpumask_t)-1) { ncpu = othercpus; if (ncpu < 1) return; @@ -1078,7 +1078,7 @@ smp_targeted_tlb_shootdown(cpumask_t mas smp_tlb_addr1 = addr1; smp_tlb_addr2 = addr2; atomic_store_rel_int(&smp_tlb_wait, 0); - if (mask == (u_int)-1) + if (mask == (cpumask_t)-1) ipi_all_but_self(vector); else ipi_selected(mask, vector); @@ -1549,9 +1549,11 @@ mp_grab_cpu_hlt(void) mask = PCPU_GET(cpumask); #endif - retval = mask & hlt_cpus_mask; - while (mask & hlt_cpus_mask) + retval = 0; + while (mask & hlt_cpus_mask) { + retval = 1; __asm __volatile("sti; hlt" : : : "memory"); + } return (retval); } Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/amd64/amd64/vm_machdep.c Wed Aug 11 23:22:53 2010 (r211197) @@ -527,7 +527,8 @@ void cpu_reset() { #ifdef SMP - u_int cnt, map; + cpumask_t map; + u_int cnt; if (smp_active) { map = PCPU_GET(other_cpus) & ~stopped_cpus; Modified: head/sys/arm/include/pmap.h ============================================================================== --- head/sys/arm/include/pmap.h Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/arm/include/pmap.h Wed Aug 11 23:22:53 2010 (r211197) @@ -136,7 +136,7 @@ struct pmap { pd_entry_t *pm_pdir; /* KVA of page directory */ uint32_t pm_gen_count; /* generation count (pmap lock dropped) */ u_int pm_retries; - int pm_active; /* active on cpus */ + cpumask_t pm_active; /* active on cpus */ struct pmap_statistics pm_stats; /* pmap statictics */ TAILQ_HEAD(,pv_entry) pm_pvlist; /* list of mappings in pmap */ }; Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/i386/i386/mp_machdep.c Wed Aug 11 23:22:53 2010 (r211197) @@ -1598,9 +1598,11 @@ mp_grab_cpu_hlt(void) mask = PCPU_GET(cpumask); #endif - retval = mask & hlt_cpus_mask; - while (mask & hlt_cpus_mask) + retval = 0; + while (mask & hlt_cpus_mask) { + retval = 1; __asm __volatile("sti; hlt" : : : "memory"); + } return (retval); } Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/i386/i386/vm_machdep.c Wed Aug 11 23:22:53 2010 (r211197) @@ -596,7 +596,8 @@ cpu_reset() #endif #ifdef SMP - u_int cnt, map; + cpumask_t map; + u_int cnt; if (smp_active) { map = PCPU_GET(other_cpus) & ~stopped_cpus; Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/i386/xen/pmap.c Wed Aug 11 23:22:53 2010 (r211197) @@ -863,8 +863,7 @@ pmap_cache_bits(int mode, boolean_t is_p void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; CTR2(KTR_PMAP, "pmap_invalidate_page: pmap=%p va=0x%x", pmap, va); @@ -888,8 +887,7 @@ pmap_invalidate_page(pmap_t pmap, vm_off void pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; vm_offset_t addr; CTR3(KTR_PMAP, "pmap_invalidate_page: pmap=%p eva=0x%x sva=0x%x", @@ -917,8 +915,7 @@ pmap_invalidate_range(pmap_t pmap, vm_of void pmap_invalidate_all(pmap_t pmap) { - u_int cpumask; - u_int other_cpus; + cpumask_t cpumask, other_cpus; CTR1(KTR_PMAP, "pmap_invalidate_page: pmap=%p", pmap); Modified: head/sys/mips/include/pmap.h ============================================================================== --- head/sys/mips/include/pmap.h Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/mips/include/pmap.h Wed Aug 11 23:22:53 2010 (r211197) @@ -81,7 +81,7 @@ struct pmap { * pmap */ uint32_t pm_gen_count; /* generation count (pmap lock dropped) */ u_int pm_retries; - int pm_active; /* active on cpus */ + cpumask_t pm_active; /* active on cpus */ struct { u_int32_t asid:ASID_BITS; /* TLB address space tag */ u_int32_t gen:ASIDGEN_BITS; /* its generation number */ Modified: head/sys/powerpc/include/pmap.h ============================================================================== --- head/sys/powerpc/include/pmap.h Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/powerpc/include/pmap.h Wed Aug 11 23:22:53 2010 (r211197) @@ -99,7 +99,7 @@ struct pmap { #else register_t pm_sr[16]; #endif - u_int pm_active; + cpumask_t pm_active; uint32_t pm_gen_count; /* generation count (pmap lock dropped) */ u_int pm_retries; @@ -153,7 +153,7 @@ void slb_free_user_cache(struct slb *); struct pmap { struct mtx pm_mtx; /* pmap mutex */ tlbtid_t pm_tid[MAXCPU]; /* TID to identify this pmap entries in TLB */ - u_int pm_active; /* active on cpus */ + cpumask_t pm_active; /* active on cpus */ int pm_refs; /* ref count */ struct pmap_statistics pm_stats; /* pmap statistics */ Modified: head/sys/sparc64/include/pmap.h ============================================================================== --- head/sys/sparc64/include/pmap.h Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/sparc64/include/pmap.h Wed Aug 11 23:22:53 2010 (r211197) @@ -61,7 +61,7 @@ struct pmap { struct mtx pm_mtx; struct tte *pm_tsb; vm_object_t pm_tsb_obj; - u_int pm_active; + cpumask_t pm_active; uint32_t pm_gen_count; /* generation count (pmap lock dropped) */ u_int pm_retries; u_int pm_context[MAXCPU]; Modified: head/sys/sparc64/include/smp.h ============================================================================== --- head/sys/sparc64/include/smp.h Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/sparc64/include/smp.h Wed Aug 11 23:22:53 2010 (r211197) @@ -77,17 +77,17 @@ struct cpu_start_args { }; struct ipi_cache_args { - u_int ica_mask; + cpumask_t ica_mask; vm_paddr_t ica_pa; }; struct ipi_rd_args { - u_int ira_mask; + cpumask_t ira_mask; register_t *ira_val; }; struct ipi_tlb_args { - u_int ita_mask; + cpumask_t ita_mask; struct pmap *ita_pmap; u_long ita_start; u_long ita_end; @@ -208,7 +208,7 @@ static __inline void * ipi_tlb_context_demap(struct pmap *pm) { struct ipi_tlb_args *ita; - u_int cpus; + cpumask_t cpus; if (smp_cpus == 1) return (NULL); @@ -230,7 +230,7 @@ static __inline void * ipi_tlb_page_demap(struct pmap *pm, vm_offset_t va) { struct ipi_tlb_args *ita; - u_int cpus; + cpumask_t cpus; if (smp_cpus == 1) return (NULL); @@ -252,7 +252,7 @@ static __inline void * ipi_tlb_range_demap(struct pmap *pm, vm_offset_t start, vm_offset_t end) { struct ipi_tlb_args *ita; - u_int cpus; + cpumask_t cpus; if (smp_cpus == 1) return (NULL); @@ -275,7 +275,7 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ static __inline void ipi_wait(void *cookie) { - volatile u_int *mask; + volatile cpumask_t *mask; if ((mask = cookie) != NULL) { atomic_clear_int(mask, PCPU_GET(cpumask)); Modified: head/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/mp_machdep.c Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/sparc64/sparc64/mp_machdep.c Wed Aug 11 23:22:53 2010 (r211197) @@ -121,7 +121,7 @@ cpu_ipi_single_t *cpu_ipi_single; static vm_offset_t mp_tramp; static u_int cpuid_to_mid[MAXCPU]; static int isjbus; -static volatile u_int shutdown_cpus; +static volatile cpumask_t shutdown_cpus; static void ap_count(phandle_t node, u_int mid, u_int cpu_impl); static void ap_start(phandle_t node, u_int mid, u_int cpu_impl); Modified: head/sys/sun4v/include/smp.h ============================================================================== --- head/sys/sun4v/include/smp.h Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/sun4v/include/smp.h Wed Aug 11 23:22:53 2010 (r211197) @@ -59,12 +59,12 @@ struct cpu_start_args { }; struct ipi_cache_args { - u_int ica_mask; + cpumask_t ica_mask; vm_paddr_t ica_pa; }; struct ipi_tlb_args { - u_int ita_mask; + cpumask_t ita_mask; struct pmap *ita_pmap; u_long ita_start; u_long ita_end; Modified: head/sys/sun4v/sun4v/mp_machdep.c ============================================================================== --- head/sys/sun4v/sun4v/mp_machdep.c Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/sun4v/sun4v/mp_machdep.c Wed Aug 11 23:22:53 2010 (r211197) @@ -115,7 +115,7 @@ vm_offset_t mp_tramp; u_int mp_boot_mid; -static volatile u_int shutdown_cpus; +static volatile cpumask_t shutdown_cpus; void cpu_mp_unleash(void *); SYSINIT(cpu_mp_unleash, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL); Modified: head/sys/sun4v/sun4v/pmap.c ============================================================================== --- head/sys/sun4v/sun4v/pmap.c Wed Aug 11 23:21:25 2010 (r211196) +++ head/sys/sun4v/sun4v/pmap.c Wed Aug 11 23:22:53 2010 (r211197) @@ -1451,7 +1451,7 @@ pmap_ipi(pmap_t pmap, char *func, uint64 { int i, cpu_count, retried; - u_int cpus; + cpumask_t cpus; cpumask_t cpumask, active, curactive; cpumask_t active_total, ackmask; uint16_t *cpulist; From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 00:16:18 2010 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 6C13F1065673; Thu, 12 Aug 2010 00:16:18 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 583EC8FC08; Thu, 12 Aug 2010 00:16:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C0GIce014919; Thu, 12 Aug 2010 00:16:18 GMT (envelope-from takawata@svn.freebsd.org) Received: (from takawata@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C0GI2t014914; Thu, 12 Aug 2010 00:16:18 GMT (envelope-from takawata@svn.freebsd.org) Message-Id: <201008120016.o7C0GI2t014914@svn.freebsd.org> From: Takanori Watanabe Date: Thu, 12 Aug 2010 00:16: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: r211201 - in head: share/man/man4 sys/conf sys/dev/tpm sys/modules sys/modules/tpm 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, 12 Aug 2010 00:16:18 -0000 Author: takawata Date: Thu Aug 12 00:16:18 2010 New Revision: 211201 URL: http://svn.freebsd.org/changeset/base/211201 Log: Add tpm(4) driver for Trusted Platform Module. You may want to look at http://bsssd.sourceforge.net/ . Submitted by: Hans-Joerg Hoexer Added: head/share/man/man4/tpm.4 (contents, props changed) head/sys/dev/tpm/ head/sys/dev/tpm/tpm.c (contents, props changed) head/sys/dev/tpm/tpm_acpi.c (contents, props changed) head/sys/dev/tpm/tpm_isa.c (contents, props changed) head/sys/dev/tpm/tpmvar.h (contents, props changed) head/sys/modules/tpm/ head/sys/modules/tpm/Makefile (contents, props changed) Modified: head/sys/conf/files.i386 head/sys/modules/Makefile Added: head/share/man/man4/tpm.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/tpm.4 Thu Aug 12 00:16:18 2010 (r211201) @@ -0,0 +1,74 @@ +.\" +.\" Copyright (c) 2010 Hans-J +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" $FreeBSD$ +.\" +.Dd March 8, 2010 +.Dt TPM 4 +.Os +.Sh NAME +.Nm tpm +.Nd Trusted Platform Module +.Sh SYNOPSIS +.Cd "device tpm" +.Pp +In +.Pa /boot/device.hints : +.Cd hint.tpm.0.at="isa" +.Cd hint.tpm.0.maddr="0xfed40000" +.Cd hint.tpm.0.msize="0x5000" +.Cd hint.tpm.1.at="isa" +.Cd hint.tpm.1.maddr="0xfed40000" +.Cd hint.tpm.1.msize="0x1000" +.Sh DESCRIPTION +The +.Nm +driver provides support for various trusted platfrom modules (TPM) that can +store cryptographic keys. +.Pp +Supported modules: +.Pp +.Bl -bullet -compact -offset indent +.It +Atmel 97SC3203 +.It +Broadcom BCM0102 +.It +Infineon IFX SLD 9630 TT 1.1 and IFX SLB 9635 TT 1.2 +.It +Intel INTC0102 +.It +Sinosun SNS SSX35 +.It +STM ST19WP18 +.It +Winbond WEC WPCT200 +.El +.Pp +The driver can be configured to use an IRQ by providing a free ISA +interrupt vector in +.Pa /boot/device.hints . +.Sh SEE ALSO +.Xr intro 4 , +.Xr files.conf 5, +.Xr config 8 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Michael Shalayeff +and +.An Hans-Joerg Hoexer . Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Wed Aug 11 23:59:21 2010 (r211200) +++ head/sys/conf/files.i386 Thu Aug 12 00:16:18 2010 (r211201) @@ -231,6 +231,9 @@ dev/syscons/scterm-teken.c optional sc dev/syscons/scvesactl.c optional sc vga vesa dev/syscons/scvgarndr.c optional sc vga dev/syscons/scvtb.c optional sc +dev/tpm/tpm.c optional tpm +dev/tpm/tpm_acpi.c optional tpm acpi +dev/tpm/tpm_isa.c optional tpm isa dev/uart/uart_cpu_i386.c optional uart dev/acpica/acpi_if.m standard dev/acpi_support/acpi_wmi_if.m standard Added: head/sys/dev/tpm/tpm.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/tpm/tpm.c Thu Aug 12 00:16:18 2010 (r211201) @@ -0,0 +1,1492 @@ +/* + * Copyright (c) 2008, 2009 Michael Shalayeff + * Copyright (c) 2009, 2010 Hans-Joerg Hoexer + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* #define TPM_DEBUG */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#ifdef __FreeBSD__ +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#else +#include + +#include +#include +#include +#include + +#include +#include +#endif +#include + +#ifndef __FreeBSD__ +/* XXX horrible hack for tcsd (-lpthread) workaround on OpenBSD */ +#undef PCATCH +#define PCATCH 0 +#endif + +#define TPM_BUFSIZ 1024 + +#define TPM_HDRSIZE 10 + +#define TPM_PARAM_SIZE 0x0001 + +#ifdef __FreeBSD__ +#define IRQUNK -1 +#endif + +#define TPM_ACCESS 0x0000 /* acess register */ +#define TPM_ACCESS_ESTABLISHMENT 0x01 /* establishment */ +#define TPM_ACCESS_REQUEST_USE 0x02 /* request using locality */ +#define TPM_ACCESS_REQUEST_PENDING 0x04 /* pending request */ +#define TPM_ACCESS_SEIZE 0x08 /* request locality seize */ +#define TPM_ACCESS_SEIZED 0x10 /* locality has been seized */ +#define TPM_ACCESS_ACTIVE_LOCALITY 0x20 /* locality is active */ +#define TPM_ACCESS_VALID 0x80 /* bits are valid */ +#define TPM_ACCESS_BITS \ + "\020\01EST\02REQ\03PEND\04SEIZE\05SEIZED\06ACT\010VALID" + +#define TPM_INTERRUPT_ENABLE 0x0008 +#define TPM_GLOBAL_INT_ENABLE 0x80000000 /* enable ints */ +#define TPM_CMD_READY_INT 0x00000080 /* cmd ready enable */ +#define TPM_INT_EDGE_FALLING 0x00000018 +#define TPM_INT_EDGE_RISING 0x00000010 +#define TPM_INT_LEVEL_LOW 0x00000008 +#define TPM_INT_LEVEL_HIGH 0x00000000 +#define TPM_LOCALITY_CHANGE_INT 0x00000004 /* locality change enable */ +#define TPM_STS_VALID_INT 0x00000002 /* int on TPM_STS_VALID is set */ +#define TPM_DATA_AVAIL_INT 0x00000001 /* int on TPM_STS_DATA_AVAIL is set */ +#define TPM_INTERRUPT_ENABLE_BITS \ + "\020\040ENA\010RDY\03LOCH\02STSV\01DRDY" + +#define TPM_INT_VECTOR 0x000c /* 8 bit reg for 4 bit irq vector */ +#define TPM_INT_STATUS 0x0010 /* bits are & 0x87 from TPM_INTERRUPT_ENABLE */ + +#define TPM_INTF_CAPABILITIES 0x0014 /* capability register */ +#define TPM_INTF_BURST_COUNT_STATIC 0x0100 /* TPM_STS_BMASK static */ +#define TPM_INTF_CMD_READY_INT 0x0080 /* int on ready supported */ +#define TPM_INTF_INT_EDGE_FALLING 0x0040 /* falling edge ints supported */ +#define TPM_INTF_INT_EDGE_RISING 0x0020 /* rising edge ints supported */ +#define TPM_INTF_INT_LEVEL_LOW 0x0010 /* level-low ints supported */ +#define TPM_INTF_INT_LEVEL_HIGH 0x0008 /* level-high ints supported */ +#define TPM_INTF_LOCALITY_CHANGE_INT 0x0004 /* locality-change int (mb 1) */ +#define TPM_INTF_STS_VALID_INT 0x0002 /* TPM_STS_VALID int supported */ +#define TPM_INTF_DATA_AVAIL_INT 0x0001 /* TPM_STS_DATA_AVAIL int supported (mb 1) */ +#define TPM_CAPSREQ \ + (TPM_INTF_DATA_AVAIL_INT|TPM_INTF_LOCALITY_CHANGE_INT|TPM_INTF_INT_LEVEL_LOW) +#define TPM_CAPBITS \ + "\020\01IDRDY\02ISTSV\03ILOCH\04IHIGH\05ILOW\06IEDGE\07IFALL\010IRDY\011BCST" + +#define TPM_STS 0x0018 /* status register */ +#define TPM_STS_MASK 0x000000ff /* status bits */ +#define TPM_STS_BMASK 0x00ffff00 /* ro io burst size */ +#define TPM_STS_VALID 0x00000080 /* ro other bits are valid */ +#define TPM_STS_CMD_READY 0x00000040 /* rw chip/signal ready */ +#define TPM_STS_GO 0x00000020 /* wo start the command */ +#define TPM_STS_DATA_AVAIL 0x00000010 /* ro data available */ +#define TPM_STS_DATA_EXPECT 0x00000008 /* ro more data to be written */ +#define TPM_STS_RESP_RETRY 0x00000002 /* wo resend the response */ +#define TPM_STS_BITS "\020\010VALID\07RDY\06GO\05DRDY\04EXPECT\02RETRY" + +#define TPM_DATA 0x0024 +#define TPM_ID 0x0f00 +#define TPM_REV 0x0f04 +#define TPM_SIZE 0x5000 /* five pages of the above */ + +#define TPM_ACCESS_TMO 2000 /* 2sec */ +#define TPM_READY_TMO 2000 /* 2sec */ +#define TPM_READ_TMO 120000 /* 2 minutes */ +#define TPM_BURST_TMO 2000 /* 2sec */ + +#define TPM_LEGACY_BUSY 0x01 +#define TPM_LEGACY_ABRT 0x01 +#define TPM_LEGACY_DA 0x02 +#define TPM_LEGACY_RE 0x04 +#define TPM_LEGACY_LAST 0x04 +#define TPM_LEGACY_BITS "\020\01BUSY\2DA\3RE\4LAST" +#define TPM_LEGACY_TMO (2*60) /* sec */ +#define TPM_LEGACY_SLEEP 5 /* ticks */ +#define TPM_LEGACY_DELAY 100 + +/* Set when enabling legacy interface in host bridge. */ +int tpm_enabled; + + +#ifdef __FreeBSD__ +#define TPMSOFTC(dev) \ + ((struct tpm_softc *)dev->si_drv1) + +d_open_t tpmopen; +d_close_t tpmclose; +d_read_t tpmread; +d_write_t tpmwrite; +d_ioctl_t tpmioctl; + +static struct cdevsw tpm_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, + .d_open = tpmopen, + .d_close = tpmclose, + .d_read = tpmread, + .d_write = tpmwrite, + .d_ioctl = tpmioctl, + .d_name = "tpm", +}; +#else +#define TPMSOFTC(dev) \ + (struct tpm_softc *)device_lookup(&tpm_cd, minor(dev)) + +struct cfdriver tpm_cd = { + NULL, "tpm", DV_DULL +}; + +int tpm_match(struct device *, void *, void *); +void tpm_attach(struct device *, struct device *, void *); + +struct cfattach tpm_ca = { + sizeof(struct tpm_softc), tpm_match, tpm_attach +}; +#endif + +const struct { + u_int32_t devid; + char name[32]; + int flags; +#define TPM_DEV_NOINTS 0x0001 +} tpm_devs[] = { + { 0x000615d1, "IFX SLD 9630 TT 1.1", 0 }, + { 0x000b15d1, "IFX SLB 9635 TT 1.2", 0 }, + { 0x100214e4, "Broadcom BCM0102", TPM_DEV_NOINTS }, + { 0x00fe1050, "WEC WPCT200", 0 }, + { 0x687119fa, "SNS SSX35", 0 }, + { 0x2e4d5453, "STM ST19WP18", 0 }, + { 0x32021114, "ATML 97SC3203", TPM_DEV_NOINTS }, + { 0x10408086, "INTEL INTC0102", 0 }, + { 0, "", TPM_DEV_NOINTS }, +}; + +int tpm_tis12_irqinit(struct tpm_softc *, int, int); +int tpm_tis12_init(struct tpm_softc *, int, const char *); +int tpm_tis12_start(struct tpm_softc *, int); +int tpm_tis12_read(struct tpm_softc *, void *, int, size_t *, int); +int tpm_tis12_write(struct tpm_softc *, void *, int); +int tpm_tis12_end(struct tpm_softc *, int, int); + +#ifdef __FreeBSD__ +void tpm_intr(void *); +#else +int tpm_intr(void *); +void tpm_powerhook(int, void *); +int tpm_suspend(struct tpm_softc *, int); +int tpm_resume(struct tpm_softc *, int); +#endif + +int tpm_waitfor_poll(struct tpm_softc *, u_int8_t, int, void *); +int tpm_waitfor_int(struct tpm_softc *, u_int8_t, int, void *, int); +int tpm_waitfor(struct tpm_softc *, u_int8_t, int, void *); +int tpm_request_locality(struct tpm_softc *, int); +int tpm_getburst(struct tpm_softc *); +u_int8_t tpm_status(struct tpm_softc *); +int tpm_tmotohz(int); + +int tpm_legacy_probe(bus_space_tag_t, bus_addr_t); +int tpm_legacy_init(struct tpm_softc *, int, const char *); +int tpm_legacy_start(struct tpm_softc *, int); +int tpm_legacy_read(struct tpm_softc *, void *, int, size_t *, int); +int tpm_legacy_write(struct tpm_softc *, void *, int); +int tpm_legacy_end(struct tpm_softc *, int, int); + +#ifdef __FreeBSD__ + +/* + * FreeBSD specific code for probing and attaching TPM to device tree. + */ +#if 0 +static void +tpm_identify(driver_t *driver, device_t parent) +{ + BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "tpm", 0); +} +#endif + + +int +tpm_attach(device_t dev) +{ + struct tpm_softc *sc = device_get_softc(dev); + int irq; + + sc->mem_rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid, + RF_ACTIVE); + if (sc->mem_res == NULL) + return ENXIO; + + sc->sc_bt = rman_get_bustag(sc->mem_res); + sc->sc_bh = rman_get_bushandle(sc->mem_res); + + sc->irq_rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid, + RF_ACTIVE | RF_SHAREABLE); + if (sc->irq_res != NULL) + irq = rman_get_start(sc->irq_res); + else + irq = IRQUNK; + + /* In case PnP probe this may contain some initialization. */ + tpm_tis12_probe(sc->sc_bt, sc->sc_bh); + + if (tpm_legacy_probe(sc->sc_bt, sc->sc_bh)) { + sc->sc_init = tpm_legacy_init; + sc->sc_start = tpm_legacy_start; + sc->sc_read = tpm_legacy_read; + sc->sc_write = tpm_legacy_write; + sc->sc_end = tpm_legacy_end; + } else { + sc->sc_init = tpm_tis12_init; + sc->sc_start = tpm_tis12_start; + sc->sc_read = tpm_tis12_read; + sc->sc_write = tpm_tis12_write; + sc->sc_end = tpm_tis12_end; + } + + printf("%s", device_get_name(dev)); + if ((sc->sc_init)(sc, irq, "tpm")) { + tpm_detach(dev); + return ENXIO; + } + + if (sc->sc_init == tpm_tis12_init && sc->irq_res != NULL && + bus_setup_intr(dev, sc->irq_res, INTR_TYPE_TTY, NULL, + tpm_intr, sc, &sc->intr_cookie) != 0) { + tpm_detach(dev); + printf(": cannot establish interrupt\n"); + return 1; + } + + sc->sc_cdev = make_dev(&tpm_cdevsw, device_get_unit(dev), + UID_ROOT, GID_WHEEL, 0600, "tpm"); + sc->sc_cdev->si_drv1 = sc; + + return 0; +} + +int +tpm_detach(device_t dev) +{ + struct tpm_softc * sc = device_get_softc(dev); + + if(sc->intr_cookie){ + bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie); + } + + if(sc->mem_res){ + bus_release_resource(dev, SYS_RES_MEMORY, + sc->mem_rid, sc->mem_res); + } + + if(sc->irq_res){ + bus_release_resource(dev, SYS_RES_IRQ, + sc->irq_rid, sc->irq_res); + } + if(sc->sc_cdev){ + destroy_dev(sc->sc_cdev); + } + + return 0; +} + + +#else +/* + * OpenBSD specific code for probing and attaching TPM to device tree. + */ +int +tpm_match(struct device *parent, void *match, void *aux) +{ + struct isa_attach_args *ia = aux; + struct cfdata *cf = match; + bus_space_tag_t bt = ia->ia_memt; + bus_space_handle_t bh; + int rv; + + /* There can be only one. */ + if (cf->cf_unit) + return 0; + + if (tpm_legacy_probe(ia->ia_iot, ia->ia_iobase)) { + ia->ia_iosize = 2; + return 1; + } + + if (ia->ia_maddr == -1) + return 0; + + if (bus_space_map(bt, ia->ia_maddr, TPM_SIZE, 0, &bh)) + return 0; + + if ((rv = tpm_tis12_probe(bt, bh))) { + ia->ia_iosize = 0; + ia->ia_msize = TPM_SIZE; + } + + bus_space_unmap(bt, bh, TPM_SIZE); + return rv; +} + +void +tpm_attach(struct device *parent, struct device *self, void *aux) +{ + struct tpm_softc *sc = (struct tpm_softc *)self; + struct isa_attach_args *ia = aux; + bus_addr_t iobase; + bus_size_t size; + int rv; + + if (tpm_legacy_probe(ia->ia_iot, ia->ia_iobase)) { + sc->sc_bt = ia->ia_iot; + iobase = ia->ia_iobase; + size = ia->ia_iosize; + sc->sc_batm = ia->ia_iot; + sc->sc_init = tpm_legacy_init; + sc->sc_start = tpm_legacy_start; + sc->sc_read = tpm_legacy_read; + sc->sc_write = tpm_legacy_write; + sc->sc_end = tpm_legacy_end; + } else { + sc->sc_bt = ia->ia_memt; + iobase = ia->ia_maddr; + size = TPM_SIZE; + sc->sc_init = tpm_tis12_init; + sc->sc_start = tpm_tis12_start; + sc->sc_read = tpm_tis12_read; + sc->sc_write = tpm_tis12_write; + sc->sc_end = tpm_tis12_end; + } + + if (bus_space_map(sc->sc_bt, iobase, size, 0, &sc->sc_bh)) { + printf(": cannot map registers\n"); + return; + } + + if ((rv = (sc->sc_init)(sc, ia->ia_irq, sc->sc_dev.dv_xname))) { + bus_space_unmap(sc->sc_bt, sc->sc_bh, size); + return; + } + + /* + * Only setup interrupt handler when we have a vector and the + * chip is TIS 1.2 compliant. + */ + if (sc->sc_init == tpm_tis12_init && ia->ia_irq != IRQUNK && + (sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, + IPL_TTY, tpm_intr, sc, sc->sc_dev.dv_xname)) == NULL) { + bus_space_unmap(sc->sc_bt, sc->sc_bh, TPM_SIZE); + printf("%s: cannot establish interrupt\n", + sc->sc_dev.dv_xname); + return; + } + +#ifdef __FreeBSD__ + sc->sc_suspend = 0; +#else + sc->sc_suspend = PWR_RESUME; + sc->sc_powerhook = powerhook_establish(tpm_powerhook, sc); +#endif +} +#endif + +/* Probe TPM using TIS 1.2 interface. */ +int +tpm_tis12_probe(bus_space_tag_t bt, bus_space_handle_t bh) +{ + u_int32_t r; + u_int8_t save, reg; + + r = bus_space_read_4(bt, bh, TPM_INTF_CAPABILITIES); + if (r == 0xffffffff) + return 0; + +#ifdef TPM_DEBUG + printf("tpm: caps=%b\n", r, TPM_CAPBITS); +#endif + if ((r & TPM_CAPSREQ) != TPM_CAPSREQ || + !(r & (TPM_INTF_INT_EDGE_RISING | TPM_INTF_INT_LEVEL_LOW))) { +#ifdef TPM_DEBUG + printf("tpm: caps too low (caps=%b)\n", r, TPM_CAPBITS); +#endif + return 0; + } + + save = bus_space_read_1(bt, bh, TPM_ACCESS); + bus_space_write_1(bt, bh, TPM_ACCESS, TPM_ACCESS_REQUEST_USE); + reg = bus_space_read_1(bt, bh, TPM_ACCESS); + if ((reg & TPM_ACCESS_VALID) && (reg & TPM_ACCESS_ACTIVE_LOCALITY) && + bus_space_read_4(bt, bh, TPM_ID) != 0xffffffff) + return 1; + + bus_space_write_1(bt, bh, TPM_ACCESS, save); + return 0; +} + +/* + * Setup interrupt vector if one is provided and interrupts are know to + * work on that particular chip. + */ +int +tpm_tis12_irqinit(struct tpm_softc *sc, int irq, int idx) +{ + u_int32_t r; + + if ((irq == IRQUNK) || (tpm_devs[idx].flags & TPM_DEV_NOINTS)) { + sc->sc_vector = IRQUNK; + return 0; + } + + /* Ack and disable all interrupts. */ + bus_space_write_4(sc->sc_bt, sc->sc_bh, TPM_INTERRUPT_ENABLE, + bus_space_read_4(sc->sc_bt, sc->sc_bh, TPM_INTERRUPT_ENABLE) & + ~TPM_GLOBAL_INT_ENABLE); + bus_space_write_4(sc->sc_bt, sc->sc_bh, TPM_INT_STATUS, + bus_space_read_4(sc->sc_bt, sc->sc_bh, TPM_INT_STATUS)); + + /* Program interrupt vector. */ + bus_space_write_1(sc->sc_bt, sc->sc_bh, TPM_INT_VECTOR, irq); + sc->sc_vector = irq; + + /* Program interrupt type. */ + if (sc->sc_capabilities & TPM_INTF_INT_EDGE_RISING) + r = TPM_INT_EDGE_RISING; + else if (sc->sc_capabilities & TPM_INTF_INT_LEVEL_HIGH) + r = TPM_INT_LEVEL_HIGH; + else + r = TPM_INT_LEVEL_LOW; + bus_space_write_4(sc->sc_bt, sc->sc_bh, TPM_INTERRUPT_ENABLE, r); + + return 0; +} + +/* Setup TPM using TIS 1.2 interface. */ +int +tpm_tis12_init(struct tpm_softc *sc, int irq, const char *name) +{ + u_int32_t r; + int i; + + r = bus_space_read_4(sc->sc_bt, sc->sc_bh, TPM_INTF_CAPABILITIES); +#ifdef TPM_DEBUG + printf(" caps=%b ", r, TPM_CAPBITS); +#endif + if ((r & TPM_CAPSREQ) != TPM_CAPSREQ || + !(r & (TPM_INTF_INT_EDGE_RISING | TPM_INTF_INT_LEVEL_LOW))) { + printf(": capabilities too low (caps=%b)\n", r, TPM_CAPBITS); + return 1; + } + sc->sc_capabilities = r; + + sc->sc_devid = bus_space_read_4(sc->sc_bt, sc->sc_bh, TPM_ID); + sc->sc_rev = bus_space_read_1(sc->sc_bt, sc->sc_bh, TPM_REV); + + for (i = 0; tpm_devs[i].devid; i++) + if (tpm_devs[i].devid == sc->sc_devid) + break; + + if (tpm_devs[i].devid) + printf(": %s rev 0x%x\n", tpm_devs[i].name, sc->sc_rev); + else + printf(": device 0x%08x rev 0x%x\n", sc->sc_devid, sc->sc_rev); + + if (tpm_tis12_irqinit(sc, irq, i)) + return 1; + + if (tpm_request_locality(sc, 0)) + return 1; + + /* Abort whatever it thought it was doing. */ + bus_space_write_1(sc->sc_bt, sc->sc_bh, TPM_STS, TPM_STS_CMD_READY); + + return 0; +} + +int +tpm_request_locality(struct tpm_softc *sc, int l) +{ + u_int32_t r; + int to, rv; + + if (l != 0) + return EINVAL; + + if ((bus_space_read_1(sc->sc_bt, sc->sc_bh, TPM_ACCESS) & + (TPM_ACCESS_VALID | TPM_ACCESS_ACTIVE_LOCALITY)) == + (TPM_ACCESS_VALID | TPM_ACCESS_ACTIVE_LOCALITY)) + return 0; + + bus_space_write_1(sc->sc_bt, sc->sc_bh, TPM_ACCESS, + TPM_ACCESS_REQUEST_USE); + + to = tpm_tmotohz(TPM_ACCESS_TMO); + + while ((r = bus_space_read_1(sc->sc_bt, sc->sc_bh, TPM_ACCESS) & + (TPM_ACCESS_VALID | TPM_ACCESS_ACTIVE_LOCALITY)) != + (TPM_ACCESS_VALID | TPM_ACCESS_ACTIVE_LOCALITY) && to--) { + rv = tsleep(sc->sc_init, PRIBIO | PCATCH, "tpm_locality", 1); + if (rv && rv != EWOULDBLOCK) { +#ifdef TPM_DEBUG + printf("tpm_request_locality: interrupted %d\n", rv); +#endif + return rv; + } + } + + if ((r & (TPM_ACCESS_VALID | TPM_ACCESS_ACTIVE_LOCALITY)) != + (TPM_ACCESS_VALID | TPM_ACCESS_ACTIVE_LOCALITY)) { +#ifdef TPM_DEBUG + printf("tpm_request_locality: access %b\n", r, TPM_ACCESS_BITS); +#endif + return EBUSY; + } + + return 0; +} + +int +tpm_getburst(struct tpm_softc *sc) +{ + int burst, to, rv; + + to = tpm_tmotohz(TPM_BURST_TMO); + + burst = 0; + while (burst == 0 && to--) { + /* + * Burst count has to be read from bits 8 to 23 without + * touching any other bits, eg. the actual status bits 0 + * to 7. + */ + burst = bus_space_read_1(sc->sc_bt, sc->sc_bh, TPM_STS + 1); + burst |= bus_space_read_1(sc->sc_bt, sc->sc_bh, TPM_STS + 2) + << 8; +#ifdef TPM_DEBUG + printf("tpm_getburst: read %d\n", burst); +#endif + if (burst) + return burst; + + rv = tsleep(sc, PRIBIO | PCATCH, "tpm_getburst", 1); + if (rv && rv != EWOULDBLOCK) { + return 0; + } + } + + return 0; +} + +u_int8_t +tpm_status(struct tpm_softc *sc) +{ + u_int8_t status; + + status = bus_space_read_1(sc->sc_bt, sc->sc_bh, TPM_STS) & + TPM_STS_MASK; + + return status; +} + +int +tpm_tmotohz(int tmo) +{ + struct timeval tv; + + tv.tv_sec = tmo / 1000; + tv.tv_usec = 1000 * (tmo % 1000); + + return tvtohz(&tv); +} + +/* Save TPM state on suspend. */ +int +#ifdef __FreeBSD__ +tpm_suspend(device_t dev) +#else +tpm_suspend(struct tpm_softc *sc, int why) +#endif +{ +#ifdef __FreeBSD__ + struct tpm_softc *sc = device_get_softc(dev); + int why = 1; +#endif + u_int8_t command[] = { + 0, 193, /* TPM_TAG_RQU_COMMAND */ + 0, 0, 0, 10, /* Length in bytes */ + 0, 0, 0, 156 /* TPM_ORD_SaveStates */ + }; + + /* + * Power down: We have to issue the SaveStates command. + */ + sc->sc_write(sc, &command, sizeof(command)); + sc->sc_read(sc, &command, sizeof(command), NULL, TPM_HDRSIZE); +#ifdef TPM_DEBUG + printf("tpm_suspend: power down: %d -> %d\n", sc->sc_suspend, why); +#endif + sc->sc_suspend = why; + + return 0; +} + +/* + * Handle resume event. Actually nothing to do as the BIOS is supposed + * to restore the previously saved state. + */ +int +#ifdef __FreeBSD__ +tpm_resume(device_t dev) +#else +tpm_resume(struct tpm_softc *sc, int why) +#endif +{ +#ifdef __FreeBSD__ + struct tpm_softc *sc = device_get_softc(dev); + int why = 0; +#endif +#ifdef TPM_DEBUG + printf("tpm_resume: resume: %d -> %d\n", sc->sc_suspend, why); +#endif + sc->sc_suspend = why; + + return 0; +} + +/* Dispatch suspend and resume events. */ +#ifndef __FreeBSD__ +void +tpm_powerhook(int why, void *self) +{ + struct tpm_softc *sc = (struct tpm_softc *)self; + + if (why != PWR_RESUME) + tpm_suspend(sc, why); + else + tpm_resume(sc, why); +} +#endif /* !__FreeBSD__ */ + +/* Wait for given status bits using polling. */ +int +tpm_waitfor_poll(struct tpm_softc *sc, u_int8_t mask, int tmo, void *c) +{ + int rv; + + /* + * Poll until either the requested condition or a time out is + * met. + */ + while (((sc->sc_stat = tpm_status(sc)) & mask) != mask && tmo--) { + rv = tsleep(c, PRIBIO | PCATCH, "tpm_poll", 1); + if (rv && rv != EWOULDBLOCK) { +#ifdef TPM_DEBUG + printf("tpm_waitfor_poll: interrupted %d\n", rv); +#endif + return rv; + } + } + + return 0; +} + +/* Wait for given status bits using interrupts. */ +int +tpm_waitfor_int(struct tpm_softc *sc, u_int8_t mask, int tmo, void *c, + int inttype) +{ + int rv, to; + + /* Poll and return when condition is already met. */ + sc->sc_stat = tpm_status(sc); + if ((sc->sc_stat & mask) == mask) + return 0; + + /* + * Enable interrupt on tpm chip. Note that interrupts on our + * level (SPL_TTY) are disabled (see tpm{read,write} et al) and + * will not be delivered to the cpu until we call tsleep(9) below. + */ + bus_space_write_4(sc->sc_bt, sc->sc_bh, TPM_INTERRUPT_ENABLE, + bus_space_read_4(sc->sc_bt, sc->sc_bh, TPM_INTERRUPT_ENABLE) | + inttype); + bus_space_write_4(sc->sc_bt, sc->sc_bh, TPM_INTERRUPT_ENABLE, + bus_space_read_4(sc->sc_bt, sc->sc_bh, TPM_INTERRUPT_ENABLE) | + TPM_GLOBAL_INT_ENABLE); + + /* + * Poll once more to remedy the race between previous polling + * and enabling interrupts on the tpm chip. + */ + sc->sc_stat = tpm_status(sc); + if ((sc->sc_stat & mask) == mask) { + rv = 0; + goto out; + } + + to = tpm_tmotohz(tmo); +#ifdef TPM_DEBUG + printf("tpm_waitfor_int: sleeping for %d ticks on %p\n", to, c); +#endif + /* + * tsleep(9) enables interrupts on the cpu and returns after + * wake up with interrupts disabled again. Note that interrupts + * generated by the tpm chip while being at SPL_TTY are not lost + * but held and delivered as soon as the cpu goes below SPL_TTY. + */ + rv = tsleep(c, PRIBIO | PCATCH, "tpm_intr", to); + + sc->sc_stat = tpm_status(sc); +#ifdef TPM_DEBUG + printf("tpm_waitfor_int: woke up with rv %d stat %b\n", rv, + sc->sc_stat, TPM_STS_BITS); +#endif + if ((sc->sc_stat & mask) == mask) + rv = 0; + + /* Disable interrupts on tpm chip again. */ +out: bus_space_write_4(sc->sc_bt, sc->sc_bh, TPM_INTERRUPT_ENABLE, + bus_space_read_4(sc->sc_bt, sc->sc_bh, TPM_INTERRUPT_ENABLE) & + ~TPM_GLOBAL_INT_ENABLE); + bus_space_write_4(sc->sc_bt, sc->sc_bh, TPM_INTERRUPT_ENABLE, + bus_space_read_4(sc->sc_bt, sc->sc_bh, TPM_INTERRUPT_ENABLE) & + ~inttype); + + return rv; +} + +/* + * Wait on given status bits, uses interrupts where possible, otherwise polls. + */ +int +tpm_waitfor(struct tpm_softc *sc, u_int8_t b0, int tmo, void *c) +{ + u_int8_t b; + int re, to, rv; + +#ifdef TPM_DEBUG + printf("tpm_waitfor: b0 %b\n", b0, TPM_STS_BITS); +#endif + + /* + * If possible, use interrupts, otherwise poll. + * + * We use interrupts for TPM_STS_VALID and TPM_STS_DATA_AVAIL (if + * the tpm chips supports them) as waiting for those can take + * really long. The other TPM_STS* are not needed very often + * so we do not support them. + */ + if (sc->sc_vector != IRQUNK) { + b = b0; + + /* + * Wait for data ready. This interrupt only occures + * when both TPM_STS_VALID and TPM_STS_DATA_AVAIL are asserted. + * Thus we don't have to bother with TPM_STS_VALID + * separately and can just return. + * + * This only holds for interrupts! When using polling + * both flags have to be waited for, see below. + */ + if ((b & TPM_STS_DATA_AVAIL) && (sc->sc_capabilities & + TPM_INTF_DATA_AVAIL_INT)) + return tpm_waitfor_int(sc, b, tmo, c, + TPM_DATA_AVAIL_INT); + + /* Wait for status valid bit. */ + if ((b & TPM_STS_VALID) && (sc->sc_capabilities & + TPM_INTF_STS_VALID_INT)) { + rv = tpm_waitfor_int(sc, b, tmo, c, TPM_STS_VALID_INT); + if (rv != 0) + return rv; + else + b = b0 & ~TPM_STS_VALID; + } + + /* + * When all flags are taken care of, return. Otherwise + * use polling for eg. TPM_STS_CMD_READY. + */ + if (b == 0) + return 0; + } + + re = 3; +restart: + /* + * If requested wait for TPM_STS_VALID before dealing with + * any other flag. Eg. when both TPM_STS_DATA_AVAIL and TPM_STS_VALID + * are requested, wait for the latter first. + */ + b = b0; + if (b0 & TPM_STS_VALID) + b = TPM_STS_VALID; + + to = tpm_tmotohz(tmo); +again: + if ((rv = tpm_waitfor_poll(sc, b, to, c)) != 0) + return rv; + + if ((b & sc->sc_stat) == TPM_STS_VALID) { + /* Now wait for other flags. */ + b = b0 & ~TPM_STS_VALID; + to++; + goto again; + } + + if ((sc->sc_stat & b) != b) { +#ifdef TPM_DEBUG + printf("tpm_waitfor: timeout: stat=%b b=%b\n", + sc->sc_stat, TPM_STS_BITS, b, TPM_STS_BITS); +#endif + if (re-- && (b0 & TPM_STS_VALID)) { + bus_space_write_1(sc->sc_bt, sc->sc_bh, TPM_STS, + TPM_STS_RESP_RETRY); + goto restart; + } + return EIO; + } + + return 0; +} + +/* Start transaction. */ +int +tpm_tis12_start(struct tpm_softc *sc, int flag) +{ + int rv; + + if (flag == UIO_READ) { + rv = tpm_waitfor(sc, TPM_STS_DATA_AVAIL | TPM_STS_VALID, + TPM_READ_TMO, sc->sc_read); + return rv; + } + + /* Own our (0th) locality. */ + if ((rv = tpm_request_locality(sc, 0)) != 0) + return rv; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 00:20:46 2010 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 7CF831065670; Thu, 12 Aug 2010 00:20:46 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BAE68FC08; Thu, 12 Aug 2010 00:20:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C0KkcN015947; Thu, 12 Aug 2010 00:20:46 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C0Kka6015945; Thu, 12 Aug 2010 00:20:46 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008120020.o7C0Kka6015945@svn.freebsd.org> From: Jung-uk Kim Date: Thu, 12 Aug 2010 00:20: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: r211202 - in head/sys/amd64: acpica amd64 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, 12 Aug 2010 00:20:46 -0000 Author: jkim Date: Thu Aug 12 00:20:46 2010 New Revision: 211202 URL: http://svn.freebsd.org/changeset/base/211202 Log: Reset switchtime and switchticks after resynchronizing the system clock. This should fix weird runtime problem after resume on amd64. It also fixes "calcru: runtime went backwards" warnings with bootverbose. Modified: head/sys/amd64/acpica/acpi_wakeup.c head/sys/amd64/amd64/mp_machdep.c Modified: head/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- head/sys/amd64/acpica/acpi_wakeup.c Thu Aug 12 00:16:18 2010 (r211201) +++ head/sys/amd64/acpica/acpi_wakeup.c Thu Aug 12 00:20:46 2010 (r211202) @@ -278,11 +278,13 @@ acpi_sleep_machdep(struct acpi_softc *sc for (;;) ia32_pause(); } else { + acpi_resync_clock(sc); + PCPU_SET(switchtime, cpu_ticks()); + PCPU_SET(switchticks, ticks); #ifdef SMP if (wakeup_cpus != 0) acpi_wakeup_cpus(sc, wakeup_cpus); #endif - acpi_resync_clock(sc); ret = 0; } Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Thu Aug 12 00:16:18 2010 (r211201) +++ head/sys/amd64/amd64/mp_machdep.c Thu Aug 12 00:20:46 2010 (r211202) @@ -1369,6 +1369,9 @@ cpususpend_handler(void) if (savectx(susppcbs[cpu])) { wbinvd(); atomic_set_int(&stopped_cpus, cpumask); + } else { + PCPU_SET(switchtime, cpu_ticks()); + PCPU_SET(switchticks, ticks); } /* Wait for resume */ From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 01:06:22 2010 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 358EF1065675; Thu, 12 Aug 2010 01:06:22 +0000 (UTC) (envelope-from andy@fud.org.nz) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7E78F8FC17; Thu, 12 Aug 2010 01:06:21 +0000 (UTC) Received: by wyj26 with SMTP id 26so1008575wyj.13 for ; Wed, 11 Aug 2010 18:06:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.72.139 with SMTP id m11mr17081942wbj.30.1281573759583; Wed, 11 Aug 2010 17:42:39 -0700 (PDT) Sender: andy@fud.org.nz Received: by 10.227.138.65 with HTTP; Wed, 11 Aug 2010 17:42:39 -0700 (PDT) In-Reply-To: <201008120016.o7C0GI2t014914@svn.freebsd.org> References: <201008120016.o7C0GI2t014914@svn.freebsd.org> Date: Thu, 12 Aug 2010 12:42:39 +1200 X-Google-Sender-Auth: BjtuwGDxewX6kbA6UOIk73I4Qfg Message-ID: From: Andrew Thompson To: Takanori Watanabe Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211201 - in head: share/man/man4 sys/conf sys/dev/tpm sys/modules sys/modules/tpm 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, 12 Aug 2010 01:06:22 -0000 On 12 August 2010 12:16, Takanori Watanabe wrote: > Author: takawata > Date: Thu Aug 12 00:16:18 2010 > New Revision: 211201 > URL: http://svn.freebsd.org/changeset/base/211201 > > Log: > =A0Add tpm(4) driver for Trusted Platform Module. > =A0You may want to look at http://bsssd.sourceforge.net/ . > > =A0Submitted by: Hans-Joerg Hoexer > > Added: > =A0head/share/man/man4/tpm.4 =A0 (contents, props changed) > =A0head/sys/dev/tpm/ > =A0head/sys/dev/tpm/tpm.c =A0 (contents, props changed) > =A0head/sys/dev/tpm/tpm_acpi.c =A0 (contents, props changed) > =A0head/sys/dev/tpm/tpm_isa.c =A0 (contents, props changed) > =A0head/sys/dev/tpm/tpmvar.h =A0 (contents, props changed) > =A0head/sys/modules/tpm/ > =A0head/sys/modules/tpm/Makefile =A0 (contents, props changed) > Modified: > =A0head/sys/conf/files.i386 > =A0head/sys/modules/Makefile > > Added: head/share/man/man4/tpm.4 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added) > +++ head/share/man/man4/tpm.4 =A0 Thu Aug 12 00:16:18 2010 =A0 =A0 =A0 = =A0(r211201) > @@ -0,0 +1,74 @@ > +.\" > +.\" Copyright (c) 2010 Hans-J His name appears truncated here, the other files seem ok. Andrew From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 01:08:50 2010 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 DB39E106568B; Thu, 12 Aug 2010 01:08:50 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA2858FC1E; Thu, 12 Aug 2010 01:08:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C18omU026500; Thu, 12 Aug 2010 01:08:50 GMT (envelope-from takawata@svn.freebsd.org) Received: (from takawata@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C18oTR026498; Thu, 12 Aug 2010 01:08:50 GMT (envelope-from takawata@svn.freebsd.org) Message-Id: <201008120108.o7C18oTR026498@svn.freebsd.org> From: Takanori Watanabe Date: Thu, 12 Aug 2010 01:08: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: r211204 - 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: Thu, 12 Aug 2010 01:08:51 -0000 Author: takawata Date: Thu Aug 12 01:08:50 2010 New Revision: 211204 URL: http://svn.freebsd.org/changeset/base/211204 Log: Fix copyright information. Modified: head/share/man/man4/tpm.4 Modified: head/share/man/man4/tpm.4 ============================================================================== --- head/share/man/man4/tpm.4 Thu Aug 12 00:55:35 2010 (r211203) +++ head/share/man/man4/tpm.4 Thu Aug 12 01:08:50 2010 (r211204) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2010 Hans-J +.\" Copyright (c) 2010 Hans-Joerg Hoexer .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 05:59:55 2010 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 CD4C6106567B; Thu, 12 Aug 2010 05:59:55 +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 BC5A38FC16; Thu, 12 Aug 2010 05:59:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C5xtIk090365; Thu, 12 Aug 2010 05:59:55 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C5xtDR090364; Thu, 12 Aug 2010 05:59:55 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201008120559.o7C5xtDR090364@svn.freebsd.org> From: Martin Matuska Date: Thu, 12 Aug 2010 05:59:55 +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: r211205 - stable/8/sys/boot/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: Thu, 12 Aug 2010 05:59:55 -0000 Author: mm Date: Thu Aug 12 05:59:55 2010 New Revision: 211205 URL: http://svn.freebsd.org/changeset/base/211205 Log: MFC r211091: Return EIO if vdev->v_phys_read is NULL. This fixes booting from a ZFS mirror with a unavailable primary device. PR: kern/148655 Reviewed by: avg Approved by: delphij (mentor) Modified: stable/8/sys/boot/zfs/zfsimpl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/boot/zfs/zfsimpl.c ============================================================================== --- stable/8/sys/boot/zfs/zfsimpl.c Thu Aug 12 01:08:50 2010 (r211204) +++ stable/8/sys/boot/zfs/zfsimpl.c Thu Aug 12 05:59:55 2010 (r211205) @@ -328,6 +328,9 @@ vdev_read_phys(vdev_t *vdev, const blkpt size_t psize; int rc; + if (!vdev->v_phys_read) + return (EIO); + if (bp) { psize = BP_GET_PSIZE(bp); } else { From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 06:06:14 2010 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 CA2BC1065670; Thu, 12 Aug 2010 06:06:14 +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 9EF058FC0A; Thu, 12 Aug 2010 06:06:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C66Egi091926; Thu, 12 Aug 2010 06:06:14 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C66Eav091923; Thu, 12 Aug 2010 06:06:14 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008120606.o7C66Eav091923@svn.freebsd.org> From: Adrian Chadd Date: Thu, 12 Aug 2010 06:06: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: r211206 - head/sys/dev/ath/ath_hal/ar5212 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, 12 Aug 2010 06:06:14 -0000 Author: adrian Date: Thu Aug 12 06:06:14 2010 New Revision: 211206 URL: http://svn.freebsd.org/changeset/base/211206 Log: Add a couple of functions to check NF calibration progress / completion. Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212.h Thu Aug 12 05:59:55 2010 (r211205) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h Thu Aug 12 06:06:14 2010 (r211206) @@ -608,4 +608,8 @@ extern void ar5212AniPoll(struct ath_hal const struct ieee80211_channel *); extern void ar5212AniReset(struct ath_hal *, const struct ieee80211_channel *, HAL_OPMODE, int); + +extern HAL_BOOL ar5212IsNFCalInProgress(struct ath_hal *ah); +extern HAL_BOOL ar5212WaitNFCalComplete(struct ath_hal *ah, int i); + #endif /* _ATH_AR5212_H_ */ Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Thu Aug 12 05:59:55 2010 (r211205) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Thu Aug 12 06:06:14 2010 (r211206) @@ -1071,3 +1071,38 @@ ar5212GetDiagState(struct ath_hal *ah, i } return AH_FALSE; } + +/* + * Check whether there's an in-progress NF completion. + * + * Returns AH_TRUE if there's a in-progress NF calibration, AH_FALSE + * otherwise. + */ +HAL_BOOL +ar5212IsNFCalInProgress(struct ath_hal *ah) +{ + if (OS_REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) + return AH_TRUE; + return AH_FALSE; +} + +/* + * Wait for an in-progress NF calibration to complete. + * + * The completion function waits "i" times 10uS. + * It returns AH_TRUE if the NF calibration completed (or was never + * in progress); AH_FALSE if it was still in progress after "i" checks. + */ +HAL_BOOL +ar5212WaitNFCalComplete(struct ath_hal *ah, int i) +{ + int j; + if (i <= 0) + i = 1; /* it should run at least once */ + for (j = 0; j < i; j++) { + if (! ar5212IsNFCalInProgress(ah)) + return AH_TRUE; + OS_DELAY(10); + } + return AH_FALSE; +} From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 06:08:36 2010 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 E7AC8106566B; Thu, 12 Aug 2010 06:08:36 +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 D6DDA8FC14; Thu, 12 Aug 2010 06:08:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C68afn092488; Thu, 12 Aug 2010 06:08:36 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C68asp092486; Thu, 12 Aug 2010 06:08:36 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008120608.o7C68asp092486@svn.freebsd.org> From: Adrian Chadd Date: Thu, 12 Aug 2010 06:08: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: r211207 - 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, 12 Aug 2010 06:08:37 -0000 Author: adrian Date: Thu Aug 12 06:08:36 2010 New Revision: 211207 URL: http://svn.freebsd.org/changeset/base/211207 Log: Internal NF calibration should not occur in parallel with any other calibration. Ensure that the NF calibration completes before continuing with the rest of the calibration setup process. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Aug 12 06:06:14 2010 (r211206) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Aug 12 06:08:36 2010 (r211207) @@ -24,6 +24,8 @@ #include "ah_eeprom_v14.h" +#include "ar5212/ar5212.h" /* for NF cal related declarations */ + #include "ar5416/ar5416.h" #include "ar5416/ar5416reg.h" #include "ar5416/ar5416phy.h" @@ -220,7 +222,16 @@ ar5416InitCal(struct ath_hal *ah, const * triggered at the same time. */ OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF); - + /* + * Try to make sure the above NF cal completes, just so + * it doesn't clash with subsequent percals -adrian + */ + if (! ar5212WaitNFCalComplete(ah, 10000)) { + HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial NF calibration did " + "not complete in time; noisy environment?\n", __func__); + return AH_FALSE; + } + /* Initialize list pointers */ cal->cal_list = cal->cal_last = cal->cal_curr = AH_NULL; From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 06:11:44 2010 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 8FFF71065679; Thu, 12 Aug 2010 06:11:44 +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 7F3A58FC18; Thu, 12 Aug 2010 06:11:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C6Bi45093225; Thu, 12 Aug 2010 06:11:44 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C6BiUT093223; Thu, 12 Aug 2010 06:11:44 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008120611.o7C6BiUT093223@svn.freebsd.org> From: Adrian Chadd Date: Thu, 12 Aug 2010 06: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: r211208 - 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, 12 Aug 2010 06:11:44 -0000 Author: adrian Date: Thu Aug 12 06:11:44 2010 New Revision: 211208 URL: http://svn.freebsd.org/changeset/base/211208 Log: Ensure that the correct rxchainmask is used when doing calibration in the AR5416 and later chipsets. ath_hal_calibrateN() calls the HAL calibrateN function with rxchainmask=0x1. This is not necessarily the case for AR5416 and later chipsets. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Aug 12 06:08:36 2010 (r211207) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Aug 12 06:11:44 2010 (r211208) @@ -407,6 +407,13 @@ ar5416PerCalibrationN(struct ath_hal *ah *isCalDone = AH_TRUE; + /* + * Since ath_hal calls the PerCal method with rxchainmask=0x1; + * override it with the current chainmask. The upper levels currently + * doesn't know about the chainmask. + */ + rxchainmask = AH5416(ah)->ah_rx_chainmask; + /* Invalid channel check */ ichan = ath_hal_checkchannel(ah, chan); if (ichan == AH_NULL) { From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 06:12:39 2010 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 AA6811065687; Thu, 12 Aug 2010 06:12:39 +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 99C9F8FC0A; Thu, 12 Aug 2010 06:12:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C6CdoD093472; Thu, 12 Aug 2010 06:12:39 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C6CdJO093470; Thu, 12 Aug 2010 06:12:39 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008120612.o7C6CdJO093470@svn.freebsd.org> From: Adrian Chadd Date: Thu, 12 Aug 2010 06:12: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: r211209 - 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, 12 Aug 2010 06:12:39 -0000 Author: adrian Date: Thu Aug 12 06:12:39 2010 New Revision: 211209 URL: http://svn.freebsd.org/changeset/base/211209 Log: Fix indentation. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Aug 12 06:11:44 2010 (r211208) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Aug 12 06:12:39 2010 (r211209) @@ -225,7 +225,7 @@ ar5416InitCal(struct ath_hal *ah, const /* * Try to make sure the above NF cal completes, just so * it doesn't clash with subsequent percals -adrian - */ + */ if (! ar5212WaitNFCalComplete(ah, 10000)) { HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial NF calibration did " "not complete in time; noisy environment?\n", __func__); From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 06:14:26 2010 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 B29351065675; Thu, 12 Aug 2010 06:14:26 +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 A20BA8FC16; Thu, 12 Aug 2010 06:14:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C6EQ0Y093901; Thu, 12 Aug 2010 06:14:26 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C6EQ6g093899; Thu, 12 Aug 2010 06:14:26 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008120614.o7C6EQ6g093899@svn.freebsd.org> From: Adrian Chadd Date: Thu, 12 Aug 2010 06:14: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: r211210 - 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, 12 Aug 2010 06:14:26 -0000 Author: adrian Date: Thu Aug 12 06:14:26 2010 New Revision: 211210 URL: http://svn.freebsd.org/changeset/base/211210 Log: Use ar5212IsNFCalInProgress() to check for NF calibration progress. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Aug 12 06:12:39 2010 (r211209) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Aug 12 06:14:26 2010 (r211210) @@ -632,7 +632,7 @@ ar5416GetNf(struct ath_hal *ah, struct i { int16_t nf, nfThresh; - if (OS_REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) { + if (ar5212IsNFCalInProgress(ah)) { HALDEBUG(ah, HAL_DEBUG_ANY, "%s: NF didn't complete in calibration window\n", __func__); nf = 0; From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 06:20:54 2010 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 C0515106567B; Thu, 12 Aug 2010 06:20:54 +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 951058FC17; Thu, 12 Aug 2010 06:20:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C6Ksp8095358; Thu, 12 Aug 2010 06:20:54 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C6Ks20095356; Thu, 12 Aug 2010 06:20:54 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008120620.o7C6Ks20095356@svn.freebsd.org> From: Adrian Chadd Date: Thu, 12 Aug 2010 06:20: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: r211211 - 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, 12 Aug 2010 06:20:54 -0000 Author: adrian Date: Thu Aug 12 06:20:54 2010 New Revision: 211211 URL: http://svn.freebsd.org/changeset/base/211211 Log: Loading the NF CCA values may take longer than expected to occur. If it does, don't then try reprogramming the NF "cap" values (ie what values are the "maximum" value the NF can be) - instead, just leave the current CCA value as the NF cap. This was inspired by some similar work from ath9k. It isn't a 100% complete solution (as there may be some reason where a high NF CCA/cap is written, causing the baseband to stop thinking it is able to transmit, leading to stuck beacon and interface reset) which I'll investigate and look at fixing in a later commit. Obtained from: Linux Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Aug 12 06:14:26 2010 (r211210) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Aug 12 06:20:54 2010 (r211211) @@ -527,7 +527,7 @@ ar5416LoadNF(struct ath_hal *ah, const s AR_PHY_CH2_EXT_CCA }; struct ar5212NfCalHist *h; - int i, j; + int i; int32_t val; uint8_t chainmask; @@ -562,11 +562,20 @@ ar5416LoadNF(struct ath_hal *ah, const s OS_REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NO_UPDATE_NF); OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF); - /* Wait for load to complete, should be fast, a few 10s of us. */ - for (j = 0; j < 1000; j++) { - if ((OS_REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) == 0) - break; - OS_DELAY(10); + if (! ar5212WaitNFCalComplete(ah, 1000)) { + /* + * We timed out waiting for the noisefloor to load, probably due to an + * in-progress rx. Simply return here and allow the load plenty of time + * to complete before the next calibration interval. We need to avoid + * trying to load -50 (which happens below) while the previous load is + * still in progress as this can cause rx deafness. Instead by returning + * here, the baseband nf cal will just be capped by our present + * noisefloor until the next calibration timer. + */ + HALDEBUG(ah, HAL_DEBUG_ANY, "Timeout while waiting for nf " + "to load: AR_PHY_AGC_CONTROL=0x%x\n", + OS_REG_READ(ah, AR_PHY_AGC_CONTROL)); + return; } /* From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 06:29:15 2010 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 2F3131065680; Thu, 12 Aug 2010 06:29:15 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 895CC8FC0A; Thu, 12 Aug 2010 06:29:14 +0000 (UTC) Received: by ewy26 with SMTP id 26so565619ewy.13 for ; Wed, 11 Aug 2010 23:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=OE1nRERjaXu44Oxb0j+SN4UQ40k/AfFvR84w+R0OyEg=; b=QzUVRuqIHvzB61aQcuu2TiEUO+UESQBe7mZXf2fv0hPGy4nU+JI+tyOUdKMs9bN6qi 4GzV4WiYgHei4G0OYyBh5BkdqIYL8VE+oCiLSWgE4wiYcgahXh+VqUaKHnt4um7IF+zn 3hMYM2KAX0MAG+R3yqsC7EhFKk+XBaMKeJNDI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=brto5BPV8NEgJqgRfTivk0iPk8mAzTNTovHxiRRTrtjW5/QqZ5kML5uGoGLatgsUT3 48YKhveJ7hAyhCbcFvNxTce9+CllAHgptkybzrErkqO4O0unou0IK8APqAiyna/aK6Ab 9ueTcCR0BIZ+T4/AbgFp8UyQalRSMHpW59gSw= MIME-Version: 1.0 Received: by 10.213.32.212 with SMTP id e20mr16165267ebd.80.1281592960597; Wed, 11 Aug 2010 23:02:40 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.213.112.140 with HTTP; Wed, 11 Aug 2010 23:02:40 -0700 (PDT) In-Reply-To: <20100811141755.GR76386@hoeg.nl> References: <201008101436.o7AEaK3l047212@svn.freebsd.org> <20100811141755.GR76386@hoeg.nl> Date: Thu, 12 Aug 2010 14:02:40 +0800 X-Google-Sender-Auth: nUYO50N6y9vCv97a88yVY2J25Lw Message-ID: From: Adrian Chadd To: Ed Schouten Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "M. Warner Losh" Subject: Re: svn commit: r211146 - head 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, 12 Aug 2010 06:29:15 -0000 On 11 August 2010 22:17, Ed Schouten wrote: > Hi Adrian, > > * Adrian Chadd wrote: >> Modified: >> =A0 head/Makefile.mips > > Can't this file be simply removed now? I think so. Warner? Adrian From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 07:05:50 2010 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 48291106564A; Thu, 12 Aug 2010 07:05:50 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 07E9E8FC1B; Thu, 12 Aug 2010 07:05:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o7C73AwC099212; Thu, 12 Aug 2010 01:03:10 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 12 Aug 2010 01:03:41 -0600 (MDT) Message-Id: <20100812.010341.999284356065411453.imp@bsdimp.com> To: adrian@FreeBSD.org From: "M. Warner Losh" In-Reply-To: References: <201008101436.o7AEaK3l047212@svn.freebsd.org> <20100811141755.GR76386@hoeg.nl> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, ed@80386.nl, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r211146 - head 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, 12 Aug 2010 07:05:50 -0000 In message: Adrian Chadd writes: : On 11 August 2010 22:17, Ed Schouten wrote: : > Hi Adrian, : > : > * Adrian Chadd wrote: : >> Modified: : >> =A0 head/Makefile.mips : > : > Can't this file be simply removed now? : = : I think so. Warner? I was planning on removing it once I finished the tbemd merge that's stalled :(. There's a small chance we may need it in the near future (like within the month), and I'd like to make sure we really don't before deleting it. Warner From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 07:37:58 2010 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 85173106566C; Thu, 12 Aug 2010 07:37:58 +0000 (UTC) (envelope-from simon@nitro.dk) Received: from mx.nitro.dk (unknown [77.75.165.90]) by mx1.freebsd.org (Postfix) with ESMTP id 473B78FC17; Thu, 12 Aug 2010 07:37:58 +0000 (UTC) Received: from arthur.nitro.dk (arthur.bofh [192.168.2.3]) by mx.nitro.dk (Postfix) with ESMTP id 242862D51D8; Thu, 12 Aug 2010 07:37:57 +0000 (UTC) Received: by arthur.nitro.dk (Postfix, from userid 1000) id 0167E5C1A; Thu, 12 Aug 2010 09:37:56 +0200 (CEST) Date: Thu, 12 Aug 2010 09:37:56 +0200 From: "Simon L. Nielsen" To: Will Andrews Message-ID: <20100812073755.GA1583@arthur.nitro.dk> References: <201008110051.o7B0pp10084996@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201008110051.o7B0pp10084996@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211157 - in head/sys: modules modules/if_carp net netinet netinet6 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, 12 Aug 2010 07:37:58 -0000 On 2010.08.11 00:51:51 +0000, Will Andrews wrote: > Author: will > Date: Wed Aug 11 00:51:50 2010 > New Revision: 211157 > URL: http://svn.freebsd.org/changeset/base/211157 > > Log: > Allow carp(4) to be loaded as a kernel module. Follow precedent set by > bridge(4), lagg(4) etc. and make use of function pointers and > pf_proto_register() to hook carp into the network stack. Yay! Thanks! I'm really looking forward to not having to handle compile kernels when upgrading to 8.2 on all my CARP based systems :-). -- Simon L. Nielsen From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 08:35:24 2010 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 96C61106564A; Thu, 12 Aug 2010 08:35:24 +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 6C0D28FC1B; Thu, 12 Aug 2010 08:35:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C8ZOGC025090; Thu, 12 Aug 2010 08:35:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C8ZOYm025088; Thu, 12 Aug 2010 08:35:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008120835.o7C8ZOYm025088@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 12 Aug 2010 08:35: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: r211212 - head/sys/ufs/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, 12 Aug 2010 08:35:24 -0000 Author: kib Date: Thu Aug 12 08:35:24 2010 New Revision: 211212 URL: http://svn.freebsd.org/changeset/base/211212 Log: Softdep_process_worklist() should unsuspend not only before processing the worklist (in softdep_process_journal), but also after flushing the workitems. Might be, we should even do this before bwillwrite() too, but this seems to be not needed for now. Fs might be suspended during processing the queue, and then there is nobody around to unsuspend. In collaboration with: pho Tested by: bz Reviewed by: jeff Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Thu Aug 12 06:20:54 2010 (r211211) +++ head/sys/ufs/ffs/ffs_softdep.c Thu Aug 12 08:35:24 2010 (r211212) @@ -857,6 +857,7 @@ static int journal_mount(struct mount *, static void journal_unmount(struct mount *); static int journal_space(struct ufsmount *, int); static void journal_suspend(struct ufsmount *); +static int journal_unsuspend(struct ufsmount *ump); static void softdep_prelink(struct vnode *, struct vnode *); static void add_to_journal(struct worklist *); static void remove_from_journal(struct worklist *); @@ -1390,6 +1391,8 @@ softdep_process_worklist(mp, full) if (!full && starttime != time_second) break; } + if (full == 0) + journal_unsuspend(ump); FREE_LOCK(&lk); return (matchcnt); } @@ -2436,6 +2439,27 @@ journal_suspend(ump) MNT_IUNLOCK(mp); } +static int +journal_unsuspend(struct ufsmount *ump) +{ + struct jblocks *jblocks; + struct mount *mp; + + mp = UFSTOVFS(ump); + jblocks = ump->softdep_jblocks; + + if (jblocks != NULL && jblocks->jb_suspended && + journal_space(ump, jblocks->jb_min)) { + jblocks->jb_suspended = 0; + FREE_LOCK(&lk); + mp->mnt_susp_owner = curthread; + vfs_write_resume(mp); + ACQUIRE_LOCK(&lk); + return (1); + } + return (0); +} + /* * Called before any allocation function to be certain that there is * sufficient space in the journal prior to creating any new records. @@ -2852,15 +2876,9 @@ softdep_process_journal(mp, flags) * space either try to sync it here to make some progress or * unsuspend it if we already have. */ - if (flags == 0 && jblocks && jblocks->jb_suspended) { - if (journal_space(ump, jblocks->jb_min)) { - FREE_LOCK(&lk); - jblocks->jb_suspended = 0; - mp->mnt_susp_owner = curthread; - vfs_write_resume(mp); - ACQUIRE_LOCK(&lk); + if (flags == 0 && jblocks->jb_suspended) { + if (journal_unsuspend(ump)) return; - } FREE_LOCK(&lk); VFS_SYNC(mp, MNT_NOWAIT); ffs_sbupdate(ump, MNT_WAIT, 0); From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 08:36:23 2010 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 8CE071065680; Thu, 12 Aug 2010 08:36: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 7C09F8FC0C; Thu, 12 Aug 2010 08:36:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C8aNPB025324; Thu, 12 Aug 2010 08:36:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C8aNJO025321; Thu, 12 Aug 2010 08:36:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008120836.o7C8aNJO025321@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 12 Aug 2010 08:36: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: r211213 - 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, 12 Aug 2010 08:36:23 -0000 Author: kib Date: Thu Aug 12 08:36:23 2010 New Revision: 211213 URL: http://svn.freebsd.org/changeset/base/211213 Log: The buffers b_vflags field is not always properly protected by bufobj lock. If b_bufobj is not NULL, then bufobj lock should be held when manipulating the flags. Not doing this sometimes leaves BV_BKGRDINPROG to be erronously set, causing softdep' getdirtybuf() to stuck indefinitely in "getbuf" sleep, waiting for background write to finish which is not actually performed. Add BO_LOCK() in the cases where it was missed. In collaboration with: pho Tested by: bz Reviewed by: jeff MFC after: 1 month Modified: head/sys/kern/vfs_bio.c head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Aug 12 08:35:24 2010 (r211212) +++ head/sys/kern/vfs_bio.c Thu Aug 12 08:36:23 2010 (r211213) @@ -398,6 +398,8 @@ bufcountwakeup(struct buf *bp) KASSERT((bp->b_vflags & BV_INFREECNT) == 0, ("buf %p already counted as free", bp)); + if (bp->b_bufobj != NULL) + mtx_assert(BO_MTX(bp->b_bufobj), MA_OWNED); bp->b_vflags |= BV_INFREECNT; old = atomic_fetchadd_int(&numfreebuffers, 1); KASSERT(old >= 0 && old < nbuf, @@ -714,6 +716,8 @@ bremfree(struct buf *bp) if ((bp->b_flags & B_INVAL) || (bp->b_flags & B_DELWRI) == 0) { KASSERT((bp->b_vflags & BV_INFREECNT) != 0, ("buf %p not counted in numfreebuffers", bp)); + if (bp->b_bufobj != NULL) + mtx_assert(BO_MTX(bp->b_bufobj), MA_OWNED); bp->b_vflags &= ~BV_INFREECNT; old = atomic_fetchadd_int(&numfreebuffers, -1); KASSERT(old > 0, ("numfreebuffers dropped to %d", old - 1)); @@ -770,6 +774,8 @@ bremfreel(struct buf *bp) if ((bp->b_flags & B_INVAL) || (bp->b_flags & B_DELWRI) == 0) { KASSERT((bp->b_vflags & BV_INFREECNT) != 0, ("buf %p not counted in numfreebuffers", bp)); + if (bp->b_bufobj != NULL) + mtx_assert(BO_MTX(bp->b_bufobj), MA_OWNED); bp->b_vflags &= ~BV_INFREECNT; old = atomic_fetchadd_int(&numfreebuffers, -1); KASSERT(old > 0, ("numfreebuffers dropped to %d", old - 1)); @@ -1412,8 +1418,16 @@ brelse(struct buf *bp) /* enqueue */ mtx_lock(&bqlock); /* Handle delayed bremfree() processing. */ - if (bp->b_flags & B_REMFREE) + if (bp->b_flags & B_REMFREE) { + struct bufobj *bo; + + bo = bp->b_bufobj; + if (bo != NULL) + BO_LOCK(bo); bremfreel(bp); + if (bo != NULL) + BO_UNLOCK(bo); + } if (bp->b_qindex != QUEUE_NONE) panic("brelse: free buffer onto another queue???"); @@ -1474,8 +1488,16 @@ brelse(struct buf *bp) * if B_INVAL is set ). */ - if (!(bp->b_flags & B_DELWRI)) + if (!(bp->b_flags & B_DELWRI)) { + struct bufobj *bo; + + bo = bp->b_bufobj; + if (bo != NULL) + BO_LOCK(bo); bufcountwakeup(bp); + if (bo != NULL) + BO_UNLOCK(bo); + } /* * Something we can maybe free or reuse @@ -1504,6 +1526,8 @@ brelse(struct buf *bp) void bqrelse(struct buf *bp) { + struct bufobj *bo; + CTR3(KTR_BUF, "bqrelse(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags); KASSERT(!(bp->b_flags & (B_CLUSTER|B_PAGING)), ("bqrelse: inappropriate B_PAGING or B_CLUSTER bp %p", bp)); @@ -1514,10 +1538,15 @@ bqrelse(struct buf *bp) return; } + bo = bp->b_bufobj; if (bp->b_flags & B_MANAGED) { if (bp->b_flags & B_REMFREE) { mtx_lock(&bqlock); + if (bo != NULL) + BO_LOCK(bo); bremfreel(bp); + if (bo != NULL) + BO_UNLOCK(bo); mtx_unlock(&bqlock); } bp->b_flags &= ~(B_ASYNC | B_NOCACHE | B_AGE | B_RELBUF); @@ -1527,8 +1556,13 @@ bqrelse(struct buf *bp) mtx_lock(&bqlock); /* Handle delayed bremfree() processing. */ - if (bp->b_flags & B_REMFREE) + if (bp->b_flags & B_REMFREE) { + if (bo != NULL) + BO_LOCK(bo); bremfreel(bp); + if (bo != NULL) + BO_UNLOCK(bo); + } if (bp->b_qindex != QUEUE_NONE) panic("bqrelse: free buffer onto another queue???"); /* buffers with stale but valid contents */ @@ -1563,8 +1597,13 @@ bqrelse(struct buf *bp) } mtx_unlock(&bqlock); - if ((bp->b_flags & B_INVAL) || !(bp->b_flags & B_DELWRI)) + if ((bp->b_flags & B_INVAL) || !(bp->b_flags & B_DELWRI)) { + if (bo != NULL) + BO_LOCK(bo); bufcountwakeup(bp); + if (bo != NULL) + BO_UNLOCK(bo); + } /* * Something we can maybe free or reuse. @@ -1898,7 +1937,11 @@ restart: KASSERT((bp->b_flags & B_DELWRI) == 0, ("delwri buffer %p found in queue %d", bp, qindex)); + if (bp->b_bufobj != NULL) + BO_LOCK(bp->b_bufobj); bremfreel(bp); + if (bp->b_bufobj != NULL) + BO_UNLOCK(bp->b_bufobj); mtx_unlock(&bqlock); if (qindex == QUEUE_CLEAN) { @@ -2635,7 +2678,9 @@ loop: bp->b_flags &= ~B_CACHE; else if ((bp->b_flags & (B_VMIO | B_INVAL)) == 0) bp->b_flags |= B_CACHE; + BO_LOCK(bo); bremfree(bp); + BO_UNLOCK(bo); /* * check for size inconsistancies for non-VMIO case. Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Thu Aug 12 08:35:24 2010 (r211212) +++ head/sys/kern/vfs_subr.c Thu Aug 12 08:36:23 2010 (r211213) @@ -1260,13 +1260,17 @@ flushbuflist( struct bufv *bufv, int fla */ if (((bp->b_flags & (B_DELWRI | B_INVAL)) == B_DELWRI) && (flags & V_SAVE)) { + BO_LOCK(bo); bremfree(bp); + BO_UNLOCK(bo); bp->b_flags |= B_ASYNC; bwrite(bp); BO_LOCK(bo); return (EAGAIN); /* XXX: why not loop ? */ } + BO_LOCK(bo); bremfree(bp); + BO_UNLOCK(bo); bp->b_flags |= (B_INVAL | B_RELBUF); bp->b_flags &= ~B_ASYNC; brelse(bp); @@ -1318,7 +1322,9 @@ restart: BO_MTX(bo)) == ENOLCK) goto restart; + BO_LOCK(bo); bremfree(bp); + BO_UNLOCK(bo); bp->b_flags |= (B_INVAL | B_RELBUF); bp->b_flags &= ~B_ASYNC; brelse(bp); @@ -1340,7 +1346,9 @@ restart: LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK, BO_MTX(bo)) == ENOLCK) goto restart; + BO_LOCK(bo); bremfree(bp); + BO_UNLOCK(bo); bp->b_flags |= (B_INVAL | B_RELBUF); bp->b_flags &= ~B_ASYNC; brelse(bp); @@ -1372,7 +1380,9 @@ restartsync: VNASSERT((bp->b_flags & B_DELWRI), vp, ("buf(%p) on dirty queue without DELWRI", bp)); + BO_LOCK(bo); bremfree(bp); + BO_UNLOCK(bo); bawrite(bp); BO_LOCK(bo); goto restartsync; From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 08:39:54 2010 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 7BE5F1065687; Thu, 12 Aug 2010 08:39:54 +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 6B2208FC1C; Thu, 12 Aug 2010 08:39:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C8dsOA026111; Thu, 12 Aug 2010 08:39:54 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C8dsVH026109; Thu, 12 Aug 2010 08:39:54 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008120839.o7C8dsVH026109@svn.freebsd.org> From: Adrian Chadd Date: Thu, 12 Aug 2010 08:39: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: r211214 - 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, 12 Aug 2010 08:39:54 -0000 Author: adrian Date: Thu Aug 12 08:39:54 2010 New Revision: 211214 URL: http://svn.freebsd.org/changeset/base/211214 Log: * Fix indentation * Restore comment erroneously deleted from the previous commit Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Aug 12 08:36:23 2010 (r211213) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu Aug 12 08:39:54 2010 (r211214) @@ -562,6 +562,7 @@ ar5416LoadNF(struct ath_hal *ah, const s OS_REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NO_UPDATE_NF); OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF); + /* Wait for load to complete, should be fast, a few 10s of us. */ if (! ar5212WaitNFCalComplete(ah, 1000)) { /* * We timed out waiting for the noisefloor to load, probably due to an @@ -575,7 +576,7 @@ ar5416LoadNF(struct ath_hal *ah, const s HALDEBUG(ah, HAL_DEBUG_ANY, "Timeout while waiting for nf " "to load: AR_PHY_AGC_CONTROL=0x%x\n", OS_REG_READ(ah, AR_PHY_AGC_CONTROL)); - return; + return; } /* From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 09:03:21 2010 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 8C61E106564A; Thu, 12 Aug 2010 09:03:21 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7AFD08FC22; Thu, 12 Aug 2010 09:03:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C93LYm031304; Thu, 12 Aug 2010 09:03:21 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C93LA6031302; Thu, 12 Aug 2010 09:03:21 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201008120903.o7C93LA6031302@svn.freebsd.org> From: "Jayachandran C." Date: Thu, 12 Aug 2010 09:03: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: r211215 - head/sys/mips/mips 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, 12 Aug 2010 09:03:21 -0000 Author: jchandra Date: Thu Aug 12 09:03:21 2010 New Revision: 211215 URL: http://svn.freebsd.org/changeset/base/211215 Log: Re-arrange the pmap calls that use smp_rendezvous() on SMP, so that their per-cpu variants are also available to be called. The per-cpu variants are needed for some later optimizations. Also remove unnecessary casts, do some style fixes. Reviewed by: alc, neel Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Thu Aug 12 08:39:54 2010 (r211214) +++ head/sys/mips/mips/pmap.c Thu Aug 12 09:03:21 2010 (r211215) @@ -173,7 +173,6 @@ static void pmap_pvh_free(struct md_page static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va); static __inline void pmap_changebit(vm_page_t m, int bit, boolean_t setem); - static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); static int pmap_remove_pte(struct pmap *pmap, pt_entry_t *ptq, vm_offset_t va); @@ -181,7 +180,8 @@ static void pmap_remove_page(struct pmap static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_page_t mpte, vm_offset_t va, vm_page_t m); -static __inline void pmap_invalidate_page(pmap_t pmap, vm_offset_t va); +static void pmap_invalidate_all(pmap_t pmap); +static void pmap_invalidate_page(pmap_t pmap, vm_offset_t va); static int _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m); static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags); @@ -592,61 +592,100 @@ pmap_nw_modified(pt_entry_t pte) else return (0); } - #endif +static __inline void +pmap_invalidate_all_local(pmap_t pmap) +{ + + if (pmap == kernel_pmap) { + tlb_invalidate_all(); + return; + } + if (pmap->pm_active & PCPU_GET(cpumask)) + tlb_invalidate_all_user(pmap); + else + pmap->pm_asid[PCPU_GET(cpuid)].gen = 0; +} + +#ifdef SMP static void pmap_invalidate_all(pmap_t pmap) { -#ifdef SMP - smp_rendezvous(0, pmap_invalidate_all_action, 0, (void *)pmap); + + smp_rendezvous(0, pmap_invalidate_all_action, 0, pmap); } static void pmap_invalidate_all_action(void *arg) { - pmap_t pmap = (pmap_t)arg; + pmap_invalidate_all_local((pmap_t)arg); +} +#else +static void +pmap_invalidate_all(pmap_t pmap) +{ + + pmap_invalidate_all_local(pmap); +} #endif - if (pmap == kernel_pmap) { - tlb_invalidate_all(); +static __inline void +pmap_invalidate_page_local(pmap_t pmap, vm_offset_t va) +{ + + if (is_kernel_pmap(pmap)) { + tlb_invalidate_address(pmap, va); return; } - - if (pmap->pm_active & PCPU_GET(cpumask)) - tlb_invalidate_all_user(pmap); - else + if (pmap->pm_asid[PCPU_GET(cpuid)].gen != PCPU_GET(asid_generation)) + return; + else if (!(pmap->pm_active & PCPU_GET(cpumask))) { pmap->pm_asid[PCPU_GET(cpuid)].gen = 0; + return; + } + tlb_invalidate_address(pmap, va); } +#ifdef SMP struct pmap_invalidate_page_arg { pmap_t pmap; vm_offset_t va; }; -static __inline void +static void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { -#ifdef SMP struct pmap_invalidate_page_arg arg; arg.pmap = pmap; arg.va = va; - - smp_rendezvous(0, pmap_invalidate_page_action, 0, (void *)&arg); + smp_rendezvous(0, pmap_invalidate_page_action, 0, &arg); } static void pmap_invalidate_page_action(void *arg) { - pmap_t pmap = ((struct pmap_invalidate_page_arg *)arg)->pmap; - vm_offset_t va = ((struct pmap_invalidate_page_arg *)arg)->va; + struct pmap_invalidate_page_arg *p = arg; + + pmap_invalidate_page_local(p->pmap, p->va); +} +#else +static void +pmap_invalidate_page(pmap_t pmap, vm_offset_t va) +{ + pmap_invalidate_page_local(pmap, va); +} #endif +static __inline void +pmap_update_page_local(pmap_t pmap, vm_offset_t va, pt_entry_t pte) +{ + if (is_kernel_pmap(pmap)) { - tlb_invalidate_address(pmap, va); + tlb_update(pmap, va, pte); return; } if (pmap->pm_asid[PCPU_GET(cpuid)].gen != PCPU_GET(asid_generation)) @@ -655,9 +694,10 @@ pmap_invalidate_page_action(void *arg) pmap->pm_asid[PCPU_GET(cpuid)].gen = 0; return; } - tlb_invalidate_address(pmap, va); + tlb_update(pmap, va, pte); } +#ifdef SMP struct pmap_update_page_arg { pmap_t pmap; vm_offset_t va; @@ -667,36 +707,29 @@ struct pmap_update_page_arg { void pmap_update_page(pmap_t pmap, vm_offset_t va, pt_entry_t pte) { -#ifdef SMP struct pmap_update_page_arg arg; arg.pmap = pmap; arg.va = va; arg.pte = pte; - - smp_rendezvous(0, pmap_update_page_action, 0, (void *)&arg); + smp_rendezvous(0, pmap_update_page_action, 0, &arg); } static void pmap_update_page_action(void *arg) { - pmap_t pmap = ((struct pmap_update_page_arg *)arg)->pmap; - vm_offset_t va = ((struct pmap_update_page_arg *)arg)->va; - pt_entry_t pte = ((struct pmap_update_page_arg *)arg)->pte; + struct pmap_update_page_arg *p = arg; -#endif - if (is_kernel_pmap(pmap)) { - tlb_update(pmap, va, pte); - return; - } - if (pmap->pm_asid[PCPU_GET(cpuid)].gen != PCPU_GET(asid_generation)) - return; - else if (!(pmap->pm_active & PCPU_GET(cpumask))) { - pmap->pm_asid[PCPU_GET(cpuid)].gen = 0; - return; - } - tlb_update(pmap, va, pte); + pmap_update_page_local(p->pmap, p->va, p->pte); +} +#else +void +pmap_update_page(pmap_t pmap, vm_offset_t va, pt_entry_t pte) +{ + + pmap_update_page_local(pmap, va, pte); } +#endif /* * Routine: pmap_extract From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 09:15:27 2010 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 B5AFC10657B5; Thu, 12 Aug 2010 09:15:27 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A48BB8FC15; Thu, 12 Aug 2010 09:15:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C9FREJ034104; Thu, 12 Aug 2010 09:15:27 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C9FRqn034102; Thu, 12 Aug 2010 09:15:27 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201008120915.o7C9FRqn034102@svn.freebsd.org> From: "Jayachandran C." Date: Thu, 12 Aug 2010 09: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: r211216 - head/sys/mips/mips 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, 12 Aug 2010 09:15:27 -0000 Author: jchandra Date: Thu Aug 12 09:15:27 2010 New Revision: 211216 URL: http://svn.freebsd.org/changeset/base/211216 Log: Optimization for pmap_kenter(), call pmap_update_page() only when necessary. On SMP, pmap_update_page() can be costly as it needs a a smp_rendezvous(). Reviewed by: alc, neel Obtained from: jmallett (http://svn.freebsd.org/base/user/jmallett/octeon) Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Thu Aug 12 09:03:21 2010 (r211215) +++ head/sys/mips/mips/pmap.c Thu Aug 12 09:15:27 2010 (r211216) @@ -810,7 +810,8 @@ pmap_kenter(vm_offset_t va, vm_paddr_t p pte = pmap_pte(kernel_pmap, va); opte = *pte; *pte = npte; - pmap_update_page(kernel_pmap, va, npte); + if (pte_test(&opte, PTE_V) && opte != npte) + pmap_update_page(kernel_pmap, va, npte); } /* From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 10:09:28 2010 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 723961065675; Thu, 12 Aug 2010 10:09:28 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5616D8FC0C; Thu, 12 Aug 2010 10:09:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CA9SGW046047; Thu, 12 Aug 2010 10:09:28 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CA9Sqf046043; Thu, 12 Aug 2010 10:09:28 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201008121009.o7CA9Sqf046043@svn.freebsd.org> From: "Jayachandran C." Date: Thu, 12 Aug 2010 10:09: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: r211217 - in head/sys/mips: include mips 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, 12 Aug 2010 10:09:28 -0000 Author: jchandra Date: Thu Aug 12 10:09:28 2010 New Revision: 211217 URL: http://svn.freebsd.org/changeset/base/211217 Log: Implement pmap changes suggested by alc@: 1. Move dirty bit emulation code that is duplicted for kernel and user in trap.c to a function pmap_emulate_modified() in pmap.c. 2. While doing dirty bit emulation, it is not necessary to update the TLB entry on all CPUs using smp_rendezvous(), we can just update the TLB entry on the current CPU, and let the other CPUs update their TLB entry lazily if they get an exception. Reviewed by: alc, neel Modified: head/sys/mips/include/pmap.h head/sys/mips/mips/pmap.c head/sys/mips/mips/trap.c Modified: head/sys/mips/include/pmap.h ============================================================================== --- head/sys/mips/include/pmap.h Thu Aug 12 09:15:27 2010 (r211216) +++ head/sys/mips/include/pmap.h Thu Aug 12 10:09:28 2010 (r211217) @@ -157,16 +157,14 @@ void pmap_bootstrap(void); void *pmap_mapdev(vm_offset_t, vm_size_t); void pmap_unmapdev(vm_offset_t, vm_size_t); vm_offset_t pmap_steal_memory(vm_size_t size); -void pmap_set_modified(vm_offset_t pa); int page_is_managed(vm_offset_t pa); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); void pmap_kremove(vm_offset_t va); void *pmap_kenter_temporary(vm_paddr_t pa, int i); void pmap_kenter_temporary_free(vm_paddr_t pa); int pmap_compute_pages_to_dump(void); -void pmap_update_page(pmap_t pmap, vm_offset_t va, pt_entry_t pte); void pmap_flush_pvcache(vm_page_t m); - +int pmap_emulate_modified(pmap_t pmap, vm_offset_t va); #endif /* _KERNEL */ #endif /* !LOCORE */ Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Thu Aug 12 09:15:27 2010 (r211216) +++ head/sys/mips/mips/pmap.c Thu Aug 12 10:09:28 2010 (r211217) @@ -180,6 +180,7 @@ static void pmap_remove_page(struct pmap static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_page_t mpte, vm_offset_t va, vm_page_t m); +static void pmap_update_page(pmap_t pmap, vm_offset_t va, pt_entry_t pte); static void pmap_invalidate_all(pmap_t pmap); static void pmap_invalidate_page(pmap_t pmap, vm_offset_t va); static int _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m); @@ -704,7 +705,7 @@ struct pmap_update_page_arg { pt_entry_t pte; }; -void +static void pmap_update_page(pmap_t pmap, vm_offset_t va, pt_entry_t pte) { struct pmap_update_page_arg arg; @@ -723,7 +724,7 @@ pmap_update_page_action(void *arg) pmap_update_page_local(p->pmap, p->va, p->pte); } #else -void +static void pmap_update_page(pmap_t pmap, vm_offset_t va, pt_entry_t pte) { @@ -3265,15 +3266,49 @@ init_pte_prot(vm_offset_t va, vm_page_t } /* - * pmap_set_modified: + * pmap_emulate_modified : do dirty bit emulation * - * Sets the page modified and reference bits for the specified page. + * On SMP, update just the local TLB, other CPUs will update their + * TLBs from PTE lazily, if they get the exception. + * Returns 0 in case of sucess, 1 if the page is read only and we + * need to fault. */ -void -pmap_set_modified(vm_offset_t pa) +int +pmap_emulate_modified(pmap_t pmap, vm_offset_t va) { + vm_page_t m; + pt_entry_t *pte; + vm_offset_t pa; - PHYS_TO_VM_PAGE(pa)->md.pv_flags |= (PV_TABLE_REF | PV_TABLE_MOD); + PMAP_LOCK(pmap); + pte = pmap_pte(pmap, va); + if (pte == NULL) + panic("pmap_emulate_modified: can't find PTE"); +#ifdef SMP + /* It is possible that some other CPU changed m-bit */ + if (!pte_test(pte, PTE_V) || pte_test(pte, PTE_D)) { + pmap_update_page_local(pmap, va, *pte); + PMAP_UNLOCK(pmap); + return (0); + } +#else + if (!pte_test(pte, PTE_V) || pte_test(pte, PTE_D)) + panic("pmap_emulate_modified: invalid pte"); +#endif + if (pte_test(pte, PTE_RO)) { + /* write to read only page in the kernel */ + PMAP_UNLOCK(pmap); + return (1); + } + pte_set(pte, PTE_D); + pmap_update_page_local(pmap, va, *pte); + pa = TLBLO_PTE_TO_PA(*pte); + if (!page_is_managed(pa)) + panic("pmap_emulate_modified: unmanaged page"); + m = PHYS_TO_VM_PAGE(pa); + m->md.pv_flags |= (PV_TABLE_REF | PV_TABLE_MOD); + PMAP_UNLOCK(pmap); + return (0); } /* Modified: head/sys/mips/mips/trap.c ============================================================================== --- head/sys/mips/mips/trap.c Thu Aug 12 09:15:27 2010 (r211216) +++ head/sys/mips/mips/trap.c Thu Aug 12 10:09:28 2010 (r211217) @@ -281,7 +281,6 @@ trap(struct trapframe *trapframe) struct thread *td = curthread; struct proc *p = curproc; vm_prot_t ftype; - pt_entry_t *pte; pmap_t pmap; int access_type; ksiginfo_t ksi; @@ -372,82 +371,24 @@ trap(struct trapframe *trapframe) case T_TLB_MOD: /* check for kernel address */ if (KERNLAND(trapframe->badvaddr)) { - vm_offset_t pa; - - PMAP_LOCK(kernel_pmap); - pte = pmap_pte(kernel_pmap, trapframe->badvaddr); - if (pte == NULL) - panic("trap: ktlbmod: can't find PTE"); -#ifdef SMP - /* It is possible that some other CPU changed m-bit */ - if (!pte_test(pte, PTE_V) || pte_test(pte, PTE_D)) { - pmap_update_page(kernel_pmap, - trapframe->badvaddr, *pte); - PMAP_UNLOCK(kernel_pmap); - return (trapframe->pc); - } -#else - if (!pte_test(pte, PTE_V) || pte_test(pte, PTE_D)) - panic("trap: ktlbmod: invalid pte"); -#endif - if (pte_test(pte, PTE_RO)) { - /* write to read only page in the kernel */ + if (pmap_emulate_modified(kernel_pmap, + trapframe->badvaddr) != 0) { ftype = VM_PROT_WRITE; - PMAP_UNLOCK(kernel_pmap); goto kernel_fault; } - pte_set(pte, PTE_D); - pmap_update_page(kernel_pmap, trapframe->badvaddr, *pte); - pa = TLBLO_PTE_TO_PA(*pte); - if (!page_is_managed(pa)) - panic("trap: ktlbmod: unmanaged page"); - pmap_set_modified(pa); - PMAP_UNLOCK(kernel_pmap); return (trapframe->pc); } /* FALLTHROUGH */ case T_TLB_MOD + T_USER: - { - vm_offset_t pa; - - pmap = &p->p_vmspace->vm_pmap; - - PMAP_LOCK(pmap); - pte = pmap_pte(pmap, trapframe->badvaddr); - if (pte == NULL) - panic("trap: utlbmod: can't find PTE"); -#ifdef SMP - /* It is possible that some other CPU changed m-bit */ - if (!pte_test(pte, PTE_V) || pte_test(pte, PTE_D)) { - pmap_update_page(pmap, trapframe->badvaddr, *pte); - PMAP_UNLOCK(pmap); - goto out; - } -#else - if (!pte_test(pte, PTE_V) || pte_test(pte, PTE_D)) - panic("trap: utlbmod: invalid pte"); -#endif - - if (pte_test(pte, PTE_RO)) { - /* write to read only page */ - ftype = VM_PROT_WRITE; - PMAP_UNLOCK(pmap); - goto dofault; - } - pte_set(pte, PTE_D); - pmap_update_page(pmap, trapframe->badvaddr, *pte); - pa = TLBLO_PTE_TO_PA(*pte); - if (!page_is_managed(pa)) - panic("trap: utlbmod: unmanaged page"); - pmap_set_modified(pa); - - PMAP_UNLOCK(pmap); - if (!usermode) { - return (trapframe->pc); - } - goto out; + pmap = &p->p_vmspace->vm_pmap; + if (pmap_emulate_modified(pmap, trapframe->badvaddr) != 0) { + ftype = VM_PROT_WRITE; + goto dofault; } + if (!usermode) + return (trapframe->pc); + goto out; case T_TLB_LD_MISS: case T_TLB_ST_MISS: From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 11:00:45 2010 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 CC3621065697; Thu, 12 Aug 2010 11:00:45 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BAE8B8FC17; Thu, 12 Aug 2010 11:00:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CB0jEB059336; Thu, 12 Aug 2010 11:00:45 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CB0jOB059331; Thu, 12 Aug 2010 11:00:45 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201008121100.o7CB0jOB059331@svn.freebsd.org> From: "Jayachandran C." Date: Thu, 12 Aug 2010 11:00: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: r211218 - head/sys/mips/mips 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, 12 Aug 2010 11:00:46 -0000 Author: jchandra Date: Thu Aug 12 11:00:45 2010 New Revision: 211218 URL: http://svn.freebsd.org/changeset/base/211218 Log: SMP support in n64. - Enable KX and UX bits on CPU startup for non-boot CPUs - Keep the KX bit when in userspace - XTLB handler needs it to access PCPU data - revert r210638 partly - we don't need to enable KX on kernel entry now Reviewed by: jmallett, imp Modified: head/sys/mips/mips/exception.S head/sys/mips/mips/mpboot.S head/sys/mips/mips/pm_machdep.c head/sys/mips/mips/vm_machdep.c Modified: head/sys/mips/mips/exception.S ============================================================================== --- head/sys/mips/mips/exception.S Thu Aug 12 10:09:28 2010 (r211217) +++ head/sys/mips/mips/exception.S Thu Aug 12 11:00:45 2010 (r211218) @@ -434,12 +434,6 @@ NNON_LEAF(MipsUserGenException, CALLFRAM /* * Save all of the registers except for the kernel temporaries in u.u_pcb. */ - mfc0 k0, MIPS_COP_0_STATUS - HAZARD_DELAY -#ifdef __mips_n64 - ori k1, k0, MIPS_SR_KX - mtc0 k1, MIPS_COP_0_STATUS -#endif GET_CPU_PCPU(k1) PTR_L k1, PC_CURPCB(k1) SAVE_U_PCB_REG(AT, AST, k1) @@ -457,7 +451,7 @@ NNON_LEAF(MipsUserGenException, CALLFRAM SAVE_U_PCB_REG(t2, T2, k1) SAVE_U_PCB_REG(t3, T3, k1) SAVE_U_PCB_REG(ta0, TA0, k1) - move a0, k0 # First arg is the status reg. + mfc0 a0, MIPS_COP_0_STATUS # First arg is the status reg. SAVE_U_PCB_REG(ta1, TA1, k1) SAVE_U_PCB_REG(ta2, TA2, k1) SAVE_U_PCB_REG(ta3, TA3, k1) @@ -656,12 +650,6 @@ NNON_LEAF(MipsUserIntr, CALLFRAME_SIZ, r * Save the relevant user registers into the u.u_pcb struct. * We don't need to save s0 - s8 because the compiler does it for us. */ - mfc0 k0, MIPS_COP_0_STATUS - HAZARD_DELAY -#ifdef __mips_n64 - ori k1, k0, MIPS_SR_KX - mtc0 k1, MIPS_COP_0_STATUS -#endif GET_CPU_PCPU(k1) PTR_L k1, PC_CURPCB(k1) SAVE_U_PCB_REG(AT, AST, k1) @@ -700,7 +688,7 @@ NNON_LEAF(MipsUserIntr, CALLFRAME_SIZ, r mflo v0 # get lo/hi late to avoid stall mfhi v1 - move a0, k0 + mfc0 a0, MIPS_COP_0_STATUS mfc0 a1, MIPS_COP_0_CAUSE MFC0 a3, MIPS_COP_0_EXC_PC SAVE_U_PCB_REG(v0, MULLO, k1) Modified: head/sys/mips/mips/mpboot.S ============================================================================== --- head/sys/mips/mips/mpboot.S Thu Aug 12 10:09:28 2010 (r211217) +++ head/sys/mips/mips/mpboot.S Thu Aug 12 11:00:45 2010 (r211218) @@ -36,7 +36,8 @@ .set noat .set noreorder -#ifdef CPU_CNMIPS +/* XXX move this to a header file */ +#if defined(CPU_CNMIPS) #define CLEAR_STATUS \ mfc0 a0, MIPS_COP_0_STATUS ;\ li a2, (MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX) ; \ @@ -44,6 +45,10 @@ li a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | SR_KSU_USER | MIPS_SR_BEV) ; \ and a0, a0, a2 ; \ mtc0 a0, MIPS_COP_0_STATUS +#elif defined(__mips_n64) +#define CLEAR_STATUS \ + li a0, (MIPS_SR_KX | MIPS_SR_UX) ; \ + mtc0 a0, MIPS_COP_0_STATUS #else #define CLEAR_STATUS \ mtc0 zero, MIPS_COP_0_STATUS Modified: head/sys/mips/mips/pm_machdep.c ============================================================================== --- head/sys/mips/mips/pm_machdep.c Thu Aug 12 10:09:28 2010 (r211217) +++ head/sys/mips/mips/pm_machdep.c Thu Aug 12 11:00:45 2010 (r211218) @@ -517,7 +517,7 @@ exec_setregs(struct thread *td, struct i #if defined(__mips_n32) td->td_frame->sr |= MIPS_SR_PX; #elif defined(__mips_n64) - td->td_frame->sr |= MIPS_SR_PX | MIPS_SR_UX; + td->td_frame->sr |= MIPS_SR_PX | MIPS_SR_UX | MIPS_SR_KX; #endif #ifdef CPU_CNMIPS td->td_frame->sr |= MIPS_SR_COP_2_BIT | MIPS_SR_PX | MIPS_SR_UX | Modified: head/sys/mips/mips/vm_machdep.c ============================================================================== --- head/sys/mips/mips/vm_machdep.c Thu Aug 12 10:09:28 2010 (r211217) +++ head/sys/mips/mips/vm_machdep.c Thu Aug 12 11:00:45 2010 (r211218) @@ -419,7 +419,7 @@ cpu_set_upcall_kse(struct thread *td, vo #if defined(__mips_n32) td->td_frame->sr |= MIPS_SR_PX; #elif defined(__mips_n64) - td->td_frame->sr |= MIPS_SR_PX | MIPS_SR_UX; + td->td_frame->sr |= MIPS_SR_PX | MIPS_SR_UX | MIPS_SR_KX; #endif #ifdef CPU_CNMIPS tf->sr |= MIPS_SR_INT_IE | MIPS_SR_COP_0_BIT | MIPS_SR_PX | MIPS_SR_UX | From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 11:01:38 2010 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 C356C10656C6; Thu, 12 Aug 2010 11:01:38 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 995018FC0A; Thu, 12 Aug 2010 11:01:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CB1c16059568; Thu, 12 Aug 2010 11:01:38 GMT (envelope-from takawata@svn.freebsd.org) Received: (from takawata@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CB1c6T059566; Thu, 12 Aug 2010 11:01:38 GMT (envelope-from takawata@svn.freebsd.org) Message-Id: <201008121101.o7CB1c6T059566@svn.freebsd.org> From: Takanori Watanabe Date: Thu, 12 Aug 2010 11:01: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: r211219 - head/usr.sbin/acpi/acpidump 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, 12 Aug 2010 11:01:38 -0000 Author: takawata Date: Thu Aug 12 11:01:38 2010 New Revision: 211219 URL: http://svn.freebsd.org/changeset/base/211219 Log: Fix tindebox breakage about format warning. Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 12 11:00:45 2010 (r211218) +++ head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 12 11:01:38 2010 (r211219) @@ -646,7 +646,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) printf(END_COMMENT); return; } - printf("\tClass %d Base Address 0x%jx Length %lld\n\n", + printf("\tClass %d Base Address 0x%jx Length %llu\n\n", tcpa->platform_class, paddr, len); if (len == 0) { From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 12:58:27 2010 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 00EA7106564A; Thu, 12 Aug 2010 12:58:27 +0000 (UTC) (envelope-from agh@neuromancer.ae) Received: from new1.smtp.messagingengine.com (new1.smtp.messagingengine.com [66.111.4.221]) by mx1.freebsd.org (Postfix) with ESMTP id B0C588FC0C; Thu, 12 Aug 2010 12:58:26 +0000 (UTC) Received: from compute1.internal (compute1.internal [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id C87242018D; Thu, 12 Aug 2010 08:41:28 -0400 (EDT) Received: from frontend2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 12 Aug 2010 08:41:28 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=from:reply-to:to:subject:date:cc:references:in-reply-to:mime-version:content-type:content-transfer-encoding:message-id; s=smtpout; bh=GyOsvfDEkj56XETWkW7p2Fhakds=; b=nZYyizphTyFZIiy7oUz4j7pg726uf+t9wPugckF25OqB3sOmvKgzZNm2JT0yQxihXo93WbRoAML27WzQFK7JuJSty1NEhBRHTG8G29MZ8FJVBbYLsMbzTjlOVPDXegW5/7K6YvJvKcpghNmTB8KJhrUa6TeW3tBb0TmWhRZXcqw= X-Sasl-enc: pv/u6LfXZS8exf0bY2dm00coTpQGitCZCOwWkLzHijnl 1281616888 Received: from direwolf.localnet (203-59-9-21.perm.iinet.net.au [203.59.9.21]) by mail.messagingengine.com (Postfix) with ESMTPSA id 07FE75E23B0; Thu, 12 Aug 2010 08:41:27 -0400 (EDT) From: Alastair Hogge To: svn-src-head@freebsd.org Date: Thu, 12 Aug 2010 20:41:25 +0800 User-Agent: KMail/1.13.5 (FreeBSD/9.0-CURRENT; KDE/4.4.5; amd64; ; ) References: <201008121101.o7CB1c6T059566@svn.freebsd.org> In-Reply-To: <201008121101.o7CB1c6T059566@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201008122041.25415.agh@neuromancer.ae> Cc: Takanori Watanabe , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211219 - head/usr.sbin/acpi/acpidump X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: agh@neuromancer.ae List-Id: "SVN commit messages 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, 12 Aug 2010 12:58:27 -0000 On Thursday 12 August 2010 19:01:38 Takanori Watanabe wrote: > Author: takawata > Date: Thu Aug 12 11:01:38 2010 > New Revision: 211219 > URL: http://svn.freebsd.org/changeset/base/211219 > > Log: > Fix tindebox breakage about format warning. > > Modified: > head/usr.sbin/acpi/acpidump/acpi.c > > Modified: head/usr.sbin/acpi/acpidump/acpi.c > =========================================================================== > === --- head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 12 11:00:45 > 2010 (r211218) +++ head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 12 11:01:38 > 2010 (r211219) @@ -646,7 +646,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER > *sdp) > printf(END_COMMENT); > return; > } > - printf("\tClass %d Base Address 0x%jx Length %lld\n\n", > + printf("\tClass %d Base Address 0x%jx Length %llu\n\n", %llu didn't work on my amd64 -r211091M buildworld only able to proceed when I replaced %lld with %lu -al -- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 13:46:43 2010 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 8651B106564A; Thu, 12 Aug 2010 13:46:43 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5AEB68FC17; Thu, 12 Aug 2010 13:46:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CDkhAQ096096; Thu, 12 Aug 2010 13:46:43 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CDkhmg096093; Thu, 12 Aug 2010 13:46:43 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008121346.o7CDkhmg096093@svn.freebsd.org> From: Attilio Rao Date: Thu, 12 Aug 2010 13:46: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: r211220 - 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: Thu, 12 Aug 2010 13:46:43 -0000 Author: attilio Date: Thu Aug 12 13:46:43 2010 New Revision: 211220 URL: http://svn.freebsd.org/changeset/base/211220 Log: Revert r211176: As long as interrupts are disabled and there is not explicit call to sched_add() there can't be any preemption there, thus the calls may be consistent. Reported by: kib, jhb Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/i386/i386/mp_machdep.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Thu Aug 12 11:01:38 2010 (r211219) +++ head/sys/amd64/amd64/mp_machdep.c Thu Aug 12 13:46:43 2010 (r211220) @@ -1324,10 +1324,8 @@ cpustop_handler(void) cpumask_t cpumask; u_int cpu; - sched_pin(); cpu = PCPU_GET(cpuid); cpumask = PCPU_GET(cpumask); - sched_unpin(); savectx(&stoppcbs[cpu]); @@ -1358,10 +1356,8 @@ cpususpend_handler(void) register_t cr3, rf; u_int cpu; - sched_pin(); cpu = PCPU_GET(cpuid); cpumask = PCPU_GET(cpumask); - sched_unpin(); rf = intr_disable(); cr3 = rcr3(); @@ -1542,14 +1538,10 @@ mp_grab_cpu_hlt(void) #endif int retval; -#ifdef MP_WATCHDOG - sched_pin(); mask = PCPU_GET(cpumask); +#ifdef MP_WATCHDOG cpuid = PCPU_GET(cpuid); - sched_unpin(); ap_watchdog(cpuid); -#else - mask = PCPU_GET(cpumask); #endif retval = 0; Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Thu Aug 12 11:01:38 2010 (r211219) +++ head/sys/i386/i386/mp_machdep.c Thu Aug 12 13:46:43 2010 (r211220) @@ -1411,10 +1411,8 @@ cpustop_handler(void) cpumask_t cpumask; u_int cpu; - sched_pin(); cpu = PCPU_GET(cpuid); cpumask = PCPU_GET(cpumask); - sched_unpin(); savectx(&stoppcbs[cpu]); @@ -1588,14 +1586,10 @@ mp_grab_cpu_hlt(void) #endif int retval; -#ifdef MP_WATCHDOG - sched_pin(); mask = PCPU_GET(cpumask); +#ifdef MP_WATCHDOG cpuid = PCPU_GET(cpuid); - sched_unpin(); ap_watchdog(cpuid); -#else - mask = PCPU_GET(cpumask); #endif retval = 0; From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 13:58:46 2010 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 60FEA1065672; Thu, 12 Aug 2010 13:58:46 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FE728FC12; Thu, 12 Aug 2010 13:58:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CDwkO8098770; Thu, 12 Aug 2010 13:58:46 GMT (envelope-from takawata@svn.freebsd.org) Received: (from takawata@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CDwk0d098768; Thu, 12 Aug 2010 13:58:46 GMT (envelope-from takawata@svn.freebsd.org) Message-Id: <201008121358.o7CDwk0d098768@svn.freebsd.org> From: Takanori Watanabe Date: Thu, 12 Aug 2010 13:58: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: r211221 - head/usr.sbin/acpi/acpidump 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, 12 Aug 2010 13:58:46 -0000 Author: takawata Date: Thu Aug 12 13:58:46 2010 New Revision: 211221 URL: http://svn.freebsd.org/changeset/base/211221 Log: Fix breakage on 64bit architecture by using inttypes.h macro. Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 12 13:46:43 2010 (r211220) +++ head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 12 13:58:46 2010 (r211221) @@ -40,6 +40,7 @@ #include #include #include +#include #include "acpidump.h" @@ -646,7 +647,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) printf(END_COMMENT); return; } - printf("\tClass %d Base Address 0x%jx Length %llu\n\n", + printf("\tClass %d Base Address 0x%jx Length %" PRIu64 "\n\n", tcpa->platform_class, paddr, len); if (len == 0) { From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 14:16:57 2010 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 6FF2910656A4; Thu, 12 Aug 2010 14:16: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 5F0BD8FC22; Thu, 12 Aug 2010 14:16:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CEGvDg002949; Thu, 12 Aug 2010 14:16:57 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CEGvEl002947; Thu, 12 Aug 2010 14:16:57 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008121416.o7CEGvEl002947@svn.freebsd.org> From: Adrian Chadd Date: Thu, 12 Aug 2010 14:16: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: r211222 - head/usr.sbin/crunch/crunchide 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, 12 Aug 2010 14:16:57 -0000 Author: adrian Date: Thu Aug 12 14:16:57 2010 New Revision: 211222 URL: http://svn.freebsd.org/changeset/base/211222 Log: Fix crunchide to work on sparc64 and perhaps other 64 bit platforms. I used the wrong type when setting st_name in the symbol table entry struct. It's an Elf64_Word which is defined as an unsigned 32 bit int on both 32 and 64 bit platforms. To make things sensible, define some new macros to use as "word" macros and use those, rather than simply using the explicit 32 bit macros. Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c ============================================================================== --- head/usr.sbin/crunch/crunchide/exec_elf32.c Thu Aug 12 13:58:46 2010 (r211221) +++ head/usr.sbin/crunch/crunchide/exec_elf32.c Thu Aug 12 14:16:57 2010 (r211222) @@ -60,10 +60,15 @@ __FBSDID("$FreeBSD$"); #include #define xewtoh(x) ((data == ELFDATA2MSB) ? be32toh(x) : le32toh(x)) #define htoxew(x) ((data == ELFDATA2MSB) ? htobe32(x) : htole32(x)) +#define wewtoh(x) ((data == ELFDATA2MSB) ? be32toh(x) : le32toh(x)) +#define htowew(x) ((data == ELFDATA2MSB) ? htobe32(x) : htole32(x)) #elif (ELFSIZE == 64) #include #define xewtoh(x) ((data == ELFDATA2MSB) ? be64toh(x) : le64toh(x)) #define htoxew(x) ((data == ELFDATA2MSB) ? htobe64(x) : htole64(x)) +/* elf64 Elf64_Word are 32 bits */ +#define wewtoh(x) ((data == ELFDATA2MSB) ? be32toh(x) : le32toh(x)) +#define htowew(x) ((data == ELFDATA2MSB) ? htobe32(x) : htole32(x)) #endif #include @@ -345,7 +350,7 @@ ELFNAMEEND(hide)(int fd, const char *fn) goto bad; } - sp->st_name = htoxew(nstrtab_nextoff); + sp->st_name = htowew(nstrtab_nextoff); /* if it's a keeper or is undefined, don't rename it. */ if (in_keep_list(symname) || From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 15:03:38 2010 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 495EA10656A6; Thu, 12 Aug 2010 15:03:38 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 060FF8FC14; Thu, 12 Aug 2010 15:03:37 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id CFAB21FFC33; Thu, 12 Aug 2010 15:03:36 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 85AA18454D; Thu, 12 Aug 2010 17:03:36 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Takanori Watanabe References: <201008121358.o7CDwk0d098768@svn.freebsd.org> Date: Thu, 12 Aug 2010 17:03:36 +0200 In-Reply-To: <201008121358.o7CDwk0d098768@svn.freebsd.org> (Takanori Watanabe's message of "Thu, 12 Aug 2010 13:58:46 +0000 (UTC)") Message-ID: <86pqxn50vr.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211221 - head/usr.sbin/acpi/acpidump 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, 12 Aug 2010 15:03:38 -0000 Takanori Watanabe writes: > - printf("\tClass %d Base Address 0x%jx Length %llu\n\n", > + printf("\tClass %d Base Address 0x%jx Length %" PRIu64 "\n\n", > tcpa->platform_class, paddr, len); This is just as wrong as the previous attempt. 1) platform_class is not an int. 2) paddr is not a uintmax_t. 3) so far, we've avoided using the PRI macros. Slightly better: printf("\tClass %u Base Address 0x%jx Length %ju\n\n", (unsigned int)tcpa->platform_class, (uintmax_t)paddr, (uintmax_t)len= ); but it would probably be easier to define paddr and len as unsigned long long instead of the misspelled u_int64_t, and use %llx and %llu. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 15:12:01 2010 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 0DCB0106566B; Thu, 12 Aug 2010 15:12:01 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id C0DA08FC16; Thu, 12 Aug 2010 15:12:00 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:1d23:cce7:53b5:cde2] (unknown [IPv6:2001:7b8:3a7:0:1d23:cce7:53b5:cde2]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id D1B095C43; Thu, 12 Aug 2010 17:11:59 +0200 (CEST) Message-ID: <4C640F41.6060100@andric.com> Date: Thu, 12 Aug 2010 17:12:01 +0200 From: Dimitry Andric User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.9pre) Gecko/20100803 Lanikai/3.1.3pre MIME-Version: 1.0 To: Andrew Thompson References: <201008120016.o7C0GI2t014914@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, Takanori Watanabe , svn-src-all@freebsd.org, src-committers@freebsd.org, Hans-Joerg Hoexer Subject: Re: svn commit: r211201 - in head: share/man/man4 sys/conf sys/dev/tpm sys/modules sys/modules/tpm 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, 12 Aug 2010 15:12:01 -0000 On 2010-08-12 02:42, Andrew Thompson wrote: >> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >> +++ head/share/man/man4/tpm.4 Thu Aug 12 00:16:18 2010 (r2112= 01) >> @@ -0,0 +1,74 @@ >> +.\" >> +.\" Copyright (c) 2010 Hans-J >=20 > His name appears truncated here, the other files seem ok. The original diff that Hans-J=F6rg sent to -hackers had this too, either the diff tool didn't cope with '=F6', or the mailing list stripped it... From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 15:29:07 2010 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 B14EB1065675; Thu, 12 Aug 2010 15:29:07 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0A5D8FC1B; Thu, 12 Aug 2010 15:29:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CFT7OB019159; Thu, 12 Aug 2010 15:29:07 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CFT74E019155; Thu, 12 Aug 2010 15:29:07 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201008121529.o7CFT74E019155@svn.freebsd.org> From: Jaakko Heinonen Date: Thu, 12 Aug 2010 15:29:07 +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: r211226 - head/sys/fs/devfs 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, 12 Aug 2010 15:29:07 -0000 Author: jh Date: Thu Aug 12 15:29:07 2010 New Revision: 211226 URL: http://svn.freebsd.org/changeset/base/211226 Log: Allow user created symbolic links to cover device files and directories if the device file appears during or after the link creation. User created symbolic links are now inserted at the head of the directory entry list after the "." and ".." entries. A new directory entry flag DE_COVERED indicates that an entry is covered by a symbolic link. PR: kern/114057 Reviewed by: kib Idea from: kib Discussed on: freebsd-current (mostly silence) Modified: head/sys/fs/devfs/devfs.h head/sys/fs/devfs/devfs_devs.c head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs.h ============================================================================== --- head/sys/fs/devfs/devfs.h Thu Aug 12 15:15:30 2010 (r211225) +++ head/sys/fs/devfs/devfs.h Thu Aug 12 15:29:07 2010 (r211226) @@ -126,10 +126,11 @@ struct devfs_dirent { struct cdev_priv *de_cdp; int de_inode; int de_flags; -#define DE_WHITEOUT 0x1 -#define DE_DOT 0x2 -#define DE_DOTDOT 0x4 -#define DE_DOOMED 0x8 +#define DE_WHITEOUT 0x01 +#define DE_DOT 0x02 +#define DE_DOTDOT 0x04 +#define DE_DOOMED 0x08 +#define DE_COVERED 0x10 int de_holdcnt; struct dirent *de_dirent; TAILQ_ENTRY(devfs_dirent) de_list; @@ -182,7 +183,7 @@ void devfs_unmount_final(struct devfs_mo struct devfs_dirent *devfs_newdirent (char *name, int namelen); struct devfs_dirent *devfs_parent_dirent(struct devfs_dirent *de); struct devfs_dirent *devfs_vmkdir (struct devfs_mount *, char *name, int namelen, struct devfs_dirent *dotdot, u_int inode); -struct devfs_dirent *devfs_find (struct devfs_dirent *dd, const char *name, int namelen); +struct devfs_dirent *devfs_find(struct devfs_dirent *dd, const char *name, int namelen, int type); #endif /* _KERNEL */ Modified: head/sys/fs/devfs/devfs_devs.c ============================================================================== --- head/sys/fs/devfs/devfs_devs.c Thu Aug 12 15:15:30 2010 (r211225) +++ head/sys/fs/devfs/devfs_devs.c Thu Aug 12 15:29:07 2010 (r211226) @@ -158,13 +158,15 @@ devfs_free(struct cdev *cdev) } struct devfs_dirent * -devfs_find(struct devfs_dirent *dd, const char *name, int namelen) +devfs_find(struct devfs_dirent *dd, const char *name, int namelen, int type) { struct devfs_dirent *de; TAILQ_FOREACH(de, &dd->de_dlist, de_list) { if (namelen != de->de_dirent->d_namlen) continue; + if (type != 0 && type != de->de_dirent->d_type) + continue; if (bcmp(name, de->de_dirent->d_name, namelen) != 0) continue; break; @@ -235,14 +237,19 @@ devfs_vmkdir(struct devfs_mount *dmp, ch else dd->de_inode = alloc_unr(devfs_inos); - /* Create the "." entry in the new directory */ + /* + * "." and ".." are always the two first entries in the + * de_dlist list. + * + * Create the "." entry in the new directory. + */ de = devfs_newdirent(".", 1); de->de_dirent->d_type = DT_DIR; de->de_flags |= DE_DOT; TAILQ_INSERT_TAIL(&dd->de_dlist, de, de_list); de->de_dir = dd; - /* Create the ".." entry in the new directory */ + /* Create the ".." entry in the new directory. */ de = devfs_newdirent("..", 2); de->de_dirent->d_type = DT_DIR; de->de_flags |= DE_DOTDOT; @@ -382,7 +389,7 @@ devfs_populate_loop(struct devfs_mount * struct devfs_dirent *de; struct devfs_dirent *dd; struct cdev *pdev; - int j; + int de_flags, j; char *q, *s; sx_assert(&dm->dm_lock, SX_XLOCKED); @@ -454,12 +461,27 @@ devfs_populate_loop(struct devfs_mount * continue; if (*q != '/') break; - de = devfs_find(dd, s, q - s); + de = devfs_find(dd, s, q - s, 0); if (de == NULL) de = devfs_vmkdir(dm, s, q - s, dd, 0); + else if (de->de_dirent->d_type == DT_LNK) { + de = devfs_find(dd, s, q - s, DT_DIR); + if (de == NULL) + de = devfs_vmkdir(dm, s, q - s, dd, 0); + de->de_flags |= DE_COVERED; + } s = q + 1; dd = de; + KASSERT(dd->de_dirent->d_type == DT_DIR && + (dd->de_flags & (DE_DOT | DE_DOTDOT)) == 0, + ("%s: invalid directory (si_name=%s)", + __func__, cdp->cdp_c.si_name)); + } + de_flags = 0; + de = devfs_find(dd, s, q - s, DT_LNK); + if (de != NULL) + de_flags |= DE_COVERED; de = devfs_newdirent(s, q - s); if (cdp->cdp_c.si_flags & SI_ALIAS) { @@ -477,6 +499,7 @@ devfs_populate_loop(struct devfs_mount * de->de_mode = cdp->cdp_c.si_mode; de->de_dirent->d_type = DT_CHR; } + de->de_flags |= de_flags; de->de_inode = cdp->cdp_inode; de->de_cdp = cdp; #ifdef MAC Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Thu Aug 12 15:15:30 2010 (r211225) +++ head/sys/fs/devfs/devfs_vnops.c Thu Aug 12 15:29:07 2010 (r211226) @@ -822,7 +822,7 @@ devfs_lookupx(struct vop_lookup_args *ap return (ENOENT); } dd = dvp->v_data; - de = devfs_find(dd, cnp->cn_nameptr, cnp->cn_namelen); + de = devfs_find(dd, cnp->cn_nameptr, cnp->cn_namelen, 0); while (de == NULL) { /* While(...) so we can use break */ if (nameiop == DELETE) @@ -1151,7 +1151,7 @@ devfs_readdir(struct vop_readdir_args *a off = 0; TAILQ_FOREACH(dd, &de->de_dlist, de_list) { KASSERT(dd->de_cdp != (void *)0xdeadc0de, ("%s %d\n", __func__, __LINE__)); - if (dd->de_flags & DE_WHITEOUT) + if (dd->de_flags & (DE_COVERED | DE_WHITEOUT)) continue; if (devfs_prison_check(dd, uio->uio_td)) continue; @@ -1232,7 +1232,7 @@ devfs_remove(struct vop_remove_args *ap) { struct vnode *vp = ap->a_vp; struct devfs_dirent *dd; - struct devfs_dirent *de; + struct devfs_dirent *de, *de_covered; struct devfs_mount *dmp = VFSTODEVFS(vp->v_mount); sx_xlock(&dmp->dm_lock); @@ -1240,6 +1240,12 @@ devfs_remove(struct vop_remove_args *ap) de = vp->v_data; if (de->de_cdp == NULL) { TAILQ_REMOVE(&dd->de_dlist, de, de_list); + if (de->de_dirent->d_type == DT_LNK) { + de_covered = devfs_find(dd, de->de_dirent->d_name, + de->de_dirent->d_namlen, 0); + if (de_covered != NULL) + de_covered->de_flags &= ~DE_COVERED; + } devfs_delete(dmp, de, 1); } else { de->de_flags |= DE_WHITEOUT; @@ -1479,7 +1485,7 @@ devfs_symlink(struct vop_symlink_args *a { int i, error; struct devfs_dirent *dd; - struct devfs_dirent *de; + struct devfs_dirent *de, *de_covered, *de_dotdot; struct devfs_mount *dmp; error = priv_check(curthread, PRIV_DEVFS_SYMLINK); @@ -1500,7 +1506,18 @@ devfs_symlink(struct vop_symlink_args *a #ifdef MAC mac_devfs_create_symlink(ap->a_cnp->cn_cred, dmp->dm_mount, dd, de); #endif - TAILQ_INSERT_TAIL(&dd->de_dlist, de, de_list); + de_covered = devfs_find(dd, de->de_dirent->d_name, + de->de_dirent->d_namlen, 0); + if (de_covered != NULL) { + KASSERT((de_covered->de_flags & DE_COVERED) == 0, + ("devfs_symlink: entry %p already covered", de_covered)); + de_covered->de_flags |= DE_COVERED; + } + + de_dotdot = TAILQ_FIRST(&dd->de_dlist); /* "." */ + de_dotdot = TAILQ_NEXT(de_dotdot, de_list); /* ".." */ + TAILQ_INSERT_AFTER(&dd->de_dlist, de_dotdot, de, de_list); + return (devfs_allocv(de, ap->a_dvp->v_mount, LK_EXCLUSIVE, ap->a_vpp)); } From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 15:35:06 2010 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 A996910656AA; Thu, 12 Aug 2010 15:35:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 789A88FC1C; Thu, 12 Aug 2010 15:35:06 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 2095D46B37; Thu, 12 Aug 2010 11:35:06 -0400 (EDT) Received: from John-Baldwins-Macbook-Pro.local (75-48-78-116.lightspeed.cncrca.sbcglobal.net [75.48.78.116]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id BF5AC8A03C; Thu, 12 Aug 2010 11:35:04 -0400 (EDT) Message-ID: <4C6414A7.6020306@FreeBSD.org> Date: Thu, 12 Aug 2010 11:35:03 -0400 From: John Baldwin User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= References: <201008121358.o7CDwk0d098768@svn.freebsd.org> <86pqxn50vr.fsf@ds4.des.no> In-Reply-To: <86pqxn50vr.fsf@ds4.des.no> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 12 Aug 2010 11:35:05 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_DYNAMIC autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, Takanori Watanabe , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211221 - head/usr.sbin/acpi/acpidump 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, 12 Aug 2010 15:35:06 -0000 Dag-Erling Smørgrav wrote: > Takanori Watanabe writes: >> - printf("\tClass %d Base Address 0x%jx Length %llu\n\n", >> + printf("\tClass %d Base Address 0x%jx Length %" PRIu64 "\n\n", >> tcpa->platform_class, paddr, len); > > This is just as wrong as the previous attempt. > > 1) platform_class is not an int. > 2) paddr is not a uintmax_t. > 3) so far, we've avoided using the PRI macros. > > Slightly better: > > printf("\tClass %u Base Address 0x%jx Length %ju\n\n", > (unsigned int)tcpa->platform_class, (uintmax_t)paddr, (uintmax_t)len); > > but it would probably be easier to define paddr and len as unsigned long > long instead of the misspelled u_int64_t, and use %llx and %llu. Depends. If the table defines a field to be a 64-bit integer, it is better to use an explicitly-64-bit integer type such as uint64_t rather than assuming that 'long long' is 64-bit. Other ACPI table definitions all use fixed-size types like uint32_t and uint64_t since the tables are defined as fixed-size fields, not as 'long' and 'int'. Using %j with uintmax_t casts is the solution used for other 64-bit fields in ACPI tables. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 16:13:24 2010 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 E075A1065675; Thu, 12 Aug 2010 16:13:24 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B603A8FC13; Thu, 12 Aug 2010 16:13:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CGDO03028988; Thu, 12 Aug 2010 16:13:24 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CGDOij028986; Thu, 12 Aug 2010 16:13:24 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008121613.o7CGDOij028986@svn.freebsd.org> From: Jung-uk Kim Date: Thu, 12 Aug 2010 16:13: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: r211228 - 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, 12 Aug 2010 16:13:25 -0000 Author: jkim Date: Thu Aug 12 16:13:24 2010 New Revision: 211228 URL: http://svn.freebsd.org/changeset/base/211228 Log: Provide description for 'machdep.disable_rtc_set' sysctl. Clean up style(9) nits. Remove a redundant return statement and an unnecessary variable. Modified: head/sys/kern/subr_rtc.c Modified: head/sys/kern/subr_rtc.c ============================================================================== --- head/sys/kern/subr_rtc.c Thu Aug 12 15:46:15 2010 (r211227) +++ head/sys/kern/subr_rtc.c Thu Aug 12 16:13:24 2010 (r211228) @@ -65,8 +65,8 @@ static long clock_res; /* XXX: should be kern. now, it's no longer machdep. */ static int disable_rtc_set; -SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set, - CTLFLAG_RW, &disable_rtc_set, 0, ""); +SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set, CTLFLAG_RW, &disable_rtc_set, + 0, "Disallow adjusting time-of-day clock"); void clock_register(device_t dev, long res) /* res has units of microseconds */ @@ -74,26 +74,22 @@ clock_register(device_t dev, long res) / if (clock_dev != NULL) { if (clock_res > res) { - if (bootverbose) { + if (bootverbose) device_printf(dev, "not installed as " "time-of-day clock: clock %s has higher " "resolution\n", device_get_name(clock_dev)); - } return; - } else { - if (bootverbose) { - device_printf(clock_dev, "removed as " - "time-of-day clock: clock %s has higher " - "resolution\n", device_get_name(dev)); - } } + if (bootverbose) + device_printf(clock_dev, "removed as " + "time-of-day clock: clock %s has higher " + "resolution\n", device_get_name(dev)); } clock_dev = dev; clock_res = res; - if (bootverbose) { + if (bootverbose) device_printf(dev, "registered as a time-of-day clock " "(resolution %ldus)\n", res); - } } /* @@ -109,7 +105,7 @@ clock_register(device_t dev, long res) / void inittodr(time_t base) { - struct timespec ref, ts; + struct timespec ts; int error; if (clock_dev == NULL) { @@ -136,9 +132,9 @@ inittodr(time_t base) wrong_time: if (base > 0) { - ref.tv_sec = base; - ref.tv_nsec = 0; - tc_setclock(&ref); + ts.tv_sec = base; + ts.tv_nsec = 0; + tc_setclock(&ts); } } @@ -157,9 +153,7 @@ resettodr(void) getnanotime(&ts); ts.tv_sec -= utc_offset(); /* XXX: We should really set all registered RTCs */ - if ((error = CLOCK_SETTIME(clock_dev, &ts)) != 0) { + if ((error = CLOCK_SETTIME(clock_dev, &ts)) != 0) printf("warning: clock_settime failed (%d), time-of-day clock " "not adjusted to system time\n", error); - return; - } } From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 16:30:15 2010 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 CD29B10656A4; Thu, 12 Aug 2010 16:30:15 +0000 (UTC) (envelope-from rpaulo@freebsd.org) Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by mx1.freebsd.org (Postfix) with ESMTP id 9E8C08FC1F; Thu, 12 Aug 2010 16:30:15 +0000 (UTC) Received: from e.earth.lavabit.com (e.earth.lavabit.com [192.168.111.14]) by karen.lavabit.com (Postfix) with ESMTP id 3B7E811B88A; Thu, 12 Aug 2010 11:30:15 -0500 (CDT) Received: from 10.0.10.3 (54.81.54.77.rev.vodafone.pt [77.54.81.54]) by lavabit.com with ESMTP id WHK3PX6BBY1L; Thu, 12 Aug 2010 11:30:15 -0500 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Rui Paulo In-Reply-To: <201008120016.o7C0GI2t014914@svn.freebsd.org> Date: Thu, 12 Aug 2010 17:30:12 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201008120016.o7C0GI2t014914@svn.freebsd.org> To: Takanori Watanabe X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211201 - in head: share/man/man4 sys/conf sys/dev/tpm sys/modules sys/modules/tpm 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, 12 Aug 2010 16:30:15 -0000 On 12 Aug 2010, at 01:16, Takanori Watanabe wrote: > Author: takawata > Date: Thu Aug 12 00:16:18 2010 > New Revision: 211201 > URL: http://svn.freebsd.org/changeset/base/211201 >=20 > Log: > Add tpm(4) driver for Trusted Platform Module. > You may want to look at http://bsssd.sourceforge.net/ . >=20 > Submitted by: Hans-Joerg Hoexer >=20 > Added: > head/share/man/man4/tpm.4 (contents, props changed) > head/sys/dev/tpm/ > head/sys/dev/tpm/tpm.c (contents, props changed) > head/sys/dev/tpm/tpm_acpi.c (contents, props changed) > head/sys/dev/tpm/tpm_isa.c (contents, props changed) > head/sys/dev/tpm/tpmvar.h (contents, props changed) > head/sys/modules/tpm/ > head/sys/modules/tpm/Makefile (contents, props changed) > Modified: > head/sys/conf/files.i386 > head/sys/modules/Makefile This breaks pc98: =3D=3D=3D> tpm (depend)rm -f .depend mkdep -f .depend -a -nostdinc -DPC98 -D_KERNEL -DKLD_MODULE = -DHAVE_KERNEL_OPTI ON_HEADERS -I. -I@ -I@/contrib/altq = -I/scratch/tmp/rpaulo/obj/pc98.i386/scratch/tmp/rpaulo/p4/dtrace/sys/GENER= IC /scratch/tmp/rpaulo/p4/dtrace/sys/modules/tpm/. /../dev/tpm/tpm.c = /scratch/tmp/rpaulo/p4/dtrace/sys/modules/tpm/../../dev/tpm/t pm_isa.c = /scratch/tmp/rpaulo/p4/dtrace/sys/modules/tpm/../../dev/tpm/tpm_acpi.c In file included from = /scratch/tmp/rpaulo/p4/dtrace/sys/modules/tpm/../../dev/tp m/tpm.c:42:@/isa/isareg.h:37:2: error: #error isareg.h is included from = PC-9801 source In file included from = /scratch/tmp/rpaulo/p4/dtrace/sys/modules/tpm/../../dev/tpm/tpm_isa.c:40: @/isa/isareg.h:37:2: error: #error isareg.h is included from PC-9801 = source In file included from = /scratch/tmp/rpaulo/p4/dtrace/sys/modules/tpm/../../dev/tpm/tpm_acpi.c:38:= @/isa/isareg.h:37:2: error: #error isareg.h is included from PC-9801 = sourceIn file included from = @/contrib/dev/acpica/include/platform/acenv.h:197, from @/contrib/dev/acpica/include/acpi.h:128, = from /scratch/tmp/rpaulo/p4/dtrace/sys/modules/tpm/../../dev/tp m/tpm_acpi.c:43: @/contrib/dev/acpica/include/platform/acfreebsd.h:124:36: error: = machine/acpica_ machdep.h: No such file or directory In file included from @/contrib/dev/acpica/include/acpi.h:130, from = /scratch/tmp/rpaulo/p4/dtrace/sys/modules/tpm/../../dev/tp m/tpm_acpi.c:43: @/contrib/dev/acpica/include/actypes.h:127:2: error: #error = ACPI_MACHINE_WIDTH n ot defined @/contrib/dev/acpica/include/actypes.h:276:2: error: #error unknown = ACPI_MACHINE _WIDTH mkdep: compile failed Maybe you want to disable tpm for pc98. Regards, -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 16:54:44 2010 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 53DC2106566C; Thu, 12 Aug 2010 16:54:44 +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 4401C8FC16; Thu, 12 Aug 2010 16:54:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CGsi2p038129; Thu, 12 Aug 2010 16:54:44 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CGsiO3038126; Thu, 12 Aug 2010 16:54:44 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201008121654.o7CGsiO3038126@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 12 Aug 2010 16:54: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: r211229 - 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: Thu, 12 Aug 2010 16:54:44 -0000 Author: mdf Date: Thu Aug 12 16:54:43 2010 New Revision: 211229 URL: http://svn.freebsd.org/changeset/base/211229 Log: Fix compile. It seemed better to have memguard.c include opt_vm.h in case future compile-time knobs were added that it wants to use. Also add include guards and forward declarations to vm/memguard.h. Approved by: zml (mentor) MFC after: 1 month Modified: head/sys/vm/memguard.c head/sys/vm/memguard.h Modified: head/sys/vm/memguard.c ============================================================================== --- head/sys/vm/memguard.c Thu Aug 12 16:13:24 2010 (r211228) +++ head/sys/vm/memguard.c Thu Aug 12 16:54:43 2010 (r211229) @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); * See the memguard(9) man page for more information on using MemGuard. */ +#include "opt_vm.h" + #include #include #include Modified: head/sys/vm/memguard.h ============================================================================== --- head/sys/vm/memguard.h Thu Aug 12 16:13:24 2010 (r211228) +++ head/sys/vm/memguard.h Thu Aug 12 16:54:43 2010 (r211229) @@ -26,8 +26,14 @@ * $FreeBSD$ */ +#ifndef _VM_MEMGUARD_H_ +#define _VM_MEMGUARD_H_ + #include "opt_vm.h" +struct malloc_type; +struct vm_map; + #ifdef DEBUG_MEMGUARD unsigned long memguard_fudge(unsigned long, unsigned long); void memguard_init(struct vm_map *); @@ -43,3 +49,5 @@ int is_memguard_addr(void *); #define memguard_cmp(mtp, size) 0 #define is_memguard_addr(addr) 0 #endif + +#endif /* _VM_MEMGUARD_H_ */ From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 17:00:02 2010 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 321201065670; Thu, 12 Aug 2010 17:00:02 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 299EC8FC0A; Thu, 12 Aug 2010 17:00:00 +0000 (UTC) Received: by ewy26 with SMTP id 26so951515ewy.13 for ; Thu, 12 Aug 2010 09:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=QfnwXiFN803JrCOOBvZZZnEWMi0adplZUqqNqp3sBno=; b=vLd9E8FC8yZ54vCExE17o1noiA6KrxwFEtln+hGV/HVGeEKBeBNXPqEjwQ7Dgkm1A1 QbM+uTRC6wfdvxSw+kNrdYiUa6p3ZWvYcibE/v50hjPh3d2mV1AhKEkqKF0nNiUAXwQd t+RpjpAqHTCJMiFZAAtkCr4s3eWELlgSNkH7U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=HCehjyVkVKkwjM0jaLyQU0uSc/ozJ8ZbXKdtbExzMA/Or+bzeglDGnwlOFWGfEeZco iHLkGtY+jrYTj1EFfQdg6CSP0uP8HkymYRN6sJ04+5UWoxbKySJX97zF38EhC5ICLfTN QjNx8dzFHsf55BxQK6ts32d/oxtehQcqPS9VM= MIME-Version: 1.0 Received: by 10.213.32.135 with SMTP id c7mr568727ebd.2.1281631074478; Thu, 12 Aug 2010 09:37:54 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.213.10.196 with HTTP; Thu, 12 Aug 2010 09:37:54 -0700 (PDT) In-Reply-To: <201008121613.o7CGDOij028986@svn.freebsd.org> References: <201008121613.o7CGDOij028986@svn.freebsd.org> Date: Thu, 12 Aug 2010 09:37:54 -0700 X-Google-Sender-Auth: 4ayecjLiwrSWAhSGwxK3mTGgC7k Message-ID: From: mdf@FreeBSD.org To: Jung-uk Kim Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211228 - 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, 12 Aug 2010 17:00:02 -0000 On Thu, Aug 12, 2010 at 9:13 AM, Jung-uk Kim wrote: > Author: jkim > Date: Thu Aug 12 16:13:24 2010 > New Revision: 211228 > URL: http://svn.freebsd.org/changeset/base/211228 > > Log: > =A0Provide description for 'machdep.disable_rtc_set' sysctl. =A0Clean up = style(9) > =A0nits. =A0Remove a redundant return statement and an unnecessary variab= le. > > Modified: > =A0head/sys/kern/subr_rtc.c > > Modified: head/sys/kern/subr_rtc.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/subr_rtc.c =A0 =A0Thu Aug 12 15:46:15 2010 =A0 =A0 =A0 = =A0(r211227) > +++ head/sys/kern/subr_rtc.c =A0 =A0Thu Aug 12 16:13:24 2010 =A0 =A0 =A0 = =A0(r211228) > @@ -65,8 +65,8 @@ static long clock_res; > > =A0/* XXX: should be kern. now, it's no longer machdep. =A0*/ > =A0static int disable_rtc_set; > -SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set, > - =A0 =A0 =A0 CTLFLAG_RW, &disable_rtc_set, 0, ""); > +SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set, CTLFLAG_RW, &disable_rtc= _set, > + =A0 =A00, "Disallow adjusting time-of-day clock"); > > =A0void > =A0clock_register(device_t dev, long res) /* res has units of microsecond= s */ > @@ -74,26 +74,22 @@ clock_register(device_t dev, long res) =A0 =A0 =A0/ > > =A0 =A0 =A0 =A0if (clock_dev !=3D NULL) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (clock_res > res) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (bootverbose) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (bootverbose) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0device_pri= ntf(dev, "not installed as " > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"t= ime-of-day clock: clock %s has higher " > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"r= esolution\n", device_get_name(clock_dev)); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } While the device_printf() is a single statement, it spans multiple lines. It seems in this instance that clarity is preserved better by using braces even though not required by C. Quoting style(9): Space after keywords (if, while, for, return, switch). No braces ('{' and '}') are used for control statements with zero or only a single statement unless that statement is more than a single line in which case they are permitted. So both styles are accepted, and I would think that changing this is needless code churn. Thanks, matthew > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (bootverbose) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 device_prin= tf(clock_dev, "removed as " > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "ti= me-of-day clock: clock %s has higher " > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "re= solution\n", device_get_name(dev)); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (bootverbose) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 device_printf(clock_dev, "r= emoved as " > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "time-of-day clock:= clock %s has higher " > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "resolution\n", dev= ice_get_name(dev)); > =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0clock_dev =3D dev; > =A0 =A0 =A0 =A0clock_res =3D res; > - =A0 =A0 =A0 if (bootverbose) { > + =A0 =A0 =A0 if (bootverbose) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0device_printf(dev, "registered as a time-o= f-day clock " > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"(resolution %ldus)\n", res); > - =A0 =A0 =A0 } > =A0} > > =A0/* > @@ -109,7 +105,7 @@ clock_register(device_t dev, long res) =A0 =A0 =A0/ > =A0void > =A0inittodr(time_t base) > =A0{ > - =A0 =A0 =A0 struct timespec ref, ts; > + =A0 =A0 =A0 struct timespec ts; > =A0 =A0 =A0 =A0int error; > > =A0 =A0 =A0 =A0if (clock_dev =3D=3D NULL) { > @@ -136,9 +132,9 @@ inittodr(time_t base) > > =A0wrong_time: > =A0 =A0 =A0 =A0if (base > 0) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 ref.tv_sec =3D base; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 ref.tv_nsec =3D 0; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 tc_setclock(&ref); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ts.tv_sec =3D base; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ts.tv_nsec =3D 0; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 tc_setclock(&ts); > =A0 =A0 =A0 =A0} > =A0} > > @@ -157,9 +153,7 @@ resettodr(void) > =A0 =A0 =A0 =A0getnanotime(&ts); > =A0 =A0 =A0 =A0ts.tv_sec -=3D utc_offset(); > =A0 =A0 =A0 =A0/* XXX: We should really set all registered RTCs */ > - =A0 =A0 =A0 if ((error =3D CLOCK_SETTIME(clock_dev, &ts)) !=3D 0) { > + =A0 =A0 =A0 if ((error =3D CLOCK_SETTIME(clock_dev, &ts)) !=3D 0) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0printf("warning: clock_settime failed (%d)= , time-of-day clock " > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"not adjusted to system time\n", e= rror); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 return; > - =A0 =A0 =A0 } > =A0} > From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 17:15:04 2010 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 4310710656A8; Thu, 12 Aug 2010 17:15:04 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id F38388FC14; Thu, 12 Aug 2010 17:15:03 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id A8A451FFC33; Thu, 12 Aug 2010 17:15:02 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 041C284525; Thu, 12 Aug 2010 19:15:02 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: John Baldwin References: <201008121358.o7CDwk0d098768@svn.freebsd.org> <86pqxn50vr.fsf@ds4.des.no> <4C6414A7.6020306@FreeBSD.org> Date: Thu, 12 Aug 2010 19:15:01 +0200 In-Reply-To: <4C6414A7.6020306@FreeBSD.org> (John Baldwin's message of "Thu, 12 Aug 2010 11:35:03 -0400") Message-ID: <868w4bda7e.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, Takanori Watanabe , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211221 - head/usr.sbin/acpi/acpidump 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, 12 Aug 2010 17:15:04 -0000 John Baldwin writes: > Dag-Erling Sm=C3=B8rgrav writes: > > Slightly better: > > > > printf("\tClass %u Base Address 0x%jx Length %ju\n\n", > > (unsigned int)tcpa->platform_class, (uintmax_t)paddr, (uintmax_t= )len); > > > > but it would probably be easier to define paddr and len as unsigned long > > long instead of the misspelled u_int64_t, and use %llx and %llu. > Depends. If the table defines a field to be a 64-bit integer, it is > better to use an explicitly-64-bit integer type such as uint64_t > rather than assuming that 'long long' is 64-bit. Actually, paddr and len are a memory address and an object size, respectively, so the logical thing would be to use uintptr_t and size_t with uintmax_t casts... DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 17:17:05 2010 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 AE20B106564A; Thu, 12 Aug 2010 17:17:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83CCB8FC15; Thu, 12 Aug 2010 17:17:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CHH5tq043063; Thu, 12 Aug 2010 17:17:05 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CHH5aV043061; Thu, 12 Aug 2010 17:17:05 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008121717.o7CHH5aV043061@svn.freebsd.org> From: Jung-uk Kim Date: Thu, 12 Aug 2010 17:17:05 +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: r211230 - 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, 12 Aug 2010 17:17:05 -0000 Author: jkim Date: Thu Aug 12 17:17:05 2010 New Revision: 211230 URL: http://svn.freebsd.org/changeset/base/211230 Log: Add the half of time-of-day clock resolution when we adjust system time from time-of-day clock or vice versa. For x86 systems, RTC resolution is one second and we used to lose up to one second whenever we initialize system time from RTC or write system time back to RTC. With this change, margin of error per conversion is roughly between -0.5 and +0.5 second rather than between -1 and 0 second. Note that it does not take care of errors from getnanotime(9) (which is up to 1/hz second) or CLOCK_GETTIME() latency. These are just too expensive to correct and it is not worthy of the cost. Modified: head/sys/kern/subr_rtc.c Modified: head/sys/kern/subr_rtc.c ============================================================================== --- head/sys/kern/subr_rtc.c Thu Aug 12 16:54:43 2010 (r211229) +++ head/sys/kern/subr_rtc.c Thu Aug 12 17:17:05 2010 (r211230) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); static device_t clock_dev = NULL; static long clock_res; +static struct timespec clock_adj; /* XXX: should be kern. now, it's no longer machdep. */ static int disable_rtc_set; @@ -87,9 +88,12 @@ clock_register(device_t dev, long res) / } clock_dev = dev; clock_res = res; + clock_adj.tv_sec = res / 2 / 1000000; + clock_adj.tv_nsec = res / 2 % 1000000 * 1000; if (bootverbose) device_printf(dev, "registered as a time-of-day clock " - "(resolution %ldus)\n", res); + "(resolution %ldus, adjustment %jd.%09jds)\n", res, + (intmax_t)clock_adj.tv_sec, (intmax_t)clock_adj.tv_nsec); } /* @@ -127,6 +131,7 @@ inittodr(time_t base) } ts.tv_sec += utc_offset(); + timespecadd(&ts, &clock_adj); tc_setclock(&ts); return; @@ -151,6 +156,7 @@ resettodr(void) return; getnanotime(&ts); + timespecadd(&ts, &clock_adj); ts.tv_sec -= utc_offset(); /* XXX: We should really set all registered RTCs */ if ((error = CLOCK_SETTIME(clock_dev, &ts)) != 0) From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 17:35:16 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id DD4B8106564A; Thu, 12 Aug 2010 17:35:15 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: mdf@FreeBSD.org Date: Thu, 12 Aug 2010 13:34:57 -0400 User-Agent: KMail/1.6.2 References: <201008121613.o7CGDOij028986@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <201008121335.05300.jkim@FreeBSD.org> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r211228 - 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, 12 Aug 2010 17:35:16 -0000 On Thursday 12 August 2010 12:37 pm, mdf@FreeBSD.org wrote: > On Thu, Aug 12, 2010 at 9:13 AM, Jung-uk Kim wrote: > > Author: jkim > > Date: Thu Aug 12 16:13:24 2010 > > New Revision: 211228 > > URL: http://svn.freebsd.org/changeset/base/211228 > > > > Log: > >  Provide description for 'machdep.disable_rtc_set' sysctl. > >  Clean up style(9)  nits.  Remove a redundant return statement > > and an unnecessary variable. --- >8 SNIP!!! --- >8 --- > While the device_printf() is a single statement, it spans multiple > lines. It seems in this instance that clarity is preserved better > by using braces even though not required by C. > > Quoting style(9): > > Space after keywords (if, while, for, return, switch). No braces > ('{' and '}') are used for control statements with zero or only a > single statement unless that statement is more than a single line > in which case they are permitted. > > So both styles are accepted, and I would think that changing this > is needless code churn. Some times it is very hard to read code when if statements contain excessive braces and 'else' statements although is permitted by style(9). It was one of those cases. Please note a 'else' block was also removed from there. Besides, I don't think it is revert worthy, either. ;-) Thanks, Jung-uk Kim From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 17:45:57 2010 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 C1209106564A; Thu, 12 Aug 2010 17:45:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8F0A48FC22; Thu, 12 Aug 2010 17:45:57 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 200DF46B37; Thu, 12 Aug 2010 13:45:57 -0400 (EDT) Received: from John-Baldwins-Macbook-Pro.local (75-48-78-116.lightspeed.cncrca.sbcglobal.net [75.48.78.116]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 9A3C08A04E; Thu, 12 Aug 2010 13:45:55 -0400 (EDT) Message-ID: <4C643352.5010508@FreeBSD.org> Date: Thu, 12 Aug 2010 13:45:54 -0400 From: John Baldwin User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= References: <201008121358.o7CDwk0d098768@svn.freebsd.org> <86pqxn50vr.fsf@ds4.des.no> <4C6414A7.6020306@FreeBSD.org> <868w4bda7e.fsf@ds4.des.no> In-Reply-To: <868w4bda7e.fsf@ds4.des.no> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 12 Aug 2010 13:45:56 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_DYNAMIC autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, Takanori Watanabe , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211221 - head/usr.sbin/acpi/acpidump 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, 12 Aug 2010 17:45:57 -0000 Dag-Erling Smørgrav wrote: > John Baldwin writes: >> Dag-Erling Smørgrav writes: >>> Slightly better: >>> >>> printf("\tClass %u Base Address 0x%jx Length %ju\n\n", >>> (unsigned int)tcpa->platform_class, (uintmax_t)paddr, (uintmax_t)len); >>> >>> but it would probably be easier to define paddr and len as unsigned long >>> long instead of the misspelled u_int64_t, and use %llx and %llu. >> Depends. If the table defines a field to be a 64-bit integer, it is >> better to use an explicitly-64-bit integer type such as uint64_t >> rather than assuming that 'long long' is 64-bit. > > Actually, paddr and len are a memory address and an object size, > respectively, so the logical thing would be to use uintptr_t and size_t > with uintmax_t casts... Except that physical addresses do not always fit in uintptr_t on i386 (think PAE with 36-bit physical addresses and 32-bit uintptr_t, same for the length). If they truly were a size_t you could use %z without a uintmax_t cast. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 19:26:28 2010 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 299EF1065695; Thu, 12 Aug 2010 19:26:28 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 192168FC12; Thu, 12 Aug 2010 19:26:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CJQRbE072132; Thu, 12 Aug 2010 19:26:27 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CJQROq072130; Thu, 12 Aug 2010 19:26:27 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201008121926.o7CJQROq072130@svn.freebsd.org> From: "Justin T. Gibbs" Date: Thu, 12 Aug 2010 19:26: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: r211232 - 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, 12 Aug 2010 19:26:28 -0000 Author: gibbs Date: Thu Aug 12 19:26:27 2010 New Revision: 211232 URL: http://svn.freebsd.org/changeset/base/211232 Log: Properly indent a continue statement. No functional changes. Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Thu Aug 12 19:15:21 2010 (r211231) +++ head/sys/kern/subr_bus.c Thu Aug 12 19:26:27 2010 (r211232) @@ -3316,7 +3316,7 @@ bus_generic_probe(device_t dev) * on early-pass busses during BUS_NEW_PASS(). */ if (dl->pass > bus_current_pass) - continue; + continue; DEVICE_IDENTIFY(dl->driver, dev); } From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 19:39:46 2010 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 52A121065674 for ; Thu, 12 Aug 2010 19:39:46 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 8A2028FC0C for ; Thu, 12 Aug 2010 19:39:45 +0000 (UTC) Received: (qmail 19430 invoked by uid 399); 12 Aug 2010 19:39:44 -0000 Received: from localhost (HELO lap.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 12 Aug 2010 19:39:44 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4C644DFF.70907@FreeBSD.org> Date: Thu, 12 Aug 2010 12:39:43 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.8) Gecko/20100807 Thunderbird/3.1.2 MIME-Version: 1.0 To: Takanori Watanabe References: <201008121101.o7CB1c6T059566@svn.freebsd.org> In-Reply-To: <201008121101.o7CB1c6T059566@svn.freebsd.org> X-Enigmail-Version: 1.1.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211219 - head/usr.sbin/acpi/acpidump 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, 12 Aug 2010 19:39:46 -0000 I think it's pretty obvious at this point that you didn't do a 'make universe' to verify that your updates were correct, and the build is still broken. Can you either fix this immediately, or back it out immediately? Thanks, Doug On 08/12/2010 04:01, Takanori Watanabe wrote: > Author: takawata > Date: Thu Aug 12 11:01:38 2010 > New Revision: 211219 > URL: http://svn.freebsd.org/changeset/base/211219 > > Log: > Fix tindebox breakage about format warning. > > Modified: > head/usr.sbin/acpi/acpidump/acpi.c > > Modified: head/usr.sbin/acpi/acpidump/acpi.c > ============================================================================== > --- head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 12 11:00:45 2010 (r211218) > +++ head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 12 11:01:38 2010 (r211219) > @@ -646,7 +646,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) > printf(END_COMMENT); > return; > } > - printf("\tClass %d Base Address 0x%jx Length %lld\n\n", > + printf("\tClass %d Base Address 0x%jx Length %llu\n\n", > tcpa->platform_class, paddr, len); > > if (len == 0) { > From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 19:43:40 2010 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 56AEA10656B0; Thu, 12 Aug 2010 19:43:40 +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 45E318FC0A; Thu, 12 Aug 2010 19:43:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CJhenw076084; Thu, 12 Aug 2010 19:43:40 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CJheH4076082; Thu, 12 Aug 2010 19:43:40 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008121943.o7CJheH4076082@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 12 Aug 2010 19:43: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: r211234 - head/tools/regression/fstest/tests/unlink 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, 12 Aug 2010 19:43:40 -0000 Author: pjd Date: Thu Aug 12 19:43:40 2010 New Revision: 211234 URL: http://svn.freebsd.org/changeset/base/211234 Log: Fix copy&pasted code - we want to create character device here. Modified: head/tools/regression/fstest/tests/unlink/11.t Modified: head/tools/regression/fstest/tests/unlink/11.t ============================================================================== --- head/tools/regression/fstest/tests/unlink/11.t Thu Aug 12 19:40:49 2010 (r211233) +++ head/tools/regression/fstest/tests/unlink/11.t Thu Aug 12 19:43:40 2010 (r211234) @@ -67,19 +67,19 @@ expect "EACCES|EPERM" -u 65533 -g 65533 expect 0 unlink ${n0}/${n1} # User owns both: the sticky directory and the character device to be removed. -expect 0 mknod ${n0}/${n1} b 0644 1 2 +expect 0 mknod ${n0}/${n1} c 0644 1 2 expect 0 chown ${n0}/${n1} 65534 65534 expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} # User owns the character device to be removed, but doesn't own the sticky directory. -expect 0 mknod ${n0}/${n1} b 0644 1 2 +expect 0 mknod ${n0}/${n1} c 0644 1 2 expect 0 chown ${n0}/${n1} 65533 65533 expect 0 -u 65533 -g 65533 unlink ${n0}/${n1} # User owns the sticky directory, but doesn't own the character device to be removed. -expect 0 mknod ${n0}/${n1} b 0644 1 2 +expect 0 mknod ${n0}/${n1} c 0644 1 2 expect 0 chown ${n0}/${n1} 65533 65533 expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} # User doesn't own the sticky directory nor the character directory to be removed. -expect 0 mknod ${n0}/${n1} b 0644 1 2 +expect 0 mknod ${n0}/${n1} c 0644 1 2 expect 0 chown ${n0}/${n1} 65534 65534 expect "EACCES|EPERM" -u 65533 -g 65533 unlink ${n0}/${n1} expect 0 unlink ${n0}/${n1} From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 19:45:28 2010 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 25AAD1065697; Thu, 12 Aug 2010 19:45:28 +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 153DD8FC17; Thu, 12 Aug 2010 19:45:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CJjRu0076533; Thu, 12 Aug 2010 19:45:27 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CJjRZb076531; Thu, 12 Aug 2010 19:45:27 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008121945.o7CJjRZb076531@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 12 Aug 2010 19:45: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: r211235 - head/tools/regression/fstest 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, 12 Aug 2010 19:45:28 -0000 Author: pjd Date: Thu Aug 12 19:45:27 2010 New Revision: 211235 URL: http://svn.freebsd.org/changeset/base/211235 Log: Portable Makefile. Modified: head/tools/regression/fstest/Makefile Modified: head/tools/regression/fstest/Makefile ============================================================================== --- head/tools/regression/fstest/Makefile Thu Aug 12 19:43:40 2010 (r211234) +++ head/tools/regression/fstest/Makefile Thu Aug 12 19:45:27 2010 (r211235) @@ -1,25 +1,26 @@ # $FreeBSD$ PROG= fstest -NO_MAN= -OSTYPE!= uname +${PROG}: ${PROG}.c + @OSTYPE=`uname`; \ + CFLAGS=-D__OS_$${OSTYPE}__; \ + if [ $$OSTYPE = "FreeBSD" ]; then \ + CFLAGS="$$CFLAGS -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL"; \ + elif [ $$OSTYPE = "SunOS" ]; then \ + CFLAGS="$$CFLAGS -DHAS_TRUNCATE64 -DHAS_STAT64"; \ + CFLAGS="$$CFLAGS -lsocket"; \ + elif [ $$OSTYPE = "Darwin" ]; then \ + CFLAGS="$$CFLAGS -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS"; \ + elif [ $$OSTYPE == "Linux" ]; then \ + CFLAGS="$$CFLAGS -D_GNU_SOURCE"; \ + else \ + echo "Unsupported operating system: ${OSTYPE}."; \ + exit 1; \ + fi; \ + cmd="gcc -Wall $$CFLAGS ${PROG}.c -o ${PROG}"; \ + echo $$cmd; \ + $$cmd -.if ${OSTYPE} == "FreeBSD" -CFLAGS+= -D__OS_FreeBSD__ -CFLAGS+= -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL - -.elif ${OSTYPE} == "SunOS" -CFLAGS+= -D__OS_Solaris__ -CFLAGS+= -DHAS_TRUNCATE64 -DHAS_STAT64 - -.elif ${OSTYPE} == "Darwin" -CFLAGS+= -D__OS_Darwin__ -CFLAGS+= -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS - -.elif ${OSTYPE} == "Linux" -CFLAGS+= -D__OS_Linux__ -CFLAGS+= -D_GNU_SOURCE -.endif - -.include +clean: + rm -f ${PROG} From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 19:50:40 2010 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 EF7891065679; Thu, 12 Aug 2010 19:50:40 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D88288FC1E; Thu, 12 Aug 2010 19:50:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CJoeXm077725; Thu, 12 Aug 2010 19:50:40 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CJoeKT077723; Thu, 12 Aug 2010 19:50:40 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201008121950.o7CJoeKT077723@svn.freebsd.org> From: "Justin T. Gibbs" Date: Thu, 12 Aug 2010 19:50: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: r211236 - 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, 12 Aug 2010 19:50:41 -0000 Author: gibbs Date: Thu Aug 12 19:50:40 2010 New Revision: 211236 URL: http://svn.freebsd.org/changeset/base/211236 Log: Allow interrupt driven config hooks to be registered from config hook callbacks. Interrupt driven configuration hooks serve two purposes: they are a mechanism for registering for a callback that is invoked once interrupt services are available, and they hold off root device selection so long as any configuration hooks are still active. Before this change, it was not possible to safely register additional hooks from the context of a configuration hook callback. The need for this feature arises when interrupts are required to discover new devices (e.g. access to the XenStore to find para-virtualized devices) which in turn also require the ability to hold off root device selection until some lengthy, interrupt driven, configuration task has completed (e.g. Xen front/back device driver negotiation). More specifically, the mutex protecting the list of active configuration hooks is never held during a callback, and static information is used to ensure proper ordering and only a single callback to each hook even when faced with registration or removal of a hook during an active run. Sponsored by: Spectra Logic Corporation MFC after: 1 week. Modified: head/sys/kern/subr_autoconf.c Modified: head/sys/kern/subr_autoconf.c ============================================================================== --- head/sys/kern/subr_autoconf.c Thu Aug 12 19:45:27 2010 (r211235) +++ head/sys/kern/subr_autoconf.c Thu Aug 12 19:50:40 2010 (r211236) @@ -55,11 +55,12 @@ __FBSDID("$FreeBSD$"); */ static TAILQ_HEAD(, intr_config_hook) intr_config_hook_list = TAILQ_HEAD_INITIALIZER(intr_config_hook_list); +static struct intr_config_hook *next_to_notify; static struct mtx intr_config_hook_lock; MTX_SYSINIT(intr_config_hook, &intr_config_hook_lock, "intr config", MTX_DEF); /* ARGSUSED */ -static void run_interrupt_driven_config_hooks(void *dummy); +static void run_interrupt_driven_config_hooks(void); /* * If we wait too long for an interrupt-driven config hook to return, print @@ -91,19 +92,46 @@ run_interrupt_driven_config_hooks_warnin } static void -run_interrupt_driven_config_hooks(void *dummy) +run_interrupt_driven_config_hooks() { - struct intr_config_hook *hook_entry, *next_entry; - int warned; + static int running; + struct intr_config_hook *hook_entry; mtx_lock(&intr_config_hook_lock); - TAILQ_FOREACH_SAFE(hook_entry, &intr_config_hook_list, ich_links, - next_entry) { + + /* + * If hook processing is already active, any newly + * registered hooks will eventually be notified. + * Let the currently running session issue these + * notifications. + */ + if (running != 0) { + mtx_unlock(&intr_config_hook_lock); + return; + } + running = 1; + + while (next_to_notify != NULL) { + hook_entry = next_to_notify; + next_to_notify = TAILQ_NEXT(hook_entry, ich_links); mtx_unlock(&intr_config_hook_lock); (*hook_entry->ich_func)(hook_entry->ich_arg); mtx_lock(&intr_config_hook_lock); } + running = 0; + mtx_unlock(&intr_config_hook_lock); +} + +static void +boot_run_interrupt_driven_config_hooks(void *dummy) +{ + int warned; + + run_interrupt_driven_config_hooks(); + + /* Block boot processing until all hooks are disestablished. */ + mtx_lock(&intr_config_hook_lock); warned = 0; while (!TAILQ_EMPTY(&intr_config_hook_list)) { if (msleep(&intr_config_hook_list, &intr_config_hook_lock, @@ -117,8 +145,9 @@ run_interrupt_driven_config_hooks(void * } mtx_unlock(&intr_config_hook_lock); } + SYSINIT(intr_config_hooks, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_FIRST, - run_interrupt_driven_config_hooks, NULL); + boot_run_interrupt_driven_config_hooks, NULL); /* * Register a hook that will be called after "cold" @@ -141,10 +170,16 @@ config_intrhook_establish(struct intr_co return (1); } TAILQ_INSERT_TAIL(&intr_config_hook_list, hook, ich_links); + if (next_to_notify == NULL) + next_to_notify = hook; mtx_unlock(&intr_config_hook_lock); if (cold == 0) + /* + * XXX Call from a task since not all drivers expect + * to be re-entered at the time a hook is established. + */ /* XXX Sufficient for modules loaded after initial config??? */ - run_interrupt_driven_config_hooks(NULL); + run_interrupt_driven_config_hooks(); return (0); } @@ -161,6 +196,8 @@ config_intrhook_disestablish(struct intr panic("config_intrhook_disestablish: disestablishing an " "unestablished hook"); + if (next_to_notify == hook) + next_to_notify = TAILQ_NEXT(hook, ich_links); TAILQ_REMOVE(&intr_config_hook_list, hook, ich_links); /* Wakeup anyone watching the list */ From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 20:18:07 2010 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 3F99D1065674; Thu, 12 Aug 2010 20:18:07 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C8088FC15; Thu, 12 Aug 2010 20:18:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CKI7b5083995; Thu, 12 Aug 2010 20:18:07 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CKI6qK083986; Thu, 12 Aug 2010 20:18:06 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201008122018.o7CKI6qK083986@svn.freebsd.org> From: Jack F Vogel Date: Thu, 12 Aug 2010 20:18:06 +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: r211241 - in stable/8/sys: conf dev/e1000 modules/em modules/igb 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, 12 Aug 2010 20:18:07 -0000 Author: jfv Date: Thu Aug 12 20:18:06 2010 New Revision: 211241 URL: http://svn.freebsd.org/changeset/base/211241 Log: MFC of e1000 changes Many bug fixes, major new feature: the igb vf driver. Added: stable/8/sys/dev/e1000/e1000_mbx.c - copied unchanged from r209616, head/sys/dev/e1000/e1000_mbx.c stable/8/sys/dev/e1000/e1000_mbx.h - copied unchanged from r209616, head/sys/dev/e1000/e1000_mbx.h stable/8/sys/dev/e1000/e1000_vf.c - copied unchanged from r209616, head/sys/dev/e1000/e1000_vf.c stable/8/sys/dev/e1000/e1000_vf.h - copied unchanged from r209616, head/sys/dev/e1000/e1000_vf.h Modified: stable/8/sys/conf/files stable/8/sys/dev/e1000/e1000_82575.h stable/8/sys/dev/e1000/e1000_api.c stable/8/sys/dev/e1000/e1000_api.h stable/8/sys/dev/e1000/e1000_hw.h stable/8/sys/dev/e1000/e1000_osdep.h stable/8/sys/dev/e1000/e1000_regs.h stable/8/sys/dev/e1000/if_em.c stable/8/sys/dev/e1000/if_igb.c stable/8/sys/dev/e1000/if_igb.h stable/8/sys/dev/e1000/if_lem.c stable/8/sys/modules/em/Makefile stable/8/sys/modules/igb/Makefile Directory Properties: stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/conf/files ============================================================================== --- stable/8/sys/conf/files Thu Aug 12 20:09:22 2010 (r211240) +++ stable/8/sys/conf/files Thu Aug 12 20:18:06 2010 (r211241) @@ -932,6 +932,10 @@ dev/e1000/e1000_nvm.c optional em | igb compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_phy.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" +dev/e1000/e1000_vf.c optional em | igb \ + compile-with "${NORMAL_C} -I$S/dev/e1000" +dev/e1000/e1000_mbx.c optional em | igb \ + compile-with "${NORMAL_C} -I$S/dev/e1000" dev/e1000/e1000_osdep.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/et/if_et.c optional et Modified: stable/8/sys/dev/e1000/e1000_82575.h ============================================================================== --- stable/8/sys/dev/e1000/e1000_82575.h Thu Aug 12 20:09:22 2010 (r211240) +++ stable/8/sys/dev/e1000/e1000_82575.h Thu Aug 12 20:18:06 2010 (r211241) @@ -459,5 +459,16 @@ struct e1000_adv_tx_context_desc { #define E1000_RXPBS_SIZE_MASK_82576 0x0000007F void e1000_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable); void e1000_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable); +enum e1000_promisc_type { + e1000_promisc_disabled = 0, /* all promisc modes disabled */ + e1000_promisc_unicast = 1, /* unicast promiscuous enabled */ + e1000_promisc_multicast = 2, /* multicast promiscuous enabled */ + e1000_promisc_enabled = 3, /* both uni and multicast promisc */ + e1000_num_promisc_types +}; + +void e1000_vfta_set_vf(struct e1000_hw *, u16, bool); +void e1000_rlpml_set_vf(struct e1000_hw *, u16); +s32 e1000_promisc_set_vf(struct e1000_hw *, enum e1000_promisc_type type); u16 e1000_rxpbs_adjust_82580(u32 data); #endif /* _E1000_82575_H_ */ Modified: stable/8/sys/dev/e1000/e1000_api.c ============================================================================== --- stable/8/sys/dev/e1000/e1000_api.c Thu Aug 12 20:09:22 2010 (r211240) +++ stable/8/sys/dev/e1000/e1000_api.c Thu Aug 12 20:18:06 2010 (r211241) @@ -112,6 +112,31 @@ out: return ret_val; } +/** + * e1000_init_mbx_params - Initialize mailbox function pointers + * @hw: pointer to the HW structure + * + * This function initializes the function pointers for the PHY + * set of functions. Called by drivers or by e1000_setup_init_funcs. + **/ +s32 e1000_init_mbx_params(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + + if (hw->mbx.ops.init_params) { + ret_val = hw->mbx.ops.init_params(hw); + if (ret_val) { + DEBUGOUT("Mailbox Initialization Error\n"); + goto out; + } + } else { + DEBUGOUT("mbx.init_mbx_params was NULL\n"); + ret_val = -E1000_ERR_CONFIG; + } + +out: + return ret_val; +} /** * e1000_set_mac_type - Sets MAC type @@ -281,6 +306,9 @@ s32 e1000_set_mac_type(struct e1000_hw * case E1000_DEV_ID_82580_COPPER_DUAL: mac->type = e1000_82580; break; + case E1000_DEV_ID_82576_VF: + mac->type = e1000_vfadapt; + break; default: /* Should never have loaded on this device */ ret_val = -E1000_ERR_MAC_INIT; @@ -326,6 +354,7 @@ s32 e1000_setup_init_funcs(struct e1000_ e1000_init_mac_ops_generic(hw); e1000_init_phy_ops_generic(hw); e1000_init_nvm_ops_generic(hw); + e1000_init_mbx_ops_generic(hw); /* * Set up the init function pointers. These are functions within the @@ -374,6 +403,9 @@ s32 e1000_setup_init_funcs(struct e1000_ case e1000_82580: e1000_init_function_pointers_82575(hw); break; + case e1000_vfadapt: + e1000_init_function_pointers_vf(hw); + break; default: DEBUGOUT("Hardware not supported\n"); ret_val = -E1000_ERR_CONFIG; @@ -396,6 +428,10 @@ s32 e1000_setup_init_funcs(struct e1000_ ret_val = e1000_init_phy_params(hw); if (ret_val) goto out; + + ret_val = e1000_init_mbx_params(hw); + if (ret_val) + goto out; } out: Modified: stable/8/sys/dev/e1000/e1000_api.h ============================================================================== --- stable/8/sys/dev/e1000/e1000_api.h Thu Aug 12 20:09:22 2010 (r211240) +++ stable/8/sys/dev/e1000/e1000_api.h Thu Aug 12 20:18:06 2010 (r211241) @@ -55,6 +55,7 @@ s32 e1000_setup_init_funcs(struct e1000 s32 e1000_init_mac_params(struct e1000_hw *hw); s32 e1000_init_nvm_params(struct e1000_hw *hw); s32 e1000_init_phy_params(struct e1000_hw *hw); +s32 e1000_init_mbx_params(struct e1000_hw *hw); s32 e1000_get_bus_info(struct e1000_hw *hw); void e1000_clear_vfta(struct e1000_hw *hw); void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value); Modified: stable/8/sys/dev/e1000/e1000_hw.h ============================================================================== --- stable/8/sys/dev/e1000/e1000_hw.h Thu Aug 12 20:09:22 2010 (r211240) +++ stable/8/sys/dev/e1000/e1000_hw.h Thu Aug 12 20:18:06 2010 (r211241) @@ -134,6 +134,7 @@ struct e1000_hw; #define E1000_DEV_ID_82576_NS 0x150A #define E1000_DEV_ID_82576_NS_SERDES 0x1518 #define E1000_DEV_ID_82576_SERDES_QUAD 0x150D +#define E1000_DEV_ID_82576_VF 0x10CA #define E1000_DEV_ID_82575EB_COPPER 0x10A7 #define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9 #define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6 @@ -186,6 +187,7 @@ enum e1000_mac_type { e1000_82575, e1000_82576, e1000_82580, + e1000_vfadapt, e1000_num_macs /* List is 1-based, so subtract 1 for TRUE count. */ }; @@ -531,6 +533,37 @@ struct e1000_hw_stats { u64 doosync; }; +struct e1000_vf_stats { + u64 base_gprc; + u64 base_gptc; + u64 base_gorc; + u64 base_gotc; + u64 base_mprc; + u64 base_gotlbc; + u64 base_gptlbc; + u64 base_gorlbc; + u64 base_gprlbc; + + u32 last_gprc; + u32 last_gptc; + u32 last_gorc; + u32 last_gotc; + u32 last_mprc; + u32 last_gotlbc; + u32 last_gptlbc; + u32 last_gorlbc; + u32 last_gprlbc; + + u64 gprc; + u64 gptc; + u64 gorc; + u64 gotc; + u64 mprc; + u64 gotlbc; + u64 gptlbc; + u64 gorlbc; + u64 gprlbc; +}; struct e1000_phy_stats { u32 idle_errors; @@ -581,6 +614,7 @@ struct e1000_host_mng_command_info { #include "e1000_phy.h" #include "e1000_nvm.h" #include "e1000_manage.h" +#include "e1000_mbx.h" struct e1000_mac_operations { /* Function pointers for the MAC. */ @@ -758,6 +792,7 @@ struct e1000_fc_info { u32 high_water; /* Flow control high-water mark */ u32 low_water; /* Flow control low-water mark */ u16 pause_time; /* Flow control pause timer */ + u16 refresh_time; /* Flow control refresh timer */ bool send_xon; /* Flow control send XON */ bool strict_ieee; /* Strict IEEE mode */ enum e1000_fc_mode current_mode; /* FC mode in effect */ @@ -805,6 +840,33 @@ struct e1000_dev_spec_ich8lan { bool nvm_k1_enabled; }; +struct e1000_mbx_operations { + s32 (*init_params)(struct e1000_hw *hw); + s32 (*read)(struct e1000_hw *, u32 *, u16, u16); + s32 (*write)(struct e1000_hw *, u32 *, u16, u16); + s32 (*read_posted)(struct e1000_hw *, u32 *, u16, u16); + s32 (*write_posted)(struct e1000_hw *, u32 *, u16, u16); + s32 (*check_for_msg)(struct e1000_hw *, u16); + s32 (*check_for_ack)(struct e1000_hw *, u16); + s32 (*check_for_rst)(struct e1000_hw *, u16); +}; + +struct e1000_mbx_stats { + u32 msgs_tx; + u32 msgs_rx; + u32 acks; + u32 reqs; + u32 rsts; +}; + +struct e1000_mbx_info { + struct e1000_mbx_operations ops; + struct e1000_mbx_stats stats; + u32 timeout; + u32 usec_delay; + u16 size; +}; + struct e1000_dev_spec_82575 { bool sgmii_active; bool global_device_reset; @@ -828,6 +890,7 @@ struct e1000_hw { struct e1000_phy_info phy; struct e1000_nvm_info nvm; struct e1000_bus_info bus; + struct e1000_mbx_info mbx; struct e1000_host_mng_dhcp_cookie mng_cookie; union { Copied: stable/8/sys/dev/e1000/e1000_mbx.c (from r209616, head/sys/dev/e1000/e1000_mbx.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/dev/e1000/e1000_mbx.c Thu Aug 12 20:18:06 2010 (r211241, copy of r209616, head/sys/dev/e1000/e1000_mbx.c) @@ -0,0 +1,762 @@ +/****************************************************************************** + + Copyright (c) 2001-2010, Intel Corporation + 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. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +******************************************************************************/ +/*$FreeBSD$*/ + +#include "e1000_mbx.h" + +/** + * e1000_null_mbx_check_for_flag - No-op function, return 0 + * @hw: pointer to the HW structure + **/ +static s32 e1000_null_mbx_check_for_flag(struct e1000_hw *hw, u16 mbx_id) +{ + DEBUGFUNC("e1000_null_mbx_check_flag"); + + return E1000_SUCCESS; +} + +/** + * e1000_null_mbx_transact - No-op function, return 0 + * @hw: pointer to the HW structure + **/ +static s32 e1000_null_mbx_transact(struct e1000_hw *hw, u32 *msg, u16 size, + u16 mbx_id) +{ + DEBUGFUNC("e1000_null_mbx_rw_msg"); + + return E1000_SUCCESS; +} + +/** + * e1000_read_mbx - Reads a message from the mailbox + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to read + * + * returns SUCCESS if it successfuly read message from buffer + **/ +s32 e1000_read_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_read_mbx"); + + /* limit read to size of mailbox */ + if (size > mbx->size) + size = mbx->size; + + if (mbx->ops.read) + ret_val = mbx->ops.read(hw, msg, size, mbx_id); + + return ret_val; +} + +/** + * e1000_write_mbx - Write a message to the mailbox + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to write + * + * returns SUCCESS if it successfully copied message into the buffer + **/ +s32 e1000_write_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_write_mbx"); + + if (size > mbx->size) + ret_val = -E1000_ERR_MBX; + + else if (mbx->ops.write) + ret_val = mbx->ops.write(hw, msg, size, mbx_id); + + return ret_val; +} + +/** + * e1000_check_for_msg - checks to see if someone sent us mail + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to check + * + * returns SUCCESS if the Status bit was found or else ERR_MBX + **/ +s32 e1000_check_for_msg(struct e1000_hw *hw, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_msg"); + + if (mbx->ops.check_for_msg) + ret_val = mbx->ops.check_for_msg(hw, mbx_id); + + return ret_val; +} + +/** + * e1000_check_for_ack - checks to see if someone sent us ACK + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to check + * + * returns SUCCESS if the Status bit was found or else ERR_MBX + **/ +s32 e1000_check_for_ack(struct e1000_hw *hw, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_ack"); + + if (mbx->ops.check_for_ack) + ret_val = mbx->ops.check_for_ack(hw, mbx_id); + + return ret_val; +} + +/** + * e1000_check_for_rst - checks to see if other side has reset + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to check + * + * returns SUCCESS if the Status bit was found or else ERR_MBX + **/ +s32 e1000_check_for_rst(struct e1000_hw *hw, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_rst"); + + if (mbx->ops.check_for_rst) + ret_val = mbx->ops.check_for_rst(hw, mbx_id); + + return ret_val; +} + +/** + * e1000_poll_for_msg - Wait for message notification + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to write + * + * returns SUCCESS if it successfully received a message notification + **/ +static s32 e1000_poll_for_msg(struct e1000_hw *hw, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + int countdown = mbx->timeout; + + DEBUGFUNC("e1000_poll_for_msg"); + + if (!countdown || !mbx->ops.check_for_msg) + goto out; + + while (countdown && mbx->ops.check_for_msg(hw, mbx_id)) { + countdown--; + if (!countdown) + break; + usec_delay(mbx->usec_delay); + } + + /* if we failed, all future posted messages fail until reset */ + if (!countdown) + mbx->timeout = 0; +out: + return countdown ? E1000_SUCCESS : -E1000_ERR_MBX; +} + +/** + * e1000_poll_for_ack - Wait for message acknowledgement + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to write + * + * returns SUCCESS if it successfully received a message acknowledgement + **/ +static s32 e1000_poll_for_ack(struct e1000_hw *hw, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + int countdown = mbx->timeout; + + DEBUGFUNC("e1000_poll_for_ack"); + + if (!countdown || !mbx->ops.check_for_ack) + goto out; + + while (countdown && mbx->ops.check_for_ack(hw, mbx_id)) { + countdown--; + if (!countdown) + break; + usec_delay(mbx->usec_delay); + } + + /* if we failed, all future posted messages fail until reset */ + if (!countdown) + mbx->timeout = 0; +out: + return countdown ? E1000_SUCCESS : -E1000_ERR_MBX; +} + +/** + * e1000_read_posted_mbx - Wait for message notification and receive message + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to write + * + * returns SUCCESS if it successfully received a message notification and + * copied it into the receive buffer. + **/ +s32 e1000_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_read_posted_mbx"); + + if (!mbx->ops.read) + goto out; + + ret_val = e1000_poll_for_msg(hw, mbx_id); + + /* if ack received read message, otherwise we timed out */ + if (!ret_val) + ret_val = mbx->ops.read(hw, msg, size, mbx_id); +out: + return ret_val; +} + +/** + * e1000_write_posted_mbx - Write a message to the mailbox, wait for ack + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to write + * + * returns SUCCESS if it successfully copied message into the buffer and + * received an ack to that message within delay * timeout period + **/ +s32 e1000_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_write_posted_mbx"); + + /* exit if either we can't write or there isn't a defined timeout */ + if (!mbx->ops.write || !mbx->timeout) + goto out; + + /* send msg */ + ret_val = mbx->ops.write(hw, msg, size, mbx_id); + + /* if msg sent wait until we receive an ack */ + if (!ret_val) + ret_val = e1000_poll_for_ack(hw, mbx_id); +out: + return ret_val; +} + +/** + * e1000_init_mbx_ops_generic - Initialize mbx function pointers + * @hw: pointer to the HW structure + * + * Sets the function pointers to no-op functions + **/ +void e1000_init_mbx_ops_generic(struct e1000_hw *hw) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + mbx->ops.init_params = e1000_null_ops_generic; + mbx->ops.read = e1000_null_mbx_transact; + mbx->ops.write = e1000_null_mbx_transact; + mbx->ops.check_for_msg = e1000_null_mbx_check_for_flag; + mbx->ops.check_for_ack = e1000_null_mbx_check_for_flag; + mbx->ops.check_for_rst = e1000_null_mbx_check_for_flag; + mbx->ops.read_posted = e1000_read_posted_mbx; + mbx->ops.write_posted = e1000_write_posted_mbx; +} + +/** + * e1000_read_v2p_mailbox - read v2p mailbox + * @hw: pointer to the HW structure + * + * This function is used to read the v2p mailbox without losing the read to + * clear status bits. + **/ +static u32 e1000_read_v2p_mailbox(struct e1000_hw *hw) +{ + u32 v2p_mailbox = E1000_READ_REG(hw, E1000_V2PMAILBOX(0)); + + v2p_mailbox |= hw->dev_spec.vf.v2p_mailbox; + hw->dev_spec.vf.v2p_mailbox |= v2p_mailbox & E1000_V2PMAILBOX_R2C_BITS; + + return v2p_mailbox; +} + +/** + * e1000_check_for_bit_vf - Determine if a status bit was set + * @hw: pointer to the HW structure + * @mask: bitmask for bits to be tested and cleared + * + * This function is used to check for the read to clear bits within + * the V2P mailbox. + **/ +static s32 e1000_check_for_bit_vf(struct e1000_hw *hw, u32 mask) +{ + u32 v2p_mailbox = e1000_read_v2p_mailbox(hw); + s32 ret_val = -E1000_ERR_MBX; + + if (v2p_mailbox & mask) + ret_val = E1000_SUCCESS; + + hw->dev_spec.vf.v2p_mailbox &= ~mask; + + return ret_val; +} + +/** + * e1000_check_for_msg_vf - checks to see if the PF has sent mail + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to check + * + * returns SUCCESS if the PF has set the Status bit or else ERR_MBX + **/ +static s32 e1000_check_for_msg_vf(struct e1000_hw *hw, u16 mbx_id) +{ + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_msg_vf"); + + if (!e1000_check_for_bit_vf(hw, E1000_V2PMAILBOX_PFSTS)) { + ret_val = E1000_SUCCESS; + hw->mbx.stats.reqs++; + } + + return ret_val; +} + +/** + * e1000_check_for_ack_vf - checks to see if the PF has ACK'd + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to check + * + * returns SUCCESS if the PF has set the ACK bit or else ERR_MBX + **/ +static s32 e1000_check_for_ack_vf(struct e1000_hw *hw, u16 mbx_id) +{ + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_ack_vf"); + + if (!e1000_check_for_bit_vf(hw, E1000_V2PMAILBOX_PFACK)) { + ret_val = E1000_SUCCESS; + hw->mbx.stats.acks++; + } + + return ret_val; +} + +/** + * e1000_check_for_rst_vf - checks to see if the PF has reset + * @hw: pointer to the HW structure + * @mbx_id: id of mailbox to check + * + * returns TRUE if the PF has set the reset done bit or else FALSE + **/ +static s32 e1000_check_for_rst_vf(struct e1000_hw *hw, u16 mbx_id) +{ + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_rst_vf"); + + if (!e1000_check_for_bit_vf(hw, (E1000_V2PMAILBOX_RSTD | + E1000_V2PMAILBOX_RSTI))) { + ret_val = E1000_SUCCESS; + hw->mbx.stats.rsts++; + } + + return ret_val; +} + +/** + * e1000_obtain_mbx_lock_vf - obtain mailbox lock + * @hw: pointer to the HW structure + * + * return SUCCESS if we obtained the mailbox lock + **/ +static s32 e1000_obtain_mbx_lock_vf(struct e1000_hw *hw) +{ + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_obtain_mbx_lock_vf"); + + /* Take ownership of the buffer */ + E1000_WRITE_REG(hw, E1000_V2PMAILBOX(0), E1000_V2PMAILBOX_VFU); + + /* reserve mailbox for vf use */ + if (e1000_read_v2p_mailbox(hw) & E1000_V2PMAILBOX_VFU) + ret_val = E1000_SUCCESS; + + return ret_val; +} + +/** + * e1000_write_mbx_vf - Write a message to the mailbox + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to write + * + * returns SUCCESS if it successfully copied message into the buffer + **/ +static s32 e1000_write_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size, + u16 mbx_id) +{ + s32 ret_val; + u16 i; + + + DEBUGFUNC("e1000_write_mbx_vf"); + + /* lock the mailbox to prevent pf/vf race condition */ + ret_val = e1000_obtain_mbx_lock_vf(hw); + if (ret_val) + goto out_no_write; + + /* flush msg and acks as we are overwriting the message buffer */ + e1000_check_for_msg_vf(hw, 0); + e1000_check_for_ack_vf(hw, 0); + + /* copy the caller specified message to the mailbox memory buffer */ + for (i = 0; i < size; i++) + E1000_WRITE_REG_ARRAY(hw, E1000_VMBMEM(0), i, msg[i]); + + /* update stats */ + hw->mbx.stats.msgs_tx++; + + /* Drop VFU and interrupt the PF to tell it a message has been sent */ + E1000_WRITE_REG(hw, E1000_V2PMAILBOX(0), E1000_V2PMAILBOX_REQ); + +out_no_write: + return ret_val; +} + +/** + * e1000_read_mbx_vf - Reads a message from the inbox intended for vf + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @mbx_id: id of mailbox to read + * + * returns SUCCESS if it successfuly read message from buffer + **/ +static s32 e1000_read_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size, + u16 mbx_id) +{ + s32 ret_val = E1000_SUCCESS; + u16 i; + + DEBUGFUNC("e1000_read_mbx_vf"); + + /* lock the mailbox to prevent pf/vf race condition */ + ret_val = e1000_obtain_mbx_lock_vf(hw); + if (ret_val) + goto out_no_read; + + /* copy the message from the mailbox memory buffer */ + for (i = 0; i < size; i++) + msg[i] = E1000_READ_REG_ARRAY(hw, E1000_VMBMEM(0), i); + + /* Acknowledge receipt and release mailbox, then we're done */ + E1000_WRITE_REG(hw, E1000_V2PMAILBOX(0), E1000_V2PMAILBOX_ACK); + + /* update stats */ + hw->mbx.stats.msgs_rx++; + +out_no_read: + return ret_val; +} + +/** + * e1000_init_mbx_params_vf - set initial values for vf mailbox + * @hw: pointer to the HW structure + * + * Initializes the hw->mbx struct to correct values for vf mailbox + */ +s32 e1000_init_mbx_params_vf(struct e1000_hw *hw) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + + /* start mailbox as timed out and let the reset_hw call set the timeout + * value to begin communications */ + mbx->timeout = 0; + mbx->usec_delay = E1000_VF_MBX_INIT_DELAY; + + mbx->size = E1000_VFMAILBOX_SIZE; + + mbx->ops.read = e1000_read_mbx_vf; + mbx->ops.write = e1000_write_mbx_vf; + mbx->ops.read_posted = e1000_read_posted_mbx; + mbx->ops.write_posted = e1000_write_posted_mbx; + mbx->ops.check_for_msg = e1000_check_for_msg_vf; + mbx->ops.check_for_ack = e1000_check_for_ack_vf; + mbx->ops.check_for_rst = e1000_check_for_rst_vf; + + mbx->stats.msgs_tx = 0; + mbx->stats.msgs_rx = 0; + mbx->stats.reqs = 0; + mbx->stats.acks = 0; + mbx->stats.rsts = 0; + + return E1000_SUCCESS; +} + +static s32 e1000_check_for_bit_pf(struct e1000_hw *hw, u32 mask) +{ + u32 mbvficr = E1000_READ_REG(hw, E1000_MBVFICR); + s32 ret_val = -E1000_ERR_MBX; + + if (mbvficr & mask) { + ret_val = E1000_SUCCESS; + E1000_WRITE_REG(hw, E1000_MBVFICR, mask); + } + + return ret_val; +} + +/** + * e1000_check_for_msg_pf - checks to see if the VF has sent mail + * @hw: pointer to the HW structure + * @vf_number: the VF index + * + * returns SUCCESS if the VF has set the Status bit or else ERR_MBX + **/ +static s32 e1000_check_for_msg_pf(struct e1000_hw *hw, u16 vf_number) +{ + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_msg_pf"); + + if (!e1000_check_for_bit_pf(hw, E1000_MBVFICR_VFREQ_VF1 << vf_number)) { + ret_val = E1000_SUCCESS; + hw->mbx.stats.reqs++; + } + + return ret_val; +} + +/** + * e1000_check_for_ack_pf - checks to see if the VF has ACKed + * @hw: pointer to the HW structure + * @vf_number: the VF index + * + * returns SUCCESS if the VF has set the Status bit or else ERR_MBX + **/ +static s32 e1000_check_for_ack_pf(struct e1000_hw *hw, u16 vf_number) +{ + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_ack_pf"); + + if (!e1000_check_for_bit_pf(hw, E1000_MBVFICR_VFACK_VF1 << vf_number)) { + ret_val = E1000_SUCCESS; + hw->mbx.stats.acks++; + } + + return ret_val; +} + +/** + * e1000_check_for_rst_pf - checks to see if the VF has reset + * @hw: pointer to the HW structure + * @vf_number: the VF index + * + * returns SUCCESS if the VF has set the Status bit or else ERR_MBX + **/ +static s32 e1000_check_for_rst_pf(struct e1000_hw *hw, u16 vf_number) +{ + u32 vflre = E1000_READ_REG(hw, E1000_VFLRE); + s32 ret_val = -E1000_ERR_MBX; + + DEBUGFUNC("e1000_check_for_rst_pf"); + + if (vflre & (1 << vf_number)) { + ret_val = E1000_SUCCESS; + E1000_WRITE_REG(hw, E1000_VFLRE, (1 << vf_number)); + hw->mbx.stats.rsts++; + } + + return ret_val; +} + +/** + * e1000_obtain_mbx_lock_pf - obtain mailbox lock + * @hw: pointer to the HW structure + * @vf_number: the VF index + * + * return SUCCESS if we obtained the mailbox lock + **/ +static s32 e1000_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number) +{ + s32 ret_val = -E1000_ERR_MBX; + u32 p2v_mailbox; + + DEBUGFUNC("e1000_obtain_mbx_lock_pf"); + + /* Take ownership of the buffer */ + E1000_WRITE_REG(hw, E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU); + + /* reserve mailbox for vf use */ + p2v_mailbox = E1000_READ_REG(hw, E1000_P2VMAILBOX(vf_number)); + if (p2v_mailbox & E1000_P2VMAILBOX_PFU) + ret_val = E1000_SUCCESS; + + return ret_val; +} + +/** + * e1000_write_mbx_pf - Places a message in the mailbox + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @vf_number: the VF index + * + * returns SUCCESS if it successfully copied message into the buffer + **/ +static s32 e1000_write_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size, + u16 vf_number) +{ + s32 ret_val; + u16 i; + + DEBUGFUNC("e1000_write_mbx_pf"); + + /* lock the mailbox to prevent pf/vf race condition */ + ret_val = e1000_obtain_mbx_lock_pf(hw, vf_number); + if (ret_val) + goto out_no_write; + + /* flush msg and acks as we are overwriting the message buffer */ + e1000_check_for_msg_pf(hw, vf_number); + e1000_check_for_ack_pf(hw, vf_number); + + /* copy the caller specified message to the mailbox memory buffer */ + for (i = 0; i < size; i++) + E1000_WRITE_REG_ARRAY(hw, E1000_VMBMEM(vf_number), i, msg[i]); + + /* Interrupt VF to tell it a message has been sent and release buffer*/ + E1000_WRITE_REG(hw, E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_STS); + + /* update stats */ + hw->mbx.stats.msgs_tx++; + +out_no_write: + return ret_val; + +} + +/** + * e1000_read_mbx_pf - Read a message from the mailbox + * @hw: pointer to the HW structure + * @msg: The message buffer + * @size: Length of buffer + * @vf_number: the VF index + * + * This function copies a message from the mailbox buffer to the caller's + * memory buffer. The presumption is that the caller knows that there was + * a message due to a VF request so no polling for message is needed. + **/ +static s32 e1000_read_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size, + u16 vf_number) +{ + s32 ret_val; + u16 i; + + DEBUGFUNC("e1000_read_mbx_pf"); + + /* lock the mailbox to prevent pf/vf race condition */ + ret_val = e1000_obtain_mbx_lock_pf(hw, vf_number); + if (ret_val) + goto out_no_read; + + /* copy the message to the mailbox memory buffer */ + for (i = 0; i < size; i++) + msg[i] = E1000_READ_REG_ARRAY(hw, E1000_VMBMEM(vf_number), i); + + /* Acknowledge the message and release buffer */ + E1000_WRITE_REG(hw, E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_ACK); + + /* update stats */ + hw->mbx.stats.msgs_rx++; + +out_no_read: + return ret_val; +} + +/** + * e1000_init_mbx_params_pf - set initial values for pf mailbox + * @hw: pointer to the HW structure + * + * Initializes the hw->mbx struct to correct values for pf mailbox + */ +s32 e1000_init_mbx_params_pf(struct e1000_hw *hw) +{ + struct e1000_mbx_info *mbx = &hw->mbx; + + if (hw->mac.type == e1000_82576) { + mbx->timeout = 0; + mbx->usec_delay = 0; + + mbx->size = E1000_VFMAILBOX_SIZE; + + mbx->ops.read = e1000_read_mbx_pf; + mbx->ops.write = e1000_write_mbx_pf; + mbx->ops.read_posted = e1000_read_posted_mbx; + mbx->ops.write_posted = e1000_write_posted_mbx; + mbx->ops.check_for_msg = e1000_check_for_msg_pf; + mbx->ops.check_for_ack = e1000_check_for_ack_pf; + mbx->ops.check_for_rst = e1000_check_for_rst_pf; + + mbx->stats.msgs_tx = 0; + mbx->stats.msgs_rx = 0; + mbx->stats.reqs = 0; + mbx->stats.acks = 0; + mbx->stats.rsts = 0; + } + + return E1000_SUCCESS; +} + Copied: stable/8/sys/dev/e1000/e1000_mbx.h (from r209616, head/sys/dev/e1000/e1000_mbx.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/dev/e1000/e1000_mbx.h Thu Aug 12 20:18:06 2010 (r211241, copy of r209616, head/sys/dev/e1000/e1000_mbx.h) @@ -0,0 +1,106 @@ +/****************************************************************************** + + Copyright (c) 2001-2010, Intel Corporation *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 20:35:14 2010 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 D5EBC1065694; Thu, 12 Aug 2010 20:35:14 +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 C41A18FC12; Thu, 12 Aug 2010 20:35:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CKZEQ6087958; Thu, 12 Aug 2010 20:35:14 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CKZEIk087955; Thu, 12 Aug 2010 20:35:14 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008122035.o7CKZEIk087955@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 12 Aug 2010 20:35: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: r211242 - in head/tools/regression/fstest/tests: rmdir unlink 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, 12 Aug 2010 20:35:14 -0000 Author: pjd Date: Thu Aug 12 20:35:14 2010 New Revision: 211242 URL: http://svn.freebsd.org/changeset/base/211242 Log: More tests. Modified: head/tools/regression/fstest/tests/rmdir/11.t head/tools/regression/fstest/tests/unlink/11.t Modified: head/tools/regression/fstest/tests/rmdir/11.t ============================================================================== --- head/tools/regression/fstest/tests/rmdir/11.t Thu Aug 12 20:18:06 2010 (r211241) +++ head/tools/regression/fstest/tests/rmdir/11.t Thu Aug 12 20:35:14 2010 (r211242) @@ -6,7 +6,7 @@ desc="rmdir returns EACCES or EPERM if t dir=`dirname $0` . ${dir}/../misc.sh -echo "1..15" +echo "1..47" n0=`namegen` n1=`namegen` @@ -22,17 +22,34 @@ expect 0 chmod ${n0} 01777 # User owns both: the sticky directory and the directory to be removed. expect 0 -u 65534 -g 65534 mkdir ${n0}/${n1} 0755 +expect dir,65534,65534 lstat ${n0}/${n1} type,uid,gid expect 0 -u 65534 -g 65534 rmdir ${n0}/${n1} +expect ENOENT lstat ${n0}/${n1} type # User owns the directory to be removed, but doesn't own the sticky directory. -expect 0 -u 65533 -g 65533 mkdir ${n0}/${n1} 0755 -expect 0 -u 65533 -g 65533 rmdir ${n0}/${n1} +for id in 0 65533; do + expect 0 chown ${n0} ${id} ${id} + create_file dir ${n0}/${n1} 65534 65534 + expect dir,65534,65534 lstat ${n0}/${n1} type,uid,gid + expect 0 -u 65534 -g 65534 rmdir ${n0}/${n1} + expect ENOENT lstat ${n0}/${n1} type +done # User owns the sticky directory, but doesn't own the directory to be removed. -expect 0 -u 65533 -g 65533 mkdir ${n0}/${n1} 0755 -expect 0 -u 65534 -g 65534 rmdir ${n0}/${n1} +expect 0 chown ${n0} 65534 65534 +for id in 0 65533; do + create_file dir ${n0}/${n1} ${id} ${id} + expect dir,${id},${id} lstat ${n0}/${n1} type,uid,gid + expect 0 -u 65534 -g 65534 rmdir ${n0}/${n1} + expect ENOENT lstat ${n0}/${n1} type +done # User doesn't own the sticky directory nor the directory to be removed. -expect 0 -u 65534 -g 65534 mkdir ${n0}/${n1} 0755 -expect "EACCES|EPERM" -u 65533 -g 65533 rmdir ${n0}/${n1} -expect 0 rmdir ${n0}/${n1} +for id in 0 65533; do + expect 0 chown ${n0} ${id} ${id} + create_file dir ${n0}/${n1} ${id} ${id} + expect dir,${id},${id} lstat ${n0}/${n1} type,uid,gid + expect "EACCES|EPERM" -u 65534 -g 65534 rmdir ${n0}/${n1} + expect dir,${id},${id} lstat ${n0}/${n1} type,uid,gid + expect 0 rmdir ${n0}/${n1} +done expect 0 rmdir ${n0} Modified: head/tools/regression/fstest/tests/unlink/11.t ============================================================================== --- head/tools/regression/fstest/tests/unlink/11.t Thu Aug 12 20:18:06 2010 (r211241) +++ head/tools/regression/fstest/tests/unlink/11.t Thu Aug 12 20:35:14 2010 (r211242) @@ -6,7 +6,7 @@ desc="unlink returns EACCES or EPERM if dir=`dirname $0` . ${dir}/../misc.sh -echo "1..68" +echo "1..270" n0=`namegen` n1=`namegen` @@ -17,100 +17,45 @@ cdir=`pwd` cd ${n2} expect 0 mkdir ${n0} 0755 -expect 0 chown ${n0} 65534 65534 expect 0 chmod ${n0} 01777 +expect 0 chown ${n0} 65534 65534 -# User owns both: the sticky directory and the file to be removed. -expect 0 -u 65534 -g 65534 create ${n0}/${n1} 0644 -expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} -# User owns the file to be removed, but doesn't own the sticky directory. -expect 0 -u 65533 -g 65533 create ${n0}/${n1} 0644 -expect 0 -u 65533 -g 65533 unlink ${n0}/${n1} -# User owns the sticky directory, but doesn't own the file to be removed. -expect 0 -u 65533 -g 65533 create ${n0}/${n1} 0644 -expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} -# User doesn't own the sticky directory nor the file to be removed. -expect 0 -u 65534 -g 65534 create ${n0}/${n1} 0644 -expect "EACCES|EPERM" -u 65533 -g 65533 unlink ${n0}/${n1} -expect 0 unlink ${n0}/${n1} - -# User owns both: the sticky directory and the fifo to be removed. -expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n1} 0644 -expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} -# User owns the fifo to be removed, but doesn't own the sticky directory. -expect 0 -u 65533 -g 65533 mkfifo ${n0}/${n1} 0644 -expect 0 -u 65533 -g 65533 unlink ${n0}/${n1} -# User owns the sticky directory, but doesn't own the fifo to be removed. -expect 0 -u 65533 -g 65533 mkfifo ${n0}/${n1} 0644 -expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} -# User doesn't own the sticky directory nor the fifo to be removed. -expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n1} 0644 -expect "EACCES|EPERM" -u 65533 -g 65533 unlink ${n0}/${n1} -expect 0 unlink ${n0}/${n1} - -# User owns both: the sticky directory and the block device to be removed. -expect 0 mknod ${n0}/${n1} b 0644 1 2 -expect 0 chown ${n0}/${n1} 65534 65534 -expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} -# User owns the block device to be removed, but doesn't own the sticky directory. -expect 0 mknod ${n0}/${n1} b 0644 1 2 -expect 0 chown ${n0}/${n1} 65533 65533 -expect 0 -u 65533 -g 65533 unlink ${n0}/${n1} -# User owns the sticky directory, but doesn't own the block device to be removed. -expect 0 mknod ${n0}/${n1} b 0644 1 2 -expect 0 chown ${n0}/${n1} 65533 65533 -expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} -# User doesn't own the sticky directory nor the block directory to be removed. -expect 0 mknod ${n0}/${n1} b 0644 1 2 -expect 0 chown ${n0}/${n1} 65534 65534 -expect "EACCES|EPERM" -u 65533 -g 65533 unlink ${n0}/${n1} -expect 0 unlink ${n0}/${n1} - -# User owns both: the sticky directory and the character device to be removed. -expect 0 mknod ${n0}/${n1} c 0644 1 2 -expect 0 chown ${n0}/${n1} 65534 65534 -expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} -# User owns the character device to be removed, but doesn't own the sticky directory. -expect 0 mknod ${n0}/${n1} c 0644 1 2 -expect 0 chown ${n0}/${n1} 65533 65533 -expect 0 -u 65533 -g 65533 unlink ${n0}/${n1} -# User owns the sticky directory, but doesn't own the character device to be removed. -expect 0 mknod ${n0}/${n1} c 0644 1 2 -expect 0 chown ${n0}/${n1} 65533 65533 -expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} -# User doesn't own the sticky directory nor the character directory to be removed. -expect 0 mknod ${n0}/${n1} c 0644 1 2 -expect 0 chown ${n0}/${n1} 65534 65534 -expect "EACCES|EPERM" -u 65533 -g 65533 unlink ${n0}/${n1} -expect 0 unlink ${n0}/${n1} - -# User owns both: the sticky directory and the socket to be removed. -expect 0 -u 65534 -g 65534 bind ${n0}/${n1} -expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} -# User owns the socket to be removed, but doesn't own the sticky directory. -expect 0 -u 65533 -g 65533 bind ${n0}/${n1} -expect 0 -u 65533 -g 65533 unlink ${n0}/${n1} -# User owns the sticky directory, but doesn't own the socket to be removed. -expect 0 -u 65533 -g 65533 bind ${n0}/${n1} -expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} -# User doesn't own the sticky directory nor the character directory to be removed. -expect 0 -u 65534 -g 65534 bind ${n0}/${n1} -expect "EACCES|EPERM" -u 65533 -g 65533 unlink ${n0}/${n1} -expect 0 unlink ${n0}/${n1} - -# User owns both: the sticky directory and the symlink to be removed. -expect 0 -u 65534 -g 65534 symlink test ${n0}/${n1} -expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} -# User owns the symlink to be removed, but doesn't own the sticky directory. -expect 0 -u 65533 -g 65533 symlink test ${n0}/${n1} -expect 0 -u 65533 -g 65533 unlink ${n0}/${n1} -# User owns the sticky directory, but doesn't own the symlink to be removed. -expect 0 -u 65533 -g 65533 symlink test ${n0}/${n1} -expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} -# User doesn't own the sticky directory nor the symlink to be removed. -expect 0 -u 65534 -g 65534 symlink test ${n0}/${n1} -expect "EACCES|EPERM" -u 65533 -g 65533 unlink ${n0}/${n1} -expect 0 unlink ${n0}/${n1} +for type in regular fifo block char socket symlink; do + # User owns both: the sticky directory and the file. + expect 0 chown ${n0} 65534 65534 + create_file ${type} ${n0}/${n1} 65534 65534 + expect ${type},65534,65534 lstat ${n0}/${n1} type,uid,gid + expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} + expect ENOENT lstat ${n0}/${n1} type + + # User owns the sticky directory, but doesn't own the file. + for id in 0 65533; do + expect 0 chown ${n0} 65534 65534 + create_file ${type} ${n0}/${n1} ${id} ${id} + expect ${type},${id},${id} lstat ${n0}/${n1} type,uid,gid + expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} + expect ENOENT lstat ${n0}/${n1} type + done + + # User owns the file, but doesn't own the sticky directory. + for id in 0 65533; do + expect 0 chown ${n0} ${id} ${id} + create_file ${type} ${n0}/${n1} 65534 65534 + expect ${type},65534,65534 lstat ${n0}/${n1} type,uid,gid + expect 0 -u 65534 -g 65534 unlink ${n0}/${n1} + expect ENOENT lstat ${n0}/${n1} type + done + + # User doesn't own the sticky directory nor the file. + for id in 0 65533; do + expect 0 chown ${n0} ${id} ${id} + create_file ${type} ${n0}/${n1} ${id} ${id} + expect ${type},${id},${id} lstat ${n0}/${n1} type,uid,gid + expect "EACCES|EPERM" -u 65534 -g 65534 unlink ${n0}/${n1} + expect ${type},${id},${id} lstat ${n0}/${n1} type,uid,gid + expect 0 unlink ${n0}/${n1} + done +done expect 0 rmdir ${n0} From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 20:46:49 2010 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 C734B106564A; Thu, 12 Aug 2010 20:46:49 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE7278FC1C; Thu, 12 Aug 2010 20:46:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CKknhO090516; Thu, 12 Aug 2010 20:46:49 GMT (envelope-from will@svn.freebsd.org) Received: (from will@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CKknNa090508; Thu, 12 Aug 2010 20:46:49 GMT (envelope-from will@svn.freebsd.org) Message-Id: <201008122046.o7CKknNa090508@svn.freebsd.org> From: Will Andrews Date: Thu, 12 Aug 2010 20:46: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: r211243 - in head: gnu/lib/libreadline/history gnu/lib/libreadline/readline/doc gnu/usr.bin/cvs/contrib gnu/usr.bin/gdb/doc lib/libexpat secure/lib/libcrypto 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: Thu, 12 Aug 2010 20:46:49 -0000 Author: will Date: Thu Aug 12 20:46:49 2010 New Revision: 211243 URL: http://svn.freebsd.org/changeset/base/211243 Log: Fix buildworld -DNO_CLEAN when using with Perforce, which marks files as read-only by default, meaning files copied can't be overwritten next time. Reviewed by: imp Approved by: ken (mentor) Modified: head/gnu/lib/libreadline/history/Makefile head/gnu/lib/libreadline/readline/doc/Makefile head/gnu/usr.bin/cvs/contrib/Makefile head/gnu/usr.bin/gdb/doc/Makefile head/lib/libexpat/Makefile head/secure/lib/libcrypto/Makefile head/share/mk/sys.mk Modified: head/gnu/lib/libreadline/history/Makefile ============================================================================== --- head/gnu/lib/libreadline/history/Makefile Thu Aug 12 20:35:14 2010 (r211242) +++ head/gnu/lib/libreadline/history/Makefile Thu Aug 12 20:46:49 2010 (r211243) @@ -8,7 +8,7 @@ MAN= rlhistory.3 SRCS= $(HISTSRC) xmalloc.c rlhistory.3: doc/history.3 - cp ${.ALLSRC} ${.TARGET} + cp -f ${.ALLSRC} ${.TARGET} CLEANFILES+= rlhistory.3 Modified: head/gnu/lib/libreadline/readline/doc/Makefile ============================================================================== --- head/gnu/lib/libreadline/readline/doc/Makefile Thu Aug 12 20:35:14 2010 (r211242) +++ head/gnu/lib/libreadline/readline/doc/Makefile Thu Aug 12 20:46:49 2010 (r211243) @@ -13,7 +13,7 @@ CLEANFILES += readline.texi readline.info: rlman.texi rluser.texi rltech.texi version.texi fdl.texi readline.texi: rlman.texi - cp ${SRCDIR}/rlman.texi ${.TARGET} + cp -f ${SRCDIR}/rlman.texi ${.TARGET} rluserman.info: rluserman.texi version.texi rluser.texi fdl.texi Modified: head/gnu/usr.bin/cvs/contrib/Makefile ============================================================================== --- head/gnu/usr.bin/cvs/contrib/Makefile Thu Aug 12 20:35:14 2010 (r211242) +++ head/gnu/usr.bin/cvs/contrib/Makefile Thu Aug 12 20:46:49 2010 (r211243) @@ -24,7 +24,7 @@ Makefile: @: .sh: - cp ${.IMPSRC} ${.TARGET} + cp -f ${.IMPSRC} ${.TARGET} .pl: sed -e 's,xPERL_PATHx,$(PERLPATH),' ${.IMPSRC} > ${.TARGET} Modified: head/gnu/usr.bin/gdb/doc/Makefile ============================================================================== --- head/gnu/usr.bin/gdb/doc/Makefile Thu Aug 12 20:35:14 2010 (r211242) +++ head/gnu/usr.bin/gdb/doc/Makefile Thu Aug 12 20:46:49 2010 (r211243) @@ -20,11 +20,11 @@ GDBvn.texi: version.in echo "@set GDBVN `sed q ${.ALLSRC}`" > ${.TARGET} inc-hist.texinfo: hsuser.texi inc-hist.diff - cp ${.ALLSRC:M*.texi} ${.TARGET} + cp -f ${.ALLSRC:M*.texi} ${.TARGET} patch < ${.ALLSRC:M*.diff} rluser.texinfo: rluser.texi - cp ${.ALLSRC:M*.texi} ${.TARGET} + cp -f ${.ALLSRC:M*.texi} ${.TARGET} CLEANFILES= gdb-cfg.texi GDBvn.texi inc-hist.texinfo inc-hist.texinfo.orig \ rluser.texinfo Modified: head/lib/libexpat/Makefile ============================================================================== --- head/lib/libexpat/Makefile Thu Aug 12 20:35:14 2010 (r211242) +++ head/lib/libexpat/Makefile Thu Aug 12 20:46:49 2010 (r211243) @@ -30,6 +30,6 @@ bsdxml.h: expat.h > ${.TARGET} bsdxml_external.h: expat_external.h - cp ${.ALLSRC} ${.TARGET} + cp -f ${.ALLSRC} ${.TARGET} .include Modified: head/secure/lib/libcrypto/Makefile ============================================================================== --- head/secure/lib/libcrypto/Makefile Thu Aug 12 20:35:14 2010 (r211242) +++ head/secure/lib/libcrypto/Makefile Thu Aug 12 20:46:49 2010 (r211243) @@ -355,13 +355,13 @@ buildinf.h: ${.CURDIR}/Makefile echo "#endif" ) > ${.TARGET} opensslconf.h: opensslconf-${MACHINE_ARCH}.h - cp ${.ALLSRC} ${.TARGET} + cp -f ${.ALLSRC} ${.TARGET} evp.h: ${LCRYPTO_SRC}/crypto/evp/evp.h .if ${MK_IDEA} == "no" sed '/^#ifndef OPENSSL_NO_IDEA$$/,/^#endif$$/d' ${.ALLSRC} > ${.TARGET} .else - cp ${.ALLSRC} ${.TARGET} + cp -f ${.ALLSRC} ${.TARGET} .endif # No FIPS support for now Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Thu Aug 12 20:35:14 2010 (r211242) +++ head/share/mk/sys.mk Thu Aug 12 20:46:49 2010 (r211243) @@ -167,7 +167,7 @@ YFLAGS ?= -d ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}) .sh: - cp ${.IMPSRC} ${.TARGET} + cp -f ${.IMPSRC} ${.TARGET} chmod a+x ${.TARGET} # DOUBLE SUFFIX RULES @@ -225,7 +225,7 @@ YFLAGS ?= -d # non-Posix rule set .sh: - cp -p ${.IMPSRC} ${.TARGET} + cp -fp ${.IMPSRC} ${.TARGET} chmod a+x ${.TARGET} .c.ln: From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 21:10:15 2010 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 EDC5A1065697; Thu, 12 Aug 2010 21:10:15 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello089077043238.chello.pl [89.77.43.238]) by mx1.freebsd.org (Postfix) with ESMTP id 762158FC16; Thu, 12 Aug 2010 21:10:15 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id AC8B345E8E; Thu, 12 Aug 2010 23:10:13 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 891DA45C9B; Thu, 12 Aug 2010 23:10:08 +0200 (CEST) Date: Thu, 12 Aug 2010 23:09:56 +0200 From: Pawel Jakub Dawidek To: Takanori Watanabe Message-ID: <20100812210956.GA2006@garage.freebsd.pl> References: <201008120016.o7C0GI2t014914@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/04w6evG8XlLl3ft" Content-Disposition: inline In-Reply-To: <201008120016.o7C0GI2t014914@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211201 - in head: share/man/man4 sys/conf sys/dev/tpm sys/modules sys/modules/tpm 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, 12 Aug 2010 21:10:16 -0000 --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 12, 2010 at 12:16:18AM +0000, Takanori Watanabe wrote: > Author: takawata > Date: Thu Aug 12 00:16:18 2010 > New Revision: 211201 > URL: http://svn.freebsd.org/changeset/base/211201 >=20 > Log: > Add tpm(4) driver for Trusted Platform Module. > You may want to look at http://bsssd.sourceforge.net/ . > =20 > Submitted by: Hans-Joerg Hoexer Yay! PS. Any reason manual page is not enabled in man4/Makefile? --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --/04w6evG8XlLl3ft Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkxkYyMACgkQForvXbEpPzQ2egCfWOmTjxMBxc8We65gg416BX5e gMgAn275LafDHYHatl48gPvgXf6EOsEr =DSvd -----END PGP SIGNATURE----- --/04w6evG8XlLl3ft-- From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 21:21:51 2010 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 411CF106566B; Thu, 12 Aug 2010 21:21:51 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1628D8FC19; Thu, 12 Aug 2010 21:21:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CLLol8098265; Thu, 12 Aug 2010 21:21:50 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CLLoUO098263; Thu, 12 Aug 2010 21:21:50 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <201008122121.o7CLLoUO098263@svn.freebsd.org> From: Ivan Voras Date: Thu, 12 Aug 2010 21:21: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: r211244 - head/share/man/man7 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, 12 Aug 2010 21:21:51 -0000 Author: ivoras Date: Thu Aug 12 21:21:50 2010 New Revision: 211244 URL: http://svn.freebsd.org/changeset/base/211244 Log: Describe vfs.read_max and update vfs.hirunningspace documentation. While there, update nits. Considered viewed by: jeff, phk, rwatson Modified: head/share/man/man7/tuning.7 Modified: head/share/man/man7/tuning.7 ============================================================================== --- head/share/man/man7/tuning.7 Thu Aug 12 20:46:49 2010 (r211243) +++ head/share/man/man7/tuning.7 Thu Aug 12 21:21:50 2010 (r211244) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 23, 2009 +.Dd August 11, 2010 .Dt TUNING 7 .Os .Sh NAME @@ -470,7 +470,7 @@ sysctl defaults to 1 (on). This parameter controls how directories are cached by the system. Most directories are small and use but a single fragment -(typically 1K) in the file system and even less (typically 512 bytes) in +(typically 2K) in the file system and even less (typically 512 bytes) in the buffer cache. However, when operating in the default mode the buffer cache will only cache a fixed number of directories even if you have a huge @@ -504,17 +504,35 @@ it off. The .Va vfs.hirunningspace sysctl determines how much outstanding write I/O may be queued to -disk controllers system-wide at any given instance. -The default is -usually sufficient but on machines with lots of disks you may want to bump -it up to four or five megabytes. +disk controllers system-wide at any given time. +It is used by the UFS file system. +The default is self-tuned and +usually sufficient but on machines with advanced controllers and lots +of disks this may be tuned up to match what the controllers buffer. +Configuring this setting to match tagged queuing capabilities of +controllers or drives with average IO size used in production works +best (for example: 16 MiB will use 128 tags with IO requests of 128 KiB). Note that setting too high a value (exceeding the buffer cache's write threshold) can lead to extremely bad clustering performance. Do not set this value arbitrarily high! -Also, -higher write queueing values may add latency to reads occurring at the same -time. +Higher write queueing values may also add latency to reads occurring at +the same time. +.Pp +The +.Va vfs.read_max +sysctl governs VFS read-ahead and is expressed as the number of blocks +to pre-read if the heuristics algorithm decides that the reads are +issued sequentially. +It is used by the UFS, ext2fs and msdosfs file systems. +With the default UFS block size of 16 KiB, a setting of 32 will allow +speculatively reading up to 512 KiB. +This setting may be increased to get around disk I/O latencies, especially +where these latencies are large such as in virtual machine emulated +environments. +It may be tuned down in specific cases where the I/O load is such that +read-ahead adversely affects performance or where system memory is really +low. .Pp There are various other buffer-cache and VM page cache related sysctls. We do not recommend modifying these values. From owner-svn-src-all@FreeBSD.ORG Thu Aug 12 22:46:31 2010 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 DE28410656A3; Thu, 12 Aug 2010 22:46:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CDC4D8FC1D; Thu, 12 Aug 2010 22:46:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CMkVhd017343; Thu, 12 Aug 2010 22:46:31 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CMkVrE017341; Thu, 12 Aug 2010 22:46:31 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201008122246.o7CMkVrE017341@svn.freebsd.org> From: Warner Losh Date: Thu, 12 Aug 2010 22:46: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: r211249 - head/sys/modules 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, 12 Aug 2010 22:46:32 -0000 Author: imp Date: Thu Aug 12 22:46:31 2010 New Revision: 211249 URL: http://svn.freebsd.org/changeset/base/211249 Log: This depends on ACPI, so only build on i386:i386, amd64:amd64 and ia64:ia64. It can't possibly work on pc98, or any of the embedded platforms, since they lack ACPI. Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Thu Aug 12 22:25:16 2010 (r211248) +++ head/sys/modules/Makefile Thu Aug 12 22:46:31 2010 (r211249) @@ -283,7 +283,7 @@ SUBDIR= ${_3dfx} \ ti \ tl \ tmpfs \ - tpm \ + ${_tpm} \ trm \ ${_twa} \ twe \ @@ -481,6 +481,7 @@ _nfe= nfe _nve= nve _nvram= nvram _nxge= nxge +_tpm= tpm _wpi= wpi _wpifw= wpifw .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) @@ -576,6 +577,7 @@ _sound= sound _speaker= speaker _splash= splash _sppp= sppp +_tpm= tpm _twa= twa _vesa= vesa _x86bios= x86bios @@ -620,6 +622,7 @@ _sound= sound _splash= splash _sppp= sppp _streams= streams +_tpm= tpm _twa= twa _wi= wi _xe= xe From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 00:45:30 2010 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 763BC1065693; Fri, 13 Aug 2010 00:45:30 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 655E38FC0A; Fri, 13 Aug 2010 00:45:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D0jUrd043603; Fri, 13 Aug 2010 00:45:30 GMT (envelope-from takawata@svn.freebsd.org) Received: (from takawata@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D0jUW6043601; Fri, 13 Aug 2010 00:45:30 GMT (envelope-from takawata@svn.freebsd.org) Message-Id: <201008130045.o7D0jUW6043601@svn.freebsd.org> From: Takanori Watanabe Date: Fri, 13 Aug 2010 00:45: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: r211252 - head/usr.sbin/acpi/acpidump 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, 13 Aug 2010 00:45:30 -0000 Author: takawata Date: Fri Aug 13 00:45:30 2010 New Revision: 211252 URL: http://svn.freebsd.org/changeset/base/211252 Log: Fix build on amd64 and ia64. Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Fri Aug 13 00:21:32 2010 (r211251) +++ head/usr.sbin/acpi/acpidump/acpi.c Fri Aug 13 00:45:30 2010 (r211252) @@ -40,7 +40,6 @@ #include #include #include -#include #include "acpidump.h" @@ -623,7 +622,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) { struct TCPAbody *tcpa; struct TCPAevent *event; - u_int64_t len, paddr; + uint64_t len, paddr; unsigned char *vaddr = NULL; unsigned char *vend = NULL; @@ -647,7 +646,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) printf(END_COMMENT); return; } - printf("\tClass %d Base Address 0x%jx Length %" PRIu64 "\n\n", + printf("\tClass %u Base Address 0x%jx Length %ju\n\n", tcpa->platform_class, paddr, len); if (len == 0) { @@ -662,7 +661,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) while (vaddr != NULL) { if (vaddr + sizeof(struct TCPAevent) >= vend) break; - event = (struct TCPAevent *)vaddr; + event = (struct TCPAevent *)(void *)vaddr; if (vaddr + event->event_size >= vend) break; if (event->event_type == 0 && event->event_size == 0) From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 01:10:43 2010 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 8ED971065670; Fri, 13 Aug 2010 01:10:43 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id C086D8FC1D; Fri, 13 Aug 2010 01:10:42 +0000 (UTC) Received: by ewy26 with SMTP id 26so1215063ewy.13 for ; Thu, 12 Aug 2010 18:10:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=iZaufVm/yS5rUlzmMXGWuzccRtAHjW+7VhUB30SDIAI=; b=u7dp+vY6UwpHxlerJEdfCRVjTqOM321Le7p6X9Xr835htO32DtW5NTEzJPcbA8d4m2 irtHloLNiedSMpdNEpDGJ0IXABqS/f9rzZstRYuOX7UqpZEJzK4JnWI6Z1h2T1oRtYXu sf/fJXz1yLBQdbLEw244lw6lLwXt2v0adSB9c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=J2e+7YhdS++JuD+PgvJdv4H5VjM6DWzv/8TmrLzcWQE+kWkxm/ZlTdASZJJIRnVa9U vy5jotFcpiyP2YpvuIDSklqjPA87Rvr2S3yMyiJy54vSAjgpCHsjvqueApwrJdM2Vczz jFz9JSViL/FXiUYXHMMAwD21BvXBu8wCGF5GA= MIME-Version: 1.0 Received: by 10.213.8.200 with SMTP id i8mr1096654ebi.18.1281661841499; Thu, 12 Aug 2010 18:10:41 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.213.112.140 with HTTP; Thu, 12 Aug 2010 18:10:41 -0700 (PDT) In-Reply-To: <201008121416.o7CEGvEl002947@svn.freebsd.org> References: <201008121416.o7CEGvEl002947@svn.freebsd.org> Date: Fri, 13 Aug 2010 09:10:41 +0800 X-Google-Sender-Auth: 644Azry8PI1RQNszxrxNKsKQxTQ Message-ID: From: Adrian Chadd To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r211222 - head/usr.sbin/crunch/crunchide 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, 13 Aug 2010 01:10:43 -0000 On 12 August 2010 22:16, Adrian Chadd wrote: > =A0I used the wrong type when setting st_name in the symbol table entry > =A0struct. It's an Elf64_Word which is defined as an unsigned 32 bit int > =A0on both 32 and 64 bit platforms. > > =A0To make things sensible, define some new macros to use as "word" macro= s > =A0and use those, rather than simply using the explicit 32 bit macros. .. and I haven't gone over the source with a fine tooth comb to substitute the "right" macros everywhere. It's possible things are still not "correct" but work fine. Adrian From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 04:00:35 2010 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 944991065674; Fri, 13 Aug 2010 04:00:35 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 839F78FC18; Fri, 13 Aug 2010 04:00:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D40ZwD087389; Fri, 13 Aug 2010 04:00:35 GMT (envelope-from takawata@svn.freebsd.org) Received: (from takawata@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D40ZWp087387; Fri, 13 Aug 2010 04:00:35 GMT (envelope-from takawata@svn.freebsd.org) Message-Id: <201008130400.o7D40ZWp087387@svn.freebsd.org> From: Takanori Watanabe Date: Fri, 13 Aug 2010 04:00: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: r211270 - head/sys/modules/tpm 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, 13 Aug 2010 04:00:35 -0000 Author: takawata Date: Fri Aug 13 04:00:35 2010 New Revision: 211270 URL: http://svn.freebsd.org/changeset/base/211270 Log: Hook tpm.4 manual to build. Modified: head/sys/modules/tpm/Makefile Modified: head/sys/modules/tpm/Makefile ============================================================================== --- head/sys/modules/tpm/Makefile Fri Aug 13 03:17:33 2010 (r211269) +++ head/sys/modules/tpm/Makefile Fri Aug 13 04:00:35 2010 (r211270) @@ -3,7 +3,9 @@ .PATH: ${.CURDIR}/../../dev/tpm KMOD= tpm -SRCS= tpm.c tpm_isa.c tpm_acpi.c isa_if.h opt_acpi.h acpi_if.h \ - bus_if.h device_if.h + +SRCS= tpm.c bus_if.h device_if.h +#Bus specific stuff. +SRCS+= tpm_isa.c tpm_acpi.c isa_if.h opt_acpi.h acpi_if.h .include From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 04:06:41 2010 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 08DC61065697 for ; Fri, 13 Aug 2010 04:06:41 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 8B3378FC17 for ; Fri, 13 Aug 2010 04:06:40 +0000 (UTC) Received: (qmail 12066 invoked by uid 399); 13 Aug 2010 04:06:39 -0000 Received: from localhost (HELO lap.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 13 Aug 2010 04:06:39 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4C64C4CD.9030408@FreeBSD.org> Date: Thu, 12 Aug 2010 21:06:37 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.8) Gecko/20100807 Thunderbird/3.1.2 MIME-Version: 1.0 To: Takanori Watanabe References: <201008130400.o7D40ZWp087387@svn.freebsd.org> In-Reply-To: <201008130400.o7D40ZWp087387@svn.freebsd.org> X-Enigmail-Version: 1.1.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211270 - head/sys/modules/tpm 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, 13 Aug 2010 04:06:41 -0000 This commit seems to accomplish something totally different than your commit message indicates. Doug On 08/12/2010 21:00, Takanori Watanabe wrote: > Author: takawata > Date: Fri Aug 13 04:00:35 2010 > New Revision: 211270 > URL: http://svn.freebsd.org/changeset/base/211270 > > Log: > Hook tpm.4 manual to build. > > Modified: > head/sys/modules/tpm/Makefile > > Modified: head/sys/modules/tpm/Makefile > ============================================================================== > --- head/sys/modules/tpm/Makefile Fri Aug 13 03:17:33 2010 (r211269) > +++ head/sys/modules/tpm/Makefile Fri Aug 13 04:00:35 2010 (r211270) > @@ -3,7 +3,9 @@ > .PATH: ${.CURDIR}/../../dev/tpm > > KMOD= tpm > -SRCS= tpm.c tpm_isa.c tpm_acpi.c isa_if.h opt_acpi.h acpi_if.h \ > - bus_if.h device_if.h > + > +SRCS= tpm.c bus_if.h device_if.h > +#Bus specific stuff. > +SRCS+= tpm_isa.c tpm_acpi.c isa_if.h opt_acpi.h acpi_if.h > > .include > -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ Computers are useless. They can only give you answers. -- Pablo Picasso From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 05:01:44 2010 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 8CF90106566C; Fri, 13 Aug 2010 05:01:44 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B2DD8FC0C; Fri, 13 Aug 2010 05:01:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D51ic1000989; Fri, 13 Aug 2010 05:01:44 GMT (envelope-from takawata@svn.freebsd.org) Received: (from takawata@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D51iZ6000987; Fri, 13 Aug 2010 05:01:44 GMT (envelope-from takawata@svn.freebsd.org) Message-Id: <201008130501.o7D51iZ6000987@svn.freebsd.org> From: Takanori Watanabe Date: Fri, 13 Aug 2010 05:01: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: r211271 - 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: Fri, 13 Aug 2010 05:01:44 -0000 Author: takawata Date: Fri Aug 13 05:01:44 2010 New Revision: 211271 URL: http://svn.freebsd.org/changeset/base/211271 Log: Hook tpm.4 manual to hook. Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Fri Aug 13 04:00:35 2010 (r211270) +++ head/share/man/man4/Makefile Fri Aug 13 05:01:44 2010 (r211271) @@ -419,6 +419,7 @@ MAN= aac.4 \ ti.4 \ tl.4 \ tnt4882.4 \ + ${_tpm.4} \ trm.4 \ tty.4 \ tun.4 \ @@ -670,6 +671,7 @@ _padlock.4= padlock.4 _rr232x.4= rr232x.4 _speaker.4= speaker.4 _spkr.4= spkr.4 +_tpm.4= tpm.4 _urtw.4= urtw.4 _wpi.4= wpi.4 From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 05:06:27 2010 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 A89751065672; Fri, 13 Aug 2010 05:06:27 +0000 (UTC) (envelope-from takawata@init-main.com) Received: from sana.init-main.com (unknown [IPv6:2001:240:28::1]) by mx1.freebsd.org (Postfix) with ESMTP id 4695B8FC17; Fri, 13 Aug 2010 05:06:27 +0000 (UTC) Received: from ns.init-main.com (localhost [127.0.0.1]) by sana.init-main.com (8.14.3/8.14.3) with ESMTP id o7D52WYa000621; Fri, 13 Aug 2010 14:02:33 +0900 (JST) (envelope-from takawata@ns.init-main.com) Message-Id: <201008130502.o7D52WYa000621@sana.init-main.com> To: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org In-reply-to: Your message of "Fri, 13 Aug 2010 04:00:35 GMT." <201008130400.o7D40ZWp087387@svn.freebsd.org> Date: Fri, 13 Aug 2010 14:02:32 +0900 From: Takanori Watanabe Cc: Subject: Re: svn commit: r211270 - head/sys/modules/tpm 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, 13 Aug 2010 05:06:27 -0000 In message <201008130400.o7D40ZWp087387@svn.freebsd.org>, Takanori Watanabe : >Author: takawata >Date: Fri Aug 13 04:00:35 2010 >New Revision: 211270 >URL: http://svn.freebsd.org/changeset/base/211270 > >Log: > Hook tpm.4 manual to build. > Wrong directory. Real change was committed separately. This is cosmetic change to separate core and bus frontend, because I heard some embedded platform also uses TPM. From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 06:39:54 2010 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 8D32D106566C; Fri, 13 Aug 2010 06:39:54 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7919F8FC08; Fri, 13 Aug 2010 06:39:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D6dsYr022791; Fri, 13 Aug 2010 06:39:54 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D6dsk1022779; Fri, 13 Aug 2010 06:39:54 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201008130639.o7D6dsk1022779@svn.freebsd.org> From: Hajimu UMEMOTO Date: Fri, 13 Aug 2010 06:39: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: r211276 - head/lib/libc/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, 13 Aug 2010 06:39:54 -0000 Author: ume Date: Fri Aug 13 06:39:54 2010 New Revision: 211276 URL: http://svn.freebsd.org/changeset/base/211276 Log: - When there is no room for returning the result, nss backend have to return ERANGE and terminate with NS_RETURN. - When gethostbyname_r(3) and the friends end with an error, set errno to the value nss backend returns, and return errno value. PR: kern/131623 MFC after: 2 weeks Modified: head/lib/libc/net/gethostbydns.c head/lib/libc/net/gethostbyht.c head/lib/libc/net/gethostbynis.c head/lib/libc/net/gethostnamadr.c head/lib/libc/net/getnetbydns.c head/lib/libc/net/getnetbyht.c head/lib/libc/net/getnetbynis.c head/lib/libc/net/getnetnamadr.c head/lib/libc/net/getproto.c head/lib/libc/net/getprotoent.c head/lib/libc/net/getprotoname.c Modified: head/lib/libc/net/gethostbydns.c ============================================================================== --- head/lib/libc/net/gethostbydns.c Fri Aug 13 06:03:54 2010 (r211275) +++ head/lib/libc/net/gethostbydns.c Fri Aug 13 06:39:54 2010 (r211276) @@ -536,9 +536,12 @@ _dns_gethostbyname(void *rval, void *cb_ return (NS_NOTFOUND); } if (__copy_hostent(&he, hptr, buffer, buflen) != 0) { + *errnop = errno; + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + return (NS_RETURN); } + RES_SET_H_ERRNO(statp, NETDB_SUCCESS); *((struct hostent **)rval) = hptr; return (NS_SUCCESS); } @@ -683,11 +686,13 @@ _dns_gethostbyaddr(void *rval, void *cb_ he.h_addrtype = AF_INET6; he.h_length = NS_IN6ADDRSZ; } - RES_SET_H_ERRNO(statp, NETDB_SUCCESS); if (__copy_hostent(&he, hptr, buffer, buflen) != 0) { + *errnop = errno; + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + return (NS_RETURN); } + RES_SET_H_ERRNO(statp, NETDB_SUCCESS); *((struct hostent **)rval) = hptr; return (NS_SUCCESS); } Modified: head/lib/libc/net/gethostbyht.c ============================================================================== --- head/lib/libc/net/gethostbyht.c Fri Aug 13 06:03:54 2010 (r211275) +++ head/lib/libc/net/gethostbyht.c Fri Aug 13 06:39:54 2010 (r211276) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -192,8 +193,11 @@ gethostent_r(struct hostent *hptr, char } if (gethostent_p(&he, hed, statp->options & RES_USE_INET6, statp) != 0) return (-1); - if (__copy_hostent(&he, hptr, buffer, buflen) != 0) - return (-1); + if (__copy_hostent(&he, hptr, buffer, buflen) != 0) { + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); + *h_errnop = statp->res_h_errno; + return ((errno != 0) ? errno : -1); + } *result = hptr; return (0); } @@ -268,8 +272,10 @@ found: return (NS_NOTFOUND); } if (__copy_hostent(&he, hptr, buffer, buflen) != 0) { + *errnop = errno; + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + return (NS_RETURN); } *((struct hostent **)rval) = hptr; return (NS_SUCCESS); @@ -323,8 +329,10 @@ _ht_gethostbyaddr(void *rval, void *cb_d if (error != 0) return (NS_NOTFOUND); if (__copy_hostent(&he, hptr, buffer, buflen) != 0) { + *errnop = errno; + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + return (NS_RETURN); } *((struct hostent **)rval) = hptr; return (NS_SUCCESS); Modified: head/lib/libc/net/gethostbynis.c ============================================================================== --- head/lib/libc/net/gethostbynis.c Fri Aug 13 06:03:54 2010 (r211275) +++ head/lib/libc/net/gethostbynis.c Fri Aug 13 06:39:54 2010 (r211276) @@ -288,8 +288,10 @@ _nis_gethostbyname(void *rval, void *cb_ return (NS_NOTFOUND); } if (__copy_hostent(&he, hptr, buffer, buflen) != 0) { + *errnop = errno; + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + return (NS_RETURN); } *((struct hostent **)rval) = hptr; return (NS_SUCCESS); @@ -336,8 +338,10 @@ _nis_gethostbyaddr(void *rval, void *cb_ return (NS_NOTFOUND); } if (__copy_hostent(&he, hptr, buffer, buflen) != 0) { + *errnop = errno; + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + return (NS_RETURN); } *((struct hostent **)rval) = hptr; return (NS_SUCCESS); Modified: head/lib/libc/net/gethostnamadr.c ============================================================================== --- head/lib/libc/net/gethostnamadr.c Fri Aug 13 06:03:54 2010 (r211275) +++ head/lib/libc/net/gethostnamadr.c Fri Aug 13 06:39:54 2010 (r211276) @@ -480,8 +480,12 @@ fakeaddr(const char *name, int af, struc hed->h_addr_ptrs[0] = (char *)hed->host_addr; hed->h_addr_ptrs[1] = NULL; he.h_addr_list = hed->h_addr_ptrs; + if (__copy_hostent(&he, hp, buf, buflen) != 0) { + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); + return (-1); + } RES_SET_H_ERRNO(statp, NETDB_SUCCESS); - return (__copy_hostent(&he, hp, buf, buflen)); + return (0); } int @@ -528,7 +532,7 @@ gethostbyname_internal(const char *name, size_t buflen, struct hostent **result, int *h_errnop, res_state statp) { const char *cp; - int rval, ret_errno; + int rval, ret_errno = 0; char abuf[MAXDNAME]; #ifdef NS_CACHING @@ -576,7 +580,11 @@ gethostbyname_internal(const char *name, "gethostbyname2_r", default_src, name, af, hp, buf, buflen, &ret_errno, h_errnop); - return ((rval == NS_SUCCESS) ? 0 : -1); + if (rval != NS_SUCCESS) { + errno = ret_errno; + return ((ret_errno != 0) ? ret_errno : -1); + } + return (0); } int @@ -586,7 +594,7 @@ gethostbyaddr_r(const void *addr, sockle const u_char *uaddr = (const u_char *)addr; const struct in6_addr *addr6; socklen_t size; - int rval, ret_errno; + int rval, ret_errno = 0; res_state statp; #ifdef NS_CACHING @@ -651,7 +659,11 @@ gethostbyaddr_r(const void *addr, sockle "gethostbyaddr_r", default_src, uaddr, len, af, hp, buf, buflen, &ret_errno, h_errnop); - return ((rval == NS_SUCCESS) ? 0 : -1); + if (rval != NS_SUCCESS) { + errno = ret_errno; + return ((ret_errno != 0) ? ret_errno : -1); + } + return (0); } struct hostent * Modified: head/lib/libc/net/getnetbydns.c ============================================================================== --- head/lib/libc/net/getnetbydns.c Fri Aug 13 06:03:54 2010 (r211275) +++ head/lib/libc/net/getnetbydns.c Fri Aug 13 06:39:54 2010 (r211276) @@ -355,8 +355,10 @@ _dns_getnetbyaddr(void *rval, void *cb_d net >>= 8; ne.n_net = net; if (__copy_netent(&ne, nptr, buffer, buflen) != 0) { + *errnop = errno; + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + return (NS_RETURN); } *((struct netent **)rval) = nptr; return (NS_SUCCESS); @@ -431,8 +433,10 @@ _dns_getnetbyname(void *rval, void *cb_d return (NS_NOTFOUND); } if (__copy_netent(&ne, nptr, buffer, buflen) != 0) { + *errnop = errno; + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + return (NS_RETURN); } *((struct netent **)rval) = nptr; return (NS_SUCCESS); Modified: head/lib/libc/net/getnetbyht.c ============================================================================== --- head/lib/libc/net/getnetbyht.c Fri Aug 13 06:03:54 2010 (r211275) +++ head/lib/libc/net/getnetbyht.c Fri Aug 13 06:39:54 2010 (r211276) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -162,8 +163,11 @@ getnetent_r(struct netent *nptr, char *b } if (getnetent_p(&ne, ned) != 0) return (-1); - if (__copy_netent(&ne, nptr, buffer, buflen) != 0) - return (-1); + if (__copy_netent(&ne, nptr, buffer, buflen) != 0) { + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); + *h_errnop = statp->res_h_errno; + return ((errno != 0) ? errno : -1); + } *result = nptr; return (0); } @@ -226,8 +230,10 @@ found: return (NS_NOTFOUND); } if (__copy_netent(&ne, nptr, buffer, buflen) != 0) { + *errnop = errno; + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + return (NS_RETURN); } *((struct netent **)rval) = nptr; return (NS_SUCCESS); @@ -272,8 +278,10 @@ _ht_getnetbyaddr(void *rval, void *cb_da return (NS_NOTFOUND); } if (__copy_netent(&ne, nptr, buffer, buflen) != 0) { + *errnop = errno; + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + return (NS_RETURN); } *((struct netent **)rval) = nptr; return (NS_SUCCESS); Modified: head/lib/libc/net/getnetbynis.c ============================================================================== --- head/lib/libc/net/getnetbynis.c Fri Aug 13 06:03:54 2010 (r211275) +++ head/lib/libc/net/getnetbynis.c Fri Aug 13 06:39:54 2010 (r211276) @@ -160,8 +160,10 @@ _nis_getnetbyname(void *rval, void *cb_d return (NS_NOTFOUND); } if (__copy_netent(&ne, nptr, buffer, buflen) != 0) { + *errnop = errno; + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + return (NS_RETURN); } *((struct netent **)rval) = nptr; return (NS_SUCCESS); @@ -244,8 +246,10 @@ _nis_getnetbyaddr(void *rval, void *cb_d return (NS_NOTFOUND); } if (__copy_netent(&ne, nptr, buffer, buflen) != 0) { + *errnop = errno; + RES_SET_H_ERRNO(statp, NETDB_INTERNAL); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + return (NS_RETURN); } *((struct netent **)rval) = nptr; return (NS_SUCCESS); Modified: head/lib/libc/net/getnetnamadr.c ============================================================================== --- head/lib/libc/net/getnetnamadr.c Fri Aug 13 06:03:54 2010 (r211275) +++ head/lib/libc/net/getnetnamadr.c Fri Aug 13 06:39:54 2010 (r211276) @@ -360,13 +360,17 @@ getnetbyname_r(const char *name, struct #endif { 0 } }; - int rval, ret_errno; + int rval, ret_errno = 0; rval = _nsdispatch((void *)result, dtab, NSDB_NETWORKS, "getnetbyname_r", default_src, name, ne, buffer, buflen, &ret_errno, h_errorp); - return ((rval == NS_SUCCESS) ? 0 : -1); + if (rval != NS_SUCCESS) { + errno = ret_errno; + return ((ret_errno != 0) ? ret_errno : -1); + } + return (0); } int @@ -388,13 +392,17 @@ getnetbyaddr_r(uint32_t addr, int af, st #endif { 0 } }; - int rval, ret_errno; + int rval, ret_errno = 0; rval = _nsdispatch((void *)result, dtab, NSDB_NETWORKS, "getnetbyaddr_r", default_src, addr, af, ne, buffer, buflen, &ret_errno, h_errorp); - return ((rval == NS_SUCCESS) ? 0 : -1); + if (rval != NS_SUCCESS) { + errno = ret_errno; + return ((ret_errno != 0) ? ret_errno : -1); + } + return (0); } struct netent * Modified: head/lib/libc/net/getproto.c ============================================================================== --- head/lib/libc/net/getproto.c Fri Aug 13 06:03:54 2010 (r211275) +++ head/lib/libc/net/getproto.c Fri Aug 13 06:39:54 2010 (r211276) @@ -33,6 +33,7 @@ static char sccsid[] = "@(#)getproto.c 8 #include __FBSDID("$FreeBSD$"); +#include #include #include #include "netdb_private.h" @@ -72,7 +73,7 @@ files_getprotobynumber(void *retval, voi errnop = va_arg(ap, int *); if ((ped = __protoent_data_init()) == NULL) { - *errnop = -1; + *errnop = errno; return (NS_NOTFOUND); } @@ -83,12 +84,12 @@ files_getprotobynumber(void *retval, voi if (!ped->stayopen) __endprotoent_p(ped); if (error != 0) { - *errnop = -1; + *errnop = errno; return (NS_NOTFOUND); } if (__copy_protoent(&pe, pptr, buffer, buflen) != 0) { - *errnop = -1; - return (NS_NOTFOUND); + *errnop = errno; + return (NS_RETURN); } *((struct protoent **)retval) = pptr; @@ -120,10 +121,11 @@ getprotobynumber_r(int proto, struct pro rv = nsdispatch(result, dtab, NSDB_PROTOCOLS, "getprotobynumber_r", defaultsrc, proto, pptr, buffer, buflen, &ret_errno); - if (rv == NS_SUCCESS) - return (0); - else - return (ret_errno); + if (rv != NS_SUCCESS) { + errno = ret_errno; + return ((ret_errno != 0) ? ret_errno : -1); + } + return (0); } struct protoent * Modified: head/lib/libc/net/getprotoent.c ============================================================================== --- head/lib/libc/net/getprotoent.c Fri Aug 13 06:03:54 2010 (r211275) +++ head/lib/libc/net/getprotoent.c Fri Aug 13 06:39:54 2010 (r211276) @@ -424,8 +424,10 @@ files_getprotoent_r(void *retval, void * buflen = va_arg(ap, size_t); errnop = va_arg(ap, int *); - if ((ped = __protoent_data_init()) == NULL) - return (-1); + if ((ped = __protoent_data_init()) == NULL) { + *errnop = errno; + return (NS_NOTFOUND); + } if (__getprotoent_p(&pe, ped) != 0) { *errnop = errno; @@ -434,7 +436,7 @@ files_getprotoent_r(void *retval, void * if (__copy_protoent(&pe, pptr, buffer, buflen) != 0) { *errnop = errno; - return (NS_NOTFOUND); + return (NS_RETURN); } *((struct protoent **)retval) = pptr; @@ -490,10 +492,11 @@ getprotoent_r(struct protoent *pptr, cha rv = nsdispatch(result, dtab, NSDB_PROTOCOLS, "getprotoent_r", defaultsrc, pptr, buffer, buflen, &ret_errno); - if (rv == NS_SUCCESS) - return (0); - else - return (ret_errno); + if (rv != NS_SUCCESS) { + errno = ret_errno; + return ((ret_errno != 0) ? ret_errno : -1); + } + return (0); } void Modified: head/lib/libc/net/getprotoname.c ============================================================================== --- head/lib/libc/net/getprotoname.c Fri Aug 13 06:03:54 2010 (r211275) +++ head/lib/libc/net/getprotoname.c Fri Aug 13 06:39:54 2010 (r211276) @@ -33,6 +33,7 @@ static char sccsid[] = "@(#)getprotoname #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -75,7 +76,7 @@ files_getprotobyname(void *retval, void if ((ped = __protoent_data_init()) == NULL) { - *errnop = -1; + *errnop = errno; return (NS_NOTFOUND); } @@ -91,12 +92,12 @@ found: if (!ped->stayopen) __endprotoent_p(ped); if (error != 0) { - *errnop = -1; + *errnop = errno; return (NS_NOTFOUND); } if (__copy_protoent(&pe, pptr, buffer, buflen) != 0) { - *errnop = -1; - return (NS_NOTFOUND); + *errnop = errno; + return (NS_RETURN); } *((struct protoent **)retval) = pptr; @@ -128,10 +129,11 @@ getprotobyname_r(const char *name, struc rv = nsdispatch(result, dtab, NSDB_PROTOCOLS, "getprotobyname_r", defaultsrc, name, pptr, buffer, buflen, &ret_errno); - if (rv == NS_SUCCESS) - return (0); - else - return (ret_errno); + if (rv != NS_SUCCESS) { + errno = ret_errno; + return ((ret_errno != 0) ? ret_errno : -1); + } + return (0); } struct protoent * From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 07:34:41 2010 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 9DF101065674; Fri, 13 Aug 2010 07:34:41 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B2228FC0A; Fri, 13 Aug 2010 07:34:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D7Yfbu034839; Fri, 13 Aug 2010 07:34:41 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D7Yf3I034838; Fri, 13 Aug 2010 07:34:41 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201008130734.o7D7Yf3I034838@svn.freebsd.org> From: Hajimu UMEMOTO Date: Fri, 13 Aug 2010 07:34:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211277 - stable/6/sbin/ip6fw 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, 13 Aug 2010 07:34:41 -0000 Author: ume Date: Fri Aug 13 07:34:41 2010 New Revision: 211277 URL: http://svn.freebsd.org/changeset/base/211277 Log: Fix the argument type of fill_icmptypes() on amd64. PR: bin/132911 Submitted by: Yoshitaka AHAREN Modified: stable/6/sbin/ip6fw/ip6fw.c Modified: stable/6/sbin/ip6fw/ip6fw.c ============================================================================== --- stable/6/sbin/ip6fw/ip6fw.c Fri Aug 13 06:39:54 2010 (r211276) +++ stable/6/sbin/ip6fw/ip6fw.c Fri Aug 13 07:34:41 2010 (r211277) @@ -764,7 +764,7 @@ fill_ip6opt(u_char *set, u_char *reset, void fill_icmptypes(types, vp, fw_flg) - u_long *types; + unsigned *types; char **vp; u_short *fw_flg; { From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 09:06:53 2010 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 6022F1065693; Fri, 13 Aug 2010 09:06:53 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id E8E778FC1A; Fri, 13 Aug 2010 09:06:52 +0000 (UTC) Received: from c122-106-147-41.carlnfd1.nsw.optusnet.com.au (c122-106-147-41.carlnfd1.nsw.optusnet.com.au [122.106.147.41]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7D96mN1007845 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Aug 2010 19:06:50 +1000 Date: Fri, 13 Aug 2010 19:06:48 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Takanori Watanabe In-Reply-To: <201008130045.o7D0jUW6043601@svn.freebsd.org> Message-ID: <20100813190247.I12761@delplex.bde.org> References: <201008130045.o7D0jUW6043601@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r211252 - head/usr.sbin/acpi/acpidump 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, 13 Aug 2010 09:06:53 -0000 On Fri, 13 Aug 2010, Takanori Watanabe wrote: > Log: > Fix build on amd64 and ia64. Why not fix it on all arches? > Modified: head/usr.sbin/acpi/acpidump/acpi.c > ============================================================================== > --- head/usr.sbin/acpi/acpidump/acpi.c Fri Aug 13 00:21:32 2010 (r211251) > +++ head/usr.sbin/acpi/acpidump/acpi.c Fri Aug 13 00:45:30 2010 (r211252) > ... > @@ -623,7 +622,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) > { > struct TCPAbody *tcpa; > struct TCPAevent *event; > - u_int64_t len, paddr; > + uint64_t len, paddr; > unsigned char *vaddr = NULL; > unsigned char *vend = NULL; > > @@ -647,7 +646,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) > printf(END_COMMENT); > return; > } > - printf("\tClass %d Base Address 0x%jx Length %" PRIu64 "\n\n", > + printf("\tClass %u Base Address 0x%jx Length %ju\n\n", > tcpa->platform_class, paddr, len); > > if (len == 0) { For `len', this used to assume that variables of type u_int64_t can be printed using PRIu64. Why the PRIu64 abomination should never be used, this assumption is valid. For `len', this now assumes that variables of type uint64_t can be printed using %ju format. %ju format is for printing variables of type uintmax_t, so this assumption is invalid unless uint64_t is the same as uintmax_t. This assumption happens to be valid on all supported arches, although it should not be (e.g., on amd64, uint64_t and uintmax_t both happen to be u_long, but this is illogical since uintmax_t is supposed to be the largest unsigned integer type but u_long is logically shorter than unsigned long long). Fixing these arches might expose many printf format errors like the above. For `paddr', this used to and still invalidly assumes that variables of type uint64_t can be printed using %ju format. PRIu64 is "lu" on both amd64 and ia64, and __uint64_t is u_long on both amd64 and ia64, so I don't see how the original version failed. In fact, it doesn't fail for me. __uintmax_t is u_long on both amd64 and ia64, so the modified version should work too, though accidentally, just like the unmodified version works accidentally for `paddr'. To expose even more printf format errors like the above, make __uintmax_t unsigned long long on amd64 and keep it as the illogical u_long on amd64. Bruce From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 09:12:54 2010 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 15E291065675; Fri, 13 Aug 2010 09:12:54 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id C81278FC19; Fri, 13 Aug 2010 09:12:53 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id D6FD91FFC33; Fri, 13 Aug 2010 09:12:52 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 96A1584528; Fri, 13 Aug 2010 11:12:52 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Takanori Watanabe References: <201008130045.o7D0jUW6043601@svn.freebsd.org> Date: Fri, 13 Aug 2010 11:12:52 +0200 In-Reply-To: <201008130045.o7D0jUW6043601@svn.freebsd.org> (Takanori Watanabe's message of "Fri, 13 Aug 2010 00:45:30 +0000 (UTC)") Message-ID: <86y6caswob.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211252 - head/usr.sbin/acpi/acpidump 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, 13 Aug 2010 09:12:54 -0000 Takanori Watanabe writes: > @@ -647,7 +646,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) > printf(END_COMMENT); > return; > } > - printf("\tClass %d Base Address 0x%jx Length %" PRIu64 "\n\n", > + printf("\tClass %u Base Address 0x%jx Length %ju\n\n", > tcpa->platform_class, paddr, len); >=20=20 > if (len =3D=3D 0) { This is still wrong, just a different kind of wrong. Just because the compiler doesn't complain doesn't mean it's right. Did you even read what John and I wrote? DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 09:58:17 2010 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 BFE571065697; Fri, 13 Aug 2010 09:58:17 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD3AA8FC17; Fri, 13 Aug 2010 09:58:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D9wHFs066450; Fri, 13 Aug 2010 09:58:17 GMT (envelope-from takawata@svn.freebsd.org) Received: (from takawata@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D9wH4m066448; Fri, 13 Aug 2010 09:58:17 GMT (envelope-from takawata@svn.freebsd.org) Message-Id: <201008130958.o7D9wH4m066448@svn.freebsd.org> From: Takanori Watanabe Date: Fri, 13 Aug 2010 09:58: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: r211278 - head/usr.sbin/acpi/acpidump 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, 13 Aug 2010 09:58:17 -0000 Author: takawata Date: Fri Aug 13 09:58:17 2010 New Revision: 211278 URL: http://svn.freebsd.org/changeset/base/211278 Log: use uintmax_t instead of uint64_t. Pointed out by: des. Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Fri Aug 13 07:34:41 2010 (r211277) +++ head/usr.sbin/acpi/acpidump/acpi.c Fri Aug 13 09:58:17 2010 (r211278) @@ -622,7 +622,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) { struct TCPAbody *tcpa; struct TCPAevent *event; - uint64_t len, paddr; + uintmax_t len, paddr; unsigned char *vaddr = NULL; unsigned char *vend = NULL; From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 10:25:38 2010 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 8E5141065696; Fri, 13 Aug 2010 10:25:38 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 1DA838FC15; Fri, 13 Aug 2010 10:25:37 +0000 (UTC) Received: from c122-106-147-41.carlnfd1.nsw.optusnet.com.au (c122-106-147-41.carlnfd1.nsw.optusnet.com.au [122.106.147.41]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7DAPSwP004848 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Aug 2010 20:25:29 +1000 Date: Fri, 13 Aug 2010 20:25:28 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: John Baldwin In-Reply-To: <4C643352.5010508@FreeBSD.org> Message-ID: <20100813200216.U12816@delplex.bde.org> References: <201008121358.o7CDwk0d098768@svn.freebsd.org> <86pqxn50vr.fsf@ds4.des.no> <4C6414A7.6020306@FreeBSD.org> <868w4bda7e.fsf@ds4.des.no> <4C643352.5010508@FreeBSD.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1130892370-1281695128=:12816" Cc: svn-src-head@FreeBSD.org, =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Takanori Watanabe Subject: Re: svn commit: r211221 - head/usr.sbin/acpi/acpidump 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, 13 Aug 2010 10:25:38 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1130892370-1281695128=:12816 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 12 Aug 2010, John Baldwin wrote: > Dag-Erling Sm=C3=B8rgrav wrote: >> John Baldwin writes: >>> Dag-Erling Sm=C3=B8rgrav writes: Oops, I replied to the commit mail for the round after this before noticing this thread. >>>> Slightly better: >>>>=20 >>>> =09printf("\tClass %u Base Address 0x%jx Length %ju\n\n", >>>> =09 (unsigned int)tcpa->platform_class, (uintmax_t)paddr,=20 >>>> (uintmax_t)len); Ugh, this has many more style bugs: - `unsigned int' is spelled u_int in KNF, partly to try to avoid the next bug - `platform_class' has type uint16_t. u_int is larger than that on all supported machines, and also on unsupported ones with 16-31 bit u_ints. Thus the cast has almost no effect, and has no effect on the result. On unsupported machines with exactly 16-bit u_ints, it has no effect. On unsupported and supported machines with >=3D 17-bit ints, the arg gets promoted to a signed int thanks to C90's promotion botch, but the value of the signed int is nonnegative so there is no difference here from the result of an unbotched promotion to u_int. - the second line is too ling, and has been nicely mangled by mailers, first by putting a hard newline in it and then by quoting it. >>>> but it would probably be easier to define paddr and len as unsigned lo= ng >>>> long instead of the misspelled u_int64_t, and use %llx and %llu. >>> Depends. If the table defines a field to be a 64-bit integer, it is >>> better to use an explicitly-64-bit integer type such as uint64_t >>> rather than assuming that 'long long' is 64-bit. Nah, unsigned long long shouldn't exist. >> Actually, paddr and len are a memory address and an object size, >> respectively, so the logical thing would be to use uintptr_t and size_t >> with uintmax_t casts... vm_offset_t and vm_size_t would be more logical, but maybe they are too BSD(Mach vm)-specific for acpi, especially outside of the kernel. > Except that physical addresses do not always fit in uintptr_t on i386 (th= ink=20 > PAE with 36-bit physical addresses and 32-bit uintptr_t, same for the=20 > length). If they truly were a size_t you could use %z without a uintmax_= t=20 > cast. Yes, if paddr really means a physical and not a virtual memory address. PAE has vm_paddr_t for the former. vm_paddr_t is 32 bits without PAE and 64 bits with PAE. Printing it and otherwise using it gives the usual problem that _no_ typedefed type can be printed or otherwise used with a hard-coded format or type (other than the typedef), but bugs are more noticable than usual since the type varies widely within a single arch. Anyway, almost all typedefed types should be cast to [u]intmax_t for printing, so that you don't have to know too much about what they are. We are still very sloppy about this for the smaller types, but have to be more careful for 64-bit types. Sloppy printing of the smaller types will break eventually when int or long expands but the typedefs don't. Bruce --0-1130892370-1281695128=:12816-- From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 10:50:14 2010 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 B46C41065696; Fri, 13 Aug 2010 10:50:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 455008FC1A; Fri, 13 Aug 2010 10:50:13 +0000 (UTC) Received: from c122-106-147-41.carlnfd1.nsw.optusnet.com.au (c122-106-147-41.carlnfd1.nsw.optusnet.com.au [122.106.147.41]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7DAoAHi011232 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Aug 2010 20:50:12 +1000 Date: Fri, 13 Aug 2010 20:50:10 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Jung-uk Kim In-Reply-To: <201008121335.05300.jkim@FreeBSD.org> Message-ID: <20100813202748.A12838@delplex.bde.org> References: <201008121613.o7CGDOij028986@svn.freebsd.org> <201008121335.05300.jkim@FreeBSD.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1729706536-1281696610=:12838" Cc: svn-src-head@FreeBSD.org, mdf@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r211228 - 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: Fri, 13 Aug 2010 10:50:14 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1729706536-1281696610=:12838 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 12 Aug 2010, Jung-uk Kim wrote: > On Thursday 12 August 2010 12:37 pm, mdf@FreeBSD.org wrote: >> On Thu, Aug 12, 2010 at 9:13 AM, Jung-uk Kim > wrote: >>> Log: >>> =A0Provide description for 'machdep.disable_rtc_set' sysctl. >>> =A0Clean up style(9) =A0nits. =A0Remove a redundant return statement >>> and an unnecessary variable. Some mailer mangled the whitespace, so the source code was unreadable and had syntax errors (hard \xa0's) in it. The hard \xa0's even got into the plain text in the log message. > --- >8 SNIP!!! --- >8 --- > >> While the device_printf() is a single statement, it spans multiple >> lines. It seems in this instance that clarity is preserved better >> by using braces even though not required by C. >> >> Quoting style(9): >> >> Space after keywords (if, while, for, return, switch). No braces >> ('{' and '}') are used for control statements with zero or only a >> single statement unless that statement is more than a single line >> in which case they are permitted. >> >> So both styles are accepted, and I would think that changing this >> is needless code churn. The main style bug here is the use of C90 string concatenation to obfuscate (not very long) messages. Some of the messages fit on 1 line before device_printf() and syslogd add prefixes to them, but the literal parts of them are misformatted across 3 lines in the source code. I try to keep messages shorted so that they fit in 1 line with normal indentation, or outdent long ones so that they fit in 1 line with abnormal indentation. > Some times it is very hard to read code when if statements contain > excessive braces and 'else' statements although is permitted by > style(9). It was one of those cases. Please note a 'else' block was > also removed from there. I agree, but don't mind the braces here. Removing the else block makes the misformatting of a string across 3 lines of source more bogus than before, since after reducing the indentation its lines are now split too early, and without splitting too early the ugly split string would fit in only 2 lines. I noticed 1 other unfixed style bug on a changed line: the SYSCTL_INT() was split much earlier than necessary (before CTLFLAG*). Now it is split as late as possible (after the variable name, which is next after CTLFLAG*). But SYSCTL_INT() is conventionally always split after CTLFLAG* unless this would give a too-long line. Bruce --0-1729706536-1281696610=:12838-- From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 10:50:42 2010 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 7BE0A1065673; Fri, 13 Aug 2010 10:50:42 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 34DC88FC14; Fri, 13 Aug 2010 10:50:42 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 62C6D1FFC33; Fri, 13 Aug 2010 10:50:41 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 2E35084525; Fri, 13 Aug 2010 12:50:41 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Bruce Evans References: <201008121358.o7CDwk0d098768@svn.freebsd.org> <86pqxn50vr.fsf@ds4.des.no> <4C6414A7.6020306@FreeBSD.org> <868w4bda7e.fsf@ds4.des.no> <4C643352.5010508@FreeBSD.org> <20100813200216.U12816@delplex.bde.org> Date: Fri, 13 Aug 2010 12:50:41 +0200 In-Reply-To: <20100813200216.U12816@delplex.bde.org> (Bruce Evans's message of "Fri, 13 Aug 2010 20:25:28 +1000 (EST)") Message-ID: <86iq3ess5a.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, Takanori Watanabe , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, John Baldwin Subject: Re: svn commit: r211221 - head/usr.sbin/acpi/acpidump 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, 13 Aug 2010 10:50:42 -0000 Bruce Evans writes: > - `platform_class' has type uint16_t. u_int is larger than that on all > supported machines, and also on unsupported ones with 16-31 bit u_ints. > Thus the cast has almost no effect, and has no effect on the result. you have to cast it to *something*, unless you're willing to assume blindly that uint16_t =3D=3D unsigned short (and use %h). > Anyway, almost all typedefed types should be cast to [u]intmax_t for > printing, so that you don't have to know too much about what they are. long or even int is fine in many cases, e.g. uid_t, mode_t DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 11:24:03 2010 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 0BF221065696; Fri, 13 Aug 2010 11:24:03 +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 ED1208FC0A; Fri, 13 Aug 2010 11:24:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DBO21U086585; Fri, 13 Aug 2010 11:24:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DBO2cm086583; Fri, 13 Aug 2010 11:24:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008131124.o7DBO2cm086583@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Aug 2010 11:24: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: r211279 - stable/8/sys/dev/usb/quirk 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, 13 Aug 2010 11:24:03 -0000 Author: kib Date: Fri Aug 13 11:24:02 2010 New Revision: 211279 URL: http://svn.freebsd.org/changeset/base/211279 Log: MFC r210931: Disable sync cache for the Transcend Jetflash V90. Modified: stable/8/sys/dev/usb/quirk/usb_quirk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/8/sys/dev/usb/quirk/usb_quirk.c Fri Aug 13 09:58:17 2010 (r211278) +++ stable/8/sys/dev/usb/quirk/usb_quirk.c Fri Aug 13 11:24:02 2010 (r211279) @@ -159,6 +159,8 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(ALCOR, AU6390, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, UMCR_9361, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), + USB_QUIRK(ALCOR, TRANSCEND, 0x0142, 0x0142, UQ_MSC_FORCE_WIRE_BBB, + UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, TRANSCEND, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), USB_QUIRK(APACER, HT202, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 12:56:00 2010 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 A090210656A4; Fri, 13 Aug 2010 12:56:00 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CEF18FC1C; Fri, 13 Aug 2010 12:56:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DCu09X006920; Fri, 13 Aug 2010 12:56:00 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DCu0lS006909; Fri, 13 Aug 2010 12:56:00 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201008131256.o7DCu0lS006909@svn.freebsd.org> From: "Jayachandran C." Date: Fri, 13 Aug 2010 12:56: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: r211280 - in head/sys: conf mips/conf mips/include mips/mips mips/rmi 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, 13 Aug 2010 12:56:00 -0000 Author: jchandra Date: Fri Aug 13 12:56:00 2010 New Revision: 211280 URL: http://svn.freebsd.org/changeset/base/211280 Log: Rename TARGET_XLR_XLS to CPU_RMI to match other CPU_xxx definitions. use CPU_RMI all XLR configurations. Update ident string for N32 and N64 kernels. Modified: head/sys/conf/options.mips head/sys/mips/conf/XLR head/sys/mips/conf/XLR64 head/sys/mips/conf/XLRN32 head/sys/mips/include/bus.h head/sys/mips/include/intr_machdep.h head/sys/mips/mips/exception.S head/sys/mips/mips/locore.S head/sys/mips/mips/machdep.c head/sys/mips/rmi/std.xlr Modified: head/sys/conf/options.mips ============================================================================== --- head/sys/conf/options.mips Fri Aug 13 11:24:02 2010 (r211279) +++ head/sys/conf/options.mips Fri Aug 13 12:56:00 2010 (r211280) @@ -35,6 +35,7 @@ CPU_SENTRY5 opt_global.h CPU_HAVEFPU opt_global.h CPU_SB1 opt_global.h CPU_CNMIPS opt_global.h +CPU_RMI opt_global.h ISA_MIPS1 opt_cputype.h ISA_MIPS3 opt_cputype.h @@ -51,7 +52,6 @@ CFE_ENV_SIZE opt_global.h NOFPU opt_global.h TARGET_EMULATOR opt_ddb.h -TARGET_XLR_XLS opt_global.h TICK_USE_YAMON_FREQ opt_global.h TICK_USE_MALTA_RTC opt_global.h Modified: head/sys/mips/conf/XLR ============================================================================== --- head/sys/mips/conf/XLR Fri Aug 13 11:24:02 2010 (r211279) +++ head/sys/mips/conf/XLR Fri Aug 13 12:56:00 2010 (r211280) @@ -46,7 +46,7 @@ # $FreeBSD$ machine mips -cpu CPU_MIPS4KC +cpu CPU_RMI ident XLR makeoptions MODULES_OVERRIDE="" Modified: head/sys/mips/conf/XLR64 ============================================================================== --- head/sys/mips/conf/XLR64 Fri Aug 13 11:24:02 2010 (r211279) +++ head/sys/mips/conf/XLR64 Fri Aug 13 12:56:00 2010 (r211280) @@ -18,8 +18,8 @@ # $FreeBSD$ machine mips -cpu CPU_MIPS4KC -ident XLR +cpu CPU_RMI +ident XLR64 makeoptions MODULES_OVERRIDE="" makeoptions TARGET_BIG_ENDIAN Modified: head/sys/mips/conf/XLRN32 ============================================================================== --- head/sys/mips/conf/XLRN32 Fri Aug 13 11:24:02 2010 (r211279) +++ head/sys/mips/conf/XLRN32 Fri Aug 13 12:56:00 2010 (r211280) @@ -18,8 +18,8 @@ # $FreeBSD$ machine mips -cpu CPU_MIPS4KC -ident XLR +cpu CPU_RMI +ident XLRN32 makeoptions MODULES_OVERRIDE="" makeoptions TARGET_BIG_ENDIAN Modified: head/sys/mips/include/bus.h ============================================================================== --- head/sys/mips/include/bus.h Fri Aug 13 11:24:02 2010 (r211279) +++ head/sys/mips/include/bus.h Fri Aug 13 12:56:00 2010 (r211280) @@ -721,7 +721,7 @@ void __bs_c(f,_bs_c_8) (void *t, bus_spa DECLARE_BUS_SPACE_PROTOTYPES(generic); extern bus_space_tag_t mips_bus_space_generic; /* Special bus space for RMI processors */ -#ifdef TARGET_XLR_XLS +#ifdef CPU_RMI extern bus_space_tag_t rmi_bus_space; extern bus_space_tag_t rmi_pci_bus_space; #endif Modified: head/sys/mips/include/intr_machdep.h ============================================================================== --- head/sys/mips/include/intr_machdep.h Fri Aug 13 11:24:02 2010 (r211279) +++ head/sys/mips/include/intr_machdep.h Fri Aug 13 12:56:00 2010 (r211280) @@ -29,7 +29,7 @@ #ifndef _MACHINE_INTR_MACHDEP_H_ #define _MACHINE_INTR_MACHDEP_H_ -#ifdef TARGET_XLR_XLS +#ifdef CPU_RMI #define XLR_MAX_INTR 64 #else #define NHARD_IRQS 6 Modified: head/sys/mips/mips/exception.S ============================================================================== --- head/sys/mips/mips/exception.S Fri Aug 13 11:24:02 2010 (r211279) +++ head/sys/mips/mips/exception.S Fri Aug 13 12:56:00 2010 (r211280) @@ -243,7 +243,7 @@ SlowFault: and a0, a0, a2 ; \ mtc0 a0, MIPS_COP_0_STATUS ; \ ITLBNOPFIX -#elif defined(TARGET_XLR_XLS) +#elif defined(CPU_RMI) #define CLEAR_STATUS \ mfc0 a0, MIPS_COP_0_STATUS ;\ li a2, (MIPS_SR_KX | MIPS_SR_UX | MIPS_SR_COP_2_BIT) ; \ @@ -485,7 +485,7 @@ NNON_LEAF(MipsUserGenException, CALLFRAM and t0, a0, ~(MIPS_SR_COP_1_BIT | MIPS_SR_EXL | MIPS3_SR_KSU_MASK | MIPS_SR_INT_IE) #if defined(CPU_CNMIPS) or t0, t0, (MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX | MIPS_SR_PX) -#elif defined(TARGET_XLR_XLS) +#elif defined(CPU_RMI) or t0, t0, (MIPS_SR_KX | MIPS_SR_UX | MIPS_SR_COP_2_BIT) #endif mtc0 t0, MIPS_COP_0_STATUS @@ -703,7 +703,7 @@ NNON_LEAF(MipsUserIntr, CALLFRAME_SIZ, r and t0, a0, ~(MIPS_SR_COP_1_BIT | MIPS_SR_EXL | MIPS_SR_INT_IE | MIPS3_SR_KSU_MASK) #ifdef CPU_CNMIPS or t0, t0, (MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX | MIPS_SR_PX) -#elif defined(TARGET_XLR_XLS) +#elif defined(CPU_RMI) or t0, t0, (MIPS_SR_KX | MIPS_SR_UX | MIPS_SR_COP_2_BIT) #endif mtc0 t0, MIPS_COP_0_STATUS Modified: head/sys/mips/mips/locore.S ============================================================================== --- head/sys/mips/mips/locore.S Fri Aug 13 11:24:02 2010 (r211279) +++ head/sys/mips/mips/locore.S Fri Aug 13 12:56:00 2010 (r211280) @@ -99,7 +99,7 @@ VECTOR(_locore, unknown) /* Reset these bits */ li t0, ~(MIPS_SR_DE | MIPS_SR_SOFT_RESET | MIPS_SR_ERL | MIPS_SR_EXL | MIPS_SR_INT_IE) -#elif defined (TARGET_XLR_XLS) +#elif defined (CPU_RMI) /* Set these bits */ li t1, (MIPS_SR_COP_2_BIT | MIPS_SR_COP_0_BIT | MIPS_SR_KX | MIPS_SR_UX) Modified: head/sys/mips/mips/machdep.c ============================================================================== --- head/sys/mips/mips/machdep.c Fri Aug 13 11:24:02 2010 (r211279) +++ head/sys/mips/mips/machdep.c Fri Aug 13 12:56:00 2010 (r211280) @@ -334,7 +334,7 @@ mips_vector_init(void) bcopy(MipsTLBMiss, (void *)MIPS_UTLB_MISS_EXC_VEC, MipsTLBMissEnd - MipsTLBMiss); -#if defined(CPU_CNMIPS) || defined(TARGET_XLR_XLS) +#if defined(CPU_CNMIPS) || defined(CPU_RMI) /* Fake, but sufficient, for the 32-bit with 64-bit hardware addresses */ bcopy(MipsTLBMiss, (void *)MIPS3_XTLB_MISS_EXC_VEC, MipsTLBMissEnd - MipsTLBMiss); Modified: head/sys/mips/rmi/std.xlr ============================================================================== --- head/sys/mips/rmi/std.xlr Fri Aug 13 11:24:02 2010 (r211279) +++ head/sys/mips/rmi/std.xlr Fri Aug 13 12:56:00 2010 (r211280) @@ -4,7 +4,4 @@ files "../rmi/files.xlr" # # XXXMIPS: It's a stub, isn't it? # -cpu CPU_MIPS4KC option NOFPU -# Kludge for now -options TARGET_XLR_XLS From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 13:36:18 2010 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 78A8E1065679; Fri, 13 Aug 2010 13:36:18 +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 671988FC08; Fri, 13 Aug 2010 13:36:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DDaIFh015763; Fri, 13 Aug 2010 13:36:18 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DDaISq015761; Fri, 13 Aug 2010 13:36:18 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201008131336.o7DDaISq015761@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 13 Aug 2010 13:36: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: r211281 - head/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, 13 Aug 2010 13:36:18 -0000 Author: jilles Date: Fri Aug 13 13:36:18 2010 New Revision: 211281 URL: http://svn.freebsd.org/changeset/base/211281 Log: sh: Fix shadowing of sigset. Modified: head/bin/sh/error.c Modified: head/bin/sh/error.c ============================================================================== --- head/bin/sh/error.c Fri Aug 13 12:56:00 2010 (r211280) +++ head/bin/sh/error.c Fri Aug 13 13:36:18 2010 (r211281) @@ -102,7 +102,7 @@ exraise(int e) void onint(void) { - sigset_t sigset; + sigset_t sigs; /* * The !in_dotrap here is safe. The only way we can arrive here @@ -115,8 +115,8 @@ onint(void) return; } intpending = 0; - sigemptyset(&sigset); - sigprocmask(SIG_SETMASK, &sigset, NULL); + sigemptyset(&sigs); + sigprocmask(SIG_SETMASK, &sigs, NULL); /* * This doesn't seem to be needed, since main() emits a newline. From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 14:35:22 2010 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 AD90210656E0; Fri, 13 Aug 2010 14:35:22 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 3E8E18FC1A; Fri, 13 Aug 2010 14:35:21 +0000 (UTC) Received: from c122-106-147-41.carlnfd1.nsw.optusnet.com.au (c122-106-147-41.carlnfd1.nsw.optusnet.com.au [122.106.147.41]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7DEZD6X027221 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 14 Aug 2010 00:35:15 +1000 Date: Sat, 14 Aug 2010 00:35:13 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= In-Reply-To: <86iq3ess5a.fsf@ds4.des.no> Message-ID: <20100814001308.N12943@delplex.bde.org> References: <201008121358.o7CDwk0d098768@svn.freebsd.org> <86pqxn50vr.fsf@ds4.des.no> <4C6414A7.6020306@FreeBSD.org> <868w4bda7e.fsf@ds4.des.no> <4C643352.5010508@FreeBSD.org> <20100813200216.U12816@delplex.bde.org> <86iq3ess5a.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1088411302-1281710113=:12943" Cc: src-committers@FreeBSD.org, John Baldwin , Takanori Watanabe , svn-src-all@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org Subject: Re: svn commit: r211221 - head/usr.sbin/acpi/acpidump 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, 13 Aug 2010 14:35:22 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1088411302-1281710113=:12943 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Fri, 13 Aug 2010, [utf-8] Dag-Erling Sm=C3=B8rgrav wrote: > Bruce Evans writes: >> - `platform_class' has type uint16_t. u_int is larger than that on all >> supported machines, and also on unsupported ones with 16-31 bit u_ints= =2E >> Thus the cast has almost no effect, and has no effect on the result. > > you have to cast it to *something*, unless you're willing to assume > blindly that uint16_t =3D=3D unsigned short (and use %h). No, all function parameters are converted to *something*, and as I partly explained above, the default something is always int or u_int, with the lofical sign error for the int not causing any problems. Various cases: - K&R compiler, or C90-C99 compiler with no prototype in scope: integer parameters are converted to int or u_int if they are smaller than that to start, else they are not converted. - variadic function for a parameter after `...': same as for K&R. - %h format for printf: makes little or no difference except for bogus parameters. The parameter must end up as int or u_int after the default promotion. The %h causes the parameter to be downcast to short or u_sho= rt. This is different from taking a short or u_short parameter. You just can't pass a short or a u_short to a variadic function, Here uint16_t is converted to u_int on machines with 16-bit ints, else it is converted to int. >> Anyway, almost all typedefed types should be cast to [u]intmax_t for >> printing, so that you don't have to know too much about what they are. > > long or even int is fine in many cases, e.g. uid_t, mode_t Though it works now, it might break someday. 32-bit ino_t and printing it with %u should have broken already. Bruce --0-1088411302-1281710113=:12943-- From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 15:17:20 2010 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 2741810656A7; Fri, 13 Aug 2010 15:17:20 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 159C68FC1B; Fri, 13 Aug 2010 15:17:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DFHJ4d038100; Fri, 13 Aug 2010 15:17:19 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DFHJFe038098; Fri, 13 Aug 2010 15:17:19 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201008131517.o7DFHJFe038098@svn.freebsd.org> From: Matt Jacob Date: Fri, 13 Aug 2010 15:17: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: r211282 - head/sbin/geom/class/multipath 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, 13 Aug 2010 15:17:20 -0000 Author: mjacob Date: Fri Aug 13 15:17:19 2010 New Revision: 211282 URL: http://svn.freebsd.org/changeset/base/211282 Log: Avoid a memory leak. Submitted by: Dmitry Luhtionov via Alexander Motin MFC after: 1 week Modified: head/sbin/geom/class/multipath/geom_multipath.c Modified: head/sbin/geom/class/multipath/geom_multipath.c ============================================================================== --- head/sbin/geom/class/multipath/geom_multipath.c Fri Aug 13 13:36:18 2010 (r211281) +++ head/sbin/geom/class/multipath/geom_multipath.c Fri Aug 13 15:17:19 2010 (r211282) @@ -149,16 +149,6 @@ mp_label(struct gctl_req *req) } /* - * Allocate a sector to write as metadata. - */ - sector = malloc(secsize); - if (sector == NULL) { - gctl_error(req, "unable to allocate metadata buffer"); - return; - } - memset(sector, 0, secsize); - - /* * Generate metadata. */ strlcpy(md.md_magic, G_MULTIPATH_MAGIC, sizeof(md.md_magic)); @@ -191,6 +181,16 @@ mp_label(struct gctl_req *req) } /* + * Allocate a sector to write as metadata. + */ + sector = malloc(secsize); + if (sector == NULL) { + gctl_error(req, "unable to allocate metadata buffer"); + return; + } + memset(sector, 0, secsize); + + /* * encode the metadata */ multipath_metadata_encode(&md, sector); From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 18:17:33 2010 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 68AA610656A7; Fri, 13 Aug 2010 18:17:33 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CDA58FC0A; Fri, 13 Aug 2010 18:17:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DIHXi6003369; Fri, 13 Aug 2010 18:17:33 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DIHXCl003368; Fri, 13 Aug 2010 18:17:33 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <201008131817.o7DIHXCl003368@svn.freebsd.org> From: Marko Zec Date: Fri, 13 Aug 2010 18:17:33 +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: r211283 - 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: Fri, 13 Aug 2010 18:17:33 -0000 Author: zec Date: Fri Aug 13 18:17:32 2010 New Revision: 211283 URL: http://svn.freebsd.org/changeset/base/211283 Log: When moving an ethernet ifnet from one vnet to another, destroy the associated ng_ether netgraph node in the current vnet, and create a new one in the target vnet. Reviewed by: julian MFC after: 3 days Modified: head/sys/net/if.c head/sys/net/if_ethersubr.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Fri Aug 13 15:17:19 2010 (r211282) +++ head/sys/net/if.c Fri Aug 13 18:17:32 2010 (r211283) @@ -956,12 +956,21 @@ if_vmove(struct ifnet *ifp, struct vnet */ IFNET_WLOCK(); ifindex_free_locked(ifp->if_index); + IFNET_WUNLOCK(); + + /* + * Perform interface-specific reassignment tasks, if provided by + * the driver. + */ + if (ifp->if_reassign != NULL) + ifp->if_reassign(ifp, new_vnet, NULL); /* * Switch to the context of the target vnet. */ CURVNET_SET_QUIET(new_vnet); + IFNET_WLOCK(); if (ifindex_alloc_locked(&idx) != 0) { IFNET_WUNLOCK(); panic("if_index overflow"); Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Fri Aug 13 15:17:19 2010 (r211282) +++ head/sys/net/if_ethersubr.c Fri Aug 13 18:17:32 2010 (r211283) @@ -129,6 +129,9 @@ static const u_char etherbroadcastaddr[E static int ether_resolvemulti(struct ifnet *, struct sockaddr **, struct sockaddr *); +#ifdef VIMAGE +static void ether_reassign(struct ifnet *, struct vnet *, char *); +#endif /* XXX: should be in an arp support file, not here */ MALLOC_DEFINE(M_ARPCOM, "arpcom", "802.* interface internals"); @@ -944,6 +947,9 @@ ether_ifattach(struct ifnet *ifp, const ifp->if_output = ether_output; ifp->if_input = ether_input; ifp->if_resolvemulti = ether_resolvemulti; +#ifdef VIMAGE + ifp->if_reassign = ether_reassign; +#endif if (ifp->if_baudrate == 0) ifp->if_baudrate = IF_Mbps(10); /* just a default */ ifp->if_broadcastaddr = etherbroadcastaddr; @@ -983,6 +989,25 @@ ether_ifdetach(struct ifnet *ifp) if_detach(ifp); } +#ifdef VIMAGE +void +ether_reassign(struct ifnet *ifp, struct vnet *new_vnet, char *unused __unused) +{ + + if (IFP2AC(ifp)->ac_netgraph != NULL) { + KASSERT(ng_ether_detach_p != NULL, + ("ng_ether_detach_p is NULL")); + (*ng_ether_detach_p)(ifp); + } + + if (ng_ether_attach_p != NULL) { + CURVNET_SET_QUIET(new_vnet); + (*ng_ether_attach_p)(ifp); + CURVNET_RESTORE(); + } +} +#endif + SYSCTL_DECL(_net_link); SYSCTL_NODE(_net_link, IFT_ETHER, ether, CTLFLAG_RW, 0, "Ethernet"); #if defined(INET) || defined(INET6) From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 19:20:35 2010 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 AB72310656BD; Fri, 13 Aug 2010 19:20:35 +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 99FCC8FC12; Fri, 13 Aug 2010 19:20:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DJKZw1004715; Fri, 13 Aug 2010 19:20:35 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DJKZgD004713; Fri, 13 Aug 2010 19:20:35 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008131920.o7DJKZgD004713@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 13 Aug 2010 19:20: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: r211284 - 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: Fri, 13 Aug 2010 19:20:35 -0000 Author: pjd Date: Fri Aug 13 19:20:35 2010 New Revision: 211284 URL: http://svn.freebsd.org/changeset/base/211284 Log: Simplify taskqueue_drain() by using proved macros. Modified: head/sys/kern/subr_taskqueue.c Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Fri Aug 13 18:17:32 2010 (r211283) +++ head/sys/kern/subr_taskqueue.c Fri Aug 13 19:20:35 2010 (r211284) @@ -248,23 +248,16 @@ taskqueue_run(struct taskqueue *queue, s void taskqueue_drain(struct taskqueue *queue, struct task *task) { - if (queue->tq_spin) { /* XXX */ - mtx_lock_spin(&queue->tq_mutex); - while (task->ta_pending != 0 || - (task->ta_running != NULL && task == *task->ta_running)) { - msleep_spin(task, &queue->tq_mutex, "-", 0); - } - mtx_unlock_spin(&queue->tq_mutex); - } else { + + if (!queue->tq_spin) WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); - mtx_lock(&queue->tq_mutex); - while (task->ta_pending != 0 || - (task->ta_running != NULL && task == *task->ta_running)) { - msleep(task, &queue->tq_mutex, PWAIT, "-", 0); - } - mtx_unlock(&queue->tq_mutex); + TQ_LOCK(queue); + while (task->ta_pending != 0 || + (task->ta_running != NULL && task == *task->ta_running)) { + TQ_SLEEP(queue, task, &queue->tq_mutex, PWAIT, "-", 0); } + TQ_UNLOCK(queue); } static void From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 19:39:33 2010 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 A5A32106564A; Fri, 13 Aug 2010 19:39:33 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 946748FC0C; Fri, 13 Aug 2010 19:39:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DJdX4r005141; Fri, 13 Aug 2010 19:39:33 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DJdXPl005139; Fri, 13 Aug 2010 19:39:33 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008131939.o7DJdXPl005139@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 13 Aug 2010 19:39:33 +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: r211285 - head/sys/dev/alc 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, 13 Aug 2010 19:39:33 -0000 Author: yongari Date: Fri Aug 13 19:39:33 2010 New Revision: 211285 URL: http://svn.freebsd.org/changeset/base/211285 Log: Make sure to disable RX MAC in alc_stop_mac(). Previously there was a logic error which it always enabled RX MAC. Modified: head/sys/dev/alc/if_alc.c Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Fri Aug 13 19:20:35 2010 (r211284) +++ head/sys/dev/alc/if_alc.c Fri Aug 13 19:39:33 2010 (r211285) @@ -3486,7 +3486,7 @@ alc_stop_mac(struct alc_softc *sc) /* Disable Rx/Tx MAC. */ reg = CSR_READ_4(sc, ALC_MAC_CFG); if ((reg & (MAC_CFG_TX_ENB | MAC_CFG_RX_ENB)) != 0) { - reg &= ~MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; + reg &= ~(MAC_CFG_TX_ENB | MAC_CFG_RX_ENB); CSR_WRITE_4(sc, ALC_MAC_CFG, reg); } for (i = ALC_TIMEOUT; i > 0; i--) { From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 19:47:13 2010 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 8CAA3106566B; Fri, 13 Aug 2010 19:47:13 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9A9218FC08; Fri, 13 Aug 2010 19:47:12 +0000 (UTC) Received: by ewy26 with SMTP id 26so1843086ewy.13 for ; Fri, 13 Aug 2010 12:47:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=QMvAUEkq6NIVRaakBmoIt5kv8Qu3seK6zT2ZaGwX87s=; b=wc6q44x17UWBsKgwFvTgFAb5XhpRuspLlu4vo4OO5BzbMe2GsnwBofAaMmvSoHYS0c LCVd0z1C4t1q5hBXNPkDUP/ADmaeIEwCYx8FPsxxVFKKjL/ii1uMp2U14gOgrWCH86Fq V0X0zyilwJKFjBfuzDJjHaZ4g22BQABPmlWUE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=VHyjHnU1u1+KKr5F5sBzzHtk5gzuLxKekNSsHKhmRAzk9yVBQoIA4wtOrDp2/sPCt5 8DlOIeGPfmhxe4XxvZqKWn0zMStXkkMACm9LfbZeBiWCb1ZWVihlyFM1hR9NLMhuk3+y /k/8QlflFUbsRRzpIYiQSswqJ0aojArqBhyCg= MIME-Version: 1.0 Received: by 10.213.31.143 with SMTP id y15mr1911860ebc.38.1281728831209; Fri, 13 Aug 2010 12:47:11 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.213.10.196 with HTTP; Fri, 13 Aug 2010 12:47:11 -0700 (PDT) In-Reply-To: <201008131920.o7DJKZgD004713@svn.freebsd.org> References: <201008131920.o7DJKZgD004713@svn.freebsd.org> Date: Fri, 13 Aug 2010 12:47:11 -0700 X-Google-Sender-Auth: wJPSLIKJH1btOMMem820jCrcXxU Message-ID: From: mdf@FreeBSD.org To: Pawel Jakub Dawidek Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211284 - 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: Fri, 13 Aug 2010 19:47:13 -0000 On Fri, Aug 13, 2010 at 12:20 PM, Pawel Jakub Dawidek wro= te: > Author: pjd > Date: Fri Aug 13 19:20:35 2010 > New Revision: 211284 > URL: http://svn.freebsd.org/changeset/base/211284 > > Log: > =A0Simplify taskqueue_drain() by using proved macros. Thanks! This was on my to-do list since I'd been in this file, once I could figure out why it hand't already been done. :-) Cheers, matthew > > Modified: > =A0head/sys/kern/subr_taskqueue.c > > Modified: head/sys/kern/subr_taskqueue.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/subr_taskqueue.c =A0 =A0 =A0Fri Aug 13 18:17:32 2010 = =A0 =A0 =A0 =A0(r211283) > +++ head/sys/kern/subr_taskqueue.c =A0 =A0 =A0Fri Aug 13 19:20:35 2010 = =A0 =A0 =A0 =A0(r211284) > @@ -248,23 +248,16 @@ taskqueue_run(struct taskqueue *queue, s > =A0void > =A0taskqueue_drain(struct taskqueue *queue, struct task *task) > =A0{ > - =A0 =A0 =A0 if (queue->tq_spin) { =A0 =A0 =A0 =A0 =A0 /* XXX */ > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mtx_lock_spin(&queue->tq_mutex); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 while (task->ta_pending !=3D 0 || > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (task->ta_running !=3D NULL && task= =3D=3D *task->ta_running)) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 msleep_spin(task, &queue->t= q_mutex, "-", 0); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mtx_unlock_spin(&queue->tq_mutex); > - =A0 =A0 =A0 } else { > + > + =A0 =A0 =A0 if (!queue->tq_spin) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, = NULL, __func__); > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mtx_lock(&queue->tq_mutex); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 while (task->ta_pending !=3D 0 || > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (task->ta_running !=3D NULL && task= =3D=3D *task->ta_running)) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 msleep(task, &queue->tq_mut= ex, PWAIT, "-", 0); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mtx_unlock(&queue->tq_mutex); > + =A0 =A0 =A0 TQ_LOCK(queue); > + =A0 =A0 =A0 while (task->ta_pending !=3D 0 || > + =A0 =A0 =A0 =A0 =A0 (task->ta_running !=3D NULL && task =3D=3D *task->t= a_running)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 TQ_SLEEP(queue, task, &queue->tq_mutex, PWA= IT, "-", 0); > =A0 =A0 =A0 =A0} > + =A0 =A0 =A0 TQ_UNLOCK(queue); > =A0} > > =A0static void > From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 20:27:41 2010 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 02B101065672; Fri, 13 Aug 2010 20:27:41 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E59E38FC17; Fri, 13 Aug 2010 20:27:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DKRef0006209; Fri, 13 Aug 2010 20:27:40 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DKReCc006207; Fri, 13 Aug 2010 20:27:40 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201008132027.o7DKReCc006207@svn.freebsd.org> From: Joel Dahl Date: Fri, 13 Aug 2010 20:27: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: r211286 - 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: Fri, 13 Aug 2010 20:27:41 -0000 Author: joel (doc committer) Date: Fri Aug 13 20:27:40 2010 New Revision: 211286 URL: http://svn.freebsd.org/changeset/base/211286 Log: Fix typo. Modified: head/share/man/man4/tpm.4 Modified: head/share/man/man4/tpm.4 ============================================================================== --- head/share/man/man4/tpm.4 Fri Aug 13 19:39:33 2010 (r211285) +++ head/share/man/man4/tpm.4 Fri Aug 13 20:27:40 2010 (r211286) @@ -35,7 +35,7 @@ In .Sh DESCRIPTION The .Nm -driver provides support for various trusted platfrom modules (TPM) that can +driver provides support for various trusted platform modules (TPM) that can store cryptographic keys. .Pp Supported modules: From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 20:29:44 2010 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 4744E1065674; Fri, 13 Aug 2010 20:29:44 +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 F21DC8FC13; Fri, 13 Aug 2010 20:29:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DKThh7006283; Fri, 13 Aug 2010 20:29:43 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DKThVI006281; Fri, 13 Aug 2010 20:29:43 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201008132029.o7DKThVI006281@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 13 Aug 2010 20:29: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: r211287 - head/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, 13 Aug 2010 20:29:44 -0000 Author: jilles Date: Fri Aug 13 20:29:43 2010 New Revision: 211287 URL: http://svn.freebsd.org/changeset/base/211287 Log: sh: Add a forgotten const. Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Fri Aug 13 20:27:40 2010 (r211286) +++ head/bin/sh/eval.c Fri Aug 13 20:29:43 2010 (r211287) @@ -641,7 +641,7 @@ evalcommand(union node *cmd, int flags, char *lastarg; int realstatus; int do_clearcmdentry; - char *path = pathval(); + const char *path = pathval(); /* First expand the arguments. */ TRACE(("evalcommand(%p, %d) called\n", (void *)cmd, flags)); From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 20:43:20 2010 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 176E11065673; Fri, 13 Aug 2010 20:43:20 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 064AB8FC0C; Fri, 13 Aug 2010 20:43:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DKhJg4006569; Fri, 13 Aug 2010 20:43:19 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DKhJKI006566; Fri, 13 Aug 2010 20:43:19 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008132043.o7DKhJKI006566@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 13 Aug 2010 20:43: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: r211288 - head/etc 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, 13 Aug 2010 20:43:20 -0000 Author: jkim Date: Fri Aug 13 20:43:19 2010 New Revision: 211288 URL: http://svn.freebsd.org/changeset/base/211288 Log: Enforce ACPI timer as the timecounter hardware before we change sleep state unless it is the current timer. When we have resumed successfully, restore the previous timecounter hardware if it was changed earlier. Only the ACPI timer is guaranteed to increase monotonically between S-state changes. Modified: head/etc/rc.resume head/etc/rc.suspend Modified: head/etc/rc.resume ============================================================================== --- head/etc/rc.resume Fri Aug 13 20:29:43 2010 (r211287) +++ head/etc/rc.resume Fri Aug 13 20:43:19 2010 (r211288) @@ -43,6 +43,12 @@ if [ -r /var/run/rc.suspend.pid ]; then echo 'rc.resume: killed rc.suspend that was still around' fi +if [ -r /var/run/rc.suspend.tch ]; then + _t=`cat /var/run/rc.suspend.tch` + /sbin/sysctl -n kern.timecounter.hardware=$_t > /dev/null 2>&1 + /bin/rm -f /var/run/rc.suspend.tch +fi + # Turns on a power supply of a card in the slot inactivated. # See also contrib/pccardq.c (only for PAO users). # pccardq | awk -F '~' '$5 == "inactive" \ Modified: head/etc/rc.suspend ============================================================================== --- head/etc/rc.suspend Fri Aug 13 20:29:43 2010 (r211287) +++ head/etc/rc.suspend Fri Aug 13 20:43:19 2010 (r211288) @@ -43,6 +43,18 @@ fi echo $$ 2> /dev/null > /var/run/rc.suspend.pid +_t=`/sbin/sysctl -n kern.timecounter.hardware 2> /dev/null` +case ${_t#ACPI-} in +fast|safe) + /bin/rm -f /var/run/rc.suspend.tch + ;; +*) + ( /sbin/sysctl -n kern.timecounter.hardware=ACPI-fast || \ + /sbin/sysctl -n kern.timecounter.hardware=ACPI-safe ) \ + > /dev/null 2>&1 && echo $_t > /var/run/rc.suspend.tch + ;; +esac + # If you have troubles on suspending with PC-CARD modem, try this. # See also contrib/pccardq.c (Only for PAO users). # pccardq | awk -F '~' '$5 == "filled" && $4 ~ /uart/ \ From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 21:04:44 2010 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 33E481065693; Fri, 13 Aug 2010 21:04:44 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22B848FC17; Fri, 13 Aug 2010 21:04:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DL4iOL007103; Fri, 13 Aug 2010 21:04:44 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DL4iU3007101; Fri, 13 Aug 2010 21:04:44 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008132104.o7DL4iU3007101@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 13 Aug 2010 21:04: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: r211289 - head/etc 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, 13 Aug 2010 21:04:44 -0000 Author: jkim Date: Fri Aug 13 21:04:43 2010 New Revision: 211289 URL: http://svn.freebsd.org/changeset/base/211289 Log: Do not fork a subshell unnecessarily. Modified: head/etc/rc.suspend Modified: head/etc/rc.suspend ============================================================================== --- head/etc/rc.suspend Fri Aug 13 20:43:19 2010 (r211288) +++ head/etc/rc.suspend Fri Aug 13 21:04:43 2010 (r211289) @@ -49,8 +49,8 @@ fast|safe) /bin/rm -f /var/run/rc.suspend.tch ;; *) - ( /sbin/sysctl -n kern.timecounter.hardware=ACPI-fast || \ - /sbin/sysctl -n kern.timecounter.hardware=ACPI-safe ) \ + { /sbin/sysctl -n kern.timecounter.hardware=ACPI-fast || \ + /sbin/sysctl -n kern.timecounter.hardware=ACPI-safe; } \ > /dev/null 2>&1 && echo $_t > /var/run/rc.suspend.tch ;; esac From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 21:17:59 2010 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 C0FD71065698; Fri, 13 Aug 2010 21:17: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 AEDF38FC08; Fri, 13 Aug 2010 21:17:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DLHxcq007421; Fri, 13 Aug 2010 21:17:59 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DLHx44007417; Fri, 13 Aug 2010 21:17:59 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008132117.o7DLHx44007417@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 13 Aug 2010 21:17: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: r211290 - head/tools/regression/fstest/tests/chflags 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, 13 Aug 2010 21:17:59 -0000 Author: pjd Date: Fri Aug 13 21:17:59 2010 New Revision: 211290 URL: http://svn.freebsd.org/changeset/base/211290 Log: - Use loops to avoid code duplication. - More tests. Modified: head/tools/regression/fstest/tests/chflags/07.t head/tools/regression/fstest/tests/chflags/08.t head/tools/regression/fstest/tests/chflags/09.t Modified: head/tools/regression/fstest/tests/chflags/07.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/07.t Fri Aug 13 21:04:43 2010 (r211289) +++ head/tools/regression/fstest/tests/chflags/07.t Fri Aug 13 21:17:59 2010 (r211290) @@ -8,7 +8,7 @@ dir=`dirname $0` require chflags -echo "1..30" +echo "1..93" n0=`namegen` n1=`namegen` @@ -18,37 +18,33 @@ expect 0 mkdir ${n0} 0755 cdir=`pwd` cd ${n0} -expect 0 create ${n1} 0644 -expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP -expect none stat ${n1} flags -expect 0 chown ${n1} 65534 65534 -expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP -expect none stat ${n1} flags -expect 0 unlink ${n1} - -expect 0 mkdir ${n1} 0755 -expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP -expect none stat ${n1} flags -expect 0 chown ${n1} 65534 65534 -expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP -expect none stat ${n1} flags -expect 0 rmdir ${n1} - -expect 0 mkfifo ${n1} 0644 -expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP -expect none stat ${n1} flags -expect 0 chown ${n1} 65534 65534 -expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP -expect none stat ${n1} flags -expect 0 unlink ${n1} - -expect 0 symlink ${n2} ${n1} -expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP -expect none lstat ${n1} flags -expect 0 lchown ${n1} 65534 65534 -expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP -expect none lstat ${n1} flags -expect 0 unlink ${n1} +for type in regular dir fifo block char socket symlink; do + if [ "${type}" != "symlink" ]; then + create_file ${type} ${n1} + expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP + expect none stat ${n1} flags + expect 0 chown ${n1} 65534 65534 + expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP + expect none stat ${n1} flags + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi + fi + + create_file ${type} ${n1} + expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP + expect none lstat ${n1} flags + expect 0 lchown ${n1} 65534 65534 + expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP + expect none lstat ${n1} flags + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi +done cd ${cdir} expect 0 rmdir ${n0} Modified: head/tools/regression/fstest/tests/chflags/08.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/08.t Fri Aug 13 21:04:43 2010 (r211289) +++ head/tools/regression/fstest/tests/chflags/08.t Fri Aug 13 21:17:59 2010 (r211290) @@ -8,7 +8,7 @@ dir=`dirname $0` require chflags -echo "1..78" +echo "1..249" n0=`namegen` n1=`namegen` @@ -18,53 +18,41 @@ expect 0 mkdir ${n0} 0755 cdir=`pwd` cd ${n0} -expect 0 create ${n1} 0644 -expect 0 chown ${n1} 65534 65534 -for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 chflags ${n1} ${flag} - expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags +for type in regular dir fifo block char socket symlink; do + if [ "${type}" != "symlink" ]; then + create_file ${type} ${n1} + expect 0 chown ${n1} 65534 65534 + for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do + expect 0 chflags ${n1} ${flag} + expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP + expect ${flag} stat ${n1} flags + expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP + expect ${flag} stat ${n1} flags + done + expect 0 chflags ${n1} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi + fi + + create_file ${type} ${n1} + expect 0 lchown ${n1} 65534 65534 + for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do + expect 0 lchflags ${n1} ${flag} + expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP + expect ${flag} lstat ${n1} flags + expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP + expect ${flag} lstat ${n1} flags + done + expect 0 lchflags ${n1} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi done -expect 0 chflags ${n1} none -expect 0 unlink ${n1} - -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 chflags ${n1} ${flag} - expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags -done -expect 0 chflags ${n1} none -expect 0 rmdir ${n1} - -expect 0 mkfifo ${n1} 0644 -expect 0 chown ${n1} 65534 65534 -for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 chflags ${n1} ${flag} - expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags -done -expect 0 chflags ${n1} none -expect 0 unlink ${n1} - -expect 0 symlink ${n2} ${n1} -expect 0 lchown ${n1} 65534 65534 -for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 lchflags ${n1} ${flag} - expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP - expect ${flag} lstat ${n1} flags - expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP - expect ${flag} lstat ${n1} flags -done -expect 0 lchflags ${n1} none -expect 0 unlink ${n1} cd ${cdir} expect 0 rmdir ${n0} Modified: head/tools/regression/fstest/tests/chflags/09.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/09.t Fri Aug 13 21:04:43 2010 (r211289) +++ head/tools/regression/fstest/tests/chflags/09.t Fri Aug 13 21:17:59 2010 (r211290) @@ -8,7 +8,7 @@ dir=`dirname $0` require chflags -echo "1..102" +echo "1..327" n0=`namegen` n1=`namegen` @@ -21,61 +21,45 @@ expect 0 mkdir ${n0} 0755 cdir=`pwd` cd ${n0} -expect 0 create ${n1} 0644 -expect 0 chown ${n1} 65534 65534 -for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 chflags ${n1} ${flag} - jexpect 1 `pwd` EPERM chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags +for type in regular dir fifo block char socket symlink; do + if [ "${type}" != "symlink" ]; then + create_file ${type} ${n1} + expect 0 chown ${n1} 65534 65534 + for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do + expect 0 chflags ${n1} ${flag} + jexpect 1 `pwd` EPERM chflags ${n1} UF_NODUMP + expect ${flag} stat ${n1} flags + jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP + expect ${flag} stat ${n1} flags + jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP + expect ${flag} stat ${n1} flags + done + expect 0 chflags ${n1} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi + fi + + create_file ${type} ${n1} + expect 0 lchown ${n1} 65534 65534 + for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do + expect 0 lchflags ${n1} ${flag} + jexpect 1 `pwd` EPERM lchflags ${n1} UF_NODUMP + expect ${flag} lstat ${n1} flags + jexpect 1 `pwd` EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP + expect ${flag} lstat ${n1} flags + jexpect 1 `pwd` EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP + expect ${flag} lstat ${n1} flags + done + expect 0 lchflags ${n1} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi done -expect 0 chflags ${n1} none -expect 0 unlink ${n1} - -expect 0 mkdir ${n1} 0755 -expect 0 chown ${n1} 65534 65534 -for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 chflags ${n1} ${flag} - jexpect 1 `pwd` EPERM chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags -done -expect 0 chflags ${n1} none -expect 0 rmdir ${n1} - -expect 0 mkfifo ${n1} 0644 -expect 0 chown ${n1} 65534 65534 -for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 chflags ${n1} ${flag} - jexpect 1 `pwd` EPERM chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags - jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP - expect ${flag} stat ${n1} flags -done -expect 0 chflags ${n1} none -expect 0 unlink ${n1} - -expect 0 symlink ${n2} ${n1} -expect 0 lchown ${n1} 65534 65534 -for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do - expect 0 lchflags ${n1} ${flag} - jexpect 1 `pwd` EPERM lchflags ${n1} UF_NODUMP - expect ${flag} lstat ${n1} flags - jexpect 1 `pwd` EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP - expect ${flag} lstat ${n1} flags - jexpect 1 `pwd` EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP - expect ${flag} lstat ${n1} flags -done -expect 0 lchflags ${n1} none -expect 0 unlink ${n1} sysctl security.jail.chflags_allowed=${old} >/dev/null cd ${cdir} From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 21:23:13 2010 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 6B0B610656A5; Fri, 13 Aug 2010 21:23:13 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A0228FC12; Fri, 13 Aug 2010 21:23:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DLNDNc007563; Fri, 13 Aug 2010 21:23:13 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DLNDo5007560; Fri, 13 Aug 2010 21:23:13 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008132123.o7DLNDo5007560@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 13 Aug 2010 21:23: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: r211291 - head/etc 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, 13 Aug 2010 21:23:13 -0000 Author: jkim Date: Fri Aug 13 21:23:13 2010 New Revision: 211291 URL: http://svn.freebsd.org/changeset/base/211291 Log: Consistently use full pathnames for external commands. Modified: head/etc/rc.resume head/etc/rc.suspend Modified: head/etc/rc.resume ============================================================================== --- head/etc/rc.resume Fri Aug 13 21:17:59 2010 (r211290) +++ head/etc/rc.resume Fri Aug 13 21:23:13 2010 (r211291) @@ -39,7 +39,7 @@ state=$2 if [ -r /var/run/rc.suspend.pid ]; then kill -9 `cat /var/run/rc.suspend.pid` - rm -f /var/run/rc.suspend.pid + /bin/rm -f /var/run/rc.suspend.pid echo 'rc.resume: killed rc.suspend that was still around' fi @@ -62,7 +62,7 @@ fi # the following to signal it to reassociate. # /usr/sbin/wpa_cli reassociate -logger -t $subsystem resumed at `date +'%Y%m%d %H:%M:%S'` -sync && sync && sync +/usr/bin/logger -t $subsystem resumed at `/bin/date +'%Y%m%d %H:%M:%S'` +/bin/sync && /bin/sync && /bin/sync exit 0 Modified: head/etc/rc.suspend ============================================================================== --- head/etc/rc.suspend Fri Aug 13 21:17:59 2010 (r211290) +++ head/etc/rc.suspend Fri Aug 13 21:23:13 2010 (r211291) @@ -64,11 +64,11 @@ esac # suspend and reloading it on resume. Example: # kldunload usb -logger -t $subsystem suspend at `date +'%Y%m%d %H:%M:%S'` -sync && sync && sync -sleep 3 +/usr/bin/logger -t $subsystem suspend at `/bin/date +'%Y%m%d %H:%M:%S'` +/bin/sync && /bin/sync && /bin/sync +/bin/sleep 3 -rm -f /var/run/rc.suspend.pid +/bin/rm -f /var/run/rc.suspend.pid if [ $subsystem = "apm" ]; then /usr/sbin/zzz else From owner-svn-src-all@FreeBSD.ORG Fri Aug 13 22:08:42 2010 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 EC6681065697; Fri, 13 Aug 2010 22:08:42 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAF088FC13; Fri, 13 Aug 2010 22:08:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DM8gS9008624; Fri, 13 Aug 2010 22:08:42 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DM8gc4008621; Fri, 13 Aug 2010 22:08:42 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008132208.o7DM8gc4008621@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 13 Aug 2010 22:08: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: r211292 - in head/sys/amd64: acpica amd64 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, 13 Aug 2010 22:08:43 -0000 Author: jkim Date: Fri Aug 13 22:08:42 2010 New Revision: 211292 URL: http://svn.freebsd.org/changeset/base/211292 Log: Reset switchtime to zero rather than the current CPU ticker (TSC) value. It is more appropriate in this context because TSC MSR is reset to zero when the CPU is restarted from S3 and above. Move acpi_resync_clock() back to where it was before r211202. It does not make a difference any more. Modified: head/sys/amd64/acpica/acpi_wakeup.c head/sys/amd64/amd64/mp_machdep.c Modified: head/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- head/sys/amd64/acpica/acpi_wakeup.c Fri Aug 13 21:23:13 2010 (r211291) +++ head/sys/amd64/acpica/acpi_wakeup.c Fri Aug 13 22:08:42 2010 (r211292) @@ -278,13 +278,13 @@ acpi_sleep_machdep(struct acpi_softc *sc for (;;) ia32_pause(); } else { - acpi_resync_clock(sc); - PCPU_SET(switchtime, cpu_ticks()); + PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); #ifdef SMP if (wakeup_cpus != 0) acpi_wakeup_cpus(sc, wakeup_cpus); #endif + acpi_resync_clock(sc); ret = 0; } Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Fri Aug 13 21:23:13 2010 (r211291) +++ head/sys/amd64/amd64/mp_machdep.c Fri Aug 13 22:08:42 2010 (r211292) @@ -1366,7 +1366,7 @@ cpususpend_handler(void) wbinvd(); atomic_set_int(&stopped_cpus, cpumask); } else { - PCPU_SET(switchtime, cpu_ticks()); + PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); } From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 00:50:26 2010 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 A2B8C1065670; Sat, 14 Aug 2010 00:50:26 +0000 (UTC) (envelope-from yar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9123A8FC08; Sat, 14 Aug 2010 00:50:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7E0oQfZ011841; Sat, 14 Aug 2010 00:50:26 GMT (envelope-from yar@svn.freebsd.org) Received: (from yar@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7E0oQX6011839; Sat, 14 Aug 2010 00:50:26 GMT (envelope-from yar@svn.freebsd.org) Message-Id: <201008140050.o7E0oQX6011839@svn.freebsd.org> From: Yar Tikhiy Date: Sat, 14 Aug 2010 00:50: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: r211294 - stable/8/usr.sbin/iostat 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, 14 Aug 2010 00:50:26 -0000 Author: yar Date: Sat Aug 14 00:50:26 2010 New Revision: 211294 URL: http://svn.freebsd.org/changeset/base/211294 Log: MFC r211001: Move the sentences telling the defaults for -c and -w to where they belong. Previously they were misplaced, i.e., swapped. Modified: stable/8/usr.sbin/iostat/iostat.8 Directory Properties: stable/8/usr.sbin/iostat/ (props changed) Modified: stable/8/usr.sbin/iostat/iostat.8 ============================================================================== --- stable/8/usr.sbin/iostat/iostat.8 Fri Aug 13 22:39:11 2010 (r211293) +++ stable/8/usr.sbin/iostat/iostat.8 Sat Aug 14 00:50:26 2010 (r211294) @@ -100,9 +100,9 @@ The options are as follows: Repeat the display .Ar count times. -If no -.Ar wait -interval is specified, the default is 1 second. +If no repeat +.Ar count +is specified, the default is infinity. .It Fl C Display CPU statistics. This is on by default, unless @@ -236,9 +236,9 @@ is specified. Pause .Ar wait seconds between each display. -If no repeat -.Ar count -is specified, the default is infinity. +If no +.Ar wait +interval is specified, the default is 1 second. .It Fl x Show extended disk statistics. Each disk is displayed on a line of its own with all available statistics. From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 09:29:43 2010 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 813B31065693; Sat, 14 Aug 2010 09:29:43 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 562E28FC14; Sat, 14 Aug 2010 09:29:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7E9ThlG022174; Sat, 14 Aug 2010 09:29:43 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7E9ThxE022171; Sat, 14 Aug 2010 09:29:43 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201008140929.o7E9ThxE022171@svn.freebsd.org> From: Bernhard Schmidt Date: Sat, 14 Aug 2010 09:29: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: r211295 - head/sys/net80211 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, 14 Aug 2010 09:29:43 -0000 Author: bschmidt Date: Sat Aug 14 09:29:42 2010 New Revision: 211295 URL: http://svn.freebsd.org/changeset/base/211295 Log: Initialize ni_txrate after txparams have been setup. Some drivers calculate various things prior to association based on ni_txrate and rely on it being nonzero. PR: kern/149185 MFC after: 2 weeks Modified: head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_sta.c Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Sat Aug 14 00:50:26 2010 (r211294) +++ head/sys/net80211/ieee80211_node.c Sat Aug 14 09:29:42 2010 (r211295) @@ -817,6 +817,7 @@ ieee80211_sta_join(struct ieee80211vap * if (ieee80211_iserp_rateset(&ni->ni_rates)) ni->ni_flags |= IEEE80211_NODE_ERP; ieee80211_node_setuptxparms(ni); + ieee80211_ratectl_node_init(ni); return ieee80211_sta_join1(ieee80211_ref_node(ni)); } @@ -1401,6 +1402,7 @@ ieee80211_fakeup_adhoc_node(struct ieee8 #endif } ieee80211_node_setuptxparms(ni); + ieee80211_ratectl_node_init(ni); if (ic->ic_newassoc != NULL) ic->ic_newassoc(ni, 1); /* XXX not right for 802.1x/WPA */ @@ -1470,6 +1472,7 @@ ieee80211_add_neighbor(struct ieee80211v if (ieee80211_iserp_rateset(&ni->ni_rates)) ni->ni_flags |= IEEE80211_NODE_ERP; ieee80211_node_setuptxparms(ni); + ieee80211_ratectl_node_init(ni); if (ic->ic_newassoc != NULL) ic->ic_newassoc(ni, 1); /* XXX not right for 802.1x/WPA */ @@ -2338,6 +2341,7 @@ ieee80211_node_join(struct ieee80211_nod ); ieee80211_node_setuptxparms(ni); + ieee80211_ratectl_node_init(ni); /* give driver a chance to setup state like ni_txrate */ if (ic->ic_newassoc != NULL) ic->ic_newassoc(ni, newassoc); Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Sat Aug 14 00:50:26 2010 (r211294) +++ head/sys/net80211/ieee80211_sta.c Sat Aug 14 09:29:42 2010 (r211295) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #ifdef IEEE80211_SUPPORT_SUPERG #include #endif +#include #define IEEE80211_RATE2MBS(r) (((r) & IEEE80211_RATE_VAL) / 2) @@ -1596,6 +1597,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, IEEE80211_F_JOIN | IEEE80211_F_DOBRS); ieee80211_setup_basic_htrates(ni, htinfo); ieee80211_node_setuptxparms(ni); + ieee80211_ratectl_node_init(ni); } else { #ifdef IEEE80211_SUPPORT_SUPERG if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_ATH)) From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 13:44:25 2010 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 3D300106566B; Sat, 14 Aug 2010 13:44:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 122238FC08; Sat, 14 Aug 2010 13:44:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EDiOrr028979; Sat, 14 Aug 2010 13:44:24 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EDiOg7028977; Sat, 14 Aug 2010 13:44:24 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201008141344.o7EDiOg7028977@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 14 Aug 2010 13:44: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: r211296 - stable/8/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, 14 Aug 2010 13:44:25 -0000 Author: bz Date: Sat Aug 14 13:44:24 2010 New Revision: 211296 URL: http://svn.freebsd.org/changeset/base/211296 Log: MFC r210686: MFp4 @181628: Free the rtentry after we diconnected it from the FIB and are counting it as rttrash. There might still be a chance we leak it from a different code path but there is nothing we can do about this here. Modified: stable/8/sys/netinet/in_rmx.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/in_rmx.c ============================================================================== --- stable/8/sys/netinet/in_rmx.c Sat Aug 14 09:29:42 2010 (r211295) +++ stable/8/sys/netinet/in_rmx.c Sat Aug 14 13:44:24 2010 (r211296) @@ -408,14 +408,28 @@ in_ifadownkill(struct radix_node *rn, vo if (rt->rt_ifa == ap->ifa && (ap->del || !(rt->rt_flags & RTF_STATIC))) { /* - * We need to disable the automatic prune that happens - * in this case in rtrequest() because it will blow - * away the pointers that rn_walktree() needs in order - * continue our descent. We will end up deleting all - * the routes that rtrequest() would have in any case, - * so that behavior is not needed there. + * Aquire a reference so that it can later be freed + * as the refcount would be 0 here in case of at least + * ap->del. + */ + RT_ADDREF(rt); + /* + * Disconnect it from the tree and permit protocols + * to cleanup. */ rtexpunge(rt); + /* + * At this point it is an rttrash node, and in case + * the above is the only reference we must free it. + * If we do not noone will have a pointer and the + * rtentry will be leaked forever. + * In case someone else holds a reference, we are + * fine as we only decrement the refcount. In that + * case if the other entity calls RT_REMREF, we + * will still be leaking but at least we tried. + */ + RTFREE_LOCKED(rt); + return (0); } RT_UNLOCK(rt); return 0; From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 13:47:34 2010 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 B04DA106566B; Sat, 14 Aug 2010 13:47:34 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 853F38FC13; Sat, 14 Aug 2010 13:47:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EDlY9Q029082; Sat, 14 Aug 2010 13:47:34 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EDlYoH029080; Sat, 14 Aug 2010 13:47:34 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201008141347.o7EDlYoH029080@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 14 Aug 2010 13:47:34 +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: r211297 - stable/7/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, 14 Aug 2010 13:47:34 -0000 Author: bz Date: Sat Aug 14 13:47:34 2010 New Revision: 211297 URL: http://svn.freebsd.org/changeset/base/211297 Log: MFC r210686: MFp4 @181628: Free the rtentry after we diconnected it from the FIB and are counting it as rttrash. There might still be a chance we leak it from a different code path but there is nothing we can do about this here. Modified: stable/7/sys/netinet/in_rmx.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/in_rmx.c ============================================================================== --- stable/7/sys/netinet/in_rmx.c Sat Aug 14 13:44:24 2010 (r211296) +++ stable/7/sys/netinet/in_rmx.c Sat Aug 14 13:47:34 2010 (r211297) @@ -402,15 +402,35 @@ in_ifadownkill(struct radix_node *rn, vo if (rt->rt_ifa == ap->ifa && (ap->del || !(rt->rt_flags & RTF_STATIC))) { /* + * Aquire a reference so that it can later be freed + * as the refcount would be 0 here in case of at least + * ap->del. + */ + RT_ADDREF(rt); + /* * We need to disable the automatic prune that happens * in this case in rtrequest() because it will blow * away the pointers that rn_walktree() needs in order * continue our descent. We will end up deleting all * the routes that rtrequest() would have in any case, * so that behavior is not needed there. + * Disconnect it from the tree and permit protocols + * to cleanup. */ rt->rt_flags &= ~RTF_CLONING; rtexpunge(rt); + /* + * At this point it is an rttrash node, and in case + * the above is the only reference we must free it. + * If we do not noone will have a pointer and the + * rtentry will be leaked forever. + * In case someone else holds a reference, we are + * fine as we only decrement the refcount. In that + * case if the other entity calls RT_REMREF, we + * will still be leaking but at least we tried. + */ + RTFREE_LOCKED(rt); + return (0); } RT_UNLOCK(rt); return 0; From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 13:51:38 2010 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 C672D1065696; Sat, 14 Aug 2010 13:51:38 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B8E48FC14; Sat, 14 Aug 2010 13:51:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EDpcQ2029195; Sat, 14 Aug 2010 13:51:38 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EDpcC0029193; Sat, 14 Aug 2010 13:51:38 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201008141351.o7EDpcC0029193@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 14 Aug 2010 13:51:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211298 - stable/6/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, 14 Aug 2010 13:51:39 -0000 Author: bz Date: Sat Aug 14 13:51:38 2010 New Revision: 211298 URL: http://svn.freebsd.org/changeset/base/211298 Log: MFC r210686: MFp4 @181628: Free the rtentry after we diconnected it from the FIB and are counting it as rttrash. There might still be a chance we leak it from a different code path but there is nothing we can do about this here. Modified: stable/6/sys/netinet/in_rmx.c Directory Properties: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/netinet/in_rmx.c ============================================================================== --- stable/6/sys/netinet/in_rmx.c Sat Aug 14 13:47:34 2010 (r211297) +++ stable/6/sys/netinet/in_rmx.c Sat Aug 14 13:51:38 2010 (r211298) @@ -365,15 +365,35 @@ in_ifadownkill(struct radix_node *rn, vo if (rt->rt_ifa == ap->ifa && (ap->del || !(rt->rt_flags & RTF_STATIC))) { /* + * Aquire a reference so that it can later be freed + * as the refcount would be 0 here in case of at least + * ap->del. + */ + RT_ADDREF(rt); + /* * We need to disable the automatic prune that happens * in this case in rtrequest() because it will blow * away the pointers that rn_walktree() needs in order * continue our descent. We will end up deleting all * the routes that rtrequest() would have in any case, * so that behavior is not needed there. + * Disconnect it from the tree and permit protocols + * to cleanup. */ rt->rt_flags &= ~RTF_CLONING; rtexpunge(rt); + /* + * At this point it is an rttrash node, and in case + * the above is the only reference we must free it. + * If we do not noone will have a pointer and the + * rtentry will be leaked forever. + * In case someone else holds a reference, we are + * fine as we only decrement the refcount. In that + * case if the other entity calls RT_REMREF, we + * will still be leaking but at least we tried. + */ + RTFREE_LOCKED(rt); + return (0); } RT_UNLOCK(rt); return 0; From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 14:01:12 2010 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 BE0E31065696; Sat, 14 Aug 2010 14:01:12 +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 AE0448FC14; Sat, 14 Aug 2010 14:01:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EE1C4D029433; Sat, 14 Aug 2010 14:01:12 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EE1CSP029430; Sat, 14 Aug 2010 14:01:12 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008141401.o7EE1CSP029430@svn.freebsd.org> From: Adrian Chadd Date: Sat, 14 Aug 2010 14:01: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: r211299 - 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: Sat, 14 Aug 2010 14:01:12 -0000 Author: adrian Date: Sat Aug 14 14:01:12 2010 New Revision: 211299 URL: http://svn.freebsd.org/changeset/base/211299 Log: Add a global counter of missed beacons. The existing missed beacon count is reset once a beacon isn't missed. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athioctl.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sat Aug 14 13:51:38 2010 (r211298) +++ head/sys/dev/ath/if_ath.c Sat Aug 14 14:01:12 2010 (r211299) @@ -2824,6 +2824,7 @@ ath_beacon_proc(void *arg, int pending) */ if (ath_hal_numtxpending(ah, sc->sc_bhalq) != 0) { sc->sc_bmisscount++; + sc->sc_stats.ast_be_missed++; DPRINTF(sc, ATH_DEBUG_BEACON, "%s: missed %u consecutive beacons\n", __func__, sc->sc_bmisscount); Modified: head/sys/dev/ath/if_athioctl.h ============================================================================== --- head/sys/dev/ath/if_athioctl.h Sat Aug 14 13:51:38 2010 (r211298) +++ head/sys/dev/ath/if_athioctl.h Sat Aug 14 14:01:12 2010 (r211299) @@ -118,7 +118,8 @@ struct ath_stats { u_int32_t ast_tdma_ack; /* TDMA tx failed 'cuz ACK required */ u_int32_t ast_tx_raw_fail;/* raw tx failed 'cuz h/w down */ u_int32_t ast_tx_nofrag; /* tx dropped 'cuz no ath frag buffer */ - u_int32_t ast_pad[14]; + u_int32_t ast_be_missed; /* missed beacons */ + u_int32_t ast_pad[13]; }; #define SIOCGATHSTATS _IOWR('i', 137, struct ifreq) From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 14:09:14 2010 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 3B2351065694; Sat, 14 Aug 2010 14:09:14 +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 2A3E68FC19; Sat, 14 Aug 2010 14:09:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EE9EvC029596; Sat, 14 Aug 2010 14:09:14 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EE9EZZ029594; Sat, 14 Aug 2010 14:09:14 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008141409.o7EE9EZZ029594@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 14 Aug 2010 14:09:14 +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: r211300 - stable/8/sys/compat/freebsd32 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, 14 Aug 2010 14:09:14 -0000 Author: kib Date: Sat Aug 14 14:09:13 2010 New Revision: 211300 URL: http://svn.freebsd.org/changeset/base/211300 Log: MFC r211005: Add compat32 definition for (old) struct ostat. Modified: stable/8/sys/compat/freebsd32/freebsd32.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/compat/freebsd32/freebsd32.h ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32.h Sat Aug 14 14:01:12 2010 (r211299) +++ stable/8/sys/compat/freebsd32/freebsd32.h Sat Aug 14 14:09:13 2010 (r211300) @@ -157,6 +157,24 @@ struct stat32 { unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32)); }; +struct ostat32 { + __uint16_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + __uint16_t st_uid; + __uint16_t st_gid; + __uint16_t st_rdev; + __int32_t st_size; + struct timespec32 st_atim; + struct timespec32 st_mtim; + struct timespec32 st_ctim; + __int32_t st_blksize; + __int32_t st_blocks; + u_int32_t st_flags; + __uint32_t st_gen; +}; + struct jail32_v0 { u_int32_t version; uint32_t path; From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 14:13:44 2010 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 EAA7A1065698; Sat, 14 Aug 2010 14:13:44 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAA338FC08; Sat, 14 Aug 2010 14:13:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EEDiND029753; Sat, 14 Aug 2010 14:13:44 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EEDiBZ029751; Sat, 14 Aug 2010 14:13:44 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201008141413.o7EEDiBZ029751@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 14 Aug 2010 14:13: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: r211301 - head/sys/netinet6 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, 14 Aug 2010 14:13:45 -0000 Author: bz Date: Sat Aug 14 14:13:44 2010 New Revision: 211301 URL: http://svn.freebsd.org/changeset/base/211301 Log: In rip6_input(), in case of multicast, we might skip the normal processing and go to the next iteration early if multicast filtering would decide that this socket shall not receive the data. Unlock the pcb in that case or we leak the read lock and next time trying to get a write lock, would hang forever. PR: kern/149608 Submitted by: Chris Luke (chrisy flirble.org) MFC after: 3 days Modified: head/sys/netinet6/raw_ip6.c Modified: head/sys/netinet6/raw_ip6.c ============================================================================== --- head/sys/netinet6/raw_ip6.c Sat Aug 14 14:09:13 2010 (r211300) +++ head/sys/netinet6/raw_ip6.c Sat Aug 14 14:13:44 2010 (r211301) @@ -248,6 +248,7 @@ rip6_input(struct mbuf **mp, int *offp, } if (blocked != MCAST_PASS) { IP6STAT_INC(ip6s_notmember); + INP_RUNLOCK(in6p); continue; } } From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 14:13:58 2010 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 6810B10657C0; Sat, 14 Aug 2010 14:13:58 +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 565448FC13; Sat, 14 Aug 2010 14:13:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EEDwul029788; Sat, 14 Aug 2010 14:13:58 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EEDwtj029784; Sat, 14 Aug 2010 14:13:58 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008141413.o7EEDwtj029784@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 14 Aug 2010 14:13:58 +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: r211302 - in stable/8/sys: amd64/ia32 compat/freebsd32 ia64/ia32 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, 14 Aug 2010 14:13:58 -0000 Author: kib Date: Sat Aug 14 14:13:58 2010 New Revision: 211302 URL: http://svn.freebsd.org/changeset/base/211302 Log: MFC r211006: Prefer struct sysentvec sv_psstrings to hardcoding FREEBSD32_PS_STRINGS in the compat32 code. Use sv_usrstack instead of FREEBSD32_USRSTACK as well. Modified: stable/8/sys/amd64/ia32/ia32_signal.c stable/8/sys/compat/freebsd32/freebsd32_misc.c stable/8/sys/ia64/ia32/ia32_signal.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/ia32/ia32_signal.c ============================================================================== --- stable/8/sys/amd64/ia32/ia32_signal.c Sat Aug 14 14:13:44 2010 (r211301) +++ stable/8/sys/amd64/ia32/ia32_signal.c Sat Aug 14 14:13:58 2010 (r211302) @@ -387,7 +387,7 @@ freebsd4_ia32_sendsig(sig_t catcher, ksi } regs->tf_rsp = (uintptr_t)sfp; - regs->tf_rip = FREEBSD32_PS_STRINGS - sz_freebsd4_ia32_sigcode; + regs->tf_rip = p->p_sysent->sv_psstrings - sz_freebsd4_ia32_sigcode; regs->tf_rflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucode32sel; regs->tf_ss = _udatasel; @@ -508,7 +508,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t * } regs->tf_rsp = (uintptr_t)sfp; - regs->tf_rip = FREEBSD32_PS_STRINGS - *(p->p_sysent->sv_szsigcode); + regs->tf_rip = p->p_sysent->sv_psstrings - *(p->p_sysent->sv_szsigcode); regs->tf_rflags &= ~(PSL_T | PSL_D); regs->tf_cs = _ucode32sel; regs->tf_ss = _udatasel; Modified: stable/8/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_misc.c Sat Aug 14 14:13:44 2010 (r211301) +++ stable/8/sys/compat/freebsd32/freebsd32_misc.c Sat Aug 14 14:13:58 2010 (r211302) @@ -2544,7 +2544,8 @@ freebsd32_copyout_strings(struct image_p execpath_len = strlen(imgp->execpath) + 1; else execpath_len = 0; - arginfo = (struct freebsd32_ps_strings *)FREEBSD32_PS_STRINGS; + arginfo = (struct freebsd32_ps_strings *)curproc->p_sysent-> + sv_psstrings; szsigcode = *(imgp->proc->p_sysent->sv_szsigcode); destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - roundup(execpath_len, sizeof(char *)) - Modified: stable/8/sys/ia64/ia32/ia32_signal.c ============================================================================== --- stable/8/sys/ia64/ia32/ia32_signal.c Sat Aug 14 14:13:44 2010 (r211301) +++ stable/8/sys/ia64/ia32/ia32_signal.c Sat Aug 14 14:13:58 2010 (r211302) @@ -128,7 +128,9 @@ ia32_setregs(struct thread *td, u_long e u_int64_t codeseg, dataseg, gdtseg, ldtseg; struct segment_descriptor desc; struct vmspace *vmspace = td->td_proc->p_vmspace; + struct sysentvec *sv; + sv = td->td_proc->p_sysent; exec_setregs(td, entry, stack, ps_strings); /* Non-syscall frames are cleared by exec_setregs() */ @@ -142,7 +144,7 @@ ia32_setregs(struct thread *td, u_long e tf->tf_special.sp = stack; /* Point the RSE backstore to something harmless. */ - tf->tf_special.bspstore = (FREEBSD32_PS_STRINGS - sz_ia32_sigcode - + tf->tf_special.bspstore = (sv->sv_psstrings - sz_ia32_sigcode - SPARE_USRSPACE + 15) & ~15; codesel = LSEL(LUCODE_SEL, SEL_UPL); @@ -157,7 +159,7 @@ ia32_setregs(struct thread *td, u_long e /* * Build the GDT and LDT. */ - gdt = FREEBSD32_USRSTACK; + gdt = sv->sv_usrstack; vm_map_find(&vmspace->vm_map, 0, 0, &gdt, IA32_PAGE_SIZE << 1, 0, VM_PROT_ALL, VM_PROT_ALL, 0); ldt = gdt + IA32_PAGE_SIZE; @@ -173,12 +175,12 @@ ia32_setregs(struct thread *td, u_long e desc.sd_hibase = ldt >> 24; copyout(&desc, (caddr_t) gdt + 8*GLDT_SEL, sizeof(desc)); - desc.sd_lolimit = ((FREEBSD32_USRSTACK >> 12) - 1) & 0xffff; + desc.sd_lolimit = ((sv->sv_usrstack >> 12) - 1) & 0xffff; desc.sd_lobase = 0; desc.sd_type = SDT_MEMERA; desc.sd_dpl = SEL_UPL; desc.sd_p = 1; - desc.sd_hilimit = ((FREEBSD32_USRSTACK >> 12) - 1) >> 16; + desc.sd_hilimit = ((sv->sv_usrstack >> 12) - 1) >> 16; desc.sd_def32 = 1; desc.sd_gran = 1; desc.sd_hibase = 0; @@ -187,14 +189,14 @@ ia32_setregs(struct thread *td, u_long e copyout(&desc, (caddr_t) ldt + 8*LUDATA_SEL, sizeof(desc)); codeseg = 0 /* base */ - + (((FREEBSD32_USRSTACK >> 12) - 1) << 32) /* limit */ + + (((sv->sv_usrstack >> 12) - 1) << 32) /* limit */ + ((long)SDT_MEMERA << 52) + ((long)SEL_UPL << 57) + (1L << 59) /* present */ + (1L << 62) /* 32 bits */ + (1L << 63); /* page granularity */ dataseg = 0 /* base */ - + (((FREEBSD32_USRSTACK >> 12) - 1) << 32) /* limit */ + + (((sv->sv_usrstack >> 12) - 1) << 32) /* limit */ + ((long)SDT_MEMRWA << 52) + ((long)SEL_UPL << 57) + (1L << 59) /* present */ @@ -231,7 +233,7 @@ ia32_setregs(struct thread *td, u_long e ia64_set_eflag(PSL_USER); /* PS_STRINGS value for BSD/OS binaries. It is 0 for non-BSD/OS. */ - tf->tf_scratch.gr11 = FREEBSD32_PS_STRINGS; + tf->tf_scratch.gr11 = td->td_proc->p_sysent->sv_psstrings; /* * XXX - Linux emulator From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 14:18:03 2010 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 2570B1065672; Sat, 14 Aug 2010 14:18:03 +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 126BC8FC0C; Sat, 14 Aug 2010 14:18:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EEI2xe029903; Sat, 14 Aug 2010 14:18:02 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EEI2e4029901; Sat, 14 Aug 2010 14:18:02 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008141418.o7EEI2e4029901@svn.freebsd.org> From: Adrian Chadd Date: Sat, 14 Aug 2010 14:18: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: r211303 - 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: Sat, 14 Aug 2010 14:18:03 -0000 Author: adrian Date: Sat Aug 14 14:18:02 2010 New Revision: 211303 URL: http://svn.freebsd.org/changeset/base/211303 Log: Export ath stats via snmp, rather than requiring a debugging interface and "athstats". Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sat Aug 14 14:13:58 2010 (r211302) +++ head/sys/dev/ath/if_ath.c Sat Aug 14 14:18:02 2010 (r211303) @@ -215,6 +215,7 @@ static void ath_sysctlattach(struct ath_ static int ath_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); static void ath_announce(struct ath_softc *); +static void ath_sysctl_stats_attach(struct ath_softc *sc); #ifdef IEEE80211_SUPPORT_TDMA static void ath_tdma_settimers(struct ath_softc *sc, u_int32_t nexttbtt, @@ -733,6 +734,7 @@ ath_attach(u_int16_t devid, struct ath_s * regdomain are available from the hal. */ ath_sysctlattach(sc); + ath_sysctl_stats_attach(sc); if (bootverbose) ieee80211_announce(ic); @@ -7328,3 +7330,189 @@ ath_tdma_beacon_send(struct ath_softc *s } } #endif /* IEEE80211_SUPPORT_TDMA */ + +static int +ath_sysctl_clearstats(SYSCTL_HANDLER_ARGS) +{ + struct ath_softc *sc = arg1; + int val = 0; + int error; + + error = sysctl_handle_int(oidp, &val, 0, req); + if (error || !req->newptr) + return error; + if (val == 0) + return 0; /* Not clearing the stats is still valid */ + memset(&sc->sc_stats, 0, sizeof(sc->sc_stats)); + val = 0; + return 0; +} + +static void +ath_sysctl_stats_attach(struct ath_softc *sc) +{ + struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev); + struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev); + struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree); + + /* Create "clear" node */ + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "clear_stats", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + ath_sysctl_clearstats, "I", "clear stats"); + + /* Create stats node */ + tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "Statistics"); + child = SYSCTL_CHILDREN(tree); + + /* This was generated from if_athioctl.h */ + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_watchdog", CTLFLAG_RD, + &sc->sc_stats.ast_watchdog, 0, "device reset by watchdog"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_hardware", CTLFLAG_RD, + &sc->sc_stats.ast_hardware, 0, "fatal hardware error interrupts"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_bmiss", CTLFLAG_RD, + &sc->sc_stats.ast_bmiss, 0, "beacon miss interrupts"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_bmiss_phantom", CTLFLAG_RD, + &sc->sc_stats.ast_bmiss_phantom, 0, "beacon miss interrupts"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_bstuck", CTLFLAG_RD, + &sc->sc_stats.ast_bstuck, 0, "beacon stuck interrupts"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rxorn", CTLFLAG_RD, + &sc->sc_stats.ast_rxorn, 0, "rx overrun interrupts"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rxeol", CTLFLAG_RD, + &sc->sc_stats.ast_rxeol, 0, "rx eol interrupts"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_txurn", CTLFLAG_RD, + &sc->sc_stats.ast_txurn, 0, "tx underrun interrupts"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_mib", CTLFLAG_RD, + &sc->sc_stats.ast_mib, 0, "mib interrupts"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_intrcoal", CTLFLAG_RD, + &sc->sc_stats.ast_intrcoal, 0, "interrupts coalesced"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_packets", CTLFLAG_RD, + &sc->sc_stats.ast_tx_packets, 0, "packet sent on the interface"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_mgmt", CTLFLAG_RD, + &sc->sc_stats.ast_tx_mgmt, 0, "management frames transmitted"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_discard", CTLFLAG_RD, + &sc->sc_stats.ast_tx_discard, 0, "frames discarded prior to assoc"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_qstop", CTLFLAG_RD, + &sc->sc_stats.ast_tx_qstop, 0, "output stopped 'cuz no buffer"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_encap", CTLFLAG_RD, + &sc->sc_stats.ast_tx_encap, 0, "tx encapsulation failed"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_nonode", CTLFLAG_RD, + &sc->sc_stats.ast_tx_nonode, 0, "tx failed 'cuz no node"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_nombuf", CTLFLAG_RD, + &sc->sc_stats.ast_tx_nombuf, 0, "tx failed 'cuz no mbuf"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_nomcl", CTLFLAG_RD, + &sc->sc_stats.ast_tx_nomcl, 0, "tx failed 'cuz no cluster"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_linear", CTLFLAG_RD, + &sc->sc_stats.ast_tx_linear, 0, "tx linearized to cluster"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_nodata", CTLFLAG_RD, + &sc->sc_stats.ast_tx_nodata, 0, "tx discarded empty frame"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_busdma", CTLFLAG_RD, + &sc->sc_stats.ast_tx_busdma, 0, "tx failed for dma resrcs"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_xretries", CTLFLAG_RD, + &sc->sc_stats.ast_tx_xretries, 0, "tx failed 'cuz too many retries"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_fifoerr", CTLFLAG_RD, + &sc->sc_stats.ast_tx_fifoerr, 0, "tx failed 'cuz FIFO underrun"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_filtered", CTLFLAG_RD, + &sc->sc_stats.ast_tx_filtered, 0, "tx failed 'cuz xmit filtered"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_shortretry", CTLFLAG_RD, + &sc->sc_stats.ast_tx_shortretry, 0, "tx on-chip retries (short)"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_longretry", CTLFLAG_RD, + &sc->sc_stats.ast_tx_longretry, 0, "tx on-chip retries (long)"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_badrate", CTLFLAG_RD, + &sc->sc_stats.ast_tx_badrate, 0, "tx failed 'cuz bogus xmit rate"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_noack", CTLFLAG_RD, + &sc->sc_stats.ast_tx_noack, 0, "tx frames with no ack marked"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_rts", CTLFLAG_RD, + &sc->sc_stats.ast_tx_rts, 0, "tx frames with rts enabled"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_cts", CTLFLAG_RD, + &sc->sc_stats.ast_tx_cts, 0, "tx frames with cts enabled"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_shortpre", CTLFLAG_RD, + &sc->sc_stats.ast_tx_shortpre, 0, "tx frames with short preamble"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_altrate", CTLFLAG_RD, + &sc->sc_stats.ast_tx_altrate, 0, "tx frames with alternate rate"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_protect", CTLFLAG_RD, + &sc->sc_stats.ast_tx_protect, 0, "tx frames with protection"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_ctsburst", CTLFLAG_RD, + &sc->sc_stats.ast_tx_ctsburst, 0, "tx frames with cts and bursting"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_ctsext", CTLFLAG_RD, + &sc->sc_stats.ast_tx_ctsext, 0, "tx frames with cts extension"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_nombuf", CTLFLAG_RD, + &sc->sc_stats.ast_rx_nombuf, 0, "rx setup failed 'cuz no mbuf"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_busdma", CTLFLAG_RD, + &sc->sc_stats.ast_rx_busdma, 0, "rx setup failed for dma resrcs"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_orn", CTLFLAG_RD, + &sc->sc_stats.ast_rx_orn, 0, "rx failed 'cuz of desc overrun"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_crcerr", CTLFLAG_RD, + &sc->sc_stats.ast_rx_crcerr, 0, "rx failed 'cuz of bad CRC"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_fifoerr", CTLFLAG_RD, + &sc->sc_stats.ast_rx_fifoerr, 0, "rx failed 'cuz of FIFO overrun"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_badcrypt", CTLFLAG_RD, + &sc->sc_stats.ast_rx_badcrypt, 0, "rx failed 'cuz decryption"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_badmic", CTLFLAG_RD, + &sc->sc_stats.ast_rx_badmic, 0, "rx failed 'cuz MIC failure"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_phyerr", CTLFLAG_RD, + &sc->sc_stats.ast_rx_phyerr, 0, "rx failed 'cuz of PHY err"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_tooshort", CTLFLAG_RD, + &sc->sc_stats.ast_rx_tooshort, 0, "rx discarded 'cuz frame too short"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_toobig", CTLFLAG_RD, + &sc->sc_stats.ast_rx_toobig, 0, "rx discarded 'cuz frame too large"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_packets", CTLFLAG_RD, + &sc->sc_stats.ast_rx_packets, 0, "packet recv on the interface"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_mgt", CTLFLAG_RD, + &sc->sc_stats.ast_rx_mgt, 0, "management frames received"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_ctl", CTLFLAG_RD, + &sc->sc_stats.ast_rx_ctl, 0, "rx discarded 'cuz ctl frame"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_be_xmit", CTLFLAG_RD, + &sc->sc_stats.ast_be_xmit, 0, "beacons transmitted"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_be_nombuf", CTLFLAG_RD, + &sc->sc_stats.ast_be_nombuf, 0, "beacon setup failed 'cuz no mbuf"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_per_cal", CTLFLAG_RD, + &sc->sc_stats.ast_per_cal, 0, "periodic calibration calls"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_per_calfail", CTLFLAG_RD, + &sc->sc_stats.ast_per_calfail, 0, "periodic calibration failed"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_per_rfgain", CTLFLAG_RD, + &sc->sc_stats.ast_per_rfgain, 0, "periodic calibration rfgain reset"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rate_calls", CTLFLAG_RD, + &sc->sc_stats.ast_rate_calls, 0, "rate control checks"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rate_raise", CTLFLAG_RD, + &sc->sc_stats.ast_rate_raise, 0, "rate control raised xmit rate"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rate_drop", CTLFLAG_RD, + &sc->sc_stats.ast_rate_drop, 0, "rate control dropped xmit rate"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_ant_defswitch", CTLFLAG_RD, + &sc->sc_stats.ast_ant_defswitch, 0, "rx/default antenna switches"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_ant_txswitch", CTLFLAG_RD, + &sc->sc_stats.ast_ant_txswitch, 0, "tx antenna switches"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_cabq_xmit", CTLFLAG_RD, + &sc->sc_stats.ast_cabq_xmit, 0, "cabq frames transmitted"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_cabq_busy", CTLFLAG_RD, + &sc->sc_stats.ast_cabq_busy, 0, "cabq found busy"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_raw", CTLFLAG_RD, + &sc->sc_stats.ast_tx_raw, 0, "tx frames through raw api"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_ff_txok", CTLFLAG_RD, + &sc->sc_stats.ast_ff_txok, 0, "fast frames tx'd successfully"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_ff_txerr", CTLFLAG_RD, + &sc->sc_stats.ast_ff_txerr, 0, "fast frames tx'd w/ error"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_ff_rx", CTLFLAG_RD, + &sc->sc_stats.ast_ff_rx, 0, "fast frames rx'd"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_ff_flush", CTLFLAG_RD, + &sc->sc_stats.ast_ff_flush, 0, "fast frames flushed from staging q"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_qfull", CTLFLAG_RD, + &sc->sc_stats.ast_tx_qfull, 0, "tx dropped 'cuz of queue limit"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_nobuf", CTLFLAG_RD, + &sc->sc_stats.ast_tx_nobuf, 0, "tx dropped 'cuz no ath buffer"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tdma_update", CTLFLAG_RD, + &sc->sc_stats.ast_tdma_update, 0, "TDMA slot timing updates"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tdma_timers", CTLFLAG_RD, + &sc->sc_stats.ast_tdma_timers, 0, "TDMA slot update set beacon timers"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tdma_tsf", CTLFLAG_RD, + &sc->sc_stats.ast_tdma_tsf, 0, "TDMA slot update set TSF"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tdma_ack", CTLFLAG_RD, + &sc->sc_stats.ast_tdma_ack, 0, "TDMA tx failed 'cuz ACK required"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_raw_fail", CTLFLAG_RD, + &sc->sc_stats.ast_tx_raw_fail, 0, "raw tx failed 'cuz h/w down"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_nofrag", CTLFLAG_RD, + &sc->sc_stats.ast_tx_nofrag, 0, "tx dropped 'cuz no ath frag buffer"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_be_missed", CTLFLAG_RD, + &sc->sc_stats.ast_be_missed, 0, "number of -missed- beacons"); +} From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 14:34:36 2010 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 9F631106566B; Sat, 14 Aug 2010 14:34:36 +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 848BC8FC1C; Sat, 14 Aug 2010 14:34:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EEYaAR030304; Sat, 14 Aug 2010 14:34:36 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EEYaSA030301; Sat, 14 Aug 2010 14:34:36 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201008141434.o7EEYaSA030301@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Sat, 14 Aug 2010 14:34: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: r211304 - head/lib/libutil 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, 14 Aug 2010 14:34:36 -0000 Author: des Date: Sat Aug 14 14:34:36 2010 New Revision: 211304 URL: http://svn.freebsd.org/changeset/base/211304 Log: Simplify expand_number() by combining the (unrolled) loop with the switch. Since expand_number() does not accept negative numbers, switch from int64_t to uint64_t; this makes it easier to check for overflow. MFC after: 3 weeks Modified: head/lib/libutil/expand_number.c head/lib/libutil/libutil.h Modified: head/lib/libutil/expand_number.c ============================================================================== --- head/lib/libutil/expand_number.c Sat Aug 14 14:18:02 2010 (r211303) +++ head/lib/libutil/expand_number.c Sat Aug 14 14:34:36 2010 (r211304) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); /* * Convert an expression of the following forms to a int64_t. - * 1) A positive decimal number. + * 1) A positive decimal number. * 2) A positive decimal number followed by a 'b' or 'B' (mult by 1). * 3) A positive decimal number followed by a 'k' or 'K' (mult by 1 << 10). * 4) A positive decimal number followed by a 'm' or 'M' (mult by 1 << 20). @@ -47,14 +47,12 @@ __FBSDID("$FreeBSD$"); * 8) A positive decimal number followed by a 'e' or 'E' (mult by 1 << 60). */ int -expand_number(const char *buf, int64_t *num) +expand_number(const char *buf, uint64_t *num) { - static const char unit[] = "bkmgtpe"; - char *endptr, s; - int64_t number; - int i; + uint64_t number; + char *endptr; - number = strtoimax(buf, &endptr, 0); + number = strtoumax(buf, &endptr, 0); if (endptr == buf) { /* No valid digits. */ @@ -68,15 +66,23 @@ expand_number(const char *buf, int64_t * return (0); } - s = tolower(*endptr); - switch (s) { - case 'b': - case 'k': - case 'm': - case 'g': - case 't': - case 'p': +#define SHIFT(n, b) \ + do { if ((n << b) < n) goto overflow; n <<= b; } while (0) + + switch (tolower((unsigned char)*endptr)) { case 'e': + SHIFT(number, 10); + case 'p': + SHIFT(number, 10); + case 't': + SHIFT(number, 10); + case 'g': + SHIFT(number, 10); + case 'm': + SHIFT(number, 10); + case 'k': + SHIFT(number, 10); + case 'b': break; default: /* Unrecognized unit. */ @@ -84,17 +90,11 @@ expand_number(const char *buf, int64_t * return (-1); } - for (i = 0; unit[i] != '\0'; i++) { - if (s == unit[i]) - break; - if ((number < 0 && (number << 10) > number) || - (number >= 0 && (number << 10) < number)) { - errno = ERANGE; - return (-1); - } - number <<= 10; - } - *num = number; return (0); + +overflow: + /* Overflow */ + errno = ERANGE; + return (-1); } Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Sat Aug 14 14:18:02 2010 (r211303) +++ head/lib/libutil/libutil.h Sat Aug 14 14:34:36 2010 (r211304) @@ -109,7 +109,7 @@ int forkpty(int *_amaster, char *_name, struct termios *_termp, struct winsize *_winp); int humanize_number(char *_buf, size_t _len, int64_t _number, const char *_suffix, int _scale, int _flags); -int expand_number(const char *_buf, int64_t *_num); +int expand_number(const char *_buf, uint64_t *_num); const char *uu_lockerr(int _uu_lockresult); int uu_lock(const char *_ttyname); int uu_unlock(const char *_ttyname); From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 14:45:31 2010 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 8F75D1065694; Sat, 14 Aug 2010 14:45:31 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8A0F78FC0A; Sat, 14 Aug 2010 14:45:30 +0000 (UTC) Received: by ewy26 with SMTP id 26so2122509ewy.13 for ; Sat, 14 Aug 2010 07:45:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=LsRW74GpwSUYS9IezoxitKBnxGql5e/waqummfSkk5U=; b=PSocU+rPjOyJFFN2ymaX2g7QQzDJNyYcsNKp3W7BMA/65ZLBzwdViB6brbi9gqoAvC DjC5kKcOhXcJhPvB1foXiTm5BbHLyQ/FES1mHGphGoj/Jqrx6a+kVmSsVWT39DMCvEJf XmyWw/FceDMgLN7/rXqzTvWBMHB6LEzBGjhzs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Ac9qhYQVNWhc/x7HN9VEEfnlMTkhjF5WC7aoyqvv75l1FUZxsUM7zh/VL0HkjRikVu 0HYY+bvspxZiCW7D+qT5isrxLrFn49agvifdTTNIOrR7DjjUHRh+swHdNpFku5tJKGqS CWZsEDfZdeZ2alVEp3+5+3L+QzHEw9buR1H3Y= MIME-Version: 1.0 Received: by 10.213.28.194 with SMTP id n2mr3124425ebc.16.1281797129433; Sat, 14 Aug 2010 07:45:29 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.213.10.196 with HTTP; Sat, 14 Aug 2010 07:45:29 -0700 (PDT) In-Reply-To: <201008141434.o7EEYaSA030301@svn.freebsd.org> References: <201008141434.o7EEYaSA030301@svn.freebsd.org> Date: Sat, 14 Aug 2010 14:45:29 +0000 X-Google-Sender-Auth: yuLW8NmTYaD6zS_35yLQCTDx9fQ Message-ID: From: mdf@FreeBSD.org To: Dag-Erling Smorgrav Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211304 - head/lib/libutil 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, 14 Aug 2010 14:45:31 -0000 On Sat, Aug 14, 2010 at 2:34 PM, Dag-Erling Smorgrav wrot= e: > Author: des > Date: Sat Aug 14 14:34:36 2010 > New Revision: 211304 > URL: http://svn.freebsd.org/changeset/base/211304 > > Log: > =A0Simplify expand_number() by combining the (unrolled) loop with the > =A0switch. =A0Since expand_number() does not accept negative numbers, swi= tch > =A0from int64_t to uint64_t; this makes it easier to check for overflow. > > =A0MFC after: =A0 =A03 weeks > > Modified: > =A0head/lib/libutil/expand_number.c > =A0head/lib/libutil/libutil.h > > Modified: head/lib/libutil/expand_number.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/libutil/expand_number.c =A0 =A0Sat Aug 14 14:18:02 2010 =A0 = =A0 =A0 =A0(r211303) > +++ head/lib/libutil/expand_number.c =A0 =A0Sat Aug 14 14:34:36 2010 =A0 = =A0 =A0 =A0(r211304) > @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); > > =A0/* > =A0* Convert an expression of the following forms to a int64_t. > - * =A0 =A0 1) A positive decimal number. > + * =A0 =A0 1) A positive decimal number. > =A0* =A0 =A0 2) A positive decimal number followed by a 'b' or 'B' (mult = by 1). > =A0* =A0 =A0 3) A positive decimal number followed by a 'k' or 'K' (mult = by 1 << 10). > =A0* =A0 =A0 4) A positive decimal number followed by a 'm' or 'M' (mult = by 1 << 20). > @@ -47,14 +47,12 @@ __FBSDID("$FreeBSD$"); > =A0* =A0 =A0 8) A positive decimal number followed by a 'e' or 'E' (mult = by 1 << 60). > =A0*/ > =A0int > -expand_number(const char *buf, int64_t *num) > +expand_number(const char *buf, uint64_t *num) > =A0{ > - =A0 =A0 =A0 static const char unit[] =3D "bkmgtpe"; > - =A0 =A0 =A0 char *endptr, s; > - =A0 =A0 =A0 int64_t number; > - =A0 =A0 =A0 int i; > + =A0 =A0 =A0 uint64_t number; > + =A0 =A0 =A0 char *endptr; > > - =A0 =A0 =A0 number =3D strtoimax(buf, &endptr, 0); > + =A0 =A0 =A0 number =3D strtoumax(buf, &endptr, 0); > > =A0 =A0 =A0 =A0if (endptr =3D=3D buf) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* No valid digits. */ > @@ -68,15 +66,23 @@ expand_number(const char *buf, int64_t * > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (0); > =A0 =A0 =A0 =A0} > > - =A0 =A0 =A0 s =3D tolower(*endptr); > - =A0 =A0 =A0 switch (s) { > - =A0 =A0 =A0 case 'b': > - =A0 =A0 =A0 case 'k': > - =A0 =A0 =A0 case 'm': > - =A0 =A0 =A0 case 'g': > - =A0 =A0 =A0 case 't': > - =A0 =A0 =A0 case 'p': > +#define SHIFT(n, b) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\ > + =A0 =A0 =A0 do { if ((n << b) < n) goto overflow; n <<=3D b; } while (0= ) I think it's possible for the number to overflow but also not shrink. e.g. 0x12345678T. Perhaps if (((n << b) >> b) !=3D n) would be better. Thanks, matthew > + > + =A0 =A0 =A0 switch (tolower((unsigned char)*endptr)) { > =A0 =A0 =A0 =A0case 'e': > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 SHIFT(number, 10); > + =A0 =A0 =A0 case 'p': > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 SHIFT(number, 10); > + =A0 =A0 =A0 case 't': > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 SHIFT(number, 10); > + =A0 =A0 =A0 case 'g': > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 SHIFT(number, 10); > + =A0 =A0 =A0 case 'm': > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 SHIFT(number, 10); > + =A0 =A0 =A0 case 'k': > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 SHIFT(number, 10); > + =A0 =A0 =A0 case 'b': > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > =A0 =A0 =A0 =A0default: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Unrecognized unit. */ > @@ -84,17 +90,11 @@ expand_number(const char *buf, int64_t * > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (-1); > =A0 =A0 =A0 =A0} > > - =A0 =A0 =A0 for (i =3D 0; unit[i] !=3D '\0'; i++) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (s =3D=3D unit[i]) > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((number < 0 && (number << 10) > number)= || > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (number >=3D 0 && (number << 10) < = number)) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 errno =3D ERANGE; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (-1); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 number <<=3D 10; > - =A0 =A0 =A0 } > - > =A0 =A0 =A0 =A0*num =3D number; > =A0 =A0 =A0 =A0return (0); > + > +overflow: > + =A0 =A0 =A0 /* Overflow */ > + =A0 =A0 =A0 errno =3D ERANGE; > + =A0 =A0 =A0 return (-1); > =A0} > > Modified: head/lib/libutil/libutil.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/lib/libutil/libutil.h =A0Sat Aug 14 14:18:02 2010 =A0 =A0 =A0 = =A0(r211303) > +++ head/lib/libutil/libutil.h =A0Sat Aug 14 14:34:36 2010 =A0 =A0 =A0 = =A0(r211304) > @@ -109,7 +109,7 @@ int forkpty(int *_amaster, char *_name, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct termios *_termp, struct wi= nsize *_winp); > =A0int =A0 =A0humanize_number(char *_buf, size_t _len, int64_t _number, > =A0 =A0 =A0 =A0 =A0 =A0const char *_suffix, int _scale, int _flags); > -int =A0 =A0expand_number(const char *_buf, int64_t *_num); > +int =A0 =A0expand_number(const char *_buf, uint64_t *_num); > =A0const char *uu_lockerr(int _uu_lockresult); > =A0int =A0 =A0uu_lock(const char *_ttyname); > =A0int =A0 =A0uu_unlock(const char *_ttyname); > From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 15:16:51 2010 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 DB50A106571D; Sat, 14 Aug 2010 15:16:51 +0000 (UTC) (envelope-from rpaulo@freebsd.org) Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by mx1.freebsd.org (Postfix) with ESMTP id B227C8FC13; Sat, 14 Aug 2010 15:16:51 +0000 (UTC) Received: from e.earth.lavabit.com (e.earth.lavabit.com [192.168.111.14]) by karen.lavabit.com (Postfix) with ESMTP id B2C6711B817; Sat, 14 Aug 2010 10:16:50 -0500 (CDT) Received: from 10.0.10.3 (54.81.54.77.rev.vodafone.pt [77.54.81.54]) by lavabit.com with ESMTP id 8DJODNJY7E5B; Sat, 14 Aug 2010 10:16:50 -0500 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Rui Paulo In-Reply-To: <201008141418.o7EEI2e4029901@svn.freebsd.org> Date: Sat, 14 Aug 2010 16:16:47 +0100 Content-Transfer-Encoding: 7bit Message-Id: <132563D7-593D-406D-A47A-295B77BC30CF@FreeBSD.org> References: <201008141418.o7EEI2e4029901@svn.freebsd.org> To: Adrian Chadd X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211303 - 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: Sat, 14 Aug 2010 15:16:52 -0000 On 14 Aug 2010, at 15:18, Adrian Chadd wrote: > Author: adrian > Date: Sat Aug 14 14:18:02 2010 > New Revision: 211303 > URL: http://svn.freebsd.org/changeset/base/211303 > > Log: > Export ath stats via snmp, rather than requiring a debugging interface > and "athstats". Don't you mean sysctl? Regards, -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 15:26:49 2010 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 E8F781065697; Sat, 14 Aug 2010 15:26:49 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 2819D8FC15; Sat, 14 Aug 2010 15:26:48 +0000 (UTC) Received: by eyh6 with SMTP id 6so2127035eyh.13 for ; Sat, 14 Aug 2010 08:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=rOsAsS2FtJMeDmwcJRVJEI9Hbgj4LL3kPGhxN9yadJQ=; b=jSf1RurgiV8CLbvFcXukZEVJM6ozTfOHSvJ48ZOpFlsdfkU6iXTJE/e+rAF4o+7xuA 7lvDEUm+ceoO75bkNUoIkDjpcYhU0neFwL/lCYB8orv9cF2BpLDxnRMc5wt5HzsxMOa4 3YajJ8gtlDwe7RYbPcHgvlW5KWBxRQvSX60Hg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=QaG8MKoOTGM69rpbIRLW4vxxWlT3Vd65QOFsQ6r8UD34/xliQHYQKF8qdR8QnxlDHl gif47ufm02bH28/+jE1e2gHccUG5Kkj+HpWeRJ2oPrCF0yKfxaQrngCeWyKfLNBskvNm PpVumKFFuL/2t9BeBNkq4t2T+UIpWkWJpLSB0= MIME-Version: 1.0 Received: by 10.213.14.78 with SMTP id f14mr737313eba.79.1281799607791; Sat, 14 Aug 2010 08:26:47 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.213.112.140 with HTTP; Sat, 14 Aug 2010 08:26:47 -0700 (PDT) In-Reply-To: <132563D7-593D-406D-A47A-295B77BC30CF@FreeBSD.org> References: <201008141418.o7EEI2e4029901@svn.freebsd.org> <132563D7-593D-406D-A47A-295B77BC30CF@FreeBSD.org> Date: Sat, 14 Aug 2010 23:26:47 +0800 X-Google-Sender-Auth: JBq_zDgK0QgVcxTI6dUJES83tuU Message-ID: From: Adrian Chadd To: Rui Paulo Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211303 - 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: Sat, 14 Aug 2010 15:26:50 -0000 I do, sorry. I had SNMP on the brain at that point (as I actually have a local bsnmpd module which exports those sysctl's via SNMP.) adrian On 14 August 2010 23:16, Rui Paulo wrote: > > On 14 Aug 2010, at 15:18, Adrian Chadd wrote: > >> Author: adrian >> Date: Sat Aug 14 14:18:02 2010 >> New Revision: 211303 >> URL: http://svn.freebsd.org/changeset/base/211303 >> >> Log: >> =A0Export ath stats via snmp, rather than requiring a debugging interfac= e >> =A0and "athstats". > > Don't you mean sysctl? > > Regards, > -- > Rui Paulo > > > From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 15:28:15 2010 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 DBDED1065693; Sat, 14 Aug 2010 15:28:15 +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 CAEC48FC17; Sat, 14 Aug 2010 15:28:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EFSFgH031536; Sat, 14 Aug 2010 15:28:15 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EFSFCr031534; Sat, 14 Aug 2010 15:28:15 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008141528.o7EFSFCr031534@svn.freebsd.org> From: Adrian Chadd Date: Sat, 14 Aug 2010 15:28: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: r211306 - 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: Sat, 14 Aug 2010 15:28:16 -0000 Author: adrian Date: Sat Aug 14 15:28:15 2010 New Revision: 211306 URL: http://svn.freebsd.org/changeset/base/211306 Log: Fix the calibration logic to correctly clamp the calculated coefficient. Obtained from: OpenWRT r22123, 521-ath9k_iqcal_fix.patch Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal_iq.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal_iq.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal_iq.c Sat Aug 14 15:21:06 2010 (r211305) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal_iq.c Sat Aug 14 15:28:15 2010 (r211306) @@ -115,7 +115,7 @@ ar5416IQCalibration(struct ath_hal *ah, if (qCoff > 15) qCoff = 15; else if (qCoff <= -16) - qCoff = 16; + qCoff = -16; HALDEBUG(ah, HAL_DEBUG_PERCAL, " : iCoff = 0x%x qCoff = 0x%x\n", iCoff, qCoff); From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 15:29:21 2010 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 E7A181065698; Sat, 14 Aug 2010 15:29:21 +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 BC6178FC0A; Sat, 14 Aug 2010 15:29:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EFTLvx031595; Sat, 14 Aug 2010 15:29:21 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EFTLp6031592; Sat, 14 Aug 2010 15:29:21 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008141529.o7EFTLp6031592@svn.freebsd.org> From: Adrian Chadd Date: Sat, 14 Aug 2010 15:29: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: r211307 - 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: Sat, 14 Aug 2010 15:29:22 -0000 Author: adrian Date: Sat Aug 14 15:29:21 2010 New Revision: 211307 URL: http://svn.freebsd.org/changeset/base/211307 Log: Merge in a fix for the power/(gain?) calculation. Apply it to both the 5416/9160 and 9285 code paths. Obtained from: OpenWRT r22123, 522-ath9k_pwrcal_fix.patch Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sat Aug 14 15:28:15 2010 (r211306) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sat Aug 14 15:29:21 2010 (r211307) @@ -2008,7 +2008,7 @@ ar5416GetGainBoundariesAndPdadcs(struct * for last gain, pdGainBoundary == Pmax_t2, so will * have to extrapolate */ - if (tgtIndex > maxIndex) { /* need to extrapolate above */ + if (tgtIndex >= maxIndex) { /* need to extrapolate above */ while ((ss <= tgtIndex) && (k < (AR5416_NUM_PDADC_VALUES - 1))) { tmpVal = (int16_t)((vpdTableI[i][sizeCurrVpdTable - 1] + (ss - maxIndex +1) * vpdStep)); Modified: head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c Sat Aug 14 15:28:15 2010 (r211306) +++ head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c Sat Aug 14 15:29:21 2010 (r211307) @@ -792,7 +792,7 @@ ar9285GetGainBoundariesAndPdadcs(struct * for last gain, pdGainBoundary == Pmax_t2, so will * have to extrapolate */ - if (tgtIndex > maxIndex) { /* need to extrapolate above */ + if (tgtIndex >= maxIndex) { /* need to extrapolate above */ while ((ss <= tgtIndex) && (k < (AR5416_NUM_PDADC_VALUES - 1))) { tmpVal = (int16_t)((vpdTableI[i][sizeCurrVpdTable - 1] + (ss - maxIndex +1) * vpdStep)); From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 15:46:19 2010 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 4C033106564A; Sat, 14 Aug 2010 15:46:19 +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 3A3088FC12; Sat, 14 Aug 2010 15:46:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EFkJGb032008; Sat, 14 Aug 2010 15:46:19 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EFkJQx032006; Sat, 14 Aug 2010 15:46:19 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008141546.o7EFkJQx032006@svn.freebsd.org> From: Adrian Chadd Date: Sat, 14 Aug 2010 15:46: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: r211308 - 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: Sat, 14 Aug 2010 15:46:19 -0000 Author: adrian Date: Sat Aug 14 15:46:18 2010 New Revision: 211308 URL: http://svn.freebsd.org/changeset/base/211308 Log: * Merge in AR9160 initval updates from Linux-2.6.34. * Grab the AR_PHY_CCA and AR_PHY_EXT_CCA initvals from Linux wireless-testing. Obtained from: Linux-2.6.34 Modified: head/sys/dev/ath/ath_hal/ar5416/ar9160.ini Modified: head/sys/dev/ath/ath_hal/ar5416/ar9160.ini ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar9160.ini Sat Aug 14 15:29:21 2010 (r211307) +++ head/sys/dev/ath/ath_hal/ar5416/ar9160.ini Sat Aug 14 15:46:18 2010 (r211308) @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting - * Copyright (c) 2002-2008 Atheros Communications, Inc. + * Copyright (c) 2002-2009 Atheros Communications, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -35,22 +35,24 @@ static const uint32_t ar9160Modes[][6] = { 0x00009848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68, 0x00197a68 }, { 0x0000a848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68, 0x00197a68 }, { 0x0000b848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68, 0x00197a68 }, - { 0x00009850, 0x6d48b4e2, 0x6d48b4e2, 0x6d48b0e2, 0x6d48b0e2, 0x6d48b0e2 }, + { 0x00009850, 0x6c48b4e2, 0x6c48b4e2, 0x6c48b0e2, 0x6c48b0e2, 0x6c48b0e2 }, { 0x00009858, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e }, - { 0x0000985c, 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e }, + { 0x0000985c, 0x31395d5e, 0x31395d5e, 0x31395d5e, 0x31395d5e, 0x31395d5e }, { 0x00009860, 0x00048d18, 0x00048d18, 0x00048d20, 0x00048d20, 0x00048d18 }, + { 0x00009864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 }, { 0x0000c864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 }, { 0x00009868, 0x409a40d0, 0x409a40d0, 0x409a40d0, 0x409a40d0, 0x409a40d0 }, { 0x0000986c, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 }, - { 0x00009914, 0x000007d0, 0x000007d0, 0x00000898, 0x00000898, 0x000007d0 }, + { 0x00009914, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898, 0x000007d0 }, { 0x00009918, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b, 0x00000016 }, { 0x00009924, 0xd00a8a07, 0xd00a8a07, 0xd00a8a0d, 0xd00a8a0d, 0xd00a8a0d }, - { 0x00009944, 0xdfb81020, 0xdfb81020, 0xdfb81020, 0xdfb81020, 0xdfb81020 }, + { 0x00009944, 0xffb81020, 0xffb81020, 0xffb81020, 0xffb81020, 0xffb81020 }, { 0x00009960, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40 }, { 0x0000a960, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40 }, { 0x0000b960, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40 }, { 0x00009964, 0x00001120, 0x00001120, 0x00001120, 0x00001120, 0x00001120 }, { 0x0000c968, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce, 0x000003ce }, + { 0x000099bc, 0x001a0600, 0x001a0600, 0x001a0c00, 0x001a0c00, 0x001a0c00 }, { 0x0000c9bc, 0x001a0600, 0x001a0600, 0x001a0c00, 0x001a0c00, 0x001a0c00 }, { 0x000099c0, 0x038919be, 0x038919be, 0x038919be, 0x038919be, 0x038919be }, { 0x000099c4, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77 }, @@ -212,7 +214,7 @@ static const uint32_t ar9160Common[][2] { 0x00008134, 0x00000000 }, { 0x00008138, 0x00000000 }, { 0x0000813c, 0x00000000 }, - { 0x00008144, 0x00000000 }, + { 0x00008144, 0xffffffff }, { 0x00008168, 0x00000000 }, { 0x0000816c, 0x00000000 }, { 0x00008170, 0x32143320 }, @@ -271,7 +273,7 @@ static const uint32_t ar9160Common[][2] { 0x0000832c, 0x00000007 }, { 0x00008330, 0x00000302 }, { 0x00008334, 0x00000e00 }, - { 0x00008338, 0x00000000 }, + { 0x00008338, 0x00ff0000 }, { 0x0000833c, 0x00000000 }, { 0x00008340, 0x000107ff }, { 0x00009808, 0x00000000 }, @@ -405,7 +407,7 @@ static const uint32_t ar9160Common[][2] { 0x0000a244, 0x00007bb6 }, { 0x0000a248, 0x0fff3ffc }, { 0x0000a24c, 0x00000001 }, - { 0x0000a250, 0x0000a000 }, + { 0x0000a250, 0x0000e000 }, { 0x0000a254, 0x00000000 }, { 0x0000a258, 0x0cc75380 }, { 0x0000a25c, 0x0f0f0f01 }, @@ -425,7 +427,7 @@ static const uint32_t ar9160Common[][2] { 0x0000a34c, 0x3fffffff }, { 0x0000a350, 0x3fffffff }, { 0x0000a354, 0x0003ffff }, - { 0x0000a358, 0x79a8aa33 }, + { 0x0000a358, 0x79bfaa03 }, { 0x0000d35c, 0x07ffffef }, { 0x0000d360, 0x0fffffe7 }, { 0x0000d364, 0x17ffffe5 }, From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 15:48:19 2010 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 15C7410656A6; Sat, 14 Aug 2010 15:48:19 +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 0505D8FC19; Sat, 14 Aug 2010 15:48:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EFmIfS032085; Sat, 14 Aug 2010 15:48:18 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EFmIlC032083; Sat, 14 Aug 2010 15:48:18 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201008141548.o7EFmIlC032083@svn.freebsd.org> From: Adrian Chadd Date: Sat, 14 Aug 2010 15:48: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: r211309 - 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: Sat, 14 Aug 2010 15:48:19 -0000 Author: adrian Date: Sat Aug 14 15:48:18 2010 New Revision: 211309 URL: http://svn.freebsd.org/changeset/base/211309 Log: A local addition, not imported from ath9k. AR_PHY_CALMODE is explicitly reset on interface reset for other chipsets; this commit also sets it for the AR9160. Modified: head/sys/dev/ath/ath_hal/ar5416/ar9160.ini Modified: head/sys/dev/ath/ath_hal/ar5416/ar9160.ini ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar9160.ini Sat Aug 14 15:46:18 2010 (r211308) +++ head/sys/dev/ath/ath_hal/ar5416/ar9160.ini Sat Aug 14 15:48:18 2010 (r211309) @@ -328,6 +328,7 @@ static const uint32_t ar9160Common[][2] { 0x000099e4, 0xaaaaaaaa }, { 0x000099e8, 0x3c466478 }, { 0x000099ec, 0x0cc80caa }, + { 0x000099f0, 0x00000000 }, /* XXX adrian's addition: AR_PHY_CALMODE == 0 */ { 0x000099fc, 0x00001042 }, { 0x00009b00, 0x00000000 }, { 0x00009b04, 0x00000001 }, From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 18:40:06 2010 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 1E8421065672; Sat, 14 Aug 2010 18:40:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E71768FC0C; Sat, 14 Aug 2010 18:40:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EIe5g5035715; Sat, 14 Aug 2010 18:40:05 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EIe5ju035714; Sat, 14 Aug 2010 18:40:05 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201008141840.o7EIe5ju035714@svn.freebsd.org> From: Warner Losh Date: Sat, 14 Aug 2010 18:40:05 +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: r211310 - stable/8/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: Sat, 14 Aug 2010 18:40:06 -0000 Author: imp Date: Sat Aug 14 18:40:05 2010 New Revision: 211310 URL: http://svn.freebsd.org/changeset/base/211310 Log: Map COMPAT_IA32 to COMPAT_FREEBSD32 Added: stable/8/sys/conf/options-compat (contents, props changed) Added: stable/8/sys/conf/options-compat ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/conf/options-compat Sat Aug 14 18:40:05 2010 (r211310) @@ -0,0 +1,2 @@ +# $FreeBSD$ +COMPAT_IA32 COMPAT_FREEBSD32 From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 18:58:05 2010 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 658DF1065679; Sat, 14 Aug 2010 18:58:05 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46F7D8FC15; Sat, 14 Aug 2010 18:58:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EIw5Ec036092; Sat, 14 Aug 2010 18:58:05 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EIw5a4036090; Sat, 14 Aug 2010 18:58:05 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008141858.o7EIw5a4036090@svn.freebsd.org> From: Doug Barton Date: Sat, 14 Aug 2010 18:58:05 +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: r211311 - head/etc 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, 14 Aug 2010 18:58:05 -0000 Author: dougb Date: Sat Aug 14 18:58:05 2010 New Revision: 211311 URL: http://svn.freebsd.org/changeset/base/211311 Log: Give people some warning before removing enable_quotas Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sat Aug 14 18:40:05 2010 (r211310) +++ head/etc/rc.subr Sat Aug 14 18:58:05 2010 (r211311) @@ -1016,9 +1016,9 @@ load_rc_config() . /etc/rc.conf.d/"$_name" fi - # Old variable names support + # Old variable name support -- Remove before 9.0-RELEASE # - [ -n "$enable_quotas" ] && quota_enable="$enable_quotas" + [ -n "$enable_quotas" ] && err 1 "enable_quotas is deprecated, use quotas_enable" # Set defaults if defined. for _var in $rcvar $rcvars; do From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 19:36:49 2010 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 53BFB106564A; Sat, 14 Aug 2010 19:36:49 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 423458FC16; Sat, 14 Aug 2010 19:36:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EJanWD036877; Sat, 14 Aug 2010 19:36:49 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EJanQS036875; Sat, 14 Aug 2010 19:36:49 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201008141936.o7EJanQS036875@svn.freebsd.org> From: Andre Oppermann Date: Sat, 14 Aug 2010 19:36:49 +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: r211312 - stable/8/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, 14 Aug 2010 19:36:49 -0000 Author: andre Date: Sat Aug 14 19:36:48 2010 New Revision: 211312 URL: http://svn.freebsd.org/changeset/base/211312 Log: MFC r210666: Fix a bug in syncache where the initial CWND for new incoming connections was limited to one segment under the faulty assumption of a retransmit. Due to this the opportunity to initialize the increased congestion window according to RFC3390 was missed. Modified: stable/8/sys/netinet/tcp_syncache.c Modified: stable/8/sys/netinet/tcp_syncache.c ============================================================================== --- stable/8/sys/netinet/tcp_syncache.c Sat Aug 14 18:58:05 2010 (r211311) +++ stable/8/sys/netinet/tcp_syncache.c Sat Aug 14 19:36:48 2010 (r211312) @@ -804,8 +804,9 @@ syncache_socket(struct syncache *sc, str /* * If the SYN,ACK was retransmitted, reset cwnd to 1 segment. + * NB: sc_rxmits counts all SYN,ACK transmits, not just retransmits. */ - if (sc->sc_rxmits) + if (sc->sc_rxmits > 1) tp->snd_cwnd = tp->t_maxseg; tcp_timer_activate(tp, TT_KEEP, tcp_keepinit); From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 20:03:33 2010 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 8999810656A3; Sat, 14 Aug 2010 20:03:33 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 780F18FC12; Sat, 14 Aug 2010 20:03:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EK3X8w037450; Sat, 14 Aug 2010 20:03:33 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EK3XW0037448; Sat, 14 Aug 2010 20:03:33 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201008142003.o7EK3XW0037448@svn.freebsd.org> From: Andre Oppermann Date: Sat, 14 Aug 2010 20:03:33 +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: r211313 - stable/7/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, 14 Aug 2010 20:03:33 -0000 Author: andre Date: Sat Aug 14 20:03:32 2010 New Revision: 211313 URL: http://svn.freebsd.org/changeset/base/211313 Log: MFC r210666: Fix a bug in syncache where the initial CWND for new incoming connections was limited to one segment under the faulty assumption of a retransmit. Due to this the opportunity to initialize the increased congestion window according to RFC3390 was missed. Modified: stable/7/sys/netinet/tcp_syncache.c Modified: stable/7/sys/netinet/tcp_syncache.c ============================================================================== --- stable/7/sys/netinet/tcp_syncache.c Sat Aug 14 19:36:48 2010 (r211312) +++ stable/7/sys/netinet/tcp_syncache.c Sat Aug 14 20:03:32 2010 (r211313) @@ -821,8 +821,9 @@ syncache_socket(struct syncache *sc, str /* * If the SYN,ACK was retransmitted, reset cwnd to 1 segment. + * NB: sc_rxmits counts all SYN,ACK transmits, not just retransmits. */ - if (sc->sc_rxmits) + if (sc->sc_rxmits > 1) tp->snd_cwnd = tp->t_maxseg; tcp_timer_activate(tp, TT_KEEP, tcp_keepinit); From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 20:12:11 2010 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 3EF8C1065672; Sat, 14 Aug 2010 20:12:11 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C11E8FC13; Sat, 14 Aug 2010 20:12:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EKCBhc037681; Sat, 14 Aug 2010 20:12:11 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EKCAaD037666; Sat, 14 Aug 2010 20:12:10 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201008142012.o7EKCAaD037666@svn.freebsd.org> From: Bernhard Schmidt Date: Sat, 14 Aug 2010 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: r211314 - in head/sys: dev/bwi dev/bwn dev/iwn dev/ral dev/usb/wlan dev/wpi net80211 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, 14 Aug 2010 20:12:11 -0000 Author: bschmidt Date: Sat Aug 14 20:12:10 2010 New Revision: 211314 URL: http://svn.freebsd.org/changeset/base/211314 Log: Introduce IEEE80211_C_RATECTL, drivers which use the ratectl framework should set this capability. MFC after: 2 weeks Modified: head/sys/dev/bwi/if_bwi.c head/sys/dev/bwn/if_bwn.c head/sys/dev/iwn/if_iwn.c head/sys/dev/ral/rt2560.c head/sys/dev/ral/rt2661.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_zyd.c head/sys/dev/wpi/if_wpi.c head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_sta.c head/sys/net80211/ieee80211_var.h Modified: head/sys/dev/bwi/if_bwi.c ============================================================================== --- head/sys/dev/bwi/if_bwi.c Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/dev/bwi/if_bwi.c Sat Aug 14 20:12:10 2010 (r211314) @@ -511,7 +511,8 @@ bwi_attach(struct bwi_softc *sc) IEEE80211_C_SHPREAMBLE | IEEE80211_C_WPA | IEEE80211_C_BGSCAN | - IEEE80211_C_MONITOR; + IEEE80211_C_MONITOR | + IEEE80211_C_RATECTL; ic->ic_opmode = IEEE80211_M_STA; ieee80211_ifattach(ic, macaddr); Modified: head/sys/dev/bwn/if_bwn.c ============================================================================== --- head/sys/dev/bwn/if_bwn.c Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/dev/bwn/if_bwn.c Sat Aug 14 20:12:10 2010 (r211314) @@ -1070,6 +1070,7 @@ bwn_attach_post(struct bwn_softc *sc) | IEEE80211_C_WPA /* capable of WPA1+WPA2 */ | IEEE80211_C_BGSCAN /* capable of bg scanning */ | IEEE80211_C_TXPMGT /* capable of txpow mgt */ + | IEEE80211_C_RATECTL /* use ratectl */ ; ic->ic_flags_ext |= IEEE80211_FEXT_SWBMISS; /* s/w bmiss */ Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/dev/iwn/if_iwn.c Sat Aug 14 20:12:10 2010 (r211314) @@ -580,6 +580,7 @@ iwn_attach(device_t dev) | IEEE80211_C_IBSS /* ibss/adhoc mode */ #endif | IEEE80211_C_WME /* WME */ + | IEEE80211_C_RATECTL /* use ratectl */ ; #if 0 /* HT */ /* XXX disable until HT channel setup works */ Modified: head/sys/dev/ral/rt2560.c ============================================================================== --- head/sys/dev/ral/rt2560.c Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/dev/ral/rt2560.c Sat Aug 14 20:12:10 2010 (r211314) @@ -291,6 +291,7 @@ rt2560_attach(device_t dev, int id) #ifdef notyet | IEEE80211_C_TXFRAG /* handle tx frags */ #endif + | IEEE80211_C_RATECTL /* use ratectl */ ; bands = 0; Modified: head/sys/dev/ral/rt2661.c ============================================================================== --- head/sys/dev/ral/rt2661.c Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/dev/ral/rt2661.c Sat Aug 14 20:12:10 2010 (r211314) @@ -294,6 +294,7 @@ rt2661_attach(device_t dev, int id) | IEEE80211_C_TXFRAG /* handle tx frags */ | IEEE80211_C_WME /* 802.11e */ #endif + | IEEE80211_C_RATECTL /* use ratectl */ ; bands = 0; Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/dev/usb/wlan/if_rum.c Sat Aug 14 20:12:10 2010 (r211314) @@ -497,6 +497,7 @@ rum_attach(device_t self) | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_BGSCAN /* bg scanning supported */ | IEEE80211_C_WPA /* 802.11i */ + | IEEE80211_C_RATECTL /* use ratectl */ ; bands = 0; Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/dev/usb/wlan/if_run.c Sat Aug 14 20:12:10 2010 (r211314) @@ -636,7 +636,8 @@ run_attach(device_t self) IEEE80211_C_SHPREAMBLE | /* short preamble supported */ IEEE80211_C_SHSLOT | /* short slot time supported */ IEEE80211_C_WME | /* WME */ - IEEE80211_C_WPA; /* WPA1|WPA2(RSN) */ + IEEE80211_C_WPA | /* WPA1|WPA2(RSN) */ + IEEE80211_C_RATECTL; /* use ratectl */ ic->ic_cryptocaps = IEEE80211_CRYPTO_WEP | Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/dev/usb/wlan/if_ural.c Sat Aug 14 20:12:10 2010 (r211314) @@ -485,6 +485,7 @@ ural_attach(device_t self) | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_BGSCAN /* bg scanning supported */ | IEEE80211_C_WPA /* 802.11i */ + | IEEE80211_C_RATECTL /* use ratectl */ ; bands = 0; Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/dev/usb/wlan/if_zyd.c Sat Aug 14 20:12:10 2010 (r211314) @@ -397,6 +397,7 @@ zyd_attach(device_t dev) | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_BGSCAN /* capable of bg scanning */ | IEEE80211_C_WPA /* 802.11i */ + | IEEE80211_C_RATECTL /* use ratectl */ ; bands = 0; Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/dev/wpi/if_wpi.c Sat Aug 14 20:12:10 2010 (r211314) @@ -634,6 +634,7 @@ wpi_attach(device_t dev) | IEEE80211_C_WME /* 802.11e */ | IEEE80211_C_HOSTAP /* Host access point mode */ #endif + | IEEE80211_C_RATECTL /* use ratectl */ ; /* Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/net80211/ieee80211.c Sat Aug 14 20:12:10 2010 (r211314) @@ -487,7 +487,8 @@ ieee80211_vap_setup(struct ieee80211com ieee80211_regdomain_vattach(vap); ieee80211_radiotap_vattach(vap); - ieee80211_ratectl_set(vap, IEEE80211_RATECTL_AMRR); + if (vap->iv_caps & IEEE80211_C_RATECTL) + ieee80211_ratectl_set(vap, IEEE80211_RATECTL_AMRR); return 0; } Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/net80211/ieee80211_node.c Sat Aug 14 20:12:10 2010 (r211314) @@ -817,7 +817,8 @@ ieee80211_sta_join(struct ieee80211vap * if (ieee80211_iserp_rateset(&ni->ni_rates)) ni->ni_flags |= IEEE80211_NODE_ERP; ieee80211_node_setuptxparms(ni); - ieee80211_ratectl_node_init(ni); + if (vap->iv_caps & IEEE80211_C_RATECTL) + ieee80211_ratectl_node_init(ni); return ieee80211_sta_join1(ieee80211_ref_node(ni)); } @@ -1037,7 +1038,8 @@ node_free(struct ieee80211_node *ni) { struct ieee80211com *ic = ni->ni_ic; - ieee80211_ratectl_node_deinit(ni); + if (ni->ni_vap->iv_caps & IEEE80211_C_RATECTL) + ieee80211_ratectl_node_deinit(ni); ic->ic_node_cleanup(ni); ieee80211_ies_cleanup(&ni->ni_ies); ieee80211_psq_cleanup(&ni->ni_psq); Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/net80211/ieee80211_sta.c Sat Aug 14 20:12:10 2010 (r211314) @@ -1597,7 +1597,8 @@ sta_recv_mgmt(struct ieee80211_node *ni, IEEE80211_F_JOIN | IEEE80211_F_DOBRS); ieee80211_setup_basic_htrates(ni, htinfo); ieee80211_node_setuptxparms(ni); - ieee80211_ratectl_node_init(ni); + if (vap->iv_caps & IEEE80211_C_RATECTL) + ieee80211_ratectl_node_init(ni); } else { #ifdef IEEE80211_SUPPORT_SUPERG if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_ATH)) Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sat Aug 14 20:03:32 2010 (r211313) +++ head/sys/net80211/ieee80211_var.h Sat Aug 14 20:12:10 2010 (r211314) @@ -601,7 +601,8 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_C_MONITOR 0x00010000 /* CAPABILITY: monitor mode */ #define IEEE80211_C_DFS 0x00020000 /* CAPABILITY: DFS/radar avail*/ #define IEEE80211_C_MBSS 0x00040000 /* CAPABILITY: MBSS available */ -/* 0x7c0000 available */ +#define IEEE80211_C_RATECTL 0x00080000 /* CAPABILITY: use ratectl */ +/* 0x700000 available */ #define IEEE80211_C_WPA1 0x00800000 /* CAPABILITY: WPA1 avail */ #define IEEE80211_C_WPA2 0x01000000 /* CAPABILITY: WPA2 avail */ #define IEEE80211_C_WPA 0x01800000 /* CAPABILITY: WPA1+WPA2 avail*/ From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 20:40:55 2010 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 C55811065672; Sat, 14 Aug 2010 20:40:55 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B45198FC17; Sat, 14 Aug 2010 20:40:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EKetEH038342; Sat, 14 Aug 2010 20:40:55 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EKete7038340; Sat, 14 Aug 2010 20:40:55 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201008142040.o7EKete7038340@svn.freebsd.org> From: Andre Oppermann Date: Sat, 14 Aug 2010 20:40: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: r211315 - 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, 14 Aug 2010 20:40:55 -0000 Author: andre Date: Sat Aug 14 20:40:55 2010 New Revision: 211315 URL: http://svn.freebsd.org/changeset/base/211315 Log: Disable TCP inflight limiter by default. It was experimental and interferes with the normal congestion control algorithms by instating a separate, possibly lower, ceiling for the amount of data that is in flight to the remote host. With high speed internet connections the inflight limit frequently has been estimated too low due to the noisy nature of the RTT measurements. This code gives way for the upcoming pluggable congestion control framework. It is the task of the congestion control algorithm to set the congestion window and amount of inflight data without external interference. Reviewed by: lstewart MFC after: 1 week Removal after: 1 month Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Sat Aug 14 20:12:10 2010 (r211314) +++ head/sys/netinet/tcp_subr.c Sat Aug 14 20:40:55 2010 (r211315) @@ -221,7 +221,7 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, SYSCTL_NODE(_net_inet_tcp, OID_AUTO, inflight, CTLFLAG_RW, 0, "TCP inflight data limiting"); -static VNET_DEFINE(int, tcp_inflight_enable) = 1; +static VNET_DEFINE(int, tcp_inflight_enable) = 0; #define V_tcp_inflight_enable VNET(tcp_inflight_enable) SYSCTL_VNET_INT(_net_inet_tcp_inflight, OID_AUTO, enable, CTLFLAG_RW, &VNET_NAME(tcp_inflight_enable), 0, From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 21:04:27 2010 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 B4DDA1065697; Sat, 14 Aug 2010 21:04:27 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A42C78FC1E; Sat, 14 Aug 2010 21:04:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EL4RJB038817; Sat, 14 Aug 2010 21:04:27 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EL4Rru038815; Sat, 14 Aug 2010 21:04:27 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201008142104.o7EL4Rru038815@svn.freebsd.org> From: Andre Oppermann Date: Sat, 14 Aug 2010 21:04: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: r211316 - 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, 14 Aug 2010 21:04:27 -0000 Author: andre Date: Sat Aug 14 21:04:27 2010 New Revision: 211316 URL: http://svn.freebsd.org/changeset/base/211316 Log: Change the messages of the ICMP bad port bandwidth limiter from a kernel printf to a log output with the priority of LOG_NOTICE. This way the messages still show up in /var/log/messages but no longer spam the console every other second on busy servers that are port scanned: "Limiting open port RST response from 114 to 100 packets/sec" PR: kern/147352 Submitted by: Eugene Grosbein MFC after: 1 week Modified: head/sys/netinet/ip_icmp.c Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Sat Aug 14 20:40:55 2010 (r211315) +++ head/sys/netinet/ip_icmp.c Sat Aug 14 21:04:27 2010 (r211316) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -975,7 +976,7 @@ badport_bandlim(int which) * the previous behaviour at the expense of added complexity. */ if (V_icmplim_output && opps > V_icmplim) - printf("Limiting %s from %d to %d packets/sec\n", + log(LOG_NOTICE, "Limiting %s from %d to %d packets/sec\n", r->type, opps, V_icmplim); } return 0; /* okay to send packet */ From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 21:41:33 2010 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 7A1FB1065672; Sat, 14 Aug 2010 21:41:33 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 694158FC0C; Sat, 14 Aug 2010 21:41:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ELfX8M039601; Sat, 14 Aug 2010 21:41:33 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ELfXrK039599; Sat, 14 Aug 2010 21:41:33 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201008142141.o7ELfXrK039599@svn.freebsd.org> From: Andre Oppermann Date: Sat, 14 Aug 2010 21:41:33 +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: r211317 - 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, 14 Aug 2010 21:41:33 -0000 Author: andre Date: Sat Aug 14 21:41:33 2010 New Revision: 211317 URL: http://svn.freebsd.org/changeset/base/211317 Log: When using TSO and sending more than TCP_MAXWIN sendalot is set and we loop back to 'again'. If the remainder is less or equal to one full segment, the TSO flag was not cleared even though it isn't necessary anymore. Enabling the TSO flag on a segment that doesn't require any offloaded segmentation by the NIC may cause confusion in the driver or hardware. Reset the internal tso flag in tcp_output() on every iteration of sendalot. PR: kern/132832 Submitted by: Renaud Lienhart MFC after: 1 week Modified: head/sys/netinet/tcp_output.c Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Sat Aug 14 21:04:27 2010 (r211316) +++ head/sys/netinet/tcp_output.c Sat Aug 14 21:41:33 2010 (r211317) @@ -153,7 +153,7 @@ tcp_output(struct tcpcb *tp) int idle, sendalot; int sack_rxmit, sack_bytes_rxmt; struct sackhole *p; - int tso = 0; + int tso; struct tcpopt to; #if 0 int maxburst = TCP_MAXBURST; @@ -211,6 +211,7 @@ again: SEQ_LT(tp->snd_nxt, tp->snd_max)) tcp_sack_adjust(tp); sendalot = 0; + tso = 0; off = tp->snd_nxt - tp->snd_una; sendwin = min(tp->snd_wnd, tp->snd_cwnd); sendwin = min(sendwin, tp->snd_bwnd); @@ -490,9 +491,9 @@ after_sack_rexmit: } else { len = tp->t_maxseg; sendalot = 1; - tso = 0; } } + if (sack_rxmit) { if (SEQ_LT(p->rxmit + len, tp->snd_una + so->so_snd.sb_cc)) flags &= ~TH_FIN; @@ -1051,6 +1052,8 @@ send: * XXX: Fixme: This is currently not the case for IPv6. */ if (tso) { + KASSERT(len > tp->t_maxopd - optlen, + ("%s: len <= tso_segsz", __func__)); m->m_pkthdr.csum_flags |= CSUM_TSO; m->m_pkthdr.tso_segsz = tp->t_maxopd - optlen; } From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 21:48:22 2010 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 C9D58106566C; Sat, 14 Aug 2010 21:48:22 +0000 (UTC) (envelope-from schweikh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B882C8FC13; Sat, 14 Aug 2010 21:48:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ELmMNm039769; Sat, 14 Aug 2010 21:48:22 GMT (envelope-from schweikh@svn.freebsd.org) Received: (from schweikh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ELmMTO039767; Sat, 14 Aug 2010 21:48:22 GMT (envelope-from schweikh@svn.freebsd.org) Message-Id: <201008142148.o7ELmMTO039767@svn.freebsd.org> From: Jens Schweikhardt Date: Sat, 14 Aug 2010 21:48: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: r211318 - head/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: Sat, 14 Aug 2010 21:48:23 -0000 Author: schweikh Date: Sat Aug 14 21:48:22 2010 New Revision: 211318 URL: http://svn.freebsd.org/changeset/base/211318 Log: Correctly spell janice and jimmy as janis and jimi (assuming the famous rock stars meant were Miss Joplin and Mr Hendrix.) Modified: head/usr.sbin/sysinstall/config.c Modified: head/usr.sbin/sysinstall/config.c ============================================================================== --- head/usr.sbin/sysinstall/config.c Sat Aug 14 21:41:33 2010 (r211317) +++ head/usr.sbin/sysinstall/config.c Sat Aug 14 21:48:22 2010 (r211318) @@ -224,38 +224,38 @@ configFstab(dialogMenuItem *self) } chunk_list[nchunks] = 0; chunk_sort(); - + fstab = fopen("/etc/fstab", "w"); if (!fstab) { msgConfirm("Unable to create a new /etc/fstab file! Manual intervention\n" "will be required."); return DITEM_FAILURE; } - + check_rootdev(chunk_list, nchunks); - + /* Go for the burn */ msgDebug("Generating /etc/fstab file\n"); fprintf(fstab, "# Device\t\tMountpoint\tFStype\tOptions\t\tDump\tPass#\n"); for (i = 0; i < nchunks; i++) fprintf(fstab, "/dev/%s\t\t%s\t\t%s\t%s\t\t%d\t%d\n", name_of(chunk_list[i]), mount_point(chunk_list[i]), fstype(chunk_list[i]), fstype_short(chunk_list[i]), seq_num(chunk_list[i]), seq_num(chunk_list[i])); - + /* Now look for the CDROMs */ devs = deviceFind(NULL, DEVICE_TYPE_CDROM); cnt = deviceCount(devs); - + /* Write out the CDROM entries */ for (i = 0; i < cnt; i++) { char cdname[10]; - + sprintf(cdname, "/cdrom%s", i ? itoa(i) : ""); if (Mkdir(cdname)) msgConfirm("Unable to make mount point for: %s", cdname); else fprintf(fstab, "/dev/%s\t\t%s\t\tcd9660\tro,noauto\t0\t0\n", devs[i]->name, cdname); } - + fclose(fstab); if (isDebug()) msgDebug("Wrote out /etc/fstab file\n"); @@ -530,7 +530,7 @@ configUsers(dialogMenuItem *self) WINDOW *w = savescr(); dialog_clear_norefresh(); - dmenuOpenSimple(&MenuUsermgmt, FALSE); + dmenuOpenSimple(&MenuUsermgmt, FALSE); restorescr(w); return DITEM_SUCCESS; } @@ -657,10 +657,10 @@ configRouter(dialogMenuItem *self) "the user intends to install themselves before rebooting\n" "the system. If you don't want any routing daemon, choose NO", 1) ? DITEM_SUCCESS : DITEM_FAILURE; - + if (ret == DITEM_SUCCESS) { char *cp = variable_get(VAR_ROUTER); - + if (cp && strcmp(cp, "NO")) { variable_set2(VAR_ROUTER_ENABLE, "YES", 1); if (!strcmp(cp, "gated")) { @@ -674,7 +674,7 @@ configRouter(dialogMenuItem *self) } if (cp) { /* Now get the flags, if they chose a router */ - ret = variable_get_value(VAR_ROUTERFLAGS, + ret = variable_get_value(VAR_ROUTERFLAGS, "Please Specify the routing daemon flags; if you're running routed\n" "then -q is the right choice for nodes and -s for gateway hosts.\n", 1) ? DITEM_SUCCESS : DITEM_FAILURE; @@ -747,7 +747,7 @@ configPackages(dialogMenuItem *self) tmp = Plist.kids; while (tmp) { PkgNodePtr tmp2 = tmp->next; - + safe_free(tmp); tmp = tmp2; } @@ -826,7 +826,7 @@ configNFSServer(dialogMenuItem *self) vsystem("echo '#and, /a to a network of privileged machines allowed to write on it as root.' >> /etc/exports"); vsystem("echo '#/usr huey louie dewie' >> /etc/exports"); vsystem("echo '#/usr/src /usr/obj -ro calvin hobbes' >> /etc/exports"); - vsystem("echo '#/home -alldirs janice jimmy frank' >> /etc/exports"); + vsystem("echo '#/home -alldirs janis jimi frank' >> /etc/exports"); vsystem("echo '#/a -maproot=0 -network 10.0.1.0 -mask 255.255.248.0' >> /etc/exports"); vsystem("echo '#' >> /etc/exports"); vsystem("echo '# You should replace these lines with your actual exported filesystems.' >> /etc/exports"); @@ -936,7 +936,7 @@ configLoaderACPI(int disable) fclose(ldconf); return DITEM_SUCCESS; -} +} #endif int From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 22:12:07 2010 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 D87F51065672; Sat, 14 Aug 2010 22:12:07 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (unknown [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id 9C9C68FC12; Sat, 14 Aug 2010 22:12:07 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id 0F0D22A28DBC; Sun, 15 Aug 2010 00:12:07 +0200 (CEST) Date: Sun, 15 Aug 2010 00:12:07 +0200 From: Ed Schouten To: Doug Barton Message-ID: <20100814221207.GJ2978@hoeg.nl> References: <201008141858.o7EIw5a4036090@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HuscSE0D68UGttcd" Content-Disposition: inline In-Reply-To: <201008141858.o7EIw5a4036090@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211311 - head/etc 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, 14 Aug 2010 22:12:07 -0000 --HuscSE0D68UGttcd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Doug Barton wrote: > - [ -n "$enable_quotas" ] && quota_enable=3D"$enable_quotas" > + [ -n "$enable_quotas" ] && err 1 "enable_quotas is deprecated, use quot= as_enable" The flag is called quota_enable, right? Not quotas_enable. Also: > Log: > Give people some warning before removing enable_quotas You have now already effectively removed enable_quotas, right? It doesn't get mapped to quota_enable anymore. --=20 Ed Schouten WWW: http://80386.nl/ --HuscSE0D68UGttcd Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkxnFLcACgkQ52SDGA2eCwU61gCffyIw176HX5z5leUm4bOcN8kC 3xgAn0eejwlJDCOs/cHbYCb6YTPUShd7 =bw6n -----END PGP SIGNATURE----- --HuscSE0D68UGttcd-- From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 22:28:08 2010 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 1A328106566B; Sat, 14 Aug 2010 22:28:08 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09DC18FC15; Sat, 14 Aug 2010 22:28:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EMS7lK040702; Sat, 14 Aug 2010 22:28:07 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EMS7YP040700; Sat, 14 Aug 2010 22:28:07 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201008142228.o7EMS7YP040700@svn.freebsd.org> From: Doug Barton Date: Sat, 14 Aug 2010 22:28:07 +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: r211319 - head/etc 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, 14 Aug 2010 22:28:08 -0000 Author: dougb Date: Sat Aug 14 22:28:07 2010 New Revision: 211319 URL: http://svn.freebsd.org/changeset/base/211319 Log: Fix silly typo on my part (s/quotas_enable/quota_enable/) Submitted by: ed Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sat Aug 14 21:48:22 2010 (r211318) +++ head/etc/rc.subr Sat Aug 14 22:28:07 2010 (r211319) @@ -1018,7 +1018,7 @@ load_rc_config() # Old variable name support -- Remove before 9.0-RELEASE # - [ -n "$enable_quotas" ] && err 1 "enable_quotas is deprecated, use quotas_enable" + [ -n "$enable_quotas" ] && err 1 "enable_quotas is deprecated, use quota_enable" # Set defaults if defined. for _var in $rcvar $rcvars; do From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 22:29:23 2010 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 DCC9C1065670 for ; Sat, 14 Aug 2010 22:29:23 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 6B3A38FC18 for ; Sat, 14 Aug 2010 22:29:23 +0000 (UTC) Received: (qmail 7254 invoked by uid 399); 14 Aug 2010 22:29:22 -0000 Received: from localhost (HELO lap.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 14 Aug 2010 22:29:22 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4C6718C1.7050607@FreeBSD.org> Date: Sat, 14 Aug 2010 15:29:21 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.8) Gecko/20100807 Thunderbird/3.1.2 MIME-Version: 1.0 To: Ed Schouten References: <201008141858.o7EIw5a4036090@svn.freebsd.org> <20100814221207.GJ2978@hoeg.nl> In-Reply-To: <20100814221207.GJ2978@hoeg.nl> X-Enigmail-Version: 1.1.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211311 - head/etc 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, 14 Aug 2010 22:29:24 -0000 On 08/14/2010 15:12, Ed Schouten wrote: > * Doug Barton wrote: >> - [ -n "$enable_quotas" ] && quota_enable="$enable_quotas" >> + [ -n "$enable_quotas" ] && err 1 "enable_quotas is deprecated, use quotas_enable" > > The flag is called quota_enable, right? Not quotas_enable. Right, sorry. >> Log: >> Give people some warning before removing enable_quotas > > You have now already effectively removed enable_quotas, right? It > doesn't get mapped to quota_enable anymore. Silently failing is a higher level of "removal" than loudly failing, but you're right that it could have been phrased better. Doug -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ Computers are useless. They can only give you answers. -- Pablo Picasso From owner-svn-src-all@FreeBSD.ORG Sat Aug 14 22:49:08 2010 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 F3AAA106564A; Sat, 14 Aug 2010 22:49:07 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D52958FC12; Sat, 14 Aug 2010 22:49:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EMn75N041175; Sat, 14 Aug 2010 22:49:07 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EMn7hA041173; Sat, 14 Aug 2010 22:49:07 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201008142249.o7EMn7hA041173@svn.freebsd.org> From: Andre Oppermann Date: Sat, 14 Aug 2010 22:49:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211321 - stable/6/sys/dev/digi 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, 14 Aug 2010 22:49:08 -0000 Author: andre Date: Sat Aug 14 22:49:07 2010 New Revision: 211321 URL: http://svn.freebsd.org/changeset/base/211321 Log: MFC r150132: Increase boot-time DigiBIOS initialization timeout to allow for a larger number of chained port modules. PR: kern/55018 Submitted by: Cyrill Shevchuk Modified: stable/6/sys/dev/digi/digi.c Modified: stable/6/sys/dev/digi/digi.c ============================================================================== --- stable/6/sys/dev/digi/digi.c Sat Aug 14 22:35:20 2010 (r211320) +++ stable/6/sys/dev/digi/digi.c Sat Aug 14 22:49:07 2010 (r211321) @@ -360,7 +360,7 @@ digi_init(struct digi_softc *sc) DLOG(DIGIDB_INIT, (sc->dev, "BIOS started after %d us\n", i)); for (i = 0; vW(ptr) != *(u_short *)"GD"; i++) { - if (i > 2*hz) { + if (i > 5*hz) { log(LOG_ERR, "digi%d: BIOS boot failed " "(0x%02x != 0x%02x)\n", sc->res.unit, vW(ptr), *(u_short *)"GD");