linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: a.p.zijlstra@chello.nl
Cc: acme@ghostprotocols.net, linux-kernel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 1/4] ptrace: Add variant of profile_pc for passing in pc
Date: Thu, 15 Sep 2011 15:56:49 -0700	[thread overview]
Message-ID: <1316127412-1912-1-git-send-email-andi@firstfloor.org> (raw)

From: Andi Kleen <ak@linux.intel.com>

Add a variant of profile_pc() that allows passing in the
instruction pointer.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/include/asm/ptrace.h |    1 +
 arch/x86/kernel/time.c        |    9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 3566454..0fafaac 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -139,6 +139,7 @@ struct cpuinfo_x86;
 struct task_struct;
 
 extern unsigned long profile_pc(struct pt_regs *regs);
+extern unsigned long __profile_pc(unsigned long pc, struct pt_regs *regs);
 #define profile_pc profile_pc
 
 extern unsigned long
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index 5a64d05..cd98120 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
@@ -26,10 +26,8 @@
 DEFINE_VVAR(volatile unsigned long, jiffies) = INITIAL_JIFFIES;
 #endif
 
-unsigned long profile_pc(struct pt_regs *regs)
+unsigned long __profile_pc(unsigned long pc, struct pt_regs *regs)
 {
-	unsigned long pc = instruction_pointer(regs);
-
 	if (!user_mode_vm(regs) && in_lock_functions(pc)) {
 #ifdef CONFIG_FRAME_POINTER
 		return *(unsigned long *)(regs->bp + sizeof(long));
@@ -49,6 +47,11 @@ unsigned long profile_pc(struct pt_regs *regs)
 	}
 	return pc;
 }
+
+unsigned long profile_pc(struct pt_regs *regs)
+{
+	return __profile_pc(instruction_pointer(regs), regs);
+}
 EXPORT_SYMBOL(profile_pc);
 
 /*
-- 
1.7.4.4


             reply	other threads:[~2011-09-15 22:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-15 22:56 Andi Kleen [this message]
2011-09-15 22:56 ` [PATCH 2/4] perf_events: Pass the event to perf_instruction_pointer Andi Kleen
2011-09-15 23:16   ` Thomas Gleixner
2011-09-15 22:56 ` [PATCH 3/4] perf_events: Support a lock_parent event flag Andi Kleen
2011-09-20  9:16   ` Peter Zijlstra
2011-09-20 17:51     ` Andi Kleen
2011-09-15 22:56 ` [PATCH 4/4] perf tools: Add -l flag to top/record to account to parent Andi Kleen

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=1316127412-1912-1-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=ak@linux.intel.com \
    --cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).