Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1195701

Re: [PATCH 4/4] KVM: x86: clean/fix memory barriers in irqchip_in_kernel

From Steve Rutherford <srutherford@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4/4] KVM: x86: clean/fix memory barriers in irqchip_in_kernel
Date 2015-07-30 05:40 +0200
Message-ID <pRMRk-365-15@gated-at.bofh.it> (permalink)
References <pRzAK-Um-9@gated-at.bofh.it> <pRzAK-Um-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4/4] KVM: x86: clean/fix memory barriers in irqchip_in_kernel Paolo Bonzini <pbonzini@redhat.com> - 2015-07-29 15:30 +0200
  Re: [PATCH 4/4] KVM: x86: clean/fix memory barriers in  irqchip_in_kernel Steve Rutherford <srutherford@google.com> - 2015-07-30 05:40 +0200
    Re: [PATCH 4/4] KVM: x86: clean/fix memory barriers in  irqchip_in_kernel Paolo Bonzini <pbonzini@redhat.com> - 2015-07-30 09:30 +0200

csiph-web