[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7fa02be2-0884-4702-ae73-a3620938161b@intel.com>
Date: Thu, 27 Feb 2025 11:03:03 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: "Chang S. Bae" <chang.seok.bae@...el.com>, linux-kernel@...r.kernel.org
Cc: x86@...nel.org, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com
Subject: Re: [PATCH RFC v1 02/11] x86/fpu/xstate: Introduce xstate order table
and accessor macro
On 2/27/25 10:44, Chang S. Bae wrote:
> The kernel has largely assumed that higher xstate component numbers
> correspond to later offsets in the buffer. However, this assumption does
> not hold for the non-compacted format, where a newer state component may
> have a lower offset.
Maybe "no longer holds" instead of "does not hold".
This never happened before APX, right?
...
> +/*
> + * Ordering of xstate components in non-compacted format: The xfeature
> + * number does not necessarily indicate its position in the XSAVE buffer.
> + * This array defines the traversal order of xstate features, included in
> + * XFEATURE_MASK_USER_SUPPORTED.
> + */
> +static const enum xfeature xfeature_noncompact_order[] = {
Nit: I think we call this "uncompacted" in most places.
> + XFEATURE_FP,
> + XFEATURE_SSE,
> + XFEATURE_YMM,
> + XFEATURE_BNDREGS,
> + XFEATURE_BNDCSR,
> + XFEATURE_OPMASK,
> + XFEATURE_ZMM_Hi256,
> + XFEATURE_Hi16_ZMM,
> + XFEATURE_PKRU,
> + XFEATURE_XTILE_CFG,
> + XFEATURE_XTILE_DATA,
> +};
There are two possible ways to do this:
One, hard-code it like you have here. If we do this, we probably also
need some verification debug code that it got done right.
Two, dynamically generate it. I suspect that once you have the
uncompacted offset read out of CPUID, you could generate this in fewer
lines of code than it takes to define it manually. I think it would also
not require adding new features manually.
Powered by blists - more mailing lists