Re: [PATCH 3/3] x86: avoid copying dynamic FP state from init_task

From: Ingo Molnar
Date: Wed Feb 26 2025 - 08:24:09 EST



* Benjamin Berg <benjamin@xxxxxxxxxxxxxxxx> wrote:

> > Note that this patch, while it still applies cleanly, crashes/hangs
> > the x86-64 defconfig kernel bootup in the early boot phase in a KVM
> > guest bootup.
>
> Oh, outch. It seems that arch_task_struct_size can actually become
> smaller than sizeof(init_task) if the CPU does not have certain
> features.
>
> See fpu__init_task_struct_size, which does:
>
> int task_size = sizeof(struct task_struct);
> task_size -= sizeof(current->thread.fpu.__fpstate.regs);
> task_size += fpu_kernel_cfg.default_size;
>
> I'll submit a new version of the patch and then also switch to use
> memcpy_and_pad.

Thank you!

Ingo