public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH 1/2] Remove stop_machine from change_clocksource
@ 2010-07-28  2:06 John Stultz
  2010-07-28  2:06 ` [RFC][PATCH 2/2] Greatly improve TSC calibration using a timer John Stultz
  2010-07-28  7:17 ` [RFC][PATCH 1/2] Remove stop_machine from change_clocksource Martin Schwidefsky
  0 siblings, 2 replies; 9+ messages in thread
From: John Stultz @ 2010-07-28  2:06 UTC (permalink / raw)
  To: LKML; +Cc: John Stultz, Thomas Gleixner, Martin Schwidefsky, Clark Williams

To me, there isn't a clear reason why we're using stop_machine
when changing clocksources instead of just taking the xtime_lock.

Additionally, using stop_machine limits us from being able to
register clocksources from timers (as needed for a following
patch).

This patch simply removes the stop_machine usage and instead
directly calls change_clocksource, which now takes the xtime_lock.

I could be totally missing something here that necessitates
stop_machine, but in my testing it seems to function fine.

Any clarifications or corrections would be appreciated!

Signed-off-by: John Stultz <johnstul@us.ibm.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Martin Schwidefsky <schwidefsky@de.ibm.com>
CC: Clark Williams <williams@redhat.com>
---
 kernel/time/timekeeping.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index e14c839..fa2cc41 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -19,7 +19,6 @@
 #include <linux/jiffies.h>
 #include <linux/time.h>
 #include <linux/tick.h>
-#include <linux/stop_machine.h>
 
 /* Structure holding internal timekeeping values. */
 struct timekeeper {
@@ -345,12 +344,12 @@ EXPORT_SYMBOL(do_settimeofday);
  *
  * Accumulates current time interval and initializes new clocksource
  */
-static int change_clocksource(void *data)
+static int change_clocksource(struct clocksource *new)
 {
-	struct clocksource *new, *old;
-
-	new = (struct clocksource *) data;
+	struct clocksource *old;
+	unsigned long flags;
 
+	write_seqlock_irqsave(&xtime_lock, flags);
 	timekeeping_forward_now();
 	if (!new->enable || new->enable(new) == 0) {
 		old = timekeeper.clock;
@@ -358,6 +357,7 @@ static int change_clocksource(void *data)
 		if (old->disable)
 			old->disable(old);
 	}
+	write_sequnlock_irqrestore(&xtime_lock, flags);
 	return 0;
 }
 
@@ -372,7 +372,7 @@ void timekeeping_notify(struct clocksource *clock)
 {
 	if (timekeeper.clock == clock)
 		return;
-	stop_machine(change_clocksource, clock, NULL);
+	change_clocksource(clock);
 	tick_clock_notify();
 }
 
-- 
1.6.0.4


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

end of thread, other threads:[~2010-07-31 20:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-28  2:06 [RFC][PATCH 1/2] Remove stop_machine from change_clocksource John Stultz
2010-07-28  2:06 ` [RFC][PATCH 2/2] Greatly improve TSC calibration using a timer John Stultz
2010-07-31 20:07   ` Kuwahara,T.
2010-07-28  7:17 ` [RFC][PATCH 1/2] Remove stop_machine from change_clocksource Martin Schwidefsky
2010-07-28 16:12   ` john stultz
2010-07-29  7:11     ` Martin Schwidefsky
2010-07-29 20:49       ` john stultz
2010-07-29 23:08         ` john stultz
2010-07-29 23:25           ` john stultz

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