Re: [PATCH 11/11] x86, fpu: check CPU-provided sizes against struct declarations

From: Tim Chen
Date: Wed Aug 26 2015 - 12:18:39 EST


On Tue, 2015-08-25 at 13:12 -0700, Dave Hansen wrote:
> From: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
>
> We now have C structures defined for each of the XSAVE state
> components that we support. This patch adds checks during our
> verification pass to ensure that the CPU-provided data
> enumerated in CPUID leaves matches our C structures.
>
> If not, we warn and dump all the XSAVE CPUID leaves.
>
> Note: this *actually* found an inconsistency with the MPX
> 'bndcsr' state. The hardware pads it out differently from
> our C structures. This patch caught it and warned.
>
> Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: x86@xxxxxxxxxx
> Cc: Borislav Petkov <bp@xxxxxxxxx>
> Cc: Fenghua Yu <fenghua.yu@xxxxxxxxx>
> Cc: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> ---
>
> b/appendme | 6 +++
> b/arch/x86/include/asm/fpu/types.h | 1
> b/arch/x86/kernel/fpu/xstate.c | 62 +++++++++++++++++++++++++++++++++++--
> 3 files changed, 67 insertions(+), 2 deletions(-)
>
> diff -puN /dev/null appendme
> --- /dev/null 2015-07-13 14:24:11.435656502 -0700
> +++ b/appendme 2015-08-25 12:50:01.857661314 -0700
> @@ -0,0 +1,6 @@
> +Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> +Cc: x86@xxxxxxxxxx
> +Cc: Borislav Petkov <bp@xxxxxxxxx>
> +Cc: Fenghua Yu <fenghua.yu@xxxxxxxxx>
> +Cc: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
> +Cc: linux-kernel@xxxxxxxxxxxxxxx
> diff -puN arch/x86/include/asm/fpu/types.h~x86-fpu-check-against-struct-declarations arch/x86/include/asm/fpu/types.h
> --- a/arch/x86/include/asm/fpu/types.h~x86-fpu-check-against-struct-declarations 2015-08-25 12:50:01.853661133 -0700
> +++ b/arch/x86/include/asm/fpu/types.h 2015-08-25 12:50:01.858661359 -0700
> @@ -108,6 +108,7 @@ enum xfeature_nr {
> XFEATURE_NR_OPMASK,
> XFEATURE_NR_ZMM_Hi256,
> XFEATURE_NR_Hi16_ZMM,
> + XFEATURE_NR_PT_UNIMPLEMENTED_SO_FAR,
>

Maybe move this to a separate patch with a bit more
explanation of this XFEATURE?

Tim



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/