From: Dave Hansen <dave.hansen@intel.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Borislav Petkov <bp@alien8.de>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
x86@kernel.org, Eric Biederman <ebiederm@xmission.com>,
kexec@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: Disable kexec for TDX guests
Date: Sun, 26 Mar 2023 10:01:23 -0700 [thread overview]
Message-ID: <b16bcda0-f190-7849-cbbb-412d328c8806@intel.com> (raw)
In-Reply-To: <20230325192524.wetlbycbcsxc4plk@box>
On 3/25/23 12:25, Kirill A. Shutemov wrote:
> On Sat, Mar 25, 2023 at 09:25:36AM -0700, Dave Hansen wrote:
>> On 3/25/23 09:01, Kirill A. Shutemov wrote:
>>> The last item is tricky. TDX guests use ACPI MADT MPWK to bring up
>>> secondary CPUs. The mechanism doesn't allow to put a CPU back offline if
>>> it has woken up.
>> ...
>>> +int arch_kexec_load(void)
>>> +{
>>> + if (cpu_feature_enabled(X86_FEATURE_TDX_GUEST)) {
>>> + pr_warn_once("Disable kexec: not yet supported in TDX guest\n");
>>> + return -EOPNOTSUPP;
>>> + }
>>> +
>>> + return 0;
>>> +}
>>
>> So, let's put all this together:
>>
>> 1. TDX implementations use MADT for wakeup exclusively right now (but
>> are not necessarily _required_ to do so forever)
>> 2. MADT doesn't support CPU offlining
>> 3. kexec() requires offlining
>>
>> Thus, current TDX implementations can't support TDX guests. This
>> *doesn't* say that TDX will always use the MADT for wakeups.
>>
>> Yet, the check you have here is for TDX and *not* for the MADT.
>
> As I described in the commit message there are more than MADT that is
> required to get kexec in TDX guest.
I kinda think we should do both.
Let's make sure that all systems that depend on MADT wakeups can't
kexec() until the ACPI folks work out what to do there.
Separately, let's either fix or *mark* the kexec()-incompatible pieces
that *ARE* specific to TDX.
>> That seems wrong.
>>
>> Let's say SEV or arm64 comes along and uses the MADT for their guests.
>> They'll add another arch_kexec_load(), with a check for *their* feature.
>>
>> This all seems like you should be disabling kexec() the moment the MADT
>> CPU wakeup is used instead of making it based on TDX.
>
> I guess we can go this path if you are fine with taking CR4.MCE and shared
> memory reverting patches (they require some rework, but I can get them
> into shape quickly). After that we can forbid kexec on machines with MADT
> if nr_cpus > 1.
This goes back to what I asked before: is anyone actually going to *use*
a single-processor system that wants to kexec()? If not, let's not
waste the time to introduce code that is just going to bitrot. Just
mark it broken and move on with life.
I'm also a _bit_ curious what the implications of the CR4.MCE
preservation are. IIRC, systems are quite a bit less stable when
CR4.MCE==0. So, maybe there are some benefits to leaving it set during
kexec() for everyone. But, that probably also involves having a #MC
handler in the mix and that's obviously trouble while we're switching
kernels and messing around in the guts of things like paging configuration.
The CR4.MCE change is simple enough, but it also _completely_ glossed
over the implications to non-TDX users.
I guess the overall message here is: please try to think of the big
picture a _little_ outside of the TDX world. This patch's approach is a
bit myopic.
next prev parent reply other threads:[~2023-03-26 17:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-25 16:01 Kirill A. Shutemov
2023-03-25 16:20 ` Dave Hansen
2023-03-25 16:25 ` Dave Hansen
2023-03-25 19:25 ` Kirill A. Shutemov
2023-03-26 17:01 ` Dave Hansen [this message]
2023-03-27 1:35 ` Baoquan He
2023-03-27 11:09 ` Kirill A. Shutemov
2023-03-28 4:25 ` Baoquan He
2023-03-27 10:55 ` Kirill A. Shutemov
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=b16bcda0-f190-7849-cbbb-412d328c8806@intel.com \
--to=dave.hansen@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=ebiederm@xmission.com \
--cc=kexec@lists.infradead.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.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
all inboxes | Powered by JetHome®