summaryrefslogtreecommitdiff
path: root/tools/testing
AgeCommit message (Collapse)Author
2026-05-06Merge tag 'ovpn-net-20260504' of https://github.com/OpenVPN/ovpn-net-nextJakub Kicinski
Antonio Quartulli says: ==================== Includes changes: * ensure MAC header offset is reset before delivering packet * ensure gro_cells_receive() and dstats_dev_add() are called with BH disabled * reduce ping count in selftest to ensure it completes within timeout * tag 'ovpn-net-20260504' of https://github.com/OpenVPN/ovpn-net-next: selftests: ovpn: reduce ping count in test.sh ovpn: ensure packet delivery happens with BH disabled ovpn: reset MAC header before passing skb up ==================== Link: https://patch.msgid.link/20260504230305.2681646-1-antonio@openvpn.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-06KVM: selftests: arm64: Fix steal_time test after UAPI refactoringSebastian Ott
Fix the following failure to the steal_time test on arm64 by making the timer address known to the guest. ==== Test Assertion Failure ==== steal_time.c:229: !ret pid=18514 tid=18514 errno=22 - Invalid argument 1 0x000000000040252f: check_steal_time_uapi at steal_time.c:229 (discriminator 20) 2 (inlined by) main at steal_time.c:537 (discriminator 20) 3 0x0000ffffa23d621b: ?? ??:0 4 0x0000ffffa23d62fb: ?? ??:0 5 0x0000000000402b6f: _start at ??:? KVM_SET_DEVICE_ATTR failed, rc: -1 errno: 22 (Invalid argument) Fixes: 40351ed924dd ("KVM: selftests: Refactor UAPI tests into dedicated function") Signed-off-by: Sebastian Ott <sebott@redhat.com> Link: https://patch.msgid.link/20260504112808.21276-1-sebott@redhat.com Signed-off-by: Marc Zyngier <maz@kernel.org>
2026-05-06selftests/rseq: Expand for optimized RSEQ ABI v2Thomas Gleixner
Update the selftests so they are executed for legacy (32 bytes RSEQ region) and optimized RSEQ ABI v2 mode. Fixes: d6200245c75e ("rseq: Allow registering RSEQ with slice extension") Signed-off-by: Thomas Gleixner <tglx@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Tested-by: Dmitry Vyukov <dvyukov@google.com> Link: https://patch.msgid.link/20260428224428.009121296%40kernel.org Cc: stable@vger.kernel.org
2026-05-06selftests/rseq: Validate legacy behaviorThomas Gleixner
The RSEQ legacy mode behavior requires that the ID fields in the rseq region are unconditionally updated on every context switch and before signal delivery even if not required by the ABI specification. To ensure that this behavior is preserved for legacy users in the future, add a test which validates that with a sleep() and a signal sent to self. Provide a run script which prevents GLIBC from registering a RSEQ region, so that the test can register it's own legacy sized region. Fixes: 566d8015f7ee ("rseq: Avoid CPU/MM CID updates when no event pending") Signed-off-by: Thomas Gleixner <tglx@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Tested-by: Dmitry Vyukov <dvyukov@google.com> Link: https://patch.msgid.link/20260428224427.764705536%40kernel.org Cc: stable@vger.kernel.org
2026-05-06selftests: livepatch: Check if stack_order sysfs attribute existsMarcos Paulo de Souza
The commit 3dae09de4061 ("livepatch: Add stack_order sysfs attribute"), merged in v6.14, introduced a new sysfs attribute. In order to run the selftests on older kernels, check if given kernel has support for the attribute. If the attribute is not supported, skip the checks. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260504-lp-tests-old-fixes-v5-6-0be26d94ab9a@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-05-06selftests: livepatch: Check if replace sysfs attribute existsMarcos Paulo de Souza
The commit adb68ed26a3e ("livepatch: Add "replace" sysfs attribute"), merged in v6.11, introduced a new sysfs attribute. In order to run the selftests on older kernels, check if given kernel has support for the attribute. If the attribute is not supported, skip the checks. While at it, create a local variable to hold the module name to be tested, instead of overwriting MOD_LIVEPATCH. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260504-lp-tests-old-fixes-v5-5-0be26d94ab9a@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-05-06selftests: livepatch: Check if patched sysfs attribute existsMarcos Paulo de Souza
The commit bb26cfd9e77e ("livepatch: add sysfs entry "patched" for each klp_object") was merged in v6.1, introducing a new sysfs attribute. In order to run the selftests on older kernels, check if given kernel has support for the attribute. If the attribute is not supported, skip the checks. Along with this change, use MOD_LIVEPATCH2 variable instead of reassigning a new value to MOD_LIVEPATCH, and also use the variable names in the check_result, to avoid using the module names. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260504-lp-tests-old-fixes-v5-4-0be26d94ab9a@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-05-06selftests: livepatch: Introduce does_sysfs_exist functionMarcos Paulo de Souza
Returns true if the livepatch sysfs attribute exists, and false otherwise. This new function will be used in the next patches. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260504-lp-tests-old-fixes-v5-3-0be26d94ab9a@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-05-06selftests: livepatch: Replace true/false module parameter by y/nMarcos Paulo de Souza
Older kernels don't support true/false for boolean module parameters because they lack commit 0d6ea3ac94ca ("lib/kstrtox.c: add "false"/"true" support to kstrtobool()"). Replace true/false by y/n so the test module can be loaded on older kernels. No functional changes. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260504-lp-tests-old-fixes-v5-2-0be26d94ab9a@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-05-06selftests: livepatch: Check for ARCH_HAS_SYSCALL_WRAPPER configMarcos Paulo de Souza
Older kernels that lack CONFIG_ARCH_HAS_SYSCALL_WRAPPER config don't have any prefixes for their syscalls. The same applies to current powerpc and loongarch, covering all currently supported architectures that support livepatch. The other supported architectures have specific prefixes, so error out when a new architecture adds livepatch support with wrappers but didn't update the test to include it. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Joe Lawrence <joe.lawrence@redhat.com> Link: https://patch.msgid.link/20260504-lp-tests-old-fixes-v5-1-0be26d94ab9a@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
2026-05-06selftests/posix_timers: Use CLOCK_THREAD_CPUTIME_ID for ITIMER_PROF measurementsJohn Stultz
It was reported that the posix_timers test was at times seeing failures with ITIMER_PROF timers, specifically in cases where the RCU_SOFTIRQ was taking up significant amounts of time. Analysis showed that as the time in softirq isn't included in the task stime + utime accounting used to trigger the SIGPROF so delays from softirq work could cause it to appear that the signal was incorrectly delayed. Contributing to this is that the test uses gettimeofday() to measure itimers, which also means any scheduling delay can also cause failures (as the task may not be running the entire time). To fix this, convert all the itimer measurements to use clock_gettime(), tweaking the logic to use nsecs instead of usecs. Then for ITIMER_PROF timers, utilize the CLOCK_THREAD_CPUTIME_ID clockid so that it is similarly measuring the time the task was running. Signed-off-by: John Stultz <jstultz@google.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260428173957.1394265-1-jstultz@google.com
2026-05-05selftests: rds: Make rds selftests TAP compliantAllison Henderson
This patch updates the rds selftests output to be TAP compliant. Use ksft_pr() to mark debug output with a leading '# ' so that TAP parsers treat it as commentary, and convert all informational print() calls to use ksft_pr(). sys.exit(0) is changed to os._exit(0) to avoid duplicate prints from the buffered TAP output. The console output from the tcpdump subprocess is silenced, and the gcov console output is redirected to a gcovr.log. Finally adjust the exit path so that the hash check loop sets a return code instead exiting directly. Then print the TAP results and totals lines before exiting. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-11-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Fix gcov collectionAllison Henderson
debugfs is not mounted automatically in a virtme-ng guest, so the gcov data copy from /sys/kernel/debug/gcov/ silently finds nothing depending on whether debugfs is mounted by default on the host OS. Fix this by mounting debugfs in run.sh before copying the gcda files. Finally when invoked through the kselftest runner, the working directory is the test directory rather than the kernel source root. gcovr defaults --root to the current working directory, which causes it to filter out all coverage data for files under net/rds/ since they are not under the test directory. Fix this by passing --root to gcovr explicitly. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-10-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Stop tcpdump on timeoutAllison Henderson
The timeout signal handler for the rds selftests currently just exits when the time limit is exceeded, and forgets to stop the network dumps. Fix this by hoisting the tcpdump terminate commands into a helper function, and call it from the signal handler before exiting Bound proc.wait() with a timeout (and fall back to proc.kill()) so an unresponsive tcpdump cannot hang the timeout path itself. We also pop() tcpdump_procs as we iterate, so stop_pcaps() is safe to call from both the normal cleanup path and the signal handler, since the second invocation simply has nothing to do Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-9-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Remove tmp pcapsAllison Henderson
This patch removes the initial tmp tcpdumps and instead saves the pcaps directly to the logdir if it is set. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-8-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Add SUDO_USER env variableAllison Henderson
This patch modifies rds selftests to use the environment variable SUDO_USER for tcpdumps if it is set. This is needed to avoid chown operations on the vng 9pfs which is not supported. Passing a user listed in sudoers avoids the tcpdump privilege drop which may otherwise create empty pcaps Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-7-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Add RDS_LOG_DIR env variableAllison Henderson
This patch modifies the rds selftest to look for an env variable RDS_LOG_DIR, and log all traces, pcaps and gcov collections to the folder specified in RDS_LOG_DIR. If RDS_LOG_DIR is unset, logs are not collected. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-6-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Add timeout flag to run.shAllison Henderson
Add a -t flag to run.sh to optionally override the default timeout. The --timeout flag is already supported in test.py, so just add the shorthand -t flag Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-5-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Fix more pylint errorsAllison Henderson
This patch fixes a few pylint errors in test.py. Remove unused exception variables from except blocks, and disable warnings for imports that cannot appear at the start of the module. Also disable warnings for the tcpdump processes. The suggestion to use a with block does not apply here since the process needs to outlive the parent to collect the dumps. Lastly add the module docstring at the top of the module. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-4-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Update USAGE string for run.shAllison Henderson
The run.sh script does not have a -g flag. Update USAGE string with correct flags. Also fix typo packet_duplcate -> packet_duplicate Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-3-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: rds: Increase selftest timeoutAllison Henderson
The 400s time out was originally developed under a leaner kernel config that booted much faster than a default config. Boot up is included as part of the over all test runtime, as well as any log collection done when the test is complete. A slower config combined with the gcov enabled test means we'll need more time to accommodate the boot up and log collection. So, bump time out to 800s. Signed-off-by: Allison Henderson <achender@kernel.org> Link: https://patch.msgid.link/20260504054143.4027538-2-achender@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: drv-net: convert so_txtime to drv-netWillem de Bruijn
In preparation for extending to pacing hardware offload, convert the so_txtime.sh test to a drv-net test that can be run against netdevsim and real hardware. Also update so_txtime.c to not exit on first failure, but run to completion and report exit code there. This helps with debugging unexpected results, especially when processing multiple packets, as happens in the "reverse_order" testcase. Signed-off-by: Willem de Bruijn <willemb@google.com> ---- v6 -> v7 - update test to use new argument expect_fail - v6 received Reviewed-by, but dropped due to above (minor) change v5 -> v6 - fix order in tools/testing/selftests/drivers/net/config v4 -> v5 - move qdisc setup/restore into each test - add tc to utils.py (separate patch) - test expected failure (separate patch) - fix pylint - convert fail to pass for timing errors if KSFT_MACHINE_SLOW (cmd does not special case KSFT_SKIP process returncode yet) Responses to sashiko review - The test converts per packet failure to errors, to continue testing other packets, but other error() cases are not in scope. - The test starts sender and receiver at an absolute future time, like the original test. This assumes ~msec scale sync'ed clocks. - The tc qdisc replace command works fine with noqueue. Tested manually. v3 -> v4 - restore original qdisc after test - drop unnecessary underscore in tap test names v2 -> v3 - Makefile: so_txtime from YNL_GEN_FILES to TEST_GEN_FILES (Sashiko, NIPA) v1 -> v2 - move so_txtime.c for net/lib to drivers/net (Jakub) - fix drivers/net/config order (Jakub) - detect passing when failure is expected (Jakub, Sashiko) - pass pylint --disable=R (Jakub) - only call ksft_run once (Jakub) - do not sleep if waiting time is negative (Sashiko) - add \n when converting error() to fprintf() (Sashiko) - 4 space indentation, instead of 2 space - increase sync delay from 100 to 200ms, to fix rare vng flakes Link: https://patch.msgid.link/20260504174056.565319-4-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: net: py: add tc utilityWillem de Bruijn
Add a wrapper similar to existing ip, ethtool, ... commands. Tc takes a slightly different syntax. Account for that. The first user is the next patch in this series, converting so_txtime to drv-net. Pacing offload is supported by selected qdiscs only. Signed-off-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260504174056.565319-3-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05selftests: net: py: support cmd verifying expected failureWillem de Bruijn
Support negative tests, where cmd raises an exception if the command succeeded. Add optional argument expect_fail to cmd and bkg. Where fail fails the test on unexpected error, expect_fail fails it on unexpected success. Both fail on negative return code. Python subprocess may set a negative return code on process crash or timeout. Those are never anticipated failures. Signed-off-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260504174056.565319-2-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-05kselftest: fix doc for ksft_test_result_report()Woradorn Laodhanadhaworn
Fix documentation to reference ksft_test_result_report() instead of ksft_test_result(). Link: https://lore.kernel.org/r/20260505182213.22924-1-woradorn.laon@gmail.com Signed-off-by: Woradorn Laodhanadhaworn <woradorn.laon@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-05selftests/rseq: Make registration flexible for legacy and optimized modeThomas Gleixner
rseq_register_current_thread() either uses the glibc registered RSEQ region or registers it's own region with the legacy size of 32 bytes. That worked so far, but becomes a problem when the kernel implements a distinction between legacy and performance optimized behavior based on the registration size as that does not allow to test both modes with the self test suite. Add two arguments to the function. One to enforce that the registration is not using libc provided mode and one to tell the registration to use the legacy size and not the kernel advertised size. Rename it and make the original one a inline wrapper which preserves the existing behavior. Fixes: 566d8015f7ee ("rseq: Avoid CPU/MM CID updates when no event pending") Signed-off-by: Thomas Gleixner <tglx@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Tested-by: Dmitry Vyukov <dvyukov@google.com> Link: https://patch.msgid.link/20260428224427.677889423%40kernel.org Cc: stable@vger.kernel.org
2026-05-05selftests/rseq: Skip tests if time slice extensions are not availableThomas Gleixner
Don't fail, skip the test if the extensions are not enabled at compile or runtime. Fixes: 830969e7821a ("selftests/rseq: Implement time slice extension test") Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Tested-by: Dmitry Vyukov <dvyukov@google.com> Link: https://patch.msgid.link/20260428224427.597838491%40kernel.org Cc: stable@vger.kernel.org
2026-05-05selftests: openvswitch: add tests for tunnel vport refcountingIlya Maximets
There were a few issues found with the tunnel vport types around the vport destruction code. Add some basic tests, so at least we know that they can be properly added and removed without obvious issues. The test creates OVS datapath, adds a non-LWT tunnel port, makes sure they are created, and then removes the datapath and waits for all the ports to be gone. The dpctl script had a few bugs in the none-lwt tunnel creation code, so fixing them as well to make the testing possible: - The type of the --lwt option changed in order to properly disable it. - Removed byte order conversion for the port numbers, as the value supposed to be in the host order. - Added missing 'gre' choice for the tunnel type. Signed-off-by: Ilya Maximets <i.maximets@ovn.org> Acked-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Aaron Conole <aconole@redhat.com> Link: https://patch.msgid.link/20260430233848.440994-3-i.maximets@ovn.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-05-05selftests/membarrier: Add rseq stress test for CFS throttle interactionsAniket Gattani
Add a new stress test to exercise the interaction between targeted expedited membarrier commands and CFS bandwidth throttling. The test creates a deep cgroup hierarchy and aggressively hammers the membarrier syscall to expose lock contention and latency issues. This serves as a reliable reproducer for the `membarrier_ipi_mutex` cascade lockup, ensuring future changes to membarrier locking do not regress targeted command latency. Closes: https://lore.kernel.org/r/202604151516.Vc7Ro4LP-lkp@intel.com/ Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Aniket Gattani <aniketgattani@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20260503212205.3714217-4-aniketgattani@google.com
2026-05-04selftests: net: bridge: add MRC and QQIC field encoding testsUjjal Roy
Enhance vlmc_query_intvl_test and vlmc_query_response_intvl_test in bridge_vlan_mcast.sh to validate IGMPv3/MLDv2 protocol compliance for MRC and QQIC field encoding across both linear and exponential ranges. TEST: Vlan multicast snooping enable [ OK ] TEST: Vlan mcast_query_interval global option default value [ OK ] TEST: Number of tagged IGMPv2 general query [ OK ] TEST: IGMPv3 QQIC linear value 60(s) [ OK ] TEST: MLDv2 QQIC linear value 60(s) [ OK ] TEST: IGMPv3 QQIC non linear value 160(s) [ OK ] TEST: MLDv2 QQIC non linear value 160(s) [ OK ] TEST: Vlan mcast_query_response_interval global option default value [ OK ] TEST: IGMPv3 MRC linear value of 60(x0.1s) [ OK ] TEST: MLDv2 MRC linear value of 24000(ms) [ OK ] TEST: IGMPv3 MRC non linear value of 240(x0.1s) [ OK ] TEST: MLDv2 MRC non linear value of 48000(ms) [ OK ] Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Ujjal Roy <royujjal@gmail.com> Link: https://patch.msgid.link/20260502131907.987-6-royujjal@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-04net: selftests: add getsockopt_iter regression testsBreno Leitao
Add a single kselftest covering the proto_ops getsockopt_iter conversions for AF_NETLINK and AF_VSOCK, using one fixture per protocol: netlink: NETLINK_PKTINFO covers the flag-style int path (exact size, oversize clamp, undersize -EINVAL); NETLINK_LIST_MEMBERSHIPS covers the size-discovery path that always reports the required buffer length back via optlen, even when the user buffer is too small to receive any group bits. vsock: SO_VM_SOCKETS_BUFFER_SIZE covers the u64 path (exact size, oversize clamp, undersize -EINVAL). Each fixture also exercises an unknown optname and a bogus level so the returned-length / errno semantics preserved by the sockopt_t conversion are pinned down. Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com> Acked-by: Stanislav Fomichev <sdf@fomichev.me> Link: https://patch.msgid.link/20260501-getsock_one-v1-3-810ce23ea70e@debian.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-04selftests/resctrl: Reduce L2 impact on CAT testReinette Chatre
The L3 CAT test loads a buffer into cache that is proportional to the L3 size allocated for the workload and measures cache misses when accessing the buffer as a test of L3 occupancy. When loading the buffer it can be assumed that a portion of the buffer will be loaded into the L2 cache and depending on cache design may not be present in L3. It is thus possible for data to not be in L3 but also not trigger an L3 cache miss when accessed. Reduce impact of L2 on the L3 CAT test by, if L2 allocation is supported, minimizing the portion of L2 that the workload can allocate into. This encourages most of buffer to be loaded into L3 and support better comparison between buffer size, cache portion, and cache misses when accessing the buffer. Link: https://lore.kernel.org/r/1f5aad318889cd6d4f9a8d8b0fbe83e3848d41a9.1775266384.git.reinette.chatre@intel.com Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-04selftests/resctrl: Simplify perf usage in CAT testReinette Chatre
The CAT test relies on the PERF_COUNT_HW_CACHE_MISSES event to determine if modifying a cache portion size is successful. This event is configured to report the data as part of an event group, but no other events are added to the group. Remove the unnecessary PERF_FORMAT_GROUP format setting. This eliminates the need for struct perf_event_read and results in read() of the associated file descriptor to return just one value associated with the PERF_COUNT_HW_CACHE_MISSES event of interest. Link: https://lore.kernel.org/r/fb69325eba5031b735fa79effaaacd797c9c6040.1775266384.git.reinette.chatre@intel.com Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-04selftests/resctrl: Remove requirement on cache miss rateReinette Chatre
As the CAT test reads the same buffer into different sized cache portions it compares the number of cache misses against an expected percentage based on the size of the cache portion. Systems and test conditions vary. The CAT test is a test of resctrl subsystem health and not a test of the hardware architecture so it is not required to place requirements on the size of the difference in cache misses, just that the number of cache misses when reading a buffer increase as the cache portion used for the buffer decreases. Remove additional constraint on how big the difference between cache misses should be as the cache portion size changes. Only test that the cache misses increase as the cache portion size decreases. This remains a good sanity check of resctrl subsystem health while reducing impact of hardware architectural differences and the various conditions under which the test may run. Increase the size difference between cache portions to additionally avoid any consequences resulting from smaller increments. Link: https://lore.kernel.org/r/6de4da5486354c0f25fef0d194956470cb744041.1775266384.git.reinette.chatre@intel.com Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-04selftests/resctrl: Raise threshold at which MBM and PMU values are comparedReinette Chatre
Commit 501cfdba0a40 ("selftests/resctrl: Do not compare performance counters and resctrl at low bandwidth") introduced a threshold under which memory bandwidth values from MBM and performance counters are not compared. This is needed because MBM and the PMUs do not have an identical view of memory bandwidth since PMUs can count all memory traffic while MBM does not count "overhead" (for example RAS) traffic that cannot be attributed to an RMID. As a ratio this difference in view of memory bandwidth is pronounced at low memory bandwidths. The 750MiB threshold was chosen arbitrarily after comparisons on different platforms. Exposed to more platforms after introduction this threshold has proven to be inadequate. Having accurate comparison between performance counters and MBM requires careful management of system load as well as control of features that introduce extra memory traffic, for example, patrol scrub. This is not appropriate for the resctrl selftests that are intended to run on a variety of systems with various configurations. Increase the memory bandwidth threshold under which no comparison is made between performance counters and MBM. Add additional leniency by increasing the percentage of difference that will be tolerated between these counts. There is no impact to the validity of the resctrl selftests results as a measure of resctrl subsystem health. Link: https://lore.kernel.org/r/b374c33ddd324130d6255cbb91c3dd500e8277e7.1775266384.git.reinette.chatre@intel.com Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-04selftests/resctrl: Increase size of buffer used in MBM and MBA testsReinette Chatre
Errata for Sierra Forest [1] (SRF42) and Granite Rapids [2] (GNR12) describe the problem that MBM on Intel RDT may overcount memory bandwidth measurements. The resctrl tests compare memory bandwidth reported by iMC PMU to that reported by MBM causing the tests to fail on these systems depending on the settings of the platform related to the errata. Since the resctrl tests need to run under various conditions it is not possible to ensure system settings are such that MBM will not overcount. It has been observed that the overcounting can be controlled via the buffer size used in the MBM and MBA tests that rely on comparisons between iMC PMU and MBM measurements. Running the MBM test on affected platforms with different buffer sizes it can be observed that the difference between iMC PMU and MBM counts reduce as the buffer size increases. After increasing the buffer size to more than 4X the differences between iMC PMU and MBM become insignificant. Increase the buffer size used in MBM and MBA tests to 4X L3 size to reduce possibility of tests failing due to difference in counts reported by iMC PMU and MBM. Link: https://lore.kernel.org/r/1bd4d8c5fc791234b0a9da94f29a3e278ba2f7ee.1775266384.git.reinette.chatre@intel.com Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://edc.intel.com/content/www/us/en/design/products-and-solutions/processors-and-chipsets/sierra-forest/xeon-6700-series-processor-with-e-cores-specification-update/errata-details/ # [1] Link: https://edc.intel.com/content/www/us/en/design/products-and-solutions/processors-and-chipsets/birch-stream/xeon-6900-6700-6500-series-processors-with-p-cores-specification-update/011US/errata-details/ # [2] Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-04selftests/resctrl: Support multiple events associated with iMCReinette Chatre
The resctrl selftests discover needed parameters to perf_event_open() via sysfs. The PMU associated with every memory controller (iMC) is discovered via the /sys/bus/event_source/devices/uncore_imc_N/type file while the read memory bandwidth event type and umask is discovered via /sys/bus/event_source/devices/uncore_imc_N/events/cas_count_read. Newer systems may have multiple events that expose read memory bandwidth. Running a recent kernel that includes commit 6a8a48644c4b ("perf/x86/intel/uncore: Add per-scheduler IMC CAS count events") on these systems expose the multiple events. For example, /sys/bus/event_source/devices/uncore_imc_N/events/cas_count_read_sch0 /sys/bus/event_source/devices/uncore_imc_N/events/cas_count_read_sch1 Support parsing of iMC PMU properties when the PMU may have multiple events to measure read memory bandwidth. The PMU only needs to be discovered once. Split the parsing of event details from actual PMU discovery in order to loop over all events associated with the PMU. Match all events with the cas_count_read prefix instead of requiring there to be one file with that name. Make the parsing code more robust. With strings passed around to create needed paths, use snprintf() instead of sprintf() to ensure there is always enough space to create the path while using the standard PATH_MAX for path lengths. Ensure there is enough room in imc_counters_config[] before attempting to add an entry. Link: https://lore.kernel.org/r/b03ca0fa21a09500c56ee589e32516c2c5effeaf.1775266384.git.reinette.chatre@intel.com Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com> Reviewed-by: Zide Chen <zide.chen@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-04selftests/resctrl: Prepare for parsing multiple events per iMCReinette Chatre
The events needed to read memory bandwidth are discovered by iterating over every memory controller (iMC) within /sys/bus/event_source/devices. Each iMC's PMU is assumed to have one event to measure read memory bandwidth that is represented by the sysfs cas_count_read file. The event's configuration is read from "cas_count_read" and stored as an element of imc_counters_config[] by read_from_imc_dir() that receives the index of the array where to store the configuration as argument. It is possible that an iMC's PMU may have more than one event that should be used to measure memory bandwidth. Change semantics to not provide the index of the array to read_from_imc_dir() but instead a pointer to the index. This enables read_from_imc_dir() to store configurations for more than one event by incrementing the index to imc_counters_config[] itself. Ensure that the same type is consistently used for the index as it is passed around during counter configuration. Link: https://lore.kernel.org/r/549e026d20af0381349e645c912e6470fce8bd7e.1775266384.git.reinette.chatre@intel.com Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com> Reviewed-by: Zide Chen <zide.chen@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-04selftests/resctrl: Do not store iMC counter value in counter config structureReinette Chatre
The MBM and MBA tests compare MBM memory bandwidth measurements against the memory bandwidth event values obtained from each memory controller's PMU. The memory bandwidth event settings are discovered from the memory controller details found in /sys/bus/event_source/devices/uncore_imc_N and stored in struct imc_counter_config. In addition to event settings struct imc_counter_config contains imc_counter_config::return_value in which the associated event value is stored on every read. The event value is consumed and immediately recorded at regular intervals. The stored value is never consumed afterwards, making its storage as part of event configuration unnecessary. Remove the return_value member from struct imc_counter_config. Instead just use a more aptly named "measurement" local variable for use during event reading. Link: https://lore.kernel.org/r/e0b6ad2755e2fd802f54b0bc07eeb90247baca19.1775266384.git.reinette.chatre@intel.com Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-04selftests/resctrl: Reduce interference from L2 occupancy during cache ↵Reinette Chatre
occupancy test The CMT test creates a new control group that is also capable of monitoring and assigns the workload to it. The workload allocates a buffer that by default fills a portion of the L3 and keeps reading from the buffer, measuring the L3 occupancy at intervals. The test passes if the workload's L3 occupancy is within 15% of the buffer size. The CMT test does not take into account that some of the workload's data may land in L2/L1. Matching L3 occupancy to the size of the buffer while a portion of the buffer can be allocated into L2 is not accurate. Take the L2 cache into account to improve test accuracy: - Reduce the workload's L2 cache allocation to the minimum on systems that support L2 cache allocation. Do so with a new utility in preparation for all L3 cache allocation tests needing the same capability. - Increase the buffer size to accommodate data that may be allocated into the L2 cache. Use a buffer size double the L3 portion to keep using the L3 portion size as goal for L3 occupancy while taking into account that some of the data may be in L2. Running the CMT test on a sample system while introducing significant cache misses using "stress-ng --matrix-3d 0 --matrix-3d-zyx" shows significant improvement in L3 cache occupancy: Before: # Starting CMT test ... # Mounting resctrl to "/sys/fs/resctrl" # Cache size :335544320 # Writing benchmark parameters to resctrl FS # Write schema "L3:0=fffe0" to resctrl FS # Write schema "L3:0=1f" to resctrl FS # Benchmark PID: 7089 # Checking for pass/fail # Pass: Check cache miss rate within 15% # Percent diff=12 # Number of bits: 5 # Average LLC val: 73269248 # Cache span (bytes): 83886080 ok 1 CMT: test After: # Starting CMT test ... # Mounting resctrl to "/sys/fs/resctrl" # Cache size :335544320 # Writing benchmark parameters to resctrl FS # Write schema "L3:0=fffe0" to resctrl FS # Write schema "L3:0=1f" to resctrl FS # Write schema "L2:1=0x1" to resctrl FS # Benchmark PID: 7171 # Checking for pass/fail # Pass: Check cache miss rate within 15% # Percent diff=0 # Number of bits: 5 # Average LLC val: 83755008 # Cache span (bytes): 83886080 ok 1 CMT: test Link: https://lore.kernel.org/r/00445fa64c251b86b86023f87220ee1ad8561460.1775266384.git.reinette.chatre@intel.com Reported-by: Dave Martin <Dave.Martin@arm.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/lkml/aO+7MeSMV29VdbQs@e133380.arm.com/ Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-04selftests/resctrl: Improve accuracy of cache occupancy testReinette Chatre
Dave Martin reported inconsistent CMT test failures. In one experiment the first run of the CMT test failed because of too large (24%) difference between measured and achievable cache occupancy while the second run passed with an acceptable 4% difference. The CMT test is susceptible to interference from the rest of the system. This can be demonstrated with a utility like stress-ng by running the CMT test while introducing cache misses using: stress-ng --matrix-3d 0 --matrix-3d-zyx Below shows an example of the CMT test failing because of a significant difference between measured and achievable cache occupancy when run with interference: # Starting CMT test ... # Mounting resctrl to "/sys/fs/resctrl" # Cache size :335544320 # Writing benchmark parameters to resctrl FS # Benchmark PID: 7011 # Checking for pass/fail # Fail: Check cache miss rate within 15% # Percent diff=99 # Number of bits: 5 # Average LLC val: 235929 # Cache span (bytes): 83886080 not ok 1 CMT: test The CMT test creates a new control group that is also capable of monitoring and assigns the workload to it. The workload allocates a buffer that by default fills a portion of the L3 and keeps reading from the buffer, measuring the L3 occupancy at intervals. The test passes if the workload's L3 occupancy is within 15% of the buffer size. By not adjusting any capacity bitmasks the workload shares the cache with the rest of the system. Any other task that may be running could evict the workload's data from the cache causing it to have low cache occupancy. Reduce interference from the rest of the system by ensuring that the workload's control group uses the capacity bitmask found in the user parameters for L3 and that the rest of the system can only allocate into the inverse of the workload's L3 cache portion. Other tasks can thus no longer evict the workload's data from L3. With the above adjustments the CMT test is more consistent. Repeating the CMT test while generating interference with stress-ng on a sample system after applying the fixes show significant improvement in test accuracy: # Starting CMT test ... # Mounting resctrl to "/sys/fs/resctrl" # Cache size :335544320 # Writing benchmark parameters to resctrl FS # Write schema "L3:0=fffe0" to resctrl FS # Write schema "L3:0=1f" to resctrl FS # Benchmark PID: 7089 # Checking for pass/fail # Pass: Check cache miss rate within 15% # Percent diff=12 # Number of bits: 5 # Average LLC val: 73269248 # Cache span (bytes): 83886080 ok 1 CMT: test Link: https://lore.kernel.org/r/b160592179f88069cdc679563e152007998a0d76.1775266384.git.reinette.chatre@intel.com Reported-by: Dave Martin <Dave.Martin@arm.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/lkml/aO+7MeSMV29VdbQs@e133380.arm.com/ Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-04Merge tag 'linux_kselftest-fixes-7.1-rc3' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest Pull kselftest fixes from Shuah Khan: - Fix extra test number increment in ksft_exit_skip() that results in incorrect KTAP result - Fix regression introduced by addition of explicit constructor orders for fixture tests. This addition broke the ordering of those relative to non-fixture tests and the reverse-constructor-order detection * tag 'linux_kselftest-fixes-7.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests: harness: Restore order of test functions selftests: kselftest: fix wrong test number in ksft_exit_skip
2026-05-05selftests: ovpn: reduce ping count in test.shRalf Lici
The second stage of test.sh ("run baseline data traffic") performs a basic connectivity check with ping -qfc 500 -w 3. On slower CI instances this is too strict for TCP: the RTT is high enough that 500 echo requests do not reliably complete within 3 seconds, so the stage flakes and the test fails even though the ovpn setup is healthy. Reduce the packet count to 100 for both the plain and 3000-byte pings in that stage. This still verifies peer setup, key exchange, routing, and data-path traffic, without making the basic connectivity check depend on timing out under load. Fixes: 959bc330a439 ("testing/selftests: add test tool and scripts for ovpn module") Signed-off-by: Ralf Lici <ralf@mandelbit.com> Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2026-05-04kunit: Fix spelling mistakes in comments and messagesJinseok Kim
Fix two spelling mistakes in kunit tooling: Bascially -> Basically higer -> higher Link: https://lore.kernel.org/r/20260501162739.3861-1-always.starving0@gmail.com Signed-off-by: Jinseok Kim <always.starving0@gmail.com> Reviewed-by: David Gow <david@davidgow.net> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-04kunit: qemu_configs: Add or1k / openrisc configurationThomas Weißschuh
Add a basic configuration to run kunit tests on or1k / openrisc. Link: https://lore.kernel.org/r/20260427-kunit-or1k-v1-2-9d3109e991e8@weissschuh.net Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: David Gow <david@davidgow.net> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2026-05-04Merge tag 'v7.1-rc2' into nolibc/for-nextThomas Weißschuh
Pick up commit b0aa5e4b087b ("sh: Fix fallout from ZERO_PAGE consolidation") to fix the sh4 selftests. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-05-03tools/nolibc: add support for 32-bit pariscThomas Weißschuh
Extend nolibc to target the 32-bit parisc architecture. 64-bit is not yet supported. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch/msgid.link/20260428-nolibc-hppa-v5-2-d843d573111a@weissschuh.net
2026-05-03selftests/nolibc: avoid function pointer comparisonsThomas Weißschuh
The upcoming parisc support would require libgcc to implement function pointer comparisons. As we try to avoid the libgcc dependency rework the logic to work without such comparisons. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260428-nolibc-hppa-v5-1-d843d573111a@weissschuh.net
2026-05-03tools/nolibc: add support for OpenRISC / or1kThomas Weißschuh
Add support for OpenRISC / or1k to nolibc. _start() uses the same wrapper construct as in arch-sh.h. libgcc is necessary as OpenRISC is missing 64-bit multiplication. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Stafford Horne <shorne@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260429-nolibc-openrisc-v2-1-8d7d7a2f3fec@weissschuh.net
2026-05-03selftests/nolibc: use vmlinux for MIPS testsThomas Weißschuh
QEMU for MIPS can also load 'vmlinux'. Slim down the table by using that from the fallback. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260429-nolibc-qemu-arch-v1-7-a2ca07eab297@weissschuh.net