diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2006-02-28 12:25:22 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2006-02-28 12:25:22 -0500 |
commit | 9585da3729e7e27bf22818625c10ac6c64ebb609 (patch) | |
tree | 8c8d46f7f2cc933fdf75a6a75cf593a63f7b8717 /arch/ia64/kernel/time.c | |
parent | 8080d5497146d5d27d9e8e78229d1adc7fe280cf (diff) | |
parent | 6749c5507388f3fc3719f57a54b540ee83f6661a (diff) |
Merge branch 'master' of git+ssh://galak@master.kernel.org/pub/scm/linux/kernel/git/galak/powerpc
Diffstat (limited to 'arch/ia64/kernel/time.c')
-rw-r--r-- | arch/ia64/kernel/time.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index a094ec49ccfa..307d01e15b2e 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c | |||
@@ -250,32 +250,27 @@ time_init (void) | |||
250 | set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); | 250 | set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); |
251 | } | 251 | } |
252 | 252 | ||
253 | #define SMALLUSECS 100 | 253 | /* |
254 | 254 | * Generic udelay assumes that if preemption is allowed and the thread | |
255 | void | 255 | * migrates to another CPU, that the ITC values are synchronized across |
256 | udelay (unsigned long usecs) | 256 | * all CPUs. |
257 | */ | ||
258 | static void | ||
259 | ia64_itc_udelay (unsigned long usecs) | ||
257 | { | 260 | { |
258 | unsigned long start; | 261 | unsigned long start = ia64_get_itc(); |
259 | unsigned long cycles; | 262 | unsigned long end = start + usecs*local_cpu_data->cyc_per_usec; |
260 | unsigned long smallusecs; | ||
261 | 263 | ||
262 | /* | 264 | while (time_before(ia64_get_itc(), end)) |
263 | * Execute the non-preemptible delay loop (because the ITC might | 265 | cpu_relax(); |
264 | * not be synchronized between CPUS) in relatively short time | 266 | } |
265 | * chunks, allowing preemption between the chunks. | ||
266 | */ | ||
267 | while (usecs > 0) { | ||
268 | smallusecs = (usecs > SMALLUSECS) ? SMALLUSECS : usecs; | ||
269 | preempt_disable(); | ||
270 | cycles = smallusecs*local_cpu_data->cyc_per_usec; | ||
271 | start = ia64_get_itc(); | ||
272 | 267 | ||
273 | while (ia64_get_itc() - start < cycles) | 268 | void (*ia64_udelay)(unsigned long usecs) = &ia64_itc_udelay; |
274 | cpu_relax(); | ||
275 | 269 | ||
276 | preempt_enable(); | 270 | void |
277 | usecs -= smallusecs; | 271 | udelay (unsigned long usecs) |
278 | } | 272 | { |
273 | (*ia64_udelay)(usecs); | ||
279 | } | 274 | } |
280 | EXPORT_SYMBOL(udelay); | 275 | EXPORT_SYMBOL(udelay); |
281 | 276 | ||