[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <55BA2F3A.8060501@de.ibm.com>
Date: Thu, 30 Jul 2015 16:05:46 +0200
From: Christian Borntraeger <borntraeger@...ibm.com>
To: Paolo Bonzini <pbonzini@...hat.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
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 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