aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/io_apic.c
diff options
context:
space:
mode:
authorGeorge Dunlap <george.dunlap@eu.citrix.com>2011-08-22 16:15:33 +0100
committerGeorge Dunlap <george.dunlap@eu.citrix.com>2011-08-22 16:15:33 +0100
commit45627433b2c0eec655bef8d02a48f75bc9b80fc2 (patch)
treebaca59da6a10167cffa3b95dce47633954ea3aba /xen/arch/x86/io_apic.c
parent1ded71e27c5ca61935734eadcd79e722cdf99732 (diff)
downloadxen-45627433b2c0eec655bef8d02a48f75bc9b80fc2.tar.gz
xen-45627433b2c0eec655bef8d02a48f75bc9b80fc2.tar.bz2
xen-45627433b2c0eec655bef8d02a48f75bc9b80fc2.zip
x86: Fix up irq vector map logic
We need to make sure that cfg->used_vector is only cleared once; otherwise there may be a race condition that allows the same vector to be assigned twice, defeating the whole purpose of the map. This makes two changes: * __clear_irq_vector() only clears the vector if the irq is not being moved * smp_iqr_move_cleanup_interrupt() only clears used_vector if this is the last place it's being used (move_cleanup_count==0 after decrement). Also make use of asserts more consistent, to catch this kind of logic bug in the future. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Diffstat (limited to 'xen/arch/x86/io_apic.c')
-rw-r--r--xen/arch/x86/io_apic.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index f9565df58b..dd45ff414e 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -485,12 +485,14 @@ fastcall void smp_irq_move_cleanup_interrupt(struct cpu_user_regs *regs)
irq, vector, smp_processor_id());
__get_cpu_var(vector_irq)[vector] = -1;
- if ( cfg->used_vectors )
+ cfg->move_cleanup_count--;
+
+ if ( cfg->move_cleanup_count == 0
+ && cfg->used_vectors )
{
ASSERT(test_bit(vector, cfg->used_vectors));
clear_bit(vector, cfg->used_vectors);
}
- cfg->move_cleanup_count--;
unlock:
spin_unlock(&desc->lock);
}