[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YieVlbIwYIIbEmd7@google.com>
Date: Tue, 8 Mar 2022 17:42:45 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
dmatlack@...gle.com
Subject: Re: [PATCH v2 10/25] KVM: x86/mmu: remove ept_ad field
On Mon, Feb 21, 2022, Paolo Bonzini wrote:
> The ept_ad field is used during page walk to determine if the guest PTEs
> have accessed and dirty bits. In the MMU role, the ad_disabled
> bit represents whether the *shadow* PTEs have the bits, so it
> would be incorrect to replace PT_HAVE_ACCESSED_DIRTY with just
> !mmu->mmu_role.base.ad_disabled.
>
> However, the similar field in the CPU mode, ad_disabled, is initialized
> correctly: to the opposite value of ept_ad for shadow EPT, and zero
> for non-EPT guest paging modes (which always have A/D bits). It is
> therefore possible to compute PT_HAVE_ACCESSED_DIRTY from the CPU mode,
> like other page-format fields; it just has to be inverted to account
> for the different polarity.
>
> Having a CPU mode that is distinct from the MMU roles in fact would even
> allow to remove PT_HAVE_ACCESSED_DIRTY macro altogether, and always use
> !mmu->cpu_mode.base.ad_disabled. I am not doing this because the macro
> has a small effect in terms of dead code elimination:
>
> text data bss dec hex
> 103544 16665 112 120321 1d601 # as of this patch
> 103746 16665 112 120523 1d6cb # without PT_HAVE_ACCESSED_DIRTY
>
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
> ---
Reviewed-by: Sean Christopherson <seanjc@...gle.com>
Powered by blists - more mailing lists