Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933286AbcCKBaK (ORCPT ); Thu, 10 Mar 2016 20:30:10 -0500 Received: from mga01.intel.com ([192.55.52.88]:5577 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933051AbcCKBaF (ORCPT ); Thu, 10 Mar 2016 20:30:05 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,318,1455004800"; d="scan'208";a="63974751" Message-ID: <56E21BD6.7000405@intel.com> Date: Fri, 11 Mar 2016 09:13:58 +0800 From: Lan Tianyu User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Paolo Bonzini , Xiao Guangrong , Thomas Gleixner CC: gleb@kernel.org, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page() 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> In-Reply-To: <56E19224.9090906@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1019 Lines: 43 On 2016年03月10日 23:26, Paolo Bonzini wrote: > > > On 10/03/2016 15:40, Xiao Guangrong wrote: >> long dirty_count = 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? > > Compared to smp_load_acquire(), smp_mb() adds an ordering between stores > and loads. Is the > > The load of kvm->tlbs_dirty should then be > > /* > * Read tlbs_dirty before setting KVM_REQ_TLB_FLUSH in > * kvm_make_all_cpus_request. This > */ > long dirty_count = smp_load_acquire(kvm->tlbs_dirty); > > Tianyu, I think Xiao provided the information that I was missing. Would > you like to prepare the patch? Paolo: Sure. I will do that. Guangrong: Thanks a lot for your input. -- Best regards Tianyu Lan