Skip to contentSkip to conversation

OMAP2+: clocksource: fix crash on boot when !CONFIG_OMAP_32K_TIMER

PATCH New Paul Walmsley 2 participants 5 messages Feb 23, 2011 – Feb 25, 2011

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

PATCH 1/1 OMAP2+: clocksource: fix crash on boot when !CONFIG_OMAP_32K_TIMER

OMAP2+ kernels built without CONFIG_OMAP_32K_TIMER crash on boot after the 2.6.38 sched_clock changes:

[    0.000000] OMAP clockevent source: GPTIMER1 at 13000000 Hz
[    0.000000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[    0.000000] pgd = c0004000
[    0.000000] [00000000] *pgd=00000000
[    0.000000] Internal error: Oops: 80000005 [#1] SMP
[    0.000000] last sysfs file:
[    0.000000] Modules linked in:
[    0.000000] CPU: 0    Not tainted  (2.6.38-rc5-00057-g04aa67d #152)
[    0.000000] PC is at 0x0
[    0.000000] LR is at sched_clock_poll+0x2c/0x3c

Without CONFIG_OMAP_32K_TIMER, the kernel has an clockevent and clocksource resolution about three orders of magnitude higher than with CONFIG_OMAP_32K_TIMER set. The tradeoff is that the lowest power consumption states are not available.

Fix by calling init_sched_clock() from the GPTIMER clocksource init code.

---
 arch/arm/mach-omap2/timer-gp.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/timer-gp.c +13 -0
index 7b7c268..0fc550e 100644
@@ -39,6 +39,7 @@
 #include <asm/mach/time.h>
 #include <plat/dmtimer.h>
 #include <asm/localtimer.h>
+#include <asm/sched_clock.h>
 
 #include "timer-gp.h"
 
@@ -190,6 +191,7 @@ static void __init omap2_gp_clocksource_init(void)
 /*
  * clocksource
  */
+static DEFINE_CLOCK_DATA(cd);
 static struct omap_dm_timer *gpt_clocksource;
 static cycle_t clocksource_read_cycles(struct clocksource *cs)
 {
@@ -204,6 +206,15 @@ static struct clocksource clocksource_gpt = {
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
+static void notrace dmtimer_update_sched_clock(void)
+{
+	u32 cyc;
+
+	cyc = omap_dm_timer_read_counter(gpt_clocksource);
+
+	update_sched_clock(&cd, cyc, (u32)~0);
+}
+
 /* Setup free-running counter for clocksource */
 static void __init omap2_gp_clocksource_init(void)
 {
@@ -224,6 +235,8 @@ static void __init omap2_gp_clocksource_init(void)
 
 	omap_dm_timer_set_load_start(gpt, 1, 0);
 
+	init_sched_clock(&cd, dmtimer_update_sched_clock, 32, tick_rate);
+
 	if (clocksource_register_hz(&clocksource_gpt, tick_rate))
 		printk(err2, clocksource_gpt.name);
 }
Signature · 1 line
1.7.2.3
maintainer
#1 lore raw

PATCH 1/1 OMAP2+: clocksource: fix crash on boot when !CONFIG_OMAP_32K_TIMER

Quoted 15 lines · Paul Walmsley

OMAP2+ kernels built without CONFIG_OMAP_32K_TIMER crash on boot after the 2.6.38 sched_clock changes:

[    0.000000] OMAP clockevent source: GPTIMER1 at 13000000 Hz
[    0.000000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[    0.000000] pgd = c0004000
[    0.000000] [00000000] *pgd=00000000
[    0.000000] Internal error: Oops: 80000005 [#1] SMP
[    0.000000] last sysfs file:
[    0.000000] Modules linked in:
[    0.000000] CPU: 0    Not tainted  (2.6.38-rc5-00057-g04aa67d #152)
[    0.000000] PC is at 0x0
[    0.000000] LR is at sched_clock_poll+0x2c/0x3c
Quoted 6 lines

Without CONFIG_OMAP_32K_TIMER, the kernel has an clockevent and clocksource resolution about three orders of magnitude higher than with CONFIG_OMAP_32K_TIMER set. The tradeoff is that the lowest power consumption states are not available.

Fix by calling init_sched_clock() from the GPTIMER clocksource init code.

I'll queue this as a fix as it's a regression.

Tony

#2 lore raw

PATCH 1/1 OMAP2+: clocksource: fix crash on boot when !CONFIG_OMAP_32K_TIMER

Quoted 16 lines · Tony Lindgren
Quoted 15 lines · Paul Walmsley

OMAP2+ kernels built without CONFIG_OMAP_32K_TIMER crash on boot after the 2.6.38 sched_clock changes:

[    0.000000] OMAP clockevent source: GPTIMER1 at 13000000 Hz
[    0.000000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[    0.000000] pgd = c0004000
[    0.000000] [00000000] *pgd=00000000
[    0.000000] Internal error: Oops: 80000005 [#1] SMP
[    0.000000] last sysfs file:
[    0.000000] Modules linked in:
[    0.000000] CPU: 0    Not tainted  (2.6.38-rc5-00057-g04aa67d #152)
[    0.000000] PC is at 0x0
[    0.000000] LR is at sched_clock_poll+0x2c/0x3c
Quoted 8 lines
Quoted 6 lines

Without CONFIG_OMAP_32K_TIMER, the kernel has an clockevent and clocksource resolution about three orders of magnitude higher than with CONFIG_OMAP_32K_TIMER set. The tradeoff is that the lowest power consumption states are not available.

Fix by calling init_sched_clock() from the GPTIMER clocksource init code.

I'll queue this as a fix as it's a regression.

Sounds good, I've got one or two other -rc candidates. Want me to build a branch with this and the other two?

- Paul

maintainer
#3 lore raw

PATCH 1/1 OMAP2+: clocksource: fix crash on boot when !CONFIG_OMAP_32K_TIMER

Quoted 23 lines · Paul Walmsley
Quoted 21 lines · Tony Lindgren
Quoted 20 lines · Paul Walmsley

OMAP2+ kernels built without CONFIG_OMAP_32K_TIMER crash on boot after the 2.6.38 sched_clock changes:

[    0.000000] OMAP clockevent source: GPTIMER1 at 13000000 Hz
[    0.000000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[    0.000000] pgd = c0004000
[    0.000000] [00000000] *pgd=00000000
[    0.000000] Internal error: Oops: 80000005 [#1] SMP
[    0.000000] last sysfs file:
[    0.000000] Modules linked in:
[    0.000000] CPU: 0    Not tainted  (2.6.38-rc5-00057-g04aa67d #152)
[    0.000000] PC is at 0x0
[    0.000000] LR is at sched_clock_poll+0x2c/0x3c

Without CONFIG_OMAP_32K_TIMER, the kernel has an clockevent and clocksource resolution about three orders of magnitude higher than with CONFIG_OMAP_32K_TIMER set. The tradeoff is that the lowest power consumption states are not available.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Fix by calling init_sched_clock() from the GPTIMER clocksource init code.

I'll queue this as a fix as it's a regression.

Sounds good, I've got one or two other -rc candidates. Want me to build a branch with this and the other two?

Well I already applied this one. But for the two others yes please.

Tony

#4 lore raw

OMAP2+: clock/MPU prcm: patches for the 2.6.38-rc series

Hi Tony

The following changes since commit f5412be599602124d2bdd49947b231dd77c0bf99:

Linux 2.6.38-rc6 (2011-02-21 17:25:52 -0800)

are available in the git repository at:
git://git.pwsan.com/linux-2.6 patches_for_2.6.38rc

John Ogness (1):
OMAP2/3: clock: fix fint calculation for DPLL_FREQSEL

Santosh Shilimkar (1):
omap4: prcm: Fix the CPUx clockdomain offsets

 arch/arm/mach-omap2/clkt_dpll.c    |    2 +-
 arch/arm/mach-omap2/prcm_mpu44xx.h |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

- Paul