From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lan Tianyu Subject: Re: [PATCH] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page() Date: Fri, 11 Mar 2016 09:13:58 +0800 Message-ID: <56E21BD6.7000405@intel.com> References: <1457055312-27067-1-git-send-email-tianyu.lan@intel.com> <56D9354E.9040908@intel.com> <56D94BFE.1080406@redhat.com> <56DE8F1A.9000401@intel.com> <56DEEF69.20208@redhat.com> <56E1875E.8060007@linux.intel.com> <56E19224.9090906@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: gleb@kernel.org, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Paolo Bonzini , Xiao Guangrong , Thomas Gleixner Return-path: In-Reply-To: <56E19224.9090906@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 2016=E5=B9=B403=E6=9C=8810=E6=97=A5 23:26, Paolo Bonzini wrote: >=20 >=20 > On 10/03/2016 15:40, Xiao Guangrong wrote: >> long dirty_count =3D kvm->tlbs_dirty; >> >> + /* >> + * read tlbs_dirty before doing tlb flush to make sure not = tlb >> request is >> + * lost. >> + */ >> smp_mb(); >> + >> if (kvm_make_all_cpus_request(kvm, KVM_REQ_TLB_FLUSH)) >> ++kvm->stat.remote_tlb_flush; >> cmpxchg(&kvm->tlbs_dirty, dirty_count, 0); >> >> >> Any comment? >=20 > Compared to smp_load_acquire(), smp_mb() adds an ordering between sto= res > and loads. Is the >=20 > The load of kvm->tlbs_dirty should then be >=20 > /* > * Read tlbs_dirty before setting KVM_REQ_TLB_FLUSH in > * kvm_make_all_cpus_request. This > */ > long dirty_count =3D smp_load_acquire(kvm->tlbs_dirty); >=20 > Tianyu, I think Xiao provided the information that I was missing. Wo= uld > you like to prepare the patch? Paolo: Sure. I will do that. Guangrong: Thanks a lot for your input. --=20 Best regards Tianyu Lan