KVM: Convert PIC lock from raw spinlock to ordinary spinlock
authorAvi Kivity <avi@redhat.com>
Sun, 19 Sep 2010 16:44:07 +0000 (18:44 +0200)
committerAvi Kivity <avi@redhat.com>
Sun, 24 Oct 2010 08:52:56 +0000 (10:52 +0200)
The PIC code used to be called from preempt_disable() context, which
wasn't very good for PREEMPT_RT.  That is no longer the case, so move
back from raw_spinlock_t to spinlock_t.

Signed-off-by: Avi Kivity <avi@redhat.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/i8259.c
arch/x86/kvm/irq.h
arch/x86/kvm/x86.c

index ab1bb8ff9a8d94d79a16d1553ba2c546cd4b21d7..dd54c5bb2e5eecaf6c8ace09c5f6010554cc7712 100644 (file)
@@ -39,7 +39,7 @@ static void pic_irq_request(struct kvm *kvm, int level);
 static void pic_lock(struct kvm_pic *s)
        __acquires(&s->lock)
 {
-       raw_spin_lock(&s->lock);
+       spin_lock(&s->lock);
 }
 
 static void pic_unlock(struct kvm_pic *s)
@@ -51,7 +51,7 @@ static void pic_unlock(struct kvm_pic *s)
 
        s->wakeup_needed = false;
 
-       raw_spin_unlock(&s->lock);
+       spin_unlock(&s->lock);
 
        if (wakeup) {
                kvm_for_each_vcpu(i, vcpu, s->kvm) {
@@ -569,7 +569,7 @@ struct kvm_pic *kvm_create_pic(struct kvm *kvm)
        s = kzalloc(sizeof(struct kvm_pic), GFP_KERNEL);
        if (!s)
                return NULL;
-       raw_spin_lock_init(&s->lock);
+       spin_lock_init(&s->lock);
        s->kvm = kvm;
        s->pics[0].elcr_mask = 0xf8;
        s->pics[1].elcr_mask = 0xde;
index 63c314502993b33c1a53773d111eb69133668179..ba910d1494100fe439d86da0289e1f7a51d71533 100644 (file)
@@ -60,7 +60,7 @@ struct kvm_kpic_state {
 };
 
 struct kvm_pic {
-       raw_spinlock_t lock;
+       spinlock_t lock;
        bool wakeup_needed;
        unsigned pending_acks;
        struct kvm *kvm;
index 0b021e16f9dd9a2ee17619c397b8ff0cda5ea03c..3adf6921e88e04405862b89c952c22a84dfbd58a 100644 (file)
@@ -3011,18 +3011,18 @@ static int kvm_vm_ioctl_set_irqchip(struct kvm *kvm, struct kvm_irqchip *chip)
        r = 0;
        switch (chip->chip_id) {
        case KVM_IRQCHIP_PIC_MASTER:
-               raw_spin_lock(&pic_irqchip(kvm)->lock);
+               spin_lock(&pic_irqchip(kvm)->lock);
                memcpy(&pic_irqchip(kvm)->pics[0],
                        &chip->chip.pic,
                        sizeof(struct kvm_pic_state));
-               raw_spin_unlock(&pic_irqchip(kvm)->lock);
+               spin_unlock(&pic_irqchip(kvm)->lock);
                break;
        case KVM_IRQCHIP_PIC_SLAVE:
-               raw_spin_lock(&pic_irqchip(kvm)->lock);
+               spin_lock(&pic_irqchip(kvm)->lock);
                memcpy(&pic_irqchip(kvm)->pics[1],
                        &chip->chip.pic,
                        sizeof(struct kvm_pic_state));
-               raw_spin_unlock(&pic_irqchip(kvm)->lock);
+               spin_unlock(&pic_irqchip(kvm)->lock);
                break;
        case KVM_IRQCHIP_IOAPIC:
                r = kvm_set_ioapic(kvm, &chip->chip.ioapic);