From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1C37C43381 for ; Sat, 23 Mar 2019 12:03:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BFA0921902 for ; Sat, 23 Mar 2019 12:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553342594; bh=4vxIIsaura+dEKkTAJ/Vh24C6P2IwLpkVwGnXLKWKuo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=bjJufU8PJUAnR2kGsACTLq90lhytn6phAmR6GZDfHIzXBIrLAx0wjGpxanVgZdIC8 eBMMq03ntOqmaWAqpeN82ckBrhzTxlgIVHIJSZSC0/w9fr9TUAOTtfG34DJubW4tZj 68O/xwz73CXNpJyUcXzI8hmSqFhvABGw5cw1vlWs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727402AbfCWMDN (ORCPT ); Sat, 23 Mar 2019 08:03:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:34778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726909AbfCWMDN (ORCPT ); Sat, 23 Mar 2019 08:03:13 -0400 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E6502218A5; Sat, 23 Mar 2019 12:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553342592; bh=4vxIIsaura+dEKkTAJ/Vh24C6P2IwLpkVwGnXLKWKuo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QOtYUWYXcCNfOsFqGQaT4uqsqKszp2XDiIyerd6iNtGvRTvw1E+pIh6OA9kxaRa9f y7TRzd8fdn4gAzRG1F0v5Hn9vMGxXXJKw8WM1MnFBRbkGMrQQPXordnen/btht/PaI I+71QYrlSctBePKxboCLXEsjGhUMZOUSUgHe+TcA= Date: Sat, 23 Mar 2019 21:03:08 +0900 From: Masami Hiramatsu To: Steven Rostedt Cc: LKML , Masami Hiramatsu , Shuah Khan , Ingo Molnar , Andrew Morton Subject: Re: [PATCH] selftests/ftrace: Select an existing function in kprobe_eventname test Message-Id: <20190323210308.d47164c66489982e374f3db0@kernel.org> In-Reply-To: <20190322150923.1b58eca5@gandalf.local.home> References: <20190322150923.1b58eca5@gandalf.local.home> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Mar 2019 15:09:23 -0400 Steven Rostedt wrote: > From: Steven Rostedt (VMware) > > Running the ftrace selftests on the latest kernel caused the > kprobe_eventname test to fail. It was due to the test that searches for > a function with at "dot" in the name and adding a probe to that. > Unfortunately, for this test, it picked: > > optimize_nops.isra.2.cold.4 > > Which happens to be marked as "__init", which means it no longer exists > in the kernel! (kallsyms keeps those function names around for tracing > purposes) > > As only functions that still exist are in the > available_filter_functions file, as they are removed when the functions > are freed at boot or module exit, have the test search for a function > with ".isra." in the name as well as being in the > available_filter_functions (if the file exists). OK, this looks good to me. Acked-by: Masami Hiramatsu Thank you, > > Signed-off-by: Steven Rostedt (VMware) > --- > diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc > index 3fb70e01b1fe..3ff236719b6e 100644 > --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc > +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc > @@ -24,7 +24,21 @@ test -d events/kprobes2/event2 || exit_failure > > :;: "Add an event on dot function without name" ;: > > -FUNC=`grep -m 10 " [tT] .*\.isra\..*$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " "` > +find_dot_func() { > + if [ ! -f available_filter_functions ]; then > + grep -m 10 " [tT] .*\.isra\..*$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " " > + return; > + fi > + > + grep " [tT] .*\.isra\..*" /proc/kallsyms | cut -f 3 -d " " | while read f; do > + if grep -s $f available_filter_functions; then > + echo $f > + break > + fi > + done > +} > + > +FUNC=`find_dot_func | tail -n 1` > [ "x" != "x$FUNC" ] || exit_unresolved > echo "p $FUNC" > kprobe_events > EVENT=`grep $FUNC kprobe_events | cut -f 1 -d " " | cut -f 2 -d:` -- Masami Hiramatsu