Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/bouyer-xenpvh]: src/sys/arch spllower(): Also check Xen pending events
details: https://anonhg.NetBSD.org/src/rev/a9ae918eaf03
branches: bouyer-xenpvh
changeset: 1024949:a9ae918eaf03
user: bouyer <bouyer%NetBSD.org@localhost>
date: Fri Apr 10 14:41:59 2020 +0000
description:
spllower(): Also check Xen pending events
hypervisor_pvhvm_callback(): exit via Xdoreti, so that pending interrupts
are checked.
disable __HAVE_FAST_SOFTINTS only for XENPV, it now works for PVHVM.
We still have to disable PREEMPTION, until we support MULTIPROCESSOR
diffstat:
sys/arch/amd64/amd64/spl.S | 9 +++++-
sys/arch/amd64/amd64/vector.S | 18 ++++++++++++--
sys/arch/amd64/conf/XEN3_PVHVM | 5 ++-
sys/arch/i386/conf/XEN3PAE_PVHVM | 5 ++-
sys/arch/i386/i386/spl.S | 13 +++++++---
sys/arch/i386/i386/vector.S | 49 ++++++++++++++++++++++++++++++++++++---
sys/arch/x86/include/intr.h | 6 ++--
7 files changed, 85 insertions(+), 20 deletions(-)
diffs (282 lines):
diff -r 94694c595a98 -r a9ae918eaf03 sys/arch/amd64/amd64/spl.S
--- a/sys/arch/amd64/amd64/spl.S Fri Apr 10 14:38:19 2020 +0000
+++ b/sys/arch/amd64/amd64/spl.S Fri Apr 10 14:41:59 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spl.S,v 1.43.4.2 2020/04/09 21:01:33 bouyer Exp $ */
+/* $NetBSD: spl.S,v 1.43.4.3 2020/04/10 14:41:59 bouyer Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -91,7 +91,7 @@
ret
END(splraise)
-#ifndef XEN
+#ifndef XENPV
/*
* Xsoftintr()
*
@@ -242,6 +242,11 @@
cli
testl CPUVAR(IPENDING),%edx
jnz 2f
+#if defined(XEN)
+ movl CPUVAR(XUNMASK)(,%rdi,4),%edx
+ testl CPUVAR(XPENDING),%edx
+ jnz 2f
+#endif
movl %edi,CPUVAR(ILEVEL)
popf
1:
diff -r 94694c595a98 -r a9ae918eaf03 sys/arch/amd64/amd64/vector.S
--- a/sys/arch/amd64/amd64/vector.S Fri Apr 10 14:38:19 2020 +0000
+++ b/sys/arch/amd64/amd64/vector.S Fri Apr 10 14:41:59 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vector.S,v 1.73 2019/12/30 23:32:29 thorpej Exp $ */
+/* $NetBSD: vector.S,v 1.73.6.1 2020/04/10 14:41:59 bouyer Exp $ */
/*
* Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -815,7 +815,6 @@
movq (%rsp),%rcx
movq 8(%rsp),%r11
addq $16,%rsp
-IDTVEC(hypervisor_pvhvm_callback)
pushq $0 /* Dummy error code */
pushq $T_ASTFLT
INTRENTRY
@@ -827,8 +826,21 @@
jnz doreti_checkast
1:
INTRFASTEXIT
+END(hypervisor_callback)
+
+IDTVEC(hypervisor_pvhvm_callback)
+ pushq $0 /* Dummy error code */
+ pushq $T_ASTFLT
+ INTRENTRY
+ movl CPUVAR(ILEVEL),%edi
+ pushq %rdi /* for Xdoreti */
+ /* sti?? */
+ movq %rsp,%rdi
+ subq $8,%rdi; /* don't forget if_ppl */
+ call do_hypervisor_callback
+ incl CPUVAR(IDEPTH)
+ jmp _C_LABEL(Xdoreti)
IDTVEC_END(hypervisor_pvhvm_callback)
-END(hypervisor_callback)
#endif /* XEN */
#ifdef XENPV
diff -r 94694c595a98 -r a9ae918eaf03 sys/arch/amd64/conf/XEN3_PVHVM
--- a/sys/arch/amd64/conf/XEN3_PVHVM Fri Apr 10 14:38:19 2020 +0000
+++ b/sys/arch/amd64/conf/XEN3_PVHVM Fri Apr 10 14:41:59 2020 +0000
@@ -1,10 +1,11 @@
-# $NetBSD: XEN3_PVHVM,v 1.3.2.1 2020/04/08 17:56:08 bouyer Exp $
+# $NetBSD: XEN3_PVHVM,v 1.3.2.2 2020/04/10 14:42:00 bouyer Exp $
include "arch/amd64/conf/std.xen"
options XENPVHVM
#options MULTIPROCESSOR # Not yet.
+options NO_PREEMPTION
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
@@ -12,7 +13,7 @@
#options UVMHIST_PRINT
#options SYSCALL_DEBUG
-#ident "XEN3_PVHVM-$Revision: 1.3.2.1 $"
+#ident "XEN3_PVHVM-$Revision: 1.3.2.2 $"
maxusers 32 # estimated number of users
options MAXPHYS=32768 #xbd doesn't handle 64k transfers
diff -r 94694c595a98 -r a9ae918eaf03 sys/arch/i386/conf/XEN3PAE_PVHVM
--- a/sys/arch/i386/conf/XEN3PAE_PVHVM Fri Apr 10 14:38:19 2020 +0000
+++ b/sys/arch/i386/conf/XEN3PAE_PVHVM Fri Apr 10 14:41:59 2020 +0000
@@ -1,10 +1,11 @@
-# $NetBSD: XEN3PAE_PVHVM,v 1.3.2.1 2020/04/08 17:56:08 bouyer Exp $
+# $NetBSD: XEN3PAE_PVHVM,v 1.3.2.2 2020/04/10 14:42:00 bouyer Exp $
include "arch/xen/conf/std.xen"
options XENPVHVM # PVHVM domU support
#options MULTIPROCESSOR # Not yet.
+options NO_PREEMPTION
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
@@ -115,7 +116,7 @@
#vcpu* at hypervisor? # Xen virtual CPUs
xenbus* at hypervisor? # Xen virtual bus
xencons* at hypervisor? # Xen virtual console
-#xennet* at xenbus? # Xen virtual network interface
+xennet* at xenbus? # Xen virtual network interface
xbd* at xenbus? # Xen virtual block device
#balloon* at xenbus? # Xen balloon device
diff -r 94694c595a98 -r a9ae918eaf03 sys/arch/i386/i386/spl.S
--- a/sys/arch/i386/i386/spl.S Fri Apr 10 14:38:19 2020 +0000
+++ b/sys/arch/i386/i386/spl.S Fri Apr 10 14:41:59 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spl.S,v 1.50 2020/01/08 17:38:41 ad Exp $ */
+/* $NetBSD: spl.S,v 1.50.4.1 2020/04/10 14:42:00 bouyer Exp $ */
/*
* Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.50 2020/01/08 17:38:41 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.50.4.1 2020/04/10 14:42:00 bouyer Exp $");
#include "opt_ddb.h"
#include "opt_spldebug.h"
@@ -94,6 +94,11 @@
cli
testl CPUVAR(IPENDING),%edx
jnz 2f
+#if defined(XEN)
+ movl CPUVAR(XUNMASK)(,%ecx,4),%edx
+ testl CPUVAR(XPENDING),%edx
+ jnz 2f
+#endif
movl %ecx,CPUVAR(ILEVEL)
popf
1:
@@ -353,7 +358,7 @@
#endif
IDTVEC_END(doreti)
-#ifndef XEN
+#ifndef XENPV
/*
* Xsoftintr()
*
@@ -455,4 +460,4 @@
cli
jmp *%esi
IDTVEC_END(resume_preempt)
-#endif /* !XEN */
+#endif /* !XENPV */
diff -r 94694c595a98 -r a9ae918eaf03 sys/arch/i386/i386/vector.S
--- a/sys/arch/i386/i386/vector.S Fri Apr 10 14:38:19 2020 +0000
+++ b/sys/arch/i386/i386/vector.S Fri Apr 10 14:41:59 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vector.S,v 1.85 2019/12/30 23:32:29 thorpej Exp $ */
+/* $NetBSD: vector.S,v 1.85.6.1 2020/04/10 14:42:00 bouyer Exp $ */
/*
* Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
*/
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85 2019/12/30 23:32:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.1 2020/04/10 14:42:00 bouyer Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -940,6 +940,7 @@
#if defined(XEN)
#define voidop(num)
+#ifdef XENPV
#define XENINTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
IDTVEC(recurse_ ## name ## num) ;\
INTR_RECURSE_HWFRAME ;\
@@ -970,6 +971,36 @@
popl %ebx ;\
jmp *%esi /* lower spl and do ASTs */ ;\
+#else /* XENPV */
+#define XENINTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
+IDTVEC(recurse_ ## name ## num) ;\
+ INTR_RECURSE_HWFRAME ;\
+ subl $4,%esp ;\
+ pushl $T_ASTFLT /* trap # for doing ASTs */ ;\
+ INTRENTRY ;\
+IDTVEC(resume_ ## name ## num) \
+ movl $IREENT_MAGIC,TF_ERR(%esp) ;\
+ pushl %ebx ;\
+ movl CPUVAR(XSOURCES) + (num) * 4,%ebp ;\
+ movl $num,CPUVAR(ILEVEL) ;\
+ IDEPTH_INCR /* leaves old %esp on stack */ ;\
+ STI(%eax) ;\
+ movl IS_HANDLERS(%ebp),%ebx ;\
+6: \
+ pushl IH_ARG(%ebx) ;\
+ call *IH_FUN(%ebx) /* call it */ ;\
+ addl $4,%esp /* toss the arg */ ;\
+ movl IH_NEXT(%ebx),%ebx /* next handler in chain */ ;\
+ testl %ebx,%ebx ;\
+ jnz 6b ;\
+ \
+ CLI(%eax) ;\
+ unmask(num) /* unmask it in hardware */ ;\
+ late_ack(num) ;\
+ jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
+
+#endif /* XENPV */
+
/*
* Just unmasking the event isn't enough, we also need to
* reassert the event pending bit if needed. For now just call
@@ -1079,7 +1110,6 @@
* activation and restart the handler using the previous one.
*/
ENTRY(hypervisor_callback)
-IDTVEC(hypervisor_pvhvm_callback)
pushl $0 /* dummy error code */
pushl $T_ASTFLT
INTRENTRY
@@ -1140,9 +1170,20 @@
loop 15b
16: movl %edi,%esp /* final %edi is top of merged stack */
jmp 11b
-IDTVEC_END(hypervisor_pvhvm_callback)
END(hypervisor_callback)
+IDTVEC(hypervisor_pvhvm_callback)
+ pushl $0 /* dummy error code */
+ pushl $T_ASTFLT
+ INTRENTRY
+ push %esp
+ call do_hypervisor_callback
+ add $4,%esp
+ push CPUVAR(ILEVEL)
+ IDEPTH_INCR
+ cli
+ jmp _C_LABEL(Xdoreti)
+IDTVEC_END(hypervisor_pvhvm_callback)
#endif /* XEN */
#ifdef XENPV
/*
diff -r 94694c595a98 -r a9ae918eaf03 sys/arch/x86/include/intr.h
--- a/sys/arch/x86/include/intr.h Fri Apr 10 14:38:19 2020 +0000
+++ b/sys/arch/x86/include/intr.h Fri Apr 10 14:41:59 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.61 2019/12/22 15:09:39 thorpej Exp $ */
+/* $NetBSD: intr.h,v 1.61.6.1 2020/04/10 14:42:00 bouyer Exp $ */
/*-
* Copyright (c) 1998, 2001, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -32,12 +32,12 @@
#ifndef _X86_INTR_H_
#define _X86_INTR_H_
-#if !defined(XEN)
+#if !defined(XENPV)
#define __HAVE_FAST_SOFTINTS
#if !defined(NO_PREEMPTION)
#define __HAVE_PREEMPTION
#endif /* !defined(NO_PREEMPTION) */
-#endif /* !defined(XEN) */
+#endif /* !defined(XENPV) */
#ifdef _KERNEL
#include <sys/types.h>
Home |
Main Index |
Thread Index |
Old Index