Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1344899 > unrolled thread

[PATCH 0/2][GIT PULL] Timekeeping updates to tip/timers/core for 4.6

Started byJohn Stultz <john.stultz@linaro.org>
First post2016-02-27 04:20 +0100
Last post2016-02-27 09:00 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2][GIT PULL] Timekeeping updates to tip/timers/core for 4.6 John Stultz <john.stultz@linaro.org> - 2016-02-27 04:20 +0100
    [PATCH 1/2] clocksource: introduce clocksource_freq2mult() John Stultz <john.stultz@linaro.org> - 2016-02-27 04:20 +0100
      [tip:timers/core] clocksource: Introduce clocksource_freq2mult() tip-bot for Alexander Kuleshov <tipbot@zytor.com> - 2016-02-27 09:10 +0100
    Re: [PATCH 0/2][GIT PULL] Timekeeping updates to tip/timers/core  for 4.6 Thomas Gleixner <tglx@linutronix.de> - 2016-02-27 09:00 +0100
    Re: [PATCH 0/2][GIT PULL] Timekeeping updates to tip/timers/core  for 4.6 Thomas Gleixner <tglx@linutronix.de> - 2016-02-27 09:00 +0100

#1344899 — [PATCH 0/2][GIT PULL] Timekeeping updates to tip/timers/core for 4.6

FromJohn Stultz <john.stultz@linaro.org>
Date2016-02-27 04:20 +0100
Subject[PATCH 0/2][GIT PULL] Timekeeping updates to tip/timers/core for 4.6
Message-ID<r6DAd-53s-5@gated-at.bofh.it>
Hey Thomas, Ingo,
  Here's my somewhat truncated queue for 4.6. I was hoping to
get the cross-timestamp patchset from Christopher sent along,
but he's got some last minute changes to address feedback from
Andy, so I'm holding off.

If the response is good for that last change, I may try to send
another set with those changes next week, but we're cutting it
fairly close to -rc6, so I'll check with you before doing so.

So.. two tiny cleanup fixes is all for now.

Boring is good, right?

Let me know if you have any thoughts or objections.

thanks
-john


The following changes since commit 18558cae0272f8fd9647e69d3fec1565a7949865:

  Linux 4.5-rc4 (2016-02-14 13:05:20 -0800)

are available in the git repository at:

  https://git.linaro.org/people/john.stultz/linux.git fortglx/4.6/time

for you to fetch changes up to ea23c1da598bfd361af5cd769e292a9667ecb7ab:

  jiffies: use CLOCKSOURCE_MASK instead of constant (2016-02-26 19:05:25 -0800)

----------------------------------------------------------------
Alexander Kuleshov (2):
      clocksource: introduce clocksource_freq2mult()
      jiffies: use CLOCKSOURCE_MASK instead of constant

 include/linux/clocksource.h | 45 +++++++++++++++++++--------------------------
 kernel/time/jiffies.c       |  2 +-
 2 files changed, 20 insertions(+), 27 deletions(-)



Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Christopher Hall <christopher.s.hall@intel.com>

Alexander Kuleshov (2):
  clocksource: introduce clocksource_freq2mult()
  jiffies: use CLOCKSOURCE_MASK instead of constant

 include/linux/clocksource.h | 45 +++++++++++++++++++--------------------------
 kernel/time/jiffies.c       |  2 +-
 2 files changed, 20 insertions(+), 27 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1344900 — [PATCH 1/2] clocksource: introduce clocksource_freq2mult()

FromJohn Stultz <john.stultz@linaro.org>
Date2016-02-27 04:20 +0100
Subject[PATCH 1/2] clocksource: introduce clocksource_freq2mult()
Message-ID<r6DAd-53s-3@gated-at.bofh.it>
In reply to#1344899
From: Alexander Kuleshov <kuleshovmail@gmail.com>

The clocksource_khz2mult() and clocksource_hz2mult() share similar
code wihch calculates a mult from the given frequency. Both implementations
in differ only in value of a frequency. This patch introduces the
clocksource_freq2mult() helper with generic implementation of
mult calculation to prevent code duplication.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 include/linux/clocksource.h | 45 +++++++++++++++++++--------------------------
 1 file changed, 19 insertions(+), 26 deletions(-)

diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 6013021..a307bf6 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -118,6 +118,23 @@ struct clocksource {
 /* simplify initialization of mask field */
 #define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
 
+static inline u32 clocksource_freq2mult(u32 freq, u32 shift_constant, u64 from)
+{
+	/*  freq = cyc/from
+	 *  mult/2^shift  = ns/cyc
+	 *  mult = ns/cyc * 2^shift
+	 *  mult = from/freq * 2^shift
+	 *  mult = from * 2^shift / freq
+	 *  mult = (from<<shift) / freq
+	 */
+	u64 tmp = ((u64)from) << shift_constant;
+
+	tmp += freq/2; /* round for do_div */
+	do_div(tmp, freq);
+
+	return (u32)tmp;
+}
+
 /**
  * clocksource_khz2mult - calculates mult from khz and shift
  * @khz:		Clocksource frequency in KHz
@@ -128,19 +145,7 @@ struct clocksource {
  */
 static inline u32 clocksource_khz2mult(u32 khz, u32 shift_constant)
 {
-	/*  khz = cyc/(Million ns)
-	 *  mult/2^shift  = ns/cyc
-	 *  mult = ns/cyc * 2^shift
-	 *  mult = 1Million/khz * 2^shift
-	 *  mult = 1000000 * 2^shift / khz
-	 *  mult = (1000000<<shift) / khz
-	 */
-	u64 tmp = ((u64)1000000) << shift_constant;
-
-	tmp += khz/2; /* round for do_div */
-	do_div(tmp, khz);
-
-	return (u32)tmp;
+	return clocksource_freq2mult(khz, shift_constant, NSEC_PER_MSEC);
 }
 
 /**
@@ -154,19 +159,7 @@ static inline u32 clocksource_khz2mult(u32 khz, u32 shift_constant)
  */
 static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
 {
-	/*  hz = cyc/(Billion ns)
-	 *  mult/2^shift  = ns/cyc
-	 *  mult = ns/cyc * 2^shift
-	 *  mult = 1Billion/hz * 2^shift
-	 *  mult = 1000000000 * 2^shift / hz
-	 *  mult = (1000000000<<shift) / hz
-	 */
-	u64 tmp = ((u64)1000000000) << shift_constant;
-
-	tmp += hz/2; /* round for do_div */
-	do_div(tmp, hz);
-
-	return (u32)tmp;
+	return clocksource_freq2mult(hz, shift_constant, NSEC_PER_SEC);
 }
 
 /**
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1344942 — [tip:timers/core] clocksource: Introduce clocksource_freq2mult()

Fromtip-bot for Alexander Kuleshov <tipbot@zytor.com>
Date2016-02-27 09:10 +0100
Subject[tip:timers/core] clocksource: Introduce clocksource_freq2mult()
Message-ID<r6I6R-8vT-1@gated-at.bofh.it>
In reply to#1344900
Commit-ID:  7aca0c07207385cca76025cc85231519935722b9
Gitweb:     http://git.kernel.org/tip/7aca0c07207385cca76025cc85231519935722b9
Author:     Alexander Kuleshov <kuleshovmail@gmail.com>
AuthorDate: Fri, 26 Feb 2016 19:14:13 -0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sat, 27 Feb 2016 08:55:30 +0100

clocksource: Introduce clocksource_freq2mult()

The clocksource_khz2mult() and clocksource_hz2mult() share similar
code wihch calculates a mult from the given frequency. Both implementations
in differ only in value of a frequency. This patch introduces the
clocksource_freq2mult() helper with generic implementation of
mult calculation to prevent code duplication.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Link: http://lkml.kernel.org/r/1456542854-22104-2-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/clocksource.h | 45 +++++++++++++++++++--------------------------
 1 file changed, 19 insertions(+), 26 deletions(-)

diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 6013021..a307bf6 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -118,6 +118,23 @@ struct clocksource {
 /* simplify initialization of mask field */
 #define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
 
+static inline u32 clocksource_freq2mult(u32 freq, u32 shift_constant, u64 from)
+{
+	/*  freq = cyc/from
+	 *  mult/2^shift  = ns/cyc
+	 *  mult = ns/cyc * 2^shift
+	 *  mult = from/freq * 2^shift
+	 *  mult = from * 2^shift / freq
+	 *  mult = (from<<shift) / freq
+	 */
+	u64 tmp = ((u64)from) << shift_constant;
+
+	tmp += freq/2; /* round for do_div */
+	do_div(tmp, freq);
+
+	return (u32)tmp;
+}
+
 /**
  * clocksource_khz2mult - calculates mult from khz and shift
  * @khz:		Clocksource frequency in KHz
@@ -128,19 +145,7 @@ struct clocksource {
  */
 static inline u32 clocksource_khz2mult(u32 khz, u32 shift_constant)
 {
-	/*  khz = cyc/(Million ns)
-	 *  mult/2^shift  = ns/cyc
-	 *  mult = ns/cyc * 2^shift
-	 *  mult = 1Million/khz * 2^shift
-	 *  mult = 1000000 * 2^shift / khz
-	 *  mult = (1000000<<shift) / khz
-	 */
-	u64 tmp = ((u64)1000000) << shift_constant;
-
-	tmp += khz/2; /* round for do_div */
-	do_div(tmp, khz);
-
-	return (u32)tmp;
+	return clocksource_freq2mult(khz, shift_constant, NSEC_PER_MSEC);
 }
 
 /**
@@ -154,19 +159,7 @@ static inline u32 clocksource_khz2mult(u32 khz, u32 shift_constant)
  */
 static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
 {
-	/*  hz = cyc/(Billion ns)
-	 *  mult/2^shift  = ns/cyc
-	 *  mult = ns/cyc * 2^shift
-	 *  mult = 1Billion/hz * 2^shift
-	 *  mult = 1000000000 * 2^shift / hz
-	 *  mult = (1000000000<<shift) / hz
-	 */
-	u64 tmp = ((u64)1000000000) << shift_constant;
-
-	tmp += hz/2; /* round for do_div */
-	do_div(tmp, hz);
-
-	return (u32)tmp;
+	return clocksource_freq2mult(hz, shift_constant, NSEC_PER_SEC);
 }
 
 /**

[toc] | [prev] | [next] | [standalone]


#1344940 — Re: [PATCH 0/2][GIT PULL] Timekeeping updates to tip/timers/core for 4.6

FromThomas Gleixner <tglx@linutronix.de>
Date2016-02-27 09:00 +0100
SubjectRe: [PATCH 0/2][GIT PULL] Timekeeping updates to tip/timers/core for 4.6
Message-ID<r6HXc-8bJ-5@gated-at.bofh.it>
In reply to#1344899
John,

On Fri, 26 Feb 2016, John Stultz wrote:

> Hey Thomas, Ingo,
>   Here's my somewhat truncated queue for 4.6. I was hoping to
> get the cross-timestamp patchset from Christopher sent along,
> but he's got some last minute changes to address feedback from
> Andy, so I'm holding off.
> 
> If the response is good for that last change, I may try to send
> another set with those changes next week, but we're cutting it
> fairly close to -rc6, so I'll check with you before doing so.

If it's just the small fixup to address review comments, we still should take
it.
 
> So.. two tiny cleanup fixes is all for now.
> 
> Boring is good, right?

:)

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1344941 — Re: [PATCH 0/2][GIT PULL] Timekeeping updates to tip/timers/core for 4.6

FromThomas Gleixner <tglx@linutronix.de>
Date2016-02-27 09:00 +0100
SubjectRe: [PATCH 0/2][GIT PULL] Timekeeping updates to tip/timers/core for 4.6
Message-ID<r6HXc-8bJ-3@gated-at.bofh.it>
In reply to#1344899
On Fri, 26 Feb 2016, John Stultz wrote:
>       clocksource: introduce clocksource_freq2mult()
>       jiffies: use CLOCKSOURCE_MASK instead of constant

Bah. You again forgot to make the first letter of the sentence upper case.

Hint: There is the concept of scripts, which can automate that :)

Thanks,

	tglx

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web