Commit f4f51050 authored by Avi Kivity's avatar Avi Kivity

KVM: Convert PIC lock from raw spinlock to ordinary spinlock

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: default avatarAvi Kivity <avi@redhat.com>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 28e4639a
...@@ -39,7 +39,7 @@ static void pic_irq_request(struct kvm *kvm, int level); ...@@ -39,7 +39,7 @@ static void pic_irq_request(struct kvm *kvm, int level);
static void pic_lock(struct kvm_pic *s) static void pic_lock(struct kvm_pic *s)
__acquires(&s->lock) __acquires(&s->lock)
{ {
raw_spin_lock(&s->lock); spin_lock(&s->lock);
} }
static void pic_unlock(struct kvm_pic *s) static void pic_unlock(struct kvm_pic *s)
...@@ -51,7 +51,7 @@ static void pic_unlock(struct kvm_pic *s) ...@@ -51,7 +51,7 @@ static void pic_unlock(struct kvm_pic *s)
s->wakeup_needed = false; s->wakeup_needed = false;
raw_spin_unlock(&s->lock); spin_unlock(&s->lock);
if (wakeup) { if (wakeup) {
kvm_for_each_vcpu(i, vcpu, s->kvm) { kvm_for_each_vcpu(i, vcpu, s->kvm) {
...@@ -569,7 +569,7 @@ struct kvm_pic *kvm_create_pic(struct kvm *kvm) ...@@ -569,7 +569,7 @@ struct kvm_pic *kvm_create_pic(struct kvm *kvm)
s = kzalloc(sizeof(struct kvm_pic), GFP_KERNEL); s = kzalloc(sizeof(struct kvm_pic), GFP_KERNEL);
if (!s) if (!s)
return NULL; return NULL;
raw_spin_lock_init(&s->lock); spin_lock_init(&s->lock);
s->kvm = kvm; s->kvm = kvm;
s->pics[0].elcr_mask = 0xf8; s->pics[0].elcr_mask = 0xf8;
s->pics[1].elcr_mask = 0xde; s->pics[1].elcr_mask = 0xde;
......
...@@ -60,7 +60,7 @@ struct kvm_kpic_state { ...@@ -60,7 +60,7 @@ struct kvm_kpic_state {
}; };
struct kvm_pic { struct kvm_pic {
raw_spinlock_t lock; spinlock_t lock;
bool wakeup_needed; bool wakeup_needed;
unsigned pending_acks; unsigned pending_acks;
struct kvm *kvm; struct kvm *kvm;
......
...@@ -3011,18 +3011,18 @@ static int kvm_vm_ioctl_set_irqchip(struct kvm *kvm, struct kvm_irqchip *chip) ...@@ -3011,18 +3011,18 @@ static int kvm_vm_ioctl_set_irqchip(struct kvm *kvm, struct kvm_irqchip *chip)
r = 0; r = 0;
switch (chip->chip_id) { switch (chip->chip_id) {
case KVM_IRQCHIP_PIC_MASTER: case KVM_IRQCHIP_PIC_MASTER:
raw_spin_lock(&pic_irqchip(kvm)->lock); spin_lock(&pic_irqchip(kvm)->lock);
memcpy(&pic_irqchip(kvm)->pics[0], memcpy(&pic_irqchip(kvm)->pics[0],
&chip->chip.pic, &chip->chip.pic,
sizeof(struct kvm_pic_state)); sizeof(struct kvm_pic_state));
raw_spin_unlock(&pic_irqchip(kvm)->lock); spin_unlock(&pic_irqchip(kvm)->lock);
break; break;
case KVM_IRQCHIP_PIC_SLAVE: case KVM_IRQCHIP_PIC_SLAVE:
raw_spin_lock(&pic_irqchip(kvm)->lock); spin_lock(&pic_irqchip(kvm)->lock);
memcpy(&pic_irqchip(kvm)->pics[1], memcpy(&pic_irqchip(kvm)->pics[1],
&chip->chip.pic, &chip->chip.pic,
sizeof(struct kvm_pic_state)); sizeof(struct kvm_pic_state));
raw_spin_unlock(&pic_irqchip(kvm)->lock); spin_unlock(&pic_irqchip(kvm)->lock);
break; break;
case KVM_IRQCHIP_IOAPIC: case KVM_IRQCHIP_IOAPIC:
r = kvm_set_ioapic(kvm, &chip->chip.ioapic); r = kvm_set_ioapic(kvm, &chip->chip.ioapic);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment