[PATCH] i386: use smp_call_function_single()

2007-02-15 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d958f143329e685d114725b64fe6bef22994c74c
Commit: d958f143329e685d114725b64fe6bef22994c74c
Parent: edf8dd36b53fdd558bc9a8ac5be793d27e110f90
Author: Alexey Dobriyan [EMAIL PROTECTED]
AuthorDate: Tue Feb 13 13:26:23 2007 +0100
Committer:  Andi Kleen [EMAIL PROTECTED]
CommitDate: Tue Feb 13 13:26:23 2007 +0100

[PATCH] i386: use smp_call_function_single()

It will execute rdmsr and wrmsr only on the cpu we need.

Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]
Signed-off-by: Andi Kleen [EMAIL PROTECTED]
---
 arch/i386/kernel/msr.c |   13 -
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
index 4e14264..bcaa6e9 100644
--- a/arch/i386/kernel/msr.c
+++ b/arch/i386/kernel/msr.c
@@ -68,7 +68,6 @@ static inline int rdmsr_eio(u32 reg, u32 *eax, u32 *edx)
 #ifdef CONFIG_SMP
 
 struct msr_command {
-   int cpu;
int err;
u32 reg;
u32 data[2];
@@ -78,16 +77,14 @@ static void msr_smp_wrmsr(void *cmd_block)
 {
struct msr_command *cmd = (struct msr_command *)cmd_block;
 
-   if (cmd-cpu == smp_processor_id())
-   cmd-err = wrmsr_eio(cmd-reg, cmd-data[0], cmd-data[1]);
+   cmd-err = wrmsr_eio(cmd-reg, cmd-data[0], cmd-data[1]);
 }
 
 static void msr_smp_rdmsr(void *cmd_block)
 {
struct msr_command *cmd = (struct msr_command *)cmd_block;
 
-   if (cmd-cpu == smp_processor_id())
-   cmd-err = rdmsr_eio(cmd-reg, cmd-data[0], cmd-data[1]);
+   cmd-err = rdmsr_eio(cmd-reg, cmd-data[0], cmd-data[1]);
 }
 
 static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
@@ -99,12 +96,11 @@ static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 
edx)
if (cpu == smp_processor_id()) {
ret = wrmsr_eio(reg, eax, edx);
} else {
-   cmd.cpu = cpu;
cmd.reg = reg;
cmd.data[0] = eax;
cmd.data[1] = edx;
 
-   smp_call_function(msr_smp_wrmsr, cmd, 1, 1);
+   smp_call_function_single(cpu, msr_smp_wrmsr, cmd, 1, 1);
ret = cmd.err;
}
preempt_enable();
@@ -120,10 +116,9 @@ static inline int do_rdmsr(int cpu, u32 reg, u32 * eax, 
u32 * edx)
if (cpu == smp_processor_id()) {
ret = rdmsr_eio(reg, eax, edx);
} else {
-   cmd.cpu = cpu;
cmd.reg = reg;
 
-   smp_call_function(msr_smp_rdmsr, cmd, 1, 1);
+   smp_call_function_single(cpu, msr_smp_rdmsr, cmd, 1, 1);
 
*eax = cmd.data[0];
*edx = cmd.data[1];
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] i386: use smp_call_function_single()

2007-02-15 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ad4e680fb2220518de5118a8e734240d4c374fe2
Commit: ad4e680fb2220518de5118a8e734240d4c374fe2
Parent: d958f143329e685d114725b64fe6bef22994c74c
Author: Alexey Dobriyan [EMAIL PROTECTED]
AuthorDate: Tue Feb 13 13:26:23 2007 +0100
Committer:  Andi Kleen [EMAIL PROTECTED]
CommitDate: Tue Feb 13 13:26:23 2007 +0100

[PATCH] i386: use smp_call_function_single()

It will execure cpuid only on the cpu we need.

Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]
Signed-off-by: Andi Kleen [EMAIL PROTECTED]
---
 arch/i386/kernel/cpuid.c |7 ++-
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c
index 4da75fa..eeae0d9 100644
--- a/arch/i386/kernel/cpuid.c
+++ b/arch/i386/kernel/cpuid.c
@@ -48,7 +48,6 @@ static struct class *cpuid_class;
 #ifdef CONFIG_SMP
 
 struct cpuid_command {
-   int cpu;
u32 reg;
u32 *data;
 };
@@ -57,8 +56,7 @@ static void cpuid_smp_cpuid(void *cmd_block)
 {
struct cpuid_command *cmd = (struct cpuid_command *)cmd_block;
 
-   if (cmd-cpu == smp_processor_id())
-   cpuid(cmd-reg, cmd-data[0], cmd-data[1], cmd-data[2],
+   cpuid(cmd-reg, cmd-data[0], cmd-data[1], cmd-data[2],
  cmd-data[3]);
 }
 
@@ -70,11 +68,10 @@ static inline void do_cpuid(int cpu, u32 reg, u32 * data)
if (cpu == smp_processor_id()) {
cpuid(reg, data[0], data[1], data[2], data[3]);
} else {
-   cmd.cpu = cpu;
cmd.reg = reg;
cmd.data = data;
 
-   smp_call_function(cpuid_smp_cpuid, cmd, 1, 1);
+   smp_call_function_single(cpu, cpuid_smp_cpuid, cmd, 1, 1);
}
preempt_enable();
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html