From: Tim Bird <tim.bird@am.sony.com>
To: linux-omap-open-source@linux.omap.com
Subject: [PATCH] support printk-times by fixing sched_clock to be callable in early boot
Date: Wed, 23 Aug 2006 11:36:11 -0700 [thread overview]
Message-ID: <44ECA01B.7000408@am.sony.com> (raw)
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;
next reply other threads:[~2006-08-23 18:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-23 18:36 Tim Bird [this message]
2006-09-05 15:37 ` [PATCH] support printk-times by fixing sched_clock to be callable in early boot tony
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44ECA01B.7000408@am.sony.com \
--to=tim.bird@am.sony.com \
--cc=linux-omap-open-source@linux.omap.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.