Skip to contentSkip to conversation

ARM: ensure all sched_clock() implementations are notrace marked

PATCH New Russell King - ARM Linux 2 participants 5 messages Dec 16, 2010

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: ensure all sched_clock() implementations are notrace marked

ftrace requires sched_clock() to be notrace. Ensure that all implementations are so marked.

---
 arch/arm/mach-ixp4xx/common.c         |    2 +-
 arch/arm/mach-mmp/time.c              |    2 +-
 arch/arm/mach-pxa/time.c              |    2 +-
 arch/arm/mach-sa1100/generic.c        |    2 +-
 arch/arm/mach-tegra/timer.c           |    2 +-
 arch/arm/plat-iop/time.c              |    2 +-
 arch/arm/plat-omap/counter_32k.c      |    2 +-
 arch/arm/plat-orion/time.c            |    2 +-
 arch/arm/plat-versatile/sched-clock.c |    2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/mach-ixp4xx/common.c +1 -1
index 82fc003..e0b91d8 100644
@@ -424,7 +424,7 @@ static void __init ixp4xx_clocksource_init(void)
 /*
  * sched_clock()
  */
-unsigned long long sched_clock(void)
+unsigned long long notrace sched_clock(void)
 {
 	cycle_t cyc = ixp4xx_get_cycles(NULL);
 	struct clocksource *cs = &clocksource_ixp4xx;
arch/arm/mach-mmp/time.c +1 -1
index 0c0ab09..a2ea33d 100644
@@ -75,7 +75,7 @@ static inline uint32_t timer_read(void)
 	return __raw_readl(TIMERS_VIRT_BASE + TMR_CVWR(0));
 }
 
-unsigned long long sched_clock(void)
+unsigned long long notrace sched_clock(void)
 {
 	unsigned long long v = cnt32_to_63(timer_read());
 	return (v * tcr2ns_scale) >> TCR2NS_SCALE_FACTOR;
arch/arm/mach-pxa/time.c +1 -1
index caf92c0..b8d9dff 100644
@@ -51,7 +51,7 @@ static void __init set_oscr2ns_scale(unsigned long oscr_rate)
 		oscr2ns_scale++;
 }
 
-unsigned long long sched_clock(void)
+unsigned long long notrace sched_clock(void)
 {
 	unsigned long long v = cnt32_to_63(OSCR);
 	return (v * oscr2ns_scale) >> OSCR2NS_SCALE_FACTOR;
arch/arm/mach-sa1100/generic.c +1 -1
index 3c1fcd6..33b4969 100644
@@ -119,7 +119,7 @@ unsigned int sa11x0_getspeed(unsigned int cpu)
  *
  *  ( * 1E9 / 3686400 => * 78125 / 288)
  */
-unsigned long long sched_clock(void)
+unsigned long long notrace sched_clock(void)
 {
 	unsigned long long v = cnt32_to_63(OSCR);
 
arch/arm/mach-tegra/timer.c +1 -1
index b49f2f5..19a6f7e 100644
@@ -110,7 +110,7 @@ static struct clocksource tegra_clocksource = {
 	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
-unsigned long long sched_clock(void)
+unsigned long long notrace sched_clock(void)
 {
 	return cnt32_to_63(timer_readl(TIMERUS_CNTR_1US)) * 1000;
 }
arch/arm/plat-iop/time.c +1 -1
index cd6d54f..2bb7db4 100644
@@ -52,7 +52,7 @@ static struct clocksource iop_clocksource = {
 /*
  * IOP sched_clock() implementation via its clocksource.
  */
-unsigned long long sched_clock(void)
+unsigned long long notrace sched_clock(void)
 {
 	cycle_t cyc = iop_clocksource_read(NULL);
 	struct clocksource *cs = &iop_clocksource;
arch/arm/plat-omap/counter_32k.c +1 -1
index 8f149f5..0de0583 100644
@@ -109,7 +109,7 @@ static struct clocksource clocksource_32k = {
  * Returns current time from boot in nsecs. It's OK for this to wrap
  * around for now, as it's just a relative time stamp.
  */
-unsigned long long sched_clock(void)
+unsigned long long notrace sched_clock(void)
 {
 	return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
 				  clocksource_32k.mult, clocksource_32k.shift);
arch/arm/plat-orion/time.c +1 -1
index 11e2583..123f96f 100644
@@ -55,7 +55,7 @@ static u32 ticks_per_jiffy;
 
 static unsigned long tclk2ns_scale;
 
-unsigned long long sched_clock(void)
+unsigned long long notrace sched_clock(void)
 {
 	unsigned long long v = cnt32_to_63(0xffffffff - readl(TIMER0_VAL));
 	return (v * tclk2ns_scale) >> TCLK2NS_SCALE_FACTOR;
arch/arm/plat-versatile/sched-clock.c +1 -1
index 9696ddc..42efd14 100644
@@ -42,7 +42,7 @@
  * long as there is always less than 89 seconds between successive
  * calls to this function.
  */
-unsigned long long sched_clock(void)
+unsigned long long notrace sched_clock(void)
 {
 	unsigned long long v = cnt32_to_63(readl(REFCOUNTER));
 
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 1/1 ARM: ensure all sched_clock() implementations are notrace marked

Quoted 4 lines · Russell King - ARM Linux

ftrace requires sched_clock() to be notrace. ?Ensure that all implementations are so marked.

It does seem better to have all of them explicity annotated anyway, even if it not required in most of the cases because they include <linux/sched.h> and the annotation in the declaration takes effect.

Note that in order for this to be fully effective, all functions called from sched_clock() need to be notrace too. OMAP and u300 miss this. The following patches fix them up; perhaps you can fold them into this one. If not, I will rebase them later after this series is merged:

http://www.spinics.net/lists/arm-kernel/msg104616.html
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg38911.html

#2 lore raw

PATCH 1/1 ARM: ensure all sched_clock() implementations are notrace marked

Quoted 10 lines · Rabin Vincent
Quoted 4 lines · Russell King - ARM Linux

ftrace requires sched_clock() to be notrace. ?Ensure that all implementations are so marked.

It does seem better to have all of them explicity annotated anyway, even if it not required in most of the cases because they include <linux/sched.h> and the annotation in the declaration takes effect.

Firstly, we shouldn't be relying upon that, and secondly, everywhere which defines sched_clock() should already be including linux/sched.h to avoid the sparse error. It sounds like there's also an exercise to make sure that is the case.

Quoted 2 lines

Note that in order for this to be fully effective, all functions called from sched_clock() need to be notrace too. OMAP and u300 miss this.

Yes, OMAP still suffers from this.

However, I assume you haven't looked at the u300 sched_clock conversion patch which is part of a follow-on series on lakml? It sorts u300 out in that regard.

#3 lore raw

PATCH 1/1 ARM: ensure all sched_clock() implementations are notrace marked

Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Rabin Vincent
Quoted 4 lines · Russell King - ARM Linux

ftrace requires sched_clock() to be notrace. ?Ensure that all implementations are so marked.

Quoted 8 lines
Quoted 3 lines

It does seem better to have all of them explicity annotated anyway, even if it not required in most of the cases because they include <linux/sched.h> and the annotation in the declaration takes effect.

Firstly, we shouldn't be relying upon that, and secondly, everywhere which defines sched_clock() should already be including linux/sched.h to avoid the sparse error. ?It sounds like there's also an exercise to make sure that is the case.

Yes. I believe I identified all the ones which weren't including the header in the last notrace series I sent out (versatile, plat-iop, omap, and u300 IIRC), but there's been some changes in various platforms' sched_clocks() and of course new platforms since then.

Quoted 9 lines
Quoted 3 lines

Note that in order for this to be fully effective, all functions called from sched_clock() need to be notrace too. ?OMAP and u300 miss this.

Yes, OMAP still suffers from this.

However, I assume you haven't looked at the u300 sched_clock conversion patch which is part of a follow-on series on lakml? ?It sorts u300 out in that regard.

Yes, I now see U300 no longer needs the notrace addition. It still could do with the #include <linux/sched.h> addition though, which was also being done as part of that patch.

#4 lore raw

PATCH 1/1 ARM: ensure all sched_clock() implementations are notrace marked

Quoted 3 lines · Rabin Vincent

Yes, I now see U300 no longer needs the notrace addition. It still could do with the #include <linux/sched.h> addition though, which was also being done as part of that patch.

Okay, added to u300, tegra, iop, and omap which weren't including linux/sched.h explicitly.