mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for John Stultz <johnstul@us.ibm.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, anton@samba.org,
	hpa@zytor.com, mingo@redhat.com, johnstul@us.ibm.com,
	tglx@linutronix.de
Subject: [tip:timers/clocksource] powerpc: Simplify update_vsyscall
Date: Tue, 27 Jul 2010 10:46:51 GMT	[thread overview]
Message-ID: <tip-b0797b60d0067fe437baa97a743c7d9de98fd769@git.kernel.org> (raw)
In-Reply-To: <1279068988-21864-5-git-send-email-johnstul@us.ibm.com>

Commit-ID:  b0797b60d0067fe437baa97a743c7d9de98fd769
Gitweb:     http://git.kernel.org/tip/b0797b60d0067fe437baa97a743c7d9de98fd769
Author:     John Stultz <johnstul@us.ibm.com>
AuthorDate: Tue, 13 Jul 2010 17:56:21 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 27 Jul 2010 12:40:54 +0200

powerpc: Simplify update_vsyscall

Currently powerpc's update_vsyscall calls an inline update_gtod.
However, both are straightforward, and there are no other users,
so this patch merges update_gtod into update_vsyscall.

Signed-off-by: John Stultz <johnstul@us.ibm.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1279068988-21864-5-git-send-email-johnstul@us.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/powerpc/kernel/time.c |   55 ++++++++++++++++++++------------------------
 1 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 0441bbd..6fcd648 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -423,30 +423,6 @@ void udelay(unsigned long usecs)
 }
 EXPORT_SYMBOL(udelay);
 
-static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec,
-			       u64 new_tb_to_xs)
-{
-	/*
-	 * tb_update_count is used to allow the userspace gettimeofday code
-	 * to assure itself that it sees a consistent view of the tb_to_xs and
-	 * stamp_xsec variables.  It reads the tb_update_count, then reads
-	 * tb_to_xs and stamp_xsec and then reads tb_update_count again.  If
-	 * the two values of tb_update_count match and are even then the
-	 * tb_to_xs and stamp_xsec values are consistent.  If not, then it
-	 * loops back and reads them again until this criteria is met.
-	 * We expect the caller to have done the first increment of
-	 * vdso_data->tb_update_count already.
-	 */
-	vdso_data->tb_orig_stamp = new_tb_stamp;
-	vdso_data->stamp_xsec = new_stamp_xsec;
-	vdso_data->tb_to_xs = new_tb_to_xs;
-	vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec;
-	vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec;
-	vdso_data->stamp_xtime = xtime;
-	smp_wmb();
-	++(vdso_data->tb_update_count);
-}
-
 #ifdef CONFIG_SMP
 unsigned long profile_pc(struct pt_regs *regs)
 {
@@ -876,7 +852,7 @@ static cycle_t timebase_read(struct clocksource *cs)
 void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
 		     u32 mult)
 {
-	u64 t2x, stamp_xsec;
+	u64 new_tb_to_xs, new_stamp_xsec;
 
 	if (clock != &clocksource_timebase)
 		return;
@@ -887,11 +863,30 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
 
 	/* XXX this assumes clock->shift == 22 */
 	/* 4611686018 ~= 2^(20+64-22) / 1e9 */
-	t2x = (u64) mult * 4611686018ULL;
-	stamp_xsec = (u64) xtime.tv_nsec * XSEC_PER_SEC;
-	do_div(stamp_xsec, 1000000000);
-	stamp_xsec += (u64) xtime.tv_sec * XSEC_PER_SEC;
-	update_gtod(clock->cycle_last, stamp_xsec, t2x);
+	new_tb_to_xs = (u64) mult * 4611686018ULL;
+	new_stamp_xsec = (u64) xtime.tv_nsec * XSEC_PER_SEC;
+	do_div(new_stamp_xsec, 1000000000);
+	new_stamp_xsec += (u64) xtime.tv_sec * XSEC_PER_SEC;
+
+	/*
+	 * tb_update_count is used to allow the userspace gettimeofday code
+	 * to assure itself that it sees a consistent view of the tb_to_xs and
+	 * stamp_xsec variables.  It reads the tb_update_count, then reads
+	 * tb_to_xs and stamp_xsec and then reads tb_update_count again.  If
+	 * the two values of tb_update_count match and are even then the
+	 * tb_to_xs and stamp_xsec values are consistent.  If not, then it
+	 * loops back and reads them again until this criteria is met.
+	 * We expect the caller to have done the first increment of
+	 * vdso_data->tb_update_count already.
+	 */
+	vdso_data->tb_orig_stamp = clock->cycle_last;
+	vdso_data->stamp_xsec = new_stamp_xsec;
+	vdso_data->tb_to_xs = new_tb_to_xs;
+	vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec;
+	vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec;
+	vdso_data->stamp_xtime = xtime;
+	smp_wmb();
+	++(vdso_data->tb_update_count);
 }
 
 void update_vsyscall_tz(void)

  parent reply	other threads:[~2010-07-27 10:47 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-14  0:56 [PATCH 00/11] -tip Timekeeping changes for 2.6.36 John Stultz
2010-07-14  0:56 ` [PATCH 01/11] x86: Fix vtime/file timestamp inconsistencies John Stultz
2010-07-14  0:56   ` [PATCH 02/11] Implement timespec_add John Stultz
2010-07-14  0:56     ` [PATCH 03/11] time: Kill off CONFIG_GENERIC_TIME John Stultz
2010-07-14  0:56       ` [PATCH 04/11] powerpc: Simplify update_vsyscall John Stultz
2010-07-14  0:56         ` [PATCH 05/11] powerpc: Cleanup xtime usage John Stultz
2010-07-14  0:56           ` [PATCH 06/11] Fix update_vsyscall to provide wall_to_monotonic offset John Stultz
2010-07-14  0:56             ` [PATCH 07/11] Convert um to use read_persistent_clock John Stultz
2010-07-14  0:56               ` [PATCH 08/11] Cleanup hrtimer.c's direct access to wall_to_monotonic John Stultz
2010-07-14  0:56                 ` [PATCH 09/11] Make xtime and wall_to_monotonic static John Stultz
2010-07-14  0:56                   ` [PATCH 10/11] Convert common x86 clocksources to use clocksource_register_hz/khz John Stultz
2010-07-14  0:56                     ` [PATCH 11/11] Add __clocksource_updatefreq_hz/khz methods John Stultz
2010-07-27 10:49                       ` [tip:timers/clocksource] clocksource: " tip-bot for John Stultz
2010-07-27 10:48                     ` [tip:timers/clocksource] x86: Convert common clocksources to use clocksource_register_hz/khz tip-bot for John Stultz
2010-07-27 10:48                   ` [tip:timers/clocksource] timekeeping: Make xtime and wall_to_monotonic static tip-bot for John Stultz
2010-07-27 10:48                 ` [tip:timers/clocksource] hrtimer: Cleanup direct access to wall_to_monotonic tip-bot for John Stultz
2010-07-27 10:47               ` [tip:timers/clocksource] um: Convert to use read_persistent_clock tip-bot for John Stultz
2010-07-27 10:47             ` [tip:timers/clocksource] timkeeping: Fix update_vsyscall to provide wall_to_monotonic offset tip-bot for John Stultz
2010-07-27 10:47           ` [tip:timers/clocksource] powerpc: Cleanup xtime usage tip-bot for John Stultz
2010-07-27 10:46         ` tip-bot for John Stultz [this message]
2010-07-27 23:41         ` [PATCH 04/11] powerpc: Simplify update_vsyscall Paul Mackerras
2010-07-28  1:33           ` john stultz
2010-07-27 10:46       ` [tip:timers/clocksource] time: Kill off CONFIG_GENERIC_TIME tip-bot for John Stultz
2010-07-27 10:46     ` [tip:timers/clocksource] time: Implement timespec_add tip-bot for John Stultz
2010-07-14  2:40   ` [PATCH 01/11] x86: Fix vtime/file timestamp inconsistencies KOSAKI Motohiro
2010-07-14 16:19     ` john stultz
2010-07-15  1:51       ` KOSAKI Motohiro
2010-07-15  2:46         ` john stultz
2010-07-15  4:41           ` KOSAKI Motohiro
2010-07-15 19:30             ` john stultz
2010-07-15  2:51         ` john stultz
2010-07-15  4:41           ` KOSAKI Motohiro
2010-07-27 10:45   ` [tip:timers/clocksource] " tip-bot for 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=tip-b0797b60d0067fe437baa97a743c7d9de98fd769@git.kernel.org \
    --to=johnstul@us.ibm.com \
    --cc=anton@samba.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /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