fix a race condition in the sched_use_tsc patch
[openwrt.git] / target / linux / linux-2.4 / patches / ar7 / 006-sched_use_tsc.patch
1 diff -urN linux.old/arch/mips/kernel/time.c linux.dev/arch/mips/kernel/time.c
2 --- linux.old/arch/mips/kernel/time.c 2005-11-14 11:06:38.661262000 +0100
3 +++ linux.dev/arch/mips/kernel/time.c 2005-11-14 11:10:42.856523250 +0100
4 @@ -151,6 +151,16 @@
5 unsigned int (*mips_hpt_read)(void);
6 void (*mips_hpt_init)(unsigned int);
7
8 +extern __u32 get_htscl(void)
9 +{
10 + return timerhi;
11 +}
12 +
13 +extern __u64 get_tscll(void)
14 +{
15 + __u32 c = read_c0_count();
16 + return ((((__u64) timerhi) + (c < timerlo)) << 32) | ((__u64) ((__u32) c));
17 +}
18
19 /*
20 * timeofday services, for syscalls.
21 @@ -761,3 +771,5 @@
22 EXPORT_SYMBOL(to_tm);
23 EXPORT_SYMBOL(rtc_set_time);
24 EXPORT_SYMBOL(rtc_get_time);
25 +EXPORT_SYMBOL(get_htscl);
26 +EXPORT_SYMBOL(get_tscll);
27 diff -urN linux.old/include/asm-mips/timex.h linux.dev/include/asm-mips/timex.h
28 --- linux.old/include/asm-mips/timex.h 2005-11-14 11:06:38.685263500 +0100
29 +++ linux.dev/include/asm-mips/timex.h 2005-11-14 11:02:21.069163500 +0100
30 @@ -31,6 +31,19 @@
31 return read_c0_count();
32 }
33
34 +extern __u32 get_htscl(void);
35 +extern __u64 get_tscll(void);
36 +
37 +#define rdtsc(low, high) \
38 + high = get_htscl(); \
39 + low = read_c0_count();
40 +
41 +#define rdtscl(low) \
42 + low = read_c0_count();
43 +
44 +#define rdtscll(val) \
45 + val = get_tscll();
46 +
47 #define vxtime_lock() do {} while (0)
48 #define vxtime_unlock() do {} while (0)
49
50 diff -urN linux.old/include/net/pkt_sched.h linux.dev/include/net/pkt_sched.h
51 --- linux.old/include/net/pkt_sched.h 2005-11-14 11:06:38.709265000 +0100
52 +++ linux.dev/include/net/pkt_sched.h 2005-11-14 11:02:21.069163500 +0100
53 @@ -5,7 +5,11 @@
54 #define PSCHED_JIFFIES 2
55 #define PSCHED_CPU 3
56
57 +#ifdef __mips__
58 +#define PSCHED_CLOCK_SOURCE PSCHED_CPU
59 +#else
60 #define PSCHED_CLOCK_SOURCE PSCHED_JIFFIES
61 +#endif
62
63 #include <linux/config.h>
64 #include <linux/types.h>
65 @@ -271,7 +275,7 @@
66 #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz)
67 #define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz)
68
69 -#ifdef CONFIG_X86_TSC
70 +#if defined(CONFIG_X86_TSC) || defined(__mips__)
71
72 #define PSCHED_GET_TIME(stamp) \
73 ({ u64 __cur; \
This page took 0.065413 seconds and 5 git commands to generate.