Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp332429lqh; Fri, 31 May 2024 02:43:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUYrHGs6ZGQu06oNe9hADyLyZxez0BGclhp5VrJN62f8fPpo5wgTxWZVWkXZ+kqJXbwWiNqB/tK6JFf+fnsQIxVlR/dVM56TvgXzGULpg== X-Google-Smtp-Source: AGHT+IGFfPnTY6ubuy1xwi12GusgN+KNJ2GxaYL9S8plR+X3R+AIF4lr8hgYJW9FIHWhvPS07rm9 X-Received: by 2002:a05:6214:4385:b0:6ad:78b4:98d4 with SMTP id 6a1803df08f44-6aecd575ff8mr12444586d6.18.1717148633936; Fri, 31 May 2024 02:43:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717148633; cv=pass; d=google.com; s=arc-20160816; b=AP92NFr+4wy6NZksdxKWUNJ8XGONYb5UW7Niut/wE7PDY93f+3AWIkH+y55elVglST 2qZ/Epd3t9Z8nZ27BTQLbsl3wMO07Fi0i+i78xbx9gYC/WqHtwMmZB5vHhAH2MR5Ow0o F8teMcnIZFP4NAlo/uZF36XTTDO++K416ejVyVI9YKMF0cjnXW8Wc2t6U18TtWAZV782 K2p9JRHxn3uaj45zoZT+7aF6amlW/xsnhcyAustPTmOMMgwUFrppkIkl1zBr29t6qarW +ZnUL9n0sDAT3JPXfhAYBUrHTTxVzyhBzNFBdBV0lbxUqqb7By9Xui7rKoChfI51R4nN 1KMw== 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:user-agent:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=U4rx8ZH+vwBde0fuHbo4Nlf0kuWkHOcW1V3E7cnWPNs=; fh=d2uWUuVlSG/Jut3a8o5WJsQvvcD6qfwUArp/NFKQOG4=; b=Lu4W5mRwzqPDKDelar5x6o3QT8+DLmF1aEz0gZ0hjRDMndws2p35TxWfd5xnGKvZNY x6FemllEfWf1+TYOasb3TSYEo8BKezXD5BL+K/7iGVExazDOMd4KmwkubZwogRLqaDYA FJhywOSJS703Lhui1yXtir8lCtxAD3AhacOGBE09PWFrCB1bpwY9VFceZUJYTr1x+sCw qwh+d0epoHKOv43f0/hC6SJyCfq7yU/FB+6Xd10dHL76R7WyYZdrUuHhynGgLPlqyhop 0dPuQ1UXcnsUfNgMvjp4vfB6VMhwXXH0SPch1wx7vRWsjfis9DakUvAsPbA+8ReQ0eBn JI3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RciYkpdX; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-196613-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196613-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 6a1803df08f44-6ae4a733cd7si16983366d6.87.2024.05.31.02.43.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 02:43:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196613-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=RciYkpdX; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-196613-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196613-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 9C7CB1C20C30 for ; Fri, 31 May 2024 09:43:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F16C9137C2F; Fri, 31 May 2024 09:43:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RciYkpdX" 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 23AA9133993; Fri, 31 May 2024 09:43:41 +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=1717148622; cv=none; b=n3l+ffv4D9fs9LDZ3OxE7046s+82LaIBMA2f1cxiIHapgeEI2CRR9KEujRp2SA974N+ajTEJ6tNxfzYkVkpQZyUx89Uj/f9GrVbStyQe2Iz7LplS5IOUXJjWc+ckBFwCk/ML9XBVooWZGmR9913JwN+7vRWTYpLcpOZayR0M3Z8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717148622; c=relaxed/simple; bh=KIRMeRLfAg2SfzPVmF2jfjZK9BOA5aUG46aIO9jkl5o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=ikCayL9KJ0WUWotOIleaxnO4GolOfUFtqdXUc2k11Zled3KH+WaUSXTSzPFWpx1mLln4Kpcid9IuDD2bE7K75j4JyzkSGEN/IE9h/mH2v+uwM9lI/PKm2ez9Rm3ZY+k9PMUPfKCXHtYi6Sl9KLJD5cD8DRLooxJwqdJOkvoDEu4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RciYkpdX; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D226C116B1; Fri, 31 May 2024 09:43:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717148621; bh=KIRMeRLfAg2SfzPVmF2jfjZK9BOA5aUG46aIO9jkl5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RciYkpdXpJWT8QaHFwbj1Bh82LBXeCOws7iQk1BBlY5vhqpXkNIxnO9Fq7XI/FPU6 vShzrLPHJ+6E88TEMoA69hJhGQ0BFgpQTLE7hnWS5ktoD0dU8NPvBi9wH53e3j4uG8 IX1grK6gn6heXUxnlA5Lo/lJa3iFXdwVh4W4ZjhCynS0j2t8z5SmjdxSby2d3Sszvm 0BvZ7mNoXzNy2sbJrx7S6TJNwoMHFuW5FJPq4aWzc53f44bnyECT9/aCcjWhDJk0dO 0ChA6G8XozeDGgGvZP6glJP2vXWXvMNHibdLHL/X/J6JTHrhOQAVPyR/TAEUEF0AcI ZEk3EA6oeTF6A== From: "Masami Hiramatsu (Google)" To: Steven Rostedt , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mhiramat@kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH 1/2] selftests/tracing: Fix event filter test to retry up to 10 times Date: Fri, 31 May 2024 18:43:37 +0900 Message-Id: <171714861780.198407.16488694516653649947.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <171714860864.198407.18416314586430149538.stgit@devnote2> References: <171714860864.198407.18416314586430149538.stgit@devnote2> User-Agent: StGit/0.19 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="utf-8" Content-Transfer-Encoding: 8bit From: Masami Hiramatsu (Google) Commit eb50d0f250e9 ("selftests/ftrace: Choose target function for filter test from samples") choose the target function from samples, but sometimes this test failes randomly because the target function does not hit at the next time. So retry getting samples up to 10 times. Fixes: eb50d0f250e9 ("selftests/ftrace: Choose target function for filter test from samples") Signed-off-by: Masami Hiramatsu (Google) --- .../ftrace/test.d/filter/event-filter-function.tc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 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 3f74c09c56b6..118247b8dd84 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 @@ -10,7 +10,6 @@ fail() { #msg } sample_events() { - echo > trace echo 1 > events/kmem/kmem_cache_free/enable echo 1 > tracing_on ls > /dev/null @@ -22,6 +21,7 @@ echo 0 > tracing_on echo 0 > events/enable echo "Get the most frequently calling function" +echo > trace sample_events target_func=`cat trace | grep -o 'call_site=\([^+]*\)' | sed 's/call_site=//' | sort | uniq -c | sort | tail -n 1 | sed 's/^[ 0-9]*//'` @@ -32,7 +32,16 @@ echo > trace echo "Test event filter function name" echo "call_site.function == $target_func" > events/kmem/kmem_cache_free/filter + +sample_events +max_retry=10 +while [ `grep kmem_cache_free trace| wc -l` -eq 0 ]; do sample_events +max_retry=$((max_retry - 1)) +if [ $max_retry -eq 0 ]; then + exit_fail +fi +done hitcnt=`grep kmem_cache_free trace| grep $target_func | wc -l` misscnt=`grep kmem_cache_free trace| grep -v $target_func | wc -l` @@ -49,7 +58,16 @@ address=`grep " ${target_func}\$" /proc/kallsyms | cut -d' ' -f1` echo "Test event filter function address" echo "call_site.function == 0x$address" > events/kmem/kmem_cache_free/filter +echo > trace +sample_events +max_retry=10 +while [ `grep kmem_cache_free trace| wc -l` -eq 0 ]; do sample_events +max_retry=$((max_retry - 1)) +if [ $max_retry -eq 0 ]; then + exit_fail +fi +done hitcnt=`grep kmem_cache_free trace| grep $target_func | wc -l` misscnt=`grep kmem_cache_free trace| grep -v $target_func | wc -l`