linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Ravi Bangoria <ravi.bangoria@amd.com>,
	Ross Zwisler <zwisler@chromium.org>,
	Athira Rajeev <atrajeev@linux.vnet.ibm.com>,
	Shirisha G <shirisha@linux.ibm.com>,
	Kajol Jain <kjain@linux.ibm.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 5/5] perf test: Make daemon signal test less racy
Date: Wed, 24 Jan 2024 09:38:58 +0100	[thread overview]
Message-ID: <ZbDMovjeAZBUSiMn@krava> (raw)
In-Reply-To: <20240124043015.1388867-6-irogers@google.com>

On Tue, Jan 23, 2024 at 08:30:15PM -0800, Ian Rogers wrote:
> The daemon signal test sends signals and then expects files to be
> written. It was observed on an Intel Alderlake that the signals were
> sent too quickly leading to the 3 expected files not appearing. To
> avoid this send the next signal only after the expected previous file
> has appeared. To avoid an infinite loop the number of retries is
> limited.
> 
> Signed-off-by: Ian Rogers <irogers@google.com>
> Acked-by: Namhyung Kim <namhyung@kernel.org>

Acked-by: Jiri Olsa <jolsa@kernel.org>

jirka

> ---
>  tools/perf/tests/shell/daemon.sh | 34 ++++++++++++++++++++++----------
>  1 file changed, 24 insertions(+), 10 deletions(-)
> 
> diff --git a/tools/perf/tests/shell/daemon.sh b/tools/perf/tests/shell/daemon.sh
> index 4c598cfc5afa..e5fa8d6f9eb1 100755
> --- a/tools/perf/tests/shell/daemon.sh
> +++ b/tools/perf/tests/shell/daemon.sh
> @@ -414,16 +414,30 @@ EOF
>  	# start daemon
>  	daemon_start ${config} test
>  
> -	# send 2 signals
> -	perf daemon signal --config ${config} --session test
> -	perf daemon signal --config ${config}
> -
> -	# stop daemon
> -	daemon_exit ${config}
> -
> -	# count is 2 perf.data for signals and 1 for perf record finished
> -	count=`ls ${base}/session-test/*perf.data* | wc -l`
> -	if [ ${count} -ne 3 ]; then
> +        # send 2 signals then exit. Do this in a loop watching the number of
> +        # files to avoid races. If the loop retries more than 600 times then
> +        # give up.
> +	local retries=0
> +	local signals=0
> +	local success=0
> +	while [ ${retries} -lt 600 ] && [ ${success} -eq 0 ]; do
> +		local files
> +		files=`ls ${base}/session-test/*perf.data* 2> /dev/null | wc -l`
> +		if [ ${signals} -eq 0 ]; then
> +			perf daemon signal --config ${config} --session test
> +			signals=1
> +		elif [ ${signals} -eq 1 ] && [ $files -ge 1 ]; then
> +			perf daemon signal --config ${config}
> +			signals=2
> +		elif [ ${signals} -eq 2 ] && [ $files -ge 2 ]; then
> +			daemon_exit ${config}
> +			signals=3
> +		elif [ ${signals} -eq 3 ] && [ $files -ge 3 ]; then
> +			success=1
> +		fi
> +		retries=$((${retries} +1))
> +	done
> +	if [ ${success} -eq 0 ]; then
>  		error=1
>  		echo "FAILED: perf data no generated"
>  	fi
> -- 
> 2.43.0.429.g432eaa2c6b-goog
> 

  reply	other threads:[~2024-01-24  8:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24  4:30 [PATCH v2 0/5] Fixes for 6.8 PR1 Ian Rogers
2024-01-24  4:30 ` [PATCH v2 1/5] perf list: Switch error message to pr_err Ian Rogers
2024-01-24  4:30 ` [PATCH v2 2/5] perf list: Add output file option Ian Rogers
2024-01-24  4:30 ` [PATCH v2 3/5] perf test: Workaround debug output in list test Ian Rogers
2024-01-24  4:30 ` [PATCH v2 4/5] perf test: Fix script test for python being disabled Ian Rogers
2024-01-24  4:30 ` [PATCH v2 5/5] perf test: Make daemon signal test less racy Ian Rogers
2024-01-24  8:38   ` Jiri Olsa [this message]
2024-01-25 14:46 ` [PATCH v2 0/5] Fixes for 6.8 PR1 Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZbDMovjeAZBUSiMn@krava \
    --to=olsajiri@gmail.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=irogers@google.com \
    --cc=kan.liang@linux.intel.com \
    --cc=kjain@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@amd.com \
    --cc=shirisha@linux.ibm.com \
    --cc=zwisler@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).