[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-4.1-testing] x86/HPET: obtain proper lock for changing IRQ affinity
# HG changeset patch # User Jan Beulich <jbeulich@xxxxxxxx> # Date 1351497797 -3600 # Node ID 59ac9035595e6923a4e7653fd84b8c0887066ea3 # Parent 2cdf9b7338018f3d4ce8125d01564ff5587c7241 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@xxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> xen-unstable changeset: 26063:1f4be6ee4619 xen-unstable date: Wed Oct 17 12:13:20 UTC 2012 --- diff -r 2cdf9b733801 -r 59ac9035595e xen/arch/x86/hpet.c --- a/xen/arch/x86/hpet.c Mon Oct 29 09:02:33 2012 +0100 +++ b/xen/arch/x86/hpet.c Mon Oct 29 09:03:17 2012 +0100 @@ -493,6 +493,16 @@ static struct hpet_event_channel *hpet_g 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); + desc->handler->set_affinity(ch->irq, cpumask_of_cpu(ch->cpu)); + spin_unlock(&desc->lock); +} + static void hpet_attach_channel(int cpu, struct hpet_event_channel *ch) { ASSERT(spin_is_locked(&ch->lock)); @@ -506,9 +516,7 @@ static void hpet_attach_channel(int cpu, if ( ch->cpu != cpu ) return; - /* set irq affinity */ - irq_desc[ch->irq].handler-> - set_affinity(ch->irq, cpumask_of_cpu(ch->cpu)); + set_channel_irq_affinity(ch); } static void hpet_detach_channel(int cpu, struct hpet_event_channel *ch) @@ -529,9 +537,7 @@ static void hpet_detach_channel(int cpu, } ch->cpu = first_cpu(ch->cpumask); - /* set irq affinity */ - irq_desc[ch->irq].handler-> - set_affinity(ch->irq, cpumask_of_cpu(ch->cpu)); + set_channel_irq_affinity(ch); } #include <asm/mc146818rtc.h> _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |