Re: [PATCH 3/9] x86/fpu: Make task_struct::thread constant size

From: Oleg Nesterov
Date: Wed Jun 12 2024 - 16:32:48 EST


Damn, sorry for the additional spam, but if I was not clear...

On 06/12, Oleg Nesterov wrote:
>
> The patch below seems to fix the problem.

Of course I am not trying to propose this change. This is just
the debugging patch. Which can hopefully explain the problem.

> Again, the changes in fpu__init_system_early_generic() are not
> strictly needed to fix it, but I believe make sense anyway.

...

> static void __init fpu__init_system_early_generic(void)
> {
> - int this_cpu = smp_processor_id();
> -
> fpstate_reset(&x86_init_fpu);
> current->thread.fpu = &x86_init_fpu;
> - per_cpu(fpu_fpregs_owner_ctx, this_cpu) = &x86_init_fpu;
> - x86_init_fpu.last_cpu = this_cpu;
> + set_thread_flag(TIF_NEED_FPU_LOAD);
> + x86_init_fpu.last_cpu = -1;

Yes, in particular set_thread_flag(TIF_NEED_FPU_LOAD). And x86_init_fpu
should die after the next patch.

Oleg.