diff options
Diffstat (limited to 'rcutorture/bin')
-rwxr-xr-x | rcutorture/bin/configinit.sh | 2 | ||||
-rw-r--r-- | rcutorture/bin/functions.sh | 49 | ||||
-rwxr-xr-x | rcutorture/bin/kvm-build.sh | 6 | ||||
-rwxr-xr-x | rcutorture/bin/kvm-recheck-lock.sh | 51 | ||||
-rwxr-xr-x | rcutorture/bin/kvm-recheck-rcu.sh | 51 | ||||
-rwxr-xr-x | rcutorture/bin/kvm-recheck.sh | 43 | ||||
-rwxr-xr-x | rcutorture/bin/kvm-test-1-rcu.sh (renamed from rcutorture/bin/kvm-test-1-run.sh) | 103 | ||||
-rw-r--r-- | rcutorture/bin/kvm.sh | 321 | ||||
-rwxr-xr-x | rcutorture/bin/parse-rcutorture.sh (renamed from rcutorture/bin/parse-torture.sh) | 22 |
9 files changed, 129 insertions, 519 deletions
diff --git a/rcutorture/bin/configinit.sh b/rcutorture/bin/configinit.sh index 9c3f3d3..a1be6e6 100755 --- a/rcutorture/bin/configinit.sh +++ b/rcutorture/bin/configinit.sh @@ -62,7 +62,7 @@ grep '^grep' < $T/u.sh > $T/upd.sh echo "cat - $c" >> $T/upd.sh make mrproper make $buildloc distclean > $builddir/Make.distclean 2>&1 -make $buildloc $TORTURE_DEFCONFIG > $builddir/Make.defconfig.out 2>&1 +make $buildloc defconfig > $builddir/Make.defconfig.out 2>&1 mv $builddir/.config $builddir/.config.sav sh $T/upd.sh < $builddir/.config.sav > $builddir/.config cp $builddir/.config $builddir/.config.new diff --git a/rcutorture/bin/functions.sh b/rcutorture/bin/functions.sh index d01b865..587561d 100644 --- a/rcutorture/bin/functions.sh +++ b/rcutorture/bin/functions.sh @@ -76,39 +76,15 @@ configfrag_hotplug_cpu () { grep -q '^CONFIG_HOTPLUG_CPU=y$' "$1" } -# identify_boot_image qemu-cmd -# -# Returns the relative path to the kernel build image. This will be -# arch/<arch>/boot/bzImage unless overridden with the TORTURE_BOOT_IMAGE -# environment variable. -identify_boot_image () { - if test -n "$TORTURE_BOOT_IMAGE" - then - echo $TORTURE_BOOT_IMAGE - else - case "$1" in - qemu-system-x86_64|qemu-system-i386) - echo arch/x86/boot/bzImage - ;; - qemu-system-ppc64) - echo arch/powerpc/boot/bzImage - ;; - *) - echo "" - ;; - esac - fi -} - # identify_qemu builddir # # Returns our best guess as to which qemu command is appropriate for -# the kernel at hand. Override with the TORTURE_QEMU_CMD environment variable. +# the kernel at hand. Override with the RCU_QEMU_CMD environment variable. identify_qemu () { local u="`file "$1"`" - if test -n "$TORTURE_QEMU_CMD" + if test -n "$RCU_QEMU_CMD" then - echo $TORTURE_QEMU_CMD + echo $RCU_QEMU_CMD elif echo $u | grep -q x86-64 then echo qemu-system-x86_64 @@ -120,9 +96,8 @@ identify_qemu () { echo qemu-system-ppc64 else echo Cannot figure out what qemu command to use! 1>&2 - echo file $1 output: $u # Usually this will be one of /usr/bin/qemu-system-* - # Use TORTURE_QEMU_CMD environment variable or appropriate + # Use RCU_QEMU_CMD environment variable or appropriate # argument to top-level script. exit 1 fi @@ -131,14 +106,14 @@ identify_qemu () { # identify_qemu_append qemu-cmd # # Output arguments for the qemu "-append" string based on CPU type -# and the TORTURE_QEMU_INTERACTIVE environment variable. +# and the RCU_QEMU_INTERACTIVE environment variable. identify_qemu_append () { case "$1" in qemu-system-x86_64|qemu-system-i386) echo noapic selinux=0 initcall_debug debug ;; esac - if test -n "$TORTURE_QEMU_INTERACTIVE" + if test -n "$RCU_QEMU_INTERACTIVE" then echo root=/dev/sda else @@ -148,8 +123,8 @@ identify_qemu_append () { # identify_qemu_args qemu-cmd serial-file # -# Output arguments for qemu arguments based on the TORTURE_QEMU_MAC -# and TORTURE_QEMU_INTERACTIVE environment variables. +# Output arguments for qemu arguments based on the RCU_QEMU_MAC +# and RCU_QEMU_INTERACTIVE environment variables. identify_qemu_args () { case "$1" in qemu-system-x86_64|qemu-system-i386) @@ -157,17 +132,17 @@ identify_qemu_args () { qemu-system-ppc64) echo -enable-kvm -M pseries -cpu POWER7 -nodefaults echo -device spapr-vscsi - if test -n "$TORTURE_QEMU_INTERACTIVE" -a -n "$TORTURE_QEMU_MAC" + if test -n "$RCU_QEMU_INTERACTIVE" -a -n "$RCU_QEMU_MAC" then - echo -device spapr-vlan,netdev=net0,mac=$TORTURE_QEMU_MAC + echo -device spapr-vlan,netdev=net0,mac=$RCU_QEMU_MAC echo -netdev bridge,br=br0,id=net0 - elif test -n "$TORTURE_QEMU_INTERACTIVE" + elif test -n "$RCU_QEMU_INTERACTIVE" then echo -net nic -net user fi ;; esac - if test -n "$TORTURE_QEMU_INTERACTIVE" + if test -n "$RCU_QEMU_INTERACTIVE" then echo -monitor stdio -serial pty -S else diff --git a/rcutorture/bin/kvm-build.sh b/rcutorture/bin/kvm-build.sh index 7c1e56b..197901e 100755 --- a/rcutorture/bin/kvm-build.sh +++ b/rcutorture/bin/kvm-build.sh @@ -45,9 +45,9 @@ T=/tmp/test-linux.sh.$$ trap 'rm -rf $T' 0 mkdir $T -grep -v 'CONFIG_[A-Z]*_TORTURE_TEST' < ${config_template} > $T/config +cat ${config_template} | grep -v CONFIG_RCU_TORTURE_TEST > $T/config cat << ___EOF___ >> $T/config -CONFIG_INITRAMFS_SOURCE="$TORTURE_INITRD" +CONFIG_INITRAMFS_SOURCE="$RCU_INITRD" CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_CONSOLE=y ___EOF___ @@ -60,7 +60,7 @@ then exit 2 fi ncpus=`cpus2use.sh` -make O=$builddir -j$ncpus $TORTURE_KMAKE_ARG > $builddir/Make.out 2>&1 +make O=$builddir -j$ncpus $RCU_KMAKE_ARG > $builddir/Make.out 2>&1 retval=$? if test $retval -ne 0 || grep "rcu[^/]*": < $builddir/Make.out | egrep -q "Stop|Error|error:|warning:" || egrep -q "Stop|Error|error:" < $builddir/Make.out then diff --git a/rcutorture/bin/kvm-recheck-lock.sh b/rcutorture/bin/kvm-recheck-lock.sh deleted file mode 100755 index 7f1ff1a..0000000 --- a/rcutorture/bin/kvm-recheck-lock.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# -# Analyze a given results directory for locktorture progress. -# -# Usage: sh kvm-recheck-lock.sh resdir -# -# 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 -# along with this program; if not, you can access it online at -# http://www.gnu.org/licenses/gpl-2.0.html. -# -# Copyright (C) IBM Corporation, 2014 -# -# Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> - -i="$1" -if test -d $i -then - : -else - echo Unreadable results directory: $i - exit 1 -fi - -configfile=`echo $i | sed -e 's/^.*\///'` -ncs=`grep "Writes: Total:" $i/console.log 2> /dev/null | tail -1 | sed -e 's/^.* Total: //' -e 's/ .*$//'` -if test -z "$ncs" -then - echo "$configfile -------" -else - title="$configfile ------- $ncs acquisitions/releases" - dur=`sed -e 's/^.* locktorture.shutdown_secs=//' -e 's/ .*$//' < $i/qemu-cmd 2> /dev/null` - if test -z "$dur" - then - : - else - ncsps=`awk -v ncs=$ncs -v dur=$dur ' - BEGIN { print ncs / dur }' < /dev/null` - title="$title ($ncsps per second)" - fi - echo $title -fi diff --git a/rcutorture/bin/kvm-recheck-rcu.sh b/rcutorture/bin/kvm-recheck-rcu.sh deleted file mode 100755 index 307c4b9..0000000 --- a/rcutorture/bin/kvm-recheck-rcu.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# -# Analyze a given results directory for rcutorture progress. -# -# Usage: sh kvm-recheck-rcu.sh resdir -# -# 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 -# along with this program; if not, you can access it online at -# http://www.gnu.org/licenses/gpl-2.0.html. -# -# Copyright (C) IBM Corporation, 2014 -# -# Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> - -i="$1" -if test -d $i -then - : -else - echo Unreadable results directory: $i - exit 1 -fi - -configfile=`echo $i | sed -e 's/^.*\///'` -ngps=`grep ver: $i/console.log 2> /dev/null | tail -1 | sed -e 's/^.* ver: //' -e 's/ .*$//'` -if test -z "$ngps" -then - echo "$configfile -------" -else - title="$configfile ------- $ngps grace periods" - dur=`sed -e 's/^.* rcutorture.shutdown_secs=//' -e 's/ .*$//' < $i/qemu-cmd 2> /dev/null` - if test -z "$dur" - then - : - else - ngpsps=`awk -v ngps=$ngps -v dur=$dur ' - BEGIN { print ngps / dur }' < /dev/null` - title="$title ($ngpsps per second)" - fi - echo $title -fi diff --git a/rcutorture/bin/kvm-recheck.sh b/rcutorture/bin/kvm-recheck.sh index 3f6c9b7..baef09f 100755 --- a/rcutorture/bin/kvm-recheck.sh +++ b/rcutorture/bin/kvm-recheck.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Given the results directories for previous KVM-based torture runs, +# Given the results directories for previous KVM runs of rcutorture, # check the build and console output for errors. Given a directory # containing results directories, this recursively checks them all. # @@ -25,45 +25,20 @@ # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH -. tools/testing/selftests/rcutorture/bin/functions.sh for rd in "$@" do - firsttime=1 dirs=`find $rd -name Make.defconfig.out -print | sort | sed -e 's,/[^/]*$,,' | sort -u` for i in $dirs do - if test -n "$firsttime" + configfile=`echo $i | sed -e 's/^.*\///'` + echo $configfile + configcheck.sh $i/.config $i/ConfigFragment + parse-build.sh $i/Make.out $configfile + parse-rcutorture.sh $i/console.log $configfile + parse-console.sh $i/console.log $configfile + if test -r $i/Warnings then - firsttime="" - resdir=`echo $i | sed -e 's,/$,,' -e 's,/[^/]*$,,'` - head -1 $resdir/log - fi - TORTURE_SUITE="`cat $i/../TORTURE_SUITE`" - kvm-recheck-${TORTURE_SUITE}.sh $i - if test -f "$i/console.log" - then - configcheck.sh $i/.config $i/ConfigFragment - parse-build.sh $i/Make.out $configfile - parse-torture.sh $i/console.log $configfile - parse-console.sh $i/console.log $configfile - if test -r $i/Warnings - then - cat $i/Warnings - fi - else - if test -f "$i/qemu-cmd" - then - print_bug qemu failed - echo " $i" - elif test -f "$i/buildonly" - then - echo Build-only run, no boot/test - configcheck.sh $i/.config $i/ConfigFragment - parse-build.sh $i/Make.out $configfile - else - print_bug Build failed - echo " $i" - fi + cat $i/Warnings fi done done diff --git a/rcutorture/bin/kvm-test-1-run.sh b/rcutorture/bin/kvm-test-1-rcu.sh index 0f69dcb..151b237 100755 --- a/rcutorture/bin/kvm-test-1-run.sh +++ b/rcutorture/bin/kvm-test-1-rcu.sh @@ -6,15 +6,15 @@ # Execute this in the source tree. Do not run it as a background task # because qemu does not seem to like that much. # -# Usage: sh kvm-test-1-run.sh config builddir resdir minutes qemu-args boot_args +# Usage: sh kvm-test-1-rcu.sh config builddir resdir minutes qemu-args bootargs # -# qemu-args defaults to "-nographic", along with arguments specifying the -# number of CPUs and other options generated from -# the underlying CPU architecture. -# boot_args defaults to value returned by the per_version_boot_params -# shell function. +# qemu-args defaults to "" -- you will want "-nographic" if running headless. +# bootargs defaults to "root=/dev/sda noapic selinux=0 console=ttyS0" +# "initcall_debug debug rcutorture.stat_interval=15" +# "rcutorture.shutdown_secs=$((minutes * 60))" +# "rcutorture.rcutorture_runnable=1" # -# Anything you specify for either qemu-args or boot_args is appended to +# Anything you specify for either qemu-args or bootargs is appended to # the default values. The "-smp" value is deduced from the contents of # the config fragment. # @@ -40,35 +40,32 @@ grace=120 -T=/tmp/kvm-test-1-run.sh.$$ +T=/tmp/kvm-test-1-rcu.sh.$$ trap 'rm -rf $T' 0 -touch $T . $KVM/bin/functions.sh . $KVPATH/ver_functions.sh config_template=${1} -config_dir=`echo $config_template | sed -e 's,/[^/]*$,,'` title=`echo $config_template | sed -e 's/^.*\///'` builddir=${2} if test -z "$builddir" -o ! -d "$builddir" -o ! -w "$builddir" then - echo "kvm-test-1-run.sh :$builddir: Not a writable directory, cannot build into it" + echo "kvm-test-1-rcu.sh :$builddir: Not a writable directory, cannot build into it" exit 1 fi resdir=${3} if test -z "$resdir" -o ! -d "$resdir" -o ! -w "$resdir" then - echo "kvm-test-1-run.sh :$resdir: Not a writable directory, cannot store results into it" + echo "kvm-test-1-rcu.sh :$resdir: Not a writable directory, cannot build into it" exit 1 fi cp $config_template $resdir/ConfigFragment echo ' ---' `date`: Starting build echo ' ---' Kconfig fragment at: $config_template >> $resdir/log -if test -r "$config_dir/CFcommon" -then - cat < $config_dir/CFcommon >> $T -fi +cat << '___EOF___' >> $T +CONFIG_RCU_TORTURE_TEST=y +___EOF___ # Optimizations below this point # CONFIG_USB=n # CONFIG_SECURITY=n @@ -95,36 +92,15 @@ fi # CONFIG_YENTA=n if kvm-build.sh $config_template $builddir $T then - QEMU="`identify_qemu $builddir/vmlinux`" - BOOT_IMAGE="`identify_boot_image $QEMU`" cp $builddir/Make*.out $resdir cp $builddir/.config $resdir - if test -n "$BOOT_IMAGE" - then - cp $builddir/$BOOT_IMAGE $resdir - else - echo No identifiable boot image, not running KVM, see $resdir. - echo Do the torture scripts know about your architecture? - fi + cp $builddir/arch/x86/boot/bzImage $resdir parse-build.sh $resdir/Make.out $title - if test -f $builddir.wait - then - mv $builddir.wait $builddir.ready - fi else cp $builddir/Make*.out $resdir - cp $builddir/.config $resdir || : echo Build failed, not running KVM, see $resdir. - if test -f $builddir.wait - then - mv $builddir.wait $builddir.ready - fi exit 1 fi -while test -f $builddir.ready -do - sleep 1 -done minutes=$4 seconds=$(($minutes * 60)) qemu_args=$5 @@ -132,13 +108,12 @@ boot_args=$6 cd $KVM kstarttime=`awk 'BEGIN { print systime() }' < /dev/null` -if test -z "$TORTURE_BUILDONLY" -then - echo ' ---' `date`: Starting kernel -fi +echo ' ---' `date`: Starting kernel + +# Determine the appropriate flavor of qemu command. +QEMU="`identify_qemu $builddir/vmlinux.o`" # Generate -smp qemu argument. -qemu_args="-nographic $qemu_args" cpu_count=`configNR_CPUS.sh $config_template` vcpus=`identify_qemu_vcpus` if test $cpu_count -gt $vcpus @@ -158,42 +133,34 @@ qemu_append="`identify_qemu_append "$QEMU"`" # Pull in Kconfig-fragment boot parameters boot_args="`configfrag_boot_params "$boot_args" "$config_template"`" -# Generate kernel-version-specific boot parameters -boot_args="`per_version_boot_params "$boot_args" $builddir/.config $seconds`" +# Generate CPU-hotplug boot parameters +boot_args="`rcutorture_param_onoff "$boot_args" $builddir/.config`" +# Generate rcu_barrier() boot parameter +boot_args="`rcutorture_param_n_barrier_cbs "$boot_args"`" +# Pull in standard rcutorture boot arguments +boot_args="$boot_args rcutorture.stat_interval=15 rcutorture.shutdown_secs=$seconds rcutorture.rcutorture_runnable=1" -if test -n "$TORTURE_BUILDONLY" +echo $QEMU $qemu_args -m 512 -kernel $builddir/arch/x86/boot/bzImage -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd +if test -n "$RCU_BUILDONLY" then echo Build-only run specified, boot/test omitted. - touch $resdir/buildonly exit 0 fi -echo $QEMU $qemu_args -m 512 -kernel $builddir/$BOOT_IMAGE -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd -( $QEMU $qemu_args -m 512 -kernel $builddir/$BOOT_IMAGE -append "$qemu_append $boot_args"; echo $? > $resdir/qemu-retval ) & +$QEMU $qemu_args -m 512 -kernel $builddir/arch/x86/boot/bzImage -append "$qemu_append $boot_args" & qemu_pid=$! commandcompleted=0 echo Monitoring qemu job at pid $qemu_pid -while : +for ((i=0;i<$seconds;i++)) do - kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null` if kill -0 $qemu_pid > /dev/null 2>&1 then - if test $kruntime -ge $seconds - then - break; - fi sleep 1 else commandcompleted=1 + kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null` if test $kruntime -lt $seconds then echo Completed in $kruntime vs. $seconds >> $resdir/Warnings 2>&1 - grep "^(qemu) qemu:" $resdir/kvm-test-1-run.sh.out >> $resdir/Warnings 2>&1 - killpid="`sed -n "s/^(qemu) qemu: terminating on signal [0-9]* from pid \([0-9]*\).*$/\1/p" $resdir/Warnings`" - if test -n "$killpid" - then - echo "ps -fp $killpid" >> $resdir/Warnings 2>&1 - ps -fp $killpid >> $resdir/Warnings 2>&1 - fi else echo ' ---' `date`: Kernel done fi @@ -203,25 +170,23 @@ done if test $commandcompleted -eq 0 then echo Grace period for qemu job at pid $qemu_pid - while : + for ((i=0;i<=$grace;i++)) do - kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null` if kill -0 $qemu_pid > /dev/null 2>&1 then - : + sleep 1 else break fi - if test $kruntime -ge $((seconds + grace)) + if test $i -eq $grace then + kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }'` echo "!!! Hang at $kruntime vs. $seconds seconds" >> $resdir/Warnings 2>&1 kill -KILL $qemu_pid - break fi - sleep 1 done fi cp $builddir/console.log $resdir -parse-torture.sh $resdir/console.log $title +parse-rcutorture.sh $resdir/console.log $title parse-console.sh $resdir/console.log $title diff --git a/rcutorture/bin/kvm.sh b/rcutorture/bin/kvm.sh index 589e9c3..1b7923b 100644 --- a/rcutorture/bin/kvm.sh +++ b/rcutorture/bin/kvm.sh @@ -30,22 +30,14 @@ scriptname=$0 args="$*" -T=/tmp/kvm.sh.$$ -trap 'rm -rf $T' 0 -mkdir $T - dur=30 -dryrun="" KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM PATH=${KVM}/bin:$PATH; export PATH -TORTURE_DEFCONFIG=defconfig -TORTURE_BOOT_IMAGE="" -TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD -TORTURE_KMAKE_ARG="" -TORTURE_SUITE=rcu +builddir="${KVM}/b1" +RCU_INITRD="$KVM/initrd"; export RCU_INITRD +RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG resdir="" configs="" -cpus=0 ds=`date +%Y.%m.%d-%H:%M:%S` kversion="" @@ -54,13 +46,10 @@ kversion="" usage () { echo "Usage: $scriptname optional arguments:" echo " --bootargs kernel-boot-arguments" - echo " --bootimage relative-path-to-kernel-boot-image" + echo " --builddir absolute-pathname" echo " --buildonly" echo " --configs \"config-file list\"" - echo " --cpus N" echo " --datestamp string" - echo " --defconfig string" - echo " --dryrun sched|script" echo " --duration minutes" echo " --interactive" echo " --kmake-arg kernel-make-arguments" @@ -70,7 +59,7 @@ usage () { echo " --qemu-args qemu-system-..." echo " --qemu-cmd qemu-system-..." echo " --results absolute-pathname" - echo " --torture rcu" + echo " --relbuilddir relative-pathname" exit 1 } @@ -79,53 +68,39 @@ do case "$1" in --bootargs) checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--' - TORTURE_BOOTARGS="$2" + RCU_BOOTARGS="$2" shift ;; - --bootimage) - checkarg --bootimage "(relative path to kernel boot image)" "$#" "$2" '[a-zA-Z0-9][a-zA-Z0-9_]*' '^--' - TORTURE_BOOT_IMAGE="$2" + --builddir) + checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' '^error' + builddir=$2 + gotbuilddir=1 shift ;; --buildonly) - TORTURE_BUILDONLY=1 + RCU_BUILDONLY=1; export RCU_BUILDONLY ;; --configs) checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--' configs="$2" shift ;; - --cpus) - checkarg --cpus "(number)" "$#" "$2" '^[0-9]*$' '^--' - cpus=$2 - shift - ;; --datestamp) checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' ds=$2 shift ;; - --defconfig) - checkarg --defconfig "defconfigtype" "$#" "$2" '^[^/][^/]*$' '^--' - TORTURE_DEFCONFIG=$2 - shift - ;; - --dryrun) - checkarg --dryrun "sched|script" $# "$2" 'sched\|script' '^--' - dryrun=$2 - shift - ;; --duration) checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error' dur=$2 shift ;; --interactive) - TORTURE_QEMU_INTERACTIVE=1; export TORTURE_QEMU_INTERACTIVE + RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE ;; --kmake-arg) checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$' - TORTURE_KMAKE_ARG="$2" + RCU_KMAKE_ARG="$2"; export RCU_KMAKE_ARG shift ;; --kversion) @@ -135,20 +110,27 @@ do ;; --mac) checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error - TORTURE_QEMU_MAC=$2 + RCU_QEMU_MAC=$2; export RCU_QEMU_MAC shift ;; --no-initrd) - TORTURE_INITRD=""; export TORTURE_INITRD + RCU_INITRD=""; export RCU_INITRD ;; --qemu-args) checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error' - TORTURE_QEMU_ARG="$2" + RCU_QEMU_ARG="$2" shift ;; --qemu-cmd) checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--' - TORTURE_QEMU_CMD="$2" + RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD + shift + ;; + --relbuilddir) + checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' + relbuilddir=$2 + gotrelbuilddir=1 + builddir=${KVM}/${relbuilddir} shift ;; --results) @@ -156,11 +138,6 @@ do resdir=$2 shift ;; - --torture) - checkarg --torture "(suite name)" "$#" "$2" '^\(lock\|rcu\)$' '^--' - TORTURE_SUITE=$2 - shift - ;; *) echo Unknown argument $1 usage @@ -169,7 +146,7 @@ do shift done -CONFIGFRAG=${KVM}/configs/${TORTURE_SUITE}; export CONFIGFRAG +CONFIGFRAG=${KVM}/configs; export CONFIGFRAG KVPATH=${CONFIGFRAG}/$kversion; export KVPATH if test -z "$configs" @@ -180,234 +157,54 @@ fi if test -z "$resdir" then resdir=$KVM/res -fi - -# Create a file of test-name/#cpus pairs, sorted by decreasing #cpus. -touch $T/cfgcpu -for CF in $configs -do - if test -f "$CONFIGFRAG/$kversion/$CF" + if ! test -e $resdir then - echo $CF `configNR_CPUS.sh $CONFIGFRAG/$kversion/$CF` >> $T/cfgcpu - else - echo "The --configs file $CF does not exist, terminating." - exit 1 + mkdir $resdir || : + fi +else + if ! test -e $resdir + then + mkdir -p "$resdir" || : fi -done -sort -k2nr $T/cfgcpu > $T/cfgcpu.sort - -# Use a greedy bin-packing algorithm, sorting the list accordingly. -awk < $T/cfgcpu.sort > $T/cfgcpu.pack -v ncpus=$cpus ' -BEGIN { - njobs = 0; -} - -{ - # Read file of tests and corresponding required numbers of CPUs. - cf[njobs] = $1; - cpus[njobs] = $2; - njobs++; -} - -END { - alldone = 0; - batch = 0; - nc = -1; - - # 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. - while (nc != ncpus) { - batch++; - nc = ncpus; - - # Each pass through the following loop considers one - # test for inclusion in the current batch. - for (i = 0; i < njobs; i++) { - if (done[i]) - continue; # Already part of a batch. - if (nc >= cpus[i] || nc == ncpus) { - - # This test fits into the current batch. - done[i] = batch; - nc -= cpus[i]; - if (nc <= 0) - break; # Too-big test in its own batch. - } - } - } - - # Dump out the tests in batch order. - for (b = 1; b <= batch; b++) - for (i = 0; i < njobs; i++) - if (done[i] == b) - print cf[i], cpus[i]; -}' - -# Generate a script to execute the tests in appropriate batches. -cat << ___EOF___ > $T/script -CONFIGFRAG="$CONFIGFRAG"; export CONFIGFRAG -KVM="$KVM"; export KVM -KVPATH="$KVPATH"; export KVPATH -PATH="$PATH"; export PATH -TORTURE_BOOT_IMAGE="$TORTURE_BOOT_IMAGE"; export TORTURE_BOOT_IMAGE -TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY -TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG -TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD -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 -TORTURE_SUITE="$TORTURE_SUITE"; export TORTURE_SUITE -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 - if ! git diff HEAD > $T/git-diff 2>&1 - then - cp $T/git-diff $resdir/$ds - fi fi -___EOF___ -awk < $T/cfgcpu.pack \ - -v CONFIGDIR="$CONFIGFRAG/$kversion/" \ - -v KVM="$KVM" \ - -v ncpus=$cpus \ - -v rd=$resdir/$ds/ \ - -v dur=$dur \ - -v TORTURE_QEMU_ARG="$TORTURE_QEMU_ARG" \ - -v TORTURE_BOOTARGS="$TORTURE_BOOTARGS" \ -'BEGIN { - i = 0; -} - -{ - cf[i] = $1; - cpus[i] = $2; - i++; -} +builddir=$KVM/b1 +if ! test -e $builddir +then + mkdir $builddir || : +fi -# Dump out the scripting required to run one test batch. -function dump(first, pastlast) -{ - print "echo ----Start batch: `date`"; - print "echo ----Start batch: `date` >> " rd "/log"; - jn=1 - for (j = first; j < pastlast; j++) { - builddir=KVM "/b" jn - cpusr[jn] = cpus[j]; - if (cfrep[cf[j]] == "") { - cfr[jn] = cf[j]; - cfrep[cf[j]] = 1; - } else { - cfrep[cf[j]]++; - cfr[jn] = cf[j] "." cfrep[cf[j]]; - } - if (cpusr[jn] > ncpus && ncpus != 0) - ovf = "(!)"; +for CF in $configs +do + # Running TREE01 multiple times creates TREE01, TREE01.2, TREE01.3, ... + rd=$resdir/$ds/$CF + if test -d "${rd}" + then + n="`ls -d "${rd}"* | grep '\.[0-9]\+$' | + sed -e 's/^.*\.\([0-9]\+\)/\1/' | + sort -k1n | tail -1`" + if test -z "$n" + then + rd="${rd}.2" else - ovf = ""; - print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date`"; - print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date` >> " rd "/log"; - print "rm -f " builddir ".*"; - print "touch " builddir ".wait"; - print "mkdir " builddir " > /dev/null 2>&1 || :"; - print "mkdir " rd cfr[jn] " || :"; - 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 &" - print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date`"; - print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date` >> " 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`"; - print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date` >> " rd "/log"; - jn++; - } - for (j = 1; j < jn; j++) { - builddir=KVM "/b" j - print "rm -f " builddir ".ready" - print "if test -z \"$TORTURE_BUILDONLY\"" - print "then" - print "\techo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date`"; - print "\techo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date` >> " rd "/log"; - print "fi" - } - print "wait" - print "if test -z \"$TORTURE_BUILDONLY\"" - print "then" - print "\techo ---- All kernel runs complete. `date`"; - print "\techo ---- All kernel runs complete. `date` >> " rd "/log"; - print "fi" - for (j = 1; j < jn; j++) { - builddir=KVM "/b" j - print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results:"; - print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results: >> " rd "/log"; - print "cat " rd cfr[j] "/kvm-test-1-run.sh.out"; - print "cat " rd cfr[j] "/kvm-test-1-run.sh.out >> " rd "/log"; - } -} - -END { - njobs = i; - nc = ncpus; - first = 0; - - # Each pass through the following loop considers one test. - for (i = 0; i < njobs; i++) { - if (ncpus == 0) { - # Sequential test specified, each test its own batch. - dump(i, i + 1); - first = i; - } else if (nc < cpus[i] && i != 0) { - # Out of CPUs, dump out a batch. - dump(first, i); - first = i; - nc = ncpus; - } - # Account for the CPUs needed by the current test. - nc -= cpus[i]; - } - # Dump the last batch. - if (ncpus != 0) - dump(first, i); -}' >> $T/script + n="`expr $n + 1`" + rd="${rd}.${n}" + fi + fi + mkdir "${rd}" + echo Results directory: $rd + kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur "-nographic $RCU_QEMU_ARG" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1 $RCU_BOOTARGS" +done +# 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 -cat << ___EOF___ >> $T/script -echo -echo echo " --- `date` Test summary:" -echo Results directory: $resdir/$ds kvm-recheck.sh $resdir/$ds -___EOF___ - -if test "$dryrun" = script -then - cat $T/script - exit 0 -elif test "$dryrun" = sched -then - # Extract the test run schedule from the script. - egrep 'Start batch|Starting build\.' $T/script | - grep -v ">>" | - sed -e 's/:.*$//' -e 's/^echo //' - exit 0 -else - # Not a dryrun, so run the script. - sh $T/script -fi - -# 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 diff --git a/rcutorture/bin/parse-torture.sh b/rcutorture/bin/parse-rcutorture.sh index 3455560..dd0a275 100755 --- a/rcutorture/bin/parse-torture.sh +++ b/rcutorture/bin/parse-rcutorture.sh @@ -1,14 +1,14 @@ #!/bin/sh # -# Check the console output from a torture run for goodness. +# Check the console output from an rcutorture run for goodness. # The "file" is a pathname on the local system, and "title" is # a text string for error-message purposes. # -# The file must contain torture output, but can be interspersed -# with other dmesg text, as in console-log output. +# The file must contain rcutorture output, but can be interspersed +# with other dmesg text. # # Usage: -# sh parse-torture.sh file title +# sh parse-rcutorture.sh file title # # 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 @@ -28,7 +28,7 @@ # # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> -T=/tmp/parse-torture.sh.$$ +T=/tmp/parse-rcutorture.sh.$$ file="$1" title="$2" @@ -36,13 +36,13 @@ trap 'rm -f $T.seq' 0 . functions.sh -# check for presence of torture output file. +# check for presence of rcutorture.txt file if test -f "$file" -a -r "$file" then : else - echo $title unreadable torture output file: $file + echo $title unreadable rcutorture.txt file: $file exit 1 fi @@ -76,9 +76,9 @@ BEGIN { END { if (badseq) { if (badseqno1 == badseqno2 && badseqno2 == ver) - print "GP HANG at " ver " torture stat " badseqnr; + print "RCU GP HANG at " ver " rcutorture stat " badseqnr; else - print "BAD SEQ " badseqno1 ":" badseqno2 " last:" ver " version " badseqnr; + print "BAD SEQ " badseqno1 ":" badseqno2 " last:" ver " RCU version " badseqnr; } }' > $T.seq @@ -91,13 +91,13 @@ then exit 2 fi else - if grep -q "_HOTPLUG:" $file + if grep -q RCU_HOTPLUG $file then print_warning HOTPLUG FAILURES $title `cat $T.seq` echo " " $file exit 3 fi - echo $title no success message, `grep --binary-files=text 'ver:' $file | wc -l` successful version messages + echo $title no success message, `grep --binary-files=text 'ver:' $file | wc -l` successful RCU version messages if test -s $T.seq then print_warning $title `cat $T.seq` |