| Age | Commit message (Collapse) | Author |
|
Track L2's multiplier, not just the non-fractional scale-up factor, so that
the nested TSC scaling test can also validate scaling L2's frequency *down*.
No functional change intended.
Link: https://patch.msgid.link/20260930173635.3362655-11-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
|
|
Extract the guts of the nested TSC scaling test to a separate helper in
anticipation of extending the test beyond its single "scale L1 up, L2 down"
testcase.
No functional change intended.
Link: https://patch.msgid.link/20260930173635.3362655-10-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
|
|
Rename the nested TSC scaling test's helpers to clarify which one is used
by guest code and which one is used by host code, and to make it more
obvious that the host version *checks* the result and asserts on errors.
Contrary to what "compare" suggests, the helper doesn't return whether or
not the actual vs. expected values match.
Link: https://patch.msgid.link/20260930173635.3362655-9-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
|
|
Randomize L2's scale factor in the nested TSC scaling test; the test's
comment that "using a global variable does not work" just means the author
didn't know how to use sync_global_to_guest().
Link: https://patch.msgid.link/20260930173635.3362655-8-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
|
|
Use a plain "lu" instead of "PRIu64" to print u64s in the nested TSC
scaling test, as KVM selftests are 64-bit only (and supporting 32-bit x86
selftest would be an absurdly large lift, for something absolutely no one
cares about).
Link: https://patch.msgid.link/20260930173635.3362655-7-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
|
|
Drop a redundant VMWRITE of TSC_MULTIPLIER_HIGH in the nested TSC scaling
test. KVM selftests are 64-bit only, i.e. the full 64-bit multiplier is
always written by setting TSC_MULTIPLIER.
Link: https://patch.msgid.link/20260930173635.3362655-6-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
|
|
Use KVM's pRNG to randomize L1's TSC ratio in the nested TSC scaling test,
so that reproducing a failure with a specific seed is slightly easier.
Link: https://patch.msgid.link/20260930173635.3362655-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
|
|
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>
|
|
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>
|
|
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>
|
|
As per the man page, the number of elements should be the first argument
and the size of each one the second.
Switch the arguments around.
The behavior will not change, as both arguments are only multiplied with
each other.
Reported-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/lkml/aqQmCtPf_5M-BjRW@google.com/
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20260924-nolibc-calloc-v1-1-c49b383475d5@weissschuh.net
|
|
malloc() adds the size of its header to the requested size without
checking for overflow. For a size within the header size of SIZE_MAX,
the sum wraps around to a few bytes, and malloc() returns a single page
instead of NULL.
calloc() checks its multiplication for overflow, but then passes the
product to malloc(), so calloc(SIZE_MAX, 1) returns a single page too.
So does realloc(ptr, SIZE_MAX).
Such a size is usually a bug in the caller, for instance a length of -1
used as a size_t, and returning a page instead of NULL can turn it into
a heap overflow.
Fail with ENOMEM when adding the header overflows, as glibc does for
sizes this large.
Fixes: 0e0ff638400b ("tools/nolibc/stdlib: Implement `malloc()`, `calloc()`, `realloc()` and `free()`")
Assisted-by: LLM
Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com>
Link: https://patch.msgid.link/20260926152414.251214-3-danishkhateeb03@gmail.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
|
|
malloc() rounds the size of each mapping up to a multiple of 4096,
presumably to align it to a page boundary. But the page size is not 4096
on all architectures, and mmap() and munmap() round the length up to the
page size themselves.
Drop the rounding. As heap->len is no longer rounded up, growing a block
with realloc() now always creates a new mapping.
Assisted-by: LLM
Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com>
Reviewed-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260926152414.251214-2-danishkhateeb03@gmail.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
|
|
The timespec, sockaddr and perf_event_attr beautifiers read a fixed size
type from the payload without checking its size. The sockaddr payload is
addrlen bytes and the perf_event_attr payload is attr.size bytes, both
chosen by the tracee.
Check the payload with syscall_arg__augmented_args_valid(). Pass its size
to the address family printers, which also bounds the AF_LOCAL path that
needn't be NUL terminated. Like the kernel, accept an AF_INET6 address
without sin6_scope_id, RFC 2133's 24 bytes. Copy the perf_event_attr into
a zero padded local, as perf_event_attr___scnprintf() reads a whole
struct.
Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Aaron Tomlin <atomlin@atomlin.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
The before and after records are paired by list position. If a CPU or
domain disappears, counters can be subtracted from a different record
or left as absolute values. An extra record can also advance the cursor
past the list.
Identify the second snapshot by its timestamp or CPU ordering, and
require matching CPU/domain IDs and versions before subtracting. Check
that every record has a counterpart before printing, and propagate
errors from either input of diff.
Add a shell test with synthetic snapshots, including equal timestamps,
CPU filtering, and missing or reordered CPU/domain records.
Fixes: 5a357ae6ad63fd10 ("perf sched stats: Add support for report subcommand")
Reviewed-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
Assisted-by: LLM
Signed-off-by: Tianyi Chen <hi@tychen.cc>
Tested-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
During the perf build, pylint reports:
************* Module export-to-postgresql
python/export-to-postgresql.py:319:8: W0621: Redefining name 'e' from outer scope (line 100) (redefined-outer-name)
Rename 'e' to 'db_error' to clear the warning.
Fixes: b1f968c9656a8a87 ("perf python: Port export-to-postgresql to perf module")
Reviewed-by: Ian Rogers <irogers@google.com>
Assisted-by: Codex:gpt-6
Signed-off-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Prepend the output Python directory to pylint's PYTHONPATH so builds
using O= can also find the generated extension.
Fixes: 5fe83fb352c8d50f ("perf build: Make pylint build test opt-out (NO_PYLINT=1)")
Reported-by: Aishwarya TCV <aishwarya.tcv@arm.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Assisted-by: Codex:gpt-6
Signed-off-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Pylint checks for tests and standalone Python scripts can run before the
perf Python extension is available. On a clean parallel build, an import
error can stop make before the extension is built.
Run the script and test pylint checks in separate sub-makes after the
language bindings are built. Keep their rules in the respective Build
files so the perf and perf-test C sub-makes can compile concurrently with
util and the Python extension. An isolated make perf does not need to
build the extension just for these checks.
Fixes: 8a54784e708b51c1 ("perf build: Add pylint build tests")
Reported-by: Aishwarya TCV <aishwarya.tcv@arm.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Assisted-by: Codex:gpt-6
Signed-off-by: Leo Yan <leo.yan@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
syscall_arg__scnprintf_buf() and syscall_arg__scnprintf_augmented_string()
trust the augmented arg's size, so a bad one reads out of bounds:
#3 0x4c0fa0 in syscall_arg__scnprintf_buf builtin-trace.c:1955
#4 0x4c2f3d in syscall_arg_fmt__scnprintf_val builtin-trace.c:2632
#5 0x4c33ae in syscall__scnprintf_args builtin-trace.c:2722
#6 0x4c43d3 in trace__sys_enter builtin-trace.c:3094
#7 0x4c7865 in trace__handle_event builtin-trace.c:4013
Move the check in btf_struct_scnprintf() to a helper,
syscall_arg__augmented_args_valid(), and use it in both. When the check
fails, syscall_arg__scnprintf_filename() now falls back to vfs_getname or
the pointer.
Closes: https://lore.kernel.org/linux-perf-users/arJ-gpzqOHk-gF8T@x2/
Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
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>
|
|
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>
|
|
The kernel pads PERF_SAMPLE_RAW data to a u64 boundary without zeroing
the padding, so a syscall record without augmented arguments still has
up to 7 trailing bytes of stale data. syscall__augmented_args() passes
these to the beautifiers as a struct augmented_arg, whose size is then
garbage, causing a crash in syscall_arg__scnprintf_buf().
Ignore trailing data shorter than a struct augmented_arg.
Closes: https://lore.kernel.org/linux-perf-users/arJ-gpzqOHk-gF8T@x2/
Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Unlike the other augmenters, sys_enter_nanosleep() leaves the struct
augmented_arg size and err fields out of the record length, so the
output stops 8 bytes short of the end of the timespec payload. Count
the header.
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
The augmenters build records in augmented_args_tmp, a per-CPU scratch
buffer reused by every syscall, so a header field that isn't written
holds a stale value from an earlier syscall. sys_enter_sendto(),
sys_enter_perf_event_open(), sys_enter_clock_nanosleep() and
sys_enter_nanosleep() never set the struct augmented_arg size and err,
and augment_arg() doesn't set err.
Set both. When bpf_probe_read_user() fails in the connect, sendto and
nanosleep augmenters, report a zero sized payload and the error rather
than the stale scratch contents.
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
When dso__demangle_sym() runs out of retries or fails to grow the
output buffer for a Rust v0 symbol, it returns the buffer and callers
blindly use it as the demangled symbol name. However,
rust_demangle_display_demangle() doesn't NUL terminate its output when
it reports OverflowOverflow, so the buffer isn't a string.
Free the buffer and return NULL in both cases. Callers already fall back
to the mangled name when no demangled name is returned.
Fixes: e20848c317b51e74 ("perf symbol-elf: Integrate rust-v0 demangling")
Reviewed-by: Ian Rogers <irogers@google.com>
Assisted-by: LLM
Signed-off-by: Michal Pluta <michalpl2003@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
The Rust and Java demangle tests only log a NULL result from
dso__demangle_sym() and carry on, so a symbol that fails to demangle
doesn't fail the test. Set TEST_FAIL.
Fixes: 07f2b1287c970e07 ("perf test demangle-java: Don't segv if demangling fails")
Fixes: bdf05ccd18414274 ("perf test demangle-rust: Add Rust demangling test")
Reviewed-by: Ian Rogers <irogers@google.com>
Assisted-by: LLM
Signed-off-by: Michal Pluta <michalpl2003@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Yu-Chun Lin <eleanor.lin@realtek.com> says:
This patch series introduces support for the Realtek RTD1625 SPI NOR Flash
controller.
Link: https://patch.msgid.link/20260930065945.88008-1-eleanor.lin@realtek.com
|
|
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
...
|
|
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>
|
|
bpftool prog tracelog -w ends from its SIGINT, SIGHUP and SIGTERM handler,
which calls exit(). exit() is not async-signal-safe: it runs atexit
handlers and flushes stdio streams, and the signal may land while the read
loop is inside fwrite() or fflush() on the stream being flushed. Whether
that deadlocks or flushes a half-updated buffer depends on the C library.
Call _exit() instead. The loop flushes every chunk as soon as it is
printed, so the stdio buffer is empty except while a chunk is being
written, and skipping the exit-time flush loses nothing.
While here, note in the manual page that opening a stream as a file
descriptor arrives in Linux 7.4, and restrict the -w/--wait description to
the stdout/stderr form of the tracelog command, since the trace pipe form
does not take the option.
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Quentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/bpf/d64c6402-175f-4ea6-be6d-1a544a95c97c@qmon.net
Link: https://lore.kernel.org/bpf/20260926154515.191689-1-memxor@gmail.com
|
|
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
|
|
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
|
|
Each osnoise tracer option (in /sys/kernel/tracing/osnoise) used by RTLA
requires four functions to be defined:
- static osnoise_get_<opt>() - to get the current value of the option
and save it into struct osnoise_context's orig_<opt> field,
- osnoise_set_<opt>() - to set the value of the option requested by the
user after reading and saving the original with osnoise_get_<opt>(),
and save it into <opt> field of struct osnoise_context,
- osnoise_restore_<opt>() - restore the value recorded in orig_<opt>,
- static osnoise_put_<opt>() - restore the value recorded in orig_<opt>
and update <opt> to reflect that.
The logic is duplicated for all the options, except for cpus (which is
the only string option) and period/runtime (which are handled together
and feature extra checks).
Deduplicate by moving the common code in get/set/restore/put into common
helper functions local to osnoise.c. The original set/restore/put
functions are reduced to wrappers generated using a set of X macros:
- OSNOISE_LL_OPTIONS, which invokes the OSNOISE_LL_OPTION macro for all
"long long" options,
- OSNOISE_FLAG_OPTIONS, which invokes the OSNOISE_FLAG_OPTION macro for
all flag options (boolean values in osnoise/options file).
Those are also used to auto-generate the corresponding fields in struct
osnoise_context, plus initialization and restoration code for them.
There are a few minor changes in the refactored code:
- osnoise_set_<opt>() now distinguishes between -2 (option cannot be
set) and -1 (option not present in kernel) for all options.
- OSNOISE_OPTION_INIT_VAL and OSNOISE_TIME_INIT_VAL are removed and
replaced with a plain -1; all unsigned long long fields are changed to
signed long long, consistent with pre-existing "%lld" format string in
osnoise_write_ll_config().
- osnoise_restore_<opt>() now correctly resets the <opt> field (not
orig_<opt>) for all options.
The change is intended to simplify adding and modifying tracer options.
It also makes the code shorter by a bit over 500 lines.
Assisted-by: Claude:claude-opus-4-6
Link: https://lore.kernel.org/r/20260929142944.1841462-1-tglozar@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
|
|
Give the user more control over the test execution when the test scripts
are run directly (not through prove), in order to do things like run a
particular test repeatedly to diagnose an intermittent failure.
If $SUBTESTS is provided, then only tests whose number is on the list will
run. For example:
# SUBTESTS="14 133 4 $(seq 98 103) 9" bash ./tests/timerlat.t
1..150
ok 4 - top verify -s/--stack
ok 9 - hist set the automatic trace mode
ok 14 - top disable auto-analysis
ok 98 - hist verify -H/--house-keeping
ok 99 - top verify -k/--kernel-threads
ok 100 - hist verify -k/--kernel-threads
ok 101 - top verify -u/--user-threads
ok 102 - hist verify -u/--user-threads
ok 103 - apply default timerlat_period_us
ok 133 - top trace output through --on-threshold trace
If $STOPONFAIL is set, then the script will exit with a non-zero exit code
on the first failure. If the output directory is non-empty, it will be
preserved, and the location shown.
Signed-off-by: Crystal Wood <crwood@redhat.com>
Link: https://lore.kernel.org/r/20260919062756.819701-4-crwood@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
|
|
Make investigating test failures a little bit easier by not having
to recreate the command line by looking in the test script.
Unfortunately, this doesn't capture variables set outside of the
command line, but it's better than nothing.
Signed-off-by: Crystal Wood <crwood@redhat.com>
Link: https://lore.kernel.org/r/20260919062756.819701-3-crwood@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
|
|
When running the tests directly instead of from the makefile, RTLA
is likely to be unset. The default "./rtla" no longer works, due to
having changed the current diretory.
Fixes: ad5b50a0959fb ("rtla/tests: Run runtime tests in temporary directory")
Signed-off-by: Crystal Wood <crwood@redhat.com>
Link: https://lore.kernel.org/r/20260919062756.819701-2-crwood@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
|
|
bpf_object__relocate_core() allocates a CO-RE candidate cache before
processing relocation records. Two instruction offset validation
failures return -EINVAL directly instead of going through the common
cleanup path.
These checks were moved into bpf_object__relocate_core() when
bpf_core_apply_relo() was split, preserving direct returns that were
safe in the previous helper but now bypass cleanup.
Route both failures through the out path so the candidate cache and
target BTF override are released.
Signed-off-by: Luis Vieira <luisflavieira@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260929-libbpf-core-relo-cleanup-v1-1-c9cd0b5775a9@gmail.com
|
|
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
|
|
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
|
|
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
|
|
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
|
|
BTF_KIND_DECL_TAG is an attribute on a declaration: with kind_flag=0
the tag name is the argument of a btf_decl_tag(), and with kind_flag=1
it encodes a complete __attribute__.
When doing btf_dump, render both forms at every declaration btf_dump
emits - a record, a record member and a typedef:
struct foo { ... } __attribute__((bar));
struct foo { int a __attribute__((bar)); };
typedef struct { ... } __attribute__((bar)) foo_t;
A decl tag is a standalone type pointing at its target. Build an
index of decl tags in btf_dump_resize(). Keep it as a flat array
sorted by (target ID, tag ID). This allows for a stable emission order
in btf_dump_emit_decl_tags().
btf_dump_emit_decl_tags() binary searches for where the target's
entries would begin and walks tags while the target matches. A record
shares its target with its members, so the component_idx is matched
there.
A record attribute goes after the closing brace, where
__attribute__((packed)) already goes. A member attribute goes after
the bit-field width: clang rejects one between the declarator and the
':'. A typedef takes it after the declarator, so a typedef of an
anonymous record can carry two groups at once, one binding to the
record and one to the typedef.
This closes a generic gap in btf_dump, which silently dropped every
decl tag it was given.
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-3-ihor.solodrai@linux.dev
|
|
btf_dump_mark_referenced() both walks every type added since the last
resize and decides what each one references. Move the walk out to
btf_dump_resize() and hand the function one type at a time, so a second
per-type job can share the same pass instead of adding another one.
No functional change.
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-2-ihor.solodrai@linux.dev
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
kernel-doc fails to parse struct declarations wrapped in
context_lock_struct(), e.g. struct debugfs_cancellation:
include/linux/debugfs.h:245 ... error: Cannot parse struct or union!
Add a struct transform that expands context_lock_struct() to a plain
struct declaration, and apply the struct transforms to the whole
declaration before split_struct_proto(), matching what dump_var() and
dump_function() already do for their prototypes. The member-only
transform in dump_struct() is then redundant.
Add a regression test for the debugfs_cancellation declaration.
Fixes: 6e530e2e3119 ("debugfs: Make debugfs_cancellation a context lock struct")
Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <20260925234054.128477-1-emmaonana18@gmail.com>
|
|
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>
|