[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1da03226-461f-5a45-6947-7a6f220a6e6e@citrix.com>
Date: Mon, 26 Sep 2022 20:09:26 +0000
From: Andrew Cooper <Andrew.Cooper3@...rix.com>
To: "x86@...nel.org" <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>
CC: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Marek Marczykowski-Górecki
<marmarek@...isiblethingslab.com>,
Andrew Cooper <Andrew.Cooper3@...rix.com>
Subject: Ping: [PATCH] x86/fpu/xstate: Fix XSTATE_WARN_ON() to emit relevant
diagnostics
On 10/08/2022 23:19, Andrew Cooper wrote:
> "XSAVE consistency problem" has been reported under Xen, but that's the extent
> of my divination skills.
>
> Modify XSTATE_WARN_ON() to force the caller to provide relevant diagnostic
> information, and modify each caller suitably.
>
> For check_xstate_against_struct(), this removes a double WARN() where one will
> do perfectly fine.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@...rix.com>
> ---
> CC: Thomas Gleixner <tglx@...utronix.de>
> CC: Ingo Molnar <mingo@...hat.com>
> CC: Borislav Petkov <bp@...en8.de>
> CC: Dave Hansen <dave.hansen@...ux.intel.com>
> CC: x86@...nel.org
> CC: Marek Marczykowski-Górecki <marmarek@...isiblethingslab.com>
>
> RFC: CC stable? This has been wonky debugging for 7 years.
>
> Apparently "size 832 != kernel_size 0" so let the debugging continue...
> ---
> arch/x86/kernel/fpu/xstate.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
> index c8340156bfd2..28b6478ea531 100644
> --- a/arch/x86/kernel/fpu/xstate.c
> +++ b/arch/x86/kernel/fpu/xstate.c
> @@ -440,8 +440,8 @@ static void __init __xstate_dump_leaves(void)
> }
> }
>
> -#define XSTATE_WARN_ON(x) do { \
> - if (WARN_ONCE(x, "XSAVE consistency problem, dumping leaves")) { \
> +#define XSTATE_WARN_ON(x, fmt, ...) do { \
> + if (WARN_ONCE(x, "XSAVE consistency problem: " fmt, ##__VA_ARGS__)) { \
> __xstate_dump_leaves(); \
> } \
> } while (0)
> @@ -554,8 +554,7 @@ static bool __init check_xstate_against_struct(int nr)
> (nr >= XFEATURE_MAX) ||
> (nr == XFEATURE_PT_UNIMPLEMENTED_SO_FAR) ||
> ((nr >= XFEATURE_RSRVD_COMP_11) && (nr <= XFEATURE_RSRVD_COMP_16))) {
> - WARN_ONCE(1, "no structure for xstate: %d\n", nr);
> - XSTATE_WARN_ON(1);
> + XSTATE_WARN_ON(1, "No structure for xstate: %d\n", nr);
> return false;
> }
> return true;
> @@ -598,12 +597,13 @@ static bool __init paranoid_xstate_size_valid(unsigned int kernel_size)
> * XSAVES.
> */
> if (!xsaves && xfeature_is_supervisor(i)) {
> - XSTATE_WARN_ON(1);
> + XSTATE_WARN_ON(1, "Got supervisor feature %d, but XSAVES not advertised\n", i);
> return false;
> }
> }
> size = xstate_calculate_size(fpu_kernel_cfg.max_features, compacted);
> - XSTATE_WARN_ON(size != kernel_size);
> + XSTATE_WARN_ON(size != kernel_size,
> + "size %u != kernel_size %u\n", size, kernel_size);
> return size == kernel_size;
> }
>
Powered by blists - more mailing lists