mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Song Liu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: jpoimboe@redhat.com, tglx@linutronix.de, songliubraving@fb.com,
	kasong@redhat.com, peterz@infradead.org,
	linux-kernel@vger.kernel.org, rostedt@goodmis.org, hpa@zytor.com,
	bp@alien8.de, mingo@kernel.org
Subject: [tip:x86/urgent] perf/x86: Always store regs->ip in perf_callchain_kernel()
Date: Thu, 27 Jun 2019 15:22:01 -0700	[thread overview]
Message-ID: <tip-83f44ae0f8afcc9da659799db8693f74847e66b3@git.kernel.org> (raw)
In-Reply-To: <3975a298fa52b506fea32666d8ff6a13467eee6d.1561595111.git.jpoimboe@redhat.com>

Commit-ID:  83f44ae0f8afcc9da659799db8693f74847e66b3
Gitweb:     https://git.kernel.org/tip/83f44ae0f8afcc9da659799db8693f74847e66b3
Author:     Song Liu <songliubraving@fb.com>
AuthorDate: Wed, 26 Jun 2019 19:33:52 -0500
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 28 Jun 2019 00:11:20 +0200

perf/x86: Always store regs->ip in perf_callchain_kernel()

The stacktrace_map_raw_tp BPF selftest is failing because the RIP saved by
perf_arch_fetch_caller_regs() isn't getting saved by perf_callchain_kernel().

This was broken by the following commit:

  d15d356887e7 ("perf/x86: Make perf callchains work without CONFIG_FRAME_POINTER")

With that change, when starting with non-HW regs, the unwinder starts
with the current stack frame and unwinds until it passes up the frame
which called perf_arch_fetch_caller_regs().  So regs->ip needs to be
saved deliberately.

Fixes: d15d356887e7 ("perf/x86: Make perf callchains work without CONFIG_FRAME_POINTER")
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Kairui Song <kasong@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Borislav Petkov <bp@alien8.de>
Link: https://lkml.kernel.org/r/3975a298fa52b506fea32666d8ff6a13467eee6d.1561595111.git.jpoimboe@redhat.com

---
 arch/x86/events/core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index f315425d8468..4fb3ca1e699d 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -2402,13 +2402,13 @@ perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *re
 		return;
 	}
 
-	if (perf_hw_regs(regs)) {
-		if (perf_callchain_store(entry, regs->ip))
-			return;
+	if (perf_callchain_store(entry, regs->ip))
+		return;
+
+	if (perf_hw_regs(regs))
 		unwind_start(&state, current, regs, NULL);
-	} else {
+	else
 		unwind_start(&state, current, NULL, (void *)regs->sp);
-	}
 
 	for (; !unwind_done(&state); unwind_next_frame(&state)) {
 		addr = unwind_get_return_address(&state);

  reply	other threads:[~2019-06-27 22:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-27  0:33 [PATCH v3 0/4] x86: bpf unwinder fixes Josh Poimboeuf
2019-06-27  0:33 ` [PATCH v3 1/4] perf/x86: Always store regs->ip in perf_callchain_kernel() Josh Poimboeuf
2019-06-27 22:22   ` tip-bot for Song Liu [this message]
2019-06-27  0:33 ` [PATCH v3 2/4] objtool: Add support for C jump tables Josh Poimboeuf
2019-06-27  1:42   ` Alexei Starovoitov
2019-06-27  2:47     ` Josh Poimboeuf
2019-06-27  2:54       ` Alexei Starovoitov
2019-06-27  3:44         ` Josh Poimboeuf
2019-06-27  3:56           ` Josh Poimboeuf
2019-06-27  4:38             ` Alexei Starovoitov
2019-06-27 12:58       ` Steven Rostedt
2019-06-27  0:33 ` [PATCH v3 3/4] bpf: Fix ORC unwinding in non-JIT BPF code Josh Poimboeuf
2019-06-27  0:57   ` Alexei Starovoitov
2019-06-27  1:06     ` Josh Poimboeuf
2019-06-27  1:22       ` Alexei Starovoitov
2019-06-27  1:30         ` Josh Poimboeuf
2019-06-27  0:33 ` [PATCH v3 4/4] x86/unwind/orc: Fall back to using frame pointers for generated code Josh Poimboeuf
2019-06-27 22:22   ` [tip:x86/urgent] " tip-bot for Josh Poimboeuf

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=tip-83f44ae0f8afcc9da659799db8693f74847e66b3@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=kasong@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=songliubraving@fb.com \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome