* [PATCH 2/6] clocksource: armada-370-xp: Register sched_clock after the counter reset
2013-12-10 19:16 ` [PATCH 1/6] clocksource: time-efm32: Select CLKSRC_MMIO Daniel Lezcano
@ 2013-12-10 19:16 ` Daniel Lezcano
2013-12-10 19:16 ` [PATCH 3/6] clocksource: clksrc-of: Do not drop unheld reference on device node Daniel Lezcano
` (3 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2013-12-10 19:16 UTC (permalink / raw)
To: linux-arm-kernel
From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
This commit registers the sched_clock _after_ the counter reset
(instead of before). This removes the timestamp 'jump' in kernel
log messages.
Before this change:
[ 0.000000] sched_clock: 32 bits at 25MHz, resolution 40ns, wraps every 171798691800ns
[ 0.000000] Initializing Coherency fabric
[ 0.000000] Aurora cache controller enabled
[ 0.000000] l2x0: 16 ways, CACHE_ID 0x00000100, AUX_CTRL 0x1a696b12, Cache size: 1024 kB
[ 163.507447] Calibrating delay loop... 1325.05 BogoMIPS (lpj=662528)
[ 163.521419] pid_max: default: 32768 minimum: 301
[ 163.526185] Mount-cache hash table entries: 512
[ 163.531095] CPU: Testing write buffer coherency: ok
After this change:
[ 0.000000] sched_clock: 32 bits at 25MHz, resolution 40ns, wraps every 171798691800ns
[ 0.000000] Initializing Coherency fabric
[ 0.000000] Aurora cache controller enabled
[ 0.000000] l2x0: 16 ways, CACHE_ID 0x00000100, AUX_CTRL 0x1a696b12, Cache size: 1024 kB
[ 0.016849] Calibrating delay loop... 1325.05 BogoMIPS (lpj=662528)
[ 0.030820] pid_max: default: 32768 minimum: 301
[ 0.035588] Mount-cache hash table entries: 512
[ 0.040500] CPU: Testing write buffer coherency: ok
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Jason Cooper <jason@lakedaemon.net>
---
drivers/clocksource/time-armada-370-xp.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
index d8e47e5..4e7f680 100644
--- a/drivers/clocksource/time-armada-370-xp.c
+++ b/drivers/clocksource/time-armada-370-xp.c
@@ -256,11 +256,6 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np)
ticks_per_jiffy = (timer_clk + HZ / 2) / HZ;
/*
- * Set scale and timer for sched_clock.
- */
- sched_clock_register(armada_370_xp_read_sched_clock, 32, timer_clk);
-
- /*
* Setup free-running clocksource timer (interrupts
* disabled).
*/
@@ -270,6 +265,11 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np)
timer_ctrl_clrset(0, TIMER0_EN | TIMER0_RELOAD_EN |
TIMER0_DIV(TIMER_DIVIDER_SHIFT));
+ /*
+ * Set scale and timer for sched_clock.
+ */
+ sched_clock_register(armada_370_xp_read_sched_clock, 32, timer_clk);
+
clocksource_mmio_init(timer_base + TIMER0_VAL_OFF,
"armada_370_xp_clocksource",
timer_clk, 300, 32, clocksource_mmio_readl_down);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/6] clocksource: clksrc-of: Do not drop unheld reference on device node
2013-12-10 19:16 ` [PATCH 1/6] clocksource: time-efm32: Select CLKSRC_MMIO Daniel Lezcano
2013-12-10 19:16 ` [PATCH 2/6] clocksource: armada-370-xp: Register sched_clock after the counter reset Daniel Lezcano
@ 2013-12-10 19:16 ` Daniel Lezcano
2013-12-10 19:16 ` [PATCH 4/6] clocksource: sunxi: Stop timer from ticking before enabling interrupts Daniel Lezcano
` (2 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2013-12-10 19:16 UTC (permalink / raw)
To: linux-arm-kernel
From: Thierry Reding <thierry.reding@gmail.com>
When booting a recent kernel on ARM with OF_DYNAMIC enabled, the kernel
warns about the following:
[ 0.000000] ERROR: Bad of_node_put() on /timer at 50004600
[ 0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.12.0-rc5-next-20131017-00077-gedfd827-dirty #406
[ 0.000000] [<c0015b68>] (unwind_backtrace+0x0/0xf4) from [<c00117e4>] (show_stack+0x10/0x14)
[ 0.000000] [<c00117e4>] (show_stack+0x10/0x14) from [<c055f734>] (dump_stack+0x9c/0xc8)
[ 0.000000] [<c055f734>] (dump_stack+0x9c/0xc8) from [<c03b47d4>] (of_node_release+0x90/0x9c)
[ 0.000000] [<c03b47d4>] (of_node_release+0x90/0x9c) from [<c03b5084>] (of_find_matching_node_and_match+0x78/0xb4)
[ 0.000000] [<c03b5084>] (of_find_matching_node_and_match+0x78/0xb4) from [<c07887c8>] (clocksource_of_init+0x60/0x70)
[ 0.000000] [<c07887c8>] (clocksource_of_init+0x60/0x70) from [<c076e99c>] (start_kernel+0x1f4/0x33c)
[ 0.000000] [<c076e99c>] (start_kernel+0x1f4/0x33c) from [<80008074>] (0x80008074)
This is caused by clocksource_of_init() dropping a reference on the
device node that it never took. The reference taken by the loop is
implicitly dropped on subsequent iterations. See the implementation of
and the comment on top of the of_find_matching_node_and_match()
function for reference (no pun intended).
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
drivers/clocksource/clksrc-of.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/clocksource/clksrc-of.c b/drivers/clocksource/clksrc-of.c
index 35639cf4..b9ddd9e 100644
--- a/drivers/clocksource/clksrc-of.c
+++ b/drivers/clocksource/clksrc-of.c
@@ -35,6 +35,5 @@ void __init clocksource_of_init(void)
init_func = match->data;
init_func(np);
- of_node_put(np);
}
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/6] clocksource: sunxi: Stop timer from ticking before enabling interrupts
2013-12-10 19:16 ` [PATCH 1/6] clocksource: time-efm32: Select CLKSRC_MMIO Daniel Lezcano
2013-12-10 19:16 ` [PATCH 2/6] clocksource: armada-370-xp: Register sched_clock after the counter reset Daniel Lezcano
2013-12-10 19:16 ` [PATCH 3/6] clocksource: clksrc-of: Do not drop unheld reference on device node Daniel Lezcano
@ 2013-12-10 19:16 ` Daniel Lezcano
2013-12-10 19:16 ` [PATCH 5/6] clocksource: dw_apb_timer_of: Fix read_sched_clock Daniel Lezcano
2013-12-10 19:16 ` [PATCH 6/6] clocksource: dw_apb_timer_of: Fix support for dts binding "snps, dw-apb-timer" Daniel Lezcano
4 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2013-12-10 19:16 UTC (permalink / raw)
To: linux-arm-kernel
From: Marc Zyngier <marc.zyngier@arm.com>
The sun4i timer can still be ticking when we enable the interrupt.
If another timer is actually used (A7 architected timer, for example),
odds are that the interrupt will eventually fire with the event_handler
pointer being NULL.
The obvious fix it to stop the timer before registering the interrupt.
Observed and tested on sun7i (cubietruck).
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/clocksource/sun4i_timer.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c
index 2fb4695..a4f6119 100644
--- a/drivers/clocksource/sun4i_timer.c
+++ b/drivers/clocksource/sun4i_timer.c
@@ -179,6 +179,9 @@ static void __init sun4i_timer_init(struct device_node *node)
writel(TIMER_CTL_CLK_SRC(TIMER_CTL_CLK_SRC_OSC24M),
timer_base + TIMER_CTL_REG(0));
+ /* Make sure timer is stopped before playing with interrupts */
+ sun4i_clkevt_time_stop(0);
+
ret = setup_irq(irq, &sun4i_timer_irq);
if (ret)
pr_warn("failed to setup irq %d\n", irq);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/6] clocksource: dw_apb_timer_of: Fix read_sched_clock
2013-12-10 19:16 ` [PATCH 1/6] clocksource: time-efm32: Select CLKSRC_MMIO Daniel Lezcano
` (2 preceding siblings ...)
2013-12-10 19:16 ` [PATCH 4/6] clocksource: sunxi: Stop timer from ticking before enabling interrupts Daniel Lezcano
@ 2013-12-10 19:16 ` Daniel Lezcano
2013-12-10 19:16 ` [PATCH 6/6] clocksource: dw_apb_timer_of: Fix support for dts binding "snps, dw-apb-timer" Daniel Lezcano
4 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2013-12-10 19:16 UTC (permalink / raw)
To: linux-arm-kernel
From: Dinh Nguyen <dinguyen@altera.com>
The read_sched_clock should return the ~value because the clock is a
countdown implementation. read_sched_clock() should be the same as
__apbt_read_clocksource().
Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/clocksource/dw_apb_timer_of.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index 45ba8ae..b29d7cd 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -108,7 +108,7 @@ static void __init add_clocksource(struct device_node *source_timer)
static u64 read_sched_clock(void)
{
- return __raw_readl(sched_io_base);
+ return ~__raw_readl(sched_io_base);
}
static const struct of_device_id sptimer_ids[] __initconst = {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 6/6] clocksource: dw_apb_timer_of: Fix support for dts binding "snps, dw-apb-timer"
2013-12-10 19:16 ` [PATCH 1/6] clocksource: time-efm32: Select CLKSRC_MMIO Daniel Lezcano
` (3 preceding siblings ...)
2013-12-10 19:16 ` [PATCH 5/6] clocksource: dw_apb_timer_of: Fix read_sched_clock Daniel Lezcano
@ 2013-12-10 19:16 ` Daniel Lezcano
2013-12-11 5:00 ` Baruch Siach
4 siblings, 1 reply; 12+ messages in thread
From: Daniel Lezcano @ 2013-12-10 19:16 UTC (permalink / raw)
To: linux-arm-kernel
From: Dinh Nguyen <dinguyen@altera.com>
In commit 620f5e1cbf (dts: Rename DW APB timer compatible strings), both
"snps,dw-apb-timer-sp" and "snps,dw-apb-timer-osc" were deprecated in place
of "snps,dw-apb-timer". But the driver also needs to be udpated in order to
support this new binding "snps,dw-apb-timer".
Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/clocksource/dw_apb_timer_of.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index b29d7cd..2a2ea27 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -113,7 +113,6 @@ static u64 read_sched_clock(void)
static const struct of_device_id sptimer_ids[] __initconst = {
{ .compatible = "picochip,pc3x2-rtc" },
- { .compatible = "snps,dw-apb-timer-sp" },
{ /* Sentinel */ },
};
@@ -151,4 +150,6 @@ static void __init dw_apb_timer_init(struct device_node *timer)
num_called++;
}
CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init);
-CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init);
+CLOCKSOURCE_OF_DECLARE(apb_timer_osc, "snps,dw-apb-timer-osc", dw_apb_timer_init);
+CLOCKSOURCE_OF_DECLARE(apb_timer_sp, "snps,dw-apb-timer-sp", dw_apb_timer_init);
+CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer", dw_apb_timer_init);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 6/6] clocksource: dw_apb_timer_of: Fix support for dts binding "snps, dw-apb-timer"
2013-12-10 19:16 ` [PATCH 6/6] clocksource: dw_apb_timer_of: Fix support for dts binding "snps, dw-apb-timer" Daniel Lezcano
@ 2013-12-11 5:00 ` Baruch Siach
2013-12-11 14:00 ` Daniel Lezcano
0 siblings, 1 reply; 12+ messages in thread
From: Baruch Siach @ 2013-12-11 5:00 UTC (permalink / raw)
To: linux-arm-kernel
Hi Daniel, Dinh,
On Tue, Dec 10, 2013 at 08:16:12PM +0100, Daniel Lezcano wrote:
> From: Dinh Nguyen <dinguyen@altera.com>
>
> In commit 620f5e1cbf (dts: Rename DW APB timer compatible strings), both
> "snps,dw-apb-timer-sp" and "snps,dw-apb-timer-osc" were deprecated in place
> of "snps,dw-apb-timer". But the driver also needs to be udpated in order to
> support this new binding "snps,dw-apb-timer".
>
> Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
I guess this (and the previous one) should also be pushed to v3.12-stable,
isn't it?
baruch
> drivers/clocksource/dw_apb_timer_of.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
> index b29d7cd..2a2ea27 100644
> --- a/drivers/clocksource/dw_apb_timer_of.c
> +++ b/drivers/clocksource/dw_apb_timer_of.c
> @@ -113,7 +113,6 @@ static u64 read_sched_clock(void)
>
> static const struct of_device_id sptimer_ids[] __initconst = {
> { .compatible = "picochip,pc3x2-rtc" },
> - { .compatible = "snps,dw-apb-timer-sp" },
> { /* Sentinel */ },
> };
>
> @@ -151,4 +150,6 @@ static void __init dw_apb_timer_init(struct device_node *timer)
> num_called++;
> }
> CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init);
> -CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init);
> +CLOCKSOURCE_OF_DECLARE(apb_timer_osc, "snps,dw-apb-timer-osc", dw_apb_timer_init);
> +CLOCKSOURCE_OF_DECLARE(apb_timer_sp, "snps,dw-apb-timer-sp", dw_apb_timer_init);
> +CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer", dw_apb_timer_init);
> --
> 1.7.9.5
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 6/6] clocksource: dw_apb_timer_of: Fix support for dts binding "snps, dw-apb-timer"
2013-12-11 5:00 ` Baruch Siach
@ 2013-12-11 14:00 ` Daniel Lezcano
0 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2013-12-11 14:00 UTC (permalink / raw)
To: linux-arm-kernel
On 12/11/2013 06:00 AM, Baruch Siach wrote:
> Hi Daniel, Dinh,
>
> On Tue, Dec 10, 2013 at 08:16:12PM +0100, Daniel Lezcano wrote:
>> From: Dinh Nguyen <dinguyen@altera.com>
>>
>> In commit 620f5e1cbf (dts: Rename DW APB timer compatible strings), both
>> "snps,dw-apb-timer-sp" and "snps,dw-apb-timer-osc" were deprecated in place
>> of "snps,dw-apb-timer". But the driver also needs to be udpated in order to
>> support this new binding "snps,dw-apb-timer".
>>
>> Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>
> I guess this (and the previous one) should also be pushed to v3.12-stable,
> isn't it?
Mmh, yes.
Thomas,
will you send those patches to Greg-KH ? Otherwise I am willing to
create a -stable branch for each release to put those in and send them
to stable@ directly.
Thanks
-- Daniel
>> drivers/clocksource/dw_apb_timer_of.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
>> index b29d7cd..2a2ea27 100644
>> --- a/drivers/clocksource/dw_apb_timer_of.c
>> +++ b/drivers/clocksource/dw_apb_timer_of.c
>> @@ -113,7 +113,6 @@ static u64 read_sched_clock(void)
>>
>> static const struct of_device_id sptimer_ids[] __initconst = {
>> { .compatible = "picochip,pc3x2-rtc" },
>> - { .compatible = "snps,dw-apb-timer-sp" },
>> { /* Sentinel */ },
>> };
>>
>> @@ -151,4 +150,6 @@ static void __init dw_apb_timer_init(struct device_node *timer)
>> num_called++;
>> }
>> CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init);
>> -CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init);
>> +CLOCKSOURCE_OF_DECLARE(apb_timer_osc, "snps,dw-apb-timer-osc", dw_apb_timer_init);
>> +CLOCKSOURCE_OF_DECLARE(apb_timer_sp, "snps,dw-apb-timer-sp", dw_apb_timer_init);
>> +CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer", dw_apb_timer_init);
>> --
>> 1.7.9.5
>
--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 12+ messages in thread