From: Sohil Mehta <sohil.mehta@intel.com>
To: Dave Hansen <dave.hansen@intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>, <x86@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>, "H . Peter Anvin" <hpa@zytor.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
"Sean Christopherson" <seanjc@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Vignesh Balasubramanian <vigbalas@amd.com>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
Oleg Nesterov <oleg@redhat.com>,
"Chang S . Bae" <chang.seok.bae@intel.com>,
Brian Gerst <brgerst@gmail.com>,
"Eric Biggers" <ebiggers@google.com>, Kees Cook <kees@kernel.org>,
Chao Gao <chao.gao@intel.com>,
Fushuai Wang <wangfushuai@baidu.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] x86/fpu: Update the debug flow for x86_task_fpu()
Date: Mon, 21 Jul 2025 18:40:04 -0700 [thread overview]
Message-ID: <a27fbd35-aab5-4c48-9820-76832f706257@intel.com> (raw)
In-Reply-To: <c1f9b3e1-b447-4c9e-956b-34b174203374@intel.com>
On 7/21/2025 3:34 PM, Dave Hansen wrote:
> On 7/21/25 14:53, Sohil Mehta wrote:
>> Also, update the warning to include PF_USER_WORKER, as these tasks are
>> treated the same as kernel threads in the FPU context.
>
> How so?
There are quite a few checks that special case PF_KTHREAD along with
PF_USER_WORKER. For example, FPSTATE allocation and freeing as well as
some context switch paths. Did I misinterpret something?
I believe it originates here:
https://lore.kernel.org/all/560c844c-f128-555b-40c6-31baff27537f@kernel.dk/
switch_fpu():
if (!test_tsk_thread_flag(old, TIF_NEED_FPU_LOAD) &&
cpu_feature_enabled(X86_FEATURE_FPU) &&
!(old->flags & (PF_KTHREAD | PF_USER_WORKER))) {
struct fpu *old_fpu = x86_task_fpu(old);
arch_release_task_struct():
if (fpu_state_size_dynamic() && !(tsk->flags & (PF_KTHREAD |
PF_USER_WORKER)))
fpstate_free(x86_task_fpu(tsk));
fpregs_restore_userregs():
if (WARN_ON_ONCE(current->flags & (PF_KTHREAD | PF_USER_WORKER)))
return;
kernel_fpu_begin_mask():
if (!(current->flags & (PF_KTHREAD | PF_USER_WORKER)) &&
!test_thread_flag(TIF_NEED_FPU_LOAD)) {
set_thread_flag(TIF_NEED_FPU_LOAD);
save_fpregs_to_fpstate(x86_task_fpu(current));
}
next prev parent reply other threads:[~2025-07-22 1:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-21 21:53 [PATCH v2 1/2] x86/fpu: Fix NULL dereference in avx512_status() Sohil Mehta
2025-07-21 21:53 ` [PATCH v2 2/2] x86/fpu: Update the debug flow for x86_task_fpu() Sohil Mehta
2025-07-21 22:34 ` Dave Hansen
2025-07-22 1:40 ` Sohil Mehta [this message]
2025-07-21 22:33 ` [PATCH v2 1/2] x86/fpu: Fix NULL dereference in avx512_status() Dave Hansen
2025-07-22 1:11 ` Sohil Mehta
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=a27fbd35-aab5-4c48-9820-76832f706257@intel.com \
--to=sohil.mehta@intel.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=chang.seok.bae@intel.com \
--cc=chao.gao@intel.com \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=ebiggers@google.com \
--cc=hpa@zytor.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=vigbalas@amd.com \
--cc=wangfushuai@baidu.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
all inboxes | Powered by JetHome®