Re: [PATCH] torture: Pass --kmake-arg to all make invocations

From: Paul E. McKenney
Date: Tue Jun 16 2020 - 12:05:36 EST


On Tue, Jun 16, 2020 at 11:49:24AM +0200, Marco Elver wrote:
> We need to pass the arguments provided to --kmake-arg to all make
> invocations. In particular, the make invocations generating the configs
> need to see the final make arguments, e.g. if config variables depend on
> particular variables that are passed to make.
>
> For example, when using '--kcsan --kmake-arg CC=clang-11', we would lose
> CONFIG_KCSAN=y due to 'make oldconfig' not seeing that we want to use a
> compiler that supports KCSAN.
>
> Signed-off-by: Marco Elver <elver@xxxxxxxxxx>

Queued and pushed, thank you!

Would the following patch make sense, at least until such time
as some other compiler supports KCSAN?

Thanx, Paul

------------------------------------------------------------------------

commit 88bcaa730b6d40ddf69b09ed6f0a14803d087d99
Author: Paul E. McKenney <paulmck@xxxxxxxxxx>
Date: Tue Jun 16 09:02:34 2020 -0700

torture: Make --kcsan default to using Clang 11

Currently, Clang 11 is the only compiler that can support KCSAN.
Therefore, as a convenience to the KCSAN user, this commit causes
--kcsan to specify Clang 11 unless a "CC=" argument was already
specified via the --kmake-arg argument.

Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>

diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 446f680..f8c6cfa 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -34,6 +34,7 @@ TORTURE_KCONFIG_ARG=""
TORTURE_KCONFIG_KASAN_ARG=""
TORTURE_KCONFIG_KCSAN_ARG=""
TORTURE_KMAKE_ARG=""
+TORTURE_KMAKE_KCSAN_ARG=""
TORTURE_QEMU_MEM=512
TORTURE_SHUTDOWN_GRACE=180
TORTURE_SUITE=rcu
@@ -144,6 +145,7 @@ do
;;
--kcsan)
TORTURE_KCONFIG_KCSAN_ARG="CONFIG_DEBUG_INFO=y CONFIG_KCSAN=y CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC=n CONFIG_KCSAN_REPORT_VALUE_CHANGE_ONLY=n CONFIG_KCSAN_REPORT_ONCE_IN_MS=100000 CONFIG_KCSAN_VERBOSE=y CONFIG_KCSAN_INTERRUPT_WATCHER=y"; export TORTURE_KCONFIG_KCSAN_ARG
+ TORTURE_KMAKE_KCSAN_ARG="CC=clang-11"
;;
--kmake-arg)
checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$'
@@ -214,6 +216,11 @@ else
exit 1
fi

+if test -n "$TORTURE_KMAKE_KCSAN_ARG" && ! echo "$TORTURE_KMAKE_ARG" | grep -q 'CC='
+then
+ TORTURE_KMAKE_ARG="$TORTURE_KMAKE_ARG $TORTURE_KMAKE_KCSAN_ARG"
+fi
+
CONFIGFRAG=${KVM}/configs/${TORTURE_SUITE}; export CONFIGFRAG

defaultconfigs="`tr '\012' ' ' < $CONFIGFRAG/CFLIST`"