Skip to contentSkip to conversation

powerpc/time: Fix tracing in time.c

PATCH In review Santosh Sivaraj 3 participants 4 messages Jun 20, 2017 – Jun 23, 2017 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/time: Fix tracing in time.c

Since trace_clock is in a different file and already marked with notrace, enable tracing in time.c by removing it from the disabled list in Makefile. Also annotate clocksource read functions and sched_clock with notrace.

Testing: Timer and ftrace selftests run with different trace clocks.

---
 arch/powerpc/kernel/Makefile | 2 --
 arch/powerpc/kernel/time.c   | 6 +++---
 2 files changed, 3 insertions(+), 5 deletions(-)
arch/powerpc/kernel/Makefile +0 -2
index e132902..0845eeb 100644
@@ -25,8 +25,6 @@ CFLAGS_REMOVE_cputable.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_prom_init.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_btext.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_prom.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
-# timers used by tracing
-CFLAGS_REMOVE_time.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
 endif
 
 obj-y				:= cputable.o ptrace.o syscalls.o \
arch/powerpc/kernel/time.c +3 -3
index 2b33cfa..6d10c5f 100644
@@ -675,7 +675,7 @@ EXPORT_SYMBOL_GPL(tb_to_ns);
  * the high 64 bits of a * b, i.e. (a * b) >> 64, where a and b
  * are 64-bit unsigned numbers.
  */
-unsigned long long sched_clock(void)
+unsigned long long notrace sched_clock(void)
 {
 	if (__USE_RTC())
 		return get_rtc();
@@ -823,12 +823,12 @@ void read_persistent_clock(struct timespec *ts)
 }
 
 /* clocksource code */
-static u64 rtc_read(struct clocksource *cs)
+static notrace u64 rtc_read(struct clocksource *cs)
 {
 	return (u64)get_rtc();
 }
 
-static u64 timebase_read(struct clocksource *cs)
+static notrace u64 timebase_read(struct clocksource *cs)
 {
 	return (u64)get_tb();
 }
Signature · 1 line
2.9.4
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Santosh Sivaraj

Since trace_clock is in a different file and already marked with notrace, enable tracing in time.c by removing it from the disabled list in Makefile. Also annotate clocksource read functions and sched_clock with notrace.

Testing: Timer and ftrace selftests run with different trace clocks.

Thanks for doing this! Apart from the minor nit below:

Quoted 23 lines
---
 arch/powerpc/kernel/Makefile | 2 --
 arch/powerpc/kernel/time.c   | 6 +++---
 2 files changed, 3 insertions(+), 5 deletions(-)
arch/powerpc/kernel/Makefile +0 -2
index e132902..0845eeb 100644
@@ -25,8 +25,6 @@ CFLAGS_REMOVE_cputable.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_prom_init.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_btext.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_prom.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
-# timers used by tracing
-CFLAGS_REMOVE_time.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
 endif
 
 obj-y				:= cputable.o ptrace.o syscalls.o \
arch/powerpc/kernel/time.c +0 -0
index 2b33cfa..6d10c5f 100644

arch/powerpc/kernel/time.c EXPORT_SYMBOL_GPL(tb_to_ns); · line 678

Quoted 5 lines
arch/powerpc/kernel/time.c +1 -1
@@ -675,7 +675,7 @@ EXPORT_SYMBOL_GPL(tb_to_ns);
  * the high 64 bits of a * b, i.e. (a * b) >> 64, where a and b
  * are 64-bit unsigned numbers.
  */
-unsigned long long sched_clock(void)
+unsigned long long notrace sched_clock(void)

For the sake of consistency, it's probably better to add the notrace annotation before the return values, though I see that the prototype in include/sched.h has used this order.

- Naveen

Quoted 21 lines
arch/powerpc/kernel/time.c +2 -2
 {
 	if (__USE_RTC())
 		return get_rtc();
@@ -823,12 +823,12 @@ void read_persistent_clock(struct timespec *ts)
 }
 
 /* clocksource code */
-static u64 rtc_read(struct clocksource *cs)
+static notrace u64 rtc_read(struct clocksource *cs)
 {
 	return (u64)get_rtc();
 }
 
-static u64 timebase_read(struct clocksource *cs)
+static notrace u64 timebase_read(struct clocksource *cs)
 {
 	return (u64)get_tb();
 }
Signature · 1 line
2.9.4
#2 lore raw

PATCH 1/1 powerpc/time: Fix tracing in time.c

Since trace_clock is in a different file and already marked with notrace, enable tracing in time.c by removing it from the disabled list in Makefile. Also annotate clocksource read functions and sched_clock with notrace.

Testing: Timer and ftrace selftests run with different trace clocks.

---
 arch/powerpc/kernel/Makefile | 2 --
 arch/powerpc/kernel/time.c   | 6 +++---
 2 files changed, 3 insertions(+), 5 deletions(-)
arch/powerpc/kernel/Makefile +0 -2
index e132902..0845eeb 100644
@@ -25,8 +25,6 @@ CFLAGS_REMOVE_cputable.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_prom_init.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_btext.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_prom.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
-# timers used by tracing
-CFLAGS_REMOVE_time.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
 endif
 
 obj-y				:= cputable.o ptrace.o syscalls.o \
arch/powerpc/kernel/time.c +3 -3
index 2b33cfa..896ba1a 100644
@@ -675,7 +675,7 @@ EXPORT_SYMBOL_GPL(tb_to_ns);
  * the high 64 bits of a * b, i.e. (a * b) >> 64, where a and b
  * are 64-bit unsigned numbers.
  */
-unsigned long long sched_clock(void)
+notrace unsigned long long sched_clock(void)
 {
 	if (__USE_RTC())
 		return get_rtc();
@@ -823,12 +823,12 @@ void read_persistent_clock(struct timespec *ts)
 }
 
 /* clocksource code */
-static u64 rtc_read(struct clocksource *cs)
+static notrace u64 rtc_read(struct clocksource *cs)
 {
 	return (u64)get_rtc();
 }
 
-static u64 timebase_read(struct clocksource *cs)
+static notrace u64 timebase_read(struct clocksource *cs)
 {
 	return (u64)get_tb();
 }
Signature · 1 line
2.9.4
#3 lore raw
Quoted 8 lines · Santosh Sivaraj

Since trace_clock is in a different file and already marked with notrace, enable tracing in time.c by removing it from the disabled list in Makefile. Also annotate clocksource read functions and sched_clock with notrace.

Testing: Timer and ftrace selftests run with different trace clocks.

Applied to powerpc next-test, thanks.

https://git.kernel.org/powerpc/c/6b847d795cf4ab3e574f4fcf7193fe

cheers