CVS commit: src/sys
Module Name:src Committed By: msaitoh Date: Mon Dec 2 03:06:52 UTC 2019 Modified Files: src/sys/arch/arm/cortex: gic_v2m.c gicv3_its.c src/sys/arch/x86/pci: msipic.c src/sys/dev/pci: if_ena.c nvme_pci.c xhci_pci.c src/sys/dev/pci/qat: qat.c Log Message: Use PCI_MSIX_"TBL"BIR_MASK instead of PCI_MSIX_"PBA"BIR_MASK for MSI-X table. This is not a real bug because both macros have the same value. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/cortex/gic_v2m.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/cortex/gicv3_its.c cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x86/pci/msipic.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/if_ena.c cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/nvme_pci.c cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/xhci_pci.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/qat/qat.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/arch/arm/cortex/gic_v2m.c diff -u src/sys/arch/arm/cortex/gic_v2m.c:1.7 src/sys/arch/arm/cortex/gic_v2m.c:1.8 --- src/sys/arch/arm/cortex/gic_v2m.c:1.7 Mon Oct 14 11:00:13 2019 +++ src/sys/arch/arm/cortex/gic_v2m.c Mon Dec 2 03:06:51 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: gic_v2m.c,v 1.7 2019/10/14 11:00:13 jmcneill Exp $ */ +/* $NetBSD: gic_v2m.c,v 1.8 2019/12/02 03:06:51 msaitoh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #define _INTR_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: gic_v2m.c,v 1.7 2019/10/14 11:00:13 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gic_v2m.c,v 1.8 2019/12/02 03:06:51 msaitoh Exp $"); #include #include @@ -280,7 +280,7 @@ gic_v2m_msix_alloc(struct arm_pci_msi *m return NULL; tbl = pci_conf_read(pa->pa_pc, pa->pa_tag, off + PCI_MSIX_TBLOFFSET); - bar = PCI_BAR0 + (4 * (tbl & PCI_MSIX_PBABIR_MASK)); + bar = PCI_BAR0 + (4 * (tbl & PCI_MSIX_TBLBIR_MASK)); table_offset = tbl & PCI_MSIX_TBLOFFSET_MASK; table_size = pci_msix_count(pa->pa_pc, pa->pa_tag) * PCI_MSIX_TABLE_ENTRY_SIZE; if (table_size == 0) Index: src/sys/arch/arm/cortex/gicv3_its.c diff -u src/sys/arch/arm/cortex/gicv3_its.c:1.21 src/sys/arch/arm/cortex/gicv3_its.c:1.22 --- src/sys/arch/arm/cortex/gicv3_its.c:1.21 Sun Jun 30 17:33:59 2019 +++ src/sys/arch/arm/cortex/gicv3_its.c Mon Dec 2 03:06:51 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: gicv3_its.c,v 1.21 2019/06/30 17:33:59 jmcneill Exp $ */ +/* $NetBSD: gicv3_its.c,v 1.22 2019/12/02 03:06:51 msaitoh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #define _INTR_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.21 2019/06/30 17:33:59 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.22 2019/12/02 03:06:51 msaitoh Exp $"); #include #include @@ -525,7 +525,7 @@ gicv3_its_msix_alloc(struct arm_pci_msi return NULL; tbl = pci_conf_read(pa->pa_pc, pa->pa_tag, off + PCI_MSIX_TBLOFFSET); - bar = PCI_BAR0 + (4 * (tbl & PCI_MSIX_PBABIR_MASK)); + bar = PCI_BAR0 + (4 * (tbl & PCI_MSIX_TBLBIR_MASK)); table_offset = tbl & PCI_MSIX_TBLOFFSET_MASK; table_size = pci_msix_count(pa->pa_pc, pa->pa_tag) * PCI_MSIX_TABLE_ENTRY_SIZE; if (table_size == 0) Index: src/sys/arch/x86/pci/msipic.c diff -u src/sys/arch/x86/pci/msipic.c:1.19 src/sys/arch/x86/pci/msipic.c:1.20 --- src/sys/arch/x86/pci/msipic.c:1.19 Wed Nov 13 02:54:59 2019 +++ src/sys/arch/x86/pci/msipic.c Mon Dec 2 03:06:51 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: msipic.c,v 1.19 2019/11/13 02:54:59 hikaru Exp $ */ +/* $NetBSD: msipic.c,v 1.20 2019/12/02 03:06:51 msaitoh Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.19 2019/11/13 02:54:59 hikaru Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.20 2019/12/02 03:06:51 msaitoh Exp $"); #include "opt_intrdebug.h" @@ -659,7 +659,7 @@ msipic_construct_msix_pic(const struct p tbl = pci_conf_read(pc, tag, off + PCI_MSIX_TBLOFFSET); table_offset = tbl & PCI_MSIX_TBLOFFSET_MASK; - bir = tbl & PCI_MSIX_PBABIR_MASK; + bir = tbl & PCI_MSIX_TBLBIR_MASK; switch (bir) { case 0: bar = PCI_BAR0; Index: src/sys/dev/pci/if_ena.c diff -u src/sys/dev/pci/if_ena.c:1.18 src/sys/dev/pci/if_ena.c:1.19 --- src/sys/dev/pci/if_ena.c:1.18 Sun Nov 10 21:16:36 2019 +++ src/sys/dev/pci/if_ena.c Mon Dec 2 03:06:51 2019 @@ -31,7 +31,7 @@ #if 0 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $"); #endif -__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.18 2019/11/10 21:16:36 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.19 2019/12/02 03:06:51 msaitoh Exp $"); #include #include @@ -314,7 +314,7 @@ ena_allocate_pci_resources(struct pci_at msixtbl = pci_conf_read(pa->pa_pc, pa->pa_tag, msixoff + PCI_MSIX_TBLOFFSET); table_offset = msixtbl & PCI_MSIX_TBLOFFSET_MASK; - bir = msixtbl & PCI_MSIX_PBABIR_MASK; + bir =
CVS commit: src/lib/libc/arch/x86_64/sys
Module Name:src Committed By: christos Date: Mon Dec 2 01:38:54 UTC 2019 Modified Files: src/lib/libc/arch/x86_64/sys: __sigtramp2.S Log Message: Add cfi annotations so that gdb can unwind the stack through signal handlers. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/x86_64/sys/__sigtramp2.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/arch/x86_64/sys/__sigtramp2.S diff -u src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.6 src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.7 --- src/lib/libc/arch/x86_64/sys/__sigtramp2.S:1.6 Thu May 22 11:01:57 2014 +++ src/lib/libc/arch/x86_64/sys/__sigtramp2.S Sun Dec 1 20:38:54 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: __sigtramp2.S,v 1.6 2014/05/22 15:01:57 uebayasi Exp $ */ +/* $NetBSD: __sigtramp2.S,v 1.7 2019/12/02 01:38:54 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -42,10 +42,13 @@ * the signal; the kernel calls the signal handler directly. */ NENTRY(__sigtramp_siginfo_2) + .cfi_startproc + .cfi_def_cfa rsp, 8 movq %r15,%rdi movq $SYS_setcontext, %rax syscall movq $-1,%rdi /* if we return here, something is wrong */ movq $SYS_exit, %rax syscall + .cfi_endproc END(__sigtramp_siginfo_2)
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Mon Dec 2 01:01:08 UTC 2019 Modified Files: src/usr.bin/make/unit-tests: varmod-edge.exp varmod-edge.mk Log Message: Add more tests for variable modifiers in make. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-edge.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-edge.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/varmod-edge.exp diff -u src/usr.bin/make/unit-tests/varmod-edge.exp:1.3 src/usr.bin/make/unit-tests/varmod-edge.exp:1.4 --- src/usr.bin/make/unit-tests/varmod-edge.exp:1.3 Sat Nov 30 03:53:45 2019 +++ src/usr.bin/make/unit-tests/varmod-edge.exp Mon Dec 2 01:01:08 2019 @@ -1,4 +1,5 @@ make: Unclosed variable specification (expecting '}') for "" (value "*)") modifier U +make: Unclosed substitution for INP.eq-esc (= missing) ok M-paren ok M-mixed ok M-unescape @@ -8,4 +9,9 @@ ok M-pat-err ok M-bsbs ok M-bs1-par ok M-bs2-par +ok M-128 +ok eq-ext +ok eq-q +ok eq-bs +ok eq-esc exit status 0 Index: src/usr.bin/make/unit-tests/varmod-edge.mk diff -u src/usr.bin/make/unit-tests/varmod-edge.mk:1.5 src/usr.bin/make/unit-tests/varmod-edge.mk:1.6 --- src/usr.bin/make/unit-tests/varmod-edge.mk:1.5 Sun Dec 1 23:53:49 2019 +++ src/usr.bin/make/unit-tests/varmod-edge.mk Mon Dec 2 01:01:08 2019 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-edge.mk,v 1.5 2019/12/01 23:53:49 rillig Exp $ +# $NetBSD: varmod-edge.mk,v 1.6 2019/12/02 01:01:08 rillig Exp $ # # Tests for edge cases in variable modifiers. # @@ -51,6 +51,7 @@ TESTS+= M-nest-mix INP.M-nest-mix= (parentheses) MOD.M-nest-mix= ${INP.M-nest-mix:M${:U*)}} EXP.M-nest-mix= (parentheses)} +# make: Unclosed variable specification (expecting '}') for "" (value "*)") modifier U # In contrast to parentheses and braces, the brackets are not counted # when the :M modifier is parsed since Makefile variables only take the @@ -112,6 +113,44 @@ INP.M-bs2-par= ( (:M (:M} \( \(:M \(:M} MOD.M-bs2-par= ${INP.M-bs2-par:M\\(:M*}}} EXP.M-bs2-par= \(:M}} +# Str_Match uses a recursive algorithm for matching the * patterns. +# Make sure that it survives patterns with 128 asterisks. +# That should be enough for all practical purposes. +# To produce a stack overflow, just add more :Qs below. +TESTS+= M-128 +INP.M-128= ${:U\\:Q:Q:Q:Q:Q:Q:Q:S,\\,x,g} +PAT.M-128= ${:U\\:Q:Q:Q:Q:Q:Q:Q:S,\\,*,g} +MOD.M-128= ${INP.M-128:M${PAT.M-128}} +EXP.M-128= ${INP.M-128} + +# This is the normal SysV substitution. Nothing surprising here. +TESTS+= eq-ext +INP.eq-ext= file.c file.cc +MOD.eq-ext= ${INP.eq-ext:%.c=%.o} +EXP.eq-ext= file.o file.cc + +# The SysV := modifier is greedy and consumes all the modifier text +# up until the closing brace or parenthesis. The :Q may look like a +# modifier, but it really isn't, that's why it appears in the output. +TESTS+= eq-q +INP.eq-q= file.c file.cc +MOD.eq-q= ${INP.eq-q:%.c=%.o:Q} +EXP.eq-q= file.o:Q file.cc + +# The = in the := modifier can be escaped. +TESTS+= eq-bs +INP.eq-bs= file.c file.c=%.o +MOD.eq-bs= ${INP.eq-bs:%.c\=%.o=.ext} +EXP.eq-bs= file.c file.ext + +# Having only an escaped = results in a parse error. +# The call to "pattern.lhs = VarGetPattern" fails. +TESTS+= eq-esc +INP.eq-esc= file.c file... +MOD.eq-esc= ${INP.eq-esc:a\=b} +EXP.eq-esc= # empty +# make: Unclosed substitution for INP.eq-esc (= missing) + all: .for test in ${TESTS} . if ${MOD.${test}} == ${EXP.${test}}
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Dec 1 23:53:49 UTC 2019 Modified Files: src/usr.bin/make: str.c src/usr.bin/make/unit-tests: varmod-edge.mk Log Message: Fix out-of-bounds read in Str_Match. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.bin/make/str.c cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-edge.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/str.c diff -u src/usr.bin/make/str.c:1.38 src/usr.bin/make/str.c:1.39 --- src/usr.bin/make/str.c:1.38 Fri Apr 21 22:15:44 2017 +++ src/usr.bin/make/str.c Sun Dec 1 23:53:49 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.38 2017/04/21 22:15:44 sjg Exp $ */ +/* $NetBSD: str.c,v 1.39 2019/12/01 23:53:49 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: str.c,v 1.38 2017/04/21 22:15:44 sjg Exp $"; +static char rcsid[] = "$NetBSD: str.c,v 1.39 2019/12/01 23:53:49 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90"; #else -__RCSID("$NetBSD: str.c,v 1.38 2017/04/21 22:15:44 sjg Exp $"); +__RCSID("$NetBSD: str.c,v 1.39 2019/12/01 23:53:49 rillig Exp $"); #endif #endif/* not lint */ #endif @@ -407,6 +407,8 @@ Str_Match(const char *string, const char return 0; while ((*pattern != ']') && (*pattern != 0)) ++pattern; + if (*pattern == 0) +--pattern; goto thisCharOK; } /* Index: src/usr.bin/make/unit-tests/varmod-edge.mk diff -u src/usr.bin/make/unit-tests/varmod-edge.mk:1.4 src/usr.bin/make/unit-tests/varmod-edge.mk:1.5 --- src/usr.bin/make/unit-tests/varmod-edge.mk:1.4 Sat Nov 30 03:53:45 2019 +++ src/usr.bin/make/unit-tests/varmod-edge.mk Sun Dec 1 23:53:49 2019 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-edge.mk,v 1.4 2019/11/30 03:53:45 rillig Exp $ +# $NetBSD: varmod-edge.mk,v 1.5 2019/12/01 23:53:49 rillig Exp $ # # Tests for edge cases in variable modifiers. # @@ -67,6 +67,9 @@ EXP.M-nest-brk= [ # # XXX: It is unexpected that no error is reported. # See str.c, function Str_Match. +# +# Before 2019-12-02, this test case triggered an out-of-bounds read +# in Str_Match. TESTS+= M-pat-err INP.M-pat-err= [ [[ [[[ MOD.M-pat-err= ${INP.M-pat-err:M${:U[[}}
CVS commit: src/sys/uvm
Module Name:src Committed By: uwe Date: Sun Dec 1 23:14:47 UTC 2019 Modified Files: src/sys/uvm: uvm_anon.c uvm_km.c uvm_pager.c uvm_swap.c Log Message: Add missing #include To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/uvm/uvm_anon.c cvs rdiff -u -r1.149 -r1.150 src/sys/uvm/uvm_km.c cvs rdiff -u -r1.112 -r1.113 src/sys/uvm/uvm_pager.c cvs rdiff -u -r1.182 -r1.183 src/sys/uvm/uvm_swap.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/uvm/uvm_anon.c diff -u src/sys/uvm/uvm_anon.c:1.66 src/sys/uvm/uvm_anon.c:1.67 --- src/sys/uvm/uvm_anon.c:1.66 Sun Dec 1 17:02:50 2019 +++ src/sys/uvm/uvm_anon.c Sun Dec 1 23:14:47 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_anon.c,v 1.66 2019/12/01 17:02:50 ad Exp $ */ +/* $NetBSD: uvm_anon.c,v 1.67 2019/12/01 23:14:47 uwe Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.66 2019/12/01 17:02:50 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.67 2019/12/01 23:14:47 uwe Exp $"); #include "opt_uvmhist.h" @@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v #include #include #include +#include #include #include Index: src/sys/uvm/uvm_km.c diff -u src/sys/uvm/uvm_km.c:1.149 src/sys/uvm/uvm_km.c:1.150 --- src/sys/uvm/uvm_km.c:1.149 Sun Dec 1 14:43:26 2019 +++ src/sys/uvm/uvm_km.c Sun Dec 1 23:14:47 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_km.c,v 1.149 2019/12/01 14:43:26 ad Exp $ */ +/* $NetBSD: uvm_km.c,v 1.150 2019/12/01 23:14:47 uwe Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -152,7 +152,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.149 2019/12/01 14:43:26 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.150 2019/12/01 23:14:47 uwe Exp $"); #include "opt_uvmhist.h" @@ -177,6 +177,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1 #include #include +#include #include #include #include Index: src/sys/uvm/uvm_pager.c diff -u src/sys/uvm/uvm_pager.c:1.112 src/sys/uvm/uvm_pager.c:1.113 --- src/sys/uvm/uvm_pager.c:1.112 Sun Dec 1 14:40:31 2019 +++ src/sys/uvm/uvm_pager.c Sun Dec 1 23:14:47 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_pager.c,v 1.112 2019/12/01 14:40:31 ad Exp $ */ +/* $NetBSD: uvm_pager.c,v 1.113 2019/12/01 23:14:47 uwe Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.112 2019/12/01 14:40:31 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.113 2019/12/01 23:14:47 uwe Exp $"); #include "opt_uvmhist.h" #include "opt_readahead.h" @@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_pager.c, #include #include +#include #include #include Index: src/sys/uvm/uvm_swap.c diff -u src/sys/uvm/uvm_swap.c:1.182 src/sys/uvm/uvm_swap.c:1.183 --- src/sys/uvm/uvm_swap.c:1.182 Sun Dec 1 14:40:31 2019 +++ src/sys/uvm/uvm_swap.c Sun Dec 1 23:14:47 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_swap.c,v 1.182 2019/12/01 14:40:31 ad Exp $ */ +/* $NetBSD: uvm_swap.c,v 1.183 2019/12/01 23:14:47 uwe Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.182 2019/12/01 14:40:31 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.183 2019/12/01 23:14:47 uwe Exp $"); #include "opt_uvmhist.h" #include "opt_compat_netbsd.h" @@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v #include #include +#include #include #include #include
CVS commit: src/share/misc
Module Name:src Committed By: sevan Date: Sun Dec 1 23:08:09 UTC 2019 Modified Files: src/share/misc: acronyms.comp Log Message: SCSI OSD To generate a diff of this commit: cvs rdiff -u -r1.294 -r1.295 src/share/misc/acronyms.comp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/misc/acronyms.comp diff -u src/share/misc/acronyms.comp:1.294 src/share/misc/acronyms.comp:1.295 --- src/share/misc/acronyms.comp:1.294 Sun Oct 20 21:53:42 2019 +++ src/share/misc/acronyms.comp Sun Dec 1 23:08:09 2019 @@ -1,4 +1,4 @@ -$NetBSD: acronyms.comp,v 1.294 2019/10/20 21:53:42 sevan Exp $ +$NetBSD: acronyms.comp,v 1.295 2019/12/01 23:08:09 sevan Exp $ 3WHS three-way handshake 8VSB 8-state vestigial side band modulation AA anti-aliasing @@ -1096,6 +1096,7 @@ OQL Object Query Language ORB object request broker ORM object-relational mapping OS operating system +OSD object-based storage device OSD open source definition OSF open software foundation OSI Open Source Initiative
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Dec 1 21:01:19 UTC 2019 Modified Files: src/sys/dev/usb: if_urtwn.c Log Message: Reset MCU ready status before resetting the MCU. Fixes PR kern/54728 To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/dev/usb/if_urtwn.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/usb/if_urtwn.c diff -u src/sys/dev/usb/if_urtwn.c:1.75 src/sys/dev/usb/if_urtwn.c:1.76 --- src/sys/dev/usb/if_urtwn.c:1.75 Tue Nov 26 10:34:16 2019 +++ src/sys/dev/usb/if_urtwn.c Sun Dec 1 21:01:19 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.75 2019/11/26 10:34:16 gson Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.76 2019/12/01 21:01:19 mlelstv Exp $ */ /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ /*- @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.75 2019/11/26 10:34:16 gson Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.76 2019/12/01 21:01:19 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -3467,6 +3467,8 @@ urtwn_load_firmware(struct urtwn_softc * } if (urtwn_read_1(sc, R92C_MCUFWDL) & R92C_MCUFWDL_RAM_DL_SEL) { + /* Reset MCU ready status */ + urtwn_write_1(sc, R92C_MCUFWDL, 0); if (ISSET(sc->chip, URTWN_CHIP_88E) || ISSET(sc->chip, URTWN_CHIP_92EU)) urtwn_r88e_fw_reset(sc);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Dec 1 21:02:09 UTC 2019 Modified Files: src/sys/dev/usb: if_urtwn.c Log Message: Don't deregister twice with pmf. To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/dev/usb/if_urtwn.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/usb/if_urtwn.c diff -u src/sys/dev/usb/if_urtwn.c:1.76 src/sys/dev/usb/if_urtwn.c:1.77 --- src/sys/dev/usb/if_urtwn.c:1.76 Sun Dec 1 21:01:19 2019 +++ src/sys/dev/usb/if_urtwn.c Sun Dec 1 21:02:09 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.76 2019/12/01 21:01:19 mlelstv Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.77 2019/12/01 21:02:09 mlelstv Exp $ */ /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ /*- @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.76 2019/12/01 21:01:19 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.77 2019/12/01 21:02:09 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -568,8 +568,6 @@ urtwn_detach(device_t self, int flags) callout_halt(>sc_scan_to, NULL); callout_halt(>sc_calib_to, NULL); - pmf_device_deregister(self); - if (ISSET(sc->sc_flags, URTWN_FLAG_ATTACHED)) { urtwn_stop(ifp, 0); usb_rem_task_wait(sc->sc_udev, >sc_task, USB_TASKQ_DRIVER,
CVS commit: src/etc/rc.d
Module Name:src Committed By: jmcneill Date: Sun Dec 1 21:00:43 UTC 2019 Modified Files: src/etc/rc.d: zfs Log Message: Attempt to load the zfs module even if /etc/zfs/zpool.cache is absent. The module needs to be loaded to create a pool in the first place, and autoloading won't work after the fact won't work at securelevel=1. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/etc/rc.d/zfs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/rc.d/zfs diff -u src/etc/rc.d/zfs:1.1 src/etc/rc.d/zfs:1.2 --- src/etc/rc.d/zfs:1.1 Sun Sep 15 19:38:09 2019 +++ src/etc/rc.d/zfs Sun Dec 1 21:00:43 2019 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: zfs,v 1.1 2019/09/15 19:38:09 brad Exp $ +# $NetBSD: zfs,v 1.2 2019/12/01 21:00:43 jmcneill Exp $ # # PROVIDE: zfs @@ -15,7 +15,7 @@ stop_cmd="zfs_stop" zfs_start() { - if [ -x /sbin/zfs -a -f /etc/zfs/zpool.cache ]; then + if [ -x /sbin/zfs ]; then # Get ZFS module loaded (and thereby, zvols created). /sbin/zfs list > /dev/null 2>&1 if [ $? -ne 0 ]; then
CVS commit: src/sys/kern
Module Name:src Committed By: riastradh Date: Sun Dec 1 20:56:40 UTC 2019 Modified Files: src/sys/kern: subr_xcall.c Log Message: Restore xcall(9) fast path using atomic_load/store_*. While here, fix a bug that was formerly in xcall(9): a missing acquire operation in the xc_wait fast path so that all memory operations in the xcall on remote CPUs will happen before any memory operations on the issuing CPU after xc_wait returns. All stores of xc->xc_donep are done with atomic_store_release so that we can safely use atomic_load_acquire to read it outside the lock. However, this fast path only works on platforms with cheap 64-bit atomic load/store, so conditionalize it on __HAVE_ATOMIC64_LOADSTORE. (Under the lock, no need for atomic loads since nobody else will be issuing stores.) For review, here's the relevant diff from the old version of the fast path, from before it was removed and some other things changed in the file: diff --git a/sys/kern/subr_xcall.c b/sys/kern/subr_xcall.c index 45a877aa90e0..b6bfb6455291 100644 --- a/sys/kern/subr_xcall.c +++ b/sys/kern/subr_xcall.c @@ -84,6 +84,7 @@ __KERNEL_RCSID(0, "$NetBSD: subr_xcall.c,v 1.27 2019/10/06 15:11:17 uwe Exp $"); #include #include #include +#include #ifdef _RUMPKERNEL #include "rump_private.h" @@ -334,10 +353,12 @@ xc_wait(uint64_t where) xc = _low_pri; } +#ifdef __HAVE_ATOMIC64_LOADSTORE /* Fast path, if already done. */ - if (xc->xc_donep >= where) { + if (atomic_load_acquire(>xc_donep) >= where) { return; } +#endif /* Slow path: block until awoken. */ mutex_enter(>xc_lock); @@ -422,7 +443,11 @@ xc_thread(void *cookie) (*func)(arg1, arg2); mutex_enter(>xc_lock); +#ifdef __HAVE_ATOMIC64_LOADSTORE + atomic_store_release(>xc_donep, xc->xc_donep + 1); +#else xc->xc_donep++; +#endif } /* NOTREACHED */ } @@ -462,7 +487,6 @@ xc__highpri_intr(void *dummy) * Lock-less fetch of function and its arguments. * Safe since it cannot change at this point. */ - KASSERT(xc->xc_donep < xc->xc_headp); func = xc->xc_func; arg1 = xc->xc_arg1; arg2 = xc->xc_arg2; @@ -475,7 +499,13 @@ xc__highpri_intr(void *dummy) * cross-call has been processed - notify waiters, if any. */ mutex_enter(>xc_lock); - if (++xc->xc_donep == xc->xc_headp) { + KASSERT(xc->xc_donep < xc->xc_headp); +#ifdef __HAVE_ATOMIC64_LOADSTORE + atomic_store_release(>xc_donep, xc->xc_donep + 1); +#else + xc->xc_donep++; +#endif + if (xc->xc_donep == xc->xc_headp) { cv_broadcast(>xc_busy); } mutex_exit(>xc_lock); To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/kern/subr_xcall.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/subr_xcall.c diff -u src/sys/kern/subr_xcall.c:1.31 src/sys/kern/subr_xcall.c:1.32 --- src/sys/kern/subr_xcall.c:1.31 Sun Dec 1 17:06:00 2019 +++ src/sys/kern/subr_xcall.c Sun Dec 1 20:56:39 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_xcall.c,v 1.31 2019/12/01 17:06:00 ad Exp $ */ +/* $NetBSD: subr_xcall.c,v 1.32 2019/12/01 20:56:39 riastradh Exp $ */ /*- * Copyright (c) 2007-2010, 2019 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_xcall.c,v 1.31 2019/12/01 17:06:00 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_xcall.c,v 1.32 2019/12/01 20:56:39 riastradh Exp $"); #include #include @@ -353,7 +353,14 @@ xc_wait(uint64_t where) xc = _low_pri; } - /* Block until awoken. */ +#ifdef __HAVE_ATOMIC64_LOADSTORE + /* Fast path, if already done. */ + if (atomic_load_acquire(>xc_donep) >= where) { + return; + } +#endif + + /* Slow path: block until awoken. */ mutex_enter(>xc_lock); while (xc->xc_donep < where) { cv_wait(>xc_busy, >xc_lock); @@ -436,7 +443,11 @@ xc_thread(void *cookie) (*func)(arg1, arg2); mutex_enter(>xc_lock); +#ifdef __HAVE_ATOMIC64_LOADSTORE + atomic_store_release(>xc_donep, xc->xc_donep + 1); +#else xc->xc_donep++; +#endif } /* NOTREACHED */ } @@ -489,7 +500,12 @@ xc__highpri_intr(void *dummy) */ mutex_enter(>xc_lock); KASSERT(xc->xc_donep < xc->xc_headp); - if (++xc->xc_donep == xc->xc_headp) { +#ifdef __HAVE_ATOMIC64_LOADSTORE + atomic_store_release(>xc_donep, xc->xc_donep + 1); +#else + xc->xc_donep++; +#endif + if (xc->xc_donep == xc->xc_headp) { cv_broadcast(>xc_busy); } mutex_exit(>xc_lock);
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Dec 1 20:31:40 UTC 2019 Modified Files: src/sys/uvm: uvm_aobj.c Log Message: Avoid calling pmap_page_protect() while under uvm_pageqlock. To generate a diff of this commit: cvs rdiff -u -r1.129 -r1.130 src/sys/uvm/uvm_aobj.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/uvm/uvm_aobj.c diff -u src/sys/uvm/uvm_aobj.c:1.129 src/sys/uvm/uvm_aobj.c:1.130 --- src/sys/uvm/uvm_aobj.c:1.129 Sun Dec 1 14:40:31 2019 +++ src/sys/uvm/uvm_aobj.c Sun Dec 1 20:31:40 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_aobj.c,v 1.129 2019/12/01 14:40:31 ad Exp $ */ +/* $NetBSD: uvm_aobj.c,v 1.130 2019/12/01 20:31:40 ad Exp $ */ /* * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.129 2019/12/01 14:40:31 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.130 2019/12/01 20:31:40 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_uvmhist.h" @@ -411,7 +411,7 @@ struct uvm_object * uao_create(voff_t size, int flags) { static struct uvm_aobj kernel_object_store; - static kmutex_t kernel_object_lock; + static kmutex_t kernel_object_lock __cacheline_aligned; static int kobj_alloced __diagused = 0; pgoff_t pages = round_page((uint64_t)size) >> PAGE_SHIFT; struct uvm_aobj *aobj; @@ -614,9 +614,11 @@ uao_detach(struct uvm_object *uobj) */ mutex_enter(uobj->vmobjlock); + TAILQ_FOREACH(pg, >memq, listq.queue) { + pmap_page_protect(pg, VM_PROT_NONE); + } mutex_enter(_pageqlock); while ((pg = TAILQ_FIRST(>memq)) != NULL) { - pmap_page_protect(pg, VM_PROT_NONE); if (pg->flags & PG_BUSY) { pg->flags |= PG_WANTED; mutex_exit(_pageqlock);
CVS commit: src/share/mk
Module Name:src Committed By: jmcneill Date: Sun Dec 1 20:28:25 UTC 2019 Modified Files: src/share/mk: bsd.own.mk Log Message: Enable ZFS support on aarch64 To generate a diff of this commit: cvs rdiff -u -r1.1166 -r1.1167 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.1166 src/share/mk/bsd.own.mk:1.1167 --- src/share/mk/bsd.own.mk:1.1166 Thu Nov 21 07:56:58 2019 +++ src/share/mk/bsd.own.mk Sun Dec 1 20:28:25 2019 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.1166 2019/11/21 07:56:58 mrg Exp $ +# $NetBSD: bsd.own.mk,v 1.1167 2019/12/01 20:28:25 jmcneill Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -1025,9 +1025,9 @@ SOFTFLOAT_BITS= 32 .endif # -# We want to build zfs only for amd64 by default for now. +# We want to build zfs only for amd64 and aarch64 by default for now. # -.if ${MACHINE} == "amd64" +.if ${MACHINE} == "amd64" || ${MACHINE_ARCH} == "aarch64" MKZFS?= yes .endif
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: jmcneill Date: Sun Dec 1 20:27:26 UTC 2019 Modified Files: src/sys/arch/aarch64/aarch64: kobj_machdep.c Log Message: Flush insn / data caches after loading modules To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/aarch64/aarch64/kobj_machdep.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/arch/aarch64/aarch64/kobj_machdep.c diff -u src/sys/arch/aarch64/aarch64/kobj_machdep.c:1.2 src/sys/arch/aarch64/aarch64/kobj_machdep.c:1.3 --- src/sys/arch/aarch64/aarch64/kobj_machdep.c:1.2 Sun Aug 19 20:02:22 2018 +++ src/sys/arch/aarch64/aarch64/kobj_machdep.c Sun Dec 1 20:27:26 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kobj_machdep.c,v 1.2 2018/08/19 20:02:22 ryo Exp $ */ +/* $NetBSD: kobj_machdep.c,v 1.3 2019/12/01 20:27:26 jmcneill Exp $ */ /* * Copyright (c) 2018 Ryo Shimizu @@ -27,19 +27,21 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.2 2018/08/19 20:02:22 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.3 2019/12/01 20:27:26 jmcneill Exp $"); #define ELFSIZE ARCH_ELFSIZE #include "opt_ddb.h" #include +#include #include #include #include #include #include #include +#include #include @@ -357,8 +359,26 @@ kobj_reloc(kobj_t ko, uintptr_t relocbas return 0; } +static void +kobj_idcache_wbinv_all(void) +{ + cpu_idcache_wbinv_all(); +} + int kobj_machdep(kobj_t ko, void *base, size_t size, bool load) { + uint64_t where; + + if (load) { + if (cold) { + kobj_idcache_wbinv_all(); + } else { + where = xc_broadcast(0, + (xcfunc_t)kobj_idcache_wbinv_all, NULL, NULL); + xc_wait(where); + } + } + return 0; }
CVS commit: src/external/cddl/osnet/dist/uts/common/os
Module Name:src Committed By: jmcneill Date: Sun Dec 1 20:26:31 UTC 2019 Modified Files: src/external/cddl/osnet/dist/uts/common/os: fm.c Log Message: Need sys/atomic.h on NetBSD To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/dist/uts/common/os/fm.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/cddl/osnet/dist/uts/common/os/fm.c diff -u src/external/cddl/osnet/dist/uts/common/os/fm.c:1.1 src/external/cddl/osnet/dist/uts/common/os/fm.c:1.2 --- src/external/cddl/osnet/dist/uts/common/os/fm.c:1.1 Mon Jun 24 08:27:20 2019 +++ src/external/cddl/osnet/dist/uts/common/os/fm.c Sun Dec 1 20:26:31 2019 @@ -65,6 +65,7 @@ #include #include #ifdef __NetBSD__ +#include #include #else #include
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: jmcneill Date: Sun Dec 1 20:26:05 UTC 2019 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: arc.c Log Message: Provide a default ptob() implementation To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.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/cddl/osnet/dist/uts/common/fs/zfs/arc.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.14 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.15 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.14 Sun May 26 10:21:00 2019 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c Sun Dec 1 20:26:05 2019 @@ -280,6 +280,9 @@ int arc_procfd; #ifndef btop #define btop(x) ((x) / PAGE_SIZE) #endif +#ifndef ptob +#define ptob(x) ((x) * PAGE_SIZE) +#endif //#define needfree (uvmexp.free < uvmexp.freetarg ? uvmexp.freetarg : 0) #define buf_init arc_buf_init #define freemem uvmexp.free
CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: jmcneill Date: Sun Dec 1 20:25:31 UTC 2019 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: vdev_disk.c Log Message: Initialize b_dev before passing buf to d_minphys (ldminphys needs this) To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.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/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.12 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.13 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.12 Tue Aug 20 08:12:14 2019 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c Sun Dec 1 20:25:31 2019 @@ -244,6 +244,7 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi } else { pdk = NULL; } + buf.b_dev = vp->v_rdev; } if (pdk && pdk->dk_driver && pdk->dk_driver->d_minphys) (*pdk->dk_driver->d_minphys)();
CVS commit: src/share/mk
Module Name:src Committed By: jmcneill Date: Sun Dec 1 20:24:47 UTC 2019 Modified Files: src/share/mk: bsd.kmodule.mk Log Message: Build aarch64 modules without fp or simd instructions. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/share/mk/bsd.kmodule.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.kmodule.mk diff -u src/share/mk/bsd.kmodule.mk:1.62 src/share/mk/bsd.kmodule.mk:1.63 --- src/share/mk/bsd.kmodule.mk:1.62 Fri Jul 5 08:28:16 2019 +++ src/share/mk/bsd.kmodule.mk Sun Dec 1 20:24:47 2019 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.kmodule.mk,v 1.62 2019/07/05 08:28:16 hannken Exp $ +# $NetBSD: bsd.kmodule.mk,v 1.63 2019/12/01 20:24:47 jmcneill Exp $ # We are not building this with PIE MKPIE=no @@ -42,7 +42,9 @@ CFLAGS+= -fno-strict-aliasing -Wno-point # The real solution to this involves generating trampolines for those # relocations inside the loader and removing this workaround, as the # resulting code would be much faster. -.if ${MACHINE_CPU} == "arm" +.if ${MACHINE_CPU} == "aarch64" +CFLAGS+= -march=armv8-a+nofp+nosimd +.elif ${MACHINE_CPU} == "arm" CFLAGS+= -fno-common -fno-unwind-tables .elif ${MACHINE_CPU} == "hppa" CFLAGS+= -mlong-calls
CVS commit: xsrc/external/mit/MesaLib/dist/src
Module Name:xsrc Committed By: maya Date: Sun Dec 1 20:21:21 UTC 2019 Modified Files: xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri: dri_sw_winsys.c xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib: xlib_sw_winsys.c xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11: xm_buffer.c Log Message: >From 02c3dad0f3b4d26e0faa5cc51d06bc50d693dcdc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 9 Oct 2019 12:05:16 -0600 Subject: [PATCH] Call shmget() with permission 0600 instead of 0777 A security advisory (TALOS-2019-0857/CVE-2019-5068) found that creating shared memory regions with permission mode 0777 could allow any user to access that memory. Several Mesa drivers use shared- memory XImages to implement back buffers for improved performance. This path changes the shmget() calls to use 0600 (user r/w). Tested with legacy Xlib driver and llvmpipe. Cc: mesa-sta...@lists.freedesktop.org Reviewed-by: Kristian H. Kristensen To generate a diff of this commit: cvs rdiff -u -r1.1.1.4 -r1.2 \ xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c cvs rdiff -u -r1.1.1.3 -r1.2 \ xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c cvs rdiff -u -r1.1.1.7 -r1.2 \ xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c diff -u xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c:1.1.1.4 xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c:1.2 --- xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c:1.1.1.4 Tue Sep 24 17:31:59 2019 +++ xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/dri/dri_sw_winsys.c Sun Dec 1 20:21:21 2019 @@ -94,7 +94,8 @@ alloc_shm(struct dri_sw_displaytarget *d { char *addr; - dri_sw_dt->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT|0777); + /* 0600 = user read+write */ + dri_sw_dt->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600); if (dri_sw_dt->shmid < 0) return NULL; Index: xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c diff -u xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c:1.1.1.3 xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c:1.2 --- xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c:1.1.1.3 Sun Mar 10 03:42:41 2019 +++ xsrc/external/mit/MesaLib/dist/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c Sun Dec 1 20:21:21 2019 @@ -126,7 +126,8 @@ alloc_shm(struct xlib_displaytarget *buf shminfo->shmid = -1; shminfo->shmaddr = (char *) -1; - shminfo->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT|0777); + /* 0600 = user read+write */ + shminfo->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600); if (shminfo->shmid < 0) { return NULL; } Index: xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c diff -u xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c:1.1.1.7 xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c:1.2 --- xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c:1.1.1.7 Sun Mar 10 03:42:37 2019 +++ xsrc/external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_buffer.c Sun Dec 1 20:21:21 2019 @@ -89,8 +89,9 @@ alloc_back_shm_ximage(XMesaBuffer b, GLu return GL_FALSE; } + /* 0600 = user read+write */ b->shminfo.shmid = shmget(IPC_PRIVATE, b->backxrb->ximage->bytes_per_line - * b->backxrb->ximage->height, IPC_CREAT|0777); + * b->backxrb->ximage->height, IPC_CREAT | 0600); if (b->shminfo.shmid < 0) { _mesa_warning(NULL, "shmget failed while allocating back buffer.\n"); XDestroyImage(b->backxrb->ximage);
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: ad Date: Sun Dec 1 19:21:13 UTC 2019 Modified Files: src/sys/rump/librump/rumpkern: scheduler.c Log Message: Another instance of cpu_onproc to replace. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/rump/librump/rumpkern/scheduler.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/rump/librump/rumpkern/scheduler.c diff -u src/sys/rump/librump/rumpkern/scheduler.c:1.46 src/sys/rump/librump/rumpkern/scheduler.c:1.47 --- src/sys/rump/librump/rumpkern/scheduler.c:1.46 Sun Dec 1 18:12:51 2019 +++ src/sys/rump/librump/rumpkern/scheduler.c Sun Dec 1 19:21:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: scheduler.c,v 1.46 2019/12/01 18:12:51 ad Exp $ */ +/* $NetBSD: scheduler.c,v 1.47 2019/12/01 19:21:13 ad Exp $ */ /* * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.46 2019/12/01 18:12:51 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.47 2019/12/01 19:21:13 ad Exp $"); #include #include @@ -449,7 +449,7 @@ rump_unschedule_cpu1(struct lwp *l, void void *old; ci = l->l_cpu; - ci->ci_curlwp = ci->ci_data.cpu_onproc = NULL; + ci->ci_curlwp = ci->ci_onproc = NULL; rcpu = cpuinfo_to_rumpcpu(ci); KASSERT(rcpu->rcpu_ci == ci);
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Dec 1 18:32:07 UTC 2019 Modified Files: src/sys/rump/include/rump: rump_namei.h src/sys/sys: namei.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/rump/include/rump/rump_namei.h cvs rdiff -u -r1.101 -r1.102 src/sys/sys/namei.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/rump/include/rump/rump_namei.h diff -u src/sys/rump/include/rump/rump_namei.h:1.35 src/sys/rump/include/rump/rump_namei.h:1.36 --- src/sys/rump/include/rump/rump_namei.h:1.35 Sun Dec 1 13:46:34 2019 +++ src/sys/rump/include/rump/rump_namei.h Sun Dec 1 18:32:07 2019 @@ -1,11 +1,11 @@ -/* $NetBSD: rump_namei.h,v 1.35 2019/12/01 13:46:34 ad Exp $ */ +/* $NetBSD: rump_namei.h,v 1.36 2019/12/01 18:32:07 ad Exp $ */ /* * WARNING: GENERATED FILE. DO NOT EDIT * (edit namei.src and run make namei in src/sys/sys) * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp - * from: NetBSD: namei.src,v 1.45 2019/12/01 13:45:42 ad Exp + * from: NetBSD: namei.src,v 1.46 2019/12/01 18:31:19 ad Exp */ #ifndef _RUMP_RUMP_NAMEI_H_ Index: src/sys/sys/namei.h diff -u src/sys/sys/namei.h:1.101 src/sys/sys/namei.h:1.102 --- src/sys/sys/namei.h:1.101 Sun Dec 1 13:46:34 2019 +++ src/sys/sys/namei.h Sun Dec 1 18:32:07 2019 @@ -1,11 +1,11 @@ -/* $NetBSD: namei.h,v 1.101 2019/12/01 13:46:34 ad Exp $ */ +/* $NetBSD: namei.h,v 1.102 2019/12/01 18:32:07 ad Exp $ */ /* * WARNING: GENERATED FILE. DO NOT EDIT * (edit namei.src and run make namei in src/sys/sys) * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp - * from: NetBSD: namei.src,v 1.45 2019/12/01 13:45:42 ad Exp + * from: NetBSD: namei.src,v 1.46 2019/12/01 18:31:19 ad Exp */ /* @@ -211,7 +211,6 @@ struct nameidata { * * - stable after initialization * L namecache_lock - * G namecache_gc_lock * C struct nchcpu::cpu_lock * L/C insert needs L, read needs L or any C, * must hold L and all C after (or during) delete before free @@ -223,11 +222,11 @@ struct namecache { TAILQ_ENTRY(namecache) nc_lru; /* L pseudo-lru chain */ LIST_ENTRY(namecache) nc_dvlist;/* L dvp's list of cache entries */ LIST_ENTRY(namecache) nc_vlist; /* L vp's list of cache entries */ - SLIST_ENTRY(namecache) nc_gclist;/*G queue for garbage collection */ struct vnode *nc_dvp; /* N vnode of parent of name */ struct vnode *nc_vp; /* N vnode the name refers to */ - kmutex_t *nc_lock; /* - lock on this entry */ - volatile int nc_hittime; /* N last time scored a hit */ + void *nc_gcqueue; /* N queue for garbage collection */ + kmutex_t nc_lock; /* lock on this entry */ + int nc_hittime; /* N last time scored a hit */ int nc_flags; /* - copy of componentname ISWHITEOUT */ u_short nc_nlen; /* - length of name */ char nc_name[0]; /* - segment name */
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Dec 1 18:31:19 UTC 2019 Modified Files: src/sys/kern: vfs_cache.c src/sys/sys: namei.src Log Message: Back out previous temporarily - seeing unusual lookup failures. Will come back to it. To generate a diff of this commit: cvs rdiff -u -r1.124 -r1.125 src/sys/kern/vfs_cache.c cvs rdiff -u -r1.45 -r1.46 src/sys/sys/namei.src 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_cache.c diff -u src/sys/kern/vfs_cache.c:1.124 src/sys/kern/vfs_cache.c:1.125 --- src/sys/kern/vfs_cache.c:1.124 Sun Dec 1 13:39:53 2019 +++ src/sys/kern/vfs_cache.c Sun Dec 1 18:31:19 2019 @@ -1,7 +1,7 @@ -/* $NetBSD: vfs_cache.c,v 1.124 2019/12/01 13:39:53 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.125 2019/12/01 18:31:19 ad Exp $ */ /*- - * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc. + * Copyright (c) 2008 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.124 2019/12/01 13:39:53 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.125 2019/12/01 18:31:19 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -130,7 +130,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c, * - Invalidate: active--->queued * * Done by cache_invalidate. If not already invalidated, nullify - * ncp->nc_dvp and ncp->nc_vp, and add to namecache_gc_queue. Called, + * ncp->nc_dvp and ncp->nc_vp, and add to cache_gcqueue. Called, * among various other places, in cache_lookup(dvp, name, namelen, * nameiop, cnflags, , ) when MAKEENTRY is missing from * cnflags. @@ -145,17 +145,16 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c, * Locking. * * L namecache_lock Global lock for namecache table and queues. - * G namecache_gc_lock Global lock for garbage collection. * C struct nchcpu::cpu_lock Per-CPU lock to reduce read contention. - * N struct namecache::nc_lock Per-entry lock, matching nc_vp->v_interlock. - *If nc_vp==NULL, lock is private / not shared. + * N struct namecache::nc_lock Per-entry lock. + * V struct vnode::v_interlock Vnode interlock. * - * Lock order: L -> C -> N + * Lock order: L -> C -> N -> V * * Examples: * . L->C: cache_reclaim - * . C->N: cache_lookup - * . L->N: cache_purge1, cache_revlookup + * . C->N->V: cache_lookup + * . L->N->V: cache_purge1, cache_revlookup * * All use serialized by namecache_lock: * @@ -168,9 +167,8 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c, * - Insertion serialized by namecache_lock, * - read protected by per-CPU lock, * - insert/read ordering guaranteed by memory barriers, and - * - deletion allowed only under namecache_lock, with namecache_gc_lock - * taken to chop out the garbage collection list, and *all* per-CPU locks - * observed as "unowned" at least once: + * - deletion allowed only under namecache_lock and *all* per-CPU locks + * in CPU_INFO_FOREACH order: * * nchashtbl / struct namecache::nc_hash * @@ -182,13 +180,11 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c, * * struct namecache::nc_dvp * struct namecache::nc_vp - * struct namecache::nc_hittime (*) + * struct namecache::nc_gcqueue (*) + * struct namecache::nc_hittime (**) * - * All use serialized by struct namecache_gc_lock: - * - * struct namecache::nc_gclist - * - * (*) cache_prune reads nc_hittime unlocked, since approximate is OK. + * (*) Once on the queue, only cache_thread uses this nc_gcqueue, unlocked. + * (**) cache_prune reads nc_hittime unlocked, since approximate is OK. * * Unlocked because stable after initialization: * @@ -261,7 +257,7 @@ typedef u_long nchash_t; * Structures associated with name cacheing. */ -static kmutex_t namecache_lock __cacheline_aligned; +static kmutex_t *namecache_lock __read_mostly; static pool_cache_t namecache_cache __read_mostly; static TAILQ_HEAD(, namecache) nclruhead __cacheline_aligned; @@ -280,9 +276,8 @@ static u_long ncvhash __read_mostly; static long numcache __cacheline_aligned; /* Garbage collection queue and number of entries pending in it. */ -static kmutex_t namecache_gc_lock __cacheline_aligned; -static SLIST_HEAD(namecache_gc_queue, namecache) namecache_gc_queue; -static u_int namecache_gc_pend; +static void *cache_gcqueue; +static u_int cache_gcpend; /* Cache effectiveness statistics. This holds total from per-cpu stats */ struct nchstats nchstats __cacheline_aligned; @@ -292,6 +287,8 @@ struct nchstats nchstats __cacheline_ali * values and add current per-cpu increments to the subsystem total * last collected by cache_reclaim(). */ +#define CACHE_STATS_CURRENT /* nothing */ + #define COUNT(cpup, f) ((cpup)->cpu_stats.f++) #define UPDATE(cpup, f) do { \ @@ -301,10 +298,15 @@ struct nchstats nchstats __cacheline_ali
CVS commit: src/sys/rump/include/machine
Module Name:src Committed By: ad Date: Sun Dec 1 18:29:26 UTC 2019 Modified Files: src/sys/rump/include/machine: cpu.h Log Message: Add ci_onproc. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/rump/include/machine/cpu.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/rump/include/machine/cpu.h diff -u src/sys/rump/include/machine/cpu.h:1.22 src/sys/rump/include/machine/cpu.h:1.23 --- src/sys/rump/include/machine/cpu.h:1.22 Wed Apr 22 17:38:33 2015 +++ src/sys/rump/include/machine/cpu.h Sun Dec 1 18:29:26 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.22 2015/04/22 17:38:33 pooka Exp $ */ +/* $NetBSD: cpu.h,v 1.23 2019/12/01 18:29:26 ad Exp $ */ /* * Copyright (c) 2008-2011 Antti Kantee. All Rights Reserved. @@ -44,6 +44,7 @@ struct cpu_info { struct cpu_data ci_data; cpuid_t ci_cpuid; struct lwp *ci_curlwp; + struct lwp *ci_onproc; struct cpu_info *ci_next;
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: ad Date: Sun Dec 1 18:12:51 UTC 2019 Modified Files: src/sys/rump/librump/rumpkern: scheduler.c Log Message: cpu_onproc -> ci_onproc To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/rump/librump/rumpkern/scheduler.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/rump/librump/rumpkern/scheduler.c diff -u src/sys/rump/librump/rumpkern/scheduler.c:1.45 src/sys/rump/librump/rumpkern/scheduler.c:1.46 --- src/sys/rump/librump/rumpkern/scheduler.c:1.45 Sat Nov 23 19:42:52 2019 +++ src/sys/rump/librump/rumpkern/scheduler.c Sun Dec 1 18:12:51 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: scheduler.c,v 1.45 2019/11/23 19:42:52 ad Exp $ */ +/* $NetBSD: scheduler.c,v 1.46 2019/12/01 18:12:51 ad Exp $ */ /* * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.45 2019/11/23 19:42:52 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.46 2019/12/01 18:12:51 ad Exp $"); #include #include @@ -377,7 +377,7 @@ rump_schedule_cpu_interlock(struct lwp * * in the case that an interrupt is scheduled immediately * after a user proc, but leave that for later. */ - ci->ci_curlwp = ci->ci_data.cpu_onproc = l; + ci->ci_curlwp = ci->ci_onproc = l; } void
CVS commit: src/sys/kern
Module Name:src Committed By: kamil Date: Sun Dec 1 17:41:11 UTC 2019 Modified Files: src/sys/kern: subr_kcov.c Log Message: Switch in_interrupt() in KCOV to cpu_intr_p() This makes KCOV more MI friendly and removes x86-specific in_interrupt() implementation. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/kern/subr_kcov.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/subr_kcov.c diff -u src/sys/kern/subr_kcov.c:1.9 src/sys/kern/subr_kcov.c:1.10 --- src/sys/kern/subr_kcov.c:1.9 Fri Nov 15 09:44:44 2019 +++ src/sys/kern/subr_kcov.c Sun Dec 1 17:41:11 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_kcov.c,v 1.9 2019/11/15 09:44:44 maxv Exp $ */ +/* $NetBSD: subr_kcov.c,v 1.10 2019/12/01 17:41:11 kamil Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -342,7 +343,7 @@ out: static inline bool __nomsan in_interrupt(void) { - return curcpu()->ci_idepth >= 0; + return cpu_intr_p(); } void __sanitizer_cov_trace_pc(void);
CVS commit: src/share/mk
Module Name:src Committed By: kamil Date: Sun Dec 1 17:25:47 UTC 2019 Modified Files: src/share/mk: bsd.sys.mk Log Message: Disable KCOV instrumentation in x86_machdep.c This allows to use cpu_intr_p() directly inside KCOV. To generate a diff of this commit: cvs rdiff -u -r1.296 -r1.297 src/share/mk/bsd.sys.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.sys.mk diff -u src/share/mk/bsd.sys.mk:1.296 src/share/mk/bsd.sys.mk:1.297 --- src/share/mk/bsd.sys.mk:1.296 Fri Nov 15 09:44:44 2019 +++ src/share/mk/bsd.sys.mk Sun Dec 1 17:25:47 2019 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.sys.mk,v 1.296 2019/11/15 09:44:44 maxv Exp $ +# $NetBSD: bsd.sys.mk,v 1.297 2019/12/01 17:25:47 kamil Exp $ # # Build definitions used for NetBSD source tree builds. @@ -247,7 +247,8 @@ CFLAGS+= ${KLEAKFLAGS.${.IMPSRC:T}:U${KL .if ${KCOV:U0} > 0 KCOVFLAGS= -fsanitize-coverage=trace-pc .for f in subr_kcov.c subr_lwp_specificdata.c subr_specificdata.c subr_asan.c \ - subr_csan.c subr_msan.c + subr_csan.c subr_msan.c x86_machdep.c +# TODO Adapt the file list for !x86 or implement __nocov (missing in GCC 8) KCOVFLAGS.${f}= # empty .endfor CFLAGS+= ${KCOVFLAGS.${.IMPSRC:T}:U${KCOVFLAGS}}
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Sun Dec 1 17:06:00 UTC 2019 Modified Files: src/sys/kern: subr_xcall.c Log Message: Back out the fastpath change in xc_wait(). It's going to be done differently. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/kern/subr_xcall.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/subr_xcall.c diff -u src/sys/kern/subr_xcall.c:1.30 src/sys/kern/subr_xcall.c:1.31 --- src/sys/kern/subr_xcall.c:1.30 Sun Dec 1 16:32:01 2019 +++ src/sys/kern/subr_xcall.c Sun Dec 1 17:06:00 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_xcall.c,v 1.30 2019/12/01 16:32:01 ad Exp $ */ +/* $NetBSD: subr_xcall.c,v 1.31 2019/12/01 17:06:00 ad Exp $ */ /*- * Copyright (c) 2007-2010, 2019 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_xcall.c,v 1.30 2019/12/01 16:32:01 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_xcall.c,v 1.31 2019/12/01 17:06:00 ad Exp $"); #include #include @@ -354,19 +354,11 @@ xc_wait(uint64_t where) } /* Block until awoken. */ -#ifdef _LP64 /* Needs 64-bit load/store for atomicity. */ - if (xc->xc_donep < where) { -#endif - mutex_enter(>xc_lock); - while (xc->xc_donep < where) { - cv_wait(>xc_busy, >xc_lock); - } - mutex_exit(>xc_lock); -#ifdef _LP64 - } else { - membar_enter(); + mutex_enter(>xc_lock); + while (xc->xc_donep < where) { + cv_wait(>xc_busy, >xc_lock); } -#endif + mutex_exit(>xc_lock); } /*
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Sun Dec 1 17:08:31 UTC 2019 Modified Files: src/sys/kern: init_main.c Log Message: Init kern_runq and kern_synch before booting secondary CPUs. To generate a diff of this commit: cvs rdiff -u -r1.506 -r1.507 src/sys/kern/init_main.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/init_main.c diff -u src/sys/kern/init_main.c:1.506 src/sys/kern/init_main.c:1.507 --- src/sys/kern/init_main.c:1.506 Thu Oct 3 22:29:17 2019 +++ src/sys/kern/init_main.c Sun Dec 1 17:08:31 2019 @@ -1,7 +1,7 @@ -/* $NetBSD: init_main.c,v 1.506 2019/10/03 22:29:17 kamil Exp $ */ +/* $NetBSD: init_main.c,v 1.507 2019/12/01 17:08:31 ad Exp $ */ /*- - * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. + * Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -97,7 +97,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.506 2019/10/03 22:29:17 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.507 2019/12/01 17:08:31 ad Exp $"); #include "opt_ddb.h" #include "opt_inet.h" @@ -799,6 +799,10 @@ configure2(void) curcpu()->ci_schedstate.spc_flags |= SPCF_RUNNING; splx(s); + /* Setup the runqueues and scheduler. */ + runq_init(); + synch_init(); + /* Boot the secondary processors. */ for (CPU_INFO_FOREACH(cii, ci)) { uvm_cpu_attach(ci); @@ -808,10 +812,6 @@ configure2(void) cpu_boot_secondary_processors(); #endif - /* Setup the runqueues and scheduler. */ - runq_init(); - synch_init(); - /* * Bus scans can make it appear as if the system has paused, so * twiddle constantly while config_interrupts() jobs are running.
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Dec 1 17:02:50 UTC 2019 Modified Files: src/sys/uvm: uvm_anon.c Log Message: Free pages in batch instead of taking uvm_pageqlock for each one. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/uvm/uvm_anon.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/uvm/uvm_anon.c diff -u src/sys/uvm/uvm_anon.c:1.65 src/sys/uvm/uvm_anon.c:1.66 --- src/sys/uvm/uvm_anon.c:1.65 Sun Dec 1 14:40:31 2019 +++ src/sys/uvm/uvm_anon.c Sun Dec 1 17:02:50 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_anon.c,v 1.65 2019/12/01 14:40:31 ad Exp $ */ +/* $NetBSD: uvm_anon.c,v 1.66 2019/12/01 17:02:50 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.65 2019/12/01 14:40:31 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.66 2019/12/01 17:02:50 ad Exp $"); #include "opt_uvmhist.h" @@ -94,7 +94,7 @@ uvm_analloc(void) } /* - * uvm_anon_dispose: free any resident page or swap resources of anon. + * uvm_anon_dispose: break loans and remove pmap mapping * * => anon must be removed from the amap (if anon was in an amap). * => amap must be locked; we may drop and re-acquire the lock here. @@ -110,17 +110,6 @@ uvm_anon_dispose(struct vm_anon *anon) KASSERT(mutex_owned(anon->an_lock)); /* - * If there is a resident page and it is loaned, then anon may not - * own it. Call out to uvm_anon_lockloanpg() to identify and lock - * the real owner of the page. - */ - - if (pg && pg->loan_count) { - KASSERT(anon->an_lock != NULL); - pg = uvm_anon_lockloanpg(anon); - } - - /* * Dispose the page, if it is resident. */ @@ -128,6 +117,16 @@ uvm_anon_dispose(struct vm_anon *anon) KASSERT(anon->an_lock != NULL); /* + * If there is a resident page and it is loaned, then anon + * may not own it. Call out to uvm_anon_lockloanpg() to + * identify and lock the real owner of the page. + */ + + if (pg->loan_count) { + pg = uvm_anon_lockloanpg(anon); + } + + /* * If the page is owned by a UVM object (now locked), * then kill the loan on the page rather than free it, * and release the object lock. @@ -160,12 +159,6 @@ uvm_anon_dispose(struct vm_anon *anon) mutex_obj_hold(anon->an_lock); return false; } - mutex_enter(_pageqlock); - uvm_pagefree(pg); - mutex_exit(_pageqlock); - UVMHIST_LOG(maphist, "anon 0x%#jx, page 0x%#jx: " - "freed now!", (uintptr_t)anon, (uintptr_t)pg, - 0, 0); } } @@ -177,12 +170,6 @@ uvm_anon_dispose(struct vm_anon *anon) } #endif - /* - * Free any swap resources, leave a page replacement hint. - */ - - uvm_anon_dropswap(anon); - uvmpdpol_anfree(anon); UVMHIST_LOG(maphist,"<- done!",0,0,0,0); return true; } @@ -196,6 +183,10 @@ void uvm_anon_free(struct vm_anon *anon) { +#if defined(VMSWAP) + /* Free any dangling swap slot. */ + uvm_anon_dropswap(anon); +#endif KASSERT(anon->an_ref == 0); KASSERT(anon->an_lock == NULL); KASSERT(anon->an_page == NULL); @@ -208,15 +199,23 @@ uvm_anon_free(struct vm_anon *anon) /* * uvm_anon_freelst: free a linked list of anon structures. * - * => anon must be locked, we will unlock it. + * => amap must be locked, we will unlock it. */ void uvm_anon_freelst(struct vm_amap *amap, struct vm_anon *anonlst) { struct vm_anon *anon; struct vm_anon **anonp = + struct vm_page *pg; KASSERT(mutex_owned(amap->am_lock)); + + if (anonlst == NULL) { + amap_unlock(amap); + return; + } + + /* Break loans and hardware mappings. Defer release of busy pages. */ while ((anon = *anonp) != NULL) { if (!uvm_anon_dispose(anon)) { /* Do not free this anon. */ @@ -227,8 +226,22 @@ uvm_anon_freelst(struct vm_amap *amap, s anonp = >an_link; } } + + /* Free pages and leave a page replacement hint. */ + mutex_enter(_pageqlock); + for (anon = anonlst; anon != NULL; anon = anon->an_link) { + UVMHIST_LOG(maphist, "anon 0x%#jx, page 0x%#jx: " + "releasing now!", (uintptr_t)anon, + (uintptr_t)anon->an_page, 0, 0); + if ((pg = anon->an_page) != NULL) { + uvm_pagefree(pg); + } + uvmpdpol_anfree(anon); + } + mutex_exit(_pageqlock); amap_unlock(amap); + /* Free swap space, pages and vm_anon. */ while (anonlst) { anon = anonlst->an_link; /* Note: clears an_ref as well. */
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Dec 1 16:44:11 UTC 2019 Modified Files: src/sys/uvm: uvm_device.c Log Message: __cacheline_aligned on a lock. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/uvm/uvm_device.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/uvm/uvm_device.c diff -u src/sys/uvm/uvm_device.c:1.66 src/sys/uvm/uvm_device.c:1.67 --- src/sys/uvm/uvm_device.c:1.66 Sat Oct 28 00:37:13 2017 +++ src/sys/uvm/uvm_device.c Sun Dec 1 16:44:11 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_device.c,v 1.66 2017/10/28 00:37:13 pgoyette Exp $ */ +/* $NetBSD: uvm_device.c,v 1.67 2019/12/01 16:44:11 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_device.c,v 1.66 2017/10/28 00:37:13 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_device.c,v 1.67 2019/12/01 16:44:11 ad Exp $"); #include "opt_uvmhist.h" @@ -54,7 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_device.c LIST_HEAD(udv_list_struct, uvm_device); static struct udv_list_struct udv_list; -static kmutex_t udv_lock; +static kmutex_t udv_lock __cacheline_aligned; /* * functions
CVS commit: src/sys/sys
Module Name:src Committed By: ad Date: Sun Dec 1 16:36:26 UTC 2019 Modified Files: src/sys/sys: param.h Log Message: NetBSD 9.99.19 - many kernel data structure changes To generate a diff of this commit: cvs rdiff -u -r1.619 -r1.620 src/sys/sys/param.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/sys/param.h diff -u src/sys/sys/param.h:1.619 src/sys/sys/param.h:1.620 --- src/sys/sys/param.h:1.619 Wed Nov 20 19:37:54 2019 +++ src/sys/sys/param.h Sun Dec 1 16:36:25 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.619 2019/11/20 19:37:54 pgoyette Exp $ */ +/* $NetBSD: param.h,v 1.620 2019/12/01 16:36:25 ad Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -67,7 +67,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 999001800 /* NetBSD 9.99.18 */ +#define __NetBSD_Version__ 999001900 /* NetBSD 9.99.19 */ #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \ (m) * 100) + (p) * 100) <= __NetBSD_Version__)
CVS commit: src/sys/dev/dm
Module Name:src Committed By: tkusumi Date: Sun Dec 1 16:33:33 UTC 2019 Modified Files: src/sys/dev/dm: dm_pdev.c Log Message: dm: Fix race on pdev create List lookup and insert need to be atomic. https://github.com/DragonFlyBSD/DragonFlyBSD/commit/ac816675c8321309b49d6a335f95c5388036803f take-from: DragonFlyBSD To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/dm/dm_pdev.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/dm/dm_pdev.c diff -u src/sys/dev/dm/dm_pdev.c:1.10 src/sys/dev/dm/dm_pdev.c:1.11 --- src/sys/dev/dm/dm_pdev.c:1.10 Fri Jan 5 14:22:26 2018 +++ src/sys/dev/dm/dm_pdev.c Sun Dec 1 16:33:33 2019 @@ -1,4 +1,4 @@ -/*$NetBSD: dm_pdev.c,v 1.10 2018/01/05 14:22:26 christos Exp $ */ +/*$NetBSD: dm_pdev.c,v 1.11 2019/12/01 16:33:33 tkusumi Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.10 2018/01/05 14:22:26 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.11 2019/12/01 16:33:33 tkusumi Exp $"); #include #include @@ -103,15 +103,17 @@ dm_pdev_insert(const char *dev_name) mutex_exit(_pdev_mutex); return dmp; } - mutex_exit(_pdev_mutex); - if ((dmp = dm_pdev_alloc(dev_name)) == NULL) + if ((dmp = dm_pdev_alloc(dev_name)) == NULL) { + mutex_exit(_pdev_mutex); return NULL; + } dev_pb = pathbuf_create(dev_name); if (dev_pb == NULL) { aprint_debug("%s: pathbuf_create on device: %s failed!\n", __func__, dev_name); + mutex_exit(_pdev_mutex); kmem_free(dmp, sizeof(dm_pdev_t)); return NULL; } @@ -120,13 +122,13 @@ dm_pdev_insert(const char *dev_name) if (error) { aprint_debug("%s: dk_lookup on device: %s (error %d)\n", __func__, dev_name, error); + mutex_exit(_pdev_mutex); kmem_free(dmp, sizeof(dm_pdev_t)); return NULL; } getdisksize(dmp->pdev_vnode, >pdev_numsec, >pdev_secsize); dmp->ref_cnt = 1; - mutex_enter(_pdev_mutex); SLIST_INSERT_HEAD(_pdev_list, dmp, next_pdev); mutex_exit(_pdev_mutex);
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Sun Dec 1 16:32:02 UTC 2019 Modified Files: src/sys/kern: subr_xcall.c Log Message: Make the fast path in xc_wait() depend on _LP64 for now. Needs 64-bit load/store. To be revisited. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/kern/subr_xcall.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/subr_xcall.c diff -u src/sys/kern/subr_xcall.c:1.29 src/sys/kern/subr_xcall.c:1.30 --- src/sys/kern/subr_xcall.c:1.29 Sun Dec 1 14:20:00 2019 +++ src/sys/kern/subr_xcall.c Sun Dec 1 16:32:01 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_xcall.c,v 1.29 2019/12/01 14:20:00 ad Exp $ */ +/* $NetBSD: subr_xcall.c,v 1.30 2019/12/01 16:32:01 ad Exp $ */ /*- * Copyright (c) 2007-2010, 2019 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_xcall.c,v 1.29 2019/12/01 14:20:00 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_xcall.c,v 1.30 2019/12/01 16:32:01 ad Exp $"); #include #include @@ -354,15 +354,19 @@ xc_wait(uint64_t where) } /* Block until awoken. */ +#ifdef _LP64 /* Needs 64-bit load/store for atomicity. */ if (xc->xc_donep < where) { +#endif mutex_enter(>xc_lock); while (xc->xc_donep < where) { cv_wait(>xc_busy, >xc_lock); } mutex_exit(>xc_lock); +#ifdef _LP64 } else { membar_enter(); } +#endif } /*
CVS commit: src/sys/dev/gpib
Module Name:src Committed By: riastradh Date: Sun Dec 1 16:22:10 UTC 2019 Modified Files: src/sys/dev/gpib: mt.c Log Message: Mark unreachable branch with __unreachable() to fix i386/ALL build. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/gpib/mt.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/gpib/mt.c diff -u src/sys/dev/gpib/mt.c:1.33 src/sys/dev/gpib/mt.c:1.34 --- src/sys/dev/gpib/mt.c:1.33 Tue Nov 12 13:17:44 2019 +++ src/sys/dev/gpib/mt.c Sun Dec 1 16:22:10 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: mt.c,v 1.33 2019/11/12 13:17:44 msaitoh Exp $ */ +/* $NetBSD: mt.c,v 1.34 2019/12/01 16:22:10 riastradh Exp $ */ /*- * Copyright (c) 1996-2003 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.33 2019/11/12 13:17:44 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.34 2019/12/01 16:22:10 riastradh Exp $"); #include #include @@ -729,6 +729,7 @@ mtstart(struct mt_softc *sc) mtstart_callout, sc); return; } + __unreachable(); case MTRESET: /*
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Dec 1 15:34:47 UTC 2019 Modified Files: src/sys/arch/alpha/alpha: ipifuncs.c src/sys/arch/alpha/include: cpu.h src/sys/arch/arm/include: cpu.h src/sys/arch/hppa/include: cpu.h src/sys/arch/ia64/include: cpu.h src/sys/arch/m68k/include: cpu.h src/sys/arch/mips/include: cpu.h src/sys/arch/mips/mips: ipifuncs.c src/sys/arch/mips/rmi: rmixl_cpu.c src/sys/arch/or1k/include: cpu.h src/sys/arch/powerpc/booke: e500_intr.c src/sys/arch/powerpc/include: cpu.h src/sys/arch/powerpc/pic: ipi.c src/sys/arch/riscv/include: cpu.h src/sys/arch/sh3/include: cpu.h src/sys/arch/sparc/include: cpu.h src/sys/arch/sparc64/include: cpu.h src/sys/arch/sparc64/sparc64: clock.c src/sys/arch/usermode/include: cpu.h src/sys/arch/vax/include: cpu.h src/sys/arch/vax/vax: ka6400.c ka820.c ka88.c src/sys/arch/x86/include: cpu.h src/sys/arch/x86/x86: ipi.c src/sys/arch/xen/x86: xen_ipi.c src/sys/kern: kern_clock.c kern_cpu.c kern_idle.c kern_runq.c kern_softint.c kern_synch.c sched_4bsd.c sched_m2.c src/sys/sys: cpu_data.h lwp.h Log Message: Fix false sharing problems with cpu_info. Identified with tprof(8). This was a very nice win in my tests on a 48 CPU box. - Reorganise cpu_data slightly according to usage. - Put cpu_onproc into struct cpu_info alongside ci_curlwp (now is ci_onproc). - On x86, put some items in their own cache lines according to usage, like the IPI bitmask and ci_want_resched. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/arch/alpha/alpha/ipifuncs.c cvs rdiff -u -r1.85 -r1.86 src/sys/arch/alpha/include/cpu.h cvs rdiff -u -r1.102 -r1.103 src/sys/arch/arm/include/cpu.h cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/include/cpu.h cvs rdiff -u -r1.19 -r1.20 src/sys/arch/ia64/include/cpu.h cvs rdiff -u -r1.16 -r1.17 src/sys/arch/m68k/include/cpu.h cvs rdiff -u -r1.127 -r1.128 src/sys/arch/mips/include/cpu.h cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/mips/ipifuncs.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/rmi/rmixl_cpu.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/or1k/include/cpu.h cvs rdiff -u -r1.39 -r1.40 src/sys/arch/powerpc/booke/e500_intr.c cvs rdiff -u -r1.109 -r1.110 src/sys/arch/powerpc/include/cpu.h cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/pic/ipi.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/riscv/include/cpu.h cvs rdiff -u -r1.58 -r1.59 src/sys/arch/sh3/include/cpu.h cvs rdiff -u -r1.102 -r1.103 src/sys/arch/sparc/include/cpu.h cvs rdiff -u -r1.127 -r1.128 src/sys/arch/sparc64/include/cpu.h cvs rdiff -u -r1.121 -r1.122 src/sys/arch/sparc64/sparc64/clock.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/include/cpu.h cvs rdiff -u -r1.103 -r1.104 src/sys/arch/vax/include/cpu.h cvs rdiff -u -r1.19 -r1.20 src/sys/arch/vax/vax/ka6400.c \ src/sys/arch/vax/vax/ka88.c cvs rdiff -u -r1.56 -r1.57 src/sys/arch/vax/vax/ka820.c cvs rdiff -u -r1.114 -r1.115 src/sys/arch/x86/include/cpu.h cvs rdiff -u -r1.29 -r1.30 src/sys/arch/x86/x86/ipi.c cvs rdiff -u -r1.34 -r1.35 src/sys/arch/xen/x86/xen_ipi.c cvs rdiff -u -r1.138 -r1.139 src/sys/kern/kern_clock.c cvs rdiff -u -r1.77 -r1.78 src/sys/kern/kern_cpu.c cvs rdiff -u -r1.26 -r1.27 src/sys/kern/kern_idle.c cvs rdiff -u -r1.51 -r1.52 src/sys/kern/kern_runq.c \ src/sys/kern/kern_softint.c cvs rdiff -u -r1.326 -r1.327 src/sys/kern/kern_synch.c cvs rdiff -u -r1.39 -r1.40 src/sys/kern/sched_4bsd.c cvs rdiff -u -r1.35 -r1.36 src/sys/kern/sched_m2.c cvs rdiff -u -r1.39 -r1.40 src/sys/sys/cpu_data.h cvs rdiff -u -r1.191 -r1.192 src/sys/sys/lwp.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/alpha/alpha/ipifuncs.c diff -u src/sys/arch/alpha/alpha/ipifuncs.c:1.49 src/sys/arch/alpha/alpha/ipifuncs.c:1.50 --- src/sys/arch/alpha/alpha/ipifuncs.c:1.49 Thu Nov 21 19:02:43 2019 +++ src/sys/arch/alpha/alpha/ipifuncs.c Sun Dec 1 15:34:44 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ipifuncs.c,v 1.49 2019/11/21 19:02:43 ad Exp $ */ +/* $NetBSD: ipifuncs.c,v 1.50 2019/12/01 15:34:44 ad Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.49 2019/11/21 19:02:43 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.50 2019/12/01 15:34:44 ad Exp $"); /* * Interprocessor interrupt handlers. @@ -263,8 +263,8 @@ static void alpha_ipi_ast(struct cpu_info *ci, struct trapframe *framep) { - if (ci->ci_data.cpu_onproc != ci->ci_data.cpu_idlelwp) - aston(ci->ci_data.cpu_onproc); + if (ci->ci_onproc != ci->ci_data.cpu_idlelwp) + aston(ci->ci_onproc); } static void Index: src/sys/arch/alpha/include/cpu.h diff -u
CVS commit: src/sys/sys
Module Name:src Committed By: riastradh Date: Sun Dec 1 15:28:02 UTC 2019 Modified Files: src/sys/sys: atomic.h Log Message: Rework modified atomic_load/store_* to work on const pointers. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/sys/atomic.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/sys/atomic.h diff -u src/sys/sys/atomic.h:1.19 src/sys/sys/atomic.h:1.20 --- src/sys/sys/atomic.h:1.19 Sun Dec 1 08:15:58 2019 +++ src/sys/sys/atomic.h Sun Dec 1 15:28:02 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.h,v 1.19 2019/12/01 08:15:58 maxv Exp $ */ +/* $NetBSD: atomic.h,v 1.20 2019/12/01 15:28:02 riastradh Exp $ */ /*- * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. @@ -414,13 +414,18 @@ __END_DECLS #ifdef KCSAN void kcsan_atomic_load(const volatile void *, void *, int); void kcsan_atomic_store(volatile void *, const void *, int); -#define __DO_ATOMIC_LOAD(p, v) \ - kcsan_atomic_load(p, __UNVOLATILE(), sizeof(v)) +#define __BEGIN_ATOMIC_LOAD(p, v) \ + union { __typeof__(*(p)) __al_val; char __al_buf[1]; } v; \ + kcsan_atomic_load(p, v.__al_buf, sizeof(v.__al_val)) +#define __END_ATOMIC_LOAD(v) \ + (v).__al_val #define __DO_ATOMIC_STORE(p, v) \ kcsan_atomic_store(p, __UNVOLATILE(), sizeof(v)) #else -#define __DO_ATOMIC_LOAD(p, v) \ - v = *p +#define __BEGIN_ATOMIC_LOAD(p, v) \ + __typeof__(*(p)) v = *(p) +#define __END_ATOMIC_LOAD(v) \ + v #define __DO_ATOMIC_STORE(p, v) \ *p = v #endif @@ -428,20 +433,18 @@ void kcsan_atomic_store(volatile void *, #define atomic_load_relaxed(p) \ ({ \ const volatile __typeof__(*(p)) *__al_ptr = (p); \ - __typeof__(*(p)) __al_val; \ __ATOMIC_PTR_CHECK(__al_ptr); \ - __DO_ATOMIC_LOAD(__al_ptr, __al_val); \ - __al_val; \ + __BEGIN_ATOMIC_LOAD(__al_ptr, __al_val); \ + __END_ATOMIC_LOAD(__al_val); \ }) #define atomic_load_consume(p) \ ({ \ const volatile __typeof__(*(p)) *__al_ptr = (p); \ - __typeof__(*(p)) __al_val; \ __ATOMIC_PTR_CHECK(__al_ptr); \ - __DO_ATOMIC_LOAD(__al_ptr, __al_val); \ + __BEGIN_ATOMIC_LOAD(__al_ptr, __al_val); \ membar_datadep_consumer(); \ - __al_val; \ + __END_ATOMIC_LOAD(__al_val); \ }) /* @@ -453,11 +456,10 @@ void kcsan_atomic_store(volatile void *, #define atomic_load_acquire(p) \ ({ \ const volatile __typeof__(*(p)) *__al_ptr = (p); \ - __typeof__(*(p)) __al_val; \ __ATOMIC_PTR_CHECK(__al_ptr); \ - __DO_ATOMIC_LOAD(__al_ptr, __al_val); \ + __BEGIN_ATOMIC_LOAD(__al_ptr, __al_val); \ membar_sync(); \ - __al_val; \ + __END_ATOMIC_LOAD(__al_val); \ }) #define atomic_store_relaxed(p,v) \
CVS commit: src
Module Name:src Committed By: riastradh Date: Sun Dec 1 15:28:20 UTC 2019 Modified Files: src/sys/sys: pslist.h src/tests/include/sys: t_pslist.c Log Message: Adapt to use atomic_load/store_*. Changes: - membar_producer(); *p = v; => atomic_store_release(p, v); (Effectively like using membar_exit instead of membar_producer, which is what we should have been doing all along so that stores by the `reader' can't affect earlier loads by the writer, such as KASSERT(p->refcnt == 0) in the writer and atomic_inc(>refcnt) in the reader.) - p = *pp; if (p != NULL) membar_datadep_consumer(); => p = atomic_load_consume(pp); (Only makes a difference on DEC Alpha. As long as lists generally have at least one element, this is not likely to make a big difference, and keeps the code simpler and clearer.) No other functional change intended. While here, annotate each synchronizing load and store with its counterpart in a comment. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/sys/pslist.h cvs rdiff -u -r1.1 -r1.2 src/tests/include/sys/t_pslist.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/sys/pslist.h diff -u src/sys/sys/pslist.h:1.6 src/sys/sys/pslist.h:1.7 --- src/sys/sys/pslist.h:1.6 Fri Sep 20 13:38:00 2019 +++ src/sys/sys/pslist.h Sun Dec 1 15:28:19 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pslist.h,v 1.6 2019/09/20 13:38:00 maxv Exp $ */ +/* $NetBSD: pslist.h,v 1.7 2019/12/01 15:28:19 riastradh Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ static __inline void pslist_init(struct pslist_head *head) { - head->plh_first = NULL; + head->plh_first = NULL; /* not yet published, so no atomic */ } static __inline void @@ -94,7 +94,7 @@ pslist_entry_destroy(struct pslist_entry * would think they were simply at the end of the list. * Instead, cause readers to crash. */ - entry->ple_next = _PSLIST_POISON; + atomic_store_relaxed(>ple_next, _PSLIST_POISON); } /* @@ -119,11 +119,10 @@ pslist_writer_insert_head(struct pslist_ _PSLIST_ASSERT(new->ple_prevp == NULL); new->ple_prevp = >plh_first; - new->ple_next = head->plh_first; + new->ple_next = head->plh_first; /* not yet published, so no atomic */ if (head->plh_first != NULL) head->plh_first->ple_prevp = >ple_next; - membar_producer(); - head->plh_first = new; + atomic_store_release(>plh_first, new); } static __inline void @@ -138,9 +137,14 @@ pslist_writer_insert_before(struct pslis _PSLIST_ASSERT(new->ple_prevp == NULL); new->ple_prevp = entry->ple_prevp; - new->ple_next = entry; - membar_producer(); - *entry->ple_prevp = new; + new->ple_next = entry; /* not yet published, so no atomic */ + + /* + * Pairs with atomic_load_consume in pslist_reader_first or + * pslist_reader_next. + */ + atomic_store_release(entry->ple_prevp, new); + entry->ple_prevp = >ple_next; } @@ -156,11 +160,12 @@ pslist_writer_insert_after(struct pslist _PSLIST_ASSERT(new->ple_prevp == NULL); new->ple_prevp = >ple_next; - new->ple_next = entry->ple_next; + new->ple_next = entry->ple_next; /* not yet published, so no atomic */ if (new->ple_next != NULL) new->ple_next->ple_prevp = >ple_next; - membar_producer(); - entry->ple_next = new; + + /* Pairs with atomic_load_consume in pslist_reader_next. */ + atomic_store_release(>ple_next, new); } static __inline void @@ -173,7 +178,15 @@ pslist_writer_remove(struct pslist_entry if (entry->ple_next != NULL) entry->ple_next->ple_prevp = entry->ple_prevp; - *entry->ple_prevp = entry->ple_next; + + /* + * No need for atomic_store_release because there's no + * initialization that this must happen after -- the store + * transitions from a good state with the entry to a good state + * without the entry, both of which are valid for readers to + * witness. + */ + atomic_store_relaxed(entry->ple_prevp, entry->ple_next); entry->ple_prevp = NULL; /* @@ -221,29 +234,30 @@ _pslist_writer_next_container(const stru /* * Reader operations. Caller must block pserialize_perform or * equivalent and be bound to a CPU. Only plh_first/ple_next may be - * read, and after that, a membar_datadep_consumer must precede - * dereferencing the resulting pointer. + * read, and only with consuming memory order so that data-dependent + * loads happen afterward. */ static __inline struct pslist_entry * pslist_reader_first(const struct pslist_head *head) { - struct pslist_entry *first = head->plh_first; - - if (first != NULL) - membar_datadep_consumer(); - - return first; + /* + * Pairs with atomic_store_release in pslist_writer_insert_head + * or pslist_writer_insert_before. + */ + return atomic_load_consume(>plh_first); } static __inline struct pslist_entry * pslist_reader_next(const struct pslist_entry *entry) { - struct pslist_entry *next =
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Sun Dec 1 15:27:58 UTC 2019 Modified Files: src/sys/kern: kern_lwp.c Log Message: Fix a longstanding problem with LWP limits. When changing the user's LWP count, we must use the process credentials because that's what the accounting entity is tied to. Reported-by: syzbot+d193266676f635661...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.214 -r1.215 src/sys/kern/kern_lwp.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_lwp.c diff -u src/sys/kern/kern_lwp.c:1.214 src/sys/kern/kern_lwp.c:1.215 --- src/sys/kern/kern_lwp.c:1.214 Sun Nov 24 13:23:57 2019 +++ src/sys/kern/kern_lwp.c Sun Dec 1 15:27:58 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_lwp.c,v 1.214 2019/11/24 13:23:57 ad Exp $ */ +/* $NetBSD: kern_lwp.c,v 1.215 2019/12/01 15:27:58 ad Exp $ */ /*- * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc. @@ -209,7 +209,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.214 2019/11/24 13:23:57 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.215 2019/12/01 15:27:58 ad Exp $"); #include "opt_ddb.h" #include "opt_lockdebug.h" @@ -771,17 +771,21 @@ lwp_create(lwp_t *l1, proc_t *p2, vaddr_ lwp_t **rnewlwpp, int sclass, const sigset_t *sigmask, const stack_t *sigstk) { - struct lwp *l2, *isfree; + struct lwp *l2; turnstile_t *ts; lwpid_t lid; KASSERT(l1 == curlwp || l1->l_proc == ); /* - * Enforce limits, excluding the first lwp and kthreads. + * Enforce limits, excluding the first lwp and kthreads. We must + * use the process credentials here when adjusting the limit, as + * they are what's tied to the accounting entity. However for + * authorizing the action, we'll use the LWP's credentials. */ + mutex_enter(p2->p_lock); if (p2->p_nlwps != 0 && p2 != ) { - uid_t uid = kauth_cred_getuid(l1->l_cred); + uid_t uid = kauth_cred_getuid(p2->p_cred); int count = chglwpcnt(uid, 1); if (__predict_false(count > p2->p_rlimit[RLIMIT_NTHR].rlim_cur)) { @@ -791,6 +795,7 @@ lwp_create(lwp_t *l1, proc_t *p2, vaddr_ >p_rlimit[RLIMIT_NTHR], KAUTH_ARG(RLIMIT_NTHR)) != 0) { (void)chglwpcnt(uid, -1); +mutex_exit(p2->p_lock); return EAGAIN; } } @@ -800,27 +805,21 @@ lwp_create(lwp_t *l1, proc_t *p2, vaddr_ * First off, reap any detached LWP waiting to be collected. * We can re-use its LWP structure and turnstile. */ - isfree = NULL; - if (p2->p_zomblwp != NULL) { - mutex_enter(p2->p_lock); - if ((isfree = p2->p_zomblwp) != NULL) { - p2->p_zomblwp = NULL; - lwp_free(isfree, true, false);/* releases proc mutex */ - } else - mutex_exit(p2->p_lock); - } - if (isfree == NULL) { - l2 = pool_cache_get(lwp_cache, PR_WAITOK); - memset(l2, 0, sizeof(*l2)); - l2->l_ts = pool_cache_get(turnstile_cache, PR_WAITOK); - SLIST_INIT(>l_pi_lenders); - } else { - l2 = isfree; + if ((l2 = p2->p_zomblwp) != NULL) { + p2->p_zomblwp = NULL; + lwp_free(l2, true, false); + /* p2 now unlocked by lwp_free() */ ts = l2->l_ts; KASSERT(l2->l_inheritedprio == -1); KASSERT(SLIST_EMPTY(>l_pi_lenders)); memset(l2, 0, sizeof(*l2)); l2->l_ts = ts; + } else { + mutex_exit(p2->p_lock); + l2 = pool_cache_get(lwp_cache, PR_WAITOK); + memset(l2, 0, sizeof(*l2)); + l2->l_ts = pool_cache_get(turnstile_cache, PR_WAITOK); + SLIST_INIT(>l_pi_lenders); } l2->l_stat = LSIDL;
CVS commit: src/distrib/utils/embedded/conf
Module Name:src Committed By: jmcneill Date: Sun Dec 1 15:07:04 UTC 2019 Modified Files: src/distrib/utils/embedded/conf: evbarm.conf Log Message: Remove the pretty much useless 128MB swap partition from the arm images. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/distrib/utils/embedded/conf/evbarm.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/conf/evbarm.conf diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.33 src/distrib/utils/embedded/conf/evbarm.conf:1.34 --- src/distrib/utils/embedded/conf/evbarm.conf:1.33 Tue Jun 11 10:50:57 2019 +++ src/distrib/utils/embedded/conf/evbarm.conf Sun Dec 1 15:07:04 2019 @@ -1,15 +1,14 @@ -# $NetBSD: evbarm.conf,v 1.33 2019/06/11 10:50:57 mrg Exp $ +# $NetBSD: evbarm.conf,v 1.34 2019/12/01 15:07:04 jmcneill Exp $ # evbarm shared config # image=$HOME/${board}.img MACHINE=evbarm -swap=256 extra=48 # spare space init=32 boot=$((192 - ${init})) -ffsoffset=$(( (${init} + ${boot} + ${swap}) / 2 ))m +ffsoffset=$(( (${init} + ${boot}) / 2 ))m size=0 # autocompute msdosid=12 @@ -20,14 +19,12 @@ make_label_evbarm() { # compute all sizes in terms of sectors local totalsize=$(( ${newsize} * 1024 * 2 / 512 )) - local swapsize=$(( ${swap} * 1024 )) local bootsize=$(( ${boot} * 1024 )) local bootoffset=$(( ${init} * 1024 )) - local swapoffset=$(( ${bootoffset} + ${bootsize} )) - local asize=$(( ${totalsize} - ${swapsize} - ${bootsize} - ${bootoffset} )) - local aoffset=$(( ${swapoffset} + ${swapsize} )) + local asize=$(( ${totalsize} - ${bootsize} - ${bootoffset} )) + local aoffset=$(( ${bootoffset} + ${bootsize} )) local bps=512 local spt=32 @@ -57,7 +54,6 @@ drivedata: 0 8 partitions: # size offsetfstype [fsize bsize cpg/sgs] a: ${asize} ${aoffset}4.2BSD ${fsize} ${bsize} 0 # - b: ${swapsize} ${swapoffset} swap # c: ${totalsize} 0 unused 0 0 # e: ${bootsize} ${bootoffset} MSDOS# EOF @@ -68,7 +64,6 @@ make_fstab_evbarm_normal() { # NetBSD /etc/fstab # See /usr/share/examples/fstab/ for more examples. ROOT.a / ffs rw,noatime 1 1 -ROOT.b none swap sw 0 0 ROOT.e /boot msdos rw 1 1 kernfs /kern kernfs rw ptyfs /dev/pts ptyfs rw @@ -85,7 +80,6 @@ make_fstab_evbarm_minwrites() { # NetBSD /etc/fstab # See /usr/share/examples/fstab/ for more examples. ROOT.a / ffs rw,log,noatime,nodevmtime 1 1 -ROOT.b none swap sw 0 0 ROOT.e /boot msdos rw 1 1 kernfs /kern kernfs rw ptyfs /dev/pts ptyfs rw @@ -137,6 +131,8 @@ dev_exists() { rc_configured=YES hostname=${board} +no_swap=YES +savecore=NO sshd=YES dhcpcd=YES ntpd=YES
CVS commit: src/sys/arch
Module Name:src Committed By: ad Date: Sun Dec 1 14:52:14 UTC 2019 Modified Files: src/sys/arch/arm/arm: arm_machdep.c src/sys/arch/mips/mips: cpu_subr.c src/sys/arch/sparc/sparc: intr.c src/sys/arch/sparc64/sparc64: machdep.c src/sys/arch/usermode/dev: cpu.c src/sys/arch/x86/x86: x86_machdep.c Log Message: Make cpu_intr_p() safe to use anywhere, i.e. outside assertions: Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not preempted while using the value of curcpu(). Instead, observe the value of l_ncsw before and after the check to see if we have been preempted. If we have been preempted, then we need to retry the read. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/arch/arm/arm/arm_machdep.c cvs rdiff -u -r1.37 -r1.38 src/sys/arch/mips/mips/cpu_subr.c cvs rdiff -u -r1.121 -r1.122 src/sys/arch/sparc/sparc/intr.c cvs rdiff -u -r1.293 -r1.294 src/sys/arch/sparc64/sparc64/machdep.c cvs rdiff -u -r1.81 -r1.82 src/sys/arch/usermode/dev/cpu.c cvs rdiff -u -r1.129 -r1.130 src/sys/arch/x86/x86/x86_machdep.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/arch/arm/arm/arm_machdep.c diff -u src/sys/arch/arm/arm/arm_machdep.c:1.56 src/sys/arch/arm/arm/arm_machdep.c:1.57 --- src/sys/arch/arm/arm/arm_machdep.c:1.56 Sat Nov 23 19:40:34 2019 +++ src/sys/arch/arm/arm/arm_machdep.c Sun Dec 1 14:52:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: arm_machdep.c,v 1.56 2019/11/23 19:40:34 ad Exp $ */ +/* $NetBSD: arm_machdep.c,v 1.57 2019/12/01 14:52:13 ad Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -80,7 +80,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.56 2019/11/23 19:40:34 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.57 2019/12/01 14:52:13 ad Exp $"); #include #include @@ -260,12 +260,27 @@ cpu_need_resched(struct cpu_info *ci, st bool cpu_intr_p(void) { - struct cpu_info * const ci = curcpu(); #ifdef __HAVE_PIC_FAST_SOFTINTS - if (ci->ci_cpl < IPL_VM) + int cpl; +#endif + uint64_t ncsw; + int idepth; + lwp_t *l; + + l = curlwp; + do { + ncsw = l->l_ncsw; + idepth = l->l_cpu->ci_intr_depth; +#ifdef __HAVE_PIC_FAST_SOFTINTS + cpl = ci->ci_cpl; +#endif + } while (__predict_false(ncsw != l->l_ncsw)); + +#ifdef __HAVE_PIC_FAST_SOFTINTS + if (cpl < IPL_VM) return false; #endif - return ci->ci_intr_depth != 0; + return idepth != 0; } #ifdef MODULAR Index: src/sys/arch/mips/mips/cpu_subr.c diff -u src/sys/arch/mips/mips/cpu_subr.c:1.37 src/sys/arch/mips/mips/cpu_subr.c:1.38 --- src/sys/arch/mips/mips/cpu_subr.c:1.37 Sun Nov 24 15:37:39 2019 +++ src/sys/arch/mips/mips/cpu_subr.c Sun Dec 1 14:52:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_subr.c,v 1.37 2019/11/24 15:37:39 ad Exp $ */ +/* $NetBSD: cpu_subr.c,v 1.38 2019/12/01 14:52:13 ad Exp $ */ /*- * Copyright (c) 2010, 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.37 2019/11/24 15:37:39 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.38 2019/12/01 14:52:13 ad Exp $"); #include "opt_cputype.h" #include "opt_ddb.h" @@ -604,11 +604,17 @@ cpu_idle(void) bool cpu_intr_p(void) { - bool rv; - kpreempt_disable(); - rv = (curcpu()->ci_idepth != 0); - kpreempt_enable(); - return rv; + uint64_t ncsw; + int idepth; + lwp_t *l; + + l = curlwp; + do { + ncsw = l->l_ncsw; + idepth = l->l_cpu->ci_idepth; + } while (__predict_false(ncsw != l->l_ncsw)); + + return idepth != 0; } #ifdef MULTIPROCESSOR Index: src/sys/arch/sparc/sparc/intr.c diff -u src/sys/arch/sparc/sparc/intr.c:1.121 src/sys/arch/sparc/sparc/intr.c:1.122 --- src/sys/arch/sparc/sparc/intr.c:1.121 Fri Mar 1 02:33:55 2019 +++ src/sys/arch/sparc/sparc/intr.c Sun Dec 1 14:52:14 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.121 2019/03/01 02:33:55 macallan Exp $ */ +/* $NetBSD: intr.c,v 1.122 2019/12/01 14:52:14 ad Exp $ */ /* * Copyright (c) 1992, 1993 @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.121 2019/03/01 02:33:55 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.122 2019/12/01 14:52:14 ad Exp $"); #include "opt_multiprocessor.h" #include "opt_sparc_arch.h" @@ -889,11 +889,15 @@ intr_biglock_wrapper(void *vp) bool cpu_intr_p(void) { + uint64_t ncsw; int idepth; + lwp_t *l; - kpreempt_disable(); - idepth = curcpu()->ci_idepth; - kpreempt_enable(); + l = curlwp; + do { + ncsw = l->l_ncsw; + idepth = l->l_cpu->ci_idepth; + } while (__predict_false(ncsw != l->l_ncsw)); return idepth != 0; } Index: src/sys/arch/sparc64/sparc64/machdep.c diff -u src/sys/arch/sparc64/sparc64/machdep.c:1.293 src/sys/arch/sparc64/sparc64/machdep.c:1.294 --- src/sys/arch/sparc64/sparc64/machdep.c:1.293 Sat Nov 23 19:40:37 2019 +++ src/sys/arch/sparc64/sparc64/machdep.c Sun Dec 1 14:52:14 2019 @@ -1,4 +1,4 @@ -/* $NetBSD:
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Dec 1 14:43:26 UTC 2019 Modified Files: src/sys/uvm: uvm_km.c Log Message: Minor correction to previous. To generate a diff of this commit: cvs rdiff -u -r1.148 -r1.149 src/sys/uvm/uvm_km.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/uvm/uvm_km.c diff -u src/sys/uvm/uvm_km.c:1.148 src/sys/uvm/uvm_km.c:1.149 --- src/sys/uvm/uvm_km.c:1.148 Sun Dec 1 14:40:31 2019 +++ src/sys/uvm/uvm_km.c Sun Dec 1 14:43:26 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_km.c,v 1.148 2019/12/01 14:40:31 ad Exp $ */ +/* $NetBSD: uvm_km.c,v 1.149 2019/12/01 14:43:26 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -152,7 +152,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.148 2019/12/01 14:40:31 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.149 2019/12/01 14:43:26 ad Exp $"); #include "opt_uvmhist.h" @@ -481,6 +481,7 @@ uvm_km_pgremove(vaddr_t startva, vaddr_t mutex_exit(uobj->vmobjlock); if (swpgonlydelta > 0) { + KASSERT(uvmexp.swpgonly >= swpgonlydelta); atomic_add_int(, -swpgonlydelta); } }
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Dec 1 14:40:31 UTC 2019 Modified Files: src/sys/uvm: uvm.h uvm_anon.c uvm_aobj.c uvm_km.c uvm_loan.c uvm_pager.c uvm_pdaemon.c uvm_swap.c Log Message: - Adjust uvmexp.swpgonly with atomics, and make uvm_swap_data_lock static. - A bit more __cacheline_aligned on mutexes. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/uvm/uvm.h cvs rdiff -u -r1.64 -r1.65 src/sys/uvm/uvm_anon.c cvs rdiff -u -r1.128 -r1.129 src/sys/uvm/uvm_aobj.c cvs rdiff -u -r1.147 -r1.148 src/sys/uvm/uvm_km.c cvs rdiff -u -r1.87 -r1.88 src/sys/uvm/uvm_loan.c cvs rdiff -u -r1.111 -r1.112 src/sys/uvm/uvm_pager.c \ src/sys/uvm/uvm_pdaemon.c cvs rdiff -u -r1.181 -r1.182 src/sys/uvm/uvm_swap.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/uvm/uvm.h diff -u src/sys/uvm/uvm.h:1.68 src/sys/uvm/uvm.h:1.69 --- src/sys/uvm/uvm.h:1.68 Mon Jan 2 20:08:32 2017 +++ src/sys/uvm/uvm.h Sun Dec 1 14:40:31 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm.h,v 1.68 2017/01/02 20:08:32 cherry Exp $ */ +/* $NetBSD: uvm.h,v 1.69 2019/12/01 14:40:31 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -126,7 +126,6 @@ extern struct uvm_object *uvm_kernel_obj extern kmutex_t uvm_pageqlock; /* lock for active/inactive page q */ extern kmutex_t uvm_fpageqlock; /* lock for free page q */ extern kmutex_t uvm_kentry_lock; -extern kmutex_t uvm_swap_data_lock; #endif /* _KERNEL */ Index: src/sys/uvm/uvm_anon.c diff -u src/sys/uvm/uvm_anon.c:1.64 src/sys/uvm/uvm_anon.c:1.65 --- src/sys/uvm/uvm_anon.c:1.64 Sat Oct 28 00:37:13 2017 +++ src/sys/uvm/uvm_anon.c Sun Dec 1 14:40:31 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_anon.c,v 1.64 2017/10/28 00:37:13 pgoyette Exp $ */ +/* $NetBSD: uvm_anon.c,v 1.65 2019/12/01 14:40:31 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.64 2017/10/28 00:37:13 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.65 2019/12/01 14:40:31 ad Exp $"); #include "opt_uvmhist.h" @@ -172,10 +172,8 @@ uvm_anon_dispose(struct vm_anon *anon) #if defined(VMSWAP) if (pg == NULL && anon->an_swslot > 0) { /* This page is no longer only in swap. */ - mutex_enter(_swap_data_lock); KASSERT(uvmexp.swpgonly > 0); - uvmexp.swpgonly--; - mutex_exit(_swap_data_lock); + atomic_dec_uint(); } #endif Index: src/sys/uvm/uvm_aobj.c diff -u src/sys/uvm/uvm_aobj.c:1.128 src/sys/uvm/uvm_aobj.c:1.129 --- src/sys/uvm/uvm_aobj.c:1.128 Sun Jul 28 05:28:53 2019 +++ src/sys/uvm/uvm_aobj.c Sun Dec 1 14:40:31 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_aobj.c,v 1.128 2019/07/28 05:28:53 msaitoh Exp $ */ +/* $NetBSD: uvm_aobj.c,v 1.129 2019/12/01 14:40:31 ad Exp $ */ /* * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.128 2019/07/28 05:28:53 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.129 2019/12/01 14:40:31 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_uvmhist.h" @@ -1491,10 +1491,8 @@ uao_dropswap_range(struct uvm_object *uo */ if (swpgonlydelta > 0) { - mutex_enter(_swap_data_lock); KASSERT(uvmexp.swpgonly >= swpgonlydelta); - uvmexp.swpgonly -= swpgonlydelta; - mutex_exit(_swap_data_lock); + atomic_add_int(, -swpgonlydelta); } } Index: src/sys/uvm/uvm_km.c diff -u src/sys/uvm/uvm_km.c:1.147 src/sys/uvm/uvm_km.c:1.148 --- src/sys/uvm/uvm_km.c:1.147 Thu Nov 14 16:23:53 2019 +++ src/sys/uvm/uvm_km.c Sun Dec 1 14:40:31 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_km.c,v 1.147 2019/11/14 16:23:53 maxv Exp $ */ +/* $NetBSD: uvm_km.c,v 1.148 2019/12/01 14:40:31 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -152,7 +152,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.147 2019/11/14 16:23:53 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.148 2019/12/01 14:40:31 ad Exp $"); #include "opt_uvmhist.h" @@ -481,10 +481,7 @@ uvm_km_pgremove(vaddr_t startva, vaddr_t mutex_exit(uobj->vmobjlock); if (swpgonlydelta > 0) { - mutex_enter(_swap_data_lock); - KASSERT(uvmexp.swpgonly >= swpgonlydelta); - uvmexp.swpgonly -= swpgonlydelta; - mutex_exit(_swap_data_lock); + atomic_add_int(, -swpgonlydelta); } } Index: src/sys/uvm/uvm_loan.c diff -u src/sys/uvm/uvm_loan.c:1.87 src/sys/uvm/uvm_loan.c:1.88 --- src/sys/uvm/uvm_loan.c:1.87 Fri May 25 20:11:03 2018 +++ src/sys/uvm/uvm_loan.c Sun Dec 1 14:40:31 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_loan.c,v 1.87 2018/05/25 20:11:03 jdolecek Exp $ */ +/* $NetBSD: uvm_loan.c,v 1.88 2019/12/01 14:40:31 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.87
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Dec 1 14:30:01 UTC 2019 Modified Files: src/sys/uvm: uvm_fault.c Log Message: Deactivate pages in batch instead of acquiring uvm_pageqlock repeatedly. To generate a diff of this commit: cvs rdiff -u -r1.210 -r1.211 src/sys/uvm/uvm_fault.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/uvm/uvm_fault.c diff -u src/sys/uvm/uvm_fault.c:1.210 src/sys/uvm/uvm_fault.c:1.211 --- src/sys/uvm/uvm_fault.c:1.210 Sun Dec 1 10:19:59 2019 +++ src/sys/uvm/uvm_fault.c Sun Dec 1 14:30:01 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_fault.c,v 1.210 2019/12/01 10:19:59 martin Exp $ */ +/* $NetBSD: uvm_fault.c,v 1.211 2019/12/01 14:30:01 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.210 2019/12/01 10:19:59 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.211 2019/12/01 14:30:01 ad Exp $"); #include "opt_uvmhist.h" @@ -191,19 +191,19 @@ uvmfault_anonflush(struct vm_anon **anon int lcv; struct vm_page *pg; + mutex_enter(_pageqlock); for (lcv = 0; lcv < n; lcv++) { if (anons[lcv] == NULL) continue; KASSERT(mutex_owned(anons[lcv]->an_lock)); pg = anons[lcv]->an_page; if (pg && (pg->flags & PG_BUSY) == 0) { - mutex_enter(_pageqlock); if (pg->wire_count == 0) { uvm_pagedeactivate(pg); } - mutex_exit(_pageqlock); } } + mutex_exit(_pageqlock); } /*
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Dec 1 14:28:01 UTC 2019 Modified Files: src/sys/uvm: uvm_init.c Log Message: Give each of the page queue locks their own cache line. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/uvm/uvm_init.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/uvm/uvm_init.c diff -u src/sys/uvm/uvm_init.c:1.49 src/sys/uvm/uvm_init.c:1.50 --- src/sys/uvm/uvm_init.c:1.49 Sat May 19 11:39:37 2018 +++ src/sys/uvm/uvm_init.c Sun Dec 1 14:28:01 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_init.c,v 1.49 2018/05/19 11:39:37 jdolecek Exp $ */ +/* $NetBSD: uvm_init.c,v 1.50 2019/12/01 14:28:01 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_init.c,v 1.49 2018/05/19 11:39:37 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_init.c,v 1.50 2019/12/01 14:28:01 ad Exp $"); #include #include @@ -64,10 +64,9 @@ const int * const uvmexp_pagemask = const int * const uvmexp_pageshift = #endif -kmutex_t uvm_pageqlock; -kmutex_t uvm_fpageqlock; -kmutex_t uvm_kentry_lock; -kmutex_t uvm_swap_data_lock; +kmutex_t uvm_pageqlock __cacheline_aligned; +kmutex_t uvm_fpageqlock __cacheline_aligned; +kmutex_t uvm_kentry_lock __cacheline_aligned; /* * uvm_md_init: Init dependant on the MD boot context.
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Dec 1 14:24:43 UTC 2019 Modified Files: src/sys/uvm: uvm_amap.c Log Message: Activate pages in batch instead of acquring uvm_pageqlock a zillion times. To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.110 src/sys/uvm/uvm_amap.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/uvm/uvm_amap.c diff -u src/sys/uvm/uvm_amap.c:1.109 src/sys/uvm/uvm_amap.c:1.110 --- src/sys/uvm/uvm_amap.c:1.109 Sun Aug 12 09:29:16 2018 +++ src/sys/uvm/uvm_amap.c Sun Dec 1 14:24:43 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_amap.c,v 1.109 2018/08/12 09:29:16 maxv Exp $ */ +/* $NetBSD: uvm_amap.c,v 1.110 2019/12/01 14:24:43 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.109 2018/08/12 09:29:16 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.110 2019/12/01 14:24:43 ad Exp $"); #include "opt_uvmhist.h" @@ -56,7 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v * we are ok). */ static struct pool_cache uvm_amap_cache; -static kmutex_t amap_list_lock; +static kmutex_t amap_list_lock __cacheline_aligned; static LIST_HEAD(, vm_amap) amap_list; /* @@ -1070,13 +1070,19 @@ ReStart: * Drop PG_BUSY on new page. Since its owner was locked all * this time - it cannot be PG_RELEASED or PG_WANTED. */ - - mutex_enter(_pageqlock); - uvm_pageactivate(npg); - mutex_exit(_pageqlock); npg->flags &= ~(PG_BUSY|PG_FAKE); UVM_PAGE_OWN(npg, NULL); } + /* Activate all pages. Some may be missing because of retry above. */ + mutex_enter(_pageqlock); + for (lcv = 0 ; lcv < amap->am_nused ; lcv++) { + anon = amap->am_anon[amap->am_slots[lcv]]; + KASSERT(anon->an_lock == amap->am_lock); + if (anon->an_page != NULL) { + uvm_pageactivate(anon->an_page); + } + } + mutex_exit(_pageqlock); amap_unlock(amap); }
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Sun Dec 1 14:20:00 UTC 2019 Modified Files: src/sys/kern: subr_xcall.c Log Message: If the system is not up and running yet, just run the function locally. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/kern/subr_xcall.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/subr_xcall.c diff -u src/sys/kern/subr_xcall.c:1.28 src/sys/kern/subr_xcall.c:1.29 --- src/sys/kern/subr_xcall.c:1.28 Mon Nov 11 09:50:11 2019 +++ src/sys/kern/subr_xcall.c Sun Dec 1 14:20:00 2019 @@ -1,7 +1,7 @@ -/* $NetBSD: subr_xcall.c,v 1.28 2019/11/11 09:50:11 maxv Exp $ */ +/* $NetBSD: subr_xcall.c,v 1.29 2019/12/01 14:20:00 ad Exp $ */ /*- - * Copyright (c) 2007-2010 The NetBSD Foundation, Inc. + * Copyright (c) 2007-2010, 2019 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_xcall.c,v 1.28 2019/11/11 09:50:11 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_xcall.c,v 1.29 2019/12/01 14:20:00 ad Exp $"); #include #include @@ -84,6 +84,7 @@ __KERNEL_RCSID(0, "$NetBSD: subr_xcall.c #include #include #include +#include #ifdef _RUMPKERNEL #include "rump_private.h" @@ -259,6 +260,11 @@ xc_broadcast(unsigned int flags, xcfunc_ KASSERT(!cpu_intr_p() && !cpu_softintr_p()); ASSERT_SLEEPABLE(); + if (__predict_false(!mp_online)) { + (*func)(arg1, arg2); + return 0; + } + if ((flags & XC_HIGHPRI) != 0) { int ipl = xc_extract_ipl(flags); return xc_highpri(func, arg1, arg2, NULL, ipl); @@ -300,11 +306,20 @@ uint64_t xc_unicast(unsigned int flags, xcfunc_t func, void *arg1, void *arg2, struct cpu_info *ci) { + int s; KASSERT(ci != NULL); KASSERT(!cpu_intr_p() && !cpu_softintr_p()); ASSERT_SLEEPABLE(); + if (__predict_false(!mp_online)) { + KASSERT(ci == curcpu()); + s = splsoftserial(); + (*func)(arg1, arg2); + splx(s); + return 0; + } + if ((flags & XC_HIGHPRI) != 0) { int ipl = xc_extract_ipl(flags); return xc_highpri(func, arg1, arg2, ci, ipl); @@ -326,6 +341,10 @@ xc_wait(uint64_t where) KASSERT(!cpu_intr_p() && !cpu_softintr_p()); ASSERT_SLEEPABLE(); + if (__predict_false(!mp_online)) { + return; + } + /* Determine whether it is high or low priority cross-call. */ if ((where & XC_PRI_BIT) != 0) { xc = _high_pri; @@ -335,11 +354,15 @@ xc_wait(uint64_t where) } /* Block until awoken. */ - mutex_enter(>xc_lock); - while (xc->xc_donep < where) { - cv_wait(>xc_busy, >xc_lock); + if (xc->xc_donep < where) { + mutex_enter(>xc_lock); + while (xc->xc_donep < where) { + cv_wait(>xc_busy, >xc_lock); + } + mutex_exit(>xc_lock); + } else { + membar_enter(); } - mutex_exit(>xc_lock); } /*
CVS commit: src/sys/dev
Module Name:src Committed By: ad Date: Sun Dec 1 14:18:51 UTC 2019 Modified Files: src/sys/dev/ic: vga.c vga_raster.c src/sys/dev/isa: pcdisplay.c Log Message: Map the video RAM cacheable/prefetchable, it's very slow and this helps a bit. To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 src/sys/dev/ic/vga.c cvs rdiff -u -r1.45 -r1.46 src/sys/dev/ic/vga_raster.c cvs rdiff -u -r1.43 -r1.44 src/sys/dev/isa/pcdisplay.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/ic/vga.c diff -u src/sys/dev/ic/vga.c:1.116 src/sys/dev/ic/vga.c:1.117 --- src/sys/dev/ic/vga.c:1.116 Sun Nov 10 21:16:35 2019 +++ src/sys/dev/ic/vga.c Sun Dec 1 14:18:51 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: vga.c,v 1.116 2019/11/10 21:16:35 chs Exp $ */ +/* $NetBSD: vga.c,v 1.117 2019/12/01 14:18:51 ad Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.116 2019/11/10 21:16:35 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.117 2019/12/01 14:18:51 ad Exp $"); #include "opt_vga.h" /* for WSCONS_SUPPORT_PCVTFONTS */ @@ -544,7 +544,9 @@ vga_init(struct vga_config *vc, bus_spac >vh_ioh_6845)) panic("vga_init: couldn't map 6845 io"); - if (bus_space_map(vh->vh_memt, 0xa, 0x2, 0, >vh_allmemh)) + if (bus_space_map(vh->vh_memt, 0xa, 0x2, + BUS_SPACE_MAP_CACHEABLE | BUS_SPACE_MAP_PREFETCHABLE, + >vh_allmemh)) panic("vga_init: couldn't map memory"); if (bus_space_subregion(vh->vh_memt, vh->vh_allmemh, Index: src/sys/dev/ic/vga_raster.c diff -u src/sys/dev/ic/vga_raster.c:1.45 src/sys/dev/ic/vga_raster.c:1.46 --- src/sys/dev/ic/vga_raster.c:1.45 Sun Nov 10 21:16:35 2019 +++ src/sys/dev/ic/vga_raster.c Sun Dec 1 14:18:51 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: vga_raster.c,v 1.45 2019/11/10 21:16:35 chs Exp $ */ +/* $NetBSD: vga_raster.c,v 1.46 2019/12/01 14:18:51 ad Exp $ */ /* * Copyright (c) 2001, 2002 Bang Jun-Young @@ -56,7 +56,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vga_raster.c,v 1.45 2019/11/10 21:16:35 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vga_raster.c,v 1.46 2019/12/01 14:18:51 ad Exp $"); #include "opt_vga.h" #include "opt_wsmsgattrs.h" /* for WSDISPLAY_CUSTOM_OUTPUT */ @@ -395,8 +395,10 @@ vga_raster_init(struct vga_config *vc, b >vh_ioh_6845)) panic("vga_raster_init: couldn't map 6845 io"); - if (bus_space_map(vh->vh_memt, 0xa, 0x2, 0, >vh_allmemh)) - panic("vga_raster_init: couldn't map memory"); + if (bus_space_map(vh->vh_memt, 0xa, 0x2, + BUS_SPACE_MAP_CACHEABLE | BUS_SPACE_MAP_PREFETCHABLE, + >vh_allmemh)) + panic("vga_init: couldn't map memory"); if (bus_space_subregion(vh->vh_memt, vh->vh_allmemh, 0, 0x1, >vh_memh)) Index: src/sys/dev/isa/pcdisplay.c diff -u src/sys/dev/isa/pcdisplay.c:1.43 src/sys/dev/isa/pcdisplay.c:1.44 --- src/sys/dev/isa/pcdisplay.c:1.43 Sat Apr 21 15:10:28 2018 +++ src/sys/dev/isa/pcdisplay.c Sun Dec 1 14:18:51 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pcdisplay.c,v 1.43 2018/04/21 15:10:28 mlelstv Exp $ */ +/* $NetBSD: pcdisplay.c,v 1.44 2019/12/01 14:18:51 ad Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcdisplay.c,v 1.43 2018/04/21 15:10:28 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcdisplay.c,v 1.44 2019/12/01 14:18:51 ad Exp $"); #include #include @@ -190,7 +190,8 @@ pcdisplay_init(struct pcdisplay_config * dc->mono = mono; if (bus_space_map(memt, mono ? 0xb : 0xb8000, 0x8000, - 0, >ph_memh)) + BUS_SPACE_MAP_CACHEABLE | BUS_SPACE_MAP_PREFETCHABLE, + >ph_memh)) panic("pcdisplay_init: cannot map memory"); if (bus_space_map(iot, mono ? 0x3b0 : 0x3d0, 0x10, 0, >ph_ioh_6845))
CVS commit: src/usr.sbin/pstat
Module Name:src Committed By: ad Date: Sun Dec 1 14:04:52 UTC 2019 Modified Files: src/usr.sbin/pstat: pstat.c Log Message: Update to match change in layout of vnode LRU lists. To generate a diff of this commit: cvs rdiff -u -r1.128 -r1.129 src/usr.sbin/pstat/pstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/pstat/pstat.c diff -u src/usr.sbin/pstat/pstat.c:1.128 src/usr.sbin/pstat/pstat.c:1.129 --- src/usr.sbin/pstat/pstat.c:1.128 Thu May 4 16:26:09 2017 +++ src/usr.sbin/pstat/pstat.c Sun Dec 1 14:04:52 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pstat.c,v 1.128 2017/05/04 16:26:09 sevan Exp $ */ +/* $NetBSD: pstat.c,v 1.129 2019/12/01 14:04:52 ad Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)pstat.c 8.16 (Berkeley) 5/9/95"; #else -__RCSID("$NetBSD: pstat.c,v 1.128 2017/05/04 16:26:09 sevan Exp $"); +__RCSID("$NetBSD: pstat.c,v 1.129 2019/12/01 14:04:52 ad Exp $"); #endif #endif /* not lint */ @@ -85,23 +85,19 @@ __RCSID("$NetBSD: pstat.c,v 1.128 2017/0 #include "swapctl.h" struct nlist nl[] = { -#define V_LRU_FREE_LIST 0 - { "_lru_free_list", 0, 0, 0, 0 }, /* address of lru free list. */ -#define V_LRU_HOLD_LIST 1 - { "_lru_hold_list", 0, 0, 0, 0 }, /* address of lru hold list. */ -#define V_LRU_VRELE_LIST 2 - { "_lru_vrele_list", 0, 0, 0, 0 }, /* address of lru vrele list. */ -#define V_NUMV 3 +#define V_LRU_LIST 0 + { "_lru_list", 0, 0, 0, 0 } , /* address of lru lists. */ +#define V_NUMV 1 { "_numvnodes", 0, 0, 0, 0 }, -#define V_NEXT_OFFSET 4 +#define V_NEXT_OFFSET 2 { "_vnode_offset_next_by_lru", 0, 0, 0, 0 }, -#define FNL_NFILE 5 +#define FNL_NFILE 3 { "_nfiles", 0, 0, 0, 0 }, -#define FNL_MAXFILE 6 +#define FNL_MAXFILE 4 { "_maxfiles", 0, 0, 0, 0 }, -#define TTY_NTTY 7 +#define TTY_NTTY 5 { "_tty_count", 0, 0, 0, 0 }, -#define TTY_TTYLIST 8 +#define TTY_TTYLIST 6 { "_ttylist", 0, 0, 0, 0 }, #define NLMANDATORY TTY_TTYLIST /* names up to here are mandatory */ { "", 0, 0, 0, 0 } @@ -770,11 +766,12 @@ kinfo_vnodes(int *avnodes) ep = bp + (numvnodes + 20) * (VPTRSZ + VNODESZ); KGET(V_NEXT_OFFSET, next_offset); - for (i = V_LRU_FREE_LIST; i <= V_LRU_VRELE_LIST; i++) { + for (i = 0; i < 3; i++) { TAILQ_HEAD(vnodelst, vnode) lru_head; struct vnode *vp, vnode; - KGET(i, lru_head); + KGET2((nl[V_LRU_LIST].n_value + sizeof(lru_head) * i), _head, + sizeof(lru_head), "lru_list"); vp = TAILQ_FIRST(_head); while (vp != NULL) { KGET2(vp, , sizeof(vnode), "vnode");
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Dec 1 13:58:53 UTC 2019 Modified Files: src/sys/kern: vnode_if.c src/sys/rump/include/rump: rumpvnode_if.h src/sys/rump/librump/rumpvfs: rumpvnode_if.c src/sys/sys: vnode_if.h Log Message: Regen for VOP_LOCK & LK_UPGRADE/LK_DOWNGRADE. To generate a diff of this commit: cvs rdiff -u -r1.108 -r1.109 src/sys/kern/vnode_if.c cvs rdiff -u -r1.31 -r1.32 src/sys/rump/include/rump/rumpvnode_if.h cvs rdiff -u -r1.31 -r1.32 src/sys/rump/librump/rumpvfs/rumpvnode_if.c cvs rdiff -u -r1.102 -r1.103 src/sys/sys/vnode_if.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/vnode_if.c diff -u src/sys/kern/vnode_if.c:1.108 src/sys/kern/vnode_if.c:1.109 --- src/sys/kern/vnode_if.c:1.108 Fri Oct 11 08:05:19 2019 +++ src/sys/kern/vnode_if.c Sun Dec 1 13:58:52 2019 @@ -1,13 +1,13 @@ -/* $NetBSD: vnode_if.c,v 1.108 2019/10/11 08:05:19 hannken Exp $ */ +/* $NetBSD: vnode_if.c,v 1.109 2019/12/01 13:58:52 ad Exp $ */ /* * Warning: DO NOT EDIT! This file is automatically generated! * (Modifications made here may easily be lost!) * * Created from the file: - * NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp + * NetBSD: vnode_if.src,v 1.78 2019/10/11 08:04:52 hannken Exp * by the script: - * NetBSD: vnode_if.sh,v 1.66 2017/06/04 08:03:26 hannken Exp + * NetBSD: vnode_if.sh,v 1.68 2019/12/01 13:56:29 ad Exp */ /* @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.108 2019/10/11 08:05:19 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.109 2019/12/01 13:58:52 ad Exp $"); #include #include @@ -1280,11 +1280,11 @@ VOP_LOCK(struct vnode *vp, a.a_desc = VDESC(vop_lock); a.a_vp = vp; a.a_flags = flags; - error = vop_pre(vp, , , (flags & LK_NOWAIT ? FST_TRY : FST_YES)); + error = vop_pre(vp, , , (flags & (LK_UPGRADE|LK_DOWNGRADE) ? FST_NO : (flags & LK_NOWAIT ? FST_TRY : FST_YES))); if (error) return error; error = (VCALL(vp, VOFFSET(vop_lock), )); - vop_post(vp, mp, mpsafe, (error ? FST_YES : FST_NO)); + vop_post(vp, mp, mpsafe, (flags & (LK_UPGRADE|LK_DOWNGRADE) ? FST_NO : (error ? FST_YES : FST_NO))); return error; } Index: src/sys/rump/include/rump/rumpvnode_if.h diff -u src/sys/rump/include/rump/rumpvnode_if.h:1.31 src/sys/rump/include/rump/rumpvnode_if.h:1.32 --- src/sys/rump/include/rump/rumpvnode_if.h:1.31 Wed Jul 12 09:31:59 2017 +++ src/sys/rump/include/rump/rumpvnode_if.h Sun Dec 1 13:58:52 2019 @@ -1,13 +1,13 @@ -/* $NetBSD: rumpvnode_if.h,v 1.31 2017/07/12 09:31:59 hannken Exp $ */ +/* $NetBSD: rumpvnode_if.h,v 1.32 2019/12/01 13:58:52 ad Exp $ */ /* * Warning: DO NOT EDIT! This file is automatically generated! * (Modifications made here may easily be lost!) * * Created from the file: - * NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp + * NetBSD: vnode_if.src,v 1.78 2019/10/11 08:04:52 hannken Exp * by the script: - * NetBSD: vnode_if.sh,v 1.66 2017/06/04 08:03:26 hannken Exp + * NetBSD: vnode_if.sh,v 1.68 2019/12/01 13:56:29 ad Exp */ /* Index: src/sys/rump/librump/rumpvfs/rumpvnode_if.c diff -u src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.31 src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.32 --- src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.31 Wed Jul 12 09:31:59 2017 +++ src/sys/rump/librump/rumpvfs/rumpvnode_if.c Sun Dec 1 13:58:53 2019 @@ -1,13 +1,13 @@ -/* $NetBSD: rumpvnode_if.c,v 1.31 2017/07/12 09:31:59 hannken Exp $ */ +/* $NetBSD: rumpvnode_if.c,v 1.32 2019/12/01 13:58:53 ad Exp $ */ /* * Warning: DO NOT EDIT! This file is automatically generated! * (Modifications made here may easily be lost!) * * Created from the file: - * NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp + * NetBSD: vnode_if.src,v 1.78 2019/10/11 08:04:52 hannken Exp * by the script: - * NetBSD: vnode_if.sh,v 1.66 2017/06/04 08:03:26 hannken Exp + * NetBSD: vnode_if.sh,v 1.68 2019/12/01 13:56:29 ad Exp */ /* @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rumpvnode_if.c,v 1.31 2017/07/12 09:31:59 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rumpvnode_if.c,v 1.32 2019/12/01 13:58:53 ad Exp $"); #include #include Index: src/sys/sys/vnode_if.h diff -u src/sys/sys/vnode_if.h:1.102 src/sys/sys/vnode_if.h:1.103 --- src/sys/sys/vnode_if.h:1.102 Wed Jul 12 09:32:00 2017 +++ src/sys/sys/vnode_if.h Sun Dec 1 13:58:53 2019 @@ -1,13 +1,13 @@ -/* $NetBSD: vnode_if.h,v 1.102 2017/07/12 09:32:00 hannken Exp $ */ +/* $NetBSD: vnode_if.h,v 1.103 2019/12/01 13:58:53 ad Exp $ */ /* * Warning: DO NOT EDIT! This file is automatically generated! * (Modifications made here may easily be lost!) * * Created from the file: - * NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp + * NetBSD: vnode_if.src,v 1.78 2019/10/11 08:04:52 hannken Exp * by the script: - * NetBSD:
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Dec 1 13:56:29 UTC 2019 Modified Files: src/sys/kern: vfs_subr.c vfs_vnode.c vfs_vnops.c vnode_if.sh src/sys/miscfs/genfs: genfs_vnops.c src/sys/sys: vnode.h vnode_impl.h Log Message: Minor vnode locking changes: - Stop using atomics to maniupulate v_usecount. It was a mistake to begin with. It doesn't work as intended unless the XLOCK bit is incorporated in v_usecount and we don't have that any more. When I introduced this 10+ years ago it was to reduce pressure on v_interlock but it doesn't do that, it just makes stuff disappear from lockstat output and introduces problems elsewhere. We could do atomic usecounts on vnodes but there has to be a well thought out scheme. - Resurrect LK_UPGRADE/LK_DOWNGRADE which will be needed to work effectively when there is increased use of shared locks on vnodes. - Allocate the vnode lock using rw_obj_alloc() to reduce false sharing of struct vnode. - Put all of the LRU lists into a single cache line, and do not requeue a vnode if it's already on the correct list and was requeued recently (less than a second ago). Kernel build before and after: 119.63s real 1453.16s user 2742.57s system 115.29s real 1401.52s user 2690.94s system To generate a diff of this commit: cvs rdiff -u -r1.474 -r1.475 src/sys/kern/vfs_subr.c cvs rdiff -u -r1.103 -r1.104 src/sys/kern/vfs_vnode.c cvs rdiff -u -r1.202 -r1.203 src/sys/kern/vfs_vnops.c cvs rdiff -u -r1.67 -r1.68 src/sys/kern/vnode_if.sh cvs rdiff -u -r1.199 -r1.200 src/sys/miscfs/genfs/genfs_vnops.c cvs rdiff -u -r1.283 -r1.284 src/sys/sys/vnode.h cvs rdiff -u -r1.17 -r1.18 src/sys/sys/vnode_impl.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_subr.c diff -u src/sys/kern/vfs_subr.c:1.474 src/sys/kern/vfs_subr.c:1.475 --- src/sys/kern/vfs_subr.c:1.474 Sat Nov 16 10:05:44 2019 +++ src/sys/kern/vfs_subr.c Sun Dec 1 13:56:29 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_subr.c,v 1.474 2019/11/16 10:05:44 maxv Exp $ */ +/* $NetBSD: vfs_subr.c,v 1.475 2019/12/01 13:56:29 ad Exp $ */ /*- * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.474 2019/11/16 10:05:44 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.475 2019/12/01 13:56:29 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1110,7 +1110,7 @@ vprint_common(struct vnode *vp, const ch vp->v_usecount, vp->v_writecount, vp->v_holdcnt); (*pr)("%ssize %" PRIx64 " writesize %" PRIx64 " numoutput %d\n", prefix, vp->v_size, vp->v_writesize, vp->v_numoutput); - (*pr)("%sdata %p lock %p\n", prefix, vp->v_data, >vi_lock); + (*pr)("%sdata %p lock %p\n", prefix, vp->v_data, vip->vi_lock); (*pr)("%sstate %s key(%p %zd)", prefix, vstate_name(vip->vi_state), vip->vi_key.vk_mount, vip->vi_key.vk_key_len); @@ -1543,7 +1543,7 @@ vfs_vnode_lock_print(void *vlock, int fu for (mp = _mountlist_next(NULL); mp; mp = _mountlist_next(mp)) { TAILQ_FOREACH(vip, >mnt_vnodelist, vi_mntvnodes) { - if (>vi_lock != vlock) + if (vip->vi_lock != vlock) continue; vfs_vnode_print(VIMPL_TO_VNODE(vip), full, pr); } Index: src/sys/kern/vfs_vnode.c diff -u src/sys/kern/vfs_vnode.c:1.103 src/sys/kern/vfs_vnode.c:1.104 --- src/sys/kern/vfs_vnode.c:1.103 Wed Feb 20 10:07:27 2019 +++ src/sys/kern/vfs_vnode.c Sun Dec 1 13:56:29 2019 @@ -1,7 +1,7 @@ -/* $NetBSD: vfs_vnode.c,v 1.103 2019/02/20 10:07:27 hannken Exp $ */ +/* $NetBSD: vfs_vnode.c,v 1.104 2019/12/01 13:56:29 ad Exp $ */ /*- - * Copyright (c) 1997-2011 The NetBSD Foundation, Inc. + * Copyright (c) 1997-2011, 2019 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -143,20 +143,10 @@ * as vput(9), routines. Common points holding references are e.g. * file openings, current working directory, mount points, etc. * - * Note on v_usecount and its locking - * - * At nearly all points it is known that v_usecount could be zero, - * the vnode_t::v_interlock will be held. To change v_usecount away - * from zero, the interlock must be held. To change from a non-zero - * value to zero, again the interlock must be held. - * - * Changing the usecount from a non-zero value to a non-zero value can - * safely be done using atomic operations, without the interlock held. - * */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.103 2019/02/20 10:07:27 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.104 2019/12/01 13:56:29 ad Exp $"); #include #include @@ -181,33 +171,39 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c, #include #include +#include /* Flags to vrelel. */ -#define VRELEL_ASYNC_RELE 0x0001 /* Always defer to vrele thread. */ -#define VRELEL_FORCE_RELE
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Dec 1 13:46:34 UTC 2019 Modified Files: src/sys/rump/include/rump: rump_namei.h src/sys/sys: namei.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/rump/include/rump/rump_namei.h cvs rdiff -u -r1.100 -r1.101 src/sys/sys/namei.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/rump/include/rump/rump_namei.h diff -u src/sys/rump/include/rump/rump_namei.h:1.34 src/sys/rump/include/rump/rump_namei.h:1.35 --- src/sys/rump/include/rump/rump_namei.h:1.34 Sun Dec 1 13:39:53 2019 +++ src/sys/rump/include/rump/rump_namei.h Sun Dec 1 13:46:34 2019 @@ -1,11 +1,11 @@ -/* $NetBSD: rump_namei.h,v 1.34 2019/12/01 13:39:53 ad Exp $ */ +/* $NetBSD: rump_namei.h,v 1.35 2019/12/01 13:46:34 ad Exp $ */ /* * WARNING: GENERATED FILE. DO NOT EDIT * (edit namei.src and run make namei in src/sys/sys) * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp - * from: NetBSD: namei.src,v 1.43 2019/09/13 13:58:53 christos Exp + * from: NetBSD: namei.src,v 1.45 2019/12/01 13:45:42 ad Exp */ #ifndef _RUMP_RUMP_NAMEI_H_ Index: src/sys/sys/namei.h diff -u src/sys/sys/namei.h:1.100 src/sys/sys/namei.h:1.101 --- src/sys/sys/namei.h:1.100 Sun Dec 1 13:39:53 2019 +++ src/sys/sys/namei.h Sun Dec 1 13:46:34 2019 @@ -1,11 +1,11 @@ -/* $NetBSD: namei.h,v 1.100 2019/12/01 13:39:53 ad Exp $ */ +/* $NetBSD: namei.h,v 1.101 2019/12/01 13:46:34 ad Exp $ */ /* * WARNING: GENERATED FILE. DO NOT EDIT * (edit namei.src and run make namei in src/sys/sys) * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp - * from: NetBSD: namei.src,v 1.43 2019/09/13 13:58:53 christos Exp + * from: NetBSD: namei.src,v 1.45 2019/12/01 13:45:42 ad Exp */ /* @@ -227,7 +227,7 @@ struct namecache { struct vnode *nc_dvp; /* N vnode of parent of name */ struct vnode *nc_vp; /* N vnode the name refers to */ kmutex_t *nc_lock; /* - lock on this entry */ - int nc_hittime; /* N last time scored a hit */ + volatile int nc_hittime; /* N last time scored a hit */ int nc_flags; /* - copy of componentname ISWHITEOUT */ u_short nc_nlen; /* - length of name */ char nc_name[0]; /* - segment name */
CVS commit: src/sys/sys
Module Name:src Committed By: ad Date: Sun Dec 1 13:45:42 UTC 2019 Modified Files: src/sys/sys: namei.src Log Message: Make nc_hittime volatile to defeat compiler cleverness. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/sys/namei.src Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/namei.src diff -u src/sys/sys/namei.src:1.44 src/sys/sys/namei.src:1.45 --- src/sys/sys/namei.src:1.44 Sun Dec 1 13:39:53 2019 +++ src/sys/sys/namei.src Sun Dec 1 13:45:42 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: namei.src,v 1.44 2019/12/01 13:39:53 ad Exp $ */ +/* $NetBSD: namei.src,v 1.45 2019/12/01 13:45:42 ad Exp $ */ /* * Copyright (c) 1985, 1989, 1991, 1993 @@ -219,7 +219,7 @@ struct namecache { struct vnode *nc_dvp; /* N vnode of parent of name */ struct vnode *nc_vp; /* N vnode the name refers to */ kmutex_t *nc_lock; /* - lock on this entry */ - int nc_hittime; /* N last time scored a hit */ + volatile int nc_hittime; /* N last time scored a hit */ int nc_flags; /* - copy of componentname ISWHITEOUT */ u_short nc_nlen; /* - length of name */ char nc_name[0]; /* - segment name */
CVS commit: src/sys
Module Name:src Committed By: ad Date: Sun Dec 1 13:39:53 UTC 2019 Modified Files: src/sys/kern: vfs_cache.c src/sys/rump/include/rump: rump_namei.h src/sys/sys: namei.h namei.src Log Message: namecache changes: - Delete the per-entry lock, and borrow the associated vnode's v_interlock instead. We need to acquire it during lookup anyway. We can revisit this in the future but for now it's a stepping stone, and works within the quite limited context of what we have (BSD namecache/lookup design). - Implement an idea that Mateusz Guzik (m...@freebsd.org) gave me. In cache_reclaim(), we don't need to lock out all of the CPUs to garbage collect entries. All we need to do is observe their locks unheld at least once: then we know they are not in the critical section, and no longer have visibility of the entries about to be garbage collected. - The above makes it safe for sysctl to take only namecache_lock to get stats, and we can remove all the crap dealing with per-CPU locks. - For lockstat, make namecache_lock a static now we have __cacheline_aligned. - Avoid false sharing - don't write back to nc_hittime unless it has changed. Put a a comment in place explaining this. Pretty sure this was there in 2008/2009 but someone removed it (understandably, the code looks weird). - Use a mutex to protect the garbage collection queue instead of atomics, and adjust the low water mark up so that cache_reclaim() isn't doing so much work at once. To generate a diff of this commit: cvs rdiff -u -r1.123 -r1.124 src/sys/kern/vfs_cache.c cvs rdiff -u -r1.33 -r1.34 src/sys/rump/include/rump/rump_namei.h cvs rdiff -u -r1.99 -r1.100 src/sys/sys/namei.h cvs rdiff -u -r1.43 -r1.44 src/sys/sys/namei.src 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_cache.c diff -u src/sys/kern/vfs_cache.c:1.123 src/sys/kern/vfs_cache.c:1.124 --- src/sys/kern/vfs_cache.c:1.123 Sun Sep 15 17:37:25 2019 +++ src/sys/kern/vfs_cache.c Sun Dec 1 13:39:53 2019 @@ -1,7 +1,7 @@ -/* $NetBSD: vfs_cache.c,v 1.123 2019/09/15 17:37:25 maya Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.124 2019/12/01 13:39:53 ad Exp $ */ /*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. + * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.123 2019/09/15 17:37:25 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.124 2019/12/01 13:39:53 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -130,7 +130,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c, * - Invalidate: active--->queued * * Done by cache_invalidate. If not already invalidated, nullify - * ncp->nc_dvp and ncp->nc_vp, and add to cache_gcqueue. Called, + * ncp->nc_dvp and ncp->nc_vp, and add to namecache_gc_queue. Called, * among various other places, in cache_lookup(dvp, name, namelen, * nameiop, cnflags, , ) when MAKEENTRY is missing from * cnflags. @@ -145,16 +145,17 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c, * Locking. * * L namecache_lock Global lock for namecache table and queues. + * G namecache_gc_lock Global lock for garbage collection. * C struct nchcpu::cpu_lock Per-CPU lock to reduce read contention. - * N struct namecache::nc_lock Per-entry lock. - * V struct vnode::v_interlock Vnode interlock. + * N struct namecache::nc_lock Per-entry lock, matching nc_vp->v_interlock. + *If nc_vp==NULL, lock is private / not shared. * - * Lock order: L -> C -> N -> V + * Lock order: L -> C -> N * * Examples: * . L->C: cache_reclaim - * . C->N->V: cache_lookup - * . L->N->V: cache_purge1, cache_revlookup + * . C->N: cache_lookup + * . L->N: cache_purge1, cache_revlookup * * All use serialized by namecache_lock: * @@ -167,8 +168,9 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c, * - Insertion serialized by namecache_lock, * - read protected by per-CPU lock, * - insert/read ordering guaranteed by memory barriers, and - * - deletion allowed only under namecache_lock and *all* per-CPU locks - * in CPU_INFO_FOREACH order: + * - deletion allowed only under namecache_lock, with namecache_gc_lock + * taken to chop out the garbage collection list, and *all* per-CPU locks + * observed as "unowned" at least once: * * nchashtbl / struct namecache::nc_hash * @@ -180,11 +182,13 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c, * * struct namecache::nc_dvp * struct namecache::nc_vp - * struct namecache::nc_gcqueue (*) - * struct namecache::nc_hittime (**) + * struct namecache::nc_hittime (*) * - * (*) Once on the queue, only cache_thread uses this nc_gcqueue, unlocked. - * (**) cache_prune reads nc_hittime unlocked, since approximate is OK. + * All use serialized by struct namecache_gc_lock:
CVS commit: src/sys/kern
Module Name:src Committed By: ad Date: Sun Dec 1 13:20:42 UTC 2019 Modified Files: src/sys/kern: kern_runq.c sched_4bsd.c sched_m2.c Log Message: PR port-sparc/54718 (sparc install hangs since recent scheduler changes) - sched_tick: cpu_need_resched is no longer the correct thing to do here. All we need to do is OR the request into the local ci_want_resched. - sched_resched_cpu: we need to set RESCHED_UPREEMPT even on softint LWPs, especially in the !__HAVE_FAST_SOFTINTS case, because the LWP with the LP_INTR flag could be running via softint_overlay() - i.e. it has been temporarily borrowed from a user process, and it needs to notice the resched after it has stopped running softints. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/kern/kern_runq.c cvs rdiff -u -r1.38 -r1.39 src/sys/kern/sched_4bsd.c cvs rdiff -u -r1.34 -r1.35 src/sys/kern/sched_m2.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_runq.c diff -u src/sys/kern/kern_runq.c:1.50 src/sys/kern/kern_runq.c:1.51 --- src/sys/kern/kern_runq.c:1.50 Wed Nov 27 20:31:13 2019 +++ src/sys/kern/kern_runq.c Sun Dec 1 13:20:42 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_runq.c,v 1.50 2019/11/27 20:31:13 ad Exp $ */ +/* $NetBSD: kern_runq.c,v 1.51 2019/12/01 13:20:42 ad Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -56,7 +56,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_runq.c,v 1.50 2019/11/27 20:31:13 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_runq.c,v 1.51 2019/12/01 13:20:42 ad Exp $"); #include "opt_dtrace.h" @@ -381,13 +381,8 @@ sched_resched_cpu(struct cpu_info *ci, p l = ci->ci_data.cpu_onproc; if ((l->l_flag & LW_IDLE) != 0) { f = RESCHED_IDLE | RESCHED_UPREEMPT; - } else if ((l->l_pflag & LP_INTR) != 0) { - /* We can't currently preempt interrupt LWPs - should do. */ - if (__predict_true(unlock)) { - spc_unlock(ci); - } - return; - } else if (pri >= sched_kpreempt_pri) { + } else if (pri >= sched_kpreempt_pri && (l->l_pflag & LP_INTR) == 0) { + /* We can't currently preempt softints - should be able to. */ #ifdef __HAVE_PREEMPTION f = RESCHED_KPREEMPT; #else Index: src/sys/kern/sched_4bsd.c diff -u src/sys/kern/sched_4bsd.c:1.38 src/sys/kern/sched_4bsd.c:1.39 --- src/sys/kern/sched_4bsd.c:1.38 Fri Nov 29 18:29:45 2019 +++ src/sys/kern/sched_4bsd.c Sun Dec 1 13:20:42 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sched_4bsd.c,v 1.38 2019/11/29 18:29:45 ad Exp $ */ +/* $NetBSD: sched_4bsd.c,v 1.39 2019/12/01 13:20:42 ad Exp $ */ /* * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2019 @@ -69,7 +69,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sched_4bsd.c,v 1.38 2019/11/29 18:29:45 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sched_4bsd.c,v 1.39 2019/12/01 13:20:42 ad Exp $"); #include "opt_ddb.h" #include "opt_lockdebug.h" @@ -130,9 +130,9 @@ sched_tick(struct cpu_info *ci) /* Force it into mi_switch() to look for other jobs to run. */ #ifdef __HAVE_PREEMPTION atomic_or_uint(>l_dopreempt, DOPREEMPT_ACTIVE); - cpu_need_resched(ci, l, RESCHED_KPREEMPT); + atomic_or_uint(>ci_want_resched, RESCHED_KPREEMPT); #else - cpu_need_resched(ci, l, RESCHED_UPREEMPT); + atomic_or_uint(>ci_want_resched, RESCHED_UPREEMPT); #endif break; default: @@ -144,9 +144,9 @@ sched_tick(struct cpu_info *ci) */ #ifdef __HAVE_PREEMPTION atomic_or_uint(>l_dopreempt, DOPREEMPT_ACTIVE); - cpu_need_resched(ci, l, RESCHED_KPREEMPT); + atomic_or_uint(>ci_want_resched, RESCHED_KPREEMPT); #else - cpu_need_resched(ci, l, RESCHED_UPREEMPT); + atomic_or_uint(>ci_want_resched, RESCHED_UPREEMPT); #endif } else if (spc->spc_flags & SPCF_SEENRR) { /* @@ -155,7 +155,7 @@ sched_tick(struct cpu_info *ci) * Indicate that the process should yield. */ spc->spc_flags |= SPCF_SHOULDYIELD; - cpu_need_resched(ci, l, RESCHED_UPREEMPT); + atomic_or_uint(>ci_want_resched, RESCHED_UPREEMPT); } else { spc->spc_flags |= SPCF_SEENRR; } Index: src/sys/kern/sched_m2.c diff -u src/sys/kern/sched_m2.c:1.34 src/sys/kern/sched_m2.c:1.35 --- src/sys/kern/sched_m2.c:1.34 Fri Nov 22 20:07:53 2019 +++ src/sys/kern/sched_m2.c Sun Dec 1 13:20:42 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sched_m2.c,v 1.34 2019/11/22 20:07:53 ad Exp $ */ +/* $NetBSD: sched_m2.c,v 1.35 2019/12/01 13:20:42 ad Exp $ */ /* * Copyright (c) 2007, 2008 Mindaugas Rasiukevicius @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sched_m2.c,v 1.34 2019/11/22 20:07:53 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sched_m2.c,v 1.35 2019/12/01 13:20:42 ad Exp $"); #include @@ -330,7 +330,7 @@ sched_tick(struct cpu_info *ci) */ if (lwp_eprio(l) <= spc->spc_maxpriority || l->l_target_cpu) { spc->spc_flags |= SPCF_SHOULDYIELD; - cpu_need_resched(ci, l, RESCHED_UPREEMPT); + atomic_or_uint(>ci_want_resched, RESCHED_UPREEMPT); } else
CVS commit: src/sys/dev
Module Name:src Committed By: maxv Date: Sun Dec 1 12:47:10 UTC 2019 Modified Files: src/sys/dev/pci: if_msk.c src/sys/dev/usb: if_atu.c uhid.c ustir.c Log Message: minor adjustments, to avoid warnings on debug builds To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/dev/pci/if_msk.c cvs rdiff -u -r1.66 -r1.67 src/sys/dev/usb/if_atu.c cvs rdiff -u -r1.109 -r1.110 src/sys/dev/usb/uhid.c cvs rdiff -u -r1.43 -r1.44 src/sys/dev/usb/ustir.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_msk.c diff -u src/sys/dev/pci/if_msk.c:1.95 src/sys/dev/pci/if_msk.c:1.96 --- src/sys/dev/pci/if_msk.c:1.95 Thu Nov 28 17:09:10 2019 +++ src/sys/dev/pci/if_msk.c Sun Dec 1 12:47:10 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_msk.c,v 1.95 2019/11/28 17:09:10 maxv Exp $ */ +/* $NetBSD: if_msk.c,v 1.96 2019/12/01 12:47:10 maxv Exp $ */ /* $OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $ */ /* @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.95 2019/11/28 17:09:10 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.96 2019/12/01 12:47:10 maxv Exp $"); #include #include @@ -139,9 +139,9 @@ static void msk_fill_rx_tick(void *); #define DPRINTFN(n, x) if (mskdebug >= (n)) printf x int mskdebug = MSK_DEBUG; -void msk_dump_txdesc(struct msk_tx_desc *, int); -void msk_dump_mbuf(struct mbuf *); -void msk_dump_bytes(const char *, int); +static void msk_dump_txdesc(struct msk_tx_desc *, int); +static void msk_dump_mbuf(struct mbuf *); +static void msk_dump_bytes(const char *, int); #else #define DPRINTF(x) #define DPRINTFN(n, x) Index: src/sys/dev/usb/if_atu.c diff -u src/sys/dev/usb/if_atu.c:1.66 src/sys/dev/usb/if_atu.c:1.67 --- src/sys/dev/usb/if_atu.c:1.66 Thu Nov 28 17:09:10 2019 +++ src/sys/dev/usb/if_atu.c Sun Dec 1 12:47:10 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_atu.c,v 1.66 2019/11/28 17:09:10 maxv Exp $ */ +/* $NetBSD: if_atu.c,v 1.67 2019/12/01 12:47:10 maxv Exp $ */ /* $OpenBSD: if_atu.c,v 1.48 2004/12/30 01:53:21 dlg Exp $ */ /* * Copyright (c) 2003, 2004 @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.66 2019/11/28 17:09:10 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.67 2019/12/01 12:47:10 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -267,10 +267,6 @@ static int atu_rx_list_init(struct atu_s static void atu_xfer_list_free(struct atu_softc *, struct atu_chain *, int); -#ifdef ATU_DEBUG -static void atu_debug_print(struct atu_softc *); -#endif - static void atu_task(void *); static int atu_newstate(struct ieee80211com *, enum ieee80211_state, int); static int atu_tx_start(struct atu_softc *, struct ieee80211_node *, @@ -2053,7 +2049,8 @@ atu_init(struct ifnet *ifp) return 0; } -#ifdef ATU_DEBUG +#if 0 && defined(ATU_DEBUG) /* XXX XXX XXX UNUSED */ +static void atu_debug_print(struct atu_softc *); static void atu_debug_print(struct atu_softc *sc) { Index: src/sys/dev/usb/uhid.c diff -u src/sys/dev/usb/uhid.c:1.109 src/sys/dev/usb/uhid.c:1.110 --- src/sys/dev/usb/uhid.c:1.109 Sun Dec 1 08:27:54 2019 +++ src/sys/dev/usb/uhid.c Sun Dec 1 12:47:10 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uhid.c,v 1.109 2019/12/01 08:27:54 maxv Exp $ */ +/* $NetBSD: uhid.c,v 1.110 2019/12/01 12:47:10 maxv Exp $ */ /* * Copyright (c) 1998, 2004, 2008, 2012 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.109 2019/12/01 08:27:54 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.110 2019/12/01 12:47:10 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -385,7 +385,7 @@ uhidclose(dev_t dev, int flag, int mode, return 0; } -int +Static int uhid_do_read(struct uhid_softc *sc, struct uio *uio, int flag) { int error = 0; @@ -467,7 +467,7 @@ uhidread(dev_t dev, struct uio *uio, int return error; } -static int +Static int uhid_do_write(struct uhid_softc *sc, struct uio *uio, int flag) { int error; Index: src/sys/dev/usb/ustir.c diff -u src/sys/dev/usb/ustir.c:1.43 src/sys/dev/usb/ustir.c:1.44 --- src/sys/dev/usb/ustir.c:1.43 Sun Dec 1 08:27:54 2019 +++ src/sys/dev/usb/ustir.c Sun Dec 1 12:47:10 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ustir.c,v 1.43 2019/12/01 08:27:54 maxv Exp $ */ +/* $NetBSD: ustir.c,v 1.44 2019/12/01 12:47:10 maxv Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ustir.c,v 1.43 2019/12/01 08:27:54 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ustir.c,v 1.44 2019/12/01 12:47:10 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -146,7 +146,6 @@ struct ustir_softc { #define USTIR_WR_TIMEOUT 200 -Static int ustir_activate(device_t, enum devact); Static int ustir_open(void *, int, int, struct lwp *); Static int ustir_close(void *, int, int, struct lwp *);
CVS commit: src/sys/arch/sh3
Module Name:src Committed By: ad Date: Sun Dec 1 12:19:28 UTC 2019 Modified Files: src/sys/arch/sh3/include: userret.h src/sys/arch/sh3/sh3: exception.c exception_vector.S Log Message: sh3: make ASTs work as expected, and fix a few things in the TLB refill path. With help from uwe@ and martin@. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sh3/include/userret.h cvs rdiff -u -r1.70 -r1.71 src/sys/arch/sh3/sh3/exception.c cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sh3/sh3/exception_vector.S 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/sh3/include/userret.h diff -u src/sys/arch/sh3/include/userret.h:1.16 src/sys/arch/sh3/include/userret.h:1.17 --- src/sys/arch/sh3/include/userret.h:1.16 Sat Nov 30 15:53:36 2019 +++ src/sys/arch/sh3/include/userret.h Sun Dec 1 12:19:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: userret.h,v 1.16 2019/11/30 15:53:36 ad Exp $ */ +/* $NetBSD: userret.h,v 1.17 2019/12/01 12:19:28 ad Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -51,6 +51,14 @@ static __inline void userret(struct lwp *l) { + /* This must come first... */ + l->l_md.md_astpending = 0; + + if (l->l_pflag & LP_OWEUPC) { + l->l_pflag &= ~LP_OWEUPC; + ADDUPROF(l); + } + /* Invoke MI userret code */ mi_userret(l); Index: src/sys/arch/sh3/sh3/exception.c diff -u src/sys/arch/sh3/sh3/exception.c:1.70 src/sys/arch/sh3/sh3/exception.c:1.71 --- src/sys/arch/sh3/sh3/exception.c:1.70 Sat Nov 30 15:53:36 2019 +++ src/sys/arch/sh3/sh3/exception.c Sun Dec 1 12:19:28 2019 @@ -1,7 +1,7 @@ -/* $NetBSD: exception.c,v 1.70 2019/11/30 15:53:36 ad Exp $ */ +/* $NetBSD: exception.c,v 1.71 2019/12/01 12:19:28 ad Exp $ */ /*- - * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. + * Copyright (c) 2002, 2019 The NetBSD Foundation, Inc. All rights reserved. * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.70 2019/11/30 15:53:36 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.71 2019/12/01 12:19:28 ad Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -89,6 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: exception.c, #include #include #include +#include #ifdef DDB #include @@ -295,12 +296,9 @@ tlb_exception(struct lwp *l, struct trap }\ } while(/*CONSTCOND*/0) - splx(tf->tf_ssr & PSL_IMASK); - usermode = !KERNELMODE(tf->tf_ssr); if (usermode) { KDASSERT(l->l_md.md_regs == tf); - LWP_CACHE_CREDS(l, l->l_proc); } else { #if 0 /* FIXME: probably wrong for yamt-idlelwp */ KDASSERT(l == NULL || /* idle */ @@ -330,6 +328,8 @@ tlb_exception(struct lwp *l, struct trap ksi.ksi_signo = SIGSEGV; ksi.ksi_code = SEGV_ACCERR; ksi.ksi_addr = (void *)va; + splx(tf->tf_ssr & PSL_IMASK); + LWP_CACHE_CREDS(l, l->l_proc); goto user_fault; } else { TLB_ASSERT(l && onfault != NULL, @@ -372,12 +372,12 @@ tlb_exception(struct lwp *l, struct trap /* Lookup page table. if entry found, load it. */ if (track && __pmap_pte_load(pmap, va, track)) { - if (usermode) - userret(l); return; } /* Page not found. call fault handler */ + splx(tf->tf_ssr & PSL_IMASK); + LWP_CACHE_CREDS(l, l->l_proc); pcb->pcb_onfault = NULL; err = uvm_fault(map, va, ftype); pcb->pcb_onfault = onfault; @@ -399,10 +399,21 @@ tlb_exception(struct lwp *l, struct trap /* Page in. load PTE to TLB. */ if (err == 0) { - bool loaded = __pmap_pte_load(pmap, va, track); + bool loaded; + userret(l); + loaded = __pmap_pte_load(pmap, va, track); +#if 0 + /* + * XXXAD I don't think you should do this - consider + * a multithreaded program where another thread got + * switched to during UVM fault and it unmapped the + * page. I think you should just let the fault happen + * again. + */ TLB_ASSERT(loaded, "page table entry not found"); - if (usermode) - userret(l); +#else + __USE(loaded); +#endif return; } @@ -441,7 +452,6 @@ tlb_exception(struct lwp *l, struct trap ksi.ksi_trap = tf->tf_expevt; trapsignal(l, ); userret(l); - ast(l, tf); return; tlb_panic: @@ -459,27 +469,29 @@ tlb_exception(struct lwp *l, struct trap * tf ... full user context. * This is called when exception return. if return from kernel to user, * handle asynchronous software traps and context switch if needed. + * Interrupts are blocked on entry. */ void ast(struct lwp *l, struct trapframe *tf) { + int s; - if (KERNELMODE(tf->tf_ssr)) { + if (__predict_true(l->l_md.md_astpending == 0)) { + return; + } + if (__predict_false(KERNELMODE(tf->tf_ssr))) { + /* should not occur but leave it here to be safe */ return; } KDASSERT(l != NULL); KDASSERT(l->l_md.md_regs == tf); - while (l->l_md.md_astpending) { - //curcpu()->ci_data.cpu_nast++; -
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Sun Dec 1 12:19:16 UTC 2019 Modified Files: src/doc [netbsd-9]: CHANGES-9.0 Log Message: Note added dedication To generate a diff of this commit: cvs rdiff -u -r1.1.2.126 -r1.1.2.127 src/doc/CHANGES-9.0 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-9.0 diff -u src/doc/CHANGES-9.0:1.1.2.126 src/doc/CHANGES-9.0:1.1.2.127 --- src/doc/CHANGES-9.0:1.1.2.126 Wed Nov 27 16:14:52 2019 +++ src/doc/CHANGES-9.0 Sun Dec 1 12:19:15 2019 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.0,v 1.1.2.126 2019/11/27 16:14:52 martin Exp $ +# $NetBSD: CHANGES-9.0,v 1.1.2.127 2019/12/01 12:19:15 martin Exp $ A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30 until the 9.0 release: @@ -6629,3 +6629,7 @@ distrib/notes/common/Makefile.inc 1.47 Fix generation of non-HTML ToC. (9.0_RC1 tag moved) +distrib/notes/common/main (edited manually) + + Add dedication to Matthias Drochner. +
CVS commit: [netbsd-9] src/distrib/notes/common
Module Name:src Committed By: martin Date: Sun Dec 1 12:17:16 UTC 2019 Modified Files: src/distrib/notes/common [netbsd-9]: main Log Message: Add dedication for Matthias Drochner. To generate a diff of this commit: cvs rdiff -u -r1.551.2.4 -r1.551.2.5 src/distrib/notes/common/main Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/notes/common/main diff -u src/distrib/notes/common/main:1.551.2.4 src/distrib/notes/common/main:1.551.2.5 --- src/distrib/notes/common/main:1.551.2.4 Wed Nov 27 14:28:40 2019 +++ src/distrib/notes/common/main Sun Dec 1 12:17:16 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: main,v 1.551.2.4 2019/11/27 14:28:40 martin Exp $ +.\" $NetBSD: main,v 1.551.2.5 2019/12/01 12:17:16 martin Exp $ .\" .\" Copyright (c) 1999-2012 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -512,6 +512,26 @@ possible, .Nx would not exist. . +.if \n[FOR_RELEASE] \{\ +.Ss "Dedication" +.Pp +. +.Nx +9.0 is dedicated to the memory of Matthias Drochner, who +passed away in August 2018. +.Pp +Matthias' technical contributions are too many to list here in full. +He was a long term contributor and commited more than 3000 changes all +over the +.Nx +source tree and lately was especially active in keeping some of our most weired +ancient VME architectures in shape. +.Pp +Beyond that he was always helpful and friendly. His +example encouraged users to contribute to the project and share their +work with the community. +.Pp +.\} \" \n[FOR_RELEASE] .ie \n[RELEASE_BRANCH] .Ss Changes Between The NetBSD \n[oldvers] \ and \n[major] Releases .el .Ss Changes Between The NetBSD \n[oldvers] and \
CVS commit: src/sys/uvm
Module Name:src Committed By: martin Date: Sun Dec 1 10:19:59 UTC 2019 Modified Files: src/sys/uvm: uvm_fault.c Log Message: Add missing include To generate a diff of this commit: cvs rdiff -u -r1.209 -r1.210 src/sys/uvm/uvm_fault.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/uvm/uvm_fault.c diff -u src/sys/uvm/uvm_fault.c:1.209 src/sys/uvm/uvm_fault.c:1.210 --- src/sys/uvm/uvm_fault.c:1.209 Sun Dec 1 08:19:09 2019 +++ src/sys/uvm/uvm_fault.c Sun Dec 1 10:19:59 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_fault.c,v 1.209 2019/12/01 08:19:09 maxv Exp $ */ +/* $NetBSD: uvm_fault.c,v 1.210 2019/12/01 10:19:59 martin Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,12 +32,13 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.209 2019/12/01 08:19:09 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.210 2019/12/01 10:19:59 martin Exp $"); #include "opt_uvmhist.h" #include #include +#include #include #include
CVS commit: src/sys/dev/usb
Module Name:src Committed By: maxv Date: Sun Dec 1 08:27:54 UTC 2019 Modified Files: src/sys/dev/usb: if_ural.c uaudio.c uberry.c ubt.c ucycom.c udsbr.c uep.c ugen.c uhid.c uhso.c ulpt.c umidi.c ums.c urio.c usscanner.c ustir.c uthum.c utoppy.c uvideo.c uvscom.c uyap.c Log Message: localify To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/dev/usb/if_ural.c cvs rdiff -u -r1.162 -r1.163 src/sys/dev/usb/uaudio.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/usb/uberry.c cvs rdiff -u -r1.63 -r1.64 src/sys/dev/usb/ubt.c cvs rdiff -u -r1.47 -r1.48 src/sys/dev/usb/ucycom.c cvs rdiff -u -r1.28 -r1.29 src/sys/dev/usb/udsbr.c cvs rdiff -u -r1.22 -r1.23 src/sys/dev/usb/uep.c cvs rdiff -u -r1.146 -r1.147 src/sys/dev/usb/ugen.c cvs rdiff -u -r1.108 -r1.109 src/sys/dev/usb/uhid.c cvs rdiff -u -r1.30 -r1.31 src/sys/dev/usb/uhso.c cvs rdiff -u -r1.103 -r1.104 src/sys/dev/usb/ulpt.c cvs rdiff -u -r1.80 -r1.81 src/sys/dev/usb/umidi.c cvs rdiff -u -r1.94 -r1.95 src/sys/dev/usb/ums.c cvs rdiff -u -r1.49 -r1.50 src/sys/dev/usb/urio.c cvs rdiff -u -r1.45 -r1.46 src/sys/dev/usb/usscanner.c cvs rdiff -u -r1.42 -r1.43 src/sys/dev/usb/ustir.c cvs rdiff -u -r1.16 -r1.17 src/sys/dev/usb/uthum.c cvs rdiff -u -r1.32 -r1.33 src/sys/dev/usb/utoppy.c cvs rdiff -u -r1.52 -r1.53 src/sys/dev/usb/uvideo.c cvs rdiff -u -r1.35 -r1.36 src/sys/dev/usb/uvscom.c cvs rdiff -u -r1.23 -r1.24 src/sys/dev/usb/uyap.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/usb/if_ural.c diff -u src/sys/dev/usb/if_ural.c:1.60 src/sys/dev/usb/if_ural.c:1.61 --- src/sys/dev/usb/if_ural.c:1.60 Sat Sep 14 12:42:36 2019 +++ src/sys/dev/usb/if_ural.c Sun Dec 1 08:27:54 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ural.c,v 1.60 2019/09/14 12:42:36 maxv Exp $ */ +/* $NetBSD: if_ural.c,v 1.61 2019/12/01 08:27:54 maxv Exp $ */ /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $ */ /*- @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.60 2019/09/14 12:42:36 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.61 2019/12/01 08:27:54 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -335,15 +335,15 @@ static const struct { { 161, 0x08808, 0x0242f, 0x00281 } }; -int ural_match(device_t, cfdata_t, void *); -void ural_attach(device_t, device_t, void *); -int ural_detach(device_t, int); -int ural_activate(device_t, enum devact); +static int ural_match(device_t, cfdata_t, void *); +static void ural_attach(device_t, device_t, void *); +static int ural_detach(device_t, int); +static int ural_activate(device_t, enum devact); CFATTACH_DECL_NEW(ural, sizeof(struct ural_softc), ural_match, ural_attach, ural_detach, ural_activate); -int +static int ural_match(device_t parent, cfdata_t match, void *aux) { struct usb_attach_arg *uaa = aux; @@ -352,7 +352,7 @@ ural_match(device_t parent, cfdata_t mat UMATCH_VENDOR_PRODUCT : UMATCH_NONE; } -void +static void ural_attach(device_t parent, device_t self, void *aux) { struct ural_softc *sc = device_private(self); @@ -524,7 +524,7 @@ ural_attach(device_t parent, device_t se return; } -int +static int ural_detach(device_t self, int flags) { struct ural_softc *sc = device_private(self); @@ -2267,7 +2267,7 @@ ural_stop(struct ifnet *ifp, int disable } } -int +static int ural_activate(device_t self, enum devact act) { struct ural_softc *sc = device_private(self); Index: src/sys/dev/usb/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.162 src/sys/dev/usb/uaudio.c:1.163 --- src/sys/dev/usb/uaudio.c:1.162 Mon Nov 4 05:46:39 2019 +++ src/sys/dev/usb/uaudio.c Sun Dec 1 08:27:54 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.162 2019/11/04 05:46:39 isaki Exp $ */ +/* $NetBSD: uaudio.c,v 1.163 2019/12/01 08:27:54 maxv Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.162 2019/11/04 05:46:39 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.163 2019/12/01 08:27:54 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -367,11 +367,11 @@ Static const struct audio_hw_if uaudio_h .get_locks = uaudio_get_locks, }; -int uaudio_match(device_t, cfdata_t, void *); -void uaudio_attach(device_t, device_t, void *); -int uaudio_detach(device_t, int); -void uaudio_childdet(device_t, device_t); -int uaudio_activate(device_t, enum devact); +static int uaudio_match(device_t, cfdata_t, void *); +static void uaudio_attach(device_t, device_t, void *); +static int uaudio_detach(device_t, int); +static void uaudio_childdet(device_t, device_t); +static int uaudio_activate(device_t, enum devact); @@ -379,7 +379,7 @@ CFATTACH_DECL2_NEW(uaudio, sizeof(struct uaudio_match, uaudio_attach, uaudio_detach, uaudio_activate, NULL, uaudio_childdet); -int +static
CVS commit: src/sys/arch/x86
Module Name:src Committed By: maxv Date: Sun Dec 1 08:23:09 UTC 2019 Modified Files: src/sys/arch/x86/include: i82489var.h src/sys/arch/x86/x86: lapic.c Log Message: localify To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x86/include/i82489var.h cvs rdiff -u -r1.75 -r1.76 src/sys/arch/x86/x86/lapic.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/arch/x86/include/i82489var.h diff -u src/sys/arch/x86/include/i82489var.h:1.19 src/sys/arch/x86/include/i82489var.h:1.20 --- src/sys/arch/x86/include/i82489var.h:1.19 Tue May 23 08:54:39 2017 +++ src/sys/arch/x86/include/i82489var.h Sun Dec 1 08:23:09 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: i82489var.h,v 1.19 2017/05/23 08:54:39 nonaka Exp $ */ +/* $NetBSD: i82489var.h,v 1.20 2019/12/01 08:23:09 maxv Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -94,7 +94,6 @@ extern void lapic_initclocks(void); extern uint32_t lapic_readreg(u_int); extern void lapic_writereg(u_int, uint32_t); extern void lapic_write_tpri(uint32_t); -extern void lapic_eoi(void); extern uint32_t lapic_cpu_number(void); extern bool lapic_is_x2apic(void); Index: src/sys/arch/x86/x86/lapic.c diff -u src/sys/arch/x86/x86/lapic.c:1.75 src/sys/arch/x86/x86/lapic.c:1.76 --- src/sys/arch/x86/x86/lapic.c:1.75 Fri Jun 14 09:23:42 2019 +++ src/sys/arch/x86/x86/lapic.c Sun Dec 1 08:23:09 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: lapic.c,v 1.75 2019/06/14 09:23:42 msaitoh Exp $ */ +/* $NetBSD: lapic.c,v 1.76 2019/12/01 08:23:09 maxv Exp $ */ /*- * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.75 2019/06/14 09:23:42 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.76 2019/12/01 08:23:09 maxv Exp $"); #include "acpica.h" #include "ioapic.h" @@ -206,12 +206,6 @@ lapic_write_tpri(uint32_t val) #endif } -void -lapic_eoi(void) -{ - lapic_writereg(LAPIC_EOI, 0); -} - uint32_t lapic_cpu_number(void) { @@ -594,7 +588,7 @@ lapic_initclocks(void) lapic_writereg(LAPIC_ICR_TIMER, lapic_tval); lapic_writereg(LAPIC_LVT_TIMER, LAPIC_LVT_TMM_PERIODIC | LAPIC_TIMER_VECTOR); - lapic_eoi(); + lapic_writereg(LAPIC_EOI, 0); } extern u_long rtclock_tval; /* XXX put in header file */
CVS commit: src/sys/uvm
Module Name:src Committed By: maxv Date: Sun Dec 1 08:19:09 UTC 2019 Modified Files: src/sys/uvm: uvm_fault.c Log Message: Use atomic_{load,store}_relaxed() on global counters. To generate a diff of this commit: cvs rdiff -u -r1.208 -r1.209 src/sys/uvm/uvm_fault.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/uvm/uvm_fault.c diff -u src/sys/uvm/uvm_fault.c:1.208 src/sys/uvm/uvm_fault.c:1.209 --- src/sys/uvm/uvm_fault.c:1.208 Sun Nov 10 20:38:33 2019 +++ src/sys/uvm/uvm_fault.c Sun Dec 1 08:19:09 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_fault.c,v 1.208 2019/11/10 20:38:33 chs Exp $ */ +/* $NetBSD: uvm_fault.c,v 1.209 2019/12/01 08:19:09 maxv Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.208 2019/11/10 20:38:33 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.209 2019/12/01 08:19:09 maxv Exp $"); #include "opt_uvmhist.h" @@ -284,7 +284,8 @@ uvmfault_anonget(struct uvm_faultinfo *u KASSERT(anon->an_lock == amap->am_lock); /* Increment the counters.*/ - uvmexp.fltanget++; + atomic_store_relaxed(, + atomic_load_relaxed() + 1); if (anon->an_page) { curlwp->l_ru.ru_minflt++; } else { @@ -331,7 +332,8 @@ uvmfault_anonget(struct uvm_faultinfo *u return 0; } pg->flags |= PG_WANTED; - uvmexp.fltpgwait++; + atomic_store_relaxed(, + atomic_load_relaxed() + 1); /* * The last unlock must be an atomic unlock and wait @@ -366,7 +368,8 @@ uvmfault_anonget(struct uvm_faultinfo *u if (pg == NULL) { /* Out of memory. Wait a little. */ uvmfault_unlockall(ufi, amap, NULL); -uvmexp.fltnoram++; +atomic_store_relaxed(, +atomic_load_relaxed() + 1); UVMHIST_LOG(maphist, " noram -- UVM_WAIT",0, 0,0,0); if (!uvm_reclaimable()) { @@ -385,7 +388,8 @@ uvmfault_anonget(struct uvm_faultinfo *u * to read an_swslot here, because we hold * PG_BUSY on the page. */ -uvmexp.pageins++; +atomic_store_relaxed(, +atomic_load_relaxed() + 1); error = uvm_swap_get(pg, anon->an_swslot, PGO_SYNCIO); @@ -526,7 +530,8 @@ released: * Retry.. */ - uvmexp.fltanretry++; + atomic_store_relaxed(, + atomic_load_relaxed() + 1); continue; } /*NOTREACHED*/ @@ -627,13 +632,15 @@ uvmfault_promote(struct uvm_faultinfo *u uvmfault_unlockall(ufi, amap, uobj); if (!uvm_reclaimable()) { UVMHIST_LOG(maphist, "out of VM", 0,0,0,0); - uvmexp.fltnoanon++; + atomic_store_relaxed(, + atomic_load_relaxed() + 1); error = ENOMEM; goto done; } UVMHIST_LOG(maphist, "out of RAM, waiting for more", 0,0,0,0); - uvmexp.fltnoram++; + atomic_store_relaxed(, + atomic_load_relaxed() + 1); uvm_wait("flt_noram5"); error = ERESTART; goto done; @@ -1026,7 +1033,8 @@ uvm_fault_check( " need to clear needs_copy and refault",0,0,0,0); uvmfault_unlockmaps(ufi, false); uvmfault_amapcopy(ufi); - uvmexp.fltamcopy++; + atomic_store_relaxed(, + atomic_load_relaxed() + 1); return ERESTART; } else { @@ -1269,7 +1277,8 @@ uvm_fault_upper_neighbor( UVMHIST_LOG(maphist, " MAPPING: n anon: pm=%#jx, va=%#jx, pg=%#jx", (uintptr_t)ufi->orig_map->pmap, currva, (uintptr_t)pg, 0); - uvmexp.fltnamap++; + atomic_store_relaxed(, + atomic_load_relaxed() + 1); /* * Since this page isn't the page that's actually faulting, @@ -1465,7 +1474,8 @@ uvm_fault_upper_promote( UVMHIST_FUNC("uvm_fault_upper_promote"); UVMHIST_CALLED(maphist); UVMHIST_LOG(maphist, " case 1B: COW fault",0,0,0,0); - uvmexp.flt_acow++; + atomic_store_relaxed(_acow, + atomic_load_relaxed(_acow) + 1); error = uvmfault_promote(ufi, oanon, PGO_DONTCARE, , >anon_spare); @@ -1513,7 +1523,8 @@ uvm_fault_upper_direct( struct vm_page *pg; UVMHIST_FUNC("uvm_fault_upper_direct"); UVMHIST_CALLED(maphist); - uvmexp.flt_anon++; + atomic_store_relaxed(_anon, + atomic_load_relaxed(_anon) + 1); pg = anon->an_page; if (anon->an_ref > 1) /* disallow writes to ref > 1 anons */ flt->enter_prot = flt->enter_prot & ~VM_PROT_WRITE; @@ -1782,7 +1793,8 @@ uvm_fault_lower_lookup( mutex_enter(uobj->vmobjlock); /* Locked: maps(read), amap(if there), uobj */ - uvmexp.fltlget++; + atomic_store_relaxed(, + atomic_load_relaxed() + 1); gotpages = flt->npages; (void) uobj->pgops->pgo_get(uobj, ufi->entry->offset + flt->startva - ufi->entry->start, @@ -1856,7 +1868,8 @@ uvm_fault_lower_neighbor( UVMHIST_LOG(maphist, " MAPPING: n obj: pm=%#jx, va=%#jx, pg=%#jx", (uintptr_t)ufi->orig_map->pmap, currva, (uintptr_t)pg, 0); - uvmexp.fltnomap++; + atomic_store_relaxed(, + atomic_load_relaxed() + 1); /* * Since this page isn't the page that's actually faulting, @@
CVS commit: src/sys
Module Name:src Committed By: maxv Date: Sun Dec 1 08:15:58 UTC 2019 Modified Files: src/sys/kern: subr_csan.c src/sys/sys: atomic.h Log Message: Add KCSAN instrumentation for atomic_{load,store}_*. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/kern/subr_csan.c cvs rdiff -u -r1.18 -r1.19 src/sys/sys/atomic.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/subr_csan.c diff -u src/sys/kern/subr_csan.c:1.5 src/sys/kern/subr_csan.c:1.6 --- src/sys/kern/subr_csan.c:1.5 Fri Nov 15 08:11:37 2019 +++ src/sys/kern/subr_csan.c Sun Dec 1 08:15:58 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_csan.c,v 1.5 2019/11/15 08:11:37 maxv Exp $ */ +/* $NetBSD: subr_csan.c,v 1.6 2019/12/01 08:15:58 maxv Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_csan.c,v 1.5 2019/11/15 08:11:37 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_csan.c,v 1.6 2019/12/01 08:15:58 maxv Exp $"); #include #include @@ -606,6 +606,28 @@ CSAN_ATOMIC_FUNC_INC(uint, unsigned int, CSAN_ATOMIC_FUNC_INC(ulong, unsigned long, unsigned long); CSAN_ATOMIC_FUNC_INC(ptr, void *, void); +void +kcsan_atomic_load(const volatile void *p, void *v, int size) +{ + switch (size) { + case 1: *(uint8_t *)v = *(const volatile uint8_t *)p; break; + case 2: *(uint16_t *)v = *(const volatile uint16_t *)p; break; + case 4: *(uint32_t *)v = *(const volatile uint32_t *)p; break; + case 8: *(uint64_t *)v = *(const volatile uint64_t *)p; break; + } +} + +void +kcsan_atomic_store(volatile void *p, const void *v, int size) +{ + switch (size) { + case 1: *(volatile uint8_t *)p = *(const uint8_t *)v; break; + case 2: *(volatile uint16_t *)p = *(const uint16_t *)v; break; + case 4: *(volatile uint32_t *)p = *(const uint32_t *)v; break; + case 8: *(volatile uint64_t *)p = *(const uint64_t *)v; break; + } +} + /* -- */ #include Index: src/sys/sys/atomic.h diff -u src/sys/sys/atomic.h:1.18 src/sys/sys/atomic.h:1.19 --- src/sys/sys/atomic.h:1.18 Fri Nov 29 22:17:23 2019 +++ src/sys/sys/atomic.h Sun Dec 1 08:15:58 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic.h,v 1.18 2019/11/29 22:17:23 riastradh Exp $ */ +/* $NetBSD: atomic.h,v 1.19 2019/12/01 08:15:58 maxv Exp $ */ /*- * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. @@ -411,18 +411,35 @@ __END_DECLS KASSERT(((uintptr_t)(p) & ilog2(sizeof(*(p == 0); \ } while (0) +#ifdef KCSAN +void kcsan_atomic_load(const volatile void *, void *, int); +void kcsan_atomic_store(volatile void *, const void *, int); +#define __DO_ATOMIC_LOAD(p, v) \ + kcsan_atomic_load(p, __UNVOLATILE(), sizeof(v)) +#define __DO_ATOMIC_STORE(p, v) \ + kcsan_atomic_store(p, __UNVOLATILE(), sizeof(v)) +#else +#define __DO_ATOMIC_LOAD(p, v) \ + v = *p +#define __DO_ATOMIC_STORE(p, v) \ + *p = v +#endif + #define atomic_load_relaxed(p) \ ({ \ const volatile __typeof__(*(p)) *__al_ptr = (p); \ + __typeof__(*(p)) __al_val; \ __ATOMIC_PTR_CHECK(__al_ptr); \ - *__al_ptr; \ + __DO_ATOMIC_LOAD(__al_ptr, __al_val); \ + __al_val; \ }) #define atomic_load_consume(p) \ ({ \ const volatile __typeof__(*(p)) *__al_ptr = (p); \ + __typeof__(*(p)) __al_val; \ __ATOMIC_PTR_CHECK(__al_ptr); \ - __typeof__(*(p)) __al_val = *__al_ptr; \ + __DO_ATOMIC_LOAD(__al_ptr, __al_val); \ membar_datadep_consumer(); \ __al_val; \ }) @@ -436,8 +453,9 @@ __END_DECLS #define atomic_load_acquire(p) \ ({ \ const volatile __typeof__(*(p)) *__al_ptr = (p); \ + __typeof__(*(p)) __al_val; \ __ATOMIC_PTR_CHECK(__al_ptr); \ - __typeof__(*(p)) __al_val = *__al_ptr; \ + __DO_ATOMIC_LOAD(__al_ptr, __al_val); \ membar_sync(); \ __al_val; \ }) @@ -445,8 +463,9 @@ __END_DECLS #define atomic_store_relaxed(p,v) \ ({ \ volatile __typeof__(*(p)) *__as_ptr = (p); \ + __typeof__(*(p)) __as_val = (v); \ __ATOMIC_PTR_CHECK(__as_ptr); \ - *__as_ptr = (v); \ + __DO_ATOMIC_STORE(__as_ptr, __as_val); \ }) #define atomic_store_release(p,v) \ @@ -455,7 +474,7 @@ __END_DECLS __typeof__(*(p)) __as_val = (v); \ __ATOMIC_PTR_CHECK(__as_ptr); \ membar_exit(); \ - *__as_ptr = __as_val; \ + __DO_ATOMIC_STORE(__as_ptr, __as_val); \ }) #else /* __STDC_VERSION__ >= 201112L */
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Sun Dec 1 08:16:49 UTC 2019 Modified Files: src/sys/dev/pci: if_age.c if_alc.c if_ale.c Log Message: Use unsigned to avoid undefined behavoir. Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/dev/pci/if_age.c cvs rdiff -u -r1.44 -r1.45 src/sys/dev/pci/if_alc.c cvs rdiff -u -r1.36 -r1.37 src/sys/dev/pci/if_ale.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_age.c diff -u src/sys/dev/pci/if_age.c:1.64 src/sys/dev/pci/if_age.c:1.65 --- src/sys/dev/pci/if_age.c:1.64 Thu Nov 21 09:12:30 2019 +++ src/sys/dev/pci/if_age.c Sun Dec 1 08:16:49 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_age.c,v 1.64 2019/11/21 09:12:30 msaitoh Exp $ */ +/* $NetBSD: if_age.c,v 1.65 2019/12/01 08:16:49 msaitoh Exp $ */ /* $OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $ */ /*- @@ -31,7 +31,7 @@ /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.64 2019/11/21 09:12:30 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.65 2019/12/01 08:16:49 msaitoh Exp $"); #include "vlan.h" @@ -2291,7 +2291,7 @@ age_rxfilter(struct age_softc *sc) goto update; } crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + mchash[crc >> 31] |= 1U << ((crc >> 26) & 0x1f); ETHER_NEXT_MULTI(step, enm); } ETHER_UNLOCK(ec); Index: src/sys/dev/pci/if_alc.c diff -u src/sys/dev/pci/if_alc.c:1.44 src/sys/dev/pci/if_alc.c:1.45 --- src/sys/dev/pci/if_alc.c:1.44 Thu Nov 21 09:12:30 2019 +++ src/sys/dev/pci/if_alc.c Sun Dec 1 08:16:49 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_alc.c,v 1.44 2019/11/21 09:12:30 msaitoh Exp $ */ +/* $NetBSD: if_alc.c,v 1.45 2019/12/01 08:16:49 msaitoh Exp $ */ /* $OpenBSD: if_alc.c,v 1.1 2009/08/08 09:31:13 kevlo Exp $ */ /*- * Copyright (c) 2009, Pyun YongHyeon @@ -3459,7 +3459,7 @@ alc_iff(struct alc_softc *sc) goto update; } crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + mchash[crc >> 31] |= 1U << ((crc >> 26) & 0x1f); ETHER_NEXT_MULTI(step, enm); } ETHER_UNLOCK(ec); Index: src/sys/dev/pci/if_ale.c diff -u src/sys/dev/pci/if_ale.c:1.36 src/sys/dev/pci/if_ale.c:1.37 --- src/sys/dev/pci/if_ale.c:1.36 Thu Nov 21 09:18:16 2019 +++ src/sys/dev/pci/if_ale.c Sun Dec 1 08:16:49 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ale.c,v 1.36 2019/11/21 09:18:16 msaitoh Exp $ */ +/* $NetBSD: if_ale.c,v 1.37 2019/12/01 08:16:49 msaitoh Exp $ */ /*- * Copyright (c) 2008, Pyun YongHyeon @@ -32,7 +32,7 @@ /* Driver for Atheros AR8121/AR8113/AR8114 PCIe Ethernet. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.36 2019/11/21 09:18:16 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.37 2019/12/01 08:16:49 msaitoh Exp $"); #include "vlan.h" @@ -2012,7 +2012,7 @@ ale_rxfilter(struct ale_softc *sc) goto update; } crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + mchash[crc >> 31] |= 1U << ((crc >> 26) & 0x1f); ETHER_NEXT_MULTI(step, enm); } ETHER_UNLOCK(ec);