torture: Update bare metal config generation
Subsystems (2)
cover torture: Update bare metal config generation
Hi,
I've been using these changes for my bare-metal testings for a few weeks now and I figured I should share even though I bet I'm the only one who runs rcutorture on bare-metal, but who knows?
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
rcu/dev
HEAD: 2ffb53f35976a1e12c481fd059701e66a6cd28ae
Thanks,
Frederic
---
Frederic Weisbecker (3):
torture: Add --cmdline-to-config parameter to kvm.sh
torture: Add --configonly parameter for kvm.sh
torture: Update bare metal advices to latest kvm.sh options.../testing/selftests/rcutorture/bin/configinit.sh | 13 +++++ .../testing/selftests/rcutorture/bin/kvm-build.sh | 9 ++- .../selftests/rcutorture/bin/kvm-recheck.sh | 6 +- .../selftests/rcutorture/bin/kvm-test-1-run.sh | 67 +++++++++++++--------- tools/testing/selftests/rcutorture/bin/kvm.sh | 32 ++++++++--- 5 files changed, 91 insertions(+), 36 deletions(-)
PATCH 1/3 torture: Add --cmdline-to-config parameter to kvm.sh
While running rcutorture on bare metal, an easy way to test is to build a kernel with the torture scenario parameters built-in using CONFIG_CMDLINE="". This way the remote box can simply download the image and the boot loader doesn't need to be updated with the new kernel parameters.
Provide kvm.sh with --cmdline-to-config to perform that.
--- .../selftests/rcutorture/bin/configinit.sh | 13 +++++++ .../selftests/rcutorture/bin/kvm-build.sh | 4 ++- .../rcutorture/bin/kvm-test-1-run.sh | 34 +++++++++++-------- tools/testing/selftests/rcutorture/bin/kvm.sh | 6 ++++ 4 files changed, 41 insertions(+), 16 deletions(-)
tools/testing/selftests/rcutorture/bin/configinit.sh +13 -0
@@ -23,6 +23,8 @@ mkdir $T c=$1 resdir=$2 +kboot_args=$3 +modprobe_args=$4 sed -e 's/^\(CONFIG[0-9A-Z_]*\)=.*$/grep -v "^# \1" |/' < $c > $T/u.sh sed -e 's/^\(CONFIG[0-9A-Z_]*=\).*$/grep -v \1 |/' < $c >> $T/u.sh
@@ -35,6 +37,17 @@ fi make $TORTURE_KMAKE_ARG $TORTURE_DEFCONFIG > $resdir/Make.defconfig.out 2>&1 mv .config .config.sav sh $T/upd.sh < .config.sav > .config + +if test -n "$TORTURE_CMDLINE2CONFIG" +then + cmdline=$(grep "CONFIG_CMDLINE=" .config | sed -E 's/CONFIG_CMDLINE="(.*)"/\1/') + prefixed_modprobe_args=$(echo $modprobe_args | sed -E -e "s/([^ ]+?)(=[^ ]*)?/rcutorture.\1\2/g") + cmdline="$kboot_args $prefixed_modprobe_args $cmdline" + grep -Ev "CONFIG_CMDLINE[= ]" .config > .config.sav + mv .config.sav .config + echo "CONFIG_CMDLINE=\""$cmdline"\"" >> .config +fi + cp .config .config.new yes '' | make $TORTURE_KMAKE_ARG oldconfig > $resdir/Make.oldconfig.out 2> $resdir/Make.oldconfig.err
tools/testing/selftests/rcutorture/bin/kvm-build.sh +3 -1
@@ -22,6 +22,8 @@ then exit 1 fi resdir=${2} +kboot_args=${3} +modprobe_args=${4} T=${TMPDIR-/tmp}/test-linux.sh.$$ trap 'rm -rf $T' 0
@@ -34,7 +36,7 @@ CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_CONSOLE=y ___EOF___ -configinit.sh $T/config $resdir +configinit.sh $T/config $resdir "$kboot_args" "$modprobe_args" retval=$? if test $retval -gt 1 then
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +19 -15
@@ -71,6 +71,24 @@ config_override_param "--kcsan options" KcList "$TORTURE_KCONFIG_KCSAN_ARG" config_override_param "--kconfig argument" KcList "$TORTURE_KCONFIG_ARG" cp $T/KcList $resdir/ConfigFragment +seconds=$3 +qemu_args=$4 +boot_args_in=$5 + +# Pull in Kconfig-fragment boot parameters +boot_args="`configfrag_boot_params "$boot_args_in" "$config_template"`" +# Generate kernel-version-specific boot parameters +boot_args="`per_version_boot_params "$boot_args" $resdir/.config $seconds`" + +if test -n "$TORTURE_BOOT_GDB_ARG" +then + boot_args="$boot_args $TORTURE_BOOT_GDB_ARG" +fi + +modprobe_args="`echo $boot_args | tr -s ' ' '\012' | grep "^$TORTURE_MOD\." | sed -e "s/$TORTURE_MOD\.//g"`" +kboot_args="`echo $boot_args | tr -s ' ' '\012' | grep -v "^$TORTURE_MOD\."`" + + base_resdir=`echo $resdir | sed -e 's/\.[0-9]\+$//'` if test "$base_resdir" != "$resdir" && test -f $base_resdir/bzImage && test -f $base_resdir/vmlinux then
@@ -93,7 +111,7 @@ then mv $resdir/build.wait $resdir/build.ready fi exit 1 -elif kvm-build.sh $T/KcList $resdir +elif kvm-build.sh $T/KcList $resdir "$kboot_args" "$modprobe_args" then # Had to build a kernel for this test. QEMU="`identify_qemu vmlinux`"
@@ -131,9 +149,6 @@ while test -f $resdir/build.ready do sleep 1 done -seconds=$3 -qemu_args=$4 -boot_args_in=$5 if test -z "$TORTURE_BUILDONLY" then
@@ -158,18 +173,7 @@ qemu_args="$qemu_args `identify_qemu_args "$QEMU" "$resdir/console.log"`" # Generate qemu -append arguments qemu_append="`identify_qemu_append "$QEMU"`" -# Pull in Kconfig-fragment boot parameters -boot_args="`configfrag_boot_params "$boot_args_in" "$config_template"`" -# Generate kernel-version-specific boot parameters -boot_args="`per_version_boot_params "$boot_args" $resdir/.config $seconds`" -if test -n "$TORTURE_BOOT_GDB_ARG" -then - boot_args="$boot_args $TORTURE_BOOT_GDB_ARG" -fi - # Give bare-metal advice -modprobe_args="`echo $boot_args | tr -s ' ' '\012' | grep "^$TORTURE_MOD\." | sed -e "s/$TORTURE_MOD\.//g"`" -kboot_args="`echo $boot_args | tr -s ' ' '\012' | grep -v "^$TORTURE_MOD\."`" testid_txt="`dirname $resdir`/testid.txt" touch $resdir/bare-metal echo To run this scenario on bare metal: >> $resdir/bare-metal
tools/testing/selftests/rcutorture/bin/kvm.sh +6 -0
@@ -33,6 +33,7 @@ TORTURE_ALLOTED_CPUS="`identify_qemu_vcpus`" TORTURE_DEFCONFIG=defconfig TORTURE_BOOT_IMAGE="" TORTURE_BUILDONLY= +TORTURE_CMDLINE2CONFIG= TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD TORTURE_KCONFIG_ARG="" TORTURE_KCONFIG_GDB_ARG=""
@@ -64,6 +65,7 @@ usage () { echo " --bootargs kernel-boot-arguments" echo " --bootimage relative-path-to-kernel-boot-image" echo " --buildonly" + echo " --cmdline-to-config" echo " --configs \"config-file list w/ repeat factor (3*TINY01)\"" echo " --cpus N" echo " --datestamp string"
@@ -108,6 +110,9 @@ do --buildonly|--build-only) TORTURE_BUILDONLY=1 ;; + --cmdline-to-config) + TORTURE_CMDLINE2CONFIG=1 + ;; --configs|--config) checkarg --configs "(list of config files)" "$#" "$2" '^[^/.a-z]\+$' '^--' configs="$configs $2"
@@ -388,6 +393,7 @@ PATH="$PATH"; export PATH TORTURE_ALLOTED_CPUS="$TORTURE_ALLOTED_CPUS"; export TORTURE_ALLOTED_CPUS TORTURE_BOOT_IMAGE="$TORTURE_BOOT_IMAGE"; export TORTURE_BOOT_IMAGE TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY +TORTURE_CMDLINE2CONFIG="$TORTURE_CMDLINE2CONFIG"; export TORTURE_CMDLINE2CONFIG TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD TORTURE_KCONFIG_ARG="$TORTURE_KCONFIG_ARG"; export TORTURE_KCONFIG_ARG
Signature · 1 line
2.25.1
Paul E. McKenney
maintainerRe: [PATCH 1/3] torture: Add --cmdline-to-config parameter to kvm.sh
Quoted 5 lines · Frederic Weisbecker
While running rcutorture on bare metal, an easy way to test is to build a kernel with the torture scenario parameters built-in using
CONFIG_CMDLINE="". This way the remote box can simply download the image and the boot loader doesn't need to be updated with the new kernel parameters.
I had no idea about CONFIG_CMDLINE! Thank you for introducing me to it!
Quoted 1 line
Provide
kvm.shwith --cmdline-to-config to perform that.
If I understand correctly, kernel-boot parameters are processed after the CONFIG_CMDLINE parameters. If so, would it make sense (probably as a separate patch) for the current --bootargs kernel parameters to be supplied to CONFIG_CMDLINE in kvm.sh, and to add a --bootargs parameter to kvm-again.sh which caused additional kernel-boot parameters to be added to the end of the "-append" list in the qemu-cmd file?
As in, "Re-run this rcutorture run, but with rcutorture.onoff_interval=0 so as to disable CPU-hotplug operations"?
More on-point questions and comments interspersed below. Well, hopefully more on-point, anyway!
Quoted 22 lines
Signed-off-by Frederic Weisbecker <[email protected]>--- .../selftests/rcutorture/bin/configinit.sh | 13 +++++++ .../selftests/rcutorture/bin/kvm-build.sh | 4 ++- .../rcutorture/bin/kvm-test-1-run.sh | 34 +++++++++++-------- tools/testing/selftests/rcutorture/bin/kvm.sh | 6 ++++ 4 files changed, 41 insertions(+), 16 deletions(-)tools/testing/selftests/rcutorture/bin/configinit.sh +2
-0@@ -23,6 +23,8 @@ mkdir $T c=$1 resdir=$2 +kboot_args=$3 +modprobe_args=$4 sed -e 's/^\(CONFIG[0-9A-Z_]*\)=.*$/grep -v "^# \1" |/' < $c > $T/u.sh sed -e 's/^\(CONFIG[0-9A-Z_]*=\).*$/grep -v \1 |/' < $c >> $T/u.sh
tools/testing/selftests/rcutorture/bin/configinit.sh fi · line 44
Quoted 8 lines
tools/testing/selftests/rcutorture/bin/configinit.sh +5
-0@@ -35,6 +37,17 @@ fi make $TORTURE_KMAKE_ARG $TORTURE_DEFCONFIG > $resdir/Make.defconfig.out 2>&1 mv .config .config.sav sh $T/upd.sh < .config.sav > .config + +if test -n "$TORTURE_CMDLINE2CONFIG" +then + cmdline=$(grep "CONFIG_CMDLINE=" .config | sed -E 's/CONFIG_CMDLINE="(.*)"/\1/') + prefixed_modprobe_args=$(echo $modprobe_args | sed -E -e "s/([^ ]+?)(=[^ ]*)?/rcutorture.\1\2/g")
Doesn't this need to check for locktorture, refscale, rcuscale, and scftorture as well as for rcutorture? Maybe use the TORTURE_MOD environment variable similar to the way you do in your change to kvm-test-1-run.sh.
tools/testing/selftests/rcutorture/bin/configinit.sh fi · line 45
Quoted 1 line
tools/testing/selftests/rcutorture/bin/configinit.sh +1
-0+ cmdline="$kboot_args $prefixed_modprobe_args $cmdline"
This makes a "--kconfig CONFIG_CMDLINE=whatever" override the --bootargs parameters. Is that what we want? Either way, why?
You could ask the same question about the current ordering of kernel boot parameters from their various sources, and it would be good to do so.
Quoted 45 lines
tools/testing/selftests/rcutorture/bin/configinit.sh +5
-0+ grep -Ev "CONFIG_CMDLINE[= ]" .config > .config.sav + mv .config.sav .config + echo "CONFIG_CMDLINE=\""$cmdline"\"" >> .config +fi + cp .config .config.new yes '' | make $TORTURE_KMAKE_ARG oldconfig > $resdir/Make.oldconfig.out 2> $resdir/Make.oldconfig.errtools/testing/selftests/rcutorture/bin/kvm-build.sh +3
-1@@ -22,6 +22,8 @@ then exit 1 fi resdir=${2} +kboot_args=${3} +modprobe_args=${4} T=${TMPDIR-/tmp}/test-linux.sh.$$ trap 'rm -rf $T' 0@@ -34,7 +36,7 @@ CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_CONSOLE=y ___EOF___ -configinit.sh $T/config $resdir +configinit.sh $T/config $resdir "$kboot_args" "$modprobe_args" retval=$? if test $retval -gt 1 thentools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +7
-0@@ -71,6 +71,24 @@ config_override_param "--kcsan options" KcList "$TORTURE_KCONFIG_KCSAN_ARG" config_override_param "--kconfig argument" KcList "$TORTURE_KCONFIG_ARG" cp $T/KcList $resdir/ConfigFragment +seconds=$3 +qemu_args=$4 +boot_args_in=$5 + +# Pull in Kconfig-fragment boot parameters +boot_args="`configfrag_boot_params "$boot_args_in" "$config_template"`" +# Generate kernel-version-specific boot parameters
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh config_override_param "--kcsan options" KcList "$TORTURE_KCONFIG_KCSAN_ARG" · line 90
Quoted 10 lines
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +10
-0+boot_args="`per_version_boot_params "$boot_args" $resdir/.config $seconds`" + +if test -n "$TORTURE_BOOT_GDB_ARG" +then + boot_args="$boot_args $TORTURE_BOOT_GDB_ARG" +fi + +modprobe_args="`echo $boot_args | tr -s ' ' '\012' | grep "^$TORTURE_MOD\." | sed -e "s/$TORTURE_MOD\.//g"`" +kboot_args="`echo $boot_args | tr -s ' ' '\012' | grep -v "^$TORTURE_MOD\."`" +
We are in trouble if a kernel boot parameter contains a space character, but we probably are already in trouble, so no problem. ;-)
But don't we want to avoid adding these to the qemu -append argument if they are already in CONFIG_CMDLINE? Or is there some benefit to duplicating them?
Quoted 55 lines
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +2
-15+ base_resdir=`echo $resdir | sed -e 's/\.[0-9]\+$//'` if test "$base_resdir" != "$resdir" && test -f $base_resdir/bzImage && test -f $base_resdir/vmlinux then@@ -93,7 +111,7 @@ then mv $resdir/build.wait $resdir/build.ready fi exit 1 -elif kvm-build.sh $T/KcList $resdir +elif kvm-build.sh $T/KcList $resdir "$kboot_args" "$modprobe_args" then # Had to build a kernel for this test. QEMU="`identify_qemu vmlinux`"@@ -131,9 +149,6 @@ while test -f $resdir/build.ready do sleep 1 done -seconds=$3 -qemu_args=$4 -boot_args_in=$5 if test -z "$TORTURE_BUILDONLY" then@@ -158,18 +173,7 @@ qemu_args="$qemu_args `identify_qemu_args "$QEMU" "$resdir/console.log"`" # Generate qemu -append arguments qemu_append="`identify_qemu_append "$QEMU"`" -# Pull in Kconfig-fragment boot parameters -boot_args="`configfrag_boot_params "$boot_args_in" "$config_template"`" -# Generate kernel-version-specific boot parameters -boot_args="`per_version_boot_params "$boot_args" $resdir/.config $seconds`" -if test -n "$TORTURE_BOOT_GDB_ARG" -then - boot_args="$boot_args $TORTURE_BOOT_GDB_ARG" -fi - # Give bare-metal advice -modprobe_args="`echo $boot_args | tr -s ' ' '\012' | grep "^$TORTURE_MOD\." | sed -e "s/$TORTURE_MOD\.//g"`" -kboot_args="`echo $boot_args | tr -s ' ' '\012' | grep -v "^$TORTURE_MOD\."`" testid_txt="`dirname $resdir`/testid.txt" touch $resdir/bare-metal echo To run this scenario on bare metal: >> $resdir/bare-metaltools/testing/selftests/rcutorture/bin/kvm.sh +1
-0@@ -33,6 +33,7 @@ TORTURE_ALLOTED_CPUS="`identify_qemu_vcpus`" TORTURE_DEFCONFIG=defconfig TORTURE_BOOT_IMAGE="" TORTURE_BUILDONLY= +TORTURE_CMDLINE2CONFIG= TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD TORTURE_KCONFIG_ARG="" TORTURE_KCONFIG_GDB_ARG=""
tools/testing/selftests/rcutorture/bin/kvm.sh usage () { · line 68
Quoted 4 lines
tools/testing/selftests/rcutorture/bin/kvm.sh +1
-0@@ -64,6 +65,7 @@ usage () { echo " --bootargs kernel-boot-arguments" echo " --bootimage relative-path-to-kernel-boot-image" echo " --buildonly" + echo " --cmdline-to-config"
Does it make sense to have a way to specify that some kernel-boot paremeters go in through CONFIG_CMDLINE and others through the qemu -append argument?
Does it make sense to make kvm.sh unconditionally pass the kernel boot parameters in via CONFIG_CMDLINE, thus avoiding the need for the new --cmdline_to_config argument? (One reason to avoid this is that it is probably easier to hand-edit the qemu-cmd file than the bzImage file. Though the qemu-cmd edits would override the bzImage boot parameters, right?)
Quoted 24 lines
tools/testing/selftests/rcutorture/bin/kvm.sh +4
-0echo " --configs \"config-file list w/ repeat factor (3*TINY01)\"" echo " --cpus N" echo " --datestamp string"@@ -108,6 +110,9 @@ do --buildonly|--build-only) TORTURE_BUILDONLY=1 ;; + --cmdline-to-config) + TORTURE_CMDLINE2CONFIG=1 + ;; --configs|--config) checkarg --configs "(list of config files)" "$#" "$2" '^[^/.a-z]\+$' '^--' configs="$configs $2"@@ -388,6 +393,7 @@ PATH="$PATH"; export PATH TORTURE_ALLOTED_CPUS="$TORTURE_ALLOTED_CPUS"; export TORTURE_ALLOTED_CPUS TORTURE_BOOT_IMAGE="$TORTURE_BOOT_IMAGE"; export TORTURE_BOOT_IMAGE TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY +TORTURE_CMDLINE2CONFIG="$TORTURE_CMDLINE2CONFIG"; export TORTURE_CMDLINE2CONFIG TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD TORTURE_KCONFIG_ARG="$TORTURE_KCONFIG_ARG"; export TORTURE_KCONFIG_ARGSignature · 1 line
2.25.1
Re: [PATCH 1/3] torture: Add --cmdline-to-config parameter to kvm.sh
Quoted 18 lines · Paul E. McKenney
Quoted 5 lines · Frederic Weisbecker
While running rcutorture on bare metal, an easy way to test is to build a kernel with the torture scenario parameters built-in using
CONFIG_CMDLINE="". This way the remote box can simply download the image and the boot loader doesn't need to be updated with the new kernel parameters.I had no idea about
CONFIG_CMDLINE! Thank you for introducing me to it!Quoted 1 line
Provide
kvm.shwith --cmdline-to-config to perform that.If I understand correctly, kernel-boot parameters are processed after the
CONFIG_CMDLINEparameters. If so, would it make sense (probably as a separate patch) for the current --bootargs kernel parameters to be supplied toCONFIG_CMDLINEinkvm.sh, and to add a --bootargs parameter tokvm-again.shwhich caused additional kernel-boot parameters to be added to the end of the "-append" list in the qemu-cmd file?
Quoted 2 lines
As in, "Re-run this rcutorture run, but with rcutorture.onoff_interval=0 so as to disable CPU-hotplug operations"?
Sure that looks possible.
Quoted 11 lines
Quoted 11 lines
tools/testing/selftests/rcutorture/bin/configinit.sh +2
-0@@ -23,6 +23,8 @@ mkdir $T c=$1 resdir=$2 +kboot_args=$3 +modprobe_args=$4
Quoted 16 lines
tools/testing/selftests/rcutorture/bin/configinit.sh fi · line 44
Quoted 11 lines
tools/testing/selftests/rcutorture/bin/configinit.sh +5
-0sed -e 's/^\(CONFIG[0-9A-Z_]*\)=.*$/grep -v "^# \1" |/' < $c > $T/u.sh sed -e 's/^\(CONFIG[0-9A-Z_]*=\).*$/grep -v \1 |/' < $c >> $T/u.sh@@ -35,6 +37,17 @@ fi make $TORTURE_KMAKE_ARG $TORTURE_DEFCONFIG > $resdir/Make.defconfig.out 2>&1 mv .config .config.sav sh $T/upd.sh < .config.sav > .config + +if test -n "$TORTURE_CMDLINE2CONFIG" +then + cmdline=$(grep "CONFIG_CMDLINE=" .config | sed -E 's/CONFIG_CMDLINE="(.*)"/\1/') + prefixed_modprobe_args=$(echo $modprobe_args | sed -E -e "s/([^ ]+?)(=[^ ]*)?/rcutorture.\1\2/g")Doesn't this need to check for locktorture, refscale, rcuscale, and scftorture as well as for rcutorture? Maybe use the
TORTURE_MODenvironment variable similar to the way you do in your change tokvm-test-1-run.sh.
Ah! Right I missed all that. Ok I'll need to handle all those other modules.
Quoted 5 lines
tools/testing/selftests/rcutorture/bin/configinit.sh fi · line 45
Quoted 2 lines
tools/testing/selftests/rcutorture/bin/configinit.sh +1
-0+ cmdline="$kboot_args $prefixed_modprobe_args $cmdline"This makes a "--kconfig
CONFIG_CMDLINE=whatever" override the --bootargs parameters. Is that what we want? Either way, why?
I guess it's up to the user not to try dangerous mixes. But we could forbid --kconfig CONFIG_CMDLINE= for example.
Quoted 2 lines
You could ask the same question about the current ordering of kernel boot parameters from their various sources, and it would be good to do so.
Heh.
Quoted 12 lines
Quoted 12 lines
tools/testing/selftests/rcutorture/bin/configinit.sh +12
-0+seconds=$3 +qemu_args=$4 +boot_args_in=$5 + +# Pull in Kconfig-fragment boot parameters +boot_args="`configfrag_boot_params "$boot_args_in" "$config_template"`" +# Generate kernel-version-specific boot parameters +boot_args="`per_version_boot_params "$boot_args" $resdir/.config $seconds`" + +if test -n "$TORTURE_BOOT_GDB_ARG" +then + boot_args="$boot_args $TORTURE_BOOT_GDB_ARG"
Quoted 8 lines
tools/testing/selftests/rcutorture/bin/configinit.sh
Quoted 5 lines
tools/testing/selftests/rcutorture/bin/configinit.sh +5
-0+fi + +modprobe_args="`echo $boot_args | tr -s ' ' '\012' | grep "^$TORTURE_MOD\." | sed -e "s/$TORTURE_MOD\.//g"`" +kboot_args="`echo $boot_args | tr -s ' ' '\012' | grep -v "^$TORTURE_MOD\."`" +We are in trouble if a kernel boot parameter contains a space character, but we probably are already in trouble, so no problem. ;-)
:o)
Quoted 4 lines
But don't we want to avoid adding these to the qemu -append argument if they are already in
CONFIG_CMDLINE? Or is there some benefit to duplicating them?
Indeed I only used it with --configonly so far so I didn't bother checking. But you're right, I should avoid passing these twice.
Quoted 22 lines
Quoted 13 lines
tools/testing/selftests/rcutorture/bin/kvm.sh +1
-0@@ -33,6 +33,7 @@ TORTURE_ALLOTED_CPUS="`identify_qemu_vcpus`" TORTURE_DEFCONFIG=defconfig TORTURE_BOOT_IMAGE="" TORTURE_BUILDONLY= +TORTURE_CMDLINE2CONFIG= TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD TORTURE_KCONFIG_ARG="" TORTURE_KCONFIG_GDB_ARG=""tools/testing/selftests/rcutorture/bin/kvm.sh usage () { · line 68
Quoted 4 lines
tools/testing/selftests/rcutorture/bin/kvm.sh +1
-0@@ -64,6 +65,7 @@ usage () { echo " --bootargs kernel-boot-arguments" echo " --bootimage relative-path-to-kernel-boot-image" echo " --buildonly" + echo " --cmdline-to-config"Does it make sense to have a way to specify that some kernel-boot paremeters go in through
CONFIG_CMDLINEand others through the qemu -append argument?
Quoted 6 lines
Does it make sense to make
kvm.shunconditionally pass the kernel boot parameters in viaCONFIG_CMDLINE, thus avoiding the need for the new --cmdline_to_config argument? (One reason to avoid this is that it is probably easier to hand-edit the qemu-cmd file than the bzImage file. Though the qemu-cmd edits would override the bzImage boot parameters, right?)
I guess it depends if you ever plan to be able to re-launch qemu with different parameters without rebuilding the bzImage. Perhaps it's even something that can be done currently?
Thanks!
Paul E. McKenney
maintainerRe: [PATCH 1/3] torture: Add --cmdline-to-config parameter to kvm.sh
Quoted 126 lines · Frederic Weisbecker
Quoted 18 lines · Paul E. McKenney
Quoted 5 lines · Frederic Weisbecker
While running rcutorture on bare metal, an easy way to test is to build a kernel with the torture scenario parameters built-in using
CONFIG_CMDLINE="". This way the remote box can simply download the image and the boot loader doesn't need to be updated with the new kernel parameters.I had no idea about
CONFIG_CMDLINE! Thank you for introducing me to it!Quoted 1 line
Provide
kvm.shwith --cmdline-to-config to perform that.If I understand correctly, kernel-boot parameters are processed after the
CONFIG_CMDLINEparameters. If so, would it make sense (probably as a separate patch) for the current --bootargs kernel parameters to be supplied toCONFIG_CMDLINEinkvm.sh, and to add a --bootargs parameter tokvm-again.shwhich caused additional kernel-boot parameters to be added to the end of the "-append" list in the qemu-cmd file?Quoted 2 lines
As in, "Re-run this rcutorture run, but with rcutorture.onoff_interval=0 so as to disable CPU-hotplug operations"?
Sure that looks possible.
Quoted 11 lines
Quoted 11 lines
tools/testing/selftests/rcutorture/bin/configinit.sh +2
-0@@ -23,6 +23,8 @@ mkdir $T c=$1 resdir=$2 +kboot_args=$3 +modprobe_args=$4Quoted 16 lines
tools/testing/selftests/rcutorture/bin/configinit.sh fi · line 44
Quoted 11 lines
tools/testing/selftests/rcutorture/bin/configinit.sh +5
-0sed -e 's/^\(CONFIG[0-9A-Z_]*\)=.*$/grep -v "^# \1" |/' < $c > $T/u.sh sed -e 's/^\(CONFIG[0-9A-Z_]*=\).*$/grep -v \1 |/' < $c >> $T/u.sh@@ -35,6 +37,17 @@ fi make $TORTURE_KMAKE_ARG $TORTURE_DEFCONFIG > $resdir/Make.defconfig.out 2>&1 mv .config .config.sav sh $T/upd.sh < .config.sav > .config + +if test -n "$TORTURE_CMDLINE2CONFIG" +then + cmdline=$(grep "CONFIG_CMDLINE=" .config | sed -E 's/CONFIG_CMDLINE="(.*)"/\1/') + prefixed_modprobe_args=$(echo $modprobe_args | sed -E -e "s/([^ ]+?)(=[^ ]*)?/rcutorture.\1\2/g")Doesn't this need to check for locktorture, refscale, rcuscale, and scftorture as well as for rcutorture? Maybe use the
TORTURE_MODenvironment variable similar to the way you do in your change tokvm-test-1-run.sh.Ah! Right I missed all that. Ok I'll need to handle all those other modules.
Quoted 4 lines
tools/testing/selftests/rcutorture/bin/configinit.sh fi · line 45
Quoted 1 line
tools/testing/selftests/rcutorture/bin/configinit.sh +1
-0+ cmdline="$kboot_args $prefixed_modprobe_args $cmdline"This makes a "--kconfig
CONFIG_CMDLINE=whatever" override the --bootargs parameters. Is that what we want? Either way, why?I guess it's up to the user not to try dangerous mixes. But we could forbid --kconfig
CONFIG_CMDLINE=for example.Quoted 2 lines
You could ask the same question about the current ordering of kernel boot parameters from their various sources, and it would be good to do so.
Heh.
Quoted 12 lines
Quoted 12 lines
tools/testing/selftests/rcutorture/bin/configinit.sh +12
-0+seconds=$3 +qemu_args=$4 +boot_args_in=$5 + +# Pull in Kconfig-fragment boot parameters +boot_args="`configfrag_boot_params "$boot_args_in" "$config_template"`" +# Generate kernel-version-specific boot parameters +boot_args="`per_version_boot_params "$boot_args" $resdir/.config $seconds`" + +if test -n "$TORTURE_BOOT_GDB_ARG" +then + boot_args="$boot_args $TORTURE_BOOT_GDB_ARG"Quoted 8 lines
tools/testing/selftests/rcutorture/bin/configinit.sh
Quoted 5 lines
tools/testing/selftests/rcutorture/bin/configinit.sh +5
-0+fi + +modprobe_args="`echo $boot_args | tr -s ' ' '\012' | grep "^$TORTURE_MOD\." | sed -e "s/$TORTURE_MOD\.//g"`" +kboot_args="`echo $boot_args | tr -s ' ' '\012' | grep -v "^$TORTURE_MOD\."`" +We are in trouble if a kernel boot parameter contains a space character, but we probably are already in trouble, so no problem. ;-)
:o)
Quoted 3 lines
But don't we want to avoid adding these to the qemu -append argument if they are already in
CONFIG_CMDLINE? Or is there some benefit to duplicating them?Indeed I only used it with --configonly so far so I didn't bother checking. But you're right, I should avoid passing these twice.
Quoted 22 lines
Quoted 13 lines
tools/testing/selftests/rcutorture/bin/kvm.sh +1
-0@@ -33,6 +33,7 @@ TORTURE_ALLOTED_CPUS="`identify_qemu_vcpus`" TORTURE_DEFCONFIG=defconfig TORTURE_BOOT_IMAGE="" TORTURE_BUILDONLY= +TORTURE_CMDLINE2CONFIG= TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD TORTURE_KCONFIG_ARG="" TORTURE_KCONFIG_GDB_ARG=""tools/testing/selftests/rcutorture/bin/kvm.sh usage () { · line 68
Quoted 4 lines
tools/testing/selftests/rcutorture/bin/kvm.sh +1
-0@@ -64,6 +65,7 @@ usage () { echo " --bootargs kernel-boot-arguments" echo " --bootimage relative-path-to-kernel-boot-image" echo " --buildonly" + echo " --cmdline-to-config"Does it make sense to have a way to specify that some kernel-boot paremeters go in through
CONFIG_CMDLINEand others through the qemu -append argument?Quoted 6 lines
Does it make sense to make
kvm.shunconditionally pass the kernel boot parameters in viaCONFIG_CMDLINE, thus avoiding the need for the new --cmdline_to_config argument? (One reason to avoid this is that it is probably easier to hand-edit the qemu-cmd file than the bzImage file. Though the qemu-cmd edits would override the bzImage boot parameters, right?)
Quoted 3 lines
I guess it depends if you ever plan to be able to re-launch qemu with different parameters without rebuilding the bzImage. Perhaps it's even something that can be done currently?
One thing that has been on my list (though not the official todo list for whatever reason) has been to create a clear precedence among the various sources of kernel boot parameters. Such a precedence exists (with a few exceptions) for Kconfig options, so that a --kconfig argument overrides the contents of the scenario file (e.g., TREE05) which overrides the contents of the CFcommon file.
And yes, it would be nice to change boot parameters without needing to rebuild the kernel, but it can be a bit tricky.
Thanx, Paul
PATCH 2/3 torture: Add --configonly parameter for kvm.sh
In reply to Frederic WeisbeckerThose who just want the resulting config file to generate for bare metal don't need to wait for the build. Provide an option to only produce the .config file.
--- .../selftests/rcutorture/bin/kvm-build.sh | 5 ++++ .../selftests/rcutorture/bin/kvm-recheck.sh | 6 ++++- .../rcutorture/bin/kvm-test-1-run.sh | 12 ++++++++- tools/testing/selftests/rcutorture/bin/kvm.sh | 26 +++++++++++++------ 4 files changed, 39 insertions(+), 10 deletions(-)
tools/testing/selftests/rcutorture/bin/kvm-build.sh +5 -0
@@ -43,6 +43,11 @@ then exit 2 fi +if test -n "$TORTURE_CONFIGONLY" +then + exit 0 +fi + # Tell "make" to use double the number of real CPUs on the build system. ncpus="`getconf _NPROCESSORS_ONLN`" make -j$((2 * ncpus)) $TORTURE_KMAKE_ARG > $resdir/Make.out 2>&1
tools/testing/selftests/rcutorture/bin/kvm-recheck.sh +5 -1
@@ -57,7 +57,11 @@ do cat $i/Warnings fi else - if test -f "$i/buildonly" + if test -f "$i/configonly" + then + echo Config-only run, no build/boot/test + configcheck.sh $i/.config $i/ConfigFragment + elif test -f "$i/buildonly" then echo Build-only run, no boot/test configcheck.sh $i/.config $i/ConfigFragment
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +11 -1
@@ -113,11 +113,21 @@ then exit 1 elif kvm-build.sh $T/KcList $resdir "$kboot_args" "$modprobe_args" then + cp .config $resdir + if test -n "$TORTURE_CONFIGONLY" + then + if test -f $resdir/build.wait + then + rm $resdir/build.wait + fi + echo Config-only run specified, build/boot/test omitted. + touch $resdir/configonly + exit 0 + fi # Had to build a kernel for this test. QEMU="`identify_qemu vmlinux`" BOOT_IMAGE="`identify_boot_image $QEMU`" cp vmlinux $resdir - cp .config $resdir cp Module.symvers $resdir > /dev/null || : cp System.map $resdir > /dev/null || : if test -n "$BOOT_IMAGE"
tools/testing/selftests/rcutorture/bin/kvm.sh +18 -8
@@ -34,6 +34,7 @@ TORTURE_DEFCONFIG=defconfig TORTURE_BOOT_IMAGE="" TORTURE_BUILDONLY= TORTURE_CMDLINE2CONFIG= +TORTURE_CONFIGONLY= TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD TORTURE_KCONFIG_ARG="" TORTURE_KCONFIG_GDB_ARG=""
@@ -66,6 +67,7 @@ usage () { echo " --bootimage relative-path-to-kernel-boot-image" echo " --buildonly" echo " --cmdline-to-config" + echo " --configonly" echo " --configs \"config-file list w/ repeat factor (3*TINY01)\"" echo " --cpus N" echo " --datestamp string"
@@ -113,6 +115,9 @@ do --cmdline-to-config) TORTURE_CMDLINE2CONFIG=1 ;; + --configonly|--config-only) + TORTURE_CONFIGONLY=1 + ;; --configs|--config) checkarg --configs "(list of config files)" "$#" "$2" '^[^/.a-z]\+$' '^--' configs="$configs $2"
@@ -394,6 +399,7 @@ TORTURE_ALLOTED_CPUS="$TORTURE_ALLOTED_CPUS"; export TORTURE_ALLOTED_CPUS TORTURE_BOOT_IMAGE="$TORTURE_BOOT_IMAGE"; export TORTURE_BOOT_IMAGE TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY TORTURE_CMDLINE2CONFIG="$TORTURE_CMDLINE2CONFIG"; export TORTURE_CMDLINE2CONFIG +TORTURE_CONFIGONLY="$TORTURE_CONFIGONLY"; export TORTURE_CONFIGONLY TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD TORTURE_KCONFIG_ARG="$TORTURE_KCONFIG_ARG"; export TORTURE_KCONFIG_ARG
@@ -438,6 +444,7 @@ fi ___EOF___ awk < $T/cfgcpu.pack \ -v TORTURE_BUILDONLY="$TORTURE_BUILDONLY" \ + -v TORTURE_CONFIGONLY="$TORTURE_CONFIGONLY" \ -v CONFIGDIR="$CONFIGFRAG/" \ -v KVM="$KVM" \ -v ncpus=$cpus \
@@ -490,12 +497,14 @@ function dump(first, pastlast, batchnum) print "mkdir " rd cfr[jn] " || :"; print "touch " builddir ".wait"; print "kvm-test-1-run.sh " CONFIGDIR cf[j], rd cfr[jn], dur " \"" TORTURE_QEMU_ARG "\" \"" TORTURE_BOOTARGS "\" > " rd cfr[jn] "/kvm-test-1-run.sh.out 2>&1 &" - print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date` | tee -a " rd "log"; - print "while test -f " builddir ".wait" - print "do" - print "\tsleep 1" - print "done" - print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date` | tee -a " rd "log"; + if (!TORTURE_CONFIGONLY) { + print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date` | tee -a " rd "log"; + print "while test -f " builddir ".wait" + print "do" + print "\tsleep 1" + print "done" + print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date` | tee -a " rd "log"; + } jn++; } print "runfiles="
@@ -503,7 +512,7 @@ function dump(first, pastlast, batchnum) builddir=rd cfr[j] "/build"; if (TORTURE_BUILDONLY) print "rm -f " builddir ".ready" - else + else if (!TORTURE_CONFIGONLY) print "mv " builddir ".ready " builddir ".run" print "runfiles=\"$runfiles " builddir ".run\"" fi
@@ -517,7 +526,8 @@ function dump(first, pastlast, batchnum) njitter = 0; print "echo Build-only run, so suppressing jitter | tee -a " rd "log" } - if (TORTURE_BUILDONLY) { + + if (TORTURE_BUILDONLY || TORTURE_CONFIGONLY) { print "needqemurun=" } print "if test -n \"$needqemurun\""
Signature · 1 line
2.25.1
Paul E. McKenney
maintainerRe: [PATCH 2/3] torture: Add --configonly parameter for kvm.sh
Quoted 5 lines · Frederic Weisbecker
Those who just want the resulting config file to generate for bare metal don't need to wait for the build. Provide an option to only produce the .config file.
Signed-off-by Frederic Weisbecker <[email protected]>
This one looks good to me, though it depends on 1/3.
I considered asking for a check of both --configonly and --buildonly, but on second thought I just couldn't see the point. After all, it does say why it stopped, either "Config-only run" or "Build-only run" and that should suffice.
Thanx, Paul
Quoted 156 lines
--- .../selftests/rcutorture/bin/kvm-build.sh | 5 ++++ .../selftests/rcutorture/bin/kvm-recheck.sh | 6 ++++- .../rcutorture/bin/kvm-test-1-run.sh | 12 ++++++++- tools/testing/selftests/rcutorture/bin/kvm.sh | 26 +++++++++++++------ 4 files changed, 39 insertions(+), 10 deletions(-)tools/testing/selftests/rcutorture/bin/kvm-build.sh +5
-0@@ -43,6 +43,11 @@ then exit 2 fi +if test -n "$TORTURE_CONFIGONLY" +then + exit 0 +fi + # Tell "make" to use double the number of real CPUs on the build system. ncpus="`getconf _NPROCESSORS_ONLN`" make -j$((2 * ncpus)) $TORTURE_KMAKE_ARG > $resdir/Make.out 2>&1tools/testing/selftests/rcutorture/bin/kvm-recheck.sh +5
-1@@ -57,7 +57,11 @@ do cat $i/Warnings fi else - if test -f "$i/buildonly" + if test -f "$i/configonly" + then + echo Config-only run, no build/boot/test + configcheck.sh $i/.config $i/ConfigFragment + elif test -f "$i/buildonly" then echo Build-only run, no boot/test configcheck.sh $i/.config $i/ConfigFragmenttools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +11
-1@@ -113,11 +113,21 @@ then exit 1 elif kvm-build.sh $T/KcList $resdir "$kboot_args" "$modprobe_args" then + cp .config $resdir + if test -n "$TORTURE_CONFIGONLY" + then + if test -f $resdir/build.wait + then + rm $resdir/build.wait + fi + echo Config-only run specified, build/boot/test omitted. + touch $resdir/configonly + exit 0 + fi # Had to build a kernel for this test. QEMU="`identify_qemu vmlinux`" BOOT_IMAGE="`identify_boot_image $QEMU`" cp vmlinux $resdir - cp .config $resdir cp Module.symvers $resdir > /dev/null || : cp System.map $resdir > /dev/null || : if test -n "$BOOT_IMAGE"tools/testing/selftests/rcutorture/bin/kvm.sh +18
-8@@ -34,6 +34,7 @@ TORTURE_DEFCONFIG=defconfig TORTURE_BOOT_IMAGE="" TORTURE_BUILDONLY= TORTURE_CMDLINE2CONFIG= +TORTURE_CONFIGONLY= TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD TORTURE_KCONFIG_ARG="" TORTURE_KCONFIG_GDB_ARG=""@@ -66,6 +67,7 @@ usage () { echo " --bootimage relative-path-to-kernel-boot-image" echo " --buildonly" echo " --cmdline-to-config" + echo " --configonly" echo " --configs \"config-file list w/ repeat factor (3*TINY01)\"" echo " --cpus N" echo " --datestamp string"@@ -113,6 +115,9 @@ do --cmdline-to-config) TORTURE_CMDLINE2CONFIG=1 ;; + --configonly|--config-only) + TORTURE_CONFIGONLY=1 + ;; --configs|--config) checkarg --configs "(list of config files)" "$#" "$2" '^[^/.a-z]\+$' '^--' configs="$configs $2"@@ -394,6 +399,7 @@ TORTURE_ALLOTED_CPUS="$TORTURE_ALLOTED_CPUS"; export TORTURE_ALLOTED_CPUS TORTURE_BOOT_IMAGE="$TORTURE_BOOT_IMAGE"; export TORTURE_BOOT_IMAGE TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY TORTURE_CMDLINE2CONFIG="$TORTURE_CMDLINE2CONFIG"; export TORTURE_CMDLINE2CONFIG +TORTURE_CONFIGONLY="$TORTURE_CONFIGONLY"; export TORTURE_CONFIGONLY TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD TORTURE_KCONFIG_ARG="$TORTURE_KCONFIG_ARG"; export TORTURE_KCONFIG_ARG@@ -438,6 +444,7 @@ fi ___EOF___ awk < $T/cfgcpu.pack \ -v TORTURE_BUILDONLY="$TORTURE_BUILDONLY" \ + -v TORTURE_CONFIGONLY="$TORTURE_CONFIGONLY" \ -v CONFIGDIR="$CONFIGFRAG/" \ -v KVM="$KVM" \ -v ncpus=$cpus \@@ -490,12 +497,14 @@ function dump(first, pastlast, batchnum) print "mkdir " rd cfr[jn] " || :"; print "touch " builddir ".wait"; print "kvm-test-1-run.sh " CONFIGDIR cf[j], rd cfr[jn], dur " \"" TORTURE_QEMU_ARG "\" \"" TORTURE_BOOTARGS "\" > " rd cfr[jn] "/kvm-test-1-run.sh.out 2>&1 &" - print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date` | tee -a " rd "log"; - print "while test -f " builddir ".wait" - print "do" - print "\tsleep 1" - print "done" - print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date` | tee -a " rd "log"; + if (!TORTURE_CONFIGONLY) { + print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date` | tee -a " rd "log"; + print "while test -f " builddir ".wait" + print "do" + print "\tsleep 1" + print "done" + print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date` | tee -a " rd "log"; + } jn++; } print "runfiles="@@ -503,7 +512,7 @@ function dump(first, pastlast, batchnum) builddir=rd cfr[j] "/build"; if (TORTURE_BUILDONLY) print "rm -f " builddir ".ready" - else + else if (!TORTURE_CONFIGONLY) print "mv " builddir ".ready " builddir ".run" print "runfiles=\"$runfiles " builddir ".run\"" fi@@ -517,7 +526,8 @@ function dump(first, pastlast, batchnum) njitter = 0; print "echo Build-only run, so suppressing jitter | tee -a " rd "log" } - if (TORTURE_BUILDONLY) { + + if (TORTURE_BUILDONLY || TORTURE_CONFIGONLY) { print "needqemurun=" } print "if test -n \"$needqemurun\""Signature · 1 line
2.25.1
Re: [PATCH 2/3] torture: Add --configonly parameter for kvm.sh
Quoted 5 lines · Paul E. McKenney
Quoted 4 lines · Frederic Weisbecker
Those who just want the resulting config file to generate for bare metal don't need to wait for the build. Provide an option to only produce the .config file.
Quoted 8 lines
Quoted 1 line
Signed-off-by Frederic Weisbecker <[email protected]>This one looks good to me, though it depends on 1/3.
I considered asking for a check of both --configonly and --buildonly, but on second thought I just couldn't see the point. After all, it does say why it stopped, either "Config-only run" or "Build-only run" and that should suffice.
Ok, I'll resend this one as standalone then so we can think more clearly on the rest.
Thanks!
PATCH 3/3 torture: Update bare metal advices to latest kvm.sh options
In reply to Frederic Weisbeckerkvm.sh is perfectly able to build a new kernel config from an existing one instead of using a defconfig. All we need to do is to pass:
--defconfig oldconfig
This is much easier than manually modifying a .config from a ConfigFragment file.
Then with the latest parameters that got added on kvm.sh, it's now easy to build a bare metal .config for a cross target for example:
./kvm.sh --configs "TREE01" --defconfig oldconfig --configonly --cmdline-to-config --kmake-arg ARCH=arm64 --no-initrd
After that all we need to do is to build the updated .config and run the resulting image.
Update bare metal advices to propose that.
--- .../rcutorture/bin/kvm-test-1-run.sh | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-)
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +11 -10
@@ -190,27 +190,28 @@ echo To run this scenario on bare metal: >> $resdir/bare-metal echo >> $resdir/bare-metal echo " 1." Set your bare-metal build tree to the state shown in this file: >> $resdir/bare-metal echo " " $testid_txt >> $resdir/bare-metal -echo " 2." Update your bare-metal build tree"'"s .config based on this file: >> $resdir/bare-metal -echo " " $resdir/ConfigFragment >> $resdir/bare-metal -echo " 3." Make the bare-metal kernel"'"s build system aware of your .config updates: >> $resdir/bare-metal -echo " " $ 'yes "" | make oldconfig' >> $resdir/bare-metal -echo " 4." Build your bare-metal kernel. >> $resdir/bare-metal +echo " 2." Prepare your bare-metal build tree"'"s .config on your root kernel directory >> $resdir/bare-metal +echo " 3." Run this scenario with "'--defconfig oldconfig --configonly --no-initrd'" >> $resdir/bare-metal +echo " 4." If you"'"re cross compiling then append the appropriate make arguments >> $resdir/bare-metal +echo " " eg: "'--kmake-arg ARCH=arm64'" >> $resdir/bare-metal echo " 5." Boot your bare-metal kernel with the following parameters: >> $resdir/bare-metal echo " " $kboot_args >> $resdir/bare-metal echo " 6." Start the test with the following command: >> $resdir/bare-metal echo " " $ modprobe $TORTURE_MOD $modprobe_args >> $resdir/bare-metal echo " 7." After some time, end the test with the following command: >> $resdir/bare-metal echo " " $ rmmod $TORTURE_MOD >> $resdir/bare-metal -echo " 8." Copy your bare-metal kernel"'"s .config file, overwriting this file: >> $resdir/bare-metal +echo " 8." Alternatively if you run rcutorture in a built-in fashion and your kernel arguments are already >> $resdir/bare-metal +echo " " hardcoded in the kernel config, skip the previous 5/6/7 steps and append to kvm.sh arguments: >> $resdir/bare-metal +echo " " --cmdline-to-config >> $resdir/bare-metal +echo " " Then simply boot your kernel and wait for the end of the tests >> $resdir/bare-metal +echo " 9." Copy your bare-metal kernel"'"s .config file, overwriting this file: >> $resdir/bare-metal echo " " $resdir/.config >> $resdir/bare-metal -echo " 9." Copy the console output from just before the modprobe to just after >> $resdir/bare-metal +echo "10." Copy the console output from just before the modprobe to just after >> $resdir/bare-metal echo " " the rmmod into this file: >> $resdir/bare-metal echo " " $resdir/console.log >> $resdir/bare-metal -echo "10." Check for runtime errors using the following command: >> $resdir/bare-metal +echo "11." Check for runtime errors using the following command: >> $resdir/bare-metal echo " " $ tools/testing/selftests/rcutorture/bin/kvm-recheck.sh `dirname $resdir` >> $resdir/bare-metal echo >> $resdir/bare-metal -echo Some of the above steps may be skipped if you build your bare-metal >> $resdir/bare-metal -echo kernel here: `head -n 1 $testid_txt | sed -e 's/^Build directory: //'` >> $resdir/bare-metal echo $QEMU $qemu_args -m $TORTURE_QEMU_MEM -kernel $KERNEL -append \"$qemu_append $boot_args\" $TORTURE_QEMU_GDB_ARG > $resdir/qemu-cmd echo "# TORTURE_SHUTDOWN_GRACE=$TORTURE_SHUTDOWN_GRACE" >> $resdir/qemu-cmd
Signature · 1 line
2.25.1
Paul E. McKenney
maintainerRe: [PATCH 3/3] torture: Update bare metal advices to latest kvm.sh options
Quoted 14 lines · Frederic Weisbecker
kvm.shis perfectly able to build a new kernel config from an existing one instead of using a defconfig. All we need to do is to pass:--defconfig oldconfig
This is much easier than manually modifying a .config from a ConfigFragment file.
Then with the latest parameters that got added on
kvm.sh, it's now easy to build a bare metal .config for a cross target for example:./kvm.sh --configs "TREE01" --defconfig oldconfig --configonly --cmdline-to-config --kmake-arg ARCH=arm64 --no-initrd
Quoted 6 lines
After that all we need to do is to build the updated .config and run the resulting image.
Update bare metal advices to propose that.
Signed-off-by Frederic Weisbecker <[email protected]>
I am inclined to let you take the lead on this part of the file given that I take other approaches to bare-metal rcutorture runs.
A few comments below, mostly wordsmithing.
Thanx, Paul
Quoted 10 lines
--- .../rcutorture/bin/kvm-test-1-run.sh | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-)tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +0
-0@@ -190,27 +190,28 @@ echo To run this scenario on bare metal: >> $resdir/bare-metal echo >> $resdir/bare-metal
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh echo To run this scenario on bare metal: >> $resdir/bare-metal · line 195
Quoted 10 lines
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +3
-5echo " 1." Set your bare-metal build tree to the state shown in this file: >> $resdir/bare-metal echo " " $testid_txt >> $resdir/bare-metal -echo " 2." Update your bare-metal build tree"'"s .config based on this file: >> $resdir/bare-metal -echo " " $resdir/ConfigFragment >> $resdir/bare-metal -echo " 3." Make the bare-metal kernel"'"s build system aware of your .config updates: >> $resdir/bare-metal -echo " " $ 'yes "" | make oldconfig' >> $resdir/bare-metal -echo " 4." Build your bare-metal kernel. >> $resdir/bare-metal +echo " 2." Prepare your bare-metal build tree"'"s .config on your root kernel directory >> $resdir/bare-metal +echo " 3." Run this scenario with "'--defconfig oldconfig --configonly --no-initrd'" >> $resdir/bare-metal +echo " 4." If you"'"re cross compiling then append the appropriate make arguments >> $resdir/bare-metal
In this case, I think that "you are" is going to be nicer than the fun with quoting quotes. ;-)
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh echo To run this scenario on bare metal: >> $resdir/bare-metal · line 203
Quoted 9 lines
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +2
-1+echo " " eg: "'--kmake-arg ARCH=arm64'" >> $resdir/bare-metal echo " 5." Boot your bare-metal kernel with the following parameters: >> $resdir/bare-metal echo " " $kboot_args >> $resdir/bare-metal echo " 6." Start the test with the following command: >> $resdir/bare-metal echo " " $ modprobe $TORTURE_MOD $modprobe_args >> $resdir/bare-metal echo " 7." After some time, end the test with the following command: >> $resdir/bare-metal echo " " $ rmmod $TORTURE_MOD >> $resdir/bare-metal -echo " 8." Copy your bare-metal kernel"'"s .config file, overwriting this file: >> $resdir/bare-metal +echo " 8." Alternatively if you run rcutorture in a built-in fashion and your kernel arguments are already >> $resdir/bare-metal
"Alternatively,"
Also "if you run rcutorture built in" should work.
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh echo To run this scenario on bare metal: >> $resdir/bare-metal · line 204
Quoted 1 line
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +1
-0+echo " " hardcoded in the kernel config, skip the previous 5/6/7 steps and append to kvm.sh arguments: >> $resdir/bare-metal
I suggest letting them know before step 5 that they might be able to skip step 5. ;-)
For example, something like: "5. If you run rcutorture as a module, do steps 6-8, otherwise skip to step 9."
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh echo To run this scenario on bare metal: >> $resdir/bare-metal · line 210
Quoted 7 lines
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +4
-1+echo " " --cmdline-to-config >> $resdir/bare-metal +echo " " Then simply boot your kernel and wait for the end of the tests >> $resdir/bare-metal +echo " 9." Copy your bare-metal kernel"'"s .config file, overwriting this file: >> $resdir/bare-metal echo " " $resdir/.config >> $resdir/bare-metal -echo " 9." Copy the console output from just before the modprobe to just after >> $resdir/bare-metal +echo "10." Copy the console output from just before the modprobe to just after >> $resdir/bare-metal echo " " the rmmod into this file: >> $resdir/bare-metal
But if running built-in, we need the entire console output, correct?
Quoted 13 lines
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +1
-3echo " " $resdir/console.log >> $resdir/bare-metal -echo "10." Check for runtime errors using the following command: >> $resdir/bare-metal +echo "11." Check for runtime errors using the following command: >> $resdir/bare-metal echo " " $ tools/testing/selftests/rcutorture/bin/kvm-recheck.sh `dirname $resdir` >> $resdir/bare-metal echo >> $resdir/bare-metal -echo Some of the above steps may be skipped if you build your bare-metal >> $resdir/bare-metal -echo kernel here: `head -n 1 $testid_txt | sed -e 's/^Build directory: //'` >> $resdir/bare-metal echo $QEMU $qemu_args -m $TORTURE_QEMU_MEM -kernel $KERNEL -append \"$qemu_append $boot_args\" $TORTURE_QEMU_GDB_ARG > $resdir/qemu-cmd echo "# TORTURE_SHUTDOWN_GRACE=$TORTURE_SHUTDOWN_GRACE" >> $resdir/qemu-cmdSignature · 1 line
2.25.1