CVS commit: src/tests/net/ndp
Module Name:src Committed By: ozaki-r Date: Fri May 20 06:48:52 UTC 2016 Modified Files: src/tests/net/ndp: t_ndp.sh Log Message: Adjust the tests for temp option that works now See PR kern/50127 To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/net/ndp/t_ndp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/ndp/t_ndp.sh diff -u src/tests/net/ndp/t_ndp.sh:1.10 src/tests/net/ndp/t_ndp.sh:1.11 --- src/tests/net/ndp/t_ndp.sh:1.10 Mon Apr 4 07:37:08 2016 +++ src/tests/net/ndp/t_ndp.sh Fri May 20 06:48:52 2016 @@ -1,4 +1,4 @@ -# $NetBSD: t_ndp.sh,v 1.10 2016/04/04 07:37:08 ozaki-r Exp $ +# $NetBSD: t_ndp.sh,v 1.11 2016/05/20 06:48:52 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -210,12 +210,11 @@ command_body() atf_check -s exit:0 -o ignore -e ignore rump.ndp -n fc00::11 atf_check -s exit:0 -o ignore -e ignore rump.ndp -n fc00::12 - # Test temp option (XXX it doesn't work; expire time isn't set) $DEBUG && rump.ndp -n -a - #atf_check -s exit:0 -o ignore rump.ndp -s fc00::10 b2:a0:20:00:00:10 temp + atf_check -s exit:0 -o ignore rump.ndp -s fc00::10 b2:a0:20:00:00:10 temp rump.ndp -s fc00::10 b2:a0:20:00:00:10 temp $DEBUG && rump.ndp -n -a - #atf_check -s exit:0 -o not-match:'permanent' rump.ndp -n fc00::10 + atf_check -s exit:0 -o not-match:'permanent' rump.ndp -n fc00::10 return 0 }
CVS commit: src/sys/arch/xen/conf
Module Name:src Committed By: jnemeth Date: Fri May 20 03:41:20 UTC 2016 Modified Files: src/sys/arch/xen/conf: files.xen Log Message: make CPU microcode loading dependent on both DOM0OPS AND CPU_UCODE To generate a diff of this commit: cvs rdiff -u -r1.140 -r1.141 src/sys/arch/xen/conf/files.xen Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/conf/files.xen diff -u src/sys/arch/xen/conf/files.xen:1.140 src/sys/arch/xen/conf/files.xen:1.141 --- src/sys/arch/xen/conf/files.xen:1.140 Sat Feb 27 15:42:20 2016 +++ src/sys/arch/xen/conf/files.xen Fri May 20 03:41:20 2016 @@ -1,4 +1,4 @@ -# $NetBSD: files.xen,v 1.140 2016/02/27 15:42:20 mlelstv Exp $ +# $NetBSD: files.xen,v 1.141 2016/05/20 03:41:20 jnemeth Exp $ # NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp # NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp @@ -93,9 +93,9 @@ file arch/xen/x86/xen_pmap.c file arch/xen/x86/xen_intr.c file arch/xen/x86/xenfunc.c -file arch/xen/xen/xen_ucode.c dom0ops | cpu_ucode needs-flag -file arch/x86/x86/cpu_ucode_amd.c dom0ops | cpu_ucode needs-flag -file arch/x86/x86/cpu_ucode_intel.c dom0ops | cpu_ucode needs-flag +file arch/xen/xen/xen_ucode.c dom0ops & cpu_ucode needs-flag +file arch/x86/x86/cpu_ucode_amd.c dom0ops & cpu_ucode needs-flag +file arch/x86/x86/cpu_ucode_intel.c dom0ops & cpu_ucode needs-flag file arch/xen/xen/xen_machdep.c file arch/xen/xen/xen_debug.c
CVS commit: src/sys/arch/i386/conf
Module Name:src Committed By: christos Date: Fri May 20 01:37:47 UTC 2016 Modified Files: src/sys/arch/i386/conf: GENERIC Log Message: Turn on PaX ASLR/MPROTECT To generate a diff of this commit: cvs rdiff -u -r1.1135 -r1.1136 src/sys/arch/i386/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/conf/GENERIC diff -u src/sys/arch/i386/conf/GENERIC:1.1135 src/sys/arch/i386/conf/GENERIC:1.1136 --- src/sys/arch/i386/conf/GENERIC:1.1135 Sat Apr 23 06:15:29 2016 +++ src/sys/arch/i386/conf/GENERIC Thu May 19 21:37:47 2016 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.1135 2016/04/23 10:15:29 skrll Exp $ +# $NetBSD: GENERIC,v 1.1136 2016/05/20 01:37:47 christos Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.1135 $" +#ident "GENERIC-$Revision: 1.1136 $" maxusers 64 # estimated number of users @@ -1713,5 +1713,8 @@ options VERIFIED_EXEC_FP_SHA512 options VERIFIED_EXEC_FP_SHA1 options VERIFIED_EXEC_FP_MD5 -options PAX_MPROTECT=0 # PaX mprotect(2) restrictions -options PAX_ASLR=0 # PaX Address Space Layout Randomization +options PAX_ASLR_DEBUG=1 # PaX ASLR debug +options PAX_SEGVGUARD=0 # PaX Segmentation fault guard +options PAX_MPROTECT=1 # PaX mprotect(2) restrictions +options PAX_MPROTECT_DEBUG=1 # PaX mprotect debug +options PAX_ASLR=1 # PaX Address Space Layout Randomization
CVS commit: src/share/mk
Module Name:src Committed By: christos Date: Fri May 20 01:36:16 UTC 2016 Modified Files: src/share/mk: bsd.own.mk Log Message: i386 is PIE now since I am turning PaX ASLR/MPROTECT on. To generate a diff of this commit: cvs rdiff -u -r1.924 -r1.925 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.924 src/share/mk/bsd.own.mk:1.925 --- src/share/mk/bsd.own.mk:1.924 Thu May 19 11:38:13 2016 +++ src/share/mk/bsd.own.mk Thu May 19 21:36:16 2016 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.924 2016/05/19 15:38:13 christos Exp $ +# $NetBSD: bsd.own.mk,v 1.925 2016/05/20 01:36:16 christos Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -1049,7 +1049,9 @@ MKCTF?= yes # # PIE is enabled on amd64 by default # -.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE} == "sparc64" +.if ${MACHINE_ARCH} == "i386" || \ +${MACHINE_ARCH} == "x86_64" || \ +${MACHINE} == "sparc64" MKPIE?= yes .else MKPIE?= no
CVS commit: src/sys/kern
Module Name:src Committed By: christos Date: Thu May 19 21:39:15 UTC 2016 Modified Files: src/sys/kern: kern_pax.c Log Message: fix for ILP32. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/kern/kern_pax.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_pax.c diff -u src/sys/kern/kern_pax.c:1.46 src/sys/kern/kern_pax.c:1.47 --- src/sys/kern/kern_pax.c:1.46 Mon May 16 20:38:50 2016 +++ src/sys/kern/kern_pax.c Thu May 19 17:39:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_pax.c,v 1.46 2016/05/17 00:38:50 christos Exp $ */ +/* $NetBSD: kern_pax.c,v 1.47 2016/05/19 21:39:15 christos Exp $ */ /* * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.46 2016/05/17 00:38:50 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.47 2016/05/19 21:39:15 christos Exp $"); #include "opt_pax.h" @@ -488,7 +488,8 @@ pax_aslr_init_vm(struct lwp *l, struct v vm->vm_aslr_delta_mmap = PAX_ASLR_DELTA(rand, PAX_ASLR_DELTA_MMAP_LSB, len); - PAX_DPRINTF("delta_mmap=%#jx/%u", vm->vm_aslr_delta_mmap, len); + PAX_DPRINTF("delta_mmap=%#jx/%u", + (uintmax_t)vm->vm_aslr_delta_mmap, len); } void
CVS commit: src/external/gpl3/gcc/dist/gcc
Module Name:src Committed By: christos Date: Thu May 19 20:27:36 UTC 2016 Modified Files: src/external/gpl3/gcc/dist/gcc: alias.c var-tracking.c Log Message: Fix infinite recursion when building i386 -fPIE in src/external/mit/xorg/lib/libxcb/xkb. https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=231599 PR debug/67355 * var-tracking.c (reverse_op): Don't add dummy zero to reverse ops that simplify back to the original value. * alias.c (refs_newer_value_p): Cut off recursion for expressions containing the original value. To generate a diff of this commit: cvs rdiff -u -r1.1.1.5 -r1.2 src/external/gpl3/gcc/dist/gcc/alias.c \ src/external/gpl3/gcc/dist/gcc/var-tracking.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/gcc/dist/gcc/alias.c diff -u src/external/gpl3/gcc/dist/gcc/alias.c:1.1.1.5 src/external/gpl3/gcc/dist/gcc/alias.c:1.2 --- src/external/gpl3/gcc/dist/gcc/alias.c:1.1.1.5 Sun Jan 24 01:06:09 2016 +++ src/external/gpl3/gcc/dist/gcc/alias.c Thu May 19 16:27:36 2016 @@ -1880,7 +1880,7 @@ base_alias_check (rtx x, rtx x_base, rtx } /* Return TRUE if EXPR refers to a VALUE whose uid is greater than - that of V. */ + (or equal to) that of V. */ static bool refs_newer_value_p (const_rtx expr, rtx v) @@ -1888,7 +1888,7 @@ refs_newer_value_p (const_rtx expr, rtx int minuid = CSELIB_VAL_PTR (v)->uid; subrtx_iterator::array_type array; FOR_EACH_SUBRTX (iter, array, expr, NONCONST) -if (GET_CODE (*iter) == VALUE && CSELIB_VAL_PTR (*iter)->uid > minuid) +if (GET_CODE (*iter) == VALUE && CSELIB_VAL_PTR (*iter)->uid >= minuid) return true; return false; } Index: src/external/gpl3/gcc/dist/gcc/var-tracking.c diff -u src/external/gpl3/gcc/dist/gcc/var-tracking.c:1.1.1.5 src/external/gpl3/gcc/dist/gcc/var-tracking.c:1.2 --- src/external/gpl3/gcc/dist/gcc/var-tracking.c:1.1.1.5 Sun Jan 24 01:06:10 2016 +++ src/external/gpl3/gcc/dist/gcc/var-tracking.c Thu May 19 16:27:36 2016 @@ -5833,11 +5833,6 @@ reverse_op (rtx val, const_rtx expr, rtx return; } ret = simplify_gen_binary (code, GET_MODE (val), val, arg); - if (ret == val) - /* Ensure ret isn't VALUE itself (which can happen e.g. for - (plus (reg1) (reg2)) when reg2 is known to be 0), as that - breaks a lot of routines during var-tracking. */ - ret = gen_rtx_fmt_ee (PLUS, GET_MODE (val), val, const0_rtx); break; default: gcc_unreachable ();
CVS commit: src/sys/kern
Module Name:src Committed By: riastradh Date: Thu May 19 18:32:29 UTC 2016 Modified Files: src/sys/kern: vfs_wapbl.c Log Message: Replace deprecated disabled code by comment describing what it intends to do, and why it won't work yet >From coypu. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/kern/vfs_wapbl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_wapbl.c diff -u src/sys/kern/vfs_wapbl.c:1.77 src/sys/kern/vfs_wapbl.c:1.78 --- src/sys/kern/vfs_wapbl.c:1.77 Sat May 7 22:12:29 2016 +++ src/sys/kern/vfs_wapbl.c Thu May 19 18:32:29 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_wapbl.c,v 1.77 2016/05/07 22:12:29 riastradh Exp $ */ +/* $NetBSD: vfs_wapbl.c,v 1.78 2016/05/19 18:32:29 riastradh Exp $ */ /*- * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #define WAPBL_INTERNAL #include -__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.77 2016/05/07 22:12:29 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.78 2016/05/19 18:32:29 riastradh Exp $"); #include #include @@ -1431,44 +1431,18 @@ wapbl_biodone(struct buf *bp) #endif if (bp->b_error) { -#ifdef notyet /* Can't currently handle possible dirty buffer reuse */ /* - * XXXpooka: interfaces not fully updated - * Note: this was not enabled in the original patch - * against netbsd4 either. I don't know if comment - * above is true or not. + * If an error occurs, it would be nice to leave the buffer + * as a delayed write on the LRU queue so that we can retry + * it later. But buffercache(9) can't handle dirty buffer + * reuse, so just mark the log permanently errored out. */ - - /* - * If an error occurs, report the error and leave the - * buffer as a delayed write on the LRU queue. - * restarting the write would likely result in - * an error spinloop, so let it be done harmlessly - * by the syncer. - */ - bp->b_flags &= ~(B_DONE); - simple_unlock(&bp->b_interlock); - - if (we->we_error == 0) { - mutex_enter(&wl->wl_mtx); - wl->wl_error_count++; - mutex_exit(&wl->wl_mtx); - cv_broadcast(&wl->wl_reclaimable_cv); - } - we->we_error = bp->b_error; - bp->b_error = 0; - brelse(bp); - return; -#else - /* For now, just mark the log permanently errored out */ - mutex_enter(&wl->wl_mtx); if (wl->wl_error_count == 0) { wl->wl_error_count++; cv_broadcast(&wl->wl_reclaimable_cv); } mutex_exit(&wl->wl_mtx); -#endif } /*
CVS commit: src/sys/ufs/ufs
Module Name:src Committed By: riastradh Date: Thu May 19 18:32:20 UTC 2016 Modified Files: src/sys/ufs/ufs: ufs_wapbl.h Log Message: While here, replace GCC __FUNCTION__ by C99 __func__ >From coypu. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/ufs/ufs/ufs_wapbl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ufs/ufs_wapbl.h diff -u src/sys/ufs/ufs/ufs_wapbl.h:1.10 src/sys/ufs/ufs/ufs_wapbl.h:1.11 --- src/sys/ufs/ufs/ufs_wapbl.h:1.10 Thu May 19 18:32:11 2016 +++ src/sys/ufs/ufs/ufs_wapbl.h Thu May 19 18:32:20 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_wapbl.h,v 1.10 2016/05/19 18:32:11 riastradh Exp $ */ +/* $NetBSD: ufs_wapbl.h,v 1.11 2016/05/19 18:32:20 riastradh Exp $ */ /*- * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc. @@ -123,7 +123,7 @@ ufs_wapbl_end(struct mount *mp) } #define UFS_WAPBL_BEGIN(mp) \ - ufs_wapbl_begin(mp, __FUNCTION__, __LINE__) + ufs_wapbl_begin(mp, __func__, __LINE__) #define UFS_WAPBL_END(mp) ufs_wapbl_end(mp) #define UFS_WAPBL_UPDATE(vp, access, modify, flags) \
CVS commit: src/sys/ufs/ufs
Module Name:src Committed By: riastradh Date: Thu May 19 18:32:03 UTC 2016 Modified Files: src/sys/ufs/ufs: ufs_vnops.c ufs_wapbl.h Log Message: Get rid of UFS_WAPBL_BEGIN1/END1 ufs makeinode no longer releases dvp, so incrementing the usecount for wapbl is unnecessary. >From coypu. To generate a diff of this commit: cvs rdiff -u -r1.231 -r1.232 src/sys/ufs/ufs/ufs_vnops.c cvs rdiff -u -r1.8 -r1.9 src/sys/ufs/ufs/ufs_wapbl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ufs/ufs_vnops.c diff -u src/sys/ufs/ufs/ufs_vnops.c:1.231 src/sys/ufs/ufs/ufs_vnops.c:1.232 --- src/sys/ufs/ufs/ufs_vnops.c:1.231 Tue Sep 1 06:09:23 2015 +++ src/sys/ufs/ufs/ufs_vnops.c Thu May 19 18:32:03 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_vnops.c,v 1.231 2015/09/01 06:09:23 dholland Exp $ */ +/* $NetBSD: ufs_vnops.c,v 1.232 2016/05/19 18:32:03 riastradh Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.231 2015/09/01 06:09:23 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.232 2016/05/19 18:32:03 riastradh Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -151,7 +151,7 @@ ufs_create(void *v) UFS_CHECK_CRAPCOUNTER(VTOI(dvp)); /* - * UFS_WAPBL_BEGIN1(dvp->v_mount, dvp) performed by successful + * UFS_WAPBL_BEGIN(dvp->v_mount) performed by successful * ufs_makeinode */ fstrans_start(dvp->v_mount, FSTRANS_SHARED); @@ -160,7 +160,7 @@ ufs_create(void *v) fstrans_done(dvp->v_mount); return (error); } - UFS_WAPBL_END1(dvp->v_mount, dvp); + UFS_WAPBL_END(dvp->v_mount); fstrans_done(dvp->v_mount); VN_KNOTE(dvp, NOTE_WRITE); VOP_UNLOCK(*ap->a_vpp); @@ -194,7 +194,7 @@ ufs_mknod(void *v) UFS_CHECK_CRAPCOUNTER(VTOI(ap->a_dvp)); /* - * UFS_WAPBL_BEGIN1(dvp->v_mount, dvp) performed by successful + * UFS_WAPBL_BEGIN(dvp->v_mount) performed by successful * ufs_makeinode */ fstrans_start(ap->a_dvp->v_mount, FSTRANS_SHARED); @@ -204,7 +204,7 @@ ufs_mknod(void *v) ip = VTOI(*vpp); ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; UFS_WAPBL_UPDATE(*vpp, NULL, NULL, 0); - UFS_WAPBL_END1(ap->a_dvp->v_mount, ap->a_dvp); + UFS_WAPBL_END(ap->a_dvp->v_mount); VOP_UNLOCK(*vpp); out: fstrans_done(ap->a_dvp->v_mount); @@ -1200,7 +1200,7 @@ ufs_symlink(void *v) UFS_CHECK_CRAPCOUNTER(VTOI(ap->a_dvp)); /* - * UFS_WAPBL_BEGIN1(dvp->v_mount, dvp) performed by successful + * UFS_WAPBL_BEGIN(dvp->v_mount) performed by successful * ufs_makeinode */ fstrans_start(ap->a_dvp->v_mount, FSTRANS_SHARED); @@ -1232,7 +1232,7 @@ ufs_symlink(void *v) error = ufs_bufio(UIO_WRITE, vp, ap->a_target, len, (off_t)0, IO_NODELOCKED | IO_JOURNALLOCKED, ap->a_cnp->cn_cred, NULL, NULL); - UFS_WAPBL_END1(ap->a_dvp->v_mount, ap->a_dvp); + UFS_WAPBL_END(ap->a_dvp->v_mount); VOP_UNLOCK(vp); if (error) vrele(vp); @@ -1784,7 +1784,7 @@ ufs_makeinode(struct vattr *vap, struct } *vpp = tvp; ip = VTOI(tvp); - error = UFS_WAPBL_BEGIN1(dvp->v_mount, dvp); + error = UFS_WAPBL_BEGIN(dvp->v_mount); if (error) { vput(tvp); return (error); @@ -1832,7 +1832,7 @@ ufs_makeinode(struct vattr *vap, struct DIP_ASSIGN(ip, nlink, 0); ip->i_flag |= IN_CHANGE; UFS_WAPBL_UPDATE(tvp, NULL, NULL, 0); - UFS_WAPBL_END1(dvp->v_mount, dvp); + UFS_WAPBL_END(dvp->v_mount); vput(tvp); return (error); } Index: src/sys/ufs/ufs/ufs_wapbl.h diff -u src/sys/ufs/ufs/ufs_wapbl.h:1.8 src/sys/ufs/ufs/ufs_wapbl.h:1.9 --- src/sys/ufs/ufs/ufs_wapbl.h:1.8 Sun Nov 10 18:28:08 2013 +++ src/sys/ufs/ufs/ufs_wapbl.h Thu May 19 18:32:03 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_wapbl.h,v 1.8 2013/11/10 18:28:08 christos Exp $ */ +/* $NetBSD: ufs_wapbl.h,v 1.9 2016/05/19 18:32:03 riastradh Exp $ */ /*- * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc. @@ -134,10 +134,7 @@ ufs_wapbl_end2(struct mount *mp, struct #define UFS_WAPBL_BEGIN(mp) \ ufs_wapbl_begin2(mp, NULL, NULL, __FUNCTION__, __LINE__) -#define UFS_WAPBL_BEGIN1(mp, v1) \ - ufs_wapbl_begin2(mp, v1, NULL, __FUNCTION__, __LINE__) #define UFS_WAPBL_END(mp) ufs_wapbl_end2(mp, NULL, NULL) -#define UFS_WAPBL_END1(mp, v1) ufs_wapbl_end2(mp, v1, NULL) #define UFS_WAPBL_UPDATE(vp, access, modify, flags) \ if ((vp)->v_mount->mnt_wapbl) { \ @@ -164,9 +161,7 @@ ufs_wapbl_end2(struct mount *mp, struct #else /* ! WAPBL */ #define UFS_WAPBL_BEGIN(mp) (__USE(mp), 0) -#define UFS_WAPBL_BEGIN1(mp, v1) 0 #define UFS_WAPBL_END(mp) do { } while (0) -#define UFS_WAPBL_END1(mp, v1) #define UFS_WAPBL_UPDATE(vp, access, modify, flags) do { } while (0) #define UFS_WAPBL_JLOCK_ASSERT(mp) #define UFS_WAPBL_JUNLOCK_ASSERT(mp)
CVS commit: src/sys/ufs/ufs
Module Name:src Committed By: riastradh Date: Thu May 19 18:32:11 UTC 2016 Modified Files: src/sys/ufs/ufs: ufs_wapbl.h Log Message: Simplify ufs_wapbl_begin2/end2, drop 2 suffix We are no longer calling UFS_WAPBL_BEGIN/END with vnodes (we are giving NULL as a parameter in all cases), so we can get rid of this input parameter and the relevant check. >From coypu. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/ufs/ufs/ufs_wapbl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ufs/ufs_wapbl.h diff -u src/sys/ufs/ufs/ufs_wapbl.h:1.9 src/sys/ufs/ufs/ufs_wapbl.h:1.10 --- src/sys/ufs/ufs/ufs_wapbl.h:1.9 Thu May 19 18:32:03 2016 +++ src/sys/ufs/ufs/ufs_wapbl.h Thu May 19 18:32:11 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_wapbl.h,v 1.9 2016/05/19 18:32:03 riastradh Exp $ */ +/* $NetBSD: ufs_wapbl.h,v 1.10 2016/05/19 18:32:11 riastradh Exp $ */ /*- * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc. @@ -95,16 +95,10 @@ void ufs_wapbl_verify_inodes(struct moun #endif static __inline int -ufs_wapbl_begin2(struct mount *mp, struct vnode *vp1, struct vnode *vp2, - const char *file, int line) +ufs_wapbl_begin(struct mount *mp, const char *file, int line) { if (mp->mnt_wapbl) { int error; - - if (vp1) - vref(vp1); - if (vp2) - vref(vp2); error = wapbl_begin(mp->mnt_wapbl, file, line); if (error) return error; @@ -117,7 +111,7 @@ ufs_wapbl_begin2(struct mount *mp, struc } static __inline void -ufs_wapbl_end2(struct mount *mp, struct vnode *vp1, struct vnode *vp2) +ufs_wapbl_end(struct mount *mp) { if (mp->mnt_wapbl) { #ifdef WAPBL_DEBUG_INODES @@ -125,16 +119,12 @@ ufs_wapbl_end2(struct mount *mp, struct ufs_wapbl_verify_inodes(mp, "wapbl_end"); #endif wapbl_end(mp->mnt_wapbl); - if (vp2) - vrele(vp2); - if (vp1) - vrele(vp1); } } #define UFS_WAPBL_BEGIN(mp) \ - ufs_wapbl_begin2(mp, NULL, NULL, __FUNCTION__, __LINE__) -#define UFS_WAPBL_END(mp) ufs_wapbl_end2(mp, NULL, NULL) + ufs_wapbl_begin(mp, __FUNCTION__, __LINE__) +#define UFS_WAPBL_END(mp) ufs_wapbl_end(mp) #define UFS_WAPBL_UPDATE(vp, access, modify, flags) \ if ((vp)->v_mount->mnt_wapbl) { \
CVS commit: src/sys/arch/sparc/stand
Module Name:src Committed By: christos Date: Thu May 19 15:41:18 UTC 2016 Modified Files: src/sys/arch/sparc/stand: Makefile.inc Log Message: We don't want PIE! To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/stand/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc/stand/Makefile.inc diff -u src/sys/arch/sparc/stand/Makefile.inc:1.12 src/sys/arch/sparc/stand/Makefile.inc:1.13 --- src/sys/arch/sparc/stand/Makefile.inc:1.12 Thu Mar 10 04:00:24 2016 +++ src/sys/arch/sparc/stand/Makefile.inc Thu May 19 11:41:18 2016 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.12 2016/03/10 09:00:24 martin Exp $ +# $NetBSD: Makefile.inc,v 1.13 2016/05/19 15:41:18 christos Exp $ .ifndef __INCLUDED_STAND_MAKEFILE_INC __INCLUDED_STAND_MAKEFILE_INC= @@ -6,6 +6,7 @@ __INCLUDED_STAND_MAKEFILE_INC= .include BINDIR= /usr/mdec +NOPIE= yes CPPFLAGS+= -DSTANDALONE -I. CFLAGS+= -ffreestanding ${${ACTIVE_CC} == "gcc":? -msoft-float :}
CVS commit: src/share/mk
Module Name:src Committed By: christos Date: Thu May 19 15:38:13 UTC 2016 Modified Files: src/share/mk: bsd.own.mk Log Message: Turn on PIE for sparc64 so we can use ASLR effectively. To generate a diff of this commit: cvs rdiff -u -r1.923 -r1.924 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.923 src/share/mk/bsd.own.mk:1.924 --- src/share/mk/bsd.own.mk:1.923 Wed May 11 09:41:56 2016 +++ src/share/mk/bsd.own.mk Thu May 19 11:38:13 2016 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.923 2016/05/11 13:41:56 martin Exp $ +# $NetBSD: bsd.own.mk,v 1.924 2016/05/19 15:38:13 christos Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -1049,7 +1049,7 @@ MKCTF?= yes # # PIE is enabled on amd64 by default # -.if ${MACHINE_ARCH} == "x86_64" +.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE} == "sparc64" MKPIE?= yes .else MKPIE?= no
CVS commit: src/sys/arch/sparc64/conf
Module Name:src Committed By: christos Date: Thu May 19 15:37:06 UTC 2016 Modified Files: src/sys/arch/sparc64/conf: GENERIC Log Message: Turn on ASLR for sparc64 To generate a diff of this commit: cvs rdiff -u -r1.184 -r1.185 src/sys/arch/sparc64/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc64/conf/GENERIC diff -u src/sys/arch/sparc64/conf/GENERIC:1.184 src/sys/arch/sparc64/conf/GENERIC:1.185 --- src/sys/arch/sparc64/conf/GENERIC:1.184 Sat Mar 19 19:21:03 2016 +++ src/sys/arch/sparc64/conf/GENERIC Thu May 19 11:37:06 2016 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.184 2016/03/19 23:21:03 gdt Exp $ +# $NetBSD: GENERIC,v 1.185 2016/05/19 15:37:06 christos Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/sparc64/conf/std.sparc64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.184 $" +#ident "GENERIC-$Revision: 1.185 $" maxusers 64 @@ -1006,5 +1006,9 @@ pseudo-device nsmb # experimental - S # drvctl - needed to show device dictionary via drvctl(8) pseudo-device drvctl -#options PAX_MPROTECT=0 # PaX mprotect(2) restrictions - # (for static binaries only for now) +options PAX_ASLR_DEBUG=1# PaX ASLR debug +options PAX_SEGVGUARD=0 # PaX Segmentation fault guard +# XXX: MPROTECT is broken! +options PAX_MPROTECT=0 # PaX mprotect(2) restrictions +options PAX_MPROTECT_DEBUG=1# PaX mprotect debug +options PAX_ASLR=1 # PaX Address Space Layout Randomization
CVS commit: src/sys/arch/sparc64/include
Module Name:src Committed By: christos Date: Thu May 19 15:36:35 UTC 2016 Modified Files: src/sys/arch/sparc64/include: proc.h Log Message: lose one more bit of ALSR to account for rounding in the VA hole. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc64/include/proc.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc64/include/proc.h diff -u src/sys/arch/sparc64/include/proc.h:1.14 src/sys/arch/sparc64/include/proc.h:1.15 --- src/sys/arch/sparc64/include/proc.h:1.14 Mon May 16 20:39:43 2016 +++ src/sys/arch/sparc64/include/proc.h Thu May 19 11:36:35 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.14 2016/05/17 00:39:43 christos Exp $ */ +/* $NetBSD: proc.h,v 1.15 2016/05/19 15:36:35 christos Exp $ */ /* * Copyright (c) 1992, 1993 @@ -60,6 +60,6 @@ struct mdproc { #define netbsd32_syscall_intern syscall_intern -#define PAX_ASLR_RAND_MMAP_MAX 0x8 +#define PAX_ASLR_RAND_MMAP_MAX 0x4 #endif /* _SPARC64_PROC_H */
CVS commit: src/sys/kern
Module Name:src Committed By: hannken Date: Thu May 19 14:50:18 UTC 2016 Modified Files: src/sys/kern: vfs_vnode.c Log Message: Keep the old vcache node on rekey. Change its key and remove the new vcache node now used as placeholder only. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/kern/vfs_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_vnode.c diff -u src/sys/kern/vfs_vnode.c:1.48 src/sys/kern/vfs_vnode.c:1.49 --- src/sys/kern/vfs_vnode.c:1.48 Thu May 19 14:47:33 2016 +++ src/sys/kern/vfs_vnode.c Thu May 19 14:50:18 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnode.c,v 1.48 2016/05/19 14:47:33 hannken Exp $ */ +/* $NetBSD: vfs_vnode.c,v 1.49 2016/05/19 14:50:18 hannken Exp $ */ /*- * Copyright (c) 1997-2011 The NetBSD Foundation, Inc. @@ -116,7 +116,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.48 2016/05/19 14:47:33 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.49 2016/05/19 14:50:18 hannken Exp $"); #define _VFS_VNODE_PRIVATE @@ -1372,6 +1372,8 @@ vcache_rekey_enter(struct mount *mp, str new_node->vn_key = new_vcache_key; mutex_enter(&vcache.lock); + + /* Insert locked new node used as placeholder. */ node = vcache_hash_lookup(&new_vcache_key, new_hash); if (node != NULL) { mutex_exit(&vcache.lock); @@ -1380,6 +1382,8 @@ vcache_rekey_enter(struct mount *mp, str } SLIST_INSERT_HEAD(&vcache.hashtab[new_hash & vcache.hashmask], new_node, vn_hash); + + /* Lock old node. */ node = vcache_hash_lookup(&old_vcache_key, old_hash); KASSERT(node != NULL); KASSERT(node->vn_vnode == vp); @@ -1399,7 +1403,7 @@ vcache_rekey_exit(struct mount *mp, stru { uint32_t old_hash, new_hash; struct vcache_key old_vcache_key, new_vcache_key; - struct vcache_node *node; + struct vcache_node *old_node, *new_node; old_vcache_key.vk_mount = mp; old_vcache_key.vk_key = old_key; @@ -1412,18 +1416,30 @@ vcache_rekey_exit(struct mount *mp, stru new_hash = vcache_hash(&new_vcache_key); mutex_enter(&vcache.lock); - node = vcache_hash_lookup(&new_vcache_key, new_hash); - KASSERT(node != NULL && node->vn_vnode == NULL); - KASSERT(node->vn_key.vk_key_len == new_key_len); - node->vn_vnode = vp; - node->vn_key = new_vcache_key; - node = vcache_hash_lookup(&old_vcache_key, old_hash); - KASSERT(node != NULL); - KASSERT(node->vn_vnode == NULL); - SLIST_REMOVE(&vcache.hashtab[old_hash & vcache.hashmask], - node, vcache_node, vn_hash); + + /* Lookup old and new node. */ + old_node = vcache_hash_lookup(&old_vcache_key, old_hash); + KASSERT(old_node != NULL); + KASSERT(old_node->vn_vnode == NULL); + new_node = vcache_hash_lookup(&new_vcache_key, new_hash); + KASSERT(new_node != NULL && new_node->vn_vnode == NULL); + KASSERT(new_node->vn_key.vk_key_len == new_key_len); + + /* Rekey old node and put it onto its new hashlist. */ + old_node->vn_vnode = vp; + old_node->vn_key = new_vcache_key; + if (old_hash != new_hash) { + SLIST_REMOVE(&vcache.hashtab[old_hash & vcache.hashmask], + old_node, vcache_node, vn_hash); + SLIST_INSERT_HEAD(&vcache.hashtab[new_hash & vcache.hashmask], + old_node, vn_hash); + } + + /* Remove new node used as placeholder. */ + SLIST_REMOVE(&vcache.hashtab[new_hash & vcache.hashmask], + new_node, vcache_node, vn_hash); mutex_exit(&vcache.lock); - pool_cache_put(vcache.pool, node); + pool_cache_put(vcache.pool, new_node); } /*
CVS commit: src/sys/kern
Module Name:src Committed By: hannken Date: Thu May 19 14:48:28 UTC 2016 Modified Files: src/sys/kern: vfs_mount.c Log Message: Change "ISSET(vp->v_iflag, VI_XLOCK)" to "vdead_check(vp, VDEAD_NOWAIT)". To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/kern/vfs_mount.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_mount.c diff -u src/sys/kern/vfs_mount.c:1.38 src/sys/kern/vfs_mount.c:1.39 --- src/sys/kern/vfs_mount.c:1.38 Thu May 19 14:47:33 2016 +++ src/sys/kern/vfs_mount.c Thu May 19 14:48:28 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_mount.c,v 1.38 2016/05/19 14:47:33 hannken Exp $ */ +/* $NetBSD: vfs_mount.c,v 1.39 2016/05/19 14:48:28 hannken Exp $ */ /*- * Copyright (c) 1997-2011 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.38 2016/05/19 14:47:33 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.39 2016/05/19 14:48:28 hannken Exp $"); #define _VFS_VNODE_PRIVATE @@ -394,7 +394,7 @@ again: } mutex_enter(vp->v_interlock); if (vnis_marker(vp) || - ISSET(vp->v_iflag, VI_XLOCK) || + vdead_check(vp, VDEAD_NOWAIT) || (f && !(*f)(cl, vp))) { mutex_exit(vp->v_interlock); vp = TAILQ_NEXT(vp, v_mntvnodes);
CVS commit: src/sys
Module Name:src Committed By: hannken Date: Thu May 19 14:47:33 UTC 2016 Modified Files: src/sys/kern: vfs_mount.c vfs_vnode.c src/sys/sys: vnode.h Log Message: Add VFS_VNODE_PRIVATE protected operations vnalloc_marker() to create, vnfree_marker() to destroy and vnis_marker() to test for marker vnodes. Make operations vnalloc() and vnfree() local to vfs_vnode.c. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/kern/vfs_mount.c cvs rdiff -u -r1.47 -r1.48 src/sys/kern/vfs_vnode.c cvs rdiff -u -r1.259 -r1.260 src/sys/sys/vnode.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_mount.c diff -u src/sys/kern/vfs_mount.c:1.37 src/sys/kern/vfs_mount.c:1.38 --- src/sys/kern/vfs_mount.c:1.37 Wed Aug 19 08:40:02 2015 +++ src/sys/kern/vfs_mount.c Thu May 19 14:47:33 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_mount.c,v 1.37 2015/08/19 08:40:02 hannken Exp $ */ +/* $NetBSD: vfs_mount.c,v 1.38 2016/05/19 14:47:33 hannken Exp $ */ /*- * Copyright (c) 1997-2011 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.37 2015/08/19 08:40:02 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.38 2016/05/19 14:47:33 hannken Exp $"); #define _VFS_VNODE_PRIVATE @@ -346,7 +346,7 @@ vfs_vnode_iterator_init(struct mount *mp { struct vnode *vp; - vp = vnalloc(mp); + vp = vnalloc_marker(mp); mutex_enter(&mntvnode_lock); TAILQ_INSERT_HEAD(&mp->mnt_vnodelist, vp, v_mntvnodes); @@ -362,13 +362,13 @@ vfs_vnode_iterator_destroy(struct vnode_ struct vnode *mvp = &vi->vi_vnode; mutex_enter(&mntvnode_lock); - KASSERT(ISSET(mvp->v_iflag, VI_MARKER)); + KASSERT(vnis_marker(mvp)); if (mvp->v_usecount != 0) { TAILQ_REMOVE(&mvp->v_mount->mnt_vnodelist, mvp, v_mntvnodes); mvp->v_usecount = 0; } mutex_exit(&mntvnode_lock); - vnfree(mvp); + vnfree_marker(mvp); } struct vnode * @@ -380,7 +380,7 @@ vfs_vnode_iterator_next(struct vnode_ite struct vnode *vp; int error; - KASSERT(ISSET(mvp->v_iflag, VI_MARKER)); + KASSERT(vnis_marker(mvp)); do { mutex_enter(&mntvnode_lock); @@ -393,7 +393,7 @@ again: return NULL; } mutex_enter(vp->v_interlock); - if (ISSET(vp->v_iflag, VI_MARKER) || + if (vnis_marker(vp) || ISSET(vp->v_iflag, VI_XLOCK) || (f && !(*f)(cl, vp))) { mutex_exit(vp->v_interlock); Index: src/sys/kern/vfs_vnode.c diff -u src/sys/kern/vfs_vnode.c:1.47 src/sys/kern/vfs_vnode.c:1.48 --- src/sys/kern/vfs_vnode.c:1.47 Fri Apr 22 15:01:54 2016 +++ src/sys/kern/vfs_vnode.c Thu May 19 14:47:33 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnode.c,v 1.47 2016/04/22 15:01:54 riastradh Exp $ */ +/* $NetBSD: vfs_vnode.c,v 1.48 2016/05/19 14:47:33 hannken Exp $ */ /*- * Copyright (c) 1997-2011 The NetBSD Foundation, Inc. @@ -116,7 +116,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.47 2016/04/22 15:01:54 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.48 2016/05/19 14:47:33 hannken Exp $"); #define _VFS_VNODE_PRIVATE @@ -195,6 +195,8 @@ static void vclean(vnode_t *); static void vrelel(vnode_t *, int); static void vdrain_thread(void *); static void vrele_thread(void *); +static vnode_t * vnalloc(struct mount *); +static void vnfree(vnode_t *); static void vnpanic(vnode_t *, const char *, ...) __printflike(2, 3); static void vwait(vnode_t *, int); @@ -236,10 +238,41 @@ vfs_vnode_sysinit(void) } /* + * Allocate a new marker vnode. + */ +vnode_t * +vnalloc_marker(struct mount *mp) +{ + + return vnalloc(mp); +} + +/* + * Free a marker vnode. + */ +void +vnfree_marker(vnode_t *vp) +{ + + KASSERT(ISSET(vp->v_iflag, VI_MARKER)); + vnfree(vp); +} + +/* + * Test a vnode for being a marker vnode. + */ +bool +vnis_marker(vnode_t *vp) +{ + + return (ISSET(vp->v_iflag, VI_MARKER)); +} + +/* * Allocate a new, uninitialized vnode. If 'mp' is non-NULL, this is a * marker vnode. */ -vnode_t * +static vnode_t * vnalloc(struct mount *mp) { vnode_t *vp; @@ -280,7 +313,7 @@ vnalloc(struct mount *mp) /* * Free an unused, unreferenced vnode. */ -void +static void vnfree(vnode_t *vp) { Index: src/sys/sys/vnode.h diff -u src/sys/sys/vnode.h:1.259 src/sys/sys/vnode.h:1.260 --- src/sys/sys/vnode.h:1.259 Sat Jan 23 16:08:20 2016 +++ src/sys/sys/vnode.h Thu May 19 14:47:33 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vnode.h,v 1.259 2016/01/23 16:08:20 christos Exp $ */ +/* $NetBSD: vnode.h,v 1.260 2016/05/19 14:47:33 hannken Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -546,9 +546,6 @@ int vtruncbuf(struct vnode *, daddr_t, b void vwakeup(struct buf *); int vdead_check(struct vnode *, int); void vrevoke(struct vnode *); -struct vnode * - vnalloc(struct mount *); -void vnfree(struct vnode *); void vremfree(struct vnode *); int vcache_get(struct mount *, const void *, size_t, stru
CVS commit: src/sys/netinet6
Module Name:src Committed By: ozaki-r Date: Thu May 19 08:53:25 UTC 2016 Modified Files: src/sys/netinet6: ip6_input.c Log Message: Get rcvif once and reuse it No functional change. To generate a diff of this commit: cvs rdiff -u -r1.158 -r1.159 src/sys/netinet6/ip6_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet6/ip6_input.c diff -u src/sys/netinet6/ip6_input.c:1.158 src/sys/netinet6/ip6_input.c:1.159 --- src/sys/netinet6/ip6_input.c:1.158 Mon Apr 4 07:37:07 2016 +++ src/sys/netinet6/ip6_input.c Thu May 19 08:53:25 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_input.c,v 1.158 2016/04/04 07:37:07 ozaki-r Exp $ */ +/* $NetBSD: ip6_input.c,v 1.159 2016/05/19 08:53:25 ozaki-r Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.158 2016/04/04 07:37:07 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.159 2016/05/19 08:53:25 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_gateway.h" @@ -248,6 +248,7 @@ ip6_input(struct mbuf *m) struct sockaddr dst; struct sockaddr_in6 dst6; } u; + struct ifnet *rcvif = m->m_pkthdr.rcvif; /* * make sure we don't have onion peering information into m_tag. @@ -265,19 +266,18 @@ ip6_input(struct mbuf *m) } else { #define M2MMAX 32 if (m->m_next) { - if (m->m_flags & M_LOOP) { + if (m->m_flags & M_LOOP) /*XXX*/ IP6_STATINC(IP6_STAT_M2M + lo0ifp->if_index); - } else if (m->m_pkthdr.rcvif->if_index < M2MMAX) { -IP6_STATINC(IP6_STAT_M2M + - m->m_pkthdr.rcvif->if_index); - } else + else if (rcvif->if_index < M2MMAX) +IP6_STATINC(IP6_STAT_M2M + rcvif->if_index); + else IP6_STATINC(IP6_STAT_M2M); } else IP6_STATINC(IP6_STAT_M1); #undef M2MMAX } - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_receive); + in6_ifstat_inc(rcvif, ifs6_in_receive); IP6_STATINC(IP6_STAT_TOTAL); /* @@ -287,19 +287,17 @@ ip6_input(struct mbuf *m) * IPv6 header is in the first mbuf of the chain. */ if (IP6_HDR_ALIGNED_P(mtod(m, void *)) == 0) { - struct ifnet *inifp = m->m_pkthdr.rcvif; if ((m = m_copyup(m, sizeof(struct ip6_hdr), (max_linkhdr + 3) & ~3)) == NULL) { /* XXXJRT new stat, please */ IP6_STATINC(IP6_STAT_TOOSMALL); - in6_ifstat_inc(inifp, ifs6_in_hdrerr); + in6_ifstat_inc(rcvif, ifs6_in_hdrerr); return; } } else if (__predict_false(m->m_len < sizeof(struct ip6_hdr))) { - struct ifnet *inifp = m->m_pkthdr.rcvif; if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) { IP6_STATINC(IP6_STAT_TOOSMALL); - in6_ifstat_inc(inifp, ifs6_in_hdrerr); + in6_ifstat_inc(rcvif, ifs6_in_hdrerr); return; } } @@ -308,7 +306,7 @@ ip6_input(struct mbuf *m) if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { IP6_STATINC(IP6_STAT_BADVERS); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr); + in6_ifstat_inc(rcvif, ifs6_in_hdrerr); goto bad; } @@ -338,8 +336,7 @@ ip6_input(struct mbuf *m) struct in6_addr odst; odst = ip6->ip6_dst; - if (pfil_run_hooks(inet6_pfil_hook, &m, m->m_pkthdr.rcvif, - PFIL_IN) != 0) + if (pfil_run_hooks(inet6_pfil_hook, &m, rcvif, PFIL_IN) != 0) return; if (m == NULL) return; @@ -365,7 +362,7 @@ ip6_input(struct mbuf *m) * XXX: "badscope" is not very suitable for a multicast source. */ IP6_STATINC(IP6_STAT_BADSCOPE); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } /* @@ -383,7 +380,7 @@ ip6_input(struct mbuf *m) if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { IP6_STATINC(IP6_STAT_BADSCOPE); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } #if 0 @@ -397,7 +394,7 @@ ip6_input(struct mbuf *m) if (IN6_IS_ADDR_V4COMPAT(&ip6->ip6_src) || IN6_IS_ADDR_V4COMPAT(&ip6->ip6_dst)) { IP6_STATINC(IP6_STAT_BADSCOPE); - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); goto bad; } #endif @@ -420,8 +417,8 @@ ip6_input(struct mbuf *m) IP6_STATINC(IP6_STAT_BADSCOPE); /* XXX */ goto bad; } - if (in6_setscope(&ip6->ip6_src, m->m_pkthdr.rcvif, NULL) || - in6_setscope(&ip6->ip6_dst, m->m_pkthdr.rcvif, NULL)) { + if (in6_setscope(&ip6->ip6_src, rcvif, NULL) || + in6_setscope(&ip6->ip6_dst, rcvif, NULL)) { IP6_STATINC(IP6_STAT_BADSCOPE); goto bad; } @@ -432,12 +429,12 @@ ip6_input(struct mbuf *m) if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { struct in6_multi *in6m = 0; - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mcast); + in6_ifstat_inc(rcvif, ifs6_in_mcast); /* * See if we belong to the destination multicast group on the * arrival interface. */ - IN6_LOOKUP_MULTI(ip6->ip6_dst, m->m_pkthdr.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: knakahara Date: Thu May 19 08:35:04 UTC 2016 Modified Files: src/sys/dev/pci: if_wm.c Log Message: fix build failure by gcc 4.8.5 To generate a diff of this commit: cvs rdiff -u -r1.405 -r1.406 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.405 src/sys/dev/pci/if_wm.c:1.406 --- src/sys/dev/pci/if_wm.c:1.405 Thu May 19 08:27:57 2016 +++ src/sys/dev/pci/if_wm.c Thu May 19 08:35:03 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.405 2016/05/19 08:27:57 knakahara Exp $ */ +/* $NetBSD: if_wm.c,v 1.406 2016/05/19 08:35:03 knakahara Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -83,7 +83,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.405 2016/05/19 08:27:57 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.406 2016/05/19 08:35:03 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -5880,7 +5880,7 @@ wm_init_rx_queue(struct wm_softc *sc, st static int wm_init_txrx_queues(struct wm_softc *sc) { - int i, error; + int i, error = 0; DPRINTF(WM_DEBUG_INIT, ("%s: %s called\n", device_xname(sc->sc_dev), __func__));
CVS commit: src/sys/dev/pci
Module Name:src Committed By: knakahara Date: Thu May 19 08:27:57 UTC 2016 Modified Files: src/sys/dev/pci: if_wm.c Log Message: unify TX and RX interrupt handler to use MSI-X vector efficiently To generate a diff of this commit: cvs rdiff -u -r1.404 -r1.405 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.404 src/sys/dev/pci/if_wm.c:1.405 --- src/sys/dev/pci/if_wm.c:1.404 Thu May 19 08:22:37 2016 +++ src/sys/dev/pci/if_wm.c Thu May 19 08:27:57 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.404 2016/05/19 08:22:37 knakahara Exp $ */ +/* $NetBSD: if_wm.c,v 1.405 2016/05/19 08:27:57 knakahara Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -83,7 +83,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.404 2016/05/19 08:22:37 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.405 2016/05/19 08:27:57 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -164,9 +164,8 @@ int wm_debug = WM_DEBUG_TX | WM_DEBUG_RX /* * This device driver's max interrupt numbers. */ -#define WM_MAX_NTXINTR 16 -#define WM_MAX_NRXINTR 16 -#define WM_MAX_NINTR (WM_MAX_NTXINTR + WM_MAX_NRXINTR + 1) +#define WM_MAX_NQUEUEINTR 16 +#define WM_MAX_NINTR (WM_MAX_NQUEUEINTR + 1) /* * Transmit descriptor list size. Due to errata, we can only have @@ -256,10 +255,7 @@ struct wm_softc; struct wm_txqueue { kmutex_t *txq_lock; /* lock for tx operations */ - struct wm_softc *txq_sc; - - int txq_id; /* index of transmit queues */ - int txq_intr_idx; /* index of MSI-X tables */ + struct wm_softc *txq_sc; /* shortcut (skip struct wm_queue) */ /* Software state for the transmit descriptors. */ int txq_num; /* must be a power of two */ @@ -310,10 +306,7 @@ struct wm_txqueue { struct wm_rxqueue { kmutex_t *rxq_lock; /* lock for rx operations */ - struct wm_softc *rxq_sc; - - int rxq_id; /* index of receive queues */ - int rxq_intr_idx; /* index of MSI-X tables */ + struct wm_softc *rxq_sc; /* shortcut (skip struct wm_queue) */ /* Software state for the receive descriptors. */ wiseman_rxdesc_t *rxq_descs; @@ -338,6 +331,14 @@ struct wm_rxqueue { /* XXX which event counter is required? */ }; +struct wm_queue { + int wmq_id; /* index of transmit and receive queues */ + int wmq_intr_idx; /* index of MSI-X tables */ + + struct wm_txqueue wmq_txq; + struct wm_rxqueue wmq_rxq; +}; + /* * Software state per device. */ @@ -402,11 +403,8 @@ struct wm_softc { int sc_ich8_flash_bank_size; int sc_nvm_k1_enabled; - int sc_ntxqueues; - struct wm_txqueue *sc_txq; - - int sc_nrxqueues; - struct wm_rxqueue *sc_rxq; + int sc_nqueues; + struct wm_queue *sc_queue; int sc_affinity_offset; @@ -609,18 +607,22 @@ static int wm_82547_txfifo_bugchk(struct static int wm_alloc_tx_descs(struct wm_softc *, struct wm_txqueue *); static void wm_free_tx_descs(struct wm_softc *, struct wm_txqueue *); static void wm_init_tx_descs(struct wm_softc *, struct wm_txqueue *); -static void wm_init_tx_regs(struct wm_softc *, struct wm_txqueue *); +static void wm_init_tx_regs(struct wm_softc *, struct wm_queue *, +struct wm_txqueue *); static int wm_alloc_rx_descs(struct wm_softc *, struct wm_rxqueue *); static void wm_free_rx_descs(struct wm_softc *, struct wm_rxqueue *); -static void wm_init_rx_regs(struct wm_softc *, struct wm_rxqueue *); +static void wm_init_rx_regs(struct wm_softc *, struct wm_queue *, +struct wm_rxqueue *); static int wm_alloc_tx_buffer(struct wm_softc *, struct wm_txqueue *); static void wm_free_tx_buffer(struct wm_softc *, struct wm_txqueue *); static void wm_init_tx_buffer(struct wm_softc *, struct wm_txqueue *); static int wm_alloc_rx_buffer(struct wm_softc *, struct wm_rxqueue *); static void wm_free_rx_buffer(struct wm_softc *, struct wm_rxqueue *); static int wm_init_rx_buffer(struct wm_softc *, struct wm_rxqueue *); -static void wm_init_tx_queue(struct wm_softc *, struct wm_txqueue *); -static int wm_init_rx_queue(struct wm_softc *, struct wm_rxqueue *); +static void wm_init_tx_queue(struct wm_softc *, struct wm_queue *, +struct wm_txqueue *); +static int wm_init_rx_queue(struct wm_softc *, struct wm_queue *, +struct wm_rxqueue *); static int wm_alloc_txrx_queues(struct wm_softc *); static void wm_free_txrx_queues(struct wm_softc *); static int wm_init_txrx_queues(struct wm_softc *); @@ -645,8 +647,7 @@ static void wm_linkintr_tbi(struct wm_so static void wm_linkintr_serdes(struct wm_softc *, uint32_t); static void wm_linkintr(struct wm_softc *, uint32_t); static int wm_intr_legacy(void *); -static int wm_txintr_msix(void *); -static int wm_rxintr_msix(void *); +static int wm_txrxintr_msix(void *); static int wm_linkintr_msix(void *); /* @@ -1675,7 +1676,7 @@ wm_attach(device_t parent, device_t se
CVS commit: src/sys/dev/pci
Module Name:src Committed By: knakahara Date: Thu May 19 08:22:37 UTC 2016 Modified Files: src/sys/dev/pci: if_wm.c Log Message: user-friendly interrupt affinity offset To generate a diff of this commit: cvs rdiff -u -r1.403 -r1.404 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.403 src/sys/dev/pci/if_wm.c:1.404 --- src/sys/dev/pci/if_wm.c:1.403 Thu May 19 08:20:06 2016 +++ src/sys/dev/pci/if_wm.c Thu May 19 08:22:37 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.403 2016/05/19 08:20:06 knakahara Exp $ */ +/* $NetBSD: if_wm.c,v 1.404 2016/05/19 08:22:37 knakahara Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -83,7 +83,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.403 2016/05/19 08:20:06 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.404 2016/05/19 08:22:37 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -408,6 +408,8 @@ struct wm_softc { int sc_nrxqueues; struct wm_rxqueue *sc_rxq; + int sc_affinity_offset; + #ifdef WM_EVENT_COUNTERS /* Event counters. */ struct evcnt sc_ev_txsstall; /* Tx stalled due to no txs */ @@ -4377,11 +4379,20 @@ wm_setup_msix(struct wm_softc *sc) const char *intrstr = NULL; char intrbuf[PCI_INTRSTR_LEN]; char intr_xname[INTRDEVNAMEBUF]; - /* - * To avoid other devices' interrupts, the affinity of Tx/Rx interrupts - * start from CPU#1. - */ - int affinity_offset = 1; + + if (sc->sc_ntxqueues + sc->sc_nrxqueues < ncpu) { + /* + * To avoid other devices' interrupts, the affinity of Tx/Rx + * interrupts start from CPU#1. + */ + sc->sc_affinity_offset = 1; + } else { + /* + * In this case, this device use all CPUs. So, we unify + * affinitied cpu_index to msix vector number for readability. + */ + sc->sc_affinity_offset = 0; + } error = wm_alloc_txrx_queues(sc); if (error) { @@ -4399,7 +4410,7 @@ wm_setup_msix(struct wm_softc *sc) tx_established = 0; for (qidx = 0; qidx < sc->sc_ntxqueues; qidx++) { struct wm_txqueue *txq = &sc->sc_txq[qidx]; - int affinity_to = (affinity_offset + intr_idx) % ncpu; + int affinity_to = (sc->sc_affinity_offset + intr_idx) % ncpu; intrstr = pci_intr_string(pc, sc->sc_intrs[intr_idx], intrbuf, sizeof(intrbuf)); @@ -4446,7 +4457,7 @@ wm_setup_msix(struct wm_softc *sc) rx_established = 0; for (qidx = 0; qidx < sc->sc_nrxqueues; qidx++) { struct wm_rxqueue *rxq = &sc->sc_rxq[qidx]; - int affinity_to = (affinity_offset + intr_idx) % ncpu; + int affinity_to = (sc->sc_affinity_offset + intr_idx) % ncpu; intrstr = pci_intr_string(pc, sc->sc_intrs[intr_idx], intrbuf, sizeof(intrbuf)); @@ -6745,8 +6756,7 @@ wm_nq_select_txqueue(struct ifnet *ifp, * TODO: * destribute by flowid(RSS has value). */ - - return cpuid % sc->sc_ntxqueues; + return (cpuid + sc->sc_affinity_offset) % sc->sc_ntxqueues; } static int
CVS commit: src/sys/dev/pci
Module Name:src Committed By: knakahara Date: Thu May 19 08:20:06 UTC 2016 Modified Files: src/sys/dev/pci: if_wm.c Log Message: initial TX multiqueue support To generate a diff of this commit: cvs rdiff -u -r1.402 -r1.403 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.402 src/sys/dev/pci/if_wm.c:1.403 --- src/sys/dev/pci/if_wm.c:1.402 Wed May 18 08:59:56 2016 +++ src/sys/dev/pci/if_wm.c Thu May 19 08:20:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.402 2016/05/18 08:59:56 knakahara Exp $ */ +/* $NetBSD: if_wm.c,v 1.403 2016/05/19 08:20:06 knakahara Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -83,7 +83,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.402 2016/05/18 08:59:56 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.403 2016/05/19 08:20:06 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -103,6 +103,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1. #include #include #include +#include +#include #include @@ -194,6 +196,8 @@ int wm_debug = WM_DEBUG_TX | WM_DEBUG_RX #define WM_MAXTXDMA (2 * round_page(IP_MAXPACKET)) /* for TSO */ +#define WM_TXINTERQSIZE 256 + /* * Receive descriptor list size. We have one Rx buffer for normal * sized packets. Jumbo packets consume 5 Rx buffers for a full-sized @@ -288,6 +292,12 @@ struct wm_txqueue { int txq_fifo_stall; /* Tx FIFO is stalled */ /* + * When ncpu > number of Tx queues, a Tx queue is shared by multiple + * CPUs. This queue intermediate them without block. + */ + pcq_t *txq_interq; + + /* * NEWQUEUE devices must use not ifp->if_flags but txq->txq_flags * to manage Tx H/W queue's busy flag. */ @@ -459,6 +469,7 @@ struct wm_softc { }; #define WM_TX_LOCK(_txq) if ((_txq)->txq_lock) mutex_enter((_txq)->txq_lock) +#define WM_TX_TRYLOCK(_txq) ((_txq)->txq_lock == NULL || mutex_tryenter((_txq)->txq_lock)) #define WM_TX_UNLOCK(_txq) if ((_txq)->txq_lock) mutex_exit((_txq)->txq_lock) #define WM_TX_LOCKED(_txq) (!(_txq)->txq_lock || mutex_owned((_txq)->txq_lock)) #define WM_RX_LOCK(_rxq) if ((_rxq)->rxq_lock) mutex_enter((_rxq)->rxq_lock) @@ -559,6 +570,7 @@ static int wm_detach(device_t, int); static bool wm_suspend(device_t, const pmf_qual_t *); static bool wm_resume(device_t, const pmf_qual_t *); static void wm_watchdog(struct ifnet *); +static void wm_watchdog_txq(struct ifnet *, struct wm_txqueue *); static void wm_tick(void *); static int wm_ifflags_cb(struct ethercom *); static int wm_ioctl(struct ifnet *, u_long, void *); @@ -615,12 +627,16 @@ static int wm_tx_offload(struct wm_softc uint32_t *, uint8_t *); static void wm_start(struct ifnet *); static void wm_start_locked(struct ifnet *); -static int wm_nq_tx_offload(struct wm_softc *, struct wm_txsoft *, -uint32_t *, uint32_t *, bool *); +static int wm_nq_tx_offload(struct wm_softc *, struct wm_txqueue *, +struct wm_txsoft *, uint32_t *, uint32_t *, bool *); static void wm_nq_start(struct ifnet *); static void wm_nq_start_locked(struct ifnet *); +static int wm_nq_transmit(struct ifnet *, struct mbuf *); +static inline int wm_nq_select_txqueue(struct ifnet *, struct mbuf *); +static void wm_nq_transmit_locked(struct ifnet *, struct wm_txqueue *); +static void wm_nq_send_common_locked(struct ifnet *, struct wm_txqueue *, bool); /* Interrupt */ -static int wm_txeof(struct wm_softc *); +static int wm_txeof(struct wm_softc *, struct wm_txqueue *); static void wm_rxeof(struct wm_rxqueue *); static void wm_linkintr_gmii(struct wm_softc *, uint32_t); static void wm_linkintr_tbi(struct wm_softc *, uint32_t); @@ -2394,9 +2410,11 @@ alloc_retry: ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = wm_ioctl; - if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) + if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) { ifp->if_start = wm_nq_start; - else + if (sc->sc_ntxqueues > 1) + ifp->if_transmit = wm_nq_transmit; + } else ifp->if_start = wm_start; ifp->if_watchdog = wm_watchdog; ifp->if_init = wm_init; @@ -2686,15 +2704,37 @@ wm_resume(device_t self, const pmf_qual_ static void wm_watchdog(struct ifnet *ifp) { + int qid; + struct wm_softc *sc = ifp->if_softc; + + for (qid = 0; qid < sc->sc_ntxqueues; qid++) { + struct wm_txqueue *txq = &sc->sc_txq[qid]; + + wm_watchdog_txq(ifp, txq); + } + + /* Reset the interface. */ + (void) wm_init(ifp); + + /* + * There are still some upper layer processing which call + * ifp->if_start(). e.g. ALTQ + */ + /* Try to get more packets going. */ + ifp->if_start(ifp); +} + +static void +wm_watchdog_txq(struct ifnet *ifp, struct wm_txqueue *txq) +{ struct wm_softc *sc = ifp->if_softc; - struct wm_txqueue *txq = &sc->sc_txq[0]; /* * Since we're using delayed interrupts,