Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753059AbbKZITb (ORCPT ); Thu, 26 Nov 2015 03:19:31 -0500 Received: from terminus.zytor.com ([198.137.202.10]:55982 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752958AbbKZIT3 (ORCPT ); Thu, 26 Nov 2015 03:19:29 -0500 Date: Thu, 26 Nov 2015 00:18:34 -0800 From: tip-bot for Jiri Olsa Message-ID: Cc: tglx@linutronix.de, namhyung@kernel.org, hpa@zytor.com, jolsa@kernel.org, mingo@kernel.org, milian.wolff@kdab.com, wangnan0@huawei.com, linux-kernel@vger.kernel.org, acme@redhat.com, peterz@infradead.org, dsahern@gmail.com Reply-To: hpa@zytor.com, namhyung@kernel.org, tglx@linutronix.de, milian.wolff@kdab.com, mingo@kernel.org, jolsa@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org, wangnan0@huawei.com, dsahern@gmail.com, peterz@infradead.org In-Reply-To: <1447772739-18471-2-git-send-email-jolsa@kernel.org> References: <1447772739-18471-2-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf callchain: Move initial entry call into get_entries function Git-Commit-ID: b26b218a1e9c5815cb8964e180b7fba3cd9bd509 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 Content-Length: 2699 Lines: 85 Commit-ID: b26b218a1e9c5815cb8964e180b7fba3cd9bd509 Gitweb: http://git.kernel.org/tip/b26b218a1e9c5815cb8964e180b7fba3cd9bd509 Author: Jiri Olsa AuthorDate: Tue, 17 Nov 2015 16:05:37 +0100 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 23 Nov 2015 18:30:10 -0300 perf callchain: Move initial entry call into get_entries function Moving initial entry call into get_entries function so all entries processing is on one place. It will be useful for next change that adds ordering logic. Signed-off-by: Jiri Olsa Tested-by: Milian Wolff Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1447772739-18471-2-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/unwind-libunwind.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index c83832b..0ae8844 100644 --- a/tools/perf/util/unwind-libunwind.c +++ b/tools/perf/util/unwind-libunwind.c @@ -614,10 +614,22 @@ void unwind__finish_access(struct thread *thread) static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, void *arg, int max_stack) { + u64 val; unw_addr_space_t addr_space; unw_cursor_t c; int ret; + ret = perf_reg_value(&val, &ui->sample->user_regs, PERF_REG_IP); + if (ret) + return ret; + + ret = entry(val, ui->thread, cb, arg); + if (ret) + return -ENOMEM; + + if (--max_stack == 0) + return 0; + addr_space = thread__priv(ui->thread); if (addr_space == NULL) return -1; @@ -640,24 +652,17 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, struct thread *thread, struct perf_sample *data, int max_stack) { - u64 ip; struct unwind_info ui = { .sample = data, .thread = thread, .machine = thread->mg->machine, }; - int ret; if (!data->user_regs.regs) return -EINVAL; - ret = perf_reg_value(&ip, &data->user_regs, PERF_REG_IP); - if (ret) - return ret; - - ret = entry(ip, thread, cb, arg); - if (ret) - return -ENOMEM; + if (max_stack <= 0) + return -EINVAL; - return --max_stack > 0 ? get_entries(&ui, cb, arg, max_stack) : 0; + return get_entries(&ui, cb, arg, max_stack); } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/