Module Name:    src
Committed By:   jym
Date:           Sun Aug 28 22:55:52 UTC 2011

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

Log Message:
VIRQ_TIMER virqs are allocated and tracked in a array
(virq_timer_to_evtch, indexed by cpuid) different from the
VIRQ <> event channel one (virq_to_evtch, indexed by event channel ID).

This is fine: fix a "harmless" bug that resulted in the event
channel of VIRQ_TIMER getting lost during bind as it was not stored
in the proper array.

"Harmless" because it is not critical for -current, however in the Xen
save/restore branch this completely cripples restore. Xen clock gets
suspended, but never comes back (fetched channel ID being invalid). Oops.

Add a small comment so we can better see the "get => allocate? => set"
chain of actions when binding/unbinding event channels.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 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.52 src/sys/arch/xen/xen/evtchn.c:1.53
--- src/sys/arch/xen/xen/evtchn.c:1.52	Sun Aug 28 22:36:17 2011
+++ src/sys/arch/xen/xen/evtchn.c	Sun Aug 28 22:55:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.c,v 1.52 2011/08/28 22:36:17 jym Exp $	*/
+/*	$NetBSD: evtchn.c,v 1.53 2011/08/28 22:55:52 jym Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.52 2011/08/28 22:36:17 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.53 2011/08/28 22:55:52 jym Exp $");
 
 #include "opt_xen.h"
 #include "isa.h"
@@ -379,6 +379,7 @@
 		return -1;
 	}
 
+	/* Get event channel from VIRQ */
 	if (virq == VIRQ_TIMER) {
 		evtchn = virq_timer_to_evtch[ci->ci_cpuid];
 	} else {
@@ -393,7 +394,12 @@
 		if (HYPERVISOR_event_channel_op(&op) != 0)
 			panic("Failed to bind virtual IRQ %d\n", virq);
 		evtchn = op.u.bind_virq.port;
+	}
 
+	/* Set event channel */
+	if (virq == VIRQ_TIMER) {
+		virq_timer_to_evtch[ci->ci_cpuid] = evtchn;
+	} else {
 		virq_to_evtch[virq] = evtchn;
 	}
 

Reply via email to