vserver 2.0 rc7
[linux-2.6.git] / arch / ppc / kernel / time.c
index 96a6138..7358665 100644 (file)
@@ -56,6 +56,7 @@
 #include <linux/mc146818rtc.h>
 #include <linux/time.h>
 #include <linux/init.h>
+#include <linux/profile.h>
 
 #include <asm/segment.h>
 #include <asm/io.h>
@@ -88,9 +89,7 @@ unsigned long tb_to_ns_scale;
 
 extern unsigned long wall_jiffies;
 
-static long time_offset;
-
-spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(rtc_lock);
 
 EXPORT_SYMBOL(rtc_lock);
 
@@ -107,35 +106,18 @@ static inline int tb_delta(unsigned *jiffy_stamp) {
        return delta;
 }
 
-extern unsigned long prof_cpu_mask;
-extern unsigned int * prof_buffer;
-extern unsigned long prof_len;
-extern unsigned long prof_shift;
-extern char _stext;
-
-static inline void ppc_do_profile (unsigned long nip)
+#ifdef CONFIG_SMP
+unsigned long profile_pc(struct pt_regs *regs)
 {
-       if (!prof_buffer)
-               return;
+       unsigned long pc = instruction_pointer(regs);
 
-       /*
-        * Only measure the CPUs specified by /proc/irq/prof_cpu_mask.
-        * (default is all CPUs.)
-        */
-       if (!((1<<smp_processor_id()) & prof_cpu_mask))
-               return;
+       if (in_lock_functions(pc))
+               return regs->link;
 
-       nip -= (unsigned long) &_stext;
-       nip >>= prof_shift;
-       /*
-        * Don't ignore out-of-bounds EIP values silently,
-        * put them into the last histogram slot, so if
-        * present, they will show up as a sharp peak.
-        */
-       if (nip > prof_len-1)
-               nip = prof_len-1;
-       atomic_inc((atomic_t *)&prof_buffer[nip]);
+       return pc;
 }
+EXPORT_SYMBOL(profile_pc);
+#endif
 
 /*
  * timer_interrupt - gets called when the decrementer overflows,
@@ -154,10 +136,12 @@ void timer_interrupt(struct pt_regs * regs)
 
        irq_enter();
 
-       while ((next_dec = tb_ticks_per_jiffy - tb_delta(&jiffy_stamp)) < 0) {
+       while ((next_dec = tb_ticks_per_jiffy - tb_delta(&jiffy_stamp)) <= 0) {
                jiffy_stamp += tb_ticks_per_jiffy;
-               if (!user_mode(regs))
-                       ppc_do_profile(instruction_pointer(regs));
+               
+               profile_tick(CPU_PROFILING, regs);
+               update_process_times(user_mode(regs));
+
                if (smp_processor_id())
                        continue;
 
@@ -198,10 +182,6 @@ void timer_interrupt(struct pt_regs * regs)
                set_dec(next_dec);
        last_jiffy_stamp(cpu) = jiffy_stamp;
 
-#ifdef CONFIG_SMP
-       smp_local_timer_interrupt(regs);
-#endif /* CONFIG_SMP */
-
        if (ppc_md.heartbeat && !ppc_md.heartbeat_count--)
                ppc_md.heartbeat();
 
@@ -290,7 +270,6 @@ int do_settimeofday(struct timespec *tv)
 
        time_adjust = 0;                /* stop active adjtime() */
        time_status |= STA_UNSYNC;
-       time_state = TIME_ERROR;        /* p. 24, (a) */
        time_maxerror = NTP_PHASE_LIMIT;
        time_esterror = NTP_PHASE_LIMIT;
        write_sequnlock_irqrestore(&xtime_lock, flags);