Re: [PATCH v3 2/2] x86/fpu: Update the debug flow for x86_task_fpu()

From: Oleg Nesterov
Date: Fri Aug 08 2025 - 11:15:01 EST


On 08/08, Sohil Mehta wrote:
>
> On 8/8/2025 12:49 AM, Oleg Nesterov wrote:
> > On 08/08, Lai, Yi wrote:
> >>
> >> [ 17.474769] WARNING: CPU: 1 PID: 731 at arch/x86/kernel/fpu/core.c:61 x86_task_fpu+0x76/0x90
> >
> > ...
> >
> >> [ 17.481244] xfpregs_get+0x9c/0x1e0
> >
> > ...
> >
> >> [ 17.485304] do_coredump+0x370e/0x5060
> >
>
> The warning here is mostly benign, right?
>
> x86_task_fpu(target) and x86_task_fpu(current) wouldn't match, causing
> sync_fpstate() to return early.

Sorry, I am not sure I understand...

I only meant that the PF_USER_WORKER check in x86_task_fpu() is not
correct right now.

> However, independent of this warning, can xfpregs_get()->sync_fpstate()
> be called in the context of the PF_USER_WORKER thread?

Probably not but I need to recheck.

> Yeah, I am wondering whether treating PF_USER_WORKER threads as
> equivalent to PF_KTHREAD is truly accurate in the FPU.

I think it is more or less equivalent but needs some work. In fact
I was thinking about it a long ago, see
https://lore.kernel.org/all/20240606120038.GB22450@xxxxxxxxxx/

I'll try to do something next week.

Oleg.