lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250124015836.732086-6-joel@joelfernandes.org>
Date: Thu, 23 Jan 2025 20:58:36 -0500
From: "Joel Fernandes (Google)" <joel@...lfernandes.org>
To: linux-kernel@...r.kernel.org,
	"Paul E. McKenney" <paulmck@...nel.org>,
	Josh Triplett <josh@...htriplett.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Lai Jiangshan <jiangshanlai@...il.com>,
	Shuah Khan <shuah@...nel.org>
Cc: "Joel Fernandes (Google)" <joel@...lfernandes.org>,
	rcu@...r.kernel.org,
	linux-kselftest@...r.kernel.org
Subject: [PATCH RFC 5/5] rcutorture: kvm: Invoke stress-ng building it if necessary

Invoke stress-ng from init using new --stress-ng and optional
--stress-ng-args. Default --stress-ng-args are used if none are
provided. Not passing --stress-ng does not change the behavior of kvm.sh
from before.

Signed-off-by: Joel Fernandes (Google) <joel@...lfernandes.org>
---
 tools/testing/selftests/rcutorture/bin/kvm.sh | 38 +++++++++++++++++--
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 4766c3023fed..d35496247ee6 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -42,13 +42,15 @@ TORTURE_JITTER_STOP=""
 TORTURE_KCONFIG_KASAN_ARG=""
 TORTURE_KCONFIG_KCSAN_ARG=""
 TORTURE_KMAKE_ARG=""
+TORTURE_MOD=rcutorture
 TORTURE_NO_AFFINITY=""
 TORTURE_QEMU_MEM=512
 torture_qemu_mem_default=1
 TORTURE_REMOTE=
 TORTURE_SHUTDOWN_GRACE=180
+TORTURE_STRESS_NG=
+TORTURE_STRESS_NG_DEFAULT_ARGS="--cpu 1 --cpu-method matrixprod --cpu-ops 1000000 --perf -t 5"
 TORTURE_SUITE=rcu
-TORTURE_MOD=rcutorture
 TORTURE_TRUST_MAKE=""
 debuginfo="CONFIG_DEBUG_INFO_NONE=n CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y"
 resdir=""
@@ -90,6 +92,8 @@ usage () {
 	echo "       --remote"
 	echo "       --results absolute-pathname"
 	echo "       --shutdown-grace seconds"
+	echo "       --stress-ng"
+	echo "       --stress-ng-args \"stress-ng arguments\""
 	echo "       --torture lock|rcu|rcuscale|refscale|scf|X*"
 	echo "       --trust-make"
 	exit 1
@@ -251,6 +255,14 @@ do
 		TORTURE_SHUTDOWN_GRACE=$2
 		shift
 		;;
+	--stress-ng)
+		TORTURE_STRESS_NG=1
+		;;
+	--stress-ng-args)
+		checkarg --stress-ng-args "(stress-ng arguments)" "$#" "$2" '.*' '^error'
+		TORTURE_STRESS_NG_DEFAULT_ARGS="$2"
+		shift
+		;;
 	--torture)
 		checkarg --torture "(suite name)" "$#" "$2" '^\(lock\|rcu\|rcuscale\|refscale\|scf\|X.*\)$' '^--'
 		TORTURE_SUITE=$2
@@ -275,9 +287,27 @@ do
 	shift
 done
 
-if test -z "$dryrun" && test -n "$TORTURE_INITRD" && !tools/testing/selftests/rcutorture/bin/mkinitrd.sh
-	echo No initrd and unable to create one, aborting test >&2
-	exit 1
+if test -n "$TORTURE_STRESS_NG"
+then
+	if ! "$RCUTORTURE/bin/mkstress-ng.sh"
+	then
+		echo "Failed to build stress-ng, aborting test" >&2
+		exit 1
+	fi
+fi
+
+if test -z "$dryrun" && test -n "$TORTURE_INITRD"
+then
+	stress_args=""
+	if test -n "$TORTURE_STRESS_NG"
+	then
+		stress_args="stress-ng $TORTURE_STRESS_NG_DEFAULT_ARGS"
+	fi
+	if ! "$RCUTORTURE/bin/mkinitrd.sh" $stress_args
+	then
+		echo "No initrd and unable to create one, aborting test" >&2
+		exit 1
+	fi
 fi
 
 CONFIGFRAG=${RCUTORTURE}/configs/${TORTURE_SUITE}; export CONFIGFRAG
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