From: "Huang, Kai" <kai.huang@intel.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: <linux-kernel@vger.kernel.org>, <x86@kernel.org>,
<dave.hansen@intel.com>, <bp@alien8.de>, <tglx@linutronix.de>,
<mingo@redhat.com>, <hpa@zytor.com>, <luto@kernel.org>,
<peterz@infradead.org>, <rick.p.edgecombe@intel.com>,
<thomas.lendacky@amd.com>, <ashish.kalra@amd.com>,
<chao.gao@intel.com>, <bhe@redhat.com>, <nik.borisov@suse.com>,
<pbonzini@redhat.com>, <seanjc@google.com>
Subject: Re: [PATCH v3 1/5] x86/kexec: do unconditional WBINVD for bare-metal in stop_this_cpu()
Date: Thu, 11 Apr 2024 09:54:13 +1200 [thread overview]
Message-ID: <4875349a-90e5-4a04-8a56-7d172b17e245@intel.com> (raw)
In-Reply-To: <a4o4wlaojm5am4hc5yhr2mpn7clm3sjy5vx3w76ahm52lhxvwr@msdcnkcj3i6k>
On 11/04/2024 2:12 am, Kirill A. Shutemov wrote:
> On Mon, Apr 08, 2024 at 12:44:54AM +1200, Kai Huang wrote:
>> TL;DR:
>
> The commit message is waaay too verbose for no good reason. You don't
> really need to repeat all the history around this code.
Could you be more specific?
I was following Boris's suggestion to summerize all the discussion
around the "unconditional WBINVD" issue.
https://lore.kernel.org/linux-kernel/20240228110207.GCZd8Sr8mXHA2KTiLz@fat_crate.local/
I can try to improve if I can know specifically what should be trimmed down.
>
>> ---
>> arch/x86/kernel/process.c | 18 ++++++++----------
>> 1 file changed, 8 insertions(+), 10 deletions(-)
>>
>> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
>> index b8441147eb5e..5ba8a9c1e47a 100644
>> --- a/arch/x86/kernel/process.c
>> +++ b/arch/x86/kernel/process.c
>> @@ -813,18 +813,16 @@ void __noreturn stop_this_cpu(void *dummy)
>> mcheck_cpu_clear(c);
>>
>> /*
>> - * Use wbinvd on processors that support SME. This provides support
>> - * for performing a successful kexec when going from SME inactive
>> - * to SME active (or vice-versa). The cache must be cleared so that
>> - * if there are entries with the same physical address, both with and
>> - * without the encryption bit, they don't race each other when flushed
>> - * and potentially end up with the wrong entry being committed to
>> - * memory.
>> + * The kernel could leave caches in incoherent state on SME/TDX
>> + * capable platforms. Flush cache to avoid silent memory
>> + * corruption for these platforms.
>> *
>> - * Test the CPUID bit directly because the machine might've cleared
>> - * X86_FEATURE_SME due to cmdline options.
>> + * stop_this_cpu() is not a fast path, just do unconditional
>> + * WBINVD for simplicity. But only do WBINVD for bare-metal
>> + * as TDX guests and SEV-ES/SEV-SNP guests will get unexpected
>> + * (and unnecessary) #VE and may unable to handle.
>
> s/#VE/exception/
>
> On SEV it is #VC, not #VE.
>
Thanks. I think I'll use "exception (#VE or #VC)" which is clearer, as
Tom typed in the comments to patch 2.
next prev parent reply other threads:[~2024-04-10 21:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-07 12:44 [PATCH v3 0/5] TDX host: kexec() support Kai Huang
2024-04-07 12:44 ` [PATCH v3 1/5] x86/kexec: do unconditional WBINVD for bare-metal in stop_this_cpu() Kai Huang
2024-04-10 14:12 ` Kirill A. Shutemov
2024-04-10 21:54 ` Huang, Kai [this message]
2024-04-11 13:31 ` Kirill A. Shutemov
2024-04-11 13:53 ` Huang, Kai
2024-04-15 17:59 ` Borislav Petkov
2024-04-15 21:43 ` Huang, Kai
2024-04-10 16:08 ` Tom Lendacky
2024-04-10 16:14 ` Tom Lendacky
2024-04-10 22:26 ` Huang, Kai
2024-04-11 14:13 ` Tom Lendacky
2024-04-11 21:55 ` Huang, Kai
2024-04-07 12:44 ` [PATCH v3 2/5] x86/kexec: do unconditional WBINVD for bare-metal in relocate_kernel() Kai Huang
2024-04-10 14:15 ` Kirill A. Shutemov
2024-04-10 16:21 ` Tom Lendacky
2024-04-10 22:55 ` Huang, Kai
2024-04-11 14:25 ` Tom Lendacky
2024-04-11 21:59 ` Huang, Kai
2024-04-07 12:44 ` [PATCH v3 3/5] x86/kexec: Reset TDX private memory on platforms with TDX erratum Kai Huang
2024-04-07 12:44 ` [PATCH v3 4/5] x86/virt/tdx: Remove the !KEXEC_CORE dependency Kai Huang
2024-04-07 12:44 ` [PATCH v3 5/5] x86/virt/tdx: Add TDX memory reset notifier to reset other private pages Kai Huang
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=4875349a-90e5-4a04-8a56-7d172b17e245@intel.com \
--to=kai.huang@intel.com \
--cc=ashish.kalra@amd.com \
--cc=bhe@redhat.com \
--cc=bp@alien8.de \
--cc=chao.gao@intel.com \
--cc=dave.hansen@intel.com \
--cc=hpa@zytor.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=nik.borisov@suse.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/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
Powered by JetHome