From: John Hawkes <hawkes@babylon.engr.sgi.com>
To: linux-ia64@vger.kernel.org
Subject: [PATCH] - sched_clock() broken for ia64 SN platform
Date: Thu, 20 Nov 2003 00:56:23 +0000 [thread overview]
Message-ID: <marc-linux-ia64-106928980122896@msgid-missing> (raw)
sched_clock() is broken in 2.6.0-test9 for ia64 "drifty ITC" platforms,
such as the SGI "SN" platform. The CPU Scheduler expects sched_clock() to
return a nanosecond value that is synchronized across all CPUs, and the SN
platform must use platform's RealTimeClock (RTC).
I attach a patch that fixes this for the SN platform.
We might instead want to implement a more general scheme, along the lines of
what is done by (struct time_interpolator), to provide a framework to solve
this for other architectures that have "drifty" non-default timebases.
John Hawkes
diff -X /home/hawkes/Patches/ignore.dirs -Naur linux-2.6.0/arch/ia64/kernel/time.c linux-2.6.0-schedclock/arch/ia64/kernel/time.c
--- linux-2.6.0/arch/ia64/kernel/time.c Mon Oct 20 12:48:11 2003
+++ linux-2.6.0-schedclock/arch/ia64/kernel/time.c Tue Nov 18 17:28:31 2003
@@ -42,12 +42,18 @@
#endif
+static unsigned long long
+itc_sched_clock (void)
+{
+ return jiffies * (1000000000/HZ); /* a crude-granularity hack */
+}
+
+unsigned long long (*ia64_sched_clock)(void) = &itc_sched_clock;
+
unsigned long long
sched_clock (void)
{
- unsigned long offset = ia64_get_itc();
-
- return (offset * local_cpu_data->nsec_per_cyc) >> IA64_NSEC_PER_CYC_SHIFT;
+ return ia64_sched_clock();
}
static void
diff -X /home/hawkes/Patches/ignore.dirs -Naur linux-2.6.0/arch/ia64/sn/kernel/sn2/timer.c linux-2.6.0-schedclock/arch/ia64/sn/kernel/sn2/timer.c
--- linux-2.6.0/arch/ia64/sn/kernel/sn2/timer.c Mon Jul 14 11:51:29 2003
+++ linux-2.6.0-schedclock/arch/ia64/sn/kernel/sn2/timer.c Wed Nov 19 10:00:43 2003
@@ -22,6 +22,8 @@
extern unsigned long sn_rtc_cycles_per_second;
static volatile unsigned long last_wall_rtc;
+extern unsigned long long (*ia64_sched_clock)(void);
+
static unsigned long rtc_offset; /* updated only when xtime write-lock is held! */
static long rtc_nsecs_per_cycle;
static long rtc_per_timer_tick;
@@ -55,6 +57,12 @@
last_wall_rtc = GET_RTC_COUNTER();
}
+static unsigned long long
+sn_sched_clock(void)
+{
+ return GET_RTC_COUNTER() * rtc_nsecs_per_cycle;
+}
+
static struct time_interpolator sn2_interpolator = {
.get_offset = getoffset,
@@ -73,4 +81,6 @@
rtc_nsecs_per_cycle = 1000000000 / sn_rtc_cycles_per_second;
last_wall_rtc = GET_RTC_COUNTER();
+
+ ia64_sched_clock = &sn_sched_clock;
}
next reply other threads:[~2003-11-20 0:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-20 0:56 John Hawkes [this message]
2003-11-20 1:24 ` [PATCH] - sched_clock() broken for ia64 SN platform David Mosberger
2003-11-20 4:09 ` John Hawkes
2003-11-20 6:01 ` David Mosberger
2003-11-20 15:23 ` Jack Steiner
2003-11-20 17:25 ` Grant Grundler
2003-11-20 17:25 ` Rich Altmaier
2003-11-20 18:32 ` David Mosberger
2003-11-20 19:20 ` Robin Holt
2003-11-20 19:23 ` Robin Holt
2003-11-20 20:58 ` John Hawkes
2003-11-20 21:27 ` David Mosberger
2003-11-20 21:58 ` john stultz
2003-11-20 22:14 ` John Hawkes
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=marc-linux-ia64-106928980122896@msgid-missing \
--to=hawkes@babylon.engr.sgi.com \
--cc=linux-ia64@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox