[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55BA2E68.9030207@redhat.com>
Date: Thu, 30 Jul 2015 16:02:16 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Christian Borntraeger <borntraeger@...ibm.com>,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc: mtosatti@...hat.com, srutherford@...gle.com, rkrcmar@...hat.com
Subject: Re: [PATCH 2/4] KVM: document memory barriers for
kvm->vcpus/kvm->online_vcpus
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 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