Tue Apr 14 16:53:57 2020 UTC ()
Always patch spllower with cx8_spllower; it works fine for Xen now
Include x86/x86/patch.c is !xenpv
While there, defopt XENPV


(bouyer)
diff -r1.37.6.1 -r1.37.6.2 src/sys/arch/x86/x86/patch.c
diff -r1.180.2.1 -r1.180.2.2 src/sys/arch/xen/conf/files.xen

cvs diff -r1.37.6.1 -r1.37.6.2 src/sys/arch/x86/x86/patch.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/patch.c 2020/04/10 14:37:54 1.37.6.1
+++ src/sys/arch/x86/x86/patch.c 2020/04/14 16:53:57 1.37.6.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: patch.c,v 1.37.6.1 2020/04/10 14:37:54 bouyer Exp $ */ 1/* $NetBSD: patch.c,v 1.37.6.2 2020/04/14 16:53:57 bouyer Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran. 8 * by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * Patch kernel code at boot time, depending on available CPU features. 33 * Patch kernel code at boot time, depending on available CPU features.
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.37.6.1 2020/04/10 14:37:54 bouyer Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.37.6.2 2020/04/14 16:53:57 bouyer Exp $");
38 38
39#include "opt_lockdebug.h" 39#include "opt_lockdebug.h"
40#ifdef i386 40#ifdef i386
41#include "opt_spldebug.h" 41#include "opt_spldebug.h"
42#endif 42#endif
43 43
44#include <sys/types.h> 44#include <sys/types.h>
45#include <sys/systm.h> 45#include <sys/systm.h>
46 46
47#include <machine/cpu.h> 47#include <machine/cpu.h>
48#include <machine/cpufunc.h> 48#include <machine/cpufunc.h>
49#include <machine/specialreg.h> 49#include <machine/specialreg.h>
50#include <machine/frameasm.h> 50#include <machine/frameasm.h>
@@ -240,28 +240,27 @@ x86_patch(bool early) @@ -240,28 +240,27 @@ x86_patch(bool early)
240 * Patch early and late. Second time around the 'lock' prefix 240 * Patch early and late. Second time around the 'lock' prefix
241 * may be gone. 241 * may be gone.
242 */ 242 */
243 if ((cpu_feature[0] & CPUID_CX8) != 0) { 243 if ((cpu_feature[0] & CPUID_CX8) != 0) {
244 patchfunc( 244 patchfunc(
245 _atomic_cas_cx8, _atomic_cas_cx8_end, 245 _atomic_cas_cx8, _atomic_cas_cx8_end,
246 _atomic_cas_64, _atomic_cas_64_end, 246 _atomic_cas_64, _atomic_cas_64_end,
247 NULL 247 NULL
248 ); 248 );
249 } 249 }
250#endif /* i386 */ 250#endif /* i386 */
251 251
252#if !defined(SPLDEBUG) 252#if !defined(SPLDEBUG)
253 if (!early && (cpu_feature[0] & CPUID_CX8) != 0 && 253 if (!early && (cpu_feature[0] & CPUID_CX8) != 0) {
254 !vm_guest_is_xenpv()) { 
255 /* Faster splx(), mutex_spin_exit(). */ 254 /* Faster splx(), mutex_spin_exit(). */
256 patchfunc( 255 patchfunc(
257 cx8_spllower, cx8_spllower_end, 256 cx8_spllower, cx8_spllower_end,
258 spllower, spllower_end, 257 spllower, spllower_end,
259 cx8_spllower_patch 258 cx8_spllower_patch
260 ); 259 );
261#if defined(i386) && !defined(LOCKDEBUG) 260#if defined(i386) && !defined(LOCKDEBUG)
262 patchfunc( 261 patchfunc(
263 i686_mutex_spin_exit, i686_mutex_spin_exit_end, 262 i686_mutex_spin_exit, i686_mutex_spin_exit_end,
264 mutex_spin_exit, mutex_spin_exit_end, 263 mutex_spin_exit, mutex_spin_exit_end,
265 i686_mutex_spin_exit_patch 264 i686_mutex_spin_exit_patch
266 ); 265 );
267#endif /* i386 && !LOCKDEBUG */ 266#endif /* i386 && !LOCKDEBUG */

cvs diff -r1.180.2.1 -r1.180.2.2 src/sys/arch/xen/conf/files.xen (expand / switch to unified diff)

--- src/sys/arch/xen/conf/files.xen 2020/04/11 18:26:07 1.180.2.1
+++ src/sys/arch/xen/conf/files.xen 2020/04/14 16:53:57 1.180.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: files.xen,v 1.180.2.1 2020/04/11 18:26:07 bouyer Exp $ 1# $NetBSD: files.xen,v 1.180.2.2 2020/04/14 16:53:57 bouyer Exp $
2# NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp  2# NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp
3# NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp  3# NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp
4 4
5ifdef i386 5ifdef i386
6maxpartitions 8 6maxpartitions 8
7else 7else
8maxpartitions 16 8maxpartitions 16
9endif 9endif
10 10
11maxusers 2 16 128 11maxusers 2 16 128
12 12
13defparam opt_kernbase.h KERNBASE 13defparam opt_kernbase.h KERNBASE
14 14
@@ -140,26 +140,27 @@ file dev/md_root.c memory_disk_hooks @@ -140,26 +140,27 @@ file dev/md_root.c memory_disk_hooks
140file arch/x86/x86/bus_dma.c machdep 140file arch/x86/x86/bus_dma.c machdep
141file arch/x86/x86/core_machdep.c coredump 141file arch/x86/x86/core_machdep.c coredump
142file arch/xen/x86/xen_bus_dma.c machdep & xenpv 142file arch/xen/x86/xen_bus_dma.c machdep & xenpv
143file arch/x86/x86/bus_space.c machdep 143file arch/x86/x86/bus_space.c machdep
144file arch/xen/x86/consinit.c machdep & xenpv 144file arch/xen/x86/consinit.c machdep & xenpv
145file arch/x86/x86/consinit.c machdep & xenpvhvm 145file arch/x86/x86/consinit.c machdep & xenpvhvm
146file arch/x86/x86/identcpu.c machdep 146file arch/x86/x86/identcpu.c machdep
147file arch/xen/x86/pintr.c machdep & dom0ops & xenpv 147file arch/xen/x86/pintr.c machdep & dom0ops & xenpv
148file arch/xen/x86/xen_ipi.c multiprocessor & xenpv 148file arch/xen/x86/xen_ipi.c multiprocessor & xenpv
149file arch/x86/x86/idt.c machdep 149file arch/x86/x86/idt.c machdep
150file arch/x86/x86/intr.c machdep & xenpvhvm 150file arch/x86/x86/intr.c machdep & xenpvhvm
151file arch/x86/x86/x86_softintr.c machdep 151file arch/x86/x86/x86_softintr.c machdep
152file arch/x86/x86/ipi.c xenpvhvm 152file arch/x86/x86/ipi.c xenpvhvm
 153file arch/x86/x86/patch.c machdep & ! xenpv
153file arch/x86/x86/pmap.c machdep 154file arch/x86/x86/pmap.c machdep
154file arch/x86/x86/x86_tlb.c machdep 155file arch/x86/x86/x86_tlb.c machdep
155file arch/x86/x86/procfs_machdep.c procfs 156file arch/x86/x86/procfs_machdep.c procfs
156file arch/x86/x86/sys_machdep.c machdep 157file arch/x86/x86/sys_machdep.c machdep
157file arch/x86/x86/tsc.c machdep 158file arch/x86/x86/tsc.c machdep
158file arch/x86/x86/vm_machdep.c machdep 159file arch/x86/x86/vm_machdep.c machdep
159file arch/x86/x86/x86_autoconf.c machdep & xenpvhvm 160file arch/x86/x86/x86_autoconf.c machdep & xenpvhvm
160file arch/x86/x86/x86_machdep.c machdep 161file arch/x86/x86/x86_machdep.c machdep
161file arch/x86/x86/platform.c machdep 162file arch/x86/x86/platform.c machdep
162 163
163include "arch/xen/conf/files.compat" 164include "arch/xen/conf/files.compat"
164 165
165# BIOS32 routines 166# BIOS32 routines
@@ -380,27 +381,27 @@ include "dev/cardbus/files.cardbus" @@ -380,27 +381,27 @@ include "dev/cardbus/files.cardbus"
380ifdef i386 381ifdef i386
381file arch/i386/i386/rbus_machdep.c cardbus 382file arch/i386/i386/rbus_machdep.c cardbus
382elifdef amd64 383elifdef amd64
383file arch/amd64/amd64/rbus_machdep.c cardbus 384file arch/amd64/amd64/rbus_machdep.c cardbus
384endif 385endif
385 386
386# this wants to be probed as late as possible. 387# this wants to be probed as late as possible.
387# 388#
388# Machine-independent PCMCIA drivers 389# Machine-independent PCMCIA drivers
389# 390#
390include "dev/pcmcia/files.pcmcia" 391include "dev/pcmcia/files.pcmcia"
391 392
392# Domain-0 operations 393# Domain-0 operations
393defflag opt_xen.h DOM0OPS 394defflag opt_xen.h DOM0OPS XENPV
394file arch/xen/xen/privcmd.c dom0ops 395file arch/xen/xen/privcmd.c dom0ops
395file arch/xen/x86/xen_shm_machdep.c dom0ops 396file arch/xen/x86/xen_shm_machdep.c dom0ops
396file arch/x86/pci/pci_machdep.c (xenpvhvm | hypervisor) & pci & ( dom0ops | xenpvhvm ) 397file arch/x86/pci/pci_machdep.c (xenpvhvm | hypervisor) & pci & ( dom0ops | xenpvhvm )
397file arch/x86/pci/pci_intr_machdep.c (xenpvhvm | hypervisor) & pci 398file arch/x86/pci/pci_intr_machdep.c (xenpvhvm | hypervisor) & pci
398file arch/x86/pci/pci_msi_machdep.c hypervisor & xenpvhvm & pci & ! no_pci_msi_msix 399file arch/x86/pci/pci_msi_machdep.c hypervisor & xenpvhvm & pci & ! no_pci_msi_msix
399file arch/x86/pci/msipic.c hypervisor & xenpvhvm & pci & ! no_pci_msi_msix 400file arch/x86/pci/msipic.c hypervisor & xenpvhvm & pci & ! no_pci_msi_msix
400file arch/x86/isa/isa_machdep.c (xenpvhvm | hypervisor) & ( dom0ops | xenpvhvm ) 401file arch/x86/isa/isa_machdep.c (xenpvhvm | hypervisor) & ( dom0ops | xenpvhvm )
401file arch/xen/xen/xenevt.c xenevt & (dom0ops | xenpvhvm) 402file arch/xen/xen/xenevt.c xenevt & (dom0ops | xenpvhvm)
402file arch/xen/xen/xennetback_xenbus.c xvif 403file arch/xen/xen/xennetback_xenbus.c xvif
403file arch/xen/xen/xennet_checksum.c xvif | xennet 404file arch/xen/xen/xennet_checksum.c xvif | xennet
404file arch/xen/xen/xbdback_xenbus.c xbdback 405file arch/xen/xen/xbdback_xenbus.c xbdback
405 406
406ifdef i386 407ifdef i386