diff options
author | Jan Beulich <jbeulich@suse.com> | 2012-10-25 15:24:23 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2012-10-25 15:24:23 +0200 |
commit | 43ae74cf38cdfe477a9ca2d915d5255026162af6 (patch) | |
tree | 153409deb331114cce1f88ded77f639336de6c1f | |
parent | 48857ea790e53e6d118de72204b12fcacceabd9a (diff) | |
download | xen-43ae74cf38cdfe477a9ca2d915d5255026162af6.tar.gz xen-43ae74cf38cdfe477a9ca2d915d5255026162af6.tar.bz2 xen-43ae74cf38cdfe477a9ca2d915d5255026162af6.zip |
x86/HPET: obtain proper lock for changing IRQ affinity
The IRQ descriptor lock should be held while adjusting the affinity of
any IRQ; the HPET channel lock isn't sufficient to protect namely
against races with moving the IRQ to a different CPU.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 26063:1f4be6ee4619
xen-unstable date: Wed Oct 17 12:13:20 UTC 2012
-rw-r--r-- | xen/arch/x86/hpet.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c index 11819e2dd3..7c7866f96e 100644 --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -433,6 +433,16 @@ static struct hpet_event_channel *hpet_get_channel(unsigned int cpu) return ch; } +static void set_channel_irq_affinity(const struct hpet_event_channel *ch) +{ + struct irq_desc *desc = irq_to_desc(ch->irq); + + ASSERT(!local_irq_is_enabled()); + spin_lock(&desc->lock); + hpet_msi_set_affinity(desc, cpumask_of(ch->cpu)); + spin_unlock(&desc->lock); +} + static void hpet_attach_channel(unsigned int cpu, struct hpet_event_channel *ch) { @@ -447,7 +457,7 @@ static void hpet_attach_channel(unsigned int cpu, if ( ch->cpu != cpu ) return; - hpet_msi_set_affinity(irq_to_desc(ch->irq), cpumask_of(ch->cpu)); + set_channel_irq_affinity(ch); } static void hpet_detach_channel(unsigned int cpu, @@ -469,7 +479,7 @@ static void hpet_detach_channel(unsigned int cpu, } ch->cpu = cpumask_first(ch->cpumask); - hpet_msi_set_affinity(irq_to_desc(ch->irq), cpumask_of(ch->cpu)); + set_channel_irq_affinity(ch); } #include <asm/mc146818rtc.h> |