summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbouyer <bouyer@NetBSD.org>2007-12-12 22:16:32 +0000
committerbouyer <bouyer@NetBSD.org>2007-12-12 22:16:32 +0000
commite2b280eabb9be125c38eb015f739b0e206bf2a3c (patch)
tree9d85cd7f8546fdc97da73fa097fc2a1776926b1d
parentfc10f67856b2c58177ae6972c6e125d7b3829163 (diff)
cleanup the debug event handler to not use the IPL system at all. Fix
debug event storm on XEN2.
-rw-r--r--sys/arch/xen/include/evtchn.h5
-rw-r--r--sys/arch/xen/x86/hypervisor_machdep.c9
-rw-r--r--sys/arch/xen/xen/evtchn.c29
3 files changed, 22 insertions, 21 deletions
diff --git a/sys/arch/xen/include/evtchn.h b/sys/arch/xen/include/evtchn.h
index 686539f6287..11adb6400c0 100644
--- a/sys/arch/xen/include/evtchn.h
+++ b/sys/arch/xen/include/evtchn.h
@@ -1,4 +1,4 @@
-/* $NetBSD: evtchn.h,v 1.13 2006/12/08 15:05:18 yamt Exp $ */
+/* $NetBSD: evtchn.h,v 1.14 2007/12/12 22:16:32 bouyer Exp $ */
/*
*
@@ -45,6 +45,9 @@ void call_evtchn_do_event(int, struct intrframe *);
int event_set_handler(int, int (*func)(void *), void *, int, const char *);
int event_remove_handler(int, int (*func)(void *), void *);
+extern int debug_port;
+extern int xen_debug_handler(void *);
+
int bind_virq_to_evtch(int);
int bind_pirq_to_evtch(int);
void unbind_pirq_from_evtch(int);
diff --git a/sys/arch/xen/x86/hypervisor_machdep.c b/sys/arch/xen/x86/hypervisor_machdep.c
index a6b687e3e37..8111ed709d1 100644
--- a/sys/arch/xen/x86/hypervisor_machdep.c
+++ b/sys/arch/xen/x86/hypervisor_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor_machdep.c,v 1.2 2007/11/22 16:17:03 bouyer Exp $ */
+/* $NetBSD: hypervisor_machdep.c,v 1.3 2007/12/12 22:16:32 bouyer Exp $ */
/*
*
@@ -59,7 +59,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.2 2007/11/22 16:17:03 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.3 2007/12/12 22:16:32 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -74,11 +74,6 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.2 2007/11/22 16:17:03 bouye
// #define PORT_DEBUG 4
// #define EARLY_DEBUG_EVENT
-#ifdef EARLY_DEBUG_EVENT
-extern int debug_port;
-extern int xen_debug_handler(void *);
-#endif
-
int stipending(void);
int
stipending()
diff --git a/sys/arch/xen/xen/evtchn.c b/sys/arch/xen/xen/evtchn.c
index 0b76c00a8bf..658a7e3a8ca 100644
--- a/sys/arch/xen/xen/evtchn.c
+++ b/sys/arch/xen/xen/evtchn.c
@@ -1,4 +1,4 @@
-/* $NetBSD: evtchn.c,v 1.25 2007/12/03 15:34:29 ad Exp $ */
+/* $NetBSD: evtchn.c,v 1.26 2007/12/12 22:16:32 bouyer Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -64,7 +64,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.25 2007/12/03 15:34:29 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.26 2007/12/12 22:16:32 bouyer Exp $");
#include "opt_xen.h"
#include "isa.h"
@@ -117,7 +117,6 @@ physdev_op_t physdev_op_notify = {
#endif
int debug_port;
-int xen_debug_handler(void *);
#ifndef XEN3
static int xen_misdirect_handler(void *);
#endif
@@ -153,15 +152,12 @@ events_default_setup()
void
init_events()
{
+#ifndef XEN3
int evtch;
- evtch = bind_virq_to_evtch(VIRQ_DEBUG);
- aprint_verbose("debug virtual interrupt using event channel %d\n",
- evtch);
- event_set_handler(evtch, &xen_debug_handler, NULL, IPL_HIGH,
- "debugev");
- hypervisor_enable_event(evtch);
-#ifndef XEN3
+ /* no debug port, it doesn't work any more for some reason ... */
+ debug_port = -1;
+
evtch = bind_virq_to_evtch(VIRQ_MISDIRECT);
aprint_verbose("misdirect virtual interrupt using event channel %d\n",
evtch);
@@ -173,6 +169,16 @@ init_events()
* alive. */
ctrl_if_init();
#endif
+ debug_port = bind_virq_to_evtch(VIRQ_DEBUG);
+ aprint_verbose("debug virtual interrupt using event channel %d\n",
+ debug_port);
+ /*
+ * Don't call event_set_handler(), we'll use a shortcut. Just set
+ * evtsource[] to a non-NULL value so that evtchn_do_event will
+ * be called.
+ */
+ evtsource[debug_port] = (void *)-1;
+ hypervisor_enable_event(debug_port);
x86_enable_intr(); /* at long last... */
}
@@ -204,7 +210,6 @@ evtchn_do_event(int evtch, struct intrframe *regs)
* Shortcut for the debug handler, we want it to always run,
* regardless of the IPL level.
*/
-
if (evtch == debug_port) {
xen_debug_handler(NULL);
hypervisor_enable_event(evtch);
@@ -288,8 +293,6 @@ bind_virq_to_evtch(int virq)
if (HYPERVISOR_event_channel_op(&op) != 0)
panic("Failed to bind virtual IRQ %d\n", virq);
evtchn = op.u.bind_virq.port;
- if (virq == VIRQ_DEBUG)
- debug_port = evtchn;
virq_to_evtch[virq] = evtchn;
}