linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/tsc: fold set_cyc2ns_scale() into caller
@ 2017-05-17 20:39 Arnd Bergmann
  2017-05-23  8:57 ` [tip:sched/core] x86/tsc: Fold " tip-bot for Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-05-17 20:39 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: Arnd Bergmann, Thomas Gleixner, H. Peter Anvin, x86,
	Prarit Bhargava, linux-kernel

The newly introduced wrapper function only has one caller,
and this one is conditional, causing a harmless warning when
CONFIG_CPU_FREQ is disabled:

arch/x86/kernel/tsc.c:189:13: error: 'set_cyc2ns_scale' defined but not used [-Werror=unused-function]

My first idea was to move the wrapper inside of that #ifdef,
but on second thought it seemed nicer to remove it completely
again and rename __set_cyc2ns_scale back to set_cyc2ns_scale,
but leaving the extra argument.

Fixes: 615cd03373a0 ("x86/tsc: Fix sched_clock() sync")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/kernel/tsc.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index a3b544264360..5270fc0c2df6 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -137,7 +137,7 @@ static inline unsigned long long cycles_2_ns(unsigned long long cyc)
 	return ns;
 }
 
-static void __set_cyc2ns_scale(unsigned long khz, int cpu, unsigned long long tsc_now)
+static void set_cyc2ns_scale(unsigned long khz, int cpu, unsigned long long tsc_now)
 {
 	unsigned long long ns_now;
 	struct cyc2ns_data data;
@@ -186,11 +186,6 @@ static void __set_cyc2ns_scale(unsigned long khz, int cpu, unsigned long long ts
 	local_irq_restore(flags);
 }
 
-static void set_cyc2ns_scale(unsigned long khz, int cpu)
-{
-	__set_cyc2ns_scale(khz, cpu, rdtsc());
-}
-
 /*
  * Scheduler clock - returns current time in nanosec units.
  */
@@ -892,7 +887,6 @@ void tsc_restore_sched_clock_state(void)
 }
 
 #ifdef CONFIG_CPU_FREQ
-
 /* Frequency scaling support. Adjust the TSC based timer when the cpu frequency
  * changes.
  *
@@ -933,7 +927,7 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
 		if (!(freq->flags & CPUFREQ_CONST_LOOPS))
 			mark_tsc_unstable("cpufreq changes");
 
-		set_cyc2ns_scale(tsc_khz, freq->cpu);
+		set_cyc2ns_scale(tsc_khz, freq->cpu, rdtsc());
 	}
 
 	return 0;
@@ -1224,7 +1218,7 @@ static void tsc_refine_calibration_work(struct work_struct *work)
 
 	/* Update the sched_clock() rate to match the clocksource one */
 	for_each_possible_cpu(cpu)
-		__set_cyc2ns_scale(tsc_khz, cpu, tsc_stop);
+		set_cyc2ns_scale(tsc_khz, cpu, tsc_stop);
 
 out:
 	if (boot_cpu_has(X86_FEATURE_ART))
@@ -1314,7 +1308,7 @@ void __init tsc_init(void)
 	cyc = rdtsc();
 	for_each_possible_cpu(cpu) {
 		cyc2ns_init(cpu);
-		__set_cyc2ns_scale(tsc_khz, cpu, cyc);
+		set_cyc2ns_scale(tsc_khz, cpu, cyc);
 	}
 
 	if (tsc_disabled > 0)
-- 
2.9.0

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

* [tip:sched/core] x86/tsc: Fold set_cyc2ns_scale() into caller
  2017-05-17 20:39 [PATCH] x86/tsc: fold set_cyc2ns_scale() into caller Arnd Bergmann
@ 2017-05-23  8:57 ` tip-bot for Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Arnd Bergmann @ 2017-05-23  8:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, arnd, hpa, mingo, peterz, prarit, tglx, torvalds

Commit-ID:  5c3c2ea6887176c5ae812c9f0350ff65b10e9485
Gitweb:     http://git.kernel.org/tip/5c3c2ea6887176c5ae812c9f0350ff65b10e9485
Author:     Arnd Bergmann <arnd@arndb.de>
AuthorDate: Wed, 17 May 2017 22:39:24 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 23 May 2017 10:11:04 +0200

x86/tsc: Fold set_cyc2ns_scale() into caller

The newly introduced wrapper function only has one caller,
and this one is conditional, causing a harmless warning when
CONFIG_CPU_FREQ is disabled:

  arch/x86/kernel/tsc.c:189:13: error: 'set_cyc2ns_scale' defined but not used [-Werror=unused-function]

My first idea was to move the wrapper inside of that #ifdef,
but on second thought it seemed nicer to remove it completely
again and rename __set_cyc2ns_scale back to set_cyc2ns_scale,
but leaving the extra argument.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 615cd03373a0 ("x86/tsc: Fix sched_clock() sync")
Link: http://lkml.kernel.org/r/20170517203949.2052220-1-arnd@arndb.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/tsc.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index a3b5442..5270fc0 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -137,7 +137,7 @@ static inline unsigned long long cycles_2_ns(unsigned long long cyc)
 	return ns;
 }
 
-static void __set_cyc2ns_scale(unsigned long khz, int cpu, unsigned long long tsc_now)
+static void set_cyc2ns_scale(unsigned long khz, int cpu, unsigned long long tsc_now)
 {
 	unsigned long long ns_now;
 	struct cyc2ns_data data;
@@ -186,11 +186,6 @@ done:
 	local_irq_restore(flags);
 }
 
-static void set_cyc2ns_scale(unsigned long khz, int cpu)
-{
-	__set_cyc2ns_scale(khz, cpu, rdtsc());
-}
-
 /*
  * Scheduler clock - returns current time in nanosec units.
  */
@@ -892,7 +887,6 @@ void tsc_restore_sched_clock_state(void)
 }
 
 #ifdef CONFIG_CPU_FREQ
-
 /* Frequency scaling support. Adjust the TSC based timer when the cpu frequency
  * changes.
  *
@@ -933,7 +927,7 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
 		if (!(freq->flags & CPUFREQ_CONST_LOOPS))
 			mark_tsc_unstable("cpufreq changes");
 
-		set_cyc2ns_scale(tsc_khz, freq->cpu);
+		set_cyc2ns_scale(tsc_khz, freq->cpu, rdtsc());
 	}
 
 	return 0;
@@ -1224,7 +1218,7 @@ static void tsc_refine_calibration_work(struct work_struct *work)
 
 	/* Update the sched_clock() rate to match the clocksource one */
 	for_each_possible_cpu(cpu)
-		__set_cyc2ns_scale(tsc_khz, cpu, tsc_stop);
+		set_cyc2ns_scale(tsc_khz, cpu, tsc_stop);
 
 out:
 	if (boot_cpu_has(X86_FEATURE_ART))
@@ -1314,7 +1308,7 @@ void __init tsc_init(void)
 	cyc = rdtsc();
 	for_each_possible_cpu(cpu) {
 		cyc2ns_init(cpu);
-		__set_cyc2ns_scale(tsc_khz, cpu, cyc);
+		set_cyc2ns_scale(tsc_khz, cpu, cyc);
 	}
 
 	if (tsc_disabled > 0)

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

end of thread, other threads:[~2017-05-23  9:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-17 20:39 [PATCH] x86/tsc: fold set_cyc2ns_scale() into caller Arnd Bergmann
2017-05-23  8:57 ` [tip:sched/core] x86/tsc: Fold " tip-bot for Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).