Module Name:    src
Committed By:   riastradh
Date:           Sat Nov 11 08:23:50 UTC 2017

Modified Files:
        src/sys/arch/xen/xen: evtchn.c

Log Message:
Add kasserts to help diagnose xen interrupt level bug.

https://mail-index.netbsd.org/tech-kern/2017/11/09/msg022571.html


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 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/xen/evtchn.c
diff -u src/sys/arch/xen/xen/evtchn.c:1.76 src/sys/arch/xen/xen/evtchn.c:1.77
--- src/sys/arch/xen/xen/evtchn.c:1.76	Sat Nov 11 08:22:08 2017
+++ src/sys/arch/xen/xen/evtchn.c	Sat Nov 11 08:23:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.c,v 1.76 2017/11/11 08:22:08 riastradh Exp $	*/
+/*	$NetBSD: evtchn.c,v 1.77 2017/11/11 08:23:50 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.76 2017/11/11 08:22:08 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.77 2017/11/11 08:23:50 riastradh Exp $");
 
 #include "opt_xen.h"
 #include "isa.h"
@@ -386,6 +386,11 @@ evtchn_do_event(int evtch, struct intrfr
 		ci->ci_ilevel = ih->ih_level;
 		ih_fun = (void *)ih->ih_fun;
 		ih_fun(ih->ih_arg, regs);
+		KASSERTMSG(ci->ci_ilevel == ih->ih_level,
+		    "event handler %p for evtsource[%d] (%s) changed ipl:"
+		    " %d != %d",
+		    ih->ih_realfun, evtch, evtsource[evtch]->ev_evname,
+		    ci->ci_ilevel, ih->ih_level);
 		ih = ih->ih_evt_next;
 	}
 	mutex_spin_exit(&evtlock[evtch]);
@@ -410,6 +415,13 @@ splx:
 					sti();
 					ih_fun = (void *)ih->ih_fun;
 					ih_fun(ih->ih_arg, regs);
+					KASSERTMSG(ci->ci_ilevel == i,
+					    "interrupt handler %p"
+					    " for interrupt source %s"
+					    " changed ipl: %d != %d",
+					    ih->ih_realfun,
+					    ci->ci_isources[i]->is_xname,
+					    ci->ci_ilevel, i);
 					cli();
 				}
 				hypervisor_enable_ipl(i);

Reply via email to