Skip to contentSkip to conversation

arch_timer: Do not register arch_sys_counter twice

PATCH New Thierry Reding 4 participants 6 messages Oct 15, 2013 – Oct 17, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch_timer: Do not register arch_sys_counter twice

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

---
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(-)
drivers/clocksource/arm_arch_timer.c +3 -9
index f655036..95fb944 100644
@@ -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,
Signature · 1 line
1.8.4
#1 lore raw

PATCH 1/1 arch_timer: Do not register arch_sys_counter twice

Quoted 39 lines · Thierry Reding

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

---
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(-)
drivers/clocksource/arm_arch_timer.c +3 -2
index f655036..95fb944 100644
@@ -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;

drivers/clocksource/arm_arch_timer.c static int __init arch_timer_register(void) · line 523

Quoted 10 lines
drivers/clocksource/arm_arch_timer.c +0 -7
-	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,

Excuse my ignorance, but I'm failing to apply either this patch or the one that Stephen Boyd proposed:

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-October/204665.html

The second hunk (deletions) doesn't apply at all, and if I just apply the first hunk then things won't compile. Which tree is this against?

Will

#2 lore raw

PATCH 1/1 arch_timer: Do not register arch_sys_counter twice

Quoted 54 lines · Will Deacon
Quoted 39 lines · Thierry Reding

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

---
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(-)
drivers/clocksource/arm_arch_timer.c +3 -2
index f655036..95fb944 100644
@@ -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;

drivers/clocksource/arm_arch_timer.c static int __init arch_timer_register(void) · line 523

Quoted 10 lines
drivers/clocksource/arm_arch_timer.c +0 -7
-	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,

Excuse my ignorance, but I'm failing to apply either this patch or the one that Stephen Boyd proposed:

Quoted 1 line

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-October/204665.html

Hehe, that patch is exactly the same as this one. =)

Quoted 2 lines

The second hunk (deletions) doesn't apply at all, and if I just apply the first hunk then things won't compile. Which tree is this against?

This is on top of today's linux-next[0] and will probably apply to yesterday's linux-next too. I think that perhaps the patch or the one that Stephen proposed himself should be squashed with the original because that caused the breakage in the first place. From what I gather from the mailing thread you linked to above it seems like John took an earlier patch from Stephen and rebased it on top of something more recent and that didn't work out as expected.

Ingo, any chance you could take this patch and squash it into the patch mentioned above? Applying it as a separate fix will break bisectability inbetween both patches.

Thierry

[0]: git://gitorious.org/thierryreding/linux-next.git
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131015/cab67725/attachment.sig>

#3 lore raw

PATCH 1/1 arch_timer: Do not register arch_sys_counter twice

Quoted 18 lines · Thierry Reding
Quoted 17 lines · Will Deacon
Quoted 16 lines · Thierry Reding

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

---
While I've only tested this on Tegra114, I suspect the same hang during boot happens for all processors that use this clock source.

Quoted 4 lines
Quoted 4 lines

Review

Quoted 4 lines
 drivers/clocksource/arm_arch_timer.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

b/drivers/clocksource/arm_arch_timer.c

Quoted 4 lines
Quoted 4 lines

drivers/clocksource/arm_arch_timer.c static void __init

Quoted 4 lines

index f655036..95fb944 100644

drivers/clocksource/arm_arch_timer.c +0 -0
@@ -436,6 +436,9 @@ static void __init

arch_counter_register(unsigned type)

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/clocksource/arm_arch_timer.c +3 -0
     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;
     }
 
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
drivers/clocksource/arm_arch_timer.c +0 -6
-    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());
-
Quoted 8 lines

drivers/clocksource/arm_arch_timer.c static int __init arch_timer_register(void) · line 523

Quoted 6 lines
drivers/clocksource/arm_arch_timer.c +0 -3
-    /* 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,

Excuse my ignorance, but I'm failing to apply either this patch or

the one

Quoted 3 lines
Quoted 3 lines

that Stephen Boyd proposed:

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-October/204665.html

Quoted 5 lines

Hehe, that patch is exactly the same as this one. =)

Quoted 2 lines

The second hunk (deletions) doesn't apply at all, and if I just apply the first hunk then things won't compile. Which tree is this against?

The problem is from my merge to -tip.

Quoted 8 lines

This is on top of today's linux-next[0] and will probably apply to yesterday's linux-next too. I think that perhaps the patch or the one that Stephen proposed himself should be squashed with the original because that caused the breakage in the first place. From what I gather from the mailing thread you linked to above it seems like John took an earlier patch from Stephen and rebased it on top of something more recent and that didn't work out as expected.

Yes, again my apologies. When I applied Stephen's original patch to the recent tree, I mis-resolved the conflict.

Quoted 3 lines

Ingo, any chance you could take this patch and squash it into the patch mentioned above? Applying it as a separate fix will break bisectability inbetween both patches.

I suspect Ingo won't squish down the fix onto the misresolved patch, since -tip usually preserves history. But hopefully we can get this merged quickly.

Again, sorry for the trouble!
-john

#4 lore raw

PATCH 1/1 arch_timer: Do not register arch_sys_counter twice

In reply to Thierry Reding
Quoted 6 lines · Thierry Reding

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.

Quoted 6 lines

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

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

Ingo/Thomas, apologies here, I miss-resolved the conflict updating Stephens' patch (and also didn't add a note in the commit about it!), which is causing issues in -next.

Would you mind applying this to tip/timers/core?

thanks
-john

Quoted 37 lines

---
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(-)
drivers/clocksource/arm_arch_timer.c +3 -9
index f655036..95fb944 100644
@@ -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,
#5 lore raw

[tip:timers/core] clocksource: arch_timer: Do not register arch_sys_counter twice

In reply to Thierry Reding
clocksource: arch_timer: Do not register arch_sys_counter twice
Commit-ID:  4a7d3e8a9939cf8073c247286d81cbe0ae48eba2
Gitweb:     http://git.kernel.org/tip/4a7d3e8a9939cf8073c247286d81cbe0ae48eba2
Author:     Thierry Reding <[email protected]>
AuthorDate: Tue, 15 Oct 2013 15:31:51 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 16 Oct 2013 08:30:03 +0200

clocksource: arch_timer: Do not register arch_sys_counter twice

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

[ 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(-)
drivers/clocksource/arm_arch_timer.c +3 -9
index f655036..95fb944 100644
@@ -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,