Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757404AbbEFDMF (ORCPT ); Tue, 5 May 2015 23:12:05 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36216 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757375AbbEFDLt (ORCPT ); Tue, 5 May 2015 23:11:49 -0400 Date: Tue, 5 May 2015 20:10:27 -0700 From: "tip-bot for Naveen N. Rao" Message-ID: Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, sukadev@linux.vnet.ibm.com, ananth@in.ibm.com, naveen.n.rao@linux.vnet.ibm.com, mpe@ellerman.id.au, masami.hiramatsu.pt@hitachi.com, acme@redhat.com, tglx@linutronix.de, srikar@linux.vnet.ibm.com Reply-To: hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org, sukadev@linux.vnet.ibm.com, ananth@in.ibm.com, naveen.n.rao@linux.vnet.ibm.com, masami.hiramatsu.pt@hitachi.com, mpe@ellerman.id.au, acme@redhat.com, tglx@linutronix.de, srikar@linux.vnet.ibm.com In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe ppc: Use the right prefix when ignoring SyS symbols on ppc Git-Commit-ID: fb6d59423115b10125f5db6acb8471f6f0af4ad7 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: 4021 Lines: 114 Commit-ID: fb6d59423115b10125f5db6acb8471f6f0af4ad7 Gitweb: http://git.kernel.org/tip/fb6d59423115b10125f5db6acb8471f6f0af4ad7 Author: Naveen N. Rao AuthorDate: Tue, 28 Apr 2015 17:35:36 +0530 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 4 May 2015 12:43:43 -0300 perf probe ppc: Use the right prefix when ignoring SyS symbols on ppc Use the proper prefix when ignoring SyS symbols on ppc ABIv1. While at it, generalize symbol selection so architectures can implement their own logic. Signed-off-by: Naveen N. Rao Reviewed-by: Srikar Dronamraju Cc: Ananth N Mavinakayanahalli Cc: Masami Hiramatsu Cc: Michael Ellerman Cc: Sukadev Bhattiprolu Cc: linuxppc-dev@lists.ozlabs.org Link: http://lkml.kernel.org/r/adf1f98b121ecaf292777fe5cc69fe1038feabce.1430217967.git.naveen.n.rao@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/arch/powerpc/util/sym-handling.c | 20 ++++++++++++++++++++ tools/perf/util/symbol.c | 21 ++++++++++++--------- tools/perf/util/symbol.h | 5 +++++ 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/tools/perf/arch/powerpc/util/sym-handling.c b/tools/perf/arch/powerpc/util/sym-handling.c index c9de001..5522a40 100644 --- a/tools/perf/arch/powerpc/util/sym-handling.c +++ b/tools/perf/arch/powerpc/util/sym-handling.c @@ -17,3 +17,23 @@ bool elf__needs_adjust_symbols(GElf_Ehdr ehdr) ehdr.e_type == ET_DYN; } #endif + +#if !defined(_CALL_ELF) || _CALL_ELF != 2 +int arch__choose_best_symbol(struct symbol *syma, + struct symbol *symb __maybe_unused) +{ + char *sym = syma->name; + + /* Skip over any initial dot */ + if (*sym == '.') + sym++; + + /* Avoid "SyS" kernel syscall aliases */ + if (strlen(sym) >= 3 && !strncmp(sym, "SyS", 3)) + return SYMBOL_B; + if (strlen(sym) >= 10 && !strncmp(sym, "compat_SyS", 10)) + return SYMBOL_B; + + return SYMBOL_A; +} +#endif diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 201f6c4c..f805757 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -85,8 +85,17 @@ static int prefix_underscores_count(const char *str) return tail - str; } -#define SYMBOL_A 0 -#define SYMBOL_B 1 +int __weak arch__choose_best_symbol(struct symbol *syma, + struct symbol *symb __maybe_unused) +{ + /* Avoid "SyS" kernel syscall aliases */ + if (strlen(syma->name) >= 3 && !strncmp(syma->name, "SyS", 3)) + return SYMBOL_B; + if (strlen(syma->name) >= 10 && !strncmp(syma->name, "compat_SyS", 10)) + return SYMBOL_B; + + return SYMBOL_A; +} static int choose_best_symbol(struct symbol *syma, struct symbol *symb) { @@ -134,13 +143,7 @@ static int choose_best_symbol(struct symbol *syma, struct symbol *symb) else if (na < nb) return SYMBOL_B; - /* Avoid "SyS" kernel syscall aliases */ - if (na >= 3 && !strncmp(syma->name, "SyS", 3)) - return SYMBOL_B; - if (na >= 10 && !strncmp(syma->name, "compat_SyS", 10)) - return SYMBOL_B; - - return SYMBOL_A; + return arch__choose_best_symbol(syma, symb); } void symbols__fixup_duplicate(struct rb_root *symbols) diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 8cb0af4..bd50ba0 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h @@ -307,4 +307,9 @@ int setup_intlist(struct intlist **list, const char *list_str, bool elf__needs_adjust_symbols(GElf_Ehdr ehdr); #endif +#define SYMBOL_A 0 +#define SYMBOL_B 1 + +int arch__choose_best_symbol(struct symbol *syma, struct symbol *symb); + #endif /* __PERF_SYMBOL */ -- 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/