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?
Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/