Re: [PATCH v9 08/26] x86/fpu/xstate: Introduce helpers to manage the XSTATE buffer dynamically

From: Borislav Petkov
Date: Mon Aug 30 2021 - 13:06:49 EST


On Wed, Aug 18, 2021 at 07:46:55PM +0000, Bae, Chang Seok wrote:
> No, this non-compacted thing is not for optimization. SDM is not quite clear
> about the logic behind the non-compacted format -- some state’s offset does
> not always match with the 'size + offset' of the previous one, even without
> 64B-alignment. So, the loop is only for the compacted format, not the
> non-compacted one.
>
> It was refactored to use in the new helper to find feature_nr’s start point.
> If the size is added up here, it is not ‘i’'s start point anymore.

Let's see, we're still talking about this thing, right:

nr = fls64(mask) - 1;

if (!boot_cpu_has(X86_FEATURE_XSAVES))
return xstate_offsets[nr] + xstate_sizes[nr];

?

That @mask is "which components reserved in the buffer."

Which buffer? The mask being passed is independent from whatever buffer.

So you need to do a lot more explaining here before this goes anywhere.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette