Linux IA64 platform development
 help / color / mirror / Atom feed
From: Robin Holt <holt@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: Attribute spinlock contention ticks to caller.
Date: Wed, 14 Sep 2005 22:26:44 +0000	[thread overview]
Message-ID: <20050914222644.GA5036@lnx-holt.americas.sgi.com> (raw)


On larger systems, ia64_spinlock_contention frequently shows up in
pfmon output.  Determining whether it is a frequently contended lock or
numerous different locks is very difficult.

The following patch attributes the ticks received while in
ia64_spinlock_contention to the requestor of the lock.


Signed-off-by: Robin Holt <holt@sgi.com>


Index: linux-2.6/arch/ia64/kernel/head.S
=================================--- linux-2.6.orig/arch/ia64/kernel/head.S	2005-09-09 18:06:16.000000000 -0500
+++ linux-2.6/arch/ia64/kernel/head.S	2005-09-14 14:38:03.946010176 -0500
@@ -1119,6 +1119,8 @@ GLOBAL_ENTRY(ia64_spinlock_contention)
 (p14)	br.cond.sptk.few .wait
 
 	br.ret.sptk.many b6	// lock is now taken
+	.global ia64_spinlock_contention_end	// for determining if we are in ia64_spinlock_contention code.
+ia64_spinlock_contention_end:
 END(ia64_spinlock_contention)
 
 #endif
Index: linux-2.6/arch/ia64/kernel/ia64_ksyms.c
=================================--- linux-2.6.orig/arch/ia64/kernel/ia64_ksyms.c	2005-09-01 09:30:56.000000000 -0500
+++ linux-2.6/arch/ia64/kernel/ia64_ksyms.c	2005-09-14 14:39:24.411493406 -0500
@@ -109,6 +109,8 @@ EXPORT_SYMBOL(unw_init_running);
  */
 extern char ia64_spinlock_contention_pre3_4;
 EXPORT_SYMBOL(ia64_spinlock_contention_pre3_4);
+extern char ia64_spinlock_contention_pre3_4_end;
+EXPORT_SYMBOL(ia64_spinlock_contention_pre3_4_end);
 #  else
 /*
  * This is not a normal routine and we don't want a function descriptor for it, so we use
@@ -116,6 +118,8 @@ EXPORT_SYMBOL(ia64_spinlock_contention_p
  */
 extern char ia64_spinlock_contention;
 EXPORT_SYMBOL(ia64_spinlock_contention);
+extern char ia64_spinlock_contention_end;
+EXPORT_SYMBOL(ia64_spinlock_contention_end);
 #  endif
 # endif
 #endif
Index: linux-2.6/arch/ia64/kernel/perfmon_default_smpl.c
=================================--- linux-2.6.orig/arch/ia64/kernel/perfmon_default_smpl.c	2005-09-01 09:30:56.000000000 -0500
+++ linux-2.6/arch/ia64/kernel/perfmon_default_smpl.c	2005-09-14 14:43:26.445574995 -0500
@@ -99,6 +99,16 @@ default_init(struct task_struct *task, v
 	return 0;
 }
 
+#ifdef CONFIG_SMP
+#if __GNUC__ < 3 || (__GNUC__ = 3 && __GNUC_MINOR__ < 3)
+extern char ia64_spinlock_contention_pre3_4[], ia64_spinlock_contention_pre3_4_end[];
+#define ia64_spinlock_contention		ia64_spinlock_contention_pre3_4
+#define ia64_spinlock_contention_end		ia64_spinlock_contention_pre3_4_end
+#else
+extern char ia64_spinlock_contention[], ia64_spinlock_contention_end[];
+#endif
+#endif
+
 static int
 default_handler(struct task_struct *task, void *buf, pfm_ovfl_arg_t *arg, struct pt_regs *regs, unsigned long stamp)
 {
@@ -165,6 +175,12 @@ default_handler(struct task_struct *task
 	 * where did the fault happen (includes slot number)
 	 */
 	ent->ip = regs->cr_iip | ((regs->cr_ipsr >> 41) & 0x3);
+#ifdef CONFIG_SMP
+	/* Fix up the ip for code in the spinlock contention path. */
+	if ((ent->ip >= (unsigned long)ia64_spinlock_contention) &&
+	    (ent->ip < (unsigned long)ia64_spinlock_contention_end))
+		ent->ip = regs->b6;
+#endif
 
 	ent->tstamp    = stamp;
 	ent->cpu       = smp_processor_id();

             reply	other threads:[~2005-09-14 22:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-14 22:26 Robin Holt [this message]
2005-09-15  0:10 ` Attribute spinlock contention ticks to caller Keith Owens
2005-09-15  6:34 ` Stephane Eranian
2005-09-15  8:19 ` Stephane Eranian
2005-09-15 17:14 ` Robin Holt
2005-09-15 17:23 ` Robin Holt
2005-09-15 17:37 ` Luck, Tony
2005-09-15 22:29 ` Robin Holt
2005-09-15 22:54 ` Zou Nan hai
2005-09-16  9:37 ` Stephane Eranian
2005-09-16 22:29 ` Robin Holt
2005-09-17  1:08 ` David Mosberger-Tang
2005-09-18 23:06 ` Robin Holt
2005-09-19  1:18 ` David Mosberger-Tang
2005-09-19  8:35 ` Stephane Eranian
2005-09-19 15:17 ` Robin Holt
2005-09-19 17:52 ` David Mosberger-Tang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050914222644.GA5036@lnx-holt.americas.sgi.com \
    --to=holt@sgi.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox