From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753909AbcDAV2Q (ORCPT ); Fri, 1 Apr 2016 17:28:16 -0400 Received: from e24smtp04.br.ibm.com ([32.104.18.25]:58494 "EHLO e24smtp04.br.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751484AbcDAV2O convert rfc822-to-8bit (ORCPT ); Fri, 1 Apr 2016 17:28:14 -0400 X-IBM-Helo: d24dlp02.br.ibm.com X-IBM-MailFrom: bauerman@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org From: Thiago Jung Bauermann To: linux-kernel@vger.kernel.org Cc: kbuild test robot , kbuild-all@01.org, linuxppc-dev@lists.ozlabs.org, Steven Rostedt , Ingo Molnar , Michael Ellerman , bauerman@linux.vnet.ibm.com Subject: Re: [PATCH] ftrace: filter: Match dot symbols when searching functions on ppc64. Date: Fri, 01 Apr 2016 18:28:06 -0300 Message-ID: <3507082.VaWR3lh7Ni@hactar> User-Agent: KMail/4.14.3 (Linux/3.13.0-36-generic; KDE/4.14.13; x86_64; ; ) In-Reply-To: <201604020331.kEOeyhX0%fengguang.wu@intel.com> References: <201604020331.kEOeyhX0%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="utf-8" X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16040121-0029-0000-0000-0000099D1046 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Samstag, 02 April 2016, 03:51:21 schrieb kbuild test robot: > >> arch/powerpc/include/asm/ftrace.h:62:5: error: "CONFIG_PPC64" is not > >> defined [-Werror=undef] > #if CONFIG_PPC64 && (!defined(_CALL_ELF) || _CALL_ELF != 2) > ^ > cc1: all warnings being treated as errors I forgot to use defined() in the #if expression. Here’s the fixed version. -- []'s Thiago Jung Bauermann IBM Linux Technology Center ---- 8< ---- 8< ---- 8< ---- 8< ---- >>From 27660a3b6c4147f9e1811b103cc47a34a53817c1 Mon Sep 17 00:00:00 2001 From: Thiago Jung Bauermann Date: Wed, 30 Mar 2016 21:26:32 -0300 Subject: [PATCH] ftrace: Match dot symbols when searching functions on ppc64 In the ppc64 big endian ABI, function symbols point to function descriptors. The symbols which point to the function entry points have a dot in front of the function name. Consequently, when the ftrace filter mechanism searches for the symbol corresponding to an entry point address, it gets the dot symbol. As a result, ftrace filter users have to be aware of this ABI detail on ppc64 and prepend a dot to the function name when setting the filter. The perf probe command insulates the user from this by ignoring the dot in front of the symbol name when matching function names to symbols, but the sysfs interface does not. This patch makes the ftrace filter mechanism do the same when searching symbols. Fixes the following failure in ftracetest's kprobe_ftrace.tc: .../kprobe_ftrace.tc: line 9: echo: write error: Invalid argument That failure is on this line of kprobe_ftrace.tc: echo _do_fork > set_ftrace_filter This is because there's no _do_fork entry in the functions list: # cat available_filter_functions | grep _do_fork ._do_fork This change introduces no regressions on the perf and ftracetest testsuite results. Cc: Steven Rostedt Cc: Ingo Molnar Cc: Michael Ellerman Signed-off-by: Thiago Jung Bauermann --- arch/powerpc/include/asm/ftrace.h | 9 +++++++++ kernel/trace/ftrace.c | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h index 50ca7585abe2..f6ed1908f0f7 100644 --- a/arch/powerpc/include/asm/ftrace.h +++ b/arch/powerpc/include/asm/ftrace.h @@ -58,6 +58,15 @@ struct dyn_arch_ftrace { struct module *mod; }; #endif /* CONFIG_DYNAMIC_FTRACE */ + +#if defined(CONFIG_PPC64) && (!defined(_CALL_ELF) || _CALL_ELF != 2) +#define ARCH_HAS_FTRACE_MATCH_ADJUST +static inline void arch_ftrace_match_adjust(char **str, char *search) +{ + if ((*str)[0] == '.' && search[0] != '.') + (*str)++; +} +#endif /* defined(CONFIG_PPC64) && (!defined(_CALL_ELF) || _CALL_ELF != 2) */ #endif /* __ASSEMBLY__ */ #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index b1870fbd2b67..e806c2a3b7a8 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -3444,11 +3444,24 @@ struct ftrace_glob { int type; }; +#ifndef ARCH_HAS_FTRACE_MATCH_ADJUST +/* + * If symbols in an architecture don't correspond exactly to the user-visible + * name of what they represent, it is possible to define this function to + * perform the necessary adjustments. +*/ +static inline void arch_ftrace_match_adjust(char **str, char *search) +{ +} +#endif + static int ftrace_match(char *str, struct ftrace_glob *g) { int matched = 0; int slen; + arch_ftrace_match_adjust(&str, g->search); + switch (g->type) { case MATCH_FULL: if (strcmp(str, g->search) == 0) -- 1.9.1