mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chang S. Bae" <chang.seok.bae@intel.com>
To: Dave Hansen <dave.hansen@linux.intel.com>,
	<linux-kernel@vger.kernel.org>
Cc: <x86@kernel.org>, <tglx@linutronix.de>, <bp@alien8.de>,
	<rafael@kernel.org>, <lenb@kernel.org>, <dave.jiang@intel.com>,
	<irenic.rajneesh@gmail.com>, <david.e.box@intel.com>
Subject: Re: [PATCH 09/10] x86/fpu: Remove unnecessary CPUID level check
Date: Mon, 16 Dec 2024 11:05:10 -0800	[thread overview]
Message-ID: <f3d50e5c-5779-4cf4-b279-31eeef2462c6@intel.com> (raw)
In-Reply-To: <20241213205038.6E71F9A4@davehans-spike.ostc.intel.com>

On 12/13/2024 12:50 PM, Dave Hansen wrote:
> 
> diff -puN arch/x86/kernel/fpu/xstate.c~xsave-leaf-checks-2 arch/x86/kernel/fpu/xstate.c
> --- a/arch/x86/kernel/fpu/xstate.c~xsave-leaf-checks-2	2024-12-13 12:45:36.903226562 -0800
> +++ b/arch/x86/kernel/fpu/xstate.c	2024-12-13 12:45:36.907226732 -0800
> @@ -764,11 +764,6 @@ void __init fpu__init_system_xstate(unsi
>   		return;
>   	}
>   
> -	if (boot_cpu_data.cpuid_level < XSTATE_CPUID) {
> -		WARN_ON_FPU(1);
> -		return;
> -	}
> -

I think this change effectively reverts commit ee813d53a8e9 ("x86, 
xsave: Check cpuid level for XSTATE_CPUID (0x0d)").

At the time of its introduction, commit b38b06659055 ("x86: filter CPU 
features dependent on unavailable CPUID levels") was already there. The 
cpu_has_xsave flag (now boot_cpu_has(X86_FEATURE_XSAVE)) should be false 
for CPUs with a lower CPUID level in this:

void __cpuinit xsave_init(void)
{
     if (!cpu_has_xsave)
         return;
     ...
        xstate_enable_boot_cpu();
}

Then, the sanity check introduced in this code path appears redundant:

xsave_init()
-> xstate_enable_boot_cpu()
     -> setup_xstate_init()
         -> setup_xstate_features()

Reviewed-by: Chang S. Bae <chang.seok.bae@intel.com>

Thanks,
Chang

  reply	other threads:[~2024-12-16 19:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13 20:50 [PATCH 00/10] [v2] x86/cpu: Centralize and standardize CPUID leaf naming Dave Hansen
2024-12-13 20:50 ` [PATCH 01/10] x86/cpu: Move MWAIT leaf definition to common header Dave Hansen
2024-12-13 20:50 ` [PATCH 02/10] x86/cpu: Use MWAIT leaf definition Dave Hansen
2024-12-13 20:50 ` [PATCH 03/10] x86/cpu: Remove unnecessary MwAIT leaf checks Dave Hansen
2024-12-13 20:50 ` [PATCH 04/10] x86/cpu: Refresh DCA leaf reading code Dave Hansen
2024-12-13 20:50 ` [PATCH 05/10] x86/cpu: Move TSC CPUID leaf definition Dave Hansen
2024-12-13 20:50 ` [PATCH 06/10] x86/tsc: Move away from TSC leaf magic numbers Dave Hansen
2024-12-13 20:50 ` [PATCH 07/10] x86/tsc: Remove CPUID "frequency" " Dave Hansen
2024-12-13 20:50 ` [PATCH 08/10] x86/fpu: Move CPUID leaf definitions to common code Dave Hansen
2024-12-13 20:50 ` [PATCH 09/10] x86/fpu: Remove unnecessary CPUID level check Dave Hansen
2024-12-16 19:05   ` Chang S. Bae [this message]
2024-12-16 21:23     ` Dave Hansen
2024-12-13 20:50 ` [PATCH 10/10] x86/cpu: Make all all CPUID leaf names consistent Dave Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f3d50e5c-5779-4cf4-b279-31eeef2462c6@intel.com \
    --to=chang.seok.bae@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave.jiang@intel.com \
    --cc=david.e.box@intel.com \
    --cc=irenic.rajneesh@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®