mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] Clean up smp_call_function_single() callers
@ 2007-07-21 14:57 Avi Kivity
  2007-07-21 14:57 ` [PATCH 1/4] [MTRR] Simplify smp_call_function_single() call sequence Avi Kivity
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Avi Kivity @ 2007-07-21 14:57 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Now that smp_call_function_single() knows how to call a function on
the currently running cpu, there is no need to do the elaborate
get_cpu()/put_cpu() dance.

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

* [PATCH 1/4] [MTRR] Simplify smp_call_function_single() call sequence
  2007-07-21 14:57 [PATCH 0/4] Clean up smp_call_function_single() callers Avi Kivity
@ 2007-07-21 14:57 ` Avi Kivity
  2007-07-21 14:57 ` [PATCH 2/4] [cpuid driver] " Avi Kivity
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2007-07-21 14:57 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Avi Kivity, Richard Gooch

smp_call_function_single() now knows how to call the function on the
current cpu.

Cc: Richard Gooch <rgooch@atnf.csiro.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
---
 arch/i386/kernel/cpu/mtrr/main.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c
index 75dc6d5..d8db59a 100644
--- a/arch/i386/kernel/cpu/mtrr/main.c
+++ b/arch/i386/kernel/cpu/mtrr/main.c
@@ -738,13 +738,7 @@ void mtrr_ap_init(void)
  */
 void mtrr_save_state(void)
 {
-	int cpu = get_cpu();
-
-	if (cpu == 0)
-		mtrr_save_fixed_ranges(NULL);
-	else
-		smp_call_function_single(0, mtrr_save_fixed_ranges, NULL, 1, 1);
-	put_cpu();
+	smp_call_function_single(0, mtrr_save_fixed_ranges, NULL, 1, 1);
 }
 
 static int __init mtrr_init_finialize(void)
-- 
1.5.2.4


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

* [PATCH 2/4] [cpuid driver] Simplify smp_call_function_single() call sequence
  2007-07-21 14:57 [PATCH 0/4] Clean up smp_call_function_single() callers Avi Kivity
  2007-07-21 14:57 ` [PATCH 1/4] [MTRR] Simplify smp_call_function_single() call sequence Avi Kivity
@ 2007-07-21 14:57 ` Avi Kivity
  2007-07-21 14:57 ` [PATCH 3/4] [msr " Avi Kivity
  2007-07-21 14:57 ` [PATCH 4/4] [TIME] " Avi Kivity
  3 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2007-07-21 14:57 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Avi Kivity, H. Peter Anvin

smp_call_function_single() now knows how to call the function on the
current cpu.

Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
---
 arch/i386/kernel/cpuid.c |   22 +++-------------------
 1 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c
index 5c2faa1..5665dd2 100644
--- a/arch/i386/kernel/cpuid.c
+++ b/arch/i386/kernel/cpuid.c
@@ -45,8 +45,6 @@
 
 static struct class *cpuid_class;
 
-#ifdef CONFIG_SMP
-
 struct cpuid_command {
 	u32 reg;
 	u32 *data;
@@ -64,25 +62,11 @@ static inline void do_cpuid(int cpu, u32 reg, u32 * data)
 {
 	struct cpuid_command cmd;
 
-	preempt_disable();
-	if (cpu == smp_processor_id()) {
-		cpuid(reg, &data[0], &data[1], &data[2], &data[3]);
-	} else {
-		cmd.reg = reg;
-		cmd.data = data;
+	cmd.reg = reg;
+	cmd.data = data;
 
-		smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1, 1);
-	}
-	preempt_enable();
+	smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1, 1);
 }
-#else				/* ! CONFIG_SMP */
-
-static inline void do_cpuid(int cpu, u32 reg, u32 * data)
-{
-	cpuid(reg, &data[0], &data[1], &data[2], &data[3]);
-}
-
-#endif				/* ! CONFIG_SMP */
 
 static loff_t cpuid_seek(struct file *file, loff_t offset, int orig)
 {
-- 
1.5.2.4


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

* [PATCH 3/4] [msr driver] Simplify smp_call_function_single() call sequence
  2007-07-21 14:57 [PATCH 0/4] Clean up smp_call_function_single() callers Avi Kivity
  2007-07-21 14:57 ` [PATCH 1/4] [MTRR] Simplify smp_call_function_single() call sequence Avi Kivity
  2007-07-21 14:57 ` [PATCH 2/4] [cpuid driver] " Avi Kivity
@ 2007-07-21 14:57 ` Avi Kivity
  2007-07-21 14:57 ` [PATCH 4/4] [TIME] " Avi Kivity
  3 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2007-07-21 14:57 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Avi Kivity, H. Peter Anvin

smp_call_function_single() now knows how to call the function on the
current cpu.

Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
---
 arch/i386/lib/msr-on-cpu.c |   62 +++++++++++++++----------------------------
 1 files changed, 22 insertions(+), 40 deletions(-)

diff --git a/arch/i386/lib/msr-on-cpu.c b/arch/i386/lib/msr-on-cpu.c
index 7767962..57d043f 100644
--- a/arch/i386/lib/msr-on-cpu.c
+++ b/arch/i386/lib/msr-on-cpu.c
@@ -26,27 +26,18 @@ static void __rdmsr_safe_on_cpu(void *info)
 static int _rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h, int safe)
 {
 	int err = 0;
-	preempt_disable();
-	if (smp_processor_id() == cpu)
-		if (safe)
-			err = rdmsr_safe(msr_no, l, h);
-		else
-			rdmsr(msr_no, *l, *h);
-	else {
-		struct msr_info rv;
-
-		rv.msr_no = msr_no;
-		if (safe) {
-			smp_call_function_single(cpu, __rdmsr_safe_on_cpu,
-						 &rv, 0, 1);
-			err = rv.err;
-		} else {
-			smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 0, 1);
-		}
-		*l = rv.l;
-		*h = rv.h;
+	struct msr_info rv;
+
+	rv.msr_no = msr_no;
+	if (safe) {
+		smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 0, 1);
+		err = rv.err;
+	} else {
+		smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 0, 1);
 	}
-	preempt_enable();
+	*l = rv.l;
+	*h = rv.h;
+
 	return err;
 }
 
@@ -67,27 +58,18 @@ static void __wrmsr_safe_on_cpu(void *info)
 static int _wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h, int safe)
 {
 	int err = 0;
-	preempt_disable();
-	if (smp_processor_id() == cpu)
-		if (safe)
-			err = wrmsr_safe(msr_no, l, h);
-		else
-			wrmsr(msr_no, l, h);
-	else {
-		struct msr_info rv;
-
-		rv.msr_no = msr_no;
-		rv.l = l;
-		rv.h = h;
-		if (safe) {
-			smp_call_function_single(cpu, __wrmsr_safe_on_cpu,
-						 &rv, 0, 1);
-			err = rv.err;
-		} else {
-			smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 0, 1);
-		}
+	struct msr_info rv;
+
+	rv.msr_no = msr_no;
+	rv.l = l;
+	rv.h = h;
+	if (safe) {
+		smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 0, 1);
+		err = rv.err;
+	} else {
+		smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 0, 1);
 	}
-	preempt_enable();
+
 	return err;
 }
 
-- 
1.5.2.4


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

* [PATCH 4/4] [TIME] Simplify smp_call_function_single() call sequence
  2007-07-21 14:57 [PATCH 0/4] Clean up smp_call_function_single() callers Avi Kivity
                   ` (2 preceding siblings ...)
  2007-07-21 14:57 ` [PATCH 3/4] [msr " Avi Kivity
@ 2007-07-21 14:57 ` Avi Kivity
  3 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2007-07-21 14:57 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Avi Kivity, Thomas Gleixner, Ingo Molnar

smp_call_function_single() now knows how to call the function on the
current cpu.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Avi Kivity <avi@qumranet.com>
---
 kernel/time/tick-broadcast.c |   17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 8001d37..fe36b9a 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -241,21 +241,12 @@ out:
  */
 void tick_broadcast_on_off(unsigned long reason, int *oncpu)
 {
-	int cpu = get_cpu();
-
-	if (!cpu_isset(*oncpu, cpu_online_map)) {
+	if (!cpu_isset(*oncpu, cpu_online_map))
 		printk(KERN_ERR "tick-braodcast: ignoring broadcast for "
 		       "offline CPU #%d\n", *oncpu);
-	} else {
-
-		if (cpu == *oncpu)
-			tick_do_broadcast_on_off(&reason);
-		else
-			smp_call_function_single(*oncpu,
-						 tick_do_broadcast_on_off,
-						 &reason, 1, 1);
-	}
-	put_cpu();
+	else
+		smp_call_function_single(*oncpu, tick_do_broadcast_on_off,
+					 &reason, 1, 1);
 }
 
 /*
-- 
1.5.2.4


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

end of thread, other threads:[~2007-07-21 15:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-21 14:57 [PATCH 0/4] Clean up smp_call_function_single() callers Avi Kivity
2007-07-21 14:57 ` [PATCH 1/4] [MTRR] Simplify smp_call_function_single() call sequence Avi Kivity
2007-07-21 14:57 ` [PATCH 2/4] [cpuid driver] " Avi Kivity
2007-07-21 14:57 ` [PATCH 3/4] [msr " Avi Kivity
2007-07-21 14:57 ` [PATCH 4/4] [TIME] " Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome