Skip to contentSkip to conversation

x86: unification of cpu/bugs.c

PATCH In review Jaswinder Singh Rajput 2 participants 5 messages Mar 26, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: unification of cpu/bugs.c

This patch is based on -tip x86/core:

From: Jaswinder Singh Rajput <[email protected]>
Date: Thu, 26 Mar 2009 17:14:38 +0530
Subject: [PATCH] x86: unification of cpu/bugs.c

Impact: Unification, cleanup

---
 arch/x86/kernel/cpu/Makefile  |    5 +--
 arch/x86/kernel/cpu/bugs.c    |   74 ++++++++++++++++++++++++++--------------
 arch/x86/kernel/cpu/bugs_64.c |   33 ------------------
 3 files changed, 50 insertions(+), 62 deletions(-)
 delete mode 100644 arch/x86/kernel/cpu/bugs_64.c
arch/x86/kernel/cpu/Makefile +2 -3
index 4e242f9..90a96ee 100644
@@ -9,10 +9,9 @@ endif
 
 obj-y			:= intel_cacheinfo.o addon_cpuid_features.o
 obj-y			+= proc.o capflags.o powerflags.o common.o
-obj-y			+= vmware.o hypervisor.o
+obj-y			+= vmware.o hypervisor.o bugs.o
 
-obj-$(CONFIG_X86_32)	+= bugs.o cmpxchg.o
-obj-$(CONFIG_X86_64)	+= bugs_64.o
+obj-$(CONFIG_X86_32)			+= cmpxchg.o
 
 obj-$(CONFIG_X86_CPU_DEBUG)		+= cpu_debug.o
 
arch/x86/kernel/cpu/bugs.c +48 -26

137 lines not on this page · raw message

arch/x86/kernel/cpu/bugs_64.c deleted +0 -33
deleted file mode 100644
index 9a3ed06..0000000
@@ -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)
-	printk("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);
-}
Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 8 lines · Jaswinder Singh Rajput

This patch is based on -tip x86/core:

From: Jaswinder Singh Rajput <[email protected]>
Date: Thu, 26 Mar 2009 17:14:38 +0530
Subject: [PATCH] x86: unification of cpu/bugs.c

Impact: Unification, cleanup

Quoted 7 lines
---
 arch/x86/kernel/cpu/Makefile  |    5 +--
 arch/x86/kernel/cpu/bugs.c    |   74 ++++++++++++++++++++++++++--------------
 arch/x86/kernel/cpu/bugs_64.c |   33 ------------------
 3 files changed, 50 insertions(+), 62 deletions(-)
 delete mode 100644 arch/x86/kernel/cpu/bugs_64.c

Jaswinder,

please send separate patches for separate changes (e.g. make separate whitespace changes).

[...]

arch/x86/kernel/cpu/bugs.c static void __init check_hlt(void) · line 101

Quoted 6 lines
arch/x86/kernel/cpu/bugs.c +1 -1
@@ -91,14 +98,14 @@ static void __init check_hlt(void)
 
 	printk(KERN_INFO "Checking 'hlt' instruction... ");
 	if (!boot_cpu_data.hlt_works_ok) {
-		printk("disabled\n");
+		printk(KERN_INFO "disabled\n");

All this is continuing the printk above.

-Robert

Quoted 23 lines
arch/x86/kernel/cpu/bugs.c +3 -3
 		return;
 	}
 	halt();
 	halt();
 	halt();
 	halt();
-	printk("OK.\n");
+	printk(KERN_INFO "OK.\n");
 }
 
 /*
@@ -122,9 +129,9 @@ static void __init check_popad(void)
 	 * CPU hard. Too bad.
 	 */
 	if (res != 12345678)
-		printk("Buggy.\n");
+		printk(KERN_INFO "Buggy.\n");
 	else
-		printk("OK.\n");
+		printk(KERN_INFO "OK.\n");
 #endif
 }
 

[...]

Signature · 3 lines
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]
#2 lore raw
Quoted 17 lines · Robert Richter
Quoted 8 lines · Jaswinder Singh Rajput

This patch is based on -tip x86/core:

