From patchwork Tue Mar 29 18:34:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 603113 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qZKGF75Ggz9sBM for ; Wed, 30 Mar 2016 05:35:33 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3qZKGF6JVBzDqS6 for ; Wed, 30 Mar 2016 05:35:33 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from e24smtp01.br.ibm.com (e24smtp01.br.ibm.com [32.104.18.85]) (using TLSv1.2 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3qZKF952jJzDq5d for ; Wed, 30 Mar 2016 05:34:37 +1100 (AEDT) Received: from localhost by e24smtp01.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 29 Mar 2016 15:34:32 -0300 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp01.br.ibm.com (10.172.0.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 29 Mar 2016 15:34:30 -0300 X-IBM-Helo: d24dlp02.br.ibm.com X-IBM-MailFrom: bauerman@linux.vnet.ibm.com X-IBM-RcptTo: linuxppc-dev@lists.ozlabs.org Received: from d24relay03.br.ibm.com (d24relay03.br.ibm.com [9.13.184.25]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 616261DC0054 for ; Tue, 29 Mar 2016 14:34:24 -0400 (EDT) Received: from d24av05.br.ibm.com (d24av05.br.ibm.com [9.18.232.44]) by d24relay03.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u2THXste3801506 for ; Tue, 29 Mar 2016 14:33:55 -0300 Received: from d24av05.br.ibm.com (localhost [127.0.0.1]) by d24av05.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u2TIYSmb019152 for ; Tue, 29 Mar 2016 14:34:28 -0400 Received: from hactar.localnet ([9.78.148.253]) by d24av05.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u2TIYQEQ019105; Tue, 29 Mar 2016 14:34:28 -0400 From: Thiago Jung Bauermann To: linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH] Remove kretprobe_trampoline_holder. Date: Tue, 29 Mar 2016 15:34:22 -0300 Message-ID: <1625864.aO4Q1DYN9d@hactar> User-Agent: KMail/4.14.3 (Linux/3.13.0-36-generic; KDE/4.14.13; x86_64; ; ) In-Reply-To: <1459208757.8173.3.camel@ellerman.id.au> References: <3qWbvb0yVwz9sdm@ozlabs.org> <2042788.6sAC9lOLzB@hactar> <1459208757.8173.3.camel@ellerman.id.au> MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16032918-1524-0000-0000-00000B5E1F7B X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Am Dienstag, 29 März 2016, 10:45:57 schrieb Michael Ellerman: > On Mon, 2016-03-28 at 17:29 -0300, Thiago Jung Bauermann wrote: > > If I do s/_do_fork/._do_fork/ in kprobe_ftrace.tc then all ftrace kprobe > > tests pass: > > OK. We fixed that in 'perf probe', but not if you're using the sysfs file > directly. > > Do you want to write a patch for ftracetest to try and handle it? I guess > you'd try "_do_fork" and if that fails then try "._do_fork", and maybe > only if uname -m says you're running on ppc64? I did write a patch yesterday (included below for reference), but then I noticed that the other ftrace tests use _do_fork and they work fine (I guess because of the fix you mentioned). I think that ideally the ftrace filter mechanism should work with dot symbols as well as regular symbols. I think this could work by creating a mechanism analogous to the ARCH_HAS_SYSCALL_MATCH_SYM_NAME one in trace_syscalls.c. Ftrace_match_record could call it to adjust the symbol name (like kprobe_lookup_name) before calling ftrace_match. But I’m wondering if it’s really worth the effort and maybe patching the testcase is enough? Also, I don’t know whether my idea would have any side effects. diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc index d6f2f49..c3ec5c2 100644 --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc @@ -4,33 +4,39 @@ [ -f kprobe_events ] || exit_unsupported # this is configurable grep function available_tracers || exit_unsupported # this is configurable +if [ "$(uname -m)" = "ppc64" ]; then + FILTER_FUNCTION="._do_fork" +else + FILTER_FUNCTION="_do_fork" +fi + # prepare echo nop > current_tracer -echo _do_fork > set_ftrace_filter +echo $FILTER_FUNCTION > set_ftrace_filter echo 0 > events/enable echo > kprobe_events -echo 'p:testprobe _do_fork' > kprobe_events +echo "p:testprobe $FILTER_FUNCTION" > kprobe_events # kprobe on / ftrace off echo 1 > events/kprobes/testprobe/enable echo > trace ( echo "forked") grep testprobe trace -! grep '_do_fork <-' trace +! grep "$FILTER_FUNCTION <-" trace # kprobe on / ftrace on echo function > current_tracer echo > trace ( echo "forked") grep testprobe trace -grep '_do_fork <-' trace +grep "$FILTER_FUNCTION <-" trace # kprobe off / ftrace on echo 0 > events/kprobes/testprobe/enable echo > trace ( echo "forked") ! grep testprobe trace -grep '_do_fork <-' trace +grep "$FILTER_FUNCTION <-" trace # kprobe on / ftrace on echo 1 > events/kprobes/testprobe/enable @@ -38,14 +44,14 @@ echo function > current_tracer echo > trace ( echo "forked") grep testprobe trace -grep '_do_fork <-' trace +grep "$FILTER_FUNCTION <-" trace # kprobe on / ftrace off echo nop > current_tracer echo > trace ( echo "forked") grep testprobe trace -! grep '_do_fork <-' trace +! grep "$FILTER_FUNCTION <-" trace # cleanup echo nop > current_tracer