From owner-svn-src-user@FreeBSD.ORG Sun Mar 10 17:30:58 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AB398756; Sun, 10 Mar 2013 17:30:58 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8FC1C842; Sun, 10 Mar 2013 17:30:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2AHUwf6083339; Sun, 10 Mar 2013 17:30:58 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2AHUvDi083335; Sun, 10 Mar 2013 17:30:57 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201303101730.r2AHUvDi083335@svn.freebsd.org> From: Alan Cox Date: Sun, 10 Mar 2013 17:30:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248134 - user/attilio/vmcontention/sys/vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Mar 2013 17:30:58 -0000 Author: alc Date: Sun Mar 10 17:30:57 2013 New Revision: 248134 URL: http://svnweb.freebsd.org/changeset/base/248134 Log: Introduce vm_radix_is_empty(), and use it in place of vm_object_cache_is_empty() where the caller is aware of the page cache's implementation as a radix trie. Sponsored by: EMC / Isilon Storage Division Modified: user/attilio/vmcontention/sys/vm/_vm_radix.h user/attilio/vmcontention/sys/vm/vm_object.c user/attilio/vmcontention/sys/vm/vm_object.h user/attilio/vmcontention/sys/vm/vm_page.c Modified: user/attilio/vmcontention/sys/vm/_vm_radix.h ============================================================================== --- user/attilio/vmcontention/sys/vm/_vm_radix.h Sun Mar 10 17:10:16 2013 (r248133) +++ user/attilio/vmcontention/sys/vm/_vm_radix.h Sun Mar 10 17:30:57 2013 (r248134) @@ -1,4 +1,5 @@ /* + * Copyright (c) 2013 EMC Corp. * Copyright (c) 2011 Jeffrey Roberson * Copyright (c) 2008 Mayur Shardul * All rights reserved. @@ -36,4 +37,11 @@ struct vm_radix { uintptr_t rt_root; }; +static __inline boolean_t +vm_radix_is_empty(struct vm_radix *rtree) +{ + + return (rtree->rt_root == 0); +} + #endif /* !__VM_RADIX_H_ */ Modified: user/attilio/vmcontention/sys/vm/vm_object.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_object.c Sun Mar 10 17:10:16 2013 (r248133) +++ user/attilio/vmcontention/sys/vm/vm_object.c Sun Mar 10 17:30:57 2013 (r248134) @@ -168,7 +168,7 @@ vm_object_zdtor(void *mem, int size, voi object = (vm_object_t)mem; KASSERT(TAILQ_EMPTY(&object->memq), ("object %p has resident pages in its memq", object)); - KASSERT(object->rtree.rt_root == 0, + KASSERT(vm_radix_is_empty(&object->rtree), ("object %p has resident pages in its trie", object)); #if VM_NRESERVLEVEL > 0 KASSERT(LIST_EMPTY(&object->rvq), Modified: user/attilio/vmcontention/sys/vm/vm_object.h ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_object.h Sun Mar 10 17:10:16 2013 (r248133) +++ user/attilio/vmcontention/sys/vm/vm_object.h Sun Mar 10 17:30:57 2013 (r248134) @@ -248,7 +248,7 @@ static __inline boolean_t vm_object_cache_is_empty(vm_object_t object) { - return (object->cache.rt_root == 0); + return (vm_radix_is_empty(&object->cache)); } vm_object_t vm_object_allocate (objtype_t, vm_pindex_t); Modified: user/attilio/vmcontention/sys/vm/vm_page.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_page.c Sun Mar 10 17:10:16 2013 (r248133) +++ user/attilio/vmcontention/sys/vm/vm_page.c Sun Mar 10 17:30:57 2013 (r248134) @@ -1018,7 +1018,7 @@ vm_page_cache_free(vm_object_t object, v boolean_t empty; mtx_lock(&vm_page_queue_free_mtx); - if (__predict_false(vm_object_cache_is_empty(object))) { + if (__predict_false(vm_radix_is_empty(&object->cache))) { mtx_unlock(&vm_page_queue_free_mtx); return; } @@ -1035,7 +1035,7 @@ vm_page_cache_free(vm_object_t object, v cnt.v_cache_count--; cnt.v_free_count++; } - empty = vm_object_cache_is_empty(object); + empty = vm_radix_is_empty(&object->cache); mtx_unlock(&vm_page_queue_free_mtx); if (object->type == OBJT_VNODE && empty) vdrop(object->handle); @@ -1096,7 +1096,7 @@ vm_page_cache_transfer(vm_object_t orig_ * not. */ VM_OBJECT_ASSERT_WLOCKED(new_object); - KASSERT(vm_object_cache_is_empty(new_object), + KASSERT(vm_radix_is_empty(&new_object->cache), ("vm_page_cache_transfer: object %p has cached pages", new_object)); mtx_lock(&vm_page_queue_free_mtx); @@ -2186,7 +2186,7 @@ vm_page_cache(vm_page_t m) mtx_lock(&vm_page_queue_free_mtx); m->flags |= PG_CACHED; cnt.v_cache_count++; - cache_was_empty = vm_object_cache_is_empty(object); + cache_was_empty = vm_radix_is_empty(&object->cache); vm_radix_insert(&object->cache, m->pindex, m); #if VM_NRESERVLEVEL > 0 if (!vm_reserv_free_page(m)) { From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 10:49:07 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 58032EE5; Mon, 11 Mar 2013 10:49:07 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3C1D2688; Mon, 11 Mar 2013 10:49:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2BAn7oG096651; Mon, 11 Mar 2013 10:49:07 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2BAn2SM096622; Mon, 11 Mar 2013 10:49:02 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303111049.r2BAn2SM096622@svn.freebsd.org> From: Attilio Rao Date: Mon, 11 Mar 2013 10:49:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248152 - in user/attilio/vmcontention: . etc/mtree sys/amd64/amd64 sys/arm/arm sys/arm/include sys/boot/common sys/boot/fdt sys/conf sys/dev/ath sys/dev/ath/ath_hal/ar5416 sys/i386/i38... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 10:49:07 -0000 Author: attilio Date: Mon Mar 11 10:49:02 2013 New Revision: 248152 URL: http://svnweb.freebsd.org/changeset/base/248152 Log: MFC Added: user/attilio/vmcontention/sys/libkern/arm/memcpy.S - copied unchanged from r248150, head/sys/libkern/arm/memcpy.S Modified: user/attilio/vmcontention/ObsoleteFiles.inc user/attilio/vmcontention/etc/mtree/BSD.include.dist user/attilio/vmcontention/sys/amd64/amd64/pmap.c user/attilio/vmcontention/sys/arm/arm/db_trace.c user/attilio/vmcontention/sys/arm/arm/disassem.c user/attilio/vmcontention/sys/arm/arm/exception.S user/attilio/vmcontention/sys/arm/include/param.h user/attilio/vmcontention/sys/boot/common/load_elf.c user/attilio/vmcontention/sys/boot/fdt/fdt_loader_cmd.c user/attilio/vmcontention/sys/conf/Makefile.arm user/attilio/vmcontention/sys/conf/files.arm user/attilio/vmcontention/sys/conf/ldscript.arm user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416reg.h user/attilio/vmcontention/sys/dev/ath/if_ath_rx.c user/attilio/vmcontention/sys/dev/ath/if_athioctl.h user/attilio/vmcontention/sys/i386/i386/pmap.c user/attilio/vmcontention/sys/kern/kern_timeout.c user/attilio/vmcontention/sys/net80211/ieee80211_superg.c user/attilio/vmcontention/sys/vm/vm_page.c user/attilio/vmcontention/usr.bin/netstat/netstat.1 user/attilio/vmcontention/usr.sbin/pkg/Makefile Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/sys/boot/ (props changed) user/attilio/vmcontention/sys/conf/ (props changed) Modified: user/attilio/vmcontention/ObsoleteFiles.inc ============================================================================== --- user/attilio/vmcontention/ObsoleteFiles.inc Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/ObsoleteFiles.inc Mon Mar 11 10:49:02 2013 (r248152) @@ -38,7 +38,7 @@ # xargs -n1 | sort | uniq -d; # done -# 20130902: NWFS and NCP supports removed +# 20130309: NWFS and NCP supports removed OLD_FILES+=usr/bin/ncplist OLD_FILES+=usr/bin/ncplogin OLD_FILES+=usr/bin/ncplogout @@ -71,6 +71,9 @@ OLD_FILES+=usr/lib32/libncp.so OLD_LIBS+=usr/lib32/libncp.so.4 OLD_FILES+=usr/lib32/libncp_p.a OLD_FILES+=usr/sbin/mount_nwfs +OLD_FILES+=usr/share/examples/nwclient/dot.nwfsrc +OLD_FILES+=usr/share/examples/nwclient/nwfs.sh.sample +OLD_DIRS+=usr/share/examples/nwclient OLD_FILES+=usr/share/man/man1/ncplist.1.gz OLD_FILES+=usr/share/man/man1/ncplogin.1.gz OLD_FILES+=usr/share/man/man1/ncplogout.1.gz @@ -99,6 +102,12 @@ OLD_FILES+=usr/share/man/man8/mount_port OLD_FILES+=usr/share/man/man4/coda.4.gz # 20130302: XFS support removed OLD_FILES+=usr/share/man/man5/xfs.5.gz +# 20130302: Capsicum overhaul +OLD_FILES+=usr/share/man/man2/cap_getrights.2.gz +OLD_FILES+=usr/share/man/man2/cap_new.2.gz +# 20130213: OpenSSL 1.0.1e import +OLD_FILES+=usr/share/openssl/man/man3/EVP_PKEY_verifyrecover.3.gz +OLD_FILES+=usr/share/openssl/man/man3/EVP_PKEY_verifyrecover_init.3.gz # 20130116: removed long unused directories for .1aout section manpages OLD_FILES+=usr/share/man/en.ISO8859-1/man1aout OLD_FILES+=usr/share/man/en.UTF-8/man1aout Modified: user/attilio/vmcontention/etc/mtree/BSD.include.dist ============================================================================== --- user/attilio/vmcontention/etc/mtree/BSD.include.dist Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/etc/mtree/BSD.include.dist Mon Mar 11 10:49:02 2013 (r248152) @@ -174,8 +174,6 @@ .. nullfs .. - portalfs - .. procfs .. udf Modified: user/attilio/vmcontention/sys/amd64/amd64/pmap.c ============================================================================== --- user/attilio/vmcontention/sys/amd64/amd64/pmap.c Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/amd64/amd64/pmap.c Mon Mar 11 10:49:02 2013 (r248152) @@ -670,7 +670,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr) */ PMAP_LOCK_INIT(kernel_pmap); kernel_pmap->pm_pml4 = (pdp_entry_t *)PHYS_TO_DMAP(KPML4phys); - kernel_pmap->pm_root = NULL; CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */ TAILQ_INIT(&kernel_pmap->pm_pvchunk); Modified: user/attilio/vmcontention/sys/arm/arm/db_trace.c ============================================================================== --- user/attilio/vmcontention/sys/arm/arm/db_trace.c Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/arm/arm/db_trace.c Mon Mar 11 10:49:02 2013 (r248152) @@ -377,7 +377,7 @@ db_stack_trace_cmd(struct unwind_state * index = db_find_index(state->start_pc); if (index->insn == EXIDX_CANTUNWIND) { - printf("Unable to unwind\n"); + db_printf("Unable to unwind\n"); break; } else if (index->insn & (1 << 31)) { /* The data is within the instruction */ @@ -612,10 +612,13 @@ db_trace_self(void) { #ifdef __ARM_EABI__ struct unwind_state state; - register uint32_t sp __asm__ ("sp"); + uint32_t sp; + + /* Read the stack pointer */ + __asm __volatile("mov %0, sp" : "=&r" (sp)); state.registers[FP] = (uint32_t)__builtin_frame_address(0); - state.registers[SP] = (uint32_t)sp; + state.registers[SP] = sp; state.registers[LR] = (uint32_t)__builtin_return_address(0); state.registers[PC] = (uint32_t)db_trace_self; Modified: user/attilio/vmcontention/sys/arm/arm/disassem.c ============================================================================== --- user/attilio/vmcontention/sys/arm/arm/disassem.c Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/arm/arm/disassem.c Mon Mar 11 10:49:02 2013 (r248152) @@ -130,7 +130,7 @@ static const struct arm32_insn arm32_i[] { 0x0c500000, 0x04100000, "ldr", "daW" }, { 0x0c500000, 0x04400000, "strb", "daW" }, { 0x0c500000, 0x04500000, "ldrb", "daW" }, -#ifdef __FreeBSD_ARCH_armv6__ +#if defined(__FreeBSD_ARCH_armv6__) || (defined(__ARM_ARCH) && __ARM_ARCH >= 6) { 0xffffffff, 0xf57ff01f, "clrex", "c" }, { 0x0ff00ff0, 0x01800f90, "strex", "dmo" }, { 0x0ff00fff, 0x01900f9f, "ldrex", "do" }, Modified: user/attilio/vmcontention/sys/arm/arm/exception.S ============================================================================== --- user/attilio/vmcontention/sys/arm/arm/exception.S Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/arm/arm/exception.S Mon Mar 11 10:49:02 2013 (r248152) @@ -77,6 +77,9 @@ Lreset_panicmsg: * Handler for the Software Interrupt exception. */ ASENTRY_NP(swi_entry) + .fnstart + .cantunwind /* Don't unwind past here */ + PUSHFRAME mov r0, sp /* Pass the frame to any function */ @@ -88,6 +91,7 @@ ASENTRY_NP(swi_entry) DO_AST PULLFRAME movs pc, lr /* Exit */ + .fnend /* * prefetch_abort_entry: Modified: user/attilio/vmcontention/sys/arm/include/param.h ============================================================================== --- user/attilio/vmcontention/sys/arm/include/param.h Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/arm/include/param.h Mon Mar 11 10:49:02 2013 (r248152) @@ -56,7 +56,7 @@ #define MACHINE "arm" #endif #ifndef MACHINE_ARCH -#ifdef __FreeBSD_ARCH_armv6__ +#if defined(__FreeBSD_ARCH_armv6__) || (defined(__ARM_ARCH) && __ARM_ARCH >= 6) #ifdef __ARMEB__ #define MACHINE_ARCH "armv6eb" #else Modified: user/attilio/vmcontention/sys/boot/common/load_elf.c ============================================================================== --- user/attilio/vmcontention/sys/boot/common/load_elf.c Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/boot/common/load_elf.c Mon Mar 11 10:49:02 2013 (r248152) @@ -297,15 +297,16 @@ __elfN(loadimage)(struct preloaded_file * the MI code below uses the p_vaddr fields with an offset added for * loading (doing so is arguably wrong). To make loading work, we need * an offset that represents the difference between physical and virtual - * addressing. ARM kernels are always linked at 0xC0000000. Depending + * addressing. ARM kernels are always linked at 0xCnnnnnnn. Depending * on the headers, the offset value passed in may be physical or virtual * (because it typically comes from e_entry), but we always replace * whatever is passed in with the va<->pa offset. On the other hand, we - * only adjust the entry point if it's a virtual address to begin with. + * always remove the high-order part of the entry address whether it's + * physical or virtual, because it will be adjusted later for the actual + * physical entry point based on where the image gets loaded. */ - off = -0xc0000000u; - if ((ehdr->e_entry & 0xc0000000u) == 0xc0000000u) - ehdr->e_entry += off; + off = -0xc0000000; + ehdr->e_entry &= ~0xf0000000; #ifdef ELF_VERBOSE printf("ehdr->e_entry 0x%08x, va<->pa off %llx\n", ehdr->e_entry, off); #endif @@ -396,6 +397,8 @@ __elfN(loadimage)(struct preloaded_file "_loadimage: failed to read section headers"); goto nosyms; } + file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr); + symtabindex = -1; symstrindex = -1; for (i = 0; i < ehdr->e_shnum; i++) { Modified: user/attilio/vmcontention/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- user/attilio/vmcontention/sys/boot/fdt/fdt_loader_cmd.c Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/boot/fdt/fdt_loader_cmd.c Mon Mar 11 10:49:02 2013 (r248152) @@ -118,16 +118,17 @@ static char cwd[FDT_CWD_LEN] = "/"; static vm_offset_t fdt_find_static_dtb() { - Elf_Dyn dyn; + Elf_Ehdr *ehdr; + Elf_Shdr *shdr; Elf_Sym sym; - vm_offset_t dyntab, esym, strtab, symtab, fdt_start; + vm_offset_t strtab, symtab, fdt_start; uint64_t offs; struct preloaded_file *kfp; struct file_metadata *md; char *strp; - int sym_count; + int i, sym_count; - symtab = strtab = dyntab = esym = 0; + symtab = strtab = 0; strp = NULL; offs = __elfN(relocation_offset); @@ -136,42 +137,26 @@ fdt_find_static_dtb() if (kfp == NULL) return (0); - md = file_findmetadata(kfp, MODINFOMD_ESYM); + /* Locate the dynamic symbols and strtab. */ + md = file_findmetadata(kfp, MODINFOMD_ELFHDR); if (md == NULL) return (0); - bcopy(md->md_data, &esym, sizeof(esym)); - /* esym is already offset */ + ehdr = (Elf_Ehdr *)md->md_data; - md = file_findmetadata(kfp, MODINFOMD_DYNAMIC); + md = file_findmetadata(kfp, MODINFOMD_SHDR); if (md == NULL) return (0); - bcopy(md->md_data, &dyntab, sizeof(dyntab)); - dyntab += offs; + shdr = (Elf_Shdr *)md->md_data; - /* Locate STRTAB and DYNTAB */ - for (;;) { - COPYOUT(dyntab, &dyn, sizeof(dyn)); - if (dyn.d_tag == DT_STRTAB) { - strtab = (vm_offset_t)(dyn.d_un.d_ptr) + offs; - } else if (dyn.d_tag == DT_SYMTAB) { - symtab = (vm_offset_t)(dyn.d_un.d_ptr) + offs; - } else if (dyn.d_tag == DT_NULL) { - break; + for (i = 0; i < ehdr->e_shnum; ++i) { + if (shdr[i].sh_type == SHT_DYNSYM && symtab == 0) { + symtab = shdr[i].sh_addr + offs; + sym_count = shdr[i].sh_size / sizeof(Elf_Sym); + } else if (shdr[i].sh_type == SHT_STRTAB && strtab == 0) { + strtab = shdr[i].sh_addr + offs; } - dyntab += sizeof(dyn); } - if (symtab == 0 || strtab == 0) { - /* - * No symtab? No strtab? That should not happen here, - * and should have been verified during __elfN(loadimage). - * This must be some kind of a bug. - */ - return (0); - } - - sym_count = (int)(esym - symtab) / sizeof(Elf_Sym); - /* * The most efficent way to find a symbol would be to calculate a * hash, find proper bucket and chain, and thus find a symbol. Modified: user/attilio/vmcontention/sys/conf/Makefile.arm ============================================================================== --- user/attilio/vmcontention/sys/conf/Makefile.arm Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/conf/Makefile.arm Mon Mar 11 10:49:02 2013 (r248152) @@ -39,12 +39,18 @@ SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/ldscri STRIP_FLAGS = -S .endif +.if ${COMPILER_TYPE} != "clang" CFLAGS += -mno-thumb-interwork +.endif .if empty(DDB_ENABLED) CFLAGS += -mno-apcs-frame .elif defined(WITH_ARM_EABI) CFLAGS += -funwind-tables +.if ${COMPILER_TYPE} == "clang" +# clang requires us to tell it to emit assembly with unwind information +CFLAGS += -mllvm -arm-enable-ehabi +.endif .endif SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.noheader ${LDFLAGS} \ Modified: user/attilio/vmcontention/sys/conf/files.arm ============================================================================== --- user/attilio/vmcontention/sys/conf/files.arm Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/conf/files.arm Mon Mar 11 10:49:02 2013 (r248152) @@ -76,6 +76,7 @@ libkern/arm/divsi3.S standard libkern/arm/ffs.S standard libkern/arm/ldivmod.S standard libkern/arm/ldivmod_helper.c standard +libkern/arm/memcpy.S standard libkern/arm/muldi3.c standard libkern/ashldi3.c standard libkern/ashrdi3.c standard Modified: user/attilio/vmcontention/sys/conf/ldscript.arm ============================================================================== --- user/attilio/vmcontention/sys/conf/ldscript.arm Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/conf/ldscript.arm Mon Mar 11 10:49:02 2013 (r248152) @@ -56,6 +56,7 @@ SECTIONS .init : { *(.init) } =0x9090 .plt : { *(.plt) } + . = ALIGN(4); _extab_start = .; PROVIDE(extab_start = .); .ARM.extab : { *(.ARM.extab) } Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416reg.h ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Mon Mar 11 10:49:02 2013 (r248152) @@ -521,6 +521,7 @@ #define AR_PCU_TBTT_PROTECT 0x00200000 /* no xmit upto tbtt+20 uS */ #define AR_PCU_CLEAR_VMF 0x01000000 /* clear vmf mode (fast cc)*/ #define AR_PCU_CLEAR_BA_VALID 0x04000000 /* clear ba state */ +#define AR_PCU_SEL_EVM 0x08000000 /* select EVM data or PLCP header */ #define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002 #define AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT 0x00000004 Modified: user/attilio/vmcontention/sys/dev/ath/if_ath_rx.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/if_ath_rx.c Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/dev/ath/if_ath_rx.c Mon Mar 11 10:49:02 2013 (r248152) @@ -399,13 +399,31 @@ ath_rx_tap_vendor(struct ifnet *ifp, str sc->sc_rx_th.wr_v.evm[0] = rs->rs_evm0; sc->sc_rx_th.wr_v.evm[1] = rs->rs_evm1; sc->sc_rx_th.wr_v.evm[2] = rs->rs_evm2; - /* XXX TODO: extend this to include 3-stream EVM */ + /* These are only populated from the AR9300 or later */ + sc->sc_rx_th.wr_v.evm[3] = rs->rs_evm3; + sc->sc_rx_th.wr_v.evm[4] = rs->rs_evm4; + + /* direction */ + sc->sc_rx_th.wr_v.vh_flags = ATH_VENDOR_PKT_RX; + + /* RX rate */ + sc->sc_rx_th.wr_v.vh_rx_hwrate = rs->rs_rate; + + /* RX flags */ + sc->sc_rx_th.wr_v.vh_rs_flags = rs->rs_flags; + + if (rs->rs_isaggr) + sc->sc_rx_th.wr_v.vh_flags |= ATH_VENDOR_PKT_ISAGGR; + if (rs->rs_moreaggr) + sc->sc_rx_th.wr_v.vh_flags |= ATH_VENDOR_PKT_MOREAGGR; /* phyerr info */ - if (rs->rs_status & HAL_RXERR_PHY) + if (rs->rs_status & HAL_RXERR_PHY) { sc->sc_rx_th.wr_v.vh_phyerr_code = rs->rs_phyerr; - else + sc->sc_rx_th.wr_v.vh_flags |= ATH_VENDOR_PKT_RXPHYERR; + } else { sc->sc_rx_th.wr_v.vh_phyerr_code = 0xff; + } sc->sc_rx_th.wr_v.vh_rs_status = rs->rs_status; sc->sc_rx_th.wr_v.vh_rssi = rs->rs_rssi; } Modified: user/attilio/vmcontention/sys/dev/ath/if_athioctl.h ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/if_athioctl.h Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/dev/ath/if_athioctl.h Mon Mar 11 10:49:02 2013 (r248152) @@ -273,6 +273,12 @@ struct ath_rateioctl { #define ATH_RADIOTAP_MAX_CHAINS 4 /* + * AR9380 and later chips are 3x3, which requires + * 5 EVM DWORDs in HT40 mode. + */ +#define ATH_RADIOTAP_MAX_EVM 5 + +/* * The vendor radiotap header data needs to be: * * + Aligned to a 4 byte address @@ -291,7 +297,7 @@ struct ath_radiotap_vendor_hdr { /* 30 uint8_t vh_rx_chainmask; /* 1 */ /* At this point it should be 4 byte aligned */ - uint32_t evm[ATH_RADIOTAP_MAX_CHAINS]; /* 4 * 4 = 16 */ + uint32_t evm[ATH_RADIOTAP_MAX_EVM]; /* 5 * 4 = 20 */ uint8_t rssi_ctl[ATH_RADIOTAP_MAX_CHAINS]; /* 4 */ uint8_t rssi_ext[ATH_RADIOTAP_MAX_CHAINS]; /* 4 */ @@ -299,7 +305,16 @@ struct ath_radiotap_vendor_hdr { /* 30 uint8_t vh_phyerr_code; /* Phy error code, or 0xff */ uint8_t vh_rs_status; /* RX status */ uint8_t vh_rssi; /* Raw RSSI */ - uint8_t vh_pad1[1]; /* Pad to 4 byte boundary */ + uint8_t vh_flags; /* General flags */ +#define ATH_VENDOR_PKT_RX 0x01 +#define ATH_VENDOR_PKT_TX 0x02 +#define ATH_VENDOR_PKT_RXPHYERR 0x04 +#define ATH_VENDOR_PKT_ISAGGR 0x08 +#define ATH_VENDOR_PKT_MOREAGGR 0x10 + + uint8_t vh_rx_hwrate; /* hardware RX ratecode */ + uint8_t vh_rs_flags; /* RX HAL flags */ + uint8_t vh_pad[2]; /* pad to DWORD boundary */ } __packed; #endif /* ATH_ENABLE_RADIOTAP_VENDOR_EXT */ Modified: user/attilio/vmcontention/sys/i386/i386/pmap.c ============================================================================== --- user/attilio/vmcontention/sys/i386/i386/pmap.c Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/i386/i386/pmap.c Mon Mar 11 10:49:02 2013 (r248152) @@ -393,7 +393,6 @@ pmap_bootstrap(vm_paddr_t firstaddr) #ifdef PAE kernel_pmap->pm_pdpt = (pdpt_entry_t *) (KERNBASE + (u_int)IdlePDPT); #endif - kernel_pmap->pm_root = NULL; CPU_FILL(&kernel_pmap->pm_active); /* don't allow deactivation */ TAILQ_INIT(&kernel_pmap->pm_pvchunk); Modified: user/attilio/vmcontention/sys/kern/kern_timeout.c ============================================================================== --- user/attilio/vmcontention/sys/kern/kern_timeout.c Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/kern/kern_timeout.c Mon Mar 11 10:49:02 2013 (r248152) @@ -258,6 +258,8 @@ callout_callwheel_init(void *dummy) /* * Calculate the size of the callout wheel and the preallocated * timeout() structures. + * XXX: Clip callout to result of previous function of maxusers + * maximum 384. This is still huge, but acceptable. */ ncallout = imin(16 + maxproc + maxfiles, 18508); TUNABLE_INT_FETCH("kern.ncallout", &ncallout); @@ -294,7 +296,7 @@ callout_cpu_init(struct callout_cpu *cc) mtx_init(&cc->cc_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE); SLIST_INIT(&cc->cc_callfree); - cc->cc_callwheel = malloc(sizeof(struct callout_tailq) * callwheelsize, + cc->cc_callwheel = malloc(sizeof(struct callout_list) * callwheelsize, M_CALLOUT, M_WAITOK); for (i = 0; i < callwheelsize; i++) LIST_INIT(&cc->cc_callwheel[i]); Copied: user/attilio/vmcontention/sys/libkern/arm/memcpy.S (from r248150, head/sys/libkern/arm/memcpy.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmcontention/sys/libkern/arm/memcpy.S Mon Mar 11 10:49:02 2013 (r248152, copy of r248150, head/sys/libkern/arm/memcpy.S) @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2012 Andrew Turner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#ifdef __ARM_EABI__ + +ENTRY_NP(__aeabi_memcpy) + b memcpy + +#endif + Modified: user/attilio/vmcontention/sys/net80211/ieee80211_superg.c ============================================================================== --- user/attilio/vmcontention/sys/net80211/ieee80211_superg.c Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/net80211/ieee80211_superg.c Mon Mar 11 10:49:02 2013 (r248152) @@ -534,8 +534,6 @@ ff_flush(struct mbuf *head, struct mbuf struct ieee80211_node *ni; struct ieee80211vap *vap; - IEEE80211_TX_LOCK_ASSERT(vap->iv_ic); - for (m = head; m != last; m = next) { next = m->m_nextpkt; m->m_nextpkt = NULL; Modified: user/attilio/vmcontention/sys/vm/vm_page.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_page.c Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/sys/vm/vm_page.c Mon Mar 11 10:49:02 2013 (r248152) @@ -73,7 +73,7 @@ * * The page daemon can acquire and hold any pair of page queue * locks in any order. * - * - The object mutex is held when inserting or removing + * - The object lock is required when inserting or removing * pages from an object (vm_page_insert() or vm_page_remove()). * */ Modified: user/attilio/vmcontention/usr.bin/netstat/netstat.1 ============================================================================== --- user/attilio/vmcontention/usr.bin/netstat/netstat.1 Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/usr.bin/netstat/netstat.1 Mon Mar 11 10:49:02 2013 (r248152) @@ -28,7 +28,7 @@ .\" @(#)netstat.1 8.8 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd February 22, 2010 +.Dd March 10, 2013 .Dt NETSTAT 1 .Os .Sh NAME @@ -301,6 +301,12 @@ is repeated, counters with a value of ze Show .Xr netisr 9 statistics. +The flags field shows available ISR handlers: +.Bl -column ".Li W" ".Dv NETISR_SNP_FLAGS_DRAINEDCPU" +.It Li C Ta Dv NETISR_SNP_FLAGS_M2CPUID Ta "Able to map mbuf to cpu id" +.It Li D Ta Dv NETISR_SNP_FLAGS_DRAINEDCPU Ta "Has queue drain handler" +.It Li F Ta Dv NETISR_SNP_FLAGS_M2FLOW Ta "Able to map mbuf to flow id" +.El .El .Pp Some options have the general meaning: Modified: user/attilio/vmcontention/usr.sbin/pkg/Makefile ============================================================================== --- user/attilio/vmcontention/usr.sbin/pkg/Makefile Mon Mar 11 10:48:26 2013 (r248151) +++ user/attilio/vmcontention/usr.sbin/pkg/Makefile Mon Mar 11 10:49:02 2013 (r248152) @@ -4,7 +4,7 @@ PROG= pkg SRCS= pkg.c dns_utils.c config.c NO_MAN= yes -DPADD= ${LIBARCHIVE} ${LIBELF} ${LIBFETCH} ${LIBBSDYML} ${LIBSUBF} +DPADD= ${LIBARCHIVE} ${LIBELF} ${LIBFETCH} ${LIBBSDYML} ${LIBSBUF} LDADD= -larchive -lelf -lfetch -lbsdyml -lsbuf .include From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 12:08:38 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3E162A91; Mon, 11 Mar 2013 12:08:38 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 18BB7D41; Mon, 11 Mar 2013 12:08:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2BC8b3d021410; Mon, 11 Mar 2013 12:08:37 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2BC8b71021409; Mon, 11 Mar 2013 12:08:37 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303111208.r2BC8b71021409@svn.freebsd.org> From: Attilio Rao Date: Mon, 11 Mar 2013 12:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248156 - user/attilio/vmobj-readlock X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 12:08:38 -0000 Author: attilio Date: Mon Mar 11 12:08:37 2013 New Revision: 248156 URL: http://svnweb.freebsd.org/changeset/base/248156 Log: Branch vmcontention to use the radix trie and start adding some read locking to vm_objects. Added: - copied from r248155, user/attilio/vmcontention/ Directory Properties: user/attilio/vmobj-readlock/ (props changed) From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 12:14:22 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 095AFC71; Mon, 11 Mar 2013 12:14:22 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D8284D72; Mon, 11 Mar 2013 12:14:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2BCEL3K024008; Mon, 11 Mar 2013 12:14:21 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2BCELtp024007; Mon, 11 Mar 2013 12:14:21 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303111214.r2BCELtp024007@svn.freebsd.org> From: Attilio Rao Date: Mon, 11 Mar 2013 12:14:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248157 - user/attilio/vmobj-rwlock X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 12:14:22 -0000 Author: attilio Date: Mon Mar 11 12:14:20 2013 New Revision: 248157 URL: http://svnweb.freebsd.org/changeset/base/248157 Log: For the moment the branch is not really useful anymore, just delete it. Deleted: user/attilio/vmobj-rwlock/ From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 13:37:19 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 963F9218; Mon, 11 Mar 2013 13:37:19 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 88A2E263; Mon, 11 Mar 2013 13:37:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2BDbJ2p051041; Mon, 11 Mar 2013 13:37:19 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2BDbJWM051040; Mon, 11 Mar 2013 13:37:19 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303111337.r2BDbJWM051040@svn.freebsd.org> From: Attilio Rao Date: Mon, 11 Mar 2013 13:37:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248161 - user/attilio/vmobj-readlock/sys/vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 13:37:19 -0000 Author: attilio Date: Mon Mar 11 13:37:18 2013 New Revision: 248161 URL: http://svnweb.freebsd.org/changeset/base/248161 Log: Relax locking assertions for vm_lookup_page() and vm_page_find_least(). Sponsored by: EMC / Isilon storage division Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_page.c Mon Mar 11 13:08:32 2013 (r248160) +++ user/attilio/vmobj-readlock/sys/vm/vm_page.c Mon Mar 11 13:37:18 2013 (r248161) @@ -915,7 +915,7 @@ vm_page_t vm_page_lookup(vm_object_t object, vm_pindex_t pindex) { - VM_OBJECT_ASSERT_WLOCKED(object); + VM_OBJECT_ASSERT_LOCKED(object); return (vm_radix_lookup(&object->rtree, pindex)); } @@ -932,7 +932,7 @@ vm_page_find_least(vm_object_t object, v { vm_page_t m; - VM_OBJECT_ASSERT_WLOCKED(object); + VM_OBJECT_ASSERT_LOCKED(object); if ((m = TAILQ_FIRST(&object->memq)) != NULL && m->pindex < pindex) m = vm_radix_lookup_ge(&object->rtree, pindex); return (m); From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 13:50:41 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0801F8C1; Mon, 11 Mar 2013 13:50:41 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EDD28320; Mon, 11 Mar 2013 13:50:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2BDoeFO054745; Mon, 11 Mar 2013 13:50:40 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2BDoeRI054744; Mon, 11 Mar 2013 13:50:40 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303111350.r2BDoeRI054744@svn.freebsd.org> From: Attilio Rao Date: Mon, 11 Mar 2013 13:50:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248162 - user/attilio/vmobj-readlock/sys/vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 13:50:41 -0000 Author: attilio Date: Mon Mar 11 13:50:40 2013 New Revision: 248162 URL: http://svnweb.freebsd.org/changeset/base/248162 Log: The VM_ALLOC_IFCACHED case does not require any object locking as it will only go through the object page cache and return. Lookups in the object's page cache are correctly handled by the vm_page_queue_free_mtx, which will be acquired correctly in this case. Relax the locking assertion. Sponsored by: EMC / Isilon storage division Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_page.c Mon Mar 11 13:37:18 2013 (r248161) +++ user/attilio/vmobj-readlock/sys/vm/vm_page.c Mon Mar 11 13:50:40 2013 (r248162) @@ -1184,7 +1184,7 @@ vm_page_alloc(vm_object_t object, vm_pin KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0), ("vm_page_alloc: inconsistent object/req")); - if (object != NULL) + if (object != NULL && (req & VM_ALLOC_IFCACHED) == 0) VM_OBJECT_ASSERT_WLOCKED(object); req_class = req & VM_ALLOC_CLASS_MASK; From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 14:42:24 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 03B0E427; Mon, 11 Mar 2013 14:42:24 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D42B383B; Mon, 11 Mar 2013 14:42:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2BEgNF5072991; Mon, 11 Mar 2013 14:42:23 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2BEgN9B072990; Mon, 11 Mar 2013 14:42:23 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303111442.r2BEgN9B072990@svn.freebsd.org> From: Attilio Rao Date: Mon, 11 Mar 2013 14:42:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248163 - user/attilio/vmobj-readlock/sys/vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 14:42:24 -0000 Author: attilio Date: Mon Mar 11 14:42:23 2013 New Revision: 248163 URL: http://svnweb.freebsd.org/changeset/base/248163 Log: Simplify vm_page_is_valid() Sponsored by: EMC / Isilon storage division Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_page.c Mon Mar 11 13:50:40 2013 (r248162) +++ user/attilio/vmobj-readlock/sys/vm/vm_page.c Mon Mar 11 14:42:23 2013 (r248163) @@ -2655,10 +2655,7 @@ vm_page_is_valid(vm_page_t m, int base, VM_OBJECT_ASSERT_WLOCKED(m->object); bits = vm_page_bits(base, size); - if (m->valid && ((m->valid & bits) == bits)) - return 1; - else - return 0; + return (m->valid && ((m->valid & bits) == bits)); } /* From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 14:47:08 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EF030724; Mon, 11 Mar 2013 14:47:08 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E004A883; Mon, 11 Mar 2013 14:47:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2BEl8Jw073706; Mon, 11 Mar 2013 14:47:08 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2BEl8cU073705; Mon, 11 Mar 2013 14:47:08 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303111447.r2BEl8cU073705@svn.freebsd.org> From: Attilio Rao Date: Mon, 11 Mar 2013 14:47:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248164 - user/attilio/vmobj-readlock/sys/vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 14:47:09 -0000 Author: attilio Date: Mon Mar 11 14:47:08 2013 New Revision: 248164 URL: http://svnweb.freebsd.org/changeset/base/248164 Log: Relax locking asserts for vm_page_is_valid(). Sponsored by: EMC / Isilon storage division Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_page.c Mon Mar 11 14:42:23 2013 (r248163) +++ user/attilio/vmobj-readlock/sys/vm/vm_page.c Mon Mar 11 14:47:08 2013 (r248164) @@ -2653,7 +2653,7 @@ vm_page_is_valid(vm_page_t m, int base, { vm_page_bits_t bits; - VM_OBJECT_ASSERT_WLOCKED(m->object); + VM_OBJECT_ASSERT_LOCKED(m->object); bits = vm_page_bits(base, size); return (m->valid && ((m->valid & bits) == bits)); } From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 14:50:46 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 83895B17; Mon, 11 Mar 2013 14:50:46 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 71AF08BA; Mon, 11 Mar 2013 14:50:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2BEokOe075649; Mon, 11 Mar 2013 14:50:46 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2BEok6X075648; Mon, 11 Mar 2013 14:50:46 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303111450.r2BEok6X075648@svn.freebsd.org> From: Attilio Rao Date: Mon, 11 Mar 2013 14:50:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248165 - user/attilio/vmobj-readlock/sys/kern X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 14:50:46 -0000 Author: attilio Date: Mon Mar 11 14:50:45 2013 New Revision: 248165 URL: http://svnweb.freebsd.org/changeset/base/248165 Log: Use vm_object read locking for brelse() and inmem(). Sponsored by: Isilon storage division Modified: user/attilio/vmobj-readlock/sys/kern/vfs_bio.c Modified: user/attilio/vmobj-readlock/sys/kern/vfs_bio.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/vfs_bio.c Mon Mar 11 14:47:08 2013 (r248164) +++ user/attilio/vmobj-readlock/sys/kern/vfs_bio.c Mon Mar 11 14:50:45 2013 (r248165) @@ -1389,7 +1389,7 @@ brelse(struct buf *bp) */ resid = bp->b_bufsize; foff = bp->b_offset; - VM_OBJECT_WLOCK(obj); + VM_OBJECT_RLOCK(obj); for (i = 0; i < bp->b_npages; i++) { int had_bogus = 0; @@ -1437,7 +1437,7 @@ brelse(struct buf *bp) resid -= PAGE_SIZE - (foff & PAGE_MASK); foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; } - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); if (bp->b_flags & (B_INVAL | B_RELBUF)) vfs_vmio_release(bp); @@ -2468,7 +2468,7 @@ inmem(struct vnode * vp, daddr_t blkno) size = vp->v_mount->mnt_stat.f_iosize; off = (vm_ooffset_t)blkno * (vm_ooffset_t)vp->v_mount->mnt_stat.f_iosize; - VM_OBJECT_WLOCK(obj); + VM_OBJECT_RLOCK(obj); for (toff = 0; toff < vp->v_mount->mnt_stat.f_iosize; toff += tinc) { m = vm_page_lookup(obj, OFF_TO_IDX(off + toff)); if (!m) @@ -2480,7 +2480,7 @@ inmem(struct vnode * vp, daddr_t blkno) (vm_offset_t) ((toff + off) & PAGE_MASK), tinc) == 0) goto notinmem; } - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); return 1; notinmem: From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 15:48:18 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BA8B9D7F; Mon, 11 Mar 2013 15:48:18 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 955FDB2A; Mon, 11 Mar 2013 15:48:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2BFmIWw092529; Mon, 11 Mar 2013 15:48:18 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2BFmHKV092526; Mon, 11 Mar 2013 15:48:17 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303111548.r2BFmHKV092526@svn.freebsd.org> From: Attilio Rao Date: Mon, 11 Mar 2013 15:48:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248166 - user/attilio/vmobj-readlock/sys/kern X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 15:48:18 -0000 Author: attilio Date: Mon Mar 11 15:48:17 2013 New Revision: 248166 URL: http://svnweb.freebsd.org/changeset/base/248166 Log: Fix low-hanging fruit read lock for vm objects. Sponsored by: EMC / Isilon storage division Modified: user/attilio/vmobj-readlock/sys/kern/imgact_elf.c user/attilio/vmobj-readlock/sys/kern/kern_proc.c user/attilio/vmobj-readlock/sys/kern/sys_process.c Modified: user/attilio/vmobj-readlock/sys/kern/imgact_elf.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/imgact_elf.c Mon Mar 11 14:50:45 2013 (r248165) +++ user/attilio/vmobj-readlock/sys/kern/imgact_elf.c Mon Mar 11 15:48:17 2013 (r248166) @@ -1278,15 +1278,15 @@ each_writable_segment(td, func, closure) continue; /* Ignore memory-mapped devices and such things. */ - VM_OBJECT_WLOCK(object); + VM_OBJECT_RLOCK(object); while ((backing_object = object->backing_object) != NULL) { - VM_OBJECT_WLOCK(backing_object); - VM_OBJECT_WUNLOCK(object); + VM_OBJECT_RLOCK(backing_object); + VM_OBJECT_RUNLOCK(object); object = backing_object; } ignore_entry = object->type != OBJT_DEFAULT && object->type != OBJT_SWAP && object->type != OBJT_VNODE; - VM_OBJECT_WUNLOCK(object); + VM_OBJECT_RUNLOCK(object); if (ignore_entry) continue; Modified: user/attilio/vmobj-readlock/sys/kern/kern_proc.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/kern_proc.c Mon Mar 11 14:50:45 2013 (r248165) +++ user/attilio/vmobj-readlock/sys/kern/kern_proc.c Mon Mar 11 15:48:17 2013 (r248166) @@ -1995,7 +1995,7 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A kve->kve_private_resident = 0; obj = entry->object.vm_object; if (obj != NULL) { - VM_OBJECT_WLOCK(obj); + VM_OBJECT_RLOCK(obj); if (obj->shadow_count == 1) kve->kve_private_resident = obj->resident_page_count; @@ -2010,9 +2010,9 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { if (tobj != obj) - VM_OBJECT_WLOCK(tobj); + VM_OBJECT_RLOCK(tobj); if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); lobj = tobj; } @@ -2072,11 +2072,11 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A break; } if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); kve->kve_ref_count = obj->ref_count; kve->kve_shadow_count = obj->shadow_count; - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); if (vp != NULL) { vn_fullpath(curthread, vp, &fullpath, &freepath); @@ -2162,7 +2162,7 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR kve->kve_private_resident = 0; obj = entry->object.vm_object; if (obj != NULL) { - VM_OBJECT_WLOCK(obj); + VM_OBJECT_RLOCK(obj); if (obj->shadow_count == 1) kve->kve_private_resident = obj->resident_page_count; @@ -2183,9 +2183,9 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { if (tobj != obj) - VM_OBJECT_WLOCK(tobj); + VM_OBJECT_RLOCK(tobj); if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); lobj = tobj; } @@ -2247,11 +2247,11 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR break; } if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); kve->kve_ref_count = obj->ref_count; kve->kve_shadow_count = obj->shadow_count; - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); if (vp != NULL) { vn_fullpath(curthread, vp, &fullpath, &freepath); Modified: user/attilio/vmobj-readlock/sys/kern/sys_process.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/sys_process.c Mon Mar 11 14:50:45 2013 (r248165) +++ user/attilio/vmobj-readlock/sys/kern/sys_process.c Mon Mar 11 15:48:17 2013 (r248166) @@ -382,7 +382,7 @@ ptrace_vm_entry(struct thread *td, struc obj = entry->object.vm_object; if (obj != NULL) - VM_OBJECT_WLOCK(obj); + VM_OBJECT_RLOCK(obj); } while (0); vm_map_unlock_read(map); @@ -395,9 +395,9 @@ ptrace_vm_entry(struct thread *td, struc lobj = obj; for (tobj = obj; tobj != NULL; tobj = tobj->backing_object) { if (tobj != obj) - VM_OBJECT_WLOCK(tobj); + VM_OBJECT_RLOCK(tobj); if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); + VM_OBJECT_RUNLOCK(lobj); lobj = tobj; pve->pve_offset += tobj->backing_object_offset; } @@ -405,8 +405,8 @@ ptrace_vm_entry(struct thread *td, struc if (vp != NULL) vref(vp); if (lobj != obj) - VM_OBJECT_WUNLOCK(lobj); - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(lobj); + VM_OBJECT_RUNLOCK(obj); if (vp != NULL) { freepath = NULL; From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 17:05:59 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 76BDCE80; Mon, 11 Mar 2013 17:05:59 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) by mx1.freebsd.org (Postfix) with ESMTP id 41D08F8; Mon, 11 Mar 2013 17:05:58 +0000 (UTC) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.14.5/8.14.5) with SMTP id r2BB44Nx018991; Mon, 11 Mar 2013 12:05:58 -0500 Received: from mh2.mail.rice.edu (mh2.mail.rice.edu [128.42.201.21]) by pp2.rice.edu with ESMTP id 1ayt5drtxx-1; Mon, 11 Mar 2013 12:05:57 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh2.mail.rice.edu, auth channel Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh2.mail.rice.edu (Postfix) with ESMTPSA id 90235500116; Mon, 11 Mar 2013 12:05:57 -0500 (CDT) Message-ID: <513E0EF4.4050304@rice.edu> Date: Mon, 11 Mar 2013 12:05:56 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130127 Thunderbird/17.0.2 MIME-Version: 1.0 To: Attilio Rao Subject: Re: svn commit: r248162 - user/attilio/vmobj-readlock/sys/vm References: <201303111350.r2BDoeRI054744@svn.freebsd.org> In-Reply-To: <201303111350.r2BDoeRI054744@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5400 definitions=5800 signatures=585085 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=13 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1111160001 definitions=main-1101130121 Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 17:05:59 -0000 On 03/11/2013 08:50, Attilio Rao wrote: > Author: attilio > Date: Mon Mar 11 13:50:40 2013 > New Revision: 248162 > URL: http://svnweb.freebsd.org/changeset/base/248162 > > Log: > The VM_ALLOC_IFCACHED case does not require any object locking as > it will only go through the object page cache and return. > Lookups in the object's page cache are correctly handled by > the vm_page_queue_free_mtx, which will be acquired correctly in this > case. > Relax the locking assertion. > Umm, no. The page is moving from the cache to the rtree. Insertion into the latter requires the object to be write locked. > Sponsored by: EMC / Isilon storage division > > Modified: > user/attilio/vmobj-readlock/sys/vm/vm_page.c > > Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c > ============================================================================== > --- user/attilio/vmobj-readlock/sys/vm/vm_page.c Mon Mar 11 13:37:18 2013 (r248161) > +++ user/attilio/vmobj-readlock/sys/vm/vm_page.c Mon Mar 11 13:50:40 2013 (r248162) > @@ -1184,7 +1184,7 @@ vm_page_alloc(vm_object_t object, vm_pin > > KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0), > ("vm_page_alloc: inconsistent object/req")); > - if (object != NULL) > + if (object != NULL && (req & VM_ALLOC_IFCACHED) == 0) > VM_OBJECT_ASSERT_WLOCKED(object); > > req_class = req & VM_ALLOC_CLASS_MASK; > From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 19:25:58 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F0924130; Mon, 11 Mar 2013 19:25:58 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-ie0-x231.google.com (mail-ie0-x231.google.com [IPv6:2607:f8b0:4001:c03::231]) by mx1.freebsd.org (Postfix) with ESMTP id BD98CA92; Mon, 11 Mar 2013 19:25:58 +0000 (UTC) Received: by mail-ie0-f177.google.com with SMTP id 16so5280886iea.22 for ; Mon, 11 Mar 2013 12:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=4fncV6Xw0pwNJmOCHCQnEh7pYPpW2lxKH6pPJLzzXrw=; b=MYMW0OAbHsR9Lf35Ew9M9Qrens/lD6ZqcIDI0EwIN3B2+WfVK3wLrBP9BH1lL6ebVz 3H5Oo35K9JrW8vQOkTt0LS5HWJwBMX5uHU5LOglITXJB9UWTDc94yuyzuGY2uYNEaUCf vigknz/jHraAsrykZk+sgJMvJ+sOUdO8lAQOppcXLQvNXmVeim0OKoUFCdM0IcrS/6NA WJAlI6EtPu0f1lx/ntGejSFgbTUUN1QyZiZZa21f/ifP/0jDMQx8HzjrvgTC+N4VYL2t dP8aBictJlueVIt00K59dk2rX86OkpeEqNypFti/vDEO6o4Db0jtidhPqxxb0KGsUw7c FQNw== MIME-Version: 1.0 X-Received: by 10.43.103.195 with SMTP id dj3mr9708355icc.3.1363029958346; Mon, 11 Mar 2013 12:25:58 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.42.117.134 with HTTP; Mon, 11 Mar 2013 12:25:58 -0700 (PDT) In-Reply-To: <513E0EF4.4050304@rice.edu> References: <201303111350.r2BDoeRI054744@svn.freebsd.org> <513E0EF4.4050304@rice.edu> Date: Mon, 11 Mar 2013 20:25:58 +0100 X-Google-Sender-Auth: nXkW0M0bUJLaCUDrjdvvjIWyRKU Message-ID: Subject: Re: svn commit: r248162 - user/attilio/vmobj-readlock/sys/vm From: Attilio Rao To: Alan Cox Content-Type: text/plain; charset=UTF-8 Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 19:25:59 -0000 On Mon, Mar 11, 2013 at 6:05 PM, Alan Cox wrote: > On 03/11/2013 08:50, Attilio Rao wrote: >> Author: attilio >> Date: Mon Mar 11 13:50:40 2013 >> New Revision: 248162 >> URL: http://svnweb.freebsd.org/changeset/base/248162 >> >> Log: >> The VM_ALLOC_IFCACHED case does not require any object locking as >> it will only go through the object page cache and return. >> Lookups in the object's page cache are correctly handled by >> the vm_page_queue_free_mtx, which will be acquired correctly in this >> case. >> Relax the locking assertion. >> > > Umm, no. The page is moving from the cache to the rtree. Insertion > into the latter requires the object to be write locked. Yeah, I figured out while I was having gym training :) Huge brainfart, I'll revert soon. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 20:01:39 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1C3A4895; Mon, 11 Mar 2013 20:01:39 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0F29AD2F; Mon, 11 Mar 2013 20:01:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2BK1c26073581; Mon, 11 Mar 2013 20:01:38 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2BK1csD073580; Mon, 11 Mar 2013 20:01:38 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201303112001.r2BK1csD073580@svn.freebsd.org> From: Dmitry Chagin Date: Mon, 11 Mar 2013 20:01:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248174 - user/dchagin/lemul/sys/compat/linux X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 20:01:39 -0000 Author: dchagin Date: Mon Mar 11 20:01:38 2013 New Revision: 248174 URL: http://svnweb.freebsd.org/changeset/base/248174 Log: When the FUTEX_CLOCK_REALTIME is specified the timeout is an absolute time, not a relative time. Rework futex_wait to handle this. On the side fix the futex leak in error case and remove useless parentheses. Modified: user/dchagin/lemul/sys/compat/linux/linux_futex.c Modified: user/dchagin/lemul/sys/compat/linux/linux_futex.c ============================================================================== --- user/dchagin/lemul/sys/compat/linux/linux_futex.c Mon Mar 11 18:01:55 2013 (r248173) +++ user/dchagin/lemul/sys/compat/linux/linux_futex.c Mon Mar 11 20:01:38 2013 (r248174) @@ -125,9 +125,7 @@ LIN_SDT_PROBE_DEFINE3(futex, futex_reque "struct waiting_proc *", "uint32_t"); LIN_SDT_PROBE_DEFINE1(futex, futex_requeue, return, "int"); LIN_SDT_PROBE_DEFINE4(futex, futex_wait, entry, "struct futex *", - "struct waiting_proc **", "struct l_timespec *", "uint32_t"); -LIN_SDT_PROBE_DEFINE1(futex, futex_wait, copyin_error, "int"); -LIN_SDT_PROBE_DEFINE1(futex, futex_wait, itimerfix_error, "int"); + "struct waiting_proc **", "int", "uint32_t"); LIN_SDT_PROBE_DEFINE1(futex, futex_wait, sleep_error, "int"); LIN_SDT_PROBE_DEFINE1(futex, futex_wait, return, "int"); LIN_SDT_PROBE_DEFINE3(futex, futex_atomic_op, entry, "struct thread *", @@ -141,6 +139,7 @@ LIN_SDT_PROBE_DEFINE1(futex, futex_atomi LIN_SDT_PROBE_DEFINE2(futex, linux_sys_futex, entry, "struct thread *", "struct linux_sys_futex_args *"); LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, unimplemented_clockswitch); +LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, itimerfix_error, "int"); LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, copyin_error, "int"); LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, invalid_cmp_requeue_use); LIN_SDT_PROBE_DEFINE3(futex, linux_sys_futex, debug_wait, "uint32_t *", @@ -552,15 +551,12 @@ futex_requeue(struct futex *f, int n, st } static int -futex_wait(struct futex *f, struct waiting_proc *wp, struct l_timespec *ts, +futex_wait(struct futex *f, struct waiting_proc *wp, int timeout_hz, uint32_t bitset) { - struct l_timespec timeout; - struct timeval tv; - int timeout_hz; int error; - LIN_SDT_PROBE4(futex, futex_wait, entry, f, wp, ts, bitset); + LIN_SDT_PROBE4(futex, futex_wait, entry, f, wp, timeout_hz, bitset); if (bitset == 0) { LIN_SDT_PROBE1(futex, futex_wait, return, EINVAL); @@ -568,30 +564,9 @@ futex_wait(struct futex *f, struct waiti } f->f_bitset = bitset; - - if (ts != NULL) { - error = copyin(ts, &timeout, sizeof(timeout)); - if (error) { - LIN_SDT_PROBE1(futex, futex_wait, copyin_error, error); - LIN_SDT_PROBE1(futex, futex_wait, return, error); - return (error); - } - TIMESPEC_TO_TIMEVAL(&tv, &timeout); - error = itimerfix(&tv); - if (error) { - LIN_SDT_PROBE1(futex, futex_wait, itimerfix_error, - error); - LIN_SDT_PROBE1(futex, futex_wait, return, error); - return (error); - } - timeout_hz = tvtohz(&tv); - } else - timeout_hz = 0; - error = futex_sleep(f, wp, timeout_hz); - if (error) { + if (error) LIN_SDT_PROBE1(futex, futex_wait, sleep_error, error); - } if (error == EWOULDBLOCK) error = ETIMEDOUT; @@ -681,6 +656,9 @@ linux_sys_futex(struct thread *td, struc struct linux_emuldata *em; struct waiting_proc *wp; struct futex *f, *f2; + struct l_timespec timeout; + struct timeval utv, ctv; + int timeout_hz; int error; uint32_t flags; @@ -754,7 +732,35 @@ linux_sys_futex(struct thread *td, struc return (EWOULDBLOCK); } - error = futex_wait(f, wp, args->timeout, args->val3); + if (args->timeout != NULL) { + error = copyin(args->timeout, &timeout, sizeof(timeout)); + if (error) { + LIN_SDT_PROBE1(futex, linux_sys_futex, copyin_error, + error); + LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); + futex_put(f, wp); + return (error); + } + TIMESPEC_TO_TIMEVAL(&utv, &timeout); + error = itimerfix(&utv); + if (error) { + LIN_SDT_PROBE1(futex, linux_sys_futex, itimerfix_error, + error); + LIN_SDT_PROBE1(futex, linux_sys_futex, return, error); + futex_put(f, wp); + return (error); + } + if (clockrt) { + microtime(&ctv); + timevalsub(&utv, &ctv); + } + if (utv.tv_sec < 0) + timevalclear(&utv); + timeout_hz = tvtohz(&utv); + } else + timeout_hz = 0; + + error = futex_wait(f, wp, timeout_hz, args->val3); break; case LINUX_FUTEX_WAKE: From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 23:04:53 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 378D2A10; Mon, 11 Mar 2013 23:04:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2A50B8E3; Mon, 11 Mar 2013 23:04:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2BN4r7p028782; Mon, 11 Mar 2013 23:04:53 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2BN4qko028780; Mon, 11 Mar 2013 23:04:52 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303112304.r2BN4qko028780@svn.freebsd.org> From: Adrian Chadd Date: Mon, 11 Mar 2013 23:04:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248177 - user/adrian/ath_radar_stuff/src/pktlog X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 23:04:53 -0000 Author: adrian Date: Mon Mar 11 23:04:52 2013 New Revision: 248177 URL: http://svnweb.freebsd.org/changeset/base/248177 Log: Update this to compile with the libradarpkt changes. Modified: user/adrian/ath_radar_stuff/src/pktlog/Makefile user/adrian/ath_radar_stuff/src/pktlog/main.c Modified: user/adrian/ath_radar_stuff/src/pktlog/Makefile ============================================================================== --- user/adrian/ath_radar_stuff/src/pktlog/Makefile Mon Mar 11 22:59:07 2013 (r248176) +++ user/adrian/ath_radar_stuff/src/pktlog/Makefile Mon Mar 11 23:04:52 2013 (r248177) @@ -6,7 +6,7 @@ X_LIBS= -L../../lib/libradarpkt/ SRCS= main.c CFLAGS+= -I/home/adrian/work/freebsd/ath/head/src/sys $(X_INCS) -g -ggdb \ -DATH_ENABLE_RADIOTAP_VENDOR_EXT -LDADD+= $(X_LIBS) -lpcap -lradarpkt +LDADD+= $(X_LIBS) -lpcap -lradarpkt -lm NO_MAN= 1 Modified: user/adrian/ath_radar_stuff/src/pktlog/main.c ============================================================================== --- user/adrian/ath_radar_stuff/src/pktlog/main.c Mon Mar 11 22:59:07 2013 (r248176) +++ user/adrian/ath_radar_stuff/src/pktlog/main.c Mon Mar 11 23:04:52 2013 (r248177) @@ -14,7 +14,7 @@ #include "libradarpkt/ar5416_radar.h" #include "libradarpkt/ar9280_radar.h" -#include "chan.h" +#include "libradarpkt/chan.h" /* from _ieee80211.h */ #define IEEE80211_CHAN_HT40U 0x00020000 /* HT 40 channel w/ ext above */ From owner-svn-src-user@FreeBSD.ORG Mon Mar 11 23:05:33 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6ADF7B34; Mon, 11 Mar 2013 23:05:33 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4E29D8EB; Mon, 11 Mar 2013 23:05:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2BN5Xsr028955; Mon, 11 Mar 2013 23:05:33 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2BN5W8x028953; Mon, 11 Mar 2013 23:05:32 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303112305.r2BN5W8x028953@svn.freebsd.org> From: Adrian Chadd Date: Mon, 11 Mar 2013 23:05:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248178 - user/adrian/ath_radar_stuff/src/evmlog X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2013 23:05:33 -0000 Author: adrian Date: Mon Mar 11 23:05:32 2013 New Revision: 248178 URL: http://svnweb.freebsd.org/changeset/base/248178 Log: Add a simple (!) but dirty hack to parse out the EVM data from the RX path. Added: user/adrian/ath_radar_stuff/src/evmlog/ user/adrian/ath_radar_stuff/src/evmlog/Makefile user/adrian/ath_radar_stuff/src/evmlog/main.c Added: user/adrian/ath_radar_stuff/src/evmlog/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/evmlog/Makefile Mon Mar 11 23:05:32 2013 (r248178) @@ -0,0 +1,13 @@ +PROG= evmlog + +X_INCS= -I../../lib/ +X_LIBS= -L../../lib/libradarpkt/ + +SRCS= main.c +CFLAGS+= -I/home/adrian/work/freebsd/ath/head/src/sys $(X_INCS) -g -ggdb \ + -DATH_ENABLE_RADIOTAP_VENDOR_EXT +LDADD+= $(X_LIBS) -lpcap -lradarpkt -lm + +NO_MAN= 1 + +.include Added: user/adrian/ath_radar_stuff/src/evmlog/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/src/evmlog/main.c Mon Mar 11 23:05:32 2013 (r248178) @@ -0,0 +1,373 @@ +#include +#include +#include +#include +#include /* for ntohl etc */ +#include + +#include +#include + +#include + +#include "net80211/ieee80211.h" +#include "net80211/ieee80211_radiotap.h" + +#include "dev/ath/if_athioctl.h" + +#if 0 +#include "libradarpkt/pkt.h" +#include "libradarpkt/ar5212_radar.h" +#include "libradarpkt/ar5416_radar.h" +#include "libradarpkt/ar9280_radar.h" +#endif + +#include "libradarpkt/chan.h" + +/* from _ieee80211.h */ +#define IEEE80211_CHAN_HT40U 0x00020000 /* HT 40 channel w/ ext above */ +#define IEEE80211_CHAN_HT40D 0x00040000 /* HT 40 channel w/ ext below */ + +// non-HT +// 0x00200140 +// HT, not HT40 +// 0x00210140 + +/* + * Compile up a rule that's bound to be useful - it only matches on + * radar errors. + * + * tcpdump -ni wlan0 -y IEEE802_11_RADIO -x -X -s0 -v -ve \ + * 'radio[79] == 0x01' + */ +#define PKTRULE "radio[79] & 0x01 == 0x01" + +static int +pkt_compile(pcap_t *p, struct bpf_program *fp) +{ + if (pcap_compile(p, fp, PKTRULE, 1, 0) != 0) + return 0; + return 1; +} + +/* + * Accessor macros to go dig through the DWORD for the relevant + * EVM bytes. + */ +#define MS(_v, _f) ( ((_v) & (_f)) >> _f ## _S ) + +#define EVM_0 0x000000ff +#define EVM_0_S 0 +#define EVM_1 0x0000ff00 +#define EVM_1_S 8 +#define EVM_2 0x00ff0000 +#define EVM_2_S 16 +#define EVM_3 0xff000000 +#define EVM_3_S 24 + +/* + * The EVM pilot information representation, post-processed. + */ +#define NUM_EVM_PILOTS 6 +#define NUM_EVM_STREAMS 3 +struct evm { + int8_t evm_pilots[NUM_EVM_STREAMS][NUM_EVM_PILOTS]; + int num_pilots; + int num_streams; +}; + +/* Print the EVM information */ +static void +print_evm(struct evm *e) +{ + int s, p; + + for (s = 0; s < e->num_streams; s++) { + printf(" evm_stream_%d=[", s + 1); + for (p = 0; p < NUM_EVM_PILOTS; p++) { + printf(" %d", (int) (e->evm_pilots[s][p])); + } + printf(" ]"); + } +} + +/* + * Populate the given EVM information. + * + * The EVM pilot offsets depend upon whether the rates are + * 1, 2 or 3 stream, as well as HT20 or HT40. + */ +static void +populate_evm(struct evm *e, uint32_t evm[4], uint8_t rx_hwrate, int rx_isht40) +{ + /* Initialise everything to 0x80 - invalid */ + memset(e->evm_pilots, 0x80, sizeof(e->evm_pilots)); + + /* HT20 pilots - always 4 */ + e->num_pilots = 4; + if (rx_isht40) + e->num_pilots += 2; /* HT40 - 6 pilots */ + + /* XXX assume it's MCS */ + if (rx_hwrate < 0x88) { /* 1 stream */ + e->num_streams = 1; + e->evm_pilots[0][0] = MS(evm[0], EVM_0); + e->evm_pilots[0][1] = MS(evm[0], EVM_1); + e->evm_pilots[0][2] = MS(evm[0], EVM_2); + e->evm_pilots[0][3] = + MS(evm[0], EVM_3); + if (rx_isht40) { + e->evm_pilots[0][4] = MS(evm[1], EVM_0), + e->evm_pilots[0][5] = MS(evm[1], EVM_1); + } + } else if (rx_hwrate < 0x90) { /* 2 stream */ + e->num_streams = 2; + e->evm_pilots[0][0] = MS(evm[0], EVM_0); + e->evm_pilots[0][1] = MS(evm[0], EVM_2); + e->evm_pilots[0][2] = MS(evm[1], EVM_0); + e->evm_pilots[0][3] = MS(evm[1], EVM_2); + if (rx_isht40) { + e->evm_pilots[0][4] = MS(evm[2], EVM_0), + e->evm_pilots[0][5] = MS(evm[2], EVM_2); + } + e->evm_pilots[1][0] = MS(evm[0], EVM_1); + e->evm_pilots[1][1] = MS(evm[0], EVM_3); + e->evm_pilots[1][2] = MS(evm[1], EVM_1); + e->evm_pilots[1][3] = MS(evm[1], EVM_3); + if (rx_isht40) { + e->evm_pilots[1][4] = MS(evm[2], EVM_1); + e->evm_pilots[1][5] = MS(evm[2], EVM_3); + } + } else { /* 3 stream */ + e->num_streams = 3; + e->evm_pilots[0][0] = MS(evm[0], EVM_0); + e->evm_pilots[0][1] = MS(evm[0], EVM_3); + e->evm_pilots[0][2] = MS(evm[1], EVM_2); + e->evm_pilots[0][3] = MS(evm[2], EVM_1); + if (rx_isht40) { + e->evm_pilots[0][4] = MS(evm[3], EVM_0); + e->evm_pilots[0][5] = MS(evm[3], EVM_3); + } + e->evm_pilots[1][0] = MS(evm[0], EVM_1); + e->evm_pilots[1][1] = MS(evm[1], EVM_0); + e->evm_pilots[1][2] = MS(evm[1], EVM_3); + e->evm_pilots[1][3] = MS(evm[2], EVM_2); + if (rx_isht40) { + e->evm_pilots[1][4] = MS(evm[3], EVM_1); + e->evm_pilots[1][5] = MS(evm[4], EVM_0); + } + e->evm_pilots[2][0] = MS(evm[0], EVM_2); + e->evm_pilots[2][1] = MS(evm[1], EVM_1); + e->evm_pilots[2][2] = MS(evm[2], EVM_0); + e->evm_pilots[2][3] = MS(evm[2], EVM_3); + if (rx_isht40) { + e->evm_pilots[2][4] = MS(evm[3], EVM_2); + e->evm_pilots[2][5] = MS(evm[4], EVM_1); + } + } +} + +void +pkt_handle(int chip, const char *pkt, int len) +{ + struct ieee80211_radiotap_header *rh; + struct ath_rx_radiotap_header *rx; + uint8_t rssi, nf; + int r; + struct xchan x; + uint32_t evm[5]; /* XXX ATH_RADIOTAP_MAX_CHAINS */ + uint8_t rx_chainmask; + uint8_t rx_hwrate; + int rx_isht40; + int rx_isht; + int rx_isaggr; + int rx_lastaggr; + struct evm e; + + /* XXX assume it's a radiotap frame */ + rh = (struct ieee80211_radiotap_header *) pkt; + rx = (struct ath_rx_radiotap_header *) pkt; + + if (rh->it_version != 0) { + printf("%s: incorrect version (%d)\n", __func__, + rh->it_version); + return; + } + +#if 0 + printf("%s: len=%d, present=0x%08x\n", + __func__, + (rh->it_len), /* XXX why aren't these endian-converted? */ + (rh->it_present)); +#endif + + /* XXX TODO: check vh_flags to ensure this is an RX frame */ + + /* + * Do a frequency lookup. + */ + /* XXX rh->it_len should be endian checked?! */ + if (pkt_lookup_chan((char *) pkt, len, &x) != 0) { + printf("%s: channel lookup failed\n", __func__); + return; + } + + /* + * Copy out the EVM data, receive rate, RX chainmask from the + * header. + * + * XXX TODO: methodize this; endianness! + */ + memcpy(evm, pkt + 48, 4 * 4); + rx_chainmask = rx->wr_v.vh_rx_chainmask; + rx_hwrate = rx->wr_v.vh_rx_hwrate; + rx_isht40 = !! (rx->wr_chan_flags & (IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D)); + rx_isht = !! (rx_hwrate & 0x80); + + /* + * If aggr=1, then we only care about lastaggr. + * If aggr=0, then the stack will only pass us up a + * completed frame, with the final descriptors' status. + */ + + rx_isaggr = !! (rx->wr_v.vh_flags & ATH_VENDOR_PKT_ISAGGR); + rx_lastaggr = 0; + if ((rx->wr_v.vh_flags & ATH_VENDOR_PKT_ISAGGR) && + ! (rx->wr_v.vh_flags & ATH_VENDOR_PKT_MOREAGGR)) { + rx_lastaggr = 1; + } + + if (rx_isht && (! rx_isaggr || rx_lastaggr)) { + populate_evm(&e, evm, rx_hwrate, rx_isht40); + + printf("ts=%llu: rs_status=0x%x, chainmask=0x%x, " + "hwrate=0x%02x, isht=%d, is40=%d, " + "rssi_comb=%d, rssi_ctl=[%d %d %d], " + "rssi_ext=[%d %d %d]", + le64toh(rx->wr_tsf), + (int) rx->wr_v.vh_rs_status, + (int) rx->wr_v.vh_rx_chainmask, + (int) rx->wr_v.vh_rx_hwrate, + (int) rx_isht, + (int) rx_isht40, + (int) (int8_t) ((rx->wr_v.vh_rssi) & 0xff), + (int) (int8_t) ((rx->wr_v.rssi_ctl[0]) & 0xff), + (int) (int8_t) ((rx->wr_v.rssi_ctl[1]) & 0xff), + (int) (int8_t) ((rx->wr_v.rssi_ctl[2]) & 0xff), + (int) (int8_t) ((rx->wr_v.rssi_ext[0]) & 0xff), + (int) (int8_t) ((rx->wr_v.rssi_ext[1]) & 0xff), + (int) (int8_t) ((rx->wr_v.rssi_ext[2]) & 0xff) + ); + print_evm(&e); + + printf("\n"); + } +} + +static pcap_t * +open_offline(const char *fname) +{ + pcap_t *p; + char errbuf[PCAP_ERRBUF_SIZE]; + + p = pcap_open_offline(fname, errbuf); + if (p == NULL) { + printf("pcap_create failed: %s\n", errbuf); + return (NULL); + } + + return (p); +} + +static pcap_t * +open_online(const char *ifname) +{ + pcap_t *p; + char errbuf[PCAP_ERRBUF_SIZE]; + struct bpf_program fp; + + p = pcap_open_live(ifname, 65536, 1, 1000, errbuf); + if (! p) { + err(1, "pcap_create: %s\n", errbuf); + return (NULL); + } + + if (pcap_set_datalink(p, DLT_IEEE802_11_RADIO) != 0) { + pcap_perror(p, "pcap_set_datalink"); + return (NULL); + } + + /* XXX pcap_is_swapped() ? */ + + if (! pkt_compile(p, &fp)) { + pcap_perror(p, "pkg_compile compile error\n"); + return (NULL); + } + +#if 1 + if (pcap_setfilter(p, &fp) != 0) { + printf("pcap_setfilter failed\n"); + return (NULL); + } +#endif + + return (p); +} + +static void +usage(const char *progname) +{ + + printf("Usage: %s \n", + progname); +} + +int +main(int argc, const char *argv[]) +{ + char *dev; + pcap_t * p; + const char *fname; + const unsigned char *pkt; + struct pcap_pkthdr *hdr; + int len, r; + int chip = 0; + + if (argc < 3) { + usage(argv[0]); + exit(255); + } + + /* XXX verify */ + fname = argv[2]; + + if (strcmp(argv[1], "file") == 0) { + p = open_offline(fname); + } else if (strcmp(argv[1], "if") == 0) { + p = open_online(fname); + } else { + usage(argv[0]); + exit(255); + } + + if (p == NULL) + exit(255); + + /* + * Iterate over frames, looking for radiotap frames + * which have PHY errors. + * + * XXX We should compile a filter for this, but the + * XXX access method is a non-standard hack atm. + */ + while ((r = pcap_next_ex(p, &hdr, &pkt)) >= 0) { +#if 0 + printf("capture: len=%d, caplen=%d\n", + hdr->len, hdr->caplen); +#endif + if (r > 0) + pkt_handle(chip, pkt, hdr->caplen); + } + + pcap_close(p); +} From owner-svn-src-user@FreeBSD.ORG Tue Mar 12 02:12:49 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2683BC03; Tue, 12 Mar 2013 02:12:49 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0AB8DFB9; Tue, 12 Mar 2013 02:12:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2C2Cm6Z085690; Tue, 12 Mar 2013 02:12:48 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2C2Cmp7085688; Tue, 12 Mar 2013 02:12:48 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201303120212.r2C2Cmp7085688@svn.freebsd.org> From: Alan Cox Date: Tue, 12 Mar 2013 02:12:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248179 - in user/attilio/vmcontention/sys/amd64: amd64 include X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 02:12:49 -0000 Author: alc Date: Tue Mar 12 02:12:47 2013 New Revision: 248179 URL: http://svnweb.freebsd.org/changeset/base/248179 Log: When a superpage promotion occurs, the page table page that the superpage mapping replaces is added to an ordered collection of page table pages. Rather than preserving the code that implements the splay tree of pages in the pmap for just this one purpose, use the new MI radix tree. The extra overhead of using a radix tree for this purpose is small enough, about 4% added run-time to pmap_promote_pde(), that I don't see the point of preserving the splay tree code. Modified: user/attilio/vmcontention/sys/amd64/amd64/pmap.c user/attilio/vmcontention/sys/amd64/include/pmap.h Modified: user/attilio/vmcontention/sys/amd64/amd64/pmap.c ============================================================================== --- user/attilio/vmcontention/sys/amd64/amd64/pmap.c Mon Mar 11 23:05:32 2013 (r248178) +++ user/attilio/vmcontention/sys/amd64/amd64/pmap.c Tue Mar 12 02:12:47 2013 (r248179) @@ -131,6 +131,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -306,7 +307,6 @@ static boolean_t pmap_try_insert_pv_entr static void pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, pd_entry_t newpde); static void pmap_update_pde_invalidate(vm_offset_t va, pd_entry_t newpde); -static vm_page_t pmap_vmpage_splay(vm_pindex_t pindex, vm_page_t root); static vm_page_t _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp); @@ -1528,31 +1528,12 @@ pmap_add_delayed_free_list(vm_page_t m, * for mapping a distinct range of virtual addresses. The pmap's collection is * ordered by this virtual address range. */ -static void +static __inline void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte) { - vm_page_t root; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - root = pmap->pm_root; - if (root == NULL) { - mpte->md.pv_left = NULL; - mpte->md.pv_right = NULL; - } else { - root = pmap_vmpage_splay(mpte->pindex, root); - if (mpte->pindex < root->pindex) { - mpte->md.pv_left = root->md.pv_left; - mpte->md.pv_right = root; - root->md.pv_left = NULL; - } else if (mpte->pindex == root->pindex) - panic("pmap_insert_pt_page: pindex already inserted"); - else { - mpte->md.pv_right = root->md.pv_right; - mpte->md.pv_left = root; - root->md.pv_right = NULL; - } - } - pmap->pm_root = mpte; + vm_radix_insert(&pmap->pm_root, mpte->pindex, mpte); } /* @@ -1560,19 +1541,12 @@ pmap_insert_pt_page(pmap_t pmap, vm_page * specified pmap's collection of idle page table pages. Returns NULL if there * is no page table page corresponding to the specified virtual address. */ -static vm_page_t +static __inline vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va) { - vm_page_t mpte; - vm_pindex_t pindex = pmap_pde_pindex(va); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if ((mpte = pmap->pm_root) != NULL && mpte->pindex != pindex) { - mpte = pmap_vmpage_splay(pindex, mpte); - if ((pmap->pm_root = mpte)->pindex != pindex) - mpte = NULL; - } - return (mpte); + return (vm_radix_lookup(&pmap->pm_root, pmap_pde_pindex(va))); } /* @@ -1580,31 +1554,12 @@ pmap_lookup_pt_page(pmap_t pmap, vm_offs * of idle page table pages. The specified page table page must be a member of * the pmap's collection. */ -static void +static __inline void pmap_remove_pt_page(pmap_t pmap, vm_page_t mpte) { - vm_page_t root; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if (mpte != pmap->pm_root) { - root = pmap_vmpage_splay(mpte->pindex, pmap->pm_root); - KASSERT(mpte == root, - ("pmap_remove_pt_page: mpte %p is missing from pmap %p", - mpte, pmap)); - } - if (mpte->md.pv_left == NULL) - root = mpte->md.pv_right; - else { - root = pmap_vmpage_splay(mpte->pindex, mpte->md.pv_left); - root->md.pv_right = mpte->md.pv_right; - } - pmap->pm_root = root; - - /* - * Reinitialize the pv_list which could be dirty now because of the - * splay tree work. - */ - TAILQ_INIT(&mpte->md.pv_list); + vm_radix_remove(&pmap->pm_root, mpte->pindex); } /* @@ -1680,61 +1635,6 @@ _pmap_unwire_ptp(pmap_t pmap, vm_offset_ } /* - * Implements Sleator and Tarjan's top-down splay algorithm. Returns - * the vm_page containing the given pindex. If, however, that - * pindex is not found in the pmap, returns a vm_page that is - * adjacent to the pindex, coming before or after it. - */ -static vm_page_t -pmap_vmpage_splay(vm_pindex_t pindex, vm_page_t root) -{ - struct vm_page dummy; - vm_page_t lefttreemax, righttreemin, y; - - if (root == NULL) - return (root); - lefttreemax = righttreemin = &dummy; - for (;; root = y) { - if (pindex < root->pindex) { - if ((y = root->md.pv_left) == NULL) - break; - if (pindex < y->pindex) { - /* Rotate right. */ - root->md.pv_left = y->md.pv_right; - y->md.pv_right = root; - root = y; - if ((y = root->md.pv_left) == NULL) - break; - } - /* Link into the new root's right tree. */ - righttreemin->md.pv_left = root; - righttreemin = root; - } else if (pindex > root->pindex) { - if ((y = root->md.pv_right) == NULL) - break; - if (pindex > y->pindex) { - /* Rotate left. */ - root->md.pv_right = y->md.pv_left; - y->md.pv_left = root; - root = y; - if ((y = root->md.pv_right) == NULL) - break; - } - /* Link into the new root's left tree. */ - lefttreemax->md.pv_right = root; - lefttreemax = root; - } else - break; - } - /* Assemble the new root. */ - lefttreemax->md.pv_right = root->md.pv_left; - righttreemin->md.pv_left = root->md.pv_right; - root->md.pv_left = dummy.md.pv_right; - root->md.pv_right = dummy.md.pv_left; - return (root); -} - -/* * After removing a page table entry, this routine is used to * conditionally free the page, and manage the hold/wire counts. */ @@ -1756,7 +1656,7 @@ pmap_pinit0(pmap_t pmap) PMAP_LOCK_INIT(pmap); pmap->pm_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(KPML4phys); - pmap->pm_root = NULL; + pmap->pm_root.rt_root = 0; CPU_ZERO(&pmap->pm_active); PCPU_SET(curpmap, pmap); TAILQ_INIT(&pmap->pm_pvchunk); @@ -1797,7 +1697,7 @@ pmap_pinit(pmap_t pmap) /* install self-referential address mapping entry(s) */ pmap->pm_pml4[PML4PML4I] = VM_PAGE_TO_PHYS(pml4pg) | PG_V | PG_RW | PG_A | PG_M; - pmap->pm_root = NULL; + pmap->pm_root.rt_root = 0; CPU_ZERO(&pmap->pm_active); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); @@ -2039,7 +1939,7 @@ pmap_release(pmap_t pmap) KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); - KASSERT(pmap->pm_root == NULL, + KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_release: pmap has reserved page table page(s)")); m = PHYS_TO_VM_PAGE(pmap->pm_pml4[PML4PML4I] & PG_FRAME); Modified: user/attilio/vmcontention/sys/amd64/include/pmap.h ============================================================================== --- user/attilio/vmcontention/sys/amd64/include/pmap.h Mon Mar 11 23:05:32 2013 (r248178) +++ user/attilio/vmcontention/sys/amd64/include/pmap.h Tue Mar 12 02:12:47 2013 (r248179) @@ -150,6 +150,8 @@ #include #include +#include + typedef u_int64_t pd_entry_t; typedef u_int64_t pt_entry_t; typedef u_int64_t pdp_entry_t; @@ -235,20 +237,10 @@ struct pv_entry; struct pv_chunk; struct md_page { - union { - TAILQ_HEAD(,pv_entry) pvi_list; - struct { - vm_page_t pii_left; - vm_page_t pii_right; - } pvi_siters; - } pv_structs; - int pat_mode; + TAILQ_HEAD(,pv_entry) pv_list; + int pat_mode; }; -#define pv_list pv_structs.pvi_list -#define pv_left pv_structs.pvi_siters.pii_left -#define pv_right pv_structs.pvi_siters.pii_right - /* * The kernel virtual address (KVA) of the level 4 page table page is always * within the direct map (DMAP) region. @@ -260,7 +252,7 @@ struct pmap { cpuset_t pm_active; /* active on cpus */ /* spare u_int here due to padding */ struct pmap_statistics pm_stats; /* pmap statistics */ - vm_page_t pm_root; /* spare page table pages */ + struct vm_radix pm_root; /* spare page table pages */ }; typedef struct pmap *pmap_t; From owner-svn-src-user@FreeBSD.ORG Tue Mar 12 03:48:06 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 56B11B94; Tue, 12 Mar 2013 03:48:06 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3AB81658; Tue, 12 Mar 2013 03:48:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2C3m6vJ014434; Tue, 12 Mar 2013 03:48:06 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2C3m5mn014432; Tue, 12 Mar 2013 03:48:05 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201303120348.r2C3m5mn014432@svn.freebsd.org> From: Alan Cox Date: Tue, 12 Mar 2013 03:48:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248183 - in user/attilio/vmcontention/sys/i386: i386 include X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 03:48:06 -0000 Author: alc Date: Tue Mar 12 03:48:05 2013 New Revision: 248183 URL: http://svnweb.freebsd.org/changeset/base/248183 Log: MFamd64 When a superpage promotion occurs, the page table page that the superpage mapping replaces is added to an ordered collection of page table pages. Rather than preserving the code that implements the splay tree of pages in the pmap for just this one purpose, use the new MI radix tree. The extra overhead of using a radix tree for this purpose is small enough, about 4% added run-time to pmap_promote_pde(), that I don't see the point of preserving the splay tree code. Sponsored by: EMC / Isilon Storage Division Modified: user/attilio/vmcontention/sys/i386/i386/pmap.c user/attilio/vmcontention/sys/i386/include/pmap.h Modified: user/attilio/vmcontention/sys/i386/i386/pmap.c ============================================================================== --- user/attilio/vmcontention/sys/i386/i386/pmap.c Tue Mar 12 03:03:24 2013 (r248182) +++ user/attilio/vmcontention/sys/i386/i386/pmap.c Tue Mar 12 03:48:05 2013 (r248183) @@ -133,6 +133,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -330,7 +331,6 @@ static boolean_t pmap_try_insert_pv_entr static void pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, pd_entry_t newpde); static void pmap_update_pde_invalidate(vm_offset_t va, pd_entry_t newpde); -static vm_page_t pmap_vmpage_splay(vm_pindex_t pindex, vm_page_t root); static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags); @@ -1604,31 +1604,12 @@ pmap_add_delayed_free_list(vm_page_t m, * for mapping a distinct range of virtual addresses. The pmap's collection is * ordered by this virtual address range. */ -static void +static __inline void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte) { - vm_page_t root; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - root = pmap->pm_root; - if (root == NULL) { - mpte->md.pv_left = NULL; - mpte->md.pv_right = NULL; - } else { - root = pmap_vmpage_splay(mpte->pindex, root); - if (mpte->pindex < root->pindex) { - mpte->md.pv_left = root->md.pv_left; - mpte->md.pv_right = root; - root->md.pv_left = NULL; - } else if (mpte->pindex == root->pindex) - panic("pmap_insert_pt_page: pindex already inserted"); - else { - mpte->md.pv_right = root->md.pv_right; - mpte->md.pv_left = root; - root->md.pv_right = NULL; - } - } - pmap->pm_root = mpte; + vm_radix_insert(&pmap->pm_root, mpte->pindex, mpte); } /* @@ -1636,19 +1617,12 @@ pmap_insert_pt_page(pmap_t pmap, vm_page * specified pmap's collection of idle page table pages. Returns NULL if there * is no page table page corresponding to the specified virtual address. */ -static vm_page_t +static __inline vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va) { - vm_page_t mpte; - vm_pindex_t pindex = va >> PDRSHIFT; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if ((mpte = pmap->pm_root) != NULL && mpte->pindex != pindex) { - mpte = pmap_vmpage_splay(pindex, mpte); - if ((pmap->pm_root = mpte)->pindex != pindex) - mpte = NULL; - } - return (mpte); + return (vm_radix_lookup(&pmap->pm_root, va >> PDRSHIFT)); } /* @@ -1656,27 +1630,12 @@ pmap_lookup_pt_page(pmap_t pmap, vm_offs * of idle page table pages. The specified page table page must be a member of * the pmap's collection. */ -static void +static __inline void pmap_remove_pt_page(pmap_t pmap, vm_page_t mpte) { - vm_page_t root; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if (mpte != pmap->pm_root) - pmap_vmpage_splay(mpte->pindex, pmap->pm_root); - if (mpte->md.pv_left == NULL) - root = mpte->md.pv_right; - else { - root = pmap_vmpage_splay(mpte->pindex, mpte->md.pv_left); - root->md.pv_right = mpte->md.pv_right; - } - pmap->pm_root = root; - - /* - * Reinitialize the pv_list which could be dirty now because of the - * splay tree work. - */ - TAILQ_INIT(&mpte->md.pv_list); + vm_radix_remove(&pmap->pm_root, mpte->pindex); } /* @@ -1730,61 +1689,6 @@ _pmap_unwire_ptp(pmap_t pmap, vm_page_t } /* - * Implements Sleator and Tarjan's top-down splay algorithm. Returns - * the vm_page containing the given pindex. If, however, that - * pindex is not found in the pmap, returns a vm_page that is - * adjacent to the pindex, coming before or after it. - */ -static vm_page_t -pmap_vmpage_splay(vm_pindex_t pindex, vm_page_t root) -{ - struct vm_page dummy; - vm_page_t lefttreemax, righttreemin, y; - - if (root == NULL) - return (root); - lefttreemax = righttreemin = &dummy; - for (;; root = y) { - if (pindex < root->pindex) { - if ((y = root->md.pv_left) == NULL) - break; - if (pindex < y->pindex) { - /* Rotate right. */ - root->md.pv_left = y->md.pv_right; - y->md.pv_right = root; - root = y; - if ((y = root->md.pv_left) == NULL) - break; - } - /* Link into the new root's right tree. */ - righttreemin->md.pv_left = root; - righttreemin = root; - } else if (pindex > root->pindex) { - if ((y = root->md.pv_right) == NULL) - break; - if (pindex > y->pindex) { - /* Rotate left. */ - root->md.pv_right = y->md.pv_left; - y->md.pv_left = root; - root = y; - if ((y = root->md.pv_right) == NULL) - break; - } - /* Link into the new root's left tree. */ - lefttreemax->md.pv_right = root; - lefttreemax = root; - } else - break; - } - /* Assemble the new root. */ - lefttreemax->md.pv_right = root->md.pv_left; - righttreemin->md.pv_left = root->md.pv_right; - root->md.pv_left = dummy.md.pv_right; - root->md.pv_right = dummy.md.pv_left; - return (root); -} - -/* * After removing a page table entry, this routine is used to * conditionally free the page, and manage the hold/wire counts. */ @@ -1818,7 +1722,7 @@ pmap_pinit0(pmap_t pmap) #ifdef PAE pmap->pm_pdpt = (pdpt_entry_t *)(KERNBASE + (vm_offset_t)IdlePDPT); #endif - pmap->pm_root = NULL; + pmap->pm_root.rt_root = 0; CPU_ZERO(&pmap->pm_active); PCPU_SET(curpmap, pmap); TAILQ_INIT(&pmap->pm_pvchunk); @@ -1857,9 +1761,9 @@ pmap_pinit(pmap_t pmap) KASSERT(pmap_kextract((vm_offset_t)pmap->pm_pdpt) < (4ULL<<30), ("pmap_pinit: pdpt above 4g")); #endif - pmap->pm_root = NULL; + pmap->pm_root.rt_root = 0; } - KASSERT(pmap->pm_root == NULL, + KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_pinit: pmap has reserved page table page(s)")); /* @@ -2123,7 +2027,7 @@ pmap_release(pmap_t pmap) KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); - KASSERT(pmap->pm_root == NULL, + KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_release: pmap has reserved page table page(s)")); pmap_lazyfix(pmap); Modified: user/attilio/vmcontention/sys/i386/include/pmap.h ============================================================================== --- user/attilio/vmcontention/sys/i386/include/pmap.h Tue Mar 12 03:03:24 2013 (r248182) +++ user/attilio/vmcontention/sys/i386/include/pmap.h Tue Mar 12 03:48:05 2013 (r248183) @@ -159,6 +159,8 @@ #include #include +#include + #ifdef PAE typedef uint64_t pdpt_entry_t; @@ -426,20 +428,10 @@ struct pv_entry; struct pv_chunk; struct md_page { - union { - TAILQ_HEAD(,pv_entry) pvi_list; - struct { - vm_page_t pii_left; - vm_page_t pii_right; - } pvi_siters; - } pv_structs; - int pat_mode; + TAILQ_HEAD(,pv_entry) pv_list; + int pat_mode; }; -#define pv_list pv_structs.pvi_list -#define pv_left pv_structs.pvi_siters.pii_left -#define pv_right pv_structs.pvi_siters.pii_right - struct pmap { struct mtx pm_mtx; pd_entry_t *pm_pdir; /* KVA of page directory */ @@ -451,7 +443,7 @@ struct pmap { pdpt_entry_t *pm_pdpt; /* KVA of page director pointer table */ #endif - vm_page_t pm_root; /* spare page table pages */ + struct vm_radix pm_root; /* spare page table pages */ }; typedef struct pmap *pmap_t; From owner-svn-src-user@FreeBSD.ORG Tue Mar 12 06:14:32 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C37D8AB7; Tue, 12 Mar 2013 06:14:32 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AC6D3A08; Tue, 12 Mar 2013 06:14:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2C6EWH9058966; Tue, 12 Mar 2013 06:14:32 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2C6EWve058965; Tue, 12 Mar 2013 06:14:32 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201303120614.r2C6EWve058965@svn.freebsd.org> From: Alan Cox Date: Tue, 12 Mar 2013 06:14:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248185 - user/attilio/vmcontention/sys/vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 06:14:32 -0000 Author: alc Date: Tue Mar 12 06:14:31 2013 New Revision: 248185 URL: http://svnweb.freebsd.org/changeset/base/248185 Log: When transferring the page from one object to another, don't insert the page into its new object until the page's pindex has been updated. Otherwise, one code path within vm_radix_insert() may use the wrong pindex value. Sponsored by: EMC / Isilon Storage Division Modified: user/attilio/vmcontention/sys/vm/vm_page.c Modified: user/attilio/vmcontention/sys/vm/vm_page.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_page.c Tue Mar 12 04:37:04 2013 (r248184) +++ user/attilio/vmcontention/sys/vm/vm_page.c Tue Mar 12 06:14:31 2013 (r248185) @@ -1110,10 +1110,10 @@ vm_page_cache_transfer(vm_object_t orig_ if ((m->pindex - offidxstart) >= new_object->size) break; vm_radix_remove(&orig_object->cache, m->pindex); - vm_radix_insert(&new_object->cache, m->pindex - offidxstart, m); /* Update the page's object and offset. */ m->object = new_object; m->pindex -= offidxstart; + vm_radix_insert(&new_object->cache, m->pindex, m); } mtx_unlock(&vm_page_queue_free_mtx); } From owner-svn-src-user@FreeBSD.ORG Tue Mar 12 12:02:13 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4FD19155; Tue, 12 Mar 2013 12:02:13 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3C2DEFDA; Tue, 12 Mar 2013 12:02:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2CC2DUU065117; Tue, 12 Mar 2013 12:02:13 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2CC27Zn065074; Tue, 12 Mar 2013 12:02:07 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303121202.r2CC27Zn065074@svn.freebsd.org> From: Attilio Rao Date: Tue, 12 Mar 2013 12:02:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248190 - in user/attilio/vmcontention: . lib/libnetgraph share/examples share/examples/cvsup share/misc sys/arm/at91 sys/arm/include sys/dev/acpica sys/dev/ath/ath_hal/ar9002 sys/dev/i... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 12:02:13 -0000 Author: attilio Date: Tue Mar 12 12:02:06 2013 New Revision: 248190 URL: http://svnweb.freebsd.org/changeset/base/248190 Log: MFC Deleted: user/attilio/vmcontention/share/examples/cvsup/ports-supfile user/attilio/vmcontention/share/examples/cvsup/refuse user/attilio/vmcontention/share/examples/cvsup/refuse.README Modified: user/attilio/vmcontention/ObsoleteFiles.inc user/attilio/vmcontention/lib/libnetgraph/msg.c user/attilio/vmcontention/share/examples/Makefile user/attilio/vmcontention/share/examples/cvsup/README user/attilio/vmcontention/share/examples/cvsup/cvs-supfile user/attilio/vmcontention/share/examples/cvsup/stable-supfile user/attilio/vmcontention/share/misc/organization.dot user/attilio/vmcontention/sys/arm/at91/if_ate.c user/attilio/vmcontention/sys/arm/include/signal.h user/attilio/vmcontention/sys/dev/acpica/acpi_hpet.c user/attilio/vmcontention/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c user/attilio/vmcontention/sys/dev/iscsi/initiator/isc_soc.c user/attilio/vmcontention/sys/dev/sound/pci/hda/hdaa_patches.c user/attilio/vmcontention/sys/dev/sound/pci/hda/hdac.h user/attilio/vmcontention/sys/dev/usb/serial/uftdi.c user/attilio/vmcontention/sys/dev/usb/usbdevs user/attilio/vmcontention/sys/fs/nfs/nfsport.h user/attilio/vmcontention/sys/kern/kern_synch.c user/attilio/vmcontention/sys/kern/kern_time.c user/attilio/vmcontention/sys/kern/subr_sleepqueue.c user/attilio/vmcontention/sys/kern/uipc_socket.c user/attilio/vmcontention/sys/kern/uipc_syscalls.c user/attilio/vmcontention/sys/kern/uipc_usrreq.c user/attilio/vmcontention/sys/modules/ath/Makefile user/attilio/vmcontention/sys/net/if_bridge.c user/attilio/vmcontention/sys/netinet/libalias/alias_db.c user/attilio/vmcontention/sys/netinet6/raw_ip6.c user/attilio/vmcontention/sys/xdr/xdr_mbuf.c user/attilio/vmcontention/usr.bin/top/machine.c user/attilio/vmcontention/usr.sbin/bhyve/pci_passthru.c Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/usr.sbin/bhyve/ (props changed) Modified: user/attilio/vmcontention/ObsoleteFiles.inc ============================================================================== --- user/attilio/vmcontention/ObsoleteFiles.inc Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/ObsoleteFiles.inc Tue Mar 12 12:02:06 2013 (r248190) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20130311: Ports are no more available via cvsup +OLD_FILES+=usr/share/examples/cvsup/ports-supfile +OLD_FILES+=usr/share/examples/cvsup/refuse +OLD_FILES+=usr/share/examples/cvsup/refuse.README # 20130309: NWFS and NCP supports removed OLD_FILES+=usr/bin/ncplist OLD_FILES+=usr/bin/ncplogin Modified: user/attilio/vmcontention/lib/libnetgraph/msg.c ============================================================================== --- user/attilio/vmcontention/lib/libnetgraph/msg.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/lib/libnetgraph/msg.c Tue Mar 12 12:02:06 2013 (r248190) @@ -234,7 +234,7 @@ NgDeliverMsg(int cs, const char *path, } /* Wait for reply if there should be one. */ - if (msg->header.cmd & NGM_HASREPLY) { + if (msg->header.cmd & NGM_HASREPLY && !(msg->header.flags & NGF_RESP)) { struct pollfd rfds; int n; Modified: user/attilio/vmcontention/share/examples/Makefile ============================================================================== --- user/attilio/vmcontention/share/examples/Makefile Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/share/examples/Makefile Tue Mar 12 12:02:06 2013 (r248190) @@ -52,9 +52,6 @@ XFILES= BSD_daemon/FreeBSD.pfa \ csh/dot.cshrc \ cvsup/README \ cvsup/cvs-supfile \ - cvsup/ports-supfile \ - cvsup/refuse \ - cvsup/refuse.README \ cvsup/stable-supfile \ cvsup/standard-supfile \ diskless/ME \ Modified: user/attilio/vmcontention/share/examples/cvsup/README ============================================================================== --- user/attilio/vmcontention/share/examples/cvsup/README Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/share/examples/cvsup/README Tue Mar 12 12:02:06 2013 (r248190) @@ -19,8 +19,6 @@ To maintain the sources for the FreeBSD- standard-supfile Main source tree - ports-supfile Ports collection - To maintain the sources for the FreeBSD-stable release, use: stable-supfile Main source tree @@ -28,7 +26,7 @@ To maintain the sources for the FreeBSD- To maintain a copy of the CVS repository containing all versions of FreeBSD, use: - cvs-supfile Main source tree and ports collection + cvs-supfile Main source tree collection IMPORTANT: Before you use any of the supfiles in this directory, you will need to edit in an appropriate "host" setting. See: Modified: user/attilio/vmcontention/share/examples/cvsup/cvs-supfile ============================================================================== --- user/attilio/vmcontention/share/examples/cvsup/cvs-supfile Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/share/examples/cvsup/cvs-supfile Tue Mar 12 12:02:06 2013 (r248190) @@ -43,9 +43,8 @@ # prefix=/home/ncvs # This specifies where to place the requested files. A # setting of "/home/ncvs" will place all of the files -# requested in /home/ncvs (e.g., "/home/ncvs/src/bin", -# "/home/ncvs/ports/archivers"). The prefix directory -# must exist in order to run CVSup. +# requested in /home/ncvs (e.g., "/home/ncvs/src/bin"). +# The prefix directory must exist in order to run CVSup. # Defaults that apply to all the collections # @@ -68,13 +67,6 @@ # mega-collection. It includes all of the individual "src-*" collections. src-all -## Ports Collection. -# -# The easiest way to get the ports tree is to use the "ports-all" -# mega-collection. It includes all of the individual "ports-*" -# collections, -ports-all - ## Projects # # This collection retrieves the projects tree of the FreeBSD Modified: user/attilio/vmcontention/share/examples/cvsup/stable-supfile ============================================================================== --- user/attilio/vmcontention/share/examples/cvsup/stable-supfile Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/share/examples/cvsup/stable-supfile Tue Mar 12 12:02:06 2013 (r248190) @@ -46,21 +46,6 @@ # in "/usr/src" (e.g., "/usr/src/bin", "/usr/src/lib"). # The prefix directory must exist in order to run CVSup. # -############################################################################### -# -# DANGER! WARNING! LOOK OUT! VORSICHT! -# -# If you add any of the ports collections to this file, be sure to -# specify them with a "tag" value set to ".", like this: -# -# ports-all tag=. -# -# If you leave out the "tag=." portion, CVSup will delete all of -# the files in your ports. That is because the ports -# collections do not use the same tags as the main part of the FreeBSD -# source tree. -# -############################################################################### # Defaults that apply to all the collections # Modified: user/attilio/vmcontention/share/misc/organization.dot ============================================================================== --- user/attilio/vmcontention/share/misc/organization.dot Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/share/misc/organization.dot Tue Mar 12 12:02:06 2013 (r248190) @@ -30,7 +30,7 @@ coresecretary [label="Core Team Secretar doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"] doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\ngjb, blackend,\ngabor, hrs"] portscommitters [label="Ports Committers\nports-committers@FreeBSD.org"] -portmgr [label="Port Management Team\nportmgr@FreeBSD.org\ntabthorpe, marcus, bapt, beat,\nerwin, linimon, pav,\nitetcu, miwi"] +portmgr [label="Port Management Team\nportmgr@FreeBSD.org\ntabthorpe, marcus, bapt, \nerwin, pav,\nitetcu, miwi"] portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\ntabthorpe"] re [label="Primary Release Engineering Team\nre@FreeBSD.org\nkib, blackend, jpaetzel, hrs, kensmith"] secteam [label="Security Team\nsecteam@FreeBSD.org\nsimon, qingli, delphij,\nremko, philip, stas, cperciva,\ncsjp, rwatson, miwi, bz"] @@ -43,13 +43,12 @@ srccommitters [label="Src Committers\nsr accounts [label="Accounts Team\naccounts@FreeBSD.org\nmarkm, simon, kensmith,\ndhw"] backups [label="Backup Administrators\nbackups@FreeBSD.org\nsimon, kensmith,\ndhw"] -bugmeister [label="Bugmeister Team\nbugmeister@FreeBSD.org\neadler, gavin, gonzo, linimon"] +bugmeister [label="Bugmeister Team\nbugmeister@FreeBSD.org\neadler, gavin, gonzo"] clusteradm [label="Cluster Administrators\nclusteradm@FreeBSD.org\nbrd, simon, ps,\nkensmith, peter"] cvsupmaster [label="CVSup Mirror Site Coordinators\ncvsup-master@FreeBSD.org\nkuriyama, jdp,\nkensmith"] dnsadm [label="DNS Administrators\ndnsadm@FreeBSD.org\nbillf, dg, ps,\nkensmith, peter"] mirroradmin [label="FTP/WWW Mirror Site Coordinators\nmirror-admin@FreeBSD.org\nkuriyama, kensmith"] ncvs [label="CVS src Repository Managers\nncvs@FreeBSD.org\njoe, kuriyama, markm,\nsimon, peter"] -pcvs [label="CVS ports Repository Managers\npcvs@FreeBSD.org\nmarcus, joe, kuriyama,\nmarkm, simon"] perforceadmin [label="Perforce Repository Administrators\nperforce-admin@FreeBSD.org\nscottl, kensmith, gordon,\nrwatson, peter, dhw"] postmaster [label="Postmaster Team\npostmaster@FreeBSD.org\njmb, brd, sahil, dhw"] refadm [label="Reference Systems Administrators\nrefadm@FreeBSD.org\njake, billf, markm, simon,\nobrien, ps, kensmith,\npeter, dhw"] @@ -70,8 +69,6 @@ _admin -> backups _admin -> bugmeister _admin -> clusteradm _admin -> ncvs -_admin -> pcvs -_admin -> dcvs _admin -> cvsupmaster _admin -> dnsadm _admin -> mirroradmin Modified: user/attilio/vmcontention/sys/arm/at91/if_ate.c ============================================================================== --- user/attilio/vmcontention/sys/arm/at91/if_ate.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/arm/at91/if_ate.c Tue Mar 12 12:02:06 2013 (r248190) @@ -899,12 +899,9 @@ ate_intr(void *xsc) /* FCS is not coppied into mbuf. */ remain = (sc->rx_descs[idx].status & ETH_LEN_MASK) - 4; - /* Get an appropriately sized mbuf */ - if (remain + ETHER_ALIGN >= MINCLSIZE) - mb = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); - else - MGETHDR(mb, M_NOWAIT, MT_DATA); - + /* Get an appropriately sized mbuf. */ + mb = m_get2(M_NOWAIT, MT_DATA, M_PKTHDR, + remain + ETHER_ALIGN); if (mb == NULL) { sc->ifp->if_iqdrops++; rxdhead->status = 0; Modified: user/attilio/vmcontention/sys/arm/include/signal.h ============================================================================== --- user/attilio/vmcontention/sys/arm/include/signal.h Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/arm/include/signal.h Tue Mar 12 12:02:06 2013 (r248190) @@ -42,6 +42,7 @@ typedef long sig_atomic_t; #if __BSD_VISIBLE struct sigcontext { + int _dummy; }; #endif Modified: user/attilio/vmcontention/sys/dev/acpica/acpi_hpet.c ============================================================================== --- user/attilio/vmcontention/sys/dev/acpica/acpi_hpet.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/dev/acpica/acpi_hpet.c Tue Mar 12 12:02:06 2013 (r248190) @@ -675,7 +675,8 @@ hpet_attach(device_t dev) if (t->pcpu_master >= 0) { t->et.et_flags |= ET_FLAGS_PERCPU; t->et.et_quality += 100; - } + } else if (mp_ncpus >= 8) + t->et.et_quality -= 100; if ((t->caps & HPET_TCAP_PER_INT) == 0) t->et.et_quality -= 10; t->et.et_frequency = sc->freq; Modified: user/attilio/vmcontention/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c ============================================================================== --- user/attilio/vmcontention/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c Tue Mar 12 12:02:06 2013 (r248190) @@ -50,7 +50,7 @@ ar9285BTCoexAntennaDiversity(struct ath_ if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ALLOW) || (AH5212(ah)->ah_diversity != HAL_ANT_VARIABLE)) { if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ENABLE) && - (AH5212(ah)->ah_diversity == HAL_ANT_VARIABLE)) { + (AH5212(ah)->ah_antControl == HAL_ANT_VARIABLE)) { /* Enable antenna diversity */ ant_div_control1 = HAL_BT_COEX_ANTDIV_CONTROL1_ENABLE; ant_div_control2 = HAL_BT_COEX_ANTDIV_CONTROL2_ENABLE; @@ -63,7 +63,7 @@ ar9285BTCoexAntennaDiversity(struct ath_ OS_REG_WRITE(ah, AR_PHY_SWITCH_COM, HAL_BT_COEX_ANT_DIV_SWITCH_COM); OS_REG_RMW(ah, AR_PHY_SWITCH_CHAIN_0, 0, 0xf0000000); - } else if (AH5212(ah)->ah_diversity == HAL_ANT_FIXED_B) { + } else if (AH5212(ah)->ah_antControl == HAL_ANT_FIXED_B) { /* Disable antenna diversity. Use antenna B(LNA2) only. */ ant_div_control1 = HAL_BT_COEX_ANTDIV_CONTROL1_FIXED_B; ant_div_control2 = HAL_BT_COEX_ANTDIV_CONTROL2_FIXED_B; Modified: user/attilio/vmcontention/sys/dev/iscsi/initiator/isc_soc.c ============================================================================== --- user/attilio/vmcontention/sys/dev/iscsi/initiator/isc_soc.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/dev/iscsi/initiator/isc_soc.c Tue Mar 12 12:02:06 2013 (r248190) @@ -91,7 +91,7 @@ isc_sendPDU(isc_session_t *sp, pduq_t *p /* | mbuf for the iSCSI header */ - MGETHDR(mh, M_TRYWAIT, MT_DATA); + MGETHDR(mh, M_WAITOK, MT_DATA); mh->m_pkthdr.rcvif = NULL; mh->m_next = NULL; mh->m_len = sizeof(union ipdu_u); @@ -132,7 +132,7 @@ isc_sendPDU(isc_session_t *sp, pduq_t *p while(len > 0) { int l; - MGET(md, M_TRYWAIT, MT_DATA); + MGET(md, M_WAITOK, MT_DATA); md->m_ext.ref_cnt = &ou_refcnt; l = min(MCLBYTES, len); debug(4, "setting ext_free(arg=%p len/l=%d/%d)", pq->buf, len, l); @@ -150,7 +150,7 @@ isc_sendPDU(isc_session_t *sp, pduq_t *p off += l; } if(((pp->ds_len & 03) != 0) || ISOK2DIG(sp->dataDigest, pp)) { - MGET(md, M_TRYWAIT, MT_DATA); + MGET(md, M_WAITOK, MT_DATA); if(pp->ds_len & 03) len = 4 - (pp->ds_len & 03); else Modified: user/attilio/vmcontention/sys/dev/sound/pci/hda/hdaa_patches.c ============================================================================== --- user/attilio/vmcontention/sys/dev/sound/pci/hda/hdaa_patches.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/dev/sound/pci/hda/hdaa_patches.c Tue Mar 12 12:02:06 2013 (r248190) @@ -344,7 +344,9 @@ hdac_pin_patch(struct hdaa_widget *w) break; } } else if (id == HDA_CODEC_ALC269 && - subid == LENOVO_X1CRBN_SUBVENDOR) { + (subid == LENOVO_X1CRBN_SUBVENDOR || + subid == LENOVO_T430_SUBVENDOR || + subid == LENOVO_T430S_SUBVENDOR)) { switch (nid) { case 21: patch = "as=1 seq=15"; Modified: user/attilio/vmcontention/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- user/attilio/vmcontention/sys/dev/sound/pci/hda/hdac.h Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/dev/sound/pci/hda/hdac.h Tue Mar 12 12:02:06 2013 (r248190) @@ -225,6 +225,8 @@ #define LENOVO_X220_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21da) #define LENOVO_X300_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac) #define LENOVO_T420_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21ce) +#define LENOVO_T430_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f3) +#define LENOVO_T430S_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb) #define LENOVO_T520_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21cf) #define LENOVO_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0xffff) Modified: user/attilio/vmcontention/sys/dev/usb/serial/uftdi.c ============================================================================== --- user/attilio/vmcontention/sys/dev/usb/serial/uftdi.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/dev/usb/serial/uftdi.c Tue Mar 12 12:02:06 2013 (r248190) @@ -753,6 +753,8 @@ static const STRUCT_USB_HOST_ID uftdi_de UFTDI_DEV(MOBILITY, USB_SERIAL, UFTDI_TYPE_AUTO), UFTDI_DEV(OLIMEX, ARM_USB_OCD, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), UFTDI_DEV(OLIMEX, ARM_USB_OCD_H, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(OPTO, CRD7734, UFTDI_TYPE_AUTO), + UFTDI_DEV(OPTO, CRD7734_1, UFTDI_TYPE_AUTO), UFTDI_DEV(PAPOUCH, AD4USB, UFTDI_TYPE_AUTO), UFTDI_DEV(PAPOUCH, AP485, UFTDI_TYPE_AUTO), UFTDI_DEV(PAPOUCH, AP485_2, UFTDI_TYPE_AUTO), Modified: user/attilio/vmcontention/sys/dev/usb/usbdevs ============================================================================== --- user/attilio/vmcontention/sys/dev/usb/usbdevs Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/dev/usb/usbdevs Tue Mar 12 12:02:06 2013 (r248190) @@ -323,6 +323,7 @@ vendor GUNZE 0x0637 Gunze Electronics U vendor AVISION 0x0638 Avision vendor TEAC 0x0644 TEAC vendor ACTON 0x0647 Acton Research Corp. +vendor OPTO 0x065a Optoelectronics Co., Ltd vendor SGI 0x065e Silicon Graphics vendor SANWASUPPLY 0x0663 Sanwa Supply vendor MEGATEC 0x0665 Megatec @@ -3150,6 +3151,13 @@ product OPTION ICON321 0xd031 Globetrot product OPTION ICON505 0xd055 Globetrotter iCON 505 product OPTION ICON452 0x7901 Globetrotter iCON 452 +/* Optoelectronics Co., Ltd */ +product OPTO BARCODE 0x0001 Barcode Reader +product OPTO OPTICONCODE 0x0009 Opticon Code Reader +product OPTO BARCODE_1 0xa002 Barcode Reader +product OPTO CRD7734 0xc000 USB Cradle CRD-7734-RU +product OPTO CRD7734_1 0xc001 USB Cradle CRD-7734-RU + /* OvisLink product */ product OVISLINK RT3072 0x3072 RT3072 Modified: user/attilio/vmcontention/sys/fs/nfs/nfsport.h ============================================================================== --- user/attilio/vmcontention/sys/fs/nfs/nfsport.h Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/fs/nfs/nfsport.h Tue Mar 12 12:02:06 2013 (r248190) @@ -140,32 +140,32 @@ * Allocate mbufs. Must succeed and never set the mbuf ptr to NULL. */ #define NFSMGET(m) do { \ - MGET((m), M_TRYWAIT, MT_DATA); \ + MGET((m), M_WAITOK, MT_DATA); \ while ((m) == NULL ) { \ (void) nfs_catnap(PZERO, 0, "nfsmget"); \ - MGET((m), M_TRYWAIT, MT_DATA); \ + MGET((m), M_WAITOK, MT_DATA); \ } \ } while (0) #define NFSMGETHDR(m) do { \ - MGETHDR((m), M_TRYWAIT, MT_DATA); \ + MGETHDR((m), M_WAITOK, MT_DATA); \ while ((m) == NULL ) { \ (void) nfs_catnap(PZERO, 0, "nfsmget"); \ - MGETHDR((m), M_TRYWAIT, MT_DATA); \ + MGETHDR((m), M_WAITOK, MT_DATA); \ } \ } while (0) #define NFSMCLGET(m, w) do { \ - MGET((m), M_TRYWAIT, MT_DATA); \ + MGET((m), M_WAITOK, MT_DATA); \ while ((m) == NULL ) { \ (void) nfs_catnap(PZERO, 0, "nfsmget"); \ - MGET((m), M_TRYWAIT, MT_DATA); \ + MGET((m), M_WAITOK, MT_DATA); \ } \ MCLGET((m), (w)); \ } while (0) #define NFSMCLGETHDR(m, w) do { \ - MGETHDR((m), M_TRYWAIT, MT_DATA); \ + MGETHDR((m), M_WAITOK, MT_DATA); \ while ((m) == NULL ) { \ (void) nfs_catnap(PZERO, 0, "nfsmget"); \ - MGETHDR((m), M_TRYWAIT, MT_DATA); \ + MGETHDR((m), M_WAITOK, MT_DATA); \ } \ } while (0) #define NFSMTOD mtod Modified: user/attilio/vmcontention/sys/kern/kern_synch.c ============================================================================== --- user/attilio/vmcontention/sys/kern/kern_synch.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/kern/kern_synch.c Tue Mar 12 12:02:06 2013 (r248190) @@ -85,7 +85,7 @@ SYSINIT(synch_setup, SI_SUB_KICK_SCHEDUL NULL); int hogticks; -static int pause_wchan; +static uint8_t pause_wchan[MAXCPU]; static struct callout loadav_callout; @@ -198,7 +198,8 @@ _sleep(void *ident, struct lock_object * if (TD_ON_SLEEPQ(td)) sleepq_remove(td, td->td_wchan); - if (ident == &pause_wchan) + if ((uint8_t *)ident >= &pause_wchan[0] && + (uint8_t *)ident <= &pause_wchan[MAXCPU - 1]) sleepq_flags = SLEEPQ_PAUSE; else sleepq_flags = SLEEPQ_SLEEP; @@ -372,7 +373,7 @@ pause_sbt(const char *wmesg, sbintime_t DELAY((sbt & 0xffffffff) / SBT_1US); return (0); } - return (_sleep(&pause_wchan, NULL, 0, wmesg, sbt, pr, flags)); + return (_sleep(&pause_wchan[curcpu], NULL, 0, wmesg, sbt, pr, flags)); } /* Modified: user/attilio/vmcontention/sys/kern/kern_time.c ============================================================================== --- user/attilio/vmcontention/sys/kern/kern_time.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/kern/kern_time.c Tue Mar 12 12:02:06 2013 (r248190) @@ -477,7 +477,7 @@ kern_clock_getres(struct thread *td, clo return (0); } -static int nanowait; +static uint8_t nanowait[MAXCPU]; int kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec *rmt) @@ -503,8 +503,8 @@ kern_nanosleep(struct thread *td, struct if (TIMESEL(&sbt, tmp)) sbt += tc_tick_sbt; sbt += tmp; - error = tsleep_sbt(&nanowait, PWAIT | PCATCH, "nanslp", sbt, prec, - C_ABSOLUTE); + error = tsleep_sbt(&nanowait[curcpu], PWAIT | PCATCH, "nanslp", + sbt, prec, C_ABSOLUTE); if (error != EWOULDBLOCK) { if (error == ERESTART) error = EINTR; Modified: user/attilio/vmcontention/sys/kern/subr_sleepqueue.c ============================================================================== --- user/attilio/vmcontention/sys/kern/subr_sleepqueue.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/kern/subr_sleepqueue.c Tue Mar 12 12:02:06 2013 (r248190) @@ -88,16 +88,14 @@ __FBSDID("$FreeBSD$"); #endif /* - * Constants for the hash table of sleep queue chains. These constants are - * the same ones that 4BSD (and possibly earlier versions of BSD) used. - * Basically, we ignore the lower 8 bits of the address since most wait - * channel pointers are aligned and only look at the next 7 bits for the - * hash. SC_TABLESIZE must be a power of two for SC_MASK to work properly. + * Constants for the hash table of sleep queue chains. + * SC_TABLESIZE must be a power of two for SC_MASK to work properly. */ -#define SC_TABLESIZE 128 /* Must be power of 2. */ +#define SC_TABLESIZE 256 /* Must be power of 2. */ #define SC_MASK (SC_TABLESIZE - 1) #define SC_SHIFT 8 -#define SC_HASH(wc) (((uintptr_t)(wc) >> SC_SHIFT) & SC_MASK) +#define SC_HASH(wc) ((((uintptr_t)(wc) >> SC_SHIFT) ^ (uintptr_t)(wc)) & \ + SC_MASK) #define SC_LOOKUP(wc) &sleepq_chains[SC_HASH(wc)] #define NR_SLEEPQS 2 /* Modified: user/attilio/vmcontention/sys/kern/uipc_socket.c ============================================================================== --- user/attilio/vmcontention/sys/kern/uipc_socket.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/kern/uipc_socket.c Tue Mar 12 12:02:06 2013 (r248190) @@ -136,6 +136,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -565,8 +566,12 @@ sonewconn(struct socket *head, int conns /* * The accept socket may be tearing down but we just * won a race on the ACCEPT_LOCK. + * However, if sctp_peeloff() is called on a 1-to-many + * style socket, the SO_ACCEPTCONN doesn't need to be set. */ - if (!(head->so_options & SO_ACCEPTCONN)) { + if (!(head->so_options & SO_ACCEPTCONN) && + ((head->so_proto->pr_protocol != IPPROTO_SCTP) || + (head->so_type != SOCK_SEQPACKET))) { SOCK_LOCK(so); so->so_head = NULL; sofree(so); /* NB: returns ACCEPT_UNLOCK'ed. */ Modified: user/attilio/vmcontention/sys/kern/uipc_syscalls.c ============================================================================== --- user/attilio/vmcontention/sys/kern/uipc_syscalls.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/kern/uipc_syscalls.c Tue Mar 12 12:02:06 2013 (r248190) @@ -2386,8 +2386,10 @@ sys_sctp_peeloff(td, uap) CURVNET_SET(head->so_vnet); so = sonewconn(head, SS_ISCONNECTED); - if (so == NULL) + if (so == NULL) { + error = ENOMEM; goto noconnection; + } /* * Before changing the flags on the socket, we have to bump the * reference count. Otherwise, if the protocol calls sofree(), Modified: user/attilio/vmcontention/sys/kern/uipc_usrreq.c ============================================================================== --- user/attilio/vmcontention/sys/kern/uipc_usrreq.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/kern/uipc_usrreq.c Tue Mar 12 12:02:06 2013 (r248190) @@ -282,7 +282,7 @@ static void unp_dispose(struct mbuf *); static void unp_shutdown(struct unpcb *); static void unp_drop(struct unpcb *, int); static void unp_gc(__unused void *, int); -static void unp_scan(struct mbuf *, void (*)(struct file *)); +static void unp_scan(struct mbuf *, void (*)(struct filedescent **, int)); static void unp_discard(struct file *); static void unp_freerights(struct filedescent **, int); static void unp_init(void); @@ -2135,17 +2135,22 @@ static int unp_marked; static int unp_unreachable; static void -unp_accessable(struct file *fp) +unp_accessable(struct filedescent **fdep, int fdcount) { struct unpcb *unp; + struct file *fp; + int i; - if ((unp = fptounp(fp)) == NULL) - return; - if (unp->unp_gcflag & UNPGC_REF) - return; - unp->unp_gcflag &= ~UNPGC_DEAD; - unp->unp_gcflag |= UNPGC_REF; - unp_marked++; + for (i = 0; i < fdcount; i++) { + fp = fdep[i]->fde_file; + if ((unp = fptounp(fp)) == NULL) + continue; + if (unp->unp_gcflag & UNPGC_REF) + continue; + unp->unp_gcflag &= ~UNPGC_DEAD; + unp->unp_gcflag |= UNPGC_REF; + unp_marked++; + } } static void @@ -2292,19 +2297,16 @@ unp_dispose(struct mbuf *m) { if (m) - unp_scan(m, unp_discard); + unp_scan(m, unp_freerights); } static void -unp_scan(struct mbuf *m0, void (*op)(struct file *)) +unp_scan(struct mbuf *m0, void (*op)(struct filedescent **, int)) { struct mbuf *m; - struct filedescent **fdep; struct cmsghdr *cm; void *data; - int i; socklen_t clen, datalen; - int qfds; while (m0 != NULL) { for (m = m0; m; m = m->m_next) { @@ -2324,10 +2326,8 @@ unp_scan(struct mbuf *m0, void (*op)(str if (cm->cmsg_level == SOL_SOCKET && cm->cmsg_type == SCM_RIGHTS) { - qfds = datalen / sizeof(*fdep); - fdep = data; - for (i = 0; i < qfds; i++) - (*op)(fdep[i]->fde_file); + (*op)(data, datalen / + sizeof(struct filedescent *)); } if (CMSG_SPACE(datalen) < clen) { Modified: user/attilio/vmcontention/sys/modules/ath/Makefile ============================================================================== --- user/attilio/vmcontention/sys/modules/ath/Makefile Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/modules/ath/Makefile Tue Mar 12 12:02:06 2013 (r248190) @@ -124,7 +124,7 @@ SRCS+= ah_eeprom_9287.c SRCS+= ar9287.c ar9287_reset.c ar9287_attach.c ar9287_cal.c ar9287_olc.c # + AR9300 HAL -# .PATH: ${.CURDIR}/../../dev/ath/ath_hal/ar9003 +# .PATH: ${.CURDIR}/../../contrib/sys/dev/ath/ath_hal/ar9300 #SRCS+= ar9300_interrupts.c ar9300_radar.c ar9300_ani.c ar9300_keycache.c #SRCS+= ar9300_radio.c ar9300_xmit.c ar9300_attach.c ar9300_mci.c ar9300_stub.c #SRCS+= ar9300_xmit_ds.c ar9300_beacon.c ar9300_misc.c ar9300_recv.c @@ -149,6 +149,7 @@ SRCS+= amrr.c SRCS+= dfs_null.c CFLAGS+= -I. -I${.CURDIR}/../../dev/ath -I${.CURDIR}/../../dev/ath/ath_hal +# CFLAGS+= -I. -I${.CURDIR}/../../contrib/sys/dev/ath/ath_hal/ .if !defined(KERNBUILDDIR) opt_ah.h: Modified: user/attilio/vmcontention/sys/net/if_bridge.c ============================================================================== --- user/attilio/vmcontention/sys/net/if_bridge.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/net/if_bridge.c Tue Mar 12 12:02:06 2013 (r248190) @@ -2314,6 +2314,7 @@ bridge_input(struct ifnet *ifp, struct m BRIDGE_UNLOCK(sc); \ return (NULL); \ } \ + eh = mtod(m, struct ether_header *); \ } \ } \ if (bif->bif_flags & IFBIF_LEARNING) { \ Modified: user/attilio/vmcontention/sys/netinet/libalias/alias_db.c ============================================================================== --- user/attilio/vmcontention/sys/netinet/libalias/alias_db.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/netinet/libalias/alias_db.c Tue Mar 12 12:02:06 2013 (r248190) @@ -2729,7 +2729,6 @@ static void InitPunchFW(struct libalias *la) { - LIBALIAS_LOCK_ASSERT(la); la->fireWallField = malloc(la->fireWallNumNums); if (la->fireWallField) { memset(la->fireWallField, 0, la->fireWallNumNums); @@ -2745,7 +2744,6 @@ static void UninitPunchFW(struct libalias *la) { - LIBALIAS_LOCK_ASSERT(la); ClearAllFWHoles(la); if (la->fireWallFD >= 0) close(la->fireWallFD); @@ -2765,7 +2763,6 @@ PunchFWHole(struct alias_link *lnk) struct ip_fw rule; /* On-the-fly built rule */ int fwhole; /* Where to punch hole */ - LIBALIAS_LOCK_ASSERT(la); la = lnk->la; /* Don't do anything unless we are asked to */ @@ -2839,7 +2836,6 @@ ClearFWHole(struct alias_link *lnk) { struct libalias *la; - LIBALIAS_LOCK_ASSERT(la); la = lnk->la; if (lnk->link_type == LINK_TCP) { int fwhole = lnk->data.tcp->fwhole; /* Where is the firewall @@ -2864,7 +2860,6 @@ ClearAllFWHoles(struct libalias *la) struct ip_fw rule; /* On-the-fly built rule */ int i; - LIBALIAS_LOCK_ASSERT(la); if (la->fireWallFD < 0) return; @@ -2878,7 +2873,7 @@ ClearAllFWHoles(struct libalias *la) memset(la->fireWallField, 0, la->fireWallNumNums); } -#endif +#endif /* !NO_FW_PUNCH */ void LibAliasSetFWBase(struct libalias *la, unsigned int base, unsigned int num) Modified: user/attilio/vmcontention/sys/netinet6/raw_ip6.c ============================================================================== --- user/attilio/vmcontention/sys/netinet6/raw_ip6.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/netinet6/raw_ip6.c Tue Mar 12 12:02:06 2013 (r248190) @@ -197,6 +197,7 @@ rip6_input(struct mbuf **mp, int *offp, &ip6->ip6_dst) != 0) continue; } + INP_RLOCK(in6p); if (in6p->in6p_cksum != -1) { V_rip6stat.rip6s_isum++; if (in6_cksum(m, proto, *offp, @@ -206,7 +207,6 @@ rip6_input(struct mbuf **mp, int *offp, continue; } } - INP_RLOCK(in6p); /* * If this raw socket has multicast state, and we * have received a multicast, check if this socket Modified: user/attilio/vmcontention/sys/xdr/xdr_mbuf.c ============================================================================== --- user/attilio/vmcontention/sys/xdr/xdr_mbuf.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/sys/xdr/xdr_mbuf.c Tue Mar 12 12:02:06 2013 (r248190) @@ -228,9 +228,9 @@ xdrmbuf_putbytes(XDR *xdrs, const char * if (xdrs->x_handy == m->m_len && M_TRAILINGSPACE(m) == 0) { if (!m->m_next) { - MGET(n, M_TRYWAIT, m->m_type); + MGET(n, M_WAITOK, m->m_type); if (m->m_flags & M_EXT) - MCLGET(n, M_TRYWAIT); + MCLGET(n, M_WAITOK); m->m_next = n; } m = m->m_next; Modified: user/attilio/vmcontention/usr.bin/top/machine.c ============================================================================== --- user/attilio/vmcontention/usr.bin/top/machine.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/usr.bin/top/machine.c Tue Mar 12 12:02:06 2013 (r248190) @@ -797,7 +797,7 @@ format_next_process(caddr_t handle, char double pct; struct handle *hp; char status[16]; - int state; + int cpu, state; struct rusage ru, *rup; long p_tot, s_tot; char *proc_fmt, thr_buf[6], jid_buf[6]; @@ -997,6 +997,13 @@ format_next_process(caddr_t handle, char } /* format this entry */ + if (smpmode) { + if (state == SRUN && pp->ki_oncpu != 0xff) + cpu = pp->ki_oncpu; + else + cpu = pp->ki_lastcpu; + } else + cpu = 0; proc_fmt = smpmode ? smp_Proc_format : up_Proc_format; if (ps.thread != 0) thr_buf[0] = '\0'; @@ -1014,7 +1021,7 @@ format_next_process(caddr_t handle, char format_k2(PROCSIZE(pp)), format_k2(pagetok(pp->ki_rssize)), status, - smpmode ? pp->ki_lastcpu : 0, + cpu, format_time(cputime), ps.wcpu ? 100.0 * weighted_cpu(pct, pp) : 100.0 * pct, screen_width > cmdlengthdelta ? screen_width - cmdlengthdelta : 0, Modified: user/attilio/vmcontention/usr.sbin/bhyve/pci_passthru.c ============================================================================== --- user/attilio/vmcontention/usr.sbin/bhyve/pci_passthru.c Tue Mar 12 10:05:36 2013 (r248189) +++ user/attilio/vmcontention/usr.sbin/bhyve/pci_passthru.c Tue Mar 12 12:02:06 2013 (r248190) @@ -279,6 +279,7 @@ msix_table_read(struct passthru_softc *s int index; pi = sc->psc_pi; + offset -= pi->pi_msix.table_offset; index = offset / MSIX_TABLE_ENTRY_SIZE; if (index >= pi->pi_msix.table_count) @@ -323,6 +324,8 @@ msix_table_write(struct vmctx *ctx, int int error, index; pi = sc->psc_pi; + offset -= pi->pi_msix.table_offset; + index = offset / MSIX_TABLE_ENTRY_SIZE; if (index >= pi->pi_msix.table_count) return; From owner-svn-src-user@FreeBSD.ORG Tue Mar 12 12:04:52 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 959B2470; Tue, 12 Mar 2013 12:04:52 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-ia0-x22f.google.com (mail-ia0-x22f.google.com [IPv6:2607:f8b0:4001:c02::22f]) by mx1.freebsd.org (Postfix) with ESMTP id 2F3E19E; Tue, 12 Mar 2013 12:04:52 +0000 (UTC) Received: by mail-ia0-f175.google.com with SMTP id y26so629999iab.6 for ; Tue, 12 Mar 2013 05:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=jVgnnRcZrGk7GysozfmaxVs1URw6c2NOpazR5koDM1c=; b=jtQl9mQOVRua+YrZ27IGhPkOPbGQLcYAhu2i82+VrIdhF+EydKQn733gaxONdMuY8q 6Ed4WiAz2oBtuulAGJqpiqqnTReUg/XWxdvxdbkV20tma1wh3XeZ+EcumYFvrTtGRjfp fkPoGCwwaAkXmaGZ9v8naNkxOtsdlhcfImCOtr8qvvmX6wAByjkYsIOV6WotvVKhIDMo uzJvZCwyl+Uq/x7CHLJxt+8khXIW3DNi+zfuyqqKk/5hvBVmads8Em3yE+jZ2n2eZEZy C0/GlFsvPw+Jt2QGhvWjs9QThP7sccbsCejGXb0OvRydbrSwJHBN+h24B0nb3ZYcwkLe E0ow== MIME-Version: 1.0 X-Received: by 10.50.190.164 with SMTP id gr4mr11260524igc.19.1363089891854; Tue, 12 Mar 2013 05:04:51 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.42.117.134 with HTTP; Tue, 12 Mar 2013 05:04:51 -0700 (PDT) In-Reply-To: <201303120614.r2C6EWve058965@svn.freebsd.org> References: <201303120614.r2C6EWve058965@svn.freebsd.org> Date: Tue, 12 Mar 2013 13:04:51 +0100 X-Google-Sender-Auth: mEp1ilKnYfQI3VcOX69RtTt5psY Message-ID: Subject: Re: svn commit: r248185 - user/attilio/vmcontention/sys/vm From: Attilio Rao To: Alan Cox Content-Type: text/plain; charset=UTF-8 Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 12:04:52 -0000 On Tue, Mar 12, 2013 at 7:14 AM, Alan Cox wrote: > Author: alc > Date: Tue Mar 12 06:14:31 2013 > New Revision: 248185 > URL: http://svnweb.freebsd.org/changeset/base/248185 > > Log: > When transferring the page from one object to another, don't insert the > page into its new object until the page's pindex has been updated. > Otherwise, one code path within vm_radix_insert() may use the wrong > pindex value. This is just a style change really because the code already subtracts offindxstart from current m->pindex when inserting. The pindex on the page is then adjusted when the real subtraction happens. IIRC, I did this way because of less diffs against -CURRENT, but the code looks correct to me already in the older version. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-user@FreeBSD.ORG Tue Mar 12 12:06:55 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4C26C697; Tue, 12 Mar 2013 12:06:55 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-ia0-x22a.google.com (mail-ia0-x22a.google.com [IPv6:2607:f8b0:4001:c02::22a]) by mx1.freebsd.org (Postfix) with ESMTP id 10318C3; Tue, 12 Mar 2013 12:06:55 +0000 (UTC) Received: by mail-ia0-f170.google.com with SMTP id h8so4773243iaa.15 for ; Tue, 12 Mar 2013 05:06:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=2EhYffxBacGWO/veC+/ZoB5NF1AOxVO0SzGKM5fRNV0=; b=KiFksea3/jKagf7n1DajWzt57AxJNoQyOjCH4ix93xMP7woURBvZjaCfkCikjCd9/L 78/ztmRCtgI6JpKXQqWeOBe88AgVtT8E8qimybYILwyAasOBiFN9dCRo5Zq1EMNHGM22 kJuYtyHYC83FqNe15q+57puHDxdK5mcI8QmT8sGpzfvFBJ3Z1psONQhzDGJTkfogrz1H NfMAH0oxOJi0h0t94KJ0bIqo51CwCZUhrDQGY1H7nVMhPKISMx3hbm9g2DBzL+mkC9Xi 6ZA9sjYNZBzAw/v88F61nLuOWLBBqBeu7EFbiP9sHR5e9AcrXl8aoZt+Qa2rxeo0NNga WwjA== MIME-Version: 1.0 X-Received: by 10.50.140.67 with SMTP id re3mr11109839igb.100.1363090014653; Tue, 12 Mar 2013 05:06:54 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.42.117.134 with HTTP; Tue, 12 Mar 2013 05:06:54 -0700 (PDT) In-Reply-To: References: <201303120614.r2C6EWve058965@svn.freebsd.org> Date: Tue, 12 Mar 2013 13:06:54 +0100 X-Google-Sender-Auth: EvpvoiYffOoUURzsgiwMNEpsvvs Message-ID: Subject: Re: svn commit: r248185 - user/attilio/vmcontention/sys/vm From: Attilio Rao To: Alan Cox Content-Type: text/plain; charset=UTF-8 Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 12:06:55 -0000 On Tue, Mar 12, 2013 at 1:04 PM, Attilio Rao wrote: > On Tue, Mar 12, 2013 at 7:14 AM, Alan Cox wrote: >> Author: alc >> Date: Tue Mar 12 06:14:31 2013 >> New Revision: 248185 >> URL: http://svnweb.freebsd.org/changeset/base/248185 >> >> Log: >> When transferring the page from one object to another, don't insert the >> page into its new object until the page's pindex has been updated. >> Otherwise, one code path within vm_radix_insert() may use the wrong >> pindex value. > > This is just a style change really because the code already subtracts > offindxstart from current m->pindex when inserting. The pindex on the > page is then adjusted when the real subtraction happens. > IIRC, I did this way because of less diffs against -CURRENT, but the > code looks correct to me already in the older version. Also, I would reduce at minimum the functional changes that could just introduce bugs against a well-tested implementation. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-user@FreeBSD.ORG Tue Mar 12 12:07:51 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 33A86842; Tue, 12 Mar 2013 12:07:51 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 23CAFD6; Tue, 12 Mar 2013 12:07:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2CC7p5D066219; Tue, 12 Mar 2013 12:07:51 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2CC7jFQ066175; Tue, 12 Mar 2013 12:07:45 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303121207.r2CC7jFQ066175@svn.freebsd.org> From: Attilio Rao Date: Tue, 12 Mar 2013 12:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248191 - in user/attilio/vmobj-readlock: . lib/libnetgraph share/examples share/examples/cvsup share/misc sys/amd64/amd64 sys/amd64/include sys/arm/at91 sys/arm/include sys/dev/acpica ... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 12:07:51 -0000 Author: attilio Date: Tue Mar 12 12:07:45 2013 New Revision: 248191 URL: http://svnweb.freebsd.org/changeset/base/248191 Log: MFC Deleted: user/attilio/vmobj-readlock/share/examples/cvsup/ports-supfile user/attilio/vmobj-readlock/share/examples/cvsup/refuse user/attilio/vmobj-readlock/share/examples/cvsup/refuse.README Modified: user/attilio/vmobj-readlock/ObsoleteFiles.inc user/attilio/vmobj-readlock/lib/libnetgraph/msg.c user/attilio/vmobj-readlock/share/examples/Makefile user/attilio/vmobj-readlock/share/examples/cvsup/README user/attilio/vmobj-readlock/share/examples/cvsup/cvs-supfile user/attilio/vmobj-readlock/share/examples/cvsup/stable-supfile user/attilio/vmobj-readlock/share/misc/organization.dot user/attilio/vmobj-readlock/sys/amd64/amd64/pmap.c user/attilio/vmobj-readlock/sys/amd64/include/pmap.h user/attilio/vmobj-readlock/sys/arm/at91/if_ate.c user/attilio/vmobj-readlock/sys/arm/include/signal.h user/attilio/vmobj-readlock/sys/dev/acpica/acpi_hpet.c user/attilio/vmobj-readlock/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c user/attilio/vmobj-readlock/sys/dev/iscsi/initiator/isc_soc.c user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdaa_patches.c user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdac.h user/attilio/vmobj-readlock/sys/dev/usb/serial/uftdi.c user/attilio/vmobj-readlock/sys/dev/usb/usbdevs user/attilio/vmobj-readlock/sys/fs/nfs/nfsport.h user/attilio/vmobj-readlock/sys/i386/i386/pmap.c user/attilio/vmobj-readlock/sys/i386/include/pmap.h user/attilio/vmobj-readlock/sys/kern/kern_synch.c user/attilio/vmobj-readlock/sys/kern/kern_time.c user/attilio/vmobj-readlock/sys/kern/subr_sleepqueue.c user/attilio/vmobj-readlock/sys/kern/uipc_socket.c user/attilio/vmobj-readlock/sys/kern/uipc_syscalls.c user/attilio/vmobj-readlock/sys/kern/uipc_usrreq.c user/attilio/vmobj-readlock/sys/modules/ath/Makefile user/attilio/vmobj-readlock/sys/net/if_bridge.c user/attilio/vmobj-readlock/sys/netinet/libalias/alias_db.c user/attilio/vmobj-readlock/sys/netinet6/raw_ip6.c user/attilio/vmobj-readlock/sys/vm/vm_page.c user/attilio/vmobj-readlock/sys/xdr/xdr_mbuf.c user/attilio/vmobj-readlock/usr.bin/top/machine.c user/attilio/vmobj-readlock/usr.sbin/bhyve/pci_passthru.c Directory Properties: user/attilio/vmobj-readlock/ (props changed) user/attilio/vmobj-readlock/sys/ (props changed) user/attilio/vmobj-readlock/usr.sbin/bhyve/ (props changed) Modified: user/attilio/vmobj-readlock/ObsoleteFiles.inc ============================================================================== --- user/attilio/vmobj-readlock/ObsoleteFiles.inc Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/ObsoleteFiles.inc Tue Mar 12 12:07:45 2013 (r248191) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20130311: Ports are no more available via cvsup +OLD_FILES+=usr/share/examples/cvsup/ports-supfile +OLD_FILES+=usr/share/examples/cvsup/refuse +OLD_FILES+=usr/share/examples/cvsup/refuse.README # 20130309: NWFS and NCP supports removed OLD_FILES+=usr/bin/ncplist OLD_FILES+=usr/bin/ncplogin Modified: user/attilio/vmobj-readlock/lib/libnetgraph/msg.c ============================================================================== --- user/attilio/vmobj-readlock/lib/libnetgraph/msg.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/lib/libnetgraph/msg.c Tue Mar 12 12:07:45 2013 (r248191) @@ -234,7 +234,7 @@ NgDeliverMsg(int cs, const char *path, } /* Wait for reply if there should be one. */ - if (msg->header.cmd & NGM_HASREPLY) { + if (msg->header.cmd & NGM_HASREPLY && !(msg->header.flags & NGF_RESP)) { struct pollfd rfds; int n; Modified: user/attilio/vmobj-readlock/share/examples/Makefile ============================================================================== --- user/attilio/vmobj-readlock/share/examples/Makefile Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/share/examples/Makefile Tue Mar 12 12:07:45 2013 (r248191) @@ -52,9 +52,6 @@ XFILES= BSD_daemon/FreeBSD.pfa \ csh/dot.cshrc \ cvsup/README \ cvsup/cvs-supfile \ - cvsup/ports-supfile \ - cvsup/refuse \ - cvsup/refuse.README \ cvsup/stable-supfile \ cvsup/standard-supfile \ diskless/ME \ Modified: user/attilio/vmobj-readlock/share/examples/cvsup/README ============================================================================== --- user/attilio/vmobj-readlock/share/examples/cvsup/README Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/share/examples/cvsup/README Tue Mar 12 12:07:45 2013 (r248191) @@ -19,8 +19,6 @@ To maintain the sources for the FreeBSD- standard-supfile Main source tree - ports-supfile Ports collection - To maintain the sources for the FreeBSD-stable release, use: stable-supfile Main source tree @@ -28,7 +26,7 @@ To maintain the sources for the FreeBSD- To maintain a copy of the CVS repository containing all versions of FreeBSD, use: - cvs-supfile Main source tree and ports collection + cvs-supfile Main source tree collection IMPORTANT: Before you use any of the supfiles in this directory, you will need to edit in an appropriate "host" setting. See: Modified: user/attilio/vmobj-readlock/share/examples/cvsup/cvs-supfile ============================================================================== --- user/attilio/vmobj-readlock/share/examples/cvsup/cvs-supfile Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/share/examples/cvsup/cvs-supfile Tue Mar 12 12:07:45 2013 (r248191) @@ -43,9 +43,8 @@ # prefix=/home/ncvs # This specifies where to place the requested files. A # setting of "/home/ncvs" will place all of the files -# requested in /home/ncvs (e.g., "/home/ncvs/src/bin", -# "/home/ncvs/ports/archivers"). The prefix directory -# must exist in order to run CVSup. +# requested in /home/ncvs (e.g., "/home/ncvs/src/bin"). +# The prefix directory must exist in order to run CVSup. # Defaults that apply to all the collections # @@ -68,13 +67,6 @@ # mega-collection. It includes all of the individual "src-*" collections. src-all -## Ports Collection. -# -# The easiest way to get the ports tree is to use the "ports-all" -# mega-collection. It includes all of the individual "ports-*" -# collections, -ports-all - ## Projects # # This collection retrieves the projects tree of the FreeBSD Modified: user/attilio/vmobj-readlock/share/examples/cvsup/stable-supfile ============================================================================== --- user/attilio/vmobj-readlock/share/examples/cvsup/stable-supfile Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/share/examples/cvsup/stable-supfile Tue Mar 12 12:07:45 2013 (r248191) @@ -46,21 +46,6 @@ # in "/usr/src" (e.g., "/usr/src/bin", "/usr/src/lib"). # The prefix directory must exist in order to run CVSup. # -############################################################################### -# -# DANGER! WARNING! LOOK OUT! VORSICHT! -# -# If you add any of the ports collections to this file, be sure to -# specify them with a "tag" value set to ".", like this: -# -# ports-all tag=. -# -# If you leave out the "tag=." portion, CVSup will delete all of -# the files in your ports. That is because the ports -# collections do not use the same tags as the main part of the FreeBSD -# source tree. -# -############################################################################### # Defaults that apply to all the collections # Modified: user/attilio/vmobj-readlock/share/misc/organization.dot ============================================================================== --- user/attilio/vmobj-readlock/share/misc/organization.dot Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/share/misc/organization.dot Tue Mar 12 12:07:45 2013 (r248191) @@ -30,7 +30,7 @@ coresecretary [label="Core Team Secretar doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"] doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\ngjb, blackend,\ngabor, hrs"] portscommitters [label="Ports Committers\nports-committers@FreeBSD.org"] -portmgr [label="Port Management Team\nportmgr@FreeBSD.org\ntabthorpe, marcus, bapt, beat,\nerwin, linimon, pav,\nitetcu, miwi"] +portmgr [label="Port Management Team\nportmgr@FreeBSD.org\ntabthorpe, marcus, bapt, \nerwin, pav,\nitetcu, miwi"] portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\ntabthorpe"] re [label="Primary Release Engineering Team\nre@FreeBSD.org\nkib, blackend, jpaetzel, hrs, kensmith"] secteam [label="Security Team\nsecteam@FreeBSD.org\nsimon, qingli, delphij,\nremko, philip, stas, cperciva,\ncsjp, rwatson, miwi, bz"] @@ -43,13 +43,12 @@ srccommitters [label="Src Committers\nsr accounts [label="Accounts Team\naccounts@FreeBSD.org\nmarkm, simon, kensmith,\ndhw"] backups [label="Backup Administrators\nbackups@FreeBSD.org\nsimon, kensmith,\ndhw"] -bugmeister [label="Bugmeister Team\nbugmeister@FreeBSD.org\neadler, gavin, gonzo, linimon"] +bugmeister [label="Bugmeister Team\nbugmeister@FreeBSD.org\neadler, gavin, gonzo"] clusteradm [label="Cluster Administrators\nclusteradm@FreeBSD.org\nbrd, simon, ps,\nkensmith, peter"] cvsupmaster [label="CVSup Mirror Site Coordinators\ncvsup-master@FreeBSD.org\nkuriyama, jdp,\nkensmith"] dnsadm [label="DNS Administrators\ndnsadm@FreeBSD.org\nbillf, dg, ps,\nkensmith, peter"] mirroradmin [label="FTP/WWW Mirror Site Coordinators\nmirror-admin@FreeBSD.org\nkuriyama, kensmith"] ncvs [label="CVS src Repository Managers\nncvs@FreeBSD.org\njoe, kuriyama, markm,\nsimon, peter"] -pcvs [label="CVS ports Repository Managers\npcvs@FreeBSD.org\nmarcus, joe, kuriyama,\nmarkm, simon"] perforceadmin [label="Perforce Repository Administrators\nperforce-admin@FreeBSD.org\nscottl, kensmith, gordon,\nrwatson, peter, dhw"] postmaster [label="Postmaster Team\npostmaster@FreeBSD.org\njmb, brd, sahil, dhw"] refadm [label="Reference Systems Administrators\nrefadm@FreeBSD.org\njake, billf, markm, simon,\nobrien, ps, kensmith,\npeter, dhw"] @@ -70,8 +69,6 @@ _admin -> backups _admin -> bugmeister _admin -> clusteradm _admin -> ncvs -_admin -> pcvs -_admin -> dcvs _admin -> cvsupmaster _admin -> dnsadm _admin -> mirroradmin Modified: user/attilio/vmobj-readlock/sys/amd64/amd64/pmap.c ============================================================================== --- user/attilio/vmobj-readlock/sys/amd64/amd64/pmap.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/amd64/amd64/pmap.c Tue Mar 12 12:07:45 2013 (r248191) @@ -131,6 +131,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -306,7 +307,6 @@ static boolean_t pmap_try_insert_pv_entr static void pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, pd_entry_t newpde); static void pmap_update_pde_invalidate(vm_offset_t va, pd_entry_t newpde); -static vm_page_t pmap_vmpage_splay(vm_pindex_t pindex, vm_page_t root); static vm_page_t _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp); @@ -1528,31 +1528,12 @@ pmap_add_delayed_free_list(vm_page_t m, * for mapping a distinct range of virtual addresses. The pmap's collection is * ordered by this virtual address range. */ -static void +static __inline void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte) { - vm_page_t root; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - root = pmap->pm_root; - if (root == NULL) { - mpte->md.pv_left = NULL; - mpte->md.pv_right = NULL; - } else { - root = pmap_vmpage_splay(mpte->pindex, root); - if (mpte->pindex < root->pindex) { - mpte->md.pv_left = root->md.pv_left; - mpte->md.pv_right = root; - root->md.pv_left = NULL; - } else if (mpte->pindex == root->pindex) - panic("pmap_insert_pt_page: pindex already inserted"); - else { - mpte->md.pv_right = root->md.pv_right; - mpte->md.pv_left = root; - root->md.pv_right = NULL; - } - } - pmap->pm_root = mpte; + vm_radix_insert(&pmap->pm_root, mpte->pindex, mpte); } /* @@ -1560,19 +1541,12 @@ pmap_insert_pt_page(pmap_t pmap, vm_page * specified pmap's collection of idle page table pages. Returns NULL if there * is no page table page corresponding to the specified virtual address. */ -static vm_page_t +static __inline vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va) { - vm_page_t mpte; - vm_pindex_t pindex = pmap_pde_pindex(va); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if ((mpte = pmap->pm_root) != NULL && mpte->pindex != pindex) { - mpte = pmap_vmpage_splay(pindex, mpte); - if ((pmap->pm_root = mpte)->pindex != pindex) - mpte = NULL; - } - return (mpte); + return (vm_radix_lookup(&pmap->pm_root, pmap_pde_pindex(va))); } /* @@ -1580,31 +1554,12 @@ pmap_lookup_pt_page(pmap_t pmap, vm_offs * of idle page table pages. The specified page table page must be a member of * the pmap's collection. */ -static void +static __inline void pmap_remove_pt_page(pmap_t pmap, vm_page_t mpte) { - vm_page_t root; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if (mpte != pmap->pm_root) { - root = pmap_vmpage_splay(mpte->pindex, pmap->pm_root); - KASSERT(mpte == root, - ("pmap_remove_pt_page: mpte %p is missing from pmap %p", - mpte, pmap)); - } - if (mpte->md.pv_left == NULL) - root = mpte->md.pv_right; - else { - root = pmap_vmpage_splay(mpte->pindex, mpte->md.pv_left); - root->md.pv_right = mpte->md.pv_right; - } - pmap->pm_root = root; - - /* - * Reinitialize the pv_list which could be dirty now because of the - * splay tree work. - */ - TAILQ_INIT(&mpte->md.pv_list); + vm_radix_remove(&pmap->pm_root, mpte->pindex); } /* @@ -1680,61 +1635,6 @@ _pmap_unwire_ptp(pmap_t pmap, vm_offset_ } /* - * Implements Sleator and Tarjan's top-down splay algorithm. Returns - * the vm_page containing the given pindex. If, however, that - * pindex is not found in the pmap, returns a vm_page that is - * adjacent to the pindex, coming before or after it. - */ -static vm_page_t -pmap_vmpage_splay(vm_pindex_t pindex, vm_page_t root) -{ - struct vm_page dummy; - vm_page_t lefttreemax, righttreemin, y; - - if (root == NULL) - return (root); - lefttreemax = righttreemin = &dummy; - for (;; root = y) { - if (pindex < root->pindex) { - if ((y = root->md.pv_left) == NULL) - break; - if (pindex < y->pindex) { - /* Rotate right. */ - root->md.pv_left = y->md.pv_right; - y->md.pv_right = root; - root = y; - if ((y = root->md.pv_left) == NULL) - break; - } - /* Link into the new root's right tree. */ - righttreemin->md.pv_left = root; - righttreemin = root; - } else if (pindex > root->pindex) { - if ((y = root->md.pv_right) == NULL) - break; - if (pindex > y->pindex) { - /* Rotate left. */ - root->md.pv_right = y->md.pv_left; - y->md.pv_left = root; - root = y; - if ((y = root->md.pv_right) == NULL) - break; - } - /* Link into the new root's left tree. */ - lefttreemax->md.pv_right = root; - lefttreemax = root; - } else - break; - } - /* Assemble the new root. */ - lefttreemax->md.pv_right = root->md.pv_left; - righttreemin->md.pv_left = root->md.pv_right; - root->md.pv_left = dummy.md.pv_right; - root->md.pv_right = dummy.md.pv_left; - return (root); -} - -/* * After removing a page table entry, this routine is used to * conditionally free the page, and manage the hold/wire counts. */ @@ -1756,7 +1656,7 @@ pmap_pinit0(pmap_t pmap) PMAP_LOCK_INIT(pmap); pmap->pm_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(KPML4phys); - pmap->pm_root = NULL; + pmap->pm_root.rt_root = 0; CPU_ZERO(&pmap->pm_active); PCPU_SET(curpmap, pmap); TAILQ_INIT(&pmap->pm_pvchunk); @@ -1797,7 +1697,7 @@ pmap_pinit(pmap_t pmap) /* install self-referential address mapping entry(s) */ pmap->pm_pml4[PML4PML4I] = VM_PAGE_TO_PHYS(pml4pg) | PG_V | PG_RW | PG_A | PG_M; - pmap->pm_root = NULL; + pmap->pm_root.rt_root = 0; CPU_ZERO(&pmap->pm_active); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); @@ -2039,7 +1939,7 @@ pmap_release(pmap_t pmap) KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); - KASSERT(pmap->pm_root == NULL, + KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_release: pmap has reserved page table page(s)")); m = PHYS_TO_VM_PAGE(pmap->pm_pml4[PML4PML4I] & PG_FRAME); Modified: user/attilio/vmobj-readlock/sys/amd64/include/pmap.h ============================================================================== --- user/attilio/vmobj-readlock/sys/amd64/include/pmap.h Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/amd64/include/pmap.h Tue Mar 12 12:07:45 2013 (r248191) @@ -150,6 +150,8 @@ #include #include +#include + typedef u_int64_t pd_entry_t; typedef u_int64_t pt_entry_t; typedef u_int64_t pdp_entry_t; @@ -235,20 +237,10 @@ struct pv_entry; struct pv_chunk; struct md_page { - union { - TAILQ_HEAD(,pv_entry) pvi_list; - struct { - vm_page_t pii_left; - vm_page_t pii_right; - } pvi_siters; - } pv_structs; - int pat_mode; + TAILQ_HEAD(,pv_entry) pv_list; + int pat_mode; }; -#define pv_list pv_structs.pvi_list -#define pv_left pv_structs.pvi_siters.pii_left -#define pv_right pv_structs.pvi_siters.pii_right - /* * The kernel virtual address (KVA) of the level 4 page table page is always * within the direct map (DMAP) region. @@ -260,7 +252,7 @@ struct pmap { cpuset_t pm_active; /* active on cpus */ /* spare u_int here due to padding */ struct pmap_statistics pm_stats; /* pmap statistics */ - vm_page_t pm_root; /* spare page table pages */ + struct vm_radix pm_root; /* spare page table pages */ }; typedef struct pmap *pmap_t; Modified: user/attilio/vmobj-readlock/sys/arm/at91/if_ate.c ============================================================================== --- user/attilio/vmobj-readlock/sys/arm/at91/if_ate.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/arm/at91/if_ate.c Tue Mar 12 12:07:45 2013 (r248191) @@ -899,12 +899,9 @@ ate_intr(void *xsc) /* FCS is not coppied into mbuf. */ remain = (sc->rx_descs[idx].status & ETH_LEN_MASK) - 4; - /* Get an appropriately sized mbuf */ - if (remain + ETHER_ALIGN >= MINCLSIZE) - mb = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); - else - MGETHDR(mb, M_NOWAIT, MT_DATA); - + /* Get an appropriately sized mbuf. */ + mb = m_get2(M_NOWAIT, MT_DATA, M_PKTHDR, + remain + ETHER_ALIGN); if (mb == NULL) { sc->ifp->if_iqdrops++; rxdhead->status = 0; Modified: user/attilio/vmobj-readlock/sys/arm/include/signal.h ============================================================================== --- user/attilio/vmobj-readlock/sys/arm/include/signal.h Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/arm/include/signal.h Tue Mar 12 12:07:45 2013 (r248191) @@ -42,6 +42,7 @@ typedef long sig_atomic_t; #if __BSD_VISIBLE struct sigcontext { + int _dummy; }; #endif Modified: user/attilio/vmobj-readlock/sys/dev/acpica/acpi_hpet.c ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/acpica/acpi_hpet.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/dev/acpica/acpi_hpet.c Tue Mar 12 12:07:45 2013 (r248191) @@ -675,7 +675,8 @@ hpet_attach(device_t dev) if (t->pcpu_master >= 0) { t->et.et_flags |= ET_FLAGS_PERCPU; t->et.et_quality += 100; - } + } else if (mp_ncpus >= 8) + t->et.et_quality -= 100; if ((t->caps & HPET_TCAP_PER_INT) == 0) t->et.et_quality -= 10; t->et.et_frequency = sc->freq; Modified: user/attilio/vmobj-readlock/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c Tue Mar 12 12:07:45 2013 (r248191) @@ -50,7 +50,7 @@ ar9285BTCoexAntennaDiversity(struct ath_ if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ALLOW) || (AH5212(ah)->ah_diversity != HAL_ANT_VARIABLE)) { if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ENABLE) && - (AH5212(ah)->ah_diversity == HAL_ANT_VARIABLE)) { + (AH5212(ah)->ah_antControl == HAL_ANT_VARIABLE)) { /* Enable antenna diversity */ ant_div_control1 = HAL_BT_COEX_ANTDIV_CONTROL1_ENABLE; ant_div_control2 = HAL_BT_COEX_ANTDIV_CONTROL2_ENABLE; @@ -63,7 +63,7 @@ ar9285BTCoexAntennaDiversity(struct ath_ OS_REG_WRITE(ah, AR_PHY_SWITCH_COM, HAL_BT_COEX_ANT_DIV_SWITCH_COM); OS_REG_RMW(ah, AR_PHY_SWITCH_CHAIN_0, 0, 0xf0000000); - } else if (AH5212(ah)->ah_diversity == HAL_ANT_FIXED_B) { + } else if (AH5212(ah)->ah_antControl == HAL_ANT_FIXED_B) { /* Disable antenna diversity. Use antenna B(LNA2) only. */ ant_div_control1 = HAL_BT_COEX_ANTDIV_CONTROL1_FIXED_B; ant_div_control2 = HAL_BT_COEX_ANTDIV_CONTROL2_FIXED_B; Modified: user/attilio/vmobj-readlock/sys/dev/iscsi/initiator/isc_soc.c ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/iscsi/initiator/isc_soc.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/dev/iscsi/initiator/isc_soc.c Tue Mar 12 12:07:45 2013 (r248191) @@ -91,7 +91,7 @@ isc_sendPDU(isc_session_t *sp, pduq_t *p /* | mbuf for the iSCSI header */ - MGETHDR(mh, M_TRYWAIT, MT_DATA); + MGETHDR(mh, M_WAITOK, MT_DATA); mh->m_pkthdr.rcvif = NULL; mh->m_next = NULL; mh->m_len = sizeof(union ipdu_u); @@ -132,7 +132,7 @@ isc_sendPDU(isc_session_t *sp, pduq_t *p while(len > 0) { int l; - MGET(md, M_TRYWAIT, MT_DATA); + MGET(md, M_WAITOK, MT_DATA); md->m_ext.ref_cnt = &ou_refcnt; l = min(MCLBYTES, len); debug(4, "setting ext_free(arg=%p len/l=%d/%d)", pq->buf, len, l); @@ -150,7 +150,7 @@ isc_sendPDU(isc_session_t *sp, pduq_t *p off += l; } if(((pp->ds_len & 03) != 0) || ISOK2DIG(sp->dataDigest, pp)) { - MGET(md, M_TRYWAIT, MT_DATA); + MGET(md, M_WAITOK, MT_DATA); if(pp->ds_len & 03) len = 4 - (pp->ds_len & 03); else Modified: user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdaa_patches.c ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdaa_patches.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdaa_patches.c Tue Mar 12 12:07:45 2013 (r248191) @@ -344,7 +344,9 @@ hdac_pin_patch(struct hdaa_widget *w) break; } } else if (id == HDA_CODEC_ALC269 && - subid == LENOVO_X1CRBN_SUBVENDOR) { + (subid == LENOVO_X1CRBN_SUBVENDOR || + subid == LENOVO_T430_SUBVENDOR || + subid == LENOVO_T430S_SUBVENDOR)) { switch (nid) { case 21: patch = "as=1 seq=15"; Modified: user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdac.h Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdac.h Tue Mar 12 12:07:45 2013 (r248191) @@ -225,6 +225,8 @@ #define LENOVO_X220_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21da) #define LENOVO_X300_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac) #define LENOVO_T420_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21ce) +#define LENOVO_T430_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f3) +#define LENOVO_T430S_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb) #define LENOVO_T520_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21cf) #define LENOVO_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0xffff) Modified: user/attilio/vmobj-readlock/sys/dev/usb/serial/uftdi.c ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/usb/serial/uftdi.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/dev/usb/serial/uftdi.c Tue Mar 12 12:07:45 2013 (r248191) @@ -753,6 +753,8 @@ static const STRUCT_USB_HOST_ID uftdi_de UFTDI_DEV(MOBILITY, USB_SERIAL, UFTDI_TYPE_AUTO), UFTDI_DEV(OLIMEX, ARM_USB_OCD, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), UFTDI_DEV(OLIMEX, ARM_USB_OCD_H, UFTDI_TYPE_AUTO | UFTDI_FLAG_JTAG), + UFTDI_DEV(OPTO, CRD7734, UFTDI_TYPE_AUTO), + UFTDI_DEV(OPTO, CRD7734_1, UFTDI_TYPE_AUTO), UFTDI_DEV(PAPOUCH, AD4USB, UFTDI_TYPE_AUTO), UFTDI_DEV(PAPOUCH, AP485, UFTDI_TYPE_AUTO), UFTDI_DEV(PAPOUCH, AP485_2, UFTDI_TYPE_AUTO), Modified: user/attilio/vmobj-readlock/sys/dev/usb/usbdevs ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/usb/usbdevs Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/dev/usb/usbdevs Tue Mar 12 12:07:45 2013 (r248191) @@ -323,6 +323,7 @@ vendor GUNZE 0x0637 Gunze Electronics U vendor AVISION 0x0638 Avision vendor TEAC 0x0644 TEAC vendor ACTON 0x0647 Acton Research Corp. +vendor OPTO 0x065a Optoelectronics Co., Ltd vendor SGI 0x065e Silicon Graphics vendor SANWASUPPLY 0x0663 Sanwa Supply vendor MEGATEC 0x0665 Megatec @@ -3150,6 +3151,13 @@ product OPTION ICON321 0xd031 Globetrot product OPTION ICON505 0xd055 Globetrotter iCON 505 product OPTION ICON452 0x7901 Globetrotter iCON 452 +/* Optoelectronics Co., Ltd */ +product OPTO BARCODE 0x0001 Barcode Reader +product OPTO OPTICONCODE 0x0009 Opticon Code Reader +product OPTO BARCODE_1 0xa002 Barcode Reader +product OPTO CRD7734 0xc000 USB Cradle CRD-7734-RU +product OPTO CRD7734_1 0xc001 USB Cradle CRD-7734-RU + /* OvisLink product */ product OVISLINK RT3072 0x3072 RT3072 Modified: user/attilio/vmobj-readlock/sys/fs/nfs/nfsport.h ============================================================================== --- user/attilio/vmobj-readlock/sys/fs/nfs/nfsport.h Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/fs/nfs/nfsport.h Tue Mar 12 12:07:45 2013 (r248191) @@ -140,32 +140,32 @@ * Allocate mbufs. Must succeed and never set the mbuf ptr to NULL. */ #define NFSMGET(m) do { \ - MGET((m), M_TRYWAIT, MT_DATA); \ + MGET((m), M_WAITOK, MT_DATA); \ while ((m) == NULL ) { \ (void) nfs_catnap(PZERO, 0, "nfsmget"); \ - MGET((m), M_TRYWAIT, MT_DATA); \ + MGET((m), M_WAITOK, MT_DATA); \ } \ } while (0) #define NFSMGETHDR(m) do { \ - MGETHDR((m), M_TRYWAIT, MT_DATA); \ + MGETHDR((m), M_WAITOK, MT_DATA); \ while ((m) == NULL ) { \ (void) nfs_catnap(PZERO, 0, "nfsmget"); \ - MGETHDR((m), M_TRYWAIT, MT_DATA); \ + MGETHDR((m), M_WAITOK, MT_DATA); \ } \ } while (0) #define NFSMCLGET(m, w) do { \ - MGET((m), M_TRYWAIT, MT_DATA); \ + MGET((m), M_WAITOK, MT_DATA); \ while ((m) == NULL ) { \ (void) nfs_catnap(PZERO, 0, "nfsmget"); \ - MGET((m), M_TRYWAIT, MT_DATA); \ + MGET((m), M_WAITOK, MT_DATA); \ } \ MCLGET((m), (w)); \ } while (0) #define NFSMCLGETHDR(m, w) do { \ - MGETHDR((m), M_TRYWAIT, MT_DATA); \ + MGETHDR((m), M_WAITOK, MT_DATA); \ while ((m) == NULL ) { \ (void) nfs_catnap(PZERO, 0, "nfsmget"); \ - MGETHDR((m), M_TRYWAIT, MT_DATA); \ + MGETHDR((m), M_WAITOK, MT_DATA); \ } \ } while (0) #define NFSMTOD mtod Modified: user/attilio/vmobj-readlock/sys/i386/i386/pmap.c ============================================================================== --- user/attilio/vmobj-readlock/sys/i386/i386/pmap.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/i386/i386/pmap.c Tue Mar 12 12:07:45 2013 (r248191) @@ -133,6 +133,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -330,7 +331,6 @@ static boolean_t pmap_try_insert_pv_entr static void pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, pd_entry_t newpde); static void pmap_update_pde_invalidate(vm_offset_t va, pd_entry_t newpde); -static vm_page_t pmap_vmpage_splay(vm_pindex_t pindex, vm_page_t root); static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags); @@ -1604,31 +1604,12 @@ pmap_add_delayed_free_list(vm_page_t m, * for mapping a distinct range of virtual addresses. The pmap's collection is * ordered by this virtual address range. */ -static void +static __inline void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte) { - vm_page_t root; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - root = pmap->pm_root; - if (root == NULL) { - mpte->md.pv_left = NULL; - mpte->md.pv_right = NULL; - } else { - root = pmap_vmpage_splay(mpte->pindex, root); - if (mpte->pindex < root->pindex) { - mpte->md.pv_left = root->md.pv_left; - mpte->md.pv_right = root; - root->md.pv_left = NULL; - } else if (mpte->pindex == root->pindex) - panic("pmap_insert_pt_page: pindex already inserted"); - else { - mpte->md.pv_right = root->md.pv_right; - mpte->md.pv_left = root; - root->md.pv_right = NULL; - } - } - pmap->pm_root = mpte; + vm_radix_insert(&pmap->pm_root, mpte->pindex, mpte); } /* @@ -1636,19 +1617,12 @@ pmap_insert_pt_page(pmap_t pmap, vm_page * specified pmap's collection of idle page table pages. Returns NULL if there * is no page table page corresponding to the specified virtual address. */ -static vm_page_t +static __inline vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va) { - vm_page_t mpte; - vm_pindex_t pindex = va >> PDRSHIFT; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if ((mpte = pmap->pm_root) != NULL && mpte->pindex != pindex) { - mpte = pmap_vmpage_splay(pindex, mpte); - if ((pmap->pm_root = mpte)->pindex != pindex) - mpte = NULL; - } - return (mpte); + return (vm_radix_lookup(&pmap->pm_root, va >> PDRSHIFT)); } /* @@ -1656,27 +1630,12 @@ pmap_lookup_pt_page(pmap_t pmap, vm_offs * of idle page table pages. The specified page table page must be a member of * the pmap's collection. */ -static void +static __inline void pmap_remove_pt_page(pmap_t pmap, vm_page_t mpte) { - vm_page_t root; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if (mpte != pmap->pm_root) - pmap_vmpage_splay(mpte->pindex, pmap->pm_root); - if (mpte->md.pv_left == NULL) - root = mpte->md.pv_right; - else { - root = pmap_vmpage_splay(mpte->pindex, mpte->md.pv_left); - root->md.pv_right = mpte->md.pv_right; - } - pmap->pm_root = root; - - /* - * Reinitialize the pv_list which could be dirty now because of the - * splay tree work. - */ - TAILQ_INIT(&mpte->md.pv_list); + vm_radix_remove(&pmap->pm_root, mpte->pindex); } /* @@ -1730,61 +1689,6 @@ _pmap_unwire_ptp(pmap_t pmap, vm_page_t } /* - * Implements Sleator and Tarjan's top-down splay algorithm. Returns - * the vm_page containing the given pindex. If, however, that - * pindex is not found in the pmap, returns a vm_page that is - * adjacent to the pindex, coming before or after it. - */ -static vm_page_t -pmap_vmpage_splay(vm_pindex_t pindex, vm_page_t root) -{ - struct vm_page dummy; - vm_page_t lefttreemax, righttreemin, y; - - if (root == NULL) - return (root); - lefttreemax = righttreemin = &dummy; - for (;; root = y) { - if (pindex < root->pindex) { - if ((y = root->md.pv_left) == NULL) - break; - if (pindex < y->pindex) { - /* Rotate right. */ - root->md.pv_left = y->md.pv_right; - y->md.pv_right = root; - root = y; - if ((y = root->md.pv_left) == NULL) - break; - } - /* Link into the new root's right tree. */ - righttreemin->md.pv_left = root; - righttreemin = root; - } else if (pindex > root->pindex) { - if ((y = root->md.pv_right) == NULL) - break; - if (pindex > y->pindex) { - /* Rotate left. */ - root->md.pv_right = y->md.pv_left; - y->md.pv_left = root; - root = y; - if ((y = root->md.pv_right) == NULL) - break; - } - /* Link into the new root's left tree. */ - lefttreemax->md.pv_right = root; - lefttreemax = root; - } else - break; - } - /* Assemble the new root. */ - lefttreemax->md.pv_right = root->md.pv_left; - righttreemin->md.pv_left = root->md.pv_right; - root->md.pv_left = dummy.md.pv_right; - root->md.pv_right = dummy.md.pv_left; - return (root); -} - -/* * After removing a page table entry, this routine is used to * conditionally free the page, and manage the hold/wire counts. */ @@ -1818,7 +1722,7 @@ pmap_pinit0(pmap_t pmap) #ifdef PAE pmap->pm_pdpt = (pdpt_entry_t *)(KERNBASE + (vm_offset_t)IdlePDPT); #endif - pmap->pm_root = NULL; + pmap->pm_root.rt_root = 0; CPU_ZERO(&pmap->pm_active); PCPU_SET(curpmap, pmap); TAILQ_INIT(&pmap->pm_pvchunk); @@ -1857,9 +1761,9 @@ pmap_pinit(pmap_t pmap) KASSERT(pmap_kextract((vm_offset_t)pmap->pm_pdpt) < (4ULL<<30), ("pmap_pinit: pdpt above 4g")); #endif - pmap->pm_root = NULL; + pmap->pm_root.rt_root = 0; } - KASSERT(pmap->pm_root == NULL, + KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_pinit: pmap has reserved page table page(s)")); /* @@ -2123,7 +2027,7 @@ pmap_release(pmap_t pmap) KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); - KASSERT(pmap->pm_root == NULL, + KASSERT(vm_radix_is_empty(&pmap->pm_root), ("pmap_release: pmap has reserved page table page(s)")); pmap_lazyfix(pmap); Modified: user/attilio/vmobj-readlock/sys/i386/include/pmap.h ============================================================================== --- user/attilio/vmobj-readlock/sys/i386/include/pmap.h Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/i386/include/pmap.h Tue Mar 12 12:07:45 2013 (r248191) @@ -159,6 +159,8 @@ #include #include +#include + #ifdef PAE typedef uint64_t pdpt_entry_t; @@ -426,20 +428,10 @@ struct pv_entry; struct pv_chunk; struct md_page { - union { - TAILQ_HEAD(,pv_entry) pvi_list; - struct { - vm_page_t pii_left; - vm_page_t pii_right; - } pvi_siters; - } pv_structs; - int pat_mode; + TAILQ_HEAD(,pv_entry) pv_list; + int pat_mode; }; -#define pv_list pv_structs.pvi_list -#define pv_left pv_structs.pvi_siters.pii_left -#define pv_right pv_structs.pvi_siters.pii_right - struct pmap { struct mtx pm_mtx; pd_entry_t *pm_pdir; /* KVA of page directory */ @@ -451,7 +443,7 @@ struct pmap { pdpt_entry_t *pm_pdpt; /* KVA of page director pointer table */ #endif - vm_page_t pm_root; /* spare page table pages */ + struct vm_radix pm_root; /* spare page table pages */ }; typedef struct pmap *pmap_t; Modified: user/attilio/vmobj-readlock/sys/kern/kern_synch.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/kern_synch.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/kern/kern_synch.c Tue Mar 12 12:07:45 2013 (r248191) @@ -85,7 +85,7 @@ SYSINIT(synch_setup, SI_SUB_KICK_SCHEDUL NULL); int hogticks; -static int pause_wchan; +static uint8_t pause_wchan[MAXCPU]; static struct callout loadav_callout; @@ -198,7 +198,8 @@ _sleep(void *ident, struct lock_object * if (TD_ON_SLEEPQ(td)) sleepq_remove(td, td->td_wchan); - if (ident == &pause_wchan) + if ((uint8_t *)ident >= &pause_wchan[0] && + (uint8_t *)ident <= &pause_wchan[MAXCPU - 1]) sleepq_flags = SLEEPQ_PAUSE; else sleepq_flags = SLEEPQ_SLEEP; @@ -372,7 +373,7 @@ pause_sbt(const char *wmesg, sbintime_t DELAY((sbt & 0xffffffff) / SBT_1US); return (0); } - return (_sleep(&pause_wchan, NULL, 0, wmesg, sbt, pr, flags)); + return (_sleep(&pause_wchan[curcpu], NULL, 0, wmesg, sbt, pr, flags)); } /* Modified: user/attilio/vmobj-readlock/sys/kern/kern_time.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/kern_time.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/kern/kern_time.c Tue Mar 12 12:07:45 2013 (r248191) @@ -477,7 +477,7 @@ kern_clock_getres(struct thread *td, clo return (0); } -static int nanowait; +static uint8_t nanowait[MAXCPU]; int kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec *rmt) @@ -503,8 +503,8 @@ kern_nanosleep(struct thread *td, struct if (TIMESEL(&sbt, tmp)) sbt += tc_tick_sbt; sbt += tmp; - error = tsleep_sbt(&nanowait, PWAIT | PCATCH, "nanslp", sbt, prec, - C_ABSOLUTE); + error = tsleep_sbt(&nanowait[curcpu], PWAIT | PCATCH, "nanslp", + sbt, prec, C_ABSOLUTE); if (error != EWOULDBLOCK) { if (error == ERESTART) error = EINTR; Modified: user/attilio/vmobj-readlock/sys/kern/subr_sleepqueue.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/subr_sleepqueue.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/kern/subr_sleepqueue.c Tue Mar 12 12:07:45 2013 (r248191) @@ -88,16 +88,14 @@ __FBSDID("$FreeBSD$"); #endif /* - * Constants for the hash table of sleep queue chains. These constants are - * the same ones that 4BSD (and possibly earlier versions of BSD) used. - * Basically, we ignore the lower 8 bits of the address since most wait - * channel pointers are aligned and only look at the next 7 bits for the - * hash. SC_TABLESIZE must be a power of two for SC_MASK to work properly. + * Constants for the hash table of sleep queue chains. + * SC_TABLESIZE must be a power of two for SC_MASK to work properly. */ -#define SC_TABLESIZE 128 /* Must be power of 2. */ +#define SC_TABLESIZE 256 /* Must be power of 2. */ #define SC_MASK (SC_TABLESIZE - 1) #define SC_SHIFT 8 -#define SC_HASH(wc) (((uintptr_t)(wc) >> SC_SHIFT) & SC_MASK) +#define SC_HASH(wc) ((((uintptr_t)(wc) >> SC_SHIFT) ^ (uintptr_t)(wc)) & \ + SC_MASK) #define SC_LOOKUP(wc) &sleepq_chains[SC_HASH(wc)] #define NR_SLEEPQS 2 /* Modified: user/attilio/vmobj-readlock/sys/kern/uipc_socket.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/uipc_socket.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/kern/uipc_socket.c Tue Mar 12 12:07:45 2013 (r248191) @@ -136,6 +136,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -565,8 +566,12 @@ sonewconn(struct socket *head, int conns /* * The accept socket may be tearing down but we just * won a race on the ACCEPT_LOCK. + * However, if sctp_peeloff() is called on a 1-to-many + * style socket, the SO_ACCEPTCONN doesn't need to be set. */ - if (!(head->so_options & SO_ACCEPTCONN)) { + if (!(head->so_options & SO_ACCEPTCONN) && + ((head->so_proto->pr_protocol != IPPROTO_SCTP) || + (head->so_type != SOCK_SEQPACKET))) { SOCK_LOCK(so); so->so_head = NULL; sofree(so); /* NB: returns ACCEPT_UNLOCK'ed. */ Modified: user/attilio/vmobj-readlock/sys/kern/uipc_syscalls.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/uipc_syscalls.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/kern/uipc_syscalls.c Tue Mar 12 12:07:45 2013 (r248191) @@ -2386,8 +2386,10 @@ sys_sctp_peeloff(td, uap) CURVNET_SET(head->so_vnet); so = sonewconn(head, SS_ISCONNECTED); - if (so == NULL) + if (so == NULL) { + error = ENOMEM; goto noconnection; + } /* * Before changing the flags on the socket, we have to bump the * reference count. Otherwise, if the protocol calls sofree(), Modified: user/attilio/vmobj-readlock/sys/kern/uipc_usrreq.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/uipc_usrreq.c Tue Mar 12 12:02:06 2013 (r248190) +++ user/attilio/vmobj-readlock/sys/kern/uipc_usrreq.c Tue Mar 12 12:07:45 2013 (r248191) @@ -282,7 +282,7 @@ static void unp_dispose(struct mbuf *); static void unp_shutdown(struct unpcb *); static void unp_drop(struct unpcb *, int); static void unp_gc(__unused void *, int); -static void unp_scan(struct mbuf *, void (*)(struct file *)); +static void unp_scan(struct mbuf *, void (*)(struct filedescent **, int)); static void unp_discard(struct file *); static void unp_freerights(struct filedescent **, int); static void unp_init(void); @@ -2135,17 +2135,22 @@ static int unp_marked; static int unp_unreachable; static void -unp_accessable(struct file *fp) +unp_accessable(struct filedescent **fdep, int fdcount) { struct unpcb *unp; + struct file *fp; + int i; - if ((unp = fptounp(fp)) == NULL) - return; - if (unp->unp_gcflag & UNPGC_REF) - return; - unp->unp_gcflag &= ~UNPGC_DEAD; - unp->unp_gcflag |= UNPGC_REF; - unp_marked++; + for (i = 0; i < fdcount; i++) { + fp = fdep[i]->fde_file; + if ((unp = fptounp(fp)) == NULL) + continue; + if (unp->unp_gcflag & UNPGC_REF) + continue; + unp->unp_gcflag &= ~UNPGC_DEAD; + unp->unp_gcflag |= UNPGC_REF; + unp_marked++; + } } static void @@ -2292,19 +2297,16 @@ unp_dispose(struct mbuf *m) { if (m) - unp_scan(m, unp_discard); + unp_scan(m, unp_freerights); } static void -unp_scan(struct mbuf *m0, void (*op)(struct file *)) +unp_scan(struct mbuf *m0, void (*op)(struct filedescent **, int)) { struct mbuf *m; - struct filedescent **fdep; struct cmsghdr *cm; void *data; - int i; socklen_t clen, datalen; - int qfds; while (m0 != NULL) { for (m = m0; m; m = m->m_next) { @@ -2324,10 +2326,8 @@ unp_scan(struct mbuf *m0, void (*op)(str if (cm->cmsg_level == SOL_SOCKET && cm->cmsg_type == SCM_RIGHTS) { - qfds = datalen / sizeof(*fdep); - fdep = data; - for (i = 0; i < qfds; i++) - (*op)(fdep[i]->fde_file); + (*op)(data, datalen / *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue Mar 12 12:10:32 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BBC39999; Tue, 12 Mar 2013 12:10:32 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AF2DD101; Tue, 12 Mar 2013 12:10:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2CCAWYA068137; Tue, 12 Mar 2013 12:10:32 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2CCAW8Z068136; Tue, 12 Mar 2013 12:10:32 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303121210.r2CCAW8Z068136@svn.freebsd.org> From: Attilio Rao Date: Tue, 12 Mar 2013 12:10:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248192 - user/attilio/vmobj-readlock/sys/vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 12:10:32 -0000 Author: attilio Date: Tue Mar 12 12:10:32 2013 New Revision: 248192 URL: http://svnweb.freebsd.org/changeset/base/248192 Log: Revert brainfart. Reported by: alc Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_page.c Tue Mar 12 12:07:45 2013 (r248191) +++ user/attilio/vmobj-readlock/sys/vm/vm_page.c Tue Mar 12 12:10:32 2013 (r248192) @@ -1184,7 +1184,7 @@ vm_page_alloc(vm_object_t object, vm_pin KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0), ("vm_page_alloc: inconsistent object/req")); - if (object != NULL && (req & VM_ALLOC_IFCACHED) == 0) + if (object != NULL) VM_OBJECT_ASSERT_WLOCKED(object); req_class = req & VM_ALLOC_CLASS_MASK; From owner-svn-src-user@FreeBSD.ORG Tue Mar 12 13:26:15 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EE0EEC23; Tue, 12 Mar 2013 13:26:15 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DE5C595E; Tue, 12 Mar 2013 13:26:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2CDQF5S090580; Tue, 12 Mar 2013 13:26:15 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2CDQCiG090555; Tue, 12 Mar 2013 13:26:12 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303121326.r2CDQCiG090555@svn.freebsd.org> From: Attilio Rao Date: Tue, 12 Mar 2013 13:26:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248205 - in user/attilio/vmcontention/sys: kern nfs nfsclient rpc sys vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 13:26:16 -0000 Author: attilio Date: Tue Mar 12 13:26:12 2013 New Revision: 248205 URL: http://svnweb.freebsd.org/changeset/base/248205 Log: MFC Modified: user/attilio/vmcontention/sys/kern/uipc_mbuf.c user/attilio/vmcontention/sys/kern/uipc_syscalls.c user/attilio/vmcontention/sys/nfs/krpc_subr.c user/attilio/vmcontention/sys/nfsclient/nfs_subs.c user/attilio/vmcontention/sys/nfsclient/nfs_vfsops.c user/attilio/vmcontention/sys/nfsclient/nfs_vnops.c user/attilio/vmcontention/sys/nfsclient/nfsm_subs.h user/attilio/vmcontention/sys/rpc/clnt_dg.c user/attilio/vmcontention/sys/rpc/clnt_vc.c user/attilio/vmcontention/sys/rpc/rpc_generic.c user/attilio/vmcontention/sys/rpc/rpcm_subs.h user/attilio/vmcontention/sys/rpc/svc.c user/attilio/vmcontention/sys/rpc/svc_dg.c user/attilio/vmcontention/sys/rpc/svc_vc.c user/attilio/vmcontention/sys/sys/mbuf.h user/attilio/vmcontention/sys/vm/vm_page.c Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/sys/ (props changed) Modified: user/attilio/vmcontention/sys/kern/uipc_mbuf.c ============================================================================== --- user/attilio/vmcontention/sys/kern/uipc_mbuf.c Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/kern/uipc_mbuf.c Tue Mar 12 13:26:12 2013 (r248205) @@ -255,25 +255,30 @@ m_freem(struct mbuf *mb) * Returns: * Nothing. */ -void +int m_extadd(struct mbuf *mb, caddr_t buf, u_int size, - void (*freef)(void *, void *), void *arg1, void *arg2, int flags, int type) + void (*freef)(void *, void *), void *arg1, void *arg2, int flags, int type, + int wait) { KASSERT(type != EXT_CLUSTER, ("%s: EXT_CLUSTER not allowed", __func__)); if (type != EXT_EXTREF) - mb->m_ext.ref_cnt = (u_int *)uma_zalloc(zone_ext_refcnt, M_NOWAIT); - if (mb->m_ext.ref_cnt != NULL) { - *(mb->m_ext.ref_cnt) = 1; - mb->m_flags |= (M_EXT | flags); - mb->m_ext.ext_buf = buf; - mb->m_data = mb->m_ext.ext_buf; - mb->m_ext.ext_size = size; - mb->m_ext.ext_free = freef; - mb->m_ext.ext_arg1 = arg1; - mb->m_ext.ext_arg2 = arg2; - mb->m_ext.ext_type = type; - } + mb->m_ext.ref_cnt = uma_zalloc(zone_ext_refcnt, wait); + + if (mb->m_ext.ref_cnt == NULL) + return (ENOMEM); + + *(mb->m_ext.ref_cnt) = 1; + mb->m_flags |= (M_EXT | flags); + mb->m_ext.ext_buf = buf; + mb->m_data = mb->m_ext.ext_buf; + mb->m_ext.ext_size = size; + mb->m_ext.ext_free = freef; + mb->m_ext.ext_arg1 = arg1; + mb->m_ext.ext_arg2 = arg2; + mb->m_ext.ext_type = type; + + return (0); } /* Modified: user/attilio/vmcontention/sys/kern/uipc_syscalls.c ============================================================================== --- user/attilio/vmcontention/sys/kern/uipc_syscalls.c Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/kern/uipc_syscalls.c Tue Mar 12 13:26:12 2013 (r248205) @@ -2222,8 +2222,14 @@ retry_space: sf_buf_mext((void *)sf_buf_kva(sf), sf); break; } - MEXTADD(m0, sf_buf_kva(sf), PAGE_SIZE, sf_buf_mext, - sfs, sf, M_RDONLY, EXT_SFBUF); + if (m_extadd(m0, (caddr_t )sf_buf_kva(sf), PAGE_SIZE, + sf_buf_mext, sfs, sf, M_RDONLY, EXT_SFBUF, + (mnw ? M_NOWAIT : M_WAITOK)) != 0) { + error = (mnw ? EAGAIN : ENOBUFS); + sf_buf_mext((void *)sf_buf_kva(sf), sf); + m_freem(m0); + break; + } m0->m_data = (char *)sf_buf_kva(sf) + pgoff; m0->m_len = xfsize; Modified: user/attilio/vmcontention/sys/nfs/krpc_subr.c ============================================================================== --- user/attilio/vmcontention/sys/nfs/krpc_subr.c Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/nfs/krpc_subr.c Tue Mar 12 13:26:12 2013 (r248205) @@ -459,9 +459,7 @@ xdr_string_encode(char *str, int len) if (mlen > MCLBYTES) /* If too big, we just can't do it. */ return (NULL); - m = m_get(M_WAITOK, MT_DATA); - if (mlen > MLEN) - MCLGET(m, M_WAITOK); + m = m_get2(M_WAITOK, MT_DATA, 0, mlen); xs = mtod(m, struct xdr_string *); m->m_len = mlen; xs->len = txdr_unsigned(len); Modified: user/attilio/vmcontention/sys/nfsclient/nfs_subs.c ============================================================================== --- user/attilio/vmcontention/sys/nfsclient/nfs_subs.c Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/nfsclient/nfs_subs.c Tue Mar 12 13:26:12 2013 (r248205) @@ -172,23 +172,6 @@ nfs_xid_gen(void) } /* - * Create the header for an rpc request packet - * The hsiz is the size of the rest of the nfs request header. - * (just used to decide if a cluster is a good idea) - */ -struct mbuf * -nfsm_reqhead(struct vnode *vp, u_long procid, int hsiz) -{ - struct mbuf *mb; - - MGET(mb, M_WAITOK, MT_DATA); - if (hsiz >= MINCLSIZE) - MCLGET(mb, M_WAITOK); - mb->m_len = 0; - return (mb); -} - -/* * copies a uio scatter/gather list to an mbuf chain. * NOTE: can ony handle iovcnt == 1 */ @@ -218,10 +201,10 @@ nfsm_uiotombuf(struct uio *uiop, struct while (left > 0) { mlen = M_TRAILINGSPACE(mp); if (mlen == 0) { - MGET(mp, M_WAITOK, MT_DATA); if (clflg) - MCLGET(mp, M_WAITOK); - mp->m_len = 0; + mp = m_getcl(M_WAITOK, MT_DATA, 0); + else + mp = m_get(M_WAITOK, MT_DATA); mp2->m_next = mp; mp2 = mp; mlen = M_TRAILINGSPACE(mp); @@ -251,8 +234,7 @@ nfsm_uiotombuf(struct uio *uiop, struct } if (rem > 0) { if (rem > M_TRAILINGSPACE(mp)) { - MGET(mp, M_WAITOK, MT_DATA); - mp->m_len = 0; + mp = m_get(M_WAITOK, MT_DATA); mp2->m_next = mp; } cp = mtod(mp, caddr_t)+mp->m_len; @@ -296,10 +278,13 @@ nfsm_strtmbuf(struct mbuf **mb, char **b } /* Loop around adding mbufs */ while (siz > 0) { - MGET(m1, M_WAITOK, MT_DATA); - if (siz > MLEN) - MCLGET(m1, M_WAITOK); - m1->m_len = NFSMSIZ(m1); + if (siz > MLEN) { + m1 = m_getcl(M_WAITOK, MT_DATA, 0); + m1->m_len = MCLBYTES; + } else { + m1 = m_get(M_WAITOK, MT_DATA); + m1->m_len = MLEN; + } m2->m_next = m1; m2 = m1; tl = mtod(m1, u_int32_t *); Modified: user/attilio/vmcontention/sys/nfsclient/nfs_vfsops.c ============================================================================== --- user/attilio/vmcontention/sys/nfsclient/nfs_vfsops.c Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/nfsclient/nfs_vfsops.c Tue Mar 12 13:26:12 2013 (r248205) @@ -298,7 +298,7 @@ nfs_statfs(struct mount *mp, struct stat } else mtx_unlock(&nmp->nm_mtx); nfsstats.rpccnt[NFSPROC_FSSTAT]++; - mreq = nfsm_reqhead(vp, NFSPROC_FSSTAT, NFSX_FH(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -356,7 +356,7 @@ nfs_fsinfo(struct nfsmount *nmp, struct u_int64_t maxfsize; nfsstats.rpccnt[NFSPROC_FSINFO]++; - mreq = nfsm_reqhead(vp, NFSPROC_FSINFO, NFSX_FH(1)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(1)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, 1); Modified: user/attilio/vmcontention/sys/nfsclient/nfs_vnops.c ============================================================================== --- user/attilio/vmcontention/sys/nfsclient/nfs_vnops.c Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/nfsclient/nfs_vnops.c Tue Mar 12 13:26:12 2013 (r248205) @@ -294,7 +294,7 @@ nfs3_access_otw(struct vnode *vp, int wm struct nfsnode *np = VTONFS(vp); nfsstats.rpccnt[NFSPROC_ACCESS]++; - mreq = nfsm_reqhead(vp, NFSPROC_ACCESS, NFSX_FH(v3) + NFSX_UNSIGNED); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + NFSX_UNSIGNED); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -714,7 +714,7 @@ nfs_getattr(struct vop_getattr_args *ap) goto nfsmout; } nfsstats.rpccnt[NFSPROC_GETATTR]++; - mreq = nfsm_reqhead(vp, NFSPROC_GETATTR, NFSX_FH(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -873,7 +873,7 @@ nfs_setattrrpc(struct vnode *vp, struct int v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_SETATTR]++; - mreq = nfsm_reqhead(vp, NFSPROC_SETATTR, NFSX_FH(v3) + NFSX_SATTR(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + NFSX_SATTR(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1037,8 +1037,8 @@ nfs_lookup(struct vop_lookup_args *ap) nfsstats.lookupcache_misses++; nfsstats.rpccnt[NFSPROC_LOOKUP]++; len = cnp->cn_namelen; - mreq = nfsm_reqhead(dvp, NFSPROC_LOOKUP, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1251,7 +1251,7 @@ nfs_readlinkrpc(struct vnode *vp, struct int v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_READLINK]++; - mreq = nfsm_reqhead(vp, NFSPROC_READLINK, NFSX_FH(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1306,7 +1306,8 @@ nfs_readrpc(struct vnode *vp, struct uio while (tsiz > 0) { nfsstats.rpccnt[NFSPROC_READ]++; len = (tsiz > rsize) ? rsize : tsiz; - mreq = nfsm_reqhead(vp, NFSPROC_READ, NFSX_FH(v3) + NFSX_UNSIGNED * 3); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_UNSIGNED * 3); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1378,8 +1379,8 @@ nfs_writerpc(struct vnode *vp, struct ui while (tsiz > 0) { nfsstats.rpccnt[NFSPROC_WRITE]++; len = (tsiz > wsize) ? wsize : tsiz; - mreq = nfsm_reqhead(vp, NFSPROC_WRITE, - NFSX_FH(v3) + 5 * NFSX_UNSIGNED + nfsm_rndup(len)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + 5 * NFSX_UNSIGNED + nfsm_rndup(len)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1501,8 +1502,8 @@ nfs_mknodrpc(struct vnode *dvp, struct v if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)) != 0) return (error); nfsstats.rpccnt[NFSPROC_MKNOD]++; - mreq = nfsm_reqhead(dvp, NFSPROC_MKNOD, NFSX_FH(v3) + 4 * NFSX_UNSIGNED + - + nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 4 * NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1605,8 +1606,8 @@ nfs_create(struct vop_create_args *ap) fmode |= O_EXCL; again: nfsstats.rpccnt[NFSPROC_CREATE]++; - mreq = nfsm_reqhead(dvp, NFSPROC_CREATE, NFSX_FH(v3) + 2 * NFSX_UNSIGNED + - nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 2 * NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1787,8 +1788,8 @@ nfs_removerpc(struct vnode *dvp, const c int v3 = NFS_ISV3(dvp); nfsstats.rpccnt[NFSPROC_REMOVE]++; - mreq = nfsm_reqhead(dvp, NFSPROC_REMOVE, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(namelen)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(namelen)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1923,9 +1924,8 @@ nfs_renamerpc(struct vnode *fdvp, const int v3 = NFS_ISV3(fdvp); nfsstats.rpccnt[NFSPROC_RENAME]++; - mreq = nfsm_reqhead(fdvp, NFSPROC_RENAME, - (NFSX_FH(v3) + NFSX_UNSIGNED)*2 + nfsm_rndup(fnamelen) + - nfsm_rndup(tnamelen)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, (NFSX_FH(v3) + NFSX_UNSIGNED)*2 + + nfsm_rndup(fnamelen) + nfsm_rndup(tnamelen)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(fdvp, v3); @@ -1983,8 +1983,8 @@ nfs_link(struct vop_link_args *ap) v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_LINK]++; - mreq = nfsm_reqhead(vp, NFSPROC_LINK, - NFSX_FH(v3)*2 + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3)*2 + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -2029,7 +2029,7 @@ nfs_symlink(struct vop_symlink_args *ap) nfsstats.rpccnt[NFSPROC_SYMLINK]++; slen = strlen(ap->a_target); - mreq = nfsm_reqhead(dvp, NFSPROC_SYMLINK, NFSX_FH(v3) + 2*NFSX_UNSIGNED + + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 2*NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen) + nfsm_rndup(slen) + NFSX_SATTR(v3)); mb = mreq; bpos = mtod(mb, caddr_t); @@ -2123,8 +2123,8 @@ nfs_mkdir(struct vop_mkdir_args *ap) return (error); len = cnp->cn_namelen; nfsstats.rpccnt[NFSPROC_MKDIR]++; - mreq = nfsm_reqhead(dvp, NFSPROC_MKDIR, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len) + NFSX_SATTR(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len) + NFSX_SATTR(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2188,8 +2188,8 @@ nfs_rmdir(struct vop_rmdir_args *ap) if (dvp == vp) return (EINVAL); nfsstats.rpccnt[NFSPROC_RMDIR]++; - mreq = nfsm_reqhead(dvp, NFSPROC_RMDIR, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2307,8 +2307,8 @@ nfs_readdirrpc(struct vnode *vp, struct */ while (more_dirs && bigenough) { nfsstats.rpccnt[NFSPROC_READDIR]++; - mreq = nfsm_reqhead(vp, NFSPROC_READDIR, NFSX_FH(v3) + - NFSX_READDIR(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_READDIR(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -2513,8 +2513,8 @@ nfs_readdirplusrpc(struct vnode *vp, str */ while (more_dirs && bigenough) { nfsstats.rpccnt[NFSPROC_READDIRPLUS]++; - mreq = nfsm_reqhead(vp, NFSPROC_READDIRPLUS, - NFSX_FH(1) + 6 * NFSX_UNSIGNED); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(1) + 6 * NFSX_UNSIGNED); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, 1); @@ -2818,8 +2818,8 @@ nfs_lookitup(struct vnode *dvp, const ch int v3 = NFS_ISV3(dvp); nfsstats.rpccnt[NFSPROC_LOOKUP]++; - mreq = nfsm_reqhead(dvp, NFSPROC_LOOKUP, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2897,7 +2897,7 @@ nfs_commit(struct vnode *vp, u_quad_t of } mtx_unlock(&nmp->nm_mtx); nfsstats.rpccnt[NFSPROC_COMMIT]++; - mreq = nfsm_reqhead(vp, NFSPROC_COMMIT, NFSX_FH(1)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(1)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, 1); Modified: user/attilio/vmcontention/sys/nfsclient/nfsm_subs.h ============================================================================== --- user/attilio/vmcontention/sys/nfsclient/nfsm_subs.h Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/nfsclient/nfsm_subs.h Tue Mar 12 13:26:12 2013 (r248205) @@ -53,34 +53,6 @@ struct vnode; * First define what the actual subs. return */ u_int32_t nfs_xid_gen(void); -struct mbuf *nfsm_reqhead(struct vnode *vp, u_long procid, int hsiz); - -#define M_HASCL(m) ((m)->m_flags & M_EXT) -#define NFSMINOFF(m) \ - do { \ - if (M_HASCL(m)) \ - (m)->m_data = (m)->m_ext.ext_buf; \ - else if ((m)->m_flags & M_PKTHDR) \ - (m)->m_data = (m)->m_pktdat; \ - else \ - (m)->m_data = (m)->m_dat; \ - } while (0) -#define NFSMSIZ(m) ((M_HASCL(m))?MCLBYTES: \ - (((m)->m_flags & M_PKTHDR)?MHLEN:MLEN)) - -/* - * Now for the macros that do the simple stuff and call the functions - * for the hard stuff. - * These macros use several vars. declared in nfsm_reqhead and these - * vars. must not be used elsewhere unless you are careful not to corrupt - * them. The vars. starting with pN and tN (N=1,2,3,..) are temporaries - * that may be used so long as the value is not expected to retained - * after a macro. - * I know, this is kind of dorkey, but it makes the actual op functions - * fairly clean and deals with the mess caused by the xdr discriminating - * unions. - */ - /* *********************************** */ /* Request generation phase macros */ Modified: user/attilio/vmcontention/sys/rpc/clnt_dg.c ============================================================================== --- user/attilio/vmcontention/sys/rpc/clnt_dg.c Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/rpc/clnt_dg.c Tue Mar 12 13:26:12 2013 (r248205) @@ -431,7 +431,7 @@ call_again: send_again: mtx_unlock(&cs->cs_lock); - MGETHDR(mreq, M_WAITOK, MT_DATA); + mreq = m_gethdr(M_WAITOK, MT_DATA); KASSERT(cu->cu_mcalllen <= MHLEN, ("RPC header too big")); bcopy(cu->cu_mcallc, mreq->m_data, cu->cu_mcalllen); mreq->m_len = cu->cu_mcalllen; Modified: user/attilio/vmcontention/sys/rpc/clnt_vc.c ============================================================================== --- user/attilio/vmcontention/sys/rpc/clnt_vc.c Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/rpc/clnt_vc.c Tue Mar 12 13:26:12 2013 (r248205) @@ -349,7 +349,7 @@ call_again: /* * Leave space to pre-pend the record mark. */ - MGETHDR(mreq, M_WAITOK, MT_DATA); + mreq = m_gethdr(M_WAITOK, MT_DATA); mreq->m_data += sizeof(uint32_t); KASSERT(ct->ct_mpos + sizeof(uint32_t) <= MHLEN, ("RPC header too big")); Modified: user/attilio/vmcontention/sys/rpc/rpc_generic.c ============================================================================== --- user/attilio/vmcontention/sys/rpc/rpc_generic.c Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/rpc/rpc_generic.c Tue Mar 12 13:26:12 2013 (r248205) @@ -750,9 +750,7 @@ clnt_call_private( struct mbuf *mrep; enum clnt_stat stat; - MGET(mreq, M_WAITOK, MT_DATA); - MCLGET(mreq, M_WAITOK); - mreq->m_len = 0; + mreq = m_getcl(M_WAITOK, MT_DATA, 0); xdrmbuf_create(&xdrs, mreq, XDR_ENCODE); if (!xargs(&xdrs, argsp)) { Modified: user/attilio/vmcontention/sys/rpc/rpcm_subs.h ============================================================================== --- user/attilio/vmcontention/sys/rpc/rpcm_subs.h Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/rpc/rpcm_subs.h Tue Mar 12 13:26:12 2013 (r248205) @@ -80,7 +80,7 @@ #define rpcm_build(a,c,s) \ { if ((s) > M_TRAILINGSPACE(mb)) { \ - MGET(mb2, M_WAITOK, MT_DATA); \ + mb2 = m_get(M_WAITOK, MT_DATA); \ if ((s) > MLEN) \ panic("build > MLEN"); \ mb->m_next = mb2; \ Modified: user/attilio/vmcontention/sys/rpc/svc.c ============================================================================== --- user/attilio/vmcontention/sys/rpc/svc.c Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/rpc/svc.c Tue Mar 12 13:26:12 2013 (r248205) @@ -563,9 +563,7 @@ svc_sendreply(struct svc_req *rqstp, xdr rply.acpted_rply.ar_results.where = NULL; rply.acpted_rply.ar_results.proc = (xdrproc_t) xdr_void; - MGET(m, M_WAITOK, MT_DATA); - MCLGET(m, M_WAITOK); - m->m_len = 0; + m = m_getcl(M_WAITOK, MT_DATA, 0); xdrmbuf_create(&xdrs, m, XDR_ENCODE); ok = xdr_results(&xdrs, xdr_location); XDR_DESTROY(&xdrs); Modified: user/attilio/vmcontention/sys/rpc/svc_dg.c ============================================================================== --- user/attilio/vmcontention/sys/rpc/svc_dg.c Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/rpc/svc_dg.c Tue Mar 12 13:26:12 2013 (r248205) @@ -238,8 +238,7 @@ svc_dg_reply(SVCXPRT *xprt, struct rpc_m bool_t stat = TRUE; int error; - MGETHDR(mrep, M_WAITOK, MT_DATA); - mrep->m_len = 0; + mrep = m_gethdr(M_WAITOK, MT_DATA); xdrmbuf_create(&xdrs, mrep, XDR_ENCODE); Modified: user/attilio/vmcontention/sys/rpc/svc_vc.c ============================================================================== --- user/attilio/vmcontention/sys/rpc/svc_vc.c Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/rpc/svc_vc.c Tue Mar 12 13:26:12 2013 (r248205) @@ -796,8 +796,7 @@ svc_vc_reply(SVCXPRT *xprt, struct rpc_m /* * Leave space for record mark. */ - MGETHDR(mrep, M_WAITOK, MT_DATA); - mrep->m_len = 0; + mrep = m_gethdr(M_WAITOK, MT_DATA); mrep->m_data += sizeof(uint32_t); xdrmbuf_create(&xdrs, mrep, XDR_ENCODE); @@ -850,8 +849,7 @@ svc_vc_backchannel_reply(SVCXPRT *xprt, /* * Leave space for record mark. */ - MGETHDR(mrep, M_WAITOK, MT_DATA); - mrep->m_len = 0; + mrep = m_gethdr(M_WAITOK, MT_DATA); mrep->m_data += sizeof(uint32_t); xdrmbuf_create(&xdrs, mrep, XDR_ENCODE); Modified: user/attilio/vmcontention/sys/sys/mbuf.h ============================================================================== --- user/attilio/vmcontention/sys/sys/mbuf.h Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/sys/mbuf.h Tue Mar 12 13:26:12 2013 (r248205) @@ -655,7 +655,8 @@ m_last(struct mbuf *m) #define MGETHDR(m, how, type) ((m) = m_gethdr((how), (type))) #define MCLGET(m, how) m_clget((m), (how)) #define MEXTADD(m, buf, size, free, arg1, arg2, flags, type) \ - m_extadd((m), (caddr_t)(buf), (size), (free),(arg1),(arg2),(flags), (type)) + (void )m_extadd((m), (caddr_t)(buf), (size), (free), (arg1), (arg2),\ + (flags), (type), M_NOWAIT) #define m_getm(m, len, how, type) \ m_getm2((m), (len), (how), (type), M_PKTHDR) @@ -780,8 +781,8 @@ int m_apply(struct mbuf *, int, int, int (*)(void *, void *, u_int), void *); int m_append(struct mbuf *, int, c_caddr_t); void m_cat(struct mbuf *, struct mbuf *); -void m_extadd(struct mbuf *, caddr_t, u_int, - void (*)(void *, void *), void *, void *, int, int); +int m_extadd(struct mbuf *, caddr_t, u_int, + void (*)(void *, void *), void *, void *, int, int, int); struct mbuf *m_collapse(struct mbuf *, int, int); void m_copyback(struct mbuf *, int, int, c_caddr_t); void m_copydata(const struct mbuf *, int, int, caddr_t); Modified: user/attilio/vmcontention/sys/vm/vm_page.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_page.c Tue Mar 12 13:17:24 2013 (r248204) +++ user/attilio/vmcontention/sys/vm/vm_page.c Tue Mar 12 13:26:12 2013 (r248205) @@ -2655,10 +2655,7 @@ vm_page_is_valid(vm_page_t m, int base, VM_OBJECT_ASSERT_WLOCKED(m->object); bits = vm_page_bits(base, size); - if (m->valid && ((m->valid & bits) == bits)) - return 1; - else - return 0; + return (m->valid != 0 && (m->valid & bits) == bits); } /* From owner-svn-src-user@FreeBSD.ORG Tue Mar 12 13:29:27 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D6994DA2; Tue, 12 Mar 2013 13:29:27 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C864997D; Tue, 12 Mar 2013 13:29:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2CDTRHl091024; Tue, 12 Mar 2013 13:29:27 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2CDTOI8091005; Tue, 12 Mar 2013 13:29:24 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303121329.r2CDTOI8091005@svn.freebsd.org> From: Attilio Rao Date: Tue, 12 Mar 2013 13:29:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248206 - in user/attilio/vmobj-readlock/sys: kern nfs nfsclient rpc sys vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 13:29:27 -0000 Author: attilio Date: Tue Mar 12 13:29:24 2013 New Revision: 248206 URL: http://svnweb.freebsd.org/changeset/base/248206 Log: Merge from vmcontention Modified: user/attilio/vmobj-readlock/sys/kern/uipc_mbuf.c user/attilio/vmobj-readlock/sys/kern/uipc_syscalls.c user/attilio/vmobj-readlock/sys/nfs/krpc_subr.c user/attilio/vmobj-readlock/sys/nfsclient/nfs_subs.c user/attilio/vmobj-readlock/sys/nfsclient/nfs_vfsops.c user/attilio/vmobj-readlock/sys/nfsclient/nfs_vnops.c user/attilio/vmobj-readlock/sys/nfsclient/nfsm_subs.h user/attilio/vmobj-readlock/sys/rpc/clnt_dg.c user/attilio/vmobj-readlock/sys/rpc/clnt_vc.c user/attilio/vmobj-readlock/sys/rpc/rpc_generic.c user/attilio/vmobj-readlock/sys/rpc/rpcm_subs.h user/attilio/vmobj-readlock/sys/rpc/svc.c user/attilio/vmobj-readlock/sys/rpc/svc_dg.c user/attilio/vmobj-readlock/sys/rpc/svc_vc.c user/attilio/vmobj-readlock/sys/sys/mbuf.h user/attilio/vmobj-readlock/sys/vm/vm_page.c Directory Properties: user/attilio/vmobj-readlock/ (props changed) user/attilio/vmobj-readlock/sys/ (props changed) Modified: user/attilio/vmobj-readlock/sys/kern/uipc_mbuf.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/uipc_mbuf.c Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/kern/uipc_mbuf.c Tue Mar 12 13:29:24 2013 (r248206) @@ -255,25 +255,30 @@ m_freem(struct mbuf *mb) * Returns: * Nothing. */ -void +int m_extadd(struct mbuf *mb, caddr_t buf, u_int size, - void (*freef)(void *, void *), void *arg1, void *arg2, int flags, int type) + void (*freef)(void *, void *), void *arg1, void *arg2, int flags, int type, + int wait) { KASSERT(type != EXT_CLUSTER, ("%s: EXT_CLUSTER not allowed", __func__)); if (type != EXT_EXTREF) - mb->m_ext.ref_cnt = (u_int *)uma_zalloc(zone_ext_refcnt, M_NOWAIT); - if (mb->m_ext.ref_cnt != NULL) { - *(mb->m_ext.ref_cnt) = 1; - mb->m_flags |= (M_EXT | flags); - mb->m_ext.ext_buf = buf; - mb->m_data = mb->m_ext.ext_buf; - mb->m_ext.ext_size = size; - mb->m_ext.ext_free = freef; - mb->m_ext.ext_arg1 = arg1; - mb->m_ext.ext_arg2 = arg2; - mb->m_ext.ext_type = type; - } + mb->m_ext.ref_cnt = uma_zalloc(zone_ext_refcnt, wait); + + if (mb->m_ext.ref_cnt == NULL) + return (ENOMEM); + + *(mb->m_ext.ref_cnt) = 1; + mb->m_flags |= (M_EXT | flags); + mb->m_ext.ext_buf = buf; + mb->m_data = mb->m_ext.ext_buf; + mb->m_ext.ext_size = size; + mb->m_ext.ext_free = freef; + mb->m_ext.ext_arg1 = arg1; + mb->m_ext.ext_arg2 = arg2; + mb->m_ext.ext_type = type; + + return (0); } /* Modified: user/attilio/vmobj-readlock/sys/kern/uipc_syscalls.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/uipc_syscalls.c Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/kern/uipc_syscalls.c Tue Mar 12 13:29:24 2013 (r248206) @@ -2222,8 +2222,14 @@ retry_space: sf_buf_mext((void *)sf_buf_kva(sf), sf); break; } - MEXTADD(m0, sf_buf_kva(sf), PAGE_SIZE, sf_buf_mext, - sfs, sf, M_RDONLY, EXT_SFBUF); + if (m_extadd(m0, (caddr_t )sf_buf_kva(sf), PAGE_SIZE, + sf_buf_mext, sfs, sf, M_RDONLY, EXT_SFBUF, + (mnw ? M_NOWAIT : M_WAITOK)) != 0) { + error = (mnw ? EAGAIN : ENOBUFS); + sf_buf_mext((void *)sf_buf_kva(sf), sf); + m_freem(m0); + break; + } m0->m_data = (char *)sf_buf_kva(sf) + pgoff; m0->m_len = xfsize; Modified: user/attilio/vmobj-readlock/sys/nfs/krpc_subr.c ============================================================================== --- user/attilio/vmobj-readlock/sys/nfs/krpc_subr.c Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/nfs/krpc_subr.c Tue Mar 12 13:29:24 2013 (r248206) @@ -459,9 +459,7 @@ xdr_string_encode(char *str, int len) if (mlen > MCLBYTES) /* If too big, we just can't do it. */ return (NULL); - m = m_get(M_WAITOK, MT_DATA); - if (mlen > MLEN) - MCLGET(m, M_WAITOK); + m = m_get2(M_WAITOK, MT_DATA, 0, mlen); xs = mtod(m, struct xdr_string *); m->m_len = mlen; xs->len = txdr_unsigned(len); Modified: user/attilio/vmobj-readlock/sys/nfsclient/nfs_subs.c ============================================================================== --- user/attilio/vmobj-readlock/sys/nfsclient/nfs_subs.c Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/nfsclient/nfs_subs.c Tue Mar 12 13:29:24 2013 (r248206) @@ -172,23 +172,6 @@ nfs_xid_gen(void) } /* - * Create the header for an rpc request packet - * The hsiz is the size of the rest of the nfs request header. - * (just used to decide if a cluster is a good idea) - */ -struct mbuf * -nfsm_reqhead(struct vnode *vp, u_long procid, int hsiz) -{ - struct mbuf *mb; - - MGET(mb, M_WAITOK, MT_DATA); - if (hsiz >= MINCLSIZE) - MCLGET(mb, M_WAITOK); - mb->m_len = 0; - return (mb); -} - -/* * copies a uio scatter/gather list to an mbuf chain. * NOTE: can ony handle iovcnt == 1 */ @@ -218,10 +201,10 @@ nfsm_uiotombuf(struct uio *uiop, struct while (left > 0) { mlen = M_TRAILINGSPACE(mp); if (mlen == 0) { - MGET(mp, M_WAITOK, MT_DATA); if (clflg) - MCLGET(mp, M_WAITOK); - mp->m_len = 0; + mp = m_getcl(M_WAITOK, MT_DATA, 0); + else + mp = m_get(M_WAITOK, MT_DATA); mp2->m_next = mp; mp2 = mp; mlen = M_TRAILINGSPACE(mp); @@ -251,8 +234,7 @@ nfsm_uiotombuf(struct uio *uiop, struct } if (rem > 0) { if (rem > M_TRAILINGSPACE(mp)) { - MGET(mp, M_WAITOK, MT_DATA); - mp->m_len = 0; + mp = m_get(M_WAITOK, MT_DATA); mp2->m_next = mp; } cp = mtod(mp, caddr_t)+mp->m_len; @@ -296,10 +278,13 @@ nfsm_strtmbuf(struct mbuf **mb, char **b } /* Loop around adding mbufs */ while (siz > 0) { - MGET(m1, M_WAITOK, MT_DATA); - if (siz > MLEN) - MCLGET(m1, M_WAITOK); - m1->m_len = NFSMSIZ(m1); + if (siz > MLEN) { + m1 = m_getcl(M_WAITOK, MT_DATA, 0); + m1->m_len = MCLBYTES; + } else { + m1 = m_get(M_WAITOK, MT_DATA); + m1->m_len = MLEN; + } m2->m_next = m1; m2 = m1; tl = mtod(m1, u_int32_t *); Modified: user/attilio/vmobj-readlock/sys/nfsclient/nfs_vfsops.c ============================================================================== --- user/attilio/vmobj-readlock/sys/nfsclient/nfs_vfsops.c Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/nfsclient/nfs_vfsops.c Tue Mar 12 13:29:24 2013 (r248206) @@ -298,7 +298,7 @@ nfs_statfs(struct mount *mp, struct stat } else mtx_unlock(&nmp->nm_mtx); nfsstats.rpccnt[NFSPROC_FSSTAT]++; - mreq = nfsm_reqhead(vp, NFSPROC_FSSTAT, NFSX_FH(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -356,7 +356,7 @@ nfs_fsinfo(struct nfsmount *nmp, struct u_int64_t maxfsize; nfsstats.rpccnt[NFSPROC_FSINFO]++; - mreq = nfsm_reqhead(vp, NFSPROC_FSINFO, NFSX_FH(1)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(1)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, 1); Modified: user/attilio/vmobj-readlock/sys/nfsclient/nfs_vnops.c ============================================================================== --- user/attilio/vmobj-readlock/sys/nfsclient/nfs_vnops.c Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/nfsclient/nfs_vnops.c Tue Mar 12 13:29:24 2013 (r248206) @@ -294,7 +294,7 @@ nfs3_access_otw(struct vnode *vp, int wm struct nfsnode *np = VTONFS(vp); nfsstats.rpccnt[NFSPROC_ACCESS]++; - mreq = nfsm_reqhead(vp, NFSPROC_ACCESS, NFSX_FH(v3) + NFSX_UNSIGNED); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + NFSX_UNSIGNED); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -714,7 +714,7 @@ nfs_getattr(struct vop_getattr_args *ap) goto nfsmout; } nfsstats.rpccnt[NFSPROC_GETATTR]++; - mreq = nfsm_reqhead(vp, NFSPROC_GETATTR, NFSX_FH(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -873,7 +873,7 @@ nfs_setattrrpc(struct vnode *vp, struct int v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_SETATTR]++; - mreq = nfsm_reqhead(vp, NFSPROC_SETATTR, NFSX_FH(v3) + NFSX_SATTR(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + NFSX_SATTR(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1037,8 +1037,8 @@ nfs_lookup(struct vop_lookup_args *ap) nfsstats.lookupcache_misses++; nfsstats.rpccnt[NFSPROC_LOOKUP]++; len = cnp->cn_namelen; - mreq = nfsm_reqhead(dvp, NFSPROC_LOOKUP, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1251,7 +1251,7 @@ nfs_readlinkrpc(struct vnode *vp, struct int v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_READLINK]++; - mreq = nfsm_reqhead(vp, NFSPROC_READLINK, NFSX_FH(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1306,7 +1306,8 @@ nfs_readrpc(struct vnode *vp, struct uio while (tsiz > 0) { nfsstats.rpccnt[NFSPROC_READ]++; len = (tsiz > rsize) ? rsize : tsiz; - mreq = nfsm_reqhead(vp, NFSPROC_READ, NFSX_FH(v3) + NFSX_UNSIGNED * 3); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_UNSIGNED * 3); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1378,8 +1379,8 @@ nfs_writerpc(struct vnode *vp, struct ui while (tsiz > 0) { nfsstats.rpccnt[NFSPROC_WRITE]++; len = (tsiz > wsize) ? wsize : tsiz; - mreq = nfsm_reqhead(vp, NFSPROC_WRITE, - NFSX_FH(v3) + 5 * NFSX_UNSIGNED + nfsm_rndup(len)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + 5 * NFSX_UNSIGNED + nfsm_rndup(len)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1501,8 +1502,8 @@ nfs_mknodrpc(struct vnode *dvp, struct v if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)) != 0) return (error); nfsstats.rpccnt[NFSPROC_MKNOD]++; - mreq = nfsm_reqhead(dvp, NFSPROC_MKNOD, NFSX_FH(v3) + 4 * NFSX_UNSIGNED + - + nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 4 * NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1605,8 +1606,8 @@ nfs_create(struct vop_create_args *ap) fmode |= O_EXCL; again: nfsstats.rpccnt[NFSPROC_CREATE]++; - mreq = nfsm_reqhead(dvp, NFSPROC_CREATE, NFSX_FH(v3) + 2 * NFSX_UNSIGNED + - nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 2 * NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1787,8 +1788,8 @@ nfs_removerpc(struct vnode *dvp, const c int v3 = NFS_ISV3(dvp); nfsstats.rpccnt[NFSPROC_REMOVE]++; - mreq = nfsm_reqhead(dvp, NFSPROC_REMOVE, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(namelen)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(namelen)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1923,9 +1924,8 @@ nfs_renamerpc(struct vnode *fdvp, const int v3 = NFS_ISV3(fdvp); nfsstats.rpccnt[NFSPROC_RENAME]++; - mreq = nfsm_reqhead(fdvp, NFSPROC_RENAME, - (NFSX_FH(v3) + NFSX_UNSIGNED)*2 + nfsm_rndup(fnamelen) + - nfsm_rndup(tnamelen)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, (NFSX_FH(v3) + NFSX_UNSIGNED)*2 + + nfsm_rndup(fnamelen) + nfsm_rndup(tnamelen)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(fdvp, v3); @@ -1983,8 +1983,8 @@ nfs_link(struct vop_link_args *ap) v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_LINK]++; - mreq = nfsm_reqhead(vp, NFSPROC_LINK, - NFSX_FH(v3)*2 + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3)*2 + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -2029,7 +2029,7 @@ nfs_symlink(struct vop_symlink_args *ap) nfsstats.rpccnt[NFSPROC_SYMLINK]++; slen = strlen(ap->a_target); - mreq = nfsm_reqhead(dvp, NFSPROC_SYMLINK, NFSX_FH(v3) + 2*NFSX_UNSIGNED + + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 2*NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen) + nfsm_rndup(slen) + NFSX_SATTR(v3)); mb = mreq; bpos = mtod(mb, caddr_t); @@ -2123,8 +2123,8 @@ nfs_mkdir(struct vop_mkdir_args *ap) return (error); len = cnp->cn_namelen; nfsstats.rpccnt[NFSPROC_MKDIR]++; - mreq = nfsm_reqhead(dvp, NFSPROC_MKDIR, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len) + NFSX_SATTR(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len) + NFSX_SATTR(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2188,8 +2188,8 @@ nfs_rmdir(struct vop_rmdir_args *ap) if (dvp == vp) return (EINVAL); nfsstats.rpccnt[NFSPROC_RMDIR]++; - mreq = nfsm_reqhead(dvp, NFSPROC_RMDIR, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2307,8 +2307,8 @@ nfs_readdirrpc(struct vnode *vp, struct */ while (more_dirs && bigenough) { nfsstats.rpccnt[NFSPROC_READDIR]++; - mreq = nfsm_reqhead(vp, NFSPROC_READDIR, NFSX_FH(v3) + - NFSX_READDIR(v3)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_READDIR(v3)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -2513,8 +2513,8 @@ nfs_readdirplusrpc(struct vnode *vp, str */ while (more_dirs && bigenough) { nfsstats.rpccnt[NFSPROC_READDIRPLUS]++; - mreq = nfsm_reqhead(vp, NFSPROC_READDIRPLUS, - NFSX_FH(1) + 6 * NFSX_UNSIGNED); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(1) + 6 * NFSX_UNSIGNED); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, 1); @@ -2818,8 +2818,8 @@ nfs_lookitup(struct vnode *dvp, const ch int v3 = NFS_ISV3(dvp); nfsstats.rpccnt[NFSPROC_LOOKUP]++; - mreq = nfsm_reqhead(dvp, NFSPROC_LOOKUP, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, + NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2897,7 +2897,7 @@ nfs_commit(struct vnode *vp, u_quad_t of } mtx_unlock(&nmp->nm_mtx); nfsstats.rpccnt[NFSPROC_COMMIT]++; - mreq = nfsm_reqhead(vp, NFSPROC_COMMIT, NFSX_FH(1)); + mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(1)); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, 1); Modified: user/attilio/vmobj-readlock/sys/nfsclient/nfsm_subs.h ============================================================================== --- user/attilio/vmobj-readlock/sys/nfsclient/nfsm_subs.h Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/nfsclient/nfsm_subs.h Tue Mar 12 13:29:24 2013 (r248206) @@ -53,34 +53,6 @@ struct vnode; * First define what the actual subs. return */ u_int32_t nfs_xid_gen(void); -struct mbuf *nfsm_reqhead(struct vnode *vp, u_long procid, int hsiz); - -#define M_HASCL(m) ((m)->m_flags & M_EXT) -#define NFSMINOFF(m) \ - do { \ - if (M_HASCL(m)) \ - (m)->m_data = (m)->m_ext.ext_buf; \ - else if ((m)->m_flags & M_PKTHDR) \ - (m)->m_data = (m)->m_pktdat; \ - else \ - (m)->m_data = (m)->m_dat; \ - } while (0) -#define NFSMSIZ(m) ((M_HASCL(m))?MCLBYTES: \ - (((m)->m_flags & M_PKTHDR)?MHLEN:MLEN)) - -/* - * Now for the macros that do the simple stuff and call the functions - * for the hard stuff. - * These macros use several vars. declared in nfsm_reqhead and these - * vars. must not be used elsewhere unless you are careful not to corrupt - * them. The vars. starting with pN and tN (N=1,2,3,..) are temporaries - * that may be used so long as the value is not expected to retained - * after a macro. - * I know, this is kind of dorkey, but it makes the actual op functions - * fairly clean and deals with the mess caused by the xdr discriminating - * unions. - */ - /* *********************************** */ /* Request generation phase macros */ Modified: user/attilio/vmobj-readlock/sys/rpc/clnt_dg.c ============================================================================== --- user/attilio/vmobj-readlock/sys/rpc/clnt_dg.c Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/rpc/clnt_dg.c Tue Mar 12 13:29:24 2013 (r248206) @@ -431,7 +431,7 @@ call_again: send_again: mtx_unlock(&cs->cs_lock); - MGETHDR(mreq, M_WAITOK, MT_DATA); + mreq = m_gethdr(M_WAITOK, MT_DATA); KASSERT(cu->cu_mcalllen <= MHLEN, ("RPC header too big")); bcopy(cu->cu_mcallc, mreq->m_data, cu->cu_mcalllen); mreq->m_len = cu->cu_mcalllen; Modified: user/attilio/vmobj-readlock/sys/rpc/clnt_vc.c ============================================================================== --- user/attilio/vmobj-readlock/sys/rpc/clnt_vc.c Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/rpc/clnt_vc.c Tue Mar 12 13:29:24 2013 (r248206) @@ -349,7 +349,7 @@ call_again: /* * Leave space to pre-pend the record mark. */ - MGETHDR(mreq, M_WAITOK, MT_DATA); + mreq = m_gethdr(M_WAITOK, MT_DATA); mreq->m_data += sizeof(uint32_t); KASSERT(ct->ct_mpos + sizeof(uint32_t) <= MHLEN, ("RPC header too big")); Modified: user/attilio/vmobj-readlock/sys/rpc/rpc_generic.c ============================================================================== --- user/attilio/vmobj-readlock/sys/rpc/rpc_generic.c Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/rpc/rpc_generic.c Tue Mar 12 13:29:24 2013 (r248206) @@ -750,9 +750,7 @@ clnt_call_private( struct mbuf *mrep; enum clnt_stat stat; - MGET(mreq, M_WAITOK, MT_DATA); - MCLGET(mreq, M_WAITOK); - mreq->m_len = 0; + mreq = m_getcl(M_WAITOK, MT_DATA, 0); xdrmbuf_create(&xdrs, mreq, XDR_ENCODE); if (!xargs(&xdrs, argsp)) { Modified: user/attilio/vmobj-readlock/sys/rpc/rpcm_subs.h ============================================================================== --- user/attilio/vmobj-readlock/sys/rpc/rpcm_subs.h Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/rpc/rpcm_subs.h Tue Mar 12 13:29:24 2013 (r248206) @@ -80,7 +80,7 @@ #define rpcm_build(a,c,s) \ { if ((s) > M_TRAILINGSPACE(mb)) { \ - MGET(mb2, M_WAITOK, MT_DATA); \ + mb2 = m_get(M_WAITOK, MT_DATA); \ if ((s) > MLEN) \ panic("build > MLEN"); \ mb->m_next = mb2; \ Modified: user/attilio/vmobj-readlock/sys/rpc/svc.c ============================================================================== --- user/attilio/vmobj-readlock/sys/rpc/svc.c Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/rpc/svc.c Tue Mar 12 13:29:24 2013 (r248206) @@ -563,9 +563,7 @@ svc_sendreply(struct svc_req *rqstp, xdr rply.acpted_rply.ar_results.where = NULL; rply.acpted_rply.ar_results.proc = (xdrproc_t) xdr_void; - MGET(m, M_WAITOK, MT_DATA); - MCLGET(m, M_WAITOK); - m->m_len = 0; + m = m_getcl(M_WAITOK, MT_DATA, 0); xdrmbuf_create(&xdrs, m, XDR_ENCODE); ok = xdr_results(&xdrs, xdr_location); XDR_DESTROY(&xdrs); Modified: user/attilio/vmobj-readlock/sys/rpc/svc_dg.c ============================================================================== --- user/attilio/vmobj-readlock/sys/rpc/svc_dg.c Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/rpc/svc_dg.c Tue Mar 12 13:29:24 2013 (r248206) @@ -238,8 +238,7 @@ svc_dg_reply(SVCXPRT *xprt, struct rpc_m bool_t stat = TRUE; int error; - MGETHDR(mrep, M_WAITOK, MT_DATA); - mrep->m_len = 0; + mrep = m_gethdr(M_WAITOK, MT_DATA); xdrmbuf_create(&xdrs, mrep, XDR_ENCODE); Modified: user/attilio/vmobj-readlock/sys/rpc/svc_vc.c ============================================================================== --- user/attilio/vmobj-readlock/sys/rpc/svc_vc.c Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/rpc/svc_vc.c Tue Mar 12 13:29:24 2013 (r248206) @@ -796,8 +796,7 @@ svc_vc_reply(SVCXPRT *xprt, struct rpc_m /* * Leave space for record mark. */ - MGETHDR(mrep, M_WAITOK, MT_DATA); - mrep->m_len = 0; + mrep = m_gethdr(M_WAITOK, MT_DATA); mrep->m_data += sizeof(uint32_t); xdrmbuf_create(&xdrs, mrep, XDR_ENCODE); @@ -850,8 +849,7 @@ svc_vc_backchannel_reply(SVCXPRT *xprt, /* * Leave space for record mark. */ - MGETHDR(mrep, M_WAITOK, MT_DATA); - mrep->m_len = 0; + mrep = m_gethdr(M_WAITOK, MT_DATA); mrep->m_data += sizeof(uint32_t); xdrmbuf_create(&xdrs, mrep, XDR_ENCODE); Modified: user/attilio/vmobj-readlock/sys/sys/mbuf.h ============================================================================== --- user/attilio/vmobj-readlock/sys/sys/mbuf.h Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/sys/mbuf.h Tue Mar 12 13:29:24 2013 (r248206) @@ -655,7 +655,8 @@ m_last(struct mbuf *m) #define MGETHDR(m, how, type) ((m) = m_gethdr((how), (type))) #define MCLGET(m, how) m_clget((m), (how)) #define MEXTADD(m, buf, size, free, arg1, arg2, flags, type) \ - m_extadd((m), (caddr_t)(buf), (size), (free),(arg1),(arg2),(flags), (type)) + (void )m_extadd((m), (caddr_t)(buf), (size), (free), (arg1), (arg2),\ + (flags), (type), M_NOWAIT) #define m_getm(m, len, how, type) \ m_getm2((m), (len), (how), (type), M_PKTHDR) @@ -780,8 +781,8 @@ int m_apply(struct mbuf *, int, int, int (*)(void *, void *, u_int), void *); int m_append(struct mbuf *, int, c_caddr_t); void m_cat(struct mbuf *, struct mbuf *); -void m_extadd(struct mbuf *, caddr_t, u_int, - void (*)(void *, void *), void *, void *, int, int); +int m_extadd(struct mbuf *, caddr_t, u_int, + void (*)(void *, void *), void *, void *, int, int, int); struct mbuf *m_collapse(struct mbuf *, int, int); void m_copyback(struct mbuf *, int, int, c_caddr_t); void m_copydata(const struct mbuf *, int, int, caddr_t); Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_page.c Tue Mar 12 13:26:12 2013 (r248205) +++ user/attilio/vmobj-readlock/sys/vm/vm_page.c Tue Mar 12 13:29:24 2013 (r248206) @@ -2655,7 +2655,7 @@ vm_page_is_valid(vm_page_t m, int base, VM_OBJECT_ASSERT_LOCKED(m->object); bits = vm_page_bits(base, size); - return (m->valid && ((m->valid & bits) == bits)); + return (m->valid != 0 && (m->valid & bits) == bits); } /* From owner-svn-src-user@FreeBSD.ORG Tue Mar 12 13:46:31 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 28B614FF; Tue, 12 Mar 2013 13:46:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F3039A63; Tue, 12 Mar 2013 13:46:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2CDkUid096704; Tue, 12 Mar 2013 13:46:30 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2CDkUlK096702; Tue, 12 Mar 2013 13:46:30 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303121346.r2CDkUlK096702@svn.freebsd.org> From: Attilio Rao Date: Tue, 12 Mar 2013 13:46:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248208 - user/attilio/vmobj-readlock/sys/vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 13:46:31 -0000 Author: attilio Date: Tue Mar 12 13:46:30 2013 New Revision: 248208 URL: http://svnweb.freebsd.org/changeset/base/248208 Log: The per-page act_count is almost always protected already by the page-lock, hence mark it formally as so, adjusting the only 2 places that leave it uncovered, but where the lock was still held nearby. Sponsored by: EMC / Isilon storage division Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.h user/attilio/vmobj-readlock/sys/vm/vm_pageout.c Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.h ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_page.h Tue Mar 12 13:42:47 2013 (r248207) +++ user/attilio/vmobj-readlock/sys/vm/vm_page.h Tue Mar 12 13:46:30 2013 (r248208) @@ -143,7 +143,7 @@ struct vm_page { uint8_t aflags; /* access is atomic */ uint8_t oflags; /* page VPO_* flags (O) */ uint16_t flags; /* page PG_* flags (P) */ - u_char act_count; /* page usage count (O) */ + u_char act_count; /* page usage count (P) */ u_char busy; /* page busy count (O) */ /* NOTE that these must support one bit per DEV_BSIZE in a page!!! */ /* so, on normal X86 kernels, they must be at least 8 bits wide */ Modified: user/attilio/vmobj-readlock/sys/vm/vm_pageout.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_pageout.c Tue Mar 12 13:42:47 2013 (r248207) +++ user/attilio/vmobj-readlock/sys/vm/vm_pageout.c Tue Mar 12 13:46:30 2013 (r248208) @@ -1015,9 +1015,9 @@ vm_pageout_scan(int pass) } else if ((m->aflags & PGA_REFERENCED) == 0 && (actcount = pmap_ts_referenced(m)) != 0) { vm_page_activate(m); - vm_page_unlock(m); - m->act_count += actcount + ACT_ADVANCE; VM_OBJECT_WUNLOCK(object); + m->act_count += actcount + ACT_ADVANCE; + vm_page_unlock(m); goto relock_queues; } @@ -1031,9 +1031,9 @@ vm_pageout_scan(int pass) vm_page_aflag_clear(m, PGA_REFERENCED); actcount = pmap_ts_referenced(m); vm_page_activate(m); - vm_page_unlock(m); - m->act_count += actcount + ACT_ADVANCE + 1; VM_OBJECT_WUNLOCK(object); + m->act_count += actcount + ACT_ADVANCE + 1; + vm_page_unlock(m); goto relock_queues; } From owner-svn-src-user@FreeBSD.ORG Tue Mar 12 16:26:07 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2F36186B; Tue, 12 Mar 2013 16:26:07 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp1.rice.edu (proofpoint1.mail.rice.edu [128.42.201.100]) by mx1.freebsd.org (Postfix) with ESMTP id E2C6DA7B; Tue, 12 Mar 2013 16:26:06 +0000 (UTC) Received: from pps.filterd (pp1.rice.edu [127.0.0.1]) by pp1.rice.edu (8.14.5/8.14.5) with SMTP id r2C9dG8d006279; Tue, 12 Mar 2013 11:26:04 -0500 Received: from mh11.mail.rice.edu (mh11.mail.rice.edu [128.42.199.30]) by pp1.rice.edu with ESMTP id 1ayt5chj1b-1; Tue, 12 Mar 2013 11:26:04 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh11.mail.rice.edu, auth channel Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh11.mail.rice.edu (Postfix) with ESMTPSA id 49BCB4C01D0; Tue, 12 Mar 2013 11:26:04 -0500 (CDT) Message-ID: <513F571A.5070007@rice.edu> Date: Tue, 12 Mar 2013 11:26:02 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130127 Thunderbird/17.0.2 MIME-Version: 1.0 To: attilio@FreeBSD.org Subject: Re: svn commit: r248185 - user/attilio/vmcontention/sys/vm References: <201303120614.r2C6EWve058965@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5400 definitions=5800 signatures=585085 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=57 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1111160001 definitions=main-1101130121 Cc: Alan Cox , src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 16:26:07 -0000 On 03/12/2013 07:04, Attilio Rao wrote: > On Tue, Mar 12, 2013 at 7:14 AM, Alan Cox wrote: >> Author: alc >> Date: Tue Mar 12 06:14:31 2013 >> New Revision: 248185 >> URL: http://svnweb.freebsd.org/changeset/base/248185 >> >> Log: >> When transferring the page from one object to another, don't insert the >> page into its new object until the page's pindex has been updated. >> Otherwise, one code path within vm_radix_insert() may use the wrong >> pindex value. > This is just a style change really because the code already subtracts > offindxstart from current m->pindex when inserting. The pindex on the > page is then adjusted when the real subtraction happens. > IIRC, I did this way because of less diffs against -CURRENT, but the > code looks correct to me already in the older version. > No, as I say in the commit message, there is a path in vm_radix_insert() that uses "page->pindex" and not the "index" argument: /* * A new node is needed because the right insertion level is reached. * Setup the new intermediate node and add the 2 children: the * new object and the older edge. */ tmp2 = vm_radix_node_get(vm_radix_trimkey(page->pindex, clev - 1), 2, clev); Prior to this change, if we follow this path, then we are using the wrong "pindex" value at this point in vm_radix_insert(). From owner-svn-src-user@FreeBSD.ORG Tue Mar 12 16:34:56 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DD0E9DC5; Tue, 12 Mar 2013 16:34:56 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-ie0-x22f.google.com (mail-ie0-x22f.google.com [IPv6:2607:f8b0:4001:c03::22f]) by mx1.freebsd.org (Postfix) with ESMTP id 945C3B6D; Tue, 12 Mar 2013 16:34:56 +0000 (UTC) Received: by mail-ie0-f175.google.com with SMTP id c12so46341ieb.20 for ; Tue, 12 Mar 2013 09:34:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=zzQhZjcXP2954E7EAyOUD6SIiJDZX9w4ocykuiB2l14=; b=vhCD8rbxteIfnd3/3i28b4XbSCz8+CDNO6JKU0aHajTJwGUk6pQ0E3vYyfzgzOJL44 2EUhNfZVR1EyMUd64+4XnvDxVl38TBaTUhfi5P4+s9dTmB2E4SKM0jk+oE3qZkHPLlJB qAeuguyi9G/eqrRX4S/hFLQY+ySGXXUK0j/3/yzNvQ/vnXnKZLEaT4Ye4SoJflT1+fuD CS1Sd+cSfAexTrvVcyv04ikBOyngzJbBftRZwMuOZrrT3X5J+55ugdxCDIhH++YEj/bl eIDG0CE4JW+gdIiZqJ7NLavV7U50sNqr6MzkybMq1Mnv6qswYR37Z9FLLiO7GO04Nr7t 5Xqg== MIME-Version: 1.0 X-Received: by 10.50.203.3 with SMTP id km3mr12633239igc.64.1363106096222; Tue, 12 Mar 2013 09:34:56 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.42.117.134 with HTTP; Tue, 12 Mar 2013 09:34:56 -0700 (PDT) In-Reply-To: <513F571A.5070007@rice.edu> References: <201303120614.r2C6EWve058965@svn.freebsd.org> <513F571A.5070007@rice.edu> Date: Tue, 12 Mar 2013 17:34:56 +0100 X-Google-Sender-Auth: TLatl20kxCc7ieNlLYBJBrPsSVw Message-ID: Subject: Re: svn commit: r248185 - user/attilio/vmcontention/sys/vm From: Attilio Rao To: Alan Cox Content-Type: text/plain; charset=UTF-8 Cc: Alan Cox , src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Mar 2013 16:34:56 -0000 On Tue, Mar 12, 2013 at 5:26 PM, Alan Cox wrote: > On 03/12/2013 07:04, Attilio Rao wrote: >> On Tue, Mar 12, 2013 at 7:14 AM, Alan Cox wrote: >>> Author: alc >>> Date: Tue Mar 12 06:14:31 2013 >>> New Revision: 248185 >>> URL: http://svnweb.freebsd.org/changeset/base/248185 >>> >>> Log: >>> When transferring the page from one object to another, don't insert the >>> page into its new object until the page's pindex has been updated. >>> Otherwise, one code path within vm_radix_insert() may use the wrong >>> pindex value. >> This is just a style change really because the code already subtracts >> offindxstart from current m->pindex when inserting. The pindex on the >> page is then adjusted when the real subtraction happens. >> IIRC, I did this way because of less diffs against -CURRENT, but the >> code looks correct to me already in the older version. >> > > No, as I say in the commit message, there is a path in vm_radix_insert() > that uses "page->pindex" and not the "index" argument: > > /* > * A new node is needed because the right insertion level is > reached. > * Setup the new intermediate node and add the 2 children: the > * new object and the older edge. > */ > tmp2 = vm_radix_node_get(vm_radix_trimkey(page->pindex, clev - > 1), 2, > clev); > > Prior to this change, if we follow this path, then we are using the > wrong "pindex" value at this point in vm_radix_insert(). My bad, that should use "index" as it was supposed to be, not the page one. I likely added it as a cleanup after having reworked all the other functions, introducing the bug. It is courious it never showed up. I'd rather fix vm_radix_insert() to not consider the page index. This is a step forward anyway in generalizing the code. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-user@FreeBSD.ORG Wed Mar 13 00:41:37 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B779F218; Wed, 13 Mar 2013 00:41:37 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A01733E6; Wed, 13 Mar 2013 00:41:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2D0fbJL098107; Wed, 13 Mar 2013 00:41:37 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2D0fbxe098106; Wed, 13 Mar 2013 00:41:37 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303130041.r2D0fbxe098106@svn.freebsd.org> From: Attilio Rao Date: Wed, 13 Mar 2013 00:41:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248221 - user/attilio/vmcontention/sys/vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2013 00:41:37 -0000 Author: attilio Date: Wed Mar 13 00:41:37 2013 New Revision: 248221 URL: http://svnweb.freebsd.org/changeset/base/248221 Log: For uniformity, use the user provided index. Sponsored by: EMC / Isilon storage division Reviewed and reported by: alc Modified: user/attilio/vmcontention/sys/vm/vm_radix.c Modified: user/attilio/vmcontention/sys/vm/vm_radix.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_radix.c Tue Mar 12 23:14:18 2013 (r248220) +++ user/attilio/vmcontention/sys/vm/vm_radix.c Wed Mar 13 00:41:37 2013 (r248221) @@ -442,7 +442,7 @@ vm_radix_insert(struct vm_radix *rtree, * Setup the new intermediate node and add the 2 children: the * new object and the older edge. */ - tmp2 = vm_radix_node_get(vm_radix_trimkey(page->pindex, clev - 1), 2, + tmp2 = vm_radix_node_get(vm_radix_trimkey(index, clev - 1), 2, clev); rnode->rn_child[slot] = tmp2; vm_radix_addpage(tmp2, index, clev, page); From owner-svn-src-user@FreeBSD.ORG Wed Mar 13 01:00:35 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3379C6CC; Wed, 13 Mar 2013 01:00:35 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0EFD067F; Wed, 13 Mar 2013 01:00:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2D10YkH002546; Wed, 13 Mar 2013 01:00:34 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2D10YnF002545; Wed, 13 Mar 2013 01:00:34 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303130100.r2D10YnF002545@svn.freebsd.org> From: Attilio Rao Date: Wed, 13 Mar 2013 01:00:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248222 - user/attilio/vmcontention/sys/vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2013 01:00:35 -0000 Author: attilio Date: Wed Mar 13 01:00:34 2013 New Revision: 248222 URL: http://svnweb.freebsd.org/changeset/base/248222 Log: Add a further safety belt to prevent inconsistencies. Sponsored by: EMC / Isilon storage division Submitted by: alc Modified: user/attilio/vmcontention/sys/vm/vm_radix.c Modified: user/attilio/vmcontention/sys/vm/vm_radix.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_radix.c Wed Mar 13 00:41:37 2013 (r248221) +++ user/attilio/vmcontention/sys/vm/vm_radix.c Wed Mar 13 01:00:34 2013 (r248222) @@ -375,6 +375,8 @@ vm_radix_insert(struct vm_radix *rtree, int slot; uint16_t clev; + KASSERT(index == page->index, ("%s: index != page->index", __func__)); + /* * The owner of record for root is not really important because it * will never be used. From owner-svn-src-user@FreeBSD.ORG Wed Mar 13 01:02:12 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 045F87F2; Wed, 13 Mar 2013 01:02:12 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EBC2068B; Wed, 13 Mar 2013 01:02:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2D12BQs004433; Wed, 13 Mar 2013 01:02:11 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2D12BG9004432; Wed, 13 Mar 2013 01:02:11 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303130102.r2D12BG9004432@svn.freebsd.org> From: Attilio Rao Date: Wed, 13 Mar 2013 01:02:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248223 - user/attilio/vmcontention/sys/vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2013 01:02:12 -0000 Author: attilio Date: Wed Mar 13 01:02:11 2013 New Revision: 248223 URL: http://svnweb.freebsd.org/changeset/base/248223 Log: Use the _KERNEL protectors. Sponsored by: EMC / Isilon storage division Requested by: alc Modified: user/attilio/vmcontention/sys/vm/_vm_radix.h Modified: user/attilio/vmcontention/sys/vm/_vm_radix.h ============================================================================== --- user/attilio/vmcontention/sys/vm/_vm_radix.h Wed Mar 13 01:00:34 2013 (r248222) +++ user/attilio/vmcontention/sys/vm/_vm_radix.h Wed Mar 13 01:02:11 2013 (r248223) @@ -37,6 +37,8 @@ struct vm_radix { uintptr_t rt_root; }; +#ifdef _KERNEL + static __inline boolean_t vm_radix_is_empty(struct vm_radix *rtree) { @@ -44,4 +46,5 @@ vm_radix_is_empty(struct vm_radix *rtree return (rtree->rt_root == 0); } +#endif /* _KERNEL */ #endif /* !__VM_RADIX_H_ */ From owner-svn-src-user@FreeBSD.ORG Wed Mar 13 01:05:45 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D6A9C92B; Wed, 13 Mar 2013 01:05:45 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AA90769F; Wed, 13 Mar 2013 01:05:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2D15jLh005104; Wed, 13 Mar 2013 01:05:45 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2D15grE005085; Wed, 13 Mar 2013 01:05:42 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303130105.r2D15grE005085@svn.freebsd.org> From: Attilio Rao Date: Wed, 13 Mar 2013 01:05:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248224 - in user/attilio/vmcontention: games/fortune/datfiles share/misc sys sys/arm/at91 sys/kern sys/net sys/netinet/libalias sys/netpfil/pf sys/nfs sys/nfsclient sys/sys usr.bin/gre... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2013 01:05:45 -0000 Author: attilio Date: Wed Mar 13 01:05:42 2013 New Revision: 248224 URL: http://svnweb.freebsd.org/changeset/base/248224 Log: MFC Deleted: user/attilio/vmcontention/games/fortune/datfiles/fortunes-o.fake user/attilio/vmcontention/games/fortune/datfiles/fortunes-o.real user/attilio/vmcontention/games/fortune/datfiles/fortunes-o.sp.ok Modified: user/attilio/vmcontention/games/fortune/datfiles/Makefile user/attilio/vmcontention/share/misc/committers-ports.dot user/attilio/vmcontention/share/misc/organization.dot user/attilio/vmcontention/sys/Makefile user/attilio/vmcontention/sys/arm/at91/if_ate.c user/attilio/vmcontention/sys/kern/uipc_mbuf.c user/attilio/vmcontention/sys/net/bpf.c user/attilio/vmcontention/sys/netinet/libalias/alias.c user/attilio/vmcontention/sys/netpfil/pf/if_pfsync.c user/attilio/vmcontention/sys/nfs/krpc_subr.c user/attilio/vmcontention/sys/nfsclient/nfs_vfsops.c user/attilio/vmcontention/sys/nfsclient/nfs_vnops.c user/attilio/vmcontention/sys/sys/mbuf.h user/attilio/vmcontention/sys/sys/param.h user/attilio/vmcontention/usr.bin/grep/regex/tre-fastmatch.c Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/sys/ (props changed) Modified: user/attilio/vmcontention/games/fortune/datfiles/Makefile ============================================================================== --- user/attilio/vmcontention/games/fortune/datfiles/Makefile Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/games/fortune/datfiles/Makefile Wed Mar 13 01:05:42 2013 (r248224) @@ -1,37 +1,22 @@ # @(#)Makefile 8.2 (Berkeley) 4/19/94 # $FreeBSD$ -FILES= fortunes freebsd-tips murphy startrek zippy -BLDS= fortunes.dat murphy.dat startrek.dat zippy.dat \ - fortunes-o fortunes-o.dat freebsd-tips.dat +DB= fortunes freebsd-tips murphy startrek zippy # TO AVOID INSTALLING THE POTENTIALLY OFFENSIVE FORTUNES, COMMENT OUT THE -# THREE LINES AND UNCOMMENT THE FOURTH LINE. +# NEXT LINE. +DB+= limerick murphy-o gerrold.limerick -# THE THREE LINES: -FILES+= limerick murphy-o gerrold.limerick -BLDS+= limerick.dat murphy-o.dat gerrold.limerick.dat -TYPE= real - -# THE FOURTH LINE: -#TYPE= fake - -FILES+= ${BLDS} +BLDS= ${DB:S/$/.dat/} +FILES= ${DB} ${BLDS} CLEANFILES+=${BLDS} FILESDIR= ${SHAREDIR}/games/fortune -.for f in fortunes freebsd-tips gerrold.limerick limerick murphy murphy-o startrek zippy +.for f in ${DB} $f.dat: $f PATH=$$PATH:/usr/games:${.OBJDIR}/../strfile \ strfile -Cs ${.ALLSRC} ${.TARGET} .endfor -fortunes-o.dat: fortunes-o - PATH=$$PATH:/usr/games:${.OBJDIR}/../strfile \ - strfile -Csx ${.ALLSRC} ${.TARGET} - -fortunes-o: fortunes-o.${TYPE} - LC_ALL=C tr a-zA-Z n-za-mN-ZA-M < ${.ALLSRC} > ${.TARGET} - .include Modified: user/attilio/vmcontention/share/misc/committers-ports.dot ============================================================================== --- user/attilio/vmcontention/share/misc/committers-ports.dot Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/share/misc/committers-ports.dot Wed Mar 13 01:05:42 2013 (r248224) @@ -171,7 +171,7 @@ philip [label="Philip Paeps\nphilip@Free rafan [label="Rong-En Fan\nrafan@FreeBSD.org\n2006/06/23"] rakuco [label="Raphael Kubo da Costa\nrakuco@FreeBSD.org\n2011/08/22"] rene [label="Rene Ladan\nrene@FreeBSD.org\n2010/04/11"] -rm [label="Ruslan Mahmatkhanov\nrm@FreeBSD.org\n2011/11/06"] +rm [label="Ruslan Makhmatkhanov\nrm@FreeBSD.org\n2011/11/06"] rnoland [label="Robert Noland\nrnoland@FreeBSD.org\n2008/07/21"] romain [label="Romain Tartiere\nromain@FreeBSD.org\n2010/01/24"] sahil [label="Sahil Tandon\nsahil@FreeBSD.org\n2010/04/11"] Modified: user/attilio/vmcontention/share/misc/organization.dot ============================================================================== --- user/attilio/vmcontention/share/misc/organization.dot Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/share/misc/organization.dot Wed Mar 13 01:05:42 2013 (r248224) @@ -30,7 +30,7 @@ coresecretary [label="Core Team Secretar doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"] doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\ngjb, blackend,\ngabor, hrs"] portscommitters [label="Ports Committers\nports-committers@FreeBSD.org"] -portmgr [label="Port Management Team\nportmgr@FreeBSD.org\ntabthorpe, marcus, bapt, \nerwin, pav,\nitetcu, miwi"] +portmgr [label="Port Management Team\nportmgr@FreeBSD.org\ntabthorpe, marcus, bapt,\nerwin, bdrewery,\nitetcu, miwi"] portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\ntabthorpe"] re [label="Primary Release Engineering Team\nre@FreeBSD.org\nkib, blackend, jpaetzel, hrs, kensmith"] secteam [label="Security Team\nsecteam@FreeBSD.org\nsimon, qingli, delphij,\nremko, philip, stas, cperciva,\ncsjp, rwatson, miwi, bz"] Modified: user/attilio/vmcontention/sys/Makefile ============================================================================== --- user/attilio/vmcontention/sys/Makefile Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/sys/Makefile Wed Mar 13 01:05:42 2013 (r248224) @@ -10,7 +10,7 @@ SUBDIR= boot # Directories to include in cscope name file and TAGS. CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \ geom gnu isa kern libkern modules net net80211 netatalk \ - netgraph netinet netinet6 netipsec netipx netnatm netncp \ + netgraph netinet netinet6 netipsec netipx netnatm \ netsmb nfs nfsclient nfsserver nlm ofed opencrypto \ pci rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR} .if !defined(CSCOPE_ARCHDIR) Modified: user/attilio/vmcontention/sys/arm/at91/if_ate.c ============================================================================== --- user/attilio/vmcontention/sys/arm/at91/if_ate.c Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/sys/arm/at91/if_ate.c Wed Mar 13 01:05:42 2013 (r248224) @@ -900,8 +900,8 @@ ate_intr(void *xsc) remain = (sc->rx_descs[idx].status & ETH_LEN_MASK) - 4; /* Get an appropriately sized mbuf. */ - mb = m_get2(M_NOWAIT, MT_DATA, M_PKTHDR, - remain + ETHER_ALIGN); + mb = m_get2(remain + ETHER_ALIGN, M_NOWAIT, MT_DATA, + M_PKTHDR); if (mb == NULL) { sc->ifp->if_iqdrops++; rxdhead->status = 0; Modified: user/attilio/vmcontention/sys/kern/uipc_mbuf.c ============================================================================== --- user/attilio/vmcontention/sys/kern/uipc_mbuf.c Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/sys/kern/uipc_mbuf.c Wed Mar 13 01:05:42 2013 (r248224) @@ -88,7 +88,7 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, m_defrag * m_get2() allocates minimum mbuf that would fit "size" argument. */ struct mbuf * -m_get2(int how, short type, int flags, int size) +m_get2(int size, int how, short type, int flags) { struct mb_args args; struct mbuf *m, *n; Modified: user/attilio/vmcontention/sys/net/bpf.c ============================================================================== --- user/attilio/vmcontention/sys/net/bpf.c Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/sys/net/bpf.c Wed Mar 13 01:05:42 2013 (r248224) @@ -525,7 +525,7 @@ bpf_movein(struct uio *uio, int linktype if (len < hlen || len - hlen > ifp->if_mtu) return (EMSGSIZE); - m = m_get2(M_WAITOK, MT_DATA, M_PKTHDR, len); + m = m_get2(len, M_WAITOK, MT_DATA, M_PKTHDR); if (m == NULL) return (EIO); m->m_pkthdr.len = m->m_len = len; Modified: user/attilio/vmcontention/sys/netinet/libalias/alias.c ============================================================================== --- user/attilio/vmcontention/sys/netinet/libalias/alias.c Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/sys/netinet/libalias/alias.c Wed Mar 13 01:05:42 2013 (r248224) @@ -1760,7 +1760,7 @@ m_megapullup(struct mbuf *m, int len) { if (m->m_next == NULL && M_WRITABLE(m) && M_TRAILINGSPACE(m) >= RESERVE) return (m); - mcl = m_get2(M_NOWAIT, MT_DATA, M_PKTHDR, len + RESERVE); + mcl = m_get2(len + RESERVE, M_NOWAIT, MT_DATA, M_PKTHDR); if (mcl == NULL) goto bad; Modified: user/attilio/vmcontention/sys/netpfil/pf/if_pfsync.c ============================================================================== --- user/attilio/vmcontention/sys/netpfil/pf/if_pfsync.c Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/sys/netpfil/pf/if_pfsync.c Wed Mar 13 01:05:42 2013 (r248224) @@ -1505,7 +1505,7 @@ pfsync_sendout(int schedswi) return; } - m = m_get2(M_NOWAIT, MT_DATA, M_PKTHDR, max_linkhdr + sc->sc_len); + m = m_get2(max_linkhdr + sc->sc_len, M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { sc->sc_ifp->if_oerrors++; V_pfsyncstats.pfsyncs_onomem++; Modified: user/attilio/vmcontention/sys/nfs/krpc_subr.c ============================================================================== --- user/attilio/vmcontention/sys/nfs/krpc_subr.c Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/sys/nfs/krpc_subr.c Wed Mar 13 01:05:42 2013 (r248224) @@ -459,7 +459,7 @@ xdr_string_encode(char *str, int len) if (mlen > MCLBYTES) /* If too big, we just can't do it. */ return (NULL); - m = m_get2(M_WAITOK, MT_DATA, 0, mlen); + m = m_get2(mlen, M_WAITOK, MT_DATA, 0); xs = mtod(m, struct xdr_string *); m->m_len = mlen; xs->len = txdr_unsigned(len); Modified: user/attilio/vmcontention/sys/nfsclient/nfs_vfsops.c ============================================================================== --- user/attilio/vmcontention/sys/nfsclient/nfs_vfsops.c Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/sys/nfsclient/nfs_vfsops.c Wed Mar 13 01:05:42 2013 (r248224) @@ -298,7 +298,7 @@ nfs_statfs(struct mount *mp, struct stat } else mtx_unlock(&nmp->nm_mtx); nfsstats.rpccnt[NFSPROC_FSSTAT]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3)); + mreq = m_get2(NFSX_FH(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -356,7 +356,7 @@ nfs_fsinfo(struct nfsmount *nmp, struct u_int64_t maxfsize; nfsstats.rpccnt[NFSPROC_FSINFO]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(1)); + mreq = m_get2(NFSX_FH(1), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, 1); Modified: user/attilio/vmcontention/sys/nfsclient/nfs_vnops.c ============================================================================== --- user/attilio/vmcontention/sys/nfsclient/nfs_vnops.c Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/sys/nfsclient/nfs_vnops.c Wed Mar 13 01:05:42 2013 (r248224) @@ -294,7 +294,7 @@ nfs3_access_otw(struct vnode *vp, int wm struct nfsnode *np = VTONFS(vp); nfsstats.rpccnt[NFSPROC_ACCESS]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + NFSX_UNSIGNED); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED, M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -714,7 +714,7 @@ nfs_getattr(struct vop_getattr_args *ap) goto nfsmout; } nfsstats.rpccnt[NFSPROC_GETATTR]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3)); + mreq = m_get2(NFSX_FH(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -873,7 +873,7 @@ nfs_setattrrpc(struct vnode *vp, struct int v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_SETATTR]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + NFSX_SATTR(v3)); + mreq = m_get2(NFSX_FH(v3) + NFSX_SATTR(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1037,8 +1037,8 @@ nfs_lookup(struct vop_lookup_args *ap) nfsstats.lookupcache_misses++; nfsstats.rpccnt[NFSPROC_LOOKUP]++; len = cnp->cn_namelen; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len), M_WAITOK, + MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1251,7 +1251,7 @@ nfs_readlinkrpc(struct vnode *vp, struct int v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_READLINK]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3)); + mreq = m_get2(NFSX_FH(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1306,8 +1306,8 @@ nfs_readrpc(struct vnode *vp, struct uio while (tsiz > 0) { nfsstats.rpccnt[NFSPROC_READ]++; len = (tsiz > rsize) ? rsize : tsiz; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_UNSIGNED * 3); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED * 3, M_WAITOK, + MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1379,8 +1379,8 @@ nfs_writerpc(struct vnode *vp, struct ui while (tsiz > 0) { nfsstats.rpccnt[NFSPROC_WRITE]++; len = (tsiz > wsize) ? wsize : tsiz; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + 5 * NFSX_UNSIGNED + nfsm_rndup(len)); + mreq = m_get2(NFSX_FH(v3) + 5 * NFSX_UNSIGNED + nfsm_rndup(len), + M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1502,8 +1502,8 @@ nfs_mknodrpc(struct vnode *dvp, struct v if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)) != 0) return (error); nfsstats.rpccnt[NFSPROC_MKNOD]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 4 * NFSX_UNSIGNED + - nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); + mreq = m_get2(NFSX_FH(v3) + 4 * NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1606,8 +1606,8 @@ nfs_create(struct vop_create_args *ap) fmode |= O_EXCL; again: nfsstats.rpccnt[NFSPROC_CREATE]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 2 * NFSX_UNSIGNED + - nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); + mreq = m_get2(NFSX_FH(v3) + 2 * NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1788,8 +1788,8 @@ nfs_removerpc(struct vnode *dvp, const c int v3 = NFS_ISV3(dvp); nfsstats.rpccnt[NFSPROC_REMOVE]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(namelen)); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(namelen), + M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1924,8 +1924,8 @@ nfs_renamerpc(struct vnode *fdvp, const int v3 = NFS_ISV3(fdvp); nfsstats.rpccnt[NFSPROC_RENAME]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, (NFSX_FH(v3) + NFSX_UNSIGNED)*2 + - nfsm_rndup(fnamelen) + nfsm_rndup(tnamelen)); + mreq = m_get2((NFSX_FH(v3) + NFSX_UNSIGNED)*2 + nfsm_rndup(fnamelen) + + nfsm_rndup(tnamelen), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(fdvp, v3); @@ -1983,8 +1983,8 @@ nfs_link(struct vop_link_args *ap) v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_LINK]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3)*2 + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); + mreq = m_get2(NFSX_FH(v3)*2 + NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -2029,8 +2029,9 @@ nfs_symlink(struct vop_symlink_args *ap) nfsstats.rpccnt[NFSPROC_SYMLINK]++; slen = strlen(ap->a_target); - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 2*NFSX_UNSIGNED + - nfsm_rndup(cnp->cn_namelen) + nfsm_rndup(slen) + NFSX_SATTR(v3)); + mreq = m_get2(NFSX_FH(v3) + 2*NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen) + nfsm_rndup(slen) + NFSX_SATTR(v3), + M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2123,8 +2124,8 @@ nfs_mkdir(struct vop_mkdir_args *ap) return (error); len = cnp->cn_namelen; nfsstats.rpccnt[NFSPROC_MKDIR]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len) + NFSX_SATTR(v3)); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len) + + NFSX_SATTR(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2188,8 +2189,8 @@ nfs_rmdir(struct vop_rmdir_args *ap) if (dvp == vp) return (EINVAL); nfsstats.rpccnt[NFSPROC_RMDIR]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2307,8 +2308,8 @@ nfs_readdirrpc(struct vnode *vp, struct */ while (more_dirs && bigenough) { nfsstats.rpccnt[NFSPROC_READDIR]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_READDIR(v3)); + mreq = m_get2(NFSX_FH(v3) + NFSX_READDIR(v3), M_WAITOK, + MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -2513,8 +2514,8 @@ nfs_readdirplusrpc(struct vnode *vp, str */ while (more_dirs && bigenough) { nfsstats.rpccnt[NFSPROC_READDIRPLUS]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(1) + 6 * NFSX_UNSIGNED); + mreq = m_get2(NFSX_FH(1) + 6 * NFSX_UNSIGNED, M_WAITOK, + MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, 1); @@ -2818,8 +2819,8 @@ nfs_lookitup(struct vnode *dvp, const ch int v3 = NFS_ISV3(dvp); nfsstats.rpccnt[NFSPROC_LOOKUP]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len), + M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2897,7 +2898,7 @@ nfs_commit(struct vnode *vp, u_quad_t of } mtx_unlock(&nmp->nm_mtx); nfsstats.rpccnt[NFSPROC_COMMIT]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(1)); + mreq = m_get2(NFSX_FH(1), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, 1); Modified: user/attilio/vmcontention/sys/sys/mbuf.h ============================================================================== --- user/attilio/vmcontention/sys/sys/mbuf.h Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/sys/sys/mbuf.h Wed Mar 13 01:05:42 2013 (r248224) @@ -801,7 +801,7 @@ int m_dup_pkthdr(struct mbuf *, struct u_int m_fixhdr(struct mbuf *); struct mbuf *m_fragment(struct mbuf *, int, int); void m_freem(struct mbuf *); -struct mbuf *m_get2(int, short, int, int); +struct mbuf *m_get2(int, int, short, int); struct mbuf *m_getjcl(int, short, int, int); struct mbuf *m_getm2(struct mbuf *, int, int, short, int); struct mbuf *m_getptr(struct mbuf *, int, int *); Modified: user/attilio/vmcontention/sys/sys/param.h ============================================================================== --- user/attilio/vmcontention/sys/sys/param.h Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/sys/sys/param.h Wed Mar 13 01:05:42 2013 (r248224) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000029 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000030 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: user/attilio/vmcontention/usr.bin/grep/regex/tre-fastmatch.c ============================================================================== --- user/attilio/vmcontention/usr.bin/grep/regex/tre-fastmatch.c Wed Mar 13 01:02:11 2013 (r248223) +++ user/attilio/vmcontention/usr.bin/grep/regex/tre-fastmatch.c Wed Mar 13 01:05:42 2013 (r248224) @@ -103,7 +103,7 @@ static int fastcmp(const fastmatch_t *fg ((!fg->reversed \ ? ((type == STR_WIDE) ? ((j + fg->wlen) > len) \ : ((j + fg->len) > len)) \ - : (j <= 0))) + : (j < 0))) /* * Checks whether the new position after shifting in the input string From owner-svn-src-user@FreeBSD.ORG Wed Mar 13 01:38:33 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7F76818B; Wed, 13 Mar 2013 01:38:33 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6DBC77ED; Wed, 13 Mar 2013 01:38:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2D1cXhU014485; Wed, 13 Mar 2013 01:38:33 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2D1cXsC014484; Wed, 13 Mar 2013 01:38:33 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303130138.r2D1cXsC014484@svn.freebsd.org> From: Attilio Rao Date: Wed, 13 Mar 2013 01:38:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248225 - user/attilio/vmcontention/sys/vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2013 01:38:33 -0000 Author: attilio Date: Wed Mar 13 01:38:32 2013 New Revision: 248225 URL: http://svnweb.freebsd.org/changeset/base/248225 Log: Fix compilation. Sponsored by: EMC / Isilon storage division Modified: user/attilio/vmcontention/sys/vm/vm_radix.c Modified: user/attilio/vmcontention/sys/vm/vm_radix.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_radix.c Wed Mar 13 01:05:42 2013 (r248224) +++ user/attilio/vmcontention/sys/vm/vm_radix.c Wed Mar 13 01:38:32 2013 (r248225) @@ -375,7 +375,8 @@ vm_radix_insert(struct vm_radix *rtree, int slot; uint16_t clev; - KASSERT(index == page->index, ("%s: index != page->index", __func__)); + KASSERT(index == page->pindex, ("%s: index != page->pindex", + __func__)); /* * The owner of record for root is not really important because it From owner-svn-src-user@FreeBSD.ORG Wed Mar 13 03:25:05 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 35CEED80; Wed, 13 Mar 2013 03:25:05 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0FB64D31; Wed, 13 Mar 2013 03:25:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2D3P4qh049135; Wed, 13 Mar 2013 03:25:04 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2D3P49D049132; Wed, 13 Mar 2013 03:25:04 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303130325.r2D3P49D049132@svn.freebsd.org> From: Attilio Rao Date: Wed, 13 Mar 2013 03:25:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248228 - in user/attilio/vmcontention/sys/dev: bge re X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2013 03:25:05 -0000 Author: attilio Date: Wed Mar 13 03:25:04 2013 New Revision: 248228 URL: http://svnweb.freebsd.org/changeset/base/248228 Log: MFC Modified: user/attilio/vmcontention/sys/dev/bge/if_bge.c user/attilio/vmcontention/sys/dev/re/if_re.c Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/sys/ (props changed) Modified: user/attilio/vmcontention/sys/dev/bge/if_bge.c ============================================================================== --- user/attilio/vmcontention/sys/dev/bge/if_bge.c Wed Mar 13 02:11:45 2013 (r248227) +++ user/attilio/vmcontention/sys/dev/bge/if_bge.c Wed Mar 13 03:25:04 2013 (r248228) @@ -3594,15 +3594,15 @@ bge_attach(device_t dev) } bge_stop_fw(sc); - bge_sig_pre_reset(sc, BGE_RESET_START); + bge_sig_pre_reset(sc, BGE_RESET_SHUTDOWN); if (bge_reset(sc)) { device_printf(sc->bge_dev, "chip reset failed\n"); error = ENXIO; goto fail; } - bge_sig_legacy(sc, BGE_RESET_START); - bge_sig_post_reset(sc, BGE_RESET_START); + bge_sig_legacy(sc, BGE_RESET_SHUTDOWN); + bge_sig_post_reset(sc, BGE_RESET_SHUTDOWN); if (bge_chipinit(sc)) { device_printf(sc->bge_dev, "chip initialization failed\n"); @@ -3960,6 +3960,20 @@ bge_reset(struct bge_softc *sc) } else write_op = bge_writereg_ind; + if (sc->bge_asicrev != BGE_ASICREV_BCM5700 && + sc->bge_asicrev != BGE_ASICREV_BCM5701) { + CSR_WRITE_4(sc, BGE_NVRAM_SWARB, BGE_NVRAMSWARB_SET1); + for (i = 0; i < 8000; i++) { + if (CSR_READ_4(sc, BGE_NVRAM_SWARB) & + BGE_NVRAMSWARB_GNT1) + break; + DELAY(20); + } + if (i == 8000) { + if (bootverbose) + device_printf(dev, "NVRAM lock timedout!\n"); + } + } /* Take APE lock when performing reset. */ bge_ape_lock(sc, BGE_APE_LOCK_GRC); Modified: user/attilio/vmcontention/sys/dev/re/if_re.c ============================================================================== --- user/attilio/vmcontention/sys/dev/re/if_re.c Wed Mar 13 02:11:45 2013 (r248227) +++ user/attilio/vmcontention/sys/dev/re/if_re.c Wed Mar 13 03:25:04 2013 (r248228) @@ -1587,7 +1587,8 @@ re_attach(device_t dev) * packet has IP options so disable TX IP checksum offloading. */ if (sc->rl_hwrev->rl_rev == RL_HWREV_8168C || - sc->rl_hwrev->rl_rev == RL_HWREV_8168C_SPIN2) + sc->rl_hwrev->rl_rev == RL_HWREV_8168C_SPIN2 || + sc->rl_hwrev->rl_rev == RL_HWREV_8168CP) ifp->if_hwassist = CSUM_TCP | CSUM_UDP; else ifp->if_hwassist = CSUM_IP | CSUM_TCP | CSUM_UDP; @@ -3419,7 +3420,8 @@ re_ioctl(struct ifnet *ifp, u_long comma if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) { rev = sc->rl_hwrev->rl_rev; if (rev == RL_HWREV_8168C || - rev == RL_HWREV_8168C_SPIN2) + rev == RL_HWREV_8168C_SPIN2 || + rev == RL_HWREV_8168CP) ifp->if_hwassist |= CSUM_TCP | CSUM_UDP; else ifp->if_hwassist |= RE_CSUM_FEATURES; From owner-svn-src-user@FreeBSD.ORG Wed Mar 13 03:27:36 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CFF56F29; Wed, 13 Mar 2013 03:27:36 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BB243D5B; Wed, 13 Mar 2013 03:27:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2D3RaDW049562; Wed, 13 Mar 2013 03:27:36 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2D3RXsl049540; Wed, 13 Mar 2013 03:27:33 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303130327.r2D3RXsl049540@svn.freebsd.org> From: Attilio Rao Date: Wed, 13 Mar 2013 03:27:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248229 - in user/attilio/vmobj-readlock: games/fortune/datfiles share/misc sys sys/arm/at91 sys/dev/bge sys/dev/re sys/kern sys/net sys/netinet/libalias sys/netpfil/pf sys/nfs sys/nfsc... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2013 03:27:36 -0000 Author: attilio Date: Wed Mar 13 03:27:32 2013 New Revision: 248229 URL: http://svnweb.freebsd.org/changeset/base/248229 Log: Merge from vmcontention. Deleted: user/attilio/vmobj-readlock/games/fortune/datfiles/fortunes-o.fake user/attilio/vmobj-readlock/games/fortune/datfiles/fortunes-o.real user/attilio/vmobj-readlock/games/fortune/datfiles/fortunes-o.sp.ok Modified: user/attilio/vmobj-readlock/games/fortune/datfiles/Makefile user/attilio/vmobj-readlock/share/misc/committers-ports.dot user/attilio/vmobj-readlock/share/misc/organization.dot user/attilio/vmobj-readlock/sys/Makefile user/attilio/vmobj-readlock/sys/arm/at91/if_ate.c user/attilio/vmobj-readlock/sys/dev/bge/if_bge.c user/attilio/vmobj-readlock/sys/dev/re/if_re.c user/attilio/vmobj-readlock/sys/kern/uipc_mbuf.c user/attilio/vmobj-readlock/sys/net/bpf.c user/attilio/vmobj-readlock/sys/netinet/libalias/alias.c user/attilio/vmobj-readlock/sys/netpfil/pf/if_pfsync.c user/attilio/vmobj-readlock/sys/nfs/krpc_subr.c user/attilio/vmobj-readlock/sys/nfsclient/nfs_vfsops.c user/attilio/vmobj-readlock/sys/nfsclient/nfs_vnops.c user/attilio/vmobj-readlock/sys/sys/mbuf.h user/attilio/vmobj-readlock/sys/sys/param.h user/attilio/vmobj-readlock/sys/vm/_vm_radix.h user/attilio/vmobj-readlock/sys/vm/vm_radix.c user/attilio/vmobj-readlock/usr.bin/grep/regex/tre-fastmatch.c Directory Properties: user/attilio/vmobj-readlock/ (props changed) user/attilio/vmobj-readlock/sys/ (props changed) Modified: user/attilio/vmobj-readlock/games/fortune/datfiles/Makefile ============================================================================== --- user/attilio/vmobj-readlock/games/fortune/datfiles/Makefile Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/games/fortune/datfiles/Makefile Wed Mar 13 03:27:32 2013 (r248229) @@ -1,37 +1,22 @@ # @(#)Makefile 8.2 (Berkeley) 4/19/94 # $FreeBSD$ -FILES= fortunes freebsd-tips murphy startrek zippy -BLDS= fortunes.dat murphy.dat startrek.dat zippy.dat \ - fortunes-o fortunes-o.dat freebsd-tips.dat +DB= fortunes freebsd-tips murphy startrek zippy # TO AVOID INSTALLING THE POTENTIALLY OFFENSIVE FORTUNES, COMMENT OUT THE -# THREE LINES AND UNCOMMENT THE FOURTH LINE. +# NEXT LINE. +DB+= limerick murphy-o gerrold.limerick -# THE THREE LINES: -FILES+= limerick murphy-o gerrold.limerick -BLDS+= limerick.dat murphy-o.dat gerrold.limerick.dat -TYPE= real - -# THE FOURTH LINE: -#TYPE= fake - -FILES+= ${BLDS} +BLDS= ${DB:S/$/.dat/} +FILES= ${DB} ${BLDS} CLEANFILES+=${BLDS} FILESDIR= ${SHAREDIR}/games/fortune -.for f in fortunes freebsd-tips gerrold.limerick limerick murphy murphy-o startrek zippy +.for f in ${DB} $f.dat: $f PATH=$$PATH:/usr/games:${.OBJDIR}/../strfile \ strfile -Cs ${.ALLSRC} ${.TARGET} .endfor -fortunes-o.dat: fortunes-o - PATH=$$PATH:/usr/games:${.OBJDIR}/../strfile \ - strfile -Csx ${.ALLSRC} ${.TARGET} - -fortunes-o: fortunes-o.${TYPE} - LC_ALL=C tr a-zA-Z n-za-mN-ZA-M < ${.ALLSRC} > ${.TARGET} - .include Modified: user/attilio/vmobj-readlock/share/misc/committers-ports.dot ============================================================================== --- user/attilio/vmobj-readlock/share/misc/committers-ports.dot Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/share/misc/committers-ports.dot Wed Mar 13 03:27:32 2013 (r248229) @@ -171,7 +171,7 @@ philip [label="Philip Paeps\nphilip@Free rafan [label="Rong-En Fan\nrafan@FreeBSD.org\n2006/06/23"] rakuco [label="Raphael Kubo da Costa\nrakuco@FreeBSD.org\n2011/08/22"] rene [label="Rene Ladan\nrene@FreeBSD.org\n2010/04/11"] -rm [label="Ruslan Mahmatkhanov\nrm@FreeBSD.org\n2011/11/06"] +rm [label="Ruslan Makhmatkhanov\nrm@FreeBSD.org\n2011/11/06"] rnoland [label="Robert Noland\nrnoland@FreeBSD.org\n2008/07/21"] romain [label="Romain Tartiere\nromain@FreeBSD.org\n2010/01/24"] sahil [label="Sahil Tandon\nsahil@FreeBSD.org\n2010/04/11"] Modified: user/attilio/vmobj-readlock/share/misc/organization.dot ============================================================================== --- user/attilio/vmobj-readlock/share/misc/organization.dot Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/share/misc/organization.dot Wed Mar 13 03:27:32 2013 (r248229) @@ -30,7 +30,7 @@ coresecretary [label="Core Team Secretar doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"] doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\ngjb, blackend,\ngabor, hrs"] portscommitters [label="Ports Committers\nports-committers@FreeBSD.org"] -portmgr [label="Port Management Team\nportmgr@FreeBSD.org\ntabthorpe, marcus, bapt, \nerwin, pav,\nitetcu, miwi"] +portmgr [label="Port Management Team\nportmgr@FreeBSD.org\ntabthorpe, marcus, bapt,\nerwin, bdrewery,\nitetcu, miwi"] portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\ntabthorpe"] re [label="Primary Release Engineering Team\nre@FreeBSD.org\nkib, blackend, jpaetzel, hrs, kensmith"] secteam [label="Security Team\nsecteam@FreeBSD.org\nsimon, qingli, delphij,\nremko, philip, stas, cperciva,\ncsjp, rwatson, miwi, bz"] Modified: user/attilio/vmobj-readlock/sys/Makefile ============================================================================== --- user/attilio/vmobj-readlock/sys/Makefile Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/Makefile Wed Mar 13 03:27:32 2013 (r248229) @@ -10,7 +10,7 @@ SUBDIR= boot # Directories to include in cscope name file and TAGS. CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \ geom gnu isa kern libkern modules net net80211 netatalk \ - netgraph netinet netinet6 netipsec netipx netnatm netncp \ + netgraph netinet netinet6 netipsec netipx netnatm \ netsmb nfs nfsclient nfsserver nlm ofed opencrypto \ pci rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR} .if !defined(CSCOPE_ARCHDIR) Modified: user/attilio/vmobj-readlock/sys/arm/at91/if_ate.c ============================================================================== --- user/attilio/vmobj-readlock/sys/arm/at91/if_ate.c Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/arm/at91/if_ate.c Wed Mar 13 03:27:32 2013 (r248229) @@ -900,8 +900,8 @@ ate_intr(void *xsc) remain = (sc->rx_descs[idx].status & ETH_LEN_MASK) - 4; /* Get an appropriately sized mbuf. */ - mb = m_get2(M_NOWAIT, MT_DATA, M_PKTHDR, - remain + ETHER_ALIGN); + mb = m_get2(remain + ETHER_ALIGN, M_NOWAIT, MT_DATA, + M_PKTHDR); if (mb == NULL) { sc->ifp->if_iqdrops++; rxdhead->status = 0; Modified: user/attilio/vmobj-readlock/sys/dev/bge/if_bge.c ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/bge/if_bge.c Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/dev/bge/if_bge.c Wed Mar 13 03:27:32 2013 (r248229) @@ -3594,15 +3594,15 @@ bge_attach(device_t dev) } bge_stop_fw(sc); - bge_sig_pre_reset(sc, BGE_RESET_START); + bge_sig_pre_reset(sc, BGE_RESET_SHUTDOWN); if (bge_reset(sc)) { device_printf(sc->bge_dev, "chip reset failed\n"); error = ENXIO; goto fail; } - bge_sig_legacy(sc, BGE_RESET_START); - bge_sig_post_reset(sc, BGE_RESET_START); + bge_sig_legacy(sc, BGE_RESET_SHUTDOWN); + bge_sig_post_reset(sc, BGE_RESET_SHUTDOWN); if (bge_chipinit(sc)) { device_printf(sc->bge_dev, "chip initialization failed\n"); @@ -3960,6 +3960,20 @@ bge_reset(struct bge_softc *sc) } else write_op = bge_writereg_ind; + if (sc->bge_asicrev != BGE_ASICREV_BCM5700 && + sc->bge_asicrev != BGE_ASICREV_BCM5701) { + CSR_WRITE_4(sc, BGE_NVRAM_SWARB, BGE_NVRAMSWARB_SET1); + for (i = 0; i < 8000; i++) { + if (CSR_READ_4(sc, BGE_NVRAM_SWARB) & + BGE_NVRAMSWARB_GNT1) + break; + DELAY(20); + } + if (i == 8000) { + if (bootverbose) + device_printf(dev, "NVRAM lock timedout!\n"); + } + } /* Take APE lock when performing reset. */ bge_ape_lock(sc, BGE_APE_LOCK_GRC); Modified: user/attilio/vmobj-readlock/sys/dev/re/if_re.c ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/re/if_re.c Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/dev/re/if_re.c Wed Mar 13 03:27:32 2013 (r248229) @@ -1587,7 +1587,8 @@ re_attach(device_t dev) * packet has IP options so disable TX IP checksum offloading. */ if (sc->rl_hwrev->rl_rev == RL_HWREV_8168C || - sc->rl_hwrev->rl_rev == RL_HWREV_8168C_SPIN2) + sc->rl_hwrev->rl_rev == RL_HWREV_8168C_SPIN2 || + sc->rl_hwrev->rl_rev == RL_HWREV_8168CP) ifp->if_hwassist = CSUM_TCP | CSUM_UDP; else ifp->if_hwassist = CSUM_IP | CSUM_TCP | CSUM_UDP; @@ -3419,7 +3420,8 @@ re_ioctl(struct ifnet *ifp, u_long comma if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) { rev = sc->rl_hwrev->rl_rev; if (rev == RL_HWREV_8168C || - rev == RL_HWREV_8168C_SPIN2) + rev == RL_HWREV_8168C_SPIN2 || + rev == RL_HWREV_8168CP) ifp->if_hwassist |= CSUM_TCP | CSUM_UDP; else ifp->if_hwassist |= RE_CSUM_FEATURES; Modified: user/attilio/vmobj-readlock/sys/kern/uipc_mbuf.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/uipc_mbuf.c Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/kern/uipc_mbuf.c Wed Mar 13 03:27:32 2013 (r248229) @@ -88,7 +88,7 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, m_defrag * m_get2() allocates minimum mbuf that would fit "size" argument. */ struct mbuf * -m_get2(int how, short type, int flags, int size) +m_get2(int size, int how, short type, int flags) { struct mb_args args; struct mbuf *m, *n; Modified: user/attilio/vmobj-readlock/sys/net/bpf.c ============================================================================== --- user/attilio/vmobj-readlock/sys/net/bpf.c Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/net/bpf.c Wed Mar 13 03:27:32 2013 (r248229) @@ -525,7 +525,7 @@ bpf_movein(struct uio *uio, int linktype if (len < hlen || len - hlen > ifp->if_mtu) return (EMSGSIZE); - m = m_get2(M_WAITOK, MT_DATA, M_PKTHDR, len); + m = m_get2(len, M_WAITOK, MT_DATA, M_PKTHDR); if (m == NULL) return (EIO); m->m_pkthdr.len = m->m_len = len; Modified: user/attilio/vmobj-readlock/sys/netinet/libalias/alias.c ============================================================================== --- user/attilio/vmobj-readlock/sys/netinet/libalias/alias.c Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/netinet/libalias/alias.c Wed Mar 13 03:27:32 2013 (r248229) @@ -1760,7 +1760,7 @@ m_megapullup(struct mbuf *m, int len) { if (m->m_next == NULL && M_WRITABLE(m) && M_TRAILINGSPACE(m) >= RESERVE) return (m); - mcl = m_get2(M_NOWAIT, MT_DATA, M_PKTHDR, len + RESERVE); + mcl = m_get2(len + RESERVE, M_NOWAIT, MT_DATA, M_PKTHDR); if (mcl == NULL) goto bad; Modified: user/attilio/vmobj-readlock/sys/netpfil/pf/if_pfsync.c ============================================================================== --- user/attilio/vmobj-readlock/sys/netpfil/pf/if_pfsync.c Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/netpfil/pf/if_pfsync.c Wed Mar 13 03:27:32 2013 (r248229) @@ -1505,7 +1505,7 @@ pfsync_sendout(int schedswi) return; } - m = m_get2(M_NOWAIT, MT_DATA, M_PKTHDR, max_linkhdr + sc->sc_len); + m = m_get2(max_linkhdr + sc->sc_len, M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { sc->sc_ifp->if_oerrors++; V_pfsyncstats.pfsyncs_onomem++; Modified: user/attilio/vmobj-readlock/sys/nfs/krpc_subr.c ============================================================================== --- user/attilio/vmobj-readlock/sys/nfs/krpc_subr.c Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/nfs/krpc_subr.c Wed Mar 13 03:27:32 2013 (r248229) @@ -459,7 +459,7 @@ xdr_string_encode(char *str, int len) if (mlen > MCLBYTES) /* If too big, we just can't do it. */ return (NULL); - m = m_get2(M_WAITOK, MT_DATA, 0, mlen); + m = m_get2(mlen, M_WAITOK, MT_DATA, 0); xs = mtod(m, struct xdr_string *); m->m_len = mlen; xs->len = txdr_unsigned(len); Modified: user/attilio/vmobj-readlock/sys/nfsclient/nfs_vfsops.c ============================================================================== --- user/attilio/vmobj-readlock/sys/nfsclient/nfs_vfsops.c Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/nfsclient/nfs_vfsops.c Wed Mar 13 03:27:32 2013 (r248229) @@ -298,7 +298,7 @@ nfs_statfs(struct mount *mp, struct stat } else mtx_unlock(&nmp->nm_mtx); nfsstats.rpccnt[NFSPROC_FSSTAT]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3)); + mreq = m_get2(NFSX_FH(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -356,7 +356,7 @@ nfs_fsinfo(struct nfsmount *nmp, struct u_int64_t maxfsize; nfsstats.rpccnt[NFSPROC_FSINFO]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(1)); + mreq = m_get2(NFSX_FH(1), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, 1); Modified: user/attilio/vmobj-readlock/sys/nfsclient/nfs_vnops.c ============================================================================== --- user/attilio/vmobj-readlock/sys/nfsclient/nfs_vnops.c Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/nfsclient/nfs_vnops.c Wed Mar 13 03:27:32 2013 (r248229) @@ -294,7 +294,7 @@ nfs3_access_otw(struct vnode *vp, int wm struct nfsnode *np = VTONFS(vp); nfsstats.rpccnt[NFSPROC_ACCESS]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + NFSX_UNSIGNED); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED, M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -714,7 +714,7 @@ nfs_getattr(struct vop_getattr_args *ap) goto nfsmout; } nfsstats.rpccnt[NFSPROC_GETATTR]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3)); + mreq = m_get2(NFSX_FH(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -873,7 +873,7 @@ nfs_setattrrpc(struct vnode *vp, struct int v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_SETATTR]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + NFSX_SATTR(v3)); + mreq = m_get2(NFSX_FH(v3) + NFSX_SATTR(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1037,8 +1037,8 @@ nfs_lookup(struct vop_lookup_args *ap) nfsstats.lookupcache_misses++; nfsstats.rpccnt[NFSPROC_LOOKUP]++; len = cnp->cn_namelen; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len), M_WAITOK, + MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1251,7 +1251,7 @@ nfs_readlinkrpc(struct vnode *vp, struct int v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_READLINK]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3)); + mreq = m_get2(NFSX_FH(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1306,8 +1306,8 @@ nfs_readrpc(struct vnode *vp, struct uio while (tsiz > 0) { nfsstats.rpccnt[NFSPROC_READ]++; len = (tsiz > rsize) ? rsize : tsiz; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_UNSIGNED * 3); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED * 3, M_WAITOK, + MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1379,8 +1379,8 @@ nfs_writerpc(struct vnode *vp, struct ui while (tsiz > 0) { nfsstats.rpccnt[NFSPROC_WRITE]++; len = (tsiz > wsize) ? wsize : tsiz; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + 5 * NFSX_UNSIGNED + nfsm_rndup(len)); + mreq = m_get2(NFSX_FH(v3) + 5 * NFSX_UNSIGNED + nfsm_rndup(len), + M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -1502,8 +1502,8 @@ nfs_mknodrpc(struct vnode *dvp, struct v if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)) != 0) return (error); nfsstats.rpccnt[NFSPROC_MKNOD]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 4 * NFSX_UNSIGNED + - nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); + mreq = m_get2(NFSX_FH(v3) + 4 * NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1606,8 +1606,8 @@ nfs_create(struct vop_create_args *ap) fmode |= O_EXCL; again: nfsstats.rpccnt[NFSPROC_CREATE]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 2 * NFSX_UNSIGNED + - nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); + mreq = m_get2(NFSX_FH(v3) + 2 * NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1788,8 +1788,8 @@ nfs_removerpc(struct vnode *dvp, const c int v3 = NFS_ISV3(dvp); nfsstats.rpccnt[NFSPROC_REMOVE]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(namelen)); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(namelen), + M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -1924,8 +1924,8 @@ nfs_renamerpc(struct vnode *fdvp, const int v3 = NFS_ISV3(fdvp); nfsstats.rpccnt[NFSPROC_RENAME]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, (NFSX_FH(v3) + NFSX_UNSIGNED)*2 + - nfsm_rndup(fnamelen) + nfsm_rndup(tnamelen)); + mreq = m_get2((NFSX_FH(v3) + NFSX_UNSIGNED)*2 + nfsm_rndup(fnamelen) + + nfsm_rndup(tnamelen), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(fdvp, v3); @@ -1983,8 +1983,8 @@ nfs_link(struct vop_link_args *ap) v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_LINK]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3)*2 + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); + mreq = m_get2(NFSX_FH(v3)*2 + NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -2029,8 +2029,9 @@ nfs_symlink(struct vop_symlink_args *ap) nfsstats.rpccnt[NFSPROC_SYMLINK]++; slen = strlen(ap->a_target); - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(v3) + 2*NFSX_UNSIGNED + - nfsm_rndup(cnp->cn_namelen) + nfsm_rndup(slen) + NFSX_SATTR(v3)); + mreq = m_get2(NFSX_FH(v3) + 2*NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen) + nfsm_rndup(slen) + NFSX_SATTR(v3), + M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2123,8 +2124,8 @@ nfs_mkdir(struct vop_mkdir_args *ap) return (error); len = cnp->cn_namelen; nfsstats.rpccnt[NFSPROC_MKDIR]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len) + NFSX_SATTR(v3)); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len) + + NFSX_SATTR(v3), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2188,8 +2189,8 @@ nfs_rmdir(struct vop_rmdir_args *ap) if (dvp == vp) return (EINVAL); nfsstats.rpccnt[NFSPROC_RMDIR]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2307,8 +2308,8 @@ nfs_readdirrpc(struct vnode *vp, struct */ while (more_dirs && bigenough) { nfsstats.rpccnt[NFSPROC_READDIR]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_READDIR(v3)); + mreq = m_get2(NFSX_FH(v3) + NFSX_READDIR(v3), M_WAITOK, + MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, v3); @@ -2513,8 +2514,8 @@ nfs_readdirplusrpc(struct vnode *vp, str */ while (more_dirs && bigenough) { nfsstats.rpccnt[NFSPROC_READDIRPLUS]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(1) + 6 * NFSX_UNSIGNED); + mreq = m_get2(NFSX_FH(1) + 6 * NFSX_UNSIGNED, M_WAITOK, + MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, 1); @@ -2818,8 +2819,8 @@ nfs_lookitup(struct vnode *dvp, const ch int v3 = NFS_ISV3(dvp); nfsstats.rpccnt[NFSPROC_LOOKUP]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); + mreq = m_get2(NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len), + M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(dvp, v3); @@ -2897,7 +2898,7 @@ nfs_commit(struct vnode *vp, u_quad_t of } mtx_unlock(&nmp->nm_mtx); nfsstats.rpccnt[NFSPROC_COMMIT]++; - mreq = m_get2(M_WAITOK, MT_DATA, 0, NFSX_FH(1)); + mreq = m_get2(NFSX_FH(1), M_WAITOK, MT_DATA, 0); mb = mreq; bpos = mtod(mb, caddr_t); nfsm_fhtom(vp, 1); Modified: user/attilio/vmobj-readlock/sys/sys/mbuf.h ============================================================================== --- user/attilio/vmobj-readlock/sys/sys/mbuf.h Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/sys/mbuf.h Wed Mar 13 03:27:32 2013 (r248229) @@ -801,7 +801,7 @@ int m_dup_pkthdr(struct mbuf *, struct u_int m_fixhdr(struct mbuf *); struct mbuf *m_fragment(struct mbuf *, int, int); void m_freem(struct mbuf *); -struct mbuf *m_get2(int, short, int, int); +struct mbuf *m_get2(int, int, short, int); struct mbuf *m_getjcl(int, short, int, int); struct mbuf *m_getm2(struct mbuf *, int, int, short, int); struct mbuf *m_getptr(struct mbuf *, int, int *); Modified: user/attilio/vmobj-readlock/sys/sys/param.h ============================================================================== --- user/attilio/vmobj-readlock/sys/sys/param.h Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/sys/param.h Wed Mar 13 03:27:32 2013 (r248229) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000029 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000030 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: user/attilio/vmobj-readlock/sys/vm/_vm_radix.h ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/_vm_radix.h Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/vm/_vm_radix.h Wed Mar 13 03:27:32 2013 (r248229) @@ -37,6 +37,8 @@ struct vm_radix { uintptr_t rt_root; }; +#ifdef _KERNEL + static __inline boolean_t vm_radix_is_empty(struct vm_radix *rtree) { @@ -44,4 +46,5 @@ vm_radix_is_empty(struct vm_radix *rtree return (rtree->rt_root == 0); } +#endif /* _KERNEL */ #endif /* !__VM_RADIX_H_ */ Modified: user/attilio/vmobj-readlock/sys/vm/vm_radix.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_radix.c Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/sys/vm/vm_radix.c Wed Mar 13 03:27:32 2013 (r248229) @@ -375,6 +375,9 @@ vm_radix_insert(struct vm_radix *rtree, int slot; uint16_t clev; + KASSERT(index == page->pindex, ("%s: index != page->pindex", + __func__)); + /* * The owner of record for root is not really important because it * will never be used. @@ -442,7 +445,7 @@ vm_radix_insert(struct vm_radix *rtree, * Setup the new intermediate node and add the 2 children: the * new object and the older edge. */ - tmp2 = vm_radix_node_get(vm_radix_trimkey(page->pindex, clev - 1), 2, + tmp2 = vm_radix_node_get(vm_radix_trimkey(index, clev - 1), 2, clev); rnode->rn_child[slot] = tmp2; vm_radix_addpage(tmp2, index, clev, page); Modified: user/attilio/vmobj-readlock/usr.bin/grep/regex/tre-fastmatch.c ============================================================================== --- user/attilio/vmobj-readlock/usr.bin/grep/regex/tre-fastmatch.c Wed Mar 13 03:25:04 2013 (r248228) +++ user/attilio/vmobj-readlock/usr.bin/grep/regex/tre-fastmatch.c Wed Mar 13 03:27:32 2013 (r248229) @@ -103,7 +103,7 @@ static int fastcmp(const fastmatch_t *fg ((!fg->reversed \ ? ((type == STR_WIDE) ? ((j + fg->wlen) > len) \ : ((j + fg->len) > len)) \ - : (j <= 0))) + : (j < 0))) /* * Checks whether the new position after shifting in the input string From owner-svn-src-user@FreeBSD.ORG Wed Mar 13 14:36:49 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7AC9E268; Wed, 13 Mar 2013 14:36:49 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4B09EA82; Wed, 13 Mar 2013 14:36:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2DEan5q057579; Wed, 13 Mar 2013 14:36:49 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2DEannE057578; Wed, 13 Mar 2013 14:36:49 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201303131436.r2DEannE057578@svn.freebsd.org> From: Andre Oppermann Date: Wed, 13 Mar 2013 14:36:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248242 - user/andre/tcp-ao X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2013 14:36:49 -0000 Author: andre Date: Wed Mar 13 14:36:48 2013 New Revision: 248242 URL: http://svnweb.freebsd.org/changeset/base/248242 Log: Create branch to implement TCP-AO (TCP Authentication Option) according to RFC5925 and RFC5926. Sponsored by: Juniper Networks Added: - copied from r248241, head/ Directory Properties: user/andre/tcp-ao/ (props changed) From owner-svn-src-user@FreeBSD.ORG Wed Mar 13 15:05:12 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 33EF39A6; Wed, 13 Mar 2013 15:05:12 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 041C2CD6; Wed, 13 Mar 2013 15:05:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2DF5BjL066258; Wed, 13 Mar 2013 15:05:11 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2DF5BAF066257; Wed, 13 Mar 2013 15:05:11 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201303131505.r2DF5BAF066257@svn.freebsd.org> From: Andre Oppermann Date: Wed, 13 Mar 2013 15:05:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248243 - user/andre/tcp-ao/sys/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2013 15:05:12 -0000 Author: andre Date: Wed Mar 13 15:05:11 2013 New Revision: 248243 URL: http://svnweb.freebsd.org/changeset/base/248243 Log: Add tcp_ao.c file to contain the implementation. Describe tcp-ao and the steps to implement it. Sponsored by: Juniper Networks Added: user/andre/tcp-ao/sys/netinet/tcp_ao.c Added: user/andre/tcp-ao/sys/netinet/tcp_ao.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/andre/tcp-ao/sys/netinet/tcp_ao.c Wed Mar 13 15:05:11 2013 (r248243) @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2013 Juniper Networks + * All rights reserved. + * + * Written by Andre Oppermann + * + * 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. + * + */ + +/* + * TCP-AO protects a TCP session and individual segments with a keyed hash + * mechanism. It is specified in RFC5925 and RFC5926. It is intended to + * eventually replace TCP-MD5 RFC2385. + * + * The implementation consists of 4 parts: + * 1. the hash implementation to sign and verify segments. + * 2. changes to the tcp input path to validate incoming segments, + * and changes to the tcp output path to sign outgoing segments. + * 3. key management in the kernel and the exposed userland API. + * 4. test programs to verify the correct operation. + * + * TODO: + * all of the above. + * + * Discussion: + * the key management can be done in two ways: via the ipsec key interface + * or through the setsockopt() api. Analyse which one is better to handle + * in the kernel and for userspace applications. + * + * legacy tcp-md5 can be brought and integrated into the tcp-ao framework. + */ + From owner-svn-src-user@FreeBSD.ORG Wed Mar 13 15:09:00 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AB55EB4F; Wed, 13 Mar 2013 15:09:00 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9453BD18; Wed, 13 Mar 2013 15:09:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2DF90os066913; Wed, 13 Mar 2013 15:09:00 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2DF90eM066912; Wed, 13 Mar 2013 15:09:00 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201303131509.r2DF90eM066912@svn.freebsd.org> From: Andre Oppermann Date: Wed, 13 Mar 2013 15:09:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248244 - user/andre/tcp-ao/sys/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2013 15:09:00 -0000 Author: andre Date: Wed Mar 13 15:09:00 2013 New Revision: 248244 URL: http://svnweb.freebsd.org/changeset/base/248244 Log: Add TCP-AO option of kind 29. The length is variable depending on the algorithm selected and can't be determined in advance. Sponsored by: Juniper Networks Modified: user/andre/tcp-ao/sys/netinet/tcp.h Modified: user/andre/tcp-ao/sys/netinet/tcp.h ============================================================================== --- user/andre/tcp-ao/sys/netinet/tcp.h Wed Mar 13 15:05:11 2013 (r248243) +++ user/andre/tcp-ao/sys/netinet/tcp.h Wed Mar 13 15:09:00 2013 (r248244) @@ -97,6 +97,7 @@ struct tcphdr { #define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ #define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */ #define TCPOLEN_SIGNATURE 18 +#define TCPOPT_AO 29 /* Miscellaneous constants */ #define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */ From owner-svn-src-user@FreeBSD.ORG Wed Mar 13 15:20:18 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E7CBFD4; Wed, 13 Mar 2013 15:20:18 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DB356DDB; Wed, 13 Mar 2013 15:20:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2DFKIu1070242; Wed, 13 Mar 2013 15:20:18 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2DFKI8r070241; Wed, 13 Mar 2013 15:20:18 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303131520.r2DFKI8r070241@svn.freebsd.org> From: Attilio Rao Date: Wed, 13 Mar 2013 15:20:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248245 - user/attilio/vmobj-readlock/sys/kern X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2013 15:20:19 -0000 Author: attilio Date: Wed Mar 13 15:20:18 2013 New Revision: 248245 URL: http://svnweb.freebsd.org/changeset/base/248245 Log: Revert read locking in brelse(). For the time being vm_page_set_invalid() requires write locking on obj. Sponsored by: EMC / Isilon storage division Modified: user/attilio/vmobj-readlock/sys/kern/vfs_bio.c Modified: user/attilio/vmobj-readlock/sys/kern/vfs_bio.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/vfs_bio.c Wed Mar 13 15:09:00 2013 (r248244) +++ user/attilio/vmobj-readlock/sys/kern/vfs_bio.c Wed Mar 13 15:20:18 2013 (r248245) @@ -1389,7 +1389,7 @@ brelse(struct buf *bp) */ resid = bp->b_bufsize; foff = bp->b_offset; - VM_OBJECT_RLOCK(obj); + VM_OBJECT_WLOCK(obj); for (i = 0; i < bp->b_npages; i++) { int had_bogus = 0; @@ -1437,7 +1437,7 @@ brelse(struct buf *bp) resid -= PAGE_SIZE - (foff & PAGE_MASK); foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; } - VM_OBJECT_RUNLOCK(obj); + VM_OBJECT_WUNLOCK(obj); if (bp->b_flags & (B_INVAL | B_RELBUF)) vfs_vmio_release(bp); From owner-svn-src-user@FreeBSD.ORG Thu Mar 14 01:53:36 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 33C3B390; Thu, 14 Mar 2013 01:53:36 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 18DCD15C; Thu, 14 Mar 2013 01:53:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2E1ra0c064971; Thu, 14 Mar 2013 01:53:36 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2E1rWF5064951; Thu, 14 Mar 2013 01:53:32 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303140153.r2E1rWF5064951@svn.freebsd.org> From: Attilio Rao Date: Thu, 14 Mar 2013 01:53:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248260 - in user/attilio/vmobj-readlock/sys: cddl/contrib/opensolaris/uts/common/fs/zfs dev/drm2/i915 dev/drm2/ttm fs/fuse fs/tmpfs kern vm X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Mar 2013 01:53:36 -0000 Author: attilio Date: Thu Mar 14 01:53:32 2013 New Revision: 248260 URL: http://svnweb.freebsd.org/changeset/base/248260 Log: Move the page handling of sleeping on a page for a specific condition under the protection of the page lock. In detail: 1) VPO_WANTED is moved to be a per-page flag, removing it and introducing PG_WANTED. 2) The function vm_page_sleep_onpage() is introduced to work as an underlying version of vm_page_sleep() / vm_page_sleep_if_busy() to specify priority and timo of the sleeping operation. 3) Convert all the current sleepers on the page to not use anymore VM_OBJECT_SLEEP() but use vm_page_sleep(). In one case, where special timo, priority and return value are needed, vm_page_sleep_onpage() is used directly. 4) The operation results without races because the object lock is now dropped after the page-lock is held. This creates a chain of trust. Further notes: - vm_page_sleep() and neighboor functions now always want the page-lock held. The semantic of the unlocking is left unchanged. - The burden to deal with page-locking is on the callers of the function. This is because soon more per-page attributes will be moved under the per-page lock, making the protection path a single critical section. - The vm_page_sleep_if_busy() is temporary made an hard function. This is to avoid namespace pollution by the object locking. With more changes the object locking won't be necessary anymore there and it will be made inline again as it should be. - vm_page_flash() and vm_page_sleep() lost the necessity to be called with the object lock held. Sponsored by: EMC / Isilon storage division Modified: user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c user/attilio/vmobj-readlock/sys/dev/drm2/i915/i915_gem.c user/attilio/vmobj-readlock/sys/dev/drm2/ttm/ttm_bo_vm.c user/attilio/vmobj-readlock/sys/fs/fuse/fuse_vnops.c user/attilio/vmobj-readlock/sys/fs/tmpfs/tmpfs_subr.c user/attilio/vmobj-readlock/sys/fs/tmpfs/tmpfs_vnops.c user/attilio/vmobj-readlock/sys/kern/subr_uio.c user/attilio/vmobj-readlock/sys/kern/uipc_shm.c user/attilio/vmobj-readlock/sys/kern/vfs_bio.c user/attilio/vmobj-readlock/sys/vm/phys_pager.c user/attilio/vmobj-readlock/sys/vm/swap_pager.c user/attilio/vmobj-readlock/sys/vm/vm_fault.c user/attilio/vmobj-readlock/sys/vm/vm_object.c user/attilio/vmobj-readlock/sys/vm/vm_object.h user/attilio/vmobj-readlock/sys/vm/vm_page.c user/attilio/vmobj-readlock/sys/vm/vm_page.h user/attilio/vmobj-readlock/sys/vm/vnode_pager.c Modified: user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Mar 14 01:53:32 2013 (r248260) @@ -342,7 +342,10 @@ page_busy(vnode_t *vp, int64_t start, in * likely to reclaim it. */ vm_page_reference(pp); + vm_page_lock(pp); + zfs_vmobject_wunlock(obj); vm_page_sleep(pp, "zfsmwb"); + zfs_vmobject_wlock(obj); continue; } } else { @@ -390,7 +393,10 @@ page_hold(vnode_t *vp, int64_t start) * likely to reclaim it. */ vm_page_reference(pp); + vm_page_lock(pp); + zfs_vmobject_wunlock(obj); vm_page_sleep(pp, "zfsmwb"); + zfs_vmobject_wlock(obj); continue; } Modified: user/attilio/vmobj-readlock/sys/dev/drm2/i915/i915_gem.c ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/drm2/i915/i915_gem.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/dev/drm2/i915/i915_gem.c Thu Mar 14 01:53:32 2013 (r248260) @@ -1421,7 +1421,10 @@ unlocked_vmobj: if ((m->flags & VPO_BUSY) != 0) { DRM_UNLOCK(dev); + vm_page_lock(m); + VM_OBJECT_WUNLOCK(vm_obj); vm_page_sleep(m, "915pbs"); + VM_OBJECT_WLOCK(vm_obj); goto retry; } m->valid = VM_PAGE_BITS_ALL; @@ -2309,14 +2312,17 @@ i915_gem_release_mmap(struct drm_i915_ge if (devobj != NULL) { page_count = OFF_TO_IDX(obj->base.size); - VM_OBJECT_WLOCK(devobj); retry: + VM_OBJECT_WLOCK(devobj); for (i = 0; i < page_count; i++) { m = vm_page_lookup(devobj, i); if (m == NULL) continue; + vm_page_lock(m); + VM_OBJECT_WUNLOCK(devobj); if (vm_page_sleep_if_busy(m, true, "915unm")) goto retry; + vm_page_unlock(m); cdev_pager_free_page(devobj, m); } VM_OBJECT_WUNLOCK(devobj); Modified: user/attilio/vmobj-readlock/sys/dev/drm2/ttm/ttm_bo_vm.c ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/drm2/ttm/ttm_bo_vm.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/dev/drm2/ttm/ttm_bo_vm.c Thu Mar 14 01:53:32 2013 (r248260) @@ -215,7 +215,10 @@ reserve: VM_OBJECT_WLOCK(vm_obj); if ((m->flags & VPO_BUSY) != 0) { + vm_page_lock(m); + VM_OBJECT_WUNLOCK(vm_obj); vm_page_sleep(m, "ttmpbs"); + VM_OBJECT_WLOCK(vm_obj); ttm_mem_io_unlock(man); ttm_bo_unreserve(bo); goto retry; Modified: user/attilio/vmobj-readlock/sys/fs/fuse/fuse_vnops.c ============================================================================== --- user/attilio/vmobj-readlock/sys/fs/fuse/fuse_vnops.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/fs/fuse/fuse_vnops.c Thu Mar 14 01:53:32 2013 (r248260) @@ -1868,15 +1868,12 @@ fuse_vnop_getpages(struct vop_getpages_a * now tell them that it is ok to use. */ if (!error) { - if (m->oflags & VPO_WANTED) { - fuse_vm_page_lock(m); + fuse_vm_page_lock(m); + if (m->flags & PG_WANTED) vm_page_activate(m); - fuse_vm_page_unlock(m); - } else { - fuse_vm_page_lock(m); + else vm_page_deactivate(m); - fuse_vm_page_unlock(m); - } + fuse_vm_page_unlock(m); vm_page_wakeup(m); } else { fuse_vm_page_lock(m); Modified: user/attilio/vmobj-readlock/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- user/attilio/vmobj-readlock/sys/fs/tmpfs/tmpfs_subr.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/fs/tmpfs/tmpfs_subr.c Thu Mar 14 01:53:32 2013 (r248260) @@ -1285,7 +1285,10 @@ retry: if (m != NULL) { if ((m->oflags & VPO_BUSY) != 0 || m->busy != 0) { + vm_page_lock(m); + VM_OBJECT_WUNLOCK(uobj); vm_page_sleep(m, "tmfssz"); + VM_OBJECT_WLOCK(uobj); goto retry; } MPASS(m->valid == VM_PAGE_BITS_ALL); Modified: user/attilio/vmobj-readlock/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- user/attilio/vmobj-readlock/sys/fs/tmpfs/tmpfs_vnops.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/fs/tmpfs/tmpfs_vnops.c Thu Mar 14 01:53:32 2013 (r248260) @@ -513,8 +513,8 @@ tmpfs_mappedread(vm_object_t vobj, vm_ob offset = addr & PAGE_MASK; tlen = MIN(PAGE_SIZE - offset, len); - VM_OBJECT_WLOCK(vobj); lookupvpg: + VM_OBJECT_WLOCK(vobj); if (((m = vm_page_lookup(vobj, idx)) != NULL) && vm_page_is_valid(m, offset, tlen)) { if ((m->oflags & VPO_BUSY) != 0) { @@ -523,6 +523,8 @@ lookupvpg: * that the page daemon is less likely to reclaim it. */ vm_page_reference(m); + vm_page_lock(m); + VM_OBJECT_WUNLOCK(vobj); vm_page_sleep(m, "tmfsmr"); goto lookupvpg; } @@ -542,6 +544,8 @@ lookupvpg: * that the page daemon is less likely to reclaim it. */ vm_page_reference(m); + vm_page_lock(m); + VM_OBJECT_WUNLOCK(vobj); vm_page_sleep(m, "tmfsmr"); goto lookupvpg; } @@ -636,8 +640,8 @@ tmpfs_mappedwrite(vm_object_t vobj, vm_o offset = addr & PAGE_MASK; tlen = MIN(PAGE_SIZE - offset, len); - VM_OBJECT_WLOCK(vobj); lookupvpg: + VM_OBJECT_WLOCK(vobj); if (((vpg = vm_page_lookup(vobj, idx)) != NULL) && vm_page_is_valid(vpg, offset, tlen)) { if ((vpg->oflags & VPO_BUSY) != 0) { @@ -646,6 +650,8 @@ lookupvpg: * that the page daemon is less likely to reclaim it. */ vm_page_reference(vpg); + vm_page_lock(vpg); + VM_OBJECT_WUNLOCK(vobj); vm_page_sleep(vpg, "tmfsmw"); goto lookupvpg; } Modified: user/attilio/vmobj-readlock/sys/kern/subr_uio.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/subr_uio.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/kern/subr_uio.c Thu Mar 14 01:53:32 2013 (r248260) @@ -107,9 +107,9 @@ vm_pgmoveco(vm_map_t mapa, vm_offset_t k VM_OBJECT_WLOCK(uobject); retry: if ((user_pg = vm_page_lookup(uobject, upindex)) != NULL) { + vm_page_lock(user_pg); if (vm_page_sleep_if_busy(user_pg, TRUE, "vm_pgmoveco")) goto retry; - vm_page_lock(user_pg); pmap_remove_all(user_pg); vm_page_free(user_pg); vm_page_unlock(user_pg); Modified: user/attilio/vmobj-readlock/sys/kern/uipc_shm.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/uipc_shm.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/kern/uipc_shm.c Thu Mar 14 01:53:32 2013 (r248260) @@ -283,7 +283,10 @@ retry: if (m != NULL) { if ((m->oflags & VPO_BUSY) != 0 || m->busy != 0) { + vm_page_lock(m); + VM_OBJECT_WUNLOCK(object); vm_page_sleep(m, "shmtrc"); + VM_OBJECT_WLOCK(object); goto retry; } } else if (vm_pager_has_page(object, idx, NULL, NULL)) { Modified: user/attilio/vmobj-readlock/sys/kern/vfs_bio.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/vfs_bio.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/kern/vfs_bio.c Thu Mar 14 01:53:32 2013 (r248260) @@ -3053,12 +3053,12 @@ allocbuf(struct buf *bp, int size) m = bp->b_pages[i]; KASSERT(m != bogus_page, ("allocbuf: bogus page found")); - while (vm_page_sleep_if_busy(m, TRUE, - "biodep")) - continue; + do { + vm_page_lock(m); + } while (vm_page_sleep_if_busy(m, TRUE, + "biodep")); bp->b_pages[i] = NULL; - vm_page_lock(m); vm_page_unwire(m, 0); vm_page_unlock(m); } @@ -3581,8 +3581,12 @@ vfs_drain_busy_pages(struct buf *bp) if ((m->oflags & VPO_BUSY) != 0) { for (; last_busied < i; last_busied++) vm_page_busy(bp->b_pages[last_busied]); - while ((m->oflags & VPO_BUSY) != 0) + while ((m->oflags & VPO_BUSY) != 0) { + vm_page_lock(m); + VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); vm_page_sleep(m, "vbpage"); + VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); + } } } for (i = 0; i < last_busied; i++) Modified: user/attilio/vmobj-readlock/sys/vm/phys_pager.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/phys_pager.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/vm/phys_pager.c Thu Mar 14 01:53:32 2013 (r248260) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -152,9 +153,11 @@ phys_pager_getpages(vm_object_t object, KASSERT(m[i]->dirty == 0, ("phys_pager_getpages: dirty page %p", m[i])); /* The requested page must remain busy, the others not. */ - if (i == reqpage) + if (i == reqpage) { + vm_page_lock(m[i]); vm_page_flash(m[i]); - else + vm_page_unlock(m[i]); + } else vm_page_wakeup(m[i]); } return (VM_PAGER_OK); Modified: user/attilio/vmobj-readlock/sys/vm/swap_pager.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/swap_pager.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/vm/swap_pager.c Thu Mar 14 01:53:32 2013 (r248260) @@ -1211,13 +1211,15 @@ swap_pager_getpages(vm_object_t object, */ VM_OBJECT_WLOCK(object); while ((mreq->oflags & VPO_SWAPINPROG) != 0) { - mreq->oflags |= VPO_WANTED; PCPU_INC(cnt.v_intrans); - if (VM_OBJECT_SLEEP(object, mreq, PSWP, "swread", hz * 20)) { + vm_page_lock(mreq); + VM_OBJECT_WUNLOCK(object); + if (vm_page_sleep_onpage(mreq, PSWP, "swread", hz * 20)) { printf( "swap_pager: indefinite wait buffer: bufobj: %p, blkno: %jd, size: %ld\n", bp->b_bufobj, (intmax_t)bp->b_blkno, bp->b_bcount); } + VM_OBJECT_WLOCK(object); } /* @@ -1531,8 +1533,11 @@ swp_pager_async_iodone(struct buf *bp) m->valid = 0; if (i != bp->b_pager.pg_reqpage) swp_pager_free_nrpage(m); - else + else { + vm_page_lock(m); vm_page_flash(m); + vm_page_unlock(m); + } /* * If i == bp->b_pager.pg_reqpage, do not wake * the page up. The caller needs to. @@ -1585,8 +1590,11 @@ swp_pager_async_iodone(struct buf *bp) vm_page_deactivate(m); vm_page_unlock(m); vm_page_wakeup(m); - } else + } else { + vm_page_lock(m); vm_page_flash(m); + vm_page_unlock(m); + } } else { /* * For write success, clear the dirty Modified: user/attilio/vmobj-readlock/sys/vm/vm_fault.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_fault.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/vm/vm_fault.c Thu Mar 14 01:53:32 2013 (r248260) @@ -379,8 +379,10 @@ RetryFault:; unlock_map(&fs); if (fs.m == vm_page_lookup(fs.object, fs.pindex)) { - vm_page_sleep_if_busy(fs.m, TRUE, - "vmpfw"); + vm_page_lock(fs.m); + if (!vm_page_sleep_if_busy(fs.m, TRUE, + "vmpfw")) + vm_page_unlock(fs.m); } vm_object_pip_wakeup(fs.object); VM_OBJECT_WUNLOCK(fs.object); Modified: user/attilio/vmobj-readlock/sys/vm/vm_object.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_object.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/vm/vm_object.c Thu Mar 14 01:53:32 2013 (r248260) @@ -391,7 +391,7 @@ vm_object_pip_wait(vm_object_t object, c VM_OBJECT_ASSERT_WLOCKED(object); while (object->paging_in_progress) { object->flags |= OBJ_PIPWNT; - VM_OBJECT_SLEEP(object, object, PVM, waitid, 0); + VM_OBJECT_SLEEP(object, object, PVM, waitid); } } @@ -584,7 +584,7 @@ retry: VM_OBJECT_WUNLOCK(robject); object->flags |= OBJ_PIPWNT; VM_OBJECT_SLEEP(object, object, - PDROP | PVM, "objde2", 0); + PDROP | PVM, "objde2"); VM_OBJECT_WLOCK(robject); temp = robject->backing_object; if (object == temp) { @@ -844,6 +844,7 @@ rescan: np = TAILQ_NEXT(p, listq); if (p->valid == 0) continue; + vm_page_lock(p); if (vm_page_sleep_if_busy(p, TRUE, "vpcwai")) { if (object->generation != curgeneration) { if ((flags & OBJPC_SYNC) != 0) @@ -854,6 +855,7 @@ rescan: np = vm_page_find_least(object, pi); continue; } + vm_page_unlock(p); if (!vm_object_page_remove_write(p, flags, &clearobjflags)) continue; @@ -1138,11 +1140,10 @@ shadowlookup: */ vm_page_aflag_set(m, PGA_REFERENCED); } - vm_page_unlock(m); if (object != tobject) VM_OBJECT_WUNLOCK(object); - m->oflags |= VPO_WANTED; - VM_OBJECT_SLEEP(tobject, m, PDROP | PVM, "madvpo", 0); + VM_OBJECT_WUNLOCK(tobject); + vm_page_sleep(m, "madvpo"); VM_OBJECT_WLOCK(object); goto relookup; } @@ -1339,8 +1340,10 @@ retry: */ if ((m->oflags & VPO_BUSY) || m->busy) { VM_OBJECT_WUNLOCK(new_object); - m->oflags |= VPO_WANTED; - VM_OBJECT_SLEEP(orig_object, m, PVM, "spltwt", 0); + vm_page_lock(m); + VM_OBJECT_WUNLOCK(orig_object); + vm_page_sleep(m, "spltwt"); + VM_OBJECT_WLOCK(orig_object); VM_OBJECT_WLOCK(new_object); goto retry; } @@ -1497,9 +1500,9 @@ vm_object_backing_scan(vm_object_t objec } else if (op & OBSC_COLLAPSE_WAIT) { if ((p->oflags & VPO_BUSY) || p->busy) { VM_OBJECT_WUNLOCK(object); - p->oflags |= VPO_WANTED; - VM_OBJECT_SLEEP(backing_object, p, - PDROP | PVM, "vmocol", 0); + vm_page_lock(p); + VM_OBJECT_WUNLOCK(backing_object); + vm_page_sleep(p, "vmocol"); VM_OBJECT_WLOCK(object); VM_OBJECT_WLOCK(backing_object); /* Modified: user/attilio/vmobj-readlock/sys/vm/vm_object.h ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_object.h Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/vm/vm_object.h Thu Mar 14 01:53:32 2013 (r248260) @@ -216,8 +216,8 @@ extern struct vm_object kmem_object_stor rw_rlock(&(object)->lock) #define VM_OBJECT_RUNLOCK(object) \ rw_runlock(&(object)->lock) -#define VM_OBJECT_SLEEP(object, wchan, pri, wmesg, timo) \ - rw_sleep((wchan), &(object)->lock, (pri), (wmesg), (timo)) +#define VM_OBJECT_SLEEP(object, wchan, pri, wmesg) \ + rw_sleep((wchan), &(object)->lock, (pri), (wmesg), 0) #define VM_OBJECT_TRYRLOCK(object) \ rw_try_rlock(&(object)->lock) #define VM_OBJECT_TRYWLOCK(object) \ Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_page.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/vm/vm_page.c Thu Mar 14 01:53:32 2013 (r248260) @@ -485,9 +485,9 @@ void vm_page_flash(vm_page_t m) { - VM_OBJECT_ASSERT_WLOCKED(m->object); - if (m->oflags & VPO_WANTED) { - m->oflags &= ~VPO_WANTED; + vm_page_lock_assert(m, MA_OWNED); + if (m->flags & PG_WANTED) { + m->flags &= ~PG_WANTED; wakeup(m); } } @@ -506,7 +506,9 @@ vm_page_wakeup(vm_page_t m) VM_OBJECT_ASSERT_WLOCKED(m->object); KASSERT(m->oflags & VPO_BUSY, ("vm_page_wakeup: page not busy!!!")); m->oflags &= ~VPO_BUSY; + vm_page_lock(m); vm_page_flash(m); + vm_page_unlock(m); } void @@ -524,8 +526,11 @@ vm_page_io_finish(vm_page_t m) VM_OBJECT_ASSERT_WLOCKED(m->object); KASSERT(m->busy > 0, ("vm_page_io_finish: page %p is not busy", m)); m->busy--; - if (m->busy == 0) + if (m->busy == 0) { + vm_page_lock(m); vm_page_flash(m); + vm_page_unlock(m); + } } /* @@ -719,15 +724,12 @@ vm_page_readahead_finish(vm_page_t m) * deactivating the page is usually the best choice, * unless the page is wanted by another thread. */ - if (m->oflags & VPO_WANTED) { - vm_page_lock(m); + vm_page_lock(m); + if (m->flags & PG_WANTED) vm_page_activate(m); - vm_page_unlock(m); - } else { - vm_page_lock(m); + else vm_page_deactivate(m); - vm_page_unlock(m); - } + vm_page_unlock(m); vm_page_wakeup(m); } else { /* @@ -743,29 +745,43 @@ vm_page_readahead_finish(vm_page_t m) } /* - * vm_page_sleep: + * vm_page_sleep_if_busy: * - * Sleep and release the page lock. + * Sleep and release the page queues lock if VPO_BUSY is set or, + * if also_m_busy is TRUE, busy is non-zero. Returns TRUE if the + * thread slept and the page queues lock was released. + * Otherwise, retains the page queues lock and returns FALSE. * - * The object containing the given page must be locked. + * The given page and object containing it must be locked. */ -void -vm_page_sleep(vm_page_t m, const char *msg) +int +vm_page_sleep_if_busy(vm_page_t m, int also_m_busy, const char *msg) { VM_OBJECT_ASSERT_WLOCKED(m->object); - if (mtx_owned(vm_page_lockptr(m))) - vm_page_unlock(m); + if ((m->oflags & VPO_BUSY) || (also_m_busy && m->busy)) { + VM_OBJECT_WUNLOCK(m->object); + vm_page_sleep(m, msg); + VM_OBJECT_WLOCK(m->object); + return (TRUE); + } + return (FALSE); +} - /* - * It's possible that while we sleep, the page will get - * unbusied and freed. If we are holding the object - * lock, we will assume we hold a reference to the object - * such that even if m->object changes, we can re-lock - * it. - */ - m->oflags |= VPO_WANTED; - VM_OBJECT_SLEEP(m->object, m, PVM, msg, 0); +/* + * vm_page_sleep_onpage: + * + * Sleep and release the page lock, using the page pointer as wchan. + * + * The given page must be locked. + */ +int +vm_page_sleep_onpage(vm_page_t m, int pri, const char *wmesg, int timo) +{ + + vm_page_lock_assert(m, MA_OWNED); + m->flags |= PG_WANTED; + return (msleep(m, vm_page_lockptr(m), pri | PDROP, wmesg, timo)); } /* @@ -2320,6 +2336,7 @@ retrylookup: * likely to reclaim it. */ vm_page_aflag_set(m, PGA_REFERENCED); + vm_page_lock(m); vm_page_sleep(m, "pgrbwt"); goto retrylookup; } else { Modified: user/attilio/vmobj-readlock/sys/vm/vm_page.h ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vm_page.h Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/vm/vm_page.h Thu Mar 14 01:53:32 2013 (r248260) @@ -166,7 +166,7 @@ struct vm_page { * */ #define VPO_BUSY 0x01 /* page is in transit */ -#define VPO_WANTED 0x02 /* someone is waiting for page */ +#define VPO_UNUSED02 0x02 /* --available-- */ #define VPO_UNMANAGED 0x04 /* no PV management for page */ #define VPO_SWAPINPROG 0x08 /* swap I/O in progress on page */ #define VPO_NOSYNC 0x10 /* do not collect for syncer */ @@ -270,6 +270,7 @@ extern struct mtx_padalign pa_lock[]; #define PG_WINATCFLS 0x0040 /* flush dirty page on inactive q */ #define PG_NODUMP 0x0080 /* don't include this page in a dump */ #define PG_UNHOLDFREE 0x0100 /* delayed free of a held page */ +#define PG_WANTED 0x0200 /* someone is waiting for page */ /* * Misc constants. @@ -401,7 +402,8 @@ void vm_page_rename (vm_page_t, vm_objec void vm_page_requeue(vm_page_t m); void vm_page_requeue_locked(vm_page_t m); void vm_page_set_valid_range(vm_page_t m, int base, int size); -void vm_page_sleep(vm_page_t m, const char *msg); +int vm_page_sleep_if_busy(vm_page_t m, int also_m_busy, const char *msg); +int vm_page_sleep_onpage(vm_page_t m, int pri, const char *msg, int timo); vm_offset_t vm_page_startup(vm_offset_t vaddr); void vm_page_unhold_pages(vm_page_t *ma, int count); void vm_page_unwire (vm_page_t, int); @@ -527,40 +529,34 @@ vm_page_dirty(vm_page_t m) } /* - * vm_page_remque: + * vm_page_sleep: * - * If the given page is in a page queue, then remove it from that page - * queue. + * Convenience wrapper around vm_page_sleep_onpage(), passing + * PVM priority and 0 timeout values. Unlocks the page upon return. * * The page must be locked. */ -static inline void -vm_page_remque(vm_page_t m) +static __inline void +vm_page_sleep(vm_page_t m, const char *msg) { - if (m->queue != PQ_NONE) - vm_page_dequeue(m); + vm_page_sleep_onpage(m, PVM, msg, 0); } /* - * vm_page_sleep_if_busy: + * vm_page_remque: * - * Sleep and release the page queues lock if VPO_BUSY is set or, - * if also_m_busy is TRUE, busy is non-zero. Returns TRUE if the - * thread slept and the page queues lock was released. - * Otherwise, retains the page queues lock and returns FALSE. + * If the given page is in a page queue, then remove it from that page + * queue. * - * The object containing the given page must be locked. + * The page must be locked. */ -static __inline int -vm_page_sleep_if_busy(vm_page_t m, int also_m_busy, const char *msg) +static inline void +vm_page_remque(vm_page_t m) { - if ((m->oflags & VPO_BUSY) || (also_m_busy && m->busy)) { - vm_page_sleep(m, msg); - return (TRUE); - } - return (FALSE); + if (m->queue != PQ_NONE) + vm_page_dequeue(m); } /* Modified: user/attilio/vmobj-readlock/sys/vm/vnode_pager.c ============================================================================== --- user/attilio/vmobj-readlock/sys/vm/vnode_pager.c Thu Mar 14 00:27:53 2013 (r248259) +++ user/attilio/vmobj-readlock/sys/vm/vnode_pager.c Thu Mar 14 01:53:32 2013 (r248260) @@ -117,7 +117,7 @@ vnode_create_vobject(struct vnode *vp, o } VOP_UNLOCK(vp, 0); vm_object_set_flag(object, OBJ_DISCONNECTWNT); - VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vodead", 0); + VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vodead"); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); } @@ -211,7 +211,7 @@ retry: if ((object->flags & OBJ_DEAD) == 0) break; vm_object_set_flag(object, OBJ_DISCONNECTWNT); - VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vadead", 0); + VM_OBJECT_SLEEP(object, object, PDROP | PVM, "vadead"); } if (vp->v_usecount == 0) From owner-svn-src-user@FreeBSD.ORG Thu Mar 14 02:00:30 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 16F566B9; Thu, 14 Mar 2013 02:00:30 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 05B72232; Thu, 14 Mar 2013 02:00:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2E20UeY067649; Thu, 14 Mar 2013 02:00:30 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2E20M1A066193; Thu, 14 Mar 2013 02:00:22 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303140200.r2E20M1A066193@svn.freebsd.org> From: Attilio Rao Date: Thu, 14 Mar 2013 02:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248261 - in user/attilio/vmcontention: crypto/openssh lib/libc/gen lib/libc/net lib/libusb share/man/man4 sys/dev/sound/pci/hda sys/dev/usb sys/fs/nfs sys/fs/nfsclient sys/kern sys/mod... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Mar 2013 02:00:30 -0000 Author: attilio Date: Thu Mar 14 02:00:21 2013 New Revision: 248261 URL: http://svnweb.freebsd.org/changeset/base/248261 Log: MFC Added: user/attilio/vmcontention/lib/libusb/libusb_global_linux.h - copied unchanged from r248260, head/lib/libusb/libusb_global_linux.h Modified: user/attilio/vmcontention/crypto/openssh/session.c user/attilio/vmcontention/lib/libc/gen/Makefile.inc user/attilio/vmcontention/lib/libc/gen/getcontext.3 user/attilio/vmcontention/lib/libc/net/nscachedcli.c user/attilio/vmcontention/lib/libusb/Makefile user/attilio/vmcontention/lib/libusb/libusb.h user/attilio/vmcontention/lib/libusb/libusb01.c user/attilio/vmcontention/lib/libusb/libusb10.c user/attilio/vmcontention/lib/libusb/libusb10.h user/attilio/vmcontention/lib/libusb/libusb10_desc.c user/attilio/vmcontention/lib/libusb/libusb10_io.c user/attilio/vmcontention/lib/libusb/libusb20.c user/attilio/vmcontention/lib/libusb/libusb20.h user/attilio/vmcontention/lib/libusb/libusb20_desc.c user/attilio/vmcontention/lib/libusb/libusb20_desc.h user/attilio/vmcontention/lib/libusb/libusb20_ugen20.c user/attilio/vmcontention/lib/libusb/usb.h user/attilio/vmcontention/share/man/man4/cas.4 user/attilio/vmcontention/share/man/man4/sge.4 user/attilio/vmcontention/share/man/man4/vinum.4 user/attilio/vmcontention/sys/dev/sound/pci/hda/hdaa_patches.c user/attilio/vmcontention/sys/dev/sound/pci/hda/hdac.h user/attilio/vmcontention/sys/dev/usb/usb_device.c user/attilio/vmcontention/sys/dev/usb/usb_request.c user/attilio/vmcontention/sys/fs/nfs/nfsport.h user/attilio/vmcontention/sys/fs/nfsclient/nfs_clbio.c user/attilio/vmcontention/sys/fs/nfsclient/nfs_clvnops.c user/attilio/vmcontention/sys/kern/imgact_elf.c user/attilio/vmcontention/sys/kern/kern_et.c user/attilio/vmcontention/sys/modules/ath/Makefile user/attilio/vmcontention/sys/nfsclient/nfs_bio.c user/attilio/vmcontention/sys/nfsclient/nfs_vnops.c user/attilio/vmcontention/sys/nfsclient/nfsmount.h user/attilio/vmcontention/sys/rpc/clnt_rc.c user/attilio/vmcontention/sys/rpc/clnt_vc.c user/attilio/vmcontention/usr.bin/unifdef/unifdefall.sh user/attilio/vmcontention/usr.sbin/usbconfig/usbconfig.c Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/crypto/openssh/ (props changed) user/attilio/vmcontention/lib/libc/ (props changed) user/attilio/vmcontention/share/man/man4/ (props changed) user/attilio/vmcontention/sys/ (props changed) Modified: user/attilio/vmcontention/crypto/openssh/session.c ============================================================================== --- user/attilio/vmcontention/crypto/openssh/session.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/crypto/openssh/session.c Thu Mar 14 02:00:21 2013 (r248261) @@ -1533,6 +1533,12 @@ do_setusercontext(struct passwd *pw) perror("unable to set user context (setuser)"); exit(1); } + + /* + * FreeBSD's setusercontext() will not apply the user's + * own umask setting unless running with the user's UID. + */ + setusercontext(lc, pw, pw->pw_uid, LOGIN_SETUMASK); #else /* Permanently switch to the desired uid. */ permanently_set_uid(pw); Modified: user/attilio/vmcontention/lib/libc/gen/Makefile.inc ============================================================================== --- user/attilio/vmcontention/lib/libc/gen/Makefile.inc Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libc/gen/Makefile.inc Thu Mar 14 02:00:21 2013 (r248261) @@ -361,6 +361,7 @@ MLINKS+=getcap.3 cgetcap.3 \ getcap.3 cgetstr.3 \ getcap.3 cgetustr.3 MLINKS+=getcwd.3 getwd.3 +MLINKS+=getcontext.3 getcontextx.3 MLINKS+=getcontext.3 setcontext.3 MLINKS+=getdomainname.3 setdomainname.3 MLINKS+=getfsent.3 endfsent.3 \ Modified: user/attilio/vmcontention/lib/libc/gen/getcontext.3 ============================================================================== --- user/attilio/vmcontention/lib/libc/gen/getcontext.3 Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libc/gen/getcontext.3 Thu Mar 14 02:00:21 2013 (r248261) @@ -35,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 26, 2011 +.Dd March 13, 2013 .Dt GETCONTEXT 3 .Os .Sh NAME @@ -47,6 +47,8 @@ .In ucontext.h .Ft int .Fn getcontext "ucontext_t *ucp" +.Ft ucontext_t * +.Fn getcontextx "void" .Ft int .Fn setcontext "const ucontext_t *ucp" .Sh DESCRIPTION Modified: user/attilio/vmcontention/lib/libc/net/nscachedcli.c ============================================================================== --- user/attilio/vmcontention/lib/libc/net/nscachedcli.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libc/net/nscachedcli.c Thu Mar 14 02:00:21 2013 (r248261) @@ -75,9 +75,10 @@ safe_write(struct cached_connection_ *co nevents = _kevent(connection->write_queue, NULL, 0, &eventlist, 1, &timeout); if ((nevents == 1) && (eventlist.filter == EVFILT_WRITE)) { - s_result = _write(connection->sockfd, data + result, + s_result = _sendto(connection->sockfd, data + result, eventlist.data < data_size - result ? - eventlist.data : data_size - result); + eventlist.data : data_size - result, MSG_NOSIGNAL, + NULL, 0); if (s_result == -1) return (-1); else @@ -175,8 +176,8 @@ send_credentials(struct cached_connectio nevents = _kevent(connection->write_queue, NULL, 0, &eventlist, 1, NULL); if (nevents == 1 && eventlist.filter == EVFILT_WRITE) { - result = (_sendmsg(connection->sockfd, &cred_hdr, 0) == -1) ? - -1 : 0; + result = (_sendmsg(connection->sockfd, &cred_hdr, + MSG_NOSIGNAL) == -1) ? -1 : 0; EV_SET(&eventlist, connection->sockfd, EVFILT_WRITE, EV_ADD, 0, 0, NULL); _kevent(connection->write_queue, &eventlist, 1, NULL, 0, NULL); Modified: user/attilio/vmcontention/lib/libusb/Makefile ============================================================================== --- user/attilio/vmcontention/lib/libusb/Makefile Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libusb/Makefile Thu Mar 14 02:00:21 2013 (r248261) @@ -37,6 +37,19 @@ SRCS+= libusb10_io.c CFLAGS+= -DCOMPAT_32BIT .endif +# +# Cross platform support +# +# Examples: +# make LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h +# make COMPAT_32BIT=YES LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h +# +.if defined(LIBUSB_GLOBAL_INCLUDE_FILE) +CFLAGS+= -DLIBUSB_GLOBAL_INCLUDE_FILE=\"${LIBUSB_GLOBAL_INCLUDE_FILE}\" +CFLAGS+= -DUSB_GLOBAL_INCLUDE_FILE=\"${LIBUSB_GLOBAL_INCLUDE_FILE}\" +CFLAGS+= -I ../../sys +.endif + .include # LibUSB v1.0 Modified: user/attilio/vmcontention/lib/libusb/libusb.h ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb.h Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libusb/libusb.h Thu Mar 14 02:00:21 2013 (r248261) @@ -27,8 +27,11 @@ #ifndef __LIBUSB_H__ #define __LIBUSB_H__ +#ifndef LIBUSB_GLOBAL_INCLUDE_FILE +#include #include #include +#endif #ifdef __cplusplus extern "C" { Modified: user/attilio/vmcontention/lib/libusb/libusb01.c ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb01.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libusb/libusb01.c Thu Mar 14 02:00:21 2013 (r248261) @@ -28,11 +28,16 @@ * This file contains the emulation layer for LibUSB v0.1 from sourceforge. */ -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include #include +#include +#include +#include +#endif #include "libusb20.h" #include "libusb20_desc.h" Modified: user/attilio/vmcontention/lib/libusb/libusb10.c ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb10.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libusb/libusb10.c Thu Mar 14 02:00:21 2013 (r248261) @@ -25,17 +25,23 @@ * SUCH DAMAGE. */ -#include -#include -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include #include #include #include #include +#include #include +#include +#include +#include +#include +#include +#endif #define libusb_device_handle libusb20_device @@ -1331,7 +1337,7 @@ failure: /* make sure our event loop spins the done handler */ dummy = 0; - write(dev->ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); + err = write(dev->ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); } /* The following function must be called unlocked */ Modified: user/attilio/vmcontention/lib/libusb/libusb10.h ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb10.h Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libusb/libusb10.h Thu Mar 14 02:00:21 2013 (r248261) @@ -27,7 +27,9 @@ #ifndef __LIBUSB10_H__ #define __LIBUSB10_H__ +#ifndef LIBUSB_GLOBAL_INCLUDE_FILE #include +#endif #define GET_CONTEXT(ctx) (((ctx) == NULL) ? usbi_default_context : (ctx)) #define UNEXPORTED __attribute__((__visibility__("hidden"))) Modified: user/attilio/vmcontention/lib/libusb/libusb10_desc.c ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb10_desc.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libusb/libusb10_desc.c Thu Mar 14 02:00:21 2013 (r248261) @@ -24,10 +24,15 @@ * SUCH DAMAGE. */ -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include +#include +#include +#include +#endif #define libusb_device_handle libusb20_device Modified: user/attilio/vmcontention/lib/libusb/libusb10_io.c ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb10_io.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libusb/libusb10_io.c Thu Mar 14 02:00:21 2013 (r248261) @@ -24,15 +24,20 @@ * SUCH DAMAGE. */ -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include #include #include #include +#include #include #include +#include +#include +#endif #define libusb_device_handle libusb20_device Modified: user/attilio/vmcontention/lib/libusb/libusb20.c ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb20.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libusb/libusb20.c Thu Mar 14 02:00:21 2013 (r248261) @@ -24,13 +24,17 @@ * SUCH DAMAGE. */ -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include #include #include #include +#include +#include +#endif #include "libusb20.h" #include "libusb20_desc.h" Modified: user/attilio/vmcontention/lib/libusb/libusb20.h ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb20.h Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libusb/libusb20.h Thu Mar 14 02:00:21 2013 (r248261) @@ -29,13 +29,9 @@ #ifndef _LIBUSB20_H_ #define _LIBUSB20_H_ -#include -#include -#include - +#ifndef LIBUSB_GLOBAL_INCLUDE_FILE #include -#include -#include +#endif #ifdef __cplusplus extern "C" { Modified: user/attilio/vmcontention/lib/libusb/libusb20_desc.c ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb20_desc.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libusb/libusb20_desc.c Thu Mar 14 02:00:21 2013 (r248261) @@ -24,11 +24,15 @@ * SUCH DAMAGE. */ -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include #include +#include +#include +#endif #include "libusb20.h" #include "libusb20_desc.h" Modified: user/attilio/vmcontention/lib/libusb/libusb20_desc.h ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb20_desc.h Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libusb/libusb20_desc.h Thu Mar 14 02:00:21 2013 (r248261) @@ -45,6 +45,10 @@ #ifndef _LIBUSB20_DESC_H_ #define _LIBUSB20_DESC_H_ +#ifndef LIBUSB_GLOBAL_INCLUDE_FILE +#include +#endif + #ifdef __cplusplus extern "C" { #endif Modified: user/attilio/vmcontention/lib/libusb/libusb20_ugen20.c ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb20_ugen20.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libusb/libusb20_ugen20.c Thu Mar 14 02:00:21 2013 (r248261) @@ -24,24 +24,28 @@ * SUCH DAMAGE. */ -#include -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include #include #include #include #include - -#include "libusb20.h" -#include "libusb20_desc.h" -#include "libusb20_int.h" +#include +#include +#include +#endif #include #include #include +#include "libusb20.h" +#include "libusb20_desc.h" +#include "libusb20_int.h" + static libusb20_init_backend_t ugen20_init_backend; static libusb20_open_device_t ugen20_open_device; static libusb20_close_device_t ugen20_close_device; Copied: user/attilio/vmcontention/lib/libusb/libusb_global_linux.h (from r248260, head/lib/libusb/libusb_global_linux.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmcontention/lib/libusb/libusb_global_linux.h Thu Mar 14 02:00:21 2013 (r248261, copy of r248260, head/lib/libusb/libusb_global_linux.h) @@ -0,0 +1,69 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2013 Hans Petter Selasky. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUSB_GLOBAL_LINUX_H_ +#define _LIBUSB_GLOBAL_LINUX_H_ + +#define _XOPEN_SOURCE +#define _BSD_SOURCE +#define _POSIX_SOURCE +#define _POSIX_C_SOURCE 200809 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef __aligned +#define __aligned(x) __attribute__((__aligned__(x))) +#endif + +#ifndef __packed +#define __packed __attribute__((__packed__)) +#endif + +#ifndef strlcpy +#define strlcpy(d,s,len) do { \ + strncpy(d,s,len); \ + ((char *)d)[(len) - 1] = 0; \ +} while (0) +#endif + +#endif /* _LIBUSB_GLOBAL_LINUX_H_ */ Modified: user/attilio/vmcontention/lib/libusb/usb.h ============================================================================== --- user/attilio/vmcontention/lib/libusb/usb.h Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/lib/libusb/usb.h Thu Mar 14 02:00:21 2013 (r248261) @@ -27,10 +27,11 @@ #ifndef _LIBUSB20_COMPAT_01_H_ #define _LIBUSB20_COMPAT_01_H_ +#ifndef LIBUSB_GLOBAL_INCLUDE_FILE +#include #include #include - -#include +#endif /* USB interface class codes */ Modified: user/attilio/vmcontention/share/man/man4/cas.4 ============================================================================== --- user/attilio/vmcontention/share/man/man4/cas.4 Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/share/man/man4/cas.4 Thu Mar 14 02:00:21 2013 (r248261) @@ -44,7 +44,7 @@ Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -if_cas="YES" +if_cas_load="YES" .Ed .Sh DESCRIPTION The Modified: user/attilio/vmcontention/share/man/man4/sge.4 ============================================================================== --- user/attilio/vmcontention/share/man/man4/sge.4 Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/share/man/man4/sge.4 Thu Mar 14 02:00:21 2013 (r248261) @@ -43,7 +43,7 @@ Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -if_sge="YES" +if_sge_load="YES" .Ed .Sh DESCRIPTION The Modified: user/attilio/vmcontention/share/man/man4/vinum.4 ============================================================================== --- user/attilio/vmcontention/share/man/man4/vinum.4 Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/share/man/man4/vinum.4 Thu Mar 14 02:00:21 2013 (r248261) @@ -36,7 +36,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 16, 2002 +.Dd March 13, 2013 .Dt VINUM 4 .Os .Sh NAME @@ -856,9 +856,6 @@ for its NetMAX product. .Sh AUTHORS .An Greg Lehey Aq grog@lemis.com . .Sh BUGS -.Nm -is a new product. -Bugs can be expected. The configuration mechanism is not yet fully functional. If you have difficulties, please look at the section @@ -876,8 +873,6 @@ kernel and test with the KLD module. Detection of differences between the version of the kernel and the KLD is not yet implemented. .Pp -The RAID-5 functionality is new in -.Fx 3.3 . Some problems have been reported with .Nm Modified: user/attilio/vmcontention/sys/dev/sound/pci/hda/hdaa_patches.c ============================================================================== --- user/attilio/vmcontention/sys/dev/sound/pci/hda/hdaa_patches.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/dev/sound/pci/hda/hdaa_patches.c Thu Mar 14 02:00:21 2013 (r248261) @@ -346,7 +346,8 @@ hdac_pin_patch(struct hdaa_widget *w) } else if (id == HDA_CODEC_ALC269 && (subid == LENOVO_X1CRBN_SUBVENDOR || subid == LENOVO_T430_SUBVENDOR || - subid == LENOVO_T430S_SUBVENDOR)) { + subid == LENOVO_T430S_SUBVENDOR || + subid == LENOVO_T530_SUBVENDOR)) { switch (nid) { case 21: patch = "as=1 seq=15"; Modified: user/attilio/vmcontention/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- user/attilio/vmcontention/sys/dev/sound/pci/hda/hdac.h Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/dev/sound/pci/hda/hdac.h Thu Mar 14 02:00:21 2013 (r248261) @@ -228,6 +228,7 @@ #define LENOVO_T430_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f3) #define LENOVO_T430S_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb) #define LENOVO_T520_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21cf) +#define LENOVO_T530_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f6) #define LENOVO_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0xffff) /* Samsung */ Modified: user/attilio/vmcontention/sys/dev/usb/usb_device.c ============================================================================== --- user/attilio/vmcontention/sys/dev/usb/usb_device.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/dev/usb/usb_device.c Thu Mar 14 02:00:21 2013 (r248261) @@ -1698,10 +1698,14 @@ usb_alloc_device(device_t parent_dev, st err = usbd_setup_device_desc(udev, NULL); if (err != 0) { - /* XXX try to re-enumerate the device */ + /* try to enumerate two more times */ err = usbd_req_re_enumerate(udev, NULL); - if (err) - goto done; + if (err != 0) { + err = usbd_req_re_enumerate(udev, NULL); + if (err != 0) { + goto done; + } + } } /* Modified: user/attilio/vmcontention/sys/dev/usb/usb_request.c ============================================================================== --- user/attilio/vmcontention/sys/dev/usb/usb_request.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/dev/usb/usb_request.c Thu Mar 14 02:00:21 2013 (r248261) @@ -76,6 +76,11 @@ static int usb_no_cs_fail; SYSCTL_INT(_hw_usb, OID_AUTO, no_cs_fail, CTLFLAG_RW, &usb_no_cs_fail, 0, "USB clear stall failures are ignored, if set"); +static int usb_full_ddesc; + +SYSCTL_INT(_hw_usb, OID_AUTO, full_ddesc, CTLFLAG_RW, + &usb_full_ddesc, 0, "USB always read complete device descriptor, if set"); + #ifdef USB_DEBUG #ifdef USB_REQ_DEBUG /* The following structures are used in connection to fault injection. */ @@ -1002,7 +1007,7 @@ usbd_req_get_desc(struct usb_device *ude USETW(req.wLength, min_len); err = usbd_do_request_flags(udev, mtx, &req, - desc, 0, NULL, 1000); + desc, 0, NULL, 500 /* ms */); if (err) { if (!retries) { @@ -1887,32 +1892,41 @@ usbd_setup_device_desc(struct usb_device */ switch (udev->speed) { case USB_SPEED_FULL: - case USB_SPEED_LOW: + if (usb_full_ddesc != 0) { + /* get full device descriptor */ + err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); + if (err == 0) + break; + } + + /* get partial device descriptor, some devices crash on this */ err = usbd_req_get_desc(udev, mtx, NULL, &udev->ddesc, USB_MAX_IPACKET, USB_MAX_IPACKET, 0, UDESC_DEVICE, 0, 0); - if (err != 0) { - DPRINTFN(0, "getting device descriptor " - "at addr %d failed, %s\n", udev->address, - usbd_errstr(err)); - return (err); - } - break; - default: - DPRINTF("Minimum MaxPacketSize is large enough " - "to hold the complete device descriptor\n"); + if (err != 0) + break; + + /* get the full device descriptor */ + err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); break; - } - /* get the full device descriptor */ - err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); + default: + DPRINTF("Minimum bMaxPacketSize is large enough " + "to hold the complete device descriptor or " + "only one bMaxPacketSize choice\n"); - /* try one more time, if error */ - if (err) + /* get the full device descriptor */ err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); - if (err) { - DPRINTF("addr=%d, getting full desc failed\n", - udev->address); + /* try one more time, if error */ + if (err != 0) + err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); + break; + } + + if (err != 0) { + DPRINTFN(0, "getting device descriptor " + "at addr %d failed, %s\n", udev->address, + usbd_errstr(err)); return (err); } Modified: user/attilio/vmcontention/sys/fs/nfs/nfsport.h ============================================================================== --- user/attilio/vmcontention/sys/fs/nfs/nfsport.h Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/fs/nfs/nfsport.h Thu Mar 14 02:00:21 2013 (r248261) @@ -981,13 +981,6 @@ struct nfsreq { #define NFSVNO_DELEGOK(v) (1) #endif -/* - * Define this as the flags argument for msleep() when catching signals - * while holding a resource that other threads would block for, such as - * a vnode lock. - */ -#define NFS_PCATCH (PCATCH | PBDRY) - #endif /* _KERNEL */ #endif /* _NFS_NFSPORT_H */ Modified: user/attilio/vmcontention/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- user/attilio/vmcontention/sys/fs/nfsclient/nfs_clbio.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/fs/nfsclient/nfs_clbio.c Thu Mar 14 02:00:21 2013 (r248261) @@ -1297,7 +1297,7 @@ nfs_getcacheblk(struct vnode *vp, daddr_ sigset_t oldset; newnfs_set_sigmask(td, &oldset); - bp = getblk(vp, bn, size, NFS_PCATCH, 0, 0); + bp = getblk(vp, bn, size, PCATCH, 0, 0); newnfs_restore_sigmask(td, &oldset); while (bp == NULL) { if (newnfs_sigintr(nmp, td)) @@ -1332,7 +1332,7 @@ ncl_vinvalbuf(struct vnode *vp, int flag if ((nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF)) intrflg = 1; if (intrflg) { - slpflag = NFS_PCATCH; + slpflag = PCATCH; slptimeo = 2 * hz; } else { slpflag = 0; @@ -1413,7 +1413,7 @@ ncl_asyncio(struct nfsmount *nmp, struct } again: if (nmp->nm_flag & NFSMNT_INT) - slpflag = NFS_PCATCH; + slpflag = PCATCH; gotiod = FALSE; /* @@ -1478,7 +1478,7 @@ again: mtx_unlock(&ncl_iod_mutex); return (error2); } - if (slpflag == NFS_PCATCH) { + if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; } Modified: user/attilio/vmcontention/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- user/attilio/vmcontention/sys/fs/nfsclient/nfs_clvnops.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/fs/nfsclient/nfs_clvnops.c Thu Mar 14 02:00:21 2013 (r248261) @@ -2660,7 +2660,7 @@ ncl_flush(struct vnode *vp, int waitfor, if (called_from_renewthread != 0) slptimeo = hz; if (nmp->nm_flag & NFSMNT_INT) - slpflag = NFS_PCATCH; + slpflag = PCATCH; if (!commit) passone = 0; bo = &vp->v_bufobj; @@ -2866,7 +2866,7 @@ loop: error = EINTR; goto done; } - if (slpflag & PCATCH) { + if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; } @@ -2912,7 +2912,7 @@ loop: error = newnfs_sigintr(nmp, td); if (error) goto done; - if (slpflag & PCATCH) { + if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; } Modified: user/attilio/vmcontention/sys/kern/imgact_elf.c ============================================================================== --- user/attilio/vmcontention/sys/kern/imgact_elf.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/kern/imgact_elf.c Thu Mar 14 02:00:21 2013 (r248261) @@ -661,9 +661,8 @@ __elfN(load_file)(struct proc *p, const } /* Only support headers that fit within first page for now */ - /* (multiplication of two Elf_Half fields will not overflow) */ if ((hdr->e_phoff > PAGE_SIZE) || - (hdr->e_phentsize * hdr->e_phnum) > PAGE_SIZE - hdr->e_phoff) { + (u_int)hdr->e_phentsize * hdr->e_phnum > PAGE_SIZE - hdr->e_phoff) { error = ENOEXEC; goto fail; } @@ -743,7 +742,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i */ if ((hdr->e_phoff > PAGE_SIZE) || - (hdr->e_phoff + hdr->e_phentsize * hdr->e_phnum) > PAGE_SIZE) { + (u_int)hdr->e_phentsize * hdr->e_phnum > PAGE_SIZE - hdr->e_phoff) { /* Only support headers in first page for now */ return (ENOEXEC); } @@ -762,8 +761,8 @@ __CONCAT(exec_, __elfN(imgact))(struct i case PT_INTERP: /* Path to interpreter */ if (phdr[i].p_filesz > MAXPATHLEN || - phdr[i].p_offset >= PAGE_SIZE || - phdr[i].p_offset + phdr[i].p_filesz >= PAGE_SIZE) + phdr[i].p_offset > PAGE_SIZE || + phdr[i].p_filesz > PAGE_SIZE - phdr[i].p_offset) return (ENOEXEC); interp = imgp->image_header + phdr[i].p_offset; interp_name_len = phdr[i].p_filesz; @@ -1553,9 +1552,8 @@ __elfN(parse_notes)(struct image_params const char *note_name; int i; - if (pnote == NULL || pnote->p_offset >= PAGE_SIZE || - pnote->p_filesz > PAGE_SIZE || - pnote->p_offset + pnote->p_filesz >= PAGE_SIZE) + if (pnote == NULL || pnote->p_offset > PAGE_SIZE || + pnote->p_filesz > PAGE_SIZE - pnote->p_offset) return (FALSE); note = note0 = (const Elf_Note *)(imgp->image_header + pnote->p_offset); Modified: user/attilio/vmcontention/sys/kern/kern_et.c ============================================================================== --- user/attilio/vmcontention/sys/kern/kern_et.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/kern/kern_et.c Thu Mar 14 02:00:21 2013 (r248261) @@ -168,7 +168,7 @@ et_start(struct eventtimer *et, sbintime KASSERT(period >= 0, ("et_start: negative period")); KASSERT((et->et_flags & ET_FLAGS_PERIODIC) || period == 0, ("et_start: period specified for oneshot-only timer")); - KASSERT((et->et_flags & ET_FLAGS_ONESHOT) && period == 0, + KASSERT((et->et_flags & ET_FLAGS_ONESHOT) || period != 0, ("et_start: period not specified for periodic-only timer")); if (period != 0) { if (period < et->et_min_period) Modified: user/attilio/vmcontention/sys/modules/ath/Makefile ============================================================================== --- user/attilio/vmcontention/sys/modules/ath/Makefile Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/modules/ath/Makefile Thu Mar 14 02:00:21 2013 (r248261) @@ -162,3 +162,7 @@ CWARNFLAGS.ah_regdomain.c= ${NO_WSHIFT_C # XXX Work around clang warnings, until maintainer approves fix. CWARNFLAGS.if_ath.c= ${NO_WSOMETIMES_UNINITIALIZED} CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} + +# AR9300 HAL build overrides, as there's still some code to tidy up +#CWARNFLAGS.ar9300_eeprom.c= ${NO_WCONSTANT_CONVERSION} +#CWARNFLAGS.ar9300_reset.c= ${NO_WSOMETIMES_UNINITIALIZED} Modified: user/attilio/vmcontention/sys/nfsclient/nfs_bio.c ============================================================================== --- user/attilio/vmcontention/sys/nfsclient/nfs_bio.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/nfsclient/nfs_bio.c Thu Mar 14 02:00:21 2013 (r248261) @@ -1242,7 +1242,7 @@ nfs_getcacheblk(struct vnode *vp, daddr_ sigset_t oldset; nfs_set_sigmask(td, &oldset); - bp = getblk(vp, bn, size, NFS_PCATCH, 0, 0); + bp = getblk(vp, bn, size, PCATCH, 0, 0); nfs_restore_sigmask(td, &oldset); while (bp == NULL) { if (nfs_sigintr(nmp, td)) @@ -1275,7 +1275,7 @@ nfs_vinvalbuf(struct vnode *vp, int flag if ((nmp->nm_flag & NFSMNT_INT) == 0) intrflg = 0; if (intrflg) { - slpflag = NFS_PCATCH; + slpflag = PCATCH; slptimeo = 2 * hz; } else { slpflag = 0; @@ -1354,7 +1354,7 @@ nfs_asyncio(struct nfsmount *nmp, struct } again: if (nmp->nm_flag & NFSMNT_INT) - slpflag = NFS_PCATCH; + slpflag = PCATCH; gotiod = FALSE; /* @@ -1419,7 +1419,7 @@ again: mtx_unlock(&nfs_iod_mtx); return (error2); } - if (slpflag == NFS_PCATCH) { + if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; } Modified: user/attilio/vmcontention/sys/nfsclient/nfs_vnops.c ============================================================================== --- user/attilio/vmcontention/sys/nfsclient/nfs_vnops.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/nfsclient/nfs_vnops.c Thu Mar 14 02:00:21 2013 (r248261) @@ -2992,7 +2992,7 @@ nfs_flush(struct vnode *vp, int waitfor, int bvecsize = 0, bveccount; if (nmp->nm_flag & NFSMNT_INT) - slpflag = NFS_PCATCH; + slpflag = PCATCH; if (!commit) passone = 0; bo = &vp->v_bufobj; @@ -3190,7 +3190,7 @@ loop: error = EINTR; goto done; } - if (slpflag & PCATCH) { + if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; } @@ -3228,7 +3228,7 @@ loop: error = nfs_sigintr(nmp, td); if (error) goto done; - if (slpflag & PCATCH) { + if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; } Modified: user/attilio/vmcontention/sys/nfsclient/nfsmount.h ============================================================================== --- user/attilio/vmcontention/sys/nfsclient/nfsmount.h Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/nfsclient/nfsmount.h Thu Mar 14 02:00:21 2013 (r248261) @@ -125,8 +125,6 @@ struct nfsmount { #define NFS_DEFAULT_NEGNAMETIMEO 60 #endif -#define NFS_PCATCH (PCATCH | PBDRY) - #endif #endif Modified: user/attilio/vmcontention/sys/rpc/clnt_rc.c ============================================================================== --- user/attilio/vmcontention/sys/rpc/clnt_rc.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/rpc/clnt_rc.c Thu Mar 14 02:00:21 2013 (r248261) @@ -247,8 +247,7 @@ clnt_reconnect_call( stat = clnt_reconnect_connect(cl); if (stat == RPC_SYSTEMERROR) { error = tsleep(&fake_wchan, - rc->rc_intr ? PCATCH | PBDRY : 0, "rpccon", - hz); + rc->rc_intr ? PCATCH : 0, "rpccon", hz); if (error == EINTR || error == ERESTART) return (RPC_INTR); tries++; Modified: user/attilio/vmcontention/sys/rpc/clnt_vc.c ============================================================================== --- user/attilio/vmcontention/sys/rpc/clnt_vc.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/sys/rpc/clnt_vc.c Thu Mar 14 02:00:21 2013 (r248261) @@ -162,7 +162,7 @@ clnt_vc_create( interrupted = 0; sleep_flag = PSOCK; if (intrflag != 0) - sleep_flag |= (PCATCH | PBDRY); + sleep_flag |= PCATCH; while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { error = msleep(&so->so_timeo, SOCK_MTX(so), @@ -470,7 +470,6 @@ call_again: errp->re_errno = error; switch (error) { case EINTR: - case ERESTART: stat = RPC_INTR; break; case EWOULDBLOCK: @@ -704,7 +703,7 @@ clnt_vc_control(CLIENT *cl, u_int reques case CLSET_INTERRUPTIBLE: if (*(int *) info) - ct->ct_waitflag = PCATCH | PBDRY; + ct->ct_waitflag = PCATCH; else ct->ct_waitflag = 0; break; Modified: user/attilio/vmcontention/usr.bin/unifdef/unifdefall.sh ============================================================================== --- user/attilio/vmcontention/usr.bin/unifdef/unifdefall.sh Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/usr.bin/unifdef/unifdefall.sh Thu Mar 14 02:00:21 2013 (r248261) @@ -42,8 +42,7 @@ case "$@" in shift esac -basename=$(basename "$0") -tmp=$(mktemp -d "${TMPDIR:-/tmp}/$basename.XXXXXXXXXX") || exit 2 +tmp=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXXXXXX") || exit 2 trap 'rm -r "$tmp" || exit 2' EXIT export LC_ALL=C Modified: user/attilio/vmcontention/usr.sbin/usbconfig/usbconfig.c ============================================================================== --- user/attilio/vmcontention/usr.sbin/usbconfig/usbconfig.c Thu Mar 14 01:53:32 2013 (r248260) +++ user/attilio/vmcontention/usr.sbin/usbconfig/usbconfig.c Thu Mar 14 02:00:21 2013 (r248261) @@ -33,6 +33,7 @@ #include #include #include +#include #include #include From owner-svn-src-user@FreeBSD.ORG Thu Mar 14 02:03:41 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7E3BB852; Thu, 14 Mar 2013 02:03:41 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4DDC026B; Thu, 14 Mar 2013 02:03:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2E23f9h068388; Thu, 14 Mar 2013 02:03:41 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2E23XlO068329; Thu, 14 Mar 2013 02:03:33 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303140203.r2E23XlO068329@svn.freebsd.org> From: Attilio Rao Date: Thu, 14 Mar 2013 02:03:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248262 - in user/attilio/vmobj-readlock: crypto/openssh lib/libc/gen lib/libc/net lib/libusb share/man/man4 sys/dev/sound/pci/hda sys/dev/usb sys/fs/nfs sys/fs/nfsclient sys/kern sys/m... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Mar 2013 02:03:41 -0000 Author: attilio Date: Thu Mar 14 02:03:33 2013 New Revision: 248262 URL: http://svnweb.freebsd.org/changeset/base/248262 Log: Merge from vmcontention Added: user/attilio/vmobj-readlock/lib/libusb/libusb_global_linux.h - copied unchanged from r248261, user/attilio/vmcontention/lib/libusb/libusb_global_linux.h Modified: user/attilio/vmobj-readlock/crypto/openssh/session.c user/attilio/vmobj-readlock/lib/libc/gen/Makefile.inc user/attilio/vmobj-readlock/lib/libc/gen/getcontext.3 user/attilio/vmobj-readlock/lib/libc/net/nscachedcli.c user/attilio/vmobj-readlock/lib/libusb/Makefile user/attilio/vmobj-readlock/lib/libusb/libusb.h user/attilio/vmobj-readlock/lib/libusb/libusb01.c user/attilio/vmobj-readlock/lib/libusb/libusb10.c user/attilio/vmobj-readlock/lib/libusb/libusb10.h user/attilio/vmobj-readlock/lib/libusb/libusb10_desc.c user/attilio/vmobj-readlock/lib/libusb/libusb10_io.c user/attilio/vmobj-readlock/lib/libusb/libusb20.c user/attilio/vmobj-readlock/lib/libusb/libusb20.h user/attilio/vmobj-readlock/lib/libusb/libusb20_desc.c user/attilio/vmobj-readlock/lib/libusb/libusb20_desc.h user/attilio/vmobj-readlock/lib/libusb/libusb20_ugen20.c user/attilio/vmobj-readlock/lib/libusb/usb.h user/attilio/vmobj-readlock/share/man/man4/cas.4 user/attilio/vmobj-readlock/share/man/man4/sge.4 user/attilio/vmobj-readlock/share/man/man4/vinum.4 user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdaa_patches.c user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdac.h user/attilio/vmobj-readlock/sys/dev/usb/usb_device.c user/attilio/vmobj-readlock/sys/dev/usb/usb_request.c user/attilio/vmobj-readlock/sys/fs/nfs/nfsport.h user/attilio/vmobj-readlock/sys/fs/nfsclient/nfs_clbio.c user/attilio/vmobj-readlock/sys/fs/nfsclient/nfs_clvnops.c user/attilio/vmobj-readlock/sys/kern/imgact_elf.c user/attilio/vmobj-readlock/sys/kern/kern_et.c user/attilio/vmobj-readlock/sys/modules/ath/Makefile user/attilio/vmobj-readlock/sys/nfsclient/nfs_bio.c user/attilio/vmobj-readlock/sys/nfsclient/nfs_vnops.c user/attilio/vmobj-readlock/sys/nfsclient/nfsmount.h user/attilio/vmobj-readlock/sys/rpc/clnt_rc.c user/attilio/vmobj-readlock/sys/rpc/clnt_vc.c user/attilio/vmobj-readlock/usr.bin/unifdef/unifdefall.sh user/attilio/vmobj-readlock/usr.sbin/usbconfig/usbconfig.c Directory Properties: user/attilio/vmobj-readlock/ (props changed) user/attilio/vmobj-readlock/crypto/openssh/ (props changed) user/attilio/vmobj-readlock/lib/libc/ (props changed) user/attilio/vmobj-readlock/share/man/man4/ (props changed) user/attilio/vmobj-readlock/sys/ (props changed) Modified: user/attilio/vmobj-readlock/crypto/openssh/session.c ============================================================================== --- user/attilio/vmobj-readlock/crypto/openssh/session.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/crypto/openssh/session.c Thu Mar 14 02:03:33 2013 (r248262) @@ -1533,6 +1533,12 @@ do_setusercontext(struct passwd *pw) perror("unable to set user context (setuser)"); exit(1); } + + /* + * FreeBSD's setusercontext() will not apply the user's + * own umask setting unless running with the user's UID. + */ + setusercontext(lc, pw, pw->pw_uid, LOGIN_SETUMASK); #else /* Permanently switch to the desired uid. */ permanently_set_uid(pw); Modified: user/attilio/vmobj-readlock/lib/libc/gen/Makefile.inc ============================================================================== --- user/attilio/vmobj-readlock/lib/libc/gen/Makefile.inc Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libc/gen/Makefile.inc Thu Mar 14 02:03:33 2013 (r248262) @@ -361,6 +361,7 @@ MLINKS+=getcap.3 cgetcap.3 \ getcap.3 cgetstr.3 \ getcap.3 cgetustr.3 MLINKS+=getcwd.3 getwd.3 +MLINKS+=getcontext.3 getcontextx.3 MLINKS+=getcontext.3 setcontext.3 MLINKS+=getdomainname.3 setdomainname.3 MLINKS+=getfsent.3 endfsent.3 \ Modified: user/attilio/vmobj-readlock/lib/libc/gen/getcontext.3 ============================================================================== --- user/attilio/vmobj-readlock/lib/libc/gen/getcontext.3 Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libc/gen/getcontext.3 Thu Mar 14 02:03:33 2013 (r248262) @@ -35,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 26, 2011 +.Dd March 13, 2013 .Dt GETCONTEXT 3 .Os .Sh NAME @@ -47,6 +47,8 @@ .In ucontext.h .Ft int .Fn getcontext "ucontext_t *ucp" +.Ft ucontext_t * +.Fn getcontextx "void" .Ft int .Fn setcontext "const ucontext_t *ucp" .Sh DESCRIPTION Modified: user/attilio/vmobj-readlock/lib/libc/net/nscachedcli.c ============================================================================== --- user/attilio/vmobj-readlock/lib/libc/net/nscachedcli.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libc/net/nscachedcli.c Thu Mar 14 02:03:33 2013 (r248262) @@ -75,9 +75,10 @@ safe_write(struct cached_connection_ *co nevents = _kevent(connection->write_queue, NULL, 0, &eventlist, 1, &timeout); if ((nevents == 1) && (eventlist.filter == EVFILT_WRITE)) { - s_result = _write(connection->sockfd, data + result, + s_result = _sendto(connection->sockfd, data + result, eventlist.data < data_size - result ? - eventlist.data : data_size - result); + eventlist.data : data_size - result, MSG_NOSIGNAL, + NULL, 0); if (s_result == -1) return (-1); else @@ -175,8 +176,8 @@ send_credentials(struct cached_connectio nevents = _kevent(connection->write_queue, NULL, 0, &eventlist, 1, NULL); if (nevents == 1 && eventlist.filter == EVFILT_WRITE) { - result = (_sendmsg(connection->sockfd, &cred_hdr, 0) == -1) ? - -1 : 0; + result = (_sendmsg(connection->sockfd, &cred_hdr, + MSG_NOSIGNAL) == -1) ? -1 : 0; EV_SET(&eventlist, connection->sockfd, EVFILT_WRITE, EV_ADD, 0, 0, NULL); _kevent(connection->write_queue, &eventlist, 1, NULL, 0, NULL); Modified: user/attilio/vmobj-readlock/lib/libusb/Makefile ============================================================================== --- user/attilio/vmobj-readlock/lib/libusb/Makefile Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libusb/Makefile Thu Mar 14 02:03:33 2013 (r248262) @@ -37,6 +37,19 @@ SRCS+= libusb10_io.c CFLAGS+= -DCOMPAT_32BIT .endif +# +# Cross platform support +# +# Examples: +# make LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h +# make COMPAT_32BIT=YES LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h +# +.if defined(LIBUSB_GLOBAL_INCLUDE_FILE) +CFLAGS+= -DLIBUSB_GLOBAL_INCLUDE_FILE=\"${LIBUSB_GLOBAL_INCLUDE_FILE}\" +CFLAGS+= -DUSB_GLOBAL_INCLUDE_FILE=\"${LIBUSB_GLOBAL_INCLUDE_FILE}\" +CFLAGS+= -I ../../sys +.endif + .include # LibUSB v1.0 Modified: user/attilio/vmobj-readlock/lib/libusb/libusb.h ============================================================================== --- user/attilio/vmobj-readlock/lib/libusb/libusb.h Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libusb/libusb.h Thu Mar 14 02:03:33 2013 (r248262) @@ -27,8 +27,11 @@ #ifndef __LIBUSB_H__ #define __LIBUSB_H__ +#ifndef LIBUSB_GLOBAL_INCLUDE_FILE +#include #include #include +#endif #ifdef __cplusplus extern "C" { Modified: user/attilio/vmobj-readlock/lib/libusb/libusb01.c ============================================================================== --- user/attilio/vmobj-readlock/lib/libusb/libusb01.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libusb/libusb01.c Thu Mar 14 02:03:33 2013 (r248262) @@ -28,11 +28,16 @@ * This file contains the emulation layer for LibUSB v0.1 from sourceforge. */ -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include #include +#include +#include +#include +#endif #include "libusb20.h" #include "libusb20_desc.h" Modified: user/attilio/vmobj-readlock/lib/libusb/libusb10.c ============================================================================== --- user/attilio/vmobj-readlock/lib/libusb/libusb10.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libusb/libusb10.c Thu Mar 14 02:03:33 2013 (r248262) @@ -25,17 +25,23 @@ * SUCH DAMAGE. */ -#include -#include -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include #include #include #include #include +#include #include +#include +#include +#include +#include +#include +#endif #define libusb_device_handle libusb20_device @@ -1331,7 +1337,7 @@ failure: /* make sure our event loop spins the done handler */ dummy = 0; - write(dev->ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); + err = write(dev->ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); } /* The following function must be called unlocked */ Modified: user/attilio/vmobj-readlock/lib/libusb/libusb10.h ============================================================================== --- user/attilio/vmobj-readlock/lib/libusb/libusb10.h Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libusb/libusb10.h Thu Mar 14 02:03:33 2013 (r248262) @@ -27,7 +27,9 @@ #ifndef __LIBUSB10_H__ #define __LIBUSB10_H__ +#ifndef LIBUSB_GLOBAL_INCLUDE_FILE #include +#endif #define GET_CONTEXT(ctx) (((ctx) == NULL) ? usbi_default_context : (ctx)) #define UNEXPORTED __attribute__((__visibility__("hidden"))) Modified: user/attilio/vmobj-readlock/lib/libusb/libusb10_desc.c ============================================================================== --- user/attilio/vmobj-readlock/lib/libusb/libusb10_desc.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libusb/libusb10_desc.c Thu Mar 14 02:03:33 2013 (r248262) @@ -24,10 +24,15 @@ * SUCH DAMAGE. */ -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include +#include +#include +#include +#endif #define libusb_device_handle libusb20_device Modified: user/attilio/vmobj-readlock/lib/libusb/libusb10_io.c ============================================================================== --- user/attilio/vmobj-readlock/lib/libusb/libusb10_io.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libusb/libusb10_io.c Thu Mar 14 02:03:33 2013 (r248262) @@ -24,15 +24,20 @@ * SUCH DAMAGE. */ -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include #include #include #include +#include #include #include +#include +#include +#endif #define libusb_device_handle libusb20_device Modified: user/attilio/vmobj-readlock/lib/libusb/libusb20.c ============================================================================== --- user/attilio/vmobj-readlock/lib/libusb/libusb20.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libusb/libusb20.c Thu Mar 14 02:03:33 2013 (r248262) @@ -24,13 +24,17 @@ * SUCH DAMAGE. */ -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include #include #include #include +#include +#include +#endif #include "libusb20.h" #include "libusb20_desc.h" Modified: user/attilio/vmobj-readlock/lib/libusb/libusb20.h ============================================================================== --- user/attilio/vmobj-readlock/lib/libusb/libusb20.h Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libusb/libusb20.h Thu Mar 14 02:03:33 2013 (r248262) @@ -29,13 +29,9 @@ #ifndef _LIBUSB20_H_ #define _LIBUSB20_H_ -#include -#include -#include - +#ifndef LIBUSB_GLOBAL_INCLUDE_FILE #include -#include -#include +#endif #ifdef __cplusplus extern "C" { Modified: user/attilio/vmobj-readlock/lib/libusb/libusb20_desc.c ============================================================================== --- user/attilio/vmobj-readlock/lib/libusb/libusb20_desc.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libusb/libusb20_desc.c Thu Mar 14 02:03:33 2013 (r248262) @@ -24,11 +24,15 @@ * SUCH DAMAGE. */ -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include #include +#include +#include +#endif #include "libusb20.h" #include "libusb20_desc.h" Modified: user/attilio/vmobj-readlock/lib/libusb/libusb20_desc.h ============================================================================== --- user/attilio/vmobj-readlock/lib/libusb/libusb20_desc.h Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libusb/libusb20_desc.h Thu Mar 14 02:03:33 2013 (r248262) @@ -45,6 +45,10 @@ #ifndef _LIBUSB20_DESC_H_ #define _LIBUSB20_DESC_H_ +#ifndef LIBUSB_GLOBAL_INCLUDE_FILE +#include +#endif + #ifdef __cplusplus extern "C" { #endif Modified: user/attilio/vmobj-readlock/lib/libusb/libusb20_ugen20.c ============================================================================== --- user/attilio/vmobj-readlock/lib/libusb/libusb20_ugen20.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libusb/libusb20_ugen20.c Thu Mar 14 02:03:33 2013 (r248262) @@ -24,24 +24,28 @@ * SUCH DAMAGE. */ -#include -#include - +#ifdef LIBUSB_GLOBAL_INCLUDE_FILE +#include LIBUSB_GLOBAL_INCLUDE_FILE +#else #include #include #include #include #include #include - -#include "libusb20.h" -#include "libusb20_desc.h" -#include "libusb20_int.h" +#include +#include +#include +#endif #include #include #include +#include "libusb20.h" +#include "libusb20_desc.h" +#include "libusb20_int.h" + static libusb20_init_backend_t ugen20_init_backend; static libusb20_open_device_t ugen20_open_device; static libusb20_close_device_t ugen20_close_device; Copied: user/attilio/vmobj-readlock/lib/libusb/libusb_global_linux.h (from r248261, user/attilio/vmcontention/lib/libusb/libusb_global_linux.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmobj-readlock/lib/libusb/libusb_global_linux.h Thu Mar 14 02:03:33 2013 (r248262, copy of r248261, user/attilio/vmcontention/lib/libusb/libusb_global_linux.h) @@ -0,0 +1,69 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2013 Hans Petter Selasky. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUSB_GLOBAL_LINUX_H_ +#define _LIBUSB_GLOBAL_LINUX_H_ + +#define _XOPEN_SOURCE +#define _BSD_SOURCE +#define _POSIX_SOURCE +#define _POSIX_C_SOURCE 200809 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef __aligned +#define __aligned(x) __attribute__((__aligned__(x))) +#endif + +#ifndef __packed +#define __packed __attribute__((__packed__)) +#endif + +#ifndef strlcpy +#define strlcpy(d,s,len) do { \ + strncpy(d,s,len); \ + ((char *)d)[(len) - 1] = 0; \ +} while (0) +#endif + +#endif /* _LIBUSB_GLOBAL_LINUX_H_ */ Modified: user/attilio/vmobj-readlock/lib/libusb/usb.h ============================================================================== --- user/attilio/vmobj-readlock/lib/libusb/usb.h Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/lib/libusb/usb.h Thu Mar 14 02:03:33 2013 (r248262) @@ -27,10 +27,11 @@ #ifndef _LIBUSB20_COMPAT_01_H_ #define _LIBUSB20_COMPAT_01_H_ +#ifndef LIBUSB_GLOBAL_INCLUDE_FILE +#include #include #include - -#include +#endif /* USB interface class codes */ Modified: user/attilio/vmobj-readlock/share/man/man4/cas.4 ============================================================================== --- user/attilio/vmobj-readlock/share/man/man4/cas.4 Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/share/man/man4/cas.4 Thu Mar 14 02:03:33 2013 (r248262) @@ -44,7 +44,7 @@ Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -if_cas="YES" +if_cas_load="YES" .Ed .Sh DESCRIPTION The Modified: user/attilio/vmobj-readlock/share/man/man4/sge.4 ============================================================================== --- user/attilio/vmobj-readlock/share/man/man4/sge.4 Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/share/man/man4/sge.4 Thu Mar 14 02:03:33 2013 (r248262) @@ -43,7 +43,7 @@ Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -if_sge="YES" +if_sge_load="YES" .Ed .Sh DESCRIPTION The Modified: user/attilio/vmobj-readlock/share/man/man4/vinum.4 ============================================================================== --- user/attilio/vmobj-readlock/share/man/man4/vinum.4 Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/share/man/man4/vinum.4 Thu Mar 14 02:03:33 2013 (r248262) @@ -36,7 +36,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 16, 2002 +.Dd March 13, 2013 .Dt VINUM 4 .Os .Sh NAME @@ -856,9 +856,6 @@ for its NetMAX product. .Sh AUTHORS .An Greg Lehey Aq grog@lemis.com . .Sh BUGS -.Nm -is a new product. -Bugs can be expected. The configuration mechanism is not yet fully functional. If you have difficulties, please look at the section @@ -876,8 +873,6 @@ kernel and test with the KLD module. Detection of differences between the version of the kernel and the KLD is not yet implemented. .Pp -The RAID-5 functionality is new in -.Fx 3.3 . Some problems have been reported with .Nm Modified: user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdaa_patches.c ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdaa_patches.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdaa_patches.c Thu Mar 14 02:03:33 2013 (r248262) @@ -346,7 +346,8 @@ hdac_pin_patch(struct hdaa_widget *w) } else if (id == HDA_CODEC_ALC269 && (subid == LENOVO_X1CRBN_SUBVENDOR || subid == LENOVO_T430_SUBVENDOR || - subid == LENOVO_T430S_SUBVENDOR)) { + subid == LENOVO_T430S_SUBVENDOR || + subid == LENOVO_T530_SUBVENDOR)) { switch (nid) { case 21: patch = "as=1 seq=15"; Modified: user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdac.h Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/dev/sound/pci/hda/hdac.h Thu Mar 14 02:03:33 2013 (r248262) @@ -228,6 +228,7 @@ #define LENOVO_T430_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f3) #define LENOVO_T430S_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb) #define LENOVO_T520_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21cf) +#define LENOVO_T530_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f6) #define LENOVO_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0xffff) /* Samsung */ Modified: user/attilio/vmobj-readlock/sys/dev/usb/usb_device.c ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/usb/usb_device.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/dev/usb/usb_device.c Thu Mar 14 02:03:33 2013 (r248262) @@ -1698,10 +1698,14 @@ usb_alloc_device(device_t parent_dev, st err = usbd_setup_device_desc(udev, NULL); if (err != 0) { - /* XXX try to re-enumerate the device */ + /* try to enumerate two more times */ err = usbd_req_re_enumerate(udev, NULL); - if (err) - goto done; + if (err != 0) { + err = usbd_req_re_enumerate(udev, NULL); + if (err != 0) { + goto done; + } + } } /* Modified: user/attilio/vmobj-readlock/sys/dev/usb/usb_request.c ============================================================================== --- user/attilio/vmobj-readlock/sys/dev/usb/usb_request.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/dev/usb/usb_request.c Thu Mar 14 02:03:33 2013 (r248262) @@ -76,6 +76,11 @@ static int usb_no_cs_fail; SYSCTL_INT(_hw_usb, OID_AUTO, no_cs_fail, CTLFLAG_RW, &usb_no_cs_fail, 0, "USB clear stall failures are ignored, if set"); +static int usb_full_ddesc; + +SYSCTL_INT(_hw_usb, OID_AUTO, full_ddesc, CTLFLAG_RW, + &usb_full_ddesc, 0, "USB always read complete device descriptor, if set"); + #ifdef USB_DEBUG #ifdef USB_REQ_DEBUG /* The following structures are used in connection to fault injection. */ @@ -1002,7 +1007,7 @@ usbd_req_get_desc(struct usb_device *ude USETW(req.wLength, min_len); err = usbd_do_request_flags(udev, mtx, &req, - desc, 0, NULL, 1000); + desc, 0, NULL, 500 /* ms */); if (err) { if (!retries) { @@ -1887,32 +1892,41 @@ usbd_setup_device_desc(struct usb_device */ switch (udev->speed) { case USB_SPEED_FULL: - case USB_SPEED_LOW: + if (usb_full_ddesc != 0) { + /* get full device descriptor */ + err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); + if (err == 0) + break; + } + + /* get partial device descriptor, some devices crash on this */ err = usbd_req_get_desc(udev, mtx, NULL, &udev->ddesc, USB_MAX_IPACKET, USB_MAX_IPACKET, 0, UDESC_DEVICE, 0, 0); - if (err != 0) { - DPRINTFN(0, "getting device descriptor " - "at addr %d failed, %s\n", udev->address, - usbd_errstr(err)); - return (err); - } - break; - default: - DPRINTF("Minimum MaxPacketSize is large enough " - "to hold the complete device descriptor\n"); + if (err != 0) + break; + + /* get the full device descriptor */ + err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); break; - } - /* get the full device descriptor */ - err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); + default: + DPRINTF("Minimum bMaxPacketSize is large enough " + "to hold the complete device descriptor or " + "only one bMaxPacketSize choice\n"); - /* try one more time, if error */ - if (err) + /* get the full device descriptor */ err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); - if (err) { - DPRINTF("addr=%d, getting full desc failed\n", - udev->address); + /* try one more time, if error */ + if (err != 0) + err = usbd_req_get_device_desc(udev, mtx, &udev->ddesc); + break; + } + + if (err != 0) { + DPRINTFN(0, "getting device descriptor " + "at addr %d failed, %s\n", udev->address, + usbd_errstr(err)); return (err); } Modified: user/attilio/vmobj-readlock/sys/fs/nfs/nfsport.h ============================================================================== --- user/attilio/vmobj-readlock/sys/fs/nfs/nfsport.h Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/fs/nfs/nfsport.h Thu Mar 14 02:03:33 2013 (r248262) @@ -981,13 +981,6 @@ struct nfsreq { #define NFSVNO_DELEGOK(v) (1) #endif -/* - * Define this as the flags argument for msleep() when catching signals - * while holding a resource that other threads would block for, such as - * a vnode lock. - */ -#define NFS_PCATCH (PCATCH | PBDRY) - #endif /* _KERNEL */ #endif /* _NFS_NFSPORT_H */ Modified: user/attilio/vmobj-readlock/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- user/attilio/vmobj-readlock/sys/fs/nfsclient/nfs_clbio.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/fs/nfsclient/nfs_clbio.c Thu Mar 14 02:03:33 2013 (r248262) @@ -1297,7 +1297,7 @@ nfs_getcacheblk(struct vnode *vp, daddr_ sigset_t oldset; newnfs_set_sigmask(td, &oldset); - bp = getblk(vp, bn, size, NFS_PCATCH, 0, 0); + bp = getblk(vp, bn, size, PCATCH, 0, 0); newnfs_restore_sigmask(td, &oldset); while (bp == NULL) { if (newnfs_sigintr(nmp, td)) @@ -1332,7 +1332,7 @@ ncl_vinvalbuf(struct vnode *vp, int flag if ((nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF)) intrflg = 1; if (intrflg) { - slpflag = NFS_PCATCH; + slpflag = PCATCH; slptimeo = 2 * hz; } else { slpflag = 0; @@ -1413,7 +1413,7 @@ ncl_asyncio(struct nfsmount *nmp, struct } again: if (nmp->nm_flag & NFSMNT_INT) - slpflag = NFS_PCATCH; + slpflag = PCATCH; gotiod = FALSE; /* @@ -1478,7 +1478,7 @@ again: mtx_unlock(&ncl_iod_mutex); return (error2); } - if (slpflag == NFS_PCATCH) { + if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; } Modified: user/attilio/vmobj-readlock/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- user/attilio/vmobj-readlock/sys/fs/nfsclient/nfs_clvnops.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/fs/nfsclient/nfs_clvnops.c Thu Mar 14 02:03:33 2013 (r248262) @@ -2660,7 +2660,7 @@ ncl_flush(struct vnode *vp, int waitfor, if (called_from_renewthread != 0) slptimeo = hz; if (nmp->nm_flag & NFSMNT_INT) - slpflag = NFS_PCATCH; + slpflag = PCATCH; if (!commit) passone = 0; bo = &vp->v_bufobj; @@ -2866,7 +2866,7 @@ loop: error = EINTR; goto done; } - if (slpflag & PCATCH) { + if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; } @@ -2912,7 +2912,7 @@ loop: error = newnfs_sigintr(nmp, td); if (error) goto done; - if (slpflag & PCATCH) { + if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; } Modified: user/attilio/vmobj-readlock/sys/kern/imgact_elf.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/imgact_elf.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/kern/imgact_elf.c Thu Mar 14 02:03:33 2013 (r248262) @@ -661,9 +661,8 @@ __elfN(load_file)(struct proc *p, const } /* Only support headers that fit within first page for now */ - /* (multiplication of two Elf_Half fields will not overflow) */ if ((hdr->e_phoff > PAGE_SIZE) || - (hdr->e_phentsize * hdr->e_phnum) > PAGE_SIZE - hdr->e_phoff) { + (u_int)hdr->e_phentsize * hdr->e_phnum > PAGE_SIZE - hdr->e_phoff) { error = ENOEXEC; goto fail; } @@ -743,7 +742,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i */ if ((hdr->e_phoff > PAGE_SIZE) || - (hdr->e_phoff + hdr->e_phentsize * hdr->e_phnum) > PAGE_SIZE) { + (u_int)hdr->e_phentsize * hdr->e_phnum > PAGE_SIZE - hdr->e_phoff) { /* Only support headers in first page for now */ return (ENOEXEC); } @@ -762,8 +761,8 @@ __CONCAT(exec_, __elfN(imgact))(struct i case PT_INTERP: /* Path to interpreter */ if (phdr[i].p_filesz > MAXPATHLEN || - phdr[i].p_offset >= PAGE_SIZE || - phdr[i].p_offset + phdr[i].p_filesz >= PAGE_SIZE) + phdr[i].p_offset > PAGE_SIZE || + phdr[i].p_filesz > PAGE_SIZE - phdr[i].p_offset) return (ENOEXEC); interp = imgp->image_header + phdr[i].p_offset; interp_name_len = phdr[i].p_filesz; @@ -1553,9 +1552,8 @@ __elfN(parse_notes)(struct image_params const char *note_name; int i; - if (pnote == NULL || pnote->p_offset >= PAGE_SIZE || - pnote->p_filesz > PAGE_SIZE || - pnote->p_offset + pnote->p_filesz >= PAGE_SIZE) + if (pnote == NULL || pnote->p_offset > PAGE_SIZE || + pnote->p_filesz > PAGE_SIZE - pnote->p_offset) return (FALSE); note = note0 = (const Elf_Note *)(imgp->image_header + pnote->p_offset); Modified: user/attilio/vmobj-readlock/sys/kern/kern_et.c ============================================================================== --- user/attilio/vmobj-readlock/sys/kern/kern_et.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/kern/kern_et.c Thu Mar 14 02:03:33 2013 (r248262) @@ -168,7 +168,7 @@ et_start(struct eventtimer *et, sbintime KASSERT(period >= 0, ("et_start: negative period")); KASSERT((et->et_flags & ET_FLAGS_PERIODIC) || period == 0, ("et_start: period specified for oneshot-only timer")); - KASSERT((et->et_flags & ET_FLAGS_ONESHOT) && period == 0, + KASSERT((et->et_flags & ET_FLAGS_ONESHOT) || period != 0, ("et_start: period not specified for periodic-only timer")); if (period != 0) { if (period < et->et_min_period) Modified: user/attilio/vmobj-readlock/sys/modules/ath/Makefile ============================================================================== --- user/attilio/vmobj-readlock/sys/modules/ath/Makefile Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/modules/ath/Makefile Thu Mar 14 02:03:33 2013 (r248262) @@ -162,3 +162,7 @@ CWARNFLAGS.ah_regdomain.c= ${NO_WSHIFT_C # XXX Work around clang warnings, until maintainer approves fix. CWARNFLAGS.if_ath.c= ${NO_WSOMETIMES_UNINITIALIZED} CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} + +# AR9300 HAL build overrides, as there's still some code to tidy up +#CWARNFLAGS.ar9300_eeprom.c= ${NO_WCONSTANT_CONVERSION} +#CWARNFLAGS.ar9300_reset.c= ${NO_WSOMETIMES_UNINITIALIZED} Modified: user/attilio/vmobj-readlock/sys/nfsclient/nfs_bio.c ============================================================================== --- user/attilio/vmobj-readlock/sys/nfsclient/nfs_bio.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/nfsclient/nfs_bio.c Thu Mar 14 02:03:33 2013 (r248262) @@ -1242,7 +1242,7 @@ nfs_getcacheblk(struct vnode *vp, daddr_ sigset_t oldset; nfs_set_sigmask(td, &oldset); - bp = getblk(vp, bn, size, NFS_PCATCH, 0, 0); + bp = getblk(vp, bn, size, PCATCH, 0, 0); nfs_restore_sigmask(td, &oldset); while (bp == NULL) { if (nfs_sigintr(nmp, td)) @@ -1275,7 +1275,7 @@ nfs_vinvalbuf(struct vnode *vp, int flag if ((nmp->nm_flag & NFSMNT_INT) == 0) intrflg = 0; if (intrflg) { - slpflag = NFS_PCATCH; + slpflag = PCATCH; slptimeo = 2 * hz; } else { slpflag = 0; @@ -1354,7 +1354,7 @@ nfs_asyncio(struct nfsmount *nmp, struct } again: if (nmp->nm_flag & NFSMNT_INT) - slpflag = NFS_PCATCH; + slpflag = PCATCH; gotiod = FALSE; /* @@ -1419,7 +1419,7 @@ again: mtx_unlock(&nfs_iod_mtx); return (error2); } - if (slpflag == NFS_PCATCH) { + if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; } Modified: user/attilio/vmobj-readlock/sys/nfsclient/nfs_vnops.c ============================================================================== --- user/attilio/vmobj-readlock/sys/nfsclient/nfs_vnops.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/nfsclient/nfs_vnops.c Thu Mar 14 02:03:33 2013 (r248262) @@ -2992,7 +2992,7 @@ nfs_flush(struct vnode *vp, int waitfor, int bvecsize = 0, bveccount; if (nmp->nm_flag & NFSMNT_INT) - slpflag = NFS_PCATCH; + slpflag = PCATCH; if (!commit) passone = 0; bo = &vp->v_bufobj; @@ -3190,7 +3190,7 @@ loop: error = EINTR; goto done; } - if (slpflag & PCATCH) { + if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; } @@ -3228,7 +3228,7 @@ loop: error = nfs_sigintr(nmp, td); if (error) goto done; - if (slpflag & PCATCH) { + if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; } Modified: user/attilio/vmobj-readlock/sys/nfsclient/nfsmount.h ============================================================================== --- user/attilio/vmobj-readlock/sys/nfsclient/nfsmount.h Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/nfsclient/nfsmount.h Thu Mar 14 02:03:33 2013 (r248262) @@ -125,8 +125,6 @@ struct nfsmount { #define NFS_DEFAULT_NEGNAMETIMEO 60 #endif -#define NFS_PCATCH (PCATCH | PBDRY) - #endif #endif Modified: user/attilio/vmobj-readlock/sys/rpc/clnt_rc.c ============================================================================== --- user/attilio/vmobj-readlock/sys/rpc/clnt_rc.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/rpc/clnt_rc.c Thu Mar 14 02:03:33 2013 (r248262) @@ -247,8 +247,7 @@ clnt_reconnect_call( stat = clnt_reconnect_connect(cl); if (stat == RPC_SYSTEMERROR) { error = tsleep(&fake_wchan, - rc->rc_intr ? PCATCH | PBDRY : 0, "rpccon", - hz); + rc->rc_intr ? PCATCH : 0, "rpccon", hz); if (error == EINTR || error == ERESTART) return (RPC_INTR); tries++; Modified: user/attilio/vmobj-readlock/sys/rpc/clnt_vc.c ============================================================================== --- user/attilio/vmobj-readlock/sys/rpc/clnt_vc.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/sys/rpc/clnt_vc.c Thu Mar 14 02:03:33 2013 (r248262) @@ -162,7 +162,7 @@ clnt_vc_create( interrupted = 0; sleep_flag = PSOCK; if (intrflag != 0) - sleep_flag |= (PCATCH | PBDRY); + sleep_flag |= PCATCH; while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { error = msleep(&so->so_timeo, SOCK_MTX(so), @@ -470,7 +470,6 @@ call_again: errp->re_errno = error; switch (error) { case EINTR: - case ERESTART: stat = RPC_INTR; break; case EWOULDBLOCK: @@ -704,7 +703,7 @@ clnt_vc_control(CLIENT *cl, u_int reques case CLSET_INTERRUPTIBLE: if (*(int *) info) - ct->ct_waitflag = PCATCH | PBDRY; + ct->ct_waitflag = PCATCH; else ct->ct_waitflag = 0; break; Modified: user/attilio/vmobj-readlock/usr.bin/unifdef/unifdefall.sh ============================================================================== --- user/attilio/vmobj-readlock/usr.bin/unifdef/unifdefall.sh Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/usr.bin/unifdef/unifdefall.sh Thu Mar 14 02:03:33 2013 (r248262) @@ -42,8 +42,7 @@ case "$@" in shift esac -basename=$(basename "$0") -tmp=$(mktemp -d "${TMPDIR:-/tmp}/$basename.XXXXXXXXXX") || exit 2 +tmp=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXXXXXX") || exit 2 trap 'rm -r "$tmp" || exit 2' EXIT export LC_ALL=C Modified: user/attilio/vmobj-readlock/usr.sbin/usbconfig/usbconfig.c ============================================================================== --- user/attilio/vmobj-readlock/usr.sbin/usbconfig/usbconfig.c Thu Mar 14 02:00:21 2013 (r248261) +++ user/attilio/vmobj-readlock/usr.sbin/usbconfig/usbconfig.c Thu Mar 14 02:03:33 2013 (r248262) @@ -33,6 +33,7 @@ #include #include #include +#include #include #include From owner-svn-src-user@FreeBSD.ORG Thu Mar 14 16:24:52 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F372F4EC; Thu, 14 Mar 2013 16:24:51 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DCD2A9A3; Thu, 14 Mar 2013 16:24:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2EGOps7032809; Thu, 14 Mar 2013 16:24:51 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2EGOp0R032805; Thu, 14 Mar 2013 16:24:51 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201303141624.r2EGOp0R032805@svn.freebsd.org> From: Andre Oppermann Date: Thu, 14 Mar 2013 16:24:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248268 - user/andre/tcp-ao/sys/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Mar 2013 16:24:52 -0000 Author: andre Date: Thu Mar 14 16:24:50 2013 New Revision: 248268 URL: http://svnweb.freebsd.org/changeset/base/248268 Log: Recognize TCP-AO options in tcp_dooptions() and add them in tcp_addoptions(). The necessary definitions and fields are added to struct tcpopt. Sponsored by: Juniper Networks Modified: user/andre/tcp-ao/sys/netinet/tcp.h user/andre/tcp-ao/sys/netinet/tcp_input.c user/andre/tcp-ao/sys/netinet/tcp_output.c user/andre/tcp-ao/sys/netinet/tcp_var.h Modified: user/andre/tcp-ao/sys/netinet/tcp.h ============================================================================== --- user/andre/tcp-ao/sys/netinet/tcp.h Thu Mar 14 10:02:59 2013 (r248267) +++ user/andre/tcp-ao/sys/netinet/tcp.h Thu Mar 14 16:24:50 2013 (r248268) @@ -98,6 +98,8 @@ struct tcphdr { #define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */ #define TCPOLEN_SIGNATURE 18 #define TCPOPT_AO 29 +#define TCPOLEN_AO_MIN 4 +#define TCPOLEN_AO_MAX 40 /* Miscellaneous constants */ #define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */ Modified: user/andre/tcp-ao/sys/netinet/tcp_input.c ============================================================================== --- user/andre/tcp-ao/sys/netinet/tcp_input.c Thu Mar 14 10:02:59 2013 (r248267) +++ user/andre/tcp-ao/sys/netinet/tcp_input.c Thu Mar 14 16:24:50 2013 (r248268) @@ -3203,6 +3203,16 @@ tcp_dooptions(struct tcpopt *to, u_char to->to_signature = cp + 2; break; #endif + case TCPOPT_AO: + if (optlen >= TCPOLEN_AO_MIN && + optlen <= TCPOLEN_AO_MAX) + continue; + to->to_flags |= TOF_AO; + to->to_signature = cp + 4; + to->to_ao_keyid = *(cp + 2); + to->to_ao_nextkeyid = *(cp + 3); + to->to_siglen = optlen - 4; + break; case TCPOPT_SACK_PERMITTED: if (optlen != TCPOLEN_SACK_PERMITTED) continue; Modified: user/andre/tcp-ao/sys/netinet/tcp_output.c ============================================================================== --- user/andre/tcp-ao/sys/netinet/tcp_output.c Thu Mar 14 10:02:59 2013 (r248267) +++ user/andre/tcp-ao/sys/netinet/tcp_output.c Thu Mar 14 16:24:50 2013 (r248268) @@ -736,6 +736,9 @@ send: if (tp->t_flags & TF_SIGNATURE) to.to_flags |= TOF_SIGNATURE; #endif /* TCP_SIGNATURE */ + /* TCP-AO (RFC5925). */ + if (tp->t_flags & TF_AO) + to.to_flags |= TOF_AO; /* Processing the options. */ hdrlen += optlen = tcp_addoptions(&to, opt); @@ -1503,6 +1506,26 @@ tcp_addoptions(struct tcpopt *to, u_char *optp++ = 0; break; } + case TOF_AO: + { + int siglen = tcp_ao_siglen(tp); + + while (!optlen || optlen % 4 != 2) { + optlen += TCPOLEN_NOP; + *optp++ = TCPOPT_NOP; + } + if (TCP_MAXOLEN - optlen < TCPOLEN_AO_MIN + siglen) + continue; + optlen += TCPOLEN_AO_MIN; + *optp++ = TCPOPT_AO; + *optp++ = TCPOLEN_AO_MIN + siglen; + *optp++ = tcp_ao_keyid(tp); /* keyid */ + *optp++ = tcp_ao_nextkeyid(tp); /* nextkeyid */ + to->to_signature = optp; + while (siglen--) + *optp++ = 0; + break; + } case TOF_SACK: { int sackblks = 0; Modified: user/andre/tcp-ao/sys/netinet/tcp_var.h ============================================================================== --- user/andre/tcp-ao/sys/netinet/tcp_var.h Thu Mar 14 10:02:59 2013 (r248267) +++ user/andre/tcp-ao/sys/netinet/tcp_var.h Thu Mar 14 16:24:50 2013 (r248268) @@ -245,6 +245,7 @@ struct tcpcb { #define TF_ECN_SND_ECE 0x10000000 /* ECN ECE in queue */ #define TF_CONGRECOVERY 0x20000000 /* congestion recovery mode */ #define TF_WASCRECOVERY 0x40000000 /* was in congestion recovery */ +#define TF_AO 0x80000000 /* require TCP-AO digests (RFC5925) #define IN_FASTRECOVERY(t_flags) (t_flags & TF_FASTRECOVERY) #define ENTER_FASTRECOVERY(t_flags) t_flags |= TF_FASTRECOVERY @@ -297,11 +298,15 @@ struct tcpopt { #define TOF_TS 0x0010 /* timestamp */ #define TOF_SIGNATURE 0x0040 /* TCP-MD5 signature option (RFC2385) */ #define TOF_SACK 0x0080 /* Peer sent SACK option */ -#define TOF_MAXOPT 0x0100 +#define TOF_AO 0x0100 /* TCP-AO authentication (RFC5925) */ +#define TOF_MAXOPT 0x0200 u_int32_t to_tsval; /* new timestamp */ u_int32_t to_tsecr; /* reflected timestamp */ u_char *to_sacks; /* pointer to the first SACK blocks */ - u_char *to_signature; /* pointer to the TCP-MD5 signature */ + u_char *to_signature; /* pointer to the MD5/AO signature */ + u_int8_t to_siglen; /* length of signature */ + u_int8_t to_ao_keyid /* current TCP-AO keyid */ + u_int8_t tp_ao_nextkeyid /* receive next TCP-AO keyid */ u_int16_t to_mss; /* maximum segment size */ u_int8_t to_wscale; /* window scaling */ u_int8_t to_nsacks; /* number of SACK blocks */ From owner-svn-src-user@FreeBSD.ORG Thu Mar 14 16:27:02 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 575F2638; Thu, 14 Mar 2013 16:27:02 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 448FC9C2; Thu, 14 Mar 2013 16:27:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2EGR2j4033140; Thu, 14 Mar 2013 16:27:02 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2EGR2gA033139; Thu, 14 Mar 2013 16:27:02 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201303141627.r2EGR2gA033139@svn.freebsd.org> From: Andre Oppermann Date: Thu, 14 Mar 2013 16:27:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248269 - user/andre/tcp-ao/sys/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Mar 2013 16:27:02 -0000 Author: andre Date: Thu Mar 14 16:27:01 2013 New Revision: 248269 URL: http://svnweb.freebsd.org/changeset/base/248269 Log: Add IPv6 pseudo header for use in checksum calculations. Sponsored by: Juniper Networks Modified: user/andre/tcp-ao/sys/netinet/ip6.h Modified: user/andre/tcp-ao/sys/netinet/ip6.h ============================================================================== --- user/andre/tcp-ao/sys/netinet/ip6.h Thu Mar 14 16:24:50 2013 (r248268) +++ user/andre/tcp-ao/sys/netinet/ip6.h Thu Mar 14 16:27:01 2013 (r248269) @@ -248,6 +248,18 @@ struct ip6_frag { #endif /* BYTE_ORDER == LITTLE_ENDIAN */ /* + * This is the real IPv6 pseudo header, used for computing the TCP and UDP + * checksums. + */ +struct ip6pseudo { + struct in6_addr ip6pseudo_src; /* source internet address */ + struct in6_addr ip6pseudo_dst; /* destination internet address */ + u_int32_t ip6pseudo_len; /* payload length */ + u_int16_t ip6pseudo_pad; /* padding (zero) */ + u_int16_t ip6pseudo_p; /* next-header (protocol) */ +}; + +/* * Internet implementation parameters. */ #define IPV6_MAXHLIM 255 /* maximum hoplimit */ From owner-svn-src-user@FreeBSD.ORG Thu Mar 14 16:29:44 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4059A877; Thu, 14 Mar 2013 16:29:44 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id AA6029E7; Thu, 14 Mar 2013 16:29:41 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r2EGTXBj021820; Thu, 14 Mar 2013 20:29:33 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r2EGTXLS021819; Thu, 14 Mar 2013 20:29:33 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 14 Mar 2013 20:29:33 +0400 From: Gleb Smirnoff To: Andre Oppermann Subject: Re: svn commit: r248269 - user/andre/tcp-ao/sys/netinet Message-ID: <20130314162933.GG48089@FreeBSD.org> References: <201303141627.r2EGR2gA033139@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201303141627.r2EGR2gA033139@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Mar 2013 16:29:44 -0000 Andre, On Thu, Mar 14, 2013 at 04:27:02PM +0000, Andre Oppermann wrote: A> Author: andre A> Date: Thu Mar 14 16:27:01 2013 A> New Revision: 248269 A> URL: http://svnweb.freebsd.org/changeset/base/248269 A> A> Log: A> Add IPv6 pseudo header for use in checksum calculations. Why obsoleted u_intXX_t instead of uintXX_t in new code? A> Sponsored by: Juniper Networks A> A> Modified: A> user/andre/tcp-ao/sys/netinet/ip6.h A> A> Modified: user/andre/tcp-ao/sys/netinet/ip6.h A> ============================================================================== A> --- user/andre/tcp-ao/sys/netinet/ip6.h Thu Mar 14 16:24:50 2013 (r248268) A> +++ user/andre/tcp-ao/sys/netinet/ip6.h Thu Mar 14 16:27:01 2013 (r248269) A> @@ -248,6 +248,18 @@ struct ip6_frag { A> #endif /* BYTE_ORDER == LITTLE_ENDIAN */ A> A> /* A> + * This is the real IPv6 pseudo header, used for computing the TCP and UDP A> + * checksums. A> + */ A> +struct ip6pseudo { A> + struct in6_addr ip6pseudo_src; /* source internet address */ A> + struct in6_addr ip6pseudo_dst; /* destination internet address */ A> + u_int32_t ip6pseudo_len; /* payload length */ A> + u_int16_t ip6pseudo_pad; /* padding (zero) */ A> + u_int16_t ip6pseudo_p; /* next-header (protocol) */ A> +}; A> + A> +/* A> * Internet implementation parameters. A> */ A> #define IPV6_MAXHLIM 255 /* maximum hoplimit */ -- Totus tuus, Glebius. From owner-svn-src-user@FreeBSD.ORG Thu Mar 14 16:33:44 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 86E2DA4B; Thu, 14 Mar 2013 16:33:44 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6CE89A12; Thu, 14 Mar 2013 16:33:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2EGXira035675; Thu, 14 Mar 2013 16:33:44 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2EGXhOf035667; Thu, 14 Mar 2013 16:33:43 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201303141633.r2EGXhOf035667@svn.freebsd.org> From: Andre Oppermann Date: Thu, 14 Mar 2013 16:33:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248270 - in user/andre/tcp-ao/sys/crypto: cmac hmac X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Mar 2013 16:33:44 -0000 Author: andre Date: Thu Mar 14 16:33:43 2013 New Revision: 248270 URL: http://svnweb.freebsd.org/changeset/base/248270 Log: Add HMAC and CMAC functions from OpenBSD: HMAC_MD5 HMAC_SHA1 HMAC_SHA256 AES_CMAC This is a pure copy of the files. Any adjustments to FreeBSD will happen in later commits. Note: Our crypto code and support functions are scattered in different places. This layout should be reconsidered at a later point in time. Sponsored by: Juniper Networks Added: user/andre/tcp-ao/sys/crypto/cmac/ user/andre/tcp-ao/sys/crypto/cmac/cmac.c user/andre/tcp-ao/sys/crypto/cmac/cmac.h user/andre/tcp-ao/sys/crypto/hmac/ user/andre/tcp-ao/sys/crypto/hmac/hmac.c user/andre/tcp-ao/sys/crypto/hmac/hmac.h Added: user/andre/tcp-ao/sys/crypto/cmac/cmac.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/andre/tcp-ao/sys/crypto/cmac/cmac.c Thu Mar 14 16:33:43 2013 (r248270) @@ -0,0 +1,120 @@ +/* $OpenBSD: cmac.c,v 1.2 2011/01/11 15:42:05 deraadt Exp $ */ + +/*- + * Copyright (c) 2008 Damien Bergamini + * + * 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. + */ + +/* + * This code implements the CMAC (Cipher-based Message Authentication) + * algorithm described in FIPS SP800-38B using the AES-128 cipher. + */ + +#include +#include + +#include +#include + +#define LSHIFT(v, r) do { \ + int i; \ + for (i = 0; i < 15; i++) \ + (r)[i] = (v)[i] << 1 | (v)[i + 1] >> 7; \ + (r)[15] = (v)[15] << 1; \ +} while (0) + +#define XOR(v, r) do { \ + int i; \ + for (i = 0; i < 16; i++) \ + (r)[i] ^= (v)[i]; \ +} while (0) + +void +AES_CMAC_Init(AES_CMAC_CTX *ctx) +{ + memset(ctx->X, 0, sizeof ctx->X); + ctx->M_n = 0; +} + +void +AES_CMAC_SetKey(AES_CMAC_CTX *ctx, const u_int8_t key[AES_CMAC_KEY_LENGTH]) +{ + rijndael_set_key_enc_only(&ctx->rijndael, key, 128); +} + +void +AES_CMAC_Update(AES_CMAC_CTX *ctx, const u_int8_t *data, u_int len) +{ + u_int mlen; + + if (ctx->M_n > 0) { + mlen = MIN(16 - ctx->M_n, len); + memcpy(ctx->M_last + ctx->M_n, data, mlen); + ctx->M_n += mlen; + if (ctx->M_n < 16 || len == mlen) + return; + XOR(ctx->M_last, ctx->X); + rijndael_encrypt(&ctx->rijndael, ctx->X, ctx->X); + data += mlen; + len -= mlen; + } + while (len > 16) { /* not last block */ + XOR(data, ctx->X); + rijndael_encrypt(&ctx->rijndael, ctx->X, ctx->X); + data += 16; + len -= 16; + } + /* potential last block, save it */ + memcpy(ctx->M_last, data, len); + ctx->M_n = len; +} + +void +AES_CMAC_Final(u_int8_t digest[AES_CMAC_DIGEST_LENGTH], AES_CMAC_CTX *ctx) +{ + u_int8_t K[16]; + + /* generate subkey K1 */ + memset(K, 0, sizeof K); + rijndael_encrypt(&ctx->rijndael, K, K); + + if (K[0] & 0x80) { + LSHIFT(K, K); + K[15] ^= 0x87; + } else + LSHIFT(K, K); + + if (ctx->M_n == 16) { + /* last block was a complete block */ + XOR(K, ctx->M_last); + } else { + /* generate subkey K2 */ + if (K[0] & 0x80) { + LSHIFT(K, K); + K[15] ^= 0x87; + } else + LSHIFT(K, K); + + /* padding(M_last) */ + ctx->M_last[ctx->M_n] = 0x80; + while (++ctx->M_n < 16) + ctx->M_last[ctx->M_n] = 0; + + XOR(K, ctx->M_last); + } + XOR(ctx->M_last, ctx->X); + rijndael_encrypt(&ctx->rijndael, ctx->X, digest); + + explicit_bzero(K, sizeof K); +} Added: user/andre/tcp-ao/sys/crypto/cmac/cmac.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/andre/tcp-ao/sys/crypto/cmac/cmac.h Thu Mar 14 16:33:43 2013 (r248270) @@ -0,0 +1,41 @@ +/* $OpenBSD: cmac.h,v 1.2 2012/12/05 23:20:15 deraadt Exp $ */ + +/*- + * Copyright (c) 2008 Damien Bergamini + * + * 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. + */ + +#ifndef _CMAC_H_ +#define _CMAC_H_ + +#define AES_CMAC_KEY_LENGTH 16 +#define AES_CMAC_DIGEST_LENGTH 16 + +typedef struct _AES_CMAC_CTX { + rijndael_ctx rijndael; + u_int8_t X[16]; + u_int8_t M_last[16]; + u_int M_n; +} AES_CMAC_CTX; + +__BEGIN_DECLS +void AES_CMAC_Init(AES_CMAC_CTX *); +void AES_CMAC_SetKey(AES_CMAC_CTX *, const u_int8_t [AES_CMAC_KEY_LENGTH]); +void AES_CMAC_Update(AES_CMAC_CTX *, const u_int8_t *, u_int) + __attribute__((__bounded__(__string__,2,3))); +void AES_CMAC_Final(u_int8_t [AES_CMAC_DIGEST_LENGTH], AES_CMAC_CTX *) + __attribute__((__bounded__(__minbytes__,1,AES_CMAC_DIGEST_LENGTH))); +__END_DECLS + +#endif /* _CMAC_H_ */ Added: user/andre/tcp-ao/sys/crypto/hmac/hmac.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/andre/tcp-ao/sys/crypto/hmac/hmac.c Thu Mar 14 16:33:43 2013 (r248270) @@ -0,0 +1,192 @@ +/* $OpenBSD: hmac.c,v 1.3 2011/01/11 15:42:05 deraadt Exp $ */ + +/*- + * Copyright (c) 2008 Damien Bergamini + * + * 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. + */ + +/* + * This code implements the HMAC algorithm described in RFC 2104 using + * the MD5, SHA1 and SHA-256 hash functions. + */ + +#include +#include + +#include +#include +#include +#include + +void +HMAC_MD5_Init(HMAC_MD5_CTX *ctx, const u_int8_t *key, u_int key_len) +{ + u_int8_t k_ipad[MD5_BLOCK_LENGTH]; + int i; + + if (key_len > MD5_BLOCK_LENGTH) { + MD5Init(&ctx->ctx); + MD5Update(&ctx->ctx, key, key_len); + MD5Final(ctx->key, &ctx->ctx); + ctx->key_len = MD5_DIGEST_LENGTH; + } else { + bcopy(key, ctx->key, key_len); + ctx->key_len = key_len; + } + + bzero(k_ipad, MD5_BLOCK_LENGTH); + bcopy(ctx->key, k_ipad, ctx->key_len); + for (i = 0; i < MD5_BLOCK_LENGTH; i++) + k_ipad[i] ^= 0x36; + + MD5Init(&ctx->ctx); + MD5Update(&ctx->ctx, k_ipad, MD5_BLOCK_LENGTH); + + explicit_bzero(k_ipad, sizeof k_ipad); +} + +void +HMAC_MD5_Update(HMAC_MD5_CTX *ctx, const u_int8_t *data, u_int len) +{ + MD5Update(&ctx->ctx, data, len); +} + +void +HMAC_MD5_Final(u_int8_t digest[MD5_DIGEST_LENGTH], HMAC_MD5_CTX *ctx) +{ + u_int8_t k_opad[MD5_BLOCK_LENGTH]; + int i; + + MD5Final(digest, &ctx->ctx); + + bzero(k_opad, MD5_BLOCK_LENGTH); + bcopy(ctx->key, k_opad, ctx->key_len); + for (i = 0; i < MD5_BLOCK_LENGTH; i++) + k_opad[i] ^= 0x5c; + + MD5Init(&ctx->ctx); + MD5Update(&ctx->ctx, k_opad, MD5_BLOCK_LENGTH); + MD5Update(&ctx->ctx, digest, MD5_DIGEST_LENGTH); + MD5Final(digest, &ctx->ctx); + + explicit_bzero(k_opad, sizeof k_opad); +} + +void +HMAC_SHA1_Init(HMAC_SHA1_CTX *ctx, const u_int8_t *key, u_int key_len) +{ + u_int8_t k_ipad[SHA1_BLOCK_LENGTH]; + int i; + + if (key_len > SHA1_BLOCK_LENGTH) { + SHA1Init(&ctx->ctx); + SHA1Update(&ctx->ctx, key, key_len); + SHA1Final(ctx->key, &ctx->ctx); + ctx->key_len = SHA1_DIGEST_LENGTH; + } else { + bcopy(key, ctx->key, key_len); + ctx->key_len = key_len; + } + + bzero(k_ipad, SHA1_BLOCK_LENGTH); + bcopy(ctx->key, k_ipad, ctx->key_len); + for (i = 0; i < SHA1_BLOCK_LENGTH; i++) + k_ipad[i] ^= 0x36; + + SHA1Init(&ctx->ctx); + SHA1Update(&ctx->ctx, k_ipad, SHA1_BLOCK_LENGTH); + + explicit_bzero(k_ipad, sizeof k_ipad); +} + +void +HMAC_SHA1_Update(HMAC_SHA1_CTX *ctx, const u_int8_t *data, u_int len) +{ + SHA1Update(&ctx->ctx, data, len); +} + +void +HMAC_SHA1_Final(u_int8_t digest[SHA1_DIGEST_LENGTH], HMAC_SHA1_CTX *ctx) +{ + u_int8_t k_opad[SHA1_BLOCK_LENGTH]; + int i; + + SHA1Final(digest, &ctx->ctx); + + bzero(k_opad, SHA1_BLOCK_LENGTH); + bcopy(ctx->key, k_opad, ctx->key_len); + for (i = 0; i < SHA1_BLOCK_LENGTH; i++) + k_opad[i] ^= 0x5c; + + SHA1Init(&ctx->ctx); + SHA1Update(&ctx->ctx, k_opad, SHA1_BLOCK_LENGTH); + SHA1Update(&ctx->ctx, digest, SHA1_DIGEST_LENGTH); + SHA1Final(digest, &ctx->ctx); + + explicit_bzero(k_opad, sizeof k_opad); +} + +void +HMAC_SHA256_Init(HMAC_SHA256_CTX *ctx, const u_int8_t *key, u_int key_len) +{ + u_int8_t k_ipad[SHA256_BLOCK_LENGTH]; + int i; + + if (key_len > SHA256_BLOCK_LENGTH) { + SHA256Init(&ctx->ctx); + SHA256Update(&ctx->ctx, key, key_len); + SHA256Final(ctx->key, &ctx->ctx); + ctx->key_len = SHA256_DIGEST_LENGTH; + } else { + bcopy(key, ctx->key, key_len); + ctx->key_len = key_len; + } + + bzero(k_ipad, SHA256_BLOCK_LENGTH); + bcopy(ctx->key, k_ipad, ctx->key_len); + for (i = 0; i < SHA256_BLOCK_LENGTH; i++) + k_ipad[i] ^= 0x36; + + SHA256Init(&ctx->ctx); + SHA256Update(&ctx->ctx, k_ipad, SHA256_BLOCK_LENGTH); + + explicit_bzero(k_ipad, sizeof k_ipad); +} + +void +HMAC_SHA256_Update(HMAC_SHA256_CTX *ctx, const u_int8_t *data, u_int len) +{ + SHA256Update(&ctx->ctx, data, len); +} + +void +HMAC_SHA256_Final(u_int8_t digest[SHA256_DIGEST_LENGTH], HMAC_SHA256_CTX *ctx) +{ + u_int8_t k_opad[SHA256_BLOCK_LENGTH]; + int i; + + SHA256Final(digest, &ctx->ctx); + + bzero(k_opad, SHA256_BLOCK_LENGTH); + bcopy(ctx->key, k_opad, ctx->key_len); + for (i = 0; i < SHA256_BLOCK_LENGTH; i++) + k_opad[i] ^= 0x5c; + + SHA256Init(&ctx->ctx); + SHA256Update(&ctx->ctx, k_opad, SHA256_BLOCK_LENGTH); + SHA256Update(&ctx->ctx, digest, SHA256_DIGEST_LENGTH); + SHA256Final(digest, &ctx->ctx); + + explicit_bzero(k_opad, sizeof k_opad); +} Added: user/andre/tcp-ao/sys/crypto/hmac/hmac.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/andre/tcp-ao/sys/crypto/hmac/hmac.h Thu Mar 14 16:33:43 2013 (r248270) @@ -0,0 +1,65 @@ +/* $OpenBSD: hmac.h,v 1.3 2012/12/05 23:20:15 deraadt Exp $ */ + +/*- + * Copyright (c) 2008 Damien Bergamini + * + * 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. + */ + +#ifndef _HMAC_H_ +#define _HMAC_H_ + +typedef struct _HMAC_MD5_CTX { + MD5_CTX ctx; + u_int8_t key[MD5_BLOCK_LENGTH]; + u_int key_len; +} HMAC_MD5_CTX; + +typedef struct _HMAC_SHA1_CTX { + SHA1_CTX ctx; + u_int8_t key[SHA1_BLOCK_LENGTH]; + u_int key_len; +} HMAC_SHA1_CTX; + +typedef struct _HMAC_SHA256_CTX { + SHA2_CTX ctx; + u_int8_t key[SHA256_BLOCK_LENGTH]; + u_int key_len; +} HMAC_SHA256_CTX; + +__BEGIN_DECLS + +void HMAC_MD5_Init(HMAC_MD5_CTX *, const u_int8_t *, u_int) + __attribute__((__bounded__(__string__,2,3))); +void HMAC_MD5_Update(HMAC_MD5_CTX *, const u_int8_t *, u_int) + __attribute__((__bounded__(__string__,2,3))); +void HMAC_MD5_Final(u_int8_t [MD5_DIGEST_LENGTH], HMAC_MD5_CTX *) + __attribute__((__bounded__(__minbytes__,1,MD5_DIGEST_LENGTH))); + +void HMAC_SHA1_Init(HMAC_SHA1_CTX *, const u_int8_t *, u_int) + __attribute__((__bounded__(__string__,2,3))); +void HMAC_SHA1_Update(HMAC_SHA1_CTX *, const u_int8_t *, u_int) + __attribute__((__bounded__(__string__,2,3))); +void HMAC_SHA1_Final(u_int8_t [SHA1_DIGEST_LENGTH], HMAC_SHA1_CTX *) + __attribute__((__bounded__(__minbytes__,1,SHA1_DIGEST_LENGTH))); + +void HMAC_SHA256_Init(HMAC_SHA256_CTX *, const u_int8_t *, u_int) + __attribute__((__bounded__(__string__,2,3))); +void HMAC_SHA256_Update(HMAC_SHA256_CTX *, const u_int8_t *, u_int) + __attribute__((__bounded__(__string__,2,3))); +void HMAC_SHA256_Final(u_int8_t [SHA256_DIGEST_LENGTH], HMAC_SHA256_CTX *) + __attribute__((__bounded__(__minbytes__,1,SHA256_DIGEST_LENGTH))); + +__END_DECLS + +#endif /* _HMAC_H_ */ From owner-svn-src-user@FreeBSD.ORG Thu Mar 14 16:40:42 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BAB6EDDB; Thu, 14 Mar 2013 16:40:42 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 96027A6F; Thu, 14 Mar 2013 16:40:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2EGeg0C036782; Thu, 14 Mar 2013 16:40:42 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2EGegGo036781; Thu, 14 Mar 2013 16:40:42 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201303141640.r2EGegGo036781@svn.freebsd.org> From: Andre Oppermann Date: Thu, 14 Mar 2013 16:40:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248271 - user/andre/tcp-ao/sys/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Mar 2013 16:40:42 -0000 Author: andre Date: Thu Mar 14 16:40:42 2013 New Revision: 248271 URL: http://svnweb.freebsd.org/changeset/base/248271 Log: First skeleton of the TCP-AO segment authentication verification and computation functions. tcp_ao_mac() Setup of authentication computation for IPv4 and IPv6 tcp_ao_hmac() HMAC-SHA-1-(96), RFC5926, Section 3.2.1 tcp_ao_cmac() AES-128-CMAC-(96), RFC5926, Section 3.2.2 tcp_ao_md5() legacy compatibility to TCP-MD5 Sponsored by: Juniper Networks Modified: user/andre/tcp-ao/sys/netinet/tcp_ao.c Modified: user/andre/tcp-ao/sys/netinet/tcp_ao.c ============================================================================== --- user/andre/tcp-ao/sys/netinet/tcp_ao.c Thu Mar 14 16:33:43 2013 (r248270) +++ user/andre/tcp-ao/sys/netinet/tcp_ao.c Thu Mar 14 16:40:42 2013 (r248271) @@ -50,3 +50,212 @@ * legacy tcp-md5 can be brought and integrated into the tcp-ao framework. */ +/* + * The code below is skeleton code and not functional yet. + */ + +/* + * The hash over the header has to be pieced together and a couple of + * fields need manipulation, like zero'ing and byte order conversion. + * Instead of doing it in-place and calling the hash update function + * for each we just copy everything into one place in the right order. + */ +struct tcp_ao_thopt { + struct tcphdr th; + uint8_t tho[TCP_MAXOLEN]; +}; +struct tcp_ao_pseudo { + uint32_t tap_sne; /* sequence number extension */ + union { + struct tap_ip { + struct ippseudo tap_ph4; + struct tcp_ao_thopt tap_th; + } tap_ip; + struct tap_ip6 { + struct ip6_phdr tap_ph6; + struct tcp_ao_thopt tap_th; + } tap_ip6; + } tap; + int tap_type; + int tap_len; +} __packed; +#define tap4 tap.tap_ip +#define tap6 tap.tap_ip6 + +/* Convenient functions not yet in existence. */ +ip_hdr2pseudo(struct ip *ip, struct ippseudo *ipp); +ip6_hdr2pseudo(struct ip6_hdr *ip6, struct ip6pseudo *ipp6); +ip_inc2pseudo(struct in_conninfo *inc, struct ippseudo *ipp); +ip6_inc2pseudo(struct in_conninfo *inc, struct ip6pseudo *ipp6); + +/* + * Computation the authentication hash and return the result of the hash + * comparison. Return values: + * 0 = success + * EAUTH = authentication failed + * other = authentication failed + */ +static int +tcp_ao_mac(struct tcpcb *tp, struct tcp_ao_key *tk, struct in_conninfo *inc, + struct tcphdr *th, struct tcpopt *to, struct mbuf *m) +{ + int moff, mlen, thlen; + struct tcp_ao_pseudo ph; + struct tcp_ao_thopt *tho; + uint8_t hash[MAXHASHLEN]; + + /* + * Set up the virtual sequence number extension that is part of + * the authentication hash. + */ + if (tp != NULL) + ph.tap_sne = tp->t_ao->tao_sne; + else + ph.tap_sne = 0; + + /* Fill in pseudo headers. */ + switch(inc->inc_flags & INC_ISIPV6) { + case 0: + ip_inc2pseudo(inc, &ph.tap4.tap_ph4); + ph.tap_len += sizeof(ph.tap4.tap_ph4); + tho = &ph.tap4.tap_th; + break; + case INC_ISIPV6: + ip6_hdr2pseudo(inc, &ph.tap6.tap_ph6); + ph.tap_len += sizeof(ph.tap6.tap_ph6); + tho = &ph.tap6.tap_th; + break; + default: + error = EINVAL; + goto out; + } + ph.tap_len += sizeof(ph.tap_sne); + + /* Fill in tcpheader including options. */ + thlen = th->th_off << 2; + bcopy(th, tho, thlen); + ph.tap_len += thlen; + + /* Zero out checksum and mac field and swap to network byte order. */ + tho->th.th_sum = 0; + bzero(&tho->tho + (to->to_signature - (th + 1)), to->to_siglen); + tcp_fields_to_net(&tho); + + /* Set up the mbuf length fields. */ + moff = thlen; + mlen = m_length(m, NULL) - thlen; + + switch(tk->algo) { + case TCP_AO_HMAC_SHA_1_96: + error = tcp_ao_sha1(tk->key, ph, m, moff, mlen, hash); + break; + case TCP_AO_AES_128_CMAC_96: + error = tcp_ao_cmac(tk->key, ph, m, moff, mlen, hash); + break; + case TCP_AO_TCPMD5: + error = tcp_ao_md5(tk->key, ph, m, moff, mlen, hash); + break; + default: + error = EINVAL; + goto out; + } + if (error) + goto out; + + /* Compare result to segment signature. */ + if (bcmp(hash, to->to_signature, tk->tk_hashlen)); + error = EAUTH; + +out: + return (error); +} + +/* + * Note: Can't use cryptodev because of callback based non-inline + * processing. Also complexity to set up a crypto session is too high + * and requires a couple of malloc's. + */ + +/* + * Compute RFC5925+RFC5926 compliant HMAC-SHA1 authentication MAC of + * a tcp segment. + * XXX: HMAC_SHA1 doesn't exist yet. + */ +static int +tcp_ao_sha1(uint32_t key[static SHA1_BLOCK_LENGTH], struct pseudo *ph, + struct mbuf *m, int moff, int mlen, uint8_t hash[static SHA1_RESULTLEN]) +{ + HMAC_SHA1_CTX ctx; + int error = 0; + + HMAC_SHA1_Init(&ctx, key, SHA1_BLOCK_LENGTH); + + /* Pseudo header. */ + HMAC_SHA1_Update(&ctx, ph, ph->tap_len); + + error = m_apply(m, moff, mlen, HMAC_SHA1_Update, &ctx); + if (error) + goto out; + + HMAC_SHA1_Final(hash, &ctx); +out: + bzero(&ctx, sizeof(ctx)); + return (error); +} + +/* + * Compute RFC5925+RFC5926 compliant AES-128-CMAC authentication MAC of + * a tcp segment. + */ +static int +tcp_ao_cmac(uint32_t key[static AES_CMAC_KEY_LENGTH], struct pseudo *ph, + struct mbuf *m, int moff, int mlen, uint8_t hash[static AES_CMAC_DIGEST_LENGTH]) +{ + AES_CMAC_CTX ctx; + int error = 0; + + AES_CMAC_Init(&ctx); + AES_CMAC_SetKey(&ctx, key); + + AES_CMAC_Update(&ctx, ph, ph->tap_len); + + error = m_apply(m, moff, mlen, AES_CMAC_Update, &ctx); + if (error) + goto out; + + AES_CMAC_Final(hash, &ctx); +out: + bzero(&ctx, sizeof(ctx)); + return (error); +} + +/* + * Compute RFC2385 compliant MD5 authentication MAC of a tcp segment. + * Note that the SNE does not apply, the key comes last and the tcp options + * are not included. + */ +static int +tcp_ao_md5(uint32_t key[static MD5_BLOCK_LENGTH], struct pseudo *ph, + struct mbuf *m, int moff, int mlen, uint8_t hash[static MD5_DIGEST_LENGTH]) +{ + MD5_CTX ctx; + int error = 0, len; + + MD5Init(&ctx); + + len = ph->tap_len - sizeof(*ph->tap_sne) - sizeof(struct tcp_ao_thopt); + len += sizeof(struct tcphdr); + MD5Update(&ctx, &ph->tap, len; + + error = m_apply(m, moff, mlen, AES_CMAC_Update, &ctx); + if (error) + goto out; + + MD5Update(&ctx, key, MD5_BLOCK_LENGTH); + + MD5Final(hash, &ctx); +out: + bzero(%ctx, sizeof(ctx)); + return (error); +} + From owner-svn-src-user@FreeBSD.ORG Thu Mar 14 16:47:23 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C4AA7FB9 for ; Thu, 14 Mar 2013 16:47:23 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 3B5EBAC1 for ; Thu, 14 Mar 2013 16:47:23 +0000 (UTC) Received: (qmail 52794 invoked from network); 14 Mar 2013 17:59:26 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 14 Mar 2013 17:59:26 -0000 Message-ID: <5141FF11.3000504@freebsd.org> Date: Thu, 14 Mar 2013 17:47:13 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 MIME-Version: 1.0 To: Gleb Smirnoff Subject: Re: svn commit: r248269 - user/andre/tcp-ao/sys/netinet References: <201303141627.r2EGR2gA033139@svn.freebsd.org> <20130314162933.GG48089@FreeBSD.org> In-Reply-To: <20130314162933.GG48089@FreeBSD.org> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Mar 2013 16:47:23 -0000 On 14.03.2013 17:29, Gleb Smirnoff wrote: > Andre, > > On Thu, Mar 14, 2013 at 04:27:02PM +0000, Andre Oppermann wrote: > A> Author: andre > A> Date: Thu Mar 14 16:27:01 2013 > A> New Revision: 248269 > A> URL: http://svnweb.freebsd.org/changeset/base/248269 > A> > A> Log: > A> Add IPv6 pseudo header for use in checksum calculations. > > Why obsoleted u_intXX_t instead of uintXX_t in new code? Legacy style of surrounding code. What's our policy there? I tend to keep it the same. Changes like this not directly related to TCP-AO will be committed separately to HEAD. -- Andre > A> Sponsored by: Juniper Networks > A> > A> Modified: > A> user/andre/tcp-ao/sys/netinet/ip6.h > A> > A> Modified: user/andre/tcp-ao/sys/netinet/ip6.h > A> ============================================================================== > A> --- user/andre/tcp-ao/sys/netinet/ip6.h Thu Mar 14 16:24:50 2013 (r248268) > A> +++ user/andre/tcp-ao/sys/netinet/ip6.h Thu Mar 14 16:27:01 2013 (r248269) > A> @@ -248,6 +248,18 @@ struct ip6_frag { > A> #endif /* BYTE_ORDER == LITTLE_ENDIAN */ > A> > A> /* > A> + * This is the real IPv6 pseudo header, used for computing the TCP and UDP > A> + * checksums. > A> + */ > A> +struct ip6pseudo { > A> + struct in6_addr ip6pseudo_src; /* source internet address */ > A> + struct in6_addr ip6pseudo_dst; /* destination internet address */ > A> + u_int32_t ip6pseudo_len; /* payload length */ > A> + u_int16_t ip6pseudo_pad; /* padding (zero) */ > A> + u_int16_t ip6pseudo_p; /* next-header (protocol) */ > A> +}; > A> + > A> +/* > A> * Internet implementation parameters. > A> */ > A> #define IPV6_MAXHLIM 255 /* maximum hoplimit */ > From owner-svn-src-user@FreeBSD.ORG Fri Mar 15 10:13:27 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C6676B18; Fri, 15 Mar 2013 10:13:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id 54549F5E; Fri, 15 Mar 2013 10:13:26 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r2FADFhV052431; Fri, 15 Mar 2013 14:13:15 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r2FADFbY052430; Fri, 15 Mar 2013 14:13:15 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 15 Mar 2013 14:13:15 +0400 From: Gleb Smirnoff To: Andre Oppermann Subject: Re: svn commit: r248269 - user/andre/tcp-ao/sys/netinet Message-ID: <20130315101315.GJ48089@FreeBSD.org> References: <201303141627.r2EGR2gA033139@svn.freebsd.org> <20130314162933.GG48089@FreeBSD.org> <5141FF11.3000504@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <5141FF11.3000504@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Mar 2013 10:13:27 -0000 On Thu, Mar 14, 2013 at 05:47:13PM +0100, Andre Oppermann wrote: A> On 14.03.2013 17:29, Gleb Smirnoff wrote: A> > Andre, A> > A> > On Thu, Mar 14, 2013 at 04:27:02PM +0000, Andre Oppermann wrote: A> > A> Author: andre A> > A> Date: Thu Mar 14 16:27:01 2013 A> > A> New Revision: 248269 A> > A> URL: http://svnweb.freebsd.org/changeset/base/248269 A> > A> A> > A> Log: A> > A> Add IPv6 pseudo header for use in checksum calculations. A> > A> > Why obsoleted u_intXX_t instead of uintXX_t in new code? A> A> Legacy style of surrounding code. What's our policy there? I tend to keep it A> the same. Quoting style(9): The project is slowly moving to use the ISO/IEC 9899:1999 (``ISO C99'') unsigned integer identifiers of the form uintXX_t in preference to the older BSD-style integer identifiers of the form u_intXX_t. New code should use the former, and old code should be converted to the new form if other major work is being done in that area and there is no overriding reason to prefer the older BSD-style. Like white-space commits, care should be taken in making uintXX_t only commits. -- Totus tuus, Glebius. From owner-svn-src-user@FreeBSD.ORG Fri Mar 15 13:40:00 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DEF1D444; Fri, 15 Mar 2013 13:40:00 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C0F749D; Fri, 15 Mar 2013 13:40:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2FDe0pL029484; Fri, 15 Mar 2013 13:40:00 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2FDe017029483; Fri, 15 Mar 2013 13:40:00 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201303151340.r2FDe017029483@svn.freebsd.org> From: Andre Oppermann Date: Fri, 15 Mar 2013 13:40:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248327 - user/andre/tcp-ao/sys/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Mar 2013 13:40:00 -0000 Author: andre Date: Fri Mar 15 13:40:00 2013 New Revision: 248327 URL: http://svnweb.freebsd.org/changeset/base/248327 Log: First skeleton of the TCP-AO traffic and master key derivation functions. tcp_ao_kdf() Setup of traffic key derivation for IPv4 and IPv6 tcp_ao_kdf_hmac() KDF_HMAC_SHA1, RFC5926, Section 3.1.1.1 tcp_ao_kdf_cmac() KDF_AES_128_CMAC, RFC5926, Section 3.1.1.2 tpc_ao_kdf_md5() legacy compatibility to TCP-MD5 (has no key-derivation) The first function is rather incomplete as I first have to analyze and decide on the key management and storage approach (ipsec keysock vs. setsockopt). Sponsored by: Juniper Networks Modified: user/andre/tcp-ao/sys/netinet/tcp_ao.c Modified: user/andre/tcp-ao/sys/netinet/tcp_ao.c ============================================================================== --- user/andre/tcp-ao/sys/netinet/tcp_ao.c Fri Mar 15 13:10:06 2013 (r248326) +++ user/andre/tcp-ao/sys/netinet/tcp_ao.c Fri Mar 15 13:40:00 2013 (r248327) @@ -55,6 +55,157 @@ */ /* + * There two types of key derivation in TCP-AO. + * One is to create the session key from the imported master key. + * It involves individual session parameters like the ip addresses, + * port numbers and inititial sequence numbers. + * The other is in additional step for certain MAC algorithms when + * the user supplied key is not exactly the required key MAC size. + * Here we have to run the key through a special round of key + * derivation first to get the desired key length. + */ + +/* + * Context for key derivation. + */ +union tcp_ao_kdf_ctx { + struct ip4 { + struct in_addr src, dst; + uint16_t sport, dport; + uint32_t irs, iss; + } ip4_ctx; + struct ip6 { + struct in6_addr src, dst; + uint16_t sport, dport; + uint32_t irs, iss; + } ip6_ctx; + int len; +}; + +/* + * Key derivation for sessions and the derived master keys. + * Return values: + * 0 = success + * EINVAL = invalid input, typically insufficient length + * other = key derivation failed + */ +static int +tcp_ao_kdf(struct in_conninfo *inc, struct tcphdr *th, uint8_t *out, + int outlen) +{ + int error = 0; + struct tcp_ao_kdf_ctx tak; + + /* Fill in context for traffic keys. */ + switch (inc->inc_flags & INC_ISIPV6) { + case 0: + tak.ip4_ctx.src = inc->ie_faddr; + tak.ip4_ctx.dst = inc->ie_laddr; + tak.ip4_ctx.irs = htonl(th->th_ack); + tak.ip4_ctx.iss = htonl(th->th_seq); + tak.len = sizeof(tak.ip4_ctx); + break; + case INC_ISIPV6: + tak.ip6_ctx.src = inc->ie6_faddr; + tak.ip6_ctx.dst = inc->ie6_laddr; + tak.ip6_ctx.irs = htonl(th->th_ack); + tak.ip6_ctx.iss = htonl(th->th_seq); + tak.len = sizeof(tak.ip6_ctx); + break; + default: + error = EINVAL; + goto out; + } + + switch (kdf) { + case TCP_AO_HMAC_SHA_1_96: + error = tcp_ao_kdf_hmac(key, keylen, out, outlen, &tak); + break; + case TCP_AO_AES_128_CMAC_96: + error = tcp_ao_kdf_cmac(key, keylen, out, outlen, &tak); + break; + case TCP_AO_TCPMD5: + error = tcp_ao_kdf_cmac(key, keylen, out, outlen, &tak); + break; + default: + error = EINVAL; + } + if (error) + goto out; + + return (error); +} + +static int +tcp_ao_kdf_hmac(uint8_t *key, int keylen , uint8_t *out, int outlen, + struct tcp_ao_kdf_ctx *tak) +{ + HMAC_SHA_CTX ctx; + uint8_t res[SHA1_DIGEST_LENGTH]; + char *label = "TCP-AO"; + int error = 0; + uint8_t i; + + for (i = 0; outlen > 0; outlen -= SHA1_DIGEST_LENGTH, i++) { + HMAC_SHA1_Init(&ctx, key, keylen); + + HMAC_SHA1_Update(&ctx, &i, sizeof(i)); + HMAC_SHA1_Update(&ctx, label, sizeof(*label)); + if (tak != NULL) + HMAC_SHA1_Update(&ctx, tak, tak->len); + HMAC_SHA1_Final(res, &ctx); + + bcopy(res, out, min(outlen, SHA1_DIGEST_LENGTH)); + out += SHA1_DIGEST_LENGTH; + } + return (error); +} + +static int +tcp_ao_kdf_cmac(uint8_t *key, int keylen, uint8_t *out, int outlen, + struct tcp_ao_kdf_ctx *tak) +{ + AES_CMAC_CTX ctx; + uint8_t res[AES_CMAC_DIGEST_LENGTH]; + uint8_t zero[AES_CMAC_KEY_LENGTH]; + int error = 0; + + if (tak == NULL) { + bzero(zero, sizeof(*zero)); + AES_CMAC_Init(&ctx); + AES_CMAC_SetKey(&ctx, zero); + AES_CMAC_Update(&ctx, key, keylen); + AES_CMAC_Final(res, &ctx); + bcopy(res, out, min(outlen, AES_CMAC_DIGEST_LENGTH)); + } + + if (keylen != AES_CMAC_KEY_LENGTH) + return (EINVAL); + + for (i = 0; outlen > 0; outlen -= AES_CMAC_DIGEST_LENGTH, i++) { + AES_CMAC_Init(&ctx); + AES_CMAC_SetKey(&ctx, key); + AES_CMAC_Update(&ctx, &i, sizeof(i)); + AES_CMAC_Update(&ctx, label, sizeof(*label)); + AES_CMAC_Update(&ctx, tak, tak->len); + AES_CMAC_Final(res, &ctx); + + bcopy(res, out, min(outlen, AES_CMAC_DIGEST_LENGTH)); + out += AES_CMAC_DIGEST_LENGTH; + } + return (error); +} + +static int +tcp_ao_kfd_md5(uint8_t *key, int keylen, uint8_t *out, int outlen, + struct tcp_ao_kdf_ctx *tak) +{ + /* XXX: No key derivation happens. */ + return (0); +} + + +/* * The hash over the header has to be pieced together and a couple of * fields need manipulation, like zero'ing and byte order conversion. * Instead of doing it in-place and calling the hash update function From owner-svn-src-user@FreeBSD.ORG Sat Mar 16 17:09:45 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1D00A60B; Sat, 16 Mar 2013 17:09:45 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0EE4B928; Sat, 16 Mar 2013 17:09:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2GH9iBu034864; Sat, 16 Mar 2013 17:09:44 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2GH9iNM034863; Sat, 16 Mar 2013 17:09:44 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201303161709.r2GH9iNM034863@svn.freebsd.org> From: Dmitry Chagin Date: Sat, 16 Mar 2013 17:09:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248379 - user/dchagin/lemul/sys/i386/linux X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Mar 2013 17:09:45 -0000 Author: dchagin Date: Sat Mar 16 17:09:44 2013 New Revision: 248379 URL: http://svnweb.freebsd.org/changeset/base/248379 Log: Add forgotten in r247188 sv_thread_detach for i386. Modified: user/dchagin/lemul/sys/i386/linux/linux_sysvec.c Modified: user/dchagin/lemul/sys/i386/linux/linux_sysvec.c ============================================================================== --- user/dchagin/lemul/sys/i386/linux/linux_sysvec.c Sat Mar 16 16:58:39 2013 (r248378) +++ user/dchagin/lemul/sys/i386/linux/linux_sysvec.c Sat Mar 16 17:09:44 2013 (r248379) @@ -994,6 +994,7 @@ struct sysentvec linux_sysvec = { .sv_shared_page_base = LINUX_SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = linux_schedtail, + .sv_thread_detach = linux_thread_detach }; INIT_SYSENTVEC(aout_sysvec, &linux_sysvec); @@ -1032,6 +1033,7 @@ struct sysentvec elf_linux_sysvec = { .sv_shared_page_base = LINUX_SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = linux_schedtail, + .sv_thread_detach = linux_thread_detach }; INIT_SYSENTVEC(elf_sysvec, &elf_linux_sysvec); From owner-svn-src-user@FreeBSD.ORG Sat Mar 16 21:02:44 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 896E52CF; Sat, 16 Mar 2013 21:02:44 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4AB2C244; Sat, 16 Mar 2013 21:02:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2GL2hfg005954; Sat, 16 Mar 2013 21:02:43 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2GL2hva005946; Sat, 16 Mar 2013 21:02:43 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201303162102.r2GL2hva005946@svn.freebsd.org> From: Colin Percival Date: Sat, 16 Mar 2013 21:02:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r248383 - in user/cperciva/portsnap-build: . s X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Mar 2013 21:02:44 -0000 Author: cperciva Date: Sat Mar 16 21:02:42 2013 New Revision: 248383 URL: http://svnweb.freebsd.org/changeset/base/248383 Log: If umount(8) fails, sleep for a second and try again. Without this, portsnap builds sometimes fail with "unmount failed: Device busy". Modified: user/cperciva/portsnap-build/build.sh user/cperciva/portsnap-build/releasesnap.sh user/cperciva/portsnap-build/s/describes-run.sh user/cperciva/portsnap-build/s/treesnap-build.sh Modified: user/cperciva/portsnap-build/build.sh ============================================================================== --- user/cperciva/portsnap-build/build.sh Sat Mar 16 20:28:38 2013 (r248382) +++ user/cperciva/portsnap-build/build.sh Sat Mar 16 21:02:42 2013 (r248383) @@ -81,7 +81,9 @@ fi rm ${SIGDIR}/*.ssl # Unmount and delete the snapshot disk -umount /dev/md${SNAPMD} +while ! umount /dev/md${SNAPMD}; do + sleep 1 +done mdconfig -d -u ${SNAPMD} # Delete indexes Modified: user/cperciva/portsnap-build/releasesnap.sh ============================================================================== --- user/cperciva/portsnap-build/releasesnap.sh Sat Mar 16 20:28:38 2013 (r248382) +++ user/cperciva/portsnap-build/releasesnap.sh Sat Mar 16 21:02:42 2013 (r248383) @@ -59,7 +59,9 @@ echo "portsnap|`date "+%s"`|`sha256 -q $ tar -czf ${TARBALL} -C ${WORKDIR} tag tINDEX INDEX.gz files # Unmount and delete the snapshot disk -umount /dev/md${SNAPMD} +while ! umount /dev/md${SNAPMD}; do + sleep 1 +done mdconfig -d -u ${SNAPMD} # Delete temporary directories Modified: user/cperciva/portsnap-build/s/describes-run.sh ============================================================================== --- user/cperciva/portsnap-build/s/describes-run.sh Sat Mar 16 20:28:38 2013 (r248382) +++ user/cperciva/portsnap-build/s/describes-run.sh Sat Mar 16 21:02:42 2013 (r248383) @@ -81,10 +81,18 @@ else fi # Clean up -umount ${JAILDIR}/dev -umount ${JAILDIR}/tmp -umount ${JAILDIR}/usr/ports -umount ${JAILDIR} +while ! umount ${JAILDIR}/dev; do + sleep 1 +done +while ! umount ${JAILDIR}/tmp; do + sleep 1 +done +while ! umount ${JAILDIR}/usr/ports; do + sleep 1 +done +while ! umount ${JAILDIR}; do + sleep 1 +done mdconfig -d -u ${JAILMD} mdconfig -d -u ${TMPMD} devfs rule -s ${RULESET} delset Modified: user/cperciva/portsnap-build/s/treesnap-build.sh ============================================================================== --- user/cperciva/portsnap-build/s/treesnap-build.sh Sat Mar 16 20:28:38 2013 (r248382) +++ user/cperciva/portsnap-build/s/treesnap-build.sh Sat Mar 16 21:02:42 2013 (r248383) @@ -35,7 +35,9 @@ echo "`date`: Building snapshot tarballs sh -e s/treesnap-mktars-all.sh ${PORTSDIR} ${SNAP} ${SNAP}/INDEX ${TMP} # Unmount the ports tree -umount /dev/md${PORTSMD} +while ! umount /dev/md${PORTSMD}; do + sleep 1 +done # Perform index describes for N in ${DESCRIBES}; do