linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Jan Polensky <japo@linux.ibm.com>
Cc: adrian.hunter@intel.com, irogers@google.com,
	Thomas Richter <tmricht@linux.ibm.com>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 1/1] perf test: Ensure lock contention using pipe mode
Date: Fri, 25 Jul 2025 22:31:51 -0700	[thread overview]
Message-ID: <aIRoR6j1qAfytIPC@google.com> (raw)
In-Reply-To: <20250725170801.3176678-1-japo@linux.ibm.com>

On Fri, Jul 25, 2025 at 07:08:01PM +0200, Jan Polensky wrote:
> The 'kernel lock contention analysis test' requires reliable triggering
> of lock contention. On some systems, previous benchmark calls failed to
> generate sufficient contention due to low system activity or resource
> limits.

Right, we need a reliable reproducer.

> 
> This patch adds the -p (pipe) option to all calls of perf bench sched
> messaging, ensuring consistent lock contention without relying on
> socket-based communication.

But I don't understand why pipe is different than sockets.  Can you
please elaborate?

Thanks,
Namhyung

> 
> Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
> Signed-off-by: Jan Polensky <japo@linux.ibm.com>
> ---
>  tools/perf/tests/shell/lock_contention.sh | 26 +++++++++++------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/tools/perf/tests/shell/lock_contention.sh b/tools/perf/tests/shell/lock_contention.sh
> index 30d195d4c62f..2c2887b22407 100755
> --- a/tools/perf/tests/shell/lock_contention.sh
> +++ b/tools/perf/tests/shell/lock_contention.sh
> @@ -44,7 +44,7 @@ check() {
>  test_record()
>  {
>  	echo "Testing perf lock record and perf lock contention"
> -	perf lock record -o ${perfdata} -- perf bench sched messaging > /dev/null 2>&1
> +	perf lock record -o ${perfdata} -- perf bench sched messaging -p > /dev/null 2>&1
>  	# the output goes to the stderr and we expect only 1 output (-E 1)
>  	perf lock contention -i ${perfdata} -E 1 -q 2> ${result}
>  	if [ "$(cat "${result}" | wc -l)" != "1" ]; then
> @@ -64,7 +64,7 @@ test_bpf()
>  	fi
> 
>  	# the perf lock contention output goes to the stderr
> -	perf lock con -a -b -E 1 -q -- perf bench sched messaging > /dev/null 2> ${result}
> +	perf lock con -a -b -E 1 -q -- perf bench sched messaging -p > /dev/null 2> ${result}
>  	if [ "$(cat "${result}" | wc -l)" != "1" ]; then
>  		echo "[Fail] BPF result count is not 1:" "$(cat "${result}" | wc -l)"
>  		err=1
> @@ -75,7 +75,7 @@ test_bpf()
>  test_record_concurrent()
>  {
>  	echo "Testing perf lock record and perf lock contention at the same time"
> -	perf lock record -o- -- perf bench sched messaging 2> /dev/null | \
> +	perf lock record -o- -- perf bench sched messaging -p 2> /dev/null | \
>  	perf lock contention -i- -E 1 -q 2> ${result}
>  	if [ "$(cat "${result}" | wc -l)" != "1" ]; then
>  		echo "[Fail] Recorded result count is not 1:" "$(cat "${result}" | wc -l)"
> @@ -99,7 +99,7 @@ test_aggr_task()
>  	fi
> 
>  	# the perf lock contention output goes to the stderr
> -	perf lock con -a -b -t -E 1 -q -- perf bench sched messaging > /dev/null 2> ${result}
> +	perf lock con -a -b -t -E 1 -q -- perf bench sched messaging -p > /dev/null 2> ${result}
>  	if [ "$(cat "${result}" | wc -l)" != "1" ]; then
>  		echo "[Fail] BPF result count is not 1:" "$(cat "${result}" | wc -l)"
>  		err=1
> @@ -122,7 +122,7 @@ test_aggr_addr()
>  	fi
> 
>  	# the perf lock contention output goes to the stderr
> -	perf lock con -a -b -l -E 1 -q -- perf bench sched messaging > /dev/null 2> ${result}
> +	perf lock con -a -b -l -E 1 -q -- perf bench sched messaging -p > /dev/null 2> ${result}
>  	if [ "$(cat "${result}" | wc -l)" != "1" ]; then
>  		echo "[Fail] BPF result count is not 1:" "$(cat "${result}" | wc -l)"
>  		err=1
> @@ -140,7 +140,7 @@ test_aggr_cgroup()
>  	fi
> 
>  	# the perf lock contention output goes to the stderr
> -	perf lock con -a -b -g -E 1 -q -- perf bench sched messaging > /dev/null 2> ${result}
> +	perf lock con -a -b -g -E 1 -q -- perf bench sched messaging -p > /dev/null 2> ${result}
>  	if [ "$(cat "${result}" | wc -l)" != "1" ]; then
>  		echo "[Fail] BPF result count is not 1:" "$(cat "${result}" | wc -l)"
>  		err=1
> @@ -162,7 +162,7 @@ test_type_filter()
>  		return
>  	fi
> 
> -	perf lock con -a -b -Y spinlock -q -- perf bench sched messaging > /dev/null 2> ${result}
> +	perf lock con -a -b -Y spinlock -q -- perf bench sched messaging -p > /dev/null 2> ${result}
>  	if [ "$(grep -c -v spinlock "${result}")" != "0" ]; then
>  		echo "[Fail] BPF result should not have non-spinlocks:" "$(cat "${result}")"
>  		err=1
> @@ -194,7 +194,7 @@ test_lock_filter()
>  		return
>  	fi
> 
> -	perf lock con -a -b -L tasklist_lock -q -- perf bench sched messaging > /dev/null 2> ${result}
> +	perf lock con -a -b -L tasklist_lock -q -- perf bench sched messaging -p > /dev/null 2> ${result}
>  	if [ "$(grep -c -v "${test_lock_filter_type}" "${result}")" != "0" ]; then
>  		echo "[Fail] BPF result should not have non-${test_lock_filter_type} locks:" "$(cat "${result}")"
>  		err=1
> @@ -222,7 +222,7 @@ test_stack_filter()
>  		return
>  	fi
> 
> -	perf lock con -a -b -S unix_stream -E 1 -q -- perf bench sched messaging > /dev/null 2> ${result}
> +	perf lock con -a -b -S unix_stream -E 1 -q -- perf bench sched messaging -p > /dev/null 2> ${result}
>  	if [ "$(cat "${result}" | wc -l)" != "1" ]; then
>  		echo "[Fail] BPF result should have a lock from unix_stream:" "$(cat "${result}")"
>  		err=1
> @@ -250,7 +250,7 @@ test_aggr_task_stack_filter()
>  		return
>  	fi
> 
> -	perf lock con -a -b -t -S unix_stream -E 1 -q -- perf bench sched messaging > /dev/null 2> ${result}
> +	perf lock con -a -b -t -S unix_stream -E 1 -q -- perf bench sched messaging -p > /dev/null 2> ${result}
>  	if [ "$(cat "${result}" | wc -l)" != "1" ]; then
>  		echo "[Fail] BPF result should have a task from unix_stream:" "$(cat "${result}")"
>  		err=1
> @@ -266,7 +266,7 @@ test_cgroup_filter()
>  		return
>  	fi
> 
> -	perf lock con -a -b -g -E 1 -F wait_total -q -- perf bench sched messaging > /dev/null 2> ${result}
> +	perf lock con -a -b -g -E 1 -F wait_total -q -- perf bench sched messaging -p > /dev/null 2> ${result}
>  	if [ "$(cat "${result}" | wc -l)" != "1" ]; then
>  		echo "[Fail] BPF result should have a cgroup result:" "$(cat "${result}")"
>  		err=1
> @@ -274,7 +274,7 @@ test_cgroup_filter()
>  	fi
> 
>  	cgroup=$(cat "${result}" | awk '{ print $3 }')
> -	perf lock con -a -b -g -E 1 -G "${cgroup}" -q -- perf bench sched messaging > /dev/null 2> ${result}
> +	perf lock con -a -b -g -E 1 -G "${cgroup}" -q -- perf bench sched messaging -p > /dev/null 2> ${result}
>  	if [ "$(cat "${result}" | wc -l)" != "1" ]; then
>  		echo "[Fail] BPF result should have a result with cgroup filter:" "$(cat "${cgroup}")"
>  		err=1
> @@ -309,7 +309,7 @@ test_csv_output()
>  	fi
> 
>  	# the perf lock contention output goes to the stderr
> -	perf lock con -a -b -E 1 -x , --output ${result} -- perf bench sched messaging > /dev/null 2>&1
> +	perf lock con -a -b -E 1 -x , --output ${result} -- perf bench sched messaging -p > /dev/null 2>&1
>  	output=$(grep -v "^#" ${result} | tr -d -c , | wc -c)
>  	if [ "${header}" != "${output}" ]; then
>  		echo "[Fail] BPF result does not match the number of commas: ${header} != ${output}"
> --
> 2.48.1
> 

  reply	other threads:[~2025-07-26  5:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25 17:08 [PATCH v2 1/1] perf test: Ensure lock contention using pipe mode Jan Polensky
2025-07-26  5:31 ` Namhyung Kim [this message]
2025-07-28 19:20   ` Jan Polensky
2025-07-30 18:12     ` Namhyung Kim
2025-07-31 13:51       ` Jan Polensky
2025-08-01 17:24 ` Namhyung Kim

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=aIRoR6j1qAfytIPC@google.com \
    --to=namhyung@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=japo@linux.ibm.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=tmricht@linux.ibm.com \
    /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).