From: John Stultz on
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(a)us.ibm.com>
CC: Thomas Gleixner <tglx(a)linutronix.de>
CC: Martin Schwidefsky <schwidefsky(a)de.ibm.com>
CC: Clark Williams <williams(a)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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/