summaryrefslogtreecommitdiff
path: root/tools/testing/selftests
AgeCommit message (Collapse)Author
10 hoursMerge branch 'for-next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc.git
10 hoursMerge branch 'next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/mic/linux.git
10 hoursMerge branch 'for-next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git
10 hoursMerge branch 'for-next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git
10 hoursMerge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm.gitMark Brown
# Conflicts: # arch/x86/kvm/x86.c
10 hoursMerge branch 'for-next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
10 hoursMerge branch 'master' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
10 hoursMerge branch 'next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git
11 hoursMerge branch 'for-next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
11 hoursMerge branch 'main' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git # Conflicts: # MAINTAINERS # tools/testing/selftests/net/lib.sh
11 hoursMerge branch 'for-next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
11 hoursMerge branch 'fs-next' of linux-nextMark Brown
13 hoursMerge branch 'mm-unstable' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
13 hoursMerge branch 'gpio/for-current' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
13 hoursMerge branch 'fixes' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git
13 hoursMerge branch 'fixes' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git
13 hoursMerge branch 'for-linus' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
13 hoursMerge branch 'main' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
13 hoursMerge branch 'for-next/fixes' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
14 hoursMerge branch 'vfs.all' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git # Conflicts: # fs/bpf_fs_kfuncs.c # tools/testing/selftests/filesystems/.gitignore # tools/testing/selftests/filesystems/Makefile
14 hoursMerge branch 'master' of https://github.com/ceph/ceph-client.gitMark Brown
15 hoursselftests: drv-net: rss_ctx: Add retries to test_rss_context_overlap to ↵Zinc Lim
reduce flakes Similar to commit 690043b95c18 ("selftests: drv-net: rss: Add retries to test_rss_key_indir to reduce flakes"), implement the retry mechanism for test_rss_context_overlap. This gives the test more attempts to distribute the flow evenly, as the chance of flow skewing to one queue is high. Example failures: # Check failed 5288 < 7000 traffic on main context (1/2): [2727, 2561, 8961, 6648] not ok 1 rss_ctx.test_rss_context_overlap # Check failed 6710 < 7000 traffic on main context (2/2): [9280, 5217, 5358, 1352] not ok 1 rss_ctx.test_rss_context_overlap Ran test_rss_context_overlap and test_rss_context_overlap2 over 1,000 consecutive runs with no failures. Signed-off-by: Zinc Lim <limzhineng2@gmail.com> Link: https://patch.msgid.link/20260702164932.2832916-1-limzhineng2@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
16 hoursMerge branch into tip/master: 'timers/core'Ingo Molnar
# New commits in timers/core: aca60c717492 ("selftests: timers: Partially revert "Remove local NSEC_PER_SEC and USEC_PER_SEC defines"") f5abf0e07894 ("ntp: Remove tick_length_base, use tick_length directly") c10c8c1ad90c ("timekeeping: Settle competing time_offset and time_adjust skew") f5adb6779968 ("timekeeping: Drive time_adjust skew via per-tick ntp_error transfer") 5f6668bf5b06 ("timekeeping: Drive time_offset skew via per-tick ntp_error transfer") e8bf3955dc2f ("timekeeping: Account for clocksource tick quantisation via NTP") b7befd6d9120 ("timekeeping: Account for monotonicity adjustment in ntp_error") 79b8bd857bd7 ("MAINTAINERS: Add Miroslav as timekeeping reviewer") 79ced850e549 ("y2038: uapi: Use 64-bit __kernel_old_timespec::tv_nsec on x32") 79bd39c58f2c ("timekeeping: Move the vDSO update declarations into a private header") 6e435911394b ("timekeeping: Fold vdso_time_update_aux() declarations into the generic ifdeffery") faef65e45a2a ("hrtimer: Remove inclusion of hrtimer_bases.h remove from hrtimer.h") 0c31af3d23e6 ("x86/speculation: Explicitly include linux/types.h") 071993aac72e ("hrtimer: Explicitly include some necessary headers in hrtimer_rearm.h") 95cf8bbadd10 ("hrtimer: Explicitly include linux/hrtimer_bases.h") 73fcec09d162 ("tick: Explicitly include linux/hrtimer_bases.h") a116c7582d7f ("hrtimer: Move hrtimer_update_function() to hrtimer.c") d3dc7fabd4c4 ("hrtimer: Move hrtimer_callback_running() to hrtimer_bases.h") 03b5d4c27982 ("hrtimer: Rename hrtimer_defs.h to hrtimer_bases.h") c4415c993fc2 ("hrtimer: Don't take cpu_base::lock in hrtimer_get_next_event() when hres_active") 1d28a67d496f ("timer_list: Annotate print_cpu() diagnostic reads") 06aba58e5849 ("time/namespace: Validate nanosecond field in proc_timens_set_offset()") eddfded41965 ("timers/migration: Fix memory leak in tmigr_setup_groups() error path") f2eee7e31ccd ("timekeeping: Unwind aux clock sysfs children on failure") 3dee6537e728 ("clocksource: Unregister subsystem on device registration failure") b4b66151a714 ("selftests: timers: leap-a-day: Fix -w option and update usage comment") b3afded935a8 ("clocksource: Remove unused WATCHDOG_INTERVAL_NS macro") d8966ca88566 ("hrtimer: Remove unused next_timer argument from __hrtimer_reprogram()") e2904ddb14a4 ("timekeeping: Document monotonic raw timestamps in snapshots correctly") a73d7f98e41a ("posix-cpu-timers: Don't abuse lock_task_sighand() in handle_posix_cpu_timers()") 034b5779b85b ("hrtimer: Remove unused clock_base_next_timer_safe()") Signed-off-by: Ingo Molnar <mingo@kernel.org>
16 hoursMerge branch into tip/master: 'locking/futex'Ingo Molnar
# New commits in locking/futex: 157a9b22ff76 ("selftests/futex: Use thread synchronization helpers instead of usleep()") 86620fb9d37b ("selftests/futex: Provide thread creation and synchronization helpers") 50c121e5a57a ("selftests/futex: Dynamically skip unsupported tests") 90a0286c7d35 ("selftests/futex: Add FUTEX_LOCK_PI owner-exiting coverage") 553bd67a9032 ("selftests/futex: Migrate robust_list to harness") 4f22ba7eee3e ("selftests/futex: Migrate futex_priv_hash to harness") 9b19fbb3a6c5 ("selftests/futex: Migrate futex_numa_mpol to harness") 7fe733f11215 ("selftests/futex: Migrate futex_requeue_pi_signal_restart to harness") 4559deb73828 ("selftests/futex: Migrate futex_requeue_pi_mismatched_ops to harness") b7d837c2d49e ("selftests/futex: Migrate futex_requeue_pi to harness") d0f7df9bb778 ("selftests/futex: Migrate futex_requeue to harness") 78834d8b9c99 ("selftests/futex: Migrate futex_wait_uninitialized_heap to harness") dccef66d850b ("selftests/futex: Migrate futex_wait_private_mapped_file to harness") 0d65d1abb5e4 ("selftests/futex: Migrate futex_wait to harness") a894f6f40332 ("selftests/futex: Correct validation logic in waitv") e531301dd8fa ("selftests/futex: Migrate functional tests to harness") dfa2f2378fb1 ("selftests/futex: Remove static keyword from 'head'") 4903ab0c83f0 ("futex: Remove unnecessary NULL check before kvfree()") d7b2769f8dba ("selftests/rseq: Replace glibc-specific __GNUC_PREREQ with portable check") Signed-off-by: Ingo Molnar <mingo@kernel.org>
16 hoursMerge branch into tip/master: 'core/rseq'Ingo Molnar
# New commits in core/rseq: 7148c0a02e09 ("selftests/rseq: Fix spelling of accommodate") Signed-off-by: Ingo Molnar <mingo@kernel.org>
16 hoursMerge branch into tip/master: 'core/entry'Ingo Molnar
# New commits in core/entry: 5b6e32ba7b59 ("syscall_user_dispatch: Add kernel.syscall_user_dispatch sysctl") ee935e8dc757 ("syscall_user_dispatch: Make it configurable in Kconfig") Signed-off-by: Ingo Molnar <mingo@kernel.org>
17 hoursselftests/net: fix EVP_MD_CTX leak in tcp_mmapWang Yan
In tcp_mmap.c, both child_thread() and main() allocate an EVP_MD_CTX via EVP_MD_CTX_new() when integrity checking is enabled, but neither function releases the context. child_thread() misses the free in its common cleanup block, and main() returns without freeing the context. This results in a SHA256 context leak on every run that uses the ‑i (integrity) option. Add the missing EVP_MD_CTX_free() calls to the appropriate cleanup paths to fix the leak. Fixes: 5c5945dc695c ("selftests/net: Add SHA256 computation over data sent in tcp_mmap") Signed-off-by: Wang Yan <wangyan01@kylinos.cn> Link: https://patch.msgid.link/20260702025949.442523-1-wangyan01@kylinos.cn Signed-off-by: Paolo Abeni <pabeni@redhat.com>
20 hoursselftests/damon: check correct path in ensure_file() not_exist casewang wei
In the ensure_file() function, the "not_exist" code path checks whether $dir exists as a regular file. However, the intent is to verify that the target file ($file) does not exist, not the $dir. Testing $dir makes the existence check effectively useless -- it tests the wrong path and thus never catches the case where the file is unexpectedly present. Replace $dir with $file so the not_exist verification targets the correct path. Link: https://lore.kernel.org/20260706134305.5224-1-a929244872@163.com Signed-off-by: wang wei <a929244872@163.com> Reviewed-by: SJ Park <sj@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/damon/drgn_dump_damon_status: do not dump nr_accesses_bpSJ Park
drgn_dump_damon_status is dumping nr_accesses_bp field for future use case. nr_accesses_bp is not being used for a real purpose, though. Hence there will be no future test for it. Do not dump it. Link: https://lore.kernel.org/20260630040812.149729-13-sj@kernel.org Signed-off-by: SJ Park <sj@kernel.org> Cc: Brendan Higgins <brendan.higgins@linux.dev> Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/mm/uffd: don't treat UFFDIO_COPY -ENOENT as a failureMike Rapoport (Microsoft)
Non-cooperarive uffd events are inherently racy and can happen in parallel with other userfaultfd operations. During event tests in uffd-unit-tests, the uffd monitor calls UFFDIO_UNREGISTER upon receiving UFFD_EVENT_REMOVE. In parallel, the faulting_process() verifies that the removed memory is actually zeroed. If a verification read wins the race with UFFDIO_UNREGISTER, it causes a missing fault that uffd monitor would receive after UFFDIO_UNREGISTER is complete. The monitor resolves the fault using UFFDIO_COPY that fails with -ENOENT which means that VMA has been changed (see commit 27d02568f529 ("userfaultfd: mcopy_atomic: return -ENOENT when no compatible VMA found")). Treat -ENOENT returned by UFFDIO_COPY as non-fatal, the same way -EEXIST is treated for concurrent faults, and don't fail the test. Link: https://lore.kernel.org/20260701200932.1470525-1-rppt@kernel.org Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Reviewed-by: Lorenzo Stoakes <ljs@kernel.org> Reviewed-by: David Hildenbrand (Arm) <david@kernel.org> Cc: Liam R. Howlett <liam@infradead.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Peter Xu <peterx@redhat.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/mm: fix clone cleartid race in pkey sighandler testsHongfu Li
Passing a stack-local child_pid to clone() with CLONE_CHILD_CLEARTID is unsafe: the kernel clears that address when the child exits, which may happen after the test function has returned and the stack slot has been reused. Neither testcase uses the settid/cleartid pointers for synchronization. Drop CLONE_PARENT_SETTID and CLONE_CHILD_CLEARTID and pass NULL for the clone tid arguments. Wait for the clone child to exit via tkill in test_sigsegv_handler_with_different_pkey_for_stack(), matching test_pkru_sigreturn(), so the detached thread cannot overlap with the next testcase. Link: https://lore.kernel.org/20260706081600.3570203-7-lihongfu@kylinos.cn Signed-off-by: Hongfu Li <lihongfu@kylinos.cn> Cc: David Hildenbrand <david@kernel.org> Cc: Joey Gouly <joey.gouly@arm.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Keith Lucas <keith.lucas@oracle.com> Cc: Kevin Brodsky <kevin.brodsky@arm.com> Cc: Liam R. Howlett (Oracle) <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport (Microsoft) <rppt@kernel.org> Cc: Muhammad Usama Anjum <usama.anjum@collabora.com> Cc: Ross Zwisler <zwisler@google.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Cc: Yury Khrustalev <yury.khrustalev@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/mm: add missing pthread_create() return checks in pkey testsHongfu Li
Add missing pthread_create() return checks in pkey sighandler tests to avoid hanging in pthread_cond_wait() when thread creation fails. Link: https://lore.kernel.org/20260706081600.3570203-6-lihongfu@kylinos.cn Signed-off-by: Hongfu Li <lihongfu@kylinos.cn> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Acked-by: Liam R. Howlett (Oracle) <liam@infradead.org> Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com> Tested-by: Kevin Brodsky <kevin.brodsky@arm.com> Cc: David Hildenbrand <david@kernel.org> Cc: Joey Gouly <joey.gouly@arm.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Keith Lucas <keith.lucas@oracle.com> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Muhammad Usama Anjum <usama.anjum@collabora.com> Cc: Ross Zwisler <zwisler@google.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Cc: Yury Khrustalev <yury.khrustalev@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/mm: add missing mmap() return checks in pkey testsHongfu Li
Add missing checks against mmap() return value, replace (void *)-1 with MAP_FAILED for better readability and consistency. Link: https://lore.kernel.org/20260706081600.3570203-5-lihongfu@kylinos.cn Signed-off-by: Hongfu Li <lihongfu@kylinos.cn> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Acked-by: Liam R. Howlett (Oracle) <liam@infradead.org> Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com> Tested-by: Kevin Brodsky <kevin.brodsky@arm.com> Cc: David Hildenbrand <david@kernel.org> Cc: Joey Gouly <joey.gouly@arm.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Keith Lucas <keith.lucas@oracle.com> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Muhammad Usama Anjum <usama.anjum@collabora.com> Cc: Ross Zwisler <zwisler@google.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Cc: Yury Khrustalev <yury.khrustalev@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/mm: use pkey_assert on clone_raw failure in pkey testHongfu Li
Use pkey_assert(0) instead of perror("clone") when clone_raw() fails. The old path only printed an error and continued; the test now exits via pkey_assert() on failure so it does not hang or proceed with an invalid child. Link: https://lore.kernel.org/20260706081600.3570203-4-lihongfu@kylinos.cn Signed-off-by: Hongfu Li <lihongfu@kylinos.cn> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Acked-by: Liam R. Howlett (Oracle) <liam@infradead.org> Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com> Tested-by: Kevin Brodsky <kevin.brodsky@arm.com> Cc: David Hildenbrand <david@kernel.org> Cc: Joey Gouly <joey.gouly@arm.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Keith Lucas <keith.lucas@oracle.com> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Muhammad Usama Anjum <usama.anjum@collabora.com> Cc: Ross Zwisler <zwisler@google.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Cc: Yury Khrustalev <yury.khrustalev@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/mm: unify pkey sighandler selftest assertions and tracingHongfu Li
Add per-test tracing to the pkey signal-handler selftest and use pkey_assert() for error handling. Each test enables tracing at start and disables it at end; on failure, pkey_assert() calls abort_hooks() to turn tracing off so ftrace is not left enabled. Link: https://lore.kernel.org/20260706081600.3570203-3-lihongfu@kylinos.cn Signed-off-by: Hongfu Li <lihongfu@kylinos.cn> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Acked-by: Liam R. Howlett (Oracle) <liam@infradead.org> Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com> Tested-by: Kevin Brodsky <kevin.brodsky@arm.com> Cc: David Hildenbrand <david@kernel.org> Cc: Joey Gouly <joey.gouly@arm.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Keith Lucas <keith.lucas@oracle.com> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Muhammad Usama Anjum <usama.anjum@collabora.com> Cc: Ross Zwisler <zwisler@google.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Cc: Yury Khrustalev <yury.khrustalev@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/mm: move pkey selftest helpers to pkey_util.cHongfu Li
Patch series "selftests/mm: refactor pkey helpers and fix mmap error handling", v10. The main changes in this series are to refactor shared tracing and assertion helpers into a common file, unify both pkey selftests on pkey_assert() and per-test tracing for consistent diagnostics, and add missing mmap() return checks with MAP_FAILED used throughout for readability and consistency. This patch (of 10): Move pkey selftest debugging helpers into shared code so both pkey selftests can use the same tracing and abort-hook logic. Also fix cat_into_file() to print file, not str, in the open() failure message. Link: https://lore.kernel.org/20260706081600.3570203-1-lihongfu@kylinos.cn Link: https://lore.kernel.org/20260706081600.3570203-2-lihongfu@kylinos.cn Signed-off-by: Hongfu Li <lihongfu@kylinos.cn> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Acked-by: Liam R. Howlett (Oracle) <liam@infradead.org> Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com> Tested-by: Kevin Brodsky <kevin.brodsky@arm.com> Cc: David Hildenbrand <david@kernel.org> Cc: Joey Gouly <joey.gouly@arm.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Keith Lucas <keith.lucas@oracle.com> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Muhammad Usama Anjum <usama.anjum@collabora.com> Cc: Ross Zwisler <zwisler@google.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Cc: Yury Khrustalev <yury.khrustalev@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/damon/sysfs.sh: test all files in quota goal dirSJ Park
DAMON sysfs interface for DAMOS quota has quite extended since its initial introduction. The test case for that in DAMON sysfs interface essential file operations test (sysfs.sh) has not accordingly extended, though. Extend the test case to test all existing files. Link: https://lore.kernel.org/20260630141726.92246-8-sj@kernel.org Signed-off-by: SJ Park <sj@kernel.org> Cc: Brendan Higgins <brendan.higgins@linux.dev> Cc: David Hildenbrand <david@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/damon/sysfs.sh: test dests dirSJ Park
DAMON selftest interface essential file operations test (sysfs.sh) is not testing DAMOS dests/ directory. Add the test. Link: https://lore.kernel.org/20260630141726.92246-7-sj@kernel.org Signed-off-by: SJ Park <sj@kernel.org> Cc: Brendan Higgins <brendan.higgins@linux.dev> Cc: David Hildenbrand <david@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/damon/sysfs.sh: test {core,ops}_filters/ directoriesSJ Park
DAMON sysfs interface essential file operations test (sysf.sh) is not testing DAMOS {core,ops}_filters directories. Add the tests. Link: https://lore.kernel.org/20260630141726.92246-6-sj@kernel.org Signed-off-by: SJ Park <sj@kernel.org> Cc: Brendan Higgins <brendan.higgins@linux.dev> Cc: David Hildenbrand <david@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/damon/sysfs.sh: test multiple probe dirs creationSJ Park
DAMON sysfs essential file operations test (sysfs.sh) was extended to test DAMON probes sysfs directory, by commit 14885da09b0f ("selftests/damon/sysfs.sh: test probes dir"). Unlike other DAMON sysfs files, it is testing only a single directory case. Extend it for multiple directories. Link: https://lore.kernel.org/20260630141726.92246-5-sj@kernel.org Signed-off-by: SJ Park <sj@kernel.org> Cc: Brendan Higgins <brendan.higgins@linux.dev> Cc: David Hildenbrand <david@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/damon/sysfs_refresh: test kdamond refresh_msRuslan Valiyev
Writing a non-zero value to a kdamond's 'refresh_ms' sysfs file should make DAMON periodically update the read-only sysfs files on its own, without the user writing update keywords such as 'update_schemes_stats' to the 'state' file. This behavior has no test coverage. Add a test that starts a kdamond with refresh_ms set and a 'stat' scheme whose default access pattern matches every monitored region, then polls the scheme's 'nr_tried' stats file directly, without requesting an update. The value can become non-zero only via the periodic refresh, so the test confirms refresh_ms works; with refresh_ms disabled the stat stays zero and the test fails. Link: https://lore.kernel.org/20260602131217.2210912-3-linuxoid@gmail.com Link: https://lore.kernel.org/20260629144927.134237-3-sj@kernel.org Signed-off-by: Ruslan Valiyev <linuxoid@gmail.com> Reviewed-by: SJ Park <sj@kernel.org> Signed-off-by: SJ Park <sj@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/damon/_damon_sysfs: support kdamond refresh_msRuslan Valiyev
Patch series "selftests/damon: test kdamond refresh_ms", v2. The kdamond 'refresh_ms' sysfs file makes DAMON periodically update its read-only sysfs files (DAMOS stats, tuned monitoring intervals and the kdamond pid) on its own, so users don't have to write update keywords such as 'update_schemes_stats' to the 'state' file. It has no selftest coverage. The first patch adds refresh_ms support to the _damon_sysfs.py test control module. The second adds a test that sets refresh_ms and confirms a scheme's stats are updated under sysfs without an explicit update request; the test skips on kernels that predate the refresh_ms file. Tested on current mainline under a DAMON-enabled kernel: the new test passes and the existing DAMON selftests show no new failures. This patch (of 2): The Kdamond class has no way to set the kdamond-level 'refresh_ms' sysfs file, which makes DAMON periodically update the read-only sysfs files (DAMOS stats, tuned monitoring intervals and the kdamond pid) on its own. Add a 'refresh_ms' parameter to Kdamond. When it is set (including to zero, to disable the periodic update), write it before turning the kdamond on, so tests can exercise the auto-update behavior. Leaving it unset keeps the previous behavior of not touching the file, so callers running against kernels without the feature are unaffected. Link: https://lore.kernel.org/20260602131217.2210912-2-linuxoid@gmail.com Link: https://lore.kernel.org/20260629144927.134237-2-sj@kernel.org Signed-off-by: Ruslan Valiyev <linuxoid@gmail.com> Reviewed-by: SJ Park <sj@kernel.org> Signed-off-by: SJ Park <sj@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/damon/sysfs.py: validate memcg_path staging readbackCheng Nie
Add a dedicated test at the end of main() that stages memcg_path via sysfs and verifies its readback. Configure the memcg filter before start(), do not call commit(), and ignore start() failures so the test does not depend on CONFIG_MEMCG or cgroup layout. Call stop() for cleanup without checking its return value. Link: https://lore.kernel.org/D2B37130D38E09AC+20260601090634.241864-1-niecheng1@uniontech.com Link: https://lore.kernel.org/20260629144812.134159-3-sj@kernel.org Signed-off-by: Cheng Nie <niecheng1@uniontech.com> Signed-off-by: SJ Park <sj@kernel.org> Reviewed-by: SJ Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/damon/_damon_sysfs.py: fix memcg_path assignmentCheng Nie
Patch series "selftests/damon: fix memcg_path staging handling", v5. Fix a bug in _damon_sysfs.py for damos_filter memcg_path setup, and add a test case of it in sysfs.py. This patch (of 2): DamosFilter stores memcg_path for sysfs staging, but the constructor assigns it with a trailing comma and therefore turns it into a tuple. Fix the assignment so memcg_path is stored as the intended string. This makes memcg filter staging and follow-up validation use the written path correctly. Link: https://lore.kernel.org/20260629144812.134159-1-sj@kernel.org Link: https://lore.kernel.org/464AE12D4BC6B6F4+20260601090519.240482-1-niecheng1@uniontech.com Link: https://lore.kernel.org/20260629144812.134159-2-sj@kernel.org Signed-off-by: Cheng Nie <niecheng1@uniontech.com> Signed-off-by: SJ Park <sj@kernel.org> Reviewed-by: SJ Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/damon: fix dead code, skipped checks, and broken lookupsKunwu Chan
'hugeapge_size' in drgn_dump_damon_status.py was a dead elif branch. $fail_reason in sysfs.sh was undefined, silently emptying the error message. 'exit' instead of 'exist' in sysfs.sh skipped a file existence check. 'nohugeapge' in sysfs.py broke an action dict lookup. Fix other wrong strings in the same files. Link: https://lore.kernel.org/20260601032314.424013-4-kunwu.chan@linux.dev Link: https://lore.kernel.org/20260629144648.134092-4-sj@kernel.org Co-developed-by: Wang Lian <lianux.mm@gmail.com> Signed-off-by: Wang Lian <lianux.mm@gmail.com> Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Signed-off-by: SJ Park <sj@kernel.org> Reviewed-by: SJ Park <sj@kernel.org> Cc: Kunwu Chan <chentao@kylinos.cn> Cc: Wang Lian <lianux.mm@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/damon/damos_tried_regions: fix expectation output and join TypeErrorKunwu Chan
The expectation print has wrong operator precedence: '%' binds before the conditional expression, so the else branch prints 'not met' without the prefix 'expectation (>= 14) is'. Add parentheses to fix it. Also, '\n'.join() on the list of ints raises TypeError; convert to str in the list comprehension. Link: https://lore.kernel.org/20260601032314.424013-3-kunwu.chan@linux.dev Link: https://lore.kernel.org/20260629144648.134092-3-sj@kernel.org Co-developed-by: Wang Lian <lianux.mm@gmail.com> Signed-off-by: Wang Lian <lianux.mm@gmail.com> Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Signed-off-by: SJ Park <sj@kernel.org> Reviewed-by: SJ Park <sj@kernel.org> Cc: Kunwu Chan <chentao@kylinos.cn> Cc: Wang Lian <lianux.mm@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/damon: prevent cross-context state pollution in DamonCtxKunwu Chan
Patch series "selftests/damon: misc fixes for test bugs", v3. This series fixes several bugs in the DAMON selftests. Most are trivial but makes test output wrong or even silently pass the one test case for 'avail_operation' file existence check. Patch 1 fixes mutable default arguments in DamonCtx.__init__() that cause state to leak between test instances. Patch 2 fixes wrong operator precedence and join TypeError in damos_tried_regions.py. Patch 3 fixes several wrong strings that produce dead elif branches, skipped file existence checks, and broken dict key lookups. This patch (of 3): DamonCtx.__init__() uses mutable default values for monitoring_attrs, targets, and schemes. In Python these are evaluated once at function definition time, so multiple DamonCtx instances can unintentionally share the same lists and DamonAttrs instance. Replace the mutable defaults with None sentinels and initialize the objects when needed. Link: https://lore.kernel.org/20260629144648.134092-1-sj@kernel.org Link: https://lore.kernel.org/20260601032314.424013-2-kunwu.chan@linux.dev Link: https://lore.kernel.org/20260629144648.134092-2-sj@kernel.org Co-developed-by: Wang Lian <lianux.mm@gmail.com> Signed-off-by: Wang Lian <lianux.mm@gmail.com> Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Signed-off-by: SJ Park <sj@kernel.org> Reviewed-by: SJ Park <sj@kernel.org> Cc: Kunwu Chan <chentao@kylinos.cn> Cc: Wang Lian <lianux.mm@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursselftests/mm: add hwpoison-panic destructive testBreno Leitao
Add a destructive selftest that verifies vm.panic_on_unrecoverable_memory_failure actually panics when a hwpoison error hits a kernel-owned page. Three "kinds" of kernel-owned page can be targeted, selectable via the script's first positional argument (default: rodata): rodata - a PG_reserved page in the kernel rodata range, sourced from the "Kernel rodata" sub-resource of "System RAM" in /proc/iomem. That entry is reported on every major architecture and guarantees the chosen PFN is backed by struct page (an online System RAM range, not a firmware hole), is PG_reserved, and is read-only -- so even if the panic fails to fire for some reason, the resulting PG_hwpoison marker on rodata does not corrupt writable kernel state. slab - a slab page found by walking /proc/kpageflags for the first PFN with KPF_SLAB set (and KPF_HWPOISON / KPF_NOPAGE / KPF_COMPOUND_TAIL clear). Exercises the get_any_page() path on a non PG_reserved kernel-owned page and so catches regressions where get_any_page() collapses kernel-owned pages into a transient -EIO instead of -ENOTRECOVERABLE. pgtable - same as slab, but the PFN is selected via KPF_PGTABLE. PageLargeKmalloc, the fourth page type matched by is_kernel_owned_page(), is intentionally not covered: it is a PAGE_TYPE_OPS flag with no /proc/kpageflags bit, so selecting such a PFN from userspace is not feasible. The slab and pgtable variants already exercise the same get_any_page() positive-check branch. The script enables the sysctl and writes the selected physical address to /sys/devices/system/memory/hard_offline_page. A successful run crashes the kernel with Memory failure: <pfn>: unrecoverable page A return from the inject means no panic fired. Before reporting, the script restores the sysctl and best-effort unpoisons the target PFN through the hwpoison debugfs interface (hard_offline_page() injects with MF_SW_SIMULATED, so the page stays unpoisonable), then re-reads /proc/kpageflags: a PFN that is still the kernel-owned type it selected is a genuine failure, while one that raced to a different type before the inject is skipped as inconclusive. Test outcome is therefore observed externally (serial console, kdump) rather than from the script's own exit code. The script is intentionally NOT wired into run_vmtests.sh: every successful run panics the kernel, which is incompatible with the sequential "run each category in the same VM" model that run_vmtests.sh assumes. It is also not registered as a TEST_PROGS / ksft_* wrapper so a default kselftest run does not opt itself into a panic. The script is meant to be executed manually inside a disposable VM (e.g. virtme-ng), one variant per VM boot, and requires RUN_DESTRUCTIVE=1 in the environment as a safety net. Link: https://lore.kernel.org/20260630-ecc_panic-v10-6-c6ed5b62eea2@debian.org Signed-off-by: Breno Leitao <leitao@debian.org> Cc: David Hildenbrand (Arm) <david@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Lance Yang <lance.yang@linux.dev> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Miaohe Lin <linmiaohe@huawei.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Naoya Horiguchi <nao.horiguchi@gmail.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursfs/proc/task_mmu: fix PAGEMAP_SCAN written state for PMD holesKiryl Shutsemau (Meta)
PAGEMAP_SCAN reports an unpopulated PTE in a uffd-wp VMA as written (pagemap_page_category() and the PAGE_IS_WRITTEN fast path), but a range with no page table at all -- a PMD hole -- is skipped. pagemap_scan_pte_hole() evaluates the hole against p->cur_vma_category, which pagemap_scan_test_walk() builds from only PAGE_IS_WPALLOWED and PAGE_IS_SOFT_DIRTY, so PAGE_IS_WRITTEN is never set: the hole is neither reported nor, under PM_SCAN_WP_MATCHING, armed. This is reachable. An anonymous THP is write-protected in place as a huge PMD (change_huge_pmd(), anon is not split), and a full-PMD MADV_DONTNEED clears it to pmd_none. A WP-async consumer such as CRIU then misses the 2MB drop -- the range is not reported written and the next incremental dump keeps stale data. (A file/shmem THP is split on write-protect, so a later DONTNEED leaves a populated page table of pte_none entries, which are already reported; only anon THP reaches the hole path.) Add PAGE_IS_WRITTEN to the categories evaluated for a hole in a non-hugetlb uffd-wp VMA, matching the pte_none handling in pagemap_page_category(). The existing PM_SCAN_WP_MATCHING path then also arms the range: uffd_wp_range() allocates the page table and installs markers under WP_UNPOPULATED, so the next scan sees it clean until re-written. hugetlb is excluded on purpose: an allocated-but-empty huge entry reads as not-written via pagemap_hugetlb_category(), so reporting an unallocated hugetlb hole (which also reaches this path) as written would be inconsistent within the same VMA. hugetlb hole handling is left as-is. Add a pagemap_ioctl selftest that forms an anon THP, drops it with MADV_DONTNEED and checks the resulting PMD hole is reported written. Link: https://lore.kernel.org/20260708103429.150655-1-kirill@shutemov.name Fixes: 2bad466cc9d9 ("mm/uffd: UFFD_FEATURE_WP_UNPOPULATED") Signed-off-by: Kiryl Shutsemau <kas@kernel.org> Cc: Muhammad Usama Anjum <usama.anjum@collabora.com> Cc: Peter Xu <peterx@redhat.com> Cc: David Hildenbrand <david@kernel.org> Cc: Jann Horn <jannh@google.com> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Pedro Falcato <pfalcato@suse.de> Cc: Peter Xu <peterx@redhat.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Assisted-by: Claude:claude-fable-5 Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 hoursfs/proc/task_mmu: fix PAGEMAP_SCAN written state for unpopulated ptesKiryl Shutsemau (Meta)
PAGEMAP_SCAN reports an unpopulated pte differently depending on which path serves the request. The PAGE_IS_WRITTEN fast path in pagemap_scan_pmd_entry() reports a pte_none as written (and, under PM_SCAN_WP_MATCHING, arms a marker); pagemap_page_category() returns 0 for the same pte_none. A request that cannot take the fast path (an extra category bit, category_anyof_mask or category_inverted) therefore reports the pte as clean and skips arming it. A range that was populated and then MADV_DONTNEED'd reads as written via one mask and clean via another, and in the latter case is not re-armed for the next round -- an incremental-dump consumer (e.g. CRIU) using a richer mask drops the zapped range and stops tracking writes to it. Report pte_none as written in pagemap_page_category() too. A pte_none carries no uffd-wp marker, i.e. it is not write-protected -- the same condition under which the present and swap cases already report PAGE_IS_WRITTEN. The fast path applies no VMA test, so neither does this. The hugetlb and fully-unpopulated-PMD (no page table) scans have no PAGE_IS_WRITTEN fast path, so they do not exhibit the per-entry divergence and are left unchanged. Add a pagemap_ioctl selftest that populates a range, drops it with MADV_DONTNEED, and checks that the fast path and the generic (category_anyof_mask) path both report every page written. Link: https://lore.kernel.org/20260707151349.92143-1-kirill@shutemov.name Fixes: 12f6b01a0bcb ("fs/proc/task_mmu: add fast paths to get/clear PAGE_IS_WRITTEN flag") Signed-off-by: Kiryl Shutsemau <kas@kernel.org> Cc: Muhammad Usama Anjum <usama.anjum@collabora.com> Cc: David Hildenbrand <david@kernel.org> Cc: Jann Horn <jannh@google.com> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Pedro Falcato <pfalcato@suse.de> Cc: Peter Xu <peterx@redhat.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@kernel.org> Assisted-by: Claude:claude-fable-5 Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>