* [PATCH] support printk-times by fixing sched_clock to be callable in early boot
@ 2006-08-23 18:36 Tim Bird
2006-09-05 15:37 ` tony
0 siblings, 1 reply; 2+ messages in thread
From: Tim Bird @ 2006-08-23 18:36 UTC (permalink / raw)
To: linux-omap-open-source
Hi all,
This patch has been sitting in my 'to-submit' queue for a long time.
Basically, you can't use the printk times feature on omap, because
by default it calls sched_clock() before the timer is set up, which
causes the machine to hang. This simplistic fix makes sched_clock()
return 0 until the clock has been properly initialized.
The overhead of the flag check is not big, but it's impact could
be reduced by moving the test into a separate printk_clock()
routine (which would front the sched_clock() function, and
is only called by printk when printk timing is active.)
Let me know if you would prefer that I rework this patch to
use that approach instead.
Regards,
-- Tim
=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================
Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Index: alp-linux--import-2-6-15--0/arch/arm/mach-omap1/time.c
===================================================================
--- alp-linux--import-2-6-15--0.orig/arch/arm/mach-omap1/time.c 2006-01-10 15:16:05.000000000 -0800
+++ alp-linux--import-2-6-15--0/arch/arm/mach-omap1/time.c 2006-01-10 15:19:09.000000000 -0800
@@ -196,6 +196,8 @@
.handler = omap_mpu_timer1_interrupt,
};
+static int omap_mpu_timer1_initialized = 0;
+
static __init void omap_init_mpu_timer(void)
{
set_cyc2ns_scale(MPU_TICKS_PER_SEC / 1000);
@@ -204,6 +206,7 @@
setup_irq(INT_TIMER2, &omap_mpu_timer_irq);
omap_mpu_timer_start(0, 0xffffffff);
omap_mpu_timer_start(1, MPU_TIMER_TICK_PERIOD);
+ omap_mpu_timer1_initialized = 1;
}
/*
@@ -211,9 +215,13 @@
*/
unsigned long long sched_clock(void)
{
- unsigned long ticks = 0 - omap_mpu_timer_read(0);
+ unsigned long ticks;
unsigned long long ticks64;
+ if (unlikely(!omap_mpu_timer1_initialized)) return 0;
+
+ ticks = 0 - omap_mpu_timer_read(0);
+
ticks64 = omap_mpu_timer1_overflows;
ticks64 <<= 32;
ticks64 |= ticks;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] support printk-times by fixing sched_clock to be callable in early boot
2006-08-23 18:36 [PATCH] support printk-times by fixing sched_clock to be callable in early boot Tim Bird
@ 2006-09-05 15:37 ` tony
0 siblings, 0 replies; 2+ messages in thread
From: tony @ 2006-09-05 15:37 UTC (permalink / raw)
To: Tim Bird; +Cc: linux-omap-open-source
Hi,
* Tim Bird <tim.bird@am.sony.com> [060823 21:37]:
> Hi all,
>
> This patch has been sitting in my 'to-submit' queue for a long time.
>
> Basically, you can't use the printk times feature on omap, because
> by default it calls sched_clock() before the timer is set up, which
> causes the machine to hang. This simplistic fix makes sched_clock()
> return 0 until the clock has been properly initialized.
>
> The overhead of the flag check is not big, but it's impact could
> be reduced by moving the test into a separate printk_clock()
> routine (which would front the sched_clock() function, and
> is only called by printk when printk timing is active.)
> Let me know if you would prefer that I rework this patch to
> use that approach instead.
Sorry for the long delay in replying. Let's rather implement
printk_clock() like you suggest as sched_clock is called quite a bit.
That should also allow us to remove the current hack
e4fb3a282725bc66dc63fd248e9d05e0396ddf95 in kernel/printk.c.
Regards,
Tony
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-09-05 15:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-23 18:36 [PATCH] support printk-times by fixing sched_clock to be callable in early boot Tim Bird
2006-09-05 15:37 ` tony
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox