aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/time.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-03-25 10:30:34 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 12:10:55 -0500
commit7351c0bfe825db2239b835c771c95affe006f51c (patch)
tree8ae203fcf187c221d8dbf82eff7f7350e83ca014 /arch/x86_64/kernel/time.c
parent6954bee829a037e4a3e06f7ecd7fc0466fadde41 (diff)
[PATCH] x86_64: Fix formatting in time.c
Only white space changes, code should be identical Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/kernel/time.c')
-rw-r--r--arch/x86_64/kernel/time.c94
1 files changed, 45 insertions, 49 deletions
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 2f7c21206574..bb6cb83450b2 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -88,7 +88,8 @@ static inline unsigned int do_gettimeoffset_tsc(void)
88 unsigned long t; 88 unsigned long t;
89 unsigned long x; 89 unsigned long x;
90 t = get_cycles_sync(); 90 t = get_cycles_sync();
91 if (t < vxtime.last_tsc) t = vxtime.last_tsc; /* hack */ 91 if (t < vxtime.last_tsc)
92 t = vxtime.last_tsc; /* hack */
92 x = ((t - vxtime.last_tsc) * vxtime.tsc_quot) >> 32; 93 x = ((t - vxtime.last_tsc) * vxtime.tsc_quot) >> 32;
93 return x; 94 return x;
94} 95}
@@ -178,8 +179,9 @@ unsigned long profile_pc(struct pt_regs *regs)
178{ 179{
179 unsigned long pc = instruction_pointer(regs); 180 unsigned long pc = instruction_pointer(regs);
180 181
181 /* Assume the lock function has either no stack frame or only a single word. 182 /* Assume the lock function has either no stack frame or only a single
182 This checks if the address on the stack looks like a kernel text address. 183 word. This checks if the address on the stack looks like a kernel
184 text address.
183 There is a small window for false hits, but in that case the tick 185 There is a small window for false hits, but in that case the tick
184 is just accounted to the spinlock function. 186 is just accounted to the spinlock function.
185 Better would be to write these functions in assembler again 187 Better would be to write these functions in assembler again
@@ -293,8 +295,7 @@ unsigned long long monotonic_clock(void)
293 this_offset = hpet_readl(HPET_COUNTER); 295 this_offset = hpet_readl(HPET_COUNTER);
294 } while (read_seqretry(&xtime_lock, seq)); 296 } while (read_seqretry(&xtime_lock, seq));
295 offset = (this_offset - last_offset); 297 offset = (this_offset - last_offset);
296 offset *=(NSEC_PER_SEC/HZ)/hpet_tick; 298 offset *= (NSEC_PER_SEC/HZ) / hpet_tick;
297 return base + offset;
298 } else { 299 } else {
299 do { 300 do {
300 seq = read_seqbegin(&xtime_lock); 301 seq = read_seqbegin(&xtime_lock);
@@ -303,50 +304,46 @@ unsigned long long monotonic_clock(void)
303 base = monotonic_base; 304 base = monotonic_base;
304 } while (read_seqretry(&xtime_lock, seq)); 305 } while (read_seqretry(&xtime_lock, seq));
305 this_offset = get_cycles_sync(); 306 this_offset = get_cycles_sync();
306 offset = (this_offset - last_offset)*1000/cpu_khz; 307 offset = (this_offset - last_offset)*1000 / cpu_khz;
307 return base + offset;
308 } 308 }
309 return base + offset;
309} 310}
310EXPORT_SYMBOL(monotonic_clock); 311EXPORT_SYMBOL(monotonic_clock);
311 312
312static noinline void handle_lost_ticks(int lost, struct pt_regs *regs) 313static noinline void handle_lost_ticks(int lost, struct pt_regs *regs)
313{ 314{
314 static long lost_count; 315 static long lost_count;
315 static int warned; 316 static int warned;
316 317 if (report_lost_ticks) {
317 if (report_lost_ticks) { 318 printk(KERN_WARNING "time.c: Lost %d timer tick(s)! ", lost);
318 printk(KERN_WARNING "time.c: Lost %d timer " 319 print_symbol("rip %s)\n", regs->rip);
319 "tick(s)! ", lost); 320 }
320 print_symbol("rip %s)\n", regs->rip); 321
321 } 322 if (lost_count == 1000 && !warned) {
322 323 printk(KERN_WARNING "warning: many lost ticks.\n"
323 if (lost_count == 1000 && !warned) { 324 KERN_WARNING "Your time source seems to be instable or "
324 printk(KERN_WARNING
325 "warning: many lost ticks.\n"
326 KERN_WARNING "Your time source seems to be instable or "
327 "some driver is hogging interupts\n"); 325 "some driver is hogging interupts\n");
328 print_symbol("rip %s\n", regs->rip); 326 print_symbol("rip %s\n", regs->rip);
329 if (vxtime.mode == VXTIME_TSC && vxtime.hpet_address) { 327 if (vxtime.mode == VXTIME_TSC && vxtime.hpet_address) {
330 printk(KERN_WARNING "Falling back to HPET\n"); 328 printk(KERN_WARNING "Falling back to HPET\n");
331 if (hpet_use_timer) 329 if (hpet_use_timer)
332 vxtime.last = hpet_readl(HPET_T0_CMP) - hpet_tick; 330 vxtime.last = hpet_readl(HPET_T0_CMP) -
333 else 331 hpet_tick;
334 vxtime.last = hpet_readl(HPET_COUNTER); 332 else
335 vxtime.mode = VXTIME_HPET; 333 vxtime.last = hpet_readl(HPET_COUNTER);
336 do_gettimeoffset = do_gettimeoffset_hpet; 334 vxtime.mode = VXTIME_HPET;
337 } 335 do_gettimeoffset = do_gettimeoffset_hpet;
338 /* else should fall back to PIT, but code missing. */ 336 }
339 warned = 1; 337 /* else should fall back to PIT, but code missing. */
340 } else 338 warned = 1;
341 lost_count++; 339 } else
340 lost_count++;
342 341
343#ifdef CONFIG_CPU_FREQ 342#ifdef CONFIG_CPU_FREQ
344 /* In some cases the CPU can change frequency without us noticing 343 /* In some cases the CPU can change frequency without us noticing
345 (like going into thermal throttle) 344 Give cpufreq a change to catch up. */
346 Give cpufreq a change to catch up. */ 345 if ((lost_count+1) % 25 == 0)
347 if ((lost_count+1) % 25 == 0) { 346 cpufreq_delayed_get();
348 cpufreq_delayed_get();
349 }
350#endif 347#endif
351} 348}
352 349
@@ -556,7 +553,7 @@ static unsigned long get_cmos_time(void)
556 /* 553 /*
557 * We know that x86-64 always uses BCD format, no need to check the 554 * We know that x86-64 always uses BCD format, no need to check the
558 * config register. 555 * config register.
559 */ 556 */
560 557
561 BCD_TO_BIN(sec); 558 BCD_TO_BIN(sec);
562 BCD_TO_BIN(min); 559 BCD_TO_BIN(min);
@@ -618,7 +615,8 @@ static void cpufreq_delayed_get(void)
618 cpufreq_delayed_issched = 1; 615 cpufreq_delayed_issched = 1;
619 if (!warned) { 616 if (!warned) {
620 warned = 1; 617 warned = 1;
621 printk(KERN_DEBUG "Losing some ticks... checking if CPU frequency changed.\n"); 618 printk(KERN_DEBUG
619 "Losing some ticks... checking if CPU frequency changed.\n");
622 } 620 }
623 schedule_work(&cpufreq_delayed_get_work); 621 schedule_work(&cpufreq_delayed_get_work);
624 } 622 }
@@ -641,9 +639,9 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
641 lpj = &dummy; 639 lpj = &dummy;
642 if (!(freq->flags & CPUFREQ_CONST_LOOPS)) 640 if (!(freq->flags & CPUFREQ_CONST_LOOPS))
643#ifdef CONFIG_SMP 641#ifdef CONFIG_SMP
644 lpj = &cpu_data[freq->cpu].loops_per_jiffy; 642 lpj = &cpu_data[freq->cpu].loops_per_jiffy;
645#else 643#else
646 lpj = &boot_cpu_data.loops_per_jiffy; 644 lpj = &boot_cpu_data.loops_per_jiffy;
647#endif 645#endif
648 646
649 if (!ref_freq) { 647 if (!ref_freq) {
@@ -780,9 +778,8 @@ static __init int late_hpet_init(void)
780 int i; 778 int i;
781 779
782 hpet = (struct hpet *) fix_to_virt(FIX_HPET_BASE); 780 hpet = (struct hpet *) fix_to_virt(FIX_HPET_BASE);
783 781 timer = &hpet->hpet_timers[2];
784 for (i = 2, timer = &hpet->hpet_timers[2]; i < ntimer; 782 for (i = 2; i < ntimer; timer++, i++)
785 timer++, i++)
786 hd.hd_irq[i] = (timer->hpet_config & 783 hd.hd_irq[i] = (timer->hpet_config &
787 Tn_INT_ROUTE_CNF_MASK) >> 784 Tn_INT_ROUTE_CNF_MASK) >>
788 Tn_INT_ROUTE_CNF_SHIFT; 785 Tn_INT_ROUTE_CNF_SHIFT;
@@ -939,8 +936,7 @@ void __init time_init(void)
939 -xtime.tv_sec, -xtime.tv_nsec); 936 -xtime.tv_sec, -xtime.tv_nsec);
940 937
941 if (!hpet_init()) 938 if (!hpet_init())
942 vxtime_hz = (1000000000000000L + hpet_period / 2) / 939 vxtime_hz = (1000000000000000L + hpet_period / 2) / hpet_period;
943 hpet_period;
944 else 940 else
945 vxtime.hpet_address = 0; 941 vxtime.hpet_address = 0;
946 942