From: Eric Biggers <ebiggers@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
linux-crypto@vger.kernel.org, linux-pm@vger.kernel.org,
Borislav Petkov <bp@alien8.de>,
Thomas Gleixner <tglx@linutronix.de>,
Ayush Jain <Ayush.Jain3@amd.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Ard Biesheuvel <ardb@kernel.org>
Subject: Re: [PATCH] x86/fpu: Fix irq_fpu_usable() to return false during CPU onlining
Date: Mon, 19 May 2025 10:04:25 -0700 [thread overview]
Message-ID: <20250519170425.GA1243@sol> (raw)
In-Reply-To: <aCrsiPd3u1-tEVd0@gmail.com>
On Mon, May 19, 2025 at 10:32:08AM +0200, Ingo Molnar wrote:
>
> > void fpu__init_cpu(void)
> > {
> > fpu__init_cpu_generic();
> > fpu__init_cpu_xstate();
> > +
> > + /* Start allowing kernel-mode FPU: */
> > + this_cpu_write(kernel_fpu_allowed, true);
> > }
>
> BTW., this is the chunk that fixes the crypto crash, right? If yes,
> then could you please split this from the main patch, with the main
> patch setting kernel_fpu_allowed very early, which should make the main
> patch an identity transformation with no (expected) change in behavior.
>
> Likewise, the cpu_disable_common change should similarly replicate the
> current code, and should only be changed in the second patch.
>
> Phasing it in like that should improve bisectability, for the off
> chance of some regression.
The line in fpu__init_cpu() is needed at the same time that the boolean is
inverted (when in_kernel_fpu is replaced with kernel_fpu_allowed), since
otherwise it never gets set to true and kernel-mode FPU is never allowed.
We could include the fpu__init_cpu() change in patch 1 and leave CPU hotplug
broken, and fix it in patch 2 by updating cpu_disable_common(). I think it
makes a lot more sense to keep them together though.
Or we could use DEFINE_PER_CPU() = true in patch 1, then revert that in patch 2
and replace it with the line in fpu__init_cpu(). But again I think the split
would be more likely to create problems than solve them.
- Eric
next prev parent reply other threads:[~2025-05-19 17:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-18 19:32 [PATCH] x86/fpu: Fix irq_fpu_usable() to return false during CPU onlining Eric Biggers
2025-05-19 4:18 ` Jain, Ayush
2025-05-19 8:26 ` Ingo Molnar
2025-05-19 8:32 ` Ingo Molnar
2025-05-19 17:04 ` Eric Biggers [this message]
2025-05-20 9:33 ` Ingo Molnar
2025-05-21 15:39 ` Thomas Gleixner
2025-05-24 2:55 ` Eric Biggers
2025-05-21 15:39 ` Thomas Gleixner
2025-05-26 2:56 ` Herbert Xu
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=20250519170425.GA1243@sol \
--to=ebiggers@kernel.org \
--cc=Ayush.Jain3@amd.com \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).