From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938442AbdEXGVt (ORCPT ); Wed, 24 May 2017 02:21:49 -0400 Received: from LGEAMRELO13.lge.com ([156.147.23.53]:47451 "EHLO lgeamrelo13.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934596AbdEXGVi (ORCPT ); Wed, 24 May 2017 02:21:38 -0400 X-Original-SENDERIP: 156.147.1.127 X-Original-MAILFROM: namhyung@kernel.org X-Original-SENDERIP: 10.177.227.17 X-Original-MAILFROM: namhyung@kernel.org From: Namhyung Kim To: Ingo Molnar Cc: LKML , kernel-team@lge.com, Arnaldo Carvalho de Melo , Jiri Olsa , Milian Wolff , Yao Jin , Arnaldo Carvalho de Melo , David Ahern , Peter Zijlstra Subject: [PATCH 5/7] perf report: always honor callchain order for inlined nodes Date: Wed, 24 May 2017 15:21:27 +0900 Message-Id: <20170524062129.32529-6-namhyung@kernel.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170524062129.32529-1-namhyung@kernel.org> References: <20170524062129.32529-1-namhyung@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Milian Wolff So far, the inlined nodes where only reversed when we built perf against libbfd. If that was not available, the addr2line fallback code path was missing the inline_list__reverse call. Now we always add the nodes in the correct order within inline_list__append. This removes the need to reverse the list and also ensures that all callers construct the list in the right order. Cc: Arnaldo Carvalho de Melo Cc: David Ahern Cc: Peter Zijlstra Cc: Yao Jin Signed-off-by: Milian Wolff Signed-off-by: Namhyung Kim --- tools/perf/util/srcline.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index 5e376d64d59e..6af0364cad06 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -56,7 +56,10 @@ static int inline_list__append(char *filename, char *funcname, int line_nr, } } - list_add_tail(&ilist->list, &node->val); + if (callchain_param.order == ORDER_CALLEE) + list_add_tail(&ilist->list, &node->val); + else + list_add(&ilist->list, &node->val); return 0; } @@ -200,14 +203,6 @@ static void addr2line_cleanup(struct a2l_data *a2l) #define MAX_INLINE_NEST 1024 -static void inline_list__reverse(struct inline_node *node) -{ - struct inline_list *ilist, *n; - - list_for_each_entry_safe_reverse(ilist, n, &node->val, list) - list_move_tail(&ilist->list, &node->val); -} - static int addr2line(const char *dso_name, u64 addr, char **file, unsigned int *line, struct dso *dso, bool unwind_inlines, struct inline_node *node) @@ -250,11 +245,6 @@ static int addr2line(const char *dso_name, u64 addr, ret = 1; } } - - if ((node != NULL) && - (callchain_param.order != ORDER_CALLEE)) { - inline_list__reverse(node); - } } if (file) { -- 2.13.0