linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arch_timer: Do not register arch_sys_counter twice
@ 2013-10-15 13:31 Thierry Reding
  2013-10-15 14:23 ` Will Deacon
  2013-10-15 16:51 ` John Stultz
  0 siblings, 2 replies; 5+ messages in thread
From: Thierry Reding @ 2013-10-15 13:31 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 65cd4f6 (arch_timer: Move to generic sched_clock framework) added
code to register the arch_sys_counter in arch_timer_register() but it is
already registered in arch_counter_register(). This results in the timer
being added to the clocksource list twice, therefore causing an infinite
loop in the list.

Remove the duplicate registration and register the scheduler clock after
the original registration instead.

This fixes a hang during boot on Tegra114 (Cortex-A15).

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
While I've only tested this on Tegra114, I suspect the same hang during
boot happens for all processors that use this clock source.

 drivers/clocksource/arm_arch_timer.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index f655036..95fb944 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -436,6 +436,9 @@ static void __init arch_counter_register(unsigned type)
 	cyclecounter.mult = clocksource_counter.mult;
 	cyclecounter.shift = clocksource_counter.shift;
 	timecounter_init(&timecounter, &cyclecounter, start_count);
+
+	/* 56 bits minimum, so we assume worst case rollover */
+	sched_clock_register(arch_timer_read_counter, 56, arch_timer_rate);
 }
 
 static void arch_timer_stop(struct clock_event_device *clk)
@@ -515,15 +518,6 @@ static int __init arch_timer_register(void)
 		goto out;
 	}
 
-	clocksource_register_hz(&clocksource_counter, arch_timer_rate);
-	cyclecounter.mult = clocksource_counter.mult;
-	cyclecounter.shift = clocksource_counter.shift;
-	timecounter_init(&timecounter, &cyclecounter,
-			 arch_counter_get_cntvct());
-
-	/* 56 bits minimum, so we assume worst case rollover */
-	sched_clock_register(arch_timer_read_counter, 56, arch_timer_rate);
-
 	if (arch_timer_use_virtual) {
 		ppi = arch_timer_ppi[VIRT_PPI];
 		err = request_percpu_irq(ppi, arch_timer_handler_virt,
-- 
1.8.4

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

end of thread, other threads:[~2013-10-15 16:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-15 13:31 [PATCH] arch_timer: Do not register arch_sys_counter twice Thierry Reding
2013-10-15 14:23 ` Will Deacon
2013-10-15 15:03   ` Thierry Reding
2013-10-15 16:46     ` John Stultz
2013-10-15 16:51 ` John Stultz

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