2013-09-28 14:12:21 -07:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2017-12-11 08:20:25 -08:00
|
|
|
# Run a series of tests under KVM. By default, this series is specified
|
|
|
|
# by the relevant CFLIST file, but can be overridden by the --configs
|
|
|
|
# command-line argument.
|
2013-09-28 14:12:21 -07:00
|
|
|
#
|
2014-07-11 19:47:35 -04:00
|
|
|
# Usage: kvm.sh [ options ]
|
2013-09-28 14:12:21 -07:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2013-12-03 09:54:18 -08:00
|
|
|
# along with this program; if not, you can access it online at
|
|
|
|
# http://www.gnu.org/licenses/gpl-2.0.html.
|
2013-09-28 14:12:21 -07:00
|
|
|
#
|
|
|
|
# Copyright (C) IBM Corporation, 2011
|
|
|
|
#
|
|
|
|
# Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
|
|
|
|
|
|
|
|
scriptname=$0
|
2013-09-30 14:49:43 -07:00
|
|
|
args="$*"
|
2013-09-28 14:12:21 -07:00
|
|
|
|
2017-08-30 15:33:49 -07:00
|
|
|
T=${TMPDIR-/tmp}/kvm.sh.$$
|
2014-01-15 15:48:41 -08:00
|
|
|
trap 'rm -rf $T' 0
|
|
|
|
mkdir $T
|
|
|
|
|
2017-11-03 19:17:24 +09:00
|
|
|
cd `dirname $scriptname`/../../../../../
|
|
|
|
|
2016-03-29 10:50:38 -07:00
|
|
|
dur=$((30*60))
|
2014-01-17 03:10:16 -08:00
|
|
|
dryrun=""
|
2013-10-15 10:42:25 -07:00
|
|
|
KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
|
2013-10-28 08:57:29 -07:00
|
|
|
PATH=${KVM}/bin:$PATH; export PATH
|
2014-02-26 14:28:43 -08:00
|
|
|
TORTURE_DEFCONFIG=defconfig
|
2014-03-06 14:44:46 -08:00
|
|
|
TORTURE_BOOT_IMAGE=""
|
2014-02-26 11:16:07 -08:00
|
|
|
TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD
|
2017-05-01 17:49:29 -07:00
|
|
|
TORTURE_KCONFIG_ARG=""
|
2014-02-26 15:23:21 -08:00
|
|
|
TORTURE_KMAKE_ARG=""
|
2018-01-12 14:19:05 -08:00
|
|
|
TORTURE_QEMU_MEM=512
|
2015-10-01 11:41:06 -07:00
|
|
|
TORTURE_SHUTDOWN_GRACE=180
|
2014-02-07 10:29:49 -08:00
|
|
|
TORTURE_SUITE=rcu
|
2013-09-28 14:12:21 -07:00
|
|
|
resdir=""
|
2013-09-29 11:13:46 -07:00
|
|
|
configs=""
|
2014-01-15 15:48:41 -08:00
|
|
|
cpus=0
|
2013-09-28 18:44:11 -07:00
|
|
|
ds=`date +%Y.%m.%d-%H:%M:%S`
|
2016-06-01 13:09:19 -07:00
|
|
|
jitter="-1"
|
2013-09-28 14:12:21 -07:00
|
|
|
|
2013-10-28 08:57:29 -07:00
|
|
|
. functions.sh
|
|
|
|
|
2013-09-28 14:12:21 -07:00
|
|
|
usage () {
|
|
|
|
echo "Usage: $scriptname optional arguments:"
|
2013-10-14 08:19:39 -07:00
|
|
|
echo " --bootargs kernel-boot-arguments"
|
2014-03-06 14:44:46 -08:00
|
|
|
echo " --bootimage relative-path-to-kernel-boot-image"
|
2013-10-10 14:52:07 -07:00
|
|
|
echo " --buildonly"
|
2015-05-11 13:55:47 -07:00
|
|
|
echo " --configs \"config-file list w/ repeat factor (3*TINY01)\""
|
2014-01-15 15:48:41 -08:00
|
|
|
echo " --cpus N"
|
2013-09-28 18:44:11 -07:00
|
|
|
echo " --datestamp string"
|
2014-02-26 14:28:43 -08:00
|
|
|
echo " --defconfig string"
|
2014-01-17 03:10:16 -08:00
|
|
|
echo " --dryrun sched|script"
|
2013-09-28 14:12:21 -07:00
|
|
|
echo " --duration minutes"
|
2013-10-04 13:15:55 -07:00
|
|
|
echo " --interactive"
|
2016-03-29 14:22:26 -07:00
|
|
|
echo " --jitter N [ maxsleep (us) [ maxspin (us) ] ]"
|
2017-05-01 17:49:29 -07:00
|
|
|
echo " --kconfig Kconfig-options"
|
2013-10-15 11:51:23 -07:00
|
|
|
echo " --kmake-arg kernel-make-arguments"
|
2013-10-04 13:15:55 -07:00
|
|
|
echo " --mac nn:nn:nn:nn:nn:nn"
|
2018-01-12 14:19:05 -08:00
|
|
|
echo " --memory megabytes | nnnG"
|
2013-10-15 10:42:25 -07:00
|
|
|
echo " --no-initrd"
|
2017-11-03 19:17:23 +09:00
|
|
|
echo " --qemu-args qemu-arguments"
|
2013-09-30 17:17:57 -07:00
|
|
|
echo " --qemu-cmd qemu-system-..."
|
2014-02-07 10:29:49 -08:00
|
|
|
echo " --results absolute-pathname"
|
|
|
|
echo " --torture rcu"
|
2013-09-28 14:12:21 -07:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
while test $# -gt 0
|
|
|
|
do
|
|
|
|
case "$1" in
|
2015-08-25 17:12:09 -07:00
|
|
|
--bootargs|--bootarg)
|
2013-10-14 08:19:39 -07:00
|
|
|
checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--'
|
2014-02-26 15:28:53 -08:00
|
|
|
TORTURE_BOOTARGS="$2"
|
2013-10-14 08:19:39 -07:00
|
|
|
shift
|
|
|
|
;;
|
2014-03-06 14:44:46 -08:00
|
|
|
--bootimage)
|
|
|
|
checkarg --bootimage "(relative path to kernel boot image)" "$#" "$2" '[a-zA-Z0-9][a-zA-Z0-9_]*' '^--'
|
|
|
|
TORTURE_BOOT_IMAGE="$2"
|
|
|
|
shift
|
|
|
|
;;
|
2013-10-10 14:52:07 -07:00
|
|
|
--buildonly)
|
2014-02-26 15:39:41 -08:00
|
|
|
TORTURE_BUILDONLY=1
|
2013-10-10 14:52:07 -07:00
|
|
|
;;
|
2015-08-25 17:12:09 -07:00
|
|
|
--configs|--config)
|
2013-09-28 14:12:21 -07:00
|
|
|
checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--'
|
|
|
|
configs="$2"
|
|
|
|
shift
|
|
|
|
;;
|
2014-01-15 15:48:41 -08:00
|
|
|
--cpus)
|
|
|
|
checkarg --cpus "(number)" "$#" "$2" '^[0-9]*$' '^--'
|
|
|
|
cpus=$2
|
|
|
|
shift
|
|
|
|
;;
|
2013-09-28 18:44:11 -07:00
|
|
|
--datestamp)
|
|
|
|
checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--'
|
|
|
|
ds=$2
|
|
|
|
shift
|
|
|
|
;;
|
2014-02-26 14:28:43 -08:00
|
|
|
--defconfig)
|
|
|
|
checkarg --defconfig "defconfigtype" "$#" "$2" '^[^/][^/]*$' '^--'
|
|
|
|
TORTURE_DEFCONFIG=$2
|
|
|
|
shift
|
|
|
|
;;
|
2014-01-17 03:10:16 -08:00
|
|
|
--dryrun)
|
|
|
|
checkarg --dryrun "sched|script" $# "$2" 'sched\|script' '^--'
|
|
|
|
dryrun=$2
|
|
|
|
shift
|
|
|
|
;;
|
2013-09-28 14:12:21 -07:00
|
|
|
--duration)
|
2013-10-15 09:22:48 -07:00
|
|
|
checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error'
|
2016-03-29 10:50:38 -07:00
|
|
|
dur=$(($2*60))
|
2013-09-28 14:12:21 -07:00
|
|
|
shift
|
|
|
|
;;
|
2013-10-04 13:15:55 -07:00
|
|
|
--interactive)
|
2014-02-26 16:38:52 -08:00
|
|
|
TORTURE_QEMU_INTERACTIVE=1; export TORTURE_QEMU_INTERACTIVE
|
2013-10-04 13:15:55 -07:00
|
|
|
;;
|
2016-03-29 14:22:26 -07:00
|
|
|
--jitter)
|
|
|
|
checkarg --jitter "(# threads [ sleep [ spin ] ])" $# "$2" '^-\{,1\}[0-9]\+\( \+[0-9]\+\)\{,2\} *$' '^error$'
|
|
|
|
jitter="$2"
|
|
|
|
shift
|
|
|
|
;;
|
2017-05-01 17:49:29 -07:00
|
|
|
--kconfig)
|
|
|
|
checkarg --kconfig "(Kconfig options)" $# "$2" '^CONFIG_[A-Z0-9_]\+=\([ynm]\|[0-9]\+\)\( CONFIG_[A-Z0-9_]\+=\([ynm]\|[0-9]\+\)\)*$' '^error$'
|
|
|
|
TORTURE_KCONFIG_ARG="$2"
|
|
|
|
shift
|
|
|
|
;;
|
2013-10-15 11:51:23 -07:00
|
|
|
--kmake-arg)
|
|
|
|
checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$'
|
2014-02-26 15:23:21 -08:00
|
|
|
TORTURE_KMAKE_ARG="$2"
|
2013-10-15 11:51:23 -07:00
|
|
|
shift
|
|
|
|
;;
|
2013-10-04 13:15:55 -07:00
|
|
|
--mac)
|
|
|
|
checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error
|
2014-02-26 16:41:18 -08:00
|
|
|
TORTURE_QEMU_MAC=$2
|
2013-10-04 13:15:55 -07:00
|
|
|
shift
|
|
|
|
;;
|
2018-01-12 14:19:05 -08:00
|
|
|
--memory)
|
|
|
|
checkarg --memory "(memory size)" $# "$2" '^[0-9]\+[MG]\?$' error
|
|
|
|
TORTURE_QEMU_MEM=$2
|
|
|
|
shift
|
|
|
|
;;
|
2013-10-15 10:42:25 -07:00
|
|
|
--no-initrd)
|
2014-02-26 11:16:07 -08:00
|
|
|
TORTURE_INITRD=""; export TORTURE_INITRD
|
2013-10-15 10:42:25 -07:00
|
|
|
;;
|
2015-08-25 17:12:09 -07:00
|
|
|
--qemu-args|--qemu-arg)
|
2017-11-03 19:17:23 +09:00
|
|
|
checkarg --qemu-args "(qemu arguments)" $# "$2" '^-' '^error'
|
2014-02-26 16:42:46 -08:00
|
|
|
TORTURE_QEMU_ARG="$2"
|
2013-10-15 09:22:48 -07:00
|
|
|
shift
|
|
|
|
;;
|
2013-09-30 17:17:57 -07:00
|
|
|
--qemu-cmd)
|
|
|
|
checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--'
|
2014-02-26 16:44:26 -08:00
|
|
|
TORTURE_QEMU_CMD="$2"
|
2013-09-30 17:17:57 -07:00
|
|
|
shift
|
|
|
|
;;
|
2013-09-28 14:12:21 -07:00
|
|
|
--results)
|
2013-10-15 09:22:48 -07:00
|
|
|
checkarg --results "(absolute pathname)" "$#" "$2" '^/' '^error'
|
2013-09-28 14:12:21 -07:00
|
|
|
resdir=$2
|
|
|
|
shift
|
|
|
|
;;
|
2015-10-01 11:41:06 -07:00
|
|
|
--shutdown-grace)
|
|
|
|
checkarg --shutdown-grace "(seconds)" "$#" "$2" '^[0-9]*$' '^error'
|
|
|
|
TORTURE_SHUTDOWN_GRACE=$2
|
|
|
|
shift
|
|
|
|
;;
|
2014-02-07 10:29:49 -08:00
|
|
|
--torture)
|
2016-01-11 13:13:12 -08:00
|
|
|
checkarg --torture "(suite name)" "$#" "$2" '^\(lock\|rcu\|rcuperf\)$' '^--'
|
2014-02-07 10:29:49 -08:00
|
|
|
TORTURE_SUITE=$2
|
|
|
|
shift
|
2018-01-30 19:36:38 -08:00
|
|
|
if test "$TORTURE_SUITE" = rcuperf
|
|
|
|
then
|
|
|
|
# If you really want jitter for rcuperf, specify
|
|
|
|
# it after specifying rcuperf. (But why?)
|
|
|
|
jitter=0
|
|
|
|
fi
|
2014-02-07 10:29:49 -08:00
|
|
|
;;
|
2013-09-28 14:12:21 -07:00
|
|
|
*)
|
2013-10-01 10:14:09 -07:00
|
|
|
echo Unknown argument $1
|
2013-09-28 14:12:21 -07:00
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2014-02-07 10:29:49 -08:00
|
|
|
CONFIGFRAG=${KVM}/configs/${TORTURE_SUITE}; export CONFIGFRAG
|
2013-09-29 11:13:46 -07:00
|
|
|
|
|
|
|
if test -z "$configs"
|
|
|
|
then
|
2014-10-04 13:04:15 -04:00
|
|
|
configs="`cat $CONFIGFRAG/CFLIST`"
|
2013-09-29 11:13:46 -07:00
|
|
|
fi
|
2013-09-28 14:12:21 -07:00
|
|
|
|
|
|
|
if test -z "$resdir"
|
|
|
|
then
|
|
|
|
resdir=$KVM/res
|
2014-01-27 12:31:20 -08:00
|
|
|
fi
|
|
|
|
|
2014-01-17 21:56:57 -08:00
|
|
|
# Create a file of test-name/#cpus pairs, sorted by decreasing #cpus.
|
2014-01-15 15:48:41 -08:00
|
|
|
touch $T/cfgcpu
|
2013-09-28 14:12:21 -07:00
|
|
|
for CF in $configs
|
|
|
|
do
|
2015-05-11 13:55:47 -07:00
|
|
|
case $CF in
|
|
|
|
[0-9]\**|[0-9][0-9]\**|[0-9][0-9][0-9]\**)
|
|
|
|
config_reps=`echo $CF | sed -e 's/\*.*$//'`
|
|
|
|
CF1=`echo $CF | sed -e 's/^[^*]*\*//'`
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
config_reps=1
|
|
|
|
CF1=$CF
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if test -f "$CONFIGFRAG/$CF1"
|
2013-10-19 06:28:21 -07:00
|
|
|
then
|
2015-05-11 13:55:47 -07:00
|
|
|
cpu_count=`configNR_CPUS.sh $CONFIGFRAG/$CF1`
|
|
|
|
cpu_count=`configfrag_boot_cpus "$TORTURE_BOOTARGS" "$CONFIGFRAG/$CF1" "$cpu_count"`
|
2017-06-09 14:09:21 -07:00
|
|
|
cpu_count=`configfrag_boot_maxcpus "$TORTURE_BOOTARGS" "$CONFIGFRAG/$CF1" "$cpu_count"`
|
2015-05-11 13:55:47 -07:00
|
|
|
for ((cur_rep=0;cur_rep<$config_reps;cur_rep++))
|
|
|
|
do
|
|
|
|
echo $CF1 $cpu_count >> $T/cfgcpu
|
|
|
|
done
|
2014-01-15 15:48:41 -08:00
|
|
|
else
|
2015-05-11 13:55:47 -07:00
|
|
|
echo "The --configs file $CF1 does not exist, terminating."
|
2014-01-15 15:48:41 -08:00
|
|
|
exit 1
|
2013-10-19 06:28:21 -07:00
|
|
|
fi
|
2013-09-28 14:12:21 -07:00
|
|
|
done
|
2017-08-30 15:33:49 -07:00
|
|
|
sort -k2nr $T/cfgcpu -T="$T" > $T/cfgcpu.sort
|
2014-01-15 15:48:41 -08:00
|
|
|
|
2014-01-17 21:56:57 -08:00
|
|
|
# Use a greedy bin-packing algorithm, sorting the list accordingly.
|
2014-01-17 14:18:05 -08:00
|
|
|
awk < $T/cfgcpu.sort > $T/cfgcpu.pack -v ncpus=$cpus '
|
|
|
|
BEGIN {
|
|
|
|
njobs = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2014-01-17 21:56:57 -08:00
|
|
|
# Read file of tests and corresponding required numbers of CPUs.
|
2014-01-17 14:18:05 -08:00
|
|
|
cf[njobs] = $1;
|
|
|
|
cpus[njobs] = $2;
|
|
|
|
njobs++;
|
|
|
|
}
|
|
|
|
|
|
|
|
END {
|
|
|
|
batch = 0;
|
|
|
|
nc = -1;
|
2014-01-17 21:56:57 -08:00
|
|
|
|
|
|
|
# Each pass through the following loop creates on test batch
|
|
|
|
# that can be executed concurrently given ncpus. Note that a
|
|
|
|
# given test that requires more than the available CPUs will run in
|
|
|
|
# their own batch. Such tests just have to make do with what
|
|
|
|
# is available.
|
2014-01-17 14:18:05 -08:00
|
|
|
while (nc != ncpus) {
|
|
|
|
batch++;
|
|
|
|
nc = ncpus;
|
2014-01-17 21:56:57 -08:00
|
|
|
|
|
|
|
# Each pass through the following loop considers one
|
|
|
|
# test for inclusion in the current batch.
|
2014-01-17 14:18:05 -08:00
|
|
|
for (i = 0; i < njobs; i++) {
|
|
|
|
if (done[i])
|
2014-01-17 21:56:57 -08:00
|
|
|
continue; # Already part of a batch.
|
2014-01-17 14:18:05 -08:00
|
|
|
if (nc >= cpus[i] || nc == ncpus) {
|
2014-01-17 21:56:57 -08:00
|
|
|
|
|
|
|
# This test fits into the current batch.
|
2014-01-17 14:18:05 -08:00
|
|
|
done[i] = batch;
|
|
|
|
nc -= cpus[i];
|
|
|
|
if (nc <= 0)
|
2014-01-17 21:56:57 -08:00
|
|
|
break; # Too-big test in its own batch.
|
2014-01-17 14:18:05 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-01-17 21:56:57 -08:00
|
|
|
|
|
|
|
# Dump out the tests in batch order.
|
2014-01-17 14:18:05 -08:00
|
|
|
for (b = 1; b <= batch; b++)
|
|
|
|
for (i = 0; i < njobs; i++)
|
|
|
|
if (done[i] == b)
|
|
|
|
print cf[i], cpus[i];
|
|
|
|
}'
|
|
|
|
|
2014-01-17 21:56:57 -08:00
|
|
|
# Generate a script to execute the tests in appropriate batches.
|
2014-02-07 10:29:49 -08:00
|
|
|
cat << ___EOF___ > $T/script
|
2014-02-27 20:26:57 -08:00
|
|
|
CONFIGFRAG="$CONFIGFRAG"; export CONFIGFRAG
|
|
|
|
KVM="$KVM"; export KVM
|
|
|
|
PATH="$PATH"; export PATH
|
2014-03-06 14:44:46 -08:00
|
|
|
TORTURE_BOOT_IMAGE="$TORTURE_BOOT_IMAGE"; export TORTURE_BOOT_IMAGE
|
2014-02-27 20:26:57 -08:00
|
|
|
TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY
|
2014-02-26 14:28:43 -08:00
|
|
|
TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG
|
2014-02-27 20:26:57 -08:00
|
|
|
TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD
|
2017-05-01 17:49:29 -07:00
|
|
|
TORTURE_KCONFIG_ARG="$TORTURE_KCONFIG_ARG"; export TORTURE_KCONFIG_ARG
|
2014-02-27 20:26:57 -08:00
|
|
|
TORTURE_KMAKE_ARG="$TORTURE_KMAKE_ARG"; export TORTURE_KMAKE_ARG
|
|
|
|
TORTURE_QEMU_CMD="$TORTURE_QEMU_CMD"; export TORTURE_QEMU_CMD
|
|
|
|
TORTURE_QEMU_INTERACTIVE="$TORTURE_QEMU_INTERACTIVE"; export TORTURE_QEMU_INTERACTIVE
|
|
|
|
TORTURE_QEMU_MAC="$TORTURE_QEMU_MAC"; export TORTURE_QEMU_MAC
|
2018-01-12 14:19:05 -08:00
|
|
|
TORTURE_QEMU_MEM="$TORTURE_QEMU_MEM"; export TORTURE_QEMU_MEM
|
2015-10-01 11:41:06 -07:00
|
|
|
TORTURE_SHUTDOWN_GRACE="$TORTURE_SHUTDOWN_GRACE"; export TORTURE_SHUTDOWN_GRACE
|
2014-02-27 20:26:57 -08:00
|
|
|
TORTURE_SUITE="$TORTURE_SUITE"; export TORTURE_SUITE
|
2014-02-27 17:11:11 -08:00
|
|
|
if ! test -e $resdir
|
|
|
|
then
|
|
|
|
mkdir -p "$resdir" || :
|
|
|
|
fi
|
|
|
|
mkdir $resdir/$ds
|
|
|
|
echo Results directory: $resdir/$ds
|
|
|
|
echo $scriptname $args
|
|
|
|
touch $resdir/$ds/log
|
|
|
|
echo $scriptname $args >> $resdir/$ds/log
|
|
|
|
echo ${TORTURE_SUITE} > $resdir/$ds/TORTURE_SUITE
|
|
|
|
pwd > $resdir/$ds/testid.txt
|
|
|
|
if test -d .git
|
|
|
|
then
|
|
|
|
git status >> $resdir/$ds/testid.txt
|
|
|
|
git rev-parse HEAD >> $resdir/$ds/testid.txt
|
2017-04-27 10:24:08 -07:00
|
|
|
git diff HEAD >> $resdir/$ds/testid.txt
|
2014-02-27 17:11:11 -08:00
|
|
|
fi
|
2014-02-07 10:29:49 -08:00
|
|
|
___EOF___
|
2014-01-17 14:18:05 -08:00
|
|
|
awk < $T/cfgcpu.pack \
|
2016-09-27 11:56:12 -07:00
|
|
|
-v TORTURE_BUILDONLY="$TORTURE_BUILDONLY" \
|
2014-10-04 13:04:15 -04:00
|
|
|
-v CONFIGDIR="$CONFIGFRAG/" \
|
2014-01-15 15:48:41 -08:00
|
|
|
-v KVM="$KVM" \
|
|
|
|
-v ncpus=$cpus \
|
2016-03-29 14:22:26 -07:00
|
|
|
-v jitter="$jitter" \
|
2014-01-15 15:48:41 -08:00
|
|
|
-v rd=$resdir/$ds/ \
|
|
|
|
-v dur=$dur \
|
2014-03-06 13:20:54 -08:00
|
|
|
-v TORTURE_QEMU_ARG="$TORTURE_QEMU_ARG" \
|
|
|
|
-v TORTURE_BOOTARGS="$TORTURE_BOOTARGS" \
|
2014-01-15 15:48:41 -08:00
|
|
|
'BEGIN {
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
cf[i] = $1;
|
|
|
|
cpus[i] = $2;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
2014-01-17 21:56:57 -08:00
|
|
|
# Dump out the scripting required to run one test batch.
|
2015-09-30 22:11:48 -07:00
|
|
|
function dump(first, pastlast, batchnum)
|
2014-01-15 15:48:41 -08:00
|
|
|
{
|
2017-11-03 19:17:27 +09:00
|
|
|
print "echo ----Start batch " batchnum ": `date` | tee -a " rd "log";
|
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
|
|
|
print "needqemurun="
|
2014-01-15 15:48:41 -08:00
|
|
|
jn=1
|
|
|
|
for (j = first; j < pastlast; j++) {
|
2018-04-23 14:03:00 -07:00
|
|
|
builddir=KVM "/b1"
|
2014-01-17 03:29:12 -08:00
|
|
|
cpusr[jn] = cpus[j];
|
2014-01-15 15:48:41 -08:00
|
|
|
if (cfrep[cf[j]] == "") {
|
2014-01-17 03:29:12 -08:00
|
|
|
cfr[jn] = cf[j];
|
2014-01-15 15:48:41 -08:00
|
|
|
cfrep[cf[j]] = 1;
|
|
|
|
} else {
|
|
|
|
cfrep[cf[j]]++;
|
2014-01-17 03:29:12 -08:00
|
|
|
cfr[jn] = cf[j] "." cfrep[cf[j]];
|
2014-01-15 15:48:41 -08:00
|
|
|
}
|
2014-01-17 22:08:09 -08:00
|
|
|
if (cpusr[jn] > ncpus && ncpus != 0)
|
2015-02-07 20:08:51 -08:00
|
|
|
ovf = "-ovf";
|
2014-01-17 22:08:09 -08:00
|
|
|
else
|
|
|
|
ovf = "";
|
2017-11-03 19:17:27 +09:00
|
|
|
print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date` | tee -a " rd "log";
|
2014-01-17 03:29:12 -08:00
|
|
|
print "rm -f " builddir ".*";
|
|
|
|
print "touch " builddir ".wait";
|
|
|
|
print "mkdir " builddir " > /dev/null 2>&1 || :";
|
|
|
|
print "mkdir " rd cfr[jn] " || :";
|
2014-02-26 16:42:46 -08:00
|
|
|
print "kvm-test-1-run.sh " CONFIGDIR cf[j], builddir, rd cfr[jn], dur " \"" TORTURE_QEMU_ARG "\" \"" TORTURE_BOOTARGS "\" > " rd cfr[jn] "/kvm-test-1-run.sh.out 2>&1 &"
|
2017-11-03 19:17:27 +09:00
|
|
|
print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date` | tee -a " rd "log";
|
2014-01-15 15:48:41 -08:00
|
|
|
print "while test -f " builddir ".wait"
|
|
|
|
print "do"
|
|
|
|
print "\tsleep 1"
|
|
|
|
print "done"
|
2017-11-03 19:17:27 +09:00
|
|
|
print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date` | tee -a " rd "log";
|
2014-01-15 15:48:41 -08:00
|
|
|
jn++;
|
|
|
|
}
|
|
|
|
for (j = 1; j < jn; j++) {
|
|
|
|
builddir=KVM "/b" j
|
|
|
|
print "rm -f " builddir ".ready"
|
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
|
|
|
print "if test -f \"" rd cfr[j] "/builtkernel\""
|
2014-04-29 09:53:34 -07:00
|
|
|
print "then"
|
2017-11-03 19:17:27 +09:00
|
|
|
print "\techo ----", cfr[j], cpusr[j] ovf ": Kernel present. `date` | tee -a " rd "log";
|
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
|
|
|
print "\tneedqemurun=1"
|
2014-04-29 09:53:34 -07:00
|
|
|
print "fi"
|
2014-01-15 15:48:41 -08:00
|
|
|
}
|
2016-03-29 14:22:26 -07:00
|
|
|
njitter = 0;
|
|
|
|
split(jitter, ja);
|
|
|
|
if (ja[1] == -1 && ncpus == 0)
|
|
|
|
njitter = 1;
|
|
|
|
else if (ja[1] == -1)
|
|
|
|
njitter = ncpus;
|
|
|
|
else
|
|
|
|
njitter = ja[1];
|
2016-09-27 11:56:12 -07:00
|
|
|
if (TORTURE_BUILDONLY && njitter != 0) {
|
|
|
|
njitter = 0;
|
2017-11-03 19:17:27 +09:00
|
|
|
print "echo Build-only run, so suppressing jitter | tee -a " rd "log"
|
2016-09-27 11:56:12 -07:00
|
|
|
}
|
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
|
|
|
if (TORTURE_BUILDONLY) {
|
|
|
|
print "needqemurun="
|
|
|
|
}
|
|
|
|
print "if test -n \"$needqemurun\""
|
2014-04-29 09:53:34 -07:00
|
|
|
print "then"
|
2017-11-03 19:17:27 +09:00
|
|
|
print "\techo ---- Starting kernels. `date` | tee -a " rd "log";
|
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
|
|
|
for (j = 0; j < njitter; j++)
|
|
|
|
print "\tjitter.sh " j " " dur " " ja[2] " " ja[3] "&"
|
|
|
|
print "\twait"
|
2017-11-03 19:17:27 +09:00
|
|
|
print "\techo ---- All kernel runs complete. `date` | tee -a " rd "log";
|
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
|
|
|
print "else"
|
|
|
|
print "\twait"
|
2017-11-03 19:17:27 +09:00
|
|
|
print "\techo ---- No kernel runs. `date` | tee -a " rd "log";
|
2014-04-29 09:53:34 -07:00
|
|
|
print "fi"
|
2014-01-15 15:48:41 -08:00
|
|
|
for (j = 1; j < jn; j++) {
|
|
|
|
builddir=KVM "/b" j
|
2017-11-03 19:17:27 +09:00
|
|
|
print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results: | tee -a " rd "log";
|
|
|
|
print "cat " rd cfr[j] "/kvm-test-1-run.sh.out | tee -a " rd "log";
|
2014-01-15 15:48:41 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
END {
|
|
|
|
njobs = i;
|
|
|
|
nc = ncpus;
|
|
|
|
first = 0;
|
2015-09-30 22:11:48 -07:00
|
|
|
batchnum = 1;
|
2014-01-17 21:56:57 -08:00
|
|
|
|
|
|
|
# Each pass through the following loop considers one test.
|
2014-01-15 15:48:41 -08:00
|
|
|
for (i = 0; i < njobs; i++) {
|
|
|
|
if (ncpus == 0) {
|
2014-01-17 21:56:57 -08:00
|
|
|
# Sequential test specified, each test its own batch.
|
2015-09-30 22:11:48 -07:00
|
|
|
dump(i, i + 1, batchnum);
|
2014-01-15 15:48:41 -08:00
|
|
|
first = i;
|
2015-09-30 22:11:48 -07:00
|
|
|
batchnum++;
|
2014-01-15 15:48:41 -08:00
|
|
|
} else if (nc < cpus[i] && i != 0) {
|
2014-01-17 21:56:57 -08:00
|
|
|
# Out of CPUs, dump out a batch.
|
2015-09-30 22:11:48 -07:00
|
|
|
dump(first, i, batchnum);
|
2014-01-15 15:48:41 -08:00
|
|
|
first = i;
|
|
|
|
nc = ncpus;
|
2015-09-30 22:11:48 -07:00
|
|
|
batchnum++;
|
2014-01-15 15:48:41 -08:00
|
|
|
}
|
2014-01-17 21:56:57 -08:00
|
|
|
# Account for the CPUs needed by the current test.
|
2014-01-15 15:48:41 -08:00
|
|
|
nc -= cpus[i];
|
|
|
|
}
|
2014-01-17 21:56:57 -08:00
|
|
|
# Dump the last batch.
|
2014-01-15 15:48:41 -08:00
|
|
|
if (ncpus != 0)
|
2015-09-30 22:11:48 -07:00
|
|
|
dump(first, i, batchnum);
|
2014-02-07 10:29:49 -08:00
|
|
|
}' >> $T/script
|
2014-01-15 15:48:41 -08:00
|
|
|
|
2014-02-27 17:11:11 -08:00
|
|
|
cat << ___EOF___ >> $T/script
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo " --- `date` Test summary:"
|
|
|
|
echo Results directory: $resdir/$ds
|
2014-04-29 09:53:34 -07:00
|
|
|
kvm-recheck.sh $resdir/$ds
|
2014-02-27 17:11:11 -08:00
|
|
|
___EOF___
|
|
|
|
|
2014-01-17 03:10:16 -08:00
|
|
|
if test "$dryrun" = script
|
|
|
|
then
|
|
|
|
cat $T/script
|
|
|
|
exit 0
|
|
|
|
elif test "$dryrun" = sched
|
|
|
|
then
|
2014-01-17 21:56:57 -08:00
|
|
|
# Extract the test run schedule from the script.
|
2014-02-26 09:10:26 -08:00
|
|
|
egrep 'Start batch|Starting build\.' $T/script |
|
|
|
|
grep -v ">>" |
|
2014-01-17 03:10:16 -08:00
|
|
|
sed -e 's/:.*$//' -e 's/^echo //'
|
|
|
|
exit 0
|
|
|
|
else
|
2014-04-29 09:53:34 -07:00
|
|
|
# Not a dryrun, so run the script.
|
2014-01-17 03:10:16 -08:00
|
|
|
sh $T/script
|
|
|
|
fi
|
2014-01-15 15:48:41 -08:00
|
|
|
|
2013-10-15 12:11:24 -07:00
|
|
|
# Tracing: trace_event=rcu:rcu_grace_period,rcu:rcu_future_grace_period,rcu:rcu_grace_period_init,rcu:rcu_nocb_wake,rcu:rcu_preempt_task,rcu:rcu_unlock_preempted_task,rcu:rcu_quiescent_state_report,rcu:rcu_fqs,rcu:rcu_callback,rcu:rcu_kfree_callback,rcu:rcu_batch_start,rcu:rcu_invoke_callback,rcu:rcu_invoke_kfree_callback,rcu:rcu_batch_end,rcu:rcu_torture_read,rcu:rcu_barrier
|