[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d7805e17b7f09b08384406168571d1bfd019b77b.camel@intel.com>
Date: Fri, 14 Mar 2025 16:28:17 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "Hansen, Dave" <dave.hansen@...el.com>, "Huang, Kai"
<kai.huang@...el.com>, "bp@...en8.de" <bp@...en8.de>, "peterz@...radead.org"
<peterz@...radead.org>, "mingo@...hat.com" <mingo@...hat.com>,
"thomas.lendacky@....com" <thomas.lendacky@....com>, "tglx@...utronix.de"
<tglx@...utronix.de>, "kirill.shutemov@...ux.intel.com"
<kirill.shutemov@...ux.intel.com>
CC: "dyoung@...hat.com" <dyoung@...hat.com>, "seanjc@...gle.com"
<seanjc@...gle.com>, "x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"sagis@...gle.com" <sagis@...gle.com>, "hpa@...or.com" <hpa@...or.com>,
"Chatre, Reinette" <reinette.chatre@...el.com>, "bhe@...hat.com"
<bhe@...hat.com>, "Williams, Dan J" <dan.j.williams@...el.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>, "ashish.kalra@....com"
<ashish.kalra@....com>, "nik.borisov@...e.com" <nik.borisov@...e.com>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>, "dwmw@...zon.co.uk"
<dwmw@...zon.co.uk>
Subject: Re: [RFC PATCH 1/5] x86/kexec: Do unconditional WBINVD for bare-metal
in stop_this_cpu()
On Fri, 2025-03-14 at 10:11 -0500, Tom Lendacky wrote:
> > I see that this already has Tom's RB, but I'm not sure how this works for
> > AMD.
> > The original SME patch tried to avoid writing to memory by putting the
> > wbinvd
> > immediately before the halt, but today it is further away. Below this hunk
> > there
> > are more instructions that could dirty memory before the halt. Ohh... it's
> > new.
> > 9 months ago 26ba7353caaa ("x86/smp: Add smp_ops.stop_this_cpu() callback")
> > adds
> > a function call that would touch the stack. I think it's wrong? And probably
> > introduced after this patch was originally written.
> >
> > Then the cpuid_eax() could be non-inlined, but probably not. But the
> > boot_cpu_has() added in this patch could call out to kasan and dirty the
> > stack.
> >
> > So I think the existing SME case might be theoretically incorrect, and if so
> > this makes things very slightly worse.
>
> But the wbinvd() is performed after those checks, so everything gets flushed.
Oh, right, duh. Thanks for checking. Yea those shouldn't matter.
Does the stop_this_cpu() part never come into play for SME either? It looks like
it was added for TDX guest kexec, but is a general ACPI thing.
Regarding the kasan thing, I was looking at this too:
wbinvd()
cpumask_clear_cpu()
clear_bit()
instrument_atomic_write()
kasan_check_write()
__kasan_check_write() <- non-inline
Powered by blists - more mailing lists