From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "yilun.xu@linux.intel.com" <yilun.xu@linux.intel.com>
Cc: "Gao, Chao" <chao.gao@intel.com>,
"Hansen, Dave" <dave.hansen@intel.com>,
"seanjc@google.com" <seanjc@google.com>,
"x86@kernel.org" <x86@kernel.org>,
"kas@kernel.org" <kas@kernel.org>,
"Wu, Binbin" <binbin.wu@intel.com>,
"Li, Xiaoyao" <xiaoyao.li@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Zhao, Yan Y" <yan.y.zhao@intel.com>,
"Hunter, Adrian" <adrian.hunter@intel.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH 2/2] x86/virt/tdx: Drop tdh_phymem_page_wbinvd_*()
Date: Wed, 23 Sep 2026 18:18:05 +0000 [thread overview]
Message-ID: <ba9c2098940c48375a759e7e83f028068fd560ff.camel@intel.com> (raw)
In-Reply-To: <arN7JeQa1f8V61UJ@yilunxu-OptiPlex-7050>
On Wed, 2026-09-23 at 15:09 +0800, Xu Yilun wrote:
> Since private KeyID virtual mappings are reserved for TDX use, the TDX
> > module has to do the clflush itself.
>
> This paragraph is a little confusing to me. Here reads like the TDX
> module does the clflush internally and the host doesn't have to opt-in.
>
> > The TDH.PHYMEM.PAGE.WBINVD SEAMCALL
> > leaf was created for this purpose.
>
> But the SEAMCALL leaf shows host should opt-in.
>
> Ah, you want to say host can't directly do clflush because of some
> reason, so we need a SEAMCALL, is it?
The host can't map things with private keyids. So it calls into the TDX module
to do it. That was my understanding. On "alloc" you are transitioning from KeyID
0 to some private key, so flush at the KeyID 0 from the host. On reclain it goes
from some private KeyID to 0, so the TDX module needs to flush at the source
alias.
>
> [...]
>
> > @@ -578,15 +577,6 @@ static void tdx_reclaim_td_control_pages(struct kvm
> > *kvm)
> > if (__tdx_reclaim_page(kvm_tdx->td.tdr_page))
> > return;
> >
> > - /*
> > - * Use a SEAMCALL to ask the TDX module to flush the cache based on
> > the
> > - * KeyID. TDX module may access TDR while operating on TD
> > (Especially
> > - * when it is reclaiming TDCS).
> > - */
> > - err = tdh_phymem_page_wbinvd_tdr(&kvm_tdx->td);
> > - if (TDX_BUG_ON(err, TDH_PHYMEM_PAGE_WBINVD, kvm))
> > - return;
> > -
> > tdx_quirk_reset_paddr(page_to_phys(kvm_tdx->td.tdr_page),
> > PAGE_SIZE);
> >
> > __free_page(kvm_tdx->td.tdr_page);
>
> After removing the wbinvd, we don't need open code to reclaim tdr
> anymore, is it? tdx_reclaim_control_page(kvm_tdx->td.tdr_page)?
>
> This may not be relevant to the topic, not sure if we are good to clean
> up it in this series.
Good point. Hmm, I think it is ok to have for this patch. Let me try.
>
>
> Another thing. There are also 2 wbinvd_on_all_cpus() on PAMT
> adding/reclaiming. Remove them?
Ohhh. By the comment, maybe yes. Good point. Let me investigate this one. I
might leave it for future work.
prev parent reply other threads:[~2026-09-23 18:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 20:52 [PATCH 0/2] Drop unneeded cache flushing Rick Edgecombe
2026-09-22 20:52 ` [PATCH 1/2] x86/virt/tdx: Drop tdx_clflush_*() Rick Edgecombe
2026-09-23 5:25 ` Yan Zhao
2026-09-23 7:30 ` Binbin Wu
2026-09-23 7:47 ` Tony Lindgren
2026-09-23 15:50 ` Edgecombe, Rick P
2026-09-23 11:58 ` Nikolay Borisov
2026-09-23 16:26 ` Edgecombe, Rick P
2026-09-23 18:07 ` Nikolay Borisov
2026-09-22 20:52 ` [PATCH 2/2] x86/virt/tdx: Drop tdh_phymem_page_wbinvd_*() Rick Edgecombe
2026-09-23 2:18 ` Xiaoyao Li
2026-09-23 16:31 ` Edgecombe, Rick P
2026-09-23 5:41 ` Yan Zhao
2026-09-23 18:22 ` Edgecombe, Rick P
2026-09-23 7:09 ` Xu Yilun
2026-09-23 18:18 ` Edgecombe, Rick P [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ba9c2098940c48375a759e7e83f028068fd560ff.camel@intel.com \
--to=rick.p.edgecombe@intel.com \
--cc=adrian.hunter@intel.com \
--cc=binbin.wu@intel.com \
--cc=chao.gao@intel.com \
--cc=dave.hansen@intel.com \
--cc=kas@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=x86@kernel.org \
--cc=xiaoyao.li@intel.com \
--cc=yan.y.zhao@intel.com \
--cc=yilun.xu@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®