Cleaning up after tests is implemented separately for individual tests
and called at the end of each test execution. Since these functions are
very similar and a more generalized test framework was introduced a
function pointer in the resctrl_test struct can be used to reduce the
amount of function calls.
These functions are also all called in the ctrl-c handler because the
handler isn't aware which test is currently running. Since the handler
is implemented with a sigaction no function parameters can be passed
there but information about what test is currently running can be passed
with a global variable.
Changelog v3:
- Make current_test static.
- Add callback NULL check to the ctrl-c handler.
Changelog v2:
- Make current_test a const pointer limited in scope to resctrl_val
file.
- Remove tests_cleanup from resctrl.h.
- Cleanup 'goto out' path and labels in individual test functions.
Older versions of this series:
[v1] https://lore.kernel.org/all/cover.1708434017.git.maciej.wieczor-retman@inte…
[v2] https://lore.kernel.org/all/cover.1708596015.git.maciej.wieczor-retman@inte…
Maciej Wieczor-Retman (3):
selftests/resctrl: Add cleanup function to test framework
selftests/resctrl: Simplify cleanup in ctrl-c handler
selftests/resctrl: Move cleanups out of individual tests
tools/testing/selftests/resctrl/cat_test.c | 8 +++-----
tools/testing/selftests/resctrl/cmt_test.c | 4 ++--
tools/testing/selftests/resctrl/mba_test.c | 8 +++-----
tools/testing/selftests/resctrl/mbm_test.c | 8 +++-----
tools/testing/selftests/resctrl/resctrl.h | 9 +++------
tools/testing/selftests/resctrl/resctrl_tests.c | 16 +++++-----------
tools/testing/selftests/resctrl/resctrl_val.c | 7 +++++--
7 files changed, 24 insertions(+), 36 deletions(-)
--
2.43.2
The RISC-V arch_timer selftests is used to validate Sstc timer
functionality in a guest, which sets up periodic timer interrupts
and check the basic interrupt status upon its receipt.
This KVM selftests was ported from aarch64 arch_timer and tested
with Linux v6.7-rc8 on a Qemu riscv64 virt machine.
---
Changed since v4:
* Rebased to Linux 6.7-rc8
* Added new patch(2/12) to clean up the data type in struct test_args
* Re-ordered patch(11/11) in v4 to patch(3/12)
* Changed the timer_err_margin_us type from int to uint32_t
Haibo Xu (11):
KVM: arm64: selftests: Data type cleanup for arch_timer test
KVM: arm64: selftests: Enable tuning of error margin in arch_timer
test
KVM: arm64: selftests: Split arch_timer test code
KVM: selftests: Add CONFIG_64BIT definition for the build
tools: riscv: Add header file csr.h
tools: riscv: Add header file vdso/processor.h
KVM: riscv: selftests: Switch to use macro from csr.h
KVM: riscv: selftests: Add exception handling support
KVM: riscv: selftests: Add guest helper to get vcpu id
KVM: riscv: selftests: Change vcpu_has_ext to a common function
KVM: riscv: selftests: Add sstc timer test
Paolo Bonzini (1):
selftests/kvm: Fix issues with $(SPLIT_TESTS)
tools/arch/riscv/include/asm/csr.h | 541 ++++++++++++++++++
tools/arch/riscv/include/asm/vdso/processor.h | 32 ++
tools/testing/selftests/kvm/Makefile | 27 +-
.../selftests/kvm/aarch64/arch_timer.c | 295 +---------
tools/testing/selftests/kvm/arch_timer.c | 259 +++++++++
.../selftests/kvm/include/aarch64/processor.h | 4 -
.../selftests/kvm/include/kvm_util_base.h | 9 +
.../selftests/kvm/include/riscv/arch_timer.h | 71 +++
.../selftests/kvm/include/riscv/processor.h | 65 ++-
.../testing/selftests/kvm/include/test_util.h | 2 +
.../selftests/kvm/include/timer_test.h | 45 ++
.../selftests/kvm/lib/riscv/handlers.S | 101 ++++
.../selftests/kvm/lib/riscv/processor.c | 87 +++
.../testing/selftests/kvm/riscv/arch_timer.c | 111 ++++
.../selftests/kvm/riscv/get-reg-list.c | 11 +-
15 files changed, 1353 insertions(+), 307 deletions(-)
create mode 100644 tools/arch/riscv/include/asm/csr.h
create mode 100644 tools/arch/riscv/include/asm/vdso/processor.h
create mode 100644 tools/testing/selftests/kvm/arch_timer.c
create mode 100644 tools/testing/selftests/kvm/include/riscv/arch_timer.h
create mode 100644 tools/testing/selftests/kvm/include/timer_test.h
create mode 100644 tools/testing/selftests/kvm/lib/riscv/handlers.S
create mode 100644 tools/testing/selftests/kvm/riscv/arch_timer.c
--
2.34.1
The changes doesn't change the current functionality. The changes on
lib.mk are both for simplification and also clarification, like in the
case of not handling TEST_GEN_MODS_DIR directly.
These changes apply on top of the current kselftest-next branch. Please
review!
Signed-off-by: Marcos Paulo de Souza <mpdesouza(a)suse.com>
---
Marcos Paulo de Souza (3):
selftests: lib.mk: Do not process TEST_GEN_MODS_DIR
selftests: lib.mk: Simplify TEST_GEN_MODS_DIR handling
selftests: livepatch: Add initial .gitignore
tools/testing/selftests/lib.mk | 19 +++++++------------
tools/testing/selftests/livepatch/.gitignore | 1 +
2 files changed, 8 insertions(+), 12 deletions(-)
---
base-commit: 345e8abe4c355bc24bab3f4a5634122e55be8665
change-id: 20240215-lp-selftests-fixes-7d4bab3c0712
Best regards,
--
Marcos Paulo de Souza <mpdesouza(a)suse.com>
Hi!
I was running some KASan tests with kunit.py recently and noticed that
when KASan is run in hw tags mode, we manually have to add the required
`mte=on` option to kunit_tool's qemu invocation, as the tests will
otherwise crash.
To make life easier, I was looking into ways for kunit.py to recognise
when MTE support was required and set the option automatically.
All solutions I could come up with for having kunit_tool conditionally
pass `mte=on` to qemu, either entailed duplicate code or required
parsing of kernel's config file again. I was working under the
assumption that only after configuring the kernel we would know whether
the 'mte=on' option was necessary, as CONFIG_ARM64_MTE is not visible
before.
Only afterwads did I realise that the qemu arm64 config that kunit_tool
falls back on, uses the `virt` machine, which supports MTE in any case.
So, could it be as easy as just adding the `mte=on` option to
kunit_tool's arm64 config? Would this be a welcome addition?
What do you think?
Many thanks,
Paul
Signed-off-by: Paul Heidekrüger <paul.heidekrueger(a)tum.de>
---
tools/testing/kunit/qemu_configs/arm64.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/kunit/qemu_configs/arm64.py b/tools/testing/kunit/qemu_configs/arm64.py
index d3ff27024755..a525f7e1093b 100644
--- a/tools/testing/kunit/qemu_configs/arm64.py
+++ b/tools/testing/kunit/qemu_configs/arm64.py
@@ -9,4 +9,4 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=y''',
qemu_arch='aarch64',
kernel_path='arch/arm64/boot/Image.gz',
kernel_command_line='console=ttyAMA0',
- extra_qemu_params=['-machine', 'virt', '-cpu', 'max,pauth-impdef=on'])
+ extra_qemu_params=['-machine', 'virt,mte=on', '-cpu', 'max,pauth-impdef=on'])
--
2.40.1