Re: [PATCH 0/6] Introduce CET supervisor state support

From: Dave Hansen
Date: Fri Jul 12 2024 - 10:36:53 EST


On 7/11/24 15:55, Edgecombe, Rick P wrote:
>> Where current is a 'task_struct' which is in /proc/slabinfo and 'struct
>> thread_struct thread' and 'struct fpu' are embedded in 'task_struct',
>> not allocated on their own:
> I think thread_struct is always a slab, but the current->thread.fpu.fpstate
> pointer can be reallocated to point to a vmalloc in fpstate_realloc(), in the
> case of XFD features.

Good point. I was ignoring XFD and AMX. They're super rare and
(conditionally) add another 8k. -- Well, closer to 11k since we
duplicate some of the XSAVE area. -- But honestly, even if the AMX
'struct fpu' fit perfectly into 4k*3 pages and CET-S made it take 4k*4
pages, I'm not sure I'd even care. It would only affect AMX-using apps
on AMX-capable hardware. So a small minority of tasks on a small
minority of one x86 vendor's CPUs.

The (potential) space consumption from the inline task_struct fpu will
matter a lot more across all Linux users than AMX ever will. It would
affect all tasks on all CPUs that have CET-S which will hopefully be the
majority of x86 CPUs running Linux some day.