clocksource/clockevents fixes for 3.13
Hi Thomas, Ingo,
here are the fixes for 3.13 based on timers/urgent
* Axel Lin added a missing dependency on CLKSRC_MMIO in the Kconfig
for the time-efm32
* Dinh Nguyen fixed read_sched_clock to return the right value and
added the clksrc-of missing definition for the dw_apb_timer
* Ezequiel Garcia registered the sched clock after the counter, thus
preventing time jump in the traces for the armada-370-xp
* Marc Zyngier stopped the timer before enabling the irq in order to
prevent it to be fired before the clockevent is registered for the sunxi
* Thierry Reding removed a of_node_put in clksrc-of because the
reference is not held
Thanks
-- Daniel
----------------------------------------------------------------
The following changes since commit 0e576acbc1d9600cf2d9b4a141a2554639959d50:
nohz: Fix another inconsistency between CONFIG_NO_HZ=n and nohz=off
(2013-11-29 12:23:03 +0100)
are available in the git repository at:
git://git.linaro.org/people/daniel.lezcano/linux.git clockevents/fixes
for you to fetch changes up to 9ab4727c1d41e50b67aecde4bf11879560a3ca78:
clocksource: dw_apb_timer_of: Fix support for dts binding
"snps,dw-apb-timer" (2013-12-10 19:49:18 +0100)
----------------------------------------------------------------
Axel Lin (1):
clocksource: time-efm32: Select CLKSRC_MMIO
Dinh Nguyen (2):
clocksource: dw_apb_timer_of: Fix read_sched_clock
clocksource: dw_apb_timer_of: Fix support for dts binding
"snps,dw-apb-timer"
Ezequiel Garcia (1):
clocksource: armada-370-xp: Register sched_clock after the
counter reset
Marc Zyngier (1):
clocksource: sunxi: Stop timer from ticking before enabling
interrupts
Thierry Reding (1):
clocksource: clksrc-of: Do not drop unheld reference on device node
drivers/clocksource/Kconfig | 1 + drivers/clocksource/clksrc-of.c | 1 - drivers/clocksource/dw_apb_timer_of.c | 7 ++++--- drivers/clocksource/sun4i_timer.c | 3 +++ drivers/clocksource/time-armada-370-xp.c | 10 +++++----- 5 files changed, 13 insertions(+), 9 deletions(-)
Signature · 5 lines
<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
PATCH 1/6 clocksource: time-efm32: Select CLKSRC_MMIO
From: Axel Lin <[email protected]>
The time-efm32 driver uses the clocksource MMIO functions. Thus it needs to select CLKSRC_MMIO in Kconfig.
--- drivers/clocksource/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/clocksource/Kconfig +1 -0
@@ -75,6 +75,7 @@ config CLKSRC_DBX500_PRCMU_SCHED_CLOCK config CLKSRC_EFM32 bool "Clocksource for Energy Micro's EFM32 SoCs" if !ARCH_EFM32 depends on OF && ARM && (ARCH_EFM32 || COMPILE_TEST) + select CLKSRC_MMIO default ARCH_EFM32 help Support to use the timers of EFM32 SoCs as clock source and clock
Signature · 1 line
1.7.9.5
PATCH 2/6 clocksource: armada-370-xp: Register sched_clock after the counter reset
From: Ezequiel Garcia <[email protected]>
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
--- drivers/clocksource/time-armada-370-xp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clocksource/time-armada-370-xp.c +5 -5
@@ -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);
Signature · 1 line
1.7.9.5
PATCH 3/6 clocksource: clksrc-of: Do not drop unheld reference on device node
In reply to Daniel LezcanoFrom: Thierry Reding <[email protected]>
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).
--- drivers/clocksource/clksrc-of.c | 1 - 1 file changed, 1 deletion(-)
drivers/clocksource/clksrc-of.c +0 -1
@@ -35,6 +35,5 @@ void __init clocksource_of_init(void) init_func = match->data;init_func (np); -of_node_put (np); } }
Signature · 1 line
1.7.9.5
PATCH 4/6 clocksource: sunxi: Stop timer from ticking before enabling interrupts
In reply to Daniel LezcanoFrom: Marc Zyngier <[email protected]>
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).
--- drivers/clocksource/sun4i_timer.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clocksource/sun4i_timer.c +3 -0
@@ -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);
Signature · 1 line
1.7.9.5
PATCH 5/6 clocksource: dw_apb_timer_of: Fix read_sched_clock
In reply to Daniel LezcanoFrom: Dinh Nguyen <[email protected]>
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().
--- drivers/clocksource/dw_apb_timer_of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/dw_apb_timer_of.c +1 -1
@@ -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 = {
Signature · 1 line
1.7.9.5
PATCH 6/6 clocksource: dw_apb_timer_of: Fix support for dts binding "snps,dw-apb-timer"
In reply to Daniel LezcanoFrom: Dinh Nguyen <[email protected]>
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".
--- drivers/clocksource/dw_apb_timer_of.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clocksource/dw_apb_timer_of.c +3 -2
@@ -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);
Signature · 1 line
1.7.9.5
Re: [PATCH 6/6] clocksource: dw_apb_timer_of: Fix support for dts binding "snps, dw-apb-timer"
Hi Daniel, Dinh,
Quoted 10 lines · Daniel Lezcano
From: Dinh Nguyen <[email protected]>
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 <[email protected]>Signed-off-by Daniel Lezcano <[email protected]>---
I guess this (and the previous one) should also be pushed to v3.12-stable, isn't it?
baruch
Quoted 25 lines
drivers/clocksource/dw_apb_timer_of.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/clocksource/dw_apb_timer_of.c +3
-2@@ -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);Signature · 1 line
1.7.9.5
Signature · 3 lines
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 -Re: [PATCH 6/6] clocksource: dw_apb_timer_of: Fix support for dts binding "snps, dw-apb-timer"
Quoted 10 lines · Baruch Siach
Hi Daniel, Dinh,
Quoted 7 lines · Daniel Lezcano
From: Dinh Nguyen <[email protected]>
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".
Quoted 6 lines
Quoted 3 lines
Signed-off-by Dinh Nguyen <[email protected]>Signed-off-by Daniel Lezcano <[email protected]>---
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
Quoted 26 lines
Quoted 25 lines
drivers/clocksource/dw_apb_timer_of.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/clocksource/dw_apb_timer_of.c +3
-3@@ -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
Signature · 5 lines
<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
Quoted 60 lines · Daniel Lezcano
Hi Thomas, Ingo,
here are the fixes for 3.13 based on timers/urgent
* Axel Lin added a missing dependency on
CLKSRC_MMIOin theKconfig
for the time-efm32* Dinh Nguyen fixed
read_sched_clockto return the right value and
added the clksrc-of missing definition for thedw_apb_timer* Ezequiel Garcia registered the sched clock after the counter,
thus preventing time jump in the traces for the armada-370-xp* Marc Zyngier stopped the timer before enabling the irq in order
to prevent it to be fired before the clockevent is registered for the sunxi* Thierry Reding removed a
of_node_putin clksrc-of because the
reference is not heldThanks
-- Daniel----------------------------------------------------------------
The following changes since commit
0e576acbc1d9600cf2d9b4a141a2554639959d50:nohz: Fix another inconsistency between
CONFIG_NO_HZ=nand
nohz=off (2013-11-29 12:23:03 +0100)are available in the git repository at:
git://git.linaro.org/people/daniel.lezcano/linux.gitclockevents/fixesfor you to fetch changes up to
9ab4727c1d41e50b67aecde4bf11879560a3ca78:clocksource:
dw_apb_timer_of: Fix support for dts binding
"snps,dw-apb-timer" (2013-12-10 19:49:18 +0100)----------------------------------------------------------------
Axel Lin (1):
clocksource: time-efm32: SelectCLKSRC_MMIODinh Nguyen (2):
clocksource:dw_apb_timer_of: Fixread_sched_clock
clocksource:dw_apb_timer_of: Fix support for dts binding
"snps,dw-apb-timer"Ezequiel Garcia (1):
clocksource: armada-370-xp: Registersched_clockafter the
counter resetMarc Zyngier (1):
clocksource: sunxi: Stop timer from ticking before enabling
interruptsThierry Reding (1):
clocksource: clksrc-of: Do not drop unheld reference on device node
Quoted 6 lines
drivers/clocksource/Kconfig | 1 + drivers/clocksource/clksrc-of.c | 1 - drivers/clocksource/dw_apb_timer_of.c | 7 ++++--- drivers/clocksource/sun4i_timer.c | 3 +++ drivers/clocksource/time-armada-370-xp.c | 10 +++++----- 5 files changed, 13 insertions(+), 9 deletions(-)
Pulled into tip:timers/urgent, thanks a lot Daniel!
Ingo
On 12/10/2013 08:48 PM, Ingo Molnar wrote:
[ ... ]
Quoted 9 lines
Quoted 7 lines
drivers/clocksource/Kconfig | 1 + drivers/clocksource/clksrc-of.c | 1 - drivers/clocksource/dw_apb_timer_of.c | 7 ++++--- drivers/clocksource/sun4i_timer.c | 3 +++ drivers/clocksource/time-armada-370-xp.c | 10 +++++----- 5 files changed, 13 insertions(+), 9 deletions(-)Pulled into tip:timers/urgent, thanks a lot Daniel!
Thanks to you for helping me to be a better maintainer. All you comments and advices were very valuable.
-- Daniel
Signature · 5 lines
<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
Quoted 12 lines · Daniel Lezcano
On 12/10/2013 08:48 PM, Ingo Molnar wrote:
[ ... ]
Quoted 8 lines
Quoted 7 lines
drivers/clocksource/Kconfig | 1 + drivers/clocksource/clksrc-of.c | 1 - drivers/clocksource/dw_apb_timer_of.c | 7 ++++--- drivers/clocksource/sun4i_timer.c | 3 +++ drivers/clocksource/time-armada-370-xp.c | 10 +++++----- 5 files changed, 13 insertions(+), 9 deletions(-)
Quoted 4 lines
Quoted 1 line
Pulled into tip:timers/urgent, thanks a lot Daniel!
Thanks to you for helping me to be a better maintainer. All you comments and advices were very valuable.
You are welcome!
Thanks,
Ingo