From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966109AbcIHJth (ORCPT ); Thu, 8 Sep 2016 05:49:37 -0400 Received: from terminus.zytor.com ([198.137.202.10]:39840 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965044AbcIHJte (ORCPT ); Thu, 8 Sep 2016 05:49:34 -0400 Date: Thu, 8 Sep 2016 02:48:45 -0700 From: tip-bot for Josh Poimboeuf Message-ID: Cc: torvalds@linux-foundation.org, mingo@kernel.org, nilayvaish@gmail.com, linux-kernel@vger.kernel.org, byungchul.park@lge.com, peterz@infradead.org, brgerst@gmail.com, rostedt@goodmis.org, rric@kernel.org, keescook@chromium.org, fweisbec@gmail.com, hpa@zytor.com, tglx@linutronix.de, jpoimboe@redhat.com, luto@amacapital.net Reply-To: brgerst@gmail.com, rostedt@goodmis.org, peterz@infradead.org, linux-kernel@vger.kernel.org, byungchul.park@lge.com, mingo@kernel.org, nilayvaish@gmail.com, torvalds@linux-foundation.org, fweisbec@gmail.com, hpa@zytor.com, jpoimboe@redhat.com, luto@amacapital.net, tglx@linutronix.de, keescook@chromium.org, rric@kernel.org In-Reply-To: <6c745a83dbd69fc6857ef9b2f8be0f011d775936.1472057064.git.jpoimboe@redhat.com> References: <6c745a83dbd69fc6857ef9b2f8be0f011d775936.1472057064.git.jpoimboe@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] oprofile/x86: Add regs->ip to oprofile trace Git-Commit-ID: 3e344a0db900757caaf0beeb749de4c7b59bfd60 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 3e344a0db900757caaf0beeb749de4c7b59bfd60 Gitweb: http://git.kernel.org/tip/3e344a0db900757caaf0beeb749de4c7b59bfd60 Author: Josh Poimboeuf AuthorDate: Wed, 24 Aug 2016 11:50:15 -0500 Committer: Ingo Molnar CommitDate: Thu, 8 Sep 2016 08:58:40 +0200 oprofile/x86: Add regs->ip to oprofile trace dump_trace() doesn't add the interrupted instruction's address to the trace, so add it manually. This makes the profile more useful, and also makes it more consistent with what perf profiling does. Signed-off-by: Josh Poimboeuf Acked-by: Robert Richter Cc: Andy Lutomirski Cc: Brian Gerst Cc: Byungchul Park Cc: Frederic Weisbecker Cc: Kees Cook Cc: Linus Torvalds Cc: Nilay Vaish Cc: Peter Zijlstra Cc: Steven Rostedt Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/6c745a83dbd69fc6857ef9b2f8be0f011d775936.1472057064.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar --- arch/x86/oprofile/backtrace.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c index cb31a44..2ef6c8b 100644 --- a/arch/x86/oprofile/backtrace.c +++ b/arch/x86/oprofile/backtrace.c @@ -114,9 +114,16 @@ x86_backtrace(struct pt_regs * const regs, unsigned int depth) if (!user_mode(regs)) { unsigned long stack = kernel_stack_pointer(regs); - if (depth) - dump_trace(NULL, regs, (unsigned long *)stack, 0, - &backtrace_ops, &depth); + + if (!depth) + return; + + oprofile_add_trace(regs->ip); + if (!--depth) + return; + + dump_trace(NULL, regs, (unsigned long *)stack, 0, + &backtrace_ops, &depth); return; }