mirror of
https://github.com/torvalds/linux.git
synced 2024-12-07 19:41:31 +00:00
c745b15c1f
While we have test coverage for the ptrace interface in our selftests the current programs have a number of gaps. The testing is done per regset so does not cover interactions and at no point do any of the tests actually run the traced processes meaning that there is no validation that anything we read or write corresponds to register values the process actually sees. Let's add a new program which attempts to cover these gaps. Each test we do performs a single ptrace write. For each test we generate some random initial register data in memory and then fork() and trace a child. The child will load the generated data into the registers then trigger a breakpoint. The parent waits for the breakpoint then reads the entire child register state via ptrace, verifying that the values expected were actually loaded by the child. It then does the write being tested and resumes the child. Once resumed the child saves the register state it sees to memory and executes another breakpoint. The parent uses process_vm_readv() to get these values from the child and verifies that the values were as expected before cleaning up the child. We generate configurations with combinations of vector lengths and SVCR values and then try every ptrace write which will implement the transition we generated. In order to control execution time (especially in emulation) we only cover the minimum and maximum VL for each of SVE and SME, this will ensure we generate both increasing and decreasing changes in vector length. In order to provide a baseline test we also check the case where we resume the child without doing a ptrace write. In order to simplify the generation of the test count for kselftest we will report but skip a substantial number of tests that can't actually be expressed via a single ptrace write, several times more than we actually run. This is noisy and will add some overhead but is very much simpler so is probably worth the tradeoff. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20240122-arm64-test-ptrace-regs-v1-1-0897f822d73e@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> |
||
---|---|---|
.. | ||
.gitignore | ||
asm-offsets.h | ||
asm-utils.S | ||
assembler.h | ||
fp-pidbench.S | ||
fp-ptrace-asm.S | ||
fp-ptrace.c | ||
fp-ptrace.h | ||
fp-stress.c | ||
fpsimd-stress | ||
fpsimd-test.S | ||
Makefile | ||
rdvl-sme.c | ||
rdvl-sve.c | ||
rdvl.h | ||
rdvl.S | ||
README | ||
sme-inst.h | ||
ssve-stress | ||
sve-probe-vls.c | ||
sve-ptrace.c | ||
sve-stress | ||
sve-test.S | ||
TODO | ||
vec-syscfg.c | ||
vlset.c | ||
za-fork-asm.S | ||
za-fork.c | ||
za-ptrace.c | ||
za-stress | ||
za-test.S | ||
zt-ptrace.c | ||
zt-test.S |
This directory contains a mix of tests integrated with kselftest and standalone stress tests. kselftest tests =============== sve-probe-vls - Checks the SVE vector length enumeration interface sve-ptrace - Checks the SVE ptrace interface Running the non-kselftest tests =============================== sve-stress performs an SVE context switch stress test, as described below. (The fpsimd-stress test works the same way; just substitute "fpsimd" for "sve" in the following commands.) The test runs until killed by the user. If no context switch error was detected, you will see output such as the following: $ ./sve-stress (wait for some time) ^C Vector length: 512 bits PID: 1573 Terminated by signal 15, no error, iterations=9467, signals=1014 Vector length: 512 bits PID: 1575 Terminated by signal 15, no error, iterations=9448, signals=1028 Vector length: 512 bits PID: 1577 Terminated by signal 15, no error, iterations=9436, signals=1039 Vector length: 512 bits PID: 1579 Terminated by signal 15, no error, iterations=9421, signals=1039 Vector length: 512 bits PID: 1581 Terminated by signal 15, no error, iterations=9403, signals=1039 Vector length: 512 bits PID: 1583 Terminated by signal 15, no error, iterations=9385, signals=1036 Vector length: 512 bits PID: 1585 Terminated by signal 15, no error, iterations=9376, signals=1039 Vector length: 512 bits PID: 1587 Terminated by signal 15, no error, iterations=9361, signals=1039 Vector length: 512 bits PID: 1589 Terminated by signal 15, no error, iterations=9350, signals=1039 If an error was detected, details of the mismatch will be printed instead of "no error". Ideally, the test should be allowed to run for many minutes or hours to maximise test coverage. KVM stress testing ================== To try to reproduce the bugs that we have been observing, sve-stress should be run in parallel in two KVM guests, while simultaneously running on the host. 1) Start 2 guests, using the following command for each: $ lkvm run --console=virtio -pconsole=hvc0 --sve Image (Depending on the hardware GIC implementation, you may also need --irqchip=gicv3. New kvmtool defaults to that if appropriate, but I can't remember whether my branch is new enough for that. Try without the option first.) Kvmtool occupies the terminal until you kill it (Ctrl+A x), or until the guest terminates. It is therefore recommended to run each instance in separate terminal (use screen or ssh etc.) This allows multiple guests to be run in parallel while running other commands on the host. Within the guest, the host filesystem is accessible, mounted on /host. 2) Run the sve-stress on *each* guest with the Vector-Length set to 32: guest$ ./vlset --inherit 32 ./sve-stress 3) Run the sve-stress on the host with the maximum Vector-Length: host$ ./vlset --inherit --max ./sve-stress Again, the test should be allowed to run for many minutes or hours to maximise test coverage. If no error is detected, you will see output from each sve-stress instance similar to that illustrated above; otherwise details of the observed mismatches will be printed.