summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/rcutorture
AgeCommit message (Collapse)Author
2021-01-06torture: Enable torture.sh argument checkingPaul E. McKenney
This commit uncomments the argument checking for the --duration argument to torture.sh. While in the area, it also corrects the duration units from seconds to minutes. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-06torture: Auto-size SCF and scaling runs based on number of CPUsPaul E. McKenney
This commit improves torture.sh flexibility by autoscaling the number of CPUs to be used in variable-CPUs torture tests, including scftorture, refscale, rcuscale, and kvfree. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-06torture: Add "make allmodconfig" to torture.shPaul E. McKenney
This commit adds the ability to do "make allmodconfig" to torture.sh, given that normal rcutorture runs do not normally catch missing exports. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-06torture: Remove use of "eval" in torture.shPaul E. McKenney
The bash "eval" command enables Bobby Tables attacks, which might not be a concern in torture testing by themselves, but one could imagine these combined with a cut-and-paste attack. This commit therefore gets rid of them. This comes at a price in terms of bash quoting not working nicely, so the "--bootargs" argument lists are now passed to torture_one via a bash-variable side channel. This might be a bit ugly, but it will also allow torture.sh to grow its own --bootargs parameter. While in the area, add proper header comments for the bash functions. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-06torture: Make torture.sh use common time-duration bash functionsPaul E. McKenney
This commit makes torture.sh use the new bash functions get_starttime() and get_starttime_duration() created for kvm.sh. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-06torture: Add torture.sh torture-everything scriptPaul E. McKenney
Although tailoring a specific set of kvm.sh runs has served rcutorture testing well over many years, it requires a relatively distraction-free environment, which is not always available. This commit therefore adds a prototype torture.sh script that by default tortures pretty much everything the rcutorture scripting is designed to torture, and which can be given command-line arguments to take a more focused approach. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-05torture: Do Kconfig analysis only once per scenarioPaul E. McKenney
Currently, if a scenario is repeated as in "--configs '4*TREE01'", the Kconfig analysis is performed for each occurrance (four times in this example) and each analysis places the exact same data into the exact same files. This is not really an issue in this repetition-four example, but it can needlessly consume tens of seconds of wallclock time for something like "--config '128*TINY01'". This commit therefore does Kconfig analysis only once per set of repeats of a given scenario, courtesy of the "sort -u" command and an automatically generated awk script. While in the area, this commit also wordsmiths a comment. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Allow standalone kvm-recheck.sh run detect --trust-makePaul E. McKenney
Normally, kvm-recheck.sh is run from kvm.sh, which provides the TORTURE_TRUST_MAKE environment variable that, if a non-empty string, indicates that the --trust-make command-line parameter has been passed to kvm.sh. If there was no --trust-make, kvm-recheck.sh insists that the Make.out file contain at least one "CC" command. Thus, when kvm-recheck.sh is run standalone to evaluate a prior --trust-make run, it will incorrectly insist that a proper kernel build did not happen. This commit therefore causes kvm-recheck.sh to also search the "log" file in the top-level results directory for the string "--trust-make". Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Remove "Failed to add ttynull console" false positivePaul E. McKenney
Commit 757055ae8ded ("init/console: Use ttynull as a fallback when there is no console") results in the string "Warning: Failed to add ttynull console. No stdin, stdout, and stderr for the init process!" appearing on the console, which the rcutorture scripting interprets as a warning, which causes every rcutorture run to be flagged. However, the rcutorture init process never attempts to do any I/O, and thus does not care that it has no stdin, stdout, or stderr. This commit therefore causes the rcutorture scripting to ignore this message. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Simplify exit-code plumbing for kvm-recheck.sh and kvm-find-errors.shPaul E. McKenney
This commit simplifies exit-code plumbing. It makes kvm-recheck.sh return the value 1 for a build error and 2 for a runtime error. It also makes kvm-find-errors.sh avoid checking runtime files for --build-only runs. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: s/STOP/STOP.1/ to avoid scenario collisionPaul E. McKenney
This commit changes the "STOP" file that is used to cleanly halt a running rcutorture run to "STOP.1" because no scenario directory will ever end with ".1". If there really was a scenario named "STOP", its directories would instead be named "STOP", "STOP.2", "STOP.3", and so on. While in the area, the commit also changes the kernel-run-time checks for this file to look directly in the directory above $resdir, thus avoiding the need to pass the TORTURE_STOPFILE environment variable to remote systems. While in the area, move the STOP.1 file to the top-level directory covering all of the scenarios. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Add --dryrun batches to help schedule a distributed runPaul E. McKenney
When all of the remote systems have the same number of CPUs, one approach is to use one "--buildonly" run and one "--dryrun sched" run, and then distributing the batches out one per remote system. However, the output of "--dryrun sched" is not made for parsing, so this commit adds a "--dryrun batches" that provides the same information in easily parsed form. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Stop hanging on panicPaul E. McKenney
By default, the "panic" kernel parameter is zero, which causes the kernel to loop indefinitely after a panic(). The rcutorture scripting will eventually kill the corresponding qemu process, but only after waiting for the full run duration plus a few minutes. This works, but delays notifying the developer of the failure. This commit therefore causes the rcutorture scripting to pass the "panic=-1" kernel parameter, which caused the kernel to instead unceremoniously shut down immediately. This in turn causes qemu to terminate, so that if all of the runs in a given batch panic(), the rcutorture scripting can immediately proceed to the next batch. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Add kvm.sh test summary to end of log filePaul E. McKenney
This commit adds the test summary to the end of the log in the top-level directory containing the kvm.sh test artifacts. While in the area, it adds the kvm.sh exit code to this test summary. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Make kvm.sh include --kconfig arguments in CPU calculationPaul E. McKenney
Currently, passing something like "--kconfig CONFIG_NR_CPUS=2" to kvm.sh has no effect on scenario scheduling. For scenarios that do not specify the number of CPUs, this can result in kvm.sh wastefully scheduling only one scenario at a time even when the --kconfig argument would allow a number to be run concurrently. This commit therefore makes kvm.sh consider the --kconfig arguments when scheduling scenarios across the available CPUs. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Make kvm.sh return failure upon build failurePaul E. McKenney
The kvm.sh script uses kvm-find-errors.sh to evaluate whether or not a build failed. Unfortunately, kvm-find-errors.sh returns success if there are no failed runs (including when there are no runs at all) even if there are build failures. This commit therefore makes kvm-find-errors.sh return failure in response to build failures. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Print run duration at end of kvm.sh executionPaul E. McKenney
Yes, you can mentally subtract the timestamps, but this commit makes the computer do this work. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Make kvm.sh arguments accumulatePaul E. McKenney
Given that kvm.sh in invoked from scripts, it is only natural for different levels of scripting to provide their own Kconfig option values, for example. Unfortunately, right now, the last such argument on the command line wins. This commit therefore makes the --bootargs, --configs, --kconfigs, --kmake-args, and --qemu-args argument values accumulate. For example, where "--configs TREE01 --configs TREE02" would previously have run only scenario TREE02, now it will run both scenarios. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Make kvm.sh "Test Summary" date be end of testPaul E. McKenney
Currently, the "date" command producing the output on the kvm.sh "Test Summary" line is executed at the beginning of the test, which produces a date that is less than helpful to someone wanting to know the duration of the test. This commit therefore defers this command's execution to the end of the test. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04tools/rcutorture: Make identify_qemu_vcpus() independent of local languageFrederic Weisbecker
The rcutorture scripts' identify_qemu_vcpus() function expects `lscpu` to have a "CPU: " line, for example: CPU(s): 8 But different local language settings can give different results: Processeur(s) : 8 As a result, identify_qemu_vcpus() may return an empty string, resulting in the following warning (with the same local language settings): kvm-test-1-run.sh: ligne 138 : test: : nombre entier attendu comme expression This commit therefore changes identify_qemu_vcpus() to use getconf, which produces local-language-independend output. Cc: Josh Triplett <josh@joshtriplett.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Lai Jiangshan <jiangshanlai@gmail.com> Cc: rcu@vger.kernel.org Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Add config2csv.sh script to compare torture scenariosPaul E. McKenney
This commit adds a config2csv.sh script that converts the specified torture-test scenarios' Kconfig options and kernel-boot parameters to .csv format. This allows easier comparison of scenarios when one fails and another does not. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Prepare for splitting qemu execution from kvm-test-1-run.shPaul E. McKenney
Distributed execution of rcutorture is eased if the qemu execution can be split from the building of the kernel, as this allows target systems to be used that are not set up to build kernels. It also avoids issues with toolchain version skew across the cluster, aside of course from qemu and KVM version skew. This commit therefore records needed data as comments in the qemu-cmd file and moves recording of the starting time to just before qemu is launched. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Allow kvm.sh --datestamp to specify subdirectoriesPaul E. McKenney
Scripts like kvm-check-branches.sh group runs under a single directory in resdir in order to allow easier retrospective analysis. However, they do this by letting kvm.sh create a directory as usual and then moving it after the run. This can be very confusing when looking at the results while kvm-check-branches.sh is running. This commit therefore enables --datestamp to hand subdirectories to kvm.sh. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Make kvm.sh "--dryrun sched" summarize number of buildsPaul E. McKenney
Knowing the number of builds that kvm.sh will split a run into allows estimation of the duration of a test, give or take build duration. This commit therefore adds a line of output to "--dryrun sched" that gives the number of builds that will be run. This excludes "builds" for repeated scenarios that reuse an earlier build. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Make kvm.sh "--dryrun sched" summarize number of batchesPaul E. McKenney
Knowing the number of batches that kvm.sh will split a run into allows estimation of the duration of a test, give or take the number of builds. This commit therefore adds a line of output to "--dryrun sched" that gives the number of batches that will be run. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Make --kcsan specify lockdepPaul E. McKenney
The --kcsan argument to kvm.sh adds CONFIG_KCSAN_VERBOSE=y in order to get more detail from the KCSAN reports. However, this Kconfig option requires lockdep to be enabled. This commit therefore causes --kcsan to also enable lockdep. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-11-19Merge branches 'cpuinfo.2020.11.06a', 'doc.2020.11.06a', ↵Paul E. McKenney
'fixes.2020.11.19b', 'lockdep.2020.11.02a', 'tasks.2020.11.06a' and 'torture.2020.11.06a' into HEAD cpuinfo.2020.11.06a: Speedups for /proc/cpuinfo. doc.2020.11.06a: Documentation updates. fixes.2020.11.19b: Miscellaneous fixes. lockdep.2020.11.02a: Lockdep-RCU updates to avoid "unused variable". tasks.2020.11.06a: Tasks-RCU updates. torture.2020.11.06a': Torture-test updates.
2020-11-06tools/rcutorture: Fix BUG parsing of console.logAnna-Maria Behnsen
For the rcutorture test summary log file console.log of virtual machines is parsed. When a console.log contains "DEBUG", BUG counter is incremented because regular expression does not handle to ignore DEBUG. Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de> Reviewed-by: Benedikt Spranger <b.spranger@linutronix.de> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-11-06torture: Make kvm-check-branches.sh use --allcpusPaul E. McKenney
Currently the kvm-check-branches.sh script calculates the number of CPUs and passes this to the kvm.sh --cpus command-line argument. This works, but this commit saves a line by instead using the new kvm.sh --allcpus command-line argument. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-11-06torture: Allow alternative forms of kvm.sh command-line argumentsPaul E. McKenney
This commit allows --build-only as a synonym for --buildonly, --kconfigs for --kconfig, and --kmake-args for --kmake-arg. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-11-06torture: Accept time units on kvm.sh --duration argumentPaul E. McKenney
The "--duration <minutes>" has worked well for a very long time, but it can be inconvenient to compute the minutes for (say) a 28-hour run. It can also be annoying to have to let a simple boot test run for a full minute. This commit therefore permits an "s" suffix to specify seconds, "m" to specify minutes (which remains the default), "h" suffix to specify hours, and "d" to specify days. With this change, "--duration 5" still specifies that each scenario run for five minutes, but "--duration 30s" runs for only 30 seconds, "--duration 8h" runs for eight hours, and "--duration 2d" runs for two days. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-11-06torture: Force weak-hashed pointers on console logPaul E. McKenney
Although the rcutorture scripting now deals correctly with full-up security-induced pointer obfuscation, it is still counter-productive for kernel hackers who are analyzing console output. This commit therefore sets the debug_boot_weak_hash kernel boot parameter, which enables printing of weak-hashed pointers for torture-test runs. Please note that this change applies only to runs initiated by the kvm.sh scripting. If you are instead using modprobe and rmmod, it is your responsibility to build and boot the underlying kernel to your taste. Please note further that this change does not result in a security hole in normal use. The rcutorture testing runs with a negligible userspace, no networking, and no user interaction. Besides which, there is no data of value that can be extracted from an rcutorture guest OS that could not also be extracted from the host that this guest is running on. Suggested-by: Anna-Maria Gleixner <anna-maria@linutronix.de> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-11-06torture: Prevent jitter processes from delaying failed runPaul E. McKenney
Even when the kernel panics and qemu dies, runs with jitter enabled will continue uselessly until the jitter.sh processes terminate. This can be annoying if a planned one-hour run instead dies during boot. This commit therefore kills the jitter.sh processes when the run ends more than one minute prior to the termination time specified by the kvm.sh --duration argument or its default. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-11-06rcutorture: Adjust scenarios SRCU-t and SRCU-u to make kconfig happyPaul E. McKenney
The SRCU-u scenario expects to enable lockdep but to also disable the CONFIG_PREEMPT_COUNT kconfig option. This no longer works. This commit therefore instead enables lockdep in SRCU-t, which then allows SRCU-u to disable CONFIG_PREEMPT_COUNT. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-11-06torture: Exclude "NOHZ tick-stop error" from fatal errorsPaul E. McKenney
The "NOHZ tick-stop error: Non-RCU local softirq work is pending" warning happens frequently and appears to be irrelevant to the various torture tests. This commit therefore filters it out. If there proves to be a need to pay attention to it a later commit will add an "advice" category to allow the user to immediately see that although something happened, it was not an indictment of the system being tortured. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-11-06rcuscale: Avoid divide by zeroPaul E. McKenney
The rcuscale test module does not use batches, so there is only ever one batch. This commit therefore informs the kvm-recheck-rcuscale.sh script of this fact of life. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-11-06rcuscale: Add RCU Tasks TracePaul E. McKenney
This commit adds the ability to test performance and scalability of RCU Tasks Trace updaters. Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-11-02torture: Don't kill gdb sessionsPaul E. McKenney
The rcutorture scripting will do a "kill -9" on any guest OS that exceeds its --duration by more than a few minutes, which is very valuable when bugs result in hangs. However, this is a problem when the "hang" was due to a --gdb debugging session. This commit therefore refrains from killing the guest OS when a debugging session is in progress. This means that the user must manually kill the kvm.sh process group if a hang really does occur. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-11-02rcutorture: Make preemptible TRACE02 enable lockdepPaul E. McKenney
Currently, the CONFIG_PREEMPT_NONE=y rcutorture TRACE01 rcutorture scenario enables lockdep. This limits its ability to find bugs due to non-preemptible sections of code being RCU readers, and pretty much all code thus appearing to lockdep to be an RCU reader. This commit therefore moves lockdep testing to the CONFIG_PREEMPT=y rcutorture TRACE02 scenario. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-09-03Merge branch 'scftorture.2020.08.24a' into HEADPaul E. McKenney
scftorture.2020.08.24a: Torture tests for smp_call_function() and friends.
2020-08-24torture: Add gdb supportPaul E. McKenney
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-24torture: Add kvm.sh --help and update help messagePaul E. McKenney
This commit adds a --help argument (along with its synonym -h) to display the help text. While in the area, this commit also updates the help text. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-08-24rcutorture: Add CONFIG_PROVE_RCU_LIST to TREE05Paul E. McKenney
Currently, the CONFIG_PROVE_RCU_LIST=y case is untested. This commit therefore adds CONFIG_PROVE_RCU_LIST=y to rcutorture's TREE05 scenario. Cc: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com> Cc: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-08-24torture: Update initrd documentationPaul E. McKenney
The rcu-test-image.txt documentation covers a very uncommon case where a real userspace environment is required. However, someone reading this document might reasonably conclude that this is in fact a prerequisite. In addition, the initrd.txt file mentions dracut, which is no longer used. This commit therefore provides the needed updates. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-08-24rcutorture: Replace HTTP links with HTTPS onesAlexander A. Klimov
Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-08-24torture: document --allcpus argument added to the kvm.sh scriptPaul Gortmaker
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-08-24rcuperf: Change rcuperf to rcuscalePaul E. McKenney
This commit further avoids conflation of rcuperf with the kernel's perf feature by renaming kernel/rcu/rcuperf.c to kernel/rcu/rcuscale.c, and also by similarly renaming the functions and variables inside this file. This has the side effect of changing the names of the kernel boot parameters, so kernel-parameters.txt and ver_functions.sh are also updated. The rcutorture --torture type was also updated from rcuperf to rcuscale. [ paulmck: Fix bugs located by Stephen Rothwell. ] Reported-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-08-24torture: Add scftorture to the rcutorture scriptingPaul E. McKenney
This commit updates the rcutorture scripting to include the new scftorture torture-test module. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-08-24torture: Declare parse-console.sh independence from rcutorturePaul E. McKenney
Currently, parse-torture.sh looks at the fifth field of torture-test console output for the version number. This works fine for rcutorture, but not for scftorture, which lacks the pointer field. This commit therefore adjusts matching lines so that the parse-console.sh awk script always sees the version number as the first field in the lines passed to it. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-06-29Merge branches 'doc.2020.06.29a', 'fixes.2020.06.29a', ↵Paul E. McKenney
'kfree_rcu.2020.06.29a', 'rcu-tasks.2020.06.29a', 'scale.2020.06.29a', 'srcu.2020.06.29a' and 'torture.2020.06.29a' into HEAD doc.2020.06.29a: Documentation updates. fixes.2020.06.29a: Miscellaneous fixes. kfree_rcu.2020.06.29a: kfree_rcu() updates. rcu-tasks.2020.06.29a: RCU Tasks updates. scale.2020.06.29a: Read-side scalability tests. srcu.2020.06.29a: SRCU updates. torture.2020.06.29a: Torture-test updates.