aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2005-11-15 19:24:51 +0000
committerFelix Fietkau <nbd@openwrt.org>2005-11-15 19:24:51 +0000
commite25286e629b4e222690293c6090b7f8ca43f5c74 (patch)
tree8ccbf9d1eb67e66ca2c090b4c09b02ccd5c07ae8
parent89be61399dfa8c455fbb766dda0346830da327f9 (diff)
downloadupstream-e25286e629b4e222690293c6090b7f8ca43f5c74.tar.gz
upstream-e25286e629b4e222690293c6090b7f8ca43f5c74.tar.bz2
upstream-e25286e629b4e222690293c6090b7f8ca43f5c74.zip
work around the remaining race condition in the tsc sched stuff
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2503 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/linux-2.4/patches/ar7/006-sched_use_tsc.patch17
-rw-r--r--target/linux/linux-2.4/patches/brcm/007-sched_use_tsc.patch17
2 files changed, 24 insertions, 10 deletions
diff --git a/target/linux/linux-2.4/patches/ar7/006-sched_use_tsc.patch b/target/linux/linux-2.4/patches/ar7/006-sched_use_tsc.patch
index 69bf01a768..5b64310738 100644
--- a/target/linux/linux-2.4/patches/ar7/006-sched_use_tsc.patch
+++ b/target/linux/linux-2.4/patches/ar7/006-sched_use_tsc.patch
@@ -1,7 +1,7 @@
diff -urN linux.old/arch/mips/kernel/time.c linux.dev/arch/mips/kernel/time.c
--- linux.old/arch/mips/kernel/time.c 2005-11-14 11:06:38.661262000 +0100
-+++ linux.dev/arch/mips/kernel/time.c 2005-11-15 15:21:17.890005500 +0100
-@@ -151,6 +151,20 @@
++++ linux.dev/arch/mips/kernel/time.c 2005-11-15 20:02:50.059676750 +0100
+@@ -151,6 +151,27 @@
unsigned int (*mips_hpt_read)(void);
void (*mips_hpt_init)(unsigned int);
@@ -10,19 +10,26 @@ diff -urN linux.old/arch/mips/kernel/time.c linux.dev/arch/mips/kernel/time.c
+ return timerhi;
+}
+
++static __u64 tscll_last = 0;
++
+extern __u64 get_tscll(void)
+{
-+ __u32 c = read_c0_count();
+ __u64 h = (__u64) timerhi;
-+ h += (c < timerlo);
++ __u32 c = read_c0_count();
++
+ h <<= 32;
+ h += c;
++
++ while (h < tscll_last)
++ h += (((__u64) 1) << 32);
++
++ tscll_last = h;
+ return h;
+}
/*
* timeofday services, for syscalls.
-@@ -761,3 +775,5 @@
+@@ -761,3 +782,5 @@
EXPORT_SYMBOL(to_tm);
EXPORT_SYMBOL(rtc_set_time);
EXPORT_SYMBOL(rtc_get_time);
diff --git a/target/linux/linux-2.4/patches/brcm/007-sched_use_tsc.patch b/target/linux/linux-2.4/patches/brcm/007-sched_use_tsc.patch
index 69bf01a768..5b64310738 100644
--- a/target/linux/linux-2.4/patches/brcm/007-sched_use_tsc.patch
+++ b/target/linux/linux-2.4/patches/brcm/007-sched_use_tsc.patch
@@ -1,7 +1,7 @@
diff -urN linux.old/arch/mips/kernel/time.c linux.dev/arch/mips/kernel/time.c
--- linux.old/arch/mips/kernel/time.c 2005-11-14 11:06:38.661262000 +0100
-+++ linux.dev/arch/mips/kernel/time.c 2005-11-15 15:21:17.890005500 +0100
-@@ -151,6 +151,20 @@
++++ linux.dev/arch/mips/kernel/time.c 2005-11-15 20:02:50.059676750 +0100
+@@ -151,6 +151,27 @@
unsigned int (*mips_hpt_read)(void);
void (*mips_hpt_init)(unsigned int);
@@ -10,19 +10,26 @@ diff -urN linux.old/arch/mips/kernel/time.c linux.dev/arch/mips/kernel/time.c
+ return timerhi;
+}
+
++static __u64 tscll_last = 0;
++
+extern __u64 get_tscll(void)
+{
-+ __u32 c = read_c0_count();
+ __u64 h = (__u64) timerhi;
-+ h += (c < timerlo);
++ __u32 c = read_c0_count();
++
+ h <<= 32;
+ h += c;
++
++ while (h < tscll_last)
++ h += (((__u64) 1) << 32);
++
++ tscll_last = h;
+ return h;
+}
/*
* timeofday services, for syscalls.
-@@ -761,3 +775,5 @@
+@@ -761,3 +782,5 @@
EXPORT_SYMBOL(to_tm);
EXPORT_SYMBOL(rtc_set_time);
EXPORT_SYMBOL(rtc_get_time);