Skip to contentSkip to conversation

clocksource: mark sched_clock_read functions notrace

PATCH New Nathan Sullivan 3 participants 5 messages Jan 30, 2015 – Feb 9, 2015

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

PATCH 1/1 clocksource: mark sched_clock_read functions notrace

These functions will be called by ftrace code when function_graph is used, so mark them notrace to avoid infinite recursion.

---
 drivers/clocksource/arm_arch_timer.c    |    2 +-
 drivers/clocksource/arm_global_timer.c  |    2 +-
 drivers/clocksource/samsung_pwm_timer.c |    2 +-
 drivers/clocksource/timer-prima2.c      |    2 +-
 drivers/clocksource/timer-sun5i.c       |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
drivers/clocksource/arm_arch_timer.c +1 -1
index 095c177..df5af55 100644
@@ -405,7 +405,7 @@ u32 arch_timer_get_rate(void)
 	return arch_timer_rate;
 }
 
-static u64 arch_counter_get_cntvct_mem(void)
+static u64 notrace arch_counter_get_cntvct_mem(void)
 {
 	u32 vct_lo, vct_hi, tmp_hi;
 
drivers/clocksource/arm_global_timer.c +1 -1
index e683377..b4e221a 100644
@@ -60,7 +60,7 @@ static struct clock_event_device __percpu *gt_evt;
  *  different to the 32-bit upper value read previously, go back to step 2.
  *  Otherwise the 64-bit timer counter value is correct.
  */
-static u64 gt_counter_read(void)
+static u64 notrace gt_counter_read(void)
 {
 	u64 counter;
 	u32 lower;
drivers/clocksource/samsung_pwm_timer.c +1 -1
index 5645cfc..09f4ee3 100644
@@ -310,7 +310,7 @@ static void samsung_clocksource_resume(struct clocksource *cs)
 	samsung_time_start(pwm.source_id, true);
 }
 
-static cycle_t samsung_clocksource_read(struct clocksource *c)
+static cycle_t notrace samsung_clocksource_read(struct clocksource *c)
 {
 	return ~readl_relaxed(pwm.source_reg);
 }
drivers/clocksource/timer-prima2.c +1 -1
index ce18d57..4410817 100644
@@ -73,7 +73,7 @@ static irqreturn_t sirfsoc_timer_interrupt(int irq, void *dev_id)
 }
 
 /* read 64-bit timer counter */
-static cycle_t sirfsoc_timer_read(struct clocksource *cs)
+static cycle_t notrace sirfsoc_timer_read(struct clocksource *cs)
 {
 	u64 cycles;
 
drivers/clocksource/timer-sun5i.c +1 -1
index 0226844..604b3bf 100644
@@ -137,7 +137,7 @@ static struct irqaction sun5i_timer_irq = {
 	.dev_id = &sun5i_clockevent,
 };
 
-static u64 sun5i_timer_sched_read(void)
+static u64 notrace sun5i_timer_sched_read(void)
 {
 	return ~readl(timer_base + TIMER_CNTVAL_LO_REG(1));
 }
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 clocksource: mark sched_clock_read functions notrace

Hi Nathan,

Quoted 7 lines · Nathan Sullivan

These functions will be called by ftrace code when function_graph is used, so mark them notrace to avoid infinite recursion.

---
  drivers/clocksource/arm_arch_timer.c    |    2 +-
  drivers/clocksource/arm_global_timer.c  |    2 +-

For the ARM Global timer part, you can add my:

Thanks,
Maxime

Quoted 6 lines
  drivers/clocksource/samsung_pwm_timer.c |    2 +-
  drivers/clocksource/timer-prima2.c      |    2 +-
  drivers/clocksource/timer-sun5i.c       |    2 +-
  5 files changed, 5 insertions(+), 5 deletions(-)
#2 lore raw

PATCH 1/1 clocksource: mark sched_clock_read functions notrace

In reply to Nathan Sullivan
Quoted 2 lines · Nathan Sullivan

These functions will be called by ftrace code when function_graph is used, so mark them notrace to avoid infinite recursion.

It would be useful to have a full stack trace to show the particular case you're hitting. Is the issue that trace_clock_local() is calling sched_clock(), and in these cases sched_clock() isn't being marked notrace?

Quoted 14 lines
---
 drivers/clocksource/arm_arch_timer.c    |    2 +-
 drivers/clocksource/arm_global_timer.c  |    2 +-
 drivers/clocksource/samsung_pwm_timer.c |    2 +-
 drivers/clocksource/timer-prima2.c      |    2 +-
 drivers/clocksource/timer-sun5i.c       |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
drivers/clocksource/arm_arch_timer.c +0 -0
index 095c177..df5af55 100644

drivers/clocksource/arm_arch_timer.c u32 arch_timer_get_rate(void) · line 408

Quoted 5 lines
drivers/clocksource/arm_arch_timer.c +1 -1
@@ -405,7 +405,7 @@ u32 arch_timer_get_rate(void)
 	return arch_timer_rate;
 }
 
-static u64 arch_counter_get_cntvct_mem(void)
+static u64 notrace arch_counter_get_cntvct_mem(void)

Assuming you're trying to mark all sched_clock() implementations notrace, then you missed a few: arch_counter_get_cntvct and arch_counter_get_cntpct.

Josh

#3 lore raw

PATCH 1/1 clocksource: mark sched_clock_read functions notrace

Quoted 8 lines · Josh Cartwright
Quoted 8 lines
drivers/clocksource/arm_arch_timer.c +0 -0
index 095c177..df5af55 100644
@@ -405,7 +405,7 @@ u32 arch_timer_get_rate(void)
 	return arch_timer_rate;
 }
 
Quoted 8 lines

drivers/clocksource/arm_arch_timer.c u32 arch_timer_get_rate(void) · line 408

Quoted 2 lines
drivers/clocksource/arm_arch_timer.c +1 -1
-static u64 arch_counter_get_cntvct_mem(void)
+static u64 notrace arch_counter_get_cntvct_mem(void)

Assuming you're trying to mark all sched_clock() implementations notrace, then you missed a few: arch_counter_get_cntvct and arch_counter_get_cntpct.

Josh

Hmm, those are inlined. Should I still mark them notrace?

Nathan

#4 lore raw

PATCH 1/1 clocksource: mark sched_clock_read functions notrace

Quoted 16 lines · Nathan Sullivan
Quoted 15 lines · Josh Cartwright

drivers/clocksource/arm_arch_timer.c u32 arch_timer_get_rate(void) · line 408

Quoted 10 lines
drivers/clocksource/arm_arch_timer.c +1 -1
index 095c177..df5af55 100644
@@ -405,7 +405,7 @@ u32 arch_timer_get_rate(void)
 	return arch_timer_rate;
 }
 
-static u64 arch_counter_get_cntvct_mem(void)
+static u64 notrace arch_counter_get_cntvct_mem(void)

Assuming you're trying to mark all sched_clock() implementations notrace, then you missed a few: arch_counter_get_cntvct and arch_counter_get_cntpct.

Quoted 3 lines
Quoted 1 line

Josh

Hmm, those are inlined. Should I still mark them notrace?

There's necessarily an out-of-line version of these functions generated, as arch_timer_read_counter has to point at something, so yes, I'd say so.

Josh