From: Jaswinder Singh Rajput <[email protected]>
Date: Thu, 26 Mar 2009 17:14:38 +0530
Subject: [PATCH] x86: unification of cpu/bugs.c

Impact: Unification, cleanup

Quoted 7 lines
---
 arch/x86/kernel/cpu/Makefile  |    5 +--
 arch/x86/kernel/cpu/bugs.c    |   74 ++++++++++++++++++++++++++--------------
 arch/x86/kernel/cpu/bugs_64.c |   33 ------------------
 3 files changed, 50 insertions(+), 62 deletions(-)
 delete mode 100644 arch/x86/kernel/cpu/bugs_64.c
Quoted 5 lines

Jaswinder,

please send separate patches for separate changes (e.g. make separate whitespace changes).

Ok I removed cleanup:

From: Jaswinder Singh Rajput <[email protected]>
Date: Thu, 26 Mar 2009 17:14:38 +0530
Subject: [PATCH] x86: unification of cpu/bugs.c

Impact: unification

---
 arch/x86/kernel/cpu/Makefile  |    5 +--
 arch/x86/kernel/cpu/bugs.c    |   52 ++++++++++++++++++++++++++++++++--------
 arch/x86/kernel/cpu/bugs_64.c |   33 --------------------------
 3 files changed, 43 insertions(+), 47 deletions(-)
 delete mode 100644 arch/x86/kernel/cpu/bugs_64.c
arch/x86/kernel/cpu/Makefile +2 -3
index 4e242f9..90a96ee 100644
@@ -9,10 +9,9 @@ endif
 
 obj-y			:= intel_cacheinfo.o addon_cpuid_features.o
 obj-y			+= proc.o capflags.o powerflags.o common.o
-obj-y			+= vmware.o hypervisor.o
+obj-y			+= vmware.o hypervisor.o bugs.o
 
-obj-$(CONFIG_X86_32)	+= bugs.o cmpxchg.o
-obj-$(CONFIG_X86_64)	+= bugs_64.o
+obj-$(CONFIG_X86_32)			+= cmpxchg.o
 
 obj-$(CONFIG_X86_CPU_DEBUG)		+= cpu_debug.o
 
arch/x86/kernel/cpu/bugs.c +41 -11

75 lines not on this page · raw message

arch/x86/kernel/cpu/bugs_64.c deleted +0 -33
deleted file mode 100644
index 9a3ed06..0000000
@@ -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)
-	printk("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);
-}
Signature · 1 line
1.6.0.6
#3 lore raw
Quoted 96 lines · Jaswinder Singh Rajput
Quoted 17 lines · Robert Richter
Quoted 8 lines · Jaswinder Singh Rajput

This patch is based on -tip x86/core:

From: Jaswinder Singh Rajput <[email protected]>
Date: Thu, 26 Mar 2009 17:14:38 +0530
Subject: [PATCH] x86: unification of cpu/bugs.c

Impact: Unification, cleanup

Quoted 7 lines
---
 arch/x86/kernel/cpu/Makefile  |    5 +--
 arch/x86/kernel/cpu/bugs.c    |   74 ++++++++++++++++++++++++++--------------
 arch/x86/kernel/cpu/bugs_64.c |   33 ------------------
 3 files changed, 50 insertions(+), 62 deletions(-)
 delete mode 100644 arch/x86/kernel/cpu/bugs_64.c
Quoted 5 lines

Jaswinder,

please send separate patches for separate changes (e.g. make separate whitespace changes).

Ok I removed cleanup:

From: Jaswinder Singh Rajput <[email protected]>
Date: Thu, 26 Mar 2009 17:14:38 +0530
Subject: [PATCH] x86: unification of cpu/bugs.c

Impact: unification

---
 arch/x86/kernel/cpu/Makefile  |    5 +--
 arch/x86/kernel/cpu/bugs.c    |   52 ++++++++++++++++++++++++++++++++--------
 arch/x86/kernel/cpu/bugs_64.c |   33 --------------------------
 3 files changed, 43 insertions(+), 47 deletions(-)
 delete mode 100644 arch/x86/kernel/cpu/bugs_64.c
arch/x86/kernel/cpu/Makefile +2 -3
index 4e242f9..90a96ee 100644
@@ -9,10 +9,9 @@ endif
 
 obj-y			:= intel_cacheinfo.o addon_cpuid_features.o
 obj-y			+= proc.o capflags.o powerflags.o common.o
-obj-y			+= vmware.o hypervisor.o
+obj-y			+= vmware.o hypervisor.o bugs.o
 
-obj-$(CONFIG_X86_32)	+= bugs.o cmpxchg.o
-obj-$(CONFIG_X86_64)	+= bugs_64.o
+obj-$(CONFIG_X86_32)			+= cmpxchg.o
 
 obj-$(CONFIG_X86_CPU_DEBUG)		+= cpu_debug.o
 
arch/x86/kernel/cpu/bugs.c +13 -5
index c8e315f..9be7218 100644
@@ -6,17 +6,23 @@
  *        <[email protected]>
  *	- Channing Corn (tests & fixes),
  *	- Andrew D. Balsa (code cleanup).
+ *
+ *  Copyright (C) 2000 SuSE
  */
-#include <linux/init.h>
+
 #include <linux/utsname.h>
-#include <asm/bugs.h>
-#include <asm/processor.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
 #include <asm/processor-flags.h>
+#include <asm/alternative.h>
+#include <asm/processor.h>
+#include <asm/paravirt.h>
 #include <asm/i387.h>
+#include <asm/bugs.h>
 #include <asm/msr.h>
-#include <asm/paravirt.h>
-#include <asm/alternative.h>
 
+#ifdef CONFIG_X86_32
 static int __init no_halt(char *s)
 {
 	boot_cpu_data.hlt_works_ok = 0;
@@ -151,6 +157,22 @@ static void __init check_config(void)
 #endif
 }
 
+/*
+ * Check various bugs

arch/x86/kernel/cpu/bugs.c static void __init check_config(void) · line 171

Quoted 10 lines
arch/x86/kernel/cpu/bugs.c +10 -0
+ */
+static void __init check_various_bugs(void)
+{
+	check_config();
+	check_fpu();
+	check_hlt();
+	check_popad();
+
+	init_utsname()->machine[1] =
+		'0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);

Did you evaluate why these functions are 32 bit only? Same applies to 64 bit below. It seems this is not a unification and instead only some move-around of code.

-Robert

Quoted 78 lines
arch/x86/kernel/cpu/bugs.c +18 -6
+}
+#else /* CONFIG_X86_32 */
+static inline void __init check_various_bugs(void) {}
+#endif /* CONFIG_X86_32 */
 
 void __init check_bugs(void)
 {
@@ -159,11 +181,19 @@ void __init check_bugs(void)
 	printk("CPU: ");
 	print_cpu_info(&boot_cpu_data);
 #endif
-	check_config();
-	check_fpu();
-	check_hlt();
-	check_popad();
-	init_utsname()->machine[1] =
-		'0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
+	check_various_bugs();
 	alternative_instructions();
+
+#ifdef CONFIG_X86_64
+	/*
+	 * 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 /* CONFIG_X86_64 */
 }
arch/x86/kernel/cpu/bugs_64.c deleted +0 -33
deleted file mode 100644
index 9a3ed06..0000000
@@ -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)
-	printk("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);
-}
Signature · 1 line
1.6.0.6
Signature · 3 lines
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]
#4 lore raw
Quoted 10 lines · Robert Richter

arch/x86/kernel/cpu/bugs.c static void __init check_config(void) · line 169

Quoted 10 lines
arch/x86/kernel/cpu/bugs.c +10 -0
+/*
+ * Check various bugs
+ */
+static void __init check_various_bugs(void)
+{
+	check_config();
+	check_fpu();
+	check_hlt();
+	check_popad();
+

This is applicable to 32 bit only. right ?

Quoted 3 lines

arch/x86/kernel/cpu/bugs.c static void __init check_config(void) · line 171

Quoted 2 lines
arch/x86/kernel/cpu/bugs.c +2 -0
+	init_utsname()->machine[1] =
+		'0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);

hmm. this can be common.

Quoted 4 lines

Did you evaluate why these functions are 32 bit only? Same applies to 64 bit below. It seems this is not a unification and instead only some move-around of code.

Thanks for pointing.

--
JSR