From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH v3 14/19] KVM: MMU: clean up spte updating and clearing Date: Thu, 7 Jul 2011 05:16:21 -0300 Message-ID: <20110707081621.GB8334@amt.cnet> References: <4E0C3178.2080603@cn.fujitsu.com> <4E0C32FE.2020805@cn.fujitsu.com> <20110706173911.GA9820@amt.cnet> <4E14B511.5000408@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , LKML , KVM To: Xiao Guangrong Return-path: Content-Disposition: inline In-Reply-To: <4E14B511.5000408@cn.fujitsu.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Thu, Jul 07, 2011 at 03:18:41AM +0800, Xiao Guangrong wrote: > On 07/07/2011 01:39 AM, Marcelo Tosatti wrote: > > >> -static bool spte_is_bit_cleared(u64 old_spte, u64 new_spte, u64 bit_mask) > >> +static void track_spte_bits(u64 old_spte, u64 keep_bits, bool always_track) > >> { > >> - return (old_spte & bit_mask) && !(new_spte & bit_mask); > >> + if (always_track || > >> + (spte_is_bit_cleared(old_spte, keep_bits, shadow_accessed_mask))) > >> + kvm_set_pfn_accessed(spte_to_pfn(old_spte)); > >> + > >> + if (always_track || > >> + (spte_is_bit_cleared(old_spte, keep_bits, shadow_dirty_mask))) > >> + kvm_set_pfn_dirty(spte_to_pfn(old_spte)); > >> +} > > > > This is much more confusing than previously, please drop it. > > > > What about remove "always_track" parameter? After that, the code should be clear. Its easier to read by having it opencoded as it is now.