Re: [patch 2/3] x86/fpu/xsave: Prepare for optimized compaction

From: Thomas Gleixner
Date: Tue Apr 19 2022 - 09:33:40 EST


On Tue, Apr 19 2022 at 14:39, Thomas Gleixner wrote:
> On Thu, Apr 14 2022 at 08:46, Dave Hansen wrote:
>>> + for (i = fls64(xtmp) - 1; i >= FIRST_EXTENDED_XFEATURE;
>>> + i = fls64(xtmp) - 1) {
>>> + unsigned int to, from;
>>
>> Is it worth a check here like:
>>
>> /* Do not move features in their init state: */
>> if (!(xcur & BIT_ULL(i))) {
>> xtmp &= ~BIT_ULL(i);
>> continue;
>> }
>
> That would also require to clear the bit in xall, but we can't do that
> in the loop as that affects offsets. Let me think about that.

Duh, misread it. Yes it's possible to do that. OTOH, with the optimized
compaction there won't be a bit set in xbv, but not in xfeatures, except
for the initial state when a task starts.

Thanks,

tglx