CVS commit: src/external/gpl3/gcc/lib/libsupc++
Module Name:src Committed By: mrg Date: Tue Apr 21 05:23:42 UTC 2020 Modified Files: src/external/gpl3/gcc/lib/libsupc++: Makefile Log Message: pull in atomicity.h (atomicity.cc) on sparc. 3 of the objects use these interfaces and this avoids link errors fixes PR#54660. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/external/gpl3/gcc/lib/libsupc++/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/gcc/lib/libsupc++/Makefile diff -u src/external/gpl3/gcc/lib/libsupc++/Makefile:1.12 src/external/gpl3/gcc/lib/libsupc++/Makefile:1.13 --- src/external/gpl3/gcc/lib/libsupc++/Makefile:1.12 Sat Jan 19 17:11:02 2019 +++ src/external/gpl3/gcc/lib/libsupc++/Makefile Tue Apr 21 05:23:41 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.12 2019/01/19 17:11:02 mrg Exp $ +# $NetBSD: Makefile,v 1.13 2020/04/21 05:23:41 mrg Exp $ REQUIRETOOLS= yes NOLINT= # defined @@ -25,6 +25,15 @@ SHLIB_MINOR= 0 SRCS= ${LIBSUPCXXSRCS} xmalloc.c CXXFLAGS+= ${G_SECTION_FLAGS} +# XXX PR#54660 +.if ${MACHINE} == "sparc" +SRCS+= atomicity.cc +DIST= ${GCCDIST} +GLIBCXX_SRCDIR= ${DIST}/libstdc++-v3 +BUILDSYMLINKS+= \ + ${GLIBCXX_SRCDIR}/${G_ATOMICITY_SRCDIR}/atomicity.h atomicity.cc +.endif + COPTS.cp-demangle.c = -Wno-stack-protector -Wno-unused-function .include "../Makefile.gthr"
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: msaitoh Date: Tue Apr 21 05:18:14 UTC 2020 Modified Files: src/sys/arch/x86/x86: i8259.c Log Message: Whitespace fix. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/x86/x86/i8259.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/x86/i8259.c diff -u src/sys/arch/x86/x86/i8259.c:1.23 src/sys/arch/x86/x86/i8259.c:1.24 --- src/sys/arch/x86/x86/i8259.c:1.23 Mon Feb 11 14:59:33 2019 +++ src/sys/arch/x86/x86/i8259.c Tue Apr 21 05:18:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: i8259.c,v 1.23 2019/02/11 14:59:33 cherry Exp $ */ +/* $NetBSD: i8259.c,v 1.24 2020/04/21 05:18:14 msaitoh Exp $ */ /* * Copyright 2002 (c) Wasabi Systems, Inc. @@ -70,9 +70,9 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: i8259.c,v 1.23 2019/02/11 14:59:33 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i8259.c,v 1.24 2020/04/21 05:18:14 msaitoh Exp $"); -#include +#include #include #include #include @@ -83,7 +83,7 @@ __KERNEL_RCSID(0, "$NetBSD: i8259.c,v 1. #include #include -#include +#include #include #include #include @@ -163,7 +163,7 @@ i8259_default_setup(void) /* reset; program device, level-triggered, four bytes */ outb(IO_ICU2 + PIC_ICW1, ICW1_SELECT | ICW1_LTIM | ICW1_IC4); else -#endif +#endif /* reset; program device, four bytes */ outb(IO_ICU2 + PIC_ICW1, ICW1_SELECT | ICW1_IC4); @@ -243,7 +243,7 @@ i8259_reinit_irqs(void) irqs = 0; for (irq = 0; irq < array_len; irq++) -#if !defined(XENPV) +#if !defined(XENPV) if (ci->ci_isources[irq] != NULL) #else if (ci->ci_xsources[irq] != NULL)
CVS commit: src
Module Name:src Committed By: msaitoh Date: Tue Apr 21 02:56:37 UTC 2020 Modified Files: src/sys/arch/x86/conf: files.x86 src/sys/arch/x86/include: apicvar.h cpu.h src/sys/arch/x86/x86: cpu.c hyperv.c tsc.c src/sys/arch/xen/conf: files.xen src/usr.sbin/cpuctl: Makefile cpuctl.c cpuctl.h src/usr.sbin/cpuctl/arch: cpuctl_i386.h i386.c Added Files: src/sys/arch/x86/x86: identcpu_subr.c Log Message: Get TSC frequency from CPUID 0x15 and/or x16 for newer Intel processors. - If the max CPUID leaf is >= 0x15, take TSC value from CPUID. Some processors can take TSC/core crystal clock ratio but core crystal clock frequency can't be taken. Intel SDM give us the values for some processors. - It also required to change lapic_per_second to make LAPIC timer correctly. - Add new file x86/x86/identcpu_subr.c to share common subroutines between kernel and userland. Some code in x86/x86/identcpu.c and cpuctl/arch/i386.c will be moved to this file in future. - Add comment to clarify. To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/sys/arch/x86/conf/files.x86 cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/include/apicvar.h cvs rdiff -u -r1.120 -r1.121 src/sys/arch/x86/include/cpu.h cvs rdiff -u -r1.184 -r1.185 src/sys/arch/x86/x86/cpu.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/x86/hyperv.c cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/identcpu_subr.c cvs rdiff -u -r1.40 -r1.41 src/sys/arch/x86/x86/tsc.c cvs rdiff -u -r1.180 -r1.181 src/sys/arch/xen/conf/files.xen cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/cpuctl/Makefile cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/cpuctl/cpuctl.c cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/cpuctl/cpuctl.h cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/cpuctl/arch/cpuctl_i386.h cvs rdiff -u -r1.111 -r1.112 src/usr.sbin/cpuctl/arch/i386.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/conf/files.x86 diff -u src/sys/arch/x86/conf/files.x86:1.107 src/sys/arch/x86/conf/files.x86:1.108 --- src/sys/arch/x86/conf/files.x86:1.107 Fri Feb 15 08:54:01 2019 +++ src/sys/arch/x86/conf/files.x86 Tue Apr 21 02:56:36 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.x86,v 1.107 2019/02/15 08:54:01 nonaka Exp $ +# $NetBSD: files.x86,v 1.108 2020/04/21 02:56:36 msaitoh Exp $ # options for MP configuration through the MP spec defflag opt_mpbios.h MPBIOS MPDEBUG MPBIOS_SCANPCI @@ -91,6 +91,7 @@ file arch/x86/x86/efi.c machdep file arch/x86/x86/errata.c machdep file arch/x86/x86/genfb_machdep.c machdep file arch/x86/x86/identcpu.c machdep +file arch/x86/x86/identcpu_subr.c machdep file arch/x86/x86/i8259.c machdep file arch/x86/x86/intr.c machdep file arch/x86/x86/kgdb_machdep.c kgdb Index: src/sys/arch/x86/include/apicvar.h diff -u src/sys/arch/x86/include/apicvar.h:1.6 src/sys/arch/x86/include/apicvar.h:1.7 --- src/sys/arch/x86/include/apicvar.h:1.6 Fri Jun 14 09:23:42 2019 +++ src/sys/arch/x86/include/apicvar.h Tue Apr 21 02:56:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: apicvar.h,v 1.6 2019/06/14 09:23:42 msaitoh Exp $ */ +/* $NetBSD: apicvar.h,v 1.7 2020/04/21 02:56:37 msaitoh Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -54,4 +54,7 @@ struct apic_attach_args { void apic_format_redir(const char *, const char *, int, int, uint32_t, uint32_t); +/* For lapic.c */ +extern uint32_t lapic_per_second; + #endif /* !_X86_APICVAR_H_ */ Index: src/sys/arch/x86/include/cpu.h diff -u src/sys/arch/x86/include/cpu.h:1.120 src/sys/arch/x86/include/cpu.h:1.121 --- src/sys/arch/x86/include/cpu.h:1.120 Mon Apr 13 22:54:11 2020 +++ src/sys/arch/x86/include/cpu.h Tue Apr 21 02:56:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.120 2020/04/13 22:54:11 bouyer Exp $ */ +/* $NetBSD: cpu.h,v 1.121 2020/04/21 02:56:37 msaitoh Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -490,6 +490,9 @@ void cpu_probe(struct cpu_info *); void cpu_identify(struct cpu_info *); void identify_hypervisor(void); +/* identcpu_subr.c */ +uint64_t cpu_tsc_freq_cpuid(struct cpu_info *); + typedef enum vm_guest { VM_GUEST_NO = 0, VM_GUEST_VM, Index: src/sys/arch/x86/x86/cpu.c diff -u src/sys/arch/x86/x86/cpu.c:1.184 src/sys/arch/x86/x86/cpu.c:1.185 --- src/sys/arch/x86/x86/cpu.c:1.184 Mon Apr 20 04:23:23 2020 +++ src/sys/arch/x86/x86/cpu.c Tue Apr 21 02:56:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.184 2020/04/20 04:23:23 msaitoh Exp $ */ +/* $NetBSD: cpu.c,v 1.185 2020/04/21 02:56:37 msaitoh Exp $ */ /* * Copyright (c) 2000-2012 NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.184 2020/04/20 04:23:23 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.185 2020/04/21 02:56:37 msaitoh Exp $"); #include "opt_ddb.h" #include "opt_mpbios.h" /* for MPDEBUG */ @@ -1291,12 +1291,20 @@ cpu_shutdown(device_t dv, int how) return
CVS commit: src/external/gpl3/gcc/dist/gcc/common/config/aarch64
Module Name:src Committed By: mrg Date: Mon Apr 20 21:57:22 UTC 2020 Modified Files: src/external/gpl3/gcc/dist/gcc/common/config/aarch64: aarch64-common.c Log Message: when sorting all_extensions_by_on[] be sure to keep the NULL entry last. correct the sizeof() to use the right variable (they were the same size at least.) as-was, with the NULL entry first, all loops across this array were no-ops. this should fix PR#55158's arm64 side. To generate a diff of this commit: cvs rdiff -u -r1.1.1.6 -r1.2 \ src/external/gpl3/gcc/dist/gcc/common/config/aarch64/aarch64-common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/gcc/dist/gcc/common/config/aarch64/aarch64-common.c diff -u src/external/gpl3/gcc/dist/gcc/common/config/aarch64/aarch64-common.c:1.1.1.6 src/external/gpl3/gcc/dist/gcc/common/config/aarch64/aarch64-common.c:1.2 --- src/external/gpl3/gcc/dist/gcc/common/config/aarch64/aarch64-common.c:1.1.1.6 Wed Mar 11 08:16:31 2020 +++ src/external/gpl3/gcc/dist/gcc/common/config/aarch64/aarch64-common.c Mon Apr 20 21:57:22 2020 @@ -285,9 +285,9 @@ aarch64_option_init_struct (struct gcc_o to calculate the feature strings is called on every options push, pop and attribute change (arm_neon headers, lto etc all cause this to happen quite frequently). It is a trade-off between time and space and - so time won. */ + so time won. Keep NULL entry last. */ int n_extensions - = sizeof (all_extensions) / sizeof (struct aarch64_option_extension); + = sizeof (all_extensions_by_on) / sizeof (all_extensions_by_on[0]) - 1; qsort (_extensions_by_on, n_extensions, sizeof (struct aarch64_option_extension), opt_ext_cmp); }
CVS commit: src/sys
Module Name:src Committed By: ad Date: Mon Apr 20 21:39:05 UTC 2020 Modified Files: src/sys/kern: kern_pmf.c vfs_bio.c vfs_mount.c vfs_syscalls.c src/sys/rump/librump/rumpvfs: rump_vfs.c src/sys/sys: buf.h vfs_syscalls.h Log Message: Rename buf_syncwait() to vfs_syncwait(), and have it wait on v_numoutput rather than BC_BUSY. Removes the dependency on bufhash. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/kern/kern_pmf.c cvs rdiff -u -r1.293 -r1.294 src/sys/kern/vfs_bio.c cvs rdiff -u -r1.79 -r1.80 src/sys/kern/vfs_mount.c cvs rdiff -u -r1.545 -r1.546 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.91 -r1.92 src/sys/rump/librump/rumpvfs/rump_vfs.c cvs rdiff -u -r1.132 -r1.133 src/sys/sys/buf.h cvs rdiff -u -r1.27 -r1.28 src/sys/sys/vfs_syscalls.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/kern_pmf.c diff -u src/sys/kern/kern_pmf.c:1.41 src/sys/kern/kern_pmf.c:1.42 --- src/sys/kern/kern_pmf.c:1.41 Sun Feb 23 20:08:35 2020 +++ src/sys/kern/kern_pmf.c Mon Apr 20 21:39:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_pmf.c,v 1.41 2020/02/23 20:08:35 ad Exp $ */ +/* $NetBSD: kern_pmf.c,v 1.42 2020/04/20 21:39:05 ad Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_pmf.c,v 1.41 2020/02/23 20:08:35 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_pmf.c,v 1.42 2020/04/20 21:39:05 ad Exp $"); #include #include @@ -317,7 +317,7 @@ pmf_system_suspend(const pmf_qual_t *qua if (doing_shutdown == 0 && panicstr == NULL) { printf("Flushing disk caches: "); do_sys_sync(); - if (buf_syncwait() != 0) + if (vfs_syncwait() != 0) printf("giving up\n"); else printf("done\n"); Index: src/sys/kern/vfs_bio.c diff -u src/sys/kern/vfs_bio.c:1.293 src/sys/kern/vfs_bio.c:1.294 --- src/sys/kern/vfs_bio.c:1.293 Sat Apr 11 14:48:19 2020 +++ src/sys/kern/vfs_bio.c Mon Apr 20 21:39:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_bio.c,v 1.293 2020/04/11 14:48:19 jdolecek Exp $ */ +/* $NetBSD: vfs_bio.c,v 1.294 2020/04/20 21:39:05 ad Exp $ */ /*- * Copyright (c) 2007, 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc. @@ -123,7 +123,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.293 2020/04/11 14:48:19 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.294 2020/04/20 21:39:05 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_bufcache.h" @@ -1708,57 +1708,6 @@ biointr(void *cookie) splx(s); } -/* - * Wait for all buffers to complete I/O - * Return the number of "stuck" buffers. - */ -int -buf_syncwait(void) -{ - buf_t *bp; - int iter, nbusy, nbusy_prev = 0, ihash; - - BIOHIST_FUNC(__func__); BIOHIST_CALLED(biohist); - - for (iter = 0; iter < 20;) { - mutex_enter(_lock); - nbusy = 0; - for (ihash = 0; ihash < bufhash+1; ihash++) { - LIST_FOREACH(bp, [ihash], b_hash) { - if ((bp->b_cflags & (BC_BUSY|BC_INVAL)) == BC_BUSY) -nbusy += ((bp->b_flags & B_READ) == 0); - } - } - mutex_exit(_lock); - - if (nbusy == 0) - break; - if (nbusy_prev == 0) - nbusy_prev = nbusy; - printf("%d ", nbusy); - kpause("bflush", false, MAX(1, hz / 25 * iter), NULL); - if (nbusy >= nbusy_prev) /* we didn't flush anything */ - iter++; - else - nbusy_prev = nbusy; - } - - if (nbusy) { -#if defined(DEBUG) || defined(DEBUG_HALT_BUSY) - printf("giving up\nPrinting vnodes for busy buffers\n"); - for (ihash = 0; ihash < bufhash+1; ihash++) { - LIST_FOREACH(bp, [ihash], b_hash) { - if ((bp->b_cflags & (BC_BUSY|BC_INVAL)) == BC_BUSY && - (bp->b_flags & B_READ) == 0) -vprint(NULL, bp->b_vp); - } - } -#endif - } - - return nbusy; -} - static void sysctl_fillbuf(const buf_t *i, struct buf_sysctl *o) { Index: src/sys/kern/vfs_mount.c diff -u src/sys/kern/vfs_mount.c:1.79 src/sys/kern/vfs_mount.c:1.80 --- src/sys/kern/vfs_mount.c:1.79 Sun Apr 19 13:26:17 2020 +++ src/sys/kern/vfs_mount.c Mon Apr 20 21:39:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_mount.c,v 1.79 2020/04/19 13:26:17 hannken Exp $ */ +/* $NetBSD: vfs_mount.c,v 1.80 2020/04/20 21:39:05 ad Exp $ */ /*- * Copyright (c) 1997-2020 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.79 2020/04/19 13:26:17 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.80 2020/04/20 21:39:05 ad Exp $"); #include #include @@ -1093,7 +1093,7 @@ vfs_sync_all(struct lwp *l) do_sys_sync(l); /* Wait for sync to finish. */ - if (buf_syncwait() != 0) { + if (vfs_syncwait() != 0) { #if defined(DDB) && defined(DEBUG_HALT_BUSY) Debugger(); #endif Index: src/sys/kern/vfs_syscalls.c diff -u src/sys/kern/vfs_syscalls.c:1.545 src/sys/kern/vfs_syscalls.c:1.546 --- src/sys/kern/vfs_syscalls.c:1.545 Sat Apr 4 20:49:30 2020 +++ src/sys/kern/vfs_syscalls.c Mon Apr 20 21:39:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD:
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Mon Apr 20 20:19:07 UTC 2020 Modified Files: src/sys/arch/x86/x86 [bouyer-xenpvh]: intr.c src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_intr.c Log Message: channel %d -> chan %d, for the benefit of 'systat vm' To generate a diff of this commit: cvs rdiff -u -r1.150.6.5 -r1.150.6.6 src/sys/arch/x86/x86/intr.c cvs rdiff -u -r1.21.2.8 -r1.21.2.9 src/sys/arch/xen/x86/xen_intr.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/x86/intr.c diff -u src/sys/arch/x86/x86/intr.c:1.150.6.5 src/sys/arch/x86/x86/intr.c:1.150.6.6 --- src/sys/arch/x86/x86/intr.c:1.150.6.5 Sun Apr 19 19:39:10 2020 +++ src/sys/arch/x86/x86/intr.c Mon Apr 20 20:19:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.150.6.5 2020/04/19 19:39:10 bouyer Exp $ */ +/* $NetBSD: intr.c,v 1.150.6.6 2020/04/20 20:19:07 bouyer Exp $ */ /* * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc. @@ -133,7 +133,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.150.6.5 2020/04/19 19:39:10 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.150.6.6 2020/04/20 20:19:07 bouyer Exp $"); #include "opt_intrdebug.h" #include "opt_multiprocessor.h" @@ -1189,7 +1189,7 @@ xen_intr_string(int port, char *buf, siz KASSERT(port >= 0); - snprintf(buf, len, "%s channel %d", pic->pic_name, port); + snprintf(buf, len, "%s chan %d", pic->pic_name, port); return buf; } Index: src/sys/arch/xen/x86/xen_intr.c diff -u src/sys/arch/xen/x86/xen_intr.c:1.21.2.8 src/sys/arch/xen/x86/xen_intr.c:1.21.2.9 --- src/sys/arch/xen/x86/xen_intr.c:1.21.2.8 Mon Apr 20 11:29:01 2020 +++ src/sys/arch/xen/x86/xen_intr.c Mon Apr 20 20:19:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_intr.c,v 1.21.2.8 2020/04/20 11:29:01 bouyer Exp $ */ +/* $NetBSD: xen_intr.c,v 1.21.2.9 2020/04/20 20:19:07 bouyer Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.8 2020/04/20 11:29:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.9 2020/04/20 20:19:07 bouyer Exp $"); #include "opt_multiprocessor.h" @@ -357,7 +357,7 @@ xen_intr_string(int port, char *buf, siz KASSERT(port >= 0); KASSERT(port < NR_EVENT_CHANNELS); - snprintf(buf, len, "%s channel %d", pic->pic_name, port); + snprintf(buf, len, "%s chan %d", pic->pic_name, port); return buf; }
CVS commit: src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Mon Apr 20 20:03:21 UTC 2020 Modified Files: src/sys/arch/xen/xen: xengnt.c Log Message: Pull from bouyer-xenpvh: Bad news: * grant table v2 is not supported for HVM guests on 4.11 at last. * see xen/arch/x86/hvm/hypercall.c in Xen sources (missing * GNTTABOP_get_status_frames) So restore grant table v1 for !XENPV To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/xen/xen/xengnt.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/xen/xen/xengnt.c diff -u src/sys/arch/xen/xen/xengnt.c:1.35 src/sys/arch/xen/xen/xengnt.c:1.36 --- src/sys/arch/xen/xen/xengnt.c:1.35 Tue Apr 14 07:41:05 2020 +++ src/sys/arch/xen/xen/xengnt.c Mon Apr 20 20:03:21 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xengnt.c,v 1.35 2020/04/14 07:41:05 jdolecek Exp $ */ +/* $NetBSD: xengnt.c,v 1.36 2020/04/20 20:03:21 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.35 2020/04/14 07:41:05 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.36 2020/04/20 20:03:21 bouyer Exp $"); #include #include @@ -42,6 +42,18 @@ __KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1 #include #include +#include "opt_xen.h" + +/* + * grant table v2 is not supported for HVM guests on 4.11 at last. + * see xen/arch/x86/hvm/hypercall.c in Xen sources (missing + * GNTTABOP_get_status_frames) + */ + +#ifdef XENPV +#define USE_GRANT_V2 +#endif + /* #define XENDEBUG */ #ifdef XENDEBUG #define DPRINTF(x) printf x @@ -49,9 +61,6 @@ __KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1 #define DPRINTF(x) #endif -#define NR_GRANT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_v2_t)) -#define NR_GRANT_STATUS_PER_PAGE (PAGE_SIZE / sizeof(grant_status_t)) - /* External tools reserve first few grant table entries. */ #define NR_RESERVED_ENTRIES 8 @@ -59,8 +68,6 @@ __KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1 int gnt_nr_grant_frames; /* Maximum number of frames that can make up the grant table */ int gnt_max_grant_frames; -/* Number of grant status frames */ -int gnt_status_frames; /* table of free grant entries */ grant_ref_t *gnt_entries; @@ -70,8 +77,19 @@ int last_gnt_entry; #define XENGNT_NO_ENTRY 0x /* VM address of the grant table */ +#ifdef USE_GRANT_V2 +#define NR_GRANT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_v2_t)) +#define NR_GRANT_STATUS_PER_PAGE (PAGE_SIZE / sizeof(grant_status_t)) + grant_entry_v2_t *grant_table; +/* Number of grant status frames */ +int gnt_status_frames; + grant_status_t *grant_status; +#else /* USE_GRANT_V2 */ +#define NR_GRANT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_v1_t)) +grant_entry_v1_t *grant_table; +#endif /* USE_GRANT_V2 */ kmutex_t grant_lock; static grant_ref_t xengnt_get_entry(void); @@ -83,7 +101,6 @@ void xengnt_init(void) { struct gnttab_query_size query; - struct gnttab_set_version gntversion; int rc; int nr_grant_entries; int i; @@ -100,10 +117,14 @@ xengnt_init(void) */ gnt_nr_grant_frames = gnt_max_grant_frames; + +#ifdef USE_GRANT_V2 + struct gnttab_set_version gntversion; gntversion.version = 2; rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, , 1); if (rc < 0 || gntversion.version != 2) panic("GNTTABOP_set_version 2 failed %d", rc); +#endif /* USE_GRANT_V2 */ nr_grant_entries = gnt_max_grant_frames * NR_GRANT_ENTRIES_PER_PAGE; @@ -118,12 +139,14 @@ xengnt_init(void) for (i = 0; i <= nr_grant_entries; i++) gnt_entries[i] = XENGNT_NO_ENTRY; +#ifdef USE_GRANT_V2 gnt_status_frames = round_page(nr_grant_entries * sizeof(grant_status_t)) / PAGE_SIZE; grant_status = (void *)uvm_km_alloc(kernel_map, gnt_status_frames * PAGE_SIZE, 0, UVM_KMF_VAONLY); if (grant_status == NULL) panic("xengnt_init() status no VM space"); +#endif /* USE_GRANT_V2 */ mutex_init(_lock, MUTEX_DEFAULT, IPL_VM); @@ -171,8 +194,10 @@ xengnt_suspend(void) { /* Remove virtual => machine mapping for grant table */ pmap_kremove((vaddr_t)grant_table, gnt_nr_grant_frames * PAGE_SIZE); +#ifdef USE_GRANT_V2 /* Remove virtual => machine mapping for status table */ pmap_kremove((vaddr_t)grant_status, gnt_status_frames * PAGE_SIZE); +#endif pmap_update(pmap_kernel()); mutex_exit(_lock); @@ -185,9 +210,11 @@ xengnt_suspend(void) { static int xengnt_map_status(void) { +#ifdef USE_GRANT_V2 gnttab_get_status_frames_t getstatus; uint64_t *pages; size_t sz; + int err; KASSERT(mutex_owned(_lock)); @@ -204,9 +231,9 @@ xengnt_map_status(void) * get the status frames, and return the list of their virtual * addresses in 'pages' */ - if (HYPERVISOR_grant_table_op(GNTTABOP_get_status_frames, - , 1) != 0) - panic("%s: get_status_frames failed", __func__); + if ((err = HYPERVISOR_grant_table_op(GNTTABOP_get_status_frames, +
CVS commit: [bouyer-xenpvh] src/sys/arch/xen
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:46:44 UTC 2020 Modified Files: src/sys/arch/xen/include [bouyer-xenpvh]: evtchn.h src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_ipi.c src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c Log Message: Misc fixes after merge To generate a diff of this commit: cvs rdiff -u -r1.28.2.2 -r1.28.2.3 src/sys/arch/xen/include/evtchn.h cvs rdiff -u -r1.35.6.5 -r1.35.6.6 src/sys/arch/xen/x86/xen_ipi.c cvs rdiff -u -r1.88.2.10 -r1.88.2.11 src/sys/arch/xen/xen/evtchn.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/xen/include/evtchn.h diff -u src/sys/arch/xen/include/evtchn.h:1.28.2.2 src/sys/arch/xen/include/evtchn.h:1.28.2.3 --- src/sys/arch/xen/include/evtchn.h:1.28.2.2 Mon Apr 20 11:29:00 2020 +++ src/sys/arch/xen/include/evtchn.h Mon Apr 20 19:46:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: evtchn.h,v 1.28.2.2 2020/04/20 11:29:00 bouyer Exp $ */ +/* $NetBSD: evtchn.h,v 1.28.2.3 2020/04/20 19:46:44 bouyer Exp $ */ /* * @@ -41,8 +41,8 @@ bool events_resume(void); unsigned int evtchn_do_event(int, struct intrframe *); void call_evtchn_do_event(int, struct intrframe *); void call_xenevt_event(int); -int event_set_handler(int, int (*func)(void *), void *, int, const char *, -const char *, bool, bool); +struct intrhand *event_set_handler(int, int (*func)(void *), void *, +int, const char *, const char *, bool, bool); int event_remove_handler(int, int (*func)(void *), void *); struct cpu_info; Index: src/sys/arch/xen/x86/xen_ipi.c diff -u src/sys/arch/xen/x86/xen_ipi.c:1.35.6.5 src/sys/arch/xen/x86/xen_ipi.c:1.35.6.6 --- src/sys/arch/xen/x86/xen_ipi.c:1.35.6.5 Mon Apr 20 11:29:01 2020 +++ src/sys/arch/xen/x86/xen_ipi.c Mon Apr 20 19:46:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_ipi.c,v 1.35.6.5 2020/04/20 11:29:01 bouyer Exp $ */ +/* $NetBSD: xen_ipi.c,v 1.35.6.6 2020/04/20 19:46:44 bouyer Exp $ */ /*- * Copyright (c) 2011, 2019 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ * Based on: x86/ipi.c */ -__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.5 2020/04/20 11:29:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_ipi.c,v 1.35.6.6 2020/04/20 19:46:44 bouyer Exp $"); #include "opt_ddb.h" @@ -143,7 +143,7 @@ xen_ipi_init(void) device_xname(ci->ci_dev)); if (event_set_handler(evtchn, xen_ipi_handler, ci, IPL_HIGH, NULL, - intr_xname, true, false) != 0) { + intr_xname, true, false) == NULL) { panic("%s: unable to register ipi handler\n", __func__); /* NOTREACHED */ } Index: src/sys/arch/xen/xen/evtchn.c diff -u src/sys/arch/xen/xen/evtchn.c:1.88.2.10 src/sys/arch/xen/xen/evtchn.c:1.88.2.11 --- src/sys/arch/xen/xen/evtchn.c:1.88.2.10 Mon Apr 20 11:29:01 2020 +++ src/sys/arch/xen/xen/evtchn.c Mon Apr 20 19:46:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: evtchn.c,v 1.88.2.10 2020/04/20 11:29:01 bouyer Exp $ */ +/* $NetBSD: evtchn.c,v 1.88.2.11 2020/04/20 19:46:44 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -54,7 +54,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.10 2020/04/20 11:29:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.11 2020/04/20 19:46:44 bouyer Exp $"); #include "opt_xen.h" #include "isa.h" @@ -885,10 +885,11 @@ event_set_handler(int evtch, int (*func) if (bind) { op.cmd = EVTCHNOP_bind_vcpu; op.u.bind_vcpu.port = evtch; - op.u.bind_vcpu.vcpu = ci->ci_cpuid; + op.u.bind_vcpu.vcpu = ci->ci_vcpuid; if (HYPERVISOR_event_channel_op() != 0) { -panic("Failed to bind event %d to " -"VCPU %"PRIuCPUID, evtch, ci->ci_cpuid); +panic("Failed to bind event %d to VCPU %s %d", +evtch, device_xname(ci->ci_dev), +ci->ci_vcpuid); } } } else { @@ -955,15 +956,14 @@ event_set_iplhandler(struct cpu_info *ci ipls->is_recurse = xenev_stubs[level - IPL_VM].ist_recurse; ipls->is_resume = xenev_stubs[level - IPL_VM].ist_resume; ipls->is_handlers = ih; - ipls->is_maxlevel = level; ipls->is_pic = _pic; ci->ci_isources[sir] = ipls; - x86_intr_calculatemasks(ci); } else { ipls = ci->ci_isources[sir]; ih->ih_next = ipls->is_handlers; ipls->is_handlers = ih; } + x86_intr_calculatemasks(ci); } int
CVS commit: [bouyer-xenpvh] src/sys/arch
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:46:04 UTC 2020 Modified Files: src/sys/arch/amd64/conf [bouyer-xenpvh]: GENERIC_XENHVM src/sys/arch/i386/conf [bouyer-xenpvh]: GENERIC_XENHVM Log Message: Thanks do jdolecek@, MAXPHYS is not restricted to 32k now. Nothing prevents merging GENERIC_XENHVM in GENERIC now To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/amd64/conf/GENERIC_XENHVM cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/i386/conf/GENERIC_XENHVM 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/amd64/conf/GENERIC_XENHVM diff -u src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.4 src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.5 --- src/sys/arch/amd64/conf/GENERIC_XENHVM:1.1.2.4 Thu Apr 16 17:50:51 2020 +++ src/sys/arch/amd64/conf/GENERIC_XENHVM Mon Apr 20 19:46:03 2020 @@ -1,10 +1,9 @@ -# $NetBSD: GENERIC_XENHVM,v 1.1.2.4 2020/04/16 17:50:51 bouyer Exp $ +# $NetBSD: GENERIC_XENHVM,v 1.1.2.5 2020/04/20 19:46:03 bouyer Exp $ include "arch/amd64/conf/GENERIC" options XENPVHVM options XEN -options MAXPHYS=32768 #xbd doesn't handle 64k transfers hypervisor* at mainbus? # Xen hypervisor #vcpu* at hypervisor? # Xen virtual CPUs xenbus* at hypervisor? # Xen virtual bus Index: src/sys/arch/i386/conf/GENERIC_XENHVM diff -u src/sys/arch/i386/conf/GENERIC_XENHVM:1.1.2.1 src/sys/arch/i386/conf/GENERIC_XENHVM:1.1.2.2 --- src/sys/arch/i386/conf/GENERIC_XENHVM:1.1.2.1 Thu Apr 16 08:46:34 2020 +++ src/sys/arch/i386/conf/GENERIC_XENHVM Mon Apr 20 19:46:04 2020 @@ -1,11 +1,10 @@ -# $NetBSD: GENERIC_XENHVM,v 1.1.2.1 2020/04/16 08:46:34 bouyer Exp $ +# $NetBSD: GENERIC_XENHVM,v 1.1.2.2 2020/04/20 19:46:04 bouyer Exp $ include "arch/i386/conf/GENERIC" options XENPVHVM options XEN -options MAXPHYS=32768 #xbd doesn't handle 64k transfers hypervisor* at mainbus? # Xen hypervisor #vcpu* at hypervisor? # Xen virtual CPUs xenbus* at hypervisor? # Xen virtual bus
CVS commit: [bouyer-xenpvh] src/sys/arch/amd64/conf
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:43:33 UTC 2020 Modified Files: src/sys/arch/amd64/conf [bouyer-xenpvh]: std.amd64 Log Message: Use std.xenversion To generate a diff of this commit: cvs rdiff -u -r1.11.26.1 -r1.11.26.2 src/sys/arch/amd64/conf/std.amd64 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/amd64/conf/std.amd64 diff -u src/sys/arch/amd64/conf/std.amd64:1.11.26.1 src/sys/arch/amd64/conf/std.amd64:1.11.26.2 --- src/sys/arch/amd64/conf/std.amd64:1.11.26.1 Thu Apr 16 08:46:34 2020 +++ src/sys/arch/amd64/conf/std.amd64 Mon Apr 20 19:43:32 2020 @@ -1,9 +1,10 @@ -# $NetBSD: std.amd64,v 1.11.26.1 2020/04/16 08:46:34 bouyer Exp $ +# $NetBSD: std.amd64,v 1.11.26.2 2020/04/20 19:43:32 bouyer Exp $ # # standard, required NetBSD/amd64 'options' machine amd64 x86 xen include "conf/std" # MI standard options +include "arch/xen/conf/std.xenversion" options CPU_IN_CKSUM options EXEC_ELF64 # exec ELF binaries @@ -14,8 +15,6 @@ options MULTIPROCESSOR options CHILD_MAX=1024 # 160 is too few options OPEN_MAX=1024 # 128 is too few -options __XEN_INTERFACE_VERSION__=0x00030208 # Xen 3.1 interface - mainbus0 at root cpu* at mainbus? ioapic* at mainbus? apid ?
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:42:10 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: xengnt.c Log Message: Bad news: * grant table v2 is not supported for HVM guests on 4.11 at last. * see xen/arch/x86/hvm/hypercall.c in Xen sources (missing * GNTTABOP_get_status_frames) So restore grant table v1 for !XENPV To generate a diff of this commit: cvs rdiff -u -r1.29.2.1 -r1.29.2.2 src/sys/arch/xen/xen/xengnt.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/xen/xen/xengnt.c diff -u src/sys/arch/xen/xen/xengnt.c:1.29.2.1 src/sys/arch/xen/xen/xengnt.c:1.29.2.2 --- src/sys/arch/xen/xen/xengnt.c:1.29.2.1 Mon Apr 20 11:29:01 2020 +++ src/sys/arch/xen/xen/xengnt.c Mon Apr 20 19:42:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xengnt.c,v 1.29.2.1 2020/04/20 11:29:01 bouyer Exp $ */ +/* $NetBSD: xengnt.c,v 1.29.2.2 2020/04/20 19:42:10 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.29.2.1 2020/04/20 11:29:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.29.2.2 2020/04/20 19:42:10 bouyer Exp $"); #include #include @@ -42,6 +42,18 @@ __KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1 #include #include +#include "opt_xen.h" + +/* + * grant table v2 is not supported for HVM guests on 4.11 at last. + * see xen/arch/x86/hvm/hypercall.c in Xen sources (missing + * GNTTABOP_get_status_frames) + */ + +#ifdef XENPV +#define USE_GRANT_V2 +#endif + /* #define XENDEBUG */ #ifdef XENDEBUG #define DPRINTF(x) printf x @@ -49,9 +61,6 @@ __KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1 #define DPRINTF(x) #endif -#define NR_GRANT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_v2_t)) -#define NR_GRANT_STATUS_PER_PAGE (PAGE_SIZE / sizeof(grant_status_t)) - /* External tools reserve first few grant table entries. */ #define NR_RESERVED_ENTRIES 8 @@ -59,8 +68,6 @@ __KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1 int gnt_nr_grant_frames; /* Maximum number of frames that can make up the grant table */ int gnt_max_grant_frames; -/* Number of grant status frames */ -int gnt_status_frames; /* table of free grant entries */ grant_ref_t *gnt_entries; @@ -70,8 +77,19 @@ int last_gnt_entry; #define XENGNT_NO_ENTRY 0x /* VM address of the grant table */ +#ifdef USE_GRANT_V2 +#define NR_GRANT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_v2_t)) +#define NR_GRANT_STATUS_PER_PAGE (PAGE_SIZE / sizeof(grant_status_t)) + grant_entry_v2_t *grant_table; +/* Number of grant status frames */ +int gnt_status_frames; + grant_status_t *grant_status; +#else /* USE_GRANT_V2 */ +#define NR_GRANT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_v1_t)) +grant_entry_v1_t *grant_table; +#endif /* USE_GRANT_V2 */ kmutex_t grant_lock; static grant_ref_t xengnt_get_entry(void); @@ -83,7 +101,6 @@ void xengnt_init(void) { struct gnttab_query_size query; - struct gnttab_set_version gntversion; int rc; int nr_grant_entries; int i; @@ -100,10 +117,14 @@ xengnt_init(void) */ gnt_nr_grant_frames = gnt_max_grant_frames; + +#ifdef USE_GRANT_V2 + struct gnttab_set_version gntversion; gntversion.version = 2; rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, , 1); if (rc < 0 || gntversion.version != 2) panic("GNTTABOP_set_version 2 failed %d", rc); +#endif /* USE_GRANT_V2 */ nr_grant_entries = gnt_max_grant_frames * NR_GRANT_ENTRIES_PER_PAGE; @@ -118,12 +139,14 @@ xengnt_init(void) for (i = 0; i <= nr_grant_entries; i++) gnt_entries[i] = XENGNT_NO_ENTRY; +#ifdef USE_GRANT_V2 gnt_status_frames = round_page(nr_grant_entries * sizeof(grant_status_t)) / PAGE_SIZE; grant_status = (void *)uvm_km_alloc(kernel_map, gnt_status_frames * PAGE_SIZE, 0, UVM_KMF_VAONLY); if (grant_status == NULL) panic("xengnt_init() status no VM space"); +#endif /* USE_GRANT_V2 */ mutex_init(_lock, MUTEX_DEFAULT, IPL_VM); @@ -171,8 +194,10 @@ xengnt_suspend(void) { /* Remove virtual => machine mapping for grant table */ pmap_kremove((vaddr_t)grant_table, gnt_nr_grant_frames * PAGE_SIZE); +#ifdef USE_GRANT_V2 /* Remove virtual => machine mapping for status table */ pmap_kremove((vaddr_t)grant_status, gnt_status_frames * PAGE_SIZE); +#endif pmap_update(pmap_kernel()); mutex_exit(_lock); @@ -185,9 +210,11 @@ xengnt_suspend(void) { static int xengnt_map_status(void) { +#ifdef USE_GRANT_V2 gnttab_get_status_frames_t getstatus; uint64_t *pages; size_t sz; + int err; KASSERT(mutex_owned(_lock)); @@ -204,9 +231,9 @@ xengnt_map_status(void) * get the status frames, and return the list of their virtual * addresses in 'pages' */ - if (HYPERVISOR_grant_table_op(GNTTABOP_get_status_frames, - , 1) != 0) - panic("%s: get_status_frames failed", __func__); + if ((err =
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:40:51 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: xbdback_xenbus.c Log Message: Fix build with DIAGNOSTIC To generate a diff of this commit: cvs rdiff -u -r1.77.2.2 -r1.77.2.3 src/sys/arch/xen/xen/xbdback_xenbus.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/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.77.2.2 src/sys/arch/xen/xen/xbdback_xenbus.c:1.77.2.3 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.77.2.2 Mon Apr 20 18:50:46 2020 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Mon Apr 20 19:40:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.77.2.2 2020/04/20 18:50:46 bouyer Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.77.2.3 2020/04/20 19:40:51 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.77.2.2 2020/04/20 18:50:46 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.77.2.3 2020/04/20 19:40:51 bouyer Exp $"); #include #include @@ -1049,7 +1049,6 @@ xbdback_co_main_done2(struct xbdback_ins { int work_to_do; - KASSERT(xbdi->xbdio_io == NULL); RING_FINAL_CHECK_FOR_REQUESTS(>xbdi_ring.ring_n, work_to_do); if (work_to_do) xbdi->xbdi_cont = xbdback_co_main; @@ -1233,7 +1232,6 @@ static void * xbdback_co_do_io(struct xbdback_instance *xbdi, void *obj) { struct xbdback_io *xbd_io = xbdi->xbdi_io; - int nsegs __diagused; switch (xbd_io->xio_operation) { case BLKIF_OP_FLUSH_DISKCACHE:
CVS commit: [bouyer-xenpvh] src/sys/arch/xen
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:40:24 UTC 2020 Modified Files: src/sys/arch/xen/conf [bouyer-xenpvh]: files.xen files.xen.pv src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_bus_dma.c Log Message: We need xenbus_bus_dma_tag for PVHVM too, but without phys->machine translation To generate a diff of this commit: cvs rdiff -u -r1.180.2.5 -r1.180.2.6 src/sys/arch/xen/conf/files.xen cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/xen/conf/files.xen.pv cvs rdiff -u -r1.28.10.1 -r1.28.10.2 src/sys/arch/xen/x86/xen_bus_dma.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/xen/conf/files.xen diff -u src/sys/arch/xen/conf/files.xen:1.180.2.5 src/sys/arch/xen/conf/files.xen:1.180.2.6 --- src/sys/arch/xen/conf/files.xen:1.180.2.5 Sun Apr 19 20:29:30 2020 +++ src/sys/arch/xen/conf/files.xen Mon Apr 20 19:40:24 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.xen,v 1.180.2.5 2020/04/19 20:29:30 bouyer Exp $ +# $NetBSD: files.xen,v 1.180.2.6 2020/04/20 19:40:24 bouyer Exp $ defflag opt_xen.h XEN XENPVH XENPVHVM @@ -9,6 +9,7 @@ file arch/xen/xen/evtchn.c xen file arch/xen/xen/xengnt.c xen file arch/xen/x86/xen_mainbus.c xen file arch/xen/xen/xen_clock.c xen +file arch/xen/x86/xen_bus_dma.c xen define hypervisorbus {} define xendevbus {} Index: src/sys/arch/xen/conf/files.xen.pv diff -u src/sys/arch/xen/conf/files.xen.pv:1.1.2.3 src/sys/arch/xen/conf/files.xen.pv:1.1.2.4 --- src/sys/arch/xen/conf/files.xen.pv:1.1.2.3 Sun Apr 19 20:29:30 2020 +++ src/sys/arch/xen/conf/files.xen.pv Mon Apr 20 19:40:24 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.xen.pv,v 1.1.2.3 2020/04/19 20:29:30 bouyer Exp $ +# $NetBSD: files.xen.pv,v 1.1.2.4 2020/04/20 19:40:24 bouyer Exp $ file arch/xen/x86/autoconf.c xenpv file arch/xen/x86/x86_xpmap.c xenpv @@ -6,7 +6,6 @@ file arch/xen/x86/xen_pmap.c xenpv file arch/xen/x86/xenfunc.c xenpv file arch/xen/xen/xen_acpi_machdep.c acpi & xenpv -file arch/xen/x86/xen_bus_dma.c machdep & xenpv file arch/xen/x86/consinit.c machdep & xenpv file arch/xen/x86/pintr.c machdep & dom0ops & xenpv Index: src/sys/arch/xen/x86/xen_bus_dma.c diff -u src/sys/arch/xen/x86/xen_bus_dma.c:1.28.10.1 src/sys/arch/xen/x86/xen_bus_dma.c:1.28.10.2 --- src/sys/arch/xen/x86/xen_bus_dma.c:1.28.10.1 Mon Apr 20 11:29:01 2020 +++ src/sys/arch/xen/x86/xen_bus_dma.c Mon Apr 20 19:40:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xen_bus_dma.c,v 1.28.10.1 2020/04/20 11:29:01 bouyer Exp $ */ +/* $NetBSD: xen_bus_dma.c,v 1.28.10.2 2020/04/20 19:40:23 bouyer Exp $ */ /* NetBSD bus_dma.c,v 1.21 2005/04/16 07:53:35 yamt Exp */ /*- @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.28.10.1 2020/04/20 11:29:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.28.10.2 2020/04/20 19:40:23 bouyer Exp $"); #include #include @@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: xen_bus_dma. #include -extern paddr_t avail_end; +#include "opt_xen.h" /* No special needs */ struct x86_bus_dma_tag xenbus_bus_dma_tag = { @@ -56,6 +56,10 @@ struct x86_bus_dma_tag xenbus_bus_dma_ta ._may_bounce = NULL, }; +#ifdef XENPV + +extern paddr_t avail_end; + /* Pure 2^n version of get_order */ static inline int get_order(unsigned long size) { @@ -318,3 +322,4 @@ dorealloc: return error; goto again; } +#endif /* XENPV */
CVS commit: [bouyer-xenpvh] src/sys/arch/i386/conf
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:38:54 UTC 2020 Modified Files: src/sys/arch/i386/conf [bouyer-xenpvh]: std.i386 std.xen Log Message: Fix build after merge To generate a diff of this commit: cvs rdiff -u -r1.35.26.1 -r1.35.26.2 src/sys/arch/i386/conf/std.i386 cvs rdiff -u -r1.1.4.2 -r1.1.4.3 src/sys/arch/i386/conf/std.xen Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/conf/std.i386 diff -u src/sys/arch/i386/conf/std.i386:1.35.26.1 src/sys/arch/i386/conf/std.i386:1.35.26.2 --- src/sys/arch/i386/conf/std.i386:1.35.26.1 Thu Apr 16 08:46:34 2020 +++ src/sys/arch/i386/conf/std.i386 Mon Apr 20 19:38:54 2020 @@ -1,9 +1,10 @@ -# $NetBSD: std.i386,v 1.35.26.1 2020/04/16 08:46:34 bouyer Exp $ +# $NetBSD: std.i386,v 1.35.26.2 2020/04/20 19:38:54 bouyer Exp $ # # standard, required NetBSD/i386 'options' machine i386 x86 xen include "conf/std" # MI standard options +include "arch/xen/conf/std.xenversion" options CPU_IN_CKSUM options EXEC_AOUT # exec a.out binaries @@ -18,7 +19,6 @@ options MPBIOS # configure CPUs and A options CHILD_MAX=1024 # 160 is too few options OPEN_MAX=1024 # 128 is too few -options __XEN_INTERFACE_VERSION__=0x00030208 # Xen 3.1 interface mainbus0 at root cpu* at mainbus? Index: src/sys/arch/i386/conf/std.xen diff -u src/sys/arch/i386/conf/std.xen:1.1.4.2 src/sys/arch/i386/conf/std.xen:1.1.4.3 --- src/sys/arch/i386/conf/std.xen:1.1.4.2 Mon Apr 20 11:28:57 2020 +++ src/sys/arch/i386/conf/std.xen Mon Apr 20 19:38:54 2020 @@ -1,10 +1,13 @@ -# $NetBSD: std.xen,v 1.1.4.2 2020/04/20 11:28:57 bouyer Exp $ +# $NetBSD: std.xen,v 1.1.4.3 2020/04/20 19:38:54 bouyer Exp $ # NetBSD: std.i386,v 1.24 2003/02/26 21:33:36 fvdl Exp # # standard, required NetBSD/i386 'options' -machine xen i386 +machine xen i386 x86 include "conf/std" # MI standard options +include "arch/xen/conf/files.xen.pv" + +options XEN #Xen support include "arch/xen/conf/std.xenversion"
CVS commit: [bouyer-xenpvh] src/sys/arch/i386/conf
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:38:11 UTC 2020 Modified Files: src/sys/arch/i386/conf [bouyer-xenpvh]: GENERIC Log Message: build with -g on the branch To generate a diff of this commit: cvs rdiff -u -r1.1227 -r1.1227.2.1 src/sys/arch/i386/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/conf/GENERIC diff -u src/sys/arch/i386/conf/GENERIC:1.1227 src/sys/arch/i386/conf/GENERIC:1.1227.2.1 --- src/sys/arch/i386/conf/GENERIC:1.1227 Sat Mar 28 08:35:36 2020 +++ src/sys/arch/i386/conf/GENERIC Mon Apr 20 19:38:11 2020 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.1227 2020/03/28 08:35:36 isaki Exp $ +# $NetBSD: GENERIC,v 1.1227.2.1 2020/04/20 19:38:11 bouyer Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.1227 $" +#ident "GENERIC-$Revision: 1.1227.2.1 $" maxusers 64 # estimated number of users @@ -119,7 +119,7 @@ options DDB_HISTORY_SIZE=512 # enable h #options DDB_VERBOSE_HELP #options KGDB # remote debugger #options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600 -#makeoptions DEBUG="-g" # compile full symbol table +makeoptions DEBUG="-g" # compile full symbol table #options KUBSAN # Kernel Undefined Behavior Sanitizer (kUBSan) #options UBSAN_ALWAYS_FATAL # (optional) Panic on all kUBSan reports #options SYSCALL_STATS # per syscall counts
CVS commit: src/sys/arch/xen/xen
Module Name:src Committed By: jdolecek Date: Mon Apr 20 19:29:09 UTC 2020 Modified Files: src/sys/arch/xen/xen: xbdback_xenbus.c Log Message: xbdback_fragio_intvl is also no longer used To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/arch/xen/xen/xbdback_xenbus.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/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.84 src/sys/arch/xen/xen/xbdback_xenbus.c:1.85 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.84 Mon Apr 20 19:20:35 2020 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Mon Apr 20 19:29:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.84 2020/04/20 19:20:35 bouyer Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.85 2020/04/20 19:29:09 jdolecek Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.84 2020/04/20 19:20:35 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.85 2020/04/20 19:29:09 jdolecek Exp $"); #include #include @@ -245,9 +245,6 @@ static struct pool_cache xbdback_io_pool /* Interval between reports of I/O errors from frontend */ static const struct timeval xbdback_err_intvl = { 1, 0 }; -#ifdef DEBUG -static const struct timeval xbdback_fragio_intvl = { 60, 0 }; -#endif void xbdbackattach(int); static int xbdback_xenbus_create(struct xenbus_device *); static int xbdback_xenbus_destroy(void *);
CVS commit: src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Mon Apr 20 19:20:36 UTC 2020 Modified Files: src/sys/arch/xen/xen: xbdback_xenbus.c Log Message: Fix build with DIAGNOSTIC To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/sys/arch/xen/xen/xbdback_xenbus.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/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.83 src/sys/arch/xen/xen/xbdback_xenbus.c:1.84 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.83 Mon Apr 20 16:12:28 2020 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Mon Apr 20 19:20:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.83 2020/04/20 16:12:28 jdolecek Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.84 2020/04/20 19:20:35 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.83 2020/04/20 16:12:28 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.84 2020/04/20 19:20:35 bouyer Exp $"); #include #include @@ -1049,7 +1049,6 @@ xbdback_co_main_done2(struct xbdback_ins { int work_to_do; - KASSERT(xbdi->xbdio_io == NULL); RING_FINAL_CHECK_FOR_REQUESTS(>xbdi_ring.ring_n, work_to_do); if (work_to_do) xbdi->xbdi_cont = xbdback_co_main; @@ -1233,7 +1232,6 @@ static void * xbdback_co_do_io(struct xbdback_instance *xbdi, void *obj) { struct xbdback_io *xbd_io = xbdi->xbdi_io; - int nsegs __diagused; switch (xbd_io->xio_operation) { case BLKIF_OP_FLUSH_DISKCACHE:
CVS commit: [bouyer-xenpvh] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Mon Apr 20 18:50:46 UTC 2020 Modified Files: src/sys/arch/xen/xen [bouyer-xenpvh]: xbdback_xenbus.c Log Message: Bring in 1.82 and 1.83 from HEAD To generate a diff of this commit: cvs rdiff -u -r1.77.2.1 -r1.77.2.2 src/sys/arch/xen/xen/xbdback_xenbus.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/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.77.2.1 src/sys/arch/xen/xen/xbdback_xenbus.c:1.77.2.2 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.77.2.1 Mon Apr 20 11:29:01 2020 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Mon Apr 20 18:50:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.77.2.1 2020/04/20 11:29:01 bouyer Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.77.2.2 2020/04/20 18:50:46 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.77.2.1 2020/04/20 11:29:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.77.2.2 2020/04/20 18:50:46 bouyer Exp $"); #include #include @@ -74,9 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: xbdback_xenb /* Need to alloc one extra page to account for possible mapping offset */ #define VBD_VA_SIZE (MAXPHYS + PAGE_SIZE) -struct xbdback_request; struct xbdback_io; -struct xbdback_fragment; struct xbdback_instance; /* @@ -98,8 +96,8 @@ typedef enum {WAITING, RUN, DISCONNECTIN * callback), the return value of a continuation can be set to NULL. In that * case, the thread will go back to sleeping and wait for the proper * condition before it starts processing requests again from where it left. - * Continuation state is "stored" in the xbdback instance (xbdi_cont and - * xbdi_cont_aux), and should only be manipulated by the instance thread. + * Continuation state is "stored" in the xbdback instance (xbdi_cont), + * and should only be manipulated by the instance thread. * * As xbdback(4) has to handle different sort of asynchronous events (Xen * event channels, biointr() soft interrupts, xenbus commands), the xbdi_lock @@ -109,36 +107,23 @@ typedef enum {WAITING, RUN, DISCONNECTIN * Here's how the call graph is supposed to be for a single I/O: * * xbdback_co_main() - *| - *| --> xbdback_co_cache_doflush() or NULL - *| | - *| - xbdback_co_cache_flush2() <- xbdback_co_do_io() <- - *|| | - *| |-> xbdback_co_cache_flush() -> xbdback_co_map_io()- + *| --> xbdback_co_cache_flush() + *| || + *| |-> xbdback_co_cache_doflush() or NULL + *| || + *| |-> xbdback_co_do_io() * xbdback_co_main_loop()-| - *| |-> xbdback_co_main_done() ---> xbdback_co_map_io()- - *| | | - *| -- xbdback_co_main_done2() <-- xbdback_co_do_io() <- + *| |-> xbdback_co_main_done2() or NULL *| | - *| --> xbdback_co_main() or NULL + *| --> xbdback_co_main_incr() -> xbdback_co_main_loop() *| * xbdback_co_io() -> xbdback_co_main_incr() -> xbdback_co_main_loop() *| - * xbdback_co_io_gotreq()--+--> xbdback_co_map_io() --- - *|| | - * -> xbdback_co_io_loop()| <- xbdback_co_do_io() <-- - * | | | | - * | | | |--> xbdback_co_io_gotio() - * | | | | - * | | xbdback_co_main_incr() | - * | | | | - * | | xbdback_co_main_loop() | - * | | | - * | xbdback_co_io_gotio2() <---| - * | | | - * | | |--> xbdback_co_io_gotfrag() - * | | | - * -- xbdback_co_io_gotfrag2() <-| + * xbdback_co_io_gotio() -> xbdback_map_shm() + *| | + *| xbdback_co_main_incr() -> xbdback_co_main_loop() + *| + * xbdback_co_do_io() *| * xbdback_co_main_incr() -> xbdback_co_main_loop() */ @@ -192,17 +177,12 @@ struct xbdback_instance { * continuation-ness (see above). */ RING_IDX xbdi_req_prod; /* limit on request indices */ - xbdback_cont_t xbdi_cont, xbdi_cont_aux; + xbdback_cont_t xbdi_cont; /* _request state: track requests fetched from ring */ struct xbdback_request *xbdi_req; /* if NULL, ignore following */ blkif_request_t xbdi_xen_req; - int xbdi_segno; /* _io state: I/O
CVS commit: src/sys/ufs/ffs
Module Name:src Committed By: christos Date: Mon Apr 20 18:10:10 UTC 2020 Modified Files: src/sys/ufs/ffs: ffs_extattr.c Log Message: - Allow root to set system attributes, samba does this - Fix locking issue, perhaps we should use our own mutex; does not seem worth it for this simple case. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/ufs/ffs/ffs_extattr.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/ufs/ffs/ffs_extattr.c diff -u src/sys/ufs/ffs/ffs_extattr.c:1.2 src/sys/ufs/ffs/ffs_extattr.c:1.3 --- src/sys/ufs/ffs/ffs_extattr.c:1.2 Sun Apr 19 09:59:13 2020 +++ src/sys/ufs/ffs/ffs_extattr.c Mon Apr 20 14:10:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_extattr.c,v 1.2 2020/04/19 13:59:13 christos Exp $ */ +/* $NetBSD: ffs_extattr.c,v 1.3 2020/04/20 18:10:10 christos Exp $ */ /*- * SPDX-License-Identifier: (BSD-2-Clause-FreeBSD AND BSD-3-Clause) @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_extattr.c,v 1.2 2020/04/19 13:59:13 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_extattr.c,v 1.3 2020/04/20 18:10:10 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -153,8 +153,8 @@ ffs_extattr_check_cred(struct vnode *vp, */ switch (attrnamespace) { case EXTATTR_NAMESPACE_SYSTEM: - /* Potentially with privs */ - return EPERM; + return kauth_authorize_system(cred, KAUTH_SYSTEM_FS_EXTATTR, + 0, vp->v_mount, NULL, NULL); case EXTATTR_NAMESPACE_USER: return VOP_ACCESS(vp, accmode, cred); default: @@ -392,8 +392,10 @@ ffs_extwrite(struct vnode *vp, struct ui } if (error) { if (ioflag & IO_UNIT) { + genfs_node_unlock(vp); // XXX: need our own lock (void)ffs_truncate(vp, osize, IO_EXT | (ioflag_SYNC), ucred); + genfs_node_wrlock(vp); uio->uio_offset -= resid - uio->uio_resid; uio->uio_resid = resid; } @@ -559,7 +561,9 @@ ffs_close_ea(struct vnode *vp, int commi ffs_unlock_ea(vp); return error; } + genfs_node_unlock(vp); // XXX: need our own lock error = ffs_truncate(vp, 0, IO_EXT, cred); + genfs_node_wrlock(vp); UFS_WAPBL_END(vp->v_mount); } error = ffs_extwrite(vp, , IO_EXT | IO_SYNC, cred); @@ -935,7 +939,6 @@ ffs_deleteextattr(void *v) error = ffs_extattr_check_cred(ap->a_vp, ap->a_attrnamespace, ap->a_cred, VWRITE); if (error) { - /* * ffs_lock_ea is not needed there, because the vnode * must be exclusively locked.
CVS commit: src/sys/kern
Module Name:src Committed By: maxv Date: Mon Apr 20 16:32:03 UTC 2020 Modified Files: src/sys/kern: kern_proc.c Log Message: Add three KASSERTs, to detect refcount bugs. This narrows down an unknown bug in some place near, that has manifested itself in various forms (use-after-frees, uninit accesses, page faults, segmentation faults), all pointed out by syzbot. The first KASSERT in fixjobc() fires when the bug is encountered. To generate a diff of this commit: cvs rdiff -u -r1.244 -r1.245 src/sys/kern/kern_proc.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_proc.c diff -u src/sys/kern/kern_proc.c:1.244 src/sys/kern/kern_proc.c:1.245 --- src/sys/kern/kern_proc.c:1.244 Sun Apr 19 20:31:59 2020 +++ src/sys/kern/kern_proc.c Mon Apr 20 16:32:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_proc.c,v 1.244 2020/04/19 20:31:59 thorpej Exp $ */ +/* $NetBSD: kern_proc.c,v 1.245 2020/04/20 16:32:03 maxv Exp $ */ /*- * Copyright (c) 1999, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.244 2020/04/19 20:31:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.245 2020/04/20 16:32:03 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_kstack.h" @@ -554,6 +554,7 @@ proc_sessrele(struct session *ss) { KASSERT(mutex_owned(proc_lock)); + KASSERT(ss->s_count > 0); /* * We keep the pgrp with the same id as the session in order to * stop a process being given the same pid. Since the pgrp holds @@ -1181,8 +1182,11 @@ fixjobc(struct proc *p, struct pgrp *pgr if (entering) { pgrp->pg_jobc++; p->p_lflag &= ~PL_ORPHANPG; - } else if (--pgrp->pg_jobc == 0) - orphanpg(pgrp); + } else { + KASSERT(pgrp->pg_jobc > 0); + if (--pgrp->pg_jobc == 0) +orphanpg(pgrp); + } } /* @@ -1197,8 +1201,11 @@ fixjobc(struct proc *p, struct pgrp *pgr if (entering) { child->p_lflag &= ~PL_ORPHANPG; hispgrp->pg_jobc++; - } else if (--hispgrp->pg_jobc == 0) -orphanpg(hispgrp); + } else { +KASSERT(hispgrp->pg_jobc > 0); +if (--hispgrp->pg_jobc == 0) + orphanpg(hispgrp); + } } } }
CVS commit: src/sys/arch/xen/xen
Module Name:src Committed By: jdolecek Date: Mon Apr 20 16:12:28 UTC 2020 Modified Files: src/sys/arch/xen/xen: xbdback_xenbus.c Log Message: remove I/O defragmentation logic, pass requests straight to the underlying block device without trying to coalesce them it seems rarely useful, and it makes the handling logic unnecessarily complex - ultimately it's the DomU operating system responsibility to issue optimal I/O might also help with the ZFS problem reported on port-xen, and will surely simplify eventual indirect segment support To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/arch/xen/xen/xbdback_xenbus.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/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.82 src/sys/arch/xen/xen/xbdback_xenbus.c:1.83 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.82 Mon Apr 20 14:11:04 2020 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Mon Apr 20 16:12:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.82 2020/04/20 14:11:04 jdolecek Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.83 2020/04/20 16:12:28 jdolecek Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.82 2020/04/20 14:11:04 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.83 2020/04/20 16:12:28 jdolecek Exp $"); #include #include @@ -74,9 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: xbdback_xenb /* Need to alloc one extra page to account for possible mapping offset */ #define VBD_VA_SIZE (MAXPHYS + PAGE_SIZE) -struct xbdback_request; struct xbdback_io; -struct xbdback_fragment; struct xbdback_instance; /* @@ -98,8 +96,8 @@ typedef enum {WAITING, RUN, DISCONNECTIN * callback), the return value of a continuation can be set to NULL. In that * case, the thread will go back to sleeping and wait for the proper * condition before it starts processing requests again from where it left. - * Continuation state is "stored" in the xbdback instance (xbdi_cont and - * xbdi_cont_aux), and should only be manipulated by the instance thread. + * Continuation state is "stored" in the xbdback instance (xbdi_cont), + * and should only be manipulated by the instance thread. * * As xbdback(4) has to handle different sort of asynchronous events (Xen * event channels, biointr() soft interrupts, xenbus commands), the xbdi_lock @@ -109,36 +107,23 @@ typedef enum {WAITING, RUN, DISCONNECTIN * Here's how the call graph is supposed to be for a single I/O: * * xbdback_co_main() - *| - *| --> xbdback_co_cache_doflush() or NULL - *| | - *| - xbdback_co_cache_flush2() <- xbdback_co_do_io() <- - *|| | - *| |-> xbdback_co_cache_flush() -> xbdback_co_map_io()- + *| --> xbdback_co_cache_flush() + *| || + *| |-> xbdback_co_cache_doflush() or NULL + *| || + *| |-> xbdback_co_do_io() * xbdback_co_main_loop()-| - *| |-> xbdback_co_main_done() ---> xbdback_co_map_io()- - *| | | - *| -- xbdback_co_main_done2() <-- xbdback_co_do_io() <- + *| |-> xbdback_co_main_done2() or NULL *| | - *| --> xbdback_co_main() or NULL + *| --> xbdback_co_main_incr() -> xbdback_co_main_loop() *| * xbdback_co_io() -> xbdback_co_main_incr() -> xbdback_co_main_loop() *| - * xbdback_co_io_gotreq()--+--> xbdback_co_map_io() --- - *|| | - * -> xbdback_co_io_loop()| <- xbdback_co_do_io() <-- - * | | | | - * | | | |--> xbdback_co_io_gotio() - * | | | | - * | | xbdback_co_main_incr() | - * | | | | - * | | xbdback_co_main_loop() | - * | | | - * | xbdback_co_io_gotio2() <---| - * | | | - * | | |--> xbdback_co_io_gotfrag() - * | | | - * -- xbdback_co_io_gotfrag2() <-| + * xbdback_co_io_gotio() -> xbdback_map_shm() + *| | + *| xbdback_co_main_incr() -> xbdback_co_main_loop() + *| + * xbdback_co_do_io() *| * xbdback_co_main_incr() -> xbdback_co_main_loop() */ @@ -192,17 +177,12 @@ struct xbdback_instance { * continuation-ness (see above). */
CVS commit: src/sys/arch/xen/xen
Module Name:src Committed By: jdolecek Date: Mon Apr 20 14:11:05 UTC 2020 Modified Files: src/sys/arch/xen/xen: xbdback_xenbus.c Log Message: do not retry when xen_shm_map() fails after having returned error for it, it corrupts the ring; just go to next request should fix the problem with ZFS causing failscade when req fails, reported by Brian Buhrow on port-xen To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/arch/xen/xen/xbdback_xenbus.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/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.81 src/sys/arch/xen/xen/xbdback_xenbus.c:1.82 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.81 Mon Apr 20 03:00:33 2020 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Mon Apr 20 14:11:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.81 2020/04/20 03:00:33 msaitoh Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.82 2020/04/20 14:11:04 jdolecek Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.81 2020/04/20 03:00:33 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.82 2020/04/20 14:11:04 jdolecek Exp $"); #include #include @@ -1804,7 +1804,8 @@ xbdback_map_shm(struct xbdback_io *xbd_i SLIST_INSERT_HEAD(>xbdi_va_free, xbd_io->xio_xv, xv_next); xbd_io->xio_xv = NULL; xbdi->xbdi_io = NULL; - xbdi->xbdi_cont = xbdi->xbdi_cont_aux; + // do not retry + xbdi->xbdi_cont = xbdback_co_main_incr; return xbdi; } }
CVS commit: src/external/bsd/tre/dist/lib
Module Name:src Committed By: joerg Date: Mon Apr 20 13:56:07 UTC 2020 Modified Files: src/external/bsd/tre/dist/lib: tre-match-approx.c Log Message: Fix indentation To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/bsd/tre/dist/lib/tre-match-approx.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/bsd/tre/dist/lib/tre-match-approx.c diff -u src/external/bsd/tre/dist/lib/tre-match-approx.c:1.6 src/external/bsd/tre/dist/lib/tre-match-approx.c:1.7 --- src/external/bsd/tre/dist/lib/tre-match-approx.c:1.6 Tue Nov 21 02:50:35 2017 +++ src/external/bsd/tre/dist/lib/tre-match-approx.c Mon Apr 20 13:56:07 2020 @@ -759,10 +759,10 @@ tre_tnfa_run_approx(const tre_tnfa_t *tn default_params); /* Set the costs after this transition. */ - memcpy(_next[dest_id].costs, - reach[id].costs, - sizeof(reach[id].costs[0][0]) - * TRE_M_LAST * (depth + 1)); + memcpy(_next[dest_id].costs, + reach[id].costs, + sizeof(reach[id].costs[0][0]) + * TRE_M_LAST * (depth + 1)); reach_next[dest_id].costs[depth][TRE_M_COST] = cost; reach_next[dest_id].costs[depth][TRE_M_NUM_SUBST] += err; reach_next[dest_id].costs[depth][TRE_M_NUM_ERR] += err;
CVS commit: src/sys/miscfs/procfs
Module Name:src Committed By: martin Date: Mon Apr 20 13:30:34 UTC 2020 Modified Files: src/sys/miscfs/procfs: procfs_linux.c Log Message: Add missing include of to fix the build To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/miscfs/procfs/procfs_linux.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/miscfs/procfs/procfs_linux.c diff -u src/sys/miscfs/procfs/procfs_linux.c:1.81 src/sys/miscfs/procfs/procfs_linux.c:1.82 --- src/sys/miscfs/procfs/procfs_linux.c:1.81 Sun Apr 19 20:31:59 2020 +++ src/sys/miscfs/procfs/procfs_linux.c Mon Apr 20 13:30:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_linux.c,v 1.81 2020/04/19 20:31:59 thorpej Exp $ */ +/* $NetBSD: procfs_linux.c,v 1.82 2020/04/20 13:30:34 martin Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -36,10 +36,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.81 2020/04/19 20:31:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.82 2020/04/20 13:30:34 martin Exp $"); #include #include +#include #include #include #include
CVS commit: src/external
Module Name:src Committed By: joerg Date: Mon Apr 20 13:04:10 UTC 2020 Modified Files: src/external/bsd/nvi/usr.bin/nvi: Makefile src/external/ibm-public/postfix: Makefile.inc src/external/mit/xorg/bin/xkbcomp: Makefile Log Message: Don't let clang warn about comparing pointers with string literals. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/external/bsd/nvi/usr.bin/nvi/Makefile cvs rdiff -u -r1.22 -r1.23 src/external/ibm-public/postfix/Makefile.inc cvs rdiff -u -r1.10 -r1.11 src/external/mit/xorg/bin/xkbcomp/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/nvi/usr.bin/nvi/Makefile diff -u src/external/bsd/nvi/usr.bin/nvi/Makefile:1.21 src/external/bsd/nvi/usr.bin/nvi/Makefile:1.22 --- src/external/bsd/nvi/usr.bin/nvi/Makefile:1.21 Sun Apr 12 17:28:57 2020 +++ src/external/bsd/nvi/usr.bin/nvi/Makefile Mon Apr 20 13:04:10 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.21 2020/04/12 17:28:57 martin Exp $ +# $NetBSD: Makefile,v 1.22 2020/04/20 13:04:10 joerg Exp $ .include @@ -17,6 +17,7 @@ COPTS.v_increment.c+= -Wno-format-nonlit CWARNFLAGS.gcc+= -Wno-unused CWARNFLAGS.clang+= -Wno-unsequenced .endif +CWARNFLAGS.clang+= -Wno-error=string-compare CPPFLAGS+=-I${DIST}/include -I${.CURDIR} -I. CPPFLAGS+=-DGTAGS -DIMCTRL Index: src/external/ibm-public/postfix/Makefile.inc diff -u src/external/ibm-public/postfix/Makefile.inc:1.22 src/external/ibm-public/postfix/Makefile.inc:1.23 --- src/external/ibm-public/postfix/Makefile.inc:1.22 Sat Apr 4 15:45:45 2020 +++ src/external/ibm-public/postfix/Makefile.inc Mon Apr 20 13:04:10 2020 @@ -1,9 +1,10 @@ -# $NetBSD: Makefile.inc,v 1.22 2020/04/04 15:45:45 christos Exp $ +# $NetBSD: Makefile.inc,v 1.23 2020/04/20 13:04:10 joerg Exp $ .include USE_FORT?= yes # network client and server -CWARNFLAGS.clang+= -Wno-empty-body -Wno-format-extra-args -Wno-string-plus-int +CWARNFLAGS.clang+= -Wno-empty-body -Wno-format-extra-args \ + -Wno-string-plus-int -Wno-string-compare WARNS?= 0 PFIX_DISTDIR= ${NETBSDSRCDIR}/external/ibm-public/postfix/dist Index: src/external/mit/xorg/bin/xkbcomp/Makefile diff -u src/external/mit/xorg/bin/xkbcomp/Makefile:1.10 src/external/mit/xorg/bin/xkbcomp/Makefile:1.11 --- src/external/mit/xorg/bin/xkbcomp/Makefile:1.10 Mon Jul 20 23:50:23 2015 +++ src/external/mit/xorg/bin/xkbcomp/Makefile Mon Apr 20 13:04:10 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.10 2015/07/20 23:50:23 mrg Exp $ +# $NetBSD: Makefile,v 1.11 2020/04/20 13:04:10 joerg Exp $ .include .include "Makefile.common" @@ -28,7 +28,7 @@ DPADD+= ${LIBXKBFILE} ${LIBXEXT} ${LIBX1 .PATH: ${X11SRCDIR.${PROG}} .PATH: ${X11SRCDIR.${PROG}}/man -CWARNFLAGS.clang+= -Wno-parentheses +CWARNFLAGS.clang+= -Wno-parentheses -Wno-string-compare .include "../../xorg-pkg-ver.mk"
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: joerg Date: Mon Apr 20 13:02:57 UTC 2020 Modified Files: src/sys/arch/x86/pci: amdsmn.c Log Message: Don't mix sign and unsigned operands. Just use size_t for the loop. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/pci/amdsmn.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/pci/amdsmn.c diff -u src/sys/arch/x86/pci/amdsmn.c:1.7 src/sys/arch/x86/pci/amdsmn.c:1.8 --- src/sys/arch/x86/pci/amdsmn.c:1.7 Mon Apr 20 11:03:02 2020 +++ src/sys/arch/x86/pci/amdsmn.c Mon Apr 20 13:02:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: amdsmn.c,v 1.7 2020/04/20 11:03:02 simonb Exp $ */ +/* $NetBSD: amdsmn.c,v 1.8 2020/04/20 13:02:57 joerg Exp $ */ /*- * Copyright (c) 2017, 2019 Conrad Meyer @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.7 2020/04/20 11:03:02 simonb Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.8 2020/04/20 13:02:57 joerg Exp $ "); /* * Driver for the AMD Family 15h (model 60+) and 17h CPU @@ -134,7 +134,7 @@ amdsmn_attach(device_t parent, device_t struct amdsmn_softc *sc = device_private(self); struct pci_attach_args *pa = aux; int flags = 0; - int i; + size_t i; mutex_init(>smn_lock, MUTEX_DEFAULT, IPL_NONE); sc->pa = *pa;
CVS commit: src/tests/lib/libi386
Module Name:src Committed By: joerg Date: Mon Apr 20 12:08:08 UTC 2020 Modified Files: src/tests/lib/libi386: Makefile Log Message: Provide SHLIBINSTALLDIR explicitly as it defauls to /lib otherwise and makes ld complain about the 64bit libc. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libi386/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libi386/Makefile diff -u src/tests/lib/libi386/Makefile:1.2 src/tests/lib/libi386/Makefile:1.3 --- src/tests/lib/libi386/Makefile:1.2 Sun Apr 19 18:07:00 2020 +++ src/tests/lib/libi386/Makefile Mon Apr 20 12:08:08 2020 @@ -1,10 +1,11 @@ -# $NetBSD: Makefile,v 1.2 2020/04/19 18:07:00 kre Exp $ +# $NetBSD: Makefile,v 1.3 2020/04/20 12:08:08 joerg Exp $ .include TESTSDIR= ${TESTSBASE}/lib/libi386 .if ${MACHINE} == "amd64" +SHLIBINSTALLDIR= /usr/lib/i386 COPTS+= -m32 LDFLAGS+= -m32 LDADD+= -li386
CVS commit: src/lib/libossaudio
Module Name:src Committed By: nia Date: Mon Apr 20 12:01:44 UTC 2020 Modified Files: src/lib/libossaudio: ossaudio.c Log Message: ossaudio: removed outdated comment To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/lib/libossaudio/ossaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libossaudio/ossaudio.c diff -u src/lib/libossaudio/ossaudio.c:1.43 src/lib/libossaudio/ossaudio.c:1.44 --- src/lib/libossaudio/ossaudio.c:1.43 Sun Apr 19 13:44:50 2020 +++ src/lib/libossaudio/ossaudio.c Mon Apr 20 12:01:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ossaudio.c,v 1.43 2020/04/19 13:44:50 nia Exp $ */ +/* $NetBSD: ossaudio.c,v 1.44 2020/04/20 12:01:44 nia Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: ossaudio.c,v 1.43 2020/04/19 13:44:50 nia Exp $"); +__RCSID("$NetBSD: ossaudio.c,v 1.44 2020/04/20 12:01:44 nia Exp $"); /* * This is an OSS (Linux) sound API emulator. @@ -594,7 +594,7 @@ audio_ioctl(int fd, unsigned long com, v retval = ioctl(fd, AUDIO_GETPROPS, ); if (retval < 0) return retval; - idat = DSP_CAP_TRIGGER; /* pretend we have trigger */ + idat = DSP_CAP_TRIGGER; if (idata & AUDIO_PROP_FULLDUPLEX) idat |= DSP_CAP_DUPLEX; if (idata & AUDIO_PROP_MMAP)
CVS commit: [bouyer-xenpvh] src/sys
Module Name:src Committed By: bouyer Date: Mon Apr 20 11:29:15 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64 [bouyer-xenpvh]: aarch64_machdep.c cpufunc.c cpuswitch.S db_machdep.c db_trace.c genassym.cf locore.S pmap.c pmapboot.c trap.c vectors.S vm_machdep.c src/sys/arch/aarch64/conf [bouyer-xenpvh]: Makefile.aarch64 files.aarch64 src/sys/arch/aarch64/include [bouyer-xenpvh]: armreg.h asm.h cpufunc.h proc.h src/sys/arch/acorn32/acorn32 [bouyer-xenpvh]: rpc_machdep.c src/sys/arch/acorn32/conf [bouyer-xenpvh]: EB7500ATX GENERIC INSTALL LOWMEM_WSCONS NC src/sys/arch/acorn32/eb7500atx [bouyer-xenpvh]: eb7500atx_machdep.c src/sys/arch/alpha/include [bouyer-xenpvh]: asm.h src/sys/arch/amd64/conf [bouyer-xenpvh]: ALL GENERIC Makefile.amd64 XEN3_DOMU XEN3_PVHVM std.xen src/sys/arch/amd64/include [bouyer-xenpvh]: asan.h asm.h msan.h types.h src/sys/arch/arm/arm32 [bouyer-xenpvh]: arm32_machdep.c db_machdep.c pmap.c vm_machdep.c src/sys/arch/arm/at91 [bouyer-xenpvh]: at91bus.c src/sys/arch/arm/conf [bouyer-xenpvh]: files.arm src/sys/arch/arm/cortex [bouyer-xenpvh]: gic.c gicv3.c src/sys/arch/arm/imx [bouyer-xenpvh]: imx23_digfilt.c src/sys/arch/arm/include [bouyer-xenpvh]: asm.h bus_defs.h bus_funcs.h src/sys/arch/arm/include/arm32 [bouyer-xenpvh]: pmap.h src/sys/arch/arm/omap [bouyer-xenpvh]: omap3_sdmareg.h omap3_sdmavar.h omapfbreg.h src/sys/arch/arm/ti [bouyer-xenpvh]: omap3_dssreg.h src/sys/arch/arm/xscale [bouyer-xenpvh]: pxa2x0_ac97.c src/sys/arch/cats/cats [bouyer-xenpvh]: cats_machdep.c src/sys/arch/cats/conf [bouyer-xenpvh]: GENERIC INSTALL src/sys/arch/evbarm/adi_brh [bouyer-xenpvh]: brh_machdep.c src/sys/arch/evbarm/armadillo [bouyer-xenpvh]: armadillo9_machdep.c src/sys/arch/evbarm/conf [bouyer-xenpvh]: ADI_BRH ARMADAXP ARMADILLO-IOT-G3 ARMADILLO210 ARMADILLO9 BCM5301X BCM56340 CP3100 CUBOX CUBOX-I DNS323 DUOVERO GEMINI GEMINI_MASTER GEMINI_SLAVE GENERIC GENERIC.common GENERIC64 GUMSTIX HDL_G HPT5325 HUMMINGBOARD IMX IMX31LITE IMX6UL-STARTER INTEGRATOR INTEGRATOR_CP IQ31244 IQ80310 IQ80321 IXDP425 IXM1200 IYONIX KOBO KUROBOX_PRO KURONAS_X4 LUBBOCK MARVELL_NAS MINI2440 N900 NAPPI NETWALKER NSLU2 OMAP5EVM OPENBLOCKS_A6 OPENBLOCKS_AX3 OSK5912 PANDABOARD PARALLELLA PEPPER RPI SHEEVAPLUG SMDK2410 SMDK2800 TEAMASA_NPWR TEAMASA_NPWR_FC TISDP2420 TISDP2430 TS7200 TWINTAIL VIPER VIRT VTC100 ZAO425 ZEDBOARD src/sys/arch/evbarm/g42xxeb [bouyer-xenpvh]: g42xxeb_machdep.c src/sys/arch/evbarm/gumstix [bouyer-xenpvh]: gumstix_machdep.c src/sys/arch/evbarm/hdl_g [bouyer-xenpvh]: hdlg_machdep.c src/sys/arch/evbarm/imx31 [bouyer-xenpvh]: imx31lk_machdep.c src/sys/arch/evbarm/integrator [bouyer-xenpvh]: integrator_machdep.c src/sys/arch/evbarm/iq80310 [bouyer-xenpvh]: iq80310_machdep.c src/sys/arch/evbarm/iq80321 [bouyer-xenpvh]: iq80321_machdep.c src/sys/arch/evbarm/ixdp425 [bouyer-xenpvh]: ixdp425_machdep.c src/sys/arch/evbarm/ixm1200 [bouyer-xenpvh]: ixm1200_machdep.c src/sys/arch/evbarm/iyonix [bouyer-xenpvh]: iyonix_machdep.c src/sys/arch/evbarm/lubbock [bouyer-xenpvh]: lubbock_machdep.c src/sys/arch/evbarm/mini2440 [bouyer-xenpvh]: mini2440_machdep.c src/sys/arch/evbarm/mmnet [bouyer-xenpvh]: mmnet_machdep.c src/sys/arch/evbarm/mpcsa [bouyer-xenpvh]: mpcsa_machdep.c src/sys/arch/evbarm/npwr_fc [bouyer-xenpvh]: npwr_fc_machdep.c src/sys/arch/evbarm/nslu2 [bouyer-xenpvh]: nslu2_machdep.c src/sys/arch/evbarm/smdk2xx0 [bouyer-xenpvh]: smdk2410_machdep.c smdk2800_machdep.c src/sys/arch/evbarm/tsarm [bouyer-xenpvh]: tsarm_machdep.c src/sys/arch/evbarm/viper [bouyer-xenpvh]: viper_machdep.c src/sys/arch/hpcarm/conf [bouyer-xenpvh]: IPAQ JORNADA720 JORNADA820 NETBOOKPRO WZERO3 src/sys/arch/hpcarm/hpcarm [bouyer-xenpvh]: pxa2x0_hpc_machdep.c sa11x0_hpc_machdep.c src/sys/arch/hppa/dev [bouyer-xenpvh]: cpu.c src/sys/arch/hppa/gsc [bouyer-xenpvh]: if_ie_gsc.c src/sys/arch/hppa/hppa [bouyer-xenpvh]: fpu.c hppa_machdep.c machdep.c pmap.c src/sys/arch/hppa/include [bouyer-xenpvh]: asm.h cpu.h types.h src/sys/arch/i386/conf [bouyer-xenpvh]: XEN3PAE_DOM0 XEN3PAE_DOMU XEN3PAE_PVHVM src/sys/arch/i386/include [bouyer-xenpvh]: asm.h src/sys/arch/ia64/include [bouyer-xenpvh]: asm.h src/sys/arch/iyonix/conf [bouyer-xenpvh]: GENERIC src/sys/arch/iyonix/iyonix [bouyer-xenpvh]: iyonix_machdep.c
CVS commit: src/share/man/man4/man4.x86
Module Name:src Committed By: simonb Date: Mon Apr 20 11:09:48 UTC 2020 Modified Files: src/share/man/man4/man4.x86: amdsmn.4 amdzentemp.4 Log Message: Note that these drivers are present on some newer AMD Family 15h processors. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/man4.x86/amdsmn.4 cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/man4.x86/amdzentemp.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/man4.x86/amdsmn.4 diff -u src/share/man/man4/man4.x86/amdsmn.4:1.3 src/share/man/man4/man4.x86/amdsmn.4:1.4 --- src/share/man/man4/man4.x86/amdsmn.4:1.3 Fri Jan 26 15:12:37 2018 +++ src/share/man/man4/man4.x86/amdsmn.4 Mon Apr 20 11:09:48 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: amdsmn.4,v 1.3 2018/01/26 15:12:37 wiz Exp $ +.\" $NetBSD: amdsmn.4,v 1.4 2020/04/20 11:09:48 simonb Exp $ .\" .\" Copyright (c) 2018 Ian Clark .\" All rights reserved. @@ -54,7 +54,7 @@ .\" .\" $FreeBSD: head/share/man/man4/amdsmn.4 323184 2017-09-05 15:13:41Z cem $ .\" -.Dd January 22, 2018 +.Dd April 20, 2020 .Dt AMDSMN 4 x86 .Os .Sh NAME @@ -66,7 +66,7 @@ The .Nm driver provides support for resources on the System Management Network bus -in AMD Family 17h processors. +in AMD Family 17h processors and some later AMD Family 15h processors. .Sh SEE ALSO .Xr amdzentemp 4 .Sh HISTORY Index: src/share/man/man4/man4.x86/amdzentemp.4 diff -u src/share/man/man4/man4.x86/amdzentemp.4:1.6 src/share/man/man4/man4.x86/amdzentemp.4:1.7 --- src/share/man/man4/man4.x86/amdzentemp.4:1.6 Sat Jan 27 21:39:06 2018 +++ src/share/man/man4/man4.x86/amdzentemp.4 Mon Apr 20 11:09:48 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: amdzentemp.4,v 1.6 2018/01/27 21:39:06 pgoyette Exp $ +.\" $NetBSD: amdzentemp.4,v 1.7 2020/04/20 11:09:48 simonb Exp $ .\"- .\" Copyright (c) 2008 Christoph Egger .\" All rights reserved. @@ -26,7 +26,7 @@ .\" .\" $FreeBSD: src/share/man/man4/coretemp.4,v 1.4 2007/10/15 20:00:19 netchild Exp $ .\" -.Dd January 28, 2018 +.Dd April 20, 2020 .Dt AMDZENTEMP 4 x86 .Os .Sh NAME @@ -38,7 +38,7 @@ The .Nm driver provides support for the on-die digital thermal sensor present -on AMD Ryzen CPUs +on AMD Ryzen CPUs and some later AMD Opteron CPUs. .Pp These sensors provide 0.125\(deC accuracy. There is one sensor for each CPU socket.
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: simonb Date: Mon Apr 20 11:03:02 UTC 2020 Modified Files: src/sys/arch/x86/pci: amdsmn.c amdzentemp.c Log Message: Update to support Family 15h Model 60 temperature sensors. Changes based on FreeBSD amdtemp driver changes by Conrad Meyer. XXX: Some code duplication between this driver and amdtemp as parts of the 15h refresh code share more in common with older CPUs while accessing the device more like 17h. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/pci/amdsmn.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/pci/amdzentemp.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/pci/amdsmn.c diff -u src/sys/arch/x86/pci/amdsmn.c:1.6 src/sys/arch/x86/pci/amdsmn.c:1.7 --- src/sys/arch/x86/pci/amdsmn.c:1.6 Tue Aug 6 05:32:44 2019 +++ src/sys/arch/x86/pci/amdsmn.c Mon Apr 20 11:03:02 2020 @@ -1,7 +1,7 @@ -/* $NetBSD: amdsmn.c,v 1.6 2019/08/06 05:32:44 msaitoh Exp $ */ +/* $NetBSD: amdsmn.c,v 1.7 2020/04/20 11:03:02 simonb Exp $ */ /*- - * Copyright (c) 2017 Conrad Meyer + * Copyright (c) 2017, 2019 Conrad Meyer * All rights reserved. * * NetBSD port by Ian Clark @@ -29,10 +29,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.6 2019/08/06 05:32:44 msaitoh Exp $ "); +__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.7 2020/04/20 11:03:02 simonb Exp $ "); /* - * Driver for the AMD Family 17h CPU System Management Network. + * Driver for the AMD Family 15h (model 60+) and 17h CPU + * System Management Network. */ #include @@ -52,11 +53,15 @@ __KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1 #include "amdsmn.h" #include "ioconf.h" -#define SMN_ADDR_REG 0x60 -#define SMN_DATA_REG 0x64 +#define F15H_SMN_ADDR_REG 0xb8 +#define F15H_SMN_DATA_REG 0xbc +#define F17H_SMN_ADDR_REG 0x60 +#define F17H_SMN_DATA_REG 0x64 struct amdsmn_softc { kmutex_t smn_lock; + uint8_t smn_addr_reg; + uint8_t smn_data_reg; struct pci_attach_args pa; pci_chipset_tag_t pc; pcitag_t pcitag; @@ -64,10 +69,29 @@ struct amdsmn_softc { static const struct pciid { uint16_t amdsmn_deviceid; + uint8_t amdsmn_addr_reg; + uint8_t amdsmn_data_reg; } amdsmn_ids[] = { - { PCI_PRODUCT_AMD_F17_RC }, - { PCI_PRODUCT_AMD_F17_1X_RC }, - { PCI_PRODUCT_AMD_F17_7X_RC }, + { + .amdsmn_deviceid = PCI_PRODUCT_AMD_F15_60_RC, + .amdsmn_addr_reg = F15H_SMN_ADDR_REG, + .amdsmn_data_reg = F15H_SMN_DATA_REG, + }, + { + .amdsmn_deviceid = PCI_PRODUCT_AMD_F17_RC, + .amdsmn_addr_reg = F17H_SMN_ADDR_REG, + .amdsmn_data_reg = F17H_SMN_DATA_REG, + }, + { + .amdsmn_deviceid = PCI_PRODUCT_AMD_F17_1X_RC, + .amdsmn_addr_reg = F17H_SMN_ADDR_REG, + .amdsmn_data_reg = F17H_SMN_DATA_REG, + }, + { + .amdsmn_deviceid = PCI_PRODUCT_AMD_F17_7X_RC, + .amdsmn_addr_reg = F17H_SMN_ADDR_REG, + .amdsmn_data_reg = F17H_SMN_DATA_REG, + }, }; static int amdsmn_match(device_t, cfdata_t, void *); @@ -110,12 +134,21 @@ amdsmn_attach(device_t parent, device_t struct amdsmn_softc *sc = device_private(self); struct pci_attach_args *pa = aux; int flags = 0; + int i; mutex_init(>smn_lock, MUTEX_DEFAULT, IPL_NONE); sc->pa = *pa; sc->pc = pa->pa_pc; sc->pcitag = pa->pa_tag; - aprint_normal(": AMD Family 17h System Management Network\n"); + + for (i = 0; i < __arraycount(amdsmn_ids); i++) + if (PCI_PRODUCT(pa->pa_id) == amdsmn_ids[i].amdsmn_deviceid) { + sc->smn_addr_reg = amdsmn_ids[i].amdsmn_addr_reg; + sc->smn_data_reg = amdsmn_ids[i].amdsmn_data_reg; + } + + // aprint_normal(": AMD Family 17h System Management Network\n"); + aprint_normal(": AMD System Management Network\n"); amdsmn_rescan(self, "amdsmnbus", ); } @@ -146,8 +179,8 @@ amdsmn_read(device_t dev, uint32_t addr, struct amdsmn_softc *sc = device_private(dev); mutex_enter(>smn_lock); - pci_conf_write(sc->pc, sc->pcitag, SMN_ADDR_REG, addr); - *value = pci_conf_read(sc->pc, sc->pcitag, SMN_DATA_REG); + pci_conf_write(sc->pc, sc->pcitag, sc->smn_addr_reg, addr); + *value = pci_conf_read(sc->pc, sc->pcitag, sc->smn_data_reg); mutex_exit(>smn_lock); return 0; @@ -159,8 +192,8 @@ amdsmn_write(device_t dev, uint32_t addr struct amdsmn_softc *sc = device_private(dev); mutex_enter(>smn_lock); - pci_conf_write(sc->pc, sc->pcitag, SMN_ADDR_REG, addr); - pci_conf_write(sc->pc, sc->pcitag, SMN_DATA_REG, value); + pci_conf_write(sc->pc, sc->pcitag, sc->smn_addr_reg, addr); + pci_conf_write(sc->pc, sc->pcitag, sc->smn_data_reg, value); mutex_exit(>smn_lock); return 0; Index: src/sys/arch/x86/pci/amdzentemp.c diff -u src/sys/arch/x86/pci/amdzentemp.c:1.9 src/sys/arch/x86/pci/amdzentemp.c:1.10 --- src/sys/arch/x86/pci/amdzentemp.c:1.9 Sun Jun 16 09:12:51 2019 +++ src/sys/arch/x86/pci/amdzentemp.c Mon Apr 20 11:03:02 2020 @@ -1,8 +1,11 @@ -/* $NetBSD: amdzentemp.c,v 1.9 2019/06/16 09:12:51 mlelstv Exp $ */ +/* $NetBSD: amdzentemp.c,v 1.10 2020/04/20