linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] OMAP2+: clocksource: fix crash on boot when !CONFIG_OMAP_32K_TIMER
@ 2011-02-23  2:59 Paul Walmsley
  2011-02-24 20:21 ` Tony Lindgren
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Walmsley @ 2011-02-23  2:59 UTC (permalink / raw)
  To: linux-arm-kernel


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.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/mach-omap2/timer-gp.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 7b7c268..0fc550e 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -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);
 }
-- 
1.7.2.3

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

* [PATCH] OMAP2+: clocksource: fix crash on boot when !CONFIG_OMAP_32K_TIMER
  2011-02-23  2:59 [PATCH] OMAP2+: clocksource: fix crash on boot when !CONFIG_OMAP_32K_TIMER Paul Walmsley
@ 2011-02-24 20:21 ` Tony Lindgren
  2011-02-24 20:31   ` Paul Walmsley
  0 siblings, 1 reply; 5+ messages in thread
From: Tony Lindgren @ 2011-02-24 20:21 UTC (permalink / raw)
  To: linux-arm-kernel

* Paul Walmsley <paul@pwsan.com> [110222 18:58]:
> 
> 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.

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

Tony

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

* [PATCH] OMAP2+: clocksource: fix crash on boot when !CONFIG_OMAP_32K_TIMER
  2011-02-24 20:21 ` Tony Lindgren
@ 2011-02-24 20:31   ` Paul Walmsley
  2011-02-24 21:13     ` Tony Lindgren
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Walmsley @ 2011-02-24 20:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 24 Feb 2011, Tony Lindgren wrote:

> * Paul Walmsley <paul@pwsan.com> [110222 18:58]:
> > 
> > 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.
> 
> 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

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

* [PATCH] OMAP2+: clocksource: fix crash on boot when !CONFIG_OMAP_32K_TIMER
  2011-02-24 20:31   ` Paul Walmsley
@ 2011-02-24 21:13     ` Tony Lindgren
  2011-02-25 20:16       ` OMAP2+: clock/MPU prcm: patches for the 2.6.38-rc series Paul Walmsley
  0 siblings, 1 reply; 5+ messages in thread
From: Tony Lindgren @ 2011-02-24 21:13 UTC (permalink / raw)
  To: linux-arm-kernel

* Paul Walmsley <paul@pwsan.com> [110224 12:29]:
> On Thu, 24 Feb 2011, Tony Lindgren wrote:
> 
> > * Paul Walmsley <paul@pwsan.com> [110222 18:58]:
> > > 
> > > 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.
> > 
> > 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

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

* OMAP2+: clock/MPU prcm: patches for the 2.6.38-rc series
  2011-02-24 21:13     ` Tony Lindgren
@ 2011-02-25 20:16       ` Paul Walmsley
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Walmsley @ 2011-02-25 20:16 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

end of thread, other threads:[~2011-02-25 20:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-23  2:59 [PATCH] OMAP2+: clocksource: fix crash on boot when !CONFIG_OMAP_32K_TIMER Paul Walmsley
2011-02-24 20:21 ` Tony Lindgren
2011-02-24 20:31   ` Paul Walmsley
2011-02-24 21:13     ` Tony Lindgren
2011-02-25 20:16       ` OMAP2+: clock/MPU prcm: patches for the 2.6.38-rc series Paul Walmsley

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