aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJon Hunter <jon-hunter@ti.com>2009-08-18 13:45:10 -0400
committerThomas Gleixner <tglx@linutronix.de>2009-11-13 14:46:24 -0500
commit98962465ed9e6ea99c38e0af63fe1dcb5a79dc25 (patch)
treef3f69ad8f6cd47e72a75da6de49eb3402f15cd9b /include/linux
parent529eaccd900a59724619b4a6ef6579fd518d5218 (diff)
nohz: Prevent clocksource wrapping during idle
The dynamic tick allows the kernel to sleep for periods longer than a single tick, but it does not limit the sleep time currently. In the worst case the kernel could sleep longer than the wrap around time of the time keeping clock source which would result in losing track of time. Prevent this by limiting it to the safe maximum sleep time of the current time keeping clock source. The value is calculated when the clock source is registered. [ tglx: simplified the code a bit and massaged the commit msg ] Signed-off-by: Jon Hunter <jon-hunter@ti.com> Cc: John Stultz <johnstul@us.ibm.com> LKML-Reference: <1250617512-23567-2-git-send-email-jon-hunter@ti.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/clocksource.h2
-rw-r--r--include/linux/time.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index f57f8825052..279c5478e8a 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -151,6 +151,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
151 * subtraction of non 64 bit counters 151 * subtraction of non 64 bit counters
152 * @mult: cycle to nanosecond multiplier 152 * @mult: cycle to nanosecond multiplier
153 * @shift: cycle to nanosecond divisor (power of two) 153 * @shift: cycle to nanosecond divisor (power of two)
154 * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
154 * @flags: flags describing special properties 155 * @flags: flags describing special properties
155 * @vread: vsyscall based read 156 * @vread: vsyscall based read
156 * @resume: resume function for the clocksource, if necessary 157 * @resume: resume function for the clocksource, if necessary
@@ -168,6 +169,7 @@ struct clocksource {
168 cycle_t mask; 169 cycle_t mask;
169 u32 mult; 170 u32 mult;
170 u32 shift; 171 u32 shift;
172 u64 max_idle_ns;
171 unsigned long flags; 173 unsigned long flags;
172 cycle_t (*vread)(void); 174 cycle_t (*vread)(void);
173 void (*resume)(void); 175 void (*resume)(void);
diff --git a/include/linux/time.h b/include/linux/time.h
index fe04e5ef6a5..6e026e45a17 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -148,6 +148,7 @@ extern void monotonic_to_bootbased(struct timespec *ts);
148 148
149extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 149extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
150extern int timekeeping_valid_for_hres(void); 150extern int timekeeping_valid_for_hres(void);
151extern u64 timekeeping_max_deferment(void);
151extern void update_wall_time(void); 152extern void update_wall_time(void);
152extern void update_xtime_cache(u64 nsec); 153extern void update_xtime_cache(u64 nsec);
153extern void timekeeping_leap_insert(int leapsecond); 154extern void timekeeping_leap_insert(int leapsecond);