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

From: Sohil Mehta
Date: Fri Aug 08 2025 - 14:52:56 EST


On 8/8/2025 8:11 AM, Oleg Nesterov wrote:
>> 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 was mainly trying to confirm that the check in sync_fpstate():

if (fpu == x86_task_fpu(current))
fpu_sync_fpstate(fpu);

would always fail in the scenario reported by Yi Lai.

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

Yes, agreed.

>> 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.

IIUC, if a PF_USER_WORKER thread encounters a fault, coredump could get
triggered in its context. That could cause the above check in
sync_fpstate() to pass. Maybe I am missing something?

>
>> 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.

Sure! If it helps, you can add this patch to the end of your series. I
am not planning to pursue it any further.

Only patch 1 in this series is needed to fix the reported arch_status issue.