# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1189428784 -3600
# Node ID 42d2c2ce9b1440adc53467b1f3095671f6b9f37d
# Parent 81a8206f58c7d92ed271e3e8b337c0884e7e3423
Fix evtchn rebind.
rebind_irq_to_cpu needs to mask evtchn before bind, which should
be same as what evtchn_rebind_cpu does today. Or else cpu_disable
fails at fixup_irqs.
Signed-off-by: Kevin Tian <kevin.tian@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
drivers/xen/core/evtchn.c | 50 ++++++++++++++++++++++----------------------
drivers/xen/evtchn/evtchn.c | 16 +-------------
include/xen/evtchn.h | 4 +--
3 files changed, 30 insertions(+), 40 deletions(-)
diff -r 81a8206f58c7 -r 42d2c2ce9b14 drivers/xen/core/evtchn.c
--- a/drivers/xen/core/evtchn.c Mon Sep 10 13:35:33 2007 +0100
+++ b/drivers/xen/core/evtchn.c Mon Sep 10 13:53:04 2007 +0100
@@ -125,7 +125,7 @@ static inline unsigned long active_evtch
~sh->evtchn_mask[idx]);
}
-void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
+static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
{
shared_info_t *s = HYPERVISOR_shared_info;
int irq = evtchn_to_irq[chn];
@@ -163,6 +163,10 @@ static inline unsigned long active_evtch
unsigned int idx)
{
return (sh->evtchn_pending[idx] & ~sh->evtchn_mask[idx]);
+}
+
+static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
+{
}
static void init_evtchn_cpu_bindings(void)
@@ -588,29 +592,27 @@ EXPORT_SYMBOL_GPL(unbind_from_irqhandler
EXPORT_SYMBOL_GPL(unbind_from_irqhandler);
#ifdef CONFIG_SMP
-/* Rebind an evtchn so that it gets delivered to a specific cpu */
-static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
-{
- struct evtchn_bind_vcpu bind_vcpu;
- int evtchn = evtchn_from_irq(irq);
-
- if (!VALID_EVTCHN(evtchn))
- return;
-
- /* Send future instances of this interrupt to other vcpu. */
- bind_vcpu.port = evtchn;
- bind_vcpu.vcpu = tcpu;
-
- /*
- * If this fails, it usually just indicates that we're dealing with a
- * virq or IPI channel, which don't actually need to be rebound. Ignore
- * it, but don't do the xenlinux-level rebind in that case.
- */
- if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu) == 0)
- bind_evtchn_to_cpu(evtchn, tcpu);
-}
-
-static void set_affinity_irq(unsigned irq, cpumask_t dest)
+void rebind_evtchn_to_cpu(int port, unsigned int cpu)
+{
+ struct evtchn_bind_vcpu ebv = { .port = port, .vcpu = cpu };
+ int masked;
+
+ masked = test_and_set_evtchn_mask(port);
+ if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &ebv) == 0)
+ bind_evtchn_to_cpu(port, cpu);
+ if (!masked)
+ unmask_evtchn(port);
+}
+
+static void rebind_irq_to_cpu(unsigned int irq, unsigned int tcpu)
+{
+ int evtchn = evtchn_from_irq(irq);
+
+ if (VALID_EVTCHN(evtchn))
+ rebind_evtchn_to_cpu(evtchn, tcpu);
+}
+
+static void set_affinity_irq(unsigned int irq, cpumask_t dest)
{
unsigned tcpu = first_cpu(dest);
rebind_irq_to_cpu(irq, tcpu);
diff -r 81a8206f58c7 -r 42d2c2ce9b14 drivers/xen/evtchn/evtchn.c
--- a/drivers/xen/evtchn/evtchn.c Mon Sep 10 13:35:33 2007 +0100
+++ b/drivers/xen/evtchn/evtchn.c Mon Sep 10 13:53:04 2007 +0100
@@ -96,18 +96,6 @@ void evtchn_device_upcall(int port)
spin_unlock(&port_user_lock);
}
-static void evtchn_rebind_cpu(evtchn_port_t port, unsigned int cpu)
-{
- struct evtchn_bind_vcpu ebv = { .port = port, .vcpu = cpu };
- int masked;
-
- masked = test_and_set_evtchn_mask(port);
- if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &ebv) == 0)
- bind_evtchn_to_cpu(port, cpu);
- if (!masked)
- unmask_evtchn(port);
-}
-
static void evtchn_check_wrong_delivery(struct per_user_data *u)
{
evtchn_port_t port;
@@ -127,7 +115,7 @@ static void evtchn_check_wrong_delivery(
for (port = 0; port < NR_EVENT_CHANNELS; port++)
if (port_user[port] == u)
- evtchn_rebind_cpu(port, current_cpu);
+ rebind_evtchn_to_cpu(port, current_cpu);
u->bind_cpu = current_cpu;
u->nr_event_wrong_delivery = 0;
@@ -258,7 +246,7 @@ static void evtchn_bind_to_user(struct p
u->bind_cpu = bind_cpu;
}
- evtchn_rebind_cpu(port, u->bind_cpu);
+ rebind_evtchn_to_cpu(port, u->bind_cpu);
unmask_evtchn(port);
diff -r 81a8206f58c7 -r 42d2c2ce9b14 include/xen/evtchn.h
--- a/include/xen/evtchn.h Mon Sep 10 13:35:33 2007 +0100
+++ b/include/xen/evtchn.h Mon Sep 10 13:53:04 2007 +0100
@@ -105,9 +105,9 @@ void unmask_evtchn(int port);
void unmask_evtchn(int port);
#ifdef CONFIG_SMP
-void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu);
+void rebind_evtchn_to_cpu(int port, unsigned int cpu);
#else
-#define bind_evtchn_to_cpu(chn, cpu) ((void)0)
+#define rebind_evtchn_to_cpu(port, cpu) ((void)0)
#endif
static inline int test_and_set_evtchn_mask(int port)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|