From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752537AbdJLOSw (ORCPT ); Thu, 12 Oct 2017 10:18:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36586 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751895AbdJLOSu (ORCPT ); Thu, 12 Oct 2017 10:18:50 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2D60C5F299D Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com Subject: Re: [PATCH] KVM:X86 simply update A/D bits route To: Peng Hao , rkrcmar@redhat.com Cc: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <1507843044-51761-1-git-send-email-peng.hao2@zte.com.cn> From: Paolo Bonzini Message-ID: <93c484be-5b0b-0ad3-54f2-2920316bc262@redhat.com> Date: Thu, 12 Oct 2017 16:18:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1507843044-51761-1-git-send-email-peng.hao2@zte.com.cn> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 12 Oct 2017 14:18:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/10/2017 23:17, Peng Hao wrote: > update_accessed_dirty_bits return 0 when dirty/accessed bits are > not supported. So walk_addr_generic just call update_accessed_dirty_bits > with supporting dirty/accessed bits. > > Signed-off-by: Peng Hao > --- > arch/x86/kvm/paging_tmpl.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h > index 86b68dc..b40f23e 100644 > --- a/arch/x86/kvm/paging_tmpl.h > +++ b/arch/x86/kvm/paging_tmpl.h > @@ -422,7 +422,7 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, > accessed_dirty &= pte >> > (PT_GUEST_DIRTY_SHIFT - PT_GUEST_ACCESSED_SHIFT); > > - if (unlikely(!accessed_dirty)) { > + if (unlikely(!accessed_dirty && have_ad)) { > ret = FNAME(update_accessed_dirty_bits)(vcpu, mmu, walker, write_fault); > if (unlikely(ret < 0)) > goto error; > At least you would have to remove the corresponding conditional in update_accessed_dirty_bits, or change it to a WARN. But I don't see the point really... why is it _better_ to check in walk_addr_generic instead of update_accessed_dirty_bits? Paolo