patch-2.3.99-pre6 linux/arch/sparc/kernel/sun4d_smp.c

Next file: linux/arch/sparc/kernel/sun4m_smp.c
Previous file: linux/arch/sparc/kernel/signal.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre5/linux/arch/sparc/kernel/sun4d_smp.c linux/arch/sparc/kernel/sun4d_smp.c
@@ -8,7 +8,6 @@
 
 #include <asm/head.h>
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/threads.h>
@@ -443,38 +442,14 @@
 	panic("Bogon SMP message pass.");
 }
 
-/* Protects counters touched during level14 ticker */
-static spinlock_t ticker_lock = SPIN_LOCK_UNLOCKED;
-
-#ifdef CONFIG_PROFILE
-
-/* 32-bit Sparc specific profiling function. */
-static inline void sparc_do_profile(unsigned long pc)
-{
-	if(prof_buffer && current->pid) {
-		extern int _stext;
-
-		pc -= (unsigned long) &_stext;
-		pc >>= prof_shift;
-
-		spin_lock(&ticker_lock);
-		if(pc < prof_len)
-			prof_buffer[pc]++;
-		else
-			prof_buffer[prof_len - 1]++;
-		spin_unlock(&ticker_lock);
-	}
-}
-
-#endif
-
 extern unsigned int prof_multiplier[NR_CPUS];
 extern unsigned int prof_counter[NR_CPUS];
 
 extern void update_one_process(struct task_struct *p, unsigned long ticks,
 			       unsigned long user, unsigned long system,
 			       int cpu);
-			       
+
+extern void sparc_do_profile(unsigned long pc, unsigned long o7);
 
 void smp4d_percpu_timer_interrupt(struct pt_regs *regs)
 {
@@ -493,12 +468,13 @@
 		show_leds(cpu);
 	}
 
-#ifdef CONFIG_PROFILE
 	if(!user_mode(regs))
-		sparc_do_profile(regs->pc);
-#endif
+		sparc_do_profile(regs->pc, regs->u_regs[UREG_RETPC]);
+
 	if(!--prof_counter[cpu]) {
 		int user = user_mode(regs);
+
+		irq_enter(cpu, 0);
 		if(current->pid) {
 			update_one_process(current, 1, user, !user, cpu);
 
@@ -507,7 +483,6 @@
 				current->need_resched = 1;
 			}
 
-			spin_lock(&ticker_lock);
 			if(user) {
 				if(current->priority < DEF_PRIORITY) {
 					kstat.cpu_nice++;
@@ -520,9 +495,9 @@
 				kstat.cpu_system++;
 				kstat.per_cpu_system[cpu]++;
 			}
-			spin_unlock(&ticker_lock);
 		}
 		prof_counter[cpu] = prof_multiplier[cpu];
+		irq_exit(cpu, 0);
 	}
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)