LKML Archive on lore.kernel.org
 help / Atom feed
* [PATCH 0/3] x86/CPU: Get rid of show_msr
@ 2016-10-24 17:38 Borislav Petkov
  2016-10-24 17:38 ` [PATCH 1/3] x86/CPU: Remove the printk format specifier in "CPU0: " Borislav Petkov
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Borislav Petkov @ 2016-10-24 17:38 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

From: Borislav Petkov <bp@suse.de>

Hi,

respective patches should explain it all but in short, this removes some
useles crap.

Borislav Petkov (3):
  x86/CPU: Remove the printk format specifier in "CPU0: "
  x86/CPU: Merge bugs.c and bugs_64.c
  x86/CPU: Get rid of show_msr

 Documentation/kernel-parameters.txt |  6 -----
 arch/x86/kernel/cpu/Makefile        |  4 +--
 arch/x86/kernel/cpu/bugs.c          | 26 +++++++++++++++---
 arch/x86/kernel/cpu/bugs_64.c       | 33 -----------------------
 arch/x86/kernel/cpu/common.c        | 53 -------------------------------------
 arch/x86/kernel/smpboot.c           |  2 +-
 6 files changed, 24 insertions(+), 100 deletions(-)
 delete mode 100644 arch/x86/kernel/cpu/bugs_64.c

-- 
2.10.0

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

* [PATCH 1/3] x86/CPU: Remove the printk format specifier in "CPU0: "
  2016-10-24 17:38 [PATCH 0/3] x86/CPU: Get rid of show_msr Borislav Petkov
@ 2016-10-24 17:38 ` Borislav Petkov
  2016-10-25 10:33   ` [tip:x86/cpu] x86/cpu: " tip-bot for Borislav Petkov
  2016-10-24 17:38 ` [PATCH 2/3] x86/CPU: Merge bugs.c and bugs_64.c Borislav Petkov
  2016-10-24 17:38 ` [PATCH 3/3] x86/CPU: Get rid of show_msr Borislav Petkov
  2 siblings, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2016-10-24 17:38 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

From: Borislav Petkov <bp@suse.de>

We're using a literal, move it into the string.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/smpboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 36cd5dc6c42e..105487738581 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1329,7 +1329,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
 	default_setup_apic_routing();
 	cpu0_logical_apicid = apic_bsp_setup(false);
 
-	pr_info("CPU%d: ", 0);
+	pr_info("CPU0: ");
 	print_cpu_info(&cpu_data(0));
 
 	if (is_uv_system())
-- 
2.10.0

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

* [PATCH 2/3] x86/CPU: Merge bugs.c and bugs_64.c
  2016-10-24 17:38 [PATCH 0/3] x86/CPU: Get rid of show_msr Borislav Petkov
  2016-10-24 17:38 ` [PATCH 1/3] x86/CPU: Remove the printk format specifier in "CPU0: " Borislav Petkov
@ 2016-10-24 17:38 ` Borislav Petkov
  2016-10-25 10:33   ` [tip:x86/cpu] x86/cpu: " tip-bot for Borislav Petkov
  2016-10-24 17:38 ` [PATCH 3/3] x86/CPU: Get rid of show_msr Borislav Petkov
  2 siblings, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2016-10-24 17:38 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

From: Borislav Petkov <bp@suse.de>

Should be easier when following boot paths. It probably is a left over
from the x86 unification eons ago.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/cpu/Makefile  |  4 +---
 arch/x86/kernel/cpu/bugs.c    | 26 ++++++++++++++++++++++----
 arch/x86/kernel/cpu/bugs_64.c | 33 ---------------------------------
 3 files changed, 23 insertions(+), 40 deletions(-)
 delete mode 100644 arch/x86/kernel/cpu/bugs_64.c

diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index 4a8697f7d4ef..33b63670bf09 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -20,13 +20,11 @@ obj-y			:= intel_cacheinfo.o scattered.o topology.o
 obj-y			+= common.o
 obj-y			+= rdrand.o
 obj-y			+= match.o
+obj-y			+= bugs.o
 
 obj-$(CONFIG_PROC_FS)	+= proc.o
 obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o
 
-obj-$(CONFIG_X86_32)	+= bugs.o
-obj-$(CONFIG_X86_64)	+= bugs_64.o
-
 obj-$(CONFIG_CPU_SUP_INTEL)		+= intel.o
 obj-$(CONFIG_CPU_SUP_AMD)		+= amd.o
 obj-$(CONFIG_CPU_SUP_CYRIX_32)		+= cyrix.o
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index bd17db15a2c1..a44ef52184df 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -16,15 +16,19 @@
 #include <asm/msr.h>
 #include <asm/paravirt.h>
 #include <asm/alternative.h>
+#include <asm/pgtable.h>
+#include <asm/cacheflush.h>
 
 void __init check_bugs(void)
 {
 	identify_boot_cpu();
-#ifndef CONFIG_SMP
-	pr_info("CPU: ");
-	print_cpu_info(&boot_cpu_data);
-#endif
 
+	if (!IS_ENABLED(CONFIG_SMP)) {
+		pr_info("CPU: ");
+		print_cpu_info(&boot_cpu_data);
+	}
+
+#ifdef CONFIG_X86_32
 	/*
 	 * Check whether we are able to run this kernel safely on SMP.
 	 *
@@ -40,4 +44,18 @@ void __init check_bugs(void)
 	alternative_instructions();
 
 	fpu__init_check_bugs();
+#else /* CONFIG_X86_64 */
+	alternative_instructions();
+
+	/*
+	 * Make sure the first 2MB area is not mapped by huge pages
+	 * There are typically fixed size MTRRs in there and overlapping
+	 * MTRRs into large pages causes slow downs.
+	 *
+	 * Right now we don't do that with gbpages because there seems
+	 * very little benefit for that case.
+	 */
+	if (!direct_gbpages)
+		set_memory_4k((unsigned long)__va(0), 1);
+#endif
 }
diff --git a/arch/x86/kernel/cpu/bugs_64.c b/arch/x86/kernel/cpu/bugs_64.c
deleted file mode 100644
index a972ac4c7e7d..000000000000
--- a/arch/x86/kernel/cpu/bugs_64.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Copyright (C) 1994  Linus Torvalds
- *  Copyright (C) 2000  SuSE
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <asm/alternative.h>
-#include <asm/bugs.h>
-#include <asm/processor.h>
-#include <asm/mtrr.h>
-#include <asm/cacheflush.h>
-
-void __init check_bugs(void)
-{
-	identify_boot_cpu();
-#if !defined(CONFIG_SMP)
-	pr_info("CPU: ");
-	print_cpu_info(&boot_cpu_data);
-#endif
-	alternative_instructions();
-
-	/*
-	 * Make sure the first 2MB area is not mapped by huge pages
-	 * There are typically fixed size MTRRs in there and overlapping
-	 * MTRRs into large pages causes slow downs.
-	 *
-	 * Right now we don't do that with gbpages because there seems
-	 * very little benefit for that case.
-	 */
-	if (!direct_gbpages)
-		set_memory_4k((unsigned long)__va(0), 1);
-}
-- 
2.10.0

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

* [PATCH 3/3] x86/CPU: Get rid of show_msr
  2016-10-24 17:38 [PATCH 0/3] x86/CPU: Get rid of show_msr Borislav Petkov
  2016-10-24 17:38 ` [PATCH 1/3] x86/CPU: Remove the printk format specifier in "CPU0: " Borislav Petkov
  2016-10-24 17:38 ` [PATCH 2/3] x86/CPU: Merge bugs.c and bugs_64.c Borislav Petkov
@ 2016-10-24 17:38 ` Borislav Petkov
  2016-10-25 10:34   ` [tip:x86/cpu] x86/cpu: Get rid of the show_msr= boot option tip-bot for Borislav Petkov
  2 siblings, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2016-10-24 17:38 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

From: Borislav Petkov <bp@suse.de>

It is useless as it dumps the MSRs too early BUT(!) we do set MSRs later
too.

Also, it dumps only BSP MSRs as it gets called only for CPU 0.

And the MSR range array would need constant updating anyway, and so on
and so on...

Oh, and we have msr.ko and msr-tools which are the much better solution
anyway. So off it goes...

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 Documentation/kernel-parameters.txt |  6 -----
 arch/x86/kernel/cpu/common.c        | 53 -------------------------------------
 2 files changed, 59 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 459b301137c2..73de01eb92b6 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -3818,12 +3818,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 	shapers=	[NET]
 			Maximal number of shapers.
 
-	show_msr=	[x86] show boot-time MSR settings
-			Format: { <integer> }
-			Show boot-time (BIOS-initialized) MSR settings.
-			The parameter means the number of CPUs to show,
-			for example 1 means boot CPU only.
-
 	simeth=		[IA-64]
 	simscsi=
 
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 1a1d668263b9..f3e7ab29c162 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1162,51 +1162,6 @@ void identify_secondary_cpu(struct cpuinfo_x86 *c)
 	mtrr_ap_init();
 }
 
-struct msr_range {
-	unsigned	min;
-	unsigned	max;
-};
-
-static const struct msr_range msr_range_array[] = {
-	{ 0x00000000, 0x00000418},
-	{ 0xc0000000, 0xc000040b},
-	{ 0xc0010000, 0xc0010142},
-	{ 0xc0011000, 0xc001103b},
-};
-
-static void __print_cpu_msr(void)
-{
-	unsigned index_min, index_max;
-	unsigned index;
-	u64 val;
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(msr_range_array); i++) {
-		index_min = msr_range_array[i].min;
-		index_max = msr_range_array[i].max;
-
-		for (index = index_min; index < index_max; index++) {
-			if (rdmsrl_safe(index, &val))
-				continue;
-			pr_info(" MSR%08x: %016llx\n", index, val);
-		}
-	}
-}
-
-static int show_msr;
-
-static __init int setup_show_msr(char *arg)
-{
-	int num;
-
-	get_option(&arg, &num);
-
-	if (num > 0)
-		show_msr = num;
-	return 1;
-}
-__setup("show_msr=", setup_show_msr);
-
 static __init int setup_noclflush(char *arg)
 {
 	setup_clear_cpu_cap(X86_FEATURE_CLFLUSH);
@@ -1240,14 +1195,6 @@ void print_cpu_info(struct cpuinfo_x86 *c)
 		pr_cont(", stepping: 0x%x)\n", c->x86_mask);
 	else
 		pr_cont(")\n");
-
-	print_cpu_msr(c);
-}
-
-void print_cpu_msr(struct cpuinfo_x86 *c)
-{
-	if (c->cpu_index < show_msr)
-		__print_cpu_msr();
 }
 
 static __init int setup_disablecpuid(char *arg)
-- 
2.10.0

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

* [tip:x86/cpu] x86/cpu: Remove the printk format specifier in "CPU0: "
  2016-10-24 17:38 ` [PATCH 1/3] x86/CPU: Remove the printk format specifier in "CPU0: " Borislav Petkov
@ 2016-10-25 10:33   ` " tip-bot for Borislav Petkov
  0 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Borislav Petkov @ 2016-10-25 10:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: torvalds, mingo, jpoimboe, linux-kernel, dvlasenk, hpa, brgerst,
	peterz, luto, bp, bp, tglx

Commit-ID:  d54ff31dd86c6df734d6b2d6382206f2b0816642
Gitweb:     http://git.kernel.org/tip/d54ff31dd86c6df734d6b2d6382206f2b0816642
Author:     Borislav Petkov <bp@suse.de>
AuthorDate: Mon, 24 Oct 2016 19:38:42 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 25 Oct 2016 11:48:49 +0200

x86/cpu: Remove the printk format specifier in "CPU0: "

We're using a literal, move it into the string.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20161024173844.23038-2-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/smpboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 42f5eb7..e2e0e35 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1331,7 +1331,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
 	default_setup_apic_routing();
 	cpu0_logical_apicid = apic_bsp_setup(false);
 
-	pr_info("CPU%d: ", 0);
+	pr_info("CPU0: ");
 	print_cpu_info(&cpu_data(0));
 
 	if (is_uv_system())

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

* [tip:x86/cpu] x86/cpu: Merge bugs.c and bugs_64.c
  2016-10-24 17:38 ` [PATCH 2/3] x86/CPU: Merge bugs.c and bugs_64.c Borislav Petkov
@ 2016-10-25 10:33   ` " tip-bot for Borislav Petkov
  0 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Borislav Petkov @ 2016-10-25 10:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, brgerst, bp, hpa, dvlasenk, luto, jpoimboe, torvalds,
	linux-kernel, peterz, bp, mingo

Commit-ID:  62a67e123e058a67db58bc6a14354dd037bafd0a
Gitweb:     http://git.kernel.org/tip/62a67e123e058a67db58bc6a14354dd037bafd0a
Author:     Borislav Petkov <bp@suse.de>
AuthorDate: Mon, 24 Oct 2016 19:38:43 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 25 Oct 2016 11:48:50 +0200

x86/cpu: Merge bugs.c and bugs_64.c

Should be easier when following boot paths. It probably is a left over
from the x86 unification eons ago.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20161024173844.23038-3-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/cpu/Makefile  |  4 +---
 arch/x86/kernel/cpu/bugs.c    | 26 ++++++++++++++++++++++----
 arch/x86/kernel/cpu/bugs_64.c | 33 ---------------------------------
 3 files changed, 23 insertions(+), 40 deletions(-)

diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index 4a8697f..33b6367 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -20,13 +20,11 @@ obj-y			:= intel_cacheinfo.o scattered.o topology.o
 obj-y			+= common.o
 obj-y			+= rdrand.o
 obj-y			+= match.o
+obj-y			+= bugs.o
 
 obj-$(CONFIG_PROC_FS)	+= proc.o
 obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o
 
-obj-$(CONFIG_X86_32)	+= bugs.o
-obj-$(CONFIG_X86_64)	+= bugs_64.o
-
 obj-$(CONFIG_CPU_SUP_INTEL)		+= intel.o
 obj-$(CONFIG_CPU_SUP_AMD)		+= amd.o
 obj-$(CONFIG_CPU_SUP_CYRIX_32)		+= cyrix.o
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index bd17db1..a44ef52 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -16,15 +16,19 @@
 #include <asm/msr.h>
 #include <asm/paravirt.h>
 #include <asm/alternative.h>
+#include <asm/pgtable.h>
+#include <asm/cacheflush.h>
 
 void __init check_bugs(void)
 {
 	identify_boot_cpu();
-#ifndef CONFIG_SMP
-	pr_info("CPU: ");
-	print_cpu_info(&boot_cpu_data);
-#endif
 
+	if (!IS_ENABLED(CONFIG_SMP)) {
+		pr_info("CPU: ");
+		print_cpu_info(&boot_cpu_data);
+	}
+
+#ifdef CONFIG_X86_32
 	/*
 	 * Check whether we are able to run this kernel safely on SMP.
 	 *
@@ -40,4 +44,18 @@ void __init check_bugs(void)
 	alternative_instructions();
 
 	fpu__init_check_bugs();
+#else /* CONFIG_X86_64 */
+	alternative_instructions();
+
+	/*
+	 * Make sure the first 2MB area is not mapped by huge pages
+	 * There are typically fixed size MTRRs in there and overlapping
+	 * MTRRs into large pages causes slow downs.
+	 *
+	 * Right now we don't do that with gbpages because there seems
+	 * very little benefit for that case.
+	 */
+	if (!direct_gbpages)
+		set_memory_4k((unsigned long)__va(0), 1);
+#endif
 }
diff --git a/arch/x86/kernel/cpu/bugs_64.c b/arch/x86/kernel/cpu/bugs_64.c
deleted file mode 100644
index a972ac4..0000000
--- a/arch/x86/kernel/cpu/bugs_64.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Copyright (C) 1994  Linus Torvalds
- *  Copyright (C) 2000  SuSE
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <asm/alternative.h>
-#include <asm/bugs.h>
-#include <asm/processor.h>
-#include <asm/mtrr.h>
-#include <asm/cacheflush.h>
-
-void __init check_bugs(void)
-{
-	identify_boot_cpu();
-#if !defined(CONFIG_SMP)
-	pr_info("CPU: ");
-	print_cpu_info(&boot_cpu_data);
-#endif
-	alternative_instructions();
-
-	/*
-	 * Make sure the first 2MB area is not mapped by huge pages
-	 * There are typically fixed size MTRRs in there and overlapping
-	 * MTRRs into large pages causes slow downs.
-	 *
-	 * Right now we don't do that with gbpages because there seems
-	 * very little benefit for that case.
-	 */
-	if (!direct_gbpages)
-		set_memory_4k((unsigned long)__va(0), 1);
-}

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

* [tip:x86/cpu] x86/cpu: Get rid of the show_msr= boot option
  2016-10-24 17:38 ` [PATCH 3/3] x86/CPU: Get rid of show_msr Borislav Petkov
@ 2016-10-25 10:34   ` tip-bot for Borislav Petkov
  2016-10-26 22:25     ` Yinghai Lu
  0 siblings, 1 reply; 8+ messages in thread
From: tip-bot for Borislav Petkov @ 2016-10-25 10:34 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: bp, tglx, brgerst, linux-kernel, bp, torvalds, hpa, jpoimboe,
	mingo, luto, peterz, dvlasenk

Commit-ID:  59c6f278bdeea4147e8be92a3ed50a9907e60088
Gitweb:     http://git.kernel.org/tip/59c6f278bdeea4147e8be92a3ed50a9907e60088
Author:     Borislav Petkov <bp@suse.de>
AuthorDate: Mon, 24 Oct 2016 19:38:44 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 25 Oct 2016 11:48:50 +0200

x86/cpu: Get rid of the show_msr= boot option

It is useless as it dumps the MSRs too early BUT(!) we do set MSRs later too.
Also, it dumps only BSP MSRs as it gets called only for CPU 0.

And the MSR range array would need constant updating anyway, and so on
and so on...

Oh, and we have msr.ko and msr-tools which are the much better solution
anyway. So off it goes...

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20161024173844.23038-4-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 Documentation/kernel-parameters.txt |  6 -----
 arch/x86/kernel/cpu/common.c        | 53 -------------------------------------
 2 files changed, 59 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 37babf9..b676a05a 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -3824,12 +3824,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 	shapers=	[NET]
 			Maximal number of shapers.
 
-	show_msr=	[x86] show boot-time MSR settings
-			Format: { <integer> }
-			Show boot-time (BIOS-initialized) MSR settings.
-			The parameter means the number of CPUs to show,
-			for example 1 means boot CPU only.
-
 	simeth=		[IA-64]
 	simscsi=
 
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 9bd910a..2e6719f 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1162,51 +1162,6 @@ void identify_secondary_cpu(struct cpuinfo_x86 *c)
 	mtrr_ap_init();
 }
 
-struct msr_range {
-	unsigned	min;
-	unsigned	max;
-};
-
-static const struct msr_range msr_range_array[] = {
-	{ 0x00000000, 0x00000418},
-	{ 0xc0000000, 0xc000040b},
-	{ 0xc0010000, 0xc0010142},
-	{ 0xc0011000, 0xc001103b},
-};
-
-static void __print_cpu_msr(void)
-{
-	unsigned index_min, index_max;
-	unsigned index;
-	u64 val;
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(msr_range_array); i++) {
-		index_min = msr_range_array[i].min;
-		index_max = msr_range_array[i].max;
-
-		for (index = index_min; index < index_max; index++) {
-			if (rdmsrl_safe(index, &val))
-				continue;
-			pr_info(" MSR%08x: %016llx\n", index, val);
-		}
-	}
-}
-
-static int show_msr;
-
-static __init int setup_show_msr(char *arg)
-{
-	int num;
-
-	get_option(&arg, &num);
-
-	if (num > 0)
-		show_msr = num;
-	return 1;
-}
-__setup("show_msr=", setup_show_msr);
-
 static __init int setup_noclflush(char *arg)
 {
 	setup_clear_cpu_cap(X86_FEATURE_CLFLUSH);
@@ -1240,14 +1195,6 @@ void print_cpu_info(struct cpuinfo_x86 *c)
 		pr_cont(", stepping: 0x%x)\n", c->x86_mask);
 	else
 		pr_cont(")\n");
-
-	print_cpu_msr(c);
-}
-
-void print_cpu_msr(struct cpuinfo_x86 *c)
-{
-	if (c->cpu_index < show_msr)
-		__print_cpu_msr();
 }
 
 static __init int setup_disablecpuid(char *arg)

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

* Re: [tip:x86/cpu] x86/cpu: Get rid of the show_msr= boot option
  2016-10-25 10:34   ` [tip:x86/cpu] x86/cpu: Get rid of the show_msr= boot option tip-bot for Borislav Petkov
@ 2016-10-26 22:25     ` Yinghai Lu
  0 siblings, 0 replies; 8+ messages in thread
From: Yinghai Lu @ 2016-10-26 22:25 UTC (permalink / raw)
  To: Josh Poimboeuf, H. Peter Anvin, Linus Torvalds, Borislav Petkov,
	Linux Kernel Mailing List, Brian Gerst, Thomas Gleixner,
	Borislav Petkov, Peter Zijlstra, Denys Vlasenko, Ingo Molnar,
	Andy Lutomirski
  Cc: linux-tip-commits

On Tue, Oct 25, 2016 at 3:34 AM, tip-bot for Borislav Petkov
<tipbot@zytor.com> wrote:
> Commit-ID:  59c6f278bdeea4147e8be92a3ed50a9907e60088
> Gitweb:     http://git.kernel.org/tip/59c6f278bdeea4147e8be92a3ed50a9907e60088
> Author:     Borislav Petkov <bp@suse.de>
> AuthorDate: Mon, 24 Oct 2016 19:38:44 +0200
> Committer:  Ingo Molnar <mingo@kernel.org>
> CommitDate: Tue, 25 Oct 2016 11:48:50 +0200
>
> x86/cpu: Get rid of the show_msr= boot option
>
> It is useless as it dumps the MSRs too early BUT(!) we do set MSRs later too.

So that is reason that was added to print the MSR early before kernel
try to change it.

> Also, it dumps only BSP MSRs as it gets called only for CPU 0.

I sent the fix last year.

https://patchwork.kernel.org/patch/6739171/

Yinghai

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

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-24 17:38 [PATCH 0/3] x86/CPU: Get rid of show_msr Borislav Petkov
2016-10-24 17:38 ` [PATCH 1/3] x86/CPU: Remove the printk format specifier in "CPU0: " Borislav Petkov
2016-10-25 10:33   ` [tip:x86/cpu] x86/cpu: " tip-bot for Borislav Petkov
2016-10-24 17:38 ` [PATCH 2/3] x86/CPU: Merge bugs.c and bugs_64.c Borislav Petkov
2016-10-25 10:33   ` [tip:x86/cpu] x86/cpu: " tip-bot for Borislav Petkov
2016-10-24 17:38 ` [PATCH 3/3] x86/CPU: Get rid of show_msr Borislav Petkov
2016-10-25 10:34   ` [tip:x86/cpu] x86/cpu: Get rid of the show_msr= boot option tip-bot for Borislav Petkov
2016-10-26 22:25     ` Yinghai Lu

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox