Skip to content

Commit

Permalink
[PATCH] i386: use smp_call_function_single()
Browse files Browse the repository at this point in the history
It will execure cpuid only on the cpu we need.

Signed-off-by: Alexey Dobriyan <adobriyan@openvz.org>
Signed-off-by: Andi Kleen <ak@suse.de>
  • Loading branch information
Alexey Dobriyan authored and Andi Kleen committed Feb 13, 2007
1 parent d958f14 commit ad4e680
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions arch/i386/kernel/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ static struct class *cpuid_class;
#ifdef CONFIG_SMP

struct cpuid_command {
int cpu;
u32 reg;
u32 *data;
};
Expand All @@ -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]);
}

Expand All @@ -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();
}
Expand Down

0 comments on commit ad4e680

Please sign in to comment.