From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takuya Yoshikawa Subject: Re: KVM: Questions and comments on make_all_cpus_request Date: Wed, 16 Jan 2013 22:20:04 +0900 Message-ID: <20130116222004.3802b85b634966a3e556b97d@gmail.com> References: <1358297020-1548-1-git-send-email-cdall@cs.columbia.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, nicolas@viennot.biz To: Christoffer Dall Return-path: Received: from mail-pa0-f54.google.com ([209.85.220.54]:61530 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751222Ab3APNUI (ORCPT ); Wed, 16 Jan 2013 08:20:08 -0500 Received: by mail-pa0-f54.google.com with SMTP id bi5so788448pad.41 for ; Wed, 16 Jan 2013 05:20:08 -0800 (PST) In-Reply-To: <1358297020-1548-1-git-send-email-cdall@cs.columbia.edu> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, 15 Jan 2013 19:43:40 -0500 Christoffer Dall wrote: > @@ -201,9 +222,13 @@ void kvm_flush_remote_tlbs(struct kvm *kvm) > { > long dirty_count = kvm->tlbs_dirty; > > - smp_mb(); > + smp_mb(); /* TODO: Someone should explain this! */ > if (make_all_cpus_request(kvm, KVM_REQ_TLB_FLUSH)) > ++kvm->stat.remote_tlb_flush; > + /* > + * TODO: Someone should explain this, why is it a cmpxchg, what > + * happens if the dirty is different from dirty_count? > + */ > cmpxchg(&kvm->tlbs_dirty, dirty_count, 0); > } If it's different from the old value, that means another attempt which forces us to care about TLBs has been done? So I think making tlbs_dirty 0 is safe only when it's not changed during executing this function. Takuya