[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aK3qfbvkCOaCxWC_@google.com>
Date: Tue, 26 Aug 2025 10:10:21 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Kai Huang <kai.huang@...el.com>
Cc: dave.hansen@...el.com, bp@...en8.de, tglx@...utronix.de,
peterz@...radead.org, mingo@...hat.com, hpa@...or.com,
thomas.lendacky@....com, x86@...nel.org, kas@...nel.org,
rick.p.edgecombe@...el.com, dwmw@...zon.co.uk, linux-kernel@...r.kernel.org,
pbonzini@...hat.com, kvm@...r.kernel.org, reinette.chatre@...el.com,
isaku.yamahata@...el.com, dan.j.williams@...el.com, ashish.kalra@....com,
nik.borisov@...e.com, chao.gao@...el.com, sagis@...gle.com,
farrah.chen@...el.com, Binbin Wu <binbin.wu@...ux.intel.com>
Subject: Re: [PATCH v7 7/7] KVM: TDX: Explicitly do WBINVD when no more TDX SEAMCALLs
On Tue, Aug 26, 2025, Kai Huang wrote:
> diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> index 2abf53ed59c8..f8f74e213f0d 100644
> --- a/arch/x86/virt/vmx/tdx/tdx.c
> +++ b/arch/x86/virt/vmx/tdx/tdx.c
> @@ -1872,3 +1872,15 @@ u64 tdh_phymem_page_wbinvd_hkid(u64 hkid, struct page *page)
> return seamcall(TDH_PHYMEM_PAGE_WBINVD, &args);
> }
> EXPORT_SYMBOL_GPL(tdh_phymem_page_wbinvd_hkid);
> +
> +void tdx_cpu_flush_cache_for_kexec(void)
> +{
> + lockdep_assert_preemption_disabled();
> +
> + if (!this_cpu_read(cache_state_incoherent))
> + return;
> +
Can you add a comment here to explain why this is done even if the kernel doesn't
support kexec? I've no objection to the superfluous flushing, but I've spent far
too much time deciphering old commits where the changelog says one thing and the
code does something else with no explanation. I don't want to be party to such
crimes :-)
> + wbinvd();
> + this_cpu_write(cache_state_incoherent, false);
> +}
> +EXPORT_SYMBOL_GPL(tdx_cpu_flush_cache_for_kexec);
> --
> 2.50.1
>
Powered by blists - more mailing lists