From: Tom Lendacky <thomas.lendacky@amd.com>
To: Kai Huang <kai.huang@intel.com>, linux-kernel@vger.kernel.org
Cc: x86@kernel.org, dave.hansen@intel.com, bp@alien8.de,
kirill.shutemov@linux.intel.com, tglx@linutronix.de,
mingo@redhat.com, hpa@zytor.com, luto@kernel.org,
peterz@infradead.org, rick.p.edgecombe@intel.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 v4 2/5] x86/kexec: do unconditional WBINVD for bare-metal in relocate_kernel()
Date: Thu, 18 Apr 2024 08:49:49 -0500 [thread overview]
Message-ID: <a5d9f8e6-3a1d-53ce-cf92-d8918f673d87@amd.com> (raw)
In-Reply-To: <6cbd40389458acbfdbd2d804da1d363dec06f750.1713439632.git.kai.huang@intel.com>
On 4/18/24 06:48, Kai Huang wrote:
> Both SME and TDX can leave caches in incoherent state due to memory
> encryption. During kexec, the caches must be flushed before jumping to
> the second kernel to avoid silent memory corruption to the second kernel.
>
> During kexec, the WBINVD in stop_this_cpu() flushes caches for all
> remote cpus when they are being stopped. For SME, the WBINVD in
> relocate_kernel() flushes the cache for the last running cpu (which is
> executing the kexec).
>
> Similarly, to support kexec for TDX host, after stopping all remote cpus
> with cache flushed, the kernel needs to flush cache for the last running
> cpu.
>
> Use the existing WBINVD in relocate_kernel() to cover TDX host as well.
>
> However, instead of sprinkling around vendor-specific checks, just do
> unconditional WBINVD to cover both SME and TDX. Kexec is not a fast path
> so having one additional WBINVD for platforms w/o SME/TDX is acceptable.
>
> But only do WBINVD for bare-metal because TDX guests and SEV-ES/SEV-SNP
> guests will get unexpected (and yet unnecessary) exception (#VE or #VC)
> which the kernel is unable to handle at this stage.
>
> Signed-off-by: Kai Huang <kai.huang@intel.com>
> Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Cc: Dave Young <dyoung@redhat.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
next prev parent reply other threads:[~2024-04-18 13:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 11:48 [PATCH v4 0/5] TDX host: kexec() support Kai Huang
2024-04-18 11:48 ` [PATCH v4 1/5] x86/kexec: do unconditional WBINVD for bare-metal in stop_this_cpu() Kai Huang
2024-04-18 13:47 ` Tom Lendacky
2024-04-18 22:23 ` Huang, Kai
2024-05-23 2:49 ` Huang, Kai
2024-05-31 20:45 ` Tom Lendacky
2024-06-04 0:57 ` Huang, Kai
2024-04-18 11:48 ` [PATCH v4 2/5] x86/kexec: do unconditional WBINVD for bare-metal in relocate_kernel() Kai Huang
2024-04-18 13:49 ` Tom Lendacky [this message]
2024-04-18 11:48 ` [PATCH v4 3/5] x86/kexec: Reset TDX private memory on platforms with TDX erratum Kai Huang
2024-04-18 11:48 ` [PATCH v4 4/5] x86/virt/tdx: Remove the !KEXEC_CORE dependency Kai Huang
2024-04-18 11:48 ` [PATCH v4 5/5] x86/virt/tdx: Add TDX memory reset notifier to reset other private pages Kai Huang
2024-05-31 17:17 ` Isaku Yamahata
2024-05-01 23:12 ` [PATCH v4 0/5] TDX host: kexec() support Huang, Kai
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=a5d9f8e6-3a1d-53ce-cf92-d8918f673d87@amd.com \
--to=thomas.lendacky@amd.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=kai.huang@intel.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=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