2013-09-28 14:12:21 -07:00
|
|
|
#!/bin/bash
|
2019-02-11 07:14:09 -08:00
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
2013-09-28 14:12:21 -07:00
|
|
|
#
|
|
|
|
|
# Run a kvm-based test of the specified tree on the specified configs.
|
|
|
|
|
# Fully automated run and error checking, no graphics console.
|
|
|
|
|
#
|
|
|
|
|
# Execute this in the source tree. Do not run it as a background task
|
|
|
|
|
# because qemu does not seem to like that much.
|
|
|
|
|
#
|
2021-02-10 15:15:13 -08:00
|
|
|
# Usage: kvm-test-1-run.sh config resdir seconds qemu-args boot_args_in
|
2013-09-28 14:12:21 -07:00
|
|
|
#
|
2016-05-19 11:42:23 +08:00
|
|
|
# qemu-args defaults to "-enable-kvm -nographic", along with arguments
|
|
|
|
|
# specifying the number of CPUs and other options
|
|
|
|
|
# generated from the underlying CPU architecture.
|
torture: Provide bare-metal modprobe-based advice
In some environments, the torture-testing use of virtualization is
inconvenient. In such cases, the modprobe and rmmod commands may be used
to do torture testing, but significant setup is required to build, boot,
and modprobe a kernel so as to match a given torture-test scenario.
This commit therefore creates a "bare-metal" file in each results
directory containing steps to run the corresponding scenario using the
modprobe command on bare metal. For example, the contents of this file
after using kvm.sh to build an rcutorture TREE01 kernel, perhaps with
the --buildonly argument, is as follows:
To run this scenario on bare metal:
1. Set your bare-metal build tree to the state shown in this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/testid.txt
2. Update your bare-metal build tree's .config based on this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/ConfigFragment
3. Make the bare-metal kernel's build system aware of your .config updates:
$ yes "" | make oldconfig
4. Build your bare-metal kernel.
5. Boot your bare-metal kernel with the following parameters:
maxcpus=8 nr_cpus=43 rcutree.gp_preinit_delay=3 rcutree.gp_init_delay=3 rcutree.gp_cleanup_delay=3 rcu_nocbs=0-1,3-7
6. Start the test with the following command:
$ modprobe rcutorture nocbs_nthreads=8 nocbs_toggle=1000 fwd_progress=0 onoff_interval=1000 onoff_holdoff=30 n_barrier_cbs=4 stat_interval=15 shutdown_secs=120 test_no_idle_hz=1 verbose=1
7. After some time, end the test with the following command:
$ rmmod rcutorture
8. Copy your bare-metal kernel's .config file, overwriting this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/.config
9. Copy the console output from just before the modprobe to just after
the rmmod into this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/console.log
10. Check for runtime errors using the following command:
$ tools/testing/selftests/rcutorture/bin/kvm-recheck.sh /home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-02-03 15:44:29 -08:00
|
|
|
# boot_args_in defaults to value returned by the per_version_boot_params
|
2014-02-06 20:35:41 -08:00
|
|
|
# shell function.
|
2013-09-28 14:12:21 -07:00
|
|
|
#
|
torture: Provide bare-metal modprobe-based advice
In some environments, the torture-testing use of virtualization is
inconvenient. In such cases, the modprobe and rmmod commands may be used
to do torture testing, but significant setup is required to build, boot,
and modprobe a kernel so as to match a given torture-test scenario.
This commit therefore creates a "bare-metal" file in each results
directory containing steps to run the corresponding scenario using the
modprobe command on bare metal. For example, the contents of this file
after using kvm.sh to build an rcutorture TREE01 kernel, perhaps with
the --buildonly argument, is as follows:
To run this scenario on bare metal:
1. Set your bare-metal build tree to the state shown in this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/testid.txt
2. Update your bare-metal build tree's .config based on this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/ConfigFragment
3. Make the bare-metal kernel's build system aware of your .config updates:
$ yes "" | make oldconfig
4. Build your bare-metal kernel.
5. Boot your bare-metal kernel with the following parameters:
maxcpus=8 nr_cpus=43 rcutree.gp_preinit_delay=3 rcutree.gp_init_delay=3 rcutree.gp_cleanup_delay=3 rcu_nocbs=0-1,3-7
6. Start the test with the following command:
$ modprobe rcutorture nocbs_nthreads=8 nocbs_toggle=1000 fwd_progress=0 onoff_interval=1000 onoff_holdoff=30 n_barrier_cbs=4 stat_interval=15 shutdown_secs=120 test_no_idle_hz=1 verbose=1
7. After some time, end the test with the following command:
$ rmmod rcutorture
8. Copy your bare-metal kernel's .config file, overwriting this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/.config
9. Copy the console output from just before the modprobe to just after
the rmmod into this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/console.log
10. Check for runtime errors using the following command:
$ tools/testing/selftests/rcutorture/bin/kvm-recheck.sh /home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-02-03 15:44:29 -08:00
|
|
|
# Anything you specify for either qemu-args or boot_args_in is appended to
|
2013-09-28 14:12:21 -07:00
|
|
|
# the default values. The "-smp" value is deduced from the contents of
|
|
|
|
|
# the config fragment.
|
|
|
|
|
#
|
|
|
|
|
# More sophisticated argument parsing is clearly needed.
|
|
|
|
|
#
|
|
|
|
|
# Copyright (C) IBM Corporation, 2011
|
|
|
|
|
#
|
2019-02-11 07:14:09 -08:00
|
|
|
# Authors: Paul E. McKenney <paulmck@linux.ibm.com>
|
2013-09-28 14:12:21 -07:00
|
|
|
|
2017-08-30 15:33:49 -07:00
|
|
|
T=${TMPDIR-/tmp}/kvm-test-1-run.sh.$$
|
2013-09-28 14:12:21 -07:00
|
|
|
trap 'rm -rf $T' 0
|
2017-05-01 17:49:29 -07:00
|
|
|
mkdir $T
|
2013-09-28 14:12:21 -07:00
|
|
|
|
2017-11-03 19:17:28 +09:00
|
|
|
. functions.sh
|
2014-10-04 13:04:15 -04:00
|
|
|
. $CONFIGFRAG/ver_functions.sh
|
2013-09-28 14:12:21 -07:00
|
|
|
|
|
|
|
|
config_template=${1}
|
2014-02-06 11:54:32 -08:00
|
|
|
config_dir=`echo $config_template | sed -e 's,/[^/]*$,,'`
|
2013-09-28 14:12:21 -07:00
|
|
|
title=`echo $config_template | sed -e 's/^.*\///'`
|
2021-02-10 15:15:13 -08:00
|
|
|
resdir=${2}
|
2013-09-28 14:12:21 -07:00
|
|
|
if test -z "$resdir" -o ! -d "$resdir" -o ! -w "$resdir"
|
|
|
|
|
then
|
2014-02-06 20:35:41 -08:00
|
|
|
echo "kvm-test-1-run.sh :$resdir: Not a writable directory, cannot store results into it"
|
2013-09-28 14:12:21 -07:00
|
|
|
exit 1
|
|
|
|
|
fi
|
2021-02-16 16:55:04 -08:00
|
|
|
echo ' ---' `date`: Starting build, PID $$
|
2013-09-30 14:49:43 -07:00
|
|
|
echo ' ---' Kconfig fragment at: $config_template >> $resdir/log
|
2020-04-09 15:32:56 -07:00
|
|
|
touch $resdir/ConfigFragment.input
|
2020-04-09 16:02:23 -07:00
|
|
|
|
2020-04-09 16:58:00 -07:00
|
|
|
# Combine additional Kconfig options into an existing set such that
|
|
|
|
|
# newer options win. The first argument is the Kconfig source ID, the
|
|
|
|
|
# second the to-be-updated file within $T, and the third and final the
|
|
|
|
|
# list of additional Kconfig options. Note that a $2.tmp file is
|
|
|
|
|
# created when doing the update.
|
2020-04-09 16:02:23 -07:00
|
|
|
config_override_param () {
|
2020-04-09 16:58:00 -07:00
|
|
|
if test -n "$3"
|
2020-04-09 16:02:23 -07:00
|
|
|
then
|
2020-04-09 16:58:00 -07:00
|
|
|
echo $3 | sed -e 's/^ *//' -e 's/ *$//' | tr -s " " "\012" > $T/Kconfig_args
|
2020-04-09 16:02:23 -07:00
|
|
|
echo " --- $1" >> $resdir/ConfigFragment.input
|
|
|
|
|
cat $T/Kconfig_args >> $resdir/ConfigFragment.input
|
2020-04-09 16:58:00 -07:00
|
|
|
config_override.sh $T/$2 $T/Kconfig_args > $T/$2.tmp
|
|
|
|
|
mv $T/$2.tmp $T/$2
|
2020-04-09 16:02:23 -07:00
|
|
|
# Note that "#CHECK#" is not permitted on commandline.
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-09 16:58:00 -07:00
|
|
|
echo > $T/KcList
|
|
|
|
|
config_override_param "$config_dir/CFcommon" KcList "`cat $config_dir/CFcommon 2> /dev/null`"
|
|
|
|
|
config_override_param "$config_template" KcList "`cat $config_template 2> /dev/null`"
|
torture: Add gdb support
This commit adds a "--gdb" parameter to kvm.sh, which causes
"CONFIG_DEBUG_INFO=y" to be added to the Kconfig options, "nokaslr"
to be added to the boot parameters, and "-s -S" to be added to the qemu
arguments. Furthermore, the scripting prints messages telling the user
how to start up gdb for the run in question.
Because of the interactive nature of gdb sessions, only one "--configs"
scenario is permitted when "--gdb" is specified. For most torture types,
this means that a "--configs" argument is required, and that argument
must specify the single scenario of interest.
The usual cautions about breakpoints and timing apply, for example,
staring at your gdb prompt for too long will likely get you many
complaints, including RCU CPU stall warnings. Omar Sandoval further
suggests using gdb's "hbreak" command instead of the "break" command on
systems supporting hardware breakpoints, and further using the "commands"
option because the resulting non-interactive breakpoints are less likely
to get you RCU CPU stall warnings.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-08-17 16:44:48 -07:00
|
|
|
config_override_param "--gdb options" KcList "$TORTURE_KCONFIG_GDB_ARG"
|
2020-04-09 17:14:18 -07:00
|
|
|
config_override_param "--kasan options" KcList "$TORTURE_KCONFIG_KASAN_ARG"
|
2020-04-09 16:58:00 -07:00
|
|
|
config_override_param "--kcsan options" KcList "$TORTURE_KCONFIG_KCSAN_ARG"
|
|
|
|
|
config_override_param "--kconfig argument" KcList "$TORTURE_KCONFIG_ARG"
|
|
|
|
|
cp $T/KcList $resdir/ConfigFragment
|
2017-05-01 17:49:29 -07:00
|
|
|
|
2016-03-30 10:48:06 -07:00
|
|
|
base_resdir=`echo $resdir | sed -e 's/\.[0-9]\+$//'`
|
2021-01-05 10:50:32 -08:00
|
|
|
if test "$base_resdir" != "$resdir" && test -f $base_resdir/bzImage && test -f $base_resdir/vmlinux
|
2013-09-28 14:12:21 -07:00
|
|
|
then
|
2016-03-30 10:48:06 -07:00
|
|
|
# Rerunning previous test, so use that test's kernel.
|
|
|
|
|
QEMU="`identify_qemu $base_resdir/vmlinux`"
|
2016-05-19 11:42:22 +08:00
|
|
|
BOOT_IMAGE="`identify_boot_image $QEMU`"
|
|
|
|
|
KERNEL=$base_resdir/${BOOT_IMAGE##*/} # use the last component of ${BOOT_IMAGE}
|
2016-03-30 10:48:06 -07:00
|
|
|
ln -s $base_resdir/Make*.out $resdir # for kvm-recheck.sh
|
|
|
|
|
ln -s $base_resdir/.config $resdir # for kvm-recheck.sh
|
rcutorture: Don't wait for kernel when all builds fail
Currently, rcutorture groups runs in batches, building each scenario in
a given batch, then invoking qemu to run all the kernels in the batch.
Of course, if a given scenario's kernel fails to build, there is no qemu
run for that scenario. And if all of the kernels in a given batch fail
to build, there are no runs, and rcutorture immediately starts on the
next batch.
But not if --jitter has been specified, which it is by default. In this
case, the jitter scripts are started unconditionally, and rcutorture
waits for them to complete, even though there are no kernels to run.
This commit therefore checks for this situation, and refuses to start
jitter unless at least one of the kernels in the batch built successfully.
This saves substantial time when all scenarios' kernels fail to build,
particularly if a long --duration was specified.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
2017-05-02 15:22:26 -07:00
|
|
|
# Arch-independent indicator
|
|
|
|
|
touch $resdir/builtkernel
|
2021-01-05 10:50:32 -08:00
|
|
|
elif test "$base_resdir" != "$resdir"
|
|
|
|
|
then
|
|
|
|
|
# Rerunning previous test for which build failed
|
|
|
|
|
ln -s $base_resdir/Make*.out $resdir # for kvm-recheck.sh
|
|
|
|
|
ln -s $base_resdir/.config $resdir # for kvm-recheck.sh
|
|
|
|
|
echo Initial build failed, not running KVM, see $resdir.
|
2021-02-10 15:15:13 -08:00
|
|
|
if test -f $resdir/build.wait
|
2021-01-05 10:50:32 -08:00
|
|
|
then
|
2021-02-10 15:15:13 -08:00
|
|
|
mv $resdir/build.wait $resdir/build.ready
|
2021-01-05 10:50:32 -08:00
|
|
|
fi
|
|
|
|
|
exit 1
|
2020-04-09 16:58:00 -07:00
|
|
|
elif kvm-build.sh $T/KcList $resdir
|
2016-03-30 10:48:06 -07:00
|
|
|
then
|
|
|
|
|
# Had to build a kernel for this test.
|
torture: Run kernel build in source directory
For historical reasons, rcutorture places its build products in a
tools/testing/selftests/rcutorture/b1 directory using the O= kbuild
command-line argument. However, doing this requires that the source
directory be pristine: Not just "make clean" pristine, but instead "make
mrproper" (or, equivalently, "make distclean") pristine. Therefore,
rcutorture executes a "make mrproper" before each build. Unfortunately,
"make mrproper" has the side effect of removing pretty much everything,
including tags files and cscope databases, which can be inconvenient
to people whose workflow centers around a single source tree.
This commit therefore makes rcutorture do the build directly in the
source directory, removing the need for "make mrproper". This works
because all needed build products are moved to their proper place in the
"res" directory immediately after the build completes, so that multiple
rcutorture kernels can still run concurrently.
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
2019-05-10 21:31:52 -07:00
|
|
|
QEMU="`identify_qemu vmlinux`"
|
2014-03-06 14:44:46 -08:00
|
|
|
BOOT_IMAGE="`identify_boot_image $QEMU`"
|
torture: Run kernel build in source directory
For historical reasons, rcutorture places its build products in a
tools/testing/selftests/rcutorture/b1 directory using the O= kbuild
command-line argument. However, doing this requires that the source
directory be pristine: Not just "make clean" pristine, but instead "make
mrproper" (or, equivalently, "make distclean") pristine. Therefore,
rcutorture executes a "make mrproper" before each build. Unfortunately,
"make mrproper" has the side effect of removing pretty much everything,
including tags files and cscope databases, which can be inconvenient
to people whose workflow centers around a single source tree.
This commit therefore makes rcutorture do the build directly in the
source directory, removing the need for "make mrproper". This works
because all needed build products are moved to their proper place in the
"res" directory immediately after the build completes, so that multiple
rcutorture kernels can still run concurrently.
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
2019-05-10 21:31:52 -07:00
|
|
|
cp vmlinux $resdir
|
|
|
|
|
cp .config $resdir
|
|
|
|
|
cp Module.symvers $resdir > /dev/null || :
|
|
|
|
|
cp System.map $resdir > /dev/null || :
|
2014-03-06 14:44:46 -08:00
|
|
|
if test -n "$BOOT_IMAGE"
|
|
|
|
|
then
|
torture: Run kernel build in source directory
For historical reasons, rcutorture places its build products in a
tools/testing/selftests/rcutorture/b1 directory using the O= kbuild
command-line argument. However, doing this requires that the source
directory be pristine: Not just "make clean" pristine, but instead "make
mrproper" (or, equivalently, "make distclean") pristine. Therefore,
rcutorture executes a "make mrproper" before each build. Unfortunately,
"make mrproper" has the side effect of removing pretty much everything,
including tags files and cscope databases, which can be inconvenient
to people whose workflow centers around a single source tree.
This commit therefore makes rcutorture do the build directly in the
source directory, removing the need for "make mrproper". This works
because all needed build products are moved to their proper place in the
"res" directory immediately after the build completes, so that multiple
rcutorture kernels can still run concurrently.
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
2019-05-10 21:31:52 -07:00
|
|
|
cp $BOOT_IMAGE $resdir
|
2016-05-19 11:42:22 +08:00
|
|
|
KERNEL=$resdir/${BOOT_IMAGE##*/}
|
rcutorture: Don't wait for kernel when all builds fail
Currently, rcutorture groups runs in batches, building each scenario in
a given batch, then invoking qemu to run all the kernels in the batch.
Of course, if a given scenario's kernel fails to build, there is no qemu
run for that scenario. And if all of the kernels in a given batch fail
to build, there are no runs, and rcutorture immediately starts on the
next batch.
But not if --jitter has been specified, which it is by default. In this
case, the jitter scripts are started unconditionally, and rcutorture
waits for them to complete, even though there are no kernels to run.
This commit therefore checks for this situation, and refuses to start
jitter unless at least one of the kernels in the batch built successfully.
This saves substantial time when all scenarios' kernels fail to build,
particularly if a long --duration was specified.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
2017-05-02 15:22:26 -07:00
|
|
|
# Arch-independent indicator
|
|
|
|
|
touch $resdir/builtkernel
|
2014-03-06 14:44:46 -08:00
|
|
|
else
|
|
|
|
|
echo No identifiable boot image, not running KVM, see $resdir.
|
|
|
|
|
echo Do the torture scripts know about your architecture?
|
|
|
|
|
fi
|
2013-09-28 14:12:21 -07:00
|
|
|
parse-build.sh $resdir/Make.out $title
|
|
|
|
|
else
|
2016-03-30 10:48:06 -07:00
|
|
|
# Build failed.
|
torture: Run kernel build in source directory
For historical reasons, rcutorture places its build products in a
tools/testing/selftests/rcutorture/b1 directory using the O= kbuild
command-line argument. However, doing this requires that the source
directory be pristine: Not just "make clean" pristine, but instead "make
mrproper" (or, equivalently, "make distclean") pristine. Therefore,
rcutorture executes a "make mrproper" before each build. Unfortunately,
"make mrproper" has the side effect of removing pretty much everything,
including tags files and cscope databases, which can be inconvenient
to people whose workflow centers around a single source tree.
This commit therefore makes rcutorture do the build directly in the
source directory, removing the need for "make mrproper". This works
because all needed build products are moved to their proper place in the
"res" directory immediately after the build completes, so that multiple
rcutorture kernels can still run concurrently.
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
2019-05-10 21:31:52 -07:00
|
|
|
cp .config $resdir || :
|
2013-09-28 14:12:21 -07:00
|
|
|
echo Build failed, not running KVM, see $resdir.
|
2021-02-10 15:15:13 -08:00
|
|
|
if test -f $resdir/build.wait
|
2014-01-13 23:16:55 -08:00
|
|
|
then
|
2021-02-10 15:15:13 -08:00
|
|
|
mv $resdir/build.wait $resdir/build.ready
|
2014-01-13 23:16:55 -08:00
|
|
|
fi
|
2013-09-28 14:12:21 -07:00
|
|
|
exit 1
|
|
|
|
|
fi
|
2021-02-10 15:15:13 -08:00
|
|
|
if test -f $resdir/build.wait
|
2016-03-30 10:48:06 -07:00
|
|
|
then
|
2021-02-10 15:15:13 -08:00
|
|
|
mv $resdir/build.wait $resdir/build.ready
|
2016-03-30 10:48:06 -07:00
|
|
|
fi
|
2021-02-10 15:15:13 -08:00
|
|
|
while test -f $resdir/build.ready
|
2014-01-13 23:16:55 -08:00
|
|
|
do
|
|
|
|
|
sleep 1
|
|
|
|
|
done
|
2021-02-10 15:15:13 -08:00
|
|
|
seconds=$3
|
|
|
|
|
qemu_args=$4
|
|
|
|
|
boot_args_in=$5
|
2013-09-28 14:12:21 -07:00
|
|
|
|
2014-04-29 09:53:34 -07:00
|
|
|
if test -z "$TORTURE_BUILDONLY"
|
|
|
|
|
then
|
|
|
|
|
echo ' ---' `date`: Starting kernel
|
|
|
|
|
fi
|
2013-09-30 17:17:57 -07:00
|
|
|
|
2013-09-28 14:12:21 -07:00
|
|
|
# Generate -smp qemu argument.
|
2016-05-19 11:42:23 +08:00
|
|
|
qemu_args="-enable-kvm -nographic $qemu_args"
|
2017-05-01 17:49:29 -07:00
|
|
|
cpu_count=`configNR_CPUS.sh $resdir/ConfigFragment`
|
torture: Provide bare-metal modprobe-based advice
In some environments, the torture-testing use of virtualization is
inconvenient. In such cases, the modprobe and rmmod commands may be used
to do torture testing, but significant setup is required to build, boot,
and modprobe a kernel so as to match a given torture-test scenario.
This commit therefore creates a "bare-metal" file in each results
directory containing steps to run the corresponding scenario using the
modprobe command on bare metal. For example, the contents of this file
after using kvm.sh to build an rcutorture TREE01 kernel, perhaps with
the --buildonly argument, is as follows:
To run this scenario on bare metal:
1. Set your bare-metal build tree to the state shown in this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/testid.txt
2. Update your bare-metal build tree's .config based on this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/ConfigFragment
3. Make the bare-metal kernel's build system aware of your .config updates:
$ yes "" | make oldconfig
4. Build your bare-metal kernel.
5. Boot your bare-metal kernel with the following parameters:
maxcpus=8 nr_cpus=43 rcutree.gp_preinit_delay=3 rcutree.gp_init_delay=3 rcutree.gp_cleanup_delay=3 rcu_nocbs=0-1,3-7
6. Start the test with the following command:
$ modprobe rcutorture nocbs_nthreads=8 nocbs_toggle=1000 fwd_progress=0 onoff_interval=1000 onoff_holdoff=30 n_barrier_cbs=4 stat_interval=15 shutdown_secs=120 test_no_idle_hz=1 verbose=1
7. After some time, end the test with the following command:
$ rmmod rcutorture
8. Copy your bare-metal kernel's .config file, overwriting this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/.config
9. Copy the console output from just before the modprobe to just after
the rmmod into this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/console.log
10. Check for runtime errors using the following command:
$ tools/testing/selftests/rcutorture/bin/kvm-recheck.sh /home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-02-03 15:44:29 -08:00
|
|
|
cpu_count=`configfrag_boot_cpus "$boot_args_in" "$config_template" "$cpu_count"`
|
2019-11-25 14:33:28 -08:00
|
|
|
if test "$cpu_count" -gt "$TORTURE_ALLOTED_CPUS"
|
2013-09-28 14:12:21 -07:00
|
|
|
then
|
2019-11-25 14:33:28 -08:00
|
|
|
echo CPU count limited from $cpu_count to $TORTURE_ALLOTED_CPUS | tee -a $resdir/Warnings
|
|
|
|
|
cpu_count=$TORTURE_ALLOTED_CPUS
|
2013-09-28 14:12:21 -07:00
|
|
|
fi
|
2013-10-04 13:15:55 -07:00
|
|
|
qemu_args="`specify_qemu_cpus "$QEMU" "$qemu_args" "$cpu_count"`"
|
2020-04-28 14:41:48 -07:00
|
|
|
qemu_args="`specify_qemu_net "$qemu_args"`"
|
2013-10-04 13:15:55 -07:00
|
|
|
|
|
|
|
|
# Generate architecture-specific and interaction-specific qemu arguments
|
2015-12-01 15:53:11 -08:00
|
|
|
qemu_args="$qemu_args `identify_qemu_args "$QEMU" "$resdir/console.log"`"
|
2013-10-04 13:15:55 -07:00
|
|
|
|
|
|
|
|
# Generate qemu -append arguments
|
|
|
|
|
qemu_append="`identify_qemu_append "$QEMU"`"
|
2013-09-28 14:12:21 -07:00
|
|
|
|
2013-10-09 11:02:00 -07:00
|
|
|
# Pull in Kconfig-fragment boot parameters
|
torture: Provide bare-metal modprobe-based advice
In some environments, the torture-testing use of virtualization is
inconvenient. In such cases, the modprobe and rmmod commands may be used
to do torture testing, but significant setup is required to build, boot,
and modprobe a kernel so as to match a given torture-test scenario.
This commit therefore creates a "bare-metal" file in each results
directory containing steps to run the corresponding scenario using the
modprobe command on bare metal. For example, the contents of this file
after using kvm.sh to build an rcutorture TREE01 kernel, perhaps with
the --buildonly argument, is as follows:
To run this scenario on bare metal:
1. Set your bare-metal build tree to the state shown in this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/testid.txt
2. Update your bare-metal build tree's .config based on this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/ConfigFragment
3. Make the bare-metal kernel's build system aware of your .config updates:
$ yes "" | make oldconfig
4. Build your bare-metal kernel.
5. Boot your bare-metal kernel with the following parameters:
maxcpus=8 nr_cpus=43 rcutree.gp_preinit_delay=3 rcutree.gp_init_delay=3 rcutree.gp_cleanup_delay=3 rcu_nocbs=0-1,3-7
6. Start the test with the following command:
$ modprobe rcutorture nocbs_nthreads=8 nocbs_toggle=1000 fwd_progress=0 onoff_interval=1000 onoff_holdoff=30 n_barrier_cbs=4 stat_interval=15 shutdown_secs=120 test_no_idle_hz=1 verbose=1
7. After some time, end the test with the following command:
$ rmmod rcutorture
8. Copy your bare-metal kernel's .config file, overwriting this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/.config
9. Copy the console output from just before the modprobe to just after
the rmmod into this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/console.log
10. Check for runtime errors using the following command:
$ tools/testing/selftests/rcutorture/bin/kvm-recheck.sh /home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-02-03 15:44:29 -08:00
|
|
|
boot_args="`configfrag_boot_params "$boot_args_in" "$config_template"`"
|
2014-02-06 17:50:32 -08:00
|
|
|
# Generate kernel-version-specific boot parameters
|
2017-03-25 10:19:50 -07:00
|
|
|
boot_args="`per_version_boot_params "$boot_args" $resdir/.config $seconds`"
|
torture: Add gdb support
This commit adds a "--gdb" parameter to kvm.sh, which causes
"CONFIG_DEBUG_INFO=y" to be added to the Kconfig options, "nokaslr"
to be added to the boot parameters, and "-s -S" to be added to the qemu
arguments. Furthermore, the scripting prints messages telling the user
how to start up gdb for the run in question.
Because of the interactive nature of gdb sessions, only one "--configs"
scenario is permitted when "--gdb" is specified. For most torture types,
this means that a "--configs" argument is required, and that argument
must specify the single scenario of interest.
The usual cautions about breakpoints and timing apply, for example,
staring at your gdb prompt for too long will likely get you many
complaints, including RCU CPU stall warnings. Omar Sandoval further
suggests using gdb's "hbreak" command instead of the "break" command on
systems supporting hardware breakpoints, and further using the "commands"
option because the resulting non-interactive breakpoints are less likely
to get you RCU CPU stall warnings.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-08-17 16:44:48 -07:00
|
|
|
if test -n "$TORTURE_BOOT_GDB_ARG"
|
|
|
|
|
then
|
|
|
|
|
boot_args="$boot_args $TORTURE_BOOT_GDB_ARG"
|
|
|
|
|
fi
|
torture: Provide bare-metal modprobe-based advice
In some environments, the torture-testing use of virtualization is
inconvenient. In such cases, the modprobe and rmmod commands may be used
to do torture testing, but significant setup is required to build, boot,
and modprobe a kernel so as to match a given torture-test scenario.
This commit therefore creates a "bare-metal" file in each results
directory containing steps to run the corresponding scenario using the
modprobe command on bare metal. For example, the contents of this file
after using kvm.sh to build an rcutorture TREE01 kernel, perhaps with
the --buildonly argument, is as follows:
To run this scenario on bare metal:
1. Set your bare-metal build tree to the state shown in this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/testid.txt
2. Update your bare-metal build tree's .config based on this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/ConfigFragment
3. Make the bare-metal kernel's build system aware of your .config updates:
$ yes "" | make oldconfig
4. Build your bare-metal kernel.
5. Boot your bare-metal kernel with the following parameters:
maxcpus=8 nr_cpus=43 rcutree.gp_preinit_delay=3 rcutree.gp_init_delay=3 rcutree.gp_cleanup_delay=3 rcu_nocbs=0-1,3-7
6. Start the test with the following command:
$ modprobe rcutorture nocbs_nthreads=8 nocbs_toggle=1000 fwd_progress=0 onoff_interval=1000 onoff_holdoff=30 n_barrier_cbs=4 stat_interval=15 shutdown_secs=120 test_no_idle_hz=1 verbose=1
7. After some time, end the test with the following command:
$ rmmod rcutorture
8. Copy your bare-metal kernel's .config file, overwriting this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/.config
9. Copy the console output from just before the modprobe to just after
the rmmod into this file:
/home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19/TREE01/console.log
10. Check for runtime errors using the following command:
$ tools/testing/selftests/rcutorture/bin/kvm-recheck.sh /home/git/linux-rcu/tools/testing/selftests/rcutorture/res/2021.02.04-17.10.19
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-02-03 15:44:29 -08:00
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
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 " 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 " " $resdir/.config >> $resdir/bare-metal
|
|
|
|
|
echo " 9." 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 " " $ 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
|
|
|
|
|
|
torture: Add gdb support
This commit adds a "--gdb" parameter to kvm.sh, which causes
"CONFIG_DEBUG_INFO=y" to be added to the Kconfig options, "nokaslr"
to be added to the boot parameters, and "-s -S" to be added to the qemu
arguments. Furthermore, the scripting prints messages telling the user
how to start up gdb for the run in question.
Because of the interactive nature of gdb sessions, only one "--configs"
scenario is permitted when "--gdb" is specified. For most torture types,
this means that a "--configs" argument is required, and that argument
must specify the single scenario of interest.
The usual cautions about breakpoints and timing apply, for example,
staring at your gdb prompt for too long will likely get you many
complaints, including RCU CPU stall warnings. Omar Sandoval further
suggests using gdb's "hbreak" command instead of the "break" command on
systems supporting hardware breakpoints, and further using the "commands"
option because the resulting non-interactive breakpoints are less likely
to get you RCU CPU stall warnings.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-08-17 16:44:48 -07:00
|
|
|
echo $QEMU $qemu_args -m $TORTURE_QEMU_MEM -kernel $KERNEL -append \"$qemu_append $boot_args\" $TORTURE_QEMU_GDB_ARG > $resdir/qemu-cmd
|
2020-11-17 16:28:18 -08:00
|
|
|
echo "# TORTURE_SHUTDOWN_GRACE=$TORTURE_SHUTDOWN_GRACE" >> $resdir/qemu-cmd
|
|
|
|
|
echo "# seconds=$seconds" >> $resdir/qemu-cmd
|
2021-02-11 16:19:29 -08:00
|
|
|
echo "# TORTURE_KCONFIG_GDB_ARG=\"$TORTURE_KCONFIG_GDB_ARG\"" >> $resdir/qemu-cmd
|
2021-02-16 15:32:23 -08:00
|
|
|
echo "# TORTURE_JITTER_START=\"$TORTURE_JITTER_START\"" >> $resdir/qemu-cmd
|
|
|
|
|
echo "# TORTURE_JITTER_STOP=\"$TORTURE_JITTER_STOP\"" >> $resdir/qemu-cmd
|
2021-02-23 12:07:39 -08:00
|
|
|
echo "# TORTURE_TRUST_MAKE=\"$TORTURE_TRUST_MAKE\"; export TORTURE_TRUST_MAKE" >> $resdir/qemu-cmd
|
2021-07-08 17:20:08 -07:00
|
|
|
echo "# TORTURE_CPU_COUNT=$cpu_count" >> $resdir/qemu-cmd
|
2013-09-28 14:12:21 -07:00
|
|
|
|
2014-02-26 15:39:41 -08:00
|
|
|
if test -n "$TORTURE_BUILDONLY"
|
2013-10-10 14:52:07 -07:00
|
|
|
then
|
|
|
|
|
echo Build-only run specified, boot/test omitted.
|
2014-04-29 09:53:34 -07:00
|
|
|
touch $resdir/buildonly
|
2013-10-10 14:52:07 -07:00
|
|
|
exit 0
|
|
|
|
|
fi
|
2020-06-16 16:34:52 -07:00
|
|
|
|
2021-02-12 14:00:05 -08:00
|
|
|
kvm-test-1-run-qemu.sh $resdir
|
2021-06-23 17:07:06 -07:00
|
|
|
parse-console.sh $resdir/console.log $title
|