Skip to contentSkip to conversation

KVM: read apic->irr with ioapic lock held

PATCH Marcelo Tosatti 2 participants 2 messages Jun 2, 2010 KVM

lore
Share & tools
lore
#0 lore raw

Read ioapic->irr inside ioapic->lock protected section.

KVM-Stable-Tag

virt/kvm/ioapic.c +2 -1
index 3bc4fdb..1149c60 100644
@@ -193,12 +193,13 @@ static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
 
 int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level)
 {
-	u32 old_irr = ioapic->irr;
+	u32 old_irr;
 	u32 mask = 1 << irq;
 	union kvm_ioapic_redirect_entry entry;
 	int ret = 1;
 
 	spin_lock(&ioapic->lock);
+	old_irr = ioapic->irr;
 	if (irq >= 0 && irq < IOAPIC_NUM_PINS) {
 		entry = ioapic->redirtbl[irq];
 		level ^= entry.fields.polarity;
#1 lore raw
Quoted 15 lines · Marcelo Tosatti

Read ioapic->irr inside ioapic->lock protected section.

KVM-Stable-Tag

virt/kvm/ioapic.c +0 -1
index 3bc4fdb..1149c60 100644
@@ -193,12 +193,13 @@ static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
 
  int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level)
  {
-	u32 old_irr = ioapic->irr;

virt/kvm/ioapic.c static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq) · line 205

Quoted 10 lines
virt/kvm/ioapic.c +2 -0
+	u32 old_irr;
  	u32 mask = 1<<  irq;
  	union kvm_ioapic_redirect_entry entry;
  	int ret = 1;
 
  	spin_lock(&ioapic->lock);
+	old_irr = ioapic->irr;
  	if (irq>= 0&&  irq<  IOAPIC_NUM_PINS) {
  		entry = ioapic->redirtbl[irq];
  		level ^= entry.fields.polarity;

Yikes.

Signature · 1 line
error compiling committee.c: too many arguments to function