Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp148139lqp; Wed, 20 Mar 2024 17:10:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVHDk63unULL+gKiB3B+hUmYREgyS/zydsIaUTFjKVmIpOX7XnOz7S2zrrz6Oe7GgbwzMvvv69IWtmGWeTma0FIIocA5LJV3LreK1uScw== X-Google-Smtp-Source: AGHT+IH4vRRl8WdxB4zozLW6DvcVwkj+2HbvAWnnYne5fzhWi0vcS+SgBw/BBqoL54hF41/0ErnT X-Received: by 2002:a05:620a:4053:b0:78a:76b:a90f with SMTP id i19-20020a05620a405300b0078a076ba90fmr4592622qko.33.1710979803173; Wed, 20 Mar 2024 17:10:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710979803; cv=pass; d=google.com; s=arc-20160816; b=cVdWcbOPOiMHpu5Z7fs0tJ6bHUlarBZHueFca3pA99f5uuhG8V5bSyf/3sWma227xF tb4HUrivA7MZIJG1g7Vtt/Gu/kcBusvsb0NrpyZH2Ig0gunVZQpq0aQ3oYhcS/c3gvLs fRiAnQHm0HWcy0snBhh1vlBJoBMwTdEtbK0RAkgIDO3ny7uzF9w1V36y/8ONmW/Y3LTB ueXPNFtz3ZhwI4gIC8/ui68i1eaCXHKn55UNpbWTLI8N2YlP4PhTVxzMJkMCHCZrjbJq LJSwnGS8TTnmE7cHrcVUNxV6QXgz4dKkaSE/RRlZ47xs240TT8d8esi6rVe+UKutHEcW qiLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=cjNbapPMq0Xn04ko2KSYx537jUrLBd9jCDwAkX5sZkk=; fh=9SoauWacefbRNI9NbxsBiZMuLUac12BIiSBlGDW1dYc=; b=zPfkjUi03ytWgjYg1pptS43UD1aWBhORMjeNAHraerAHsSHJJOlkMlMZthqSufOkC+ YYuR6rwh2q00k9OnCt6r5K2BGVqw0BPao08d4a8o7jgCZGjGQQDKg0TTJnGyzmKTtNnK 8nd1NarUIx5C0UX7xdDDIdIUzACR4B2VvcTyTf+E5kwixPo9H3Zm5t9CVESIRgPTR3OL rxbyzFkmCTMyZ+1eE7NF6lEFQrNR7Y0ws2dkW6/42PwSuR7AJMGhu/Gbqs7Pf0QlvgwZ MMGtKARYeEIcBAOh4RHEipsBvpu7bxfg59AMf8ZbhinD1VzCRpUUjT/HcefaJQH7vBUi AMPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h5JBMlxg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-109507-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109507-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r3-20020a05620a03c300b007883a08d7a2si14670805qkm.688.2024.03.20.17.10.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 17:10:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109507-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h5JBMlxg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-109507-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109507-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C697A1C2115C for ; Thu, 21 Mar 2024 00:10:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF00D10E3; Thu, 21 Mar 2024 00:09:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="h5JBMlxg" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5CF3181; Thu, 21 Mar 2024 00:09:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710979795; cv=none; b=uoREIlOC5pRvkcQsgkjUnSGPc3SnvVj9mcg5VvI3x4hxe7w51OxlGnoPMDCRp+zUKa5DmPP0e8Aw4yYJqxFPiaigOtI7hYWuPSAKYXX4CTEs7gvk788oR6KXDKtNZJHZ+grHhVT6zQZh6JM5+UuLj1b6EF4dzOJSgAY7FKR6yAU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710979795; c=relaxed/simple; bh=b3fhj+Y7w7mTM1r4m4zFP7hvSeXi94xhvksGojllfeE=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=Cn+6uktzEXDk07SjBPOmJtuDoNPsLs+uJcls6tx4yhkGhOne81hxiRe0H0jlYE5oZyjfchYteyH9vSlqvJLj8pCkMh9bQhIHxbR5wPSiJeK/k9NFuQxT75wCGdtmAL6/jiVptmW/YRdP+b7nThzBqtNsuKeDofHIA4FDKsczipw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=h5JBMlxg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0044C433C7; Thu, 21 Mar 2024 00:09:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710979795; bh=b3fhj+Y7w7mTM1r4m4zFP7hvSeXi94xhvksGojllfeE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=h5JBMlxgOO95XUSpRnjuxOaSJWSOW6PvFVxLcsQJc2TKZqox67ZeBeWenDNV6dbP5 U9ZWZ0Du5boyQXO4nvOqWGeLrJHoxKCffcliKILYTwNg8ypkRVxxn1rg74//f1VuOV wwMyYqIXuFL9TwxiCizAhFju8iQNv8kukYMJTAfhuVsBLGQ8YeLT08Jbhj8QKduFsj TqKF5cRoM9nu1uuoqc5n0rM666rrSpqjNm8biVLRKblDxojQQj7PreieWV9Ja079kH 75r/dztXpOVYwPPVbovWK11jQ3Xsyy1EGx5l93mtz7AjJSofbe6BU3Dsr9iM03Iacr +PbU1GtKp618g== Date: Thu, 21 Mar 2024 09:09:50 +0900 From: Masami Hiramatsu (Google) To: Mark Rutland , Shuah Khan Cc: linux-kernel@vger.kernel.org, aishwarya.tcv@arm.com, linux-kselftest@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, mhiramat@kernel.org, rostedt@goodmis.org Subject: Re: [PATCH] selftests/ftrace: Fix event filter target_func selection Message-Id: <20240321090950.f96e6b3918bb2dfd121db138@kernel.org> In-Reply-To: <20240320141844.1779984-1-mark.rutland@arm.com> References: <20240320141844.1779984-1-mark.rutland@arm.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 20 Mar 2024 14:18:44 +0000 Mark Rutland wrote: > The event filter function test has been failing in our internal test > farm: > > | # not ok 33 event filter function - test event filtering on functions > > Running the test in verbose mode indicates that this is because the test > erroneously determines that kmem_cache_free() is the most common caller > of kmem_cache_free(): > > # # + cut -d: -f3 trace > # # + sed s/call_site=([^+]*)+0x.*/1/ > # # + sort > # # + uniq -c > # # + sort > # # + tail -n 1 > # # + sed s/^[ 0-9]*// > # # + target_func=kmem_cache_free > > .. and as kmem_cache_free() doesn't call itself, setting this as the > filter function for kmem_cache_free() results in no hits, and > consequently the test fails: > > # # + grep kmem_cache_free trace > # # + grep kmem_cache_free > # # + wc -l > # # + hitcnt=0 > # # + grep kmem_cache_free trace > # # + grep -v kmem_cache_free > # # + wc -l > # # + misscnt=0 > # # + [ 0 -eq 0 ] > # # + exit_fail > > This seems to be because the system in question has tasks with ':' in > their name (which a number of kernel worker threads have). These show up > in the trace, e.g. > > test:.sh-1299 [004] ..... 2886.040608: kmem_cache_free: call_site=putname+0xa4/0xc8 ptr=000000000f4d22f4 name=names_cache > > .. and so when we try to extact the call_site with: > > cut -d: -f3 trace | sed 's/call_site=\([^+]*\)+0x.*/\1/' > > .. the 'cut' command will extrace the column containing > 'kmem_cache_free' rather than the column containing 'call_site=...', and > the 'sed' command will leave this unchanged. Consequently, the test will > decide to use 'kmem_cache_free' as the filter function, resulting in the > failure seen above. > > Fix this by matching the 'call_site=' part specifically to extract > the function name. > Looks good to me. Acked-by: Masami Hiramatsu (Google) I think this should be a fix because test task name can have ':'. Fixes: eb50d0f250e9 ("selftests/ftrace: Choose target function for filter test from samples") Cc: stable@vger.kernel.org Shuah, can you pick this as a fix? Thank you, > Signed-off-by: Mark Rutland > Reported-by: Aishwarya TCV > Cc: Masami Hiramatsu > Cc: Mathieu Desnoyers > Cc: Shuah Khan > Cc: Steven Rostedt > Cc: linux-kernel@vger.kernel.org > Cc: linux-kselftest@vger.kernel.org > Cc: linux-trace-kernel@vger.kernel.org > --- > .../selftests/ftrace/test.d/filter/event-filter-function.tc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc b/tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc > index 2de7c61d1ae3..3f74c09c56b6 100644 > --- a/tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc > +++ b/tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc > @@ -24,7 +24,7 @@ echo 0 > events/enable > echo "Get the most frequently calling function" > sample_events > > -target_func=`cut -d: -f3 trace | sed 's/call_site=\([^+]*\)+0x.*/\1/' | sort | uniq -c | sort | tail -n 1 | sed 's/^[ 0-9]*//'` > +target_func=`cat trace | grep -o 'call_site=\([^+]*\)' | sed 's/call_site=//' | sort | uniq -c | sort | tail -n 1 | sed 's/^[ 0-9]*//'` > if [ -z "$target_func" ]; then > exit_fail > fi > -- > 2.39.2 > > -- Masami Hiramatsu (Google)