summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/arm64
Commit message (Collapse)AuthorAgeFilesLines
...
| * kselftest/arm64: Remove the local NUM_VL definitionZenghui Yu2023-01-201-2/+0
| | | | | | | | | | | | | | | | | | | | It was introduced in commit b77e995e3b96 ("kselftest/arm64: Add a test program to exercise the syscall ABI") but never actually used. Remove it. Signed-off-by: Zenghui Yu <yuzenghui@huawei.com> Reviewed-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221218092942.1940-1-yuzenghui@huawei.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Verify simultaneous SSVE and ZA context generationMark Brown2023-01-201-0/+162
| | | | | | | | | | | | | | | | | | Add a test that generates SSVE and ZA context in a single signal frame to ensure that nothing is going wrong in that case for any reason. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230117-arm64-test-ssve-za-v1-2-203c00150154@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Verify that SSVE signal context has SVE_SIG_FLAG_SM setMark Brown2023-01-201-0/+5
| | | | | | | | | | | | | | | | | | Streaming mode SVE signal context should have SVE_SIG_FLAG_SM set but we were not actually validating this. Add a check. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230117-arm64-test-ssve-za-v1-1-203c00150154@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Remove spurious comment from MTE test MakefileMark Brown2023-01-201-1/+0
| | | | | | | | | | | | | | | | | | | | There's a stray comment in the MTE test Makefile which documents something that's since been removed, delete it. Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/20230111-arm64-kselftest-clang-v1-6-89c69d377727@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Support build of MTE tests with clangMark Brown2023-01-201-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The assembly portions of the MTE selftests need to be built with a toolchain supporting MTE. Since we support GCC versions that lack MTE support we have logic to suppress build of these tests when using such a toolchain but that logic is broken for LLVM=1 builds, it uses CC but CC is only set for LLVM builds in libs.mk which needs to be included after we have selected which test programs to build. Since all supported LLVM versions support MTE we can simply assume MTE support when LLVM is set. This is not a thing of beauty but it does the job. Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/20230111-arm64-kselftest-clang-v1-5-89c69d377727@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Initialise current at build time in signal testsMark Brown2023-01-201-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building with clang the toolchain refuses to link the signals testcases since the assembly code has a reference to current which has no initialiser so is placed in the BSS: /tmp/signals-af2042.o: in function `fake_sigreturn': <unknown>:51:(.text+0x40): relocation truncated to fit: R_AARCH64_LD_PREL_LO19 against symbol `current' defined in .bss section in /tmp/test_signals-ec1160.o Since the first statement in main() initialises current we may as well fix this by moving the initialisation to build time so the variable doesn't end up in the BSS. Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/20230111-arm64-kselftest-clang-v1-4-89c69d377727@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Don't pass headers to the compiler as sourceMark Brown2023-01-201-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The signal Makefile rules pass all the dependencies for each executable, including headers, to the compiler which GCC is happy enough with but clang rejects: clang --target=aarch64-none-linux-gnu -fintegrated-as -Wall -O2 -g -I/home/broonie/git/linux/tools/testing/selftests/ -isystem /home/broonie/git/linux/usr/include -D_GNU_SOURCE -std=gnu99 -I. test_signals.c test_signals_utils.c testcases/testcases.c signals.S testcases/fake_sigreturn_bad_magic.c test_signals.h test_signals_utils.h testcases/testcases.h -o testcases/fake_sigreturn_bad_magic clang: error: cannot specify -o when generating multiple output files This happens because clang gets confused about what to do with the header files, failing to identify them as source. This is not amazing behaviour on clang's part and should ideally be fixed but even if that happens we'd still need a new clang release so let's instead rework the Makefile so we use variables for the lists of header and source files, allowing us to only pass the source files to the compiler and keep clang happy. As a bonus the resulting Makefile is a bit easier to read. Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/20230111-arm64-kselftest-clang-v1-3-89c69d377727@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Remove redundant _start labels from FP testsMark Brown2023-01-204-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a number of freestanding static executables used in floating point testing that have no runtime at all. These all define the main entry point as: .globl _start function _start _start: but clang's integrated assembler complains that: error: symbol '_start' is already defined due to having both a label and function directive. Remove the label to allow building with clang. No functional change. Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/20230111-arm64-kselftest-clang-v1-2-89c69d377727@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Fix .pushsection for strings in FP testsMark Brown2023-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .pushsection directive used to store the strings used with the .puts macro in the floating point helpers does not provide a section type but according to the gas documentation this should be mandatory and with the clang built in as it actually is. Provide one so that we can build these tests with LLVM=1. No functional change. Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/20230111-arm64-kselftest-clang-v1-1-89c69d377727@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Run BTI selftests on systems without BTIMark Brown2023-01-121-15/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The BTI selftests are built both with and without BTI support, validating both the generation of BTI signals as expected for binaries without BTI support. Both versions of the binary currently skip all their tests when the system does not support BTI, however this is excessive since we do have a defined ABI for how the programs should function in this case (especially for the non-BTI binary). Update the test program to run all the tests unconditionally, adding a runtime adjustment of the expected results on systems that don't support BTI where we currently handle the build time case. The tests all use HINT space instructions, BTI itself is a HINT as is are the PAC instructions that function as landing pads, so nothing in the tests depends on support for BTI in the kernel or hardware. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230110-arm64-bti-selftest-skip-v1-2-143ecdc84567@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Fix test numbering when skipping testsMark Brown2023-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Currently when skipping tests in the BTI testsuite we assign the same number to every test since we forget to increment the current test number as we skip, causing warnings about not running the expected test count and potentially otherwise confusing result parsers. Fix this by adding an appropriate increment. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230110-arm64-bti-selftest-skip-v1-1-143ecdc84567@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Skip non-power of 2 SVE vector lengths in fp-stressMark Brown2023-01-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As documented in issue C215 in the known issues list for DDI0487I.a [1] Arm will be making a retroactive change to SVE to remove the possibility of selecting non power of two vector lengths. This has no impact on existing physical implementations but most virtual implementations have implemented the full range of permissible vector lengths. Given how demanding fp-stress is for these implementations update to only attempt to enumerate the power of two vector lengths, reducing the load created on existing virtual implementations and only exercising the functionality that will be seen in physical implementations. [1] https://developer.arm.com/documentation/102105/ia-00/ Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221220-arm64-fp-stress-pow2-v1-1-d0ce756b57af@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Only enumerate power of two VLs in syscall-abiMark Brown2023-01-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As documented in issue C215 in the known issues list for DDI0487I.a [1] Arm will be making a retroactive change to SVE to remove the possibility of selecting non power of two vector lengths. This has no impact on existing physical implementations but most virtual implementations have implemented the full range of permissible vector lengths. Since virtual implementations are noticeably slow in general and the larger vector lengths amplify the issue there's a useful improvement in runtime from only covering the vector lengths that will exist in practical systems, adjust our enumeration accordingly. We have other tests that aim to cover the enumeration interfaces. For symmetry we apply the same change to the eumeration for SME vector lengths, though the power of two restriction was already present for SME so there is no impact on the set of vector lengths tested. [1] https://developer.arm.com/documentation/102105/ia-00/ Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221223-arm64-syscall-abi-sme-only-v1-4-4fabfbd62087@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Verify SME only ABI in syscall-abiMark Brown2023-01-122-6/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently syscall-abi only covers SME in the case where the system supports SVE however it is architecturally valid to support SME without SVE. Update the program to cover this case, this requires adjustments in the code to check for SVCR.SM being set when deciding if we're handling the FPSIMD or SVE registers and the addition of new test cases for the SME only case. Note that in the SME only case we should not save the SVE registers after a syscall since even if we were in streaming mode and therefore set them the syscall should have exited streaming mode, we check that we have done so by looking at SVCR. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221223-arm64-syscall-abi-sme-only-v1-3-4fabfbd62087@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Only enumerate VLs once in syscall-abiMark Brown2023-01-121-54/+41
| | | | | | | | | | | | | | | | | | | | | | Currently syscall-abi not only enumerates the SVE VLs twice while working out how many tests are planned, it also repeats the enumeration process while doing the actual tests. Record the VLs when we enumerate and use that list when we are performing the tests, removing some duplicated logic. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221223-arm64-syscall-abi-sme-only-v1-2-4fabfbd62087@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Fix syscall-abi for systems without 128 bit SMEMark Brown2023-01-121-0/+8
|/ | | | | | | | | | | SME does not mandate any specific VL so we may not have 128 bit SME but the algorithm used for enumerating VLs assumes that we will. Add the required check to ensure that the algorithm terminates. Fixes: 43e3f85523e4 ("kselftest/arm64: Add SME support to syscall ABI test") Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221223-arm64-syscall-abi-sme-only-v1-1-4fabfbd62087@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
* Merge branch 'for-next/selftests' into for-next/coreWill Deacon2022-12-066-45/+122
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * for-next/selftests: kselftest/arm64: Allow epoll_wait() to return more than one result kselftest/arm64: Don't drain output while spawning children kselftest/arm64: Hold fp-stress children until they're all spawned kselftest/arm64: Set test names prior to starting children kselftest/arm64: Use preferred form for predicate load/stores kselftest/arm64: fix array_size.cocci warning kselftest/arm64: fix array_size.cocci warning kselftest/arm64: Print ASCII version of unknown signal frame magic values kselftest/arm64: Remove validation of extra_context from TODO kselftest/arm64: Provide progress messages when signalling children kselftest/arm64: Check that all children are producing output in fp-stress
| * kselftest/arm64: Allow epoll_wait() to return more than one resultMark Brown2022-12-011-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When everything is starting up we are likely to have a lot of child processes producing output at once. This means that we can reduce overhead a bit by allowing epoll_wait() to return more than one descriptor at once, it cuts down on the number of system calls we need to do which on virtual platforms where the syscall overhead is a bit more noticable and we're likely to have a lot more children active can make a small but noticable difference. On physical platforms the relatively small number of processes being run and vastly improved speeds push the effects of this change into the noise. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221129215926.442895-4-broonie@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
| * kselftest/arm64: Don't drain output while spawning childrenMark Brown2022-12-011-8/+0
| | | | | | | | | | | | | | | | | | Now we hold execution of the stress test programs until all children are started there is no need to drain output while that is happening. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221129215926.442895-3-broonie@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
| * kselftest/arm64: Hold fp-stress children until they're all spawnedMark Brown2022-12-011-1/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present fp-stress has a bit of a thundering herd problem since the children it spawns start running immediately, meaning that they can start starving the parent process of CPU before it has even started all the children. This is much more severe on virtual platforms since they tend to support far more SVE and SME vector lengths, be slower in general and for some have issues with performance when simulating multiple CPUs. We can mitigate this problem by having all the child processes block before starting the test program, meaning that we at least have all the child processes started before we start heavily using CPU. We still have the same load issues while waiting for the actual stress test programs to start up and produce output but they're at least all ready to go before that kicks in, resulting in substantial reductions in overall runtime on some of the severely affected systems. One test was showing about 20% improvement. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221129215926.442895-2-broonie@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
| * kselftest/arm64: Set test names prior to starting childrenMark Brown2022-11-251-10/+10
| | | | | | | | | | | | | | | | | | | | Since we now flush output immediately on starting children we should ensure that the child name is set beforehand so that any output that does get flushed from the newly created child has the name of the child attached. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221124120722.150988-1-broonie@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
| * kselftest/arm64: Use preferred form for predicate load/storesMark Brown2022-11-181-2/+2
| | | | | | | | | | | | | | | | | | | | The preferred form of the str/ldr for predicate registers with an immediate of zero is to omit the zero, and the clang built in assembler rejects the zero immediate. Drop the immediate. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221117114130.687261-1-broonie@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
| * kselftest/arm64: fix array_size.cocci warningwangkailong@jari.cn2022-11-141-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix following coccicheck warning: tools/testing/selftests/arm64/mte/check_mmap_options.c:64:24-25: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_mmap_options.c:66:20-21: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_mmap_options.c:135:25-26: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_mmap_options.c:96:25-26: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_mmap_options.c:190:24-25: WARNING: Use ARRAY_SIZE Signed-off-by: KaiLong Wang <wangkailong@jari.cn> Link: https://lore.kernel.org/r/777ce8ba.12e.184705d4211.Coremail.wangkailong@jari.cn Signed-off-by: Will Deacon <will@kernel.org>
| * kselftest/arm64: fix array_size.cocci warningKang Minchul2022-11-081-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use ARRAY_SIZE to fix the following coccicheck warnings: tools/testing/selftests/arm64/mte/check_buffer_fill.c:341:20-21: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_buffer_fill.c:35:20-21: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_buffer_fill.c:168:20-21: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_buffer_fill.c:72:20-21: WARNING: Use ARRAY_SIZE tools/testing/selftests/arm64/mte/check_buffer_fill.c:369:25-26: WARNING: Use ARRAY_SIZE Signed-off-by: Kang Minchul <tegongkang@gmail.com> Link: https://lore.kernel.org/r/20221105073143.78521-1-tegongkang@gmail.com Signed-off-by: Will Deacon <will@kernel.org>
| * kselftest/arm64: Print ASCII version of unknown signal frame magic valuesMark Brown2022-11-081-4/+17
| | | | | | | | | | | | | | | | | | | | The signal magic values are supposed to be allocated as somewhat meaningful ASCII so if we encounter a bad magic value print the any alphanumeric characters we find in it as well as the hex value to aid debuggability. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221102140543.98193-1-broonie@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
| * kselftest/arm64: Remove validation of extra_context from TODOMark Brown2022-11-081-1/+0
| | | | | | | | | | | | | | | | | | | | When fixing up support for extra_context in the signal handling tests I didn't notice that there is a TODO file in the directory which lists this as a thing to be done. Since it's been done remove it from the list. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221027110324.33802-1-broonie@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
| * kselftest/arm64: Provide progress messages when signalling childrenMark Brown2022-11-081-0/+3
| | | | | | | | | | | | | | | | | | | | Especially when the test is configured to run for a longer time it can be reassuring to users to see that the supervising program is running OK so provide a message every second when the output timer expires. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221017144553.773176-3-broonie@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
| * kselftest/arm64: Check that all children are producing output in fp-stressMark Brown2022-11-081-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we don't have an explicit check that when it's been a second since we have seen output produced from the test programs starting up that means all of them are running and we should start both sending signals and timing out. This is not reliable, especially on very heavily loaded systems where the test programs might take longer than a second to run. We do skip sending signals to children that have not produced output yet so we won't cause them to exit unexpectedly by sending a signal but this can create confusion when interpreting output, for example appearing to show the tests running for less time than expected or appearing to show missed signal deliveries. Avoid issues by explicitly checking that we have seen output from all the child processes before we start sending signals or counting test run time. This is especially likely on virtual platforms with large numbers of vector lengths supported since the platforms are slow and there will be a lot of tasks per CPU. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221017144553.773176-2-broonie@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
* | kselftest/arm64: Add SVE 2.1 to hwcap testMark Brown2022-11-091-0/+13
| | | | | | | | | | | | | | | | | | Add coverage for FEAT_SVE2p1. Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20221017152520.1039165-7-broonie@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
* | kselftest/arm64: Add FEAT_RPRFM to the hwcap testMark Brown2022-11-091-0/+6
| | | | | | | | | | | | | | | | | | | | Since the newly added instruction is in the HINT space we can't reasonably test for it actually being present. Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20221017152520.1039165-5-broonie@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
* | kselftest/arm64: Add FEAT_CSSC to the hwcap selftestMark Brown2022-11-091-0/+13
|/ | | | | | | | | Add FEAT_CSSC to the set of features checked by the hwcap selftest. Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20221017152520.1039165-3-broonie@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
* Merge branch 'for-next/kselftest' into for-next/coreCatalin Marinas2022-09-3031-168/+1313
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * for-next/kselftest: (28 commits) : Kselftest updates for arm64 kselftest/arm64: Handle EINTR while reading data from children kselftest/arm64: Flag fp-stress as exiting when we begin finishing up kselftest/arm64: Don't repeat termination handler for fp-stress kselftest/arm64: Don't enable v8.5 for MTE selftest builds kselftest/arm64: Fix typo in hwcap check kselftest/arm64: Add hwcap test for RNG kselftest/arm64: Add SVE 2 to the tested hwcaps kselftest/arm64: Add missing newline in hwcap output kselftest/arm64: Fix spelling misakes of signal names kselftest/arm64: Enforce actual ABI for SVE syscalls kselftest/arm64: Correct buffer allocation for SVE Z registers kselftest/arm64: Include larger SVE and SME VLs in signal tests kselftest/arm64: Allow larger buffers in get_signal_context() kselftest/arm64: Preserve any EXTRA_CONTEXT in handle_signal_copyctx() kselftest/arm64: Validate contents of EXTRA_CONTEXT blocks kselftest/arm64: Only validate each signal context once kselftest/arm64: Remove unneeded protype for validate_extra_context() kselftest/arm64: Fix validation of EXTRA_CONTEXT signal context location kselftest/arm64: Fix validatation termination record after EXTRA_CONTEXT kselftest/arm64: Validate signal ucontext in place ...
| * kselftest/arm64: Handle EINTR while reading data from childrenMark Brown2022-09-291-35/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we treat any error when reading from the child as a failure and don't read any more output from that child as a result. This ignores the fact that it is valid for read() to return EINTR as the error code if there is a signal pending so we could stop handling the output of children, especially during exit when we will get some SIGCHLD signals delivered to us. Fix this by pulling the read handling out into a separate function which returns a flag if reads should be continued and wrapping it in a loop. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220921181345.618085-4-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Flag fp-stress as exiting when we begin finishing upMark Brown2022-09-291-0/+1
| | | | | | | | | | | | | | | | | | | | Once we have started exiting the termination handler will have the same effect as what we're already running so set the termination flag at that point. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220921181345.618085-3-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Don't repeat termination handler for fp-stressMark Brown2022-09-291-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | When fp-stress gets a termination signal it sets a flag telling itself to exit and sends a termination signal to all the children. If the flag is set then don't bother repeating this process, it isn't going to accomplish anything other than consume CPU time which can be an issue when running in emulation. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220921181345.618085-2-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Don't enable v8.5 for MTE selftest buildsMark Brown2022-09-292-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we set -march=armv8.5+memtag when building the MTE selftests, allowing the compiler to emit v8.5 and MTE instructions for anything it generates. This means that we may get code that will generate SIGILLs when run on older systems rather than skipping on non-MTE systems as should be the case. Most toolchains don't select any incompatible instructions but I have seen some reports which suggest that some may be appearing which do so. This is also potentially problematic in that if the compiler chooses to emit any MTE instructions for the C code it may interfere with the MTE usage we are trying to test. Since the only reason we are specifying this option is to allow us to assemble MTE instructions in mte_helper.S we can avoid these issues by moving to using a .arch directive there and adding the -march explicitly to the toolchain support check instead of the generic CFLAGS. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220928154517.173108-1-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Fix typo in hwcap checkMark Brown2022-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | We use a local variable hwcap to refer to the element of the hwcaps array which we are currently checking. When checking for the relevant hwcap bit being set in testing we were dereferencing hwcaps rather than hwcap in fetching the AT_HWCAP to use, which is perfectly valid C but means we were always checking the bit was set in the hwcap for whichever feature is first in the array. Remove the stray s. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220907113400.12982-1-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Add hwcap test for RNGMark Brown2022-09-161-0/+12
| | | | | | | | | | | | | | | | | | Validate the RNG hwcap and make sure we don't generate a SIGILL reading RNDR when it is reported. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220913141101.151400-4-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Add SVE 2 to the tested hwcapsMark Brown2022-09-161-0/+136
| | | | | | | | | | | | | | | | | | Include SVE 2 and the various subfeatures it adds in the set of hwcaps we check for. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220913141101.151400-3-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Add missing newline in hwcap outputMark Brown2022-09-161-1/+1
| | | | | | | | | | | | | | | | | | Clean up the output of the test by adding a missing newline, the fix had been done locally but didn't make it into the applied version. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220913141101.151400-2-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Fix spelling misakes of signal namesColin Ian King2022-09-071-2/+2
| | | | | | | | | | | | | | | | There are a couple of spelling mistakes of signame names. Fix them. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20220907170902.687340-1-colin.i.king@gmail.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Enforce actual ABI for SVE syscallsMark Brown2022-09-071-19/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently syscall-abi permits the bits in Z registers not shared with the V registers as well as all of the predicate registers to be preserved on syscall but the actual implementation has always cleared them and our documentation has now been updated to make that the documented ABI so update the syscall-abi test to match. Signed-off-by: Mark Brown <broonie@kernel.org> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20220829162502.886816-4-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Correct buffer allocation for SVE Z registersMark Brown2022-09-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The buffer used for verifying SVE Z registers allocated enough space for 16 maximally sized registers rather than 32 due to using the macro for the number of P registers. In practice this didn't matter since for historical reasons the maximum VQ defined in the ABI is greater the architectural maximum so we will always allocate more space than is needed even with emulated platforms implementing the architectural maximum. Still, we should use the right define. Signed-off-by: Mark Brown <broonie@kernel.org> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20220829162502.886816-2-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Include larger SVE and SME VLs in signal testsMark Brown2022-09-074-46/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that the core utilities for signal testing support handling data in EXTRA_CONTEXT blocks we can test larger SVE and SME VLs which spill over the limits in the base signal context. This is done by defining storage for the context as a union with a ucontext_t and a buffer together with some helpers for getting relevant sizes and offsets like we do for fake_sigframe, this isn't the most lovely code ever but is fairly straightforward to implement and much less invasive to the somewhat unclear and indistinct layers of abstraction in the signal handling test code. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220829160703.874492-11-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Allow larger buffers in get_signal_context()Mark Brown2022-09-0714-15/+16
| | | | | | | | | | | | | | | | | | | | In order to allow testing of signal contexts that overflow the base signal frame allow callers to pass the buffer size for the user context into get_signal_context(). No functional change. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220829160703.874492-10-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Preserve any EXTRA_CONTEXT in handle_signal_copyctx()Mark Brown2022-09-071-2/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When preserving the signal context for later verification by testcases check for and include any EXTRA_CONTEXT block if enough space has been provided. Since the EXTRA_CONTEXT block includes a pointer to the start of the additional data block we need to do at least some fixup on the copied data. For simplicity in users we do this by extending the length of the EXTRA_CONTEXT to include the following termination record, this will cause users to see the extra data as part of the linked list of contexts without needing any special handling. Care will be needed if any specific tests for EXTRA_CONTEXT are added beyond the validation done in ASSERT_GOOD_CONTEXT. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220829160703.874492-9-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Validate contents of EXTRA_CONTEXT blocksMark Brown2022-09-071-4/+21
| | | | | | | | | | | | | | | | | | | | | | | | Currently in validate_reserved() we check the basic form and contents of an EXTRA_CONTEXT block but do not actually validate anything inside the data block it provides. Extend the validation to do so, when we get to the terminator for the main data block reset and start walking the extra data block instead. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220829160703.874492-8-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Only validate each signal context onceMark Brown2022-09-071-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently for the more complex signal context types we validate the context specific details the end of the parsing loop validate_reserved() if we've ever seen a context of that type. This is currently merely a bit inefficient but will get a bit awkward when we start parsing extra_context, at which point we will need to reset the head to advance into the extra space that extra_context provides. Instead only do the more detailed checks on each context type the first time we see that context type. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220829160703.874492-7-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Remove unneeded protype for validate_extra_context()Mark Brown2022-09-071-2/+0
| | | | | | | | | | | | | | | | | | Nothing outside testcases.c should need to use validate_extra_context(), remove the prototype to ensure nothing does. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220829160703.874492-6-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
| * kselftest/arm64: Fix validation of EXTRA_CONTEXT signal context locationMark Brown2022-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently in validate_extra_context() we assert both that the extra data pointed to by the EXTRA_CONTEXT is 16 byte aligned and that it immediately follows the struct _aarch64_ctx providing the terminator for the linked list of contexts in the signal frame. Since struct _aarch64_ctx is an 8 byte structure which must be 16 byte aligned these cannot both be true. As documented in sigcontext.h and implemented by the kernel the extra data should be at the next 16 byte aligned address after the terminator so fix the validation to match. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220829160703.874492-5-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>