Commit 23b2c2b8 authored by David S. Miller's avatar David S. Miller

Merge nuts.davemloft.net:/disk1/BK/network-2.6

into nuts.davemloft.net:/disk1/BK/net-2.6
parents 2813e143 0903b016
...@@ -16,11 +16,6 @@ ...@@ -16,11 +16,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#ifdef CONFIG_X86_TSC
#include <asm/msr.h>
#endif
struct rtattr; struct rtattr;
struct Qdisc; struct Qdisc;
...@@ -216,8 +211,6 @@ typedef long psched_tdiff_t; ...@@ -216,8 +211,6 @@ typedef long psched_tdiff_t;
typedef u64 psched_time_t; typedef u64 psched_time_t;
typedef long psched_tdiff_t; typedef long psched_tdiff_t;
extern psched_time_t psched_time_base;
#if PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES #if PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES
#if HZ < 96 #if HZ < 96
...@@ -237,41 +230,28 @@ extern psched_time_t psched_time_base; ...@@ -237,41 +230,28 @@ extern psched_time_t psched_time_base;
#define PSCHED_JIFFIE2US(delay) ((delay)<<PSCHED_JSCALE) #define PSCHED_JIFFIE2US(delay) ((delay)<<PSCHED_JSCALE)
#elif PSCHED_CLOCK_SOURCE == PSCHED_CPU #elif PSCHED_CLOCK_SOURCE == PSCHED_CPU
#include <asm/timex.h>
extern psched_tdiff_t psched_clock_per_hz; extern psched_tdiff_t psched_clock_per_hz;
extern int psched_clock_scale; extern int psched_clock_scale;
extern psched_time_t psched_time_base;
extern cycles_t psched_time_mark;
#define PSCHED_GET_TIME(stamp) \
do { \
cycles_t cur = get_cycles(); \
if (sizeof(cycles_t) == sizeof(u32)) { \
if (cur <= psched_time_mark) \
psched_time_base += 0x100000000ULL; \
psched_time_mark = cur; \
(stamp) = (psched_time_base + cur)>>psched_clock_scale; \
} else { \
(stamp) = cur>>psched_clock_scale; \
} \
} while (0)
#define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz) #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz)
#define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz) #define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz)
#ifdef CONFIG_X86_TSC
#define PSCHED_GET_TIME(stamp) \
({ u64 __cur; \
rdtscll(__cur); \
(stamp) = __cur>>psched_clock_scale; \
})
#elif defined (__alpha__)
#define PSCHED_WATCHER u32
extern PSCHED_WATCHER psched_time_mark;
#define PSCHED_GET_TIME(stamp) \
({ u32 __res; \
__asm__ __volatile__ ("rpcc %0" : "r="(__res)); \
if (__res <= psched_time_mark) psched_time_base += 0x100000000UL; \
psched_time_mark = __res; \
(stamp) = (psched_time_base + __res)>>psched_clock_scale; \
})
#else
#error PSCHED_CLOCK_SOURCE=PSCHED_CPU is not supported on this arch.
#endif /* ARCH */
#endif /* PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES */ #endif /* PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES */
#endif /* PSCHED_CLOCK_SOURCE == PSCHED_GETTIMEOFDAY */ #endif /* PSCHED_CLOCK_SOURCE == PSCHED_GETTIMEOFDAY */
......
...@@ -1103,42 +1103,34 @@ int psched_tod_diff(int delta_sec, int bound) ...@@ -1103,42 +1103,34 @@ int psched_tod_diff(int delta_sec, int bound)
EXPORT_SYMBOL(psched_tod_diff); EXPORT_SYMBOL(psched_tod_diff);
#endif #endif
psched_time_t psched_time_base;
#if PSCHED_CLOCK_SOURCE == PSCHED_CPU #if PSCHED_CLOCK_SOURCE == PSCHED_CPU
psched_tdiff_t psched_clock_per_hz; psched_tdiff_t psched_clock_per_hz;
int psched_clock_scale; int psched_clock_scale;
EXPORT_SYMBOL(psched_clock_per_hz); EXPORT_SYMBOL(psched_clock_per_hz);
EXPORT_SYMBOL(psched_clock_scale); EXPORT_SYMBOL(psched_clock_scale);
#endif
#ifdef PSCHED_WATCHER psched_time_t psched_time_base;
PSCHED_WATCHER psched_time_mark; cycles_t psched_time_mark;
EXPORT_SYMBOL(psched_time_mark); EXPORT_SYMBOL(psched_time_mark);
EXPORT_SYMBOL(psched_time_base); EXPORT_SYMBOL(psched_time_base);
/*
* Periodically adjust psched_time_base to avoid overflow
* with 32-bit get_cycles(). Safe up to 4GHz CPU.
*/
static void psched_tick(unsigned long); static void psched_tick(unsigned long);
static struct timer_list psched_timer = TIMER_INITIALIZER(psched_tick, 0, 0); static struct timer_list psched_timer = TIMER_INITIALIZER(psched_tick, 0, 0);
static void psched_tick(unsigned long dummy) static void psched_tick(unsigned long dummy)
{ {
#if PSCHED_CLOCK_SOURCE == PSCHED_CPU if (sizeof(cycles_t) == sizeof(u32)) {
psched_time_t dummy_stamp; psched_time_t dummy_stamp;
PSCHED_GET_TIME(dummy_stamp); PSCHED_GET_TIME(dummy_stamp);
/* It is OK up to 4GHz cpu */ psched_timer.expires = jiffies + 1*HZ;
psched_timer.expires = jiffies + 1*HZ; add_timer(&psched_timer);
#else }
unsigned long now = jiffies;
psched_time_base += ((u64)(now-psched_time_mark))<<PSCHED_JSCALE;
psched_time_mark = now;
psched_timer.expires = now + 60*60*HZ;
#endif
add_timer(&psched_timer);
} }
#endif
#if PSCHED_CLOCK_SOURCE == PSCHED_CPU
int __init psched_calibrate_clock(void) int __init psched_calibrate_clock(void)
{ {
psched_time_t stamp, stamp1; psched_time_t stamp, stamp1;
...@@ -1147,9 +1139,7 @@ int __init psched_calibrate_clock(void) ...@@ -1147,9 +1139,7 @@ int __init psched_calibrate_clock(void)
long rdelay; long rdelay;
unsigned long stop; unsigned long stop;
#ifdef PSCHED_WATCHER
psched_tick(0); psched_tick(0);
#endif
stop = jiffies + HZ/10; stop = jiffies + HZ/10;
PSCHED_GET_TIME(stamp); PSCHED_GET_TIME(stamp);
do_gettimeofday(&tv); do_gettimeofday(&tv);
...@@ -1185,9 +1175,6 @@ static int __init pktsched_init(void) ...@@ -1185,9 +1175,6 @@ static int __init pktsched_init(void)
#elif PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES #elif PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES
psched_tick_per_us = HZ<<PSCHED_JSCALE; psched_tick_per_us = HZ<<PSCHED_JSCALE;
psched_us_per_tick = 1000000; psched_us_per_tick = 1000000;
#ifdef PSCHED_WATCHER
psched_tick(0);
#endif
#endif #endif
link_p = rtnetlink_links[PF_UNSPEC]; link_p = rtnetlink_links[PF_UNSPEC];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment