* [PATCH 2/8] clocksource/drivers/pistachio: 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 3/8] clocksource/drivers/samsung_pwm_timer: " Daniel Lezcano
` (5 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Daniel Lezcano @ 2015-10-28 13:11 UTC (permalink / raw)
To: tglx; +Cc: Jisheng Zhang, open list:CLOCKSOURCE, CLOC...
From: Jisheng Zhang <jszhang@marvell.com>
Currently pistachio can be used as a scheduler clock. We properly marked
pistachio_read_sched_clock() as notrace but we then call another function
pistachio_clocksource_read_cycles() 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 pistachio_clocksource_read_cycles()
function.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/clocksource/time-pistachio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/time-pistachio.c b/drivers/clocksource/time-pistachio.c
index 18d4266..bba6799 100644
--- a/drivers/clocksource/time-pistachio.c
+++ b/drivers/clocksource/time-pistachio.c
@@ -67,7 +67,8 @@ static inline void gpt_writel(void __iomem *base, u32 value, u32 offset,
writel(value, base + 0x20 * gpt_id + offset);
}
-static cycle_t pistachio_clocksource_read_cycles(struct clocksource *cs)
+static cycle_t notrace
+pistachio_clocksource_read_cycles(struct clocksource *cs)
{
struct pistachio_clocksource *pcs = to_pistachio_clocksource(cs);
u32 counter, overflw;
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 3/8] clocksource/drivers/samsung_pwm_timer: 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 2/8] clocksource/drivers/pistachio: " Daniel Lezcano
@ 2015-10-28 13:11 ` Daniel Lezcano
2015-10-28 13:11 ` [PATCH 4/8] clocksource/drivers/prima2: " Daniel Lezcano
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Daniel Lezcano @ 2015-10-28 13:11 UTC (permalink / raw)
To: tglx; +Cc: Jisheng Zhang, open list:CLOCKSOURCE, CLOC...
From: Jisheng Zhang <jszhang@marvell.com>
Currently samsung_pwm_timer can be used as a scheduler clock. We properly
marked samsung_read_sched_clock() as notrace but we then call another
function samsung_clocksource_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 samsung_clocksource_read()
function.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/clocksource/samsung_pwm_timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clocksource/samsung_pwm_timer.c b/drivers/clocksource/samsung_pwm_timer.c
index bc90e13..9502bc4 100644
--- a/drivers/clocksource/samsung_pwm_timer.c
+++ b/drivers/clocksource/samsung_pwm_timer.c
@@ -307,7 +307,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);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ 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 ` [PATCH 2/8] clocksource/drivers/pistachio: " Daniel Lezcano
2015-10-28 13:11 ` [PATCH 3/8] clocksource/drivers/samsung_pwm_timer: " Daniel Lezcano
@ 2015-10-28 13:11 ` Daniel Lezcano
2015-10-28 13:11 ` [PATCH 5/8] clocksource/drivers/vf_pit_timer: " Daniel Lezcano
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Daniel Lezcano @ 2015-10-28 13:11 UTC (permalink / raw)
To: tglx
Cc: Jisheng Zhang, Barry Song, moderated list:ARM/CSR SIRFPRIMA...,
open list:CLOCKSOURCE, CLOC...
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] 11+ messages in thread* [PATCH 5/8] clocksource/drivers/vf_pit_timer: Prevent ftrace recursion
2015-10-28 13:11 ` [PATCH 1/8] clocksource/drivers/arm_global_timer: Prevent ftrace recursion Daniel Lezcano
` (2 preceding siblings ...)
2015-10-28 13:11 ` [PATCH 4/8] clocksource/drivers/prima2: " Daniel Lezcano
@ 2015-10-28 13:11 ` Daniel Lezcano
2015-10-28 13:11 ` [PATCH 6/8] clocksource/drivers/fsl_ftm_timer: " Daniel Lezcano
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Daniel Lezcano @ 2015-10-28 13:11 UTC (permalink / raw)
To: tglx; +Cc: Jisheng Zhang, open list:CLOCKSOURCE, CLOC...
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 the pit_read_sched_clock() function. Fix this by adding a
notrace attribute to this function.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/clocksource/vf_pit_timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clocksource/vf_pit_timer.c b/drivers/clocksource/vf_pit_timer.c
index f07ba99..a0e6c68 100644
--- a/drivers/clocksource/vf_pit_timer.c
+++ b/drivers/clocksource/vf_pit_timer.c
@@ -52,7 +52,7 @@ static inline void pit_irq_acknowledge(void)
__raw_writel(PITTFLG_TIF, clkevt_base + PITTFLG);
}
-static u64 pit_read_sched_clock(void)
+static u64 notrace pit_read_sched_clock(void)
{
return ~__raw_readl(clksrc_base + PITCVAL);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 6/8] clocksource/drivers/fsl_ftm_timer: Prevent ftrace recursion
2015-10-28 13:11 ` [PATCH 1/8] clocksource/drivers/arm_global_timer: Prevent ftrace recursion Daniel Lezcano
` (3 preceding siblings ...)
2015-10-28 13:11 ` [PATCH 5/8] clocksource/drivers/vf_pit_timer: " Daniel Lezcano
@ 2015-10-28 13:11 ` Daniel Lezcano
2015-10-28 13:11 ` [PATCH 7/8] clocksource/drivers/digicolor: " Daniel Lezcano
2015-10-28 13:11 ` [PATCH 8/8] clocksource/drivers/sh_mtu2: Fix multiple shutdown call issue Daniel Lezcano
6 siblings, 0 replies; 11+ messages in thread
From: Daniel Lezcano @ 2015-10-28 13:11 UTC (permalink / raw)
To: tglx; +Cc: Jisheng Zhang, open list:CLOCKSOURCE, CLOC...
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 the ftm_read_sched_clock() function.
Fix this by adding the notrace attribute to this function.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/clocksource/fsl_ftm_timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clocksource/fsl_ftm_timer.c b/drivers/clocksource/fsl_ftm_timer.c
index ef43469..10202f1 100644
--- a/drivers/clocksource/fsl_ftm_timer.c
+++ b/drivers/clocksource/fsl_ftm_timer.c
@@ -118,7 +118,7 @@ static inline void ftm_reset_counter(void __iomem *base)
ftm_writel(0x00, base + FTM_CNT);
}
-static u64 ftm_read_sched_clock(void)
+static u64 notrace ftm_read_sched_clock(void)
{
return ftm_readl(priv->clksrc_base + FTM_CNT);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ 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
` (4 preceding siblings ...)
2015-10-28 13:11 ` [PATCH 6/8] clocksource/drivers/fsl_ftm_timer: " Daniel Lezcano
@ 2015-10-28 13:11 ` Daniel Lezcano
2015-10-28 13:11 ` [PATCH 8/8] clocksource/drivers/sh_mtu2: Fix multiple shutdown call issue Daniel Lezcano
6 siblings, 0 replies; 11+ messages in thread
From: Daniel Lezcano @ 2015-10-28 13:11 UTC (permalink / raw)
To: tglx
Cc: Jisheng Zhang, Baruch Siach, open list:CLOCKSOURCE, CLOC...,
moderated list:ARM/CONEXANT DIGI...
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] 11+ messages in thread* [PATCH 8/8] clocksource/drivers/sh_mtu2: Fix multiple shutdown call issue
2015-10-28 13:11 ` [PATCH 1/8] clocksource/drivers/arm_global_timer: Prevent ftrace recursion Daniel Lezcano
` (5 preceding siblings ...)
2015-10-28 13:11 ` [PATCH 7/8] clocksource/drivers/digicolor: " Daniel Lezcano
@ 2015-10-28 13:11 ` Daniel Lezcano
6 siblings, 0 replies; 11+ messages in thread
From: Daniel Lezcano @ 2015-10-28 13:11 UTC (permalink / raw)
To: tglx
Cc: Magnus Damm, Viresh Kumar, Laurent Pinchart, Chris Brandt,
open list:CLOCKSOURCE, CLOC...
From: Magnus Damm <damm+renesas@opensource.se>
On the r7s72100 Genmai board the MTU2 driver currently triggers a common
clock framework WARN_ON(enable_count) when disabling the clock due to
the MTU2 driver after recent callback rework may call ->set_state_shutdown()
multiple times. A similar issue was spotted for the TMU driver and fixed in:
452b132 clocksource/drivers/sh_tmu: Fix traceback spotted in -next
On r7s72100 Genmai v4.3-rc7 built with shmobile_defconfig spits out the
following during boot:
sh_mtu2 fcff0000.timer: ch0: used for clock events
------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:675 clk_core_disable+0x2c/0x6c()
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.3.0-rc7 #1
Hardware name: Generic R7S72100 (Flattened Device Tree)
Backtrace:
[<c00133d4>] (dump_backtrace) from [<c0013570>] (show_stack+0x18/0x1c)
[<c0013558>] (show_stack) from [<c01c7aac>] (dump_stack+0x74/0x90)
[<c01c7a38>] (dump_stack) from [<c00272fc>] (warn_slowpath_common+0x88/0xb4)
[<c0027274>] (warn_slowpath_common) from [<c0027400>] (warn_slowpath_null+0x24/0x2c)
[<c00273dc>] (warn_slowpath_null) from [<c03a9320>] (clk_core_disable+0x2c/0x6c)
[<c03a92f4>] (clk_core_disable) from [<c03aa0a0>] (clk_disable+0x40/0x4c)
[<c03aa060>] (clk_disable) from [<c0395d2c>] (sh_mtu2_disable+0x24/0x50)
[<c0395d08>] (sh_mtu2_disable) from [<c0395d6c>] (sh_mtu2_clock_event_shutdown+0x14/0x1c)
[<c0395d58>] (sh_mtu2_clock_event_shutdown) from [<c007d7d0>] (clockevents_switch_state+0xc8/0x114)
[<c007d708>] (clockevents_switch_state) from [<c007d834>] (clockevents_shutdown+0x18/0x28)
[<c007d81c>] (clockevents_shutdown) from [<c007dd58>] (clockevents_exchange_device+0x70/0x78)
[<c007dce8>] (clockevents_exchange_device) from [<c007e578>] (tick_check_new_device+0x88/0xe0)
[<c007e4f0>] (tick_check_new_device) from [<c007daf0>] (clockevents_register_device+0xac/0x120)
[<c007da44>] (clockevents_register_device) from [<c0395be8>] (sh_mtu2_probe+0x230/0x350)
[<c03959b8>] (sh_mtu2_probe) from [<c028b6f0>] (platform_drv_probe+0x50/0x98)
Reported-by: Chris Brandt <chris.brandt@renesas.com>
Fixes: 19a9ffb ("clockevents/drivers/sh_mtu2: Migrate to new 'set-state' interface")
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/clocksource/sh_mtu2.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index f1985da..53aa7e9 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -280,7 +280,9 @@ static int sh_mtu2_clock_event_shutdown(struct clock_event_device *ced)
{
struct sh_mtu2_channel *ch = ced_to_sh_mtu2(ced);
- sh_mtu2_disable(ch);
+ if (clockevent_state_periodic(ced))
+ sh_mtu2_disable(ch);
+
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 11+ messages in thread