[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGtprH-Z9=pKM1XxYYQTvwA161BCdgeRbRFQjV=HaV+4Qfo3=w@mail.gmail.com>
Date: Tue, 17 Jan 2023 14:58:48 -0800
From: Vishal Annapurve <vannapurve@...gle.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: x86@...nel.org, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, pbonzini@...hat.com,
vkuznets@...hat.com, wanpengli@...cent.com, jmattson@...gle.com,
joro@...tes.org, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, dave.hansen@...ux.intel.com, hpa@...or.com,
shuah@...nel.org, yang.zhong@...el.com, ricarkol@...gle.com,
aaronlewis@...gle.com, wei.w.wang@...el.com,
kirill.shutemov@...ux.intel.com, corbet@....net, hughd@...gle.com,
jlayton@...nel.org, bfields@...ldses.org,
akpm@...ux-foundation.org, chao.p.peng@...ux.intel.com,
yu.c.zhang@...ux.intel.com, jun.nakajima@...el.com,
dave.hansen@...el.com, michael.roth@....com, qperret@...gle.com,
steven.price@....com, ak@...ux.intel.com, david@...hat.com,
luto@...nel.org, vbabka@...e.cz, marcorr@...gle.com,
erdemaktas@...gle.com, pgonda@...gle.com, nikunj@....com,
diviness@...gle.com, maz@...nel.org, dmatlack@...gle.com,
axelrasmussen@...gle.com, maciej.szmigiero@...cle.com,
mizhang@...gle.com, bgardon@...gle.com, ackerleytng@...gle.com
Subject: Re: [V2 PATCH 1/6] KVM: x86: Add support for testing private memory
On Tue, Jan 17, 2023 at 1:39 PM Sean Christopherson <seanjc@...gle.com> wrote:
>
> On Mon, Dec 05, 2022, Vishal Annapurve wrote:
> > Introduce HAVE_KVM_PRIVATE_MEM_TESTING config to be able to test fd based
> > @@ -272,13 +274,15 @@ static inline int kvm_mmu_do_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
> > .rsvd = err & PFERR_RSVD_MASK,
> > .user = err & PFERR_USER_MASK,
> > .prefetch = prefetch,
> > - .is_tdp = likely(vcpu->arch.mmu->page_fault == kvm_tdp_page_fault),
> > + .is_tdp = is_tdp,
> > .nx_huge_page_workaround_enabled =
> > is_nx_huge_page_enabled(vcpu->kvm),
> >
> > .max_level = KVM_MAX_HUGEPAGE_LEVEL,
> > .req_level = PG_LEVEL_4K,
> > .goal_level = PG_LEVEL_4K,
> > + .is_private = IS_ENABLED(CONFIG_HAVE_KVM_PRIVATE_MEM_TESTING) && is_tdp &&
> > + kvm_mem_is_private(vcpu->kvm, cr2_or_gpa >> PAGE_SHIFT),
>
> After looking at the SNP+UPM series, I think we should forego a dedicated Kconfig
> for testing and instead add a new VM type for UPM-capable guests. The new type,
> e.g. KVM_X86_PROTECTED_VM, can then be used to leverage UPM for "legacy" SEV and
> SEV-ES guests, as well as for UPM-capable guests that don't utilize per-VM
> memory encryption, e.g. KVM selftests.
>
> Carrying test-only behavior is obviously never ideal, and it would pretty much have
> to be mutually exclusive with "real" usage of UPM, otherwise the KVM logics gets
> unnecessarily complex.
Ack, the newly added VM type fits better here with SEV/SEV-ES and
non-confidential selftests being able to share this framework.
Powered by blists - more mailing lists