Re: [PATCH v7 1/4] KVM: x86: Split the APIC from the rest of IRQCHIP.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 30, 2015 at 10:21:54AM +0200, Paolo Bonzini wrote:
> Please review this diff:
> 
> diff --git b/arch/x86/kvm/irq.h a/arch/x86/kvm/irq.h
> index 72af5a989a2e..975cf33ef306 100644
> --- b/arch/x86/kvm/irq.h
> +++ a/arch/x86/kvm/irq.h
> @@ -93,11 +90,11 @@ static inline int irqchip_split(struct kvm *kvm)
>  	bool ret;
>  	struct kvm_pic *vpic = pic_irqchip(kvm);
>  
> -	/* Read vpic before kvm->irq_routing.  */
> -	smp_rmb();
>  	ret = (vpic != NULL);
>  	ret |= irqchip_split(kvm);
>  
> +	/* Read vpic before kvm->irq_routing.  */
> +	smp_rmb();
>  	return ret;
>  }
>  
> diff --git b/arch/x86/kvm/lapic.c a/arch/x86/kvm/lapic.c
> index 2f486d8ecdae..a86324ca9cc3 100644
> --- b/arch/x86/kvm/lapic.c
> +++ a/arch/x86/kvm/lapic.c
> @@ -209,7 +209,7 @@ out:
>  	if (old)
>  		kfree_rcu(old, rcu);
>  
> -	if (!irqchip_split(kvm))
> +	if (ioapic_in_kernel(kvm))
>  		kvm_vcpu_request_scan_ioapic(kvm);
>  }
>  
> @@ -1846,7 +1846,7 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu,
>  		kvm_x86_ops->hwapic_isr_update(vcpu->kvm,
>  				apic_find_highest_isr(apic));
>  	kvm_make_request(KVM_REQ_EVENT, vcpu);
> -	if (!ioapic_in_kernel(vcpu->kvm))
> +	if (ioapic_in_kernel(vcpu->kvm))
>  		kvm_rtc_eoi_tracking_restore_one(vcpu);
>  }
>  
> diff --git b/arch/x86/kvm/x86.c a/arch/x86/kvm/x86.c
> index 49a98608e3f6..5d2b8695732c 100644
> --- b/arch/x86/kvm/x86.c
> +++ a/arch/x86/kvm/x86.c
> @@ -3573,16 +3573,14 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
>  		r = -EEXIST;
>  		if (irqchip_in_kernel(kvm))
>  			goto split_irqchip_unlock;
> -		if (!irqchip_split(kvm)) {
> -			if (atomic_read(&kvm->online_vcpus))
> -				goto split_irqchip_unlock;
> -			r = kvm_setup_empty_irq_routing(kvm);
> -			if (r)
> -				goto split_irqchip_unlock;
> -			/* Pairs with irqchip_in_kernel. */
> -			smp_wmb();
> -			kvm->arch.irqchip_split = true;
> -		}
> +		if (atomic_read(&kvm->online_vcpus))
> +			goto split_irqchip_unlock;
> +		r = kvm_setup_empty_irq_routing(kvm);
> +		if (r)
> +			goto split_irqchip_unlock;
> +		/* Pairs with irqchip_in_kernel. */
> +		smp_wmb();
> +		kvm->arch.irqchip_split = true;
This looks a bit non-sensical, but is overprepared for the introduction
IOAPIC hotplug, which two patches down the line. Changing it is fine,
you'll just need to merge the very same change back.

>  		r = 0;
>  split_irqchip_unlock:
>  		mutex_unlock(&kvm->lock);
> @@ -3701,7 +3699,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
>  		}
>  
>  		r = -ENXIO;
> -		if (!irqchip_in_kernel(kvm) || !ioapic_in_kernel(kvm))
> +		if (!irqchip_in_kernel(kvm) || irqchip_split(kvm))
>  			goto get_irqchip_out;
>  		r = kvm_vm_ioctl_get_irqchip(kvm, chip);
>  		if (r)
> @@ -3725,7 +3723,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
>  		}
>  
>  		r = -ENXIO;
> -		if (!irqchip_in_kernel(kvm) || !ioapic_in_kernel(kvm))
> +		if (!irqchip_in_kernel(kvm) || irqchip_split(kvm))
>  			goto set_irqchip_out;
>  		r = kvm_vm_ioctl_set_irqchip(kvm, chip);
>  		if (r)
> 
> No need to resend.
> 
> Paolo

Looks good.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux