# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1529  -> 1.1530 
#	arch/ia64/kernel/time.c	1.38    -> 1.39   
#	arch/ia64/kernel/head.S	1.15    -> 1.16   
#	arch/ia64/kernel/irq.c	1.33    -> 1.34   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/12/04	jbarnes@tomahawk.engr.sgi.com	1.1530
# spinlock contention profiling hack
# --------------------------------------------
#
diff -Nru a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
--- a/arch/ia64/kernel/head.S	Thu Dec  4 16:15:31 2003
+++ b/arch/ia64/kernel/head.S	Thu Dec  4 16:15:31 2003
@@ -888,6 +888,8 @@
 	cmp4.eq p14,p0=r30,r0
 (p14)	br.cond.sptk.few b6	// lock is now free, try to acquire
 	br.cond.sptk.few .wait
+	.global ia64_spinlock_contention_pre3_4_end    // for kernprof
+ia64_spinlock_contention_pre3_4_end:
 END(ia64_spinlock_contention_pre3_4)
 
 #else
diff -Nru a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
--- a/arch/ia64/kernel/irq.c	Thu Dec  4 16:15:31 2003
+++ b/arch/ia64/kernel/irq.c	Thu Dec  4 16:15:31 2003
@@ -1101,7 +1101,7 @@
 #endif
 }
 
-cpumask_t prof_cpu_mask = CPU_MASK_ALL;
+cpumask_t prof_cpu_mask;
 
 void init_irq_proc (void)
 {
diff -Nru a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
--- a/arch/ia64/kernel/time.c	Thu Dec  4 16:15:31 2003
+++ b/arch/ia64/kernel/time.c	Thu Dec  4 16:15:31 2003
@@ -202,6 +202,9 @@
 {
 	unsigned long ip, slot;
 	extern cpumask_t prof_cpu_mask;
+#ifdef CONFIG_SMP
+	extern char ia64_spinlock_contention_pre3_4[], ia64_spinlock_contention_pre3_4_end[];
+#endif
 
 	profile_hook(regs);
 
@@ -216,7 +219,14 @@
 	 * bits 2 and 3 rather than bits 0 and 1.
 	 */
 	slot = ip & 3;
-	ip = (ip & ~3UL) + 4*slot;
+	ip = (ip & ~3UL);
+#ifdef CONFIG_SMP
+	if (ip >= (unsigned long)ia64_spinlock_contention_pre3_4 &&
+			ip < (unsigned long)ia64_spinlock_contention_pre3_4_end)
+		ip = regs->r28;
+	else
+#endif
+	ip += 4*slot;
 
 	/*
 	 * Only measure the CPUs specified by /proc/irq/prof_cpu_mask.
