mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Stultz <johnstul@us.ibm.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: John Stultz <johnstul@us.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Clark Williams <williams@redhat.com>
Subject: [RFC][PATCH 1/2] Remove stop_machine from change_clocksource
Date: Tue, 27 Jul 2010 19:06:41 -0700	[thread overview]
Message-ID: <1280282802-10618-1-git-send-email-johnstul@us.ibm.com> (raw)

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


             reply	other threads:[~2010-07-28  2:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-28  2:06 John Stultz [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1280282802-10618-1-git-send-email-johnstul@us.ibm.com \
    --to=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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