aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/rcutorture/bin/functions.sh (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-04-11torture: Make thread detection more robust by using lspcuPaul Menzel1-1/+1
For consecutive numbers the lscpu command collapses the output and just shows the range with start and end. The processors are numbered that way on POWER8. $ sudo ppc64_cpu --smt=8 $ lscpu | grep '^NUMA node' NUMA node(s): 2 NUMA node0 CPU(s): 0-79 NUMA node8 CPU(s): 80-159 This causes the heuristic to detect the number threads per core, looking for the number after the first comma, to fail, and QEMU aborts because of invalid arguments. $ lscpu | grep '^NUMA node0' | sed -e 's/^[^,-]*(,|\-)\([0-9]*\),.*$/\1/' NUMA node0 CPU(s): 0-79 But the lscpu command shows the number of threads per core: $ sudo ppc64_cpu --smt=8 $ lscpu | grep 'Thread(s) per core' Thread(s) per core: 8 $ sudo ppc64_cpu --smt=off $ lscpu | grep 'Thread(s) per core' Thread(s) per core: 1 This commit therefore directly uses that value and replaces use of grep with "sed -n" and its "p" command. Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2021-01-04torture: Stop hanging on panicPaul E. McKenney1-0/+1
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: Print run duration at end of kvm.sh executionPaul E. McKenney1-0/+33
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-04tools/rcutorture: Make identify_qemu_vcpus() independent of local languageFrederic Weisbecker1-1/+1
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>
2020-11-06torture: Force weak-hashed pointers on console logPaul E. McKenney1-0/+1
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-06-29torture: Remove whitespace from identify_qemu_vcpus outputPaul E. McKenney1-1/+1
The identify_qemu_vcpus bash function can return numbers including whitespace characters, which can be a bit annoying in some bash dollar-sign substitutions. This commit therefore strips all spaces and tabs from the value that identify_qemu_vcpus outputs. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2020-06-29torture: Remove qemu dependency on EFI firmwarePaul E. McKenney1-3/+18
On some (probably misconfigured) systems, the torture-test scripting will cause qemu to complain about missing EFI firmware, often because qemu is trying to traverse broken symbolic links to find that firmware. Which is a bit silly given that the default torture-test guest OS has but a single binary for its userspace, and thus is unlikely to do much in the way of networking in any case. This commit therefore avoids such problems by specifying "-net none" to qemu unless the TORTURE_QEMU_INTERACTIVE environment variable is set (for example, by having specified "--interactive" to kvm.sh), in which case "-net nic -net user" is specified to qemu instead. Either choice may be overridden by specifying the "-net" argument of your choice to the kvm.sh "--qemu-args" parameter. Link: https://lore.kernel.org/lkml/20190701141403.GA246562@google.com Reported-by: Joel Fernandes <joel@joelfernandes.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
2020-02-20locktorture: Allow CPU-hotplug to be disabled via --bootargsPaul E. McKenney1-1/+1
The bootparam_hotplug_cpu() bash function was checking for CPU-hotplug kernel-boot parameters from --bootargs, but that check was specific to rcutorture ("rcutorture\.onoff_"). This commit therefore makes this check also work for locktorture ("torture\.onoff_"). Note that rcuperf does not do CPU-hotplug operations, so it is not necessary to make a similar change for rcuperf. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2019-05-28rcutorture: Tweak kvm optionsSebastian Andrzej Siewior1-1/+12
In one of my rcutorture tests the TSC clocksource got marked unstable due to a large difference in the TSC value. I'm not sure if the guest run for a long time with disabled interrupts or if the host was very busy and didn't schedule the guest for some time. I took a look on the qemu/KVM options and decided to update the options: - Use kvm{32|64} as CPU. We could probably use `host' (like ARM does) for maximum available features but since we don't run any userland I'm not sure if it makes any difference. - Drop the "noapic" option. There is no history why the APIC was disabled, I see no reason for it. Once old qemu versions fade away, we can add "x2apic=on,tsc-deadline=on,hypervisor=on,tsc_adjust=on". - Additional config options. It ensures that the kernel knowns that it runs as a kvm guest and can use virt devices like the kvm-clock as clocksource. The kvm-clock was the main motivation here. - I didn't add a random HW device. It would make the random device ready earlier (not it doesn't complete the initialisation at all) but I doubt that there is any need for this. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> [ paulmck: The world is not quite ready for CONFIG_PARAVIRT_SPINLOCKS=y and x2apic, so they are omitted for the time being. ] Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
2019-03-26tools/.../rcutorture: Convert to SPDX license identifierPaul E. McKenney1-15/+2
Replace the license boiler plate with a SPDX license identifier. While in the area, update an email address and add copyright notices. Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
2018-02-20rcutorture: Add basic ARM64 support to run scriptsLihao Liang1-2/+15
This commit adds support of the qemu command qemu-system-aarch64 to rcutorture. Signed-off-by: Lihao Liang <lianglihao@huawei.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
2017-07-24rcutorture: Use nr_cpus rather than maxcpus to limit test sizePaul E. McKenney1-1/+26
The maxcpus= kernel boot parameter limits the number of CPUs brought online at boot time, but it does nothing to prevent additional CPUs from being brought up later. Placing a hard cap on the total number of CPUs is instead the job of the nr_cpus= boot parameter. This commit therefore switches the configfrag_boot_cpus() shell function from maxcpus= to nr_cpus=. This commit also adds a nr_cpus=43 kernel parameter to RCU's TREE01 test scenario, but retains the maxcpus=8 kernel parameter in order to test the ability of RCU expedited grace periods to handle new CPUs coming online for the first time during grace-period initialization. Finally, this commit makes the torture scheduling allow maxcpus= to override other means of specifying the number of CPUs to allow for. This last works because the torture kernel modules size their workloads based on the number of CPUs present at the start of the test, not the ultimate number of CPUs. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
2016-06-14rcutorture: Drop "-soundhw pcspkr" from x86 boot argumentsPaul E. McKenney1-1/+0
Because recent testing shows that "-soundhw pcspkr" is no longer required in the kernel boot arguments, this commit drops this qemu argument. Reported-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
2016-06-14rcutorture: Don't specify the cpu type of QEMU on PPCBoqun Feng1-1/+1
Do not restrict the cpu type to POWER7 for QEMU as we have POWER8 now. Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
2016-06-14rcutorture: Make -soundhw a x86 specific optionBoqun Feng1-0/+1
The option "-soundhw pcspk" gives me a error on PPC as follow: qemu-system-ppc64: ISA bus not available for pcspk This means this option doesn't work on ppc by default. So simply make this an x86-specific option via identify_qemu_args(). Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
2016-06-14rcutorture: Use vmlinux as the fallback kernel imageBoqun Feng1-6/+4
The vmlinux image is available for all the architectures, and suitable for running a KVM guest by QEMU, besides, we used to copy the vmlinux to $resdir anyway. Therefore it makes sense to use it as the fallback kernel image for rcutorture KVM tests. This patch makes identify_boot_image() return vmlinux if ${TORTURE_BOOT_IMAGE} is not set on non-x86 architectures, also fixes several places that hard-code "bzImage" as $KERNEL. This also fixes a problem that PPC doesn't have a bzImage file as build results. Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
2014-09-07rcutorture: Specify MAXSMP=y for TREE01Paul E. McKenney1-0/+20
Setting CONFIG_MAXSMP=y causes cpumasks to be moved offstack, which introduces the possibility of NULL cpumask_var_t pointers. This commit therefore enables CONFIG_MAXSMP=y in TREE01 to increase test coverage. However, because CONFIG_MAXSMP=y implies 8192 CPUs, we need to use the maxcpus= boot parameter to limit the number of CPUs to something reasonable, which in turn requires updating the scripts to handle this. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Pranith Kumar <bobby.prani@gmail.com>
2014-05-14torture: Choose bzImage location based on architecturePaul E. McKenney1-0/+24
Currently, the scripts hard-code arch/x86/boot/bzImage, which does not work well for other architectures. This commit therefore provides a identify_boot_image function that selects the correct bzImage location relative to the top of the Linux source tree. This commit also adds a --bootimage argument that allows selecting some other file, for example, "vmlinux". This change requires that the definition of the QEMU variable be computed earlier in order to identify where to look for the boot image when it comes time to copy it to the results directory. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
2014-05-14torture: Rename RCU_QEMU_CMD to TORTURE_QEMU_CMDPaul E. McKenney1-4/+4
This commit makes the torture scripts a bit more RCU-independent. It also removes a redundant export of this same shell variable. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
2014-05-14torture: Rename RCU_QEMU_MAC to TORTURE_QEMU_MACPaul E. McKenney1-3/+3
This commit makes the torture scripts a bit more RCU-independent. It also drops an redundant "export" statement. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
2014-05-14torture: Rename RCU_QEMU_INTERACTIVE to TORTURE_QEMU_INTERACTIVEPaul E. McKenney1-6/+6
This commit makes the torture scripts a bit more RCU-independent. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
2014-02-18rcutorture: Enable concurrent rcutorture runsPaul E. McKenney1-0/+1
The rcutorture tests run by default range from using one CPU to using sixteen of them. Therefore, rcutorture testing could be sped up significantly simply by running the kernels in parallel. Building them in parallel is not all that helpful: "make -j" is usually a better bet. So this commit takes a new "--cpus" argument that specifies how many CPUs rcutorture is permitted to use for its parallel runs. The default of zero does sequential runs as before. The bin-packing is minimal, and will be grossly suboptimal for some configurations. However, powers of two work reasonably well. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
2013-12-03rcutorture: Stop tracking FSF's postal addressPaul E. McKenney1-2/+2
All of the rcutorture scripts has the usual GPL header, which contains a long-obsolete postal address for FSF. To avoid the need to track the FSF office's movements, this commit substitutes the URL where GPL may be found. Reported-by: Greg KH <gregkh@linuxfoundation.org> Reported-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
2013-12-03rcutorture: Move checkarg to functions.shPaul E. McKenney1-0/+24
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Greg KH <gregkh@linuxfoundation.org>
2013-12-03rcutorture: Flag errors and warnings with color codingPaul E. McKenney1-0/+16
The output of the rcutorture scripts often requires interpretation, so this commit simplifies this interpretation by tagging messages as BUGs (colored red) or WARNINGs (colored yellow). Reported-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Greg KH <gregkh@linuxfoundation.org>
2013-12-03rcutorture: Refactor to enable non-x86 architecturesPaul E. McKenney1-0/+78
This commit expands the checks for what architecture is running to generate additional qemu-system- commands, then uses the resulting qemu-system- command name to choose different qemu arguments as needed for different architectures. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Greg KH <gregkh@linuxfoundation.org>
2013-12-03rcutorture: Abstract qemu-flavor identificationPaul E. McKenney1-0/+27
The task of working out which flavor of qemu to use gets more complex as more types of CPUs are supported. Adding Power makes three in addition to 32-bit and 64-bit x86, so it is time to pull this out into a function. This commit therefore creates an identify_qemu function and also adds a --qemu-cmd command-line argument for the inevitable case where the identify_qemu cannot figure it out. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Greg KH <gregkh@linuxfoundation.org>
2013-12-03rcutorture: Add per-Kconfig fragment boot parametersPaul E. McKenney1-0/+12
Some Kconfig fragments require rcutorture module parameters to do optimal testing, for example, a configuration for SRCU would need rcutorture.torture_type=srcu. This commit therefore adds a per-Kconfig-fragment boot-parameter capability. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Greg KH <gregkh@linuxfoundation.org>
2013-12-03rcutorture: Add per-version default Kconfig fragments and module parametersPaul E. McKenney1-4/+3
Different Kconfig parameters apply to different kernel versions, as do different rcutorture module parameters. This commit allows the rcutorture test scripts to adjust for different kernel versions. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Greg KH <gregkh@linuxfoundation.org>
2013-12-03rcutorture: Add KVM-based test frameworkPaul E. McKenney1-0/+42
This commit adds the test framework that I used to test RCU under KVM. This consists of a group of scripts and Kconfig fragments. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Greg KH <gregkh@linuxfoundation.org>