Re: [PATCH v5 28/28] x86/fpu/amx: Clear the AMX state when appropriate

From: Dave Hansen
Date: Mon May 24 2021 - 13:40:00 EST


On 5/24/21 10:32 AM, Len Brown wrote:
> On Mon, May 24, 2021 at 10:10 AM Dave Hansen <dave.hansen@xxxxxxxxx> wrote:
>> On 5/23/21 8:13 PM, Andy Lutomirski wrote:
>>> Can we do this just when going idle?
>> Chang, you might also want to talk with folks that do scheduler
>> performance work (I've cc'd Tim). I know we're always fighting to trim
>> down the idle and wakeup paths. There might be no other alternative,
>> but unconditionally forcing an AMX XRSTOR on return from idle might be
>> considered nasty.
> I'm not excited about burdening the generic idle path with a CPU
> feature specific check that would need to be checked on every idle
> entry.

Me neither.

But, the check itself should be cheap. A cpu_feature_enabled(AMX) check
will eliminate even the cost of a branch on systems without AMX. You
could probably even get fancy and also use a static branch that doesn't
get enabled until the first AMX user shows up.