linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] clocksource/drivers/arm_global_timer: Prevent ftrace recursion
       [not found] <5630C947.4020706@linaro.org>
@ 2015-10-28 13:11 ` Daniel Lezcano
  2015-10-28 13:11   ` [PATCH 4/8] clocksource/drivers/prima2: " Daniel Lezcano
  2015-10-28 13:11   ` [PATCH 7/8] clocksource/drivers/digicolor: " Daniel Lezcano
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Lezcano @ 2015-10-28 13:11 UTC (permalink / raw)
  To: linux-arm-kernel

From: Jisheng Zhang <jszhang@marvell.com>

Currently arm_global_timer can be used as a scheduler clock. We properly
marked gt_sched_clock_read() as notrace but we then call another function
gt_counter_read() that _wasn't_ notrace.

Having a traceable function in the sched_clock() path leads to a recursion
within ftrace and a kernel crash.

Fix this by adding an extra notrace function to keep other users of
gt_counter_read() traceable.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/arm_global_timer.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/arm_global_timer.c b/drivers/clocksource/arm_global_timer.c
index 29ea50a..a2cb6fa 100644
--- a/drivers/clocksource/arm_global_timer.c
+++ b/drivers/clocksource/arm_global_timer.c
@@ -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;
@@ -79,6 +79,11 @@ static u64 gt_counter_read(void)
 	return counter;
 }
 
+static u64 gt_counter_read(void)
+{
+	return _gt_counter_read();
+}
+
 /**
  * To ensure that updates to comparator value register do not set the
  * Interrupt Status Register proceed as follows:
@@ -201,7 +206,7 @@ static struct clocksource gt_clocksource = {
 #ifdef CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
 static u64 notrace gt_sched_clock_read(void)
 {
-	return gt_counter_read();
+	return _gt_counter_read();
 }
 #endif
 
-- 
1.9.1

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

* [PATCH 4/8] clocksource/drivers/prima2: Prevent ftrace recursion
  2015-10-28 13:11 ` [PATCH 1/8] clocksource/drivers/arm_global_timer: Prevent ftrace recursion Daniel Lezcano
@ 2015-10-28 13:11   ` Daniel Lezcano
  2015-10-28 13:11   ` [PATCH 7/8] clocksource/drivers/digicolor: " Daniel Lezcano
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Lezcano @ 2015-10-28 13:11 UTC (permalink / raw)
  To: linux-arm-kernel

From: Jisheng Zhang <jszhang@marvell.com>

Currently prima2 timer can be used as a scheduler clock. We properly
marked sirfsoc_read_sched_clock() as notrace but we then call another
function sirfsoc_timer_read() that _wasn't_ notrace.

Having a traceable function in the sched_clock() path leads to a recursion
within ftrace and a kernel crash.

Fix this by adding notrace attribute to the sirfsoc_timer_read() function.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/timer-prima2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-prima2.c b/drivers/clocksource/timer-prima2.c
index 78de982..2854c66 100644
--- a/drivers/clocksource/timer-prima2.c
+++ b/drivers/clocksource/timer-prima2.c
@@ -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;
 
-- 
1.9.1

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

* [PATCH 7/8] clocksource/drivers/digicolor: Prevent ftrace recursion
  2015-10-28 13:11 ` [PATCH 1/8] clocksource/drivers/arm_global_timer: Prevent ftrace recursion Daniel Lezcano
  2015-10-28 13:11   ` [PATCH 4/8] clocksource/drivers/prima2: " Daniel Lezcano
@ 2015-10-28 13:11   ` Daniel Lezcano
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Lezcano @ 2015-10-28 13:11 UTC (permalink / raw)
  To: linux-arm-kernel

From: Jisheng Zhang <jszhang@marvell.com>

Having a traceable function in the sched_clock() path leads to a recursion
within ftrace and a kernel crash.

We should not trace digicolor_timer_sched_read() function. Fix this by adding
the notrace attribute to this function.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/timer-digicolor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-digicolor.c b/drivers/clocksource/timer-digicolor.c
index e73947f0f..a536eeb 100644
--- a/drivers/clocksource/timer-digicolor.c
+++ b/drivers/clocksource/timer-digicolor.c
@@ -143,7 +143,7 @@ static irqreturn_t digicolor_timer_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static u64 digicolor_timer_sched_read(void)
+static u64 notrace digicolor_timer_sched_read(void)
 {
 	return ~readl(dc_timer_dev.base + COUNT(TIMER_B));
 }
-- 
1.9.1

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

end of thread, other threads:[~2015-10-28 13:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5630C947.4020706@linaro.org>
2015-10-28 13:11 ` [PATCH 1/8] clocksource/drivers/arm_global_timer: Prevent ftrace recursion Daniel Lezcano
2015-10-28 13:11   ` [PATCH 4/8] clocksource/drivers/prima2: " Daniel Lezcano
2015-10-28 13:11   ` [PATCH 7/8] clocksource/drivers/digicolor: " Daniel Lezcano

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).