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 hypervisor_set_ipending() should not set th...
details: https://anonhg.NetBSD.org/src/rev/60b40feb9efa
branches: trunk
changeset: 782885:60b40feb9efa
user: cherry <cherry%NetBSD.org@localhost>
date: Sun Nov 25 07:48:46 2012 +0000
description:
hypervisor_set_ipending() should not set the pending flag across cpus. The reason for this is that the pending flag update is not atomic, or protected by a lock. Since its current (mis)use in
evtchn_do_event() across cpus is to notify the remote cpu of an interrupt, we use hypervisor_send_event() instead, to trigger an event on the remote cpu, which in turn invokes evtchn_do_event() on
that cpu and DTRT on it.
On the local cpu, we protect hypervisor_set_ipending() from re-entry via cli(). Remove a redundant and unprotected call to hypervisor_set_ipending().
Thanks to jym@ for spotting this discrepancy while reviewing a related patch.
See: http://mail-index.netbsd.org/tech-kern/2012/11/12/msg014374.html
diffstat:
sys/arch/xen/xen/evtchn.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diffs (35 lines):
diff -r 9dce8425b191 -r 60b40feb9efa sys/arch/xen/xen/evtchn.c
--- a/sys/arch/xen/xen/evtchn.c Sun Nov 25 04:06:59 2012 +0000
+++ b/sys/arch/xen/xen/evtchn.c Sun Nov 25 07:48:46 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: evtchn.c,v 1.62 2012/02/12 14:24:08 jym Exp $ */
+/* $NetBSD: evtchn.c,v 1.63 2012/11/25 07:48:46 cherry Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.62 2012/02/12 14:24:08 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.63 2012/11/25 07:48:46 cherry Exp $");
#include "opt_xen.h"
#include "isa.h"
@@ -298,15 +298,12 @@
ih = evtsource[evtch]->ev_handlers;
while (ih != NULL) {
if (ih->ih_cpu != ci) {
- hypervisor_set_ipending(ih->ih_cpu, 1 << ih->ih_level,
- evtch >> LONG_SHIFT, evtch & LONG_MASK);
+ hypervisor_send_event(ih->ih_cpu, evtch);
iplmask &= ~IUNMASK(ci, ih->ih_level);
ih = ih->ih_evt_next;
continue;
}
if (ih->ih_level <= ilevel) {
- hypervisor_set_ipending(ih->ih_cpu, iplmask,
- evtch >> LONG_SHIFT, evtch & LONG_MASK);
#ifdef IRQ_DEBUG
if (evtch == IRQ_DEBUG)
printf("ih->ih_level %d <= ilevel %d\n", ih->ih_level, ilevel);
Home |
Main Index |
Thread Index |
Old Index