All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: x86@kernel.org, "Chang S. Bae" <chang.seok.bae@intel.com>
Subject: [patch 3/7] x86/fpu/xsave: Initialize offset/size cache early
Date: Thu, 24 Mar 2022 14:47:11 +0100 (CET)	[thread overview]
Message-ID: <20220324134623.519411939@linutronix.de> (raw)
In-Reply-To: 20220324134548.432837672@linutronix.de

Reading XSTATE feature information from CPUID over and over does not make
sense. The information has to be cached anyway, so it can be done early.

This prepares for runtime calculation of XSTATE offsets and allows
consolidation of the size calculation functions in a later step.

Rename the function while at it as it does not setup any features.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/kernel/fpu/xstate.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -180,7 +180,7 @@ static bool xfeature_enabled(enum xfeatu
  * Record the offsets and sizes of various xstates contained
  * in the XSAVE state memory layout.
  */
-static void __init setup_xstate_features(void)
+static void __init setup_xstate_cache(void)
 {
 	u32 eax, ebx, ecx, edx, i;
 	/* start at the beginning of the "extended state" */
@@ -390,7 +390,6 @@ static void __init setup_init_fpu_buf(vo
 	if (!boot_cpu_has(X86_FEATURE_XSAVE))
 		return;
 
-	setup_xstate_features();
 	print_xstate_features();
 
 	xstate_init_xcomp_bv(&init_fpstate.regs.xsave, fpu_kernel_cfg.max_features);
@@ -906,6 +905,10 @@ void __init fpu__init_system_xstate(unsi
 
 	/* Enable xstate instructions to be able to continue with initialization: */
 	fpu__init_cpu_xstate();
+
+	/* Cache size, offset and flags for initialization */
+	setup_xstate_cache();
+
 	err = init_xstate_size();
 	if (err)
 		goto out_disable;


  parent reply	other threads:[~2022-03-24 13:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24 13:47 [patch 0/7] x86/fpu: Cure supervisor mode (ENQCMD) fallout Thomas Gleixner
2022-03-24 13:47 ` [patch 1/7] x86/fpu: Remove redundant XCOMP_BV initialization Thomas Gleixner
2022-03-31  9:01   ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
2022-03-24 13:47 ` [patch 2/7] x86/fpu: Remove unused supervisor only offsets Thomas Gleixner
2022-03-31  9:00   ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
2022-03-24 13:47 ` Thomas Gleixner [this message]
2022-03-31  9:00   ` [tip: x86/urgent] x86/fpu/xsave: Initialize offset/size cache early tip-bot2 for Thomas Gleixner
2022-03-24 13:47 ` [patch 4/7] x86/fpu: Cache xfeature flags from CPUID Thomas Gleixner
2022-03-31  9:00   ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
2022-03-24 13:47 ` [patch 5/7] x86/fpu/xsave: Handle compacted offsets correctly with supervisor states Thomas Gleixner
2022-03-31  9:00   ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
2022-03-24 13:47 ` [patch 6/7] x86/fpu/xstate: Handle supervisor states in XSTATE permissions Thomas Gleixner
2022-03-31  9:00   ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
2022-03-24 13:47 ` [patch 7/7] x86/fpu/xstate: Consolidate size calculations Thomas Gleixner
2022-03-28 18:43   ` [patch V2 " Thomas Gleixner
2022-03-31  9:00     ` [tip: x86/urgent] " tip-bot2 for Thomas Gleixner
2022-03-28 12:39 ` [patch 0/7] x86/fpu: Cure supervisor mode (ENQCMD) fallout Chang S. Bae
2022-03-28 22:30 ` Fenghua Yu

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=20220324134623.519411939@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=chang.seok.bae@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.