From: Swapnil Sapkal <swapnil.sapkal@amd.com>
To: <ray.huang@amd.com>, <shuah@kernel.org>
Cc: <sukrut.bellary@gmail.com>, <li.meng@amd.com>,
<gautham.shenoy@amd.com>, <wyes.karny@amd.com>,
<Perry.Yuan@amd.com>, <Mario.Limonciello@amd.com>,
<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>,
Swapnil Sapkal <swapnil.sapkal@amd.com>
Subject: [PATCH v3 2/2] selftests/amd-pstate: Added option to provide perf binary path
Date: Tue, 3 Oct 2023 05:10:06 +0000 [thread overview]
Message-ID: <20231003051006.6343-3-swapnil.sapkal@amd.com> (raw)
In-Reply-To: <20231003051006.6343-1-swapnil.sapkal@amd.com>
In selftests/amd-pstate, distro `perf` is used to capture `perf stat`
while running microbenchmarks. Distro `perf` is not working with
upstream kernel. Fixed this by providing an option to give the perf
binary path.
Signed-off-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
---
tools/testing/selftests/amd-pstate/gitsource.sh | 2 +-
tools/testing/selftests/amd-pstate/run.sh | 14 ++++++++++----
tools/testing/selftests/amd-pstate/tbench.sh | 2 +-
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/amd-pstate/gitsource.sh b/tools/testing/selftests/amd-pstate/gitsource.sh
index d0ad2ed5ba9d..5acc065e9e3e 100755
--- a/tools/testing/selftests/amd-pstate/gitsource.sh
+++ b/tools/testing/selftests/amd-pstate/gitsource.sh
@@ -87,7 +87,7 @@ run_gitsource()
printf "Make and test gitsource for $1 #$2 make_cpus: $MAKE_CPUS\n"
BACKUP_DIR=$(pwd)
cd $SCRIPTDIR/$git_name
- perf stat -a --per-socket -I 1000 -e power/energy-pkg/ /usr/bin/time -o $BACKUP_DIR/$OUTFILE_GIT.time-gitsource-$1-$2.log make test -j$MAKE_CPUS > $BACKUP_DIR/$OUTFILE_GIT-perf-$1-$2.log 2>&1
+ $PERF stat -a --per-socket -I 1000 -e power/energy-pkg/ /usr/bin/time -o $BACKUP_DIR/$OUTFILE_GIT.time-gitsource-$1-$2.log make test -j$MAKE_CPUS > $BACKUP_DIR/$OUTFILE_GIT-perf-$1-$2.log 2>&1
cd $BACKUP_DIR
for job in `jobs -p`
diff --git a/tools/testing/selftests/amd-pstate/run.sh b/tools/testing/selftests/amd-pstate/run.sh
index 279d073c5728..b87cdc5bfe4a 100755
--- a/tools/testing/selftests/amd-pstate/run.sh
+++ b/tools/testing/selftests/amd-pstate/run.sh
@@ -25,6 +25,7 @@ OUTFILE=selftest
OUTFILE_TBENCH="$OUTFILE.tbench"
OUTFILE_GIT="$OUTFILE.gitsource"
+PERF=/usr/bin/perf
SYSFS=
CPUROOT=
CPUFREQROOT=
@@ -152,8 +153,9 @@ help()
gitsource: Gitsource testing.>]
[-t <tbench time limit>]
[-p <tbench process number>]
- [-l <loop times for tbench>]
+ [-l <loop times for tbench/gitsource>]
[-i <amd tracer interval>]
+ [-b <perf binary>]
[-m <comparative test: acpi-cpufreq>]
\n"
exit 2
@@ -161,7 +163,7 @@ help()
parse_arguments()
{
- while getopts ho:c:t:p:l:i:m: arg
+ while getopts ho:c:t:p:l:i:b:m: arg
do
case $arg in
h) # --help
@@ -192,6 +194,10 @@ parse_arguments()
TRACER_INTERVAL=$OPTARG
;;
+ b) # --perf-binary
+ PERF=`realpath $OPTARG`
+ ;;
+
m) # --comparative-test
COMPARATIVE_TEST=$OPTARG
;;
@@ -205,8 +211,8 @@ parse_arguments()
command_perf()
{
- if ! command -v perf > /dev/null; then
- echo $msg please install perf. >&2
+ if ! $PERF -v; then
+ echo $msg please install perf or provide perf binary path as argument >&2
exit $ksft_skip
fi
}
diff --git a/tools/testing/selftests/amd-pstate/tbench.sh b/tools/testing/selftests/amd-pstate/tbench.sh
index 4d2e8ce2da3b..2a98d9c9202e 100755
--- a/tools/testing/selftests/amd-pstate/tbench.sh
+++ b/tools/testing/selftests/amd-pstate/tbench.sh
@@ -68,7 +68,7 @@ run_tbench()
printf "Test tbench for $1 #$2 time_limit: $TIME_LIMIT procs_num: $PROCESS_NUM\n"
tbench_srv > /dev/null 2>&1 &
- perf stat -a --per-socket -I 1000 -e power/energy-pkg/ tbench -t $TIME_LIMIT $PROCESS_NUM > $OUTFILE_TBENCH-perf-$1-$2.log 2>&1
+ $PERF stat -a --per-socket -I 1000 -e power/energy-pkg/ tbench -t $TIME_LIMIT $PROCESS_NUM > $OUTFILE_TBENCH-perf-$1-$2.log 2>&1
pid=`pidof tbench_srv`
kill $pid
--
2.34.1
next prev parent reply other threads:[~2023-10-03 5:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-03 5:10 [PATCH v3 0/2] Fix issues observed in selftests/amd-pstate Swapnil Sapkal
2023-10-03 5:10 ` [PATCH v3 1/2] selftests/amd-pstate: Fix broken paths to run workloads in amd-pstate-ut Swapnil Sapkal
2023-10-06 19:05 ` Mario Limonciello
2023-10-12 5:00 ` Swapnil Sapkal
2023-10-03 5:10 ` Swapnil Sapkal [this message]
2023-10-06 18:59 ` [PATCH v3 2/2] selftests/amd-pstate: Added option to provide perf binary path Mario Limonciello
2023-10-12 5:04 ` Swapnil Sapkal
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=20231003051006.6343-3-swapnil.sapkal@amd.com \
--to=swapnil.sapkal@amd.com \
--cc=Mario.Limonciello@amd.com \
--cc=Perry.Yuan@amd.com \
--cc=gautham.shenoy@amd.com \
--cc=li.meng@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=ray.huang@amd.com \
--cc=shuah@kernel.org \
--cc=sukrut.bellary@gmail.com \
--cc=wyes.karny@amd.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
all inboxes | Powered by JetHome®