summaryrefslogtreecommitdiff
path: root/tools/testing
AgeCommit message (Collapse)Author
2026-09-30KVM: selftests: Add coverage for the EFER_LMSLE_MBZ defeatureJim Mattson
Add coverage for KVM's virtualization of EFER_LMSLE_MBZ, CPUID.80000008H:EBX[bit 20], which is set when the CPU does *not* support long mode segment limits. Verify that KVM's enumeration of the defeature matches the expectation derived from hardware plus kvm_amd's "nested" module param, so that the assertion doesn't compare KVM's enumeration against itself, and that WRMSR(EFER), nested VMRUN, and KVM_SET_SREGS reject EFER.LMSLE=1 if and only if guest CPUID enumerates the defeature. Also verify that host-initiated KVM_SET_MSRS is exempt from the check, as host-initiated writes skip guest CPUID checks so that userspace can set MSRs before it sets guest CPUID. Extend svm_nested_efer_test rather than add yet another test binary for a single CPUID bit; the test already has the L1/L2 harness needed to exercise EFER.LMSLE. Note, only a CPU that supports LMSLE, i.e. Rome and earlier, exercises the emulation path; elsewhere KVM enumerates the defeature straight from hardware. Opportunistically drop the unnecessary #include of vmx.h. Assisted-by: LLM Signed-off-by: Jim Mattson <jmattson@google.com> [sean: drop specific APM volume references, use common "nested" getter] Link: https://patch.msgid.link/20260930212114.3500045-6-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-09-30KVM: selftests: Add module param API to check if nested virtualization is ↵Sean Christopherson
enabled Add an API to check if the nested virtualization module param is enabled, e.g. so that tests can verify KVM's own enumeration of the corresponding CPU feature. Provide a big warning above the API to make it as obvious as possible clear that tests should use "kvm_cpu_has(X86_FEATURE_VMX) || kvm_cpu_has(X86_FEATURE_SVM)" when checking for nested virtualization. It doesn't really matter which method tests use, as KVM is supposed to keep "nested" synchronized with VMX/SVM enumeration, but make the comment super scary to try and prevent KVM selftests from having two different ways of doing the same thing. Note, the bool vs. int mess is intentional, because KVM's params are terrible. kvm_amd.ko provides an "int", while kvm_intel.ko provides a "bool". Link: https://patch.msgid.link/20260930212114.3500045-5-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-09-30KVM: selftests: Rename svm_nested_clear_efer_svme to svm_nested_efer_testJim Mattson
Rename svm_nested_clear_efer_svme.c to svm_nested_efer_test.c so that the test can host coverage for other EFER bits whose behavior is tied to nested SVM, and so that the name matches the svm_nested_<topic>_test convention used by svm_nested_pat_test, svm_nested_shutdown_test, etc. No functional change intended. Assisted-by: LLM Signed-off-by: Jim Mattson <jmattson@google.com> Link: https://patch.msgid.link/20260930212114.3500045-4-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-09-30sched_ext: Merge branch 'for-7.3-fixes' into for-7.4Tejun Heo
Pull to receive cc07fae1de5d ("selftests/sched_ext: Add a test for ops.dequeue() on remote local DSQ moves") and resolve its conflict with f73ec6791424 ("sched_ext: Add selftest for blocked donor admission") here so that for-next merges clean. Conflicts: kept both auto-test-targets entries in the selftests Makefile, where each side added one after dequeue_iter. Signed-off-by: Tejun Heo <tj@kernel.org>
2026-09-30selftests/sched_ext: Add a test for ops.dequeue() on remote local DSQ movesKuba Piecuch
Add a dequeue_remote test that makes moves of tasks in the BPF scheduler's custody to another CPU's local DSQ the common case, both via SCX_DSQ_LOCAL_ON dispatch and via scx_bpf_dsq_move_to_local(). The BPF scheduler tracks each task's custody state and triggers scx_bpf_error() if a custody period doesn't end with exactly one ops.dequeue() before the task runs, or if it ends with an SCX_DEQ_CORE_SCHED_EXEC dequeue of a task without a core cookie. Without the previous patch, the test fails with: sched_ext: dequeue_remote: dequeue_remote.bpf.c:141: 15 (rcu_preempt): late ops.dequeue() with SCX_DEQ_CORE_SCHED_EXEC (enq_cpu=3 cpu=2 seq=1) ... ops_dequeue+0x114/0x170 set_next_task_scx+0x104/0x1e0 __pick_next_task+0xc7/0x180 __schedule+0x154/0x1870 Reviewed-by: Andrea Righi <arighi@nvidia.com> Assisted-by: Claude:claude-opus-5.5 Signed-off-by: Kuba Piecuch <jpiecuch@google.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2026-09-30Merge remote-tracking branch 'ionic/ionic-shared' into wip/leon-for-nextLeon Romanovsky
Preparatory patch to support SRQ in RDMA ionic driver. Signed-off-by: Leon Romanovsky <leon@kernel.org> * ionic/ionic-shared: (1790 commits) net: ionic: Fetch qid allocation and SRQ capability from firmware Linux 7.3-rc4 ...
2026-09-30KVM: selftests: Delete the unused guest_snprintf()Gokul K
Delete guest_snprintf() as it isn't used, has never been used, and in all likelihood will never be used. Because variadic functions can't pass along va_args verbatim, guest_snprintf() can't be used as-is by things like ucall_fmt(). guest_snprintf() could be used to dedup the ucall code by turning it into a macro, but that would still require implicitly consuming the caller's variadic arguments and would risk creating variable shadows, i.e. introduces fragility for very little benefit. No functional change intended. Link: https://lore.kernel.org/all/20260930002238.649421F000FF@smtp.kernel.org Signed-off-by: Gokul K <gokul02k@gmail.com> Closes: https://lore.kernel.org/all/20260918113631.634233-4-gokul02k@gmail.com Link: https://patch.msgid.link/20260918113631.634233-4-gokul02k@gmail.com [sean: massage changelog] Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-09-30selftests/bpf: Test Program Structure diagnostic contextKumar Kartikeya Dwivedi
Exercise each corrected Program Structure report. Place a missing-table gotox after another instruction so its attribution differs from the subprogram start. Add malformed subprogram layouts for a branch crossing a subprogram boundary and a subprogram that falls through its end. Both cases carry BTF line records and assert that their structured reports include the corresponding source function and file. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/cf2f420c2b21de440a7dc51b1565c0f06d4b539640ee5c03384e5d77bcfb5686@mail.kernel.org/ Link: https://lore.kernel.org/r/20260924170646.2366016-8-memxor@gmail.com Link: https://lore.kernel.org/bpf/20260926133048.2962553-4-memxor@gmail.com
2026-09-30selftests/bpf: Test non-sleepable kfunc contextKumar Kartikeya Dwivedi
A sleepable kfunc call can be rejected because the program itself is not sleepable or because a sleepable program is inside an active critical section. Exercise the two causes separately. Call a sleepable kfunc directly from a non-sleepable tracing program, then call it from a sleepable tracing program inside an RCU read-side critical section. Assert both the legacy verifier messages and the structured reasons. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/2e42a1a2bf45f4d2aba7495bdc9f147558055740e2f3c8b9dae255f6c57fc13c@mail.kernel.org/ Link: https://lore.kernel.org/r/20260924170646.2366016-6-memxor@gmail.com Link: https://lore.kernel.org/bpf/20260926133048.2962553-2-memxor@gmail.com
2026-09-30selftests/bpf: Skip callx switch table test for clang-22 with cpu=v4Ihor Solodrai
clang-22 miscompiles call_by_switch() when targeting -mcpu=v4: it turns the switch into an array of pointers to functions and then erroneously removes the array in BPFAsmPrinter::doFinalization(), breaking the build with: error: Undefined temporary symbol .Lswitch.table.call_by_switch Fixed by llvm commit 9fc458a1d95b ("[BPF] Fix erroneous removal of non-jump-table globals"), first released in clang-23; older clangs are fine. test_progs-cpuv4 is built by default whenever clang supports v4, so selftests/bpf fails to build with any clang-22 release. Guard just this test with the compiler/cpu check and leave a __skip placeholder for the broken combination, so the gap is reported as SKIP instead of silently missing. Fixes: b018e998e645 ("selftests/bpf: Add tests for callx through pointers in read-only data") Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20260930020851.71691-1-ihor.solodrai@linux.dev
2026-09-30selftests/bpf: Show the tag kflag in the raw BTF dump helperIhor Solodrai
A kflag on BTF_KIND_DECL_TAG or BTF_KIND_TYPE_TAG means the tag string is an __attribute__ list rather than a btf_decl_tag()/btf_type_tag() argument. fprintf_btf_type_raw() did not print it, so a tag added with btf__add_decl_tag() and an attribute added with btf__add_decl_attr() dumped identically apart from their type IDs. Print " kflag=1" for those two kinds, only when the flag is set, so no existing expected string changes. Add a btf_write subtest for btf__add_decl_attr() and btf__add_type_attr(). Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://patch.msgid.link/20260929234608.48503-6-ihor.solodrai@linux.dev
2026-09-30selftests/bpf: Test btf_dump rendering of decl_tagsIhor Solodrai
Cover the decl tag rendering the libbpf patch added. One subtest builds a BTF with every shape that renders, plus two that must not: - a named record with both forms of tag - a typedef'd anonymous record, whose attribute precedes the declarator - a union - a record that also carries the derived packed attribute - an anonymous record inlined at a member - two records whose tags are added in reverse target order, which is what pins the sort: without it the records lose their attributes - attributes on a var and on a func, which btf_dump never declares The incremental subtest's second round adds an attribute to the new struct, pinning the later-walk indexing of appended types. A separate subtest covers members. A member attribute and a record one share a key in the index, so it checks they do not leak into each other's position, over a function pointer, an array and a bit-field - declarators the attribute has to follow rather than precede. Another covers typedefs, including a typedef of an anonymous record carrying three groups at once, binding to the member, the record and the typedef. Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://patch.msgid.link/20260929234608.48503-5-ihor.solodrai@linux.dev
2026-09-30selftests/bpf: Add ASSERT_TEXT_EQ()Ihor Solodrai
Text comparisons in test_progs repeat the same two statements: compare_text_to_expected() to print the diff, then an assert to record the failure. ASSERT_OK() on the raw return also appends a stale errno to the failure output. Add ASSERT_TEXT_EQ() after ASSERT_HAS_SUBSTR(). The assert cannot move into compare_text_to_expected() itself: the helper is linked into standalone binaries without test__fail(), and the framework unit test checks the raw mismatch return. Convert the 3 test_progs call sites plus test_ctx__dump_and_compare(), so multi-line dumps fail with a diff; prog_tests_framework.c keeps calling the helper directly. Suggested-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20260929234608.48503-4-ihor.solodrai@linux.dev
2026-09-30KVM: arm64: selftests: Check ID regs are immutable after a failed runFuad Tabba
Add a set_id_regs case covering ID register immutability when a vCPU's first KVM_RUN fails after finalization but before KVM_ARCH_FLAG_HAS_RAN_ONCE is set. The test provokes such a failure with a PMUv3-enabled vCPU whose PMU is left uninitialized, then checks that KVM_SET_ONE_REG on the feature and implementation ID registers, and KVM_CREATE_DEVICE for a vGIC, are all rejected with -EBUSY. Assisted-by: LLM [Fixed for latest tag standard -- broonie] Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260805064740.3013538-1-fuad.tabba@linux.dev Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Tested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org> Acked-by: Mark Brown <broonie@kernel.org> Reviewed-by: Oliver Upton <oupton@kernel.org> Link: https://patch.msgid.link/20260929-kvm-arm64-idreg-final-v4-3-75296dde994d@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
2026-09-30selftests: net: check timestamp echo after an old ACKJeff Jo
Add a regression test for a gap-filling packet whose acknowledgment has become old. Linux first sends data to the peer. Deliver two peer data packets out of order: the later packet acknowledges Linux's data, while the delayed packet still carries the earlier acknowledgment. Require the ACK that closes the receive gap to echo the delayed packet's timestamp, 301000. Without the fix, Linux accepts the data but still echoes the previously saved timestamp, 1000. Also check that the application can read all 34 bytes. Use a large jump in peer timestamps to represent the idle interval, with no real wait, loss or retransmission. The test directly checks the outgoing timestamp echo. It requires packetdrill's merged TSecr verification fix (linked below); older tools incorrectly pass on an unfixed kernel. Use the existing packetdrill selftest runner for IPv4, IPv6 and IPv4-mapped IPv6. Link: https://github.com/google/packetdrill/commit/83f72d3f9085d0e26eb4d206fe4d7cfab5b6d872 Assisted-by: LLM Signed-off-by: Jeff Jo <jeffjo@openai.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2026-09-29selftests: net: test untracked NA recovery of FAILED neighborsLawrence Lee
Seed a FAILED neighbor before triggering an unsolicited NA. Verify that the entry transitions to STALE and learns the advertised link-layer address only when drop_unsolicited_na is disabled, accept_untracked_na mode 1 or in-prefix mode 2 is enabled, and IPv6 forwarding is enabled. Verify that disabling each gate keeps the entry in FAILED without a link-layer address. Mark the seed externally learned and disable carrier-based eviction so the entry cannot be garbage-collected before the NA arrives. Require the marker after processing to prove that a recovered entry was updated in place instead of deleted and recreated. Keep the NA source, target, and neighbor key fixed for the mode 2 cases. Vary the prefix configured on the router to exercise the source-prefix check without changing the entry under test. Arm packet capture before bringing up the host interface and starting DAD. Wait for the capture to become ready and for tcpdump to exit so the NA cannot be missed and receive processing is complete before checking the neighbor entry. Preserve the return code from test_unsolicited_na_common() before constructing the test description. The array assignment previously reset the return code to zero and caused existing cases to report false success. Link: https://lore.kernel.org/r/20260813233344.445265-1-lfqlee314@gmail.com Signed-off-by: Lawrence Lee <lfqlee314@gmail.com> Link: https://patch.msgid.link/ce40008682ed26ab039168a5fcb515eff8d30c3a.1790127207.git.lfqlee314@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-29selftests: net: cover UDP splice checksum fragment alignmentAlireza Asgari
Exercise software UDP checksums when splice() transfers multiple pipe fragments into a corked datagram. Use separate source pipes so short writes cannot merge, and use odd fragment lengths to expose checksum-position errors between fragments. Cover IPv4, IPv6 and IPv4-mapped destinations, connected and unconnected sockets, resident prefixes, even and odd fragment lengths, and a fragment starting near a page boundary. Ordinary sends provide a control. Check the complete payload and reject extra datagrams after a successful send. Keep receive waits bounded and skip unavailable address families or pipe capacities. The test uses only loopback sockets with ephemeral ports and has no dependency on the application that exposed the regression. Signed-off-by: Alireza Asgari <alireza@asgari.net> Link: https://patch.msgid.link/20260924-fix-udp-splice-checksum-v1-2-fe61d65447a8@asgari.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-29selftests/net: check auto-selected port with reuse optionsJiayuan Chen
Use IP_LOCAL_PORT_RANGE to limit a socket to 8 ports, bind 8 sockets to port 0 and check they get 8 distinct ports and the 9th bind fails with EADDRINUSE. Run it for the four combinations of reuse options on the sockets: none (existing test) SO_REUSEPORT SO_REUSEADDR SO_REUSEADDR + SO_REUSEPORT TCP passes all four. Before the udp fix UDP only passes the first one: the scan hands out a port already taken by a socket with the same reuse options, so fewer than 8 distinct ports come back and the 9th bind succeeds. # ./ip_local_port_range.sh Before: ok 13 ip_local_port_range.ip4_udp.exhaust_8_port_range not ok 14 ip_local_port_range.ip4_udp.exhaust_8_port_range_reuseport not ok 15 ip_local_port_range.ip4_udp.exhaust_8_port_range_reuseaddr not ok 16 ip_local_port_range.ip4_udp.exhaust_8_port_range_reuseaddr_reuseport ok 49 ip_local_port_range.ip6_udp.exhaust_8_port_range not ok 50 ip_local_port_range.ip6_udp.exhaust_8_port_range_reuseport not ok 51 ip_local_port_range.ip6_udp.exhaust_8_port_range_reuseaddr not ok 52 ip_local_port_range.ip6_udp.exhaust_8_port_range_reuseaddr_reuseport After: ok 13 ip_local_port_range.ip4_udp.exhaust_8_port_range ok 14 ip_local_port_range.ip4_udp.exhaust_8_port_range_reuseport ok 15 ip_local_port_range.ip4_udp.exhaust_8_port_range_reuseaddr ok 16 ip_local_port_range.ip4_udp.exhaust_8_port_range_reuseaddr_reuseport ok 49 ip_local_port_range.ip6_udp.exhaust_8_port_range ok 50 ip_local_port_range.ip6_udp.exhaust_8_port_range_reuseport ok 51 ip_local_port_range.ip6_udp.exhaust_8_port_range_reuseaddr ok 52 ip_local_port_range.ip6_udp.exhaust_8_port_range_reuseaddr_reuseport Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev> Link: https://patch.msgid.link/20260928023145.301855-2-jiayuan.chen@linux.dev Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-29RDMA/selftests: Fix the kernel config fragmentSasha Levin
The config fragment lists bare option names with no values: CONFIG_TUN CONFIG_VETH CONFIG_DUMMY CONFIG_NET_NS CONFIG_RDMA_RXE which is not valid Kconfig syntax. When the fragment is merged, for example by "make kselftest-merge" or by CI systems, the lines are rejected: .config:5514:warning: unexpected data: CONFIG_TUN .config:5515:warning: unexpected data: CONFIG_VETH .config:5516:warning: unexpected data: CONFIG_DUMMY and none of the options gets enabled, so the rxe tests skip or fail for lack of the modules they load. Give each option a value. The scripts load and unload tun, veth, dummy and rdma_rxe with modprobe, so build those as modules. RDMA_RXE also depends on INFINIBAND, and rxe_rping_between_netns.sh runs rping, which needs the RDMA CM userspace interface provided by INFINIBAND_USER_ACCESS, so add both. Found by KernelCI kselftest builds. Fixes: e01027cab38a ("RDMA/rxe: Add testcase for net namespace rxe") Fixes: ecdcc8a455b7 ("RDMA/selftests: Add rxe_netns_names test") Link: https://patch.msgid.link/r/20260927161655.1184153-1-sashal@kernel.org Assisted-by: LLM Signed-off-by: Sasha Levin <sashal@kernel.org> Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2026-09-29kbuild: Move gen_init_cpio and gen_initramfs.sh to scripts/Nicolas Schier
gen_init_cpio and gen_initramfs.sh are part of kbuild and required for all kernel builds w/ CONFIG_BLK_DEV_INITRD. Move both to scripts/ to be more clear about their importance. Link: https://lore.kernel.org/all/aSdrCFkUQup3qb-q@derry.ads.avm.de/ Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Nicolas Schier <nsc@kernel.org> Link: https://patch.msgid.link/20260928-move-gen_init_cpio-to-scripts-v4-2-f437a33c40ac@kernel.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-29selftests/timers: clocksource-switch: Fix unchecked open()/read()Qingshuang Fu
get_clocksources() and get_cur_clocksource() open and read the clocksource sysfs files without checking the return values and without NUL-terminating the buffer. If open() fails, read() is called on fd -1 and returns -1, which is stored in a size_t as SIZE_MAX. The token-scanning loop in get_clocksources() then walks past the uninitialized stack buffer, reading and writing out of bounds. Even on success the buffer is not NUL-terminated, so a fully read buffer makes the inner scan run past the data, and get_cur_clocksource() lets change_clocksource() call strlen() on a non-terminated buffer. Check the open()/read() results, use ssize_t for the read length, NUL-terminate the buffer, and close the fd in get_cur_clocksource(). Fixes: 7290ce1423c3 ("selftests/timers: Add clocksource-switch test from timetest suite") Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260825064605.472889-1-fffsqian@163.com
2026-09-29selftests: timers: Measure the CPU timers on the clock they countEva Kurchatova
Commit b00385b8d081 ("selftests/posix_timers: Use CLOCK_THREAD_CPUTIME_ID for ITIMER_PROF measurements") gave ITIMER_PROF the clock it counts, as measuring a CPU timer against the wall says nothing on a machine where the task does not have a CPU to itself. The other CPU timers are still measured against CLOCK_REALTIME and fail the same way. With four busy loops on the two CPUs of a test machine: not ok 2 ITIMER_VIRTUAL not ok 5 timer_create() per CLOCK_THREAD_CPUTIME_ID not ok 6 timer_create() per CLOCK_PROCESS_CPUTIME_ID ITIMER_VIRTUAL counts the time the task spends in userspace, so take CLOCK_THREAD_CPUTIME_ID for it as well; the loop it runs stays in userspace, so what that clock adds for system time is far inside the half a second the check allows. check_timer_create() arms its timer on the clock it is given, so measure on that one. The test then passes whole on that machine, 19 of 19, busy or idle. Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260917015237.2462954-2-eva.kurchatova@virtuozzo.com
2026-09-29selftests: timers: Count what tick is worth in the drift estimateEva Kurchatova
raw_skew measures the drift between CLOCK_MONOTONIC and CLOCK_MONOTONIC_RAW and compares it against the adjustment adjtimex() reports, but for the latter it reads only tx.freq. The kernel takes the tick value into the adjustment as well, worth a microsecond of the tick length per unit, a hundred ppm each, and a time synchronisation daemon does put the coarse part of its correction there. Where it does, the two numbers cannot meet: # Estimating clock drift: -51.724(est) 48.277(act) [FAILED] On the machine measured, chronyd held freq at 48.278 ppm with tick at 9999, so the correction really applied is -51.722 ppm, which is what the clocks show. The skip for an externally adjusted clock does not catch this: the clock is steady, the offset is zero, and neither freq nor tick moves during the run. Count what tick is worth alongside freq. On the same machine: # Estimating clock drift: -51.724(est) -51.723(act) [OK] Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260917015237.2462954-1-eva.kurchatova@virtuozzo.com
2026-09-29KVM: arm64: selftests: Check a feature hidden in an ID register is UNDEFFuad Tabba
Userspace can hide a feature from a guest by clearing its field in a writable ID register, and KVM then makes the feature's instructions UNDEFINED in the guest by trapping or disabling them. No selftest checks that. Add a test that runs the instruction of each of TLBI OS, MOPS, TCR2_EL1 and FPMR once with its field as advertised and once with it cleared, and expects an UNDEF only when cleared. A feature the vCPU doesn't advertise is skipped, as is hidden TLBI OS on a CPU with neither FGT nor FEAT_EVT2, where KVM can't trap it. Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260929090031.3829185-5-fuad.tabba@linux.dev Signed-off-by: Oliver Upton <oupton@kernel.org>
2026-09-30selftests/ftrace: Add generic boot tracing test frameworkMasami Hiramatsu (Google)
Add a generic test framework under tools/testing/selftests/ftrace/boottime/ to verify kernel boot tracing configurations (bootconfig, kernel command-line tracing options, and persistent ring buffers) during early boot. The test runner (run_boottime_test.sh) sources ktap_helpers.sh to generate output in TAP version 13 format. It builds a minimal initramfs with busybox, dynamically resolves test specifications (.bconf for bootconfig, .cmdline for kernel boot parameters, .qemuopts for QEMU options, and # REBOOT: 1 for multi-boot crash/reboot tests with doubled timeout), boots QEMU, and runs corresponding tracefs checker scripts. Link: https://lore.kernel.org/all/178649541846.438282.672153252242971310.stgit@devnote2/ Assisted-by: LLM Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
2026-09-29KVM: selftests: Move test_read() into elf.c and delete lib/io.cGokul K
lib/io.c has outlived its purpose. test_read() has exactly one caller, lib/elf.c; test_write() has none at all; and test_seq_read() is a declaration in test_util.h with no definition anywhere in the tree. Both surviving helpers open with TEST_ASSERT(count >= 0, "Unexpected count, count: %li", count); which can never fire, because @count is a size_t. Building with -Wextra points this out: lib/io.c:51:27: warning: comparison of unsigned expression in '>= 0' is always true [-Wtype-limits] lib/io.c:128:27: warning: comparison of unsigned expression in '>= 0' is always true [-Wtype-limits] The comment above each assertion is worse than the assertion itself: it cites the read(2) and write(2) manpages to claim that a count of zero is allowed, but a zero count lands in "case 0" and fails the test outright. The helper has never accepted what the comment promises. Move test_read() into elf.c as a static elf_read(), named for what it does rather than reading as "test the read() syscall", and assert that @count is non-zero, which is what the code has always required and what every caller already passes. Drop the commentary describing retry behaviour that the code makes obvious. Nothing is then left in lib/io.c, so remove the file along with test_write() and the stale test_seq_read() declaration. No functional change intended. Suggested-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/all/aqxNbR9u5F1sqB3p@google.com Signed-off-by: Gokul K <gokul02k@gmail.com> Link: https://patch.msgid.link/20260918054420.338842-1-gokul02k@gmail.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-09-29KVM: selftests: Delete the declaration of vcpu_set_cpuid_maxphyaddr()Gokul K
vcpu_set_cpuid_maxphyaddr() is declared in include/x86/processor.h and defined nowhere. The declaration is the only mention of the name in tools/testing/selftests, so nothing has ever been able to call it. No Fixes: tag: a prototype for a function that does not exist cannot have regressed anything, and there is nothing to backport. No functional change intended. Signed-off-by: Gokul K <gokul02k@gmail.com> Link: https://patch.msgid.link/20260918113631.634233-3-gokul02k@gmail.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-09-29selftests: net: add test for netdev instance lock ordering on unregisterJakub Kicinski
Dismantle two netns holding a dummy and a netkit pair registered in opposite order. unregister_netdevice_many_notify() takes the instance locks of all the devices at once, nesting the two kinds of devices one way for the first netns and the other way for the second. With lockdep enabled this used to trigger a circular locking report. Acked-by: Stanislav Fomichev <sdf@fomichev.me> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20260926041832.1649675-2-kuba@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-09-29selftests/bpf: Fix up bpftool btf dump test for signaturesAlan Maguire
Now we show a function signature, fix up the test to expect it. Also fix the fact that we did not add the right number of parameters to the FUNC_PROTO, and ensure consts/addresses are prefixed appropriately. Fixes: 321562c34d5b ("bpftool: Add ability to dump LOC_PARAM, LOC_PROTO and LOCSEC") Signed-off-by: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20260926175113.2368566-4-alan.maguire@oracle.com
2026-09-29bpf: Check global subprog memory arguments in the common pathAmery Hung
Route fixed-size global ARG_PTR_TO_MEM arguments through check_func_arg(). Preserve their read-write access check, nullable contract, and support for BTF-defined allocated memory. Recognize subprog calls explicitly in the common checker. Global subprog stack liveness can prove that bytes in an argument are unused by the callee. Retain the existing allowance for those poisoned stack bytes when call metadata is present, and update the nullability log expectation. The verifier also rejects packet pointers when the callee may change packet data. The concrete packet-backed register state is only available while checking the call site; the independently verified callee sees generic PTR_TO_MEM. Record this property as subprog_may_change_pkt in subprog-only call metadata and retain the packet-pointer rejection in the common fixed-memory path. Signed-off-by: Amery Hung <ameryhung@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20260928185334.1004200-11-ameryhung@gmail.com
2026-09-29bpf: Check global subprog BTF-ID arguments in the common pathAmery Hung
Route global ARG_PTR_TO_BTF_ID arguments through check_func_arg(). Use vmlinux BTF for their type match and retain the global-subprogram rules instead of applying kfunc-only trusted-pointer validation or runtime type resolution. The common nullability check now rejects non-nullable global BTF-ID arguments before register-type matching. Update the corresponding verifier log expectations. Signed-off-by: Amery Hung <ameryhung@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20260928185334.1004200-10-ameryhung@gmail.com
2026-09-29bpf: Check subprog dynptr arguments in the common pathAmery Hung
Subprog and helper/kfunc dynptr arguments ultimately use the same process_dynptr_func() validation. Route the subprog dynptr branch through check_func_arg() so register type, offset, and dynptr state are checked in the common order. check_func_arg() validates the register against the PTR_TO_STACK and CONST_PTR_TO_DYNPTR compatibility set before dispatching to process_dynptr_func(). Once the subprog path uses the common checker, process_dynptr_func() has no caller that bypasses this validation. Remove its now-redundant register-type check. The existing wrong-register-type test passed a NULL local to a callee that did not use the argument. Clang left the context pointer in R1, while GCC materialized zero. The common checker rejected the values at different stages and emitted different diagnostics. Obtain a PTR_TO_BTF_ID from bpf_get_current_task_btf() and keep its callee argument live. This makes both compilers exercise the intended register-type mismatch. Signed-off-by: Amery Hung <ameryhung@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20260928185334.1004200-9-ameryhung@gmail.com
2026-09-29bpf: Check subprog context arguments in the common pathAmery Hung
Subprog and helper/kfunc context arguments require PTR_TO_CTX with an acceptable offset. Route subprog context arguments through check_func_arg() and update the verifier-log expectation. Signed-off-by: Amery Hung <ameryhung@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20260928185334.1004200-7-ameryhung@gmail.com
2026-09-29bpf: Check subprog scalar arguments in the common pathAmery Hung
BPF subprogram scalar arguments are checked separately even though the common argument checker enforces the same SCALAR_VALUE requirement. Start the migration by routing the scalar branch through check_func_arg() and update the verifier-log expectation. Use the BTF parameter index for metadata and the ABI slot index for register lookup. Route extra slots of by-value aggregates through check_arg_extra_slot() so every occupied slot follows the common path. Following patches can extend this guarded common-check branch as each remaining BPF-subprogram-specific implementation is removed. Signed-off-by: Amery Hung <ameryhung@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20260928185334.1004200-5-ameryhung@gmail.com
2026-09-29selftests/bpf: Detach a trampoline prog while a task sleeps before itFlorent Revest (Anthropic)
Add a test for the use-after-free fixed by the previous commit. A sleepable prog on bpf_fentry_test1() blocks a task on a userfaultfd page, like bpf_mod_race does, while the two progs that run after it in the same trampoline are detached and freed one after the other, which the test knows from their .bss maps going away. After the first detach the task is in an image that isn't the trampoline's current one anymore. The task is then released and must not call into the freed progs. This is done with fentry progs, with fexit progs, where the task is already past the original function, and with a task sleeping in a fentry prog while fexit progs are detached, where the original function must still be called. bpf_mod_race's userfaultfd helper moves to testing_helpers.c so that both tests can use it. Without the fix, on a kernel with KASAN: BUG: KASAN: vmalloc-out-of-bounds in __bpf_prog_enter_recur+0xed/0x1e0 Read of size 8 at addr ffa0000000144040 by task test_progs/171 CPU: 6 UID: 0 PID: 171 Comm: test_progs Tainted: G OE 7.2.0+ #1 PREEMPT(full) Call Trace: <TASK> __bpf_prog_enter_recur+0xed/0x1e0 bpf_trampoline_6442545468+0x72/0xe3 bpf_fentry_test1+0x9/0x20 bpf_prog_test_run_tracing+0x183/0x3e0 __sys_bpf+0xd3f/0x38f0 ... Signed-off-by: Florent Revest (Anthropic) <florent.revest@linux.dev> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20260926135605.1217928-4-florent.revest@linux.dev
2026-09-28Merge tag 'nf-next-26-09-28' of ↵Jakub Kicinski
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next Pablo Neira Ayuso says: ==================== Netfilter updates for net-next The following patchset contains Netfilter updates for net-next. The fixes included in this batch are deemed to handle correctness issues present in the Netfilter tree: 1) TCP sequence tracking is not reset inconditionally by synproxy when recycling an entry, sashiko reports the zero offset case skips it. Add a new function to inconditionally reset TCP sequence tracking. From Fernando F. Mancera. 2) Update documentation to reflect that the default maximum number of expectations (nf_conntrack_expect_max) is nf_conntrack_buckets / 64. From Shaojie Sun. 3) Remove useless break; after return in nft_osf, from Linkui Xiao. 4) Fix typos in comments in the netfilter tree, from Hemanth Selam. 5) Remove a few conntrack error stats duplicated updates, from Phil Sutter. 6) Do not bump invalid and drop conntrack error stats when packet is dropped, this is another duplicate. also From Phil. 7) Set on netns pointer before registering the flowtable, this is a requirement by the next patch, not fixing an existing issue. From Qingfang Deng. 8) Remove unnecessary workqueue work flush for all of the existing netns when device is gone. Also from Qingfang Deng. 9) Rework-fix nfnetlink_hook to correctly deal with large netlink dumps. Use sequence numbers to detect interference with hook updates while netlink dump is ongoing. From Phil Sutter. 10) Fix ctnetlink dump filtering by the IPv6 address, this has only work correctly for IPv4 this far, from Piotr Kubik. 11) ctnetlink filtering by zone is supported, but the ctnetlink dump filtering infrastructure was never updated to include a flag from userspace, update it to fill this gap. From Ilya Maximets. * tag 'nf-next-26-09-28' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next: netfilter: conntrack: make filtering by zone discoverable netfilter: ctnetlink: fix inverted IPv6 address match in dump filter netfilter: nfnetlink: Fix for interrupted hook dumps netfilter: flowtable: check namespace before iterating flows net/sched: act_ct: set net pointer before publishing flowtable netfilter: conntrack: Untangle drop and invalid counters netfilter: conntrack: Untangle insert_failed counter from others netfilter: fix several typos in comments netfilter: osf: remove unreachable break in nf_osf_ttl() netfilter: conntrack: fix nf_conntrack_expect_max default value in documentation netfilter: synproxy: fix reset of ct seqadj when reopening a connection ==================== Link: https://patch.msgid.link/20260927223436.269024-1-pablo@netfilter.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-28vsock/test: cover receive queue hintsDavid Carlier
Add io_uring receive tests checking IORING_CQE_F_SOCK_NONEMPTY across a partial receive, draining while the peer stays connected, EOF, a nonblocking receive on an empty queue, a zero-length request, and a multishot receive with provided buffers. Signed-off-by: David Carlier <devnexen@gmail.com> Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://patch.msgid.link/20260923184008.153541-3-devnexen@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-28selftests/bpf: Fix linked_externs with bpf-gccVineet Gupta
test_progs-bpf_gcc fails to build: prog_tests/linked_externs.c:17:23: error: 'struct linked_arena' has no member named 'arena' Several problems, all from bpf-gcc not supporting address_space(1). First, the arena variables are declared with __arena, but that macro is for pointers -- it marks the pointee address space. The one that carries placement is __arena_global: #if defined(__BPF_FEATURE_ADDR_SPACE_CAST) && !defined(BPF_ARENA_FORCE_ASM) #define __arena __attribute__((address_space(1))) __attribute__((btf_type_tag("arena"))) #define __arena_global __attribute__((address_space(1))) #else #define __arena __attribute__((btf_type_tag("arena"))) #define __arena_global SEC(".addr_space.1") #endif __BPF_FEATURE_ADDR_SPACE_CAST is a clang predefine. Under clang the two are interchangeable here, since address_space(1) both places the variable and is what btf_type_tag would have described. Under bpf-gcc __arena is only a BTF type tag, so the definitions land in .data, the arena map gets no initial value, and is_skel_data() in bpftool does not emit the typed arena member -- hence the build error. Note this is distinct from skel->maps.arena, which comes from SEC(".maps") and is always present. The extern declarations need __arena_global too. Without a section, gcc does not place an extern in any DATASEC, so it stays a free-floating extern VAR rather than an entry of .addr_space.1. test_relink() only walks that DATASEC: id = btf__find_by_name_kind(btf, sec_name, BTF_KIND_DATASEC); ... ASSERT_NEQ(btf_var(t)->linkage, BTF_VAR_GLOBAL_EXTERN, "var_resolved"); so relink_arena would report OK under bpf-gcc whether or not the linker resolved anything -- it would not be testing the allocated-section path this test exists for. Second, placement alone is not enough to run the test. Dereferencing an arena global needs an addr_space_cast, which only clang emits: clang: bpf-gcc: r1 = 0x0 ll r1 = 0x0 ll r1 = addr_space_cast(r1, 0x0, 0x1) r2 = *(u64 *)(r1 + 0x0) r1 = *(u64 *)(r1 + 0x0) so the verifier sees a scalar and rejects the program: 4: (79) r2 = *(u64 *)(r1 +0) R1 invalid mem access 'scalar' Guard the program bodies and skip the skeleton subtest, as arena_atomics.c already does. The variables stay unconditional so the arena is still populated and the skeleton still has its member. The fallback bodies reference the externs without dereferencing them: 'used' is ignored on an extern, so an unreferenced one is dropped and .addr_space.1 loses it again. With this, bpf-gcc reports: #217/1 linked_externs/skel_arena:SKIP #217/2 linked_externs/relink_arena:OK #217/3 linked_externs/relink_maps:OK with b_val present in .addr_space.1 as linkage=extern, same as clang, so relink_arena covers the same path in both. clang still passes all three. Fixes: 34354db1b148 ("selftests/bpf: Add linked_externs test for externs in allocated sections") Signed-off-by: Vineet Gupta <vineet.gupta@linux.dev> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Tested-by: Ihor Solodrai <ihor.solodrai@linux.dev> Link: https://lore.kernel.org/bpf/20260928231441.4037097-1-vineet.gupta@linux.dev
2026-09-28selftests/net/openvswitch: add SCTP flow key test across conntrack NATMinxi Hou
After conntrack NAT rewrites a packet, OVS refreshes the cached flow key in ovs_nat_update_key(), which has a per-protocol branch for the L4 ports (UDP/TCP/SCTP, conntrack.c). Address-only NAT cannot tell a working SCTP branch from a missing one: the ports survive unchanged either way, so a post-recirc match on the original port stays green even with the branch deleted. The suite's NAT coverage drives TCP over nc, and the merged SCTP test has no conntrack in the path, so the SCTP branch goes unexercised. Add test_sctp_nat_connect_v4: untracked client traffic to 192.168.0.20:4443 hits ct(commit,nat(dst=172.31.110.20:5555)),recirc, and the post-recirc flows match the translated tuple, ipv4(dst=172.31.110.20),sctp(dst=5555). Reply traffic is matched on the restored original tuple, sctp(src=4443). With the SCTP branch broken the translated port never reaches the key, no post-recirc flow matches, and the association fails. The probe flow uses the same ct+nat action as the real flows, so a kernel without CONFIG_NF_NAT rejects it at flow-add time and the test skips instead of failing. The config fragment sets CONFIG_NETFILTER_ADVANCED=y so CONFIG_NF_CT_PROTO_SCTP is visible, CONFIG_NF_CT_PROTO_SCTP=y, and CONFIG_NF_NAT=m so the reference build actually has those pieces. After the association succeeds the test pushes a known payload across and waits for the listener to log it. Signed-off-by: Minxi Hou <houminxi@gmail.com> Reviewed-by: Narcisa Vasile <narcisav.kernel@gmail.com> Reviewed-by: Aaron Conole <aconole@redhat.com> Link: https://patch.msgid.link/20260918144647.2024095-3-houminxi@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-28selftests/net/openvswitch: add SCTP flow key test over IPv6Minxi Hou
The merged SCTP test covers only IPv4. The SCTP branch of the IPv6 extractor (the proto=132 walk after parse_ipv6hdr) and the v6 side of the SCTP netlink validation (match_validate() requires the sctp() key whenever ipv6(proto=132) is matched) have no selftest coverage. Add test_sctp_connect_v6 mirroring the v4 test: bare icmpv6() flows forward NS/NA, and ipv6(proto=132),sctp(dst=4443)/sctp(src=4443) flows gate the association in the same three phases (flows installed, removed, reinstalled). A keyless ipv6(proto=132) install must be refused with EINVAL, pinning the reject side of the match_validate() rule; without it a regression dropping the requirement would pass unnoticed. The refusal is asserted to be EINVAL specifically, not a parse error of the flow string. After the association succeeds the test also pushes a known payload across and waits for the listener to log it, proving the datapath carries the association's traffic end to end, not only its handshake. Skips when the sctp module is missing, socat lacks SCTP or IPv6 support, or IPv6 is unavailable; an association or payload failure with the flows installed fails the test. Signed-off-by: Minxi Hou <houminxi@gmail.com> Reviewed-by: Narcisa Vasile <narcisav.kernel@gmail.com> Reviewed-by: Aaron Conole <aconole@redhat.com> Link: https://patch.msgid.link/20260918144647.2024095-2-houminxi@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-28vfio: selftests: Verify a failed second open preserves the vf_tokenAlex Williamson
The cdev path enforces a single open per device and rejects a second bind of an already open device. That rejection must happen before the bind can mutate state shared across opens, notably the PF vf_token, so that a bind which cannot complete leaves the current opener's state untouched. Before the fix in commit 258ba46543ab ("vfio: Reject a second cdev open before mutating shared device state"), the second bind mutated the vf_token and only then failed with -EINVAL. It is now rejected early with -EBUSY. Add a regression test that binds a PF with one token, attempts a second bind of the same PF with a different token, then initializes a VF with the original token. The VF init succeeds only if the rejected second bind left the PF vf_token intact; a regression that clobbered it to the second token would make the VF init fail. The -EBUSY errno is checked with EXPECT_EQ() so the clobber assertion still runs if the rejection returns a different error. This hazard is specific to the cdev/iommufd single-open path, so the test runs only in iommufd mode. Suggested-by: David Matlack <dmatlack@google.com> Assisted-by: LLM Signed-off-by: Alex Williamson <alex.williamson@nvidia.com> Reviewed-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20260925205134.3505611-1-alex.williamson@nvidia.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-09-28KVM: selftests: Extend nested x2APIC test to validate using eVMCS for vmcs12Sean Christopherson
Signed-off-by: Sean Christopherson <seanjc@google.com> Message-ID: <20260813223610.2043560-7-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-09-28KVM: selftests: Extend nested x2APIC test to validate disabling x2APIC virtSean Christopherson
Signed-off-by: Sean Christopherson <seanjc@google.com> Message-ID: <20260813223610.2043560-6-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-09-28Merge branch 'mlx5-vfio-selftest-v7' of ↵Alex Williamson
https://github.com/awilliam/linux-vfio into v7.4/vfio/next Merge project branch shared for mlx5 conflict management. Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-09-28selftests/cgroup: add settings file with a longer timeoutVishal Chourasia
The cgroup selftests lack a settings file, causing the kselftest runner to apply its default 45s timeout. The test_cpu binary now exceeds this limit, resulting in timeout failures that prevent the final test cases from reporting results: not ok 2 selftests: cgroup: test_cpu # TIMEOUT 45 seconds Test execution times: |Test | Duration | |----------------------|-------------------- | |cpu.weight (×4) | ~10s each | |test_cpucg_stats | 2s CPU time | |test_cpucg_nice | 2s CPU time | |test_cpucg_max | 1000/HZ seconds | |test_cpucg_max_nested | 1000/HZ seconds | Total runtime: ~46s at HZ=1000, ~64s at HZ=100 When executed independently, all nine test cases complete successfully (46.2s on a ppc64le HZ=1000 guest). Introduce a settings file that increases the timeout to 120 seconds, providing sufficient margin above the HZ=100 worst-case scenario. Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2026-09-28vfio: selftests: mlx5 driver - add send_msi supportJason Gunthorpe
Wire an MSI-X vector to a dedicated EQ so the mlx5 driver supports send_msi(). Each EQ can be linked to an MSI-X vector, and the CQ can be set up to deliver an event to the EQ. Thus, when everything is armed, an RDMA WRITE posted to the QP generates a CQE, which generates an EQE, which generates an MSI-X. To keep things simple this just re-uses all the existing QPs and CQs, so they generate single MSIs during memcpy. send_msi() drains any accumulated MSI EQ events from prior memcpy completions, posts a small signaled RDMA Write, then polls the CQ to consume the resulting CQE (avoiding stale completions on subsequent test cycles). Assisted-by: Claude:claude-opus-4.6 Acked-by: David Matlack <dmatlack@google.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/10-v7-c6d30e8ce1e4+3dfa6-mlx5st_jgg@nvidia.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-09-28vfio: selftests: Add mlx5 driver - data path and memcpy opsJason Gunthorpe
Complete the mlx5 driver by adding CQ/QP creation, QP state transitions, WQE posting, CQ polling, and the memcpy_start/memcpy_wait callbacks. After this patch the driver is functional for DMA tests. The data path implements RDMA Write self-loopback via an RC QP with force-loopback. WQEs are posted to a 16-entry send queue with an NC doorbell, and completions are polled from a 16-entry CQ. Assisted-by: Claude:claude-opus-4.6 Acked-by: David Matlack <dmatlack@google.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/9-v7-c6d30e8ce1e4+3dfa6-mlx5st_jgg@nvidia.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-09-28vfio: selftests: Add mlx5 driver - HW init and command interfaceJason Gunthorpe
Add an mlx5 ConnectX selftest driver that programs VFs and PFs through the command interface. Create the driver skeleton with probe(), the command interface, HCA boot sequence, and all resource allocation up through ALLOC_PD + CREATE_MKEY. The driver implements vfio_pci_driver_ops (probe/init/remove) and registers with the VFIO selftest framework. It matches the same mlx5 ConnectX device IDs that the kernel matches. init() brings the HCA to a running state: - Command interface setup (two-slot: regular + async pages) - ENABLE_HCA -> SET_ISSI -> QUERY/MANAGE_PAGES -> SET_HCA_CAP -> INIT_HCA - EQ creation (CMD + PAGE_REQUEST events for PF support) - ALLOC_PD, CREATE_MKEY (PA-mode, covers all IOVAs) - Force-loopback capability check remove() tears down in reverse order through TEARDOWN_HCA and DISABLE_HCA, including async pages slot drain and FW page reclaim. The driver region (~18MB) holds all HW-visible DMA buffers (command queue, mailboxes, EQ, FW pages) overlaid as a single struct on device->driver.region.vaddr. Data path ops (memcpy_start/memcpy_wait) are left as stubs for the next patch. Assisted-by: Claude:claude-opus-4.6 Acked-by: David Matlack <dmatlack@google.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/8-v7-c6d30e8ce1e4+3dfa6-mlx5st_jgg@nvidia.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-09-28vfio: selftests: Add dev_dbgJason Gunthorpe
Enable it with a #define DEBUG at the top of the file. Allows leaving behind debugging prints that are useful in case future changes are required. Assisted-by: Claude:claude-opus-4.6 Reviewed-by: David Matlack <dmatlack@google.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/7-v7-c6d30e8ce1e4+3dfa6-mlx5st_jgg@nvidia.com Signed-off-by: Alex Williamson <alex@shazbot.org>
2026-09-28vfio: selftests: Allow drivers to specify required region sizeJason Gunthorpe
Add a region_size field to struct vfio_pci_driver_ops so drivers can declare how much DMA-mapped region they need. The mlx5 driver will need ~18MB for firmware pages. Existing drivers pass in the sizeof their state struct. Since drivers all use only their declared state we can use the value directly and remove the SZ_2M hard coding. Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Acked-by: Sean Christopherson <seanjc@google.com> Reviewed-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/6-v7-c6d30e8ce1e4+3dfa6-mlx5st_jgg@nvidia.com Signed-off-by: Alex Williamson <alex@shazbot.org>