FAILED: patch "[PATCH] selftests/mm: skip soft-dirty tests when" failed to apply to 6.1-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 0389c305ef56cbadca4cbef44affc0ec3213ed30
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025101330-hemstitch-crimson-1681@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 0389c305ef56cbadca4cbef44affc0ec3213ed30 Mon Sep 17 00:00:00 2001
From: Lance Yang <[email protected]>
Date: Wed, 17 Sep 2025 21:31:37 +0800
Subject: [PATCH] selftests/mm: skip soft-dirty tests when
CONFIG_MEM_SOFT_DIRTY is disabled
The madv_populate and soft-dirty kselftests currently fail on systems where CONFIG_MEM_SOFT_DIRTY is disabled.
Introduce a new helper softdirty_supported() into vm_util.c/h to ensure tests are properly skipped when the feature is not enabled.
tools/testing/selftests/mm/madv_populate.c +2 -19
@@ -264,23 +264,6 @@ static void test_softdirty(void)munmap (addr,SIZE ); } -static int system_has_softdirty (void ) -{ -/* -* There is no way to check if the kernel supports soft-dirty, other -* than by writing to a page and seeing if the bit was set. But the -* tests are intended to check that the bit gets set when it should, so -* doing that check would turn a potentially legitimate fail into a -* skip. Fortunately, we know for sure that arm64 does not support -* soft-dirty. So for now, let's just use the arch as a corse guide. -*/ -#if defined(__aarch64__) -return 0 ; -#else -return 1 ; -#endif -} -int main (int argc,char **argv) {int nr_tests =16 ;
@@ -288,7 +271,7 @@ int main(int argc, char **argv) pagesize =getpagesize (); -if (system_has_softdirty ()) +if (softdirty_supported ()) nr_tests +=5 ;ksft_print_header ();
@@ -300,7 +283,7 @@ int main(int argc, char **argv)test_holes ();test_populate_read ();test_populate_write (); -if (system_has_softdirty ()) +if (softdirty_supported ())test_softdirty (); err =ksft_get_fail_cnt ();
tools/testing/selftests/mm/soft-dirty.c +4 -1
@@ -200,8 +200,11 @@ int main(int argc, char **argv)int pagesize;ksft_print_header (); -ksft_set_plan (15 ); +if (!softdirty_supported ()) +ksft_exit_skip ("soft-dirty is not support\n" ); + +ksft_set_plan (15 ); pagemap_fd =open (PAGEMAP_FILE_PATH ,O_RDONLY );if (pagemap_fd <0 )ksft_exit_fail_msg ("Failed to open %s\n" ,PAGEMAP_FILE_PATH );
tools/testing/selftests/mm/vm_util.c +17 -0
@@ -449,6 +449,23 @@ bool check_vmflag_pfnmap(void *addr)return check_vmflag (addr,"pf" ); } +bool softdirty_supported (void ) +{ +char *addr; +bool supported = false; +const size_t pagesize =getpagesize (); + +/* New mappings are expected to be marked with VM_SOFTDIRTY (sd). */ + addr =mmap (0 , pagesize,PROT_READ |PROT_WRITE , +MAP_ANONYMOUS |MAP_PRIVATE ,0 ,0 ); +if (!addr) +ksft_exit_fail_msg ("mmap failed\n" ); + + supported =check_vmflag (addr,"sd" ); +munmap (addr, pagesize); +return supported; +} +/* * Open an fd at /proc/$pid/maps and configure procmap_out ready for * PROCMAP_QUERY query. Returns 0 on success, or an error code otherwise.
tools/testing/selftests/mm/vm_util.h +1 -0
@@ -104,6 +104,7 @@ bool find_vma_procmap(struct procmap_fd *procmap, void *address);int close_procmap (struct procmap_fd *procmap);int write_sysfs (const char *file_path,unsigned long val);int read_sysfs (const char *file_path,unsigned long *val); +bool softdirty_supported (void );static inline int open_self_procmap (struct procmap_fd *procmap_out) {
PATCH 1/1 selftests/mm: skip soft-dirty tests when CONFIG_MEM_SOFT_DIRTY is disabled
From: Lance Yang <[email protected]>
The madv_populate and soft-dirty kselftests currently fail on systems where CONFIG_MEM_SOFT_DIRTY is disabled.
Introduce a new helper softdirty_supported() into vm_util.c/h to ensure tests are properly skipped when the feature is not enabled.
--- tools/testing/selftests/vm/madv_populate.c | 9 ++- tools/testing/selftests/vm/soft-dirty.c | 5 +- tools/testing/selftests/vm/vm_util.c | 77 ++++++++++++++++++++++ tools/testing/selftests/vm/vm_util.h | 2 + 4 files changed, 90 insertions(+), 3 deletions(-)
tools/testing/selftests/vm/madv_populate.c +7 -2
@@ -274,12 +274,16 @@ static void test_softdirty(void)int main (int argc,char **argv) { +int nr_tests =16 ;int err; pagesize =getpagesize (); +if (softdirty_supported ()) + nr_tests +=5 ; +ksft_print_header (); -ksft_set_plan (21 ); +ksft_set_plan (nr_tests);sense_support ();test_prot_read ();
@@ -287,7 +291,8 @@ int main(int argc, char **argv)test_holes ();test_populate_read ();test_populate_write (); -test_softdirty (); +if (softdirty_supported ()) +test_softdirty (); err =ksft_get_fail_cnt ();if (err)
tools/testing/selftests/vm/soft-dirty.c +4 -1
@@ -190,8 +190,11 @@ int main(int argc, char **argv)int pagesize;ksft_print_header (); -ksft_set_plan (15 ); +if (!softdirty_supported ()) +ksft_exit_skip ("soft-dirty is not support\n" ); + +ksft_set_plan (15 ); pagemap_fd =open (PAGEMAP_FILE_PATH ,O_RDONLY );if (pagemap_fd <0 )ksft_exit_fail_msg ("Failed to open %s\n" ,PAGEMAP_FILE_PATH );
tools/testing/selftests/vm/vm_util.c +77 -0
86 lines not on this page · raw message
tools/testing/selftests/vm/vm_util.h +2 -0
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 */ #include <stdint.h> #include <stdbool.h> +#include <sys/mman.h> uint64_t pagemap_get_entry (int fd,char *start);bool pagemap_is_softdirty (int fd,char *start);
@@ -10,3 +11,4 @@ uint64_t read_pmd_pagesize(void);bool check_huge_anon (void *addr,int nr_hpages,uint64_t hpage_size);bool check_huge_file (void *addr,int nr_hpages,uint64_t hpage_size);bool check_huge_shmem (void *addr,int nr_hpages,uint64_t hpage_size); +bool softdirty_supported (void );
Signature · 1 line
2.49.0