Re: [PATCH 2/4] KVM: document memory barriers for kvm->vcpus/kvm->online_vcpus

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

 



Am 30.07.2015 um 16:02 schrieb Paolo Bonzini:
> 
> 
> On 30/07/2015 15:57, Christian Borntraeger wrote:
>>>>>> +	/* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu, in case
>>>>>> +	 * the caller has read kvm->online_vcpus before (as is the case
>>>>>> +	 * for kvm_for_each_vcpu, for example).
>>>>>> +	 */
>> is somewhat distracting because of "read" and "before". So something like
>>
>>  /* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu, to serialize the setting
>> of kvm->vcpus and setting kvm->online_vcpus....
>>
>> might be better.
> 
> What you are suggesting would go in kvm_vm_ioctl_create_vcpu, e.g.
> rewriting:
> 
> 	/* Pairs with smp_rmb() in kvm_get_vcpu.  */
> 	smp_wmb();
> 
> like this:
> 
> 	/*
> 	 * Pairs with smp_rmb() in kvm_get_vcpu.  Write kvm->vcpus
> 	 * before kvm->online_vcpu's incremented value.
> 	 */
> 	smp_wmb();
> 
> Instead, kvm_get_cpu has:
> 
> 	/*
> 	 * Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu, in case
> 	 * the caller has read kvm->online_vcpus before (as is the case
> 	 * for kvm_for_each_vcpu, for example).
> 	 */
> 	smp_rmb();
> 
> which already describes which loads are serialized here.
> 
> Is this correct?

Right you are.


--
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