[tip:x86/cpu] x86, AMD: Correct {rd,wr}msr_amd_safe warnings

2013-04-16 Thread tip-bot for Borislav Petkov
Commit-ID:  682469a5db6fade318a72406935b5000186e5643
Gitweb: http://git.kernel.org/tip/682469a5db6fade318a72406935b5000186e5643
Author: Borislav Petkov 
AuthorDate: Mon, 8 Apr 2013 17:57:45 +0200
Committer:  Borislav Petkov 
CommitDate: Tue, 16 Apr 2013 11:50:51 +0200

x86, AMD: Correct {rd,wr}msr_amd_safe warnings

The idea with those routines is to slowly phase them out and not call
them on anything else besides K8. They even have a check for that which,
when called too early, fails. Let me explain:

It gets the cpuinfo_x86 pointer from the per_cpu array and when this
happens for cpu0, before its boot_cpu_data has been copied back to the
per_cpu array in smp_store_boot_cpu_info(), we get an empty struct and
thus the check fails.

Use boot_cpu_data directly instead.

Signed-off-by: Borislav Petkov 
Link: http://lkml.kernel.org/r/136543-9837-4-git-send-email...@alien8.de
Signed-off-by: H. Peter Anvin 
---
 arch/x86/kernel/cpu/amd.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 9a2a716..cea02d7 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -20,11 +20,11 @@
 
 static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
 {
-   struct cpuinfo_x86 *c = _data(smp_processor_id());
u32 gprs[8] = { 0 };
int err;
 
-   WARN_ONCE((c->x86 != 0xf), "%s should only be used on K8!\n", __func__);
+   WARN_ONCE((boot_cpu_data.x86 != 0xf),
+ "%s should only be used on K8!\n", __func__);
 
gprs[1] = msr;
gprs[7] = 0x9c5a203a;
@@ -38,10 +38,10 @@ static inline int rdmsrl_amd_safe(unsigned msr, unsigned 
long long *p)
 
 static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val)
 {
-   struct cpuinfo_x86 *c = _data(smp_processor_id());
u32 gprs[8] = { 0 };
 
-   WARN_ONCE((c->x86 != 0xf), "%s should only be used on K8!\n", __func__);
+   WARN_ONCE((boot_cpu_data.x86 != 0xf),
+ "%s should only be used on K8!\n", __func__);
 
gprs[0] = (u32)val;
gprs[1] = msr;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:x86/cpu] x86, AMD: Correct {rd,wr}msr_amd_safe warnings

2013-04-16 Thread tip-bot for Borislav Petkov
Commit-ID:  682469a5db6fade318a72406935b5000186e5643
Gitweb: http://git.kernel.org/tip/682469a5db6fade318a72406935b5000186e5643
Author: Borislav Petkov b...@suse.de
AuthorDate: Mon, 8 Apr 2013 17:57:45 +0200
Committer:  Borislav Petkov b...@suse.de
CommitDate: Tue, 16 Apr 2013 11:50:51 +0200

x86, AMD: Correct {rd,wr}msr_amd_safe warnings

The idea with those routines is to slowly phase them out and not call
them on anything else besides K8. They even have a check for that which,
when called too early, fails. Let me explain:

It gets the cpuinfo_x86 pointer from the per_cpu array and when this
happens for cpu0, before its boot_cpu_data has been copied back to the
per_cpu array in smp_store_boot_cpu_info(), we get an empty struct and
thus the check fails.

Use boot_cpu_data directly instead.

Signed-off-by: Borislav Petkov b...@suse.de
Link: http://lkml.kernel.org/r/136543-9837-4-git-send-email...@alien8.de
Signed-off-by: H. Peter Anvin h...@zytor.com
---
 arch/x86/kernel/cpu/amd.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 9a2a716..cea02d7 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -20,11 +20,11 @@
 
 static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
 {
-   struct cpuinfo_x86 *c = cpu_data(smp_processor_id());
u32 gprs[8] = { 0 };
int err;
 
-   WARN_ONCE((c-x86 != 0xf), %s should only be used on K8!\n, __func__);
+   WARN_ONCE((boot_cpu_data.x86 != 0xf),
+ %s should only be used on K8!\n, __func__);
 
gprs[1] = msr;
gprs[7] = 0x9c5a203a;
@@ -38,10 +38,10 @@ static inline int rdmsrl_amd_safe(unsigned msr, unsigned 
long long *p)
 
 static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val)
 {
-   struct cpuinfo_x86 *c = cpu_data(smp_processor_id());
u32 gprs[8] = { 0 };
 
-   WARN_ONCE((c-x86 != 0xf), %s should only be used on K8!\n, __func__);
+   WARN_ONCE((boot_cpu_data.x86 != 0xf),
+ %s should only be used on K8!\n, __func__);
 
gprs[0] = (u32)val;
gprs[1] = msr;
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:x86/cpu] x86, AMD: Correct {rd,wr}msr_amd_safe warnings

2013-04-08 Thread tip-bot for Borislav Petkov
Commit-ID:  982f33db626e7b42f44e0d404ebb110bf139c18b
Gitweb: http://git.kernel.org/tip/982f33db626e7b42f44e0d404ebb110bf139c18b
Author: Borislav Petkov 
AuthorDate: Mon, 8 Apr 2013 17:57:45 +0200
Committer:  H. Peter Anvin 
CommitDate: Mon, 8 Apr 2013 09:07:17 -0700

x86, AMD: Correct {rd,wr}msr_amd_safe warnings

The idea with those routines is to slowly phase them out and not call
them on anything else besides K8. They even have a check for that which,
when called too early, fails. Let me explain:

It gets the cpuinfo_x86 pointer from the per_cpu array and when this
happens for cpu0, before its boot_cpu_data has been copied back to the
per_cpu array in smp_store_boot_cpu_info(), we get an empty struct and
thus the check fails.

Use boot_cpu_data directly instead.

Signed-off-by: Borislav Petkov 
Link: http://lkml.kernel.org/r/136543-9837-4-git-send-email...@alien8.de
Signed-off-by: H. Peter Anvin 
---
 arch/x86/kernel/cpu/amd.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 9a2a716..cea02d7 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -20,11 +20,11 @@
 
 static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
 {
-   struct cpuinfo_x86 *c = _data(smp_processor_id());
u32 gprs[8] = { 0 };
int err;
 
-   WARN_ONCE((c->x86 != 0xf), "%s should only be used on K8!\n", __func__);
+   WARN_ONCE((boot_cpu_data.x86 != 0xf),
+ "%s should only be used on K8!\n", __func__);
 
gprs[1] = msr;
gprs[7] = 0x9c5a203a;
@@ -38,10 +38,10 @@ static inline int rdmsrl_amd_safe(unsigned msr, unsigned 
long long *p)
 
 static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val)
 {
-   struct cpuinfo_x86 *c = _data(smp_processor_id());
u32 gprs[8] = { 0 };
 
-   WARN_ONCE((c->x86 != 0xf), "%s should only be used on K8!\n", __func__);
+   WARN_ONCE((boot_cpu_data.x86 != 0xf),
+ "%s should only be used on K8!\n", __func__);
 
gprs[0] = (u32)val;
gprs[1] = msr;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:x86/cpu] x86, AMD: Correct {rd,wr}msr_amd_safe warnings

2013-04-08 Thread tip-bot for Borislav Petkov
Commit-ID:  982f33db626e7b42f44e0d404ebb110bf139c18b
Gitweb: http://git.kernel.org/tip/982f33db626e7b42f44e0d404ebb110bf139c18b
Author: Borislav Petkov b...@suse.de
AuthorDate: Mon, 8 Apr 2013 17:57:45 +0200
Committer:  H. Peter Anvin h...@zytor.com
CommitDate: Mon, 8 Apr 2013 09:07:17 -0700

x86, AMD: Correct {rd,wr}msr_amd_safe warnings

The idea with those routines is to slowly phase them out and not call
them on anything else besides K8. They even have a check for that which,
when called too early, fails. Let me explain:

It gets the cpuinfo_x86 pointer from the per_cpu array and when this
happens for cpu0, before its boot_cpu_data has been copied back to the
per_cpu array in smp_store_boot_cpu_info(), we get an empty struct and
thus the check fails.

Use boot_cpu_data directly instead.

Signed-off-by: Borislav Petkov b...@suse.de
Link: http://lkml.kernel.org/r/136543-9837-4-git-send-email...@alien8.de
Signed-off-by: H. Peter Anvin h...@zytor.com
---
 arch/x86/kernel/cpu/amd.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 9a2a716..cea02d7 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -20,11 +20,11 @@
 
 static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
 {
-   struct cpuinfo_x86 *c = cpu_data(smp_processor_id());
u32 gprs[8] = { 0 };
int err;
 
-   WARN_ONCE((c-x86 != 0xf), %s should only be used on K8!\n, __func__);
+   WARN_ONCE((boot_cpu_data.x86 != 0xf),
+ %s should only be used on K8!\n, __func__);
 
gprs[1] = msr;
gprs[7] = 0x9c5a203a;
@@ -38,10 +38,10 @@ static inline int rdmsrl_amd_safe(unsigned msr, unsigned 
long long *p)
 
 static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val)
 {
-   struct cpuinfo_x86 *c = cpu_data(smp_processor_id());
u32 gprs[8] = { 0 };
 
-   WARN_ONCE((c-x86 != 0xf), %s should only be used on K8!\n, __func__);
+   WARN_ONCE((boot_cpu_data.x86 != 0xf),
+ %s should only be used on K8!\n, __func__);
 
gprs[0] = (u32)val;
gprs[1] = msr;
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/