[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2ea853668cb6b3124d3a01bb610c6072cb4d57e6.camel@intel.com>
Date: Wed, 11 Jun 2025 21:16:05 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "seanjc@...gle.com" <seanjc@...gle.com>
CC: "Huang, Kai" <kai.huang@...el.com>, "binbin.wu@...ux.intel.com"
<binbin.wu@...ux.intel.com>, "Li, Xiaoyao" <xiaoyao.li@...el.com>, "Chatre,
Reinette" <reinette.chatre@...el.com>, "Hunter, Adrian"
<adrian.hunter@...el.com>, "Zhao, Yan Y" <yan.y.zhao@...el.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>, "pbonzini@...hat.com"
<pbonzini@...hat.com>, "Yamahata, Isaku" <isaku.yamahata@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"tony.lindgren@...ux.intel.com" <tony.lindgren@...ux.intel.com>
Subject: Re: [PATCH] KVM: x86/mmu: Embed direct bits into gpa for
KVM_PRE_FAULT_MEMORY
On Wed, 2025-06-11 at 13:43 -0700, Sean Christopherson wrote:
> > Functionally, page_fault_can_be_fast() should prevented this with the
> > check of
> > kvm->arch.has_private_mem.
>
> No? I see this:
>
> if (kvm->arch.has_private_mem &&
> fault->is_private != kvm_mem_is_private(kvm, fault->gfn))
> return false;
>
> I.e. a private fault can be fast, so long as the page is already in the
> correct
> shared vs. private state. I can imagine that it's impossible for TDX to
> generate
> protection violations, but I think kvm_tdp_mmu_fast_pf_get_last_sptep() could
> be
> reached with a mirror root if kvm_ad_enabled=false.
>
> if (!fault->present)
> return !kvm_ad_enabled;
>
> /*
> * Note, instruction fetches and writes are mutually exclusive,
> ignore
> * the "exec" flag.
> */
> return fault->write;
Oh, how embarrassing. Yes, I misread the code, but the way it's working is, oh
man...
TDX isn't setting PFERR_WRITE_MASK or PFERR_PRESENT_MASK in the error_code
passed into the fault handler. So page_fault_can_be_fast() should return false
for that reason for private/mirror faults.
Powered by blists - more mailing lists