[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BB6FB28C-F350-4C3E-BFCA-EBA4384918F6@intel.com>
Date: Mon, 30 Aug 2021 23:39:58 +0000
From: "Bae, Chang Seok" <chang.seok.bae@...el.com>
To: Borislav Petkov <bp@...en8.de>
CC: "Lutomirski, Andy" <luto@...nel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...nel.org" <mingo@...nel.org>,
"x86@...nel.org" <x86@...nel.org>,
"Brown, Len" <len.brown@...el.com>,
"Hansen, Dave" <dave.hansen@...el.com>,
"Macieira, Thiago" <thiago.macieira@...el.com>,
"Liu, Jing2" <jing2.liu@...el.com>,
"Shankar, Ravi V" <ravi.v.shankar@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v9 08/26] x86/fpu/xstate: Introduce helpers to manage the
XSTATE buffer dynamically
On Aug 30, 2021, at 10:07, Borislav Petkov <bp@...en8.de> wrote:
> 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.
Yes, this function that you suggested to rename like
calculate_xstate_buf_size_from_mask() has no input to do with any buffer.
Perhaps, as Dave suggested [1],
"@mask The set of components for which the space is needed."
Along with these,
"calculate_xstate_buf_size_from_mask -- Calculate the amount of space
needed to store an xstate buffer with the given features.”
s/nr/last_feature_nr/
[1]: https://lore.kernel.org/lkml/bb49fdc9-2228-8bd1-bcc5-7c498daf0887@intel.com/
Thanks,
Chang
Powered by blists - more mailing lists