[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150730033208.GC15229@google.com>
Date: Wed, 29 Jul 2015 20:32:08 -0700
From: Steve Rutherford <srutherford@...gle.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
mtosatti@...hat.com, rkrcmar@...hat.com
Subject: Re: [PATCH 4/4] KVM: x86: clean/fix memory barriers in
irqchip_in_kernel
On Wed, Jul 29, 2015 at 03:28:58PM +0200, Paolo Bonzini wrote:
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 2d62229aac26..23e47a0b054b 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3626,30 +3626,25 @@ long kvm_arch_vm_ioctl(struct file *filp,
> r = kvm_ioapic_init(kvm);
> if (r) {
> mutex_lock(&kvm->slots_lock);
> - kvm_io_bus_unregister_dev(kvm, KVM_PIO_BUS,
> - &vpic->dev_master);
> - kvm_io_bus_unregister_dev(kvm, KVM_PIO_BUS,
> - &vpic->dev_slave);
> - kvm_io_bus_unregister_dev(kvm, KVM_PIO_BUS,
> - &vpic->dev_eclr);
> + kvm_destroy_pic(vpic);
> mutex_unlock(&kvm->slots_lock);
> - kfree(vpic);
> goto create_irqchip_unlock;
> }
> } else
> goto create_irqchip_unlock;
> - smp_wmb();
> - kvm->arch.vpic = vpic;
> - smp_wmb();
> r = kvm_setup_default_irq_routing(kvm);
> if (r) {
> mutex_lock(&kvm->slots_lock);
> mutex_lock(&kvm->irq_lock);
> kvm_ioapic_destroy(kvm);
> - kvm_destroy_pic(kvm);
> + kvm_destroy_pic(vpic);
> mutex_unlock(&kvm->irq_lock);
> mutex_unlock(&kvm->slots_lock);
> + goto create_irqchip_unlock;
> }
> + /* Write kvm->irq_routing before kvm->arch.vpic. */
> + smp_wmb();
I assume this pairs with irqchip_in_kernel?
> + kvm->arch.vpic = vpic;
> create_irqchip_unlock:
> mutex_unlock(&kvm->lock);
> break;
> --
> 1.8.3.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists