[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f5101cfa773a5dd89dd40ff9023024f4782b8123.camel@intel.com>
Date: Fri, 15 Aug 2025 00:00:50 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "seanjc@...gle.com" <seanjc@...gle.com>
CC: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"ashish.kalra@....com" <ashish.kalra@....com>, "Hansen, Dave"
<dave.hansen@...el.com>, "thomas.lendacky@....com" <thomas.lendacky@....com>,
"kas@...nel.org" <kas@...nel.org>, "Chatre, Reinette"
<reinette.chatre@...el.com>, "dwmw@...zon.co.uk" <dwmw@...zon.co.uk>,
"pbonzini@...hat.com" <pbonzini@...hat.com>, "mingo@...hat.com"
<mingo@...hat.com>, "Yamahata, Isaku" <isaku.yamahata@...el.com>,
"nik.borisov@...e.com" <nik.borisov@...e.com>, "tglx@...utronix.de"
<tglx@...utronix.de>, "hpa@...or.com" <hpa@...or.com>, "peterz@...radead.org"
<peterz@...radead.org>, "sagis@...gle.com" <sagis@...gle.com>, "Chen, Farrah"
<farrah.chen@...el.com>, "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>,
"bp@...en8.de" <bp@...en8.de>, "binbin.wu@...ux.intel.com"
<binbin.wu@...ux.intel.com>, "Gao, Chao" <chao.gao@...el.com>, "Williams, Dan
J" <dan.j.williams@...el.com>, "x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH v6 7/7] KVM: TDX: Explicitly do WBINVD when no more TDX
SEAMCALLs
On Thu, 2025-08-14 at 16:22 -0700, Sean Christopherson wrote:
> On Thu, Aug 14, 2025, Kai Huang wrote:
> > On Thu, 2025-08-14 at 11:00 -0700, Sean Christopherson wrote:
> > > > > > + */
> > > > > > + tdx_cpu_flush_cache();
> > > > >
> > > > > IIUC, this can be:
> > > > >
> > > > > if (IS_ENABLED(CONFIG_KEXEC))
> > > > > tdx_cpu_flush_cache();
> > > > >
> > > >
> > > > No strong objection, just 2 cents. I bet !CONFIG_KEXEC && CONFIG_INTEL_TDX_HOST
> > > > kernels will be the minority. Seems like an opportunity to simplify the code.
> > >
> > > Reducing the number of lines of code is not always a simplification. IMO, not
> > > checking CONFIG_KEXEC adds "complexity" because anyone that reads the comment
> > > (and/or the massive changelog) will be left wondering why there's a bunch of
> > > documentation that talks about kexec, but no hint of kexec considerations in the
> > > code.
> >
> > I think we can use 'kexec_in_progress', which is even better than
> > IS_ENABLED(CONFIG_KEXEC) IMHO.
>
> I don't think that will accomplish what you want. E.g. kvm-intel.ko is unloaded
> after doing TDX things, while kexec_in_progress=false, and then some time later
> a kexec is triggered. In that case, stop_this_cpu() will still get stuck doing
> WBINVD.
Right. Thanks. Let me think more on this.
One minor thing is I think we should use IS_ENABLED(CONFIG_KEXEC_CORE)
instead. Besides the CONFIG_KEXEC, there is another CONFIG_KEXEC_FILE,
and both of them select CONFIG_KEXEC_CORE.
Powered by blists - more mailing lists