From: "Christopher S. Aker" <caker@theshore.net>
To: uml-devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: [uml-devel] [PATCH] - fix for 2.4.22-7um RTC on CPUs faster than 2.1 GHz
Date: Thu, 18 Dec 2003 02:09:39 -0600 [thread overview]
Message-ID: <000901c3c53e$4a759550$0201a8c0@hawk> (raw)
In-Reply-To: Pine.LNX.4.58.0312181520100.15701@boston.corp.fedex.com
Enabling the RTC in 2.4.22-7um produced a hang very soon after INIT at boot time.
I discovered host_hz as an int overflows past 2.1 Ghz (2147483647 hz). An
unsigned int/long would only work for up to ~ 4.3 Ghz (4294967295 hz) or so, which
isn't that far off, imo... So -- Below is a patch that changes the type of
host_hz to unsigned long long. Also, I believe some casting was taking place with
the return value of get_host_hz, so mhz is also redefined as an unsigned long
long.
-Chris
diff -Naur orig/arch/um/kernel/time.c mine/arch/um/kernel/time.c
--- orig/arch/um/kernel/time.c 2003-12-18 02:30:20.000000000 -0500
+++ mine/arch/um/kernel/time.c 2003-12-18 02:32:38.000000000 -0500
@@ -79,10 +79,11 @@
set_interval(ITIMER_REAL);
}
-static long get_host_hz(void)
+static unsigned long long get_host_hz(void)
{
char mhzline[16], *end;
- int ret, mult, mhz, rest, len;
+ int ret, mult, rest, len;
+ unsigned long long mhz;
ret = cpu_feature("cpu MHz", mhzline,
sizeof(mhzline) / sizeof(mhzline[0]));
@@ -112,7 +113,7 @@
return(1000000 * mhz + rest);
}
-int host_hz = 0;
+unsigned long long host_hz = 0;
void time_init(void)
{
diff -Naur orig/arch/um/kernel/time_kern.c mine/arch/um/kernel/time_kern.c
--- orig/arch/um/kernel/time_kern.c 2003-12-18 02:30:20.000000000 -0500
+++ mine/arch/um/kernel/time_kern.c 2003-12-18 02:34:58.000000000 -0500
@@ -39,7 +39,7 @@
static unsigned long long prev_tsc;
static long long delta; /* Deviation per interval */
-extern int host_hz;
+extern unsigned long long host_hz;
void timer_irq(union uml_pt_regs *regs)
{
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next prev parent reply other threads:[~2003-12-18 8:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-18 7:24 [uml-devel] uml-patch-2.4.22-7 without CONFIG_MODE_TT failed Jeff Chua
2003-12-18 8:09 ` Christopher S. Aker [this message]
2003-12-18 18:30 ` [uml-devel] [PATCH] - fix for 2.4.22-7um RTC on CPUs faster than 2.1 GHz Jeff Dike
2003-12-18 20:39 ` Matt Ayres
2003-12-18 21:52 ` Jeff Dike
2003-12-19 11:37 ` Nick Craig-Wood
2003-12-18 19:21 ` [uml-devel] uml-patch-2.4.22-7 without CONFIG_MODE_TT failed Jeff Dike
2003-12-18 19:50 ` BlaisorBlade
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='000901c3c53e$4a759550$0201a8c0@hawk' \
--to=caker@theshore.net \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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