Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7876361ybi; Tue, 9 Jul 2019 05:46:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZl/j5kZLi2/QEagPLPMDLPkb7aePbMTuz6/tiGuE6NXK28rsuM5AzywB+2LI+XBJ0sN5x X-Received: by 2002:a17:90a:8591:: with SMTP id m17mr25844975pjn.100.1562676391397; Tue, 09 Jul 2019 05:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562676391; cv=none; d=google.com; s=arc-20160816; b=il6jo4FpEoy/KIcGJRqOMhxRkV2gIunqwvspz1mO4gt90E1E+xBUbJlCHmAuIxTPdC 75aB3q5dZZBqL1W7NhqTivAQwBg8+LIwLYKrR+q3OQwYV9JLhEnJ5chBMmx1R6RHzpmy bS0HWo5AFNz4cTinZK2zGvHgH5FpujWjwTHfzmpF9XvUTcVws1D8HA3qbXER5r9eyW1w qPSVL6JK1xAdGSDKmFGxy/Uq1WTDhUKNC+cEEphTn1MP2IsJdPEAPJ6rhz0HeXaLQDEI i2UdFyEPbM6Kj6KxwjDkxRxgUI3xIP4BBAye4ryrTuWQqrKhN0u+Vstspv+vImYaAUpT lB/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=iIAoR0uB4j4jvOnE6mgc0Rn7kTF1DqQy5xrUI8w1iMY=; b=Y+i2wgUWkb3OdMyq1KR30QhXNHJWwHXz0c/jTzwEa8RE5ncokvzqosr4GNlnDmL8z5 /ImfLxQeooXNRCTKwlPJ01r4PwpZr1XG4boCMRgjKhnp5fBd2oyr8RwkSSpuBakr71SE YFjGSOEPxvJ2EJh23lRDRLK7W8AsOuOX0QK2bPDCX6AA/MBDXbEzafbsUyHxucWy8S0y cfNWsYObA0YWHpJ90h2MEk5AoW2+5gE6m1Bel6hSgHb3bNXvJw1WCtIx1d14o/izUrHY TQ5qSrJFX1Ns7jp60DlMbk4tNxtJw1CFnByfdblY+JMQ0GJf2CmtxD1k7mRD3SckPli7 +woQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DVQoHFbQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l125si23370276pgl.63.2019.07.09.05.46.14; Tue, 09 Jul 2019 05:46:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DVQoHFbQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726831AbfGIMoI (ORCPT + 99 others); Tue, 9 Jul 2019 08:44:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:39120 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726010AbfGIMoH (ORCPT ); Tue, 9 Jul 2019 08:44:07 -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 5AA9521537; Tue, 9 Jul 2019 12:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562676247; bh=9KZHooGyatEqMb1kT1mcZtrsl+uFzSoHbbt9cvkl2Pg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DVQoHFbQx9WuHoat7JU1TGwT5uSIe/ObmRQ8JgHlOCtuDyCcaaqQnKWgkB8XWFcC4 /bfX6pGhgg2ZDRb1YBe9yJTL+fMQT40l5WCxfMCcVz1HMMC0GVhshvzkRO9A6qx6rh JUTbQWtyLk3ZFUOp/p6rVn+PdwS69LyDpP7WBdA8= Date: Tue, 9 Jul 2019 21:44:02 +0900 From: Masami Hiramatsu To: Steven Rostedt Cc: Thadeu Lima de Souza Cascardo , LKML , Masami Hiramatsu , Shuah Khan , Ingo Molnar , Andrew Morton Subject: Re: [PATCH] selftests/ftrace: Select an existing function in kprobe_eventname test Message-Id: <20190709214402.ffe8b206485dec2ec28eeb3a@kernel.org> In-Reply-To: <20190708152214.0304ec7e@gandalf.local.home> References: <20190322150923.1b58eca5@gandalf.local.home> <20190708191026.GA8307@calabresa> <20190708152214.0304ec7e@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 Mon, 8 Jul 2019 15:22:14 -0400 Steven Rostedt wrote: > On Mon, 8 Jul 2019 16:10:29 -0300 > Thadeu Lima de Souza Cascardo wrote: > > > On Fri, Mar 22, 2019 at 03:09:23PM -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) Ouch! > > > > > > 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). Hmm, OK. But I think this eventually fixed in kallsyms, by something like having [GONE] or [__init] flag for such symbols. > > > > > > > This fixes a similar problem for me. > > > > Tested-by: Thadeu Lima de Souza Cascardo > > Masami, can you ack this, and Shuah, can you take it? Yeah anyway, Acked-by: Masami Hiramatsu Thank you! > > Thanks! > > -- Steve > > > > > > 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