Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7156095ybi; Mon, 8 Jul 2019 15:47:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwESGSgOMv+YI1re68gQgRA0SC7T3DujLKqNAPQeAVX5voY9SrlzPYJ7ZWrAlzY5ZxKHcFc X-Received: by 2002:a17:90a:bb0c:: with SMTP id u12mr29100410pjr.132.1562626019933; Mon, 08 Jul 2019 15:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562626019; cv=none; d=google.com; s=arc-20160816; b=AxS8UeWeKw0EyNp0x4EdzAr2hGI8EtldYqnL9KB1wE7atpkfbyMlenNcGhatjBw/vV PIerAz8qTVrbLl+c+QGPpTrC8xJNJPycp2dwbUR1GW+7asS1IQ+4LdiouaJ8MzmcgYh8 6NbHdND6AE8lSYsnt84LecookW7n5JF7uPHHuKg76DDNNfBTdAAYNs8Ph+k0BqamVWQ+ UTj3WP7wiIU/IRIf/Kaks+JrtcGzHgzGJ2Q+ZcvpTR7E7bq7hXo1RiKn4DexlCvb8hqu PYzag0dSzGZVxE8KL8jvoLghpH9CUkNdP2+0gzja7YPx+ny00CE79pb0DbTDOVJHP6Qw cEjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=uZma5otCeeP5X2TisOK7fX9bEsT8q63MHdz9R9Ja3ps=; b=bydWidegrlFamQqsacALRF9F0O6agbChKiQmRiFZX7411d0L5A00kXMY/W0rqyriN6 hJqQPMBIi3qa3ZrHHvam8Q9S74HYXQfPWsDe9WkEVBG++xyDGyazdy774hKDbflK2Ap0 V3rA2rdJxF7r+HhavveeXlq8klEhl6svyO3+3mLDJSGnW13lHa+GA8aVfW5nfcQqtVmY p/IWpI16o1Ed5ZAWcxcqPD7isqED3D+XM2RXm+aNaAxrgzckDL7sO1cM4XMfDDS0Ple5 9nRi0V4A+sG+m6BhXw0XrWFngJqv8lFKRCD0XIECGK7s9yxe3gHvdOQL48ZRqunk3Vdb Ptag== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u11si16104687plr.431.2019.07.08.15.46.45; Mon, 08 Jul 2019 15:46:59 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731459AbfGHTKg (ORCPT + 99 others); Mon, 8 Jul 2019 15:10:36 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:53504 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727606AbfGHTKg (ORCPT ); Mon, 8 Jul 2019 15:10:36 -0400 Received: from 1.general.cascardo.us.vpn ([10.172.70.58] helo=calabresa) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1hkZ21-0003Ex-F9; Mon, 08 Jul 2019 19:10:33 +0000 Date: Mon, 8 Jul 2019 16:10:29 -0300 From: Thadeu Lima de Souza Cascardo 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: <20190708191026.GA8307@calabresa> References: <20190322150923.1b58eca5@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190322150923.1b58eca5@gandalf.local.home> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) > > 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). > This fixes a similar problem for me. Tested-by: Thadeu Lima de Souza Cascardo > 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:`