linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Support generic disabling of all XSAVE features
@ 2017-06-21 23:41 Andi Kleen
  2017-06-21 23:41 ` [PATCH 1/5] x86/xsave: Move xsave initialization to after parsing early parameters Andi Kleen
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Andi Kleen @ 2017-06-21 23:41 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel

For performance testing and debugging it can be useful to disable XSAVE
features individually. This patchkit hooks up XSAVE with the
generic clearcpuid=... option, so that disabling a CPUID feature
automatically disables the respective XSAVE feature.

It also cleans up CPUID dependency management. Currently it's
possible to generate configurations with clearcpuid that crash.

It replaces an earlier patchkit that did this with special
case options.

v1:
Initial post
v2:
Work around broken lguest by exporting set_cpu_cap
Repost with cover letter
v3:
Repost. No changes to code.

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH 1/5] x86/xsave: Move xsave initialization to after parsing early parameters
@ 2017-06-05 22:59 Andi Kleen
  2017-06-06  7:18 ` Thomas Gleixner
  0 siblings, 1 reply; 10+ messages in thread
From: Andi Kleen @ 2017-06-05 22:59 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

Move the XSAVE initialization code to be after parsing early parameters.
I don't see any reason why the FPU code needs to be initialized that
early, nothing else in the initialization phase uses XSAVE.
This is useful to be able to handle command line parameters in the
XSAVE initialization code.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/kernel/cpu/common.c | 1 -
 arch/x86/kernel/setup.c      | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index c8b39870f33e..60b7aa6330ed 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -885,7 +885,6 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 	}
 
 	setup_force_cpu_cap(X86_FEATURE_ALWAYS);
-	fpu__init_system(c);
 }
 
 void __init early_cpu_init(void)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index f81823695014..77db31315af3 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -91,6 +91,7 @@
 #include <asm/processor.h>
 #include <asm/bugs.h>
 #include <asm/kasan.h>
+#include <asm/fpu/internal.h>
 
 #include <asm/vsyscall.h>
 #include <asm/cpu.h>
@@ -982,6 +983,8 @@ void __init setup_arch(char **cmdline_p)
 
 	parse_early_param();
 
+	fpu__init_system(&boot_cpu_data);
+
 #ifdef CONFIG_MEMORY_HOTPLUG
 	/*
 	 * Memory used by the kernel cannot be hot-removed because Linux
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH 1/5] x86/xsave: Move xsave initialization to after parsing early parameters
@ 2017-05-31 22:22 Andi Kleen
  0 siblings, 0 replies; 10+ messages in thread
From: Andi Kleen @ 2017-05-31 22:22 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, hpa, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

Move the XSAVE initialization code to be after parsing early parameters.
I don't see any reason why the FPU code needs to be initialized that
early, nothing else in the initialization phase uses XSAVE.
This is useful to be able to handle command line parameters in the
XSAVE initialization code.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/kernel/cpu/common.c | 1 -
 arch/x86/kernel/setup.c      | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index c8b39870f33e..60b7aa6330ed 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -885,7 +885,6 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 	}
 
 	setup_force_cpu_cap(X86_FEATURE_ALWAYS);
-	fpu__init_system(c);
 }
 
 void __init early_cpu_init(void)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index f81823695014..77db31315af3 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -91,6 +91,7 @@
 #include <asm/processor.h>
 #include <asm/bugs.h>
 #include <asm/kasan.h>
+#include <asm/fpu/internal.h>
 
 #include <asm/vsyscall.h>
 #include <asm/cpu.h>
@@ -982,6 +983,8 @@ void __init setup_arch(char **cmdline_p)
 
 	parse_early_param();
 
+	fpu__init_system(&boot_cpu_data);
+
 #ifdef CONFIG_MEMORY_HOTPLUG
 	/*
 	 * Memory used by the kernel cannot be hot-removed because Linux
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-06-22 10:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21 23:41 Support generic disabling of all XSAVE features Andi Kleen
2017-06-21 23:41 ` [PATCH 1/5] x86/xsave: Move xsave initialization to after parsing early parameters Andi Kleen
2017-06-21 23:41 ` [PATCH 2/5] x86/cpuid: Add generic table for cpuid dependencies Andi Kleen
2017-06-22  9:28   ` Jonathan McDowell
2017-06-21 23:41 ` [PATCH 3/5] x86/cpuid: Make clearcpuid an early param Andi Kleen
2017-06-21 23:41 ` [PATCH 4/5] x86/xsave: Make XSAVE check the base CPUID features before enabling Andi Kleen
2017-06-21 23:41 ` [PATCH 5/5] x86/xsave: Using generic CPUID clearing when disabling XSAVE Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2017-06-05 22:59 [PATCH 1/5] x86/xsave: Move xsave initialization to after parsing early parameters Andi Kleen
2017-06-06  7:18 ` Thomas Gleixner
2017-05-31 22:22 Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).