[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a27fbd35-aab5-4c48-9820-76832f706257@intel.com>
Date: Mon, 21 Jul 2025 18:40:04 -0700
From: Sohil Mehta <sohil.mehta@...el.com>
To: Dave Hansen <dave.hansen@...el.com>, Dave Hansen
<dave.hansen@...ux.intel.com>, <x86@...nel.org>
CC: Borislav Petkov <bp@...en8.de>, "H . Peter Anvin" <hpa@...or.com>, "Thomas
Gleixner" <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, "Sean
Christopherson" <seanjc@...gle.com>, Peter Zijlstra <peterz@...radead.org>,
Vignesh Balasubramanian <vigbalas@....com>, Rick Edgecombe
<rick.p.edgecombe@...el.com>, Oleg Nesterov <oleg@...hat.com>, "Chang S .
Bae" <chang.seok.bae@...el.com>, Brian Gerst <brgerst@...il.com>, "Eric
Biggers" <ebiggers@...gle.com>, Kees Cook <kees@...nel.org>, Chao Gao
<chao.gao@...el.com>, Fushuai Wang <wangfushuai@...du.com>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/2] x86/fpu: Update the debug flow for x86_task_fpu()
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));
}
Powered by blists - more mailing lists