Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xen VIRQ_TIMER virqs are allocated and tracked ...



details:   https://anonhg.NetBSD.org/src/rev/8717eace408f
branches:  trunk
changeset: 768913:8717eace408f
user:      jym <jym%NetBSD.org@localhost>
date:      Sun Aug 28 22:55:52 2011 +0000

description:
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.

diffstat:

 sys/arch/xen/xen/evtchn.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r 6804d4a0b066 -r 8717eace408f sys/arch/xen/xen/evtchn.c
--- a/sys/arch/xen/xen/evtchn.c Sun Aug 28 22:36:17 2011 +0000
+++ b/sys/arch/xen/xen/evtchn.c Sun Aug 28 22:55:52 2011 +0000
@@ -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;
        }
 



Home | Main Index | Thread Index | Old Index