linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: fix 32-bit *_cpu_data initializers
@ 2013-03-02 23:14 Krzysztof Mazur
  2013-03-02 23:46 ` Borislav Petkov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Krzysztof Mazur @ 2013-03-02 23:14 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, tglx, mingo, hpa, len.brown, Krzysztof Mazur

The commit 27be457000211a6903968dfce06d5f73f051a217
(x86 idle: remove 32-bit-only "no-hlt" parameter, hlt_works_ok flag)
removed the hlt_works_ok flag from struct cpuinfo_x86, but
boot_cpu_data and new_cpu_data initializers were not changed causing
setting f00f_bug flag, instead of fdiv_bug. If CONFIG_X86_F00F_BUG
is not set the f00f_bug flag is never cleared.

To avoid such problems in future C99-style initialization is now used.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
---
$ cat < /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 13
model name	: Intel(R) Pentium(R) M processor 1.73GHz
stepping	: 8
microcode	: 0x20
cpu MHz		: 800.000
cache size	: 2048 KB
fdiv_bug	: no
f00f_bug	: yes
...
	
By the way now in struct cpuinfo_x86 for 32-bit systems pad0
should be extended to 2 bytes or removed, because now 32-bit
specific bugs area have now 6 bytes + pad0.

 arch/x86/kernel/setup.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 84d3285..90d8cc9 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -171,9 +171,15 @@ static struct resource bss_resource = {
 
 #ifdef CONFIG_X86_32
 /* cpu data as detected by the assembly code in head.S */
-struct cpuinfo_x86 new_cpu_data __cpuinitdata = {0, 0, 0, 0, -1, 1, 0, 0, -1};
+struct cpuinfo_x86 new_cpu_data __cpuinitdata = {
+	.wp_works_ok = -1,
+	.fdiv_bug = -1,
+};
 /* common cpu data for all cpus */
-struct cpuinfo_x86 boot_cpu_data __read_mostly = {0, 0, 0, 0, -1, 1, 0, 0, -1};
+struct cpuinfo_x86 boot_cpu_data __read_mostly = {
+	.wp_works_ok = -1,
+	.fdiv_bug = -1,
+};
 EXPORT_SYMBOL(boot_cpu_data);
 
 unsigned int def_to_bigsmp;
-- 
1.8.2.rc1.362.gc8d5142


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

* Re: [PATCH] x86: fix 32-bit *_cpu_data initializers
  2013-03-02 23:14 [PATCH] x86: fix 32-bit *_cpu_data initializers Krzysztof Mazur
@ 2013-03-02 23:46 ` Borislav Petkov
  2013-03-06 14:31 ` [tip:x86/urgent] x86: Fix " tip-bot for Krzysztof Mazur
  2013-03-07  4:26 ` tip-bot for Krzysztof Mazur
  2 siblings, 0 replies; 4+ messages in thread
From: Borislav Petkov @ 2013-03-02 23:46 UTC (permalink / raw)
  To: Krzysztof Mazur; +Cc: x86, linux-kernel, tglx, mingo, hpa, len.brown

On Sun, Mar 03, 2013 at 12:14:42AM +0100, Krzysztof Mazur wrote:
> The commit 27be457000211a6903968dfce06d5f73f051a217
> (x86 idle: remove 32-bit-only "no-hlt" parameter, hlt_works_ok flag)
> removed the hlt_works_ok flag from struct cpuinfo_x86, but
> boot_cpu_data and new_cpu_data initializers were not changed causing
> setting f00f_bug flag, instead of fdiv_bug. If CONFIG_X86_F00F_BUG
> is not set the f00f_bug flag is never cleared.
> 
> To avoid such problems in future C99-style initialization is now used.
> 
> Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>

Good catch.

Acked-by: Borislav Petkov <bp@suse.de>

> ---
> $ cat < /proc/cpuinfo
> processor	: 0
> vendor_id	: GenuineIntel
> cpu family	: 6
> model		: 13
> model name	: Intel(R) Pentium(R) M processor 1.73GHz
> stepping	: 8
> microcode	: 0x20
> cpu MHz		: 800.000
> cache size	: 2048 KB
> fdiv_bug	: no
> f00f_bug	: yes
> ...
>
> By the way now in struct cpuinfo_x86 for 32-bit systems pad0
> should be extended to 2 bytes or removed, because now 32-bit
> specific bugs area have now 6 bytes + pad0.

It's good that you bring this up - I have a patchset which removes all
those *_bug fields in cpuinfo_x86 which means the padding goes away too.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

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

* [tip:x86/urgent] x86: Fix 32-bit *_cpu_data initializers
  2013-03-02 23:14 [PATCH] x86: fix 32-bit *_cpu_data initializers Krzysztof Mazur
  2013-03-02 23:46 ` Borislav Petkov
@ 2013-03-06 14:31 ` tip-bot for Krzysztof Mazur
  2013-03-07  4:26 ` tip-bot for Krzysztof Mazur
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Krzysztof Mazur @ 2013-03-06 14:31 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, krzysiek, tglx, bp

Commit-ID:  7ae184e4b97158629d657ab5c0eca2ea06d1c5a9
Gitweb:     http://git.kernel.org/tip/7ae184e4b97158629d657ab5c0eca2ea06d1c5a9
Author:     Krzysztof Mazur <krzysiek@podlesie.net>
AuthorDate: Sun, 3 Mar 2013 00:14:42 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 6 Mar 2013 11:17:09 +0100

x86: Fix 32-bit *_cpu_data initializers

The commit 27be457000211a6903968dfce06d5f73f051a217
('x86 idle: remove 32-bit-only "no-hlt" parameter, hlt_works_ok
flag') removed the hlt_works_ok flag from struct cpuinfo_x86, but
boot_cpu_data and new_cpu_data initializers were not changed
causing setting f00f_bug flag, instead of fdiv_bug.

If CONFIG_X86_F00F_BUG is not set the f00f_bug flag is never
cleared.

To avoid such problems in future C99-style initialization is now
used.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
Acked-by: Borislav Petkov <bp@suse.de>
Cc: len.brown@intel.com
Link: http://lkml.kernel.org/r/1362266082-2227-1-git-send-email-krzysiek@podlesie.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/setup.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 84d3285..90d8cc9 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -171,9 +171,15 @@ static struct resource bss_resource = {
 
 #ifdef CONFIG_X86_32
 /* cpu data as detected by the assembly code in head.S */
-struct cpuinfo_x86 new_cpu_data __cpuinitdata = {0, 0, 0, 0, -1, 1, 0, 0, -1};
+struct cpuinfo_x86 new_cpu_data __cpuinitdata = {
+	.wp_works_ok = -1,
+	.fdiv_bug = -1,
+};
 /* common cpu data for all cpus */
-struct cpuinfo_x86 boot_cpu_data __read_mostly = {0, 0, 0, 0, -1, 1, 0, 0, -1};
+struct cpuinfo_x86 boot_cpu_data __read_mostly = {
+	.wp_works_ok = -1,
+	.fdiv_bug = -1,
+};
 EXPORT_SYMBOL(boot_cpu_data);
 
 unsigned int def_to_bigsmp;

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

* [tip:x86/urgent] x86: Fix 32-bit *_cpu_data initializers
  2013-03-02 23:14 [PATCH] x86: fix 32-bit *_cpu_data initializers Krzysztof Mazur
  2013-03-02 23:46 ` Borislav Petkov
  2013-03-06 14:31 ` [tip:x86/urgent] x86: Fix " tip-bot for Krzysztof Mazur
@ 2013-03-07  4:26 ` tip-bot for Krzysztof Mazur
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Krzysztof Mazur @ 2013-03-07  4:26 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, krzysiek, tglx, bp

Commit-ID:  015221fefbc93689dd47508a66326556adf2abcd
Gitweb:     http://git.kernel.org/tip/015221fefbc93689dd47508a66326556adf2abcd
Author:     Krzysztof Mazur <krzysiek@podlesie.net>
AuthorDate: Sun, 3 Mar 2013 00:14:42 +0100
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Wed, 6 Mar 2013 20:15:50 -0800

x86: Fix 32-bit *_cpu_data initializers

The commit 27be457000211a6903968dfce06d5f73f051a217
('x86 idle: remove 32-bit-only "no-hlt" parameter, hlt_works_ok
flag') removed the hlt_works_ok flag from struct cpuinfo_x86, but
boot_cpu_data and new_cpu_data initializers were not changed
causing setting f00f_bug flag, instead of fdiv_bug.

If CONFIG_X86_F00F_BUG is not set the f00f_bug flag is never
cleared.

To avoid such problems in future C99-style initialization is now
used.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
Acked-by: Borislav Petkov <bp@suse.de>
Cc: len.brown@intel.com
Link: http://lkml.kernel.org/r/1362266082-2227-1-git-send-email-krzysiek@podlesie.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/kernel/setup.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 84d3285..90d8cc9 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -171,9 +171,15 @@ static struct resource bss_resource = {
 
 #ifdef CONFIG_X86_32
 /* cpu data as detected by the assembly code in head.S */
-struct cpuinfo_x86 new_cpu_data __cpuinitdata = {0, 0, 0, 0, -1, 1, 0, 0, -1};
+struct cpuinfo_x86 new_cpu_data __cpuinitdata = {
+	.wp_works_ok = -1,
+	.fdiv_bug = -1,
+};
 /* common cpu data for all cpus */
-struct cpuinfo_x86 boot_cpu_data __read_mostly = {0, 0, 0, 0, -1, 1, 0, 0, -1};
+struct cpuinfo_x86 boot_cpu_data __read_mostly = {
+	.wp_works_ok = -1,
+	.fdiv_bug = -1,
+};
 EXPORT_SYMBOL(boot_cpu_data);
 
 unsigned int def_to_bigsmp;

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

end of thread, other threads:[~2013-03-07  4:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-02 23:14 [PATCH] x86: fix 32-bit *_cpu_data initializers Krzysztof Mazur
2013-03-02 23:46 ` Borislav Petkov
2013-03-06 14:31 ` [tip:x86/urgent] x86: Fix " tip-bot for Krzysztof Mazur
2013-03-07  4:26 ` tip-bot for Krzysztof Mazur

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).