[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zdjd_loCXRAV3aVb@google.com>
Date: Fri, 23 Feb 2024 10:03:42 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: David Stevens <stevensd@...omium.org>, Yu Zhang <yu.c.zhang@...ux.intel.com>,
Isaku Yamahata <isaku.yamahata@...il.com>, Zhi Wang <zhi.wang.linux@...il.com>,
Maxim Levitsky <mlevitsk@...hat.com>, kvmarm@...ts.linux.dev, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Subject: Re: [PATCH v10 7/8] KVM: x86/mmu: Track if sptes refer to refcounted pages
On Fri, Feb 23, 2024, Paolo Bonzini wrote:
> On 2/21/24 08:25, David Stevens wrote:
> > From: David Stevens <stevensd@...omium.org>
> >
> > Use one of the unused bits in EPT sptes to track whether or not an spte
> > refers to a struct page that has a valid refcount, in preparation for
> > adding support for mapping such pages into guests. The new bit is used
> > to avoid triggering a page_count() == 0 warning and to avoid touching
> > A/D bits of unknown usage.
> >
> > Non-EPT sptes don't have any free bits to use, so this tracking is not
> > possible when TDP is disabled or on 32-bit x86.
>
> TDX will add support for non-zero non-present PTEs. We could use this to
> use inverted bit 8 to mark present PTEs (bit 8 set for non-present, bit 8
> clear for present) for both shadow paging and AMD NPT. This would free bit
> 11 for SPTE_MMU_PAGE_REFCOUNTED.
Ooh, that's much more clever than where I was headed, which was to abuse the PAT
bit (kernel configures 0400 to be WB), which would actually be quite elegant if
(a) the PAT bit didn't move around or (b) the kernel used a non-zero PCD or PWT
bit for WB :-/
Powered by blists - more mailing lists